Initial commit
This commit is contained in:
1
engines/tetraedge/POTFILES
Normal file
1
engines/tetraedge/POTFILES
Normal file
@@ -0,0 +1 @@
|
||||
engines/tetraedge/metaengine.cpp
|
||||
3
engines/tetraedge/configure.engine
Normal file
3
engines/tetraedge/configure.engine
Normal file
@@ -0,0 +1,3 @@
|
||||
# This file is included from the main "configure" script
|
||||
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
|
||||
add_engine tetraedge "Tetraedge" yes "" "" "highres 3d freetype2 vorbis png jpeg lua theoradec" "tinygl"
|
||||
3
engines/tetraedge/credits.pl
Normal file
3
engines/tetraedge/credits.pl
Normal file
@@ -0,0 +1,3 @@
|
||||
begin_section("Tetraedge");
|
||||
add_person("Matthew Duggan", "stauff", "");
|
||||
end_section();
|
||||
70
engines/tetraedge/detection.cpp
Normal file
70
engines/tetraedge/detection.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/detection.h"
|
||||
#include "tetraedge/metaengine.h"
|
||||
#include "tetraedge/detection_tables.h"
|
||||
|
||||
const DebugChannelDef TetraedgeMetaEngineDetection::debugFlagList[] = {
|
||||
{ Tetraedge::kDebugGraphics, "Graphics", "Graphics debug level" },
|
||||
{ Tetraedge::kDebugPath, "Path", "Pathfinding debug level" },
|
||||
{ Tetraedge::kDebugFilePath, "FilePath", "File path debug level" },
|
||||
{ Tetraedge::kDebugScan, "Scan", "Scan for unrecognised games" },
|
||||
{ Tetraedge::kDebugScript, "Script", "Enable debug script dump" },
|
||||
DEBUG_CHANNEL_END
|
||||
};
|
||||
|
||||
TetraedgeMetaEngineDetection::TetraedgeMetaEngineDetection() : AdvancedMetaEngineDetection(Tetraedge::GAME_DESCRIPTIONS,
|
||||
Tetraedge::GAME_NAMES) {
|
||||
_flags = kADFlagMatchFullPaths;
|
||||
}
|
||||
|
||||
static const Common::Language *getGameLanguages() {
|
||||
static const Common::Language languages[] = {
|
||||
Common::EN_ANY,
|
||||
Common::FR_FRA,
|
||||
Common::DE_DEU,
|
||||
Common::IT_ITA,
|
||||
Common::ES_ESP,
|
||||
Common::RU_RUS,
|
||||
Common::HE_ISR, // This is a Fan-translation, which requires additional patch
|
||||
Common::JA_JPN,
|
||||
Common::PL_POL,
|
||||
Common::UNK_LANG
|
||||
};
|
||||
return languages;
|
||||
}
|
||||
|
||||
DetectedGame TetraedgeMetaEngineDetection::toDetectedGame(const ADDetectedGame &adGame, ADDetectedGameExtraInfo *extraInfo) const {
|
||||
DetectedGame game = AdvancedMetaEngineDetection::toDetectedGame(adGame);
|
||||
|
||||
// The AdvancedDetector model only allows specifying a single supported
|
||||
// game language. All games support multiple languages. Only Syberia 1
|
||||
// supports RU.
|
||||
for (const Common::Language *language = getGameLanguages(); *language != Common::UNK_LANG; language++) {
|
||||
game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(*language));
|
||||
}
|
||||
|
||||
return game;
|
||||
}
|
||||
|
||||
|
||||
REGISTER_PLUGIN_STATIC(TETRAEDGE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, TetraedgeMetaEngineDetection);
|
||||
73
engines/tetraedge/detection.h
Normal file
73
engines/tetraedge/detection.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_DETECTION_H
|
||||
#define TETRAEDGE_DETECTION_H
|
||||
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
enum TetraedgeDebugChannels {
|
||||
kDebugGraphics = 1,
|
||||
kDebugPath,
|
||||
kDebugScan,
|
||||
kDebugFilePath,
|
||||
kDebugScript,
|
||||
};
|
||||
|
||||
enum GameFeatures {
|
||||
GF_UTF8 = 1 << 0,
|
||||
};
|
||||
|
||||
extern const PlainGameDescriptor GAME_NAMES[];
|
||||
|
||||
extern const ADGameDescription GAME_DESCRIPTIONS[];
|
||||
|
||||
} // namespace Tetraedge
|
||||
|
||||
class TetraedgeMetaEngineDetection : public AdvancedMetaEngineDetection<ADGameDescription> {
|
||||
static const DebugChannelDef debugFlagList[];
|
||||
|
||||
public:
|
||||
TetraedgeMetaEngineDetection();
|
||||
~TetraedgeMetaEngineDetection() override {}
|
||||
|
||||
DetectedGame toDetectedGame(const ADDetectedGame &adGame, ADDetectedGameExtraInfo *extraInfo) const override;
|
||||
|
||||
const char *getEngineName() const override {
|
||||
return "Tetraedge Engine";
|
||||
}
|
||||
|
||||
const char *getName() const override {
|
||||
return "tetraedge";
|
||||
}
|
||||
|
||||
const char *getOriginalCopyright() const override {
|
||||
return "(C) Microids";
|
||||
}
|
||||
|
||||
const DebugChannelDef *getDebugChannels() const override {
|
||||
return debugFlagList;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
309
engines/tetraedge/detection_tables.h
Normal file
309
engines/tetraedge/detection_tables.h
Normal file
@@ -0,0 +1,309 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
const PlainGameDescriptor GAME_NAMES[] = {
|
||||
{ "amerzone", "Amerzone" },
|
||||
{ "syberia", "Syberia" },
|
||||
{ "syberia2", "Syberia II" },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
const ADGameDescription GAME_DESCRIPTIONS[] = {
|
||||
// Amerzone GOG release
|
||||
{
|
||||
"amerzone",
|
||||
nullptr,
|
||||
AD_ENTRY1s("MacOS/Amerzone", "d:cde4144aeea5a99602ee903554585178", 6380272),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformMacintosh,
|
||||
ADGF_UNSTABLE,
|
||||
GUIO0()
|
||||
},
|
||||
|
||||
// Amerzone Android release
|
||||
{
|
||||
"amerzone",
|
||||
nullptr,
|
||||
AD_ENTRY1s("main.1.com.microids.amerzone.obb", "7f84b8030e523f999fcc77351bf86d8a", 646128261),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_UNSTABLE,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// GOG and Steam releases
|
||||
// Note: Full sum of GOG and Steam are different,
|
||||
// but size and first 5000 bytes are the same.
|
||||
{
|
||||
"syberia",
|
||||
nullptr,
|
||||
AD_ENTRY1s("MacOS/Syberia", "d:6951fb8f71fe06f34684564625f73cd8", 10640592),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformMacintosh,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO2(GAMEOPTION_CORRECT_MOVIE_ASPECT, GAMEOPTION_RESTORE_SCENES)
|
||||
},
|
||||
|
||||
// iOS "free" release v1.1.3. Not supported as we can't properly support
|
||||
// the in-app purchase to enable the full game.
|
||||
{
|
||||
"syberia",
|
||||
nullptr,
|
||||
AD_ENTRY1s("Syberia", "d:be658efbcf4541f56b656f92a05d271a", 15821120),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformIOS,
|
||||
ADGF_UNSUPPORTED | ADGF_DEMO,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// iOS paid release v1.2. Not yet tested.
|
||||
{
|
||||
"syberia",
|
||||
nullptr,
|
||||
AD_ENTRY1s("Syberia", "d:1425707556476013e859979562c5d753", 15794272),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformIOS,
|
||||
ADGF_UNSTABLE,
|
||||
GUIO2(GAMEOPTION_CORRECT_MOVIE_ASPECT, GAMEOPTION_RESTORE_SCENES)
|
||||
},
|
||||
|
||||
// Nintendo Switch, from Syberia1-3 cartridge
|
||||
{
|
||||
"syberia",
|
||||
nullptr,
|
||||
AD_ENTRY2s("InGame.lua", "acaf61504a12aebf3862648e04cf29aa", 3920,
|
||||
"texts/de.xml", "14681ac50bbfa50427058d2793b415eb", (uint32_t)-1),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformNintendoSwitch,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
{
|
||||
"syberia2",
|
||||
nullptr,
|
||||
AD_ENTRY3s("Debug.lua", "a2ea493892e96bea64013819195c081e", 7024,
|
||||
"InGame.lua", "a7df110fe816cb342574150c6f992964", 4654,
|
||||
"texts/de.xml", "dabad822a917b1f87de8f09eadc3ec85", (uint32_t)-1),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformNintendoSwitch,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// Nintendo Switch, from Syberia1+2 Online bundle, v0
|
||||
{
|
||||
"syberia",
|
||||
nullptr,
|
||||
AD_ENTRY2s("InGame.lua", "ca319e6f014d04baaf1e77f13f89b44f", 4271,
|
||||
"texts/de.xml", "14681ac50bbfa50427058d2793b415eb", (uint32_t)-1),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformNintendoSwitch,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// Nintendo Switch, from Syberia1+2 Online bundle, v196608
|
||||
{
|
||||
"syberia",
|
||||
nullptr,
|
||||
AD_ENTRY2s("InGame.lua", "ca319e6f014d04baaf1e77f13f89b44f", 4271,
|
||||
"texts/de.xml", "17d7a875e81a7761d2b30698bd947c15", (uint32_t)-1),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformNintendoSwitch,
|
||||
ADGF_NO_FLAGS | GF_UTF8,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
{
|
||||
"syberia2",
|
||||
nullptr,
|
||||
AD_ENTRY3s("Debug.lua", "a2ea493892e96bea64013819195c081e", 7024,
|
||||
"InGame.lua", "7d7fdb9005675618220e7cd8962c6482", 4745,
|
||||
"texts/de.xml", "78ed3567b3621459229f39c03132e5bb", (uint32_t)-1),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformNintendoSwitch,
|
||||
ADGF_NO_FLAGS | GF_UTF8,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// Android v1.0.5
|
||||
{
|
||||
"syberia",
|
||||
"Extracted",
|
||||
AD_ENTRY1s("InGame.lua", "12ee6a8eade070b905136cd4cdfc3726", 4471),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
{
|
||||
"syberia",
|
||||
nullptr,
|
||||
AD_ENTRY1s("main.12.com.microids.syberia.obb", "b82f9295c4bafe4af58450cbacfd261e", 1000659045),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// Buka release v1.0.3
|
||||
{
|
||||
"syberia",
|
||||
"Extracted",
|
||||
AD_ENTRY1s("InGame.lua", "6577b0151ca4532e94a63a91c22a17c1", 2646),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
{
|
||||
"syberia",
|
||||
nullptr,
|
||||
AD_ENTRY1s("main.2.ru.buka.syberia1.obb", "7af875e74acfceee5d9b78c705da212e", 771058907),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// v1.0.1
|
||||
{
|
||||
"syberia",
|
||||
nullptr,
|
||||
AD_ENTRY1s("main.5.com.microids.syberia.obb", "6a39b40edca885bb9508ec09675c1923", 1389534445),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
{
|
||||
"syberia",
|
||||
"Extracted",
|
||||
AD_ENTRY1s("InGame.lua", "8698770015e103725db60a65f3e21657", 2478),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
{
|
||||
"syberia",
|
||||
nullptr,
|
||||
AD_ENTRY1s("InGame.data", "5cb78f2c8aac837fe53596ecfe921b38", 2195),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformPS3,
|
||||
ADGF_UNSUPPORTED,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// v1.0.2 Buka release
|
||||
{
|
||||
"syberia2",
|
||||
nullptr,
|
||||
AD_ENTRY1s("main.2.ru.buka.syberia2.obb", "e9d8516610d33f375a3f6800232e3224", 1038859725),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
{
|
||||
"syberia2",
|
||||
"Extracted",
|
||||
AD_ENTRY2s("Debug.lua", "a2ea493892e96bea64013819195c081e", 7024,
|
||||
"filelist.bin", "eb189789a74286c5023e102ec1c44fd4", 2099822),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// v1.0.1 Android release
|
||||
{
|
||||
"syberia2",
|
||||
nullptr,
|
||||
AD_ENTRY1s("main.4.com.microids.syberia2.obb", "d8aa60562ffad83d3bcaa7b611fc4299", 1473221971),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
{
|
||||
"syberia2",
|
||||
"Extracted",
|
||||
AD_ENTRY2s("Debug.lua", "a2ea493892e96bea64013819195c081e", 7024,
|
||||
"filelist.bin", "dc40f150ee291a30e0bc6cd8a0127aab", 2100007),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformAndroid,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// v1.0.0 iOS release
|
||||
{
|
||||
"syberia2",
|
||||
nullptr,
|
||||
AD_ENTRY2s("Debug.lua", "a2ea493892e96bea64013819195c081e", 7024,
|
||||
"Info.plist", nullptr, (uint32_t)-1),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformIOS,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
|
||||
// GOG release
|
||||
{
|
||||
"syberia2",
|
||||
nullptr,
|
||||
AD_ENTRY1s("MacOS/Syberia 2", "d:c447586a3cb3d46d6127b467e7fb9a86", 12021136),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformMacintosh,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
// iOS release v1.0.1. Not yet tested.
|
||||
{
|
||||
"syberia2",
|
||||
nullptr,
|
||||
AD_ENTRY1s("Syberia 2", "d:17d0ded9b87b5096207117bf0cfb5138", 15881248),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformIOS,
|
||||
ADGF_UNSTABLE,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
{
|
||||
"syberia2",
|
||||
nullptr,
|
||||
AD_ENTRY1s("Debug.data", "d5cfcba9b725e746df39109e7e1b0564", 7024),
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformPS3,
|
||||
ADGF_UNSUPPORTED,
|
||||
GUIO1(GAMEOPTION_CORRECT_MOVIE_ASPECT)
|
||||
},
|
||||
|
||||
AD_TABLE_END_MARKER
|
||||
};
|
||||
|
||||
} // namespace Tetraedge
|
||||
597
engines/tetraedge/game/amerzone_game.cpp
Normal file
597
engines/tetraedge/game/amerzone_game.cpp
Normal file
@@ -0,0 +1,597 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/savefile.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/amerzone_game.h"
|
||||
#include "tetraedge/game/lua_binds.h"
|
||||
#include "tetraedge/te/te_core.h"
|
||||
#include "tetraedge/te/te_input_mgr.h"
|
||||
#include "tetraedge/te/te_renderer.h"
|
||||
#include "tetraedge/te/te_scene_warp.h"
|
||||
#include "tetraedge/te/te_sound_manager.h"
|
||||
#include "tetraedge/te/te_warp.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
AmerzoneGame::AmerzoneGame() : Tetraedge::Game(), _orientationX(0.0f), _orientationY(0.0f),
|
||||
_speedX(0.0f), _speedY(0.0f), _isInDrag(false), _edgeButtonRolloverCount(0),
|
||||
_warpX(nullptr), _warpY(nullptr), _prevWarpY(nullptr),
|
||||
_xAngleMin(0.0f), _xAngleMax(0.0f), _yAngleMin(0.0f), _yAngleMax(0.0f),
|
||||
_puzzleNo(-1), _puzParam1(-1), _puzParam2(-1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AmerzoneGame::addToBag(const Common::String &objname) {
|
||||
inventory().addObject(objname);
|
||||
// TODO: set this once _puzzleDisjoncteur is created
|
||||
//if (objname == "A_Fil_cuivre_jour")
|
||||
// _puzzleDisjoncteur.addState(2);
|
||||
|
||||
_notifier.push("<section style=\"center\" /><color r=\"0\" g=\"0\" b=\"0\"/><font file=\"Common/Fonts/Arial_r_16.tef\" />" + inventory().objectName(objname), "");
|
||||
}
|
||||
|
||||
void AmerzoneGame::changeSpeedToMouseDirection() {
|
||||
error("TODO: Implement AmerzoneGame::changeSpeedToMouseDirection");
|
||||
}
|
||||
|
||||
bool AmerzoneGame::changeWarp(const Common::String &rawZone, const Common::String &scene, bool fadeFlag) {
|
||||
if (_warpY) {
|
||||
_luaScript.execute("OnWarpLeave");
|
||||
_warpY->markerValidatedSignal().remove(this, &AmerzoneGame::onObjectClick);
|
||||
_warpY->animFinishedSignal().remove(this, &AmerzoneGame::onAnimationFinished);
|
||||
saveBackup("save.xml");
|
||||
_videoMusic.stop();
|
||||
}
|
||||
_prevWarpY = _warpY;
|
||||
_warpY = nullptr;
|
||||
|
||||
Application *app = g_engine->getApplication();
|
||||
TeCore *core = g_engine->getCore();
|
||||
|
||||
// TODO: There is a bunch of stuff here to cache the warp zone.
|
||||
// Just reload each time for now.
|
||||
if (!_warpY) {
|
||||
_warpY = new TeWarp();
|
||||
_warpY->setRotation(app->frontLayout().rotation());
|
||||
_warpY->init();
|
||||
float fov = 60.0f; //TODO: g_engine->getCore()->fileFlagSystemFlagsContains("HD") ? 60.0f : 45.0f;
|
||||
_warpY->setFov((float)(fov * M_PI / 180.0));
|
||||
}
|
||||
|
||||
Common::Path zone;
|
||||
if (rawZone.contains('\\')) {
|
||||
// Split path components on '\'
|
||||
zone = Common::Path(rawZone, '\\');
|
||||
} else {
|
||||
zone = Common::Path(rawZone, '/');
|
||||
}
|
||||
|
||||
_warpY->load(zone, false);
|
||||
_warpY->setVisible(true, false);
|
||||
TeWarp::debug = false;
|
||||
_warpY->activeMarkers(app->permanentHelp());
|
||||
_warpY->animFinishedSignal().add(this, &AmerzoneGame::onAnimationFinished);
|
||||
_luaContext.removeGlobal("OnWarpEnter");
|
||||
_luaContext.removeGlobal("OnWarpLeave");
|
||||
_luaContext.removeGlobal("OnWarpObjectHit");
|
||||
_luaContext.removeGlobal("OnMovieFinished");
|
||||
_luaContext.removeGlobal("OnAnimationFinished");
|
||||
_luaContext.removeGlobal("OnDialogFinished");
|
||||
_luaContext.removeGlobal("OnDocumentClosed");
|
||||
_luaContext.removeGlobal("OnPuzzleWon");
|
||||
|
||||
for (uint i = 0; i < _gameSounds.size(); i++) {
|
||||
_gameSounds[i]->stop();
|
||||
_gameSounds[i]->deleteLater();
|
||||
}
|
||||
_gameSounds.clear();
|
||||
|
||||
Common::String sceneXml = zone.baseName();
|
||||
size_t dotpos = sceneXml.rfind('.');
|
||||
if (dotpos != Common::String::npos)
|
||||
sceneXml = sceneXml.substr(0, dotpos);
|
||||
sceneXml += ".xml";
|
||||
TeSceneWarp sceneWarp;
|
||||
sceneWarp.load(zone.getParent().appendComponent(sceneXml), _warpY, false);
|
||||
|
||||
// NOTE: Original uses FLT_MAX here but that can cause overflows, just use a big number.
|
||||
_xAngleMin = 1e8;
|
||||
_xAngleMax = 1e8;
|
||||
_yAngleMin = 45.0f - _orientationY;
|
||||
_yAngleMax = _orientationY + 55.0f;
|
||||
|
||||
dotpos = sceneXml.rfind('.');
|
||||
Common::String sceneLua = sceneXml.substr(0, dotpos) + ".lua";
|
||||
_luaScript.load(core->findFile(zone.getParent().appendComponent(sceneLua)));
|
||||
_luaScript.execute();
|
||||
_luaScript.execute("OnWarpEnter");
|
||||
if (fadeFlag) {
|
||||
startChangeWarpAnim();
|
||||
} else {
|
||||
onChangeWarpAnimFinished();
|
||||
}
|
||||
|
||||
_currentZone = rawZone;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AmerzoneGame::draw() {
|
||||
if (!_running)
|
||||
return;
|
||||
if (_warpX)
|
||||
_warpX->render();
|
||||
if (_warpY)
|
||||
_warpY->render();
|
||||
}
|
||||
|
||||
void AmerzoneGame::enter() {
|
||||
if (_entered)
|
||||
return;
|
||||
Application *app = g_engine->getApplication();
|
||||
// TODO:
|
||||
//_puzzleDisjoncteur.setState(5);
|
||||
_inGameGui.load("GUI/InGame.lua");
|
||||
|
||||
TeLayout *inGame = _inGameGui.layoutChecked("inGame");
|
||||
app->frontLayout().addChild(inGame);
|
||||
// DocumentsBrowser and Inventory get added as children of InventoryMenu
|
||||
_inventoryMenu.load();
|
||||
app->frontLayout().addChild(&_inventoryMenu);
|
||||
|
||||
TeButtonLayout *invbtn = _inGameGui.buttonLayoutChecked("inventoryButton");
|
||||
invbtn->onMouseClickValidated().add(this, &AmerzoneGame::onInventoryButtonValidated);
|
||||
TeButtonLayout *helpbtn = _inGameGui.buttonLayoutChecked("helpButton");
|
||||
helpbtn->onMouseClickValidated().add(this, &AmerzoneGame::onHelpButtonValidated);
|
||||
if (app->permanentHelp()) {
|
||||
helpbtn->setVisible(false);
|
||||
}
|
||||
TeButtonLayout *skipvidbtn = _inGameGui.buttonLayoutChecked("skipVideoButton");
|
||||
skipvidbtn->setVisible(false);
|
||||
skipvidbtn->onMouseClickValidated().add(this, &AmerzoneGame::onSkipVideoButtonValidated);
|
||||
|
||||
TeButtonLayout *vidbgbtn = _inGameGui.buttonLayoutChecked("videoBackgroundButton");
|
||||
vidbgbtn->setVisible(false);
|
||||
vidbgbtn->onMouseClickValidated().remove(this, &AmerzoneGame::onLockVideoButtonValidated);
|
||||
vidbgbtn->onMouseClickValidated().add(this, &AmerzoneGame::onLockVideoButtonValidated);
|
||||
|
||||
TeSpriteLayout *vid = _inGameGui.spriteLayoutChecked("video");
|
||||
vid->_tiledSurfacePtr->_frameAnim.onStop().add(this, &Game::onVideoFinished);
|
||||
vid->setVisible(false);
|
||||
_dialog2.load();
|
||||
app->frontLayout().addChild(&_dialog2);
|
||||
_question2.load();
|
||||
|
||||
TeInputMgr *inputMgr = g_engine->getInputMgr();
|
||||
inputMgr->_mouseMoveSignal.add(this, &AmerzoneGame::onMouseMove);
|
||||
// Left up should be max priority to make sure drags are always finished even if event
|
||||
// is over button.
|
||||
inputMgr->_mouseLUpSignal.push_back(TeICallback1ParamPtr<const Common::Point &>(new TeCallback1Param<AmerzoneGame,
|
||||
const Common::Point &>(this, &AmerzoneGame::onMouseLeftUp, FLT_MAX)));
|
||||
inputMgr->_mouseLDownSignal.add(this, &AmerzoneGame::onMouseLeftDown);
|
||||
|
||||
_orientationX = 0;
|
||||
_orientationY = 0;
|
||||
_isInDrag = false;
|
||||
_speedX = 0;
|
||||
_speedY = 0;
|
||||
|
||||
_notifier.load();
|
||||
_warpX = new TeWarp();
|
||||
_warpX->setRotation(app->frontLayout().rotation());
|
||||
_warpX->init();
|
||||
float fov = 60.0f; //TODO: g_engine->getCore()->fileFlagSystemFlagsContains("HD") ? 60.0f : 45.0f;
|
||||
_warpX->setFov((float)(fov * M_PI / 180.0));
|
||||
_warpX->setVisible(true, false);
|
||||
_luaContext.create();
|
||||
_luaScript.attachToContext(&_luaContext);
|
||||
|
||||
// Game also sets up fade sprites, which is set up in Game.
|
||||
|
||||
_running = true;
|
||||
_playedTimer.start();
|
||||
_edgeButtonRolloverCount = 0;
|
||||
|
||||
initLoadedBackupData();
|
||||
_entered = true;
|
||||
}
|
||||
|
||||
void AmerzoneGame::finishGame() {
|
||||
// Skip the animations of the original.
|
||||
// This is more like OnGameFinishedRotateAnimFinished.
|
||||
leave(true);
|
||||
Application *app = g_engine->getApplication();
|
||||
app->mainMenu().enter();
|
||||
}
|
||||
|
||||
// This is actually GameWarp::Load
|
||||
void AmerzoneGame::initLoadedBackupData() {
|
||||
_luaContext.destroy();
|
||||
_luaContext.create();
|
||||
_luaContext.addBindings(LuaBinds::LuaOpenBinds);
|
||||
Application *app = g_engine->getApplication();
|
||||
if (!_loadName.empty()) {
|
||||
Common::InSaveFile *saveFile = g_engine->getSaveFileManager()->openForLoading(_loadName);
|
||||
Common::Error result = g_engine->loadGameStream(saveFile);
|
||||
if (result.getCode() == Common::kNoError) {
|
||||
ExtendedSavegameHeader header;
|
||||
if (MetaEngine::readSavegameHeader(saveFile, &header))
|
||||
g_engine->setTotalPlayTime(header.playtime);
|
||||
}
|
||||
changeWarp(_currentZone, "", false);
|
||||
} else {
|
||||
changeWarp(app->firstWarpPath(), app->firstScene(), true);
|
||||
}
|
||||
}
|
||||
|
||||
void AmerzoneGame::isInDrag(bool inDrag) {
|
||||
const Common::Point mousePt = g_engine->getInputMgr()->lastMousePos();
|
||||
if (inDrag != _isInDrag) {
|
||||
_isInDrag = inDrag;
|
||||
g_system->lockMouse(inDrag);
|
||||
if (inDrag) {
|
||||
// Start drag operation
|
||||
_mouseDragStart = mousePt;
|
||||
_mouseDragLast = mousePt;
|
||||
_decelAnimX.stop();
|
||||
_decelAnimY.stop();
|
||||
_dragTimer.stop();
|
||||
_dragTimer.start();
|
||||
} else {
|
||||
// Finish drag operation
|
||||
_dragTimer.timeElapsed();
|
||||
Application *app = g_engine->getApplication();
|
||||
TeVector3f32 mouseDir(mousePt.x - _mouseDragLast.x, mousePt.y - _mouseDragLast.y, 0);
|
||||
if (app->inverseLook())
|
||||
mouseDir = mouseDir * -1.0f;
|
||||
const TeMatrix4x4 layoutRot = app->frontLayout().rotation().toTeMatrix();
|
||||
TeVector3f32 dest = layoutRot * mouseDir;
|
||||
dest.x() /= 2;
|
||||
dest.y() /= 2;
|
||||
_speedX = CLIP(dest.x(), -10000.0f, 10000.0f);
|
||||
_speedY = CLIP(dest.y(), -10000.0f, 10000.0f);
|
||||
startDecelerationAnim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AmerzoneGame::leave(bool flag) {
|
||||
_inGameGui.unload();
|
||||
_question2.unload();
|
||||
Application *app = g_engine->getApplication();
|
||||
app->frontLayout().removeChild(&_dialog2);
|
||||
_dialog2.unload();
|
||||
if (_warpX) {
|
||||
delete _warpX;
|
||||
_warpX = nullptr;
|
||||
}
|
||||
if (_warpY) {
|
||||
saveBackup("save.xml");
|
||||
}
|
||||
app->frontLayout().removeChild(&_inventoryMenu);
|
||||
_inventoryMenu.unload();
|
||||
|
||||
// TODO: game does this.. doesn't this leak?
|
||||
_warpY = nullptr;
|
||||
_prevWarpY = nullptr;
|
||||
|
||||
// TODO: Game goes through a list of (cached?) warps here to clean up.
|
||||
warning("TODO: Finish AmerzoneGame::leave");
|
||||
|
||||
_notifier.unload();
|
||||
_luaContext.destroy();
|
||||
_running = false;
|
||||
_playedTimer.stop();
|
||||
_videoMusic.stop();
|
||||
}
|
||||
|
||||
bool AmerzoneGame::onChangeWarpAnimFinished() {
|
||||
if (_prevWarpY) {
|
||||
// TODO: remove callback from movement3
|
||||
_prevWarpY->setVisible(false, true);
|
||||
_prevWarpY->clear();
|
||||
_prevWarpY = nullptr;
|
||||
// TODO: set fade sprite not visible here?
|
||||
//error("TODO: Finish AmerzoneGame::onChangeWarpAnimFinished");
|
||||
}
|
||||
_warpY->markerValidatedSignal().add(this, &AmerzoneGame::onObjectClick);
|
||||
optimizeWarpResources();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AmerzoneGame::onHelpButtonValidated() {
|
||||
g_engine->getSoundManager()->playFreeSound("Sounds/SFX/Clic_prec-suiv.ogg");
|
||||
|
||||
bool active = true;
|
||||
TeWarp::debug = TeWarp::debug == false;
|
||||
if (!TeWarp::debug && !g_engine->getApplication()->permanentHelp())
|
||||
active = false;
|
||||
|
||||
_warpY->activeMarkers(active);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AmerzoneGame::onAnimationFinished(const Common::String &anim) {
|
||||
_luaScript.execute("OnAnimationFinished", anim);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AmerzoneGame::onMouseLeftUp(const Common::Point &pt) {
|
||||
_warpY->setMouseLeftUpForMakers();
|
||||
TeVector3f32 offset = TeVector3f32(pt - _mouseDragStart);
|
||||
if (offset.length() > 20.0f)
|
||||
_warpY->checkObjectEvents();
|
||||
isInDrag(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AmerzoneGame::onMouseLeftDown(const Common::Point &pt) {
|
||||
isInDrag(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AmerzoneGame::onObjectClick(const Common::String &obj) {
|
||||
_lastHitObjectName = obj;
|
||||
_luaScript.execute("OnWarpObjectHit", obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AmerzoneGame::onPuzzleEnterAnimLoadTime() {
|
||||
TeLayout *ingame = _inGameGui.layoutChecked("inGame");
|
||||
float zoff = ingame->zSize();
|
||||
switch(_puzzleNo) {
|
||||
case 0:
|
||||
_puzzleComputerPwd.setScale(TeVector3f32(1, 1, 0.0001f));
|
||||
_puzzleComputerPwd.setPosition(TeVector3f32(0, 0, zoff));
|
||||
_puzzleComputerPwd.enter();
|
||||
break;
|
||||
case 1:
|
||||
_puzzleComputerHydra.setScale(TeVector3f32(1, 1, 0.0001f));
|
||||
_puzzleComputerHydra.setPosition(TeVector3f32(0, 0, zoff));
|
||||
_puzzleComputerHydra.setTargetCoordinates(1, 4, 5);
|
||||
_puzzleComputerHydra.enter();
|
||||
break;
|
||||
case 2:
|
||||
_puzzleComputerHydra.setScale(TeVector3f32(1, 1, 0.0001f));
|
||||
_puzzleComputerHydra.setPosition(TeVector3f32(0, 0, zoff));
|
||||
_puzzleComputerHydra.setTargetCoordinates(2, 2, 7);
|
||||
_puzzleComputerHydra.enter();
|
||||
break;
|
||||
case 3:
|
||||
_puzzleHanjie.setScale(TeVector3f32(1, 1, 0.0001f));
|
||||
_puzzleHanjie.setPosition(TeVector3f32(0, 0, zoff));
|
||||
_puzzleHanjie.wakeUp();
|
||||
break;
|
||||
case 4:
|
||||
_puzzlePentacle.setScale(TeVector3f32(1, 1, 0.0001f));
|
||||
_puzzlePentacle.setPosition(TeVector3f32(0, 0, zoff));
|
||||
_puzzlePentacle.wakeUp(_puzParam1, _puzParam2);
|
||||
break;
|
||||
case 5:
|
||||
_puzzleDisjoncteur.setScale(TeVector3f32(1, 1, 0.0001f));
|
||||
_puzzleDisjoncteur.setPosition(TeVector3f32(0, 0, zoff));
|
||||
_puzzleDisjoncteur.wakeUp();
|
||||
break;
|
||||
case 6:
|
||||
_puzzleLiquides.setScale(TeVector3f32(1, 1, 0.0001f));
|
||||
_puzzleLiquides.setPosition(TeVector3f32(0, 0, zoff));
|
||||
_puzzleLiquides.wakeUp();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void AmerzoneGame::optimizeWarpResources() {
|
||||
// Note: original calls this OptimizeWarpRessources
|
||||
warning("TODO: Implement AmerzoneGame::optimizeWarpResources");
|
||||
}
|
||||
|
||||
void AmerzoneGame::setAngleX(float angle) {
|
||||
float diff = angle - _orientationX;
|
||||
float distFromMin = _xAngleMin - diff;
|
||||
if (distFromMin < 0)
|
||||
angle += distFromMin;
|
||||
float distFromMax = diff + _xAngleMax;
|
||||
if (distFromMax < 0)
|
||||
angle -= distFromMax;
|
||||
|
||||
diff = angle - _orientationX;
|
||||
_xAngleMin -= diff;
|
||||
_xAngleMax += diff;
|
||||
|
||||
float roundedAngle = angle - (int)(angle / 360.0f) * 360;
|
||||
_orientationX = roundedAngle;
|
||||
if (roundedAngle > 360.0f || roundedAngle < -360.0f)
|
||||
_orientationX = 0;
|
||||
}
|
||||
|
||||
void AmerzoneGame::setAngleY(float angle) {
|
||||
float diff = angle - _orientationY;
|
||||
float distFromMin = _yAngleMin - diff;
|
||||
if (distFromMin < 0)
|
||||
angle += distFromMin;
|
||||
float distFromMax = diff + _yAngleMax;
|
||||
if (distFromMax < 0)
|
||||
angle -= distFromMax;
|
||||
|
||||
diff = angle - _orientationY;
|
||||
_yAngleMin -= diff;
|
||||
_yAngleMax += diff;
|
||||
|
||||
_orientationY = CLIP(angle, -55.0f, 45.0f);
|
||||
}
|
||||
|
||||
void AmerzoneGame::showPuzzle(int puzzleNo, int puzParam1, int puzParam2) {
|
||||
_puzzleNo = puzzleNo;
|
||||
_puzParam1 = puzParam1;
|
||||
_puzParam2 = puzParam2;
|
||||
onPuzzleEnterAnimLoadTime();
|
||||
}
|
||||
|
||||
|
||||
void AmerzoneGame::speedX(const float &speed) {
|
||||
_speedX = CLIP(speed, -10000.0f, 10000.0f);
|
||||
}
|
||||
|
||||
void AmerzoneGame::speedY(const float &speed) {
|
||||
_speedY = CLIP(speed, -10000.0f, 10000.0f);
|
||||
}
|
||||
|
||||
void AmerzoneGame::startChangeWarpAnim() {
|
||||
_warpX->update();
|
||||
_warpY->update();
|
||||
if (_prevWarpY == nullptr) {
|
||||
onChangeWarpAnimFinished();
|
||||
} else {
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
renderer->clearBuffer(TeRenderer::ColorBuffer);
|
||||
renderer->clearBuffer(TeRenderer::DepthBuffer);
|
||||
|
||||
// Original does null checks here but they are pointless as both
|
||||
// are already used above.
|
||||
_warpX->render();
|
||||
_prevWarpY->render();
|
||||
|
||||
// This is a much simpler version of what the original does
|
||||
// as it reuses the fade code.
|
||||
g_engine->getApplication()->captureFade();
|
||||
_prevWarpY->unloadTextures();
|
||||
g_engine->getApplication()->visualFade().animateFadeWithZoom();
|
||||
}
|
||||
}
|
||||
|
||||
void AmerzoneGame::startDecelerationAnim() {
|
||||
_decelAnimX.stop();
|
||||
_decelAnimY.stop();
|
||||
|
||||
Common::Array<float> curve;
|
||||
curve.push_back(0);
|
||||
curve.push_back(0.35f);
|
||||
curve.push_back(0.68f);
|
||||
curve.push_back(0.85f);
|
||||
curve.push_back(0.93f);
|
||||
curve.push_back(0.97f);
|
||||
curve.push_back(1);
|
||||
|
||||
_decelAnimX.setCurve(curve);
|
||||
_decelAnimX._duration = 400;
|
||||
_decelAnimX._startVal = _speedX;
|
||||
_decelAnimX._endVal = 0;
|
||||
_decelAnimX._callbackObj = this;
|
||||
_decelAnimX._callbackMethod = &AmerzoneGame::speedX;
|
||||
_decelAnimX.play();
|
||||
|
||||
_decelAnimY.setCurve(curve);
|
||||
_decelAnimY._duration = 400;
|
||||
_decelAnimY._startVal = _speedY;
|
||||
_decelAnimY._endVal = 0;
|
||||
_decelAnimY._callbackObj = this;
|
||||
_decelAnimY._callbackMethod = &AmerzoneGame::speedY;
|
||||
_decelAnimY.play();
|
||||
}
|
||||
|
||||
void AmerzoneGame::update() {
|
||||
TeInputMgr *inputMgr = g_engine->getInputMgr();
|
||||
|
||||
//if (!inputMgr->>isLeftDown())
|
||||
// isInDrag(false);
|
||||
|
||||
Application *app = g_engine->getApplication();
|
||||
if (!app->compassLook()) {
|
||||
if (_isInDrag) {
|
||||
TeVector2s32 mousePos = TeVector2s32(inputMgr->lastMousePos());
|
||||
TeVector3f32 offset = TeVector3f32(mousePos - _mouseDragLast);
|
||||
TeMatrix4x4 orientLayoutMatrix = app->frontLayout().rotation().toTeMatrix();
|
||||
TeVector3f32 rotOffset = orientLayoutMatrix * offset;
|
||||
if (app->inverseLook()) {
|
||||
setAngleX(_orientationX + rotOffset.x() / 2);
|
||||
setAngleY(_orientationY - rotOffset.y() / 2);
|
||||
} else {
|
||||
setAngleX(_orientationX - rotOffset.x() / 2);
|
||||
setAngleY(_orientationY + rotOffset.y() / 2);
|
||||
}
|
||||
_mouseDragLast = inputMgr->lastMousePos();
|
||||
} else {
|
||||
if (_edgeButtonRolloverCount > 0) {
|
||||
changeSpeedToMouseDirection();
|
||||
}
|
||||
float dragtime = (float)(_dragTimer.timeElapsed() / 1000000.0);
|
||||
if (_speedX)
|
||||
setAngleX(_orientationX - _speedX * dragtime);
|
||||
if (_speedY)
|
||||
setAngleY(_orientationY + _speedY * dragtime);
|
||||
}
|
||||
} else {
|
||||
// Compass stuff happens here in the game, but it's
|
||||
// not fully implemented - the TeCompass class is just
|
||||
// stubs.
|
||||
error("TODO: Implement compass support in AmerzoneGame::update.");
|
||||
}
|
||||
|
||||
if (_warpY) {
|
||||
TeVector2s32 mousePos = TeVector2s32(inputMgr->lastMousePos());
|
||||
TeVector3f32 offset = TeVector3f32(mousePos - _mouseDragStart);
|
||||
if (offset.length() > 20.0f)
|
||||
_warpY->setMouseLeftUpForMakers();
|
||||
}
|
||||
|
||||
// Note: _orientation*Y* is rotation around *X* axis, and vice-versa.
|
||||
const TeQuaternion rot = TeQuaternion::fromEulerDegrees(TeVector3f32(_orientationY, _orientationX, 0));
|
||||
|
||||
if (_warpX)
|
||||
_warpX->rotateCamera(rot);
|
||||
if (_warpY)
|
||||
_warpY->rotateCamera(rot);
|
||||
if (_warpX)
|
||||
_warpX->update();
|
||||
if (_warpY)
|
||||
_warpY->update();
|
||||
}
|
||||
|
||||
bool AmerzoneGame::onDialogFinished(const Common::String &val) {
|
||||
_luaScript.execute("OnDialogFinished", val);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AmerzoneGame::onVideoFinished() {
|
||||
_inGameGui.buttonLayoutChecked("videoBackgroundButton")->setVisible(false);
|
||||
_inGameGui.buttonLayoutChecked("skipVideoButton")->setVisible(false);
|
||||
TeSpriteLayout *video = _inGameGui.spriteLayoutChecked("video");
|
||||
Common::Path vidPath = video->_tiledSurfacePtr->loadedPath();
|
||||
video->setVisible(false);
|
||||
video->_tiledSurfacePtr->unload();
|
||||
video->_tiledSurfacePtr->setLoadedPath("");
|
||||
Application *app = g_engine->getApplication();
|
||||
_videoMusic.stop();
|
||||
if (app->musicOn())
|
||||
app->music().play();
|
||||
_running = true;
|
||||
_luaScript.execute("OnMovieFinished", vidPath.toString('/'));
|
||||
return false;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
121
engines/tetraedge/game/amerzone_game.h
Normal file
121
engines/tetraedge/game/amerzone_game.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_AMERZONE_GAME_H
|
||||
#define TETRAEDGE_GAME_AMERZONE_GAME_H
|
||||
|
||||
#include "tetraedge/game/game.h"
|
||||
|
||||
#include "tetraedge/game/puzzle_cadenas.h"
|
||||
#include "tetraedge/game/puzzle_coffre.h"
|
||||
#include "tetraedge/game/puzzle_computer_hydra.h"
|
||||
#include "tetraedge/game/puzzle_computer_pwd.h"
|
||||
#include "tetraedge/game/puzzle_disjoncteur.h"
|
||||
#include "tetraedge/game/puzzle_hanjie.h"
|
||||
#include "tetraedge/game/puzzle_liquides.h"
|
||||
#include "tetraedge/game/puzzle_pentacle.h"
|
||||
#include "tetraedge/game/puzzle_transfusion.h"
|
||||
|
||||
#include "tetraedge/te/te_timer.h"
|
||||
#include "tetraedge/te/te_warp.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
/** The main Amerzone Game class. This is known as GameWarp in the original
|
||||
* code, but was renamed to be more descriptive in the ScummVM context */
|
||||
class AmerzoneGame : public Tetraedge::Game {
|
||||
public:
|
||||
AmerzoneGame();
|
||||
~AmerzoneGame() {}
|
||||
|
||||
virtual void addToBag(const Common::String &objname) override;
|
||||
virtual bool changeWarp(const Common::String &zone, const Common::String &scene, bool fadeFlag) override;
|
||||
virtual void draw() override;
|
||||
virtual void enter() override;
|
||||
virtual void finishGame() override;
|
||||
virtual void initLoadedBackupData() override;
|
||||
virtual void leave(bool flag) override;
|
||||
virtual void update() override;
|
||||
virtual bool onDialogFinished(const Common::String &val) override;
|
||||
virtual bool onVideoFinished() override;
|
||||
|
||||
TeWarp *warpY() { return _warpY; }
|
||||
const Common::String lastHitObjectName() const { return _lastHitObjectName; }
|
||||
|
||||
void setAngleX(float angle);
|
||||
void setAngleY(float angle);
|
||||
void showPuzzle(int puzzleNo, int puzParam1, int puzParam2);
|
||||
|
||||
private:
|
||||
void changeSpeedToMouseDirection();
|
||||
void isInDrag(bool val);
|
||||
void speedX(const float &speed);
|
||||
void speedY(const float &speed);
|
||||
|
||||
bool onHelpButtonValidated();
|
||||
bool onAnimationFinished(const Common::String &anim);
|
||||
bool onMouseLeftUp(const Common::Point &pt);
|
||||
bool onMouseLeftDown(const Common::Point &pt);
|
||||
bool onObjectClick(const Common::String &obj);
|
||||
bool onPuzzleEnterAnimLoadTime();
|
||||
|
||||
void optimizeWarpResources();
|
||||
void startChangeWarpAnim();
|
||||
void startDecelerationAnim();
|
||||
bool onChangeWarpAnimFinished();
|
||||
|
||||
TeTimer _dragTimer;
|
||||
float _orientationX;
|
||||
float _orientationY;
|
||||
float _xAngleMin;
|
||||
float _xAngleMax;
|
||||
float _yAngleMin;
|
||||
float _yAngleMax;
|
||||
float _speedX;
|
||||
float _speedY;
|
||||
bool _isInDrag;
|
||||
int _edgeButtonRolloverCount;
|
||||
Common::Point _mouseDragStart;
|
||||
Common::Point _mouseDragLast;
|
||||
int _puzzleNo;
|
||||
int _puzParam1;
|
||||
int _puzParam2;
|
||||
TeCurveAnim2<AmerzoneGame, float> _decelAnimX;
|
||||
TeCurveAnim2<AmerzoneGame, float> _decelAnimY;
|
||||
TeWarp *_warpX;
|
||||
TeWarp *_warpY;
|
||||
TeWarp *_prevWarpY;
|
||||
Common::String _lastHitObjectName;
|
||||
|
||||
PuzzleCadenas _puzzleCadenas;
|
||||
PuzzleCoffre _puzzleCoffre;
|
||||
PuzzleComputerPwd _puzzleComputerPwd;
|
||||
PuzzleComputerHydra _puzzleComputerHydra;
|
||||
PuzzleDisjoncteur _puzzleDisjoncteur;
|
||||
PuzzleHanjie _puzzleHanjie;
|
||||
PuzzleLiquides _puzzleLiquides;
|
||||
PuzzlePentacle _puzzlePentacle;
|
||||
PuzzleTransfusion _puzzleTransfusion;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_AMERZONE_GAME_H
|
||||
626
engines/tetraedge/game/application.cpp
Normal file
626
engines/tetraedge/game/application.cpp
Normal file
@@ -0,0 +1,626 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "common/file.h"
|
||||
#include "common/util.h"
|
||||
#include "common/events.h"
|
||||
|
||||
#include "graphics/scaler.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/character.h"
|
||||
#include "tetraedge/game/characters_shadow.h"
|
||||
#include "tetraedge/game/in_game_scene.h"
|
||||
#include "tetraedge/te/te_core.h"
|
||||
#include "tetraedge/te/te_resource_manager.h"
|
||||
#include "tetraedge/te/te_renderer.h"
|
||||
#include "tetraedge/te/te_font2.h"
|
||||
#include "tetraedge/te/te_font3.h"
|
||||
#include "tetraedge/te/te_input_mgr.h"
|
||||
#include "tetraedge/te/te_sound_manager.h"
|
||||
|
||||
//#define TETRAEDGE_DUMP_LAYOUTS
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
bool Application::_dontUpdateWhenApplicationPaused = false;
|
||||
|
||||
Application::Application() : _finishedGame(false), _finishedFremium(false),
|
||||
_captureFade(false), _difficulty(1), _created(false), _tutoActivated(false),
|
||||
_drawShadows(true), _compassLook(false), _inverseLook(false),
|
||||
_permanentHelp(true), _musicOn(true) {
|
||||
//
|
||||
// TODO: Game defaults _ratioStretched to false, but then
|
||||
// the horizontally scrolling scenes don't scroll properly.
|
||||
// For now just default to true.
|
||||
//
|
||||
_ratioStretched = true;
|
||||
|
||||
TeCore *core = g_engine->getCore();
|
||||
core->_coreNotReady = true;
|
||||
const char *platform = "";
|
||||
switch (g_engine->getGamePlatform()) {
|
||||
case Common::Platform::kPlatformAndroid:
|
||||
platform = "Android";
|
||||
core->fileFlagSystemSetFlag("pad", "padDisabled");
|
||||
break;
|
||||
case Common::Platform::kPlatformMacintosh:
|
||||
platform = "MacOSX";
|
||||
break;
|
||||
case Common::Platform::kPlatformIOS:
|
||||
platform = "iPhone";
|
||||
break;
|
||||
case Common::Platform::kPlatformNintendoSwitch:
|
||||
platform = "NX";
|
||||
core->fileFlagSystemSetFlag("pad", "padDisabled");
|
||||
break;
|
||||
case Common::Platform::kPlatformPS3:
|
||||
platform = "PS3";
|
||||
break;
|
||||
default:
|
||||
error("Unsupported platform");
|
||||
}
|
||||
core->fileFlagSystemSetFlag("platform", platform);
|
||||
//
|
||||
// WORKAROUND: Syberia 2 A5_ValDomaine/54000/Logic54000.lua
|
||||
// checks a typo of this flag..
|
||||
//
|
||||
core->fileFlagSystemSetFlag("plateform", platform);
|
||||
|
||||
core->fileFlagSystemSetFlag("part", "Full");
|
||||
if (g_engine->isGameDemo())
|
||||
core->fileFlagSystemSetFlag("distributor", "Freemium");
|
||||
else
|
||||
core->fileFlagSystemSetFlag("distributor", "DefaultDistributor");
|
||||
|
||||
TeLuaGUI tempGui;
|
||||
tempGui.load("texts/Part.lua");
|
||||
_applicationTitle = tempGui.value("applicationTitle").toString();
|
||||
_versionString = tempGui.value("versionString").toString();
|
||||
_firstWarpPath = tempGui.value("firstWarpPath").toString();
|
||||
_firstZone = tempGui.value("firstZone").toString();
|
||||
_firstScene = tempGui.value("firstScene").toString();
|
||||
|
||||
TeSoundManager *soundmgr = g_engine->getSoundManager();
|
||||
soundmgr->setChannelVolume("sfx", 0.7f);
|
||||
soundmgr->setChannelVolume("music", 0.7f);
|
||||
soundmgr->setChannelVolume("dialog", 0.7f);
|
||||
soundmgr->setChannelVolume("video", 0.7f);
|
||||
// TODO: Configure freemium things here?
|
||||
|
||||
// Note: original has an app run timer, but it's never used?
|
||||
|
||||
_defaultCursor = g_engine->gameIsAmerzone() ? "2D/arrow6.png" : "pictures/cursor.png";
|
||||
|
||||
loadOptions("options.xml");
|
||||
}
|
||||
|
||||
Application::~Application() {
|
||||
destroy();
|
||||
}
|
||||
|
||||
void Application::create() {
|
||||
// TODO: Move mainWindowCamera to mainWindow?
|
||||
|
||||
const int winWidth = g_engine->getDefaultScreenWidth();
|
||||
const int winHeight = g_engine->getDefaultScreenHeight();
|
||||
|
||||
// See TeMainWindowBase::initCamera
|
||||
_mainWindowCamera.reset(new TeCamera());
|
||||
_mainWindowCamera->setName("_mainWinCam");
|
||||
_mainWindowCamera->setProjMatrixType(4);
|
||||
_mainWindowCamera->viewport(0, 0, winWidth, winHeight);
|
||||
_mainWindowCamera->orthogonalParams(winWidth * -0.5f, winWidth * 0.5f, winHeight * 0.5f, winHeight * -0.5f);
|
||||
_mainWindowCamera->setOrthoPlanes(-2048.0f, 2048.0f);
|
||||
|
||||
_mainWindow.setSize(TeVector3f32(winWidth, winHeight, 0.0));
|
||||
_mainWindow.setSizeType(TeILayout::ABSOLUTE);
|
||||
_mainWindow.setPositionType(TeILayout::ABSOLUTE);
|
||||
_mainWindow.setPosition(TeVector3f32(0.0f, 0.0f, 0.0f));
|
||||
_mainWindow.setName("TeEngine Application");
|
||||
|
||||
TeResourceManager *resmgr = g_engine->getResourceManager();
|
||||
TeCore *core = g_engine->getCore();
|
||||
// Cache some fonts
|
||||
if (g_engine->gameIsAmerzone()) {
|
||||
resmgr->getResource<TeFont2>(core->findFile("Common/Fonts/Arial_r_10.tef"));
|
||||
resmgr->getResource<TeFont2>(core->findFile("Common/Fonts/Arial_r_12.tef"));
|
||||
resmgr->getResource<TeFont2>(core->findFile("Common/Fonts/Arial_r_16.tef"));
|
||||
resmgr->getResource<TeFont2>(core->findFile("Common/Fonts/Colaborate-Regular_r_16.tef"));
|
||||
resmgr->getResource<TeFont2>(core->findFile("Common/Fonts/Colaborate-Regular_r_24.tef"));
|
||||
resmgr->getResource<TeFont2>(core->findFile("Common/Fonts/Credits.tef"));
|
||||
resmgr->getResource<TeFont2>(core->findFile("Common/Fonts/FontLoadingMenu.tef"));
|
||||
} else {
|
||||
_fontComic = resmgr->getResource<TeFont3>(core->findFile("Common/Fonts/ComicRelief.ttf"));
|
||||
_fontArgh = resmgr->getResource<TeFont3>(core->findFile("Common/Fonts/Argh.ttf"));
|
||||
_fontArial = resmgr->getResource<TeFont3>(core->findFile("Common/Fonts/arial.ttf"));
|
||||
_fontChaucer = resmgr->getResource<TeFont3>(core->findFile("Common/Fonts/CHAUCER.TTF"));
|
||||
_fontColaborate = resmgr->getResource<TeFont3>(core->findFile("Common/Fonts/Colaborate-Regular.otf"));
|
||||
_fontProDisplay = resmgr->getResource<TeFont3>(core->findFile("Common/Fonts/ProDisplay.ttf"));
|
||||
}
|
||||
|
||||
// The app prebuilds some fonts.. cover letters, numbers, a few accented chars, and punctuation.
|
||||
// Skip that here.
|
||||
/*
|
||||
TeTextBase2 textBase;
|
||||
textBase.setText("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/,*?;.:/!\xA7&\xE9\"'(-\xE8_\xE7\xE0)=");
|
||||
textBase.setFont(0, _fontComic);
|
||||
textBase.setRect(TeVector2s32(1, 1));
|
||||
textBase.setFontSize(12);
|
||||
textBase.build();
|
||||
textBase.setFontSize(14);
|
||||
textBase.build();
|
||||
textBase.setFontSize(16);
|
||||
textBase.build();
|
||||
textBase.setFontSize(18);
|
||||
textBase.build();
|
||||
textBase.setFontSize(30);
|
||||
textBase.build();
|
||||
textBase.setFont(0, _fontColaborate);
|
||||
textBase.setFontSize(18);
|
||||
textBase.build();
|
||||
textBase.setFont(0, _fontProDisplay);
|
||||
textBase.setFontSize(24);
|
||||
textBase.build();
|
||||
*/
|
||||
|
||||
static const char allLangs[][3] = {"en", "fr", "de", "es", "it", "ru", "he"};
|
||||
const Common::Path textsPath("texts");
|
||||
|
||||
// Try alternate langs..
|
||||
int i = 0;
|
||||
TetraedgeFSNode textFileNode;
|
||||
while (i < ARRAYSIZE(allLangs)) {
|
||||
textFileNode = core->findFile(textsPath.join(core->language() + ".xml"));
|
||||
if (textFileNode.exists())
|
||||
break;
|
||||
core->language(allLangs[i]);
|
||||
i++;
|
||||
}
|
||||
if (i == ARRAYSIZE(allLangs)) {
|
||||
error("Couldn't find texts/[lang].xml for any language.");
|
||||
}
|
||||
|
||||
_loc.load(textFileNode);
|
||||
core->addLoc(&_loc);
|
||||
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
const Common::Path helpMenuPath("menus/help/help_");
|
||||
Common::Path helpMenuFilePath;
|
||||
Common::String lang(core->language());
|
||||
i = 0;
|
||||
while (i < ARRAYSIZE(allLangs)) {
|
||||
helpMenuFilePath = helpMenuPath.append(lang + ".xml");
|
||||
if (Common::File::exists(helpMenuFilePath))
|
||||
break;
|
||||
lang = allLangs[i];
|
||||
i++;
|
||||
}
|
||||
if (i == ARRAYSIZE(allLangs)) {
|
||||
error("Couldn't find menus/help/help_[lang].xml for any language.");
|
||||
}
|
||||
|
||||
_helpGui.load(helpMenuFilePath);
|
||||
}
|
||||
|
||||
// TODO: set TeCore field 0x74 and 0x78 to true here? Do they do anything?");
|
||||
|
||||
// Game calls these here but does nothing with result?
|
||||
//TeGetDeviceDPI();
|
||||
//TeGetDeviceReferenceDPI();
|
||||
|
||||
_backLayout.setName("layoutBack");
|
||||
_backLayout.setSizeType(TeLayout::CoordinatesType::RELATIVE_TO_PARENT);
|
||||
_backLayout.setSize(TeVector3f32(1.0f, 1.0f, 0.0f));
|
||||
_mainWindow.addChild(&_backLayout);
|
||||
|
||||
_frontOrientationLayout.setName("orientationLayoutFront");
|
||||
_frontOrientationLayout.setSizeType(TeLayout::CoordinatesType::RELATIVE_TO_PARENT);
|
||||
_frontOrientationLayout.setSize(TeVector3f32(1.0f, 1.0f, 0.0f));
|
||||
_mainWindow.addChild(&_frontOrientationLayout);
|
||||
|
||||
_frontLayout.setName("layoutFront");
|
||||
_frontLayout.setSizeType(TeLayout::CoordinatesType::RELATIVE_TO_PARENT);
|
||||
_frontLayout.setSize(TeVector3f32(1.0f, 1.0f, 0.0f));
|
||||
_frontOrientationLayout.addChild(&_frontLayout);
|
||||
|
||||
_visFade.init();
|
||||
|
||||
_frontOrientationLayout.addChild(&_visFade._fadeCaptureSprite);
|
||||
_frontOrientationLayout.addChild(&_visFade._blackFadeSprite);
|
||||
_frontOrientationLayout.addChild(&_visFade._buttonLayout);
|
||||
|
||||
_frontLayout.addChild(&_appSpriteLayout);
|
||||
_appSpriteLayout.setSizeType(TeLayout::CoordinatesType::RELATIVE_TO_PARENT);
|
||||
_appSpriteLayout.setSize(TeVector3f32(1.0f, 1.0f, 1.0f));
|
||||
_appSpriteLayout.setVisible(false);
|
||||
|
||||
// Note: The games do some loading of a "version.ver" file here to add a
|
||||
// watermark to the backLayout, but that file doesn't exist in any of the
|
||||
// GOG games so it was probably only used during development.
|
||||
if (Common::File::exists("version.ver")) {
|
||||
warning("Skipping doing anything with version.ver file");
|
||||
}
|
||||
|
||||
_mouseCursorLayout.setName("mouseCursor");
|
||||
|
||||
// Not needed in scummvm:
|
||||
g_system->showMouse(false);
|
||||
//mainWindow->setNativeCursorVisible(false);
|
||||
|
||||
_mouseCursorLayout.load(_defaultCursor);
|
||||
_mouseCursorLayout.setAnchor(TeVector3f32(0.3f, 0.1f, 0.0f));
|
||||
_frontOrientationLayout.addChild(&_mouseCursorLayout);
|
||||
|
||||
_lockCursorButton.setName("lockCursorButton");
|
||||
_lockCursorButton.setSizeType(TeLayout::CoordinatesType::RELATIVE_TO_PARENT);
|
||||
_lockCursorButton.setSize(TeVector3f32(2.0f, 0.095f, 0.0f));
|
||||
_lockCursorButton.setPositionType(TeLayout::CoordinatesType::RELATIVE_TO_PARENT);
|
||||
_lockCursorButton.setPosition(TeVector3f32(0.95f, 0.95f, 0.0f));
|
||||
_lockCursorButton.setVisible(false);
|
||||
_frontOrientationLayout.addChild(&_lockCursorButton);
|
||||
|
||||
_lockCursorFromActionButton.setName("lockCursorFromActionButton");
|
||||
_lockCursorFromActionButton.setSizeType(TeLayout::CoordinatesType::RELATIVE_TO_PARENT);
|
||||
_lockCursorFromActionButton.setSize(TeVector3f32(2.0f, 2.0f, 0.0f));
|
||||
_lockCursorFromActionButton.setVisible(false);
|
||||
_frontOrientationLayout.addChild(&_lockCursorFromActionButton);
|
||||
|
||||
_autoSaveIcon1.setName("autosaveIcon");
|
||||
_autoSaveIcon1.setAnchor(TeVector3f32(0.5f, 0.5f, 0.0f));
|
||||
_autoSaveIcon1.setPosition(TeVector3f32(0.2f, 0.9f, 0.0f));
|
||||
_autoSaveIcon1.setSize(TeVector3f32(128.0f, 64.0f, 0.0f));
|
||||
_autoSaveIcon1.load("menus/inGame/autosave_icon.png");
|
||||
_autoSaveIcon1.setVisible(false);
|
||||
_frontOrientationLayout.addChild(&_autoSaveIcon1);
|
||||
|
||||
_autoSaveIconAnim1._runTimer.pausable(false);
|
||||
_autoSaveIconAnim1.pause();
|
||||
_autoSaveIconAnim1._startVal = TeColor(255, 255, 255, 0);
|
||||
_autoSaveIconAnim1._endVal = TeColor(255, 255, 255, 255);
|
||||
_autoSaveIconAnim1._repeatCount = -1;
|
||||
Common::Array<float> curve;
|
||||
curve.push_back(0.0f);
|
||||
curve.push_back(1.0f);
|
||||
curve.push_back(1.0f);
|
||||
curve.push_back(0.0f);
|
||||
_autoSaveIconAnim1.setCurve(curve);
|
||||
_autoSaveIconAnim1._duration = 4000.0f;
|
||||
_autoSaveIconAnim1._callbackObj = &_autoSaveIcon1;
|
||||
_autoSaveIconAnim1._callbackMethod = &Te3DObject2::setColor;
|
||||
|
||||
_autoSaveIcon2.setName("autosaveIcon");
|
||||
_autoSaveIcon2.setAnchor(TeVector3f32(0.5f, 0.5f, 0.0f));
|
||||
_autoSaveIcon2.setPosition(TeVector3f32(0.2f, 0.7f, 0.0f));
|
||||
_autoSaveIcon2.setSize(TeVector3f32(64.0f, 86.0f, 0.0f));
|
||||
_autoSaveIcon2.load("menus/inGame/NoCel.png");
|
||||
_autoSaveIcon2.setVisible(false);
|
||||
_frontOrientationLayout.addChild(&_autoSaveIcon2);
|
||||
|
||||
_autoSaveIconAnim2._runTimer.pausable(false);
|
||||
_autoSaveIconAnim2.pause();
|
||||
_autoSaveIconAnim2._startVal = TeColor(255, 255, 255, 0);
|
||||
_autoSaveIconAnim2._endVal = TeColor(255, 255, 255, 255);
|
||||
_autoSaveIconAnim2._repeatCount = 1;
|
||||
_autoSaveIconAnim2.setCurve(curve);
|
||||
_autoSaveIconAnim2._duration = 4000.0f;
|
||||
_autoSaveIconAnim2._callbackObj = &_autoSaveIcon2;
|
||||
_autoSaveIconAnim2._callbackMethod = &Te3DObject2::setColor;
|
||||
|
||||
_visFade.blackFadeCurveAnim().onFinished().add(this, &Application::onBlackFadeAnimationFinished);
|
||||
|
||||
g_engine->getInputMgr()->_mouseMoveSignal.add(this, &Application::onMousePositionChanged);
|
||||
|
||||
onMainWindowSizeChanged();
|
||||
_splashScreens.enter();
|
||||
|
||||
_drawShadows = !(g_engine->gameIsAmerzone() || ConfMan.getBool("disable_shadows"));
|
||||
|
||||
// Note: this is not in the original, but seems like a good place to do it..
|
||||
g_engine->getGame()->loadUnlockedArtwork();
|
||||
|
||||
_created = true;
|
||||
}
|
||||
|
||||
void Application::destroy() {
|
||||
Character::animCacheFreeAll();
|
||||
|
||||
_globalBonusMenu.unload();
|
||||
_bonusMenu.unload();
|
||||
_mainMenu.unload();
|
||||
_credits.leave();
|
||||
_ownerErrorMenu.unload();
|
||||
_splashScreens.unload();
|
||||
}
|
||||
|
||||
void Application::startGame(bool newGame, int difficulty) {
|
||||
_appSpriteLayout.setVisible(false);
|
||||
_appSpriteLayout.pause();
|
||||
_appSpriteLayout.unload();
|
||||
if (newGame)
|
||||
_difficulty = difficulty;
|
||||
g_engine->getGame()->enter();
|
||||
}
|
||||
|
||||
void Application::resume() {
|
||||
// Probably not needed.
|
||||
error("Implement Application::resume");
|
||||
}
|
||||
|
||||
bool Application::run() {
|
||||
if (_created) {
|
||||
TeTimer::updateAll();
|
||||
if (!_dontUpdateWhenApplicationPaused) {
|
||||
// Note: we run the inputmgr separately.. probably no need for this.
|
||||
//_inputmgr->update();
|
||||
TeAnimation::updateAll();
|
||||
//TeVideo::updateAll();
|
||||
}
|
||||
_captureFade = false;
|
||||
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
Game *game = g_engine->getGame();
|
||||
|
||||
renderer->reset();
|
||||
game->update();
|
||||
game->scene().updateScroll();
|
||||
g_engine->getSoundManager()->update();
|
||||
performRender();
|
||||
if (game->_returnToMainMenu) {
|
||||
game->leave(true);
|
||||
if (!game->luaShowOwnerError()) {
|
||||
_mainMenu.enter();
|
||||
} else {
|
||||
_ownerErrorMenu.enter();
|
||||
}
|
||||
game->_returnToMainMenu = false;
|
||||
}
|
||||
if (_finishedGame) {
|
||||
game->leave(false);
|
||||
_mainMenu.enter();
|
||||
if (Common::File::exists("finalURL.lua") || Common::File::exists("finalURL.data")) {
|
||||
TeLuaGUI finalGui;
|
||||
finalGui.load("finalURL.lua");
|
||||
/*TeVariant finalVal =*/ finalGui.value("finalURL");
|
||||
// Not clear if this variant is ever used in original.
|
||||
debug("TODO: use final URL??");
|
||||
finalGui.unload();
|
||||
}
|
||||
_finishedGame = false;
|
||||
}
|
||||
TeObject::deleteNow();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Application::suspend() {
|
||||
// Probably not needed.
|
||||
error("Implement Application::suspend");
|
||||
}
|
||||
|
||||
void Application::showNoCellIcon(bool show) {
|
||||
if (!show) {
|
||||
_autoSaveIconAnim2._repeatCount = 1;
|
||||
} else {
|
||||
_autoSaveIcon2.setVisible(true);
|
||||
_autoSaveIcon2.setColor(TeColor(255, 255, 255, 255));
|
||||
_autoSaveIconAnim2._repeatCount = -1;
|
||||
_autoSaveIconAnim2.play();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::showLoadingIcon(bool show) {
|
||||
if (!show) {
|
||||
_autoSaveIconAnim1._repeatCount = 1;
|
||||
} else {
|
||||
_autoSaveIcon1.setVisible(true);
|
||||
_autoSaveIcon1.setColor(TeColor(255, 255, 255, 255));
|
||||
_autoSaveIconAnim1._repeatCount = -1;
|
||||
_autoSaveIconAnim1.play();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::saveCorrupted(const Common::String &fname) {
|
||||
// Probably not needed.
|
||||
error("Implement Application::saveCorrupted");
|
||||
}
|
||||
|
||||
void Application::drawBack() {
|
||||
_mainWindowCamera->apply();
|
||||
_backLayout.draw();
|
||||
TeCamera::restore();
|
||||
g_engine->getRenderer()->loadIdentityMatrix();
|
||||
}
|
||||
|
||||
void Application::drawFront() {
|
||||
_mainWindowCamera->apply();
|
||||
_frontOrientationLayout.draw();
|
||||
TeCamera::restore();
|
||||
g_engine->getRenderer()->loadIdentityMatrix();
|
||||
}
|
||||
|
||||
#ifdef TETRAEDGE_DUMP_LAYOUTS
|
||||
static int renderCount = 0;
|
||||
static void dumpLayout(TeLayout *layout, Common::String indent = "++") {
|
||||
assert(layout);
|
||||
if (!layout->worldVisible())
|
||||
return;
|
||||
debug("%s '%s'%s pos:%s worldScale:%s userSize:%s size:%s col:%s", indent.c_str(), layout->name().c_str(), (layout->worldVisible() ? "" : " (invis)"),
|
||||
layout->position().dump().c_str(), layout->worldScale().dump().c_str(),
|
||||
layout->userSize().dump().c_str(), layout->size().dump().c_str(),
|
||||
layout->color().dump().c_str());
|
||||
for (auto & child: layout->childList()) {
|
||||
TeLayout *childLayout = dynamic_cast<TeLayout *>(child);
|
||||
if (childLayout)
|
||||
dumpLayout(childLayout, indent + "++");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Application::performRender() {
|
||||
Game *game = g_engine->getGame();
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
|
||||
if (_drawShadows && game->running() && game->scene()._character
|
||||
&& game->scene().shadowLightNo() != -1
|
||||
&& game->scene().charactersShadow() != nullptr) {
|
||||
renderer->shadowMode(TeRenderer::ShadowModeCreating);
|
||||
game->scene().charactersShadow()->createTexture(&game->scene());
|
||||
renderer->shadowMode(TeRenderer::ShadowModeNone);
|
||||
}
|
||||
|
||||
drawBack();
|
||||
|
||||
renderer->renderTransparentMeshes();
|
||||
renderer->clearBuffer(TeRenderer::DepthBuffer);
|
||||
if (game->running()) {
|
||||
if (_drawShadows && game->scene()._character
|
||||
&& game->scene().shadowLightNo() != -1
|
||||
&& game->scene().charactersShadow() != nullptr) {
|
||||
TeIntrusivePtr<TeCamera> currentCamera = game->scene().currentCamera();
|
||||
if (currentCamera) {
|
||||
currentCamera->apply();
|
||||
renderer->shadowMode(TeRenderer::ShadowModeDrawing);
|
||||
game->scene().charactersShadow()->draw(&game->scene());
|
||||
renderer->shadowMode(TeRenderer::ShadowModeNone);
|
||||
}
|
||||
}
|
||||
game->draw();
|
||||
}
|
||||
|
||||
renderer->renderTransparentMeshes();
|
||||
renderer->clearBuffer(TeRenderer::DepthBuffer);
|
||||
drawFront();
|
||||
renderer->renderTransparentMeshes();
|
||||
game->scene().drawPath();
|
||||
renderer->updateScreen();
|
||||
|
||||
#ifdef TETRAEDGE_DUMP_LAYOUTS
|
||||
renderCount++;
|
||||
if (renderCount % 100 == 0) {
|
||||
debug("\n--------------------\nFrame %d back layout: ", renderCount);
|
||||
dumpLayout(&_backLayout);
|
||||
debug("\n--------------------\nFrame %d front orientation layout: ", renderCount);
|
||||
dumpLayout(&_frontOrientationLayout);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//void Application::preloadTextrue(); does nothing..
|
||||
|
||||
void Application::fade() {
|
||||
_visFade.animateFade();
|
||||
}
|
||||
|
||||
void Application::blackFade() {
|
||||
_visFade.animateBlackFade();
|
||||
}
|
||||
|
||||
void Application::captureFade() {
|
||||
if (_captureFade)
|
||||
return;
|
||||
_captureFade = true;
|
||||
performRender();
|
||||
_visFade.captureFrame();
|
||||
}
|
||||
|
||||
void Application::getSavegameThumbnail(Graphics::Surface &thumb) {
|
||||
captureFade();
|
||||
Graphics::Surface screen;
|
||||
_visFade.texture()->writeTo(screen);
|
||||
screen.flipVertical(Common::Rect(screen.w, screen.h));
|
||||
Common::ScopedPtr<Graphics::Surface> scaledScreen(screen.scale(kThumbnailWidth, kThumbnailHeight2));
|
||||
thumb.copyFrom(*scaledScreen);
|
||||
screen.free();
|
||||
scaledScreen->free();
|
||||
}
|
||||
|
||||
bool Application::isFading() {
|
||||
return _visFade.blackFading() || _visFade.fading();
|
||||
}
|
||||
|
||||
bool Application::onBlackFadeAnimationFinished() {
|
||||
_visFade._blackFadeSprite.setVisible(false);
|
||||
_visFade._buttonLayout.setVisible(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Application::onMainWindowSizeChanged() {
|
||||
// This sets HD or SD "definition" in the core depending on device DPI.
|
||||
// For now just default to SD.
|
||||
debug("mainWindowSizeChanged: defaulting to SD.");
|
||||
g_engine->getCore()->fileFlagSystemSetFlag("definition", "SD");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Application::onMousePositionChanged(const Common::Point &p) {
|
||||
const TeVector3f32 mainWinSize = _mainWindow.size();
|
||||
const TeVector3f32 newCursorPos(p.x / mainWinSize.x(), p.y / mainWinSize.y(), 0.0);
|
||||
_mouseCursorLayout.setPosition(newCursorPos);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Application::isLockCursor() {
|
||||
return _lockCursorButton.visible() || _lockCursorFromActionButton.visible();
|
||||
}
|
||||
|
||||
bool Application::isLockPad() {
|
||||
Game *game = g_engine->getGame();
|
||||
bool result = isLockCursor() || game->dialog2().isDialogPlaying() || game->isMoviePlaying()
|
||||
|| game->question2().gui().layoutChecked("background")->visible()
|
||||
|| game->isDocumentOpened();
|
||||
return result;
|
||||
}
|
||||
|
||||
void Application::lockCursor(bool lock) {
|
||||
_lockCursorButton.setVisible(lock);
|
||||
}
|
||||
|
||||
void Application::lockCursorFromAction(bool lock) {
|
||||
_lockCursorFromActionButton.setVisible(lock);
|
||||
g_engine->getGame()->showMarkers(lock);
|
||||
}
|
||||
|
||||
void Application::loadOptions(const Common::String &fname) {
|
||||
// Probably not needed. We sync confman in addArtworkUnlocked.
|
||||
debug("Application::loadOptions %s", fname.c_str());
|
||||
}
|
||||
|
||||
void Application::saveOptions(const Common::String &fname) {
|
||||
// Probably not needed. We sync confman in addArtworkUnlocked.
|
||||
debug("Application::saveOptions %s", fname.c_str());
|
||||
}
|
||||
|
||||
Common::String Application::getHelpText(const Common::String &key) {
|
||||
return _helpGui.value(key);
|
||||
}
|
||||
|
||||
const char *Application::inAppUnlockFullVersionID() {
|
||||
// Probably not needed.
|
||||
error("Implement Application::inAppUnlockFullVersionID");
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
198
engines/tetraedge/game/application.h
Normal file
198
engines/tetraedge/game/application.h
Normal file
@@ -0,0 +1,198 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_APPLICATION_H
|
||||
#define TETRAEDGE_GAME_APPLICATION_H
|
||||
|
||||
#include "common/str.h"
|
||||
#include "common/ptr.h"
|
||||
|
||||
#include "tetraedge/game/bonus_menu.h"
|
||||
#include "tetraedge/game/credits.h"
|
||||
#include "tetraedge/game/global_bonus_menu.h"
|
||||
#include "tetraedge/game/main_menu.h"
|
||||
#include "tetraedge/game/options_menu.h"
|
||||
#include "tetraedge/game/loc_file.h"
|
||||
#include "tetraedge/game/owner_error_menu.h"
|
||||
#include "tetraedge/game/splash_screens.h"
|
||||
#include "tetraedge/game/in_game_scene.h"
|
||||
#include "tetraedge/game/upsell_screen.h"
|
||||
|
||||
#include "tetraedge/te/te_visual_fade.h"
|
||||
#include "tetraedge/te/te_music.h"
|
||||
#include "tetraedge/te/te_xml_gui.h"
|
||||
#include "tetraedge/te/te_font3.h"
|
||||
|
||||
namespace Common {
|
||||
struct Event;
|
||||
}
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Application {
|
||||
public:
|
||||
Application();
|
||||
~Application();
|
||||
|
||||
void create();
|
||||
void destroy();
|
||||
|
||||
void startGame(bool newGame, int difficulty);
|
||||
void resume();
|
||||
bool run();
|
||||
void suspend();
|
||||
void showNoCellIcon(bool show);
|
||||
void showLoadingIcon(bool show);
|
||||
void saveCorrupted(const Common::String &fname);
|
||||
|
||||
void performRender();
|
||||
//void preloadTextrue(); does nothing
|
||||
|
||||
void fade();
|
||||
void blackFade();
|
||||
void captureFade();
|
||||
bool isFading();
|
||||
|
||||
bool isLockCursor();
|
||||
bool isLockPad();
|
||||
void lockCursor(bool lock);
|
||||
void lockCursorFromAction(bool lock);
|
||||
|
||||
void loadOptions(const Common::String &fname);
|
||||
void saveOptions(const Common::String &fname);
|
||||
|
||||
void getSavegameThumbnail(Graphics::Surface &thumb);
|
||||
|
||||
Common::String getHelpText(const Common::String &key);
|
||||
|
||||
BonusMenu &bonusMenu() { return _bonusMenu; }
|
||||
GlobalBonusMenu &globalBonusMenu() { return _globalBonusMenu; }
|
||||
MainMenu &mainMenu() { return _mainMenu; }
|
||||
OptionsMenu &optionsMenu() { return _optionsMenu; }
|
||||
TeMusic &music() { return _music; }
|
||||
Credits &credits() { return _credits; }
|
||||
UpsellScreen &upsellScreen() { return _upsellScreen; }
|
||||
TeVisualFade &visualFade() { return _visFade; }
|
||||
TeSpriteLayout &appSpriteLayout() { return _appSpriteLayout; }
|
||||
TeSpriteLayout &mouseCursorLayout() { return _mouseCursorLayout; }
|
||||
const Common::String getVersionString() const { return _versionString; }
|
||||
TeLayout &getMainWindow() { return _mainWindow; }
|
||||
void setTutoActivated(bool val) { _tutoActivated = val; }
|
||||
TeCamera *mainWindowCamera() { return _mainWindowCamera.get(); }
|
||||
Common::Array<Common::String> &unrecalAnims() { return _unrecalAnims; }
|
||||
int &difficulty() { return _difficulty; }
|
||||
bool &tutoActivated() { return _tutoActivated; }
|
||||
|
||||
void setFinishedGame(bool val) { _finishedGame = val; }
|
||||
void setFinishedFremium(bool val) { _finishedFremium = val; }
|
||||
const Common::String &firstWarpPath() { return _firstWarpPath; }
|
||||
const Common::String &firstZone() { return _firstZone; }
|
||||
const Common::String &firstScene() { return _firstScene; }
|
||||
const Common::Path &defaultCursor() { return _defaultCursor; }
|
||||
TeLayout &frontLayout() { return _frontLayout; };
|
||||
TeLayout &frontOrientationLayout() { return _frontOrientationLayout; }
|
||||
TeLayout &backLayout() { return _backLayout; }
|
||||
LocFile &loc() { return _loc; }
|
||||
bool ratioStretched() const { return _ratioStretched; }
|
||||
bool compassLook() const { return _compassLook; }
|
||||
bool inverseLook() const { return _inverseLook; }
|
||||
bool permanentHelp() const { return _permanentHelp; }
|
||||
bool musicOn() const { return _musicOn; }
|
||||
|
||||
private:
|
||||
void drawBack();
|
||||
void drawFront();
|
||||
|
||||
const char *inAppUnlockFullVersionID();
|
||||
|
||||
bool onBlackFadeAnimationFinished();
|
||||
bool onMainWindowSizeChanged();
|
||||
bool onMousePositionChanged(const Common::Point &p);
|
||||
|
||||
bool _finishedGame;
|
||||
bool _finishedFremium;
|
||||
|
||||
TeVisualFade _visFade;
|
||||
TeMusic _music;
|
||||
TeSpriteLayout _appSpriteLayout;
|
||||
TeSpriteLayout _mouseCursorLayout;
|
||||
TeSpriteLayout _autoSaveIcon1;
|
||||
TeSpriteLayout _autoSaveIcon2;
|
||||
|
||||
TeButtonLayout _lockCursorButton;
|
||||
TeButtonLayout _lockCursorFromActionButton;
|
||||
|
||||
TeLayout _frontLayout;
|
||||
TeLayout _frontOrientationLayout;
|
||||
TeLayout _backLayout;
|
||||
|
||||
LocFile _loc;
|
||||
|
||||
Common::String _applicationTitle;
|
||||
Common::String _versionString;
|
||||
Common::String _firstWarpPath;
|
||||
Common::String _firstZone;
|
||||
Common::String _firstScene;
|
||||
Common::Path _defaultCursor;
|
||||
|
||||
Common::Array<Common::String> _unrecalAnims;
|
||||
|
||||
TeCurveAnim2<Te3DObject2, TeColor> _autoSaveIconAnim1;
|
||||
TeCurveAnim2<Te3DObject2, TeColor> _autoSaveIconAnim2;
|
||||
|
||||
Common::SharedPtr<TeCamera> _mainWindowCamera; // TODO: should be part of TeMainWindow.
|
||||
TeLayout _mainWindow; // TODO: should be a specialised class.
|
||||
|
||||
GlobalBonusMenu _globalBonusMenu;
|
||||
BonusMenu _bonusMenu;
|
||||
MainMenu _mainMenu;
|
||||
OptionsMenu _optionsMenu;
|
||||
Credits _credits;
|
||||
OwnerErrorMenu _ownerErrorMenu;
|
||||
SplashScreens _splashScreens;
|
||||
UpsellScreen _upsellScreen;
|
||||
|
||||
TeIntrusivePtr<TeFont3> _fontComic;
|
||||
TeIntrusivePtr<TeFont3> _fontArgh;
|
||||
TeIntrusivePtr<TeFont3> _fontArial;
|
||||
TeIntrusivePtr<TeFont3> _fontChaucer;
|
||||
TeIntrusivePtr<TeFont3> _fontColaborate;
|
||||
TeIntrusivePtr<TeFont3> _fontProDisplay;
|
||||
|
||||
bool _captureFade;
|
||||
bool _created;
|
||||
bool _tutoActivated;
|
||||
bool _drawShadows;
|
||||
bool _ratioStretched;
|
||||
bool _compassLook;
|
||||
bool _inverseLook;
|
||||
bool _permanentHelp;
|
||||
bool _musicOn;
|
||||
|
||||
int _difficulty;
|
||||
|
||||
TeXmlGui _helpGui;
|
||||
static bool _dontUpdateWhenApplicationPaused;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_APPLICATION_H
|
||||
110
engines/tetraedge/game/billboard.cpp
Normal file
110
engines/tetraedge/game/billboard.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/textconsole.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/billboard.h"
|
||||
#include "tetraedge/game/syberia_game.h"
|
||||
|
||||
#include "tetraedge/te/te_core.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
Billboard::Billboard() : _hasPos2(false) {
|
||||
}
|
||||
|
||||
bool Billboard::load(const Common::Path &path) {
|
||||
_model = new TeModel();
|
||||
TeIntrusivePtr<Te3DTexture> texture = Te3DTexture::makeInstance();
|
||||
SyberiaGame *game = dynamic_cast<SyberiaGame *>(g_engine->getGame());
|
||||
TeCore *core = g_engine->getCore();
|
||||
TetraedgeFSNode texnode = core->findFile(game->sceneZonePath().join(path));
|
||||
texture->load(texnode);
|
||||
_model->setName(path.toString('/'));
|
||||
Common::Array<TeVector3f32> quad;
|
||||
quad.resize(4);
|
||||
_model->setQuad(texture, quad, TeColor(0xff, 0xff, 0xff, 0xff));
|
||||
_model->setVisible(false);
|
||||
game->scene().models().push_back(_model);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Billboard::calcVertex() {
|
||||
Game *game = g_engine->getGame();
|
||||
TeIntrusivePtr<TeCamera> currentCam = game->scene().currentCamera();
|
||||
assert(currentCam);
|
||||
currentCam->apply();
|
||||
const TeMatrix4x4 camProjMatrix = currentCam->projectionMatrix();
|
||||
TeMatrix4x4 camWorldInverse = currentCam->worldTransformationMatrix();
|
||||
camWorldInverse.inverse();
|
||||
|
||||
const TeMatrix4x4 camTotalTransform = camProjMatrix * camWorldInverse;
|
||||
TeMatrix4x4 camTotalInverse = camTotalTransform;
|
||||
camTotalInverse.inverse();
|
||||
|
||||
TeVector3f32 posvec(0.0f, 0.0f, _pos.z());
|
||||
if (_hasPos2) {
|
||||
posvec = _pos2;
|
||||
}
|
||||
posvec = camTotalTransform * posvec;
|
||||
|
||||
TeVector3f32 meshVertex;
|
||||
float fx, fy;
|
||||
|
||||
fx = _pos.x();
|
||||
fy = _pos.y();
|
||||
meshVertex = camTotalInverse * TeVector3f32(fx + fx - 1.0f, fy + fy - 1.0f, posvec.z());
|
||||
_model->meshes()[0]->setVertex(0, meshVertex);
|
||||
|
||||
fx = _pos.x();
|
||||
fy = _pos.y() + _size.getY();
|
||||
meshVertex = camTotalInverse * TeVector3f32(fx + fx - 1.0f, fy + fy - 1.0f, posvec.z());
|
||||
_model->meshes()[0]->setVertex(1, meshVertex);
|
||||
|
||||
fx = _pos.x() + _size.getX();
|
||||
fy = _pos.y();
|
||||
meshVertex = camTotalInverse * TeVector3f32(fx + fx - 1.0f, fy + fy - 1.0f, posvec.z());
|
||||
_model->meshes()[0]->setVertex(2, meshVertex);
|
||||
|
||||
fx = _pos.x() + _size.getX();
|
||||
fy = _pos.y() + _size.getY();
|
||||
meshVertex = camTotalInverse * TeVector3f32(fx + fx - 1.0f, fy + fy - 1.0f, posvec.z());
|
||||
_model->meshes()[0]->setVertex(3, meshVertex);
|
||||
}
|
||||
|
||||
void Billboard::position(const TeVector3f32 &pos) {
|
||||
_pos = pos;
|
||||
calcVertex();
|
||||
}
|
||||
|
||||
void Billboard::position2(const TeVector3f32 &pos) {
|
||||
_pos2 = pos;
|
||||
_hasPos2 = true;
|
||||
calcVertex();
|
||||
}
|
||||
|
||||
void Billboard::size(const TeVector2f32 &size) {
|
||||
_size = size;
|
||||
calcVertex();
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
58
engines/tetraedge/game/billboard.h
Normal file
58
engines/tetraedge/game/billboard.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_BILLBOARD_H
|
||||
#define TETRAEDGE_GAME_BILLBOARD_H
|
||||
|
||||
#include "common/str.h"
|
||||
|
||||
#include "tetraedge/te/te_object.h"
|
||||
#include "tetraedge/te/te_intrusive_ptr.h"
|
||||
#include "tetraedge/te/te_model.h"
|
||||
#include "tetraedge/te/te_vector2f32.h"
|
||||
#include "tetraedge/te/te_vector3f32.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Billboard : public TeObject {
|
||||
public:
|
||||
Billboard();
|
||||
|
||||
bool load(const Common::Path &path);
|
||||
|
||||
void calcVertex();
|
||||
void position(const TeVector3f32 &pos);
|
||||
void position2(const TeVector3f32 &pos);
|
||||
void size(const TeVector2f32 &size);
|
||||
|
||||
TeIntrusivePtr<TeModel> &model() { return _model; }
|
||||
|
||||
private:
|
||||
TeIntrusivePtr<TeModel> _model;
|
||||
TeVector3f32 _pos;
|
||||
TeVector3f32 _pos2;
|
||||
TeVector2f32 _size;
|
||||
bool _hasPos2;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_BILLBOARD_H
|
||||
253
engines/tetraedge/game/bonus_menu.cpp
Normal file
253
engines/tetraedge/game/bonus_menu.cpp
Normal file
@@ -0,0 +1,253 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/bonus_menu.h"
|
||||
|
||||
#include "common/textconsole.h"
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/syberia_game.h"
|
||||
#include "tetraedge/te/te_core.h"
|
||||
#include "tetraedge/te/te_input_mgr.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
BonusMenu::BonusMenu() : _pageNo(0) {
|
||||
}
|
||||
|
||||
void BonusMenu::enter(const Common::Path &scriptName) {
|
||||
bool loaded = load(scriptName);
|
||||
if (!loaded)
|
||||
error("BonusMenu::enter: failed to load %s", scriptName.toString(Common::Path::kNativeSeparator).c_str());
|
||||
Application *app = g_engine->getApplication();
|
||||
app->frontLayout().addChild(layoutChecked("menu"));
|
||||
SyberiaGame *game = dynamic_cast<SyberiaGame *>(g_engine->getGame());
|
||||
assert(game);
|
||||
|
||||
buttonLayoutChecked("quitButton")->onMouseClickValidated().add(this, &BonusMenu::onQuitButton);
|
||||
|
||||
int btnNo = 0;
|
||||
while (true) {
|
||||
const Common::String btnNoStr = Common::String::format("%d", btnNo);
|
||||
TeButtonLayout *btn = buttonLayout(btnNoStr);
|
||||
if (!btn)
|
||||
break;
|
||||
SaveButton *saveBtn = new SaveButton(btn, btnNoStr, this);
|
||||
_saveButtons.push_back(saveBtn);
|
||||
|
||||
TeVector3f32 mainWinSz = g_engine->getApplication()->getMainWindow().size();
|
||||
if (g_engine->getCore()->fileFlagSystemFlag("definition") == "SD")
|
||||
mainWinSz = mainWinSz / 3.0f;
|
||||
else
|
||||
mainWinSz = mainWinSz / 4.0f;
|
||||
mainWinSz.z() = 1.0f;
|
||||
saveBtn->setSize(mainWinSz);
|
||||
for (Te3DObject2 *child : saveBtn->childList()) {
|
||||
child->setSize(mainWinSz);
|
||||
}
|
||||
|
||||
if (btn->childCount() <= 4)
|
||||
error("expected save button to have >4 children");
|
||||
const Common::String artName = btn->child(4)->name();
|
||||
btn->setEnable(game->isArtworkUnlocked(artName));
|
||||
|
||||
btnNo++;
|
||||
}
|
||||
|
||||
btnNo = 0;
|
||||
while( true ) {
|
||||
const Common::String btnNoStr = Common::String::format("slot%d", btnNo);
|
||||
TeLayout *l = layout(btnNoStr);
|
||||
if (!l)
|
||||
break;
|
||||
|
||||
if (btnNo < (int)_saveButtons.size()) {
|
||||
l->addChild(_saveButtons[btnNo]);
|
||||
}
|
||||
btnNo = btnNo + 1;
|
||||
}
|
||||
|
||||
TeButtonLayout *slideBtn = buttonLayoutChecked("slideButton");
|
||||
slideBtn->onButtonChangedToStateDownSignal().add(this, &BonusMenu::onSlideButtonDown);
|
||||
|
||||
TeInputMgr *inputmgr = g_engine->getInputMgr();
|
||||
inputmgr->_mouseMoveSignal.add(this, &BonusMenu::onMouseMove);
|
||||
|
||||
_pageNo = 0;
|
||||
|
||||
TeButtonLayout *leftBtn = buttonLayout("leftButton");
|
||||
if (leftBtn)
|
||||
leftBtn->onMouseClickValidated().add(this, &BonusMenu::onLeftButton);
|
||||
|
||||
TeButtonLayout *rightBtn = buttonLayout("rightButton");
|
||||
if (rightBtn)
|
||||
rightBtn->onMouseClickValidated().add(this, &BonusMenu::onRightButton);
|
||||
|
||||
// TODO: more stuff here with "text" values
|
||||
warning("TODO: Finish BonusMenu::enter(%s)", scriptName.toString(Common::Path::kNativeSeparator).c_str());
|
||||
|
||||
TeButtonLayout *pictureBtn = buttonLayout("fullScreenPictureButton");
|
||||
if (pictureBtn) {
|
||||
pictureBtn->onMouseClickValidated().add(this, &BonusMenu::onPictureButton);
|
||||
}
|
||||
}
|
||||
|
||||
void BonusMenu::enter() {
|
||||
error("TODO: implement BonusMenu::enter()");
|
||||
}
|
||||
|
||||
void BonusMenu::leave() {
|
||||
for (auto *s : _saveButtons) {
|
||||
delete s;
|
||||
}
|
||||
_saveButtons.clear();
|
||||
TeInputMgr *inputmgr = g_engine->getInputMgr();
|
||||
inputmgr->_mouseMoveSignal.remove(this, &BonusMenu::onMouseMove);
|
||||
TeLuaGUI::unload();
|
||||
}
|
||||
|
||||
bool BonusMenu::onLeftButton() {
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *slideAnim = layoutPositionLinearAnimation("slideAnimation");
|
||||
|
||||
if (!slideAnim->_runTimer.running() && _pageNo != 0) {
|
||||
TeLayout *slotsLayout = layout("slots");
|
||||
TeVector3f32 slotsPos = slotsLayout->userPosition();
|
||||
slideAnim->_startVal = slotsPos;
|
||||
slotsPos.x() += value("slideTranslation").toFloat64();
|
||||
slideAnim->_endVal = slotsPos;
|
||||
|
||||
slideAnim->_callbackObj = layoutChecked("slots");
|
||||
slideAnim->_callbackMethod = &TeLayout::setPosition;
|
||||
slideAnim->play();
|
||||
|
||||
_pageNo--;
|
||||
|
||||
buttonLayoutChecked("slideButton")->reset();
|
||||
|
||||
warning("TODO: Finish BonusMenu::onLeftButton");
|
||||
// TODO: Set values depending on whether saves exist (lines 95-120)
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BonusMenu::onMouseMove(const Common::Point &pt) {
|
||||
TeButtonLayout *slideLayout = buttonLayoutChecked("slideButton");
|
||||
if (slideLayout->state() == TeButtonLayout::BUTTON_STATE_DOWN) {
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *slideAnim = layoutPositionLinearAnimation("slideAnimation");
|
||||
if (!slideAnim->_runTimer.running()) {
|
||||
const Common::Point mousePos = g_engine->getInputMgr()->lastMousePos();
|
||||
const TeVector3f32 slotsSize = layoutChecked("slots")->size();
|
||||
|
||||
float slideAmount = (mousePos.x - _slideBtnStartMousePos._x) / slotsSize.x();
|
||||
if (slideAmount <= -0.1) {
|
||||
onRightButton();
|
||||
buttonLayoutChecked("slideButton")->setClickPassThrough(false);
|
||||
} else if (slideAmount > 0.1){
|
||||
onLeftButton();
|
||||
buttonLayoutChecked("slideButton")->setClickPassThrough(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BonusMenu::onPictureButton() {
|
||||
TeButtonLayout *btn = buttonLayoutChecked("menu");
|
||||
btn->setVisible(true);
|
||||
|
||||
Application *app = g_engine->getApplication();
|
||||
TeSpriteLayout *pictureLayout = spriteLayoutChecked("fullScreenPictureLayout");
|
||||
app->frontLayout().removeChild(pictureLayout);
|
||||
pictureLayout->setVisible(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BonusMenu::onQuitButton() {
|
||||
Application *app = g_engine->getApplication();
|
||||
assert(app);
|
||||
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->globalBonusMenu().enter();
|
||||
app->fade();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BonusMenu::onRightButton() {
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *slideAnim = layoutPositionLinearAnimation("slideAnimation");
|
||||
|
||||
if (!slideAnim->_runTimer.running() && _pageNo < (int)_saveButtons.size() - 1) {
|
||||
TeLayout *slotsLayout = layout("slots");
|
||||
TeVector3f32 slotsPos = slotsLayout->userPosition();
|
||||
slideAnim->_startVal = slotsPos;
|
||||
slotsPos.x() -= value("slideTranslation").toFloat64();
|
||||
slideAnim->_endVal = slotsPos;
|
||||
|
||||
slideAnim->_callbackObj = layoutChecked("slots");
|
||||
slideAnim->_callbackMethod = &TeLayout::setPosition;
|
||||
slideAnim->play();
|
||||
|
||||
_pageNo++;
|
||||
|
||||
buttonLayoutChecked("slideButton")->reset();
|
||||
|
||||
// TODO: Set values depending on whether saves exist (lines 95-120)
|
||||
warning("TODO: Finish BonusMenu::onRightButton");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BonusMenu::onSlideButtonDown() {
|
||||
TeInputMgr *inputmgr = g_engine->getInputMgr();
|
||||
TeVector2s32 mousepos = inputmgr->lastMousePos();
|
||||
_slideBtnStartMousePos = mousepos;
|
||||
buttonLayoutChecked("slideButton")->setClickPassThrough(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
BonusMenu::SaveButton::SaveButton(TeButtonLayout *btn, const Common::String &name, BonusMenu *owner) : _menu(owner) {
|
||||
setName(name);
|
||||
btn->setEnable(true);
|
||||
addChild(btn);
|
||||
btn->onMouseClickValidated().add(this, &BonusMenu::SaveButton::onLoadSave);
|
||||
}
|
||||
|
||||
Common::String BonusMenu::SaveButton::path() const {
|
||||
return Common::String("Backup/") + name() + ".xml";
|
||||
}
|
||||
|
||||
bool BonusMenu::SaveButton::onLoadSave() {
|
||||
_menu->buttonLayoutChecked("menu")->setVisible(false);
|
||||
TeSpriteLayout *pic = _menu->spriteLayoutChecked("fullScreenPicture");
|
||||
const Common::Path picName(child(0)->child(4)->name());
|
||||
pic->load(picName);
|
||||
|
||||
TeSpriteLayout *picLayout = _menu->spriteLayoutChecked("fullScreenPictureLayout");
|
||||
g_engine->getApplication()->frontLayout().addChild(picLayout);
|
||||
picLayout->setVisible(true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
76
engines/tetraedge/game/bonus_menu.h
Normal file
76
engines/tetraedge/game/bonus_menu.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_BONUS_MENU_H
|
||||
#define TETRAEDGE_GAME_BONUS_MENU_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "common/str.h"
|
||||
#include "tetraedge/te/te_layout.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
#include "tetraedge/te/te_vector2s32.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class BonusMenu : public TeLuaGUI {
|
||||
public:
|
||||
BonusMenu();
|
||||
|
||||
// This is called a "save button", but actually it's used for
|
||||
// bonus artwork in this context. Bad naming is copied from
|
||||
// the original.
|
||||
class SaveButton : public TeLayout {
|
||||
public:
|
||||
SaveButton(TeButtonLayout *btn, const Common::String &name, BonusMenu *owner);
|
||||
// another confusing name - actually just shows the bonus artwork
|
||||
bool onLoadSave();
|
||||
Common::String path() const;
|
||||
|
||||
BonusMenu *_menu;
|
||||
};
|
||||
|
||||
virtual void enter() override;
|
||||
virtual void enter(const Common::Path &scriptName);
|
||||
void leave() override;
|
||||
|
||||
void loadGame(Common::String &name) {
|
||||
_gameName = name;
|
||||
}
|
||||
|
||||
bool onLeftButton();
|
||||
bool onMouseMove(const Common::Point &pt);
|
||||
bool onPictureButton();
|
||||
bool onQuitButton();
|
||||
bool onRightButton();
|
||||
bool onSlideButtonDown();
|
||||
|
||||
// empty? bool onLoadGameConfirmed() { };
|
||||
|
||||
private:
|
||||
Common::Array<SaveButton *> _saveButtons;
|
||||
TeVector2s32 _slideBtnStartMousePos;
|
||||
Common::String _gameName;
|
||||
int _pageNo;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_BONUS_MENU_H
|
||||
181
engines/tetraedge/game/cellphone.cpp
Normal file
181
engines/tetraedge/game/cellphone.cpp
Normal file
@@ -0,0 +1,181 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/te/te_core.h"
|
||||
|
||||
#include "tetraedge/game/cellphone.h"
|
||||
#include "tetraedge/te/te_text_layout.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
Cellphone::Cellphone() : _nextNumber(0) {
|
||||
}
|
||||
|
||||
bool Cellphone::addNumber(const Common::String &num) {
|
||||
for (const Common::String &addedNum : _addedNumbers) {
|
||||
if (addedNum == num)
|
||||
return false;
|
||||
}
|
||||
|
||||
TeTextLayout *layout = new TeTextLayout();
|
||||
const Common::String namePrefix("numRepertoire");
|
||||
layout->setName(namePrefix + num);
|
||||
layout->setSizeType(RELATIVE_TO_PARENT);
|
||||
layout->setAnchor(TeVector3f32(0.5f, 0.0f, 0.0f));
|
||||
// WORKAROUND: Original uses (1.0, 1.0, 1.0) here but then the text area is too high.
|
||||
layout->setSize(TeVector3f32(1.0f, 0.6f, 0.0f));
|
||||
layout->setPosition(TeVector3f32(0.5f, 0.08f, 0.0f));
|
||||
layout->setTextSizeType(1);
|
||||
layout->setTextSizeProportionalToWidth(46);
|
||||
Common::String val("Unknown");
|
||||
const Common::String *locNum = g_engine->getCore()->loc()->text(num);
|
||||
if (locNum)
|
||||
val = *locNum;
|
||||
|
||||
layout->setText(_gui.value("textAttributs").toString() + val);
|
||||
layout->setVisible(true);
|
||||
_textLayoutArray.push_back(layout);
|
||||
_addedNumbers.push_back(num);
|
||||
|
||||
TeSpriteLayout *sprite = _gui.spriteLayoutChecked("numRepertoire");
|
||||
sprite->addChild(layout);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Cellphone::currentPage(int offset) {
|
||||
if (_textLayoutArray.empty())
|
||||
return;
|
||||
|
||||
_nextNumber = offset;
|
||||
TeLayout *repertoire = _gui.layoutChecked("numRepertoire");
|
||||
for (int i = 0; i < repertoire->childCount(); i++) {
|
||||
repertoire->child(i)->setVisible(i == offset);
|
||||
}
|
||||
}
|
||||
|
||||
void Cellphone::enter() {
|
||||
_gui.buttonLayoutChecked("background")->setVisible(true);
|
||||
currentPage(_nextNumber);
|
||||
}
|
||||
|
||||
void Cellphone::leave() {
|
||||
if (!_gui.loaded())
|
||||
return;
|
||||
|
||||
_gui.buttonLayoutChecked("background")->setVisible(false);
|
||||
for (TeTextLayout *text : _textLayoutArray) {
|
||||
text->deleteLater();
|
||||
}
|
||||
_textLayoutArray.clear();
|
||||
_addedNumbers.clear();
|
||||
}
|
||||
|
||||
void Cellphone::load() {
|
||||
_nextNumber = 0;
|
||||
TeButtonLayout *btnlayout;
|
||||
_gui.load("menus/cellphone.lua");
|
||||
btnlayout = _gui.buttonLayoutChecked("haut");
|
||||
btnlayout->onMouseClickValidated().add(this, &Cellphone::onPreviousNumber);
|
||||
btnlayout = _gui.buttonLayoutChecked("bas");
|
||||
btnlayout->onMouseClickValidated().add(this, &Cellphone::onNextNumber);
|
||||
btnlayout = _gui.buttonLayoutChecked("appeler");
|
||||
btnlayout->onMouseClickValidated().add(this, &Cellphone::onCallNumberValidated);
|
||||
btnlayout = _gui.buttonLayoutChecked("fermer");
|
||||
btnlayout->onMouseClickValidated().add(this, &Cellphone::onCloseButtonValidated);
|
||||
btnlayout = _gui.buttonLayoutChecked("background");
|
||||
btnlayout->setVisible(false);
|
||||
}
|
||||
|
||||
void Cellphone::loadFromBackup(const Common::XMLParser::ParserNode *node) {
|
||||
error("TODO: implement Cellphone::loadFromBackup");
|
||||
/*
|
||||
basic algorithm:
|
||||
child = node->lastChild;
|
||||
while (child != nullptr) {
|
||||
if (child->type == ELEMENT) {
|
||||
if (if child->userData == "Number") {
|
||||
addNumber(this, child->getAttribute("num"));
|
||||
}
|
||||
}
|
||||
child = child->prev;
|
||||
}*/
|
||||
}
|
||||
|
||||
bool Cellphone::onCallNumberValidated() {
|
||||
_onCallNumberSignal.call(_addedNumbers[_nextNumber]);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Cellphone::onCloseButtonValidated() {
|
||||
_gui.buttonLayoutChecked("background")->setVisible(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Cellphone::onNextNumber() {
|
||||
uint numoffset = _nextNumber + 1;
|
||||
if (numoffset < _textLayoutArray.size()) {
|
||||
currentPage(numoffset);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Cellphone::onPreviousNumber() {
|
||||
int numoffset = _nextNumber - 1;
|
||||
if (numoffset >= 0)
|
||||
currentPage(numoffset);
|
||||
return false;
|
||||
}
|
||||
|
||||
void Cellphone::saveToBackup(Common::XMLParser::ParserNode *xmlnode) {
|
||||
error("TODO: implement Cellphone::saveToBackup");
|
||||
}
|
||||
|
||||
void Cellphone::setVisible(bool visible) {
|
||||
_gui.buttonLayoutChecked("background")->setVisible(visible);
|
||||
}
|
||||
|
||||
void Cellphone::unload() {
|
||||
leave();
|
||||
_gui.unload();
|
||||
}
|
||||
|
||||
Common::Error Cellphone::syncState(Common::Serializer &s) {
|
||||
Common::Array<Common::String> numbers = _addedNumbers;
|
||||
uint numElems = numbers.size();
|
||||
s.syncAsUint32LE(numElems);
|
||||
if (numElems > 1000)
|
||||
error("Unexpected number of elems syncing cellphone");
|
||||
numbers.resize(numElems);
|
||||
for (uint i = 0; i < numElems; i++) {
|
||||
s.syncString(numbers[i]);
|
||||
}
|
||||
if (s.isLoading()) {
|
||||
if (!_addedNumbers.empty())
|
||||
leave();
|
||||
|
||||
for (const auto &num : numbers)
|
||||
addNumber(num);
|
||||
}
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
81
engines/tetraedge/game/cellphone.h
Normal file
81
engines/tetraedge/game/cellphone.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_CELLPHONE_H
|
||||
#define TETRAEDGE_GAME_CELLPHONE_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "common/callback.h"
|
||||
#include "common/str.h"
|
||||
#include "common/formats/xmlparser.h"
|
||||
|
||||
#include "tetraedge/te/te_layout.h"
|
||||
#include "tetraedge/te/te_text_layout.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Cellphone : public TeLayout {
|
||||
public:
|
||||
Cellphone();
|
||||
virtual ~Cellphone() {}
|
||||
|
||||
bool addNumber(const Common::String &num);
|
||||
void currentPage(int offset);
|
||||
|
||||
void enter();
|
||||
void leave();
|
||||
|
||||
void load();
|
||||
void loadFromBackup(const Common::XMLParser::ParserNode *node);
|
||||
|
||||
bool onCallNumberValidated();
|
||||
bool onCloseButtonValidated();
|
||||
bool onNextNumber();
|
||||
bool onPreviousNumber();
|
||||
|
||||
void saveToBackup(Common::XMLParser::ParserNode *xmlnode);
|
||||
void setVisible(bool visible);
|
||||
|
||||
TeSignal1Param<Common::String> &onCallNumber() {
|
||||
return _onCallNumberSignal;
|
||||
}
|
||||
|
||||
void unload();
|
||||
|
||||
Common::Error syncState(Common::Serializer &s);
|
||||
|
||||
TeLuaGUI &gui() { return _gui; }
|
||||
|
||||
private:
|
||||
|
||||
int _nextNumber;
|
||||
Common::Array<TeTextLayout*> _textLayoutArray;
|
||||
Common::Array<Common::String> _addedNumbers;
|
||||
|
||||
TeSignal1Param<Common::String> _onCallNumberSignal;
|
||||
|
||||
TeLuaGUI _gui;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_CELLPHONE_H
|
||||
1150
engines/tetraedge/game/character.cpp
Normal file
1150
engines/tetraedge/game/character.cpp
Normal file
File diff suppressed because it is too large
Load Diff
263
engines/tetraedge/game/character.h
Normal file
263
engines/tetraedge/game/character.h
Normal file
@@ -0,0 +1,263 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_CHARACTER_H
|
||||
#define TETRAEDGE_GAME_CHARACTER_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "common/str.h"
|
||||
#include "common/types.h"
|
||||
#include "common/ptr.h"
|
||||
#include "tetraedge/te/te_animation.h"
|
||||
#include "tetraedge/te/te_model_animation.h"
|
||||
#include "tetraedge/te/te_vector3f32.h"
|
||||
#include "tetraedge/te/te_matrix4x4.h"
|
||||
#include "tetraedge/te/te_model.h"
|
||||
#include "tetraedge/te/te_bezier_curve.h"
|
||||
#include "tetraedge/te/te_free_move_zone.h"
|
||||
#include "tetraedge/te/te_trs.h"
|
||||
#include "tetraedge/te/te_curve_anim2.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Character : public TeAnimation, public TeObject {
|
||||
public:
|
||||
Character();
|
||||
virtual ~Character();
|
||||
|
||||
struct AnimSettings {
|
||||
AnimSettings() : _stepLeft(0), _stepRight(0) {};
|
||||
Common::String _file;
|
||||
int _stepLeft;
|
||||
int _stepRight;
|
||||
};
|
||||
|
||||
struct WalkSettings {
|
||||
AnimSettings _walkParts[4];
|
||||
|
||||
void clear();
|
||||
};
|
||||
|
||||
struct CharacterSettings {
|
||||
CharacterSettings() : _walkSpeed(0.0f), _invertNormals(false) {}
|
||||
|
||||
Common::String _name;
|
||||
Common::String _modelFileName;
|
||||
TeVector3f32 _defaultScale;
|
||||
Common::String _idleAnimFileName;
|
||||
Common::HashMap<Common::String, WalkSettings> _walkSettings; // keys are "Walk", "Jog", etc
|
||||
float _walkSpeed;
|
||||
|
||||
TeVector3f32 _cutSceneCurveDemiPosition;
|
||||
Common::String _defaultEyes; // Note: Engine supports more, but in practice only one ever used.
|
||||
Common::String _defaultMouth; // Note: Engine supports more, but in practice only one ever used.
|
||||
Common::String _defaultBody; // Note: Engine supports more, but in practice only one ever used.
|
||||
|
||||
bool _invertNormals;
|
||||
|
||||
void clear();
|
||||
};
|
||||
|
||||
struct AnimCacheElement {
|
||||
TeIntrusivePtr<TeModelAnimation> _modelAnim;
|
||||
int _size;
|
||||
};
|
||||
|
||||
enum WalkPart {
|
||||
WalkPart_Start,
|
||||
WalkPart_Loop,
|
||||
WalkPart_EndD,
|
||||
WalkPart_EndG
|
||||
};
|
||||
|
||||
struct Callback {
|
||||
Common::String _luaFn;
|
||||
int _triggerFrame;
|
||||
int _lastCheckFrame;
|
||||
int _maxCalls;
|
||||
float _callsMade;
|
||||
};
|
||||
|
||||
class Water {
|
||||
Water();
|
||||
TeIntrusivePtr<TeModel> _model;
|
||||
TeCurveAnim2<TeModel,TeColor> _colorAnim;
|
||||
TeCurveAnim2<TeModel,TeVector3f32> _scaleAnim;
|
||||
};
|
||||
|
||||
void addCallback(const Common::String &s1, const Common::String &s2, float f1, float f2);
|
||||
|
||||
static void animCacheFreeAll();
|
||||
static void animCacheFreeOldest();
|
||||
static TeIntrusivePtr<TeModelAnimation> animCacheLoad(const Common::Path &path);
|
||||
|
||||
float animLength(const TeModelAnimation &modelanim, int bone, int lastframe);
|
||||
float animLengthFromFile(const Common::String &animname, uint32 *pframeCount, uint lastframe = 9999);
|
||||
bool blendAnimation(const Common::String &animname, float amount, bool repeat, bool returnToIdle);
|
||||
TeVector3f32 correctPosition(const TeVector3f32 &pos);
|
||||
float curveOffset();
|
||||
void deleteAllCallback();
|
||||
void deleteAnim();
|
||||
void deleteCallback(const Common::String &str1, const Common::String &str2, float f);
|
||||
//static bool deserialize(TiXmlElement *param_1, Walk *param_2);
|
||||
void endMove();
|
||||
|
||||
const WalkSettings *getCurrentWalkFiles();
|
||||
bool isFramePassed(int frameno);
|
||||
bool isWalkEnd();
|
||||
int leftStepFrame(enum WalkPart walkpart);
|
||||
int rightStepFrame(enum WalkPart walkpart);
|
||||
bool loadModel(const Common::String &name, bool unused);
|
||||
static bool loadSettings(const Common::Path &path);
|
||||
|
||||
bool onBonesUpdate(const Common::String &boneName, TeMatrix4x4 &boneMatrix);
|
||||
bool onModelAnimationFinished();
|
||||
void permanentUpdate();
|
||||
void placeOnCurve(TeIntrusivePtr<TeBezierCurve> &curve);
|
||||
//void play() // just called TeAnimation::play();
|
||||
void removeAnim();
|
||||
void removeFromCurve();
|
||||
Common::String rootBone() const;
|
||||
|
||||
bool setAnimation(const Common::String &name, bool repeat, bool returnToIdle = false, bool unused = false, int startFrame = -1, int endFrame = 9999);
|
||||
void setAnimationSound(const Common::String &name, uint offset);
|
||||
void setCurveOffset(float offset);
|
||||
void setFreeMoveZone(TeFreeMoveZone *zone);
|
||||
bool setShadowVisible(bool visible);
|
||||
void setStepSound(const Common::String &stepSound1, const Common::String &stepSound2);
|
||||
float speedFromAnim(double amount);
|
||||
//void stop(); // just maps to TeAnimation::stop();
|
||||
float translationFromAnim(const TeModelAnimation &anim, int bone, int frame);
|
||||
TeVector3f32 translationVectorFromAnim(const TeModelAnimation &anim, int bone, int frame);
|
||||
TeTRS trsFromAnim(const TeModelAnimation &anim, int bone, int frame);
|
||||
void update(double percentval) override;
|
||||
void updateAnimFrame();
|
||||
void updatePosition(float curveOffset);
|
||||
Common::String walkAnim(WalkPart part);
|
||||
void walkMode(const Common::String &mode);
|
||||
void walkTo(float curveEnd, bool walkFlag);
|
||||
|
||||
TeIntrusivePtr<TeModel> _model;
|
||||
TeIntrusivePtr<TeModel> _shadowModel[2];
|
||||
TeSignal1Param<const Common::String &> _characterAnimPlayerFinishedSignal;
|
||||
TeSignal1Param<const Common::String &> _onCharacterAnimFinishedSignal;
|
||||
|
||||
const CharacterSettings &characterSettings() const { return _characterSettings; }
|
||||
Common::String &walkModeStr() { return _walkModeStr; } // writable for loading games.
|
||||
const Common::String &curAnimName() const { return _curAnimName; }
|
||||
TeFreeMoveZone *freeMoveZone() { return _freeMoveZone; }
|
||||
const Common::String &freeMoveZoneName() const { return _freeMoveZoneName; }
|
||||
void setFreeMoveZoneName(const Common::String &val) { _freeMoveZoneName = val; }
|
||||
bool needsSomeUpdate() const { return _needsSomeUpdate; }
|
||||
void setNeedsSomeUpdate(bool val) { _needsSomeUpdate = val; }
|
||||
void setCharLookingAt(Character *other) { _charLookingAt = other; }
|
||||
void setCharLookingAtOffset(float val) { _charLookingAtOffset = val; }
|
||||
float charLookingAtOffset() const { return _charLookingAtOffset; }
|
||||
const TeVector3f32 &positionCharacter() const { return _positionCharacter; }
|
||||
void setPositionCharacter(const TeVector3f32 &val) { _positionCharacter = val; }
|
||||
bool positionFlag() const { return _positionFlag; }
|
||||
void setPositionFlag(bool val) { _positionFlag = val; }
|
||||
void setCurveStartLocation(const TeVector3f32 &val) { _curveStartLocation = val; }
|
||||
bool hasAnchor() const { return _hasAnchor; }
|
||||
void setHasAnchor(bool val) { _hasAnchor = val; }
|
||||
const TeVector2f32 &headRotation() const { return _headRotation; }
|
||||
void setHeadRotation(const TeVector2f32 &val) { _headRotation = val; }
|
||||
void setLastHeadRotation(const TeVector2f32 &val) { _lastHeadRotation = val; }
|
||||
const TeVector3f32 &lastHeadBoneTrans() const { return _lastHeadBoneTrans; }
|
||||
Character *charLookingAt() { return _charLookingAt; }
|
||||
bool lookingAtTallThing() const { return _lookingAtTallThing; }
|
||||
void setLookingAtTallThing(bool val) { _lookingAtTallThing = val; }
|
||||
TeIntrusivePtr<TeBezierCurve> curve() { return _curve; }
|
||||
void setRecallageY(bool val) { _recallageY = val; }
|
||||
|
||||
static void cleanup();
|
||||
|
||||
private:
|
||||
float _walkCurveStart;
|
||||
float _walkCurveLast;
|
||||
float _walkCurveEnd;
|
||||
float _walkCurveLen;
|
||||
float _walkCurveIncrement;
|
||||
float _walkCurveNextLength;
|
||||
float _walkedLength;
|
||||
int _walkTotalFrames;
|
||||
bool _walkToFlag;
|
||||
bool _walkEndAnimG;
|
||||
TeIntrusivePtr<TeBezierCurve> _curve;
|
||||
TeVector3f32 _curveStartLocation;
|
||||
|
||||
TeFreeMoveZone *_freeMoveZone;
|
||||
Common::String _freeMoveZoneName;
|
||||
Common::String _stepSound1;
|
||||
Common::String _stepSound2;
|
||||
Common::String _walkModeStr; // Walk or Jog
|
||||
Common::String _animSound;
|
||||
|
||||
Character *_charLookingAt;
|
||||
float _charLookingAtOffset; // Only used in Syberia 2
|
||||
|
||||
uint _animSoundOffset;
|
||||
|
||||
TeIntrusivePtr<TeModelAnimation> _curModelAnim;
|
||||
|
||||
CharacterSettings _characterSettings;
|
||||
|
||||
float _walkStartAnimLen;
|
||||
float _walkLoopAnimLen;
|
||||
float _walkEndGAnimLen;
|
||||
|
||||
uint32 _walkStartAnimFrameCount;
|
||||
uint32 _walkLoopAnimFrameCount;
|
||||
uint32 _walkEndGAnimFrameCount;
|
||||
|
||||
int _lastFrame;
|
||||
int _lastAnimFrame;
|
||||
bool _notWalkAnim;
|
||||
bool _returnToIdleAnim;
|
||||
bool _callbacksChanged;
|
||||
bool _needsSomeUpdate;
|
||||
bool _positionFlag;
|
||||
bool _lookingAtTallThing;
|
||||
bool _hasAnchor;
|
||||
bool _recallageY;
|
||||
|
||||
TeVector2f32 _headRotation;
|
||||
TeVector2f32 _lastHeadRotation;
|
||||
TeVector3f32 _lastHeadBoneTrans;
|
||||
|
||||
TeVector3f32 _positionCharacter;
|
||||
|
||||
// TODO: work out how these are different
|
||||
Common::String _setAnimName;
|
||||
Common::String _curAnimName;
|
||||
|
||||
Common::HashMap<Common::String, Common::Array<Callback *>> _callbacks;
|
||||
|
||||
// static Common::Array<AnimCacheElement> *_animCache; // Never used?
|
||||
// static uint _animCacheSize; // Never used?
|
||||
static Common::HashMap<Common::String, TeIntrusivePtr<TeModelAnimation>> *_animCacheMap;
|
||||
static Common::HashMap<Common::String, CharacterSettings> *_globalCharacterSettings;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_CHARACTER_H
|
||||
190
engines/tetraedge/game/character_settings_xml_parser.cpp
Normal file
190
engines/tetraedge/game/character_settings_xml_parser.cpp
Normal file
@@ -0,0 +1,190 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/character_settings_xml_parser.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_ModelsSettings(ParserNode *node) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_Model(ParserNode *node) {
|
||||
const Character::CharacterSettings emptySettings;
|
||||
const Common::String &name = node->values["name"];
|
||||
_characterSettings->setVal(name, emptySettings);
|
||||
_curCharacter = &_characterSettings->getVal(name);
|
||||
_curCharacter->_name = name;
|
||||
assert(_characterSettings != nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_modelFileName(ParserNode *node) {
|
||||
_curTextTag = TagModelFileName;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_defaultScale(ParserNode *node) {
|
||||
_curTextTag = TagDefaultScale;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_walk(ParserNode *node) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_animationFileName(ParserNode *node) {
|
||||
_curTextTag = TagAnimationFileName;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_walkType(ParserNode *node) {
|
||||
Common::String walkName = node->values["name"];
|
||||
_curWalkSettings = &(_curCharacter->_walkSettings[walkName]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Character::AnimSettings CharacterSettingsXmlParser::parseWalkAnimSettings(const ParserNode *node) const {
|
||||
Character::AnimSettings settings;
|
||||
const Common::StringMap &map = node->values;
|
||||
settings._file = map["file"];
|
||||
if (map.contains("stepRight"))
|
||||
settings._stepRight = map["stepRight"].asUint64();
|
||||
|
||||
if (map.contains("stepLeft"))
|
||||
settings._stepLeft = map["stepLeft"].asUint64();
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_start(ParserNode *node) {
|
||||
_curWalkSettings->_walkParts[0] = parseWalkAnimSettings(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_loop(ParserNode *node) {
|
||||
_curWalkSettings->_walkParts[1] = parseWalkAnimSettings(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_endD(ParserNode *node) {
|
||||
_curWalkSettings->_walkParts[2] = parseWalkAnimSettings(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_endG(ParserNode *node) {
|
||||
_curWalkSettings->_walkParts[3] = parseWalkAnimSettings(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_speed(ParserNode *node) {
|
||||
_curTextTag = TagSpeed;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_cutSceneCurveDemi(ParserNode *node) {
|
||||
// Handled in the "position" callback.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_position(ParserNode *node) {
|
||||
_curTextTag = TagPosition;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_rippleTexture(ParserNode *node) {
|
||||
// Ignored
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_face(ParserNode *node) {
|
||||
// Handled in "face" and "eyes" callbacks.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_eyes(ParserNode *node) {
|
||||
_curTextTag = TagEyes;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_mouth(ParserNode *node) {
|
||||
_curTextTag = TagMouth;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_body(ParserNode *node) {
|
||||
if (node->values["name"] != "default")
|
||||
error("CharacterSettingsXmlParser: Only default body supported.");
|
||||
_curTextTag = TagBody;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::parserCallback_invertNormals(ParserNode *node) {
|
||||
_curCharacter->_invertNormals = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::textCallback(const Common::String &val) {
|
||||
switch (_curTextTag) {
|
||||
case TagModelFileName:
|
||||
_curCharacter->_modelFileName = val;
|
||||
break;
|
||||
case TagDefaultScale:
|
||||
_curCharacter->_defaultScale.parse(val);
|
||||
break;
|
||||
case TagAnimationFileName:
|
||||
_curCharacter->_idleAnimFileName = val;
|
||||
break;
|
||||
case TagEyes:
|
||||
_curCharacter->_defaultEyes = val;
|
||||
break;
|
||||
case TagMouth:
|
||||
_curCharacter->_defaultMouth = val;
|
||||
break;
|
||||
case TagSpeed:
|
||||
_curCharacter->_walkSpeed = atof(val.c_str());
|
||||
break;
|
||||
case TagPosition:
|
||||
_curCharacter->_cutSceneCurveDemiPosition.parse(val);
|
||||
break;
|
||||
case TagBody:
|
||||
_curCharacter->_defaultBody = val;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterSettingsXmlParser::handleUnknownKey(ParserNode *node) {
|
||||
if (node->values.contains("animFile")) {
|
||||
// The game actually does nothing with these, they seem to be
|
||||
// for debugging purposes only.
|
||||
//const Common::String &animFile = node->values["animFile"];
|
||||
//debug("TODO: CharacterSettingsXmlParser handle mapping %s -> %s",
|
||||
// node->name.c_str(), animFile.c_str());
|
||||
return true;
|
||||
}
|
||||
parserError("Unknown key");
|
||||
return false;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
145
engines/tetraedge/game/character_settings_xml_parser.h
Normal file
145
engines/tetraedge/game/character_settings_xml_parser.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_CHARACTER_SETTINGS_XML_PARSER_H
|
||||
#define TETRAEDGE_GAME_CHARACTER_SETTINGS_XML_PARSER_H
|
||||
|
||||
#include "common/formats/xmlparser.h"
|
||||
#include "tetraedge/game/character.h"
|
||||
#include "tetraedge/te/te_vector3f32.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class CharacterSettingsXmlParser : public Common::XMLParser {
|
||||
public:
|
||||
void setCharacterSettings(Common::HashMap<Common::String, Character::CharacterSettings> *settings) {
|
||||
_characterSettings = settings;
|
||||
};
|
||||
|
||||
// Parser
|
||||
CUSTOM_XML_PARSER(CharacterSettingsXmlParser) {
|
||||
XML_KEY(ModelsSettings)
|
||||
XML_KEY(Model)
|
||||
XML_PROP(name, true)
|
||||
XML_KEY(modelFileName)
|
||||
KEY_END()
|
||||
XML_KEY(defaultScale)
|
||||
KEY_END()
|
||||
XML_KEY(invertNormals)
|
||||
KEY_END()
|
||||
XML_KEY(walk)
|
||||
XML_KEY(animationFileName)
|
||||
KEY_END()
|
||||
XML_KEY(walkType)
|
||||
XML_PROP(name, true)
|
||||
XML_KEY(start)
|
||||
XML_PROP(file, true)
|
||||
XML_PROP(stepRight, false)
|
||||
XML_PROP(stepLeft, false)
|
||||
KEY_END()
|
||||
XML_KEY(loop)
|
||||
XML_PROP(file, true)
|
||||
XML_PROP(stepRight, false)
|
||||
XML_PROP(stepLeft, false)
|
||||
KEY_END()
|
||||
XML_KEY(endD)
|
||||
XML_PROP(file, true)
|
||||
XML_PROP(stepRight, false)
|
||||
XML_PROP(stepLeft, false)
|
||||
KEY_END()
|
||||
XML_KEY(endG)
|
||||
XML_PROP(file, true)
|
||||
XML_PROP(stepRight, false)
|
||||
XML_PROP(stepLeft, false)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
XML_KEY(speed)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
XML_KEY(cutSceneCurveDemi)
|
||||
XML_KEY(position)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
XML_KEY(face)
|
||||
XML_PROP(name, true)
|
||||
XML_KEY(eyes)
|
||||
KEY_END()
|
||||
XML_KEY(mouth)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
XML_KEY(body)
|
||||
XML_PROP(name, true)
|
||||
KEY_END()
|
||||
XML_KEY(rippleTexture)
|
||||
XML_PROP(path, true)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
} PARSER_END()
|
||||
|
||||
// Parser callback methods
|
||||
bool parserCallback_ModelsSettings(ParserNode *node);
|
||||
bool parserCallback_Model(ParserNode *node);
|
||||
bool parserCallback_modelFileName(ParserNode *node);
|
||||
bool parserCallback_defaultScale(ParserNode *node);
|
||||
bool parserCallback_walk(ParserNode *node);
|
||||
bool parserCallback_animationFileName(ParserNode *node);
|
||||
bool parserCallback_walkType(ParserNode *node);
|
||||
bool parserCallback_start(ParserNode *node); // walk anim
|
||||
bool parserCallback_loop(ParserNode *node); // walk anim
|
||||
bool parserCallback_endD(ParserNode *node); // for walk anim
|
||||
bool parserCallback_endG(ParserNode *node); // for walk anim
|
||||
bool parserCallback_speed(ParserNode *node); // walk speed
|
||||
bool parserCallback_cutSceneCurveDemi(ParserNode *node);
|
||||
bool parserCallback_position(ParserNode *node); // position of cutSceneCurveDemi
|
||||
bool parserCallback_face(ParserNode *node);
|
||||
bool parserCallback_eyes(ParserNode *node);
|
||||
bool parserCallback_mouth(ParserNode *node);
|
||||
bool parserCallback_body(ParserNode *node);
|
||||
bool parserCallback_invertNormals(ParserNode *node);
|
||||
bool parserCallback_rippleTexture(ParserNode *node);
|
||||
|
||||
bool textCallback(const Common::String &val) override;
|
||||
bool handleUnknownKey(ParserNode *node) override;
|
||||
|
||||
private:
|
||||
Character::AnimSettings parseWalkAnimSettings(const ParserNode *node) const;
|
||||
|
||||
enum TextTagType {
|
||||
TagModelFileName,
|
||||
TagDefaultScale,
|
||||
TagAnimationFileName,
|
||||
TagEyes,
|
||||
TagMouth,
|
||||
TagSpeed,
|
||||
TagPosition,
|
||||
TagBody
|
||||
};
|
||||
|
||||
TextTagType _curTextTag;
|
||||
Character::CharacterSettings *_curCharacter;
|
||||
Character::WalkSettings *_curWalkSettings;
|
||||
Common::HashMap<Common::String, Character::CharacterSettings> *_characterSettings;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_CHARACTER_SETTINGS_XML_PARSER_H
|
||||
102
engines/tetraedge/game/characters_shadow.cpp
Normal file
102
engines/tetraedge/game/characters_shadow.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/character.h"
|
||||
#include "tetraedge/game/characters_shadow.h"
|
||||
#include "tetraedge/game/characters_shadow_opengl.h"
|
||||
#include "tetraedge/game/characters_shadow_tinygl.h"
|
||||
#include "tetraedge/te/te_light.h"
|
||||
#include "tetraedge/te/te_renderer.h"
|
||||
#include "tetraedge/te/te_3d_texture.h"
|
||||
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
/*static*/
|
||||
Te3DObject2 *CharactersShadow::_camTarget = nullptr;
|
||||
|
||||
CharactersShadow::CharactersShadow() : _glTex(0), _texSize(0) {
|
||||
}
|
||||
|
||||
void CharactersShadow::create(InGameScene *scene) {
|
||||
_texSize = 720;
|
||||
_camTarget = new Te3DObject2();
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
renderer->enableTexture();
|
||||
_camera = new TeCamera();
|
||||
_camera->setProjMatrixType(2);
|
||||
_camera->setAspectRatio(1.0);
|
||||
_camera->setName("_shadowCam");
|
||||
_camera->viewport(0, 0, _texSize, _texSize);
|
||||
|
||||
createInternal();
|
||||
|
||||
renderer->disableTexture();
|
||||
}
|
||||
|
||||
void CharactersShadow::createTexture(InGameScene *scene) {
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
renderer->enableTexture();
|
||||
TeLight *light = scene->shadowLight();
|
||||
if (light) {
|
||||
const TeQuaternion q1 = TeQuaternion::fromAxisAndAngle(TeVector3f32(0, 1, 0), light->positionRadial().getX() - M_PI_2);
|
||||
const TeQuaternion q2 = TeQuaternion::fromAxisAndAngle(TeVector3f32(1, 0, 0), light->positionRadial().getY());
|
||||
_camera->setRotation(q2 * q1);
|
||||
_camera->setPosition(light->position3d());
|
||||
}
|
||||
_camera->setFov((float)(scene->shadowFov() * M_PI / 180.0));
|
||||
_camera->setOrthoPlanes(scene->shadowNearPlane(), scene->shadowFarPlane());
|
||||
_camera->apply();
|
||||
|
||||
createTextureInternal(scene);
|
||||
|
||||
TeCamera::restore();
|
||||
TeCamera::restore();
|
||||
}
|
||||
|
||||
void CharactersShadow::destroy() {
|
||||
deleteTexture();
|
||||
if (_camera)
|
||||
_camera = nullptr;
|
||||
if (_camTarget) {
|
||||
delete _camTarget;
|
||||
_camTarget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/
|
||||
CharactersShadow *CharactersShadow::makeInstance() {
|
||||
Graphics::RendererType r = g_engine->preferredRendererType();
|
||||
|
||||
#if defined(USE_OPENGL_GAME)
|
||||
if (r == Graphics::kRendererTypeOpenGL)
|
||||
return new CharactersShadowOpenGL();
|
||||
#endif
|
||||
|
||||
#if defined(USE_TINYGL)
|
||||
if (r == Graphics::kRendererTypeTinyGL)
|
||||
return new CharactersShadowTinyGL();
|
||||
#endif
|
||||
error("Couldn't create CharactersShadow for selected renderer");
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
58
engines/tetraedge/game/characters_shadow.h
Normal file
58
engines/tetraedge/game/characters_shadow.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_CHARACTERS_SHADOW_H
|
||||
#define TETRAEDGE_GAME_CHARACTERS_SHADOW_H
|
||||
|
||||
#include "tetraedge/game/in_game_scene.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class InGameScene;
|
||||
|
||||
class CharactersShadow {
|
||||
public:
|
||||
CharactersShadow();
|
||||
virtual ~CharactersShadow() {};
|
||||
|
||||
void create(InGameScene *scene);
|
||||
void createTexture(InGameScene *scene);
|
||||
void destroy();
|
||||
virtual void draw(InGameScene *scene) = 0;
|
||||
//void drawTexture(); // empty?
|
||||
|
||||
// Make an instance which is correct for the preferred renderer
|
||||
static CharactersShadow *makeInstance();
|
||||
|
||||
protected:
|
||||
virtual void createInternal() = 0;
|
||||
virtual void createTextureInternal(InGameScene *scene) = 0;
|
||||
virtual void deleteTexture() = 0;
|
||||
|
||||
uint _glTex;
|
||||
int _texSize;
|
||||
TeIntrusivePtr<TeCamera> _camera;
|
||||
static Te3DObject2 *_camTarget;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_CHARACTERS_SHADOW_H
|
||||
151
engines/tetraedge/game/characters_shadow_opengl.cpp
Normal file
151
engines/tetraedge/game/characters_shadow_opengl.cpp
Normal file
@@ -0,0 +1,151 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "graphics/opengl/system_headers.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/character.h"
|
||||
#include "tetraedge/game/characters_shadow_opengl.h"
|
||||
#include "tetraedge/te/te_light.h"
|
||||
#include "tetraedge/te/te_renderer.h"
|
||||
#include "tetraedge/te/te_3d_texture_opengl.h"
|
||||
|
||||
//#define TETRAEDGE_DUMP_SHADOW_RENDER 1
|
||||
|
||||
#ifdef TETRAEDGE_DUMP_SHADOW_RENDER
|
||||
#include "image/png.h"
|
||||
static int dumpCount = 0;
|
||||
#endif
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
void CharactersShadowOpenGL::createInternal() {
|
||||
Te3DTextureOpenGL::unbind();
|
||||
glGenTextures(1, &_glTex);
|
||||
glBindTexture(GL_TEXTURE_2D, _glTex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, _texSize, _texSize, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, nullptr);
|
||||
}
|
||||
|
||||
void CharactersShadowOpenGL::createTextureInternal(InGameScene *scene) {
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
renderer->clearBuffer(TeRenderer::ColorAndDepth);
|
||||
|
||||
for (Character *character : scene->_characters) {
|
||||
character->_model->draw();
|
||||
}
|
||||
scene->_character->_model->draw();
|
||||
Te3DTextureOpenGL::unbind();
|
||||
glBindTexture(GL_TEXTURE_2D, _glTex);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, _texSize, _texSize);
|
||||
renderer->clearBuffer(TeRenderer::ColorAndDepth);
|
||||
|
||||
#ifdef TETRAEDGE_DUMP_SHADOW_RENDER
|
||||
Graphics::Surface tex;
|
||||
tex.create(_texSize, _texSize, Graphics::PixelFormat::createFormatRGBA32());
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex.getPixels());
|
||||
Common::DumpFile dumpFile;
|
||||
tex.flipVertical(Common::Rect(tex.w, tex.h));
|
||||
dumpFile.open(Common::String::format("/tmp/rendered-shadow-dump-%04d.png", dumpCount));
|
||||
dumpCount++;
|
||||
Image::writePNG(dumpFile, tex);
|
||||
tex.free();
|
||||
dumpFile.close();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CharactersShadowOpenGL::deleteTexture() {
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
renderer->disableTexture();
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glDeleteTextures(1, &_glTex);
|
||||
}
|
||||
|
||||
void CharactersShadowOpenGL::draw(InGameScene *scene) {
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
glDepthMask(false);
|
||||
renderer->disableZBuffer();
|
||||
renderer->enableTexture();
|
||||
glBindTexture(GL_TEXTURE_2D, _glTex);
|
||||
Te3DTextureOpenGL::unbind();
|
||||
glBindTexture(GL_TEXTURE_2D, _glTex);
|
||||
glEnable(GL_BLEND);
|
||||
renderer->setCurrentColor(scene->shadowColor());
|
||||
|
||||
TeMatrix4x4 matrix;
|
||||
matrix.translate(TeVector3f32(0.5f, 0.5f, 0.5f));
|
||||
matrix.scale(TeVector3f32(0.5f, 0.5f, 0.5f));
|
||||
matrix = matrix * _camera->projectionMatrix();
|
||||
|
||||
TeMatrix4x4 cammatrix = _camera->worldTransformationMatrix();
|
||||
cammatrix.inverse();
|
||||
|
||||
matrix = matrix * cammatrix;
|
||||
|
||||
float f[4];
|
||||
|
||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
||||
for (uint i = 0; i < 4; i++)
|
||||
f[i] = matrix(0, i);
|
||||
glTexGenfv(GL_S, GL_EYE_PLANE, f);
|
||||
|
||||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
||||
for (uint i = 0; i < 4; i++)
|
||||
f[i] = matrix(1, i);
|
||||
glTexGenfv(GL_T, GL_EYE_PLANE, f);
|
||||
|
||||
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
||||
for (uint i = 0; i < 4; i++)
|
||||
f[i] = matrix(2, i);
|
||||
glTexGenfv(GL_R, GL_EYE_PLANE, f);
|
||||
|
||||
glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
||||
for (uint i = 0; i < 4; i++)
|
||||
f[i] = matrix(3, i);
|
||||
glTexGenfv(GL_Q, GL_EYE_PLANE, f);
|
||||
|
||||
Te3DTextureOpenGL::unbind();
|
||||
glBindTexture(GL_TEXTURE_2D, _glTex);
|
||||
glEnable(GL_BLEND);
|
||||
renderer->setCurrentColor(scene->shadowColor());
|
||||
|
||||
Common::Array<TeIntrusivePtr<TeModel>> &models =
|
||||
(g_engine->gameType() == TetraedgeEngine::kSyberia ?
|
||||
scene->zoneModels() : scene->shadowReceivingObjects());
|
||||
for (TeIntrusivePtr<TeModel> model : models) {
|
||||
if (model->meshes().size() > 0 && model->meshes()[0]->materials().empty()) {
|
||||
model->meshes()[0]->defaultMaterial(TeIntrusivePtr<Te3DTexture>());
|
||||
model->meshes()[0]->materials()[0]._isShadowTexture = true;
|
||||
model->meshes()[0]->materials()[0]._diffuseColor = scene->shadowColor();
|
||||
}
|
||||
model->draw();
|
||||
}
|
||||
|
||||
renderer->disableTexture();
|
||||
glDepthMask(true);
|
||||
renderer->enableZBuffer();
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
50
engines/tetraedge/game/characters_shadow_opengl.h
Normal file
50
engines/tetraedge/game/characters_shadow_opengl.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_CHARACTERS_SHADOW_OPENGL_H
|
||||
#define TETRAEDGE_GAME_CHARACTERS_SHADOW_OPENGL_H
|
||||
|
||||
#if defined(USE_OPENGL_GAME)
|
||||
|
||||
#include "tetraedge/game/characters_shadow.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class InGameScene;
|
||||
|
||||
class CharactersShadowOpenGL : public CharactersShadow {
|
||||
public:
|
||||
CharactersShadowOpenGL() {};
|
||||
|
||||
void draw(InGameScene *scene) override;
|
||||
|
||||
protected:
|
||||
virtual void createInternal() override;
|
||||
virtual void createTextureInternal(InGameScene *scene) override;
|
||||
virtual void deleteTexture() override;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // USE_OPENGL
|
||||
|
||||
#endif // TETRAEDGE_GAME_CHARACTERS_SHADOW_OPENGL_H
|
||||
140
engines/tetraedge/game/characters_shadow_tinygl.cpp
Normal file
140
engines/tetraedge/game/characters_shadow_tinygl.cpp
Normal file
@@ -0,0 +1,140 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "graphics/tinygl/tinygl.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/character.h"
|
||||
#include "tetraedge/game/characters_shadow_tinygl.h"
|
||||
#include "tetraedge/te/te_light.h"
|
||||
#include "tetraedge/te/te_renderer.h"
|
||||
#include "tetraedge/te/te_3d_texture_tinygl.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
void CharactersShadowTinyGL::createInternal() {
|
||||
Te3DTextureTinyGL::unbind();
|
||||
tglGenTextures(1, &_glTex);
|
||||
tglBindTexture(TGL_TEXTURE_2D, _glTex);
|
||||
tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MIN_FILTER, TGL_LINEAR);
|
||||
tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MAG_FILTER, TGL_LINEAR);
|
||||
tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_WRAP_S, TGL_CLAMP);
|
||||
tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_WRAP_T, TGL_CLAMP);
|
||||
// TODO: not supported in TGL
|
||||
//tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_LUMINANCE_ALPHA, _texSize, _texSize, 0, TGL_LUMINANCE_ALPHA, TGL_UNSIGNED_BYTE, nullptr);
|
||||
}
|
||||
|
||||
void CharactersShadowTinyGL::createTextureInternal(InGameScene *scene) {
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
tglClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
renderer->clearBuffer(TeRenderer::ColorAndDepth);
|
||||
|
||||
for (Character *character : scene->_characters) {
|
||||
character->_model->draw();
|
||||
}
|
||||
scene->_character->_model->draw();
|
||||
Te3DTextureTinyGL::unbind();
|
||||
tglBindTexture(TGL_TEXTURE_2D, _glTex);
|
||||
// TODO: Find TGL equivalent for this..
|
||||
// tglCopyTexSubImage2D(TGL_TEXTURE_2D, 0, 0, 0, 0, 0, _texSize, _texSize);
|
||||
renderer->clearBuffer(TeRenderer::ColorAndDepth);
|
||||
}
|
||||
|
||||
void CharactersShadowTinyGL::deleteTexture() {
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
renderer->disableTexture();
|
||||
tglBindTexture(TGL_TEXTURE_2D, 0);
|
||||
tglDeleteTextures(1, &_glTex);
|
||||
}
|
||||
|
||||
void CharactersShadowTinyGL::draw(InGameScene *scene) {
|
||||
TeRenderer *renderer = g_engine->getRenderer();
|
||||
tglDepthMask(false);
|
||||
renderer->disableZBuffer();
|
||||
renderer->enableTexture();
|
||||
tglBindTexture(TGL_TEXTURE_2D, _glTex);
|
||||
Te3DTextureTinyGL::unbind();
|
||||
tglBindTexture(TGL_TEXTURE_2D, _glTex);
|
||||
tglEnable(TGL_BLEND);
|
||||
renderer->setCurrentColor(scene->shadowColor());
|
||||
|
||||
TeMatrix4x4 matrix;
|
||||
matrix.translate(TeVector3f32(0.5f, 0.5f, 0.5f));
|
||||
matrix.scale(TeVector3f32(0.5f, 0.5f, 0.5f));
|
||||
matrix = matrix * _camera->projectionMatrix();
|
||||
|
||||
TeMatrix4x4 cammatrix = _camera->worldTransformationMatrix();
|
||||
cammatrix.inverse();
|
||||
|
||||
matrix = matrix * cammatrix;
|
||||
|
||||
/* TODO: Find TGL equivalents for the following block. */
|
||||
/*
|
||||
tglTexGeni(TGL_S, TGL_TEXTURE_GEN_MODE, TGL_EYE_LINEAR);
|
||||
|
||||
float f[4];
|
||||
for (uint i = 0; i < 4; i++)
|
||||
f[i] = matrix(0, i);
|
||||
|
||||
tglTexGenfv(TGL_S, TGL_EYE_PLANE, f);
|
||||
tglTexGeni(TGL_T, TGL_TEXTURE_GEN_MODE, TGL_EYE_LINEAR);
|
||||
|
||||
for (uint i = 0; i < 4; i++)
|
||||
f[i] = matrix(1, i);
|
||||
|
||||
tglTexGenfv(TGL_T, TGL_EYE_PLANE, f);
|
||||
tglTexGeni(TGL_R, TGL_TEXTURE_GEN_MODE, TGL_EYE_LINEAR);
|
||||
|
||||
for (uint i = 0; i < 4; i++)
|
||||
f[i] = matrix(2, i);
|
||||
|
||||
tglTexGenfv(TGL_R, TGL_EYE_PLANE, f);
|
||||
tglTexGeni(TGL_Q, TGL_TEXTURE_GEN_MODE, TGL_EYE_LINEAR);
|
||||
|
||||
for (uint i = 0; i < 4; i++)
|
||||
f[i] = matrix(3, i);
|
||||
|
||||
tglTexGenfv(TGL_Q, TGL_EYE_PLANE, f);
|
||||
*/
|
||||
|
||||
Te3DTextureTinyGL::unbind();
|
||||
tglBindTexture(TGL_TEXTURE_2D, _glTex);
|
||||
tglEnable(TGL_BLEND);
|
||||
renderer->setCurrentColor(scene->shadowColor());
|
||||
|
||||
Common::Array<TeIntrusivePtr<TeModel>> &models =
|
||||
(g_engine->gameType() == TetraedgeEngine::kSyberia ?
|
||||
scene->zoneModels() : scene->shadowReceivingObjects());
|
||||
for (TeIntrusivePtr<TeModel> model : models) {
|
||||
if (model->meshes().size() > 0 && model->meshes()[0]->materials().empty()) {
|
||||
model->meshes()[0]->defaultMaterial(TeIntrusivePtr<Te3DTexture>());
|
||||
model->meshes()[0]->materials()[0]._isShadowTexture = true;
|
||||
model->meshes()[0]->materials()[0]._diffuseColor = scene->shadowColor();
|
||||
}
|
||||
model->draw();
|
||||
}
|
||||
|
||||
renderer->disableTexture();
|
||||
tglDepthMask(true);
|
||||
renderer->enableZBuffer();
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
50
engines/tetraedge/game/characters_shadow_tinygl.h
Normal file
50
engines/tetraedge/game/characters_shadow_tinygl.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_CHARACTERS_SHADOW_TINYGL_H
|
||||
#define TETRAEDGE_GAME_CHARACTERS_SHADOW_TINYGL_H
|
||||
|
||||
#if defined(USE_TINYGL)
|
||||
|
||||
#include "tetraedge/game/characters_shadow.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class InGameScene;
|
||||
|
||||
class CharactersShadowTinyGL : public CharactersShadow {
|
||||
public:
|
||||
CharactersShadowTinyGL() {};
|
||||
|
||||
void draw(InGameScene *scene) override;
|
||||
|
||||
protected:
|
||||
virtual void createInternal() override;
|
||||
virtual void createTextureInternal(InGameScene *scene) override;
|
||||
virtual void deleteTexture() override;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // USE_TINYGL
|
||||
|
||||
#endif // TETRAEDGE_GAME_CHARACTERS_SHADOW_TINYGL_H
|
||||
136
engines/tetraedge/game/confirm.cpp
Normal file
136
engines/tetraedge/game/confirm.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/config-manager.h"
|
||||
|
||||
#include "tetraedge/game/confirm.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/tetraedge.h"
|
||||
|
||||
#include "tetraedge/te/te_text_layout.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
Confirm::Confirm() {
|
||||
}
|
||||
|
||||
void Confirm::enter(const Common::Path &guiPath, const Common::String &y) {
|
||||
_gui.load(guiPath);
|
||||
TeLayout *backgroundLayout = _gui.layout("background");
|
||||
if (!backgroundLayout) {
|
||||
warning("confirm script not loaded, default to Yes.");
|
||||
onButtonYes();
|
||||
return;
|
||||
}
|
||||
backgroundLayout->setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
|
||||
Application *app = g_engine->getApplication();
|
||||
TeButtonLayout *confirmButtonLayout = _gui.buttonLayout("confirm");
|
||||
app->frontOrientationLayout().addChild(confirmButtonLayout);
|
||||
|
||||
TeButtonLayout *yesButtonLayout = _gui.buttonLayout("yes");
|
||||
if (yesButtonLayout)
|
||||
yesButtonLayout->onMouseClickValidated().add(this, &Confirm::onButtonYes);
|
||||
|
||||
TeButtonLayout *noButtonLayout = _gui.buttonLayout("no");
|
||||
if (noButtonLayout)
|
||||
noButtonLayout->onMouseClickValidated().add(this, &Confirm::onButtonNo);
|
||||
|
||||
TeLayout *textLayout = _gui.layout("text");
|
||||
if (textLayout) {
|
||||
const Common::String textAttributs = _gui.value("textAttributs").toString();
|
||||
const Common::String textAttributsDown = _gui.value("textAttributsDown").toString();
|
||||
const Common::String *okButtonLoc = app->loc().value("okButton");
|
||||
const Common::String *cancelButtonLoc = app->loc().value("cancelButton");
|
||||
|
||||
TeTextLayout *textTextLayout = dynamic_cast<TeTextLayout *>(textLayout->child(0));
|
||||
if (!textTextLayout)
|
||||
error("Expected text layout child.");
|
||||
const Common::String *textLayoutName = app->loc().value(textTextLayout->name());
|
||||
const char *fallbackText = "Do you really want to quit?"; // FIXME: Needed for Syberia II
|
||||
textTextLayout->setText(textAttributs + (textLayoutName ? *textLayoutName : fallbackText));
|
||||
|
||||
if (!okButtonLoc || !cancelButtonLoc) {
|
||||
error("Missing translations for ok and cancel");
|
||||
}
|
||||
|
||||
TeITextLayout *yesUpLayout = _gui.textLayout("yesUpLayout");
|
||||
if (yesUpLayout)
|
||||
yesUpLayout->setText(textAttributs + *okButtonLoc);
|
||||
|
||||
TeITextLayout *yesDownLayout = _gui.textLayout("yesDownLayout");
|
||||
if (yesDownLayout)
|
||||
yesDownLayout->setText(textAttributsDown + *okButtonLoc);
|
||||
|
||||
TeITextLayout *yesRollOverLayout = _gui.textLayout("yesRollOverLayout");
|
||||
if (yesRollOverLayout)
|
||||
yesRollOverLayout->setText(textAttributs + *okButtonLoc);
|
||||
|
||||
TeITextLayout *noUpLayout = _gui.textLayout("noUpLayout");
|
||||
if (noUpLayout)
|
||||
noUpLayout->setText(textAttributs + *cancelButtonLoc);
|
||||
|
||||
TeITextLayout *noDownLayout = _gui.textLayout("noDownLayout");
|
||||
if (noDownLayout)
|
||||
noDownLayout->setText(textAttributsDown + *cancelButtonLoc);
|
||||
|
||||
TeITextLayout *noRollOverLayout = _gui.textLayout("noRollOverLayout");
|
||||
if (noRollOverLayout)
|
||||
noRollOverLayout->setText(textAttributs + *cancelButtonLoc);
|
||||
}
|
||||
|
||||
// Make sure the mouse cursor is back on top.
|
||||
app->frontOrientationLayout().removeChild(&app->mouseCursorLayout());
|
||||
app->frontOrientationLayout().addChild(&app->mouseCursorLayout());
|
||||
|
||||
if (ConfMan.getBool("skip_confirm")) {
|
||||
onButtonYes();
|
||||
}
|
||||
}
|
||||
|
||||
void Confirm::leave() {
|
||||
Application *app = g_engine->getApplication();
|
||||
TeButtonLayout *confirmButtonLayout = _gui.buttonLayout("confirm");
|
||||
if (confirmButtonLayout) {
|
||||
app->frontLayout().removeChild(confirmButtonLayout);
|
||||
}
|
||||
_gui.unload();
|
||||
}
|
||||
|
||||
bool Confirm::onButtonNo() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
leave();
|
||||
_onButtonNoSignal.call();
|
||||
app->fade();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Confirm::onButtonYes() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
leave();
|
||||
_onButtonYesSignal.call();
|
||||
app->fade();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
53
engines/tetraedge/game/confirm.h
Normal file
53
engines/tetraedge/game/confirm.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_CONFIRM_H
|
||||
#define TETRAEDGE_GAME_CONFIRM_H
|
||||
|
||||
#include "common/str.h"
|
||||
|
||||
#include "tetraedge/te/te_signal.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Confirm {
|
||||
public:
|
||||
Confirm();
|
||||
|
||||
void enter(const Common::Path &guiPath, const Common::String &y);
|
||||
void leave();
|
||||
|
||||
bool onButtonNo();
|
||||
bool onButtonYes();
|
||||
|
||||
TeSignal0Param &onButtonNoSignal() { return _onButtonNoSignal; }
|
||||
TeSignal0Param &onButtonYesSignal() { return _onButtonYesSignal; }
|
||||
|
||||
private:
|
||||
TeLuaGUI _gui;
|
||||
TeSignal0Param _onButtonNoSignal;
|
||||
TeSignal0Param _onButtonYesSignal;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_CONFIRM_H
|
||||
243
engines/tetraedge/game/credits.cpp
Normal file
243
engines/tetraedge/game/credits.cpp
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/textconsole.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/credits.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
Credits::Credits() : _animCounter(0), _returnToOptions(false) {
|
||||
}
|
||||
|
||||
void Credits::enter(bool returnToOptions) {
|
||||
_returnToOptions = returnToOptions;
|
||||
_animCounter = 0;
|
||||
_timer.start();
|
||||
// TODO: set _field0x50 = 0;
|
||||
if (!g_engine->gameIsAmerzone())
|
||||
_gui.load("menus/credits/credits.lua");
|
||||
else
|
||||
_gui.load("GUI/Credits.lua");
|
||||
Application *app = g_engine->getApplication();
|
||||
app->frontLayout().addChild(_gui.layoutChecked("menu"));
|
||||
|
||||
Common::Path musicPath(_gui.value("musicPath").toString(), '/');
|
||||
if (!app->music().isPlaying() || app->music().path() != musicPath) {
|
||||
app->music().stop();
|
||||
app->music().load(musicPath);
|
||||
app->music().play();
|
||||
app->music().volume(1.0f);
|
||||
}
|
||||
|
||||
TeButtonLayout *bgbtn = _gui.buttonLayout("background");
|
||||
if (bgbtn) {
|
||||
bgbtn->onMouseClickValidated().add(this, &Credits::onQuitButton);
|
||||
}
|
||||
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *posAnim = _gui.layoutPositionLinearAnimation("scrollTextPositionAnim");
|
||||
if (!posAnim)
|
||||
error("Credits gui - couldn't find scrollTextPositionAnim");
|
||||
posAnim->onFinished().add(this, &Credits::onAnimFinished);
|
||||
posAnim->_callbackObj = _gui.layoutChecked("text");
|
||||
posAnim->_callbackMethod = &TeLayout::setPosition;
|
||||
posAnim->play();
|
||||
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *anchorAnim = _gui.layoutAnchorLinearAnimation("scrollTextAnchorAnim");
|
||||
if (!anchorAnim)
|
||||
error("Credits gui - couldn't find scrollTextAnchorAnim");
|
||||
|
||||
anchorAnim->_callbackObj = _gui.layoutChecked("text");
|
||||
anchorAnim->_callbackMethod = &TeLayout::setAnchor;
|
||||
anchorAnim->play();
|
||||
|
||||
if (g_engine->gameType() == TetraedgeEngine::kSyberia) {
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *bgPosAnim = _gui.layoutPositionLinearAnimation("scrollBackgroundPositionAnim");
|
||||
if (!bgPosAnim)
|
||||
error("Credits gui - couldn't find scrollBackgroundPositionAnim");
|
||||
|
||||
bgPosAnim->_callbackObj = _gui.layoutChecked("backgroundSprite");
|
||||
bgPosAnim->_callbackMethod = &TeLayout::setAnchor;
|
||||
bgPosAnim->play();
|
||||
}
|
||||
|
||||
_curveAnim._runTimer.pausable(false);
|
||||
_curveAnim.stop();
|
||||
_curveAnim._startVal = TeColor(0xff, 0xff, 0xff, 0);
|
||||
_curveAnim._endVal = TeColor(0xff, 0xff, 0xff, 0xff);
|
||||
Common::Array<float> curve;
|
||||
curve.push_back(0.0f);
|
||||
curve.push_back(0.0f);
|
||||
curve.push_back(0.0f);
|
||||
curve.push_back(0.0f);
|
||||
curve.push_back(1.0f);
|
||||
_curveAnim._repeatCount = 1;
|
||||
_curveAnim.setCurve(curve);
|
||||
_curveAnim._duration = 12000;
|
||||
|
||||
if (g_engine->gameType() == TetraedgeEngine::kSyberia) {
|
||||
TeLayout *backgrounds = _gui.layoutChecked("Backgrounds");
|
||||
if (_animCounter < backgrounds->childCount()) {
|
||||
TeSpriteLayout *bgchild = dynamic_cast<TeSpriteLayout *>(backgrounds->child(_animCounter));
|
||||
if (!bgchild)
|
||||
error("Child of backgrounds is not a TeSpriteLayout");
|
||||
_curveAnim._callbackObj = bgchild;
|
||||
_curveAnim._callbackMethod = &TeLayout::setColor;
|
||||
_curveAnim.play();
|
||||
bgchild->setVisible(true);
|
||||
const Common::String bgAnimName = bgchild->name() + "Anim";
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *bgPosAnim = _gui.layoutPositionLinearAnimation(bgAnimName);
|
||||
if (!bgPosAnim)
|
||||
error("Couldn't find bg position anim %s", bgAnimName.c_str());
|
||||
bgPosAnim->_callbackObj = bgchild;
|
||||
bgPosAnim->_callbackMethod = &TeLayout::setPosition;
|
||||
bgPosAnim->play();
|
||||
}
|
||||
} else {
|
||||
// Syberia 2
|
||||
TeLayout *foreground = _gui.layoutChecked("foreground1");
|
||||
_curveAnim._callbackObj = foreground;
|
||||
_curveAnim._callbackMethod = &TeLayout::setColor;
|
||||
_curveAnim.play();
|
||||
_gui.buttonLayoutChecked("quitButton")->onMouseClickValidated().add(this, &Credits::onQuitButton);
|
||||
|
||||
//
|
||||
// WORKAROUND: These are set to PanScan ratio 1.0, but with our code
|
||||
// but that shrinks them down to pillarboxed. Force back to full size.
|
||||
//
|
||||
_gui.layoutChecked("foreground1")->setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
_gui.layoutChecked("foreground")->setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
}
|
||||
|
||||
_curveAnim.onFinished().add(this, &Credits::onBackgroundAnimFinished);
|
||||
}
|
||||
|
||||
void Credits::leave() {
|
||||
//
|
||||
// Slightly different to original.. stop *all* position/anchor animations
|
||||
// - Syberia 2 only stops certain animations but this works for both.
|
||||
//
|
||||
for (auto &anim : _gui.layoutPositionLinearAnimations()) {
|
||||
anim._value->stop();
|
||||
}
|
||||
for (auto &anim : _gui.layoutAnchorLinearAnimations()) {
|
||||
anim._value->stop();
|
||||
}
|
||||
_curveAnim.stop();
|
||||
_curveAnim.onFinished().remove(this, &Credits::onBackgroundAnimFinished);
|
||||
|
||||
if (_gui.loaded()) {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
app->frontLayout().removeChild(_gui.layoutChecked("menu"));
|
||||
_timer.stop();
|
||||
_gui.unload();
|
||||
if (_returnToOptions) {
|
||||
app->optionsMenu().enter();
|
||||
} else {
|
||||
// WORKAROUND: Ensure game is left before opening menu to
|
||||
// stop inventory button appearing in menu.
|
||||
g_engine->getGame()->leave(true);
|
||||
app->mainMenu().enter();
|
||||
}
|
||||
app->fade();
|
||||
}
|
||||
}
|
||||
|
||||
bool Credits::onAnimFinished() {
|
||||
leave();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Credits::onBackgroundAnimFinished() {
|
||||
if (g_engine->gameType() == TetraedgeEngine::kSyberia)
|
||||
return onBackgroundAnimFinishedSyb1();
|
||||
else
|
||||
return onBackgroundAnimFinishedSyb2();
|
||||
}
|
||||
|
||||
bool Credits::onBackgroundAnimFinishedSyb2() {
|
||||
const TeColor white = TeColor(0xff, 0xff, 0xff, 0xff);
|
||||
const TeColor clear = TeColor(0xff, 0xff, 0xff, 0);
|
||||
if (_curveAnim._startVal != white) {
|
||||
_curveAnim._startVal = white;
|
||||
_curveAnim._endVal = clear;
|
||||
TeSpriteLayout *fgLayout = _gui.spriteLayout("foreground");
|
||||
TeVariant fgFile = _gui.value(Common::String::format("foregrounds%d", _animCounter));
|
||||
fgLayout->load(Common::Path(fgFile.toString()));
|
||||
} else {
|
||||
_curveAnim._startVal = clear;
|
||||
_curveAnim._endVal = white;
|
||||
TeSpriteLayout *fgLayout = _gui.spriteLayout("foreground1");
|
||||
TeVariant fgFile = _gui.value(Common::String::format("foregrounds%d", _animCounter));
|
||||
fgLayout->load(Common::Path(fgFile.toString()));
|
||||
}
|
||||
|
||||
_curveAnim.play();
|
||||
_animCounter++;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Credits::onBackgroundAnimFinishedSyb1() {
|
||||
_animCounter++;
|
||||
TeLayout *backgrounds = _gui.layoutChecked("Backgrounds");
|
||||
if (_animCounter < backgrounds->childCount()) {
|
||||
TeSpriteLayout *bgchild = dynamic_cast<TeSpriteLayout *>(backgrounds->child(_animCounter));
|
||||
if (!bgchild)
|
||||
error("Children of credits Backgrounds should be Sprites.");
|
||||
_curveAnim._callbackObj = bgchild;
|
||||
_curveAnim._callbackMethod = &TeLayout::setColor;
|
||||
_curveAnim.play();
|
||||
bgchild->setVisible(true);
|
||||
const Common::String bgAnimName = bgchild->name() + "Anim";
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *bgPosAnim = _gui.layoutPositionLinearAnimation(bgAnimName);
|
||||
if (!bgPosAnim)
|
||||
error("Couldn't find bg position anim %s", bgAnimName.c_str());
|
||||
bgPosAnim->_callbackObj = bgchild;
|
||||
bgPosAnim->_callbackMethod = &TeLayout::setPosition;
|
||||
bgPosAnim->play();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Credits::onPadButtonUp(uint button) {
|
||||
// Original calls this function here but it seems unnecessary?
|
||||
//TeLayout *buttonsLayout = _gui.layout("buttons");
|
||||
if (button & 2) // TODO; which button is 2?
|
||||
leave();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Credits::onQuitButton() {
|
||||
if (g_engine->gameType() == TetraedgeEngine::kSyberia) {
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *anim1 = _gui.layoutPositionLinearAnimation("scrollTextPositionAnim");
|
||||
anim1->stop();
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *anim2 = _gui.layoutAnchorLinearAnimation("scrollTextAnchorAnim");
|
||||
anim2->stop();
|
||||
}
|
||||
leave();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
57
engines/tetraedge/game/credits.h
Normal file
57
engines/tetraedge/game/credits.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_CREDITS_H
|
||||
#define TETRAEDGE_GAME_CREDITS_H
|
||||
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
#include "tetraedge/te/te_curve_anim2.h"
|
||||
#include "tetraedge/te/te_color.h"
|
||||
#include "tetraedge/te/te_3d_object2.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Credits {
|
||||
public:
|
||||
Credits();
|
||||
|
||||
void enter(bool flag);
|
||||
void leave();
|
||||
|
||||
private:
|
||||
bool onAnimFinished();
|
||||
bool onBackgroundAnimFinished();
|
||||
bool onBackgroundAnimFinishedSyb1();
|
||||
bool onBackgroundAnimFinishedSyb2();
|
||||
bool onPadButtonUp(uint button);
|
||||
bool onQuitButton();
|
||||
|
||||
TeTimer _timer;
|
||||
TeLuaGUI _gui;
|
||||
TeCurveAnim2<Te3DObject2, TeColor> _curveAnim;
|
||||
Common::Array<double> _doubleArr;
|
||||
int _animCounter;
|
||||
bool _returnToOptions; // if true, return to OptionsMenu instead of MainMenu.
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_CREDITS_H
|
||||
219
engines/tetraedge/game/dialog2.cpp
Normal file
219
engines/tetraedge/game/dialog2.cpp
Normal file
@@ -0,0 +1,219 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/dialog2.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/character.h"
|
||||
#include "tetraedge/te/te_button_layout.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
Dialog2::Dialog2() {
|
||||
_music.onStopSignal().add(this, &Dialog2::onSoundFinished);
|
||||
_minimumTimeTimer.alarmSignal().add(this, &Dialog2::onMinimumTimeTimer);
|
||||
}
|
||||
|
||||
bool Dialog2::isDialogPlaying() {
|
||||
TeButtonLayout *lockbtn = _gui.buttonLayout("dialogLockButton");
|
||||
|
||||
if (lockbtn)
|
||||
return lockbtn->visible();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Dialog2::launchNextDialog() {
|
||||
Game *game = g_engine->getGame();
|
||||
if (_dialogs.empty()) {
|
||||
game->showMarkers(false);
|
||||
_gui.buttonLayoutChecked("dialogLockButton")->setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
TeButtonLayout *dialog = _gui.buttonLayoutChecked("dialog");
|
||||
if (dialog->anchor().y() >= 1.0) {
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *anim = _gui.layoutAnchorLinearAnimation("dialogAnimationDown");
|
||||
anim->stop();
|
||||
anim->play();
|
||||
} else {
|
||||
dialog->setSizeType(CoordinatesType::ABSOLUTE);
|
||||
TeButtonLayout *lockBtn = _gui.buttonLayoutChecked("dialogLockButton");
|
||||
dialog->setSize(lockBtn->size());
|
||||
_currentDialogData = _dialogs.front();
|
||||
_dialogs.remove_at(0);
|
||||
const Common::String formatStr = _gui.value("textFormat").toString();
|
||||
Common::String formattedVal = Common::String::format(formatStr.c_str(), _currentDialogData._stringVal.c_str());
|
||||
_gui.textLayout("text")->setText(formattedVal);
|
||||
_music.load(_currentDialogData._sound);
|
||||
_music.setChannelName("dialog");
|
||||
_music.play();
|
||||
if (!_currentDialogData._charname.empty()) {
|
||||
Character *c = game->scene().character(_currentDialogData._charname);
|
||||
if (!c) {
|
||||
warning("[Dialog2::launchNextDialog] Character's \"%s\" doesn't exist", _currentDialogData._charname.c_str());
|
||||
} else {
|
||||
if (_currentDialogData._animBlend == 0.0f) {
|
||||
if (!c->setAnimation(_currentDialogData._animfile, false, true))
|
||||
error("[Dialog2::launchNextDialog] Character's animation \"%s\" doesn't exist for the character\"%s\"",
|
||||
_currentDialogData._animfile.c_str(), _currentDialogData._charname.c_str());
|
||||
} else {
|
||||
if (!c->blendAnimation(_currentDialogData._animfile, _currentDialogData._animBlend, false, true))
|
||||
error("[Dialog2::launchNextDialog] Character's animation \"%s\" doesn't exist for the character\"%s\"",
|
||||
_currentDialogData._animfile.c_str(), _currentDialogData._charname.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
lockBtn->setVisible(true);
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *anim = _gui.layoutAnchorLinearAnimation("dialogAnimationUp");
|
||||
anim->stop();
|
||||
anim->play();
|
||||
_minimumTimeTimer.start();
|
||||
_minimumTimeTimer.setAlarmIn(1500000);
|
||||
}
|
||||
}
|
||||
|
||||
void Dialog2::load() {
|
||||
setName("dialog2");
|
||||
setSizeType(RELATIVE_TO_PARENT);
|
||||
TeVector3f32 usersz = userSize();
|
||||
setSize(TeVector3f32(1.0f, 1.0f, usersz.z()));
|
||||
size(); // refresh size? seems to do nothing with result
|
||||
_music.repeat(false);
|
||||
const char *luaPath = g_engine->gameIsAmerzone() ? "GUI/dialog.lua" : "menus/dialog.lua";
|
||||
_gui.load(luaPath);
|
||||
size(); // refresh size? seems to do nothing with result
|
||||
TeButtonLayout *dialogLockBtn = _gui.buttonLayoutChecked("dialogLockButton");
|
||||
|
||||
dialogLockBtn->setVisible(false);
|
||||
addChild(dialogLockBtn);
|
||||
size(); // refresh size? seems to do nothing with result again.
|
||||
|
||||
TeButtonLayout *dialogBtn = _gui.buttonLayoutChecked("dialog");
|
||||
|
||||
dialogBtn->onMouseClickValidated().add(this, &Dialog2::onSkipButton);
|
||||
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *dialogAnimUp = _gui.layoutAnchorLinearAnimation("dialogAnimationUp");
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *dialogAnimDown = _gui.layoutAnchorLinearAnimation("dialogAnimationDown");
|
||||
if (!dialogAnimUp || !dialogAnimDown)
|
||||
error("Dialog2::load: didn't get dialogAnimUp or dialogAnimationDown");
|
||||
|
||||
dialogAnimUp->_callbackObj = dialogBtn;
|
||||
dialogAnimUp->_callbackMethod = &TeLayout::setAnchor;
|
||||
dialogAnimUp->onFinished().add(this, &Dialog2::onAnimationUpFinished);
|
||||
|
||||
dialogAnimDown->_callbackObj = dialogBtn;
|
||||
dialogAnimDown->_callbackMethod = &TeLayout::setAnchor;
|
||||
dialogAnimDown->onFinished().add(this, &Dialog2::onAnimationDownFinished);
|
||||
}
|
||||
|
||||
void Dialog2::loadFromBackup() {
|
||||
// seems to do nothing useful? just iterates the children..
|
||||
}
|
||||
|
||||
bool Dialog2::onAnimationDownFinished() {
|
||||
Common::String param(_currentDialogData._name);
|
||||
launchNextDialog();
|
||||
_onAnimationDownFinishedSignal.call(param);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Dialog2::onAnimationUpFinished() {
|
||||
// Seems like this just prints a debug value??
|
||||
//TeButtonLayout *dialogButton = _gui.buttonLayout("dialog");
|
||||
//dialogButton->anchor();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Dialog2::onMinimumTimeTimer() {
|
||||
_minimumTimeTimer.stop();
|
||||
if (!_music.isPlaying())
|
||||
startDownAnimation();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Dialog2::onSkipButton() {
|
||||
const TeCurveAnim2<TeLayout, TeVector3f32> *dialogAnimUp = _gui.layoutAnchorLinearAnimation("dialogAnimationUp");
|
||||
if (!dialogAnimUp->_runTimer.running()) {
|
||||
const TeCurveAnim2<TeLayout, TeVector3f32> *dialogAnimDown = _gui.layoutAnchorLinearAnimation("dialogAnimationDown");
|
||||
if (!dialogAnimDown->_runTimer.running()) {
|
||||
startDownAnimation();
|
||||
_music.stop();
|
||||
}
|
||||
}
|
||||
// Divergence from original: don't let clicks through on skip operation.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Dialog2::onSoundFinished() {
|
||||
if (!_minimumTimeTimer.running())
|
||||
startDownAnimation();
|
||||
return false;
|
||||
}
|
||||
|
||||
void Dialog2::pushDialog(const Common::String &name, const Common::String &textVal, const Common::String &sound, int param_4) {
|
||||
error("TODO: Implement Dialog2::pushDialog 3 param");
|
||||
}
|
||||
|
||||
void Dialog2::pushDialog(const Common::String &name, const Common::String &textVal, const Common::String &sound,
|
||||
const Common::String &charname, const Common::String &animfile, float animBlend) {
|
||||
DialogData data;
|
||||
data._name = name;
|
||||
data._stringVal = textVal;
|
||||
data._charname = charname;
|
||||
data._animfile = animfile;
|
||||
data._sound = Common::Path("sounds/Dialogs").join(sound);
|
||||
data._animBlend = animBlend;
|
||||
if (sound.empty()) {
|
||||
data._sound = Common::Path("sounds/dialogs/silence5s.ogg");
|
||||
}
|
||||
_dialogs.push_back(data);
|
||||
if (_dialogs.size() == 1) {
|
||||
Game *game = g_engine->getGame();
|
||||
game->showMarkers(true);
|
||||
}
|
||||
if (!_music.isPlaying())
|
||||
launchNextDialog();
|
||||
}
|
||||
|
||||
//void saveToBackup(TiXmlNode *node)
|
||||
|
||||
void Dialog2::startDownAnimation() {
|
||||
_minimumTimeTimer.stop();
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *dialogAnimDown = _gui.layoutAnchorLinearAnimation("dialogAnimationDown");
|
||||
dialogAnimDown->play();
|
||||
}
|
||||
|
||||
void Dialog2::unload() {
|
||||
if (!_gui.loaded())
|
||||
return;
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *dialogAnimUp = _gui.layoutAnchorLinearAnimation("dialogAnimationUp");
|
||||
dialogAnimUp->stop();
|
||||
TeCurveAnim2<TeLayout, TeVector3f32> *dialogAnimDown = _gui.layoutAnchorLinearAnimation("dialogAnimationDown");
|
||||
dialogAnimDown->stop();
|
||||
_music.close();
|
||||
_gui.unload();
|
||||
|
||||
_dialogs.clear();
|
||||
_minimumTimeTimer.stop();
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
81
engines/tetraedge/game/dialog2.h
Normal file
81
engines/tetraedge/game/dialog2.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_DIALOG2_H
|
||||
#define TETRAEDGE_GAME_DIALOG2_H
|
||||
|
||||
#include "common/serializer.h"
|
||||
|
||||
#include "tetraedge/te/te_timer.h"
|
||||
#include "tetraedge/te/te_music.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Dialog2 : public TeLayout {
|
||||
public:
|
||||
Dialog2();
|
||||
|
||||
struct DialogData {
|
||||
Common::String _name;
|
||||
Common::String _stringVal;
|
||||
Common::Path _sound;
|
||||
Common::String _charname;
|
||||
Common::String _animfile;
|
||||
float _animBlend;
|
||||
};
|
||||
|
||||
bool isDialogPlaying();
|
||||
void launchNextDialog();
|
||||
void load();
|
||||
void loadFromBackup(); // seems to do nothing useful? just iterates the children..
|
||||
bool onAnimationDownFinished();
|
||||
bool onAnimationUpFinished();
|
||||
bool onMinimumTimeTimer();
|
||||
bool onSkipButton();
|
||||
bool onSoundFinished();
|
||||
|
||||
void pushDialog(const Common::String &name, const Common::String &textVal, const Common::String &sound, int param_4);
|
||||
void pushDialog(const Common::String &name, const Common::String &textVal, const Common::String &sound,
|
||||
const Common::String &charName, const Common::String &animFile, float animBlend);
|
||||
//void saveToBackup(TiXmlNode *node)
|
||||
void startDownAnimation();
|
||||
void unload();
|
||||
|
||||
TeLuaGUI &gui() { return _gui; }
|
||||
TeSignal1Param<const Common::String &> &onAnimationDownFinishedSignal() { return _onAnimationDownFinishedSignal; }
|
||||
|
||||
private:
|
||||
Common::Array<DialogData> _dialogs;
|
||||
|
||||
TeTimer _minimumTimeTimer;
|
||||
|
||||
TeLuaGUI _gui;
|
||||
TeMusic _music;
|
||||
|
||||
DialogData _currentDialogData;
|
||||
|
||||
TeSignal1Param<const Common::String &> _onAnimationDownFinishedSignal;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_DIALOG2_H
|
||||
72
engines/tetraedge/game/document.cpp
Normal file
72
engines/tetraedge/game/document.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/document.h"
|
||||
#include "tetraedge/game/documents_browser.h"
|
||||
#include "tetraedge/te/te_core.h"
|
||||
#include "tetraedge/te/te_sprite_layout.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
Document::Document(DocumentsBrowser *browser) : _browser(browser) {
|
||||
|
||||
}
|
||||
|
||||
void Document::load(const Common::String &name) {
|
||||
setSizeType(RELATIVE_TO_PARENT);
|
||||
setSize(TeVector3f32(1, 1, 1));
|
||||
_gui.load("DocumentsBrowser/Document.lua");
|
||||
addChild(_gui.layoutChecked("object"));
|
||||
setName(name);
|
||||
const Common::Path sprPath = spritePath();
|
||||
_gui.spriteLayoutChecked("upLayout")->load(sprPath);
|
||||
_gui.buttonLayoutChecked("object")->onMouseClickValidated().add(this, &Document::onButtonDown);
|
||||
TeITextLayout *txtLayout = _gui.textLayout("text");
|
||||
if (!txtLayout)
|
||||
error("can't find text layout in document");
|
||||
|
||||
const char *fontFile;
|
||||
if (g_engine->gameIsAmerzone())
|
||||
fontFile = "Arial_r_16.tef";
|
||||
else
|
||||
fontFile = "arial.ttf";
|
||||
|
||||
Common::String header = Common::String::format(
|
||||
"<section style=\"center\" /><color r=\"255\" g=\"255\" b=\"255\"/><font file=\"Common/Fonts/%s\" />", fontFile);
|
||||
txtLayout->setText(header + _browser->documentName(name));
|
||||
}
|
||||
|
||||
void Document::unload() {
|
||||
removeChild(_gui.layoutChecked("object"));
|
||||
_gui.unload();
|
||||
}
|
||||
|
||||
bool Document::onButtonDown() {
|
||||
_onButtonDownSignal.call(*this);
|
||||
return false;
|
||||
}
|
||||
|
||||
Common::Path Document::spritePath() const {
|
||||
return Common::Path("DocumentsBrowser/Documents").join(name()).append(".png");
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
65
engines/tetraedge/game/document.h
Normal file
65
engines/tetraedge/game/document.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_DOCUMENT_H
|
||||
#define TETRAEDGE_GAME_DOCUMENT_H
|
||||
|
||||
#include "common/str.h"
|
||||
|
||||
#include "tetraedge/te/te_layout.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class DocumentsBrowser;
|
||||
|
||||
class Document : public TeLayout {
|
||||
public:
|
||||
Document(DocumentsBrowser *browser);
|
||||
virtual ~Document() {
|
||||
unload();
|
||||
if (parent()) {
|
||||
parent()->removeChild(this);
|
||||
setParent(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void load(const Common::String &name);
|
||||
//void loadFromBackup(TiXmlElement &node) {
|
||||
// load(node->Attribute("id");
|
||||
//}
|
||||
|
||||
bool onButtonDown();
|
||||
//void saveToBackup(TiXmlElement &node);
|
||||
Common::Path spritePath() const;
|
||||
void unload();
|
||||
|
||||
TeSignal1Param<Document &> &onButtonDownSignal() { return _onButtonDownSignal; }
|
||||
|
||||
private:
|
||||
DocumentsBrowser *_browser;
|
||||
TeLuaGUI _gui;
|
||||
TeSignal1Param<Document &> _onButtonDownSignal;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_DOCUMENT_H
|
||||
431
engines/tetraedge/game/documents_browser.cpp
Normal file
431
engines/tetraedge/game/documents_browser.cpp
Normal file
@@ -0,0 +1,431 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/documents_browser.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/documents_browser_xml_parser.h"
|
||||
#include "tetraedge/game/syberia_game.h"
|
||||
#include "tetraedge/te/te_core.h"
|
||||
#include "tetraedge/te/te_lua_thread.h"
|
||||
#include "tetraedge/te/te_scrolling_layout.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
DocumentsBrowser::DocumentsBrowser() : _startPage(0), _curPage(0), _zoomCount(0) {
|
||||
_timer.alarmSignal().add(this, &DocumentsBrowser::onQuitDocumentDoubleClickTimer);
|
||||
}
|
||||
|
||||
void DocumentsBrowser::enter() {
|
||||
setVisible(true);
|
||||
currentPage(_curPage);
|
||||
}
|
||||
|
||||
void DocumentsBrowser::hideDocument() {
|
||||
Common::String docName = _curDocName;
|
||||
_curDocName.clear();
|
||||
TeSpriteLayout *zoomedSprite = _gui.spriteLayout("zoomedSprite");
|
||||
if (!zoomedSprite)
|
||||
return;
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
zoomedSprite->unload();
|
||||
_gui.buttonLayoutChecked("zoomed")->setVisible(false);
|
||||
_zoomedDocGui.unload();
|
||||
Game *game = g_engine->getGame();
|
||||
|
||||
bool callFn = true;
|
||||
SyberiaGame *sybgame = dynamic_cast<SyberiaGame *>(game);
|
||||
if (sybgame) {
|
||||
Common::Array<SyberiaGame::YieldedCallback> &yieldedcallbacks = sybgame->yieldedCallbacks();
|
||||
for (uint i = 0; i < yieldedcallbacks.size(); i++) {
|
||||
if (yieldedcallbacks[i]._luaFnName == "OnDocumentClosed" &&
|
||||
yieldedcallbacks[i]._luaParam == docName) {
|
||||
yieldedcallbacks.remove_at(i);
|
||||
if (yieldedcallbacks[i]._luaThread) {
|
||||
yieldedcallbacks[i]._luaThread->resume();
|
||||
callFn = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (callFn)
|
||||
game->luaScript().execute("OnDocumentClosed", docName);
|
||||
}
|
||||
|
||||
app->fade();
|
||||
}
|
||||
|
||||
void DocumentsBrowser::leave() {
|
||||
_timer.stop();
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
void DocumentsBrowser::load() {
|
||||
setVisible(false);
|
||||
setName("_documentsBrowser");
|
||||
setSizeType(RELATIVE_TO_PARENT);
|
||||
setSize(TeVector3f32(1.0f, 1.0f, userSize().z()));
|
||||
|
||||
_gui.load("DocumentsBrowser/DocumentsBrowser.lua");
|
||||
|
||||
TeLayout *docBrowser = _gui.layout("documentBrowser");
|
||||
if (docBrowser)
|
||||
addChild(docBrowser);
|
||||
|
||||
TeButtonLayout *button = _gui.buttonLayoutChecked("previousPage");
|
||||
button->onMouseClickValidated().add(this, &DocumentsBrowser::onPreviousPage);
|
||||
button = _gui.buttonLayoutChecked("nextPage");
|
||||
button->onMouseClickValidated().add(this, &DocumentsBrowser::onNextPage);
|
||||
button = _gui.buttonLayoutChecked("zoomed");
|
||||
button->onMouseClickValidated().add(this, &DocumentsBrowser::onZoomedButton);
|
||||
button->setVisible(false);
|
||||
|
||||
if (g_engine->gameIsAmerzone()) {
|
||||
TeLayout *bglayout = _gui.layoutChecked("background");
|
||||
bglayout->setRatioMode(RATIO_MODE_NONE);
|
||||
|
||||
loadXMLFile("DocumentsBrowser/Documents/Documents.xml");
|
||||
}
|
||||
_timer.start();
|
||||
}
|
||||
|
||||
void DocumentsBrowser::loadZoomed() {
|
||||
TeLayout *zoomedChild = _gui.layout("zoomed");
|
||||
if (g_engine->gameIsAmerzone()) {
|
||||
zoomedChild->setRatioMode(RATIO_MODE_NONE);
|
||||
g_engine->getGame()->inventoryMenu().addChild(zoomedChild);
|
||||
} else {
|
||||
_zoomedLayout.setSizeType(RELATIVE_TO_PARENT);
|
||||
TeVector3f32 usersz = userSize();
|
||||
_zoomedLayout.setSize(TeVector3f32(1.0f, 1.0f, usersz.z()));
|
||||
_zoomedLayout.addChild(zoomedChild);
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentsBrowser::loadXMLFile(const Common::Path &path) {
|
||||
TetraedgeFSNode node = g_engine->getCore()->findFile(path);
|
||||
Common::ScopedPtr<Common::SeekableReadStream> xmlfile(node.createReadStream());
|
||||
int64 fileLen = xmlfile->size();
|
||||
char *buf = new char[fileLen + 1];
|
||||
buf[fileLen] = '\0';
|
||||
xmlfile->read(buf, fileLen);
|
||||
const Common::String xmlContents = Common::String::format("<?xml version=\"1.0\" encoding=\"UTF-8\"?><document>%s</document>", buf);
|
||||
delete [] buf;
|
||||
xmlfile.reset();
|
||||
|
||||
DocumentsBrowserXmlParser parser;
|
||||
if (!parser.loadBuffer((const byte *)xmlContents.c_str(), xmlContents.size()))
|
||||
error("Couldn't load inventory xml.");
|
||||
if (!parser.parse())
|
||||
error("Couldn't parse inventory xml.");
|
||||
_documentData = parser._objects;
|
||||
}
|
||||
|
||||
void DocumentsBrowser::currentPage(int setPage) {
|
||||
const Common::String setPageName = Common::String::format("page%d", setPage);
|
||||
TeLayout *pageLayout = _gui.layout(setPageName);
|
||||
if (!pageLayout)
|
||||
return;
|
||||
|
||||
_curPage = setPage;
|
||||
|
||||
int pageNo = 0;
|
||||
while (true) {
|
||||
const Common::String pageName = Common::String::format("page%d", pageNo);
|
||||
pageLayout = _gui.layout(pageName);
|
||||
if (!pageLayout)
|
||||
break;
|
||||
pageLayout->setVisible(pageNo == setPage);
|
||||
const Common::String diodeName = Common::String::format("diode%d", pageNo);
|
||||
_gui.buttonLayoutChecked(diodeName)->setEnable(pageNo == setPage);
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
|
||||
bool DocumentsBrowser::onQuitDocumentDoubleClickTimer() {
|
||||
uint64 time = _timer.getTimeFromStart();
|
||||
_timer.stop();
|
||||
if (time >= 200000) {
|
||||
showDocument(_curDocName, _startPage + 1);
|
||||
} else {
|
||||
hideDocument();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DocumentsBrowser::onNextPage() {
|
||||
currentPage(_curPage + 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DocumentsBrowser::onPreviousPage() {
|
||||
currentPage(_curPage - 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DocumentsBrowser::onZoomedButton() {
|
||||
int count = _zoomCount;
|
||||
_zoomCount++;
|
||||
if (count == 0) {
|
||||
_timer.start();
|
||||
_timer.setAlarmIn(200000);
|
||||
} else {
|
||||
onQuitDocumentDoubleClickTimer();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DocumentsBrowser::addDocument(Document *document) {
|
||||
int pageno = 0;
|
||||
while (true) {
|
||||
Common::String pageName = Common::String::format("page%d", pageno);
|
||||
TeLayout *page = _gui.layout(pageName);
|
||||
if (!page)
|
||||
break;
|
||||
int slotno = 0;
|
||||
while (true) {
|
||||
Common::String pageSlotName = Common::String::format("page%dSlot%d", pageno, slotno);
|
||||
TeLayout *slot = _gui.layout(pageSlotName);
|
||||
if (!slot)
|
||||
break;
|
||||
if (slot->childCount() == 0) {
|
||||
slot->addChild(document);
|
||||
if (g_engine->gameIsAmerzone()) {
|
||||
document->onButtonDownSignal().add(this, &DocumentsBrowser::onDocumentSelected);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
slotno++;
|
||||
}
|
||||
pageno++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void DocumentsBrowser::addDocument(const Common::String &str) {
|
||||
Document *doc = new Document(this);
|
||||
doc->load(str);
|
||||
if (!addDocument(doc))
|
||||
delete doc;
|
||||
}
|
||||
|
||||
Common::String DocumentsBrowser::documentDescription(const Common::String &key) const {
|
||||
if (_documentData.contains(key))
|
||||
return _documentData.getVal(key)._description;
|
||||
return "";
|
||||
}
|
||||
|
||||
Common::String DocumentsBrowser::documentName(const Common::String &key) const {
|
||||
if (_documentData.contains(key))
|
||||
return _documentData.getVal(key)._name;
|
||||
return "";
|
||||
}
|
||||
|
||||
bool DocumentsBrowser::onDocumentSelected(Document &doc) {
|
||||
showDocument(doc.name(), 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
Common::String DocumentsBrowser::zoomedPageName() const {
|
||||
return Common::String::format("%s_zoomed_%d", _curDocName.c_str(), (int)_curPage);
|
||||
}
|
||||
|
||||
bool DocumentsBrowser::onShowedDocumentButton0() {
|
||||
g_engine->getGame()->luaScript().execute("OnShowedDocumentButtonValidated", zoomedPageName(), "button0");
|
||||
return false;
|
||||
}
|
||||
bool DocumentsBrowser::onShowedDocumentButton1() {
|
||||
g_engine->getGame()->luaScript().execute("OnShowedDocumentButtonValidated", zoomedPageName(), "button1");
|
||||
return false;
|
||||
}
|
||||
bool DocumentsBrowser::onShowedDocumentButton2() {
|
||||
g_engine->getGame()->luaScript().execute("OnShowedDocumentButtonValidated", zoomedPageName(), "button2");
|
||||
return false;
|
||||
}
|
||||
bool DocumentsBrowser::onShowedDocumentButton3() {
|
||||
g_engine->getGame()->luaScript().execute("OnShowedDocumentButtonValidated", zoomedPageName(), "button3");
|
||||
return false;
|
||||
}
|
||||
bool DocumentsBrowser::onShowedDocumentButton4() {
|
||||
g_engine->getGame()->luaScript().execute("OnShowedDocumentButtonValidated", zoomedPageName(), "button4");
|
||||
return false;
|
||||
}
|
||||
bool DocumentsBrowser::onShowedDocumentButton5() {
|
||||
g_engine->getGame()->luaScript().execute("OnShowedDocumentButtonValidated", zoomedPageName(), "button5");
|
||||
return false;
|
||||
}
|
||||
bool DocumentsBrowser::onShowedDocumentButton6() {
|
||||
g_engine->getGame()->luaScript().execute("OnShowedDocumentButtonValidated", zoomedPageName(), "button6");
|
||||
return false;
|
||||
}
|
||||
bool DocumentsBrowser::onShowedDocumentButton7() {
|
||||
g_engine->getGame()->luaScript().execute("OnShowedDocumentButtonValidated", zoomedPageName(), "button7");
|
||||
return false;
|
||||
}
|
||||
bool DocumentsBrowser::onShowedDocumentButton8() {
|
||||
g_engine->getGame()->luaScript().execute("OnShowedDocumentButtonValidated", zoomedPageName(), "button8");
|
||||
return false;
|
||||
}
|
||||
bool DocumentsBrowser::onShowedDocumentButton9() {
|
||||
g_engine->getGame()->luaScript().execute("OnShowedDocumentButtonValidated", zoomedPageName(), "button9");
|
||||
return false;
|
||||
}
|
||||
|
||||
void DocumentsBrowser::showDocument(const Common::String &docName, int startPage) {
|
||||
_curPage = startPage;
|
||||
_startPage = startPage;
|
||||
_curDocName = docName;
|
||||
_zoomedDocGui.unload();
|
||||
|
||||
if (docName.empty()) {
|
||||
hideDocument();
|
||||
return;
|
||||
}
|
||||
|
||||
TeCore *core = g_engine->getCore();
|
||||
const char *pathPattern = g_engine->gameIsAmerzone() ? "DocumentsBrowser/Documents/%s_zoomed_%d" : "DocumentsBrowser/Documents/Documents/%s_zoomed_%d";
|
||||
const Common::Path docPathBase(Common::String::format(pathPattern, docName.c_str(), (int)startPage));
|
||||
Common::Path docPath = docPathBase.append(".png");
|
||||
TetraedgeFSNode docNode = core->findFile(docPath);
|
||||
if (!docNode.exists()) {
|
||||
docPath = docPathBase.append(".jpg");
|
||||
docNode = core->findFile(docPath);
|
||||
if (!docNode.exists()) {
|
||||
// Probably the end of the doc
|
||||
if (startPage == 0)
|
||||
warning("Can't find first page of doc named %s", docName.c_str());
|
||||
hideDocument();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
TeSpriteLayout *sprite = _gui.spriteLayoutChecked("zoomedSprite");
|
||||
sprite->load(docPath);
|
||||
TeVector2s32 spriteSize = sprite->_tiledSurfacePtr->tiledTexture()->totalSize();
|
||||
|
||||
TetraedgeFSNode luaNode = core->findFile(docPathBase.append(".lua"));
|
||||
if (luaNode.exists()) {
|
||||
_zoomedDocGui.load(luaNode);
|
||||
sprite->addChild(_zoomedDocGui.layoutChecked("root"));
|
||||
|
||||
TeButtonLayout *btn;
|
||||
btn = _zoomedDocGui.buttonLayout("button0");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &DocumentsBrowser::onShowedDocumentButton0);
|
||||
btn = _zoomedDocGui.buttonLayout("button1");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &DocumentsBrowser::onShowedDocumentButton1);
|
||||
btn = _zoomedDocGui.buttonLayout("button2");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &DocumentsBrowser::onShowedDocumentButton2);
|
||||
btn = _zoomedDocGui.buttonLayout("button3");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &DocumentsBrowser::onShowedDocumentButton3);
|
||||
btn = _zoomedDocGui.buttonLayout("button4");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &DocumentsBrowser::onShowedDocumentButton4);
|
||||
btn = _zoomedDocGui.buttonLayout("button5");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &DocumentsBrowser::onShowedDocumentButton5);
|
||||
btn = _zoomedDocGui.buttonLayout("button6");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &DocumentsBrowser::onShowedDocumentButton6);
|
||||
btn = _zoomedDocGui.buttonLayout("button7");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &DocumentsBrowser::onShowedDocumentButton7);
|
||||
btn = _zoomedDocGui.buttonLayout("button8");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &DocumentsBrowser::onShowedDocumentButton8);
|
||||
btn = _zoomedDocGui.buttonLayout("button9");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &DocumentsBrowser::onShowedDocumentButton9);
|
||||
}
|
||||
|
||||
sprite->setSizeType(RELATIVE_TO_PARENT);
|
||||
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
TeVector3f32 winSize = app->getMainWindow().size();
|
||||
sprite->setSize(TeVector3f32(1.0f, (4.0f / (winSize.y() / winSize.x() * 4.0f)) *
|
||||
((float)spriteSize._y / (float)spriteSize._x), 0.0f));
|
||||
TeScrollingLayout *scroll = _gui.scrollingLayout("scroll");
|
||||
if (!scroll)
|
||||
error("DocumentsBrowser::showDocument Couldn't fetch scroll object");
|
||||
scroll->resetScrollPosition();
|
||||
scroll->playAutoScroll();
|
||||
} else {
|
||||
sprite->setRatioMode(RATIO_MODE_NONE);
|
||||
sprite->updateSize();
|
||||
}
|
||||
|
||||
_gui.buttonLayoutChecked("zoomed")->setVisible(true);
|
||||
_zoomCount = 0;
|
||||
app->fade();
|
||||
}
|
||||
|
||||
void DocumentsBrowser::unload() {
|
||||
hideDocument();
|
||||
int pageno = 0;
|
||||
while (true) {
|
||||
Common::String pageName = Common::String::format("page%d", pageno);
|
||||
TeLayout *page = _gui.layout(pageName);
|
||||
if (!page)
|
||||
break;
|
||||
int slotno = 0;
|
||||
while (true) {
|
||||
Common::String pageSlotName = Common::String::format("page%dSlot%d", pageno, slotno);
|
||||
TeLayout *slot = _gui.layout(pageSlotName);
|
||||
if (!slot)
|
||||
break;
|
||||
for (int i = 0; i < slot->childCount(); i++) {
|
||||
Document *doc = dynamic_cast<Document *>(slot->child(i));
|
||||
if (doc)
|
||||
delete doc;
|
||||
}
|
||||
slotno++;
|
||||
}
|
||||
pageno++;
|
||||
}
|
||||
_gui.unload();
|
||||
}
|
||||
|
||||
Common::Error DocumentsBrowser::syncState(Common::Serializer &s) {
|
||||
uint32 count = _documentData.size();
|
||||
s.syncAsUint32LE(count);
|
||||
if (s.isLoading()) {
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
Common::String name;
|
||||
s.syncString(name);
|
||||
addDocument(name);
|
||||
}
|
||||
} else {
|
||||
for (auto &doc : _documentData) {
|
||||
Common::String key = doc._key;
|
||||
s.syncString(key);
|
||||
}
|
||||
}
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
121
engines/tetraedge/game/documents_browser.h
Normal file
121
engines/tetraedge/game/documents_browser.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_DOCUMENTS_BROWSER_H
|
||||
#define TETRAEDGE_GAME_DOCUMENTS_BROWSER_H
|
||||
|
||||
#include "common/str.h"
|
||||
#include "tetraedge/game/document.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class DocumentsBrowser : public TeLayout {
|
||||
public:
|
||||
struct DocumentData {
|
||||
Common::String _id;
|
||||
Common::String _name;
|
||||
Common::String _description; // seems always empty..
|
||||
};
|
||||
|
||||
DocumentsBrowser();
|
||||
|
||||
bool addDocument(Document *document);
|
||||
void addDocument(const Common::String &str);
|
||||
|
||||
void currentPage(int page);
|
||||
int documentCount(const Common::String &str) { // never used?
|
||||
return 1;
|
||||
}
|
||||
|
||||
Common::String documentDescription(const Common::String &name) const;
|
||||
Common::String documentName(const Common::String &name) const;
|
||||
|
||||
void enter();
|
||||
void hideDocument();
|
||||
void leave();
|
||||
void load();
|
||||
// void loadFromBackup(TiXmlNode *node);
|
||||
void loadZoomed();
|
||||
// void saveToBackup(TiXmlNode *node);
|
||||
|
||||
void showDocument(const Common::String &str, int startPage);
|
||||
void unload();
|
||||
|
||||
Common::Error syncState(Common::Serializer &s);
|
||||
|
||||
TeLayout &zoomedLayout() { return _zoomedLayout; }
|
||||
|
||||
TeLuaGUI &gui() { return _gui; }
|
||||
|
||||
|
||||
private:
|
||||
void loadXMLFile(const Common::Path &path);
|
||||
|
||||
bool onDocumentSelected(Document &doc);
|
||||
bool onNextPage();
|
||||
bool onPreviousPage();
|
||||
bool onQuitDocumentDoubleClickTimer();
|
||||
bool onZoomedButton();
|
||||
|
||||
Common::String zoomedPageName() const;
|
||||
|
||||
// Sorry, this is how the original does it...
|
||||
bool onShowedDocumentButton0();
|
||||
bool onShowedDocumentButton1();
|
||||
bool onShowedDocumentButton2();
|
||||
bool onShowedDocumentButton3();
|
||||
bool onShowedDocumentButton4();
|
||||
bool onShowedDocumentButton5();
|
||||
bool onShowedDocumentButton6();
|
||||
bool onShowedDocumentButton7();
|
||||
bool onShowedDocumentButton8();
|
||||
bool onShowedDocumentButton9();
|
||||
/*
|
||||
These are defined but unused in any game..
|
||||
bool onShowedDocumentButton10();
|
||||
bool onShowedDocumentButton11();
|
||||
bool onShowedDocumentButton12();
|
||||
bool onShowedDocumentButton13();
|
||||
bool onShowedDocumentButton14();
|
||||
bool onShowedDocumentButton15();
|
||||
bool onShowedDocumentButton16();
|
||||
bool onShowedDocumentButton17();
|
||||
bool onShowedDocumentButton18();
|
||||
bool onShowedDocumentButton19();
|
||||
*/
|
||||
|
||||
TeTimer _timer;
|
||||
TeLayout _zoomedLayout;
|
||||
uint64 _curPage;
|
||||
uint64 _startPage;
|
||||
int _zoomCount;
|
||||
Common::String _curDocName;
|
||||
|
||||
TeLuaGUI _gui;
|
||||
TeLuaGUI _zoomedDocGui;
|
||||
|
||||
Common::HashMap<Common::String, DocumentData> _documentData;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_DOCUMENTS_BROWSER_H
|
||||
34
engines/tetraedge/game/documents_browser_xml_parser.cpp
Normal file
34
engines/tetraedge/game/documents_browser_xml_parser.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/documents_browser_xml_parser.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
bool DocumentsBrowserXmlParser::parserCallback_Document(ParserNode *node) {
|
||||
DocumentsBrowser::DocumentData data;
|
||||
data._id = node->values["id"];
|
||||
data._name = node->values["name"];
|
||||
_objects.setVal(data._id, data);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
55
engines/tetraedge/game/documents_browser_xml_parser.h
Normal file
55
engines/tetraedge/game/documents_browser_xml_parser.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/hashmap.h"
|
||||
#include "common/str.h"
|
||||
#include "common/formats/xmlparser.h"
|
||||
#include "tetraedge/game/documents_browser.h"
|
||||
|
||||
#ifndef TETRAEDGE_GAME_DOCUMENTS_BROWSER_XML_PARSER_H
|
||||
#define TETRAEDGE_GAME_DOCUMENTS_BROWSER_XML_PARSER_H
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class DocumentsBrowserXmlParser : public Common::XMLParser {
|
||||
public:
|
||||
// Parser
|
||||
CUSTOM_XML_PARSER(DocumentsBrowserXmlParser) {
|
||||
XML_KEY(document)
|
||||
XML_KEY(Document)
|
||||
XML_PROP(id, true)
|
||||
XML_PROP(name, true)
|
||||
XML_PROP(description, false)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
} PARSER_END()
|
||||
|
||||
bool parserCallback_document(ParserNode *node) { return true; };
|
||||
bool parserCallback_Document(ParserNode *node);
|
||||
|
||||
public:
|
||||
Common::HashMap<Common::String, DocumentsBrowser::DocumentData> _objects;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_DOCUMENTS_BROWSER_XML_PARSER_H
|
||||
121
engines/tetraedge/game/gallery_menu.cpp
Normal file
121
engines/tetraedge/game/gallery_menu.cpp
Normal file
@@ -0,0 +1,121 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/gallery_menu.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
static const char *AMBIENT_SND_BIKE = "sounds/Ambiances/b_automatebike.ogg";
|
||||
static const char *AMBIENT_SND_ENGR = "sounds/Ambiances/b_engrenagebg.ogg";
|
||||
|
||||
GalleryMenu::GalleryMenu() {
|
||||
}
|
||||
|
||||
bool GalleryMenu::onLockVideoButtonValidated() {
|
||||
onSkipVideoButtonValidated();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GalleryMenu::onSkipVideoButtonValidated() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->music().play();
|
||||
Game *game = g_engine->getGame();
|
||||
|
||||
game->stopSound(AMBIENT_SND_BIKE);
|
||||
game->playSound(AMBIENT_SND_BIKE, -1, 0.1f);
|
||||
|
||||
game->stopSound(AMBIENT_SND_ENGR);
|
||||
game->playSound(AMBIENT_SND_ENGR, -1, 0.09f);
|
||||
|
||||
TeSpriteLayout *video = spriteLayoutChecked("video");
|
||||
video->stop();
|
||||
video->setVisible(false);
|
||||
buttonLayoutChecked("videoBackgroundButton")->setVisible(false);
|
||||
buttonLayoutChecked("skipVideoButton")->setVisible(false);
|
||||
_music.stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GalleryMenu::onQuitButton() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->mainMenu().enter();
|
||||
app->fade();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GalleryMenu::onVideoFinished() {
|
||||
if (_loaded) {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
onSkipVideoButtonValidated();
|
||||
app->music().play();
|
||||
app->fade();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void GalleryMenu::enter() {
|
||||
Application *app = g_engine->getApplication();
|
||||
Game *game = g_engine->getGame();
|
||||
|
||||
load("menus/galleryMenu/galleryMenu.lua");
|
||||
TeLayout *menu = layoutChecked("galleryMenu");
|
||||
app->frontLayout().addChild(menu);
|
||||
|
||||
game->stopSound(AMBIENT_SND_BIKE);
|
||||
game->playSound(AMBIENT_SND_BIKE, -1, 0.1f);
|
||||
|
||||
game->stopSound(AMBIENT_SND_ENGR);
|
||||
game->playSound(AMBIENT_SND_ENGR, -1, 0.09f);
|
||||
|
||||
TeButtonLayout *btn = buttonLayoutChecked("quitButton");
|
||||
btn->onMouseClickValidated().add(this, &GalleryMenu::onQuitButton);
|
||||
|
||||
//TeLayout *list = layoutChecked("galleryList");
|
||||
|
||||
error("TODO: Finish GalleryMenu::enter");
|
||||
}
|
||||
|
||||
void GalleryMenu::leave() {
|
||||
if (!_loaded)
|
||||
return;
|
||||
|
||||
Game *game = g_engine->getGame();
|
||||
game->stopSound(AMBIENT_SND_BIKE);
|
||||
game->stopSound(AMBIENT_SND_ENGR);
|
||||
unload();
|
||||
for (GalleryBtnObject *btn : _btnObjects) {
|
||||
delete btn;
|
||||
}
|
||||
_btnObjects.clear();
|
||||
}
|
||||
|
||||
bool GalleryMenu::GalleryBtnObject::onValidated() {
|
||||
error("TODO: Implement GalleryMenu::GalleryBtnObject::onValidated");
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
59
engines/tetraedge/game/gallery_menu.h
Normal file
59
engines/tetraedge/game/gallery_menu.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_GALLERY_MENU_H
|
||||
#define TETRAEDGE_GAME_GALLERY_MENU_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "tetraedge/te/te_music.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class GalleryMenu : public TeLuaGUI {
|
||||
public:
|
||||
GalleryMenu();
|
||||
|
||||
struct GalleryBtnObject {
|
||||
bool onValidated();
|
||||
|
||||
Common::String _audioPath;
|
||||
Common::String _moviePath;
|
||||
GalleryMenu *_owner;
|
||||
};
|
||||
|
||||
void enter();
|
||||
void leave();
|
||||
|
||||
bool onQuitButton();
|
||||
bool onLockVideoButtonValidated();
|
||||
bool onSkipVideoButtonValidated();
|
||||
bool onVideoFinished();
|
||||
TeMusic &music();
|
||||
|
||||
private:
|
||||
TeMusic _music;
|
||||
Common::Array<GalleryBtnObject *> _btnObjects;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_GALLERY_MENU_H
|
||||
539
engines/tetraedge/game/game.cpp
Normal file
539
engines/tetraedge/game/game.cpp
Normal file
@@ -0,0 +1,539 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/path.h"
|
||||
#include "common/str-array.h"
|
||||
#include "common/system.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/config-manager.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/cellphone.h"
|
||||
#include "tetraedge/game/character.h"
|
||||
#include "tetraedge/game/in_game_scene.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/game_achievements.h"
|
||||
#include "tetraedge/game/lua_binds.h"
|
||||
#include "tetraedge/game/object3d.h"
|
||||
|
||||
#include "tetraedge/te/te_camera.h"
|
||||
#include "tetraedge/te/te_core.h"
|
||||
#include "tetraedge/te/te_input_mgr.h"
|
||||
#include "tetraedge/te/te_ray_intersection.h"
|
||||
#include "tetraedge/te/te_sound_manager.h"
|
||||
#include "tetraedge/te/te_variant.h"
|
||||
#include "tetraedge/te/te_lua_thread.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
Game::Game() : _objectsTakenVal(0), _returnToMainMenu(false), _entered(false),
|
||||
_running(false), _noScaleLayout2(nullptr), _luaShowOwnerError(false),
|
||||
_firstInventory(true), _dialogsTold(0) {
|
||||
for (int i = 0; i < NUM_OBJECTS_TAKEN_IDS; i++) {
|
||||
_objectsTakenBits[i] = false;
|
||||
}
|
||||
_dialog2.onAnimationDownFinishedSignal().add(this, &Game::onDialogFinished);
|
||||
_question2.onAnswerSignal().add(this, &Game::onAnswered);
|
||||
}
|
||||
|
||||
Game::~Game() {
|
||||
}
|
||||
|
||||
/*static*/ const char *Game::OBJECTS_TAKEN_IDS[5] = {
|
||||
"BCylindreBarr",
|
||||
"VCylindreMusique",
|
||||
"VCylindreVal",
|
||||
"CCylindreCite",
|
||||
"VPoupeeMammouth"
|
||||
};
|
||||
|
||||
void Game::addNoScale2Child(TeLayout *layout) {
|
||||
if (!layout)
|
||||
return;
|
||||
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
if (_noScaleLayout2) {
|
||||
_noScaleLayout2->addChild(layout);
|
||||
}
|
||||
} else {
|
||||
// No _noScaleLayout in Amerzone, just use front
|
||||
g_engine->getApplication()->frontLayout().addChild(layout);
|
||||
}
|
||||
}
|
||||
|
||||
void Game::closeDialogs() {
|
||||
_documentsBrowser.hideDocument();
|
||||
_documentsBrowser.leave();
|
||||
_inventory.leave();
|
||||
}
|
||||
|
||||
/*static*/
|
||||
TeI3DObject2 *Game::findLayoutByName(TeLayout *parent, const Common::String &name) {
|
||||
// Seems like this is never used?
|
||||
error("TODO: Implement Game::findLayoutByName");
|
||||
}
|
||||
|
||||
/*static*/
|
||||
TeSpriteLayout *Game::findSpriteLayoutByName(TeLayout *parent, const Common::String &name) {
|
||||
if (!parent)
|
||||
return nullptr;
|
||||
|
||||
if (parent->name() == name)
|
||||
return dynamic_cast<TeSpriteLayout *>(parent);
|
||||
|
||||
for (auto &child : parent->childList()) {
|
||||
TeSpriteLayout *val = findSpriteLayoutByName(dynamic_cast<TeLayout *>(child), name);
|
||||
if (val)
|
||||
return val;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Game::isDocumentOpened() {
|
||||
return _documentsBrowser.gui().layoutChecked("zoomed")->visible();
|
||||
}
|
||||
|
||||
bool Game::isMoviePlaying() {
|
||||
TeButtonLayout *vidButton = _inGameGui.buttonLayout("videoBackgroundButton");
|
||||
if (vidButton)
|
||||
return vidButton->visible();
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char *DIALOG_IDS[20] = {
|
||||
"KFJ1", "KH", "KJ", "KL",
|
||||
"KO", "KS", "KCa", "KFE2",
|
||||
"KFE3", "KG", "KMa", "KP",
|
||||
"KR", "KCo", "KD", "KA",
|
||||
"KFJ", "KM", "KN", "KFM"};
|
||||
|
||||
bool Game::launchDialog(const Common::String &dname, uint param_2, const Common::String &charname,
|
||||
const Common::String &animfile, float animblend) {
|
||||
Application *app = g_engine->getApplication();
|
||||
const Common::String *locstring = app->loc().value(dname);
|
||||
|
||||
if (!locstring)
|
||||
locstring = &dname;
|
||||
|
||||
if (!locstring) // shouldn't happen?
|
||||
return false;
|
||||
|
||||
Common::String dstring = *locstring;
|
||||
|
||||
//
|
||||
// WORKAROUND: Fix some errors in en version strings
|
||||
//
|
||||
if (g_engine->getCore()->language() == "en") {
|
||||
if (dname == "C_OK_tel03_09") {
|
||||
size_t rloc = dstring.find("pleased to here");
|
||||
if (rloc != Common::String::npos)
|
||||
dstring.replace(rloc + 11, 4, "hear");
|
||||
} else if (dname == "B_diapo04") {
|
||||
size_t rloc = dstring.find("little imagination ? he draws");
|
||||
if (rloc != Common::String::npos)
|
||||
dstring.replace(rloc + 19, 1, "-");
|
||||
} else if (dname == "V_NK_lettre_01") {
|
||||
size_t rloc = dstring.find("you now ? my brother");
|
||||
if (rloc != Common::String::npos)
|
||||
dstring.replace(rloc + 8, 1, "-");
|
||||
}
|
||||
}
|
||||
|
||||
for (uint i = 0; i < ARRAYSIZE(DIALOG_IDS); i++) {
|
||||
if (dname.contains(Common::String::format("_%s_", DIALOG_IDS[i])))
|
||||
_dialogsTold++;
|
||||
}
|
||||
|
||||
const Common::String sndfile = dname + ".ogg";
|
||||
_dialog2.pushDialog(dname, dstring, sndfile, charname, animfile, animblend);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Game::onAnswered(const Common::String &val) {
|
||||
_luaScript.execute("OnAnswered", val);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Game::onInventoryButtonValidated() {
|
||||
_inventoryMenu.enter();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Game::onLockVideoButtonValidated() {
|
||||
TeButtonLayout *btn = _inGameGui.buttonLayoutChecked("skipVideoButton");
|
||||
btn->setVisible(!btn->visible());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifdef TETRAEDGE_ENABLE_CUSTOM_CURSOR_CHECKS
|
||||
// Note: None of these cursor files seem to be actually shipped with the game
|
||||
// but the logic is reproduced here just in case there's some different
|
||||
// version that uses them.
|
||||
static const char cursorsTable[][2][80] = {
|
||||
{"H000", "pictures/F000.png"},
|
||||
{"H045", "pictures/F045.png"},
|
||||
{"H090", "pictures/F090.png"},
|
||||
{"H135", "pictures/F135.png"},
|
||||
{"H180", "pictures/F180.png"},
|
||||
{"H225", "pictures/F225.png"},
|
||||
{"H270", "pictures/F270.png"},
|
||||
{"H315", "pictures/F315.png"},
|
||||
{"Main", "pictures/Main.png"},
|
||||
{"Action", "pictures/Action.png"},
|
||||
{"Parler", "pictures/Cursor_Large/Anim_Cursor_Talking.anim"},
|
||||
{"Type01", "pictures/Type01.png"},
|
||||
{"Type02", "pictures/Type02.png"},
|
||||
{"Type03", "pictures/Type03.png"},
|
||||
{"Type04", "pictures/Type04.png"},
|
||||
{"Type05", "pictures/Type05.png"}
|
||||
};
|
||||
#endif
|
||||
|
||||
bool Game::onMouseMove(const Common::Point &pt) {
|
||||
if (!_entered)
|
||||
return false;
|
||||
|
||||
Application *app = g_engine->getApplication();
|
||||
|
||||
if (app->isLockCursor()) {
|
||||
app->mouseCursorLayout().load(app->defaultCursor());
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: All the logic below is a bit suspicious and unfinished.
|
||||
//
|
||||
// The original game goes through a series of checks of mouseIn and
|
||||
// visible before deciding whether to do a full search for a mouse
|
||||
// cursor to apply. But after all that, in practice, none of the
|
||||
// mouse cursors above actually exist in the game data.
|
||||
//
|
||||
// So maybe all this is useless?
|
||||
|
||||
#ifdef TETRAEDGE_ENABLE_CUSTOM_CURSOR_CHECKS
|
||||
TeVector2s32 mouseLoc = g_engine->getInputMgr()->lastMousePos();
|
||||
bool skipFullSearch = false;
|
||||
|
||||
TeLayout *cellphone = _inventory.cellphone()->gui().layoutChecked("cellphone");
|
||||
TeLayout *cellbg = _inventory.cellphone()->gui().layoutChecked("background");
|
||||
if (cellphone->isMouseIn(mouseLoc)) {
|
||||
skipFullSearch = true;
|
||||
if (!cellbg->visible() && _objectif.isMouseIn(mouseLoc)) {
|
||||
app->mouseCursorLayout().load(app->defaultCursor());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
TeLayout *imgDialog = _dialog2.gui().layoutChecked("imgDialog");
|
||||
bool mouseInImgDialog = imgDialog->isMouseIn(mouseLoc);
|
||||
if (mouseInImgDialog || !imgDialog->visible()) {
|
||||
if (!mouseInImgDialog)
|
||||
skipFullSearch = true;
|
||||
//warning("TODO: Finish Game::onMouseMove");
|
||||
}
|
||||
|
||||
bool checkedCursor = false;
|
||||
if (!skipFullSearch && _scene.gui2().loaded()) {
|
||||
TeLayout *bglayout = _scene.gui2().layoutChecked("background");
|
||||
for (uint i = 0; i < bglayout->childCount(); i++) {
|
||||
TeLayout *childlayout = dynamic_cast<TeLayout *>(bglayout->child(i));
|
||||
if (childlayout && childlayout->isMouseIn(mouseLoc) && childlayout->visible()) {
|
||||
for (int i = 0; i < ARRAYSIZE(cursorsTable); i++) {
|
||||
if (childlayout->name().contains(cursorsTable[i][0])) {
|
||||
app->mouseCursorLayout().load(cursorsTable[i][1]);
|
||||
if (Common::String(cursorsTable[i][0]).contains(".anim")) {
|
||||
app->mouseCursorLayout()._tiledSurfacePtr->_frameAnim._loopCount = -1;
|
||||
app->mouseCursorLayout()._tiledSurfacePtr->_frameAnim.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
checkedCursor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!checkedCursor)
|
||||
app->mouseCursorLayout().load(DEFAULT_CURSOR);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Game::onSkipVideoButtonValidated() {
|
||||
TeSpriteLayout *sprite = _inGameGui.spriteLayoutChecked("video");
|
||||
sprite->stop();
|
||||
TeButtonLayout *btn = _inGameGui.buttonLayout("videoBackgroundButton");
|
||||
if (btn)
|
||||
btn->setVisible(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Unused
|
||||
void Game::pauseMovie() {
|
||||
_videoMusic.pause();
|
||||
TeSpriteLayout *sprite = _inGameGui.spriteLayoutChecked("video");
|
||||
sprite->pause();
|
||||
}
|
||||
*/
|
||||
|
||||
bool Game::playMovie(const Common::Path &vidPath, const Common::Path &musicPath, float volume /* = 1.0f */) {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
TeButtonLayout *videoBackgroundButton = _inGameGui.buttonLayoutChecked("videoBackgroundButton");
|
||||
videoBackgroundButton->setVisible(true);
|
||||
|
||||
TeButtonLayout *skipVideoButton = _inGameGui.buttonLayoutChecked("skipVideoButton");
|
||||
skipVideoButton->setVisible(false);
|
||||
|
||||
app->music().stop();
|
||||
_videoMusic.stop();
|
||||
_videoMusic.setChannelName("video");
|
||||
_videoMusic.repeat(false);
|
||||
_videoMusic.volume(volume);
|
||||
_videoMusic.load(musicPath);
|
||||
|
||||
_running = false;
|
||||
|
||||
TeSpriteLayout *videoSpriteLayout = _inGameGui.spriteLayoutChecked("video");
|
||||
if (videoSpriteLayout->load(vidPath)) {
|
||||
uint vidHeight = videoSpriteLayout->_tiledSurfacePtr->codec()->height();
|
||||
uint vidWidth = videoSpriteLayout->_tiledSurfacePtr->codec()->width();
|
||||
|
||||
// Note: Not in original, but original incorrectly stretches
|
||||
// videos that should be 16:9.
|
||||
if (ConfMan.getBool("correct_movie_aspect")) {
|
||||
videoSpriteLayout->setRatioMode(TeILayout::RATIO_MODE_LETTERBOX);
|
||||
videoSpriteLayout->setRatio((float)vidWidth / vidHeight);
|
||||
videoSpriteLayout->updateSize();
|
||||
}
|
||||
|
||||
videoSpriteLayout->setVisible(true);
|
||||
_videoMusic.play();
|
||||
videoSpriteLayout->play();
|
||||
|
||||
// Stop the movie and sound early for testing if skip_videos set
|
||||
if (ConfMan.getBool("skip_videos")) {
|
||||
videoSpriteLayout->_tiledSurfacePtr->_frameAnim.setNbFrames(10);
|
||||
_videoMusic.stop();
|
||||
}
|
||||
|
||||
app->fade();
|
||||
return true;
|
||||
} else {
|
||||
warning("Failed to load movie %s", vidPath.toString(Common::Path::kNativeSeparator).c_str());
|
||||
// Ensure the correct finished event gets called anyway.
|
||||
videoSpriteLayout->_tiledSurfacePtr->setLoadedPath(vidPath);
|
||||
onVideoFinished();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Game::playSound(const Common::String &name, int repeats, float volume) {
|
||||
Game *game = g_engine->getGame();
|
||||
|
||||
assert(repeats == 1 || repeats == -1);
|
||||
if (repeats == 1) {
|
||||
GameSound *sound = new GameSound();
|
||||
sound->setName(name);
|
||||
sound->setChannelName("sfx");
|
||||
sound->repeat(false);
|
||||
sound->load(Common::Path(name));
|
||||
sound->volume(volume);
|
||||
if (!sound->play()) {
|
||||
game->luaScript().execute("OnFreeSoundFinished", name);
|
||||
game->luaScript().execute("OnCellFreeSoundFinished", name);
|
||||
// Note: original leaks sound here, don't do that..
|
||||
delete sound;
|
||||
} else {
|
||||
sound->onStopSignal().add(sound, &GameSound::onSoundStopped);
|
||||
sound->setRetain(true);
|
||||
_gameSounds.push_back(sound);
|
||||
}
|
||||
} else if (repeats == -1) {
|
||||
const Common::Path pathName(name);
|
||||
for (GameSound *snd : _gameSounds) {
|
||||
const Common::Path accessName = snd->getAccessName();
|
||||
if (accessName == pathName) {
|
||||
snd->setRetain(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GameSound *sound = new GameSound();
|
||||
sound->setChannelName("sfx");
|
||||
sound->load(pathName);
|
||||
sound->volume(volume);
|
||||
if (!sound->play()) {
|
||||
game->luaScript().execute("OnFreeSoundFinished", name);
|
||||
game->luaScript().execute("OnCellFreeSoundFinished", name);
|
||||
delete sound;
|
||||
} else {
|
||||
sound->setRetain(true);
|
||||
_gameSounds.push_back(sound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Game::removeNoScale2Child(TeLayout *layout) {
|
||||
if (!layout)
|
||||
return;
|
||||
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
if (_noScaleLayout2)
|
||||
_noScaleLayout2->removeChild(layout);
|
||||
} else {
|
||||
// No _noScaleLayout in Amerzone, just use front
|
||||
g_engine->getApplication()->frontLayout().removeChild(layout);
|
||||
}
|
||||
}
|
||||
|
||||
void Game::resumeMovie() {
|
||||
_videoMusic.play();
|
||||
_inGameGui.spriteLayout("video")->play();
|
||||
}
|
||||
|
||||
void Game::saveBackup(const Common::String &saveName) {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->showLoadingIcon(true);
|
||||
if (saveName == "save.xml")
|
||||
g_engine->saveAutosaveIfEnabled();
|
||||
else
|
||||
warning("TODO: Implemet Game::saveBackup %s", saveName.c_str());
|
||||
app->showLoadingIcon(false);
|
||||
}
|
||||
|
||||
bool Game::setBackground(const Common::Path &name) {
|
||||
return _scene.changeBackground(name);
|
||||
}
|
||||
|
||||
void Game::setCurrentObjectSprite(const Common::Path &spritePath) {
|
||||
TeSpriteLayout *currentSprite = _inGameGui.spriteLayout("currentObjectSprite");
|
||||
if (currentSprite) {
|
||||
if (spritePath.empty())
|
||||
currentSprite->unload();
|
||||
else
|
||||
currentSprite->load(spritePath);
|
||||
}
|
||||
}
|
||||
|
||||
// Note: The naming of this function is bad, but follows the original..
|
||||
// we really set the visibility to the *opposite* of the parameter.
|
||||
bool Game::showMarkers(bool val) {
|
||||
if (!_forGui.loaded())
|
||||
return false;
|
||||
|
||||
TeLayout *bg = _forGui.layoutChecked("background");
|
||||
for (int i = 0; i < bg->childCount(); i++) {
|
||||
const InGameScene::TeMarker *marker = _scene.findMarker(bg->child(i)->name());
|
||||
if (marker)
|
||||
bg->child(i)->setVisible(!val);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Game::startAnimation(const Common::String &animName, int loopcount, bool reversed) {
|
||||
TeSpriteLayout *layout = _scene.bgGui().spriteLayout(animName);
|
||||
if (layout) {
|
||||
layout->_tiledSurfacePtr->_frameAnim.setLoopCount(loopcount);
|
||||
layout->_tiledSurfacePtr->_frameAnim.setReversed(reversed);
|
||||
layout->_tiledSurfacePtr->play();
|
||||
}
|
||||
return layout != nullptr;
|
||||
}
|
||||
|
||||
void Game::stopSound(const Common::String &name) {
|
||||
Common::Path path(name);
|
||||
for (uint i = 0; i < _gameSounds.size(); i++) {
|
||||
GameSound *sound = _gameSounds[i];
|
||||
if (sound->filePath() == path) {
|
||||
sound->stop();
|
||||
sound->deleteLater();
|
||||
_gameSounds.remove_at(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_engine->getSoundManager()->stopFreeSound(name);
|
||||
}
|
||||
|
||||
Common::Error Game::syncGame(Common::Serializer &s) {
|
||||
Application *app = g_engine->getApplication();
|
||||
|
||||
//
|
||||
// Note: Early versions of this code didn't sync a version number so it was
|
||||
// the inventory item count. We use a large version number which would never
|
||||
// be the inventory count.
|
||||
//
|
||||
// Version history:
|
||||
// 1000 - original sybeira 1/2 data
|
||||
// 1001 - added document browser information for Amerzone, currently unused
|
||||
// in syberia but synced anyway for simplicity.
|
||||
//
|
||||
if (!s.syncVersion(1001))
|
||||
error("Save game version too new: %d", s.getVersion());
|
||||
|
||||
if (s.getVersion() < 1000) {
|
||||
warning("Loading as old un-versioned save data");
|
||||
inventory().syncStateWithCount(s, s.getVersion());
|
||||
} else {
|
||||
inventory().syncState(s);
|
||||
}
|
||||
|
||||
if (s.getVersion() > 1000)
|
||||
documentsBrowser().syncState(s);
|
||||
|
||||
if (!g_engine->gameIsAmerzone())
|
||||
inventory().cellphone()->syncState(s);
|
||||
|
||||
// Some of these other values are not needed for Amerzone, but we can safely
|
||||
// save/load them as they're just empty.
|
||||
|
||||
// dialog2().syncState(s); // game saves this here, but doesn't actually save anything
|
||||
_luaContext.syncState(s);
|
||||
s.syncString(_currentZone);
|
||||
s.syncString(_currentScene);
|
||||
s.syncAsUint32LE(app->difficulty());
|
||||
uint64 elapsed = _playedTimer.timeFromLastTimeElapsed(); // TODO: + _loadedPlayTime;
|
||||
s.syncAsDoubleLE(elapsed);
|
||||
_playedTimer.stop();
|
||||
_playedTimer.start();
|
||||
s.syncAsUint32LE(_objectsTakenVal);
|
||||
for (uint i = 0; i < ARRAYSIZE(_objectsTakenBits); i++)
|
||||
s.syncAsByte(_objectsTakenBits[i]);
|
||||
s.syncAsUint32LE(_dialogsTold);
|
||||
s.syncString(_prevSceneName);
|
||||
Common::String mpath(_videoMusic.filePath().toString('/'));
|
||||
s.syncString(mpath);
|
||||
if (s.isLoading())
|
||||
_videoMusic.load(Common::Path(mpath, '/'));
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
assert(_scene._character);
|
||||
s.syncString(_scene._character->walkModeStr());
|
||||
}
|
||||
s.syncAsByte(_firstInventory);
|
||||
s.syncAsByte(app->tutoActivated());
|
||||
|
||||
app->showLoadingIcon(false);
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
181
engines/tetraedge/game/game.h
Normal file
181
engines/tetraedge/game/game.h
Normal file
@@ -0,0 +1,181 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_GAME_H
|
||||
#define TETRAEDGE_GAME_GAME_H
|
||||
|
||||
#include "common/types.h"
|
||||
#include "common/serializer.h"
|
||||
#include "common/str.h"
|
||||
#include "common/random.h"
|
||||
|
||||
#include "tetraedge/game/documents_browser.h"
|
||||
#include "tetraedge/game/inventory.h"
|
||||
#include "tetraedge/game/inventory_menu.h"
|
||||
#include "tetraedge/game/in_game_scene.h"
|
||||
#include "tetraedge/game/notifier.h"
|
||||
#include "tetraedge/game/game_sound.h"
|
||||
#include "tetraedge/game/question2.h"
|
||||
#include "tetraedge/game/dialog2.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
#include "tetraedge/te/te_music.h"
|
||||
#include "tetraedge/te/te_vector2s32.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class TeLuaThread;
|
||||
|
||||
class Game {
|
||||
public:
|
||||
Game();
|
||||
virtual ~Game();
|
||||
|
||||
struct YieldedCallback {
|
||||
TeLuaThread *_luaThread;
|
||||
Common::String _luaParam;
|
||||
Common::String _luaParam2;
|
||||
Common::String _luaFnName;
|
||||
// Note: original game long, and int fields.. unused?
|
||||
};
|
||||
|
||||
void addNoScale2Child(TeLayout *layout);
|
||||
virtual void addToBag(const Common::String &objname) = 0;
|
||||
|
||||
virtual bool changeWarp(const Common::String &zone, const Common::String &scene, bool fadeFlag) = 0;
|
||||
|
||||
void closeDialogs();
|
||||
|
||||
virtual void draw() = 0;
|
||||
virtual void enter() = 0; // will load game if _loadName is set.
|
||||
// Note: game uses ILayouts here..
|
||||
static TeI3DObject2 *findLayoutByName(TeLayout *parent, const Common::String &name);
|
||||
static TeSpriteLayout *findSpriteLayoutByName(TeLayout *parent, const Common::String &name);
|
||||
|
||||
virtual void finishGame() = 0;
|
||||
virtual void initLoadedBackupData() = 0;
|
||||
bool isDocumentOpened();
|
||||
bool isMouse() { return false; }
|
||||
bool isMoviePlaying();
|
||||
bool launchDialog(const Common::String ¶m_1, uint param_2, const Common::String &charname,
|
||||
const Common::String &animfile, float animblend);
|
||||
virtual void leave(bool flag) = 0;
|
||||
|
||||
// Not in original. Load unlocked artwork from ScummVM config.
|
||||
virtual void loadUnlockedArtwork() {};
|
||||
|
||||
//void pauseMovie(); // Unused
|
||||
//void pauseSounds() {}; // Unused, does nothing?
|
||||
bool playMovie(const Common::Path &vidPath, const Common::Path &musicPath, float volume = 1.0f);
|
||||
void playSound(const Common::String &name, int param_2, float volume);
|
||||
void removeNoScale2Child(TeLayout *layout);
|
||||
void resumeMovie();
|
||||
void resumeSounds() {}; // does nothing?
|
||||
void saveBackup(const Common::String &saveName);
|
||||
bool setBackground(const Common::Path &name);
|
||||
void setCurrentObjectSprite(const Common::Path &spritePath);
|
||||
bool showMarkers(bool val);
|
||||
bool startAnimation(const Common::String &animName, int loopcount, bool reversed);
|
||||
// void startAnimationPart(const Common::String ¶m_1, int param_2, int param_3, int param_4, bool param_5) {}; // Unused.
|
||||
void stopSound(const Common::String &name);
|
||||
Common::Error syncGame(Common::Serializer &s); // Basically replaces saveBackup from original..
|
||||
virtual void update() = 0;
|
||||
|
||||
InventoryMenu &inventoryMenu() { return _inventoryMenu; }
|
||||
Inventory &inventory() { return _inventory; }
|
||||
DocumentsBrowser &documentsBrowser() { return _documentsBrowser; }
|
||||
bool entered() const { return _entered; }
|
||||
bool running() const { return _running; }
|
||||
void setRunning(bool val) { _running = val; }
|
||||
bool luaShowOwnerError() const { return _luaShowOwnerError; }
|
||||
|
||||
bool _returnToMainMenu;
|
||||
bool _firstInventory;
|
||||
|
||||
const Common::String ¤tZone() const { return _currentZone; }
|
||||
const Common::String ¤tScene() const { return _currentScene; }
|
||||
TeLuaScript &luaScript() { return _luaScript; }
|
||||
TeLuaContext &luaContext() { return _luaContext; }
|
||||
InGameScene &scene() { return _scene; }
|
||||
Dialog2 &dialog2() { return _dialog2; }
|
||||
Question2 &question2() { return _question2; }
|
||||
TeLuaGUI &forGui() { return _forGui; }
|
||||
TeLuaGUI &inGameGui() { return _inGameGui; }
|
||||
bool hasLoadName() const { return !_loadName.empty(); }
|
||||
void setLoadName(const Common::String &loadName) { _loadName = loadName; }
|
||||
|
||||
bool onAnswered(const Common::String &val);
|
||||
virtual bool onDialogFinished(const Common::String &val) = 0;
|
||||
virtual bool onFinishedLoadingBackup(const Common::String &val) { return false; }
|
||||
bool onInventoryButtonValidated();
|
||||
bool onLockVideoButtonValidated();
|
||||
bool onMouseMove(const Common::Point &pt);
|
||||
bool onSkipVideoButtonValidated();
|
||||
virtual bool onVideoFinished() = 0;
|
||||
|
||||
protected:
|
||||
bool _luaShowOwnerError;
|
||||
bool _running;
|
||||
bool _entered;
|
||||
|
||||
//TeLuaGUI _gui1; // Never used.
|
||||
TeLuaGUI _setAnimGui;
|
||||
TeLuaGUI _forGui;
|
||||
TeLuaGUI _inGameGui;
|
||||
|
||||
Inventory _inventory;
|
||||
InventoryMenu _inventoryMenu;
|
||||
|
||||
InGameScene _scene;
|
||||
|
||||
Common::String _loadName;
|
||||
|
||||
Common::String _currentScene;
|
||||
Common::String _currentZone;
|
||||
Common::String _prevSceneName;
|
||||
|
||||
Common::Array<GameSound *> _gameSounds;
|
||||
|
||||
static const int NUM_OBJECTS_TAKEN_IDS = 5;
|
||||
static const char *OBJECTS_TAKEN_IDS[NUM_OBJECTS_TAKEN_IDS];
|
||||
bool _objectsTakenBits[NUM_OBJECTS_TAKEN_IDS];
|
||||
int _objectsTakenVal;
|
||||
|
||||
TeTimer _playedTimer;
|
||||
TeTimer _walkTimer;
|
||||
TeLuaScript _luaScript;
|
||||
TeLuaContext _luaContext;
|
||||
TeLuaScript _gameEnterScript;
|
||||
TeMusic _videoMusic;
|
||||
Notifier _notifier;
|
||||
DocumentsBrowser _documentsBrowser;
|
||||
|
||||
Question2 _question2;
|
||||
Dialog2 _dialog2;
|
||||
|
||||
int _dialogsTold;
|
||||
|
||||
TeLayout *_noScaleLayout2;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_GAME_H
|
||||
59
engines/tetraedge/game/game_achievements.cpp
Normal file
59
engines/tetraedge/game/game_achievements.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/game_achievements.h"
|
||||
#include "tetraedge/te/te_lua_context.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
GameAchievements::GameAchievements() {
|
||||
}
|
||||
|
||||
/*static*/ void GameAchievements::registerAchievements(TeLuaContext &context) {
|
||||
context.setGlobal("PS3_Welcome", 0);
|
||||
context.setGlobal("PS3_Legacy", -1);
|
||||
context.setGlobal("PS3_Graduate", -2);
|
||||
context.setGlobal("PS3_Easten", -3);
|
||||
context.setGlobal("PS3_Odyssey", -4);
|
||||
context.setGlobal("PS3_Code", -5);
|
||||
context.setGlobal("PS3_Escape", -6);
|
||||
context.setGlobal("PS3_Amerzone", -7);
|
||||
context.setGlobal("PS3_Music", -8);
|
||||
context.setGlobal("PS3_OnWay", -9);
|
||||
context.setGlobal("PS3_Gossip", -10);
|
||||
context.setGlobal("PS3_Snoop", -0xb);
|
||||
context.setGlobal("PS3_School", -0xc);
|
||||
context.setGlobal("XBOX_Welcome", 1);
|
||||
context.setGlobal("XBOX_Legacy", 2);
|
||||
context.setGlobal("XBOX_Graduate", 3);
|
||||
context.setGlobal("XBOX_Easten", 4);
|
||||
context.setGlobal("XBOX_Odyssey", 5);
|
||||
context.setGlobal("XBOX_Code", 6);
|
||||
context.setGlobal("XBOX_Escape", 7);
|
||||
context.setGlobal("XBOX_Amerzone", 8);
|
||||
context.setGlobal("XBOX_Music", 9);
|
||||
context.setGlobal("XBOX_OnWay", 10);
|
||||
context.setGlobal("XBOX_Gossip", 0xb);
|
||||
context.setGlobal("XBOX_Snoop", 0xc);
|
||||
context.setGlobal("XBOX_School", 0xd);
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
40
engines/tetraedge/game/game_achievements.h
Normal file
40
engines/tetraedge/game/game_achievements.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_GAME_ACHIEVEMENTS_H
|
||||
#define TETRAEDGE_GAME_GAME_ACHIEVEMENTS_H
|
||||
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class TeLuaContext;
|
||||
|
||||
class GameAchievements {
|
||||
public:
|
||||
GameAchievements();
|
||||
|
||||
static void registerAchievements(TeLuaContext &context);
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_GAME_ACHIEVEMENTS_H
|
||||
56
engines/tetraedge/game/game_sound.cpp
Normal file
56
engines/tetraedge/game/game_sound.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/game_sound.h"
|
||||
#include "tetraedge/game/syberia_game.h"
|
||||
#include "tetraedge/tetraedge.h"
|
||||
|
||||
#include "tetraedge/te/te_lua_thread.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
GameSound::GameSound() {
|
||||
}
|
||||
|
||||
bool GameSound::onSoundStopped() {
|
||||
SyberiaGame *game = dynamic_cast<SyberiaGame *>(g_engine->getGame());
|
||||
if (!game || !game->luaContext().isCreated())
|
||||
return false;
|
||||
|
||||
Common::Array<SyberiaGame::YieldedCallback> &callbacks = game->yieldedCallbacks();
|
||||
for (uint i = 0; i < callbacks.size(); i++) {
|
||||
if (callbacks[i]._luaFnName == "OnFreeSoundFinished" && callbacks[i]._luaParam == _name) {
|
||||
TeLuaThread *thread = callbacks[i]._luaThread;
|
||||
callbacks.remove_at(i);
|
||||
if (thread) {
|
||||
thread->resume();
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
game->luaScript().execute("OnFreeSoundFinished", _name);
|
||||
game->luaScript().execute("OnCellFreeSoundFinished", _name);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
45
engines/tetraedge/game/game_sound.h
Normal file
45
engines/tetraedge/game/game_sound.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_GAME_SOUND_H
|
||||
#define TETRAEDGE_GAME_GAME_SOUND_H
|
||||
|
||||
#include "common/str.h"
|
||||
#include "tetraedge/te/te_music.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class GameSound : public TeMusic {
|
||||
public:
|
||||
GameSound();
|
||||
|
||||
bool onSoundStopped();
|
||||
const Common::String &name() const { return _name; }
|
||||
void setName(const Common::String &val) { _name = val; }
|
||||
|
||||
private:
|
||||
Common::String _name;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_GAME_SOUND_H
|
||||
118
engines/tetraedge/game/global_bonus_menu.cpp
Normal file
118
engines/tetraedge/game/global_bonus_menu.cpp
Normal file
@@ -0,0 +1,118 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/global_bonus_menu.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
GlobalBonusMenu::GlobalBonusMenu() : _entered(false) {
|
||||
}
|
||||
|
||||
void GlobalBonusMenu::enter() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->appSpriteLayout().setVisible(true);
|
||||
app->captureFade();
|
||||
_entered = true;
|
||||
load("menus/bonusmenu/GlobalBonusMenu.lua");
|
||||
TeLayout *menu = layoutChecked("menu");
|
||||
app->frontLayout().addChild(menu);
|
||||
|
||||
// Original checks each layout's existence
|
||||
TeButtonLayout *btn;
|
||||
btn = buttonLayout("Val");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &GlobalBonusMenu::onValButtonValidated);
|
||||
btn = buttonLayout("Bar");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &GlobalBonusMenu::onBarButtonValidated);
|
||||
btn = buttonLayout("Cit");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &GlobalBonusMenu::onCitButtonValidated);
|
||||
btn = buttonLayout("Ara");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &GlobalBonusMenu::onAraButtonValidated);
|
||||
btn = buttonLayout("Syb2");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &GlobalBonusMenu::onSyb2ButtonValidated);
|
||||
btn = buttonLayout("Syb3");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &GlobalBonusMenu::onSyb3ButtonValidated);
|
||||
btn = buttonLayout("Back");
|
||||
if (btn)
|
||||
btn->onMouseClickValidated().add(this, &GlobalBonusMenu::onQuitButton);
|
||||
}
|
||||
|
||||
void GlobalBonusMenu::leave() {
|
||||
if (!_entered)
|
||||
return;
|
||||
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
TeLuaGUI::unload();
|
||||
app->fade();
|
||||
_entered = false;
|
||||
}
|
||||
|
||||
bool GlobalBonusMenu::onSomeButtonValidated(const char *script) {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->bonusMenu().enter(script);
|
||||
app->fade();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GlobalBonusMenu::onAraButtonValidated() {
|
||||
return onSomeButtonValidated("menus/bonusmenu/Ara.lua");
|
||||
}
|
||||
|
||||
bool GlobalBonusMenu::onBarButtonValidated() {
|
||||
return onSomeButtonValidated("menus/bonusmenu/Bar.lua");
|
||||
}
|
||||
|
||||
bool GlobalBonusMenu::onCitButtonValidated() {
|
||||
return onSomeButtonValidated("menus/bonusmenu/Cit.lua");
|
||||
}
|
||||
|
||||
bool GlobalBonusMenu::onSyb2ButtonValidated() {
|
||||
return onSomeButtonValidated("menus/bonusmenu/Syb2.lua");
|
||||
}
|
||||
|
||||
bool GlobalBonusMenu::onSyb3ButtonValidated() {
|
||||
return onSomeButtonValidated("menus/bonusmenu/Syb3.lua");
|
||||
}
|
||||
|
||||
bool GlobalBonusMenu::onValButtonValidated() {
|
||||
return onSomeButtonValidated("menus/bonusmenu/Val.lua");
|
||||
}
|
||||
|
||||
bool GlobalBonusMenu::onQuitButton() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->mainMenu().enter();
|
||||
app->fade();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
54
engines/tetraedge/game/global_bonus_menu.h
Normal file
54
engines/tetraedge/game/global_bonus_menu.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_GLOBAL_BONUS_MENU_H
|
||||
#define TETRAEDGE_GAME_GLOBAL_BONUS_MENU_H
|
||||
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class GlobalBonusMenu : public TeLuaGUI {
|
||||
public:
|
||||
GlobalBonusMenu();
|
||||
|
||||
void enter() override;
|
||||
void leave() override;
|
||||
|
||||
bool onAraButtonValidated();
|
||||
bool onBarButtonValidated();
|
||||
bool onCitButtonValidated();
|
||||
bool onSyb2ButtonValidated();
|
||||
bool onSyb3ButtonValidated();
|
||||
bool onValButtonValidated();
|
||||
|
||||
bool onQuitButton();
|
||||
|
||||
private:
|
||||
bool onSomeButtonValidated(const char *script);
|
||||
|
||||
bool _entered;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_GLOBAL_BONUS_MENU_H
|
||||
51
engines/tetraedge/game/help_option_menu.cpp
Normal file
51
engines/tetraedge/game/help_option_menu.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/help_option_menu.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
HelpOptionMenu::HelpOptionMenu() : _entered(false) {
|
||||
}
|
||||
|
||||
void HelpOptionMenu::enter() {
|
||||
if (!_entered) {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
load("menus/helpoptionMenu/optionsMenu.lua");
|
||||
|
||||
TeLayout *menu = layoutChecked("menu");
|
||||
app->appSpriteLayout().addChild(menu);
|
||||
app->fade();
|
||||
}
|
||||
}
|
||||
|
||||
void HelpOptionMenu::leave() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
unload();
|
||||
app->fade();
|
||||
_entered = false;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
43
engines/tetraedge/game/help_option_menu.h
Normal file
43
engines/tetraedge/game/help_option_menu.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_HELP_OPTION_MENU_H
|
||||
#define TETRAEDGE_GAME_HELP_OPTION_MENU_H
|
||||
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class HelpOptionMenu : public TeLuaGUI {
|
||||
public:
|
||||
HelpOptionMenu();
|
||||
|
||||
void enter() override;
|
||||
void leave() override;
|
||||
|
||||
private:
|
||||
bool _entered;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_HELP_OPTION_MENU_H
|
||||
58
engines/tetraedge/game/how_to.cpp
Normal file
58
engines/tetraedge/game/how_to.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
|
||||
#include "tetraedge/game/how_to.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
HowTo::HowTo() : _entered(false) {
|
||||
}
|
||||
|
||||
void HowTo::leave() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
unload();
|
||||
//app->helpOptionMenu().enter();
|
||||
app->fade();
|
||||
_entered = false;
|
||||
error("TODO: Finish HowTo::leave - need app->helpOptionMenu");
|
||||
}
|
||||
|
||||
void HowTo::enter() {
|
||||
if (_entered)
|
||||
return;
|
||||
|
||||
_entered = true;
|
||||
error("TODO: Implement HowTo::enter");
|
||||
}
|
||||
|
||||
bool HowTo::onDefaultPadButtonUp(uint32 flags) {
|
||||
error("TODO: Implement HowTo::onDefaultPadButtonUp");
|
||||
}
|
||||
|
||||
bool HowTo::updateDisplay(uint oldval, uint newval) {
|
||||
error("TODO: Implement HowTo::updateDisplay");
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
47
engines/tetraedge/game/how_to.h
Normal file
47
engines/tetraedge/game/how_to.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_HOW_TO_H
|
||||
#define TETRAEDGE_GAME_HOW_TO_H
|
||||
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class HowTo : public TeLuaGUI {
|
||||
public:
|
||||
HowTo();
|
||||
|
||||
void enter() override;
|
||||
void leave() override;
|
||||
|
||||
bool onDefaultPadButtonUp(uint32 flags);
|
||||
|
||||
private:
|
||||
bool updateDisplay(uint oldval, uint newval);
|
||||
|
||||
bool _entered;
|
||||
//uint _val;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_HOW_TO_H
|
||||
1928
engines/tetraedge/game/in_game_scene.cpp
Normal file
1928
engines/tetraedge/game/in_game_scene.cpp
Normal file
File diff suppressed because it is too large
Load Diff
337
engines/tetraedge/game/in_game_scene.h
Normal file
337
engines/tetraedge/game/in_game_scene.h
Normal file
@@ -0,0 +1,337 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_IN_GAME_SCENE_H
|
||||
#define TETRAEDGE_GAME_IN_GAME_SCENE_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "common/str.h"
|
||||
#include "common/hashmap.h"
|
||||
|
||||
#include "tetraedge/game/object3d.h"
|
||||
#include "tetraedge/game/billboard.h"
|
||||
#include "tetraedge/game/youki_manager.h"
|
||||
|
||||
#include "tetraedge/te/te_act_zone.h"
|
||||
#include "tetraedge/te/te_bezier_curve.h"
|
||||
#include "tetraedge/te/te_free_move_zone.h"
|
||||
#include "tetraedge/te/te_scene.h"
|
||||
#include "tetraedge/te/te_light.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
#include "tetraedge/te/te_particle.h"
|
||||
#include "tetraedge/te/te_pick_mesh2.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Character;
|
||||
class CharactersShadow;
|
||||
class TeLayout;
|
||||
|
||||
class InGameScene : public TeScene {
|
||||
public:
|
||||
friend class InGameSceneXmlParser;
|
||||
|
||||
InGameScene();
|
||||
|
||||
struct AnimObject {
|
||||
bool onFinished();
|
||||
|
||||
Common::String _name;
|
||||
TeSpriteLayout *_layout;
|
||||
};
|
||||
|
||||
struct Callback {
|
||||
float _f;
|
||||
Common::String _name;
|
||||
};
|
||||
|
||||
struct SoundStep {
|
||||
Common::String _stepSound1;
|
||||
Common::String _stepSound2;
|
||||
};
|
||||
|
||||
struct AnchorZone {
|
||||
Common::String _name;
|
||||
bool _activated;
|
||||
TeVector3f32 _loc;
|
||||
float _radius;
|
||||
};
|
||||
|
||||
struct Object {
|
||||
TeIntrusivePtr<TeModel> _model;
|
||||
Common::String _name;
|
||||
};
|
||||
|
||||
struct TeMarker {
|
||||
Common::String _name;
|
||||
Common::String _val;
|
||||
};
|
||||
|
||||
struct Dummy {
|
||||
Common::String _name;
|
||||
TeVector3f32 _position;
|
||||
TeQuaternion _rotation;
|
||||
TeVector3f32 _scale;
|
||||
};
|
||||
|
||||
static const int MAX_FIRE;
|
||||
static const int MAX_SNOW;
|
||||
static const int MAX_SMOKE;
|
||||
static const float DUREE_MAX_FIRE;
|
||||
static const float SCALE_FIRE;
|
||||
static const int MAX_FLAKE;
|
||||
static const float DUREE_MIN_FLAKE;
|
||||
static const float DUREE_MAX_FLAKE;
|
||||
static const float SCALE_FLAKE;
|
||||
static const float DEPTH_MAX_FLAKE;
|
||||
|
||||
struct Fire {
|
||||
TeCurveAnim2<TeModel, TeVector3f32> _positionAnim;
|
||||
TeCurveAnim2<TeModel, TeColor> _colorAnim;
|
||||
TeCurveAnim2<TeModel, TeVector3f32> _scaleAnim;
|
||||
};
|
||||
|
||||
struct Flamme {
|
||||
Flamme() : _needsFires(false), _addFireOnUpdate(false) {};
|
||||
~Flamme();
|
||||
Common::Array<Fire*> _fires;
|
||||
Common::String _name;
|
||||
TeVector3f32 _center;
|
||||
TeVector3f32 _yMax;
|
||||
TeVector3f32 _offsetMin;
|
||||
TeVector3f32 _offsetMax;
|
||||
bool _needsFires;
|
||||
bool _addFireOnUpdate;
|
||||
void initFire();
|
||||
};
|
||||
|
||||
// TODO: Any other members of RippleMask?
|
||||
class RippleMask : public TeModel {
|
||||
|
||||
};
|
||||
|
||||
struct SceneLight {
|
||||
Common::String _name;
|
||||
TeVector3f32 _v1;
|
||||
TeVector3f32 _v2;
|
||||
TeColor _color;
|
||||
float _f;
|
||||
};
|
||||
|
||||
void activateAnchorZone(const Common::String &name, bool val);
|
||||
void addAnchorZone(const Common::String &s1, const Common::String &name, float radius);
|
||||
void addBlockingObject(const Common::String &obj) {
|
||||
_blockingObjects.push_back(obj);
|
||||
}
|
||||
bool addMarker(const Common::String &name, const Common::Path &imgPath, float x, float y, const Common::String &locType, const Common::String &markerVal, float anchorX, float anchorY);
|
||||
static float angularDistance(float a1, float a2);
|
||||
bool aroundAnchorZone(const AnchorZone *zone);
|
||||
TeLayout *background();
|
||||
Billboard *billboard(const Common::String &name);
|
||||
bool changeBackground(const Common::Path &name);
|
||||
Character *character(const Common::String &name);
|
||||
virtual void close() override;
|
||||
// Original has a typo, "converPathToMesh", corrected.
|
||||
void convertPathToMesh(TeFreeMoveZone *zone);
|
||||
TeIntrusivePtr<TeBezierCurve> curve(const Common::String &curveName);
|
||||
void deleteAllCallback();
|
||||
void deleteMarker(const Common::String &markerName);
|
||||
// Original just calls these "deserialize" but that's a fairly vague name
|
||||
// so renamed to be more meaningful.
|
||||
void deserializeCam(Common::ReadStream &stream, TeIntrusivePtr<TeCamera> &cam);
|
||||
void deserializeModel(Common::ReadStream &stream, TeIntrusivePtr<TeModel> &model, TePickMesh2 *pickmesh);
|
||||
virtual void draw() override;
|
||||
void drawKate();
|
||||
void drawMask();
|
||||
void drawReflection();
|
||||
void drawPath();
|
||||
Dummy dummy(const Common::String &name);
|
||||
bool findKate();
|
||||
const TeMarker *findMarker(const Common::String &name);
|
||||
const TeMarker *findMarkerByInt(const Common::String &name);
|
||||
SoundStep findSoundStep(const Common::String &name);
|
||||
void freeGeometry();
|
||||
void freeSceneObjects();
|
||||
Common::Path getActZoneFileName() const;
|
||||
Common::Path getBlockersFileName() const;
|
||||
Common::Path getLightsFileName() const;
|
||||
float getHeadHorizontalRotation(Character *cter, const TeVector3f32 &vec);
|
||||
float getHeadVerticalRotation(Character *cter, const TeVector3f32 &vec);
|
||||
Common::Path imagePathMarker(const Common::String &name);
|
||||
void initScroll();
|
||||
bool isMarker(const Common::String &name);
|
||||
bool isObjectBlocking(const Common::String &name);
|
||||
TeVector2f32 layerSize();
|
||||
|
||||
virtual bool load(const TetraedgeFSNode &node) override;
|
||||
void loadBackground(const TetraedgeFSNode &node);
|
||||
bool loadBillboard(const Common::String &name);
|
||||
void loadBlockers();
|
||||
bool loadCharacter(const Common::String &name);
|
||||
void loadInteractions(const TetraedgeFSNode &node);
|
||||
bool loadLights(const TetraedgeFSNode &node);
|
||||
void loadMarkers(const TetraedgeFSNode &node);
|
||||
bool loadObject(const Common::String &oname);
|
||||
bool loadObjectMaterials(const Common::String &name);
|
||||
bool loadObjectMaterials(const Common::Path &path, const Common::String &name);
|
||||
bool loadPlayerCharacter(const Common::String &cname);
|
||||
|
||||
// Syberia 2 specific data..
|
||||
void loadActZones();
|
||||
bool loadCamera(const Common::String &name);
|
||||
bool loadCurve(const Common::String &name);
|
||||
bool loadDynamicLightBloc(const Common::String &name, const Common::String &texture, const Common::String &zone, const Common::String &scene);
|
||||
// loadFlamme uses the xml doc
|
||||
bool loadFreeMoveZone(const Common::String &name, TeVector2f32 &gridSize);
|
||||
bool loadLight(const Common::String &fname, const Common::String &zone, const Common::String &scene);
|
||||
bool loadMask(const Common::String &name, const Common::String &texture, const Common::String &zone, const Common::String &scene);
|
||||
bool loadRBB(const Common::String &fname, const Common::String &zone, const Common::String &scene);
|
||||
bool loadRippleMask(const Common::String &name, const Common::String &texture, const Common::String &zone, const Common::String &scene);
|
||||
bool loadRObject(const Common::String &fname, const Common::String &zone, const Common::String &scene);
|
||||
bool loadShadowMask(const Common::String &name, const Common::String &texture, const Common::String &zone, const Common::String &scene);
|
||||
bool loadShadowReceivingObject(const Common::String &fname, const Common::String &zone, const Common::String &scene);
|
||||
//bool loadSnowCustom() // todo: from xml file?
|
||||
bool loadXml(const Common::String &zone, const Common::String &scene);
|
||||
bool loadZBufferObject(const Common::String &fname, const Common::String &zone, const Common::String &scene);
|
||||
|
||||
void moveCharacterTo(const Common::String &charName, const Common::String &curveName, float curveOffset, float curveEnd);
|
||||
Object3D *object3D(const Common::String &oname);
|
||||
void onMainWindowSizeChanged();
|
||||
TeFreeMoveZone *pathZone(const Common::String &zname);
|
||||
void playVerticalScrolling(float time);
|
||||
|
||||
void reset();
|
||||
void setImagePathMarker(const Common::String &markerName, const Common::Path &path);
|
||||
void setPositionCharacter(const Common::String &charName, const Common::String &freeMoveZoneName, const TeVector3f32 &position);
|
||||
void setStep(const Common::String &scene, const Common::String &step1, const Common::String &step2);
|
||||
void setVisibleMarker(const Common::String &markerName, bool val);
|
||||
TeLight *shadowLight();
|
||||
void unloadCharacter(const Common::String &name);
|
||||
void unloadObject(const Common::String &name);
|
||||
void unloadSpriteLayouts();
|
||||
void update() override;
|
||||
|
||||
// Does nothing, but to keep calls from original..
|
||||
void updateScroll();
|
||||
void updateViewport(int ival);
|
||||
|
||||
Character *_character;
|
||||
Common::Array<Character *> _characters;
|
||||
|
||||
TeLuaGUI &bgGui() { return _bgGui; }
|
||||
TeLuaGUI &hitObjectGui() { return _hitObjectGui; }
|
||||
TeLuaGUI &markerGui() { return _markerGui; }
|
||||
|
||||
Common::Array<TePickMesh2 *> &clickMeshes() { return _clickMeshes; }
|
||||
|
||||
float shadowFarPlane() const { return _shadowFarPlane; }
|
||||
float shadowNearPlane() const { return _shadowNearPlane; }
|
||||
float shadowFov() const { return _shadowFov; }
|
||||
const TeColor &shadowColor() const { return _shadowColor; }
|
||||
int shadowLightNo() const { return _shadowLightNo; }
|
||||
CharactersShadow *charactersShadow() { return _charactersShadow; }
|
||||
|
||||
TeIntrusivePtr<TeBezierCurve> curve() { return _curve; }
|
||||
void setCurve(TeIntrusivePtr<TeBezierCurve> &c) { _curve = c; }
|
||||
Common::Array<TeIntrusivePtr<TeModel>> &zoneModels() { return _zoneModels; }
|
||||
Common::Array<TeIntrusivePtr<TeModel>> &shadowReceivingObjects() { return _shadowReceivingObjects; }
|
||||
Common::Array<TeRectBlocker> &rectBlockers() { return _rectBlockers; }
|
||||
Common::Array<TeBlocker> &blockers() { return _blockers; }
|
||||
Common::Array<Object3D *> object3Ds() { return _object3Ds; }
|
||||
void setWaitTime(double usecs) { _waitTime = usecs; }
|
||||
TeTimer &waitTimeTimer() { return _waitTimeTimer; }
|
||||
Common::Array<Common::SharedPtr<TeLight>> &lights() { return _lights; }
|
||||
Common::Array<TeIntrusivePtr<TeParticle>> &particles() { return _particles; }
|
||||
|
||||
// Note: Zone name and scene name are only set in Syberia 2
|
||||
const Common::String getZoneName() const { return _zoneName; }
|
||||
const Common::String getSceneName() const { return _sceneName; }
|
||||
|
||||
void activateMask(const Common::String &name, bool val);
|
||||
YoukiManager &youkiManager() { return _youkiManager; }
|
||||
|
||||
private:
|
||||
int _shadowLightNo;
|
||||
CharactersShadow *_charactersShadow;
|
||||
TeColor _shadowColor;
|
||||
float _shadowFarPlane;
|
||||
float _shadowNearPlane;
|
||||
float _shadowFov;
|
||||
|
||||
double _waitTime;
|
||||
TeTimer _waitTimeTimer;
|
||||
|
||||
Common::Array<TeBlocker> _blockers;
|
||||
Common::Array<TeRectBlocker> _rectBlockers;
|
||||
Common::Array<TeActZone> _actZones;
|
||||
Common::Array<TeFreeMoveZone*> _freeMoveZones;
|
||||
Common::Array<TeMarker> _markers;
|
||||
Common::Array<AnchorZone *> _anchorZones;
|
||||
Common::Array<AnimObject *> _animObjects;
|
||||
Common::Array<Object3D *> _object3Ds;
|
||||
Common::Array<Billboard *> _billboards;
|
||||
Common::Array<TeSpriteLayout *> _sprites;
|
||||
Common::Array<TePickMesh2 *> _clickMeshes;
|
||||
Common::Array<RippleMask *> _rippleMasks;
|
||||
|
||||
Common::HashMap<Common::String, SoundStep> _soundSteps;
|
||||
Common::HashMap<Common::String, Common::Array<Callback*>> _callbacks;
|
||||
|
||||
Common::Array<TeIntrusivePtr<TeModel>> _hitObjects;
|
||||
Common::Array<Object> _objects;
|
||||
Common::Array<TeIntrusivePtr<TeBezierCurve>> _bezierCurves;
|
||||
Common::Array<Dummy> _dummies;
|
||||
Common::Array<Flamme> _flammes;
|
||||
Common::Array<SceneLight> _sceneLights;
|
||||
Common::Array<TeIntrusivePtr<TeModel>> _zoneModels;
|
||||
Common::Array<TeIntrusivePtr<TeModel>> _masks;
|
||||
Common::Array<TeIntrusivePtr<TeParticle>> _particles;
|
||||
Common::Array<TeIntrusivePtr<TeModel>> _shadowReceivingObjects;
|
||||
|
||||
TeIntrusivePtr<TeModel> _playerCharacterModel;
|
||||
TeIntrusivePtr<TeBezierCurve> _curve;
|
||||
Common::Array<Common::String> _blockingObjects;
|
||||
TeLuaGUI _bgGui;
|
||||
TeLuaGUI _markerGui;
|
||||
TeLuaGUI _hitObjectGui;
|
||||
|
||||
Common::Array<Common::SharedPtr<TeLight>> _lights;
|
||||
|
||||
TeVector2f32 _scrollOffset;
|
||||
TeVector2f32 _scrollScale;
|
||||
TeVector2f32 _viewportSize;
|
||||
|
||||
Common::Path _loadedPath;
|
||||
|
||||
// Syberia 2 specific items
|
||||
static bool _collisionSlide;
|
||||
Common::String _sceneName;
|
||||
Common::String _zoneName;
|
||||
bool _maskAlpha;
|
||||
YoukiManager _youkiManager;
|
||||
TeTimer _verticalScrollTimer;
|
||||
float _verticalScrollTime;
|
||||
bool _verticalScrollPlaying;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_IN_GAME_SCENE_H
|
||||
209
engines/tetraedge/game/in_game_scene_xml_parser.cpp
Normal file
209
engines/tetraedge/game/in_game_scene_xml_parser.cpp
Normal file
@@ -0,0 +1,209 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/in_game_scene_xml_parser.h"
|
||||
#include "tetraedge/game/in_game_scene.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_camera(ParserNode *node) {
|
||||
_scene->loadCamera(node->values["name"]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_pathZone(ParserNode *node) {
|
||||
_fmzGridSize = TeVector2f32();
|
||||
// Handled in closedKeyCallback
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_gridSize(ParserNode *node) {
|
||||
_textNodeType = TextNodeGridSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_curve(ParserNode *node) {
|
||||
_scene->loadCurve(node->values["name"]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_dummy(ParserNode *node) {
|
||||
_scene->_dummies.push_back(InGameScene::Dummy());
|
||||
_scene->_dummies.back()._name = node->values["name"];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_position(ParserNode *node) {
|
||||
_textNodeType = TextNodePosition;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_mask(ParserNode *node) {
|
||||
_scene->loadMask(node->values["name"], node->values["texture"],
|
||||
_scene->getZoneName(), _scene->getSceneName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_dynamicLight(ParserNode *node) {
|
||||
_scene->loadDynamicLightBloc(node->values["name"], node->values["texture"],
|
||||
_scene->getZoneName(), _scene->getSceneName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_rippleMask(ParserNode *node) {
|
||||
_scene->loadRippleMask(node->values["name"], node->values["texture"],
|
||||
_scene->getZoneName(), _scene->getSceneName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_snowCone(ParserNode *node) {
|
||||
// doesn't call the function in the game..
|
||||
/*_scene->loadSnowCone(node->values["name"], node->values["texture"],
|
||||
_scene->getZoneName(), _scene->getSceneName());*/
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_shadowMask(ParserNode *node) {
|
||||
_scene->loadShadowMask(node->values["name"], node->values["texture"],
|
||||
_scene->getZoneName(), _scene->getSceneName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_shadowReceivingObject(ParserNode *node) {
|
||||
_scene->loadShadowReceivingObject(node->values["name"], _scene->getZoneName(), _scene->getSceneName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_zBufferObject(ParserNode *node) {
|
||||
_scene->loadZBufferObject(node->values["name"], _scene->getZoneName(), _scene->getSceneName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_rObject(ParserNode *node) {
|
||||
_scene->loadRObject(node->values["name"], _scene->getZoneName(), _scene->getSceneName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_rBB(ParserNode *node) {
|
||||
_scene->loadRBB(node->values["name"], _scene->getZoneName(), _scene->getSceneName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_light(ParserNode *node) {
|
||||
_scene->loadLight(node->values["name"], _scene->getZoneName(), _scene->getSceneName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_collisionSlide(ParserNode *node) {
|
||||
TeFreeMoveZone::setCollisionSlide(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// WORKAROUND: This is a typo in scenes/A2_Falaise/24020/Scene24020.xml
|
||||
// for collisionSlide. Fix it to do what it was intended to do.
|
||||
//
|
||||
bool InGameSceneXmlParser::parserCallback_coliisionSlide(ParserNode *node) {
|
||||
TeFreeMoveZone::setCollisionSlide(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_noCollisionSlide(ParserNode *node) {
|
||||
TeFreeMoveZone::setCollisionSlide(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_flamme(ParserNode *node) {
|
||||
_scene->_flammes.push_back(InGameScene::Flamme());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_name(ParserNode *node) {
|
||||
_scene->_flammes.back()._name = node->values["value"];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_center(ParserNode *node) {
|
||||
_scene->_flammes.back()._center = parsePoint(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_yMax(ParserNode *node) {
|
||||
_scene->_flammes.back()._yMax = parsePoint(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_offsetMin(ParserNode *node) {
|
||||
_scene->_flammes.back()._offsetMin = parsePoint(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::parserCallback_offsetMax(ParserNode *node) {
|
||||
_scene->_flammes.back()._offsetMax = parsePoint(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::closedKeyCallback(ParserNode *node) {
|
||||
_textNodeType = TextNodeNone;
|
||||
if (node->name == "pathZone") {
|
||||
_scene->loadFreeMoveZone(node->values["name"], _fmzGridSize);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InGameSceneXmlParser::textCallback(const Common::String &val) {
|
||||
switch (_textNodeType) {
|
||||
case TextNodePosition: {
|
||||
TeVector3f32 pos;
|
||||
if (!pos.parse(val)) {
|
||||
//
|
||||
// WORKAROUND: Syberia 2 A5_ValMaison/55016/Scene55016.xml
|
||||
// contains invalid dummy position data.
|
||||
//
|
||||
if (val == "-10,-17,-31,7") {
|
||||
pos = TeVector3f32(-10, -17, -31);
|
||||
} else {
|
||||
parserError("Can't parse dummy position");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
_scene->_dummies.back()._position = pos;
|
||||
break;
|
||||
}
|
||||
case TextNodeGridSize: {
|
||||
TeVector2f32 sz;
|
||||
if (!sz.parse(val)) {
|
||||
parserError("Can't parse gridSize");
|
||||
return false;
|
||||
}
|
||||
_fmzGridSize = sz;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
parserError("Unexpected text block");
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
178
engines/tetraedge/game/in_game_scene_xml_parser.h
Normal file
178
engines/tetraedge/game/in_game_scene_xml_parser.h
Normal file
@@ -0,0 +1,178 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_IN_GAME_SCENE_XML_PARSER_H
|
||||
#define TETRAEDGE_GAME_IN_GAME_SCENE_XML_PARSER_H
|
||||
|
||||
#include "tetraedge/te/te_xml_parser.h"
|
||||
#include "tetraedge/game/in_game_scene.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
/**
|
||||
* XML Parser for in game scene files in Syberia 2.
|
||||
* Sybeira 1 uses a binary format, see InGameScene::load.
|
||||
*/
|
||||
class InGameSceneXmlParser : public TeXmlParser {
|
||||
public:
|
||||
InGameSceneXmlParser(InGameScene *scene)
|
||||
: _scene(scene), _textNodeType(TextNodeNone) {}
|
||||
|
||||
// NOTE: This doesn't handle snowCustom tag which was
|
||||
// added in original but commented out in every place.
|
||||
CUSTOM_XML_PARSER(InGameSceneXmlParser) {
|
||||
XML_KEY(scene)
|
||||
XML_KEY(camera)
|
||||
XML_PROP(name, true)
|
||||
KEY_END()
|
||||
XML_KEY(pathZone)
|
||||
XML_PROP(name, true)
|
||||
XML_KEY(gridSize)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
XML_KEY(curve)
|
||||
XML_PROP(name, true)
|
||||
KEY_END()
|
||||
XML_KEY(dummy)
|
||||
XML_PROP(name, true)
|
||||
XML_KEY(position)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
XML_KEY(mask)
|
||||
XML_PROP(name, true)
|
||||
XML_PROP(texture, true)
|
||||
KEY_END()
|
||||
XML_KEY(dynamicLight)
|
||||
XML_PROP(name, true)
|
||||
XML_PROP(texture, true)
|
||||
KEY_END()
|
||||
XML_KEY(rippleMask)
|
||||
XML_PROP(name, true)
|
||||
XML_PROP(texture, true)
|
||||
KEY_END()
|
||||
XML_KEY(snowCone)
|
||||
XML_PROP(name, true)
|
||||
KEY_END()
|
||||
XML_KEY(shadowMask)
|
||||
XML_PROP(name, true)
|
||||
XML_PROP(texture, true)
|
||||
KEY_END()
|
||||
XML_KEY(shadowReceivingObject)
|
||||
XML_PROP(name, true)
|
||||
KEY_END()
|
||||
XML_KEY(zBufferObject)
|
||||
XML_PROP(name, true)
|
||||
KEY_END()
|
||||
XML_KEY(rObject)
|
||||
XML_PROP(name, true)
|
||||
KEY_END()
|
||||
XML_KEY(rBB)
|
||||
XML_PROP(name, true)
|
||||
KEY_END()
|
||||
XML_KEY(light)
|
||||
XML_PROP(name, true)
|
||||
KEY_END()
|
||||
XML_KEY(flamme)
|
||||
XML_KEY(name)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(center)
|
||||
XML_PROP(x, true)
|
||||
XML_PROP(y, true)
|
||||
XML_PROP(z, true)
|
||||
KEY_END()
|
||||
XML_KEY(yMax)
|
||||
XML_PROP(x, true)
|
||||
XML_PROP(y, true)
|
||||
XML_PROP(z, true)
|
||||
KEY_END()
|
||||
XML_KEY(offsetMin)
|
||||
XML_PROP(x, true)
|
||||
XML_PROP(y, true)
|
||||
XML_PROP(z, true)
|
||||
KEY_END()
|
||||
XML_KEY(offsetMax)
|
||||
XML_PROP(x, true)
|
||||
XML_PROP(y, true)
|
||||
XML_PROP(z, true)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
XML_KEY(collisionSlide)
|
||||
KEY_END()
|
||||
XML_KEY(coliisionSlide)
|
||||
KEY_END()
|
||||
XML_KEY(noCollisionSlide)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
} PARSER_END()
|
||||
|
||||
bool parserCallback_scene(ParserNode *node) { return true; }
|
||||
bool parserCallback_camera(ParserNode *node);
|
||||
bool parserCallback_pathZone(ParserNode *node);
|
||||
bool parserCallback_gridSize(ParserNode *node);
|
||||
bool parserCallback_curve(ParserNode *node);
|
||||
bool parserCallback_dummy(ParserNode *node);
|
||||
bool parserCallback_position(ParserNode *node);
|
||||
bool parserCallback_mask(ParserNode *node);
|
||||
bool parserCallback_dynamicLight(ParserNode *node);
|
||||
bool parserCallback_rippleMask(ParserNode *node);
|
||||
bool parserCallback_snowCone(ParserNode *node);
|
||||
bool parserCallback_shadowMask(ParserNode *node);
|
||||
bool parserCallback_shadowReceivingObject(ParserNode *node);
|
||||
bool parserCallback_zBufferObject(ParserNode *node);
|
||||
bool parserCallback_rObject(ParserNode *node);
|
||||
bool parserCallback_rBB(ParserNode *node);
|
||||
bool parserCallback_light(ParserNode *node);
|
||||
bool parserCallback_collisionSlide(ParserNode *node);
|
||||
bool parserCallback_coliisionSlide(ParserNode *node);
|
||||
bool parserCallback_noCollisionSlide(ParserNode *node);
|
||||
|
||||
// Flamme and its children.
|
||||
bool parserCallback_flamme(ParserNode *node);
|
||||
bool parserCallback_name(ParserNode *node);
|
||||
bool parserCallback_center(ParserNode *node);
|
||||
bool parserCallback_yMax(ParserNode *node);
|
||||
bool parserCallback_offsetMin(ParserNode *node);
|
||||
bool parserCallback_offsetMax(ParserNode *node);
|
||||
|
||||
virtual bool closedKeyCallback(ParserNode *node) override;
|
||||
virtual bool textCallback(const Common::String &val) override;
|
||||
|
||||
public:
|
||||
InGameScene *_scene;
|
||||
|
||||
// Free Move Zones have to be handled separately just to handle a single
|
||||
// corner case where the grid size is overridden.
|
||||
TeVector2f32 _fmzGridSize;
|
||||
|
||||
enum TextNodeType {
|
||||
TextNodeNone,
|
||||
TextNodePosition,
|
||||
TextNodeGridSize
|
||||
};
|
||||
|
||||
TextNodeType _textNodeType;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_IN_GAME_SCENE_XML_PARSER_H
|
||||
657
engines/tetraedge/game/inventory.cpp
Normal file
657
engines/tetraedge/game/inventory.cpp
Normal file
@@ -0,0 +1,657 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/textconsole.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/cellphone.h"
|
||||
#include "tetraedge/game/character.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/inventory.h"
|
||||
#include "tetraedge/game/inventory_object.h"
|
||||
#include "tetraedge/game/inventory_objects_xml_parser.h"
|
||||
|
||||
#include "tetraedge/te/te_core.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
Inventory::Inventory() : _cellphone(nullptr), _selectedObject(nullptr), _currentPage(0) {
|
||||
}
|
||||
|
||||
Inventory::~Inventory() {
|
||||
if (_cellphone) {
|
||||
_cellphone->unload();
|
||||
delete _cellphone;
|
||||
}
|
||||
}
|
||||
|
||||
void Inventory::enter() {
|
||||
setVisible(true);
|
||||
|
||||
if (g_engine->gameIsAmerzone()) {
|
||||
currentPage(_currentPage);
|
||||
} else {
|
||||
Game *game = g_engine->getGame();
|
||||
Character *character = game->scene()._character;
|
||||
character->stop();
|
||||
character->setAnimation(character->characterSettings()._idleAnimFileName, true);
|
||||
|
||||
_gui.layoutChecked("textObject")->setVisible(false);
|
||||
|
||||
if (!game->_firstInventory && !g_engine->gameIsAmerzone()) {
|
||||
_gui.buttonLayoutChecked("Aide")->setVisible(false);
|
||||
} else {
|
||||
game->_firstInventory = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_selectedObject)
|
||||
selectedObject(_selectedObject);
|
||||
}
|
||||
|
||||
void Inventory::leave() {
|
||||
setVisible(false);
|
||||
if (_selectedObject) {
|
||||
Game *game = g_engine->getGame();
|
||||
if (game->entered())
|
||||
game->luaScript().execute("OnSelectedObject", _selectedObject->name());
|
||||
}
|
||||
}
|
||||
|
||||
void Inventory::load() {
|
||||
setName("_inventory");
|
||||
setSizeType(RELATIVE_TO_PARENT);
|
||||
setSize(TeVector3f32(1.0f, 1.0f, userSize().z()));
|
||||
_gui.load("Inventory/Inventory.lua");
|
||||
TeLayout *invlayout = _gui.layoutChecked("inventory");
|
||||
addChild(invlayout);
|
||||
|
||||
if (g_engine->gameIsAmerzone()) {
|
||||
TeLayout *bglayout = _gui.layoutChecked("background");
|
||||
bglayout->setRatioMode(RATIO_MODE_NONE);
|
||||
|
||||
TeButtonLayout *btn;
|
||||
btn = _gui.buttonLayoutChecked("previousPage");
|
||||
btn->onMouseClickValidated().add(this, &Inventory::onPreviousPage);
|
||||
|
||||
btn = _gui.buttonLayoutChecked("nextPage");
|
||||
btn->onMouseClickValidated().add(this, &Inventory::onNextPage);
|
||||
} else {
|
||||
TeButtonLayout *btn;
|
||||
btn = _gui.buttonLayoutChecked("cellphone");
|
||||
btn->onMouseClickValidated().add(this, &Inventory::onVisibleCellphone);
|
||||
|
||||
btn = _gui.buttonLayoutChecked("prendre");
|
||||
btn->setVisible(false);
|
||||
btn->onMouseClickValidated().add(this, &Inventory::onTakeObjectSelected);
|
||||
|
||||
btn = _gui.buttonLayoutChecked("lire");
|
||||
btn->setEnable(false);
|
||||
btn->onMouseClickValidated().add(this, &Inventory::onZoomed);
|
||||
|
||||
btn = _gui.buttonLayoutChecked("quitButton");
|
||||
btn->setVisible(true);
|
||||
btn->onMouseClickValidated().add(this, &Inventory::onQuitButton);
|
||||
|
||||
btn = _gui.buttonLayoutChecked("quitBackground");
|
||||
btn->setVisible(true);
|
||||
btn->onMouseClickValidated().add(this, &Inventory::onQuitButton);
|
||||
|
||||
btn = _gui.buttonLayoutChecked("mainMenuButton");
|
||||
btn->setVisible(true);
|
||||
btn->onMouseClickValidated().add(this, &Inventory::onMainMenuButton);
|
||||
|
||||
loadCellphone();
|
||||
}
|
||||
_currentPage = 0;
|
||||
_selectedObject = nullptr;
|
||||
|
||||
const Common::Path objectsPathPrefix("Inventory/Objects/Objects_");
|
||||
const Common::String &lang = g_engine->getCore()->language();
|
||||
Common::Path langXmlPath = objectsPathPrefix.append(lang).appendInPlace(".xml");
|
||||
if (!Common::File::exists(langXmlPath)) {
|
||||
langXmlPath = objectsPathPrefix.append(".xml");
|
||||
if (!Common::File::exists(langXmlPath)) {
|
||||
langXmlPath = objectsPathPrefix.append("en.xml");
|
||||
if (!Common::File::exists(langXmlPath)) {
|
||||
error("Inventory::load Couldn't find inventory objects xml.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadXMLFile(langXmlPath);
|
||||
|
||||
TeLayout *layout = _gui.layoutChecked("selectionSprite");
|
||||
layout->setVisible(false);
|
||||
_invObjects.clear();
|
||||
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
void Inventory::loadXMLFile(const Common::Path &path) {
|
||||
Common::File xmlfile;
|
||||
xmlfile.open(path);
|
||||
int64 fileLen = xmlfile.size();
|
||||
char *buf = new char[fileLen + 1];
|
||||
buf[fileLen] = '\0';
|
||||
xmlfile.read(buf, fileLen);
|
||||
const Common::String xmlContents = Common::String::format("<?xml version=\"1.0\" encoding=\"UTF-8\"?><document>%s</document>", buf);
|
||||
delete [] buf;
|
||||
xmlfile.close();
|
||||
|
||||
InventoryObjectsXmlParser parser;
|
||||
if (!parser.loadBuffer((const byte *)xmlContents.c_str(), xmlContents.size()))
|
||||
error("Couldn't load inventory xml.");
|
||||
if (!parser.parse())
|
||||
error("Couldn't parse inventory xml.");
|
||||
_objectData = parser._objects;
|
||||
}
|
||||
|
||||
void Inventory::unload() {
|
||||
int pageNo = 0;
|
||||
while (true) {
|
||||
const Common::String pageStr = Common::String::format("page%d", pageNo);
|
||||
if (_gui.layout(pageStr)) {
|
||||
int slotNo = 0;
|
||||
while (true) {
|
||||
const Common::String slotStr = Common::String::format("page%dSlot%d", pageNo, slotNo);
|
||||
TeLayout *slotLayout = _gui.layout(slotStr);
|
||||
if (!slotLayout)
|
||||
break;
|
||||
|
||||
// Take a copy of the list as we may be deleting some
|
||||
// and that removes them from the parent.
|
||||
Common::Array<Te3DObject2 *> children = slotLayout->childList();
|
||||
for (Te3DObject2 *child : children) {
|
||||
InventoryObject *invObj = dynamic_cast<InventoryObject *>(child);
|
||||
if (invObj)
|
||||
delete invObj;
|
||||
}
|
||||
slotNo++;
|
||||
}
|
||||
pageNo++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
_gui.unload();
|
||||
}
|
||||
|
||||
void Inventory::loadCellphone() {
|
||||
_cellphone = new Cellphone();
|
||||
_cellphone->load();
|
||||
}
|
||||
|
||||
//void loadFromBackup(TiXmlNode *node);
|
||||
//void saveToBackup(TiXmlNode *node);
|
||||
|
||||
void Inventory::addObject(const Common::String &objId) {
|
||||
InventoryObject *newobj = new InventoryObject();
|
||||
newobj->load(objId);
|
||||
if (!addObject(newobj))
|
||||
delete newobj;
|
||||
}
|
||||
|
||||
bool Inventory::addObject(InventoryObject *obj) {
|
||||
_invObjects.push_front(obj);
|
||||
obj->selectedSignal().add(this, &Inventory::onObjectSelected);
|
||||
if (_invObjects.size() > 1) {
|
||||
int pageNo = 0;
|
||||
while (true) {
|
||||
TeLayout *page = _gui.layout(Common::String::format("page%d", pageNo));
|
||||
int slotNo = 0;
|
||||
if (!page)
|
||||
break;
|
||||
while (true) {
|
||||
TeLayout *slot = _gui.layout(Common::String::format("page%dSlot%d", pageNo, slotNo));
|
||||
if (!slot)
|
||||
break;
|
||||
for (int c = 0; c < slot->childCount(); c++) {
|
||||
Te3DObject2 *child = slot->child(c);
|
||||
InventoryObject *iobj = dynamic_cast<InventoryObject *>(child);
|
||||
if (iobj) {
|
||||
slot->removeChild(child);
|
||||
c--;
|
||||
}
|
||||
}
|
||||
slotNo++;
|
||||
}
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
|
||||
int pageno = 0;
|
||||
uint totalSlots = 0;
|
||||
bool retval = false;
|
||||
const Common::String newObjName = obj->name();
|
||||
auto invObjIter = _invObjects.begin();
|
||||
bool finished = false;
|
||||
while (!finished) {
|
||||
TeLayout *page = _gui.layout(Common::String::format("page%d", pageno));
|
||||
retval = false;
|
||||
if (!page)
|
||||
break;
|
||||
int slotno = 0;
|
||||
while (true) {
|
||||
TeLayout *slot = _gui.layout(Common::String::format("page%dSlot%d", pageno, slotno));
|
||||
if (!slot)
|
||||
break;
|
||||
retval = true;
|
||||
|
||||
if (totalSlots == _invObjects.size()) {
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
TeTextLayout *newText = new TeTextLayout();
|
||||
newText->setSizeType(CoordinatesType::RELATIVE_TO_PARENT);
|
||||
newText->setPosition(TeVector3f32(1.0, 1.0, 0.0));
|
||||
newText->setSize(TeVector3f32(1.0, 1.0, 0.0));
|
||||
newText->setTextSizeType(1);
|
||||
newText->setTextSizeProportionalToWidth(200);
|
||||
newText->setText(_gui.value("textAttributs").toString() + objectName((*invObjIter)->name()));
|
||||
newText->setName((*invObjIter)->name());
|
||||
newText->setVisible(false);
|
||||
|
||||
TeLayout *layout = _gui.layout("textObject");
|
||||
layout->addChild(newText);
|
||||
}
|
||||
|
||||
slot->addChild(*invObjIter);
|
||||
|
||||
totalSlots++;
|
||||
slotno++;
|
||||
invObjIter++;
|
||||
}
|
||||
pageno++;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool Inventory::isDocument(const Common::String &objId) {
|
||||
if (!_objectData.contains(objId))
|
||||
return false;
|
||||
return _objectData.getVal(objId)._isDocument;
|
||||
}
|
||||
|
||||
int Inventory::objectCount(const Common::String &objId) {
|
||||
for (const InventoryObject *obj : _invObjects) {
|
||||
if (obj->name() == objId)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Common::String Inventory::objectDescription(const Common::String &objId) {
|
||||
// Note: The game XML files don't actually include descriptions.
|
||||
return "";
|
||||
}
|
||||
|
||||
Common::String Inventory::objectName(const Common::String &objId) {
|
||||
if (!_objectData.contains(objId))
|
||||
return "";
|
||||
return _objectData.getVal(objId)._name;
|
||||
}
|
||||
|
||||
void Inventory::currentPage(uint page) {
|
||||
TeLayout *pageLayout = _gui.layout(Common::String::format("page%d", page));
|
||||
if (pageLayout) {
|
||||
_currentPage = page;
|
||||
uint p = 0;
|
||||
while (true) {
|
||||
pageLayout = _gui.layout(Common::String::format("page%d", p));
|
||||
if (!pageLayout)
|
||||
break;
|
||||
pageLayout->setVisible(p == _currentPage);
|
||||
TeButtonLayout *diodeLayout = _gui.buttonLayoutChecked(Common::String::format("diode%d", p));
|
||||
diodeLayout->setEnable(p != _currentPage);
|
||||
p++;
|
||||
}
|
||||
if (_selectedObject)
|
||||
selectedObject(_selectedObject);
|
||||
}
|
||||
}
|
||||
|
||||
bool Inventory::onPreviousPage() {
|
||||
currentPage(_currentPage - 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Inventory::onNextPage() {
|
||||
currentPage(_currentPage + 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Inventory::onMainMenuButton() {
|
||||
leave();
|
||||
Game *game = g_engine->getGame();
|
||||
game->leave(false);
|
||||
Application *app = g_engine->getApplication();
|
||||
app->mainMenu().enter();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Inventory::onObjectSelected(InventoryObject &obj) {
|
||||
selectedObject(&obj);
|
||||
if (_selectedTimer.running()) {
|
||||
uint64 timeout = g_engine->gameIsAmerzone() ? 250000 : 300000;
|
||||
if (_selectedTimer.timeElapsed() < timeout)
|
||||
g_engine->getGame()->inventoryMenu().leave();
|
||||
} else {
|
||||
_selectedTimer.start();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Inventory::onQuitButton() {
|
||||
Game *game = g_engine->getGame();
|
||||
game->inventoryMenu().leave();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Inventory::onTakeObjectSelected() {
|
||||
Game *game = g_engine->getGame();
|
||||
game->inventoryMenu().leave();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Inventory::onVisibleCellphone() {
|
||||
_cellphone->enter();
|
||||
Game *game = g_engine->getGame();
|
||||
game->inventoryMenu().leave();
|
||||
leave();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Inventory::onZoomed() {
|
||||
const Common::String &selected = selectedObject();
|
||||
if (!selected.empty()) {
|
||||
Game *game = g_engine->getGame();
|
||||
game->documentsBrowser().showDocument(selected, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Inventory::pauseAnims() {
|
||||
Game *game = g_engine->getGame();
|
||||
if (game->scene()._character) {
|
||||
|
||||
}
|
||||
error("TODO: implement Inventory::pauseAnims");
|
||||
}
|
||||
|
||||
void Inventory::unPauseAnims() {
|
||||
Game *game = g_engine->getGame();
|
||||
if (game->scene()._character) {
|
||||
|
||||
}
|
||||
error("TODO: implement Inventory::unPauseAnims");
|
||||
}
|
||||
|
||||
void Inventory::removeObject(const Common::String &name) {
|
||||
if (!name.size()) {
|
||||
warning("Reqeust to remove an object with no name?");
|
||||
return;
|
||||
}
|
||||
|
||||
// Take a copy of the name to be sure as we will be deleting the object
|
||||
const Common::String objname = name;
|
||||
int pageNo = 0;
|
||||
while (true) {
|
||||
TeLayout *page = _gui.layout(Common::String::format("page%d", pageNo));
|
||||
if (!page)
|
||||
break;
|
||||
int slotNo = 0;
|
||||
while (true) {
|
||||
const Common::String slotStr = Common::String::format("page%dSlot%d", pageNo, slotNo);
|
||||
TeLayout *slotLayout = _gui.layout(slotStr);
|
||||
if (!slotLayout)
|
||||
break;
|
||||
|
||||
for (Te3DObject2 *child : slotLayout->childList()) {
|
||||
InventoryObject *childObj = dynamic_cast<InventoryObject *>(child);
|
||||
if (childObj && childObj->name() == objname) {
|
||||
if (_selectedObject == childObj)
|
||||
selectedObject(nullptr);
|
||||
for (auto iter = _invObjects.begin(); iter != _invObjects.end(); iter++) {
|
||||
if ((*iter)->name() == objname) {
|
||||
_invObjects.erase(iter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
slotLayout->removeChild(child);
|
||||
delete childObj;
|
||||
updateLayout();
|
||||
return;
|
||||
}
|
||||
}
|
||||
slotNo++;
|
||||
}
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
|
||||
void Inventory::removeSelectedObject() {
|
||||
if (_selectedObject) {
|
||||
removeObject(_selectedObject->name());
|
||||
selectedObject(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
InventoryObject *Inventory::selectedInventoryObject() {
|
||||
return _selectedObject;
|
||||
}
|
||||
|
||||
void Inventory::selectedObject(const Common::String &objname) {
|
||||
int pageNo = 0;
|
||||
while (true) {
|
||||
TeLayout *page = _gui.layout(Common::String::format("page%d", pageNo));
|
||||
if (!page)
|
||||
break;
|
||||
int slotNo = 0;
|
||||
while (true) {
|
||||
const Common::String slotStr = Common::String::format("page%dSlot%d", pageNo, slotNo);
|
||||
TeLayout *slotLayout = _gui.layout(slotStr);
|
||||
if (!slotLayout)
|
||||
break;
|
||||
|
||||
for (Te3DObject2 *child : slotLayout->childList()) {
|
||||
InventoryObject *invObj = dynamic_cast<InventoryObject *>(child);
|
||||
if (invObj && invObj->name() == objname) {
|
||||
selectedObject(invObj);
|
||||
// NOTE: Original then iterates _invObjects here..
|
||||
// why double iterate like that?
|
||||
return;
|
||||
}
|
||||
}
|
||||
slotNo++;
|
||||
}
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
|
||||
void Inventory::selectedObject(InventoryObject *obj) {
|
||||
Game *game = g_engine->getGame();
|
||||
game->setCurrentObjectSprite("");
|
||||
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
_gui.layoutChecked("prendre")->setVisible(false);
|
||||
_gui.layoutChecked("textObject")->setVisible(false);
|
||||
}
|
||||
_selectedObject = obj;
|
||||
if (!obj) {
|
||||
_gui.spriteLayoutChecked("selectionSprite")->setVisible(false);
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
_gui.textLayout("text")->setText("");
|
||||
game->inGameGui().spriteLayoutChecked("selectedObject")->unload();
|
||||
}
|
||||
} else {
|
||||
TeSpriteLayout *selection = _gui.spriteLayoutChecked("selectionSprite");
|
||||
selection->setVisible(obj->worldVisible());
|
||||
TeLayout *parentLayout = dynamic_cast<TeLayout *>(obj->parent());
|
||||
if (!parentLayout)
|
||||
error("Couldn't get parent of object");
|
||||
TeVector3f32 pos = parentLayout->position();
|
||||
pos.z() = selection->position().z();
|
||||
selection->setPosition(pos);
|
||||
|
||||
const Common::Path spritePath = obj->spritePath();
|
||||
game->setCurrentObjectSprite(spritePath);
|
||||
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
const Common::String &objId = obj->name();
|
||||
static const char *textStyle = "<section style=\"center\" /><color r=\"200\" g=\"200\" b=\"200\"/><font file=\"Common/Fonts/Colaborate-Regular.otf\" size=\"24\" />";
|
||||
Common::String text = Common::String::format("%s%s<br/>%s", textStyle,
|
||||
objectName(objId).c_str(),
|
||||
objectDescription(objId).c_str());
|
||||
_gui.textLayout("text")->setText(text);
|
||||
|
||||
_gui.buttonLayoutChecked("lire")->setEnable(isDocument(objId));
|
||||
TeLayout *textObj = _gui.layout("textObject");
|
||||
for (int i = 0; i < textObj->childCount(); i++) {
|
||||
if (textObj->child(i)->name() == obj->name()) {
|
||||
textObj->setVisible(true);
|
||||
textObj->child(i)->setVisible(true);
|
||||
} else {
|
||||
textObj->child(i)->setVisible(false);
|
||||
}
|
||||
}
|
||||
game->inGameGui().spriteLayoutChecked("selectedObject")->load(spritePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Common::String &Inventory::selectedObject() {
|
||||
if (_selectedObject == nullptr)
|
||||
return _blankStr;
|
||||
else
|
||||
return _selectedObject->name();
|
||||
}
|
||||
|
||||
bool Inventory::updateLayout() {
|
||||
int pageNo = 0;
|
||||
while (true) {
|
||||
TeLayout *page = _gui.layout(Common::String::format("page%d", pageNo));
|
||||
if (!page)
|
||||
break;
|
||||
int slotNo = 0;
|
||||
while (true) {
|
||||
const Common::String slotStr = Common::String::format("page%dSlot%d", pageNo, slotNo);
|
||||
TeLayout *slotLayout = _gui.layout(slotStr);
|
||||
if (!slotLayout)
|
||||
break;
|
||||
|
||||
// Take a copy of the list as we are deleting some
|
||||
// and that removes them from the parent's list.
|
||||
Common::Array<Te3DObject2 *> children = slotLayout->childList();
|
||||
for (Te3DObject2 *child : children) {
|
||||
InventoryObject *invObj = dynamic_cast<InventoryObject *>(child);
|
||||
if (invObj)
|
||||
slotLayout->removeChild(child);
|
||||
}
|
||||
slotNo++;
|
||||
}
|
||||
pageNo++;
|
||||
}
|
||||
|
||||
// If list is empty, we're done.
|
||||
if (_invObjects.size() == 0)
|
||||
return true;
|
||||
|
||||
pageNo = 0;
|
||||
Common::List<InventoryObject *>::iterator invObjIter = _invObjects.begin();
|
||||
while (true) {
|
||||
TeLayout *page = _gui.layout(Common::String::format("page%d", pageNo));
|
||||
if (!page)
|
||||
break;
|
||||
int slotNo = 0;
|
||||
while (true) {
|
||||
const Common::String slotStr = Common::String::format("page%dSlot%d", pageNo, slotNo);
|
||||
TeLayout *slotLayout = _gui.layout(slotStr);
|
||||
if (!slotLayout)
|
||||
break;
|
||||
slotLayout->addChild(*invObjIter);
|
||||
invObjIter++;
|
||||
slotNo++;
|
||||
if (invObjIter == _invObjects.end())
|
||||
return true;
|
||||
}
|
||||
pageNo++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//#define TETRAEDGE_DEBUG_SAVELOAD
|
||||
|
||||
Common::Error Inventory::syncState(Common::Serializer &s) {
|
||||
uint nitems = _invObjects.size();
|
||||
s.syncAsUint32LE(nitems);
|
||||
return syncStateWithCount(s, nitems);
|
||||
}
|
||||
|
||||
Common::Error Inventory::syncStateWithCount(Common::Serializer &s, uint nitems) {
|
||||
if (nitems > 1000)
|
||||
error("Unexpected number of elems syncing inventory");
|
||||
|
||||
if (s.isLoading()) {
|
||||
_invObjects.clear();
|
||||
_selectedObject = nullptr;
|
||||
// Clear the layout if needed
|
||||
if (_gui.loaded())
|
||||
updateLayout();
|
||||
#ifdef TETRAEDGE_DEBUG_SAVELOAD
|
||||
debug("Inventory::syncState: --- Loading %d inventory items: ---", nitems);
|
||||
#endif
|
||||
for (uint i = 0; i < nitems; i++) {
|
||||
Common::String objname;
|
||||
s.syncString(objname);
|
||||
addObject(objname);
|
||||
#ifdef TETRAEDGE_DEBUG_SAVELOAD
|
||||
debug("Inventory::syncState: %s", objname.c_str());
|
||||
#endif
|
||||
}
|
||||
} else if (nitems) {
|
||||
#ifdef TETRAEDGE_DEBUG_SAVELOAD
|
||||
debug("Inventory::syncState: --- Saving %d inventory items: --- ", _invObjects.size());
|
||||
#endif
|
||||
// Add items in reverse order as the "addObject" on load will
|
||||
// add to front of list.InventoryObject
|
||||
auto iter = _invObjects.end();
|
||||
while (iter != _invObjects.begin()) {
|
||||
iter--;
|
||||
Common::String objname = (*iter)->name();
|
||||
s.syncString(objname);
|
||||
#ifdef TETRAEDGE_DEBUG_SAVELOAD
|
||||
debug("Inventory::syncState: %s", objname.c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TETRAEDGE_DEBUG_SAVELOAD
|
||||
debug("Inventory::syncState: -------- end --------");
|
||||
#endif
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
112
engines/tetraedge/game/inventory.h
Normal file
112
engines/tetraedge/game/inventory.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_INVENTORY_H
|
||||
#define TETRAEDGE_GAME_INVENTORY_H
|
||||
|
||||
#include "common/str.h"
|
||||
#include "tetraedge/game/inventory_object.h"
|
||||
#include "tetraedge/te/te_layout.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Cellphone;
|
||||
|
||||
class Inventory : public TeLayout {
|
||||
public:
|
||||
struct InventoryObjectData {
|
||||
Common::String _id;
|
||||
Common::String _name;
|
||||
bool _isDocument;
|
||||
};
|
||||
|
||||
Inventory();
|
||||
virtual ~Inventory();
|
||||
|
||||
void enter();
|
||||
void leave();
|
||||
void load();
|
||||
void unload();
|
||||
void loadCellphone();
|
||||
|
||||
//void loadFromBackup(TiXmlNode *node);
|
||||
//void saveToBackup(TiXmlNode *node);
|
||||
|
||||
void addObject(const Common::String &objname);
|
||||
bool addObject(InventoryObject *obj);
|
||||
bool isDocument(const Common::String &objname);
|
||||
|
||||
int objectCount(const Common::String &objname);
|
||||
Common::String objectDescription(const Common::String &objname);
|
||||
Common::String objectName(const Common::String &objname);
|
||||
|
||||
void pauseAnims();
|
||||
void unPauseAnims();
|
||||
|
||||
void removeObject(const Common::String &objname);
|
||||
void removeSelectedObject();
|
||||
|
||||
InventoryObject *selectedInventoryObject();
|
||||
void selectedObject(const Common::String &objname);
|
||||
void selectedObject(InventoryObject *obj);
|
||||
const Common::String &selectedObject();
|
||||
|
||||
bool updateLayout();
|
||||
|
||||
Common::Error syncState(Common::Serializer &s);
|
||||
Common::Error syncStateWithCount(Common::Serializer &s, uint nitems);
|
||||
|
||||
Cellphone *cellphone() { return _cellphone; }
|
||||
|
||||
private:
|
||||
// Amerzone navigation events
|
||||
void currentPage(uint page);
|
||||
bool onPreviousPage();
|
||||
bool onNextPage();
|
||||
|
||||
// Syberia navigation events
|
||||
bool onMainMenuButton();
|
||||
bool onObjectSelected(InventoryObject &obj);
|
||||
bool onQuitButton();
|
||||
bool onTakeObjectSelected();
|
||||
bool onVisibleCellphone();
|
||||
bool onZoomed();
|
||||
|
||||
void loadXMLFile(const Common::Path &path);
|
||||
|
||||
TeLuaGUI _gui;
|
||||
Common::List<InventoryObject *> _invObjects;
|
||||
Cellphone *_cellphone;
|
||||
InventoryObject *_selectedObject;
|
||||
Common::HashMap<Common::String, InventoryObjectData> _objectData;
|
||||
|
||||
// This is used when we need a reference to a blank str in selectedObject()
|
||||
const Common::String _blankStr;
|
||||
|
||||
uint _currentPage;
|
||||
|
||||
TeTimer _selectedTimer;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_INVENTORY_H
|
||||
142
engines/tetraedge/game/inventory_menu.cpp
Normal file
142
engines/tetraedge/game/inventory_menu.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/inventory_menu.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
InventoryMenu::InventoryMenu() {
|
||||
}
|
||||
|
||||
void InventoryMenu::enter() {
|
||||
Application *app = g_engine->getApplication();
|
||||
if (g_engine->gameIsAmerzone())
|
||||
g_engine->getGame()->setRunning(false);
|
||||
app->mouseCursorLayout().load(app->defaultCursor());
|
||||
|
||||
_gui.buttonLayoutChecked("quitButton")->setEnable(true);
|
||||
_gui.layoutChecked("inventoryMenu")->setVisible(true);
|
||||
onInventoryButton();
|
||||
}
|
||||
|
||||
void InventoryMenu::leave() {
|
||||
Game *game = g_engine->getGame();
|
||||
game->inventory().leave();
|
||||
game->documentsBrowser().leave();
|
||||
TeLayout *invMenu = _gui.layout("inventoryMenu");
|
||||
if (invMenu)
|
||||
invMenu->setVisible(false);
|
||||
if (g_engine->gameIsAmerzone())
|
||||
game->setRunning(true);
|
||||
}
|
||||
|
||||
void InventoryMenu::load() {
|
||||
setName("_inventoryMenu");
|
||||
setSizeType(RELATIVE_TO_PARENT);
|
||||
TeVector3f32 usersz = userSize();
|
||||
setSize(TeVector3f32(1.0f, 1.0f, usersz.z()));
|
||||
|
||||
_gui.load("InventoryMenu/InventoryMenu.lua");
|
||||
|
||||
Game *game = g_engine->getGame();
|
||||
if (g_engine->gameIsAmerzone()) {
|
||||
_gui.layoutChecked("inventoryMenu")->setRatioMode(RATIO_MODE_NONE);
|
||||
game->inventory().load();
|
||||
game->documentsBrowser().load();
|
||||
addChild(&game->inventory());
|
||||
addChild(&game->documentsBrowser());
|
||||
}
|
||||
|
||||
addChild(_gui.layoutChecked("inventoryMenu"));
|
||||
|
||||
_gui.buttonLayoutChecked("quitButton")->onMouseClickValidated()
|
||||
.add(this, &InventoryMenu::onQuitButton);
|
||||
// Quit background is only in Syberia 1 and 2 (not amerzone)
|
||||
TeButtonLayout *quitBackground = _gui.buttonLayout("quitBackground");
|
||||
if (quitBackground)
|
||||
quitBackground->onMouseClickValidated().add(this, &InventoryMenu::onQuitButton);
|
||||
_gui.buttonLayoutChecked("mainMenuButton")->onMouseClickValidated()
|
||||
.add(this, &InventoryMenu::onMainMenuButton);
|
||||
_gui.buttonLayoutChecked("documentsButton")->onMouseClickValidated()
|
||||
.add(this, &InventoryMenu::onDocumentsButton);
|
||||
_gui.buttonLayoutChecked("inventoryButton")->onMouseClickValidated()
|
||||
.add(this, &InventoryMenu::onInventoryButton);
|
||||
|
||||
_gui.layoutChecked("inventoryMenu")->setVisible(false);
|
||||
|
||||
if (g_engine->gameIsAmerzone()) {
|
||||
game->documentsBrowser().loadZoomed();
|
||||
}
|
||||
}
|
||||
|
||||
void InventoryMenu::unload() {
|
||||
leave();
|
||||
_gui.unload();
|
||||
}
|
||||
|
||||
bool InventoryMenu::isVisible() {
|
||||
TeLayout *menuLayout = _gui.layout("inventoryMenu");
|
||||
return menuLayout->visible();
|
||||
}
|
||||
|
||||
bool InventoryMenu::onDocumentsButton() {
|
||||
_gui.buttonLayoutChecked("mainMenuButton")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("documentsButton")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("inventoryButton")->setEnable(true);
|
||||
Game *game = g_engine->getGame();
|
||||
game->inventory().leave();
|
||||
game->documentsBrowser().enter();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InventoryMenu::onInventoryButton() {
|
||||
_gui.buttonLayoutChecked("mainMenuButton")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("documentsButton")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("inventoryButton")->setEnable(false);
|
||||
Game *game = g_engine->getGame();
|
||||
game->inventory().enter();
|
||||
game->documentsBrowser().leave();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InventoryMenu::onMainMenuButton() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
Game *game = g_engine->getGame();
|
||||
game->_returnToMainMenu = true;
|
||||
app->fade();
|
||||
// Don't process any more events.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InventoryMenu::onQuitButton() {
|
||||
leave();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InventoryMenu::onSaveButton(){
|
||||
return false;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
54
engines/tetraedge/game/inventory_menu.h
Normal file
54
engines/tetraedge/game/inventory_menu.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_INVENTORY_MENU_H
|
||||
#define TETRAEDGE_GAME_INVENTORY_MENU_H
|
||||
|
||||
#include "tetraedge/te/te_layout.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class InventoryMenu : public TeLayout {
|
||||
public:
|
||||
InventoryMenu();
|
||||
virtual ~InventoryMenu() {}
|
||||
|
||||
void enter();
|
||||
void leave();
|
||||
void load();
|
||||
void unload();
|
||||
|
||||
bool isVisible();
|
||||
|
||||
bool onDocumentsButton();
|
||||
bool onInventoryButton();
|
||||
bool onMainMenuButton();
|
||||
bool onQuitButton();
|
||||
bool onSaveButton();
|
||||
|
||||
private:
|
||||
TeLuaGUI _gui;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_INVENTORY_MENU_H
|
||||
51
engines/tetraedge/game/inventory_object.cpp
Normal file
51
engines/tetraedge/game/inventory_object.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/inventory_object.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
InventoryObject::InventoryObject() {
|
||||
}
|
||||
|
||||
void InventoryObject::load(const Common::String &newName) {
|
||||
setSizeType(RELATIVE_TO_PARENT);
|
||||
setSize(TeVector3f32(1.0f, 1.0f, 1.0f));
|
||||
_gui.load("Inventory/InventoryObject.lua");
|
||||
addChild(_gui.layoutChecked("object"));
|
||||
setName(newName);
|
||||
_gui.spriteLayoutChecked("upLayout")->load(spritePath());
|
||||
TeButtonLayout *btn = _gui.buttonLayoutChecked("object");
|
||||
btn->onMouseClickValidated().add(this, &InventoryObject::onButtonDown);
|
||||
// TODO: btn->setDoubleValidationProtectionEnabled(false)
|
||||
}
|
||||
|
||||
Common::Path InventoryObject::spritePath() {
|
||||
return Common::Path("Inventory/Objects").join(name()).append(".png");
|
||||
}
|
||||
|
||||
bool InventoryObject::onButtonDown() {
|
||||
_selectedSignal.call(*this);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
47
engines/tetraedge/game/inventory_object.h
Normal file
47
engines/tetraedge/game/inventory_object.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_INVENTORY_OBJECT_H
|
||||
#define TETRAEDGE_GAME_INVENTORY_OBJECT_H
|
||||
|
||||
#include "common/str.h"
|
||||
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class InventoryObject : public TeLayout {
|
||||
public:
|
||||
InventoryObject();
|
||||
|
||||
void load(const Common::String &name);
|
||||
Common::Path spritePath();
|
||||
bool onButtonDown();
|
||||
TeSignal1Param<InventoryObject&> &selectedSignal() { return _selectedSignal; };
|
||||
|
||||
private:
|
||||
TeLuaGUI _gui;
|
||||
TeSignal1Param<InventoryObject&> _selectedSignal;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_INVENTORY_OBJECT_H
|
||||
44
engines/tetraedge/game/inventory_objects_xml_parser.cpp
Normal file
44
engines/tetraedge/game/inventory_objects_xml_parser.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/inventory_objects_xml_parser.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
bool InventoryObjectsXmlParser::parserCallback_Object(ParserNode *node) {
|
||||
Inventory::InventoryObjectData data;
|
||||
data._id = node->values["id"];
|
||||
data._name = node->values["name"];
|
||||
data._isDocument = node->values.contains("isDocument");
|
||||
_objects.setVal(data._id, data);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InventoryObjectsXmlParser::handleUnknownKey(ParserNode *node) {
|
||||
if (node->name == "value") {
|
||||
warning("Garbage entry <value> in inventory file");
|
||||
return true;
|
||||
}
|
||||
parserError("Unknown key");
|
||||
return false;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
57
engines/tetraedge/game/inventory_objects_xml_parser.h
Normal file
57
engines/tetraedge/game/inventory_objects_xml_parser.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/hashmap.h"
|
||||
#include "common/str.h"
|
||||
#include "common/formats/xmlparser.h"
|
||||
#include "tetraedge/game/inventory.h"
|
||||
|
||||
#ifndef TETRAEDGE_GAME_INVENTORY_OBJECTS_XML_PARSER_H
|
||||
#define TETRAEDGE_GAME_INVENTORY_OBJECTS_XML_PARSER_H
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class InventoryObjectsXmlParser : public Common::XMLParser {
|
||||
public:
|
||||
// Parser
|
||||
CUSTOM_XML_PARSER(InventoryObjectsXmlParser) {
|
||||
XML_KEY(document)
|
||||
XML_KEY(Object)
|
||||
XML_PROP(id, true)
|
||||
XML_PROP(name, true)
|
||||
XML_PROP(isDocument, false)
|
||||
XML_PROP(description, false)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
} PARSER_END()
|
||||
|
||||
bool parserCallback_document(ParserNode *node) { return true; };
|
||||
bool parserCallback_Object(ParserNode *node);
|
||||
bool handleUnknownKey(ParserNode *node) override;
|
||||
|
||||
public:
|
||||
Common::HashMap<Common::String, Inventory::InventoryObjectData> _objects;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_INVENTORY_OBJECTS_XML_PARSER_H
|
||||
62
engines/tetraedge/game/loc_file.cpp
Normal file
62
engines/tetraedge/game/loc_file.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "common/formats/xmlparser.h"
|
||||
|
||||
#include "tetraedge/game/loc_file.h"
|
||||
#include "tetraedge/te/te_name_val_xml_parser.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
LocFile::LocFile() {
|
||||
}
|
||||
|
||||
void LocFile::load(const TetraedgeFSNode &fsnode) {
|
||||
TeNameValXmlParser parser;
|
||||
const Common::String xmlHeader("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
Common::ScopedPtr<Common::SeekableReadStream> locFile(fsnode.createReadStream());
|
||||
const Common::String path = fsnode.getName();
|
||||
if (!locFile)
|
||||
error("LocFile::load: failed to open %s.", path.c_str());
|
||||
|
||||
int64 fileLen = locFile->size();
|
||||
char *buf = new char[fileLen + 1];
|
||||
buf[fileLen] = '\0';
|
||||
locFile->read(buf, fileLen);
|
||||
const Common::String xmlContents = xmlHeader + buf;
|
||||
delete [] buf;
|
||||
locFile.reset();
|
||||
if (!parser.loadBuffer((const byte *)xmlContents.c_str(), xmlContents.size()))
|
||||
error("LocFile::load: failed to load %s.", path.c_str());
|
||||
|
||||
if (!parser.parse())
|
||||
error("LocFile::load: failed to parse %s.", path.c_str());
|
||||
|
||||
_map = parser.getMap();
|
||||
}
|
||||
|
||||
const Common::String *LocFile::value(const Common::String &key) const {
|
||||
return text(key);
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
44
engines/tetraedge/game/loc_file.h
Normal file
44
engines/tetraedge/game/loc_file.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_LOC_FILE_H
|
||||
#define TETRAEDGE_GAME_LOC_FILE_H
|
||||
|
||||
#include "common/str.h"
|
||||
#include "common/fs.h"
|
||||
|
||||
#include "tetraedge/te/te_i_loc.h"
|
||||
#include "tetraedge/tetraedge.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class LocFile : public TeILoc {
|
||||
public:
|
||||
LocFile();
|
||||
|
||||
void load(const TetraedgeFSNode &fsnode);
|
||||
const Common::String *value(const Common::String &key) const;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_LOC_FILE_H
|
||||
3097
engines/tetraedge/game/lua_binds.cpp
Normal file
3097
engines/tetraedge/game/lua_binds.cpp
Normal file
File diff suppressed because it is too large
Load Diff
37
engines/tetraedge/game/lua_binds.h
Normal file
37
engines/tetraedge/game/lua_binds.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_LUA_BINDS_H
|
||||
#define TETRAEDGE_GAME_LUA_BINDS_H
|
||||
|
||||
struct lua_State;
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
namespace LuaBinds {
|
||||
|
||||
void LuaOpenBinds(lua_State *L);
|
||||
|
||||
} // end namespace LuaBinds
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_LUA_BINDS_H
|
||||
368
engines/tetraedge/game/main_menu.cpp
Normal file
368
engines/tetraedge/game/main_menu.cpp
Normal file
@@ -0,0 +1,368 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/system.h"
|
||||
#include "common/events.h"
|
||||
#include "common/savefile.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/confirm.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/main_menu.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
|
||||
#include "tetraedge/te/te_button_layout.h"
|
||||
#include "tetraedge/te/te_sprite_layout.h"
|
||||
#include "tetraedge/te/te_text_layout.h"
|
||||
#include "tetraedge/te/te_music.h"
|
||||
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
static const char *LAST_SAVE_CONF = "last_save_slot";
|
||||
|
||||
MainMenu::MainMenu() : _entered(false), _confirmingTuto(false) {
|
||||
_newGameConfirm.onButtonYesSignal().add(this, &MainMenu::onNewGameConfirmed);
|
||||
_tutoConfirm.onButtonYesSignal().add(this, &MainMenu::onActivedTuto);
|
||||
_tutoConfirm.onButtonNoSignal().add(this, &MainMenu::onDisabledTuto);
|
||||
_quitConfirm.onButtonYesSignal().add(this, &MainMenu::onQuit);
|
||||
onFacebookLoggedSignal.add(this, &MainMenu::onFacebookLogged);
|
||||
}
|
||||
|
||||
void MainMenu::enter() {
|
||||
Application *app = g_engine->getApplication();
|
||||
|
||||
if (g_engine->gameType() == TetraedgeEngine::kSyberia2) {
|
||||
app->backLayout().setRatioMode(TeILayout::RATIO_MODE_LETTERBOX);
|
||||
app->backLayout().setRatio(1.333333f);
|
||||
app->frontLayout().setRatioMode(TeILayout::RATIO_MODE_LETTERBOX);
|
||||
app->frontLayout().setRatio(1.333333f);
|
||||
}
|
||||
|
||||
TeSpriteLayout &appSpriteLayout = app->appSpriteLayout();
|
||||
appSpriteLayout.setVisible(true);
|
||||
if (!appSpriteLayout._tiledSurfacePtr->_frameAnim._runTimer.running() && g_engine->gameType() == TetraedgeEngine::kSyberia) {
|
||||
appSpriteLayout.load("menus/menu.ogv");
|
||||
appSpriteLayout._tiledSurfacePtr->_frameAnim.setLoopCount(-1);
|
||||
appSpriteLayout._tiledSurfacePtr->play();
|
||||
}
|
||||
app->captureFade();
|
||||
|
||||
_entered = true;
|
||||
const char *luaFile = g_engine->gameIsAmerzone() ? "GUI/MainMenu.lua" : "menus/mainMenu/mainMenu.lua";
|
||||
load(luaFile);
|
||||
|
||||
TeLayout *menuLayout = layoutChecked("menu");
|
||||
appSpriteLayout.addChild(menuLayout);
|
||||
|
||||
//
|
||||
// WORKAROUND: This is set to PanScan ratio 1.0, but with our code
|
||||
// but that shrinks it down to pillarboxed. Force back to full size.
|
||||
//
|
||||
|
||||
TeLayout *background;
|
||||
if (layout("background"))
|
||||
background = layoutChecked("background");
|
||||
else
|
||||
background = dynamic_cast<TeLayout *>(menuLayout->child(0));
|
||||
assert(background);
|
||||
background->setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
|
||||
app->mouseCursorLayout().setVisible(true);
|
||||
app->mouseCursorLayout().load(app->defaultCursor());
|
||||
|
||||
TeMusic &music = app->music();
|
||||
if (music.isPlaying()) {
|
||||
// TODO: something here??
|
||||
}
|
||||
music.load(Common::Path(value("musicPath").toString()));
|
||||
music.play();
|
||||
music.volume(1.0f);
|
||||
|
||||
TeButtonLayout *newGameButton = buttonLayout("newGameButton");
|
||||
if (newGameButton)
|
||||
newGameButton->onMouseClickValidated().add(this, &MainMenu::onNewGameButtonValidated);
|
||||
|
||||
TeButtonLayout *continueGameButton = buttonLayout("continueGameButton");
|
||||
if (continueGameButton) {
|
||||
continueGameButton->onMouseClickValidated().add(this, &MainMenu::onContinueGameButtonValidated);
|
||||
continueGameButton->setEnable(ConfMan.hasKey(LAST_SAVE_CONF));
|
||||
}
|
||||
|
||||
TeButtonLayout *loadGameButton = buttonLayout("loadGameButton");
|
||||
if (loadGameButton)
|
||||
loadGameButton->onMouseClickValidated().add(this, &MainMenu::onLoadGameButtonValidated);
|
||||
|
||||
TeButtonLayout *optionsButton = buttonLayout("optionsButton");
|
||||
if (optionsButton)
|
||||
optionsButton->onMouseClickValidated().add(this, &MainMenu::onOptionsButtonValidated);
|
||||
|
||||
TeButtonLayout *galleryButton = buttonLayout("galleryButton");
|
||||
if (galleryButton)
|
||||
galleryButton->onMouseClickValidated().add(this, &MainMenu::onGalleryButtonValidated);
|
||||
|
||||
TeButtonLayout *quitButton = buttonLayout("quitButton");
|
||||
if (quitButton)
|
||||
quitButton->onMouseClickValidated().add(this, &MainMenu::onQuitButtonValidated);
|
||||
|
||||
// TODO: confirmation (menus/confirm/confirmNotSound.lua)
|
||||
// if TeSoundManager is not valid.
|
||||
|
||||
// Hide the Facebook button since we don't support it anyway..
|
||||
TeButtonLayout *fbButton = buttonLayout("facebookButton");
|
||||
if (fbButton)
|
||||
fbButton->setVisible(false);
|
||||
|
||||
_confirmingTuto = false;
|
||||
TeLayout *panel = layout("panel");
|
||||
|
||||
if (panel) {
|
||||
const Common::String panelTypoVal = value("panelTypo").toString();
|
||||
for (auto *child : panel->childList()) {
|
||||
TeTextLayout *childText = dynamic_cast<TeTextLayout *>(child);
|
||||
if (!childText)
|
||||
continue;
|
||||
childText->setName(panelTypoVal + childText->name());
|
||||
}
|
||||
}
|
||||
setCenterButtonsVisibility(true);
|
||||
TeITextLayout *versionNum = textLayout("versionNumber");
|
||||
if (versionNum) {
|
||||
const Common::String versionSectionStr("<section style=\"left\" /><color r=\"255\" g=\"255\" b=\"255\"/><font file=\"Common/Fonts/arial.ttf\" size=\"12\" />");
|
||||
versionNum->setText(versionSectionStr + app->getVersionString());
|
||||
}
|
||||
|
||||
// Skip the menu if we are loading.
|
||||
Game *game = g_engine->getGame();
|
||||
if (game->hasLoadName() || ConfMan.getBool("skip_mainmenu")) {
|
||||
onNewGameConfirmed();
|
||||
}
|
||||
}
|
||||
|
||||
void MainMenu::leave() {
|
||||
if (!_entered)
|
||||
return;
|
||||
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
Game *game = g_engine->getGame();
|
||||
game->stopSound("sounds/Ambiances/b_automatebike.ogg");
|
||||
game->stopSound("sounds/Ambiances/b_engrenagebg.ogg");
|
||||
TeLuaGUI::unload();
|
||||
app->fade();
|
||||
_entered= false;
|
||||
}
|
||||
|
||||
bool MainMenu::deleteFile(const Common::String &fname) {
|
||||
error("TODO: Implement MainMenu::deleteFile");
|
||||
}
|
||||
|
||||
bool MainMenu::onActivedTuto() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->setTutoActivated(true);
|
||||
g_engine->getGame()->_firstInventory = true;
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->startGame(true, 1);
|
||||
app->fade();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenu::onBFGRateIt2ButtonValidated() {
|
||||
error("TODO: Implement MainMenu::onBFGRateIt2ButtonValidated");
|
||||
}
|
||||
|
||||
bool MainMenu::onBFGRateItButtonValidated() {
|
||||
error("TODO: Implement MainMenu::onBFGRateItButtonValidated");
|
||||
}
|
||||
|
||||
bool MainMenu::onBFGRateItQuitButtonValidated() {
|
||||
error("TODO: Implement MainMenu::onBFGRateItQuitButtonValidated");
|
||||
}
|
||||
|
||||
bool MainMenu::onBFGUnlockGameButtonValidated() {
|
||||
error("TODO: Implement MainMenu::onBFGUnlockGameButtonValidated");
|
||||
}
|
||||
|
||||
void MainMenu::tryDisableButton(const Common::String &btnName) {
|
||||
TeButtonLayout *button = buttonLayout(btnName);
|
||||
if (button)
|
||||
button->setEnable(false);
|
||||
}
|
||||
|
||||
bool MainMenu::onContinueGameButtonValidated() {
|
||||
Application *app = g_engine->getApplication();
|
||||
int lastSave = ConfMan.hasKey(LAST_SAVE_CONF) ? ConfMan.getInt(LAST_SAVE_CONF) : -1;
|
||||
if (lastSave >= 0)
|
||||
g_engine->loadGameState(lastSave);
|
||||
|
||||
tryDisableButton("newGameButton");
|
||||
tryDisableButton("continueGameButton");
|
||||
tryDisableButton("loadGameButton");
|
||||
tryDisableButton("optionsButton");
|
||||
tryDisableButton("galleryButton");
|
||||
tryDisableButton("quitButton");
|
||||
|
||||
if (_confirmingTuto)
|
||||
return false;
|
||||
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->startGame(false, 1);
|
||||
app->fade();
|
||||
|
||||
if (g_engine->gameType() == TetraedgeEngine::kSyberia2) {
|
||||
// TODO: This should probably happen on direct game load too,
|
||||
// as it bypasses this code path which always gets called in
|
||||
// the original?
|
||||
if (app->ratioStretched()) {
|
||||
app->backLayout().setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
app->frontLayout().setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
} else {
|
||||
app->backLayout().setRatioMode(TeILayout::RATIO_MODE_LETTERBOX);
|
||||
app->backLayout().setRatio(1.333333f);
|
||||
app->frontLayout().setRatioMode(TeILayout::RATIO_MODE_LETTERBOX);
|
||||
app->frontLayout().setRatio(1.333333f);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenu::onDisabledTuto() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->setTutoActivated(false);
|
||||
g_engine->getGame()->_firstInventory = false;
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->startGame(true, 1);
|
||||
app->fade();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenu::onEnterGameRotateAnimFinished() {
|
||||
error("TODO: Implement MainMenu::onEnterGameRotateAnimFinished");
|
||||
}
|
||||
|
||||
bool MainMenu::onGalleryButtonValidated() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->globalBonusMenu().enter();
|
||||
app->fade();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenu::onHowToButtonValidated() {
|
||||
onContinueGameButtonValidated();
|
||||
_confirmingTuto = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenu::onLoadGameButtonValidated() {
|
||||
g_engine->loadGameDialog();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenu::onNewGameButtonValidated() {
|
||||
// Note: Original confirms whether to start new game here
|
||||
// with "menus/confirm/confirmNewGame.lua"
|
||||
// because only one save is allowed. We just clear last
|
||||
// save slot number and go ahead and start.
|
||||
ConfMan.setInt(LAST_SAVE_CONF, -1);
|
||||
onNewGameConfirmed();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenu::onNewGameConfirmed() {
|
||||
// Note: Original game deletes saves here. Don't do that..
|
||||
_confirmingTuto = true;
|
||||
if (!g_engine->gameIsAmerzone())
|
||||
_tutoConfirm.enter("menus/confirm/confirmTuto.lua", "");
|
||||
else
|
||||
_tutoConfirm.enter("GUI/ConfirmNewGame.lua", "");
|
||||
onContinueGameButtonValidated();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenu::onOptionsButtonValidated() {
|
||||
if (ConfMan.getBool("use_scummvm_options")) {
|
||||
g_engine->openConfigDialog();
|
||||
} else {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->optionsMenu().enter();
|
||||
app->fade();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MainMenu::onQuit() {
|
||||
g_engine->quitGame();
|
||||
leave();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenu::onQuitButtonValidated() {
|
||||
_quitConfirm.enter("menus/confirm/confirmQuit.lua", "");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenu::onUnlockGameButtonValidated() {
|
||||
error("TODO: Implement MainMenu::onUnlockGameButtonValidated");
|
||||
}
|
||||
|
||||
void MainMenu::refresh() {
|
||||
bool haveSave = ConfMan.hasKey(LAST_SAVE_CONF);
|
||||
TeButtonLayout *continueGameButton = buttonLayout("continueGameButton");
|
||||
if (continueGameButton) {
|
||||
continueGameButton->setEnable(haveSave);
|
||||
}
|
||||
}
|
||||
|
||||
void MainMenu::setCenterButtonsVisibility(bool visible) {
|
||||
bool haveSave = ConfMan.hasKey(LAST_SAVE_CONF);
|
||||
|
||||
TeButtonLayout *continuegameunlockButton = buttonLayout("continuegameunlockButton");
|
||||
if (continuegameunlockButton) {
|
||||
continuegameunlockButton->setVisible(haveSave & visible);
|
||||
}
|
||||
|
||||
TeButtonLayout *newGameUnlockButton = buttonLayout("newgameunlockButton");
|
||||
if (newGameUnlockButton) {
|
||||
newGameUnlockButton->setVisible(visible & !haveSave);
|
||||
}
|
||||
|
||||
TeButtonLayout *unlockgameButton = buttonLayout("unlockgameButton");
|
||||
if (unlockgameButton) {
|
||||
unlockgameButton->setVisible(false);
|
||||
}
|
||||
|
||||
TeLayout *rateItButton = layout("rateItButton");
|
||||
if (rateItButton) {
|
||||
rateItButton->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
85
engines/tetraedge/game/main_menu.h
Normal file
85
engines/tetraedge/game/main_menu.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_MAIN_MENU_H
|
||||
#define TETRAEDGE_GAME_MAIN_MENU_H
|
||||
|
||||
#include "common/str.h"
|
||||
#include "tetraedge/game/confirm.h"
|
||||
#include "tetraedge/te/te_signal.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class MainMenu : public TeLuaGUI {
|
||||
public:
|
||||
MainMenu();
|
||||
|
||||
void enter() override;
|
||||
void leave() override;
|
||||
|
||||
bool deleteFile(const Common::String &name);
|
||||
bool onActivedTuto();
|
||||
bool onBFGFreeGamesButtonValidated() { return false; }
|
||||
bool onBFGRateIt2ButtonValidated();
|
||||
bool onBFGRateItButtonValidated();
|
||||
bool onBFGRateItQuitButtonValidated();
|
||||
bool onBFGSplashButtonUpdated() { return false; }
|
||||
bool onBFGSplashButtonValidated() { return false; }
|
||||
bool onBFGTellAFriendButtonValidated() { return false; }
|
||||
bool onBFGUnlockGameButtonValidated();
|
||||
bool onContinueGameButtonValidated();
|
||||
bool onDisabledTuto();
|
||||
bool onEnterGameRotateAnimFinished();
|
||||
bool onFacebookButtonValidated() { return false; }
|
||||
bool onFacebookLogged() { return false; }
|
||||
bool onGalleryButtonValidated();
|
||||
bool onHowToButtonValidated();
|
||||
bool onLoadGameButtonValidated();
|
||||
bool onNewGameButtonValidated();
|
||||
bool onNewGameConfirmed();
|
||||
bool onOptionsButtonValidated();
|
||||
bool onQuit();
|
||||
bool onQuitButtonValidated();
|
||||
bool onUnlockGameButtonValidated();
|
||||
bool onWalkThroughButtonValidated() { return false; };
|
||||
|
||||
void refresh();
|
||||
void setCenterButtonsVisibility(bool visible);
|
||||
bool isEntered() const { return _entered; }
|
||||
|
||||
private:
|
||||
|
||||
void tryDisableButton(const Common::String &btnName);
|
||||
|
||||
Confirm _newGameConfirm;
|
||||
Confirm _tutoConfirm;
|
||||
Confirm _quitConfirm;
|
||||
|
||||
TeSignal0Param onFacebookLoggedSignal;
|
||||
|
||||
bool _entered;
|
||||
bool _confirmingTuto;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_MAIN_MENU_H
|
||||
154
engines/tetraedge/game/notifier.cpp
Normal file
154
engines/tetraedge/game/notifier.cpp
Normal file
@@ -0,0 +1,154 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/notifier.h"
|
||||
#include "tetraedge/te/te_layout.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
Notifier::Notifier() {
|
||||
}
|
||||
|
||||
static const char *notifyLayoutName() {
|
||||
return g_engine->gameIsAmerzone() ? "notify" : "notifier";
|
||||
}
|
||||
|
||||
void Notifier::launchNextnotifier() {
|
||||
TeCurveAnim2<Te3DObject2, TeColor> *colorAnim = _gui.colorLinearAnimation("fadeIn");
|
||||
assert(colorAnim);
|
||||
if (colorAnim->_runTimer.running())
|
||||
return;
|
||||
|
||||
colorAnim = _gui.colorLinearAnimation("fadeOut");
|
||||
if (!colorAnim->_runTimer.running()) {
|
||||
colorAnim = _gui.colorLinearAnimation("visible");
|
||||
bool abort = true;
|
||||
if (!colorAnim->_runTimer.running()) {
|
||||
abort = _notifierDataArray.empty();
|
||||
}
|
||||
if (abort)
|
||||
return;
|
||||
}
|
||||
|
||||
unload();
|
||||
load();
|
||||
|
||||
if (_notifierDataArray.empty())
|
||||
return;
|
||||
|
||||
Common::String textformat = _gui.value("textFormat").toString();
|
||||
Common::String formattedName;
|
||||
if (!textformat.empty())
|
||||
formattedName = Common::String::format(textformat.c_str(), _notifierDataArray[0]._name.c_str());
|
||||
else
|
||||
formattedName = _notifierDataArray[0]._name;
|
||||
|
||||
TeITextLayout *text = _gui.textLayout("text");
|
||||
text->setText(formattedName);
|
||||
|
||||
if (!_notifierDataArray[0]._imgpath.empty()) {
|
||||
assert(!g_engine->gameIsAmerzone());
|
||||
_gui.spriteLayoutChecked("image")->load(_notifierDataArray[0]._imgpath);
|
||||
}
|
||||
|
||||
_gui.layoutChecked(notifyLayoutName())->setVisible(true);
|
||||
|
||||
colorAnim = _gui.colorLinearAnimation("fadeIn");
|
||||
colorAnim->_callbackObj = _gui.layoutChecked("sprite");
|
||||
colorAnim->play();
|
||||
|
||||
colorAnim = g_engine->gameIsAmerzone() ? nullptr : _gui.colorLinearAnimation("fadeInImage");
|
||||
if (colorAnim) {
|
||||
colorAnim->_callbackObj = _gui.layoutChecked("image");
|
||||
colorAnim->play();
|
||||
}
|
||||
|
||||
_notifierDataArray.remove_at(0);
|
||||
}
|
||||
|
||||
void Notifier::load() {
|
||||
const char *luaPath = g_engine->gameIsAmerzone() ? "GUI/Notify.lua" : "menus/Notifier.lua";
|
||||
_gui.load(luaPath);
|
||||
TeLayout *notifierLayout = _gui.layoutChecked(notifyLayoutName());
|
||||
g_engine->getGame()->addNoScale2Child(notifierLayout);
|
||||
notifierLayout->setVisible(false);
|
||||
|
||||
TeCurveAnim2<Te3DObject2, TeColor> *fadeIn = _gui.colorLinearAnimation("fadeIn");
|
||||
fadeIn->onFinished().add(this, &Notifier::onFadeInFinished);
|
||||
|
||||
TeCurveAnim2<Te3DObject2, TeColor> *visible = _gui.colorLinearAnimation("visible");
|
||||
visible->onFinished().add(this, &Notifier::onVisibleFinished);
|
||||
|
||||
TeCurveAnim2<Te3DObject2, TeColor> *fadeOut = _gui.colorLinearAnimation("fadeOut");
|
||||
fadeOut->onFinished().add(this, &Notifier::onFadeOutFinished);
|
||||
}
|
||||
|
||||
bool Notifier::onFadeInFinished() {
|
||||
TeCurveAnim2<Te3DObject2, TeColor> *colorAnim = _gui.colorLinearAnimation("visible");
|
||||
colorAnim->_callbackObj = _gui.layout("sprite");
|
||||
colorAnim->play();
|
||||
|
||||
colorAnim = g_engine->gameIsAmerzone() ? nullptr : _gui.colorLinearAnimation("visibleImage");
|
||||
if (colorAnim) {
|
||||
colorAnim->_callbackObj = _gui.layout("image");
|
||||
colorAnim->play();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Notifier::onFadeOutFinished() {
|
||||
TeLayout *notifierLayout = _gui.layoutChecked(notifyLayoutName());
|
||||
notifierLayout->setVisible(false);
|
||||
launchNextnotifier();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Notifier::onVisibleFinished() {
|
||||
TeCurveAnim2<Te3DObject2, TeColor> *colorAnim = _gui.colorLinearAnimation("fadeOut");
|
||||
colorAnim->_callbackObj = _gui.layout("sprite");
|
||||
colorAnim->play();
|
||||
|
||||
colorAnim = g_engine->gameIsAmerzone() ? nullptr : _gui.colorLinearAnimation("fadeOutImage");
|
||||
if (colorAnim) {
|
||||
colorAnim->_callbackObj = _gui.layout("image");
|
||||
colorAnim->play();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Notifier::push(const Common::String &name, const Common::Path &imgpath) {
|
||||
notifierData n = {name, imgpath};
|
||||
_notifierDataArray.push_back(n);
|
||||
launchNextnotifier();
|
||||
}
|
||||
|
||||
void Notifier::unload() {
|
||||
TeLayout *layout = _gui.layoutChecked(notifyLayoutName());
|
||||
g_engine->getGame()->removeNoScale2Child(layout);
|
||||
_gui.unload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
56
engines/tetraedge/game/notifier.h
Normal file
56
engines/tetraedge/game/notifier.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_NOTIFIER_H
|
||||
#define TETRAEDGE_GAME_NOTIFIER_H
|
||||
|
||||
#include "common/str.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Notifier {
|
||||
public:
|
||||
Notifier();
|
||||
|
||||
void launchNextnotifier();
|
||||
void load();
|
||||
bool onFadeInFinished();
|
||||
bool onFadeOutFinished();
|
||||
bool onVisibleFinished();
|
||||
|
||||
void push(const Common::String &name, const Common::Path &imgpath);
|
||||
void unload();
|
||||
|
||||
TeLuaGUI &gui() { return _gui; }
|
||||
|
||||
private:
|
||||
struct notifierData {
|
||||
Common::String _name;
|
||||
Common::Path _imgpath;
|
||||
};
|
||||
Common::Array<notifierData> _notifierDataArray;
|
||||
TeLuaGUI _gui;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_NOTIFIER_H
|
||||
122
engines/tetraedge/game/object3d.cpp
Normal file
122
engines/tetraedge/game/object3d.cpp
Normal file
@@ -0,0 +1,122 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/textconsole.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/object3d.h"
|
||||
#include "tetraedge/game/object_settings_xml_parser.h"
|
||||
|
||||
#include "tetraedge/te/te_lua_script.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
/*static*/
|
||||
Common::HashMap<Common::String, Object3D::ObjectSettings> *Object3D::_objectSettings = nullptr;
|
||||
|
||||
/*static*/
|
||||
void Object3D::cleanup() {
|
||||
if (_objectSettings)
|
||||
delete _objectSettings;
|
||||
_objectSettings = nullptr;
|
||||
}
|
||||
|
||||
|
||||
// start and end frames not initialized in original, but to guarantee we don't use
|
||||
// uninitialized values we set it here.
|
||||
Object3D::Object3D() : _translateTime(-1), _rotateTime(-1), _objScale(1.0f, 1.0f, 1.0f),
|
||||
_startFrame(-1), _endFrame(9999) {
|
||||
}
|
||||
|
||||
bool Object3D::loadModel(const Common::String &name) {
|
||||
_modelPtr = new TeModel();
|
||||
Common::HashMap<Common::String, ObjectSettings>::iterator settings = _objectSettings->find(name);
|
||||
if (settings != _objectSettings->end()) {
|
||||
_modelFileName = settings->_value._modelFileName;
|
||||
_defaultScale = settings->_value._defaultScale;
|
||||
_modelPtr->setTexturePath("objects/Textures");
|
||||
bool loaded = _modelPtr->load(Common::Path("objects").join(_modelFileName));
|
||||
if (loaded) {
|
||||
_modelPtr->setName(name);
|
||||
_modelPtr->setScale(_defaultScale);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Object3D::setObjectMoveDest(const TeVector3f32 &vec) {
|
||||
_moveAnim._startVal = TeVector3f32();
|
||||
_moveAnim._endVal = vec;
|
||||
}
|
||||
|
||||
void Object3D::setObjectMoveTime(float time) {
|
||||
_moveAnim._duration = time * 1000;
|
||||
_moveAnim._callbackObj = this;
|
||||
_moveAnim._callbackMethod = &Object3D::setCurMovePos;
|
||||
Common::Array<float> curve;
|
||||
curve.push_back(0.0f);
|
||||
curve.push_back(1.0f);
|
||||
_moveAnim.setCurve(curve);
|
||||
_moveAnim.onFinished().remove(this, &Object3D::onMoveAnimFinished);
|
||||
_moveAnim.onFinished().add(this, &Object3D::onMoveAnimFinished);
|
||||
_moveAnim.play();
|
||||
}
|
||||
|
||||
bool Object3D::onMoveAnimFinished() {
|
||||
g_engine->getGame()->luaScript().execute("OnObjectMoveFinished", _modelPtr->name());
|
||||
_moveAnim.onFinished().remove(this, &Object3D::onMoveAnimFinished);
|
||||
return false;
|
||||
}
|
||||
|
||||
void Object3D::setCurMovePos(const TeVector3f32 &vec) {
|
||||
_curMovePos = vec;
|
||||
}
|
||||
|
||||
/*static*/
|
||||
bool Object3D::loadSettings(const Common::Path &path) {
|
||||
if (_objectSettings)
|
||||
delete _objectSettings;
|
||||
_objectSettings = new Common::HashMap<Common::String, ObjectSettings>();
|
||||
|
||||
ObjectSettingsXmlParser parser(_objectSettings);
|
||||
parser.setAllowText();
|
||||
|
||||
if (!parser.loadFile(path))
|
||||
error("Object3D::loadSettings: Can't load %s", path.toString(Common::Path::kNativeSeparator).c_str());
|
||||
if (!parser.parse())
|
||||
error("Object3D::loadSettings: Can't parse %s", path.toString(Common::Path::kNativeSeparator).c_str());
|
||||
parser.finalize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Object3D::ObjectSettings::clear() {
|
||||
_name.clear();
|
||||
_modelFileName.clear();
|
||||
_defaultScale = TeVector3f32();
|
||||
_originOffset = TeVector3f32();
|
||||
_invertNormals = false;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
96
engines/tetraedge/game/object3d.h
Normal file
96
engines/tetraedge/game/object3d.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_OBJECT3D_H
|
||||
#define TETRAEDGE_GAME_OBJECT3D_H
|
||||
|
||||
#include "common/str.h"
|
||||
#include "common/hashmap.h"
|
||||
|
||||
#include "tetraedge/te/te_curve_anim2.h"
|
||||
#include "tetraedge/te/te_object.h"
|
||||
#include "tetraedge/te/te_model.h"
|
||||
#include "tetraedge/te/te_vector3f32.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Object3D : public TeObject {
|
||||
public:
|
||||
struct ObjectSettings {
|
||||
Common::String _name;
|
||||
Common::String _modelFileName;
|
||||
TeVector3f32 _defaultScale;
|
||||
TeVector3f32 _originOffset;
|
||||
bool _invertNormals;
|
||||
|
||||
void clear();
|
||||
};
|
||||
|
||||
Object3D();
|
||||
|
||||
bool loadModel(const Common::String &name);
|
||||
|
||||
static bool loadSettings(const Common::Path &path);
|
||||
static void cleanup();
|
||||
|
||||
TeIntrusivePtr<TeModel> model() { return _modelPtr; }
|
||||
|
||||
void setObjectMoveDest(const TeVector3f32 &vec);
|
||||
void setObjectMoveTime(float f);
|
||||
bool onMoveAnimFinished();
|
||||
void setCurMovePos(const TeVector3f32 &pos);
|
||||
|
||||
float _rotateTime;
|
||||
TeTimer _rotateTimer;
|
||||
TeQuaternion _rotateStart;
|
||||
TeVector3f32 _rotateAmount; // Rotate vector in degrees
|
||||
|
||||
float _translateTime;
|
||||
TeTimer _translateTimer;
|
||||
TeVector3f32 _translateStart;
|
||||
TeVector3f32 _translateAmount;
|
||||
|
||||
TeCurveAnim2<Object3D,TeVector3f32> _moveAnim;
|
||||
TeVector3f32 _curMovePos;
|
||||
|
||||
Common::String _onCharName;
|
||||
Common::String _onCharBone;
|
||||
|
||||
// TRS relative to the character this object is "on"
|
||||
TeVector3f32 _objTranslation;
|
||||
TeQuaternion _objRotation;
|
||||
TeVector3f32 _objScale;
|
||||
TeMatrix4x4 _lastMatrix;
|
||||
|
||||
int _startFrame;
|
||||
int _endFrame;
|
||||
|
||||
private:
|
||||
static Common::HashMap<Common::String, ObjectSettings> *_objectSettings;
|
||||
|
||||
TeIntrusivePtr<TeModel> _modelPtr;
|
||||
Common::String _modelFileName;
|
||||
TeVector3f32 _defaultScale;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_OBJECT3D_H
|
||||
91
engines/tetraedge/game/object_settings_xml_parser.cpp
Normal file
91
engines/tetraedge/game/object_settings_xml_parser.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/object_settings_xml_parser.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
bool ObjectSettingsXmlParser::parserCallback_ObjectsSettings(ParserNode *node) {
|
||||
// Nothing to do, data handled in the child keys.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ObjectSettingsXmlParser::parserCallback_Object(ParserNode *node) {
|
||||
// Save the last object.
|
||||
_objectSettings->setVal(_curObject._name, _curObject);
|
||||
const Common::String &objname = node->values["name"];
|
||||
_curObject.clear();
|
||||
_curObject._name = objname;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ObjectSettingsXmlParser::finalize() {
|
||||
_objectSettings->setVal(_curObject._name, _curObject);
|
||||
}
|
||||
|
||||
bool ObjectSettingsXmlParser::parserCallback_modelFileName(ParserNode *node) {
|
||||
_textTagType = TagModelFileName;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ObjectSettingsXmlParser::parserCallback_defaultScale(ParserNode *node) {
|
||||
_textTagType = TagDefaultScale;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ObjectSettingsXmlParser::parserCallback_originOffset(ParserNode *node) {
|
||||
_textTagType = TagOriginOffset;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ObjectSettingsXmlParser::parserCallback_invertNormals(ParserNode *node) {
|
||||
_curObject._invertNormals = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ObjectSettingsXmlParser::textCallback(const Common::String &val) {
|
||||
switch (_textTagType) {
|
||||
case TagModelFileName:
|
||||
_curObject._modelFileName = val;
|
||||
break;
|
||||
case TagDefaultScale:
|
||||
{
|
||||
bool result = _curObject._defaultScale.parse(val);
|
||||
if (!result)
|
||||
warning("Failed to parse Object defaultScale from %s", val.c_str());
|
||||
break;
|
||||
}
|
||||
case TagOriginOffset:
|
||||
{
|
||||
bool result = _curObject._originOffset.parse(val);
|
||||
if (!result)
|
||||
warning("Failed to parse Object originOffset from %s", val.c_str());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
error("should only see text for model file name or scale");
|
||||
}
|
||||
|
||||
_textTagType = TagNone;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
79
engines/tetraedge/game/object_settings_xml_parser.h
Normal file
79
engines/tetraedge/game/object_settings_xml_parser.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_OBJECT_SETTINGS_XML_PARSER_H
|
||||
#define TETRAEDGE_GAME_OBJECT_SETTINGS_XML_PARSER_H
|
||||
|
||||
#include "common/formats/xmlparser.h"
|
||||
#include "tetraedge/game/object3d.h"
|
||||
#include "tetraedge/te/te_vector3f32.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class ObjectSettingsXmlParser : public Common::XMLParser {
|
||||
public:
|
||||
ObjectSettingsXmlParser(Common::HashMap<Common::String, Object3D::ObjectSettings> *settings) :
|
||||
Common::XMLParser(), _textTagType(TagNone), _objectSettings(settings) {}
|
||||
|
||||
void finalize();
|
||||
|
||||
// Parser
|
||||
CUSTOM_XML_PARSER(ObjectSettingsXmlParser) {
|
||||
XML_KEY(ObjectsSettings)
|
||||
XML_KEY(Object)
|
||||
XML_PROP(name, true)
|
||||
XML_KEY(modelFileName)
|
||||
KEY_END()
|
||||
XML_KEY(defaultScale)
|
||||
KEY_END()
|
||||
XML_KEY(originOffset)
|
||||
KEY_END()
|
||||
XML_KEY(invertNormals)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
} PARSER_END()
|
||||
|
||||
private:
|
||||
// Parser callback methods
|
||||
bool parserCallback_ObjectsSettings(ParserNode *node);
|
||||
bool parserCallback_Object(ParserNode *node);
|
||||
bool parserCallback_modelFileName(ParserNode *node);
|
||||
bool parserCallback_defaultScale(ParserNode *node);
|
||||
bool parserCallback_originOffset(ParserNode *node);
|
||||
bool parserCallback_invertNormals(ParserNode *node);
|
||||
bool textCallback(const Common::String &val) override;
|
||||
|
||||
enum TextTagType {
|
||||
TagNone,
|
||||
TagModelFileName,
|
||||
TagDefaultScale,
|
||||
TagOriginOffset
|
||||
};
|
||||
|
||||
TextTagType _textTagType;
|
||||
Object3D::ObjectSettings _curObject;
|
||||
Common::HashMap<Common::String, Object3D::ObjectSettings> *_objectSettings;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_OBJECT_SETTINGS_XML_PARSER_H
|
||||
254
engines/tetraedge/game/objectif.cpp
Normal file
254
engines/tetraedge/game/objectif.cpp
Normal file
@@ -0,0 +1,254 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/textconsole.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/game/objectif.h"
|
||||
#include "tetraedge/te/te_vector2f32.h"
|
||||
#include "tetraedge/te/te_text_layout.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
/*static*/
|
||||
bool Objectif::_layoutsDirty = false;
|
||||
|
||||
Objectif::Objectif() : _helpButtonVisible(false) {
|
||||
}
|
||||
|
||||
void Objectif::enter() {
|
||||
_gui1.buttonLayoutChecked("helpButton")->setVisible(true);
|
||||
_helpButtonVisible = true;
|
||||
}
|
||||
|
||||
bool Objectif::isMouseIn(const TeVector2s32 &mousept) {
|
||||
TeLayout *bg = _gui1.layoutChecked("background");
|
||||
if (bg->visible()) {
|
||||
TeLayout *calepin = _gui1.layoutChecked("Calepin");
|
||||
if (calepin->isMouseIn(mousept))
|
||||
return true;
|
||||
// otherwise check the helpButton
|
||||
}
|
||||
TeButtonLayout *btn = _gui2.buttonLayoutChecked("helpButton");
|
||||
if (btn->visible())
|
||||
return btn->isMouseIn(mousept);
|
||||
return false;
|
||||
}
|
||||
|
||||
void Objectif::load() {
|
||||
Application *app = g_engine->getApplication();
|
||||
_gui1.load("menus/objectif.lua");
|
||||
_gui2.load("menus/helpButton.lua");
|
||||
|
||||
TeButtonLayout *btn = _gui2.buttonLayoutChecked("helpButton");
|
||||
app->frontLayout().addChild(btn);
|
||||
btn->setVisible(true);
|
||||
_helpButtonVisible = true;
|
||||
btn->onMouseClickValidated().add(this, &Objectif::onHelpButtonValidated);
|
||||
|
||||
btn = _gui1.buttonLayoutChecked("helpQuit");
|
||||
btn->onMouseClickValidated().add(this, &Objectif::onHelpButtonValidated);
|
||||
|
||||
_gui1.buttonLayoutChecked("background")->setVisible(false);
|
||||
|
||||
_gui2.spriteLayoutChecked("newUp")->setVisible(false);
|
||||
_gui2.spriteLayoutChecked("newDown")->setVisible(false);
|
||||
_gui2.spriteLayoutChecked("notNewUp")->setVisible(true);
|
||||
_gui2.spriteLayoutChecked("notNewDown")->setVisible(true);
|
||||
|
||||
_layoutsDirty = true;
|
||||
}
|
||||
|
||||
void Objectif::leave() {
|
||||
TeLayout *layout;
|
||||
layout = _gui1.layout("background");
|
||||
if (layout)
|
||||
layout->setVisible(false);
|
||||
layout = _gui2.layout("helpButton");
|
||||
if (layout) {
|
||||
layout->setVisible(false);
|
||||
_helpButtonVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Objectif::onHelpButtonValidated() {
|
||||
if (!_helpButtonVisible) {
|
||||
_gui1.buttonLayoutChecked("background")->setVisible(false);
|
||||
_gui2.buttonLayoutChecked("helpButton")->setVisible(true);
|
||||
_helpButtonVisible = true;
|
||||
} else {
|
||||
_gui1.buttonLayoutChecked("background")->setVisible(true);
|
||||
_gui2.spriteLayoutChecked("newUp")->setVisible(false);
|
||||
_gui2.spriteLayoutChecked("newDown")->setVisible(false);
|
||||
_gui2.spriteLayoutChecked("notNewUp")->setVisible(true);
|
||||
_gui2.spriteLayoutChecked("notNewUp")->setVisible(true);
|
||||
_gui2.spriteLayoutChecked("helpButton")->setVisible(false);
|
||||
_helpButtonVisible = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Objectif::pushObjectif(Common::String const &head, Common::String const &sub) {
|
||||
for (const Task &t : _tasks) {
|
||||
if (t._headTask == head && t._subTask == sub)
|
||||
return;
|
||||
}
|
||||
|
||||
_layoutsDirty = true;
|
||||
_tasks.resize(_tasks.size() + 1);
|
||||
_tasks.back()._headTask = head;
|
||||
_tasks.back()._subTask = sub;
|
||||
_tasks.back()._taskFlag = true;
|
||||
}
|
||||
|
||||
void Objectif::deleteObjectif(Common::String const &head, Common::String const &sub) {
|
||||
for (Task &t : _tasks) {
|
||||
if (t._taskFlag && t._headTask == head && t._subTask == sub) {
|
||||
t._taskFlag = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Objectif::reattachLayout(TeLayout *layout) {
|
||||
TeButtonLayout *btn;
|
||||
|
||||
btn = _gui1.buttonLayout("background");
|
||||
if (btn) {
|
||||
layout->removeChild(btn);
|
||||
layout->addChild(btn);
|
||||
}
|
||||
|
||||
btn = _gui2.buttonLayout("helpButton");
|
||||
if (btn) {
|
||||
layout->removeChild(btn);
|
||||
layout->addChild(btn);
|
||||
}
|
||||
}
|
||||
|
||||
void Objectif::removeChildren() {
|
||||
TeLayout *tasks = _gui1.layoutChecked("tasks");
|
||||
while (tasks->childCount()) {
|
||||
Te3DObject2 *child = tasks->child(0);
|
||||
TeTextLayout *text = dynamic_cast<TeTextLayout*>(child);
|
||||
tasks->removeChild(child);
|
||||
if (text)
|
||||
delete text;
|
||||
}
|
||||
_layoutsDirty = true;
|
||||
}
|
||||
|
||||
void Objectif::update() {
|
||||
Game *game = g_engine->getGame();
|
||||
game->luaScript().execute("UpdateHelp");
|
||||
if (_layoutsDirty) {
|
||||
TeLayout *tasks = _gui1.layoutChecked("tasks");
|
||||
removeChildren();
|
||||
|
||||
int last_i = -1;
|
||||
for (uint i = 0; i < _tasks.size(); i++) {
|
||||
if (!_tasks[i]._taskFlag)
|
||||
continue;
|
||||
if (last_i != -1 && _tasks[i]._headTask == _tasks[last_i]._headTask)
|
||||
continue;
|
||||
last_i = i;
|
||||
createChildLayout(tasks, _tasks[i]._headTask, false);
|
||||
// Creating the subtasks for this head
|
||||
for (uint j = 0; j < _tasks.size(); j++) {
|
||||
if (_tasks[j]._taskFlag && _tasks[j]._headTask == _tasks[i]._headTask && _tasks[j]._subTask != "")
|
||||
createChildLayout(tasks, _tasks[j]._subTask, true);
|
||||
}
|
||||
}
|
||||
|
||||
float z = 0.1f;
|
||||
for (Te3DObject2 *child : tasks->childList()) {
|
||||
TeTextLayout *text = dynamic_cast<TeTextLayout *>(child);
|
||||
if (!text)
|
||||
continue;
|
||||
/*TeVector3f32 size =*/
|
||||
text->size();
|
||||
TeVector3f32 userPos = text->userPosition();
|
||||
userPos.z() = z;
|
||||
text->setPosition(userPos);
|
||||
z += text->userSize().y();
|
||||
}
|
||||
}
|
||||
_layoutsDirty = false;
|
||||
}
|
||||
|
||||
void Objectif::createChildLayout(TeLayout *layout, Common::String const &taskId, bool isSubTask) {
|
||||
TeTextLayout *text = new TeTextLayout();
|
||||
text->setName(taskId);
|
||||
text->setAnchor(TeVector3f32(0.0f, 0.0f, 0.0f));
|
||||
text->setPositionType(TeILayout::RELATIVE_TO_PARENT);
|
||||
text->setSizeType(TeILayout::RELATIVE_TO_PARENT);
|
||||
Application *app = g_engine->getApplication();
|
||||
// No help at difficulty 2.
|
||||
if (app->difficulty() != 2) {
|
||||
Common::String textVal;
|
||||
if (!isSubTask) {
|
||||
text->setSize(TeVector3f32(0.8f, 1.0f, 0.1f));
|
||||
text->setPosition(TeVector3f32(0.1f, 0.0f, 0.1f));
|
||||
textVal = "<section style=\"left\" /><color r=\"39\" g=\"85\" b=\"97\"/><font file=\"Common/Fonts/ComicRelief.ttf\" size=\"12\"/>";
|
||||
} else {
|
||||
text->setSize(TeVector3f32(0.75f, 1.0f, 0.1f));
|
||||
text->setPosition(TeVector3f32(0.15f, 0.0f, 0.1f));
|
||||
if (app->difficulty() == 0) {
|
||||
textVal = "<section style=\"left\" /><color r=\"0\" g=\"0\" b=\"0\"/><font file=\"Common/Fonts/ComicRelief.ttf\" size=\"12\"/>\t";
|
||||
} else {
|
||||
textVal = "<section style=\"left\" /><color r=\"0\" g=\"0\" b=\"0\"/><font file=\"Common/Fonts/arial.ttf\" size=\"16\"/>";
|
||||
}
|
||||
}
|
||||
textVal += app->getHelpText(taskId);
|
||||
text->setText(textVal);
|
||||
}
|
||||
|
||||
layout->addChild(text);
|
||||
}
|
||||
|
||||
|
||||
void Objectif::unload() {
|
||||
removeChildren();
|
||||
leave();
|
||||
|
||||
Application *app = g_engine->getApplication();
|
||||
TeButtonLayout *btn = _gui2.buttonLayoutChecked("helpButton");
|
||||
app->frontLayout().removeChild(btn);
|
||||
btn = _gui1.buttonLayoutChecked("background");
|
||||
app->frontLayout().removeChild(btn);
|
||||
|
||||
_gui1.unload();
|
||||
_gui2.unload();
|
||||
_tasks.clear();
|
||||
}
|
||||
|
||||
void Objectif::setVisibleButtonHelp(bool visible) {
|
||||
_gui2.buttonLayoutChecked("helpButton")->setVisible(visible);
|
||||
_helpButtonVisible = visible;
|
||||
}
|
||||
|
||||
void Objectif::setVisibleObjectif(bool visible) {
|
||||
_gui1.buttonLayoutChecked("background")->setVisible(visible);
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
71
engines/tetraedge/game/objectif.h
Normal file
71
engines/tetraedge/game/objectif.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_OBJECTIF_H
|
||||
#define TETRAEDGE_GAME_OBJECTIF_H
|
||||
|
||||
#include "tetraedge/te/te_vector2f32.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class Objectif {
|
||||
public:
|
||||
struct Task {
|
||||
Common::String _headTask;
|
||||
Common::String _subTask;
|
||||
bool _taskFlag;
|
||||
};
|
||||
|
||||
Objectif();
|
||||
|
||||
void createChildLayout(TeLayout *layout, Common::String const &taskId, bool isSubTask);
|
||||
void enter();
|
||||
bool hideBouton();
|
||||
bool isMouseIn(const TeVector2s32 &mousept);
|
||||
bool isVisibleObjectif();
|
||||
void deleteObjectif(Common::String const &head, Common::String const &sub);
|
||||
void leave();
|
||||
void load();
|
||||
bool onHelpButtonValidated();
|
||||
void pushObjectif(Common::String const &head, Common::String const &sub);
|
||||
void reattachLayout(TeLayout *layout);
|
||||
void removeChildren();
|
||||
// void save()
|
||||
void setVisibleButtonHelp(bool visible);
|
||||
void setVisibleObjectif(bool visible);
|
||||
void unload();
|
||||
void update();
|
||||
|
||||
TeLuaGUI &gui1() { return _gui1; }
|
||||
|
||||
private:
|
||||
TeLuaGUI _gui1;
|
||||
TeLuaGUI _gui2;
|
||||
Common::Array<Task> _tasks;
|
||||
bool _helpButtonVisible;
|
||||
|
||||
static bool _layoutsDirty;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_OBJECTIF_H
|
||||
356
engines/tetraedge/game/options_menu.cpp
Normal file
356
engines/tetraedge/game/options_menu.cpp
Normal file
@@ -0,0 +1,356 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/options_menu.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/te/te_sound_manager.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
static const float EPSILON = 1.192093e-07f;
|
||||
|
||||
static Common::String pageStr(int i) {
|
||||
return Common::String::format("page%d", i);
|
||||
}
|
||||
|
||||
OptionsMenu::OptionsMenu() : _tutoPage(1) {
|
||||
}
|
||||
|
||||
void OptionsMenu::enter() {
|
||||
Application *app = g_engine->getApplication();
|
||||
|
||||
if (!app->appSpriteLayout()._tiledSurfacePtr->isLoaded() && g_engine->gameType() == TetraedgeEngine::kSyberia) {
|
||||
app->appSpriteLayout().load("menus/menu.ogv");
|
||||
app->appSpriteLayout().play();
|
||||
}
|
||||
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
load("menus/options/optionsMenu.lua");
|
||||
_gui2.load("menus/options/tuto.lua");
|
||||
|
||||
app->frontLayout().addChild(layoutChecked("menu2"));
|
||||
app->frontLayout().addChild(_gui2.buttonLayoutChecked("tuto"));
|
||||
_gui2.buttonLayoutChecked("tuto")->setVisible(false);
|
||||
} else {
|
||||
load("GUI/OptionsMenu.lua");
|
||||
|
||||
app->frontLayout().addChild(layoutChecked("menu2"));
|
||||
}
|
||||
|
||||
const Common::Path musicPath(value("musicPath").toString());
|
||||
if (!app->music().isPlaying() || (app->music().getAccessName() != musicPath)) {
|
||||
app->music().load(musicPath);
|
||||
app->music().play();
|
||||
app->music().volume(1.0);
|
||||
}
|
||||
|
||||
TeButtonLayout *quitButton = buttonLayout("quitButton");
|
||||
if (quitButton)
|
||||
quitButton->onMouseClickValidated().add(this, &OptionsMenu::onQuitButton);
|
||||
buttonLayoutChecked("creditsButton")->onMouseClickValidated().add(this, &OptionsMenu::onCreditsButton);
|
||||
TeButtonLayout *supportBtn = buttonLayout("supportButton");
|
||||
if (supportBtn)
|
||||
supportBtn->onMouseClickValidated().add(this, &OptionsMenu::onSupportButton);
|
||||
TeButtonLayout *termsBtn = buttonLayout("termsButton");
|
||||
if (termsBtn)
|
||||
termsBtn->onMouseClickValidated().add(this, &OptionsMenu::onTermsOfServiceButton);
|
||||
TeButtonLayout *privBtn = buttonLayout("privacyButton");
|
||||
if (privBtn)
|
||||
privBtn->onMouseClickValidated().add(this, &OptionsMenu::onPrivacyPolicyButton);
|
||||
|
||||
if (!g_engine->gameIsAmerzone()) {
|
||||
buttonLayoutChecked("sfxVolumeMinusButton")->onMouseClickValidated().add(this, &OptionsMenu::onSFXVolumeMinusButton);
|
||||
buttonLayoutChecked("sfxVolumePlusButton")->onMouseClickValidated().add(this, &OptionsMenu::onSFXVolumePlusButton);
|
||||
buttonLayoutChecked("musicVolumeMinusButton")->onMouseClickValidated().add(this, &OptionsMenu::onMusicVolumeMinusButton);
|
||||
buttonLayoutChecked("musicVolumePlusButton")->onMouseClickValidated().add(this, &OptionsMenu::onMusicVolumePlusButton);
|
||||
buttonLayoutChecked("dialogVolumeMinusButton")->onMouseClickValidated().add(this, &OptionsMenu::onDialogVolumeMinusButton);
|
||||
buttonLayoutChecked("dialogVolumePlusButton")->onMouseClickValidated().add(this, &OptionsMenu::onDialogVolumePlusButton);
|
||||
buttonLayoutChecked("videoVolumeMinusButton")->onMouseClickValidated().add(this, &OptionsMenu::onVideoVolumeMinusButton);
|
||||
buttonLayoutChecked("videoVolumePlusButton")->onMouseClickValidated().add(this, &OptionsMenu::onVideoVolumePlusButton);
|
||||
buttonLayoutChecked("sfxVolumeMinusButton")->setDoubleValidationProtectionEnabled(false);
|
||||
buttonLayoutChecked("sfxVolumePlusButton")->setDoubleValidationProtectionEnabled(false);
|
||||
buttonLayoutChecked("musicVolumeMinusButton")->setDoubleValidationProtectionEnabled(false);
|
||||
buttonLayoutChecked("musicVolumePlusButton")->setDoubleValidationProtectionEnabled(false);
|
||||
buttonLayoutChecked("dialogVolumeMinusButton")->setDoubleValidationProtectionEnabled(false);
|
||||
buttonLayoutChecked("dialogVolumePlusButton")->setDoubleValidationProtectionEnabled(false);
|
||||
buttonLayoutChecked("videoVolumeMinusButton")->setDoubleValidationProtectionEnabled(false);
|
||||
buttonLayoutChecked("videoVolumePlusButton")->setDoubleValidationProtectionEnabled(false);
|
||||
|
||||
_tutoPage = 1;
|
||||
buttonLayoutChecked("tutoButton")->onMouseClickValidated().add(this, &OptionsMenu::onVisibleTuto);
|
||||
|
||||
TeLayout *bg = _gui2.layoutChecked("background");
|
||||
for (int i = 1; i <= bg->childCount(); i++) {
|
||||
TeButtonLayout *page = _gui2.buttonLayoutChecked(pageStr(i));
|
||||
if (i == bg->childCount()) {
|
||||
page->onMouseClickValidated().add(this, &OptionsMenu::onCloseTuto);
|
||||
} else {
|
||||
page->onMouseClickValidated().add(this, &OptionsMenu::onVisibleTutoNextPage);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Amerzone has no volume controls
|
||||
|
||||
// TODO: musicOn checkbox
|
||||
// TODO: permanentHelp checkbox
|
||||
// TODO: inverseLook checkbox
|
||||
// TODO: compassLook checkbox
|
||||
}
|
||||
|
||||
//
|
||||
// WORKAROUND: This is set to PanScan ratio 1.0, but with our code
|
||||
// but that shrinks it down to pillarboxed. Force back to full size.
|
||||
//
|
||||
layoutChecked("background")->setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
|
||||
updateSFXVolumeJauge();
|
||||
updateMusicVolumeJauge();
|
||||
updateDialogVolumeJauge();
|
||||
updateVideoVolumeJauge();
|
||||
}
|
||||
|
||||
void OptionsMenu::leave() {
|
||||
if (loaded()) {
|
||||
unload();
|
||||
_gui2.unload();
|
||||
}
|
||||
}
|
||||
|
||||
bool OptionsMenu::onCloseTuto() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
_gui2.buttonLayoutChecked("tuto")->setVisible(false);
|
||||
_tutoPage = 1;
|
||||
app->fade();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onCreditsButton() {
|
||||
Game *game = g_engine->getGame();
|
||||
game->stopSound("sounds/Ambiances/b_automatebike.ogg");
|
||||
game->stopSound("sounds/Ambiances/b_engrenagebg.ogg");
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->credits().enter(true);
|
||||
// TODO: app->appSpriteLayout().something
|
||||
app->fade();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onDialogVolumeMinusButton() {
|
||||
int n = 0;
|
||||
while (layout(Common::String("dialogVolumeSprite%d", n)) != nullptr)
|
||||
n++;
|
||||
float diff = (n ? (1.0f / n) : 0.1f);
|
||||
TeSoundManager *sndmgr = g_engine->getSoundManager();
|
||||
float curvol = sndmgr->getChannelVolume("dialog");
|
||||
sndmgr->setChannelVolume("dialog", MAX(0.0f, curvol - diff));
|
||||
updateDialogVolumeJauge();
|
||||
_music2.stop();
|
||||
if (!_music1.isPlaying()) {
|
||||
_music1.setChannelName("dialog");
|
||||
_music1.repeat(false);
|
||||
_music1.load(Common::Path(value("dialogTestPath").toString()));
|
||||
_music1.play();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onDialogVolumePlusButton() {
|
||||
int n = 0;
|
||||
while (layout(Common::String("dialogVolumeSprite%d", n)) != nullptr)
|
||||
n++;
|
||||
float diff = (n ? (1.0f / n) : 0.1f);
|
||||
TeSoundManager *sndmgr = g_engine->getSoundManager();
|
||||
float curvol = sndmgr->getChannelVolume("dialog");
|
||||
sndmgr->setChannelVolume("dialog", MIN(1.0f, curvol + diff));
|
||||
updateDialogVolumeJauge();
|
||||
_music2.stop();
|
||||
if (!_music1.isPlaying()) {
|
||||
_music1.setChannelName("dialog");
|
||||
_music1.repeat(false);
|
||||
_music1.load(Common::Path(value("dialogTestPath").toString()));
|
||||
_music1.play();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onMusicVolumeMinusButton() {
|
||||
int n = 0;
|
||||
while (layout(Common::String("musicVolumeSprite%d", n)) != nullptr)
|
||||
n++;
|
||||
float diff = (n ? (1.0f / n) : 0.1f);
|
||||
TeSoundManager *sndmgr = g_engine->getSoundManager();
|
||||
float curvol = sndmgr->getChannelVolume("music");
|
||||
sndmgr->setChannelVolume("music", MAX(0.0f, curvol - diff));
|
||||
updateMusicVolumeJauge();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onMusicVolumePlusButton() {
|
||||
int n = 0;
|
||||
while (layout(Common::String("musicVolumeSprite%d", n)) != nullptr)
|
||||
n++;
|
||||
float diff = (n ? (1.0f / n) : 0.1f);
|
||||
TeSoundManager *sndmgr = g_engine->getSoundManager();
|
||||
float curvol = sndmgr->getChannelVolume("music");
|
||||
sndmgr->setChannelVolume("music", MIN(1.0f, curvol + diff));
|
||||
updateMusicVolumeJauge();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onQuitButton() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
leave();
|
||||
app->mainMenu().enter();
|
||||
app->fade();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onSFXVolumeMinusButton() {
|
||||
int n = 0;
|
||||
while (layout(Common::String("sfxVolumeSprite%d", n)) != nullptr)
|
||||
n++;
|
||||
float diff = (n ? (1.0f / n) : 0.1f);
|
||||
TeSoundManager *sndmgr = g_engine->getSoundManager();
|
||||
float curvol = sndmgr->getChannelVolume("sfx");
|
||||
sndmgr->setChannelVolume("sfx", MAX(0.0f, curvol - diff));
|
||||
updateSFXVolumeJauge();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onSFXVolumePlusButton() {
|
||||
int n = 0;
|
||||
while (layout(Common::String("sfxVolumeSprite%d", n)) != nullptr)
|
||||
n++;
|
||||
float diff = (n ? (1.0f / n) : 0.1f);
|
||||
TeSoundManager *sndmgr = g_engine->getSoundManager();
|
||||
float curvol = sndmgr->getChannelVolume("sfx");
|
||||
sndmgr->setChannelVolume("sfx", MIN(1.0f, curvol + diff));
|
||||
updateSFXVolumeJauge();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onVideoVolumeMinusButton() {
|
||||
int n = 0;
|
||||
while (layout(Common::String("videoVolumeSprite%d", n)) != nullptr)
|
||||
n++;
|
||||
//float diff = (n ? (1.0f / n) : 0.1f);
|
||||
//TeSoundManager *sndmgr = g_engine->getSoundManager();
|
||||
//float curvol = sndmgr->getChannelVolume("video");
|
||||
warning("TODO: Implement onVideoVolumeMinusButton");
|
||||
updateVideoVolumeJauge();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onVideoVolumePlusButton() {
|
||||
int n = 0;
|
||||
while (layout(Common::String("videoVolumeSprite%d", n)) != nullptr)
|
||||
n++;
|
||||
//float diff = (n ? (1.0f / n) : 0.1f);
|
||||
//TeSoundManager *sndmgr = g_engine->getSoundManager();
|
||||
//float curvol = sndmgr->getChannelVolume("video");
|
||||
warning("TODO: Implement onVideoVolumePlusButton");
|
||||
updateVideoVolumeJauge();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onVisibleTuto() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
TeButtonLayout *tutobtn = _gui2.buttonLayoutChecked("tuto");
|
||||
TeLayout *background = _gui2.layoutChecked("background");
|
||||
tutobtn->setVisible(true);
|
||||
for (int i = 1; i <= background->childCount(); i++) {
|
||||
_gui2.buttonLayoutChecked(pageStr(i))->setVisible(false);
|
||||
}
|
||||
_gui2.buttonLayoutChecked(pageStr(1))->setVisible(true);
|
||||
app->fade();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptionsMenu::onVisibleTutoNextPage() {
|
||||
TeButtonLayout *tutobtn = _gui2.buttonLayoutChecked("tuto");
|
||||
tutobtn->setVisible(true);
|
||||
TeLayout *bg = _gui2.layoutChecked("background");
|
||||
|
||||
for (int i = 1; i <= bg->childCount(); i++) {
|
||||
_gui2.buttonLayoutChecked(pageStr(i))->setVisible(false);
|
||||
}
|
||||
|
||||
_gui2.buttonLayoutChecked(pageStr(_tutoPage))->setVisible(false);
|
||||
_tutoPage++;
|
||||
_gui2.buttonLayoutChecked(pageStr(_tutoPage))->setVisible(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
void OptionsMenu::updateJauge(const Common::String &chan, const Common::String &spriteName) {
|
||||
TeSoundManager *sndMgr = g_engine->getSoundManager();
|
||||
const float chanVol = sndMgr->getChannelVolume(chan);
|
||||
TeSpriteLayout *volSprite = spriteLayout(spriteName);
|
||||
if (volSprite)
|
||||
volSprite->_tiledSurfacePtr->setLeftCropping(sndMgr->getChannelVolume(chan));
|
||||
|
||||
int n = 0;
|
||||
while (layout(Common::String::format("%s%d", spriteName.c_str(), n)) != nullptr)
|
||||
n++;
|
||||
|
||||
int i = 0;
|
||||
while (true) {
|
||||
TeLayout *sprite = layout(Common::String::format("%s%d", spriteName.c_str(), i));
|
||||
if (!sprite)
|
||||
break;
|
||||
bool enableSprite = false;
|
||||
float mul = n ? 1.0f / n : 1.0f;
|
||||
if (i * mul - EPSILON <= chanVol) {
|
||||
enableSprite = chanVol < (i + 1) * mul - EPSILON;
|
||||
}
|
||||
sprite->setVisible(enableSprite);
|
||||
|
||||
TeLayout *offSprite = layout(Common::String::format("%s%dOff", spriteName.c_str(), i));
|
||||
if (offSprite) {
|
||||
offSprite->setVisible(!enableSprite);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsMenu::updateDialogVolumeJauge() {
|
||||
updateJauge("dialog", "dialogVolumeSprite");
|
||||
}
|
||||
|
||||
void OptionsMenu::updateMusicVolumeJauge() {
|
||||
updateJauge("music", "musicVolumeSprite");
|
||||
}
|
||||
|
||||
void OptionsMenu::updateSFXVolumeJauge() {
|
||||
updateJauge("sfx", "sfxVolumeSprite");
|
||||
}
|
||||
|
||||
void OptionsMenu::updateVideoVolumeJauge() {
|
||||
updateJauge("video", "videoVolumeSprite");
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
71
engines/tetraedge/game/options_menu.h
Normal file
71
engines/tetraedge/game/options_menu.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_OPTIONS_MENU_H
|
||||
#define TETRAEDGE_GAME_OPTIONS_MENU_H
|
||||
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
#include "tetraedge/te/te_music.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class OptionsMenu : public TeLuaGUI {
|
||||
public:
|
||||
OptionsMenu();
|
||||
|
||||
void enter() override;
|
||||
void leave() override;
|
||||
|
||||
private:
|
||||
bool onCloseTuto();
|
||||
bool onCreditsButton();
|
||||
bool onDialogVolumeMinusButton();
|
||||
bool onDialogVolumePlusButton();
|
||||
bool onMusicVolumeMinusButton();
|
||||
bool onMusicVolumePlusButton();
|
||||
bool onPrivacyPolicyButton() { return false; }
|
||||
bool onQuitButton();
|
||||
bool onSFXVolumeMinusButton();
|
||||
bool onSFXVolumePlusButton();
|
||||
bool onSupportButton() { return false; }
|
||||
bool onTermsOfServiceButton() { return false; }
|
||||
bool onVideoVolumeMinusButton();
|
||||
bool onVideoVolumePlusButton();
|
||||
bool onVisibleTuto();
|
||||
bool onVisibleTutoNextPage();
|
||||
|
||||
void updateDialogVolumeJauge();
|
||||
void updateMusicVolumeJauge();
|
||||
void updateSFXVolumeJauge();
|
||||
void updateVideoVolumeJauge();
|
||||
|
||||
// Not in the original, but to extract some common code..
|
||||
void updateJauge(const Common::String &chan, const Common::String &spriteName);
|
||||
|
||||
TeLuaGUI _gui2;
|
||||
TeMusic _music1;
|
||||
TeMusic _music2;
|
||||
int _tutoPage;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_OPTIONS_MENU_H
|
||||
57
engines/tetraedge/game/owner_error_menu.cpp
Normal file
57
engines/tetraedge/game/owner_error_menu.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/path.h"
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/owner_error_menu.h"
|
||||
|
||||
#include "tetraedge/te/te_layout.h"
|
||||
#include "tetraedge/te/te_text_layout.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
OwnerErrorMenu::OwnerErrorMenu() : _entered(false) {
|
||||
}
|
||||
|
||||
void OwnerErrorMenu::enter() {
|
||||
_entered = true;
|
||||
load("menus/ownerError/ownerError.lua");
|
||||
Application *app = g_engine->getApplication();
|
||||
TeLayout *menuLayout = layoutChecked("menu");
|
||||
app->frontLayout().addChild(menuLayout);
|
||||
TeTextLayout *txt = dynamic_cast<TeTextLayout*>(layoutChecked("ownerMenuText"));
|
||||
if (!txt)
|
||||
error("Couldn't get ownerMenuText layout");
|
||||
const Common::String *locname = app->loc().value(txt->name());
|
||||
txt->setText(value("textAttributs").toString() + (locname ? *locname : txt->name()));
|
||||
}
|
||||
|
||||
void OwnerErrorMenu::leave() {
|
||||
Application *app = g_engine->getApplication();
|
||||
app->captureFade();
|
||||
TeLuaGUI::unload();
|
||||
_entered = false;
|
||||
app->mainMenu().enter();
|
||||
app->fade();
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
42
engines/tetraedge/game/owner_error_menu.h
Normal file
42
engines/tetraedge/game/owner_error_menu.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_OWNER_ERROR_MENU_H
|
||||
#define TETRAEDGE_GAME_OWNER_ERROR_MENU_H
|
||||
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class OwnerErrorMenu : public TeLuaGUI {
|
||||
public:
|
||||
OwnerErrorMenu();
|
||||
|
||||
void enter() override;
|
||||
void leave() override;
|
||||
|
||||
private:
|
||||
bool _entered;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_OWNER_ERROR_MENU_H
|
||||
134
engines/tetraedge/game/particle_xml_parser.cpp
Normal file
134
engines/tetraedge/game/particle_xml_parser.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/particle_xml_parser.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
bool ParticleXmlParser::parserCallback_particle(ParserNode *node) {
|
||||
_scene->particles().push_back(new TeParticle(_scene));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_name(ParserNode *node) {
|
||||
_scene->particles().back()->setName(node->values["value"]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_texture(ParserNode *node) {
|
||||
_scene->particles().back()->loadTexture(node->values["value"]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_position(ParserNode *node) {
|
||||
_scene->particles().back()->setPosition(parsePoint(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_direction(ParserNode *node) {
|
||||
_scene->particles().back()->setDirection(parsePoint(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_size(ParserNode *node) {
|
||||
_scene->particles().back()->setSize(parseDouble(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_volumesize(ParserNode *node) {
|
||||
_scene->particles().back()->setVolumeSize(parsePoint(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_startcolor(ParserNode *node) {
|
||||
TeColor col;
|
||||
if (parseCol(node, col)) {
|
||||
_scene->particles().back()->setStartColor(col);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_endcolor(ParserNode *node) {
|
||||
TeColor col;
|
||||
if (parseCol(node, col)) {
|
||||
_scene->particles().back()->setEndColor(col);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_colortime(ParserNode *node) {
|
||||
_scene->particles().back()->setColorTime(parseUint(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_time(ParserNode *node) {
|
||||
_scene->particles().back()->setTime(parseUint(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_period(ParserNode *node) {
|
||||
_scene->particles().back()->setPeriod(parseUint(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_particleperperiod(ParserNode *node) {
|
||||
_scene->particles().back()->setParticlePerPeriod(parseUint(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_startloop(ParserNode *node) {
|
||||
_scene->particles().back()->setStartLoop(parseUint(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_enabled(ParserNode *node) {
|
||||
_scene->particles().back()->setEnabled(parseUint(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_gravity(ParserNode *node) {
|
||||
_scene->particles().back()->setGravity(parseDouble(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_randomdirection(ParserNode *node) {
|
||||
_scene->particles().back()->setRandomDir((bool)parseUint(node));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleXmlParser::parserCallback_orientation(ParserNode *node) {
|
||||
TeVector3f32 orient;
|
||||
if (node->values.contains("x")) {
|
||||
orient = parsePoint(node);
|
||||
} else if (node->values.contains("value")) {
|
||||
orient.y() = parseDouble(node);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
_scene->particles().back()->setOrientation(orient);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
129
engines/tetraedge/game/particle_xml_parser.h
Normal file
129
engines/tetraedge/game/particle_xml_parser.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_PARTICLE_XML_PARSER_H
|
||||
#define TETRAEDGE_GAME_PARTICLE_XML_PARSER_H
|
||||
|
||||
#include "tetraedge/game/in_game_scene.h"
|
||||
#include "tetraedge/te/te_xml_parser.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class ParticleXmlParser : public TeXmlParser {
|
||||
public:
|
||||
CUSTOM_XML_PARSER(ParticleXmlParser) {
|
||||
XML_KEY(particle)
|
||||
XML_KEY(name)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(texture)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(position)
|
||||
XML_PROP(x, true)
|
||||
XML_PROP(y, true)
|
||||
XML_PROP(z, true)
|
||||
KEY_END()
|
||||
XML_KEY(direction)
|
||||
XML_PROP(x, true)
|
||||
XML_PROP(y, true)
|
||||
XML_PROP(z, true)
|
||||
KEY_END()
|
||||
XML_KEY(size)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(volumesize)
|
||||
XML_PROP(x, true)
|
||||
XML_PROP(y, true)
|
||||
XML_PROP(z, true)
|
||||
KEY_END()
|
||||
XML_KEY(startcolor)
|
||||
XML_PROP(r, true)
|
||||
XML_PROP(g, true)
|
||||
XML_PROP(b, true)
|
||||
XML_PROP(a, true)
|
||||
KEY_END()
|
||||
XML_KEY(endcolor)
|
||||
XML_PROP(r, true)
|
||||
XML_PROP(g, true)
|
||||
XML_PROP(b, true)
|
||||
XML_PROP(a, true)
|
||||
KEY_END()
|
||||
XML_KEY(colortime)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(time)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(period)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(particleperperiod)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(startloop)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(enabled)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(gravity)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(randomdirection)
|
||||
XML_PROP(value, true)
|
||||
KEY_END()
|
||||
XML_KEY(orientation)
|
||||
// Can either be x/y/z or "value" (which is y)
|
||||
XML_PROP(x, false)
|
||||
XML_PROP(y, false)
|
||||
XML_PROP(z, false)
|
||||
XML_PROP(value, false)
|
||||
KEY_END()
|
||||
KEY_END()
|
||||
} PARSER_END()
|
||||
|
||||
bool parserCallback_particle(ParserNode *node);
|
||||
bool parserCallback_name(ParserNode *node);
|
||||
bool parserCallback_texture(ParserNode *node);
|
||||
bool parserCallback_position(ParserNode *node);
|
||||
bool parserCallback_direction(ParserNode *node);
|
||||
bool parserCallback_size(ParserNode *node);
|
||||
bool parserCallback_volumesize(ParserNode *node);
|
||||
bool parserCallback_startcolor(ParserNode *node);
|
||||
bool parserCallback_endcolor(ParserNode *node);
|
||||
bool parserCallback_colortime(ParserNode *node);
|
||||
bool parserCallback_time(ParserNode *node);
|
||||
bool parserCallback_period(ParserNode *node);
|
||||
bool parserCallback_particleperperiod(ParserNode *node);
|
||||
bool parserCallback_startloop(ParserNode *node);
|
||||
bool parserCallback_enabled(ParserNode *node);
|
||||
bool parserCallback_gravity(ParserNode *node);
|
||||
bool parserCallback_randomdirection(ParserNode *node);
|
||||
bool parserCallback_orientation(ParserNode *node);
|
||||
|
||||
public:
|
||||
InGameScene *_scene;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_PARTICLE_XML_PARSER_H
|
||||
31
engines/tetraedge/game/puzzle_cadenas.cpp
Normal file
31
engines/tetraedge/game/puzzle_cadenas.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/puzzle_cadenas.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
PuzzleCadenas::PuzzleCadenas() {
|
||||
}
|
||||
|
||||
// TODO: Add more functions here.
|
||||
|
||||
} // end namespace Tetraedge
|
||||
43
engines/tetraedge/game/puzzle_cadenas.h
Normal file
43
engines/tetraedge/game/puzzle_cadenas.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_PUZZLE_CADENAS_H
|
||||
#define TETRAEDGE_GAME_PUZZLE_CADENAS_H
|
||||
|
||||
#include "tetraedge/te/te_3d_object2.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
// Note: this puzzle exists in the game code but seems never used?
|
||||
class PuzzleCadenas : public Te3DObject2 {
|
||||
public:
|
||||
PuzzleCadenas();
|
||||
|
||||
// TODO add public members
|
||||
|
||||
private:
|
||||
// TODO add private members
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_PUZZLE_CADENAS_H
|
||||
35
engines/tetraedge/game/puzzle_coffre.cpp
Normal file
35
engines/tetraedge/game/puzzle_coffre.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/puzzle_coffre.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
PuzzleCoffre::PuzzleCoffre() {
|
||||
}
|
||||
|
||||
void PuzzleCoffre::wakeUp() {
|
||||
error("TODO: Implement PuzzleCoffre::wakeUp");
|
||||
}
|
||||
|
||||
// TODO: Add more functions here.
|
||||
|
||||
} // end namespace Tetraedge
|
||||
46
engines/tetraedge/game/puzzle_coffre.h
Normal file
46
engines/tetraedge/game/puzzle_coffre.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_PUZZLE_COFFRE_H
|
||||
#define TETRAEDGE_GAME_PUZZLE_COFFRE_H
|
||||
|
||||
#include "tetraedge/te/te_3d_object2.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
// Note: this puzzle exists in the game code but seems never used?
|
||||
|
||||
class PuzzleCoffre : public Te3DObject2 {
|
||||
public:
|
||||
PuzzleCoffre();
|
||||
|
||||
void wakeUp();
|
||||
|
||||
// TODO add public members
|
||||
|
||||
private:
|
||||
// TODO add private members
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_PUZZLE_COFFRE_H
|
||||
410
engines/tetraedge/game/puzzle_computer_hydra.cpp
Normal file
410
engines/tetraedge/game/puzzle_computer_hydra.cpp
Normal file
@@ -0,0 +1,410 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/puzzle_computer_hydra.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/amerzone_game.h"
|
||||
#include "tetraedge/game/game.h"
|
||||
#include "tetraedge/te/te_sound_manager.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
PuzzleComputerHydra::PuzzleComputerHydra() : _checklistStep(0), _axisNo(0) {
|
||||
ARRAYCLEAR(_enteredCoord, 0);
|
||||
ARRAYCLEAR(_targetCoord, 0);
|
||||
}
|
||||
|
||||
void PuzzleComputerHydra::enter() {
|
||||
_gui.load("GUI/PuzzleComputerHydra.lua");
|
||||
Application *app = g_engine->getApplication();
|
||||
app->frontLayout().addChild(_gui.layoutChecked("puzzleComputerHydra"));
|
||||
_exitTimer.alarmSignal().add(this, &PuzzleComputerHydra::onExitTimer);
|
||||
_exitTimer.start();
|
||||
_transitionTimer.start();
|
||||
initAll();
|
||||
hideScreens();
|
||||
enterChecklistScreen();
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::leave() {
|
||||
_exitTimer.alarmSignal().clear();
|
||||
_transitionTimer.alarmSignal().clear();
|
||||
_gui.unload();
|
||||
AmerzoneGame *game = dynamic_cast<AmerzoneGame *>(g_engine->getGame());
|
||||
assert(game);
|
||||
game->warpY()->setVisible(true, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
void PuzzleComputerHydra::setTargetCoordinates(int x, int y, int z) {
|
||||
_targetCoord[0] = x;
|
||||
_targetCoord[1] = y;
|
||||
_targetCoord[2] = z;
|
||||
}
|
||||
|
||||
void PuzzleComputerHydra::clearChecklistScreen() {
|
||||
_gui.layoutChecked("eggText")->setVisible(false);
|
||||
_gui.layoutChecked("fuelText")->setVisible(false);
|
||||
_gui.layoutChecked("capText")->setVisible(false);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::enterChecklistScreen() {
|
||||
_transitionTimer.alarmSignal().add(this, &PuzzleComputerHydra::onTransitionTimer);
|
||||
exitCoordinatesScreen();
|
||||
exitSelectMode();
|
||||
_checklistStep = 0;
|
||||
_gui.layoutChecked("checklist")->setVisible(true);
|
||||
_gui.layoutChecked("checklist")->setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
_gui.spriteLayoutChecked("title")->load("2D/puzzles/Computer_Hydra/CHECKLIST.png");
|
||||
_gui.spriteLayoutChecked("infos")->setVisible(false);
|
||||
clearChecklistScreen();
|
||||
processCheckListScreen();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::enterCoordinatesScreen() {
|
||||
_transitionTimer.alarmSignal().remove(this, &PuzzleComputerHydra::enterCoordinatesScreen);
|
||||
exitChecklistScreen();
|
||||
_axisNo = 0;
|
||||
_enteredCoord[0] = -1;
|
||||
_enteredCoord[1] = -1;
|
||||
_enteredCoord[2] = -1;
|
||||
_gui.spriteLayoutChecked("coordinates")->setVisible(true);
|
||||
_gui.spriteLayoutChecked("coordinates")->setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
_gui.spriteLayoutChecked("titleCoordinates")->load("2D/puzzles/Computer_Hydra/ENTERDETAILS.png");
|
||||
_gui.spriteLayoutChecked("title")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("infos")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("infosCoordinates")->setVisible(false);
|
||||
_gui.buttonLayoutChecked("button0")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button1")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button2")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button3")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button4")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button5")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button6")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button7")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button8")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button9")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("cancel")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("exit")->setEnable(true);
|
||||
_gui.spriteLayoutChecked("digit1")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("digit2")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("digit3")->setVisible(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::enterSelectMode() {
|
||||
_transitionTimer.alarmSignal().remove(this, &PuzzleComputerHydra::enterSelectMode);
|
||||
exitChecklistScreen();
|
||||
_gui.layoutChecked("modeSelect")->setVisible(true);
|
||||
_gui.layoutChecked("modeSelect")->setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
_gui.spriteLayoutChecked("title")->load("2D/puzzles/Computer_Hydra/CHOOSEMODE.png");
|
||||
_gui.spriteLayoutChecked("infos")->setVisible(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::exitChecklistScreen() {
|
||||
_gui.layoutChecked("checklist")->setVisible(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::exitCoordinatesScreen() {
|
||||
_transitionTimer.alarmSignal().remove(this, &PuzzleComputerHydra::enterChecklistScreen);
|
||||
_gui.spriteLayoutChecked("title")->setVisible(true);
|
||||
_gui.spriteLayoutChecked("coordinates")->setVisible(false);
|
||||
_gui.buttonLayoutChecked("button0")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("button1")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("button2")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("button3")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("button4")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("button5")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("button6")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("button7")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("button8")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("button9")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("cancel")->setEnable(false);
|
||||
_gui.spriteLayoutChecked("digit1")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("digit2")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("digit3")->setVisible(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::exitSelectMode() {
|
||||
_gui.layoutChecked("modeSelect")->setVisible(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PuzzleComputerHydra::hideScreens() {
|
||||
_gui.layoutChecked("checklist")->setVisible(false);
|
||||
_gui.layoutChecked("coordinates")->setVisible(false);
|
||||
_gui.layoutChecked("modeSelect")->setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::hideUnavailableModeMsg() {
|
||||
_gui.layoutChecked("infos")->setVisible(false);
|
||||
_transitionTimer.alarmSignal().remove(this, &PuzzleComputerHydra::hideUnavailableModeMsg);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PuzzleComputerHydra::initAll() {
|
||||
_gui.spriteLayoutChecked("screenBase")->setVisible(true);
|
||||
_gui.spriteLayoutChecked("screenBase")->setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
_gui.spriteLayoutChecked("title")->setVisible(true);
|
||||
_gui.spriteLayoutChecked("infos")->setVisible(false);
|
||||
_gui.buttonLayoutChecked("confirmDestination")->setVisible(false);
|
||||
_gui.buttonLayoutChecked("confirmDestination")->setEnable(false);
|
||||
_gui.buttonLayoutChecked("button0")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButton0Clicked);
|
||||
_gui.buttonLayoutChecked("button1")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButton1Clicked);
|
||||
_gui.buttonLayoutChecked("button2")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButton2Clicked);
|
||||
_gui.buttonLayoutChecked("button3")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButton3Clicked);
|
||||
_gui.buttonLayoutChecked("button4")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButton4Clicked);
|
||||
_gui.buttonLayoutChecked("button5")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButton5Clicked);
|
||||
_gui.buttonLayoutChecked("button6")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButton6Clicked);
|
||||
_gui.buttonLayoutChecked("button7")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButton7Clicked);
|
||||
_gui.buttonLayoutChecked("button8")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButton8Clicked);
|
||||
_gui.buttonLayoutChecked("button9")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButton9Clicked);
|
||||
|
||||
_gui.buttonLayoutChecked("cancel")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButtonCancelClicked);
|
||||
_gui.buttonLayoutChecked("exit")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onExitButton);
|
||||
|
||||
_gui.buttonLayoutChecked("buttonBoat")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButtonBoatClicked);
|
||||
_gui.buttonLayoutChecked("buttonGrapple")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButtonGrappleClicked);
|
||||
_gui.buttonLayoutChecked("buttonHelicopter")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButtonHelicopterClicked);
|
||||
_gui.buttonLayoutChecked("buttonSubmarine")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButtonSubmarineClicked);
|
||||
_gui.buttonLayoutChecked("buttonSailboat")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButtonSailboatClicked);
|
||||
_gui.buttonLayoutChecked("buttonPlane")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onButtonPlaneClicked);
|
||||
_gui.buttonLayoutChecked("confirmDestination")->onMouseClickValidated().add(this, &PuzzleComputerHydra::onPuzzleCompleted);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::processCheckListScreen() {
|
||||
Game *game = g_engine->getGame();
|
||||
TeSoundManager *sndMgr = g_engine->getSoundManager();
|
||||
|
||||
switch (_checklistStep) {
|
||||
case 0: {
|
||||
if (game->luaContext().global("Egg_On_Board").toBoolean()) {
|
||||
_gui.spriteLayoutChecked("eggText")->load("2D/puzzles/Computer_Hydra/EGGOK.png");
|
||||
_checklistStep = 1;
|
||||
_transitionTimer.setAlarmIn(1000000);
|
||||
sndMgr->playFreeSound("Sounds/SFX/BipOrdi.ogg");
|
||||
} else {
|
||||
_gui.spriteLayoutChecked("eggText")->load("2D/puzzles/Computer_Hydra/BADEGG.png");
|
||||
_transitionTimer.setAlarmIn(2000000);
|
||||
sndMgr->playFreeSound("Sounds/SFX/N_CodeFaux.ogg");
|
||||
}
|
||||
_gui.spriteLayoutChecked("eggText")->setVisible(true);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
if (game->luaContext().global("Fuel_Tank_Full").toBoolean()) {
|
||||
_gui.spriteLayoutChecked("fuelText")->load("2D/puzzles/Computer_Hydra/FUELOK.png");
|
||||
sndMgr->playFreeSound("Sounds/SFX/BipOrdi.ogg");
|
||||
} else {
|
||||
_gui.spriteLayoutChecked("fuelText")->load("2D/puzzles/Computer_Hydra/BADFUEL.png");
|
||||
sndMgr->playFreeSound("Sounds/SFX/N_CodeFaux.ogg");
|
||||
}
|
||||
_gui.spriteLayoutChecked("fuelText")->setVisible(true);
|
||||
_checklistStep = 3;
|
||||
_transitionTimer.setAlarmIn(1000000);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
if (game->luaContext().global("Destination_Set").toBoolean()) {
|
||||
_gui.spriteLayoutChecked("capText")->load("2D/puzzles/Computer_Hydra/CAPOK.png");
|
||||
_transitionTimer.alarmSignal().remove(this, &PuzzleComputerHydra::onTransitionTimer);
|
||||
_transitionTimer.alarmSignal().add(this, &PuzzleComputerHydra::enterSelectMode);
|
||||
sndMgr->playFreeSound("Sounds/SFX/BipOrdi.ogg");
|
||||
} else {
|
||||
_gui.spriteLayoutChecked("capText")->load("2D/puzzles/Computer_Hydra/BADCAP.png");
|
||||
_transitionTimer.alarmSignal().remove(this, &PuzzleComputerHydra::onTransitionTimer);
|
||||
_transitionTimer.alarmSignal().add(this, &PuzzleComputerHydra::enterCoordinatesScreen);
|
||||
sndMgr->playFreeSound("Sounds/SFX/N_CodeFaux.ogg");
|
||||
}
|
||||
_transitionTimer.setAlarmIn(1000000);
|
||||
_gui.spriteLayoutChecked("capText")->setVisible(true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::registerNewDigit(int digit) {
|
||||
if (_axisNo >= 3)
|
||||
return false;
|
||||
_enteredCoord[_axisNo] = digit;
|
||||
_axisNo++;
|
||||
const Common::String dname = Common::String::format("digit%d", _axisNo);
|
||||
const Common::Path dimg(Common::String::format("2D/puzzles/Computer_Hydra/%d.png", digit));
|
||||
_gui.spriteLayoutChecked(dname)->load(dimg);
|
||||
_gui.spriteLayoutChecked(dname)->setVisible(true);
|
||||
if (_axisNo == 3) {
|
||||
if (_enteredCoord[0] == _targetCoord[0] && _enteredCoord[1] == _targetCoord[1]
|
||||
&& _enteredCoord[2] == _targetCoord[2]) {
|
||||
// Correct!
|
||||
Game *game = g_engine->getGame();
|
||||
game->luaContext().setGlobal("Destination_Set", true);
|
||||
_gui.spriteLayoutChecked("infosCoordinates")->load("2D/puzzles/Computer_Hydra/CAPOK.png");
|
||||
_transitionTimer.alarmSignal().add(this, &PuzzleComputerHydra::enterChecklistScreen);
|
||||
_transitionTimer.setAlarmIn(1000000);
|
||||
g_engine->getSoundManager()->playFreeSound("Sounds/SFX/BipOrdi.ogg");
|
||||
} else {
|
||||
// Incorrect.
|
||||
_gui.spriteLayoutChecked("infosCoordinates")->load("2D/puzzles/Computer_Hydra/BADCAP.png");
|
||||
g_engine->getSoundManager()->playFreeSound("Sounds/SFX/N_CodeFaux.ogg");
|
||||
}
|
||||
_gui.spriteLayoutChecked("infosCoordinates")->setVisible(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::showConfirmDestination() {
|
||||
exitSelectMode();
|
||||
_gui.buttonLayoutChecked("confirmDestination")->setVisible(true);
|
||||
_gui.buttonLayoutChecked("confirmDestination")->setEnable(true);
|
||||
_gui.spriteLayoutChecked("infos")->load("2D/puzzles/Computer_Hydra/CAPOK.png");
|
||||
_gui.spriteLayoutChecked("infos")->setVisible(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::showUnavailableModeMsg() {
|
||||
_gui.spriteLayoutChecked("infos")->load("2D/puzzles/Computer_Hydra/NONDISPO.png");
|
||||
_gui.spriteLayoutChecked("infos")->setVisible(true);
|
||||
_transitionTimer.alarmSignal().remove(this, &PuzzleComputerHydra::hideUnavailableModeMsg);
|
||||
_transitionTimer.alarmSignal().add(this, &PuzzleComputerHydra::hideUnavailableModeMsg);
|
||||
_transitionTimer.setAlarmIn(500000);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButton0Clicked() {
|
||||
return registerNewDigit(0);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButton1Clicked() {
|
||||
return registerNewDigit(1);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButton2Clicked() {
|
||||
return registerNewDigit(2);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButton3Clicked() {
|
||||
return registerNewDigit(3);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButton4Clicked() {
|
||||
return registerNewDigit(4);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButton5Clicked() {
|
||||
return registerNewDigit(5);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButton6Clicked() {
|
||||
return registerNewDigit(6);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButton7Clicked() {
|
||||
return registerNewDigit(7);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButton8Clicked() {
|
||||
return registerNewDigit(8);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButton9Clicked() {
|
||||
return registerNewDigit(9);
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onModeCheckButton(const Common::String &global) {
|
||||
Game *game = g_engine->getGame();
|
||||
TeSoundManager *sndMgr = g_engine->getSoundManager();
|
||||
bool available = game->luaContext().global(global).toBoolean();
|
||||
if (available) {
|
||||
showConfirmDestination();
|
||||
sndMgr->playFreeSound("Sounds/SFX/BipOrdi.ogg");
|
||||
} else {
|
||||
sndMgr->playFreeSound("Sounds/SFX/N_CodeFaux.ogg");
|
||||
showUnavailableModeMsg();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButtonBoatClicked() {
|
||||
return onModeCheckButton("Bark_Mode_Available");
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButtonCancelClicked() {
|
||||
if (_axisNo <= 0)
|
||||
return true;
|
||||
const Common::String dname = Common::String::format("digit%d", _axisNo);
|
||||
_gui.spriteLayoutChecked(dname)->setVisible(false);
|
||||
_axisNo--;
|
||||
_enteredCoord[_axisNo] = -1;
|
||||
_gui.spriteLayoutChecked("infosCoordinates")->setVisible(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButtonGrappleClicked() {
|
||||
return onModeCheckButton("Grapple_Mode_Available");
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButtonHelicopterClicked() {
|
||||
return onModeCheckButton("Helicopter_Mode_Available");
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButtonSubmarineClicked() {
|
||||
return onModeCheckButton("Submarine_Mode_Available");
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButtonSailboatClicked() {
|
||||
return onModeCheckButton("Sailboat_Mode_Available");
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onButtonPlaneClicked() {
|
||||
return onModeCheckButton("Plane_Mode_Available");
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onExitButton() {
|
||||
leave();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onExitTimer() {
|
||||
leave();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onTransitionTimer() {
|
||||
processCheckListScreen();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PuzzleComputerHydra::onPuzzleCompleted() {
|
||||
leave();
|
||||
g_engine->getGame()->luaScript().execute("OnComputerHydraPuzzleCompleted");
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
89
engines/tetraedge/game/puzzle_computer_hydra.h
Normal file
89
engines/tetraedge/game/puzzle_computer_hydra.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_PUZZLE_COMPUTER_HYDRA_H
|
||||
#define TETRAEDGE_GAME_PUZZLE_COMPUTER_HYDRA_H
|
||||
|
||||
#include "tetraedge/te/te_3d_object2.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
#include "tetraedge/te/te_timer.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class PuzzleComputerHydra : public Te3DObject2 {
|
||||
public:
|
||||
PuzzleComputerHydra();
|
||||
|
||||
void enter();
|
||||
bool leave();
|
||||
void setTargetCoordinates(int x, int y, int z);
|
||||
|
||||
private:
|
||||
void clearChecklistScreen();
|
||||
bool enterChecklistScreen();
|
||||
bool enterCoordinatesScreen();
|
||||
bool enterSelectMode();
|
||||
bool exitChecklistScreen();
|
||||
bool exitCoordinatesScreen();
|
||||
bool exitSelectMode();
|
||||
void hideScreens();
|
||||
bool hideUnavailableModeMsg();
|
||||
void initAll();
|
||||
bool processCheckListScreen();
|
||||
bool registerNewDigit(int digit);
|
||||
bool showConfirmDestination();
|
||||
bool showUnavailableModeMsg();
|
||||
|
||||
bool onButton0Clicked();
|
||||
bool onButton1Clicked();
|
||||
bool onButton2Clicked();
|
||||
bool onButton3Clicked();
|
||||
bool onButton4Clicked();
|
||||
bool onButton5Clicked();
|
||||
bool onButton6Clicked();
|
||||
bool onButton7Clicked();
|
||||
bool onButton8Clicked();
|
||||
bool onButton9Clicked();
|
||||
bool onButtonBoatClicked();
|
||||
bool onButtonCancelClicked();
|
||||
bool onButtonGrappleClicked();
|
||||
bool onButtonHelicopterClicked();
|
||||
bool onButtonSubmarineClicked();
|
||||
bool onButtonSailboatClicked();
|
||||
bool onButtonPlaneClicked();
|
||||
bool onExitButton();
|
||||
bool onExitTimer();
|
||||
bool onPuzzleCompleted();
|
||||
bool onTransitionTimer();
|
||||
bool onModeCheckButton(const Common::String &global);
|
||||
|
||||
TeLuaGUI _gui;
|
||||
TeTimer _exitTimer;
|
||||
TeTimer _transitionTimer;
|
||||
int _axisNo;
|
||||
int _enteredCoord[3];
|
||||
int _targetCoord[3];
|
||||
int _checklistStep;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_PUZZLE_COMPUTER_HYDRA_H
|
||||
179
engines/tetraedge/game/puzzle_computer_pwd.cpp
Normal file
179
engines/tetraedge/game/puzzle_computer_pwd.cpp
Normal file
@@ -0,0 +1,179 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/puzzle_computer_pwd.h"
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/application.h"
|
||||
#include "tetraedge/game/amerzone_game.h"
|
||||
|
||||
#include "tetraedge/te/te_sound_manager.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
static const int CORRECT_PWD[6] = {2, 8, 0, 6, 0, 4};
|
||||
|
||||
PuzzleComputerPwd::PuzzleComputerPwd() : _nDigits(0) {
|
||||
ARRAYCLEAR(_enteredPwd, 0);
|
||||
}
|
||||
|
||||
void PuzzleComputerPwd::enter() {
|
||||
_gui.load("GUI/PuzzleComputerPwd.lua");
|
||||
g_engine->getApplication()->frontLayout().addChild(_gui.layoutChecked("puzzleComputerPassword"));
|
||||
_gui.layoutChecked("background")->setRatioMode(TeILayout::RATIO_MODE_NONE);
|
||||
_gui.spriteLayoutChecked("background")->setVisible(true);
|
||||
_gui.buttonLayoutChecked("button0")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button1")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button2")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button3")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button4")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button5")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button6")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button7")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button8")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("button9")->setEnable(true);
|
||||
_gui.buttonLayoutChecked("cancel")->setEnable(true);
|
||||
|
||||
_gui.spriteLayoutChecked("star1")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("star2")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("star3")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("star4")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("star5")->setVisible(false);
|
||||
_gui.spriteLayoutChecked("star6")->setVisible(false);
|
||||
|
||||
_gui.buttonLayoutChecked("button0")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButton0Clicked);
|
||||
_gui.buttonLayoutChecked("button1")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButton1Clicked);
|
||||
_gui.buttonLayoutChecked("button2")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButton2Clicked);
|
||||
_gui.buttonLayoutChecked("button3")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButton3Clicked);
|
||||
_gui.buttonLayoutChecked("button4")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButton4Clicked);
|
||||
_gui.buttonLayoutChecked("button5")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButton5Clicked);
|
||||
_gui.buttonLayoutChecked("button6")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButton6Clicked);
|
||||
_gui.buttonLayoutChecked("button7")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButton7Clicked);
|
||||
_gui.buttonLayoutChecked("button8")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButton8Clicked);
|
||||
_gui.buttonLayoutChecked("button9")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButton9Clicked);
|
||||
_gui.buttonLayoutChecked("cancel")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onButtonCancelClicked);
|
||||
_gui.buttonLayoutChecked("exit")->onMouseClickValidated().add(this, &PuzzleComputerPwd::onExitButton);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::leave() {
|
||||
resetPwd();
|
||||
_gui.unload();
|
||||
|
||||
AmerzoneGame *game = dynamic_cast<AmerzoneGame *>(g_engine->getGame());
|
||||
assert(game);
|
||||
if (game->warpY()) {
|
||||
game->warpY()->setVisible(true, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButton0Clicked() {
|
||||
return registerNewDigit(0);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButton1Clicked() {
|
||||
return registerNewDigit(1);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButton2Clicked() {
|
||||
return registerNewDigit(2);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButton3Clicked() {
|
||||
return registerNewDigit(3);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButton4Clicked() {
|
||||
return registerNewDigit(4);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButton5Clicked() {
|
||||
return registerNewDigit(5);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButton6Clicked() {
|
||||
return registerNewDigit(6);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButton7Clicked() {
|
||||
return registerNewDigit(7);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButton8Clicked() {
|
||||
return registerNewDigit(8);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButton9Clicked() {
|
||||
return registerNewDigit(9);
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onButtonCancelClicked() {
|
||||
if (_nDigits)
|
||||
_nDigits--;
|
||||
const Common::String sname = Common::String::format("star%d", _nDigits + 1);
|
||||
_gui.spriteLayoutChecked(sname)->setVisible(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::onExitButton() {
|
||||
leave();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PuzzleComputerPwd::registerNewDigit(int digit) {
|
||||
if (_nDigits == 6)
|
||||
return false;
|
||||
_enteredPwd[_nDigits] = digit;
|
||||
_nDigits++;
|
||||
const Common::String sname = Common::String::format("star%d", _nDigits);
|
||||
_gui.spriteLayoutChecked(sname)->setVisible(true);
|
||||
if (_nDigits == 6) {
|
||||
bool match = true;
|
||||
for (uint i = 0; i < 6 && match; i++) {
|
||||
match &= (CORRECT_PWD[i] == _enteredPwd[i]);
|
||||
}
|
||||
|
||||
TeSoundManager *sndMgr = g_engine->getSoundManager();
|
||||
if (match) {
|
||||
const Common::Path snd(_gui.value("goodPassword").toString());
|
||||
sndMgr->playFreeSound(snd);
|
||||
leave();
|
||||
Game *game = g_engine->getGame();
|
||||
game->luaScript().execute("OnComputerPwdPuzzleAnswered");
|
||||
return true;
|
||||
} else {
|
||||
const Common::Path snd(_gui.value("badPassword").toString());
|
||||
sndMgr->playFreeSound(snd);
|
||||
resetPwd();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PuzzleComputerPwd::resetPwd() {
|
||||
for (int i = 1; i < 7; i++) {
|
||||
const Common::String sname = Common::String::format("star%d", i);
|
||||
_gui.spriteLayoutChecked(sname)->setVisible(false);
|
||||
}
|
||||
_nDigits = 0;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
61
engines/tetraedge/game/puzzle_computer_pwd.h
Normal file
61
engines/tetraedge/game/puzzle_computer_pwd.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_PUZZLE_COMPUTER_PWD_H
|
||||
#define TETRAEDGE_GAME_PUZZLE_COMPUTER_PWD_H
|
||||
|
||||
#include "tetraedge/te/te_3d_object2.h"
|
||||
#include "tetraedge/te/te_lua_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class PuzzleComputerPwd : public Te3DObject2 {
|
||||
public:
|
||||
PuzzleComputerPwd();
|
||||
|
||||
void enter();
|
||||
bool leave();
|
||||
|
||||
private:
|
||||
bool onButton0Clicked();
|
||||
bool onButton1Clicked();
|
||||
bool onButton2Clicked();
|
||||
bool onButton3Clicked();
|
||||
bool onButton4Clicked();
|
||||
bool onButton5Clicked();
|
||||
bool onButton6Clicked();
|
||||
bool onButton7Clicked();
|
||||
bool onButton8Clicked();
|
||||
bool onButton9Clicked();
|
||||
bool onButtonCancelClicked();
|
||||
bool onExitButton();
|
||||
|
||||
bool registerNewDigit(int digit);
|
||||
void resetPwd();
|
||||
|
||||
TeLuaGUI _gui;
|
||||
int _nDigits;
|
||||
int _enteredPwd[6];
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_PUZZLE_COMPUTER_PWD_H
|
||||
82
engines/tetraedge/game/puzzle_disjoncteur.cpp
Normal file
82
engines/tetraedge/game/puzzle_disjoncteur.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/puzzle_disjoncteur.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
PuzzleDisjoncteur::PuzzleDisjoncteur() : _state(0) {
|
||||
}
|
||||
|
||||
void PuzzleDisjoncteur::wakeUp() {
|
||||
error("TODO: Implement PuzzleDisjoncteur::wakeUp");
|
||||
}
|
||||
|
||||
void PuzzleDisjoncteur::sleep() {
|
||||
error("TODO: Implement PuzzleDisjoncteur::sleep");
|
||||
}
|
||||
|
||||
void PuzzleDisjoncteur::addState(uint32 flags) {
|
||||
if (!(_state & flags))
|
||||
_state += flags;
|
||||
}
|
||||
|
||||
void PuzzleDisjoncteur::removeState(uint32 flags) {
|
||||
if (_state & flags)
|
||||
_state -= flags;
|
||||
}
|
||||
|
||||
void PuzzleDisjoncteur::setDraggedSprite(TeSpriteLayout *sprite) {
|
||||
error("TODO: Implement PuzzleDisjoncteur::setDraggedSprite");
|
||||
}
|
||||
|
||||
void PuzzleDisjoncteur::setDraggedSpriteBack() {
|
||||
error("TODO: Implement PuzzleDisjoncteur::setDraggedSpriteBack");
|
||||
}
|
||||
|
||||
bool PuzzleDisjoncteur::onExitButton() {
|
||||
sleep();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PuzzleDisjoncteur::onLevierAnimFinished() {
|
||||
error("TODO: Implement PuzzleDisjoncteur::onLevierAnimFinished");
|
||||
}
|
||||
|
||||
bool PuzzleDisjoncteur::onMouseDown(const Common::Point &pt) {
|
||||
error("TODO: Implement PuzzleDisjoncteur::onMouseDown");
|
||||
}
|
||||
|
||||
bool PuzzleDisjoncteur::onMouseMove(const Common::Point &pt) {
|
||||
error("TODO: Implement PuzzleDisjoncteur::onMouseMove");
|
||||
}
|
||||
|
||||
bool PuzzleDisjoncteur::onMouseUp(const Common::Point &pt) {
|
||||
error("TODO: Implement PuzzleDisjoncteur::onMouseUp");
|
||||
}
|
||||
|
||||
bool PuzzleDisjoncteur::onWinTimer() {
|
||||
sleep();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Tetraedge
|
||||
58
engines/tetraedge/game/puzzle_disjoncteur.h
Normal file
58
engines/tetraedge/game/puzzle_disjoncteur.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_PUZZLE_DISJONCTEUR_H
|
||||
#define TETRAEDGE_GAME_PUZZLE_DISJONCTEUR_H
|
||||
|
||||
#include "tetraedge/te/te_3d_object2.h"
|
||||
#include "tetraedge/te/te_sprite_layout.h"
|
||||
#include "tetraedge/te/te_xml_gui.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class PuzzleDisjoncteur : public Te3DObject2 {
|
||||
public:
|
||||
PuzzleDisjoncteur();
|
||||
|
||||
void wakeUp();
|
||||
void sleep();
|
||||
|
||||
private:
|
||||
void addState(uint32 flags);
|
||||
void removeState(uint32 flags);
|
||||
void setDraggedSprite(TeSpriteLayout *sprite);
|
||||
void setDraggedSpriteBack();
|
||||
void setState(uint32 flags) { _state = flags; }
|
||||
|
||||
bool onExitButton();
|
||||
bool onLevierAnimFinished();
|
||||
bool onMouseDown(const Common::Point &pt);
|
||||
bool onMouseMove(const Common::Point &pt);
|
||||
bool onMouseUp(const Common::Point &pt);
|
||||
bool onWinTimer();
|
||||
|
||||
TeXmlGui _gui;
|
||||
uint32 _state;
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_PUZZLE_DISJONCTEUR_H
|
||||
123
engines/tetraedge/game/puzzle_hanjie.cpp
Normal file
123
engines/tetraedge/game/puzzle_hanjie.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/puzzle_hanjie.h"
|
||||
|
||||
#include "tetraedge/tetraedge.h"
|
||||
#include "tetraedge/game/amerzone_game.h"
|
||||
#include "tetraedge/te/te_input_mgr.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
static const char *BG_NAMES[] = {"Amenta", "Croix", "Echelle", "Sang", "Trident"};
|
||||
|
||||
PuzzleHanjie::PuzzleHanjie() : _exitButton(nullptr), _entered(false), _foregroundSprite(nullptr), _backgroundNo(0) {
|
||||
ARRAYCLEAR(_sprites);
|
||||
ARRAYCLEAR(_expectedVals, false);
|
||||
}
|
||||
|
||||
void PuzzleHanjie::wakeUp() {
|
||||
_timer.alarmSignal().add(this, &PuzzleHanjie::onWinTimer);
|
||||
_timer.start();
|
||||
|
||||
TeInputMgr *inputMgr = g_engine->getInputMgr();
|
||||
// TODO: Set callback priority value using world transform here?
|
||||
inputMgr->_mouseLUpSignal.add(this, &PuzzleHanjie::onMouseUp);
|
||||
|
||||
_gui.load("Texts/PuzzleHanjie.xml");
|
||||
|
||||
TeButtonLayout *btn = _gui.button("blockButton");
|
||||
btn->setVisible(true);
|
||||
btn->setEnable(true);
|
||||
_foregroundSprite = _gui.sprite("Foreground");
|
||||
_exitButton = _gui.button("Exit");
|
||||
if (_exitButton) {
|
||||
_exitButton->onMouseClickValidated().add(this, &PuzzleHanjie::onExitButton);
|
||||
}
|
||||
|
||||
for (uint i = 0; i < 7; i++) {
|
||||
for (uint j = 0; j < 7; j++) {
|
||||
Common::String sname = Common::String::format("Case%d-%d", i, j);
|
||||
_sprites[i * 7 + j] = _gui.sprite(sname);
|
||||
}
|
||||
}
|
||||
_backgroundNo = g_engine->getRandomNumber(4);
|
||||
_bgImg = Common::Path(Common::String::format("%s%s.png", _gui.value("Background").c_str(), BG_NAMES[_backgroundNo]));
|
||||
_bgSprite.load(_bgImg);
|
||||
_bgSprite.setPosition(TeVector3f32(0, 0, 220));
|
||||
_bgSprite.setVisible(true);
|
||||
|
||||
for (uint row = 0; row < 7; row++) {
|
||||
const Common::String key = Common::String::format("Solution.%s%d", BG_NAMES[_backgroundNo], row);
|
||||
const Common::String data = _gui.value(key);
|
||||
Common::StringArray splitData = TetraedgeEngine::splitString(data, '-');
|
||||
if (splitData.size() != 7)
|
||||
error("Invalid puzzle data for %s: %s", key.c_str(), data.c_str());
|
||||
for (uint col = 0; col < 7; col++) {
|
||||
_expectedVals[row * 7 + col] = (splitData[col] == "1");
|
||||
}
|
||||
}
|
||||
|
||||
if (_gui.group("Sounds")) {
|
||||
const Common::String begin = _gui.value("Sounds.Begin");
|
||||
if (!begin.empty())
|
||||
_soundBegin = Common::String::format("Sounds/Dialogs/%s", begin.c_str());
|
||||
}
|
||||
_entered = true;
|
||||
}
|
||||
|
||||
void PuzzleHanjie::sleep() {
|
||||
TeInputMgr *inputMgr = g_engine->getInputMgr();
|
||||
inputMgr->_mouseLUpSignal.remove(this, &PuzzleHanjie::onMouseUp);
|
||||
|
||||
_timer.alarmSignal().clear();
|
||||
_gui.unload();
|
||||
_bgSprite.setVisible(false);
|
||||
_bgSprite.unload();
|
||||
_entered = false;
|
||||
AmerzoneGame *game = dynamic_cast<AmerzoneGame *>(g_engine->getGame());
|
||||
assert(game);
|
||||
game->warpY()->setVisible(true, false);
|
||||
}
|
||||
|
||||
bool PuzzleHanjie::isSolved() {
|
||||
for (uint i = 0; i < ARRAYSIZE(_expectedVals); i++) {
|
||||
if (_expectedVals[i] != _sprites[i]->visible())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PuzzleHanjie::onExitButton() {
|
||||
sleep();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PuzzleHanjie::onWinTimer() {
|
||||
sleep();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PuzzleHanjie::onMouseUp(const Common::Point &pt) {
|
||||
error("TODO: Implement PuzzleHanjie::onMouseUp");
|
||||
}
|
||||
|
||||
} // end namespace Tetraedge
|
||||
63
engines/tetraedge/game/puzzle_hanjie.h
Normal file
63
engines/tetraedge/game/puzzle_hanjie.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_PUZZLE_HANJIE_H
|
||||
#define TETRAEDGE_GAME_PUZZLE_HANJIE_H
|
||||
|
||||
#include "tetraedge/te/te_3d_object2.h"
|
||||
#include "tetraedge/te/te_timer.h"
|
||||
#include "tetraedge/te/te_xml_gui.h"
|
||||
#include "tetraedge/te/te_button_layout.h"
|
||||
#include "tetraedge/te/te_sprite_layout.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class PuzzleHanjie : public Te3DObject2 {
|
||||
public:
|
||||
PuzzleHanjie();
|
||||
|
||||
void wakeUp();
|
||||
void sleep();
|
||||
|
||||
private:
|
||||
bool isSolved();
|
||||
bool onExitButton();
|
||||
bool onWinTimer();
|
||||
bool onMouseUp(const Common::Point &pt);
|
||||
|
||||
TeTimer _timer;
|
||||
TeXmlGui _gui;
|
||||
|
||||
TeButtonLayout *_exitButton;
|
||||
TeSpriteLayout *_sprites[49];
|
||||
TeSpriteLayout *_foregroundSprite;
|
||||
int _backgroundNo;
|
||||
bool _entered;
|
||||
Common::Path _bgImg;
|
||||
Common::String _soundBegin;
|
||||
TeSpriteLayout _bgSprite;
|
||||
bool _expectedVals[49];
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_PUZZLE_HANJIE_H
|
||||
39
engines/tetraedge/game/puzzle_liquides.cpp
Normal file
39
engines/tetraedge/game/puzzle_liquides.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/puzzle_liquides.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
PuzzleLiquides::PuzzleLiquides() {
|
||||
}
|
||||
|
||||
void PuzzleLiquides::wakeUp() {
|
||||
error("TODO: Implement PuzzleLiquides::wakeUp");
|
||||
}
|
||||
|
||||
void PuzzleLiquides::sleep() {
|
||||
error("TODO: Implement PuzzleLiquides::sleep");
|
||||
}
|
||||
|
||||
// TODO: Add more functions here.
|
||||
|
||||
} // end namespace Tetraedge
|
||||
51
engines/tetraedge/game/puzzle_liquides.h
Normal file
51
engines/tetraedge/game/puzzle_liquides.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_PUZZLE_LIQUIDES_H
|
||||
#define TETRAEDGE_GAME_PUZZLE_LIQUIDES_H
|
||||
|
||||
#include "tetraedge/te/te_3d_object2.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class PuzzleLiquides : public Te3DObject2 {
|
||||
public:
|
||||
PuzzleLiquides();
|
||||
|
||||
void wakeUp();
|
||||
void sleep();
|
||||
|
||||
private:
|
||||
void initCase();
|
||||
bool isAdjacent(int x, int y);
|
||||
bool isSolved();
|
||||
|
||||
bool onExitButton();
|
||||
bool onMouseDown(const Common::Point &pt);
|
||||
bool onMouseMove(const Common::Point &pt);
|
||||
bool onMouseUp(const Common::Point &pt);
|
||||
bool onWinTimer();
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_PUZZLE_LIQUIDES_H
|
||||
35
engines/tetraedge/game/puzzle_pentacle.cpp
Normal file
35
engines/tetraedge/game/puzzle_pentacle.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tetraedge/game/puzzle_pentacle.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
PuzzlePentacle::PuzzlePentacle() {
|
||||
}
|
||||
|
||||
void PuzzlePentacle::wakeUp(int param1, int param2) {
|
||||
error("TODO: Implement PuzzlePentacle::wakeUp");
|
||||
}
|
||||
|
||||
// TODO: Add more functions here.
|
||||
|
||||
} // end namespace Tetraedge
|
||||
44
engines/tetraedge/game/puzzle_pentacle.h
Normal file
44
engines/tetraedge/game/puzzle_pentacle.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TETRAEDGE_GAME_PUZZLE_PENTACLE_H
|
||||
#define TETRAEDGE_GAME_PUZZLE_PENTACLE_H
|
||||
|
||||
#include "tetraedge/te/te_3d_object2.h"
|
||||
|
||||
namespace Tetraedge {
|
||||
|
||||
class PuzzlePentacle : public Te3DObject2 {
|
||||
public:
|
||||
PuzzlePentacle();
|
||||
|
||||
void wakeUp(int param1, int param2);
|
||||
|
||||
// TODO add public members
|
||||
|
||||
private:
|
||||
// TODO add private members
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Tetraedge
|
||||
|
||||
#endif // TETRAEDGE_GAME_PUZZLE_PENTACLE_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user