aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/null/null.cpp16
-rw-r--r--common/language.cpp3
-rw-r--r--common/language.h3
-rw-r--r--engines/fullpipe/constants.h9
-rw-r--r--engines/fullpipe/init.cpp4
-rw-r--r--engines/fullpipe/motion.cpp24
-rw-r--r--engines/fullpipe/motion.h17
-rw-r--r--engines/fullpipe/objectnames.h2
-rw-r--r--engines/fullpipe/scenes.h3
-rw-r--r--engines/fullpipe/scenes/scene04.cpp105
-rw-r--r--engines/fullpipe/utils.cpp1
-rw-r--r--engines/sci/console.cpp2
-rw-r--r--engines/sci/engine/savegame.cpp2
-rw-r--r--engines/sci/engine/script.cpp7
-rw-r--r--engines/sci/engine/script.h9
-rw-r--r--engines/sci/engine/script_patches.cpp342
-rw-r--r--engines/sci/engine/script_patches.h100
-rw-r--r--engines/sci/engine/seg_manager.cpp7
-rw-r--r--engines/sci/engine/seg_manager.h3
-rw-r--r--engines/sci/sci.cpp7
-rw-r--r--engines/sci/sci.h3
-rw-r--r--engines/tinsel/scene.cpp42
-rw-r--r--engines/tsage/core.cpp2
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.cpp877
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.h78
-rw-r--r--engines/wintermute/base/base_file_manager.cpp7
-rw-r--r--engines/wintermute/detection_tables.h112
27 files changed, 1086 insertions, 701 deletions
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 9e05539799..29bf9acacd 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -20,12 +20,23 @@
*
*/
+// We use some stdio.h functionality here thus we need to allow some
+// symbols. Alternatively, we could simply allow everything by defining
+// FORBIDDEN_SYMBOL_ALLOW_ALL
+#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+#define FORBIDDEN_SYMBOL_EXCEPTION_stdout
+#define FORBIDDEN_SYMBOL_EXCEPTION_stderr
+#define FORBIDDEN_SYMBOL_EXCEPTION_fputs
+
#include "backends/modular-backend.h"
#include "base/main.h"
#if defined(USE_NULL_DRIVER)
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
+#include "backends/events/default/default-events.h"
+#include "backends/mutex/null/null-mutex.h"
+#include "backends/graphics/null/null-graphics.h"
#include "audio/mixer_intern.h"
#include "common/scummsys.h"
@@ -40,13 +51,14 @@
#include "backends/fs/windows/windows-fs-factory.h"
#endif
-class OSystem_NULL : public ModularBackend {
+class OSystem_NULL : public ModularBackend, Common::EventSource {
public:
OSystem_NULL();
virtual ~OSystem_NULL();
virtual void initBackend();
+ virtual Common::EventSource *getDefaultEventSource() { return this; }
virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis(bool skipRecord = false);
@@ -92,7 +104,7 @@ bool OSystem_NULL::pollEvent(Common::Event &event) {
return false;
}
-uint32 OSystem_NULL::getMillis() {
+uint32 OSystem_NULL::getMillis(bool skipRecord) {
return 0;
}
diff --git a/common/language.cpp b/common/language.cpp
index 898adf8d0e..6704a52373 100644
--- a/common/language.cpp
+++ b/common/language.cpp
@@ -28,6 +28,7 @@ namespace Common {
const LanguageDescription g_languages[] = {
{ "zh-cn", "zh_CN", "Chinese (China)", ZH_CNA },
{ "zh", "zh_TW", "Chinese (Taiwan)", ZH_TWN },
+ { "hr", "hr_HR", "Croatian", HR_HRV },
{ "cz", "cs_CZ", "Czech", CZ_CZE },
{ "nl", "nl_NL", "Dutch", NL_NLD },
{ "en", "en", "English", EN_ANY }, // Generic English (when only one game version exist)
@@ -38,11 +39,11 @@ const LanguageDescription g_languages[] = {
{ "gr", "el_GR", "Greek", GR_GRE },
{ "he", "he_IL", "Hebrew", HE_ISR },
{ "hb", "he_IL", "Hebrew", HE_ISR }, // Deprecated
- { "hr", "hr_HR", "Croatian", HR_HRV },
{ "hu", "hu_HU", "Hungarian", HU_HUN },
{ "it", "it_IT", "Italian", IT_ITA },
{ "jp", "ja_JP", "Japanese", JA_JPN },
{ "kr", "ko_KR", "Korean", KO_KOR },
+ { "lv", "lv_LV", "Latvian", LV_LAT },
{ "nb", "nb_NO", "Norwegian Bokm\xE5l", NB_NOR }, // TODO Someone should verify the unix locale
{ "pl", "pl_PL", "Polish", PL_POL },
{ "br", "pt_BR", "Portuguese", PT_BRA },
diff --git a/common/language.h b/common/language.h
index 03b9ebaf8e..f18815509b 100644
--- a/common/language.h
+++ b/common/language.h
@@ -34,6 +34,7 @@ class String;
enum Language {
ZH_CNA,
ZH_TWN,
+ HR_HRV,
CZ_CZE,
NL_NLD,
EN_ANY, // Generic English (when only one game version exist)
@@ -43,11 +44,11 @@ enum Language {
DE_DEU,
GR_GRE,
HE_ISR,
- HR_HRV,
HU_HUN,
IT_ITA,
JA_JPN,
KO_KOR,
+ LV_LAT,
NB_NOR,
PL_POL,
PT_BRA,
diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h
index 76739b6632..41800dab13 100644
--- a/engines/fullpipe/constants.h
+++ b/engines/fullpipe/constants.h
@@ -96,7 +96,6 @@ namespace Fullpipe {
#define MSG_SC4_KOZAWFALL 2858
#define MSG_SC4_MANFROMBOTTLE 2854
#define MSG_SC4_MANTOBOTTLE 2852
-#define PIC_SC4_LADDER 1438
#define MSG_GOTOLADDER 618
#define MSG_SHAKEBOTTLE 584
#define MSG_SHOOTKOZAW 557
@@ -110,6 +109,8 @@ namespace Fullpipe {
#define MV_IN1MAN_SLEEP 5111
#define MV_KZW_JUMP 558
#define MV_KZW_JUMPROTATE 561
+#define MV_KZW_TOHOLERV 537
+#define MV_KZW_WALKPLANK 500
#define MV_BDG_OPEN 1379
#define MV_BTN_CLICK 599
#define MV_CLK_GO 589
@@ -184,9 +185,14 @@ namespace Fullpipe {
#define PIC_SC4_MASK 585
#define PIC_SC4_PLANK 5183
#define PIC_SCD_SEL 734
+#define QU_BALL_WALKL 4920
+#define QU_BALL_WALKR 4919
#define QU_EGTR_MD2_SHOW 4698
#define QU_EGTR_MD1_SHOW 4697
#define QU_EGTR_SLIMSHOW 4883
+#define QU_HND_TAKE0 1440
+#define QU_HND_TAKE1 1441
+#define QU_HND_TAKE2 1442
#define QU_HND_TAKEBOTTLE 1443
#define QU_IN2_DO 5144
#define QU_INTR_FINISH 5138
@@ -286,6 +292,7 @@ namespace Fullpipe {
#define ST_MAN_EMPTY 476
#define ST_MAN_RIGHT 325
#define ST_MAN_SIT 1164
+#define ST_PNK_WEIGHTLEFT 503
#define TrubaDown 697
#define TrubaLeft 474
#define TrubaRight 696
diff --git a/engines/fullpipe/init.cpp b/engines/fullpipe/init.cpp
index 49bf72ac91..eb109e11ec 100644
--- a/engines/fullpipe/init.cpp
+++ b/engines/fullpipe/init.cpp
@@ -65,7 +65,7 @@ void FullpipeEngine::initObjectStates() {
setObjectState(sO_Guardian, getObjectEnumState(sO_Guardian, sO_OnRight));
setObjectState(sO_Grandma, getObjectEnumState(sO_Grandma, sO_In_14));
setObjectState(sO_Boot_15, getObjectEnumState(sO_Boot_15, sO_NotPresent));
- setObjectState(sO_LeftPipe_15, getObjectEnumState(sO_LeftPipe_15, sO_OpenedShe));
+ setObjectState(sO_LeftPipe_15, getObjectEnumState(sO_LeftPipe_15, sO_IsOpened));
setObjectState(sO_Pedestal_16, getObjectEnumState(sO_Pedestal_16, sO_IsFree));
setObjectState(sO_Cup, getObjectEnumState(sO_Cup, sO_InSmokeRoom));
setObjectState(sO_Pedestal_17, getObjectEnumState(sO_Pedestal_17, sO_IsFree));
@@ -84,7 +84,7 @@ void FullpipeEngine::initObjectStates() {
setObjectState(sO_Lever_23, getObjectEnumState(sO_Lever_23, sO_NotTaken));
setObjectState(sO_LeverHandle_23, getObjectEnumState(sO_LeverHandle_23, sO_WithoutStool));
setObjectState(sO_LowerPipe_21, getObjectEnumState(sO_LowerPipe_21, sO_IsClosed));
- setObjectState(sO_StarsDown_24, getObjectEnumState(sO_StarsDown_24, sO_OpenedShe));
+ setObjectState(sO_StarsDown_24, getObjectEnumState(sO_StarsDown_24, sO_IsOpened));
setObjectState(sO_Hatch_26, getObjectEnumState(sO_Hatch_26, sO_Closed));
setObjectState(sO_Sock_26, getObjectEnumState(sO_Sock_26, sO_NotHanging));
setObjectState(sO_LeftPipe_26, getObjectEnumState(sO_LeftPipe_26, sO_IsClosed));
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index f67011a50f..28201c535d 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -28,9 +28,9 @@
#include "fullpipe/objects.h"
#include "fullpipe/statics.h"
+#include "fullpipe/gameloader.h"
#include "fullpipe/motion.h"
#include "fullpipe/messages.h"
-#include "fullpipe/gameloader.h"
namespace Fullpipe {
@@ -185,6 +185,28 @@ MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos,
return mq;
}
+MctlLadder::MctlLadder() {
+ _preload.preloadId1 = 0;
+ _preload.keyCode = 0;
+ _preload.sceneId = 0;
+ _preload.preloadId2 = 0;
+
+ _ladder_field_18 = 0;
+ _ladder_field_C = 0;
+ _ladder_field_1C = 0;
+ _ladder_field_10 = 0;
+ _ladder_field_14 = 0;
+
+ _ladder_field_20 = 0;
+ _ladder_field_24 = 0;
+}
+
+int MctlLadder::collisionDetection(StaticANIObject *man) {
+ warning("STUB: MctlLaddercollisionDetection()");
+
+ return 0;
+}
+
MctlConnectionPoint *MctlCompound::findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIndex, int *minDistancePtr) {
warning("STUB: MctlCompound::findClosestConnectionPoint()");
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index bab0ffc8ca..9e1e42aaa4 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -161,6 +161,23 @@ public:
MessageQueue *genMovement(MGMInfo *mgminfo);
};
+class MctlLadder : public MotionController {
+public:
+ int _ladder_field_C;
+ int _ladder_field_10;
+ int _ladder_field_14;
+ int _ladder_field_18;
+ int _ladder_field_1C;
+ int _ladder_field_20;
+ int _ladder_field_24;
+ PreloadItem _preload;
+ MGM _mgm;
+
+public:
+ MctlLadder();
+ int collisionDetection(StaticANIObject *man);
+};
+
class MovGraphNode : public CObject {
public:
int _x;
diff --git a/engines/fullpipe/objectnames.h b/engines/fullpipe/objectnames.h
index 241e31b165..b8696ec672 100644
--- a/engines/fullpipe/objectnames.h
+++ b/engines/fullpipe/objectnames.h
@@ -148,7 +148,7 @@ namespace Fullpipe {
#define sO_ClockAxis "\xce\xf1\xfc \xf7\xe0\xf1\xee\xe2" // "Ось часов"
#define sO_Opened "\xce\xf2\xea\xf0\xfb\xf2" // "Открыт"
#define sO_OpenedWithBoot "\xce\xf2\xea\xf0\xfb\xf2\xe0 \xf1 \xe1\xee\xf2\xe8\xed\xea\xee\xec" // "Открыта с ботинком"
-#define sO_OpenedShe "\xce\xf2\xea\xf0\xfb\xf2\xe0" // "Открыта"
+#define sO_IsOpened "\xce\xf2\xea\xf0\xfb\xf2\xe0" // "Открыта"
#define sO_WeirdWacko "\xce\xf2\xec\xee\xf0\xee\xe6\xe5\xed\xed\xfb\xe9" // "Отмороженный"
#define sO_NotPresent "\xce\xf2\xf1\xf3\xf2\xf1\xf2\xe2\xf3\xe5\xf2" // "Отсутствует"
#define sO_Error "\xce\xf8\xe8\xe1\xea\xe0" // "Ошибка"
diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h
index 670b94a839..ced671d6e7 100644
--- a/engines/fullpipe/scenes.h
+++ b/engines/fullpipe/scenes.h
@@ -26,6 +26,7 @@
namespace Fullpipe {
class StaticANIObject;
+ class MctlLadder;
int defaultUpdateCursor();
@@ -93,7 +94,7 @@ public:
Common::List<GameObject *> scene04_bottleObjList;
Common::List<StaticANIObject *> scene04_kozyawkiAni;
- int scene04_ladder;
+ MctlLadder *scene04_ladder;
bool scene04_coinPut;
bool scene04_soundPlaying;
int scene04_dynamicPhaseIndex;
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index d642ebfcd2..689260a41b 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -319,7 +319,20 @@ void sceneHandler04_lowerPlank() {
}
void sceneHandler04_manFromBottle() {
- warning("sceneHandler04_manFromBottle()");
+ for (Common::List<GameObject *>::iterator it = g_vars->scene04_bottleObjList.begin(); it != g_vars->scene04_bottleObjList.end(); ++it)
+ if (*it == g_fullpipe->_aniMan) {
+ g_vars->scene04_bottleObjList.erase(it);
+ g_vars->scene04_var06 -= 9;
+ break;
+ }
+
+ if (g_vars->scene04_ladder)
+ delete g_vars->scene04_ladder;
+
+ g_vars->scene04_ladder = 0;
+
+ getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
}
void sceneHandler04_manToBottle() {
@@ -433,24 +446,98 @@ void sceneHandler04_sub9(StaticANIObject *ani) {
warning("sceneHandler04_sub9()");
}
-void sceneHandler04_sub15() {
- warning("sceneHandler04_sub15()");
+void sceneHandler04_sub12() {
+ StaticANIObject *ball = g_fullpipe->_currentScene->getStaticANIObject1ById(ANI_BIGBALL, -1);
+
+ if (ball && ball->_flags & 4)
+ for (uint i = 0; i < ball->_movements.size(); i++)
+ ((Movement *)ball->_movements[i])->_counterMax = 0;
+
+ g_vars->scene04_var13 = 0;
+}
+
+void sceneHandler04_handTake() {
+ g_vars->scene04_clock->changeStatics2(ST_CLK_CLOSED);
+
+ if (g_vars->scene04_kozyawkiAni.size()) {
+ if (g_vars->scene04_kozyawkiAni.size() == 1) {
+ chainQueue(QU_HND_TAKE1, 0);
+ g_vars->scene04_var19 = 0;
+ } else {
+ chainQueue((g_vars->scene04_kozyawkiAni.size() != 2) ? QU_HND_TAKEBOTTLE : QU_HND_TAKE2, 0);
+ g_vars->scene04_var19 = 0;
+ }
+ } else {
+ chainQueue(QU_HND_TAKE0, 0);
+ g_vars->scene04_var19 = 0;
+ }
}
void sceneHandler04_sub17() {
- warning("sceneHandler04_sub17()");
+ StaticANIObject *ball = g_fullpipe->_currentScene->getStaticANIObject1ById(ANI_BIGBALL, -1);
+
+ if (g_vars->scene04_var01
+ && (!ball || !(ball->_flags & 4))
+ && g_vars->scene04_ladder->collisionDetection(g_fullpipe->_aniMan) > 3) {
+
+ if (!g_fullpipe->_rnd->getRandomNumber(49)) {
+ if (g_vars->scene04_var15)
+ chainQueue(QU_BALL_WALKR, 0);
+ else
+ chainQueue(QU_BALL_WALKL, 0);
+
+ g_vars->scene04_var15 = !g_vars->scene04_var15;
+
+ sceneHandler04_checkBigBallClick();
+
+ g_vars->scene04_var14 = 0;
+ }
+ }
}
void sceneHandler04_takeBottle() {
- warning("sceneHandler04_takeBottle()");
+ g_vars->scene04_var02 = 1;
+ g_vars->scene04_hand->_priority = 5;
+
+ g_fullpipe->setObjectState(sO_LowerPipe, g_fullpipe->getObjectEnumState(sO_LowerPipe, sO_IsOpened));
}
void sceneHandler04_takeKozyawka() {
- warning("sceneHandler04_takeKozyawka()");
+ if (g_vars->scene04_kozyawkiAni.size() > 0) {
+ if (g_vars->scene04_kozyawkiAni.size() == 1)
+ g_vars->scene04_var19 = 1;
+
+ StaticANIObject *koz = g_vars->scene04_kozyawkiAni.front();
+ g_vars->scene04_kozyawkiAni.pop_front();
+
+ if (koz) {
+ koz->queueMessageQueue(0);
+ koz->hide();
+
+ g_vars->scene04_kozyawkiObjList.push_back(koz);
+
+ for (Common::List<GameObject *>::iterator it = g_vars->scene04_bottleObjList.begin(); it != g_vars->scene04_bottleObjList.end(); ++it)
+ if (*it == koz) {
+ g_vars->scene04_bottleObjList.erase(it);
+ break;
+ }
+
+ g_vars->scene04_var06 -= 2;
+ }
+ }
}
void sceneHandler04_testPlank(ExCommand *ex) {
- warning("sceneHandler04_testPlank()");
+ MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex->_parId);
+
+ if (!mq)
+ return;
+
+ if (g_vars->scene04_plank->_movement || !g_vars->scene04_plank->_statics || g_vars->scene04_plank->_statics->_staticsId != ST_PNK_WEIGHTLEFT) {
+ mq->getExCommandByIndex(0)->_messageNum = MV_KZW_TOHOLERV;
+ } else {
+ mq->getExCommandByIndex(0)->_messageNum = MV_KZW_WALKPLANK;
+ }
}
void sceneHandler04_updateBottle() {
@@ -526,7 +613,7 @@ int sceneHandler04(ExCommand *ex) {
if (g_vars->scene04_var10)
sceneHandler04_sub1(0);
- sceneHandler04_sub15();
+ sceneHandler04_handTake();
sceneHandler04_stopSound();
break;
@@ -719,7 +806,7 @@ int sceneHandler04(ExCommand *ex) {
if (g_vars->scene04_var10)
sceneHandler04_sub1(0);
- sceneHandler04_sub15();
+ sceneHandler04_handTake();
}
break;
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index 3a65801951..063aa5c738 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -26,6 +26,7 @@
#include "common/memstream.h"
#include "fullpipe/objects.h"
+#include "fullpipe/gameloader.h"
#include "fullpipe/motion.h"
#include "fullpipe/ngiarchive.h"
#include "fullpipe/messages.h"
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 80d8ab8257..e7cbde6cbb 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -2980,7 +2980,7 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
Script *script;
// Create a custom segment manager here, so that the game's segment
// manager won't be affected by loading and unloading scripts here.
- SegManager *customSegMan = new SegManager(_engine->getResMan());
+ SegManager *customSegMan = new SegManager(_engine->getResMan(), _engine->getScriptPatcher());
Common::List<ResourceId>::iterator itr;
for (itr = resources.begin(); itr != resources.end(); ++itr) {
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 6955225fe5..16b88b5672 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -484,7 +484,7 @@ void Script::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsSint32LE(_nr);
if (s.isLoading())
- load(_nr, g_sci->getResMan());
+ load(_nr, g_sci->getResMan(), g_sci->getScriptPatcher());
s.skip(4, VER(14), VER(22)); // OBSOLETE: Used to be _bufSize
s.skip(4, VER(14), VER(22)); // OBSOLETE: Used to be _scriptSize
s.skip(4, VER(14), VER(22)); // OBSOLETE: Used to be _heapSize
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 6616a0ee13..c661a00185 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -32,7 +32,8 @@
namespace Sci {
-Script::Script() : SegmentObj(SEG_TYPE_SCRIPT), _buf(NULL) {
+Script::Script()
+ : SegmentObj(SEG_TYPE_SCRIPT), _buf(NULL) {
freeScript();
}
@@ -65,7 +66,7 @@ void Script::freeScript() {
_objects.clear();
}
-void Script::load(int script_nr, ResourceManager *resMan) {
+void Script::load(int script_nr, ResourceManager *resMan, ScriptPatcher *scriptPatcher) {
freeScript();
Resource *script = resMan->findResource(ResourceId(kResourceTypeScript, script_nr), 0);
@@ -136,7 +137,7 @@ void Script::load(int script_nr, ResourceManager *resMan) {
memcpy(_buf, script->data, script->size);
// Check scripts for matching signatures and patch those, if found
- patcherProcessScript(_nr, _buf, script->size);
+ scriptPatcher->processScript(_nr, _buf, script->size);
if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1) {
Resource *heap = resMan->findResource(ResourceId(kResourceTypeHeap, _nr), 0);
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index 6a27dc7f64..9e016156b8 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -25,6 +25,7 @@
#include "common/str.h"
#include "sci/engine/segment.h"
+#include "sci/engine/script_patches.h"
namespace Sci {
@@ -96,13 +97,7 @@ public:
~Script();
void freeScript();
- void load(int script_nr, ResourceManager *resMan);
-
- void patcherProcessScript(uint16 scriptNr, byte *scriptData, const uint32 scriptSize);
- void patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacSci11);
- void patcherEnablePatch(SciScriptPatcherEntry *patchTable, const char *searchDescription);
- int32 patcherFindSignature(const SciScriptPatcherEntry *patchEntry, const byte *scriptData, const uint32 scriptSize, bool isMacSci11);
- void patcherApplyPatch(const SciScriptPatcherEntry *patchEntry, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, bool isMacSci11);
+ void load(int script_nr, ResourceManager *resMan, ScriptPatcher *scriptPatcher);
virtual bool isValidOffset(uint16 offset) const;
virtual SegmentRef dereference(reg_t pointer);
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 6293fb42ae..5370c59256 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -25,6 +25,7 @@
#include "sci/engine/script.h"
#include "sci/engine/state.h"
#include "sci/engine/features.h"
+#include "sci/engine/script_patches.h"
#include "common/util.h"
@@ -76,72 +77,27 @@ namespace Sci {
// You have to use the exact same order in both the table and the enum, otherwise
// it won't work.
-#define SIG_END 0xFFFF
-#define SIG_MISMATCH 0xFFFE
-#define SIG_COMMANDMASK 0xF000
-#define SIG_VALUEMASK 0x0FFF
-#define SIG_BYTEMASK 0x00FF
-#define SIG_MAGICDWORD 0xF000
-#define SIG_ADDTOOFFSET 0xE000
-#define SIG_SELECTOR16 0x9000
-#define SIG_SELECTOR8 0x8000
-#define SIG_UINT16 0x1000
-#define SIG_BYTE 0x0000
-
-#define PATCH_END SIG_END
-#define PATCH_COMMANDMASK SIG_COMMANDMASK
-#define PATCH_VALUEMASK SIG_VALUEMASK
-#define PATCH_BYTEMASK SIG_BYTEMASK
-#define PATCH_ADDTOOFFSET SIG_ADDTOOFFSET
-#define PATCH_GETORIGINALBYTE 0xD000
-#define PATCH_GETORIGINALBYTEADJUST 0xC000
-#define PATCH_SELECTOR16 SIG_SELECTOR16
-#define PATCH_SELECTOR8 SIG_SELECTOR8
-#define PATCH_UINT16 SIG_UINT16
-#define PATCH_BYTE SIG_BYTE
-
-// defines maximum scratch area for getting original bytes from unpatched script data
-#define PATCH_VALUELIMIT 4096
-
-struct SciScriptPatcherEntry {
- bool active;
- uint16 scriptNr;
- const char *description;
- int16 applyCount;
- uint32 magicDWord;
- int magicOffset;
- const uint16 *signatureData;
- const uint16 *patchData;
-};
-
-#define SCI_SIGNATUREENTRY_TERMINATOR { false, 0, NULL, 0, 0, 0, NULL, NULL }
-
-struct SciScriptPatcherSelector {
- const char *name;
- int16 id;
-};
-
-SciScriptPatcherSelector selectorTable[] = {
- { "cycles", -1, }, // system selector
- { "seconds", -1, }, // system selector
- { "init", -1, }, // system selector
- { "dispose", -1, }, // system selector
- { "new", -1, }, // system selector
- { "curEvent", -1, }, // system selector
- { "disable", -1, }, // system selector
- { "show", -1, }, // system selector
- { "x", -1, }, // system selector
- { "cel", -1, }, // system selector
- { "setMotion", -1, }, // system selector
- { "deskSarg", -1, }, // Gabriel Knight
- { "localize", -1, }, // Freddy Pharkas
- { "put", -1, }, // Police Quest 1 VGA
- { "solvePuzzle", -1, }, // Quest For Glory 3
- { "timesShownID", -1, }, // Space Quest 1 VGA
- { "startText", -1, }, // King's Quest 6 CD / Laura Bow 2 CD for audio+text support
- { "startAudio", -1, }, // King's Quest 6 CD / Laura Bow 2 CD for audio+text support
- { "modNum", -1, }, // King's Quest 6 CD / Laura Bow 2 CD for audio+text support
- { NULL, -1 }
+static const char *selectorNameTable[] = {
+ "cycles", // system selector
+ "seconds", // system selector
+ "init", // system selector
+ "dispose", // system selector
+ "new", // system selector
+ "curEvent", // system selector
+ "disable", // system selector
+ "show", // system selector
+ "x", // system selector
+ "cel", // system selector
+ "setMotion", // system selector
+ "deskSarg", // Gabriel Knight
+ "localize", // Freddy Pharkas
+ "put", // Police Quest 1 VGA
+ "solvePuzzle", // Quest For Glory 3
+ "timesShownID", // Space Quest 1 VGA
+ "startText", // King's Quest 6 CD / Laura Bow 2 CD for audio+text support
+ "startAudio", // King's Quest 6 CD / Laura Bow 2 CD for audio+text support
+ "modNum", // King's Quest 6 CD / Laura Bow 2 CD for audio+text support
+ NULL
};
enum ScriptPatcherSelectors {
@@ -209,9 +165,9 @@ const uint16 camelotPatchPeepingTom[] = {
PATCH_END
};
-// script, description, signature patch
+// script, description, signature patch
SciScriptPatcherEntry camelotSignatures[] = {
- { true, 62, "fix peepingTom Sierra bug", 1, 0, 0, camelotSignaturePeepingTom, camelotPatchPeepingTom },
+ { true, 62, "fix peepingTom Sierra bug", 1, camelotSignaturePeepingTom, camelotPatchPeepingTom },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -278,9 +234,9 @@ const uint16 ecoquest1PatchStayAndHelp[] = {
PATCH_END
};
-// script, description, signature patch
+// script, description, signature patch
SciScriptPatcherEntry ecoquest1Signatures[] = {
- { true, 660, "CD: bad messagebox and freeze", 1, 0, 0, ecoquest1SignatureStayAndHelp, ecoquest1PatchStayAndHelp },
+ { true, 660, "CD: bad messagebox and freeze", 1, ecoquest1SignatureStayAndHelp, ecoquest1PatchStayAndHelp },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -403,10 +359,10 @@ const uint16 ecoquest2PatchEcorderTutorial[] = {
PATCH_END
};
-// script, description, signature patch
+// script, description, signature patch
SciScriptPatcherEntry ecoquest2Signatures[] = {
- { true, 50, "initial text not removed on ecorder", 1, 0, 0, ecoquest2SignatureEcorder, ecoquest2PatchEcorder },
- { true, 333, "initial text not removed on ecorder tutorial",1, 0, 0, ecoquest2SignatureEcorderTutorial, ecoquest2PatchEcorderTutorial },
+ { true, 50, "initial text not removed on ecorder", 1, ecoquest2SignatureEcorder, ecoquest2PatchEcorder },
+ { true, 333, "initial text not removed on ecorder tutorial",1, ecoquest2SignatureEcorderTutorial, ecoquest2PatchEcorderTutorial },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -433,9 +389,9 @@ const uint16 fanmadePatchInfiniteLoop[] = {
PATCH_END
};
-// script, description, signature patch
+// script, description, signature patch
SciScriptPatcherEntry fanmadeSignatures[] = {
- { true, 999, "infinite loop on typo", 1, 0, 0, fanmadeSignatureInfiniteLoop, fanmadePatchInfiniteLoop },
+ { true, 999, "infinite loop on typo", 1, fanmadeSignatureInfiniteLoop, fanmadePatchInfiniteLoop },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -556,10 +512,10 @@ const uint16 freddypharkasPatchMacInventory[] = {
// script, description, signature patch
SciScriptPatcherEntry freddypharkasSignatures[] = {
- { true, 0, "CD: score early disposal", 1, 0, 0, freddypharkasSignatureScoreDisposal, freddypharkasPatchScoreDisposal },
- { true, 15, "Mac: broken inventory", 1, 0, 0, freddypharkasSignatureMacInventory, freddypharkasPatchMacInventory },
- { true, 235, "CD: canister pickup hang", 3, 0, 0, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang },
- { true, 320, "ladder event issue", 2, 0, 0, freddypharkasSignatureLadderEvent, freddypharkasPatchLadderEvent },
+ { true, 0, "CD: score early disposal", 1, freddypharkasSignatureScoreDisposal, freddypharkasPatchScoreDisposal },
+ { true, 15, "Mac: broken inventory", 1, freddypharkasSignatureMacInventory, freddypharkasPatchMacInventory },
+ { true, 235, "CD: canister pickup hang", 3, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang },
+ { true, 320, "ladder event issue", 2, freddypharkasSignatureLadderEvent, freddypharkasPatchLadderEvent },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -697,10 +653,10 @@ const uint16 gk1PatchInterrogationBug[] = {
// script, description, signature patch
SciScriptPatcherEntry gk1Signatures[] = {
- { true, 51, "interrogation bug", 1, 0, 0, gk1SignatureInterrogationBug, gk1PatchInterrogationBug },
- { true, 212, "day 5 phone freeze", 1, 0, 0, gk1SignatureDay5PhoneFreeze, gk1PatchDay5PhoneFreeze },
- { true, 230, "day 6 police beignet timer issue", 1, 0, 0, gk1SignatureDay6PoliceBeignet, gk1PatchDay6PoliceBeignet },
- { true, 230, "day 6 police sleep timer issue", 1, 0, 0, gk1SignatureDay6PoliceSleep, gk1PatchDay6PoliceSleep },
+ { true, 51, "interrogation bug", 1, gk1SignatureInterrogationBug, gk1PatchInterrogationBug },
+ { true, 212, "day 5 phone freeze", 1, gk1SignatureDay5PhoneFreeze, gk1PatchDay5PhoneFreeze },
+ { true, 230, "day 6 police beignet timer issue", 1, gk1SignatureDay6PoliceBeignet, gk1PatchDay6PoliceBeignet },
+ { true, 230, "day 6 police sleep timer issue", 1, gk1SignatureDay6PoliceSleep, gk1PatchDay6PoliceSleep },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -821,9 +777,9 @@ const uint16 kq5PatchWinGMSignals[] = {
// script, description, signature patch
SciScriptPatcherEntry kq5Signatures[] = {
- { true, 0, "CD: harpy volume change", 1, 0, 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume },
- { true, 200, "CD: witch cage init", 1, 0, 0, kq5SignatureWitchCageInit, kq5PatchWitchCageInit },
- { false, 124, "Win: GM Music signal checks", 4, 0, 0, kq5SignatureWinGMSignals, kq5PatchWinGMSignals },
+ { true, 0, "CD: harpy volume change", 1, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume },
+ { true, 200, "CD: witch cage init", 1, kq5SignatureWitchCageInit, kq5PatchWitchCageInit },
+ { false, 124, "Win: GM Music signal checks", 4, kq5SignatureWinGMSignals, kq5PatchWinGMSignals },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1019,19 +975,19 @@ const uint16 kq6laurabow2CDPatchAudioTextSupport5[] = {
PATCH_END
};
-// script, description, signature patch
+// script, description, signature patch
SciScriptPatcherEntry kq6Signatures[] = {
- { true, 481, "duplicate baby cry", 1, 0, 0, kq6SignatureDuplicateBabyCry, kq6PatchDuplicateBabyCry },
- { true, 907, "inventory stack fix", 1, 0, 0, kq6SignatureInventoryStackFix, kq6PatchInventoryStackFix },
+ { true, 481, "duplicate baby cry", 1, kq6SignatureDuplicateBabyCry, kq6PatchDuplicateBabyCry },
+ { true, 907, "inventory stack fix", 1, kq6SignatureInventoryStackFix, kq6PatchInventoryStackFix },
// King's Quest 6 and Laura Bow 2 share basic patches for audio + text support
// *** King's Quest 6 audio + text support - CURRENTLY DISABLED ***
// TODO: fix window placement (currently part of the text windows go off-screen)
// TODO: fix hi-res portraits mode graphic glitches
- { false, 924, "CD: audio + text support 1", 1, 0, 0, kq6laurabow2CDSignatureAudioTextSupport1, kq6laurabow2CDPatchAudioTextSupport1 },
- { false, 924, "CD: audio + text support 2", 1, 0, 0, kq6laurabow2CDSignatureAudioTextSupport2, kq6laurabow2CDPatchAudioTextSupport2 },
- { false, 924, "CD: audio + text support 3", 1, 0, 0, kq6laurabow2CDSignatureAudioTextSupport3, kq6laurabow2CDPatchAudioTextSupport3 },
- { false, 928, "CD: audio + text support 4", 1, 0, 0, kq6laurabow2CDSignatureAudioTextSupport4, kq6laurabow2CDPatchAudioTextSupport4 },
- { false, 928, "CD: audio + text support 5", 2, 0, 0, kq6laurabow2CDSignatureAudioTextSupport5, kq6laurabow2CDPatchAudioTextSupport5 },
+ { false, 924, "CD: audio + text support 1", 1, kq6laurabow2CDSignatureAudioTextSupport1, kq6laurabow2CDPatchAudioTextSupport1 },
+ { false, 924, "CD: audio + text support 2", 1, kq6laurabow2CDSignatureAudioTextSupport2, kq6laurabow2CDPatchAudioTextSupport2 },
+ { false, 924, "CD: audio + text support 3", 1, kq6laurabow2CDSignatureAudioTextSupport3, kq6laurabow2CDPatchAudioTextSupport3 },
+ { false, 928, "CD: audio + text support 4", 1, kq6laurabow2CDSignatureAudioTextSupport4, kq6laurabow2CDPatchAudioTextSupport4 },
+ { false, 928, "CD: audio + text support 5", 2, kq6laurabow2CDSignatureAudioTextSupport5, kq6laurabow2CDPatchAudioTextSupport5 },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1075,9 +1031,9 @@ const uint16 longbowPatchShowHandCode[] = {
PATCH_END
};
-// script, description, signature patch
+// script, description, signature patch
SciScriptPatcherEntry longbowSignatures[] = {
- { true, 210, "hand code crash", 5, 0, 0, longbowSignatureShowHandCode, longbowPatchShowHandCode },
+ { true, 210, "hand code crash", 5, longbowSignatureShowHandCode, longbowPatchShowHandCode },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1119,7 +1075,7 @@ const uint16 larry2PatchWearParachutePoints[] = {
// script, description, signature patch
SciScriptPatcherEntry larry2Signatures[] = {
- { true, 63, "plane: no points for wearing plane", 1, 0, 0, larry2SignatureWearParachutePoints, larry2PatchWearParachutePoints },
+ { true, 63, "plane: no points for wearing plane", 1, larry2SignatureWearParachutePoints, larry2PatchWearParachutePoints },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1148,7 +1104,7 @@ const uint16 larry5PatchGermanEndingPattiTalker[] = {
// script, description, signature patch
SciScriptPatcherEntry larry5Signatures[] = {
- { true, 380, "German-only: Enlarge Patti Textbox", 1, 0, 0, larry5SignatureGermanEndingPattiTalker, larry5PatchGermanEndingPattiTalker },
+ { true, 380, "German-only: Enlarge Patti Textbox", 1, larry5SignatureGermanEndingPattiTalker, larry5PatchGermanEndingPattiTalker },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1199,7 +1155,7 @@ const uint16 larry6PatchDeathDialog[] = {
// script, description, signature patch
SciScriptPatcherEntry larry6Signatures[] = {
- { true, 82, "death dialog memory corruption", 1, 0, 0, larry6SignatureDeathDialog, larry6PatchDeathDialog },
+ { true, 82, "death dialog memory corruption", 1, larry6SignatureDeathDialog, larry6PatchDeathDialog },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1323,14 +1279,14 @@ const uint16 laurabow2CDPatchFixProblematicIconBar[] = {
// script, description, signature patch
SciScriptPatcherEntry laurabow2Signatures[] = {
- { true, 560, "CD: painting closing immediately", 1, 0, 0, laurabow2CDSignaturePaintingClosing, laurabow2CDPatchPaintingClosing },
- { true, 0, "CD: fix problematic icon bar", 1, 0, 0, laurabow2CDSignatureFixProblematicIconBar, laurabow2CDPatchFixProblematicIconBar },
+ { true, 560, "CD: painting closing immediately", 1, laurabow2CDSignaturePaintingClosing, laurabow2CDPatchPaintingClosing },
+ { true, 0, "CD: fix problematic icon bar", 1, laurabow2CDSignatureFixProblematicIconBar, laurabow2CDPatchFixProblematicIconBar },
// King's Quest 6 and Laura Bow 2 share basic patches for audio + text support
- { false, 924, "CD: audio + text support 1", 1, 0, 0, kq6laurabow2CDSignatureAudioTextSupport1, kq6laurabow2CDPatchAudioTextSupport1 },
- { false, 924, "CD: audio + text support 2", 1, 0, 0, kq6laurabow2CDSignatureAudioTextSupport2, kq6laurabow2CDPatchAudioTextSupport2 },
- { false, 924, "CD: audio + text support 3", 1, 0, 0, kq6laurabow2CDSignatureAudioTextSupport3, kq6laurabow2CDPatchAudioTextSupport3 },
- { false, 928, "CD: audio + text support 4", 1, 0, 0, kq6laurabow2CDSignatureAudioTextSupport4, kq6laurabow2CDPatchAudioTextSupport4 },
- { false, 928, "CD: audio + text support 5", 2, 0, 0, kq6laurabow2CDSignatureAudioTextSupport5, kq6laurabow2CDPatchAudioTextSupport5 },
+ { false, 924, "CD: audio + text support 1", 1, kq6laurabow2CDSignatureAudioTextSupport1, kq6laurabow2CDPatchAudioTextSupport1 },
+ { false, 924, "CD: audio + text support 2", 1, kq6laurabow2CDSignatureAudioTextSupport2, kq6laurabow2CDPatchAudioTextSupport2 },
+ { false, 924, "CD: audio + text support 3", 1, kq6laurabow2CDSignatureAudioTextSupport3, kq6laurabow2CDPatchAudioTextSupport3 },
+ { false, 928, "CD: audio + text support 4", 1, kq6laurabow2CDSignatureAudioTextSupport4, kq6laurabow2CDPatchAudioTextSupport4 },
+ { false, 928, "CD: audio + text support 5", 2, kq6laurabow2CDSignatureAudioTextSupport5, kq6laurabow2CDPatchAudioTextSupport5 },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1370,9 +1326,9 @@ const uint16 mothergoose256PatchSaveLimit[] = {
// script, description, signature patch
SciScriptPatcherEntry mothergoose256Signatures[] = {
- { true, 0, "replay save issue", 1, 0, 0, mothergoose256SignatureReplay, mothergoose256PatchReplay },
- { true, 0, "save limit dialog (SCI1.1)", 1, 0, 0, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit },
- { true, 994, "save limit dialog (SCI1)", 1, 0, 0, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit },
+ { true, 0, "replay save issue", 1, mothergoose256SignatureReplay, mothergoose256PatchReplay },
+ { true, 0, "save limit dialog (SCI1.1)", 1, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit },
+ { true, 994, "save limit dialog (SCI1)", 1, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1435,7 +1391,7 @@ const uint16 pq1vgaPatchPutGunInLockerBug[] = {
// script, description, signature patch
SciScriptPatcherEntry pq1vgaSignatures[] = {
- { true, 341, "put gun in locker bug", 1, 0, 0, pq1vgaSignaturePutGunInLockerBug, pq1vgaPatchPutGunInLockerBug },
+ { true, 341, "put gun in locker bug", 1, pq1vgaSignaturePutGunInLockerBug, pq1vgaPatchPutGunInLockerBug },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1633,14 +1589,14 @@ const uint16 qfg1vgaPatchFunnyRoomFix[] = {
// script, description, signature patch
SciScriptPatcherEntry qfg1vgaSignatures[] = {
- { true, 215, "fight event issue", 1, 0, 0, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents },
- { true, 216, "weapon master event issue", 1, 0, 0, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents },
- { true, 814, "window text temp space", 1, 0, 0, qfg1vgaSignatureTempSpace, qfg1vgaPatchTempSpace },
- { true, 814, "dialog header offset", 3, 0, 0, qfg1vgaSignatureDialogHeader, qfg1vgaPatchDialogHeader },
- { true, 331, "moving to crusher", 1, 0, 0, qfg1vgaSignatureMoveToCrusher, qfg1vgaPatchMoveToCrusher },
- { true, 41, "moving to castle gate", 1, 0, 0, qfg1vgaSignatureMoveToCastleGate, qfg1vgaPatchMoveToCastleGate },
- { true, 210, "cheetaur description fixed", 1, 0, 0, qfg1vgaSignatureCheetaurDescription, qfg1vgaPatchCheetaurDescription },
- { true, 96, "funny room script bug fixed", 1, 0, 0, qfg1vgaSignatureFunnyRoomFix, qfg1vgaPatchFunnyRoomFix },
+ { true, 215, "fight event issue", 1, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents },
+ { true, 216, "weapon master event issue", 1, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents },
+ { true, 814, "window text temp space", 1, qfg1vgaSignatureTempSpace, qfg1vgaPatchTempSpace },
+ { true, 814, "dialog header offset", 3, qfg1vgaSignatureDialogHeader, qfg1vgaPatchDialogHeader },
+ { true, 331, "moving to crusher", 1, qfg1vgaSignatureMoveToCrusher, qfg1vgaPatchMoveToCrusher },
+ { true, 41, "moving to castle gate", 1, qfg1vgaSignatureMoveToCastleGate, qfg1vgaPatchMoveToCastleGate },
+ { true, 210, "cheetaur description fixed", 1, qfg1vgaSignatureCheetaurDescription, qfg1vgaPatchCheetaurDescription },
+ { true, 96, "funny room script bug fixed", 1, qfg1vgaSignatureFunnyRoomFix, qfg1vgaPatchFunnyRoomFix },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1678,7 +1634,7 @@ const uint16 qfg2PatchImportDialog[] = {
// script, description, signature patch
SciScriptPatcherEntry qfg2Signatures[] = {
- { true, 944, "import dialog continuous calls", 1, 0, 0, qfg2SignatureImportDialog, qfg2PatchImportDialog },
+ { true, 944, "import dialog continuous calls", 1, qfg2SignatureImportDialog, qfg2PatchImportDialog },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1749,8 +1705,8 @@ const uint16 qfg3PatchWooDialog[] = {
// script, description, signature patch
SciScriptPatcherEntry qfg3Signatures[] = {
- { true, 944, "import dialog continuous calls", 1, 0, 0, qfg3SignatureImportDialog, qfg3PatchImportDialog },
- { true, 440, "dialog crash when asking about Woo", 1, 0, 0, qfg3SignatureWooDialog, qfg3PatchWooDialog },
+ { true, 944, "import dialog continuous calls", 1, qfg3SignatureImportDialog, qfg3PatchImportDialog },
+ { true, 440, "dialog crash when asking about Woo", 1, qfg3SignatureWooDialog, qfg3PatchWooDialog },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1870,10 +1826,10 @@ const uint16 sq4CdPatchTextOptions[] = {
// script, description, signature patch
SciScriptPatcherEntry sq4Signatures[] = {
- { true, 298, "Floppy: endless flight", 1, 0, 0, sq4FloppySignatureEndlessFlight, sq4FloppyPatchEndlessFlight },
- { true, 818, "CD: Speech and subtitles option", 1, 0, 0, sq4CdSignatureTextOptions, sq4CdPatchTextOptions },
- { true, 0, "CD: Babble icon speech and subtitles fix", 1, 0, 0, sq4CdSignatureBabbleIcon, sq4CdPatchBabbleIcon },
- { true, 818, "CD: Speech and subtitles option button", 1, 0, 0, sq4CdSignatureTextOptionsButton, sq4CdPatchTextOptionsButton },
+ { true, 298, "Floppy: endless flight", 1, sq4FloppySignatureEndlessFlight, sq4FloppyPatchEndlessFlight },
+ { true, 818, "CD: Speech and subtitles option", 1, sq4CdSignatureTextOptions, sq4CdPatchTextOptions },
+ { true, 0, "CD: Babble icon speech and subtitles fix", 1, sq4CdSignatureBabbleIcon, sq4CdPatchBabbleIcon },
+ { true, 818, "CD: Speech and subtitles option button", 1, sq4CdSignatureTextOptionsButton, sq4CdPatchTextOptionsButton },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1947,8 +1903,8 @@ const uint16 sq1vgaPatchEgoShowsCard[] = {
// script, description, signature patch
SciScriptPatcherEntry sq1vgaSignatures[] = {
- { true, 45, "Ulence Flats: timepod graphic glitch", 1, 0, 0, sq1vgaSignatureUlenceFlatsTimepodGfxGlitch, sq1vgaPatchUlenceFlatsTimepodGfxGlitch },
- { true, 58, "Sarien armory droid zapping ego first time", 1, 0, 0, sq1vgaSignatureEgoShowsCard, sq1vgaPatchEgoShowsCard },
+ { true, 45, "Ulence Flats: timepod graphic glitch", 1, sq1vgaSignatureUlenceFlatsTimepodGfxGlitch, sq1vgaPatchUlenceFlatsTimepodGfxGlitch },
+ { true, 58, "Sarien armory droid zapping ego first time", 1, sq1vgaSignatureEgoShowsCard, sq1vgaPatchEgoShowsCard },
SCI_SIGNATUREENTRY_TERMINATOR};
// ===========================================================================
@@ -2005,13 +1961,31 @@ const uint16 sq5PatchToolboxFix[] = {
// script, description, signature patch
SciScriptPatcherEntry sq5Signatures[] = {
- { true, 226, "toolbox fix", 1, 0, 0, sq5SignatureToolboxFix, sq5PatchToolboxFix },
+ { true, 226, "toolbox fix", 1, sq5SignatureToolboxFix, sq5PatchToolboxFix },
SCI_SIGNATUREENTRY_TERMINATOR
};
+// =================================================================================
+
+ScriptPatcher::ScriptPatcher() {
+ int selectorCount = ARRAYSIZE(selectorNameTable);
+ int selectorNr;
+
+ // Allocate table for selector-IDs and initialize that table as well
+ _selectorIdTable = new Selector[ selectorCount ];
+ for (selectorNr = 0; selectorNr < selectorCount; selectorNr++)
+ _selectorIdTable[selectorNr] = -1;
+
+ _runtimeTable = NULL;
+}
+
+ScriptPatcher::~ScriptPatcher() {
+ delete[] _runtimeTable;
+ delete[] _selectorIdTable;
+}
// will actually patch previously found signature area
-void Script::patcherApplyPatch(const SciScriptPatcherEntry *patchEntry, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, const bool isMacSci11) {
+void ScriptPatcher::applyPatch(const SciScriptPatcherEntry *patchEntry, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, const bool isMacSci11) {
const uint16 *patchData = patchEntry->patchData;
byte orgData[PATCH_VALUELIMIT];
int32 offset = signatureOffset;
@@ -2067,7 +2041,7 @@ void Script::patcherApplyPatch(const SciScriptPatcherEntry *patchEntry, byte *sc
break;
}
case PATCH_SELECTOR16: {
- patchSelector = selectorTable[patchValue].id;
+ patchSelector = _selectorIdTable[patchValue];
byte1 = patchSelector & 0xFF;
byte2 = patchSelector >> 8;
break;
@@ -2086,7 +2060,7 @@ void Script::patcherApplyPatch(const SciScriptPatcherEntry *patchEntry, byte *sc
break;
}
case PATCH_SELECTOR8: {
- patchSelector = selectorTable[patchValue].id;
+ patchSelector = _selectorIdTable[patchValue];
if (patchSelector & 0xFF00)
error("Script-Patcher: 8 bit selector required, game uses 16 bit selector");
scriptData[offset] = patchSelector & 0xFF;
@@ -2103,18 +2077,18 @@ void Script::patcherApplyPatch(const SciScriptPatcherEntry *patchEntry, byte *sc
}
// will return -1 if no match was found, otherwise an offset to the start of the signature match
-int32 Script::patcherFindSignature(const SciScriptPatcherEntry *patchEntry, const byte *scriptData, const uint32 scriptSize, const bool isMacSci11) {
+int32 ScriptPatcher::findSignature(const SciScriptPatcherEntry *patchEntry, SciScriptPatcherRuntimeEntry *runtimeEntry, const byte *scriptData, const uint32 scriptSize, const bool isMacSci11) {
if (scriptSize < 4) // we need to find a DWORD, so less than 4 bytes is not okay
return -1;
- const uint32 magicDWord = patchEntry->magicDWord; // is platform-specific BE/LE form, so that the later match will work
+ const uint32 magicDWord = runtimeEntry->magicDWord; // is platform-specific BE/LE form, so that the later match will work
const uint32 searchLimit = scriptSize - 3;
uint32 DWordOffset = 0;
// first search for the magic DWORD
while (DWordOffset < searchLimit) {
if (magicDWord == READ_UINT32(scriptData + DWordOffset)) {
// magic DWORD found, check if actual signature matches
- uint32 offset = DWordOffset + patchEntry->magicOffset;
+ uint32 offset = DWordOffset + runtimeEntry->magicOffset;
uint32 byteOffset = offset;
const uint16 *signatureData = patchEntry->signatureData;
uint16 sigSelector = 0;
@@ -2145,7 +2119,7 @@ int32 Script::patcherFindSignature(const SciScriptPatcherEntry *patchEntry, cons
break;
}
case SIG_SELECTOR16: {
- sigSelector = selectorTable[sigValue].id;
+ sigSelector = _selectorIdTable[sigValue];
byte1 = sigSelector & 0xFF;
byte2 = sigSelector >> 8;
break;
@@ -2169,7 +2143,7 @@ int32 Script::patcherFindSignature(const SciScriptPatcherEntry *patchEntry, cons
}
case SIG_SELECTOR8: {
if (byteOffset < scriptSize) {
- sigSelector = selectorTable[sigValue].id;
+ sigSelector = _selectorIdTable[sigValue];
if (sigSelector & 0xFF00)
error("Script-Patcher: 8 bit selector required, game uses 16 bit selector\nFaulty patch: '%s'", patchEntry->description);
if (scriptData[byteOffset] != (sigSelector & 0xFF))
@@ -2208,9 +2182,10 @@ int32 Script::patcherFindSignature(const SciScriptPatcherEntry *patchEntry, cons
// This method calculates the magic DWORD for each entry in the signature table
// and it also initializes the selector table for selectors used in the signatures/patches of the current game
-void Script::patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacSci11) {
+void ScriptPatcher::initSignature(SciScriptPatcherEntry *patchTable, bool isMacSci11) {
SciScriptPatcherEntry *curEntry = patchTable;
- SciScriptPatcherSelector *curSelector = NULL;
+ SciScriptPatcherRuntimeEntry *curRuntimeEntry;
+ Selector curSelector = -1;
int step;
int magicOffset;
byte magicDWord[4];
@@ -2221,10 +2196,24 @@ void Script::patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacS
uint32 curValue;
byte byte1;
byte byte2;
+ int patchEntryCount = 0;
+
+ // Count entries and allocate runtime data
+ while (curEntry->signatureData) {
+ patchEntryCount++; curEntry++;
+ }
+ _runtimeTable = new SciScriptPatcherRuntimeEntry[patchEntryCount];
+ memset(_runtimeTable, 0, sizeof(SciScriptPatcherRuntimeEntry) * patchEntryCount);
+ curEntry = patchTable;
+ curRuntimeEntry = _runtimeTable;
while (curEntry->signatureData) {
// process signature
memset(magicDWord, 0, sizeof(magicDWord));
+
+ curRuntimeEntry->active = curEntry->defaultActive;
+ curRuntimeEntry->magicDWord = 0;
+ curRuntimeEntry->magicOffset = 0;
for (step = 0; step < 2; step++) {
switch (step) {
@@ -2240,10 +2229,10 @@ void Script::patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacS
switch (curCommand) {
case SIG_MAGICDWORD: {
if (step == 0) {
- if ((curEntry->magicDWord) || (magicDWordLeft))
+ if ((curRuntimeEntry->magicDWord) || (magicDWordLeft))
error("Script-Patcher: Magic-DWORD specified multiple times in signature\nFaulty patch: '%s'", curEntry->description);
magicDWordLeft = 4;
- curEntry->magicOffset = magicOffset;
+ curRuntimeEntry->magicOffset = magicOffset;
}
break;
}
@@ -2271,15 +2260,17 @@ void Script::patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacS
break;
}
case SIG_SELECTOR16: {
- curSelector = &selectorTable[curValue];
- if (curSelector->id == -1)
- curSelector->id = g_sci->getKernel()->findSelector(curSelector->name);
+ curSelector = _selectorIdTable[curValue];
+ if (curSelector == -1) {
+ curSelector = g_sci->getKernel()->findSelector(selectorNameTable[curValue]);
+ _selectorIdTable[curValue] = curSelector;
+ }
if (!isMacSci11) {
- byte1 = curSelector->id & 0x00FF;
- byte2 = curSelector->id >> 8;
+ byte1 = curSelector & 0x00FF;
+ byte2 = curSelector >> 8;
} else {
- byte1 = curSelector->id >> 8;
- byte2 = curSelector->id & 0x00FF;
+ byte1 = curSelector >> 8;
+ byte2 = curSelector & 0x00FF;
}
break;
}
@@ -2294,7 +2285,7 @@ void Script::patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacS
magicDWordLeft--;
}
if (!magicDWordLeft) {
- curEntry->magicDWord = READ_LE_UINT32(magicDWord);
+ curRuntimeEntry->magicDWord = READ_LE_UINT32(magicDWord);
}
}
break;
@@ -2302,15 +2293,16 @@ void Script::patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacS
case SIG_BYTE:
case SIG_SELECTOR8: {
if (curCommand == SIG_SELECTOR8) {
- curSelector = &selectorTable[curValue];
- if (curSelector->id == -1) {
- curSelector->id = g_sci->getKernel()->findSelector(curSelector->name);
- if (curSelector->id != -1) {
- if (curSelector->id & 0xFF00)
+ curSelector = _selectorIdTable[curValue];
+ if (curSelector == -1) {
+ curSelector = g_sci->getKernel()->findSelector(selectorNameTable[curValue]);
+ _selectorIdTable[curValue] = curSelector;
+ if (curSelector != -1) {
+ if (curSelector & 0xFF00)
error("Script-Patcher: 8 bit selector required, game uses 16 bit selector\nFaulty patch: '%s'", curEntry->description);
}
}
- curValue = curSelector->id;
+ curValue = curSelector;
}
magicOffset--;
if (magicDWordLeft) {
@@ -2318,7 +2310,7 @@ void Script::patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacS
magicDWord[4 - magicDWordLeft] = (byte)curValue;
magicDWordLeft--;
if (!magicDWordLeft) {
- curEntry->magicDWord = READ_LE_UINT32(magicDWord);
+ curRuntimeEntry->magicDWord = READ_LE_UINT32(magicDWord);
}
}
}
@@ -2329,35 +2321,38 @@ void Script::patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacS
}
if (magicDWordLeft)
error("Script-Patcher: Magic-DWORD beyond End-Of-Signature\nFaulty patch: '%s'", curEntry->description);
- if (!curEntry->magicDWord)
+ if (!curRuntimeEntry->magicDWord)
error("Script-Patcher: Magic-DWORD not specified in signature\nFaulty patch: '%s'", curEntry->description);
- curEntry++;
+ curEntry++; curRuntimeEntry++;
}
}
// This method enables certain patches
// It's used for patches, which are not meant to get applied all the time
-void Script::patcherEnablePatch(SciScriptPatcherEntry *patchTable, const char *searchDescription) {
+void ScriptPatcher::enablePatch(SciScriptPatcherEntry *patchTable, const char *searchDescription) {
SciScriptPatcherEntry *curEntry = patchTable;
+ SciScriptPatcherRuntimeEntry *runtimeEntry = _runtimeTable;
int searchDescriptionLen = strlen( searchDescription );
int matchCount = 0;
while (curEntry->signatureData) {
if (strncmp(curEntry->description, searchDescription, searchDescriptionLen) == 0) {
// match found, enable patch
- curEntry->active = true;
+ runtimeEntry->active = true;
matchCount++;
}
- curEntry++;
+ curEntry++; runtimeEntry++;
}
if (!matchCount)
error("Script-Patcher: no patch found to enable");
}
-void Script::patcherProcessScript(uint16 scriptNr, byte *scriptData, const uint32 scriptSize) {
+void ScriptPatcher::processScript(uint16 scriptNr, byte *scriptData, const uint32 scriptSize) {
SciScriptPatcherEntry *signatureTable = NULL;
+ SciScriptPatcherEntry *curEntry = NULL;
+ SciScriptPatcherRuntimeEntry *curRuntimeEntry = NULL;
const Sci::SciGameId gameId = g_sci->getGameId();
switch (gameId) {
@@ -2431,48 +2426,51 @@ void Script::patcherProcessScript(uint16 scriptNr, byte *scriptData, const uint3
if (signatureTable) {
bool isMacSci11 = (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_1_1);
- if (!signatureTable->magicDWord) {
+ if (!_runtimeTable) {
// Abort, in case selectors are not yet initialized (happens for games w/o selector-dictionary)
if (!g_sci->getKernel()->selectorNamesAvailable())
return;
// signature table needs to get initialized (Magic DWORD set, selector table set)
- patcherInitSignature(signatureTable, isMacSci11);
+ initSignature(signatureTable, isMacSci11);
// Do additional game-specific initialization
switch (gameId) {
case GID_KQ5:
if (g_sci->_features->useAltWinGMSound()) {
// See the explanation in the kq5SignatureWinGMSignals comment
- patcherEnablePatch(signatureTable, "Win: GM Music signal checks");
+ enablePatch(signatureTable, "Win: GM Music signal checks");
}
break;
case GID_LAURABOW2:
if (g_sci->speechAndSubtitlesEnabled()) {
// Enables Audio + subtitles patches for Laura Bow 2, when "Text and Speech: Both" is selected
- patcherEnablePatch(signatureTable, "CD: audio + text support");
+ enablePatch(signatureTable, "CD: audio + text support");
}
break;
default:
break;
}
}
+
+ curEntry = signatureTable;
+ curRuntimeEntry = _runtimeTable;
- while (signatureTable->signatureData) {
- if ( (scriptNr == signatureTable->scriptNr) && (signatureTable->active) ) {
+ while (curEntry->signatureData) {
+ if ( (scriptNr == curEntry->scriptNr) && (curRuntimeEntry->active) ) {
int32 foundOffset = 0;
- int16 applyCount = signatureTable->applyCount;
+ int16 applyCount = curEntry->applyCount;
do {
- foundOffset = patcherFindSignature(signatureTable, scriptData, scriptSize, isMacSci11);
+ foundOffset = findSignature(curEntry, curRuntimeEntry, scriptData, scriptSize, isMacSci11);
if (foundOffset != -1) {
// found, so apply the patch
- debugC(kDebugLevelScriptPatcher, "Script-Patcher: '%s' on script %d offset %d", signatureTable->description, scriptNr, foundOffset);
- patcherApplyPatch(signatureTable, scriptData, scriptSize, foundOffset, isMacSci11);
+ debugC(kDebugLevelScriptPatcher, "Script-Patcher: '%s' on script %d offset %d", curEntry->description, scriptNr, foundOffset);
+ applyPatch(curEntry, scriptData, scriptSize, foundOffset, isMacSci11);
}
applyCount--;
} while ((foundOffset != -1) && (applyCount));
}
- signatureTable++;
+ curEntry++; curRuntimeEntry++;
}
}
}
diff --git a/engines/sci/engine/script_patches.h b/engines/sci/engine/script_patches.h
new file mode 100644
index 0000000000..77cb2c7ef1
--- /dev/null
+++ b/engines/sci/engine/script_patches.h
@@ -0,0 +1,100 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SCI_ENGINE_SCRIPT_PATCHES_H
+#define SCI_ENGINE_SCRIPT_PATCHES_H
+
+#include "sci/sci.h"
+
+namespace Sci {
+
+#define SIG_END 0xFFFF
+#define SIG_MISMATCH 0xFFFE
+#define SIG_COMMANDMASK 0xF000
+#define SIG_VALUEMASK 0x0FFF
+#define SIG_BYTEMASK 0x00FF
+#define SIG_MAGICDWORD 0xF000
+#define SIG_ADDTOOFFSET 0xE000
+#define SIG_SELECTOR16 0x9000
+#define SIG_SELECTOR8 0x8000
+#define SIG_UINT16 0x1000
+#define SIG_BYTE 0x0000
+
+#define PATCH_END SIG_END
+#define PATCH_COMMANDMASK SIG_COMMANDMASK
+#define PATCH_VALUEMASK SIG_VALUEMASK
+#define PATCH_BYTEMASK SIG_BYTEMASK
+#define PATCH_ADDTOOFFSET SIG_ADDTOOFFSET
+#define PATCH_GETORIGINALBYTE 0xD000
+#define PATCH_GETORIGINALBYTEADJUST 0xC000
+#define PATCH_SELECTOR16 SIG_SELECTOR16
+#define PATCH_SELECTOR8 SIG_SELECTOR8
+#define PATCH_UINT16 SIG_UINT16
+#define PATCH_BYTE SIG_BYTE
+
+// defines maximum scratch area for getting original bytes from unpatched script data
+#define PATCH_VALUELIMIT 4096
+
+struct SciScriptPatcherEntry {
+ bool defaultActive;
+// bool active;
+ uint16 scriptNr;
+ const char *description;
+ int16 applyCount;
+// uint32 magicDWord;
+// int magicOffset;
+ const uint16 *signatureData;
+ const uint16 *patchData;
+};
+
+//#define SCI_SIGNATUREENTRY_TERMINATOR { false, 0, NULL, 0, 0, 0, NULL, NULL }
+#define SCI_SIGNATUREENTRY_TERMINATOR { false, 0, NULL, 0, NULL, NULL }
+
+struct SciScriptPatcherRuntimeEntry {
+ bool active;
+ uint32 magicDWord;
+ int magicOffset;
+};
+
+/**
+ * ScriptPatcher class, handles on-the-fly patching of script data
+ */
+class ScriptPatcher {
+public:
+ ScriptPatcher();
+ ~ScriptPatcher();
+
+ void processScript(uint16 scriptNr, byte *scriptData, const uint32 scriptSize);
+
+private:
+ void initSignature(SciScriptPatcherEntry *patchTable, bool isMacSci11);
+ void enablePatch(SciScriptPatcherEntry *patchTable, const char *searchDescription);
+ int32 findSignature(const SciScriptPatcherEntry *patchEntry, SciScriptPatcherRuntimeEntry *runtimeEntry, const byte *scriptData, const uint32 scriptSize, bool isMacSci11);
+ void applyPatch(const SciScriptPatcherEntry *patchEntry, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, bool isMacSci11);
+
+ Selector *_selectorIdTable;
+ SciScriptPatcherRuntimeEntry *_runtimeTable;
+};
+
+} // End of namespace Sci
+
+#endif // SCI_ENGINE_WORKAROUNDS_H
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index a059bee74e..161a4f5c79 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -28,7 +28,8 @@
namespace Sci {
-SegManager::SegManager(ResourceManager *resMan) {
+SegManager::SegManager(ResourceManager *resMan, ScriptPatcher *scriptPatcher)
+ : _resMan(resMan), _scriptPatcher(scriptPatcher) {
_heap.push_back(0);
_clonesSegId = 0;
@@ -44,8 +45,6 @@ SegManager::SegManager(ResourceManager *resMan) {
_stringSegId = 0;
#endif
- _resMan = resMan;
-
createClassTable();
}
@@ -983,7 +982,7 @@ int SegManager::instantiateScript(int scriptNum) {
scr = allocateScript(scriptNum, &segmentId);
}
- scr->load(scriptNum, _resMan);
+ scr->load(scriptNum, _resMan, _scriptPatcher);
scr->initializeLocals(this);
scr->initializeClasses(this);
scr->initializeObjects(this, segmentId);
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index 0667b75651..b587f4991a 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -49,7 +49,7 @@ public:
/**
* Initialize the segment manager.
*/
- SegManager(ResourceManager *resMan);
+ SegManager(ResourceManager *resMan, ScriptPatcher *scriptPatcher);
/**
* Deallocate all memory associated with the segment manager.
@@ -448,6 +448,7 @@ private:
Common::HashMap<int, SegmentId> _scriptSegMap;
ResourceManager *_resMan;
+ ScriptPatcher *_scriptPatcher;
SegmentId _clonesSegId; ///< ID of the (a) clones segment
SegmentId _listsSegId; ///< ID of the (a) list segment
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 065565d8de..69a7c0bc56 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -38,6 +38,7 @@
#include "sci/engine/state.h"
#include "sci/engine/kernel.h"
#include "sci/engine/script.h" // for script_adjust_opcode_formats
+#include "sci/engine/script_patches.h"
#include "sci/engine/selector.h" // for SELECTOR
#include "sci/sound/audio.h"
@@ -184,6 +185,7 @@ SciEngine::~SciEngine() {
delete[] _opcode_formats;
+ delete _scriptPatcher;
delete _resMan; // should be deleted last
g_sci = 0;
}
@@ -217,8 +219,9 @@ Common::Error SciEngine::run() {
// Add the after market GM patches for the specified game, if they exist
_resMan->addNewGMPatch(_gameId);
_gameObjectAddress = _resMan->findGameObject();
-
- SegManager *segMan = new SegManager(_resMan);
+
+ _scriptPatcher = new ScriptPatcher();
+ SegManager *segMan = new SegManager(_resMan, _scriptPatcher);
// Initialize the game screen
_gfxScreen = new GfxScreen(_resMan);
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index c91606fbc9..418f8c5e50 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -55,6 +55,7 @@ class AudioPlayer;
class SoundCommandParser;
class EventManager;
class SegManager;
+class ScriptPatcher;
class GfxAnimate;
class GfxCache;
@@ -269,6 +270,7 @@ public:
bool hasMacIconBar() const;
inline ResourceManager *getResMan() const { return _resMan; }
+ inline ScriptPatcher *getScriptPatcher() const { return _scriptPatcher; }
inline Kernel *getKernel() const { return _kernel; }
inline EngineState *getEngineState() const { return _gamestate; }
inline Vocabulary *getVocabulary() const { return _vocabulary; }
@@ -400,6 +402,7 @@ private:
const ADGameDescription *_gameDescription;
const SciGameId _gameId;
ResourceManager *_resMan; /**< The resource manager */
+ ScriptPatcher *_scriptPatcher; /**< The script patcher */
EngineState *_gamestate;
Kernel *_kernel;
Vocabulary *_vocabulary;
diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp
index 043b18b8c5..6b6f4a5cd3 100644
--- a/engines/tinsel/scene.cpp
+++ b/engines/tinsel/scene.cpp
@@ -130,14 +130,14 @@ const SCENE_STRUC *GetSceneStruc(const byte *pStruc) {
const byte *p = pStruc;
memset(&g_tempStruc, 0, sizeof(SCENE_STRUC));
- g_tempStruc.numEntrance = READ_32(p); p += sizeof(uint32);
- g_tempStruc.numPoly = READ_32(p); p += sizeof(uint32);
- g_tempStruc.numTaggedActor = READ_32(p); p += sizeof(uint32);
- g_tempStruc.defRefer = READ_32(p); p += sizeof(uint32);
- g_tempStruc.hSceneScript = READ_32(p); p += sizeof(uint32);
- g_tempStruc.hEntrance = READ_32(p); p += sizeof(uint32);
- g_tempStruc.hPoly = READ_32(p); p += sizeof(uint32);
- g_tempStruc.hTaggedActor = READ_32(p); p += sizeof(uint32);
+ g_tempStruc.numEntrance = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.numPoly = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.numTaggedActor = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.defRefer = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.hSceneScript = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.hEntrance = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.hPoly = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.hTaggedActor = READ_UINT32(p); p += sizeof(uint32);
return &g_tempStruc;
}
@@ -168,7 +168,7 @@ static void SceneTinselProcess(CORO_PARAM, const void *param) {
assert(_ctx->pInit->hTinselCode); // Must have some code to run
_ctx->pic = InitInterpretContext(GS_SCENE,
- _ctx->pInit->hTinselCode,
+ FROM_32(_ctx->pInit->hTinselCode),
TinselV2 ? _ctx->pInit->event : NOEVENT,
NOPOLY, // No polygon
0, // No actor
@@ -210,7 +210,7 @@ void SendSceneTinselProcess(TINSEL_EVENT event) {
*/
static void LoadScene(SCNHANDLE scene, int entry) {
- int32 i;
+ uint32 i;
TP_INIT init;
const SCENE_STRUC *ss;
const ENTRANCE_STRUC *es;
@@ -239,17 +239,17 @@ static void LoadScene(SCNHANDLE scene, int entry) {
// Music stuff
char *cptr = (char *)FindChunk(scene, CHUNK_MUSIC_FILENAME);
assert(cptr);
- _vm->_pcmMusic->setMusicSceneDetails(ss->hMusicScript, ss->hMusicSegment, cptr);
+ _vm->_pcmMusic->setMusicSceneDetails(FROM_32(ss->hMusicScript), FROM_32(ss->hMusicSegment), cptr);
}
if (entry == NO_ENTRY_NUM) {
// Restoring scene
// Initialize all the polygons for this scene
- InitPolygons(ss->hPoly, ss->numPoly, true);
+ InitPolygons(FROM_32(ss->hPoly), FROM_32(ss->numPoly), true);
// Initialize the actors for this scene
- StartTaggedActors(ss->hTaggedActor, ss->numTaggedActor, false);
+ StartTaggedActors(FROM_32(ss->hTaggedActor), FROM_32(ss->numTaggedActor), false);
if (TinselV2)
// Returning from cutscene
@@ -259,18 +259,18 @@ static void LoadScene(SCNHANDLE scene, int entry) {
// Genuine new scene
// Initialize all the polygons for this scene
- InitPolygons(ss->hPoly, ss->numPoly, false);
+ InitPolygons(FROM_32(ss->hPoly), FROM_32(ss->numPoly), false);
// Initialize the actors for this scene
- StartTaggedActors(ss->hTaggedActor, ss->numTaggedActor, true);
+ StartTaggedActors(FROM_32(ss->hTaggedActor), FROM_32(ss->numTaggedActor), true);
// Run the appropriate entrance code (if any)
- es = (const ENTRANCE_STRUC *)LockMem(ss->hEntrance);
- for (i = 0; i < ss->numEntrance; i++) {
+ es = (const ENTRANCE_STRUC *)LockMem(FROM_32(ss->hEntrance));
+ for (i = 0; i < FROM_32(ss->numEntrance); i++) {
if (FROM_32(es->eNumber) == (uint)entry) {
if (es->hScript) {
init.event = STARTUP;
- init.hTinselCode = FROM_32(es->hScript);
+ init.hTinselCode = es->hScript;
CoroScheduler.createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
}
@@ -285,7 +285,7 @@ static void LoadScene(SCNHANDLE scene, int entry) {
}
- if (i == ss->numEntrance)
+ if (i == FROM_32(ss->numEntrance))
error("Non-existent scene entry number");
if (ss->hSceneScript) {
@@ -297,10 +297,10 @@ static void LoadScene(SCNHANDLE scene, int entry) {
}
// Default refer type
- SetDefaultRefer(ss->defRefer);
+ SetDefaultRefer(FROM_32(ss->defRefer));
// Scene's processes
- SceneProcesses(ss->numProcess, ss->hProcess);
+ SceneProcesses(FROM_32(ss->numProcess), FROM_32(ss->hProcess));
}
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 596f056bfe..0b3eb53268 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -2888,6 +2888,8 @@ void BackgroundSceneObject::setup2(int visage, int stripFrameNum, int frameNum,
setFrame(frameNum);
setPosition(Common::Point(posX, posY));
fixPriority(priority);
+
+ _effect = effect;
}
void BackgroundSceneObject::copySceneToBackground() {
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index d174d6fa4d..65ea8ad6a7 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -876,8 +876,8 @@ void Scene1100::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player._moveRate = 30;
R2_GLOBALS._player._moveDiff = Common::Point(16, 2);
- _rightLandslide.setup2(1104, 2, 1, 175, 125, 102, 1);
- _purplePlant.setup2(1102, 5, 1, 216, 167, 1, 0);
+ _rightLandslide.setup2(1104, 2, 1, 175, 125, 102, EFFECT_SHADED);
+ _purplePlant.setup2(1102, 5, 1, 216, 167, 1, EFFECT_NONE);
_leftImpacts.postInit();
_leftImpacts.setup(1113, 2, 1);
@@ -2212,31 +2212,41 @@ void Scene1200::startCrawling(CrawlDirection dir) {
*
*--------------------------------------------------------------------------*/
-Scene1337::unkObj1337sub1::unkObj1337sub1() {
+Scene1337::Card::Card() {
_cardId = 0;
_stationPos = Common::Point(0, 0);
}
-void Scene1337::unkObj1337sub1::synchronize(Serializer &s) {
- warning("STUBBED: unkObj1337sub1::synchronize()");
+void Scene1337::Card::synchronize(Serializer &s) {
+ warning("STUBBED: Card::synchronize()");
}
-Scene1337::unkObj1337_1::unkObj1337_1() {
- _fieldB94 = Common::Point(0, 0);
- _fieldB98 = Common::Point(0, 0);
- _fieldB9C = Common::Point(0, 0);
- _fieldBA0 = Common::Point(0, 0);
- _fieldBA4 = 0;
+bool Scene1337::Card::isIn(Common::Point pt) {
+ if ((_stationPos.x > pt.x) || (_stationPos.x + 24 < pt.x))
+ return false;
+
+ if ((_stationPos.y > pt.y) || (_stationPos.y + 24 < pt.y))
+ return false;
+
+ return true;
+}
+
+Scene1337::GameBoardSide::GameBoardSide() {
+ _card1Pos = Common::Point(0, 0);
+ _card2Pos = Common::Point(0, 0);
+ _card3Pos = Common::Point(0, 0);
+ _card4Pos = Common::Point(0, 0);
+ _frameNum = 0;
}
-void Scene1337::unkObj1337_1::synchronize(Serializer &s) {
- warning("STUBBED: unkObj1337_1::synchronize()");
+void Scene1337::GameBoardSide::synchronize(Serializer &s) {
+ warning("STUBBED: GameBoardSide::synchronize()");
}
Scene1337::Scene1337() {
_autoplay = false;
_cardsAvailableNumb = 0;
- _field3E26 = 0;
+ _currentDiscardIndex = 0;
for (int i = 0; i < 100; i++)
_availableCardsPile[i] = 0;
@@ -2248,11 +2258,11 @@ Scene1337::Scene1337() {
_field4244 = false;
_field4246 = false;
_field424A = 0;
- _instructionsDisplayedFl = 0;
+ _instructionsDisplayedFl = false;
_instructionsWaitCount = 0;
_unkFctPtr412 = nullptr;
- _field3EF0 = nullptr;
+ _discardCard = nullptr;
_field3EF4 = nullptr;
_field3EF8 = nullptr;
@@ -2455,7 +2465,7 @@ void Scene1337::Action1::signal() {
scene->_gameBoardSide[0]._outpostStation[0]._card.remove();
scene->_gameBoardSide[0]._outpostStation[1]._card.remove();
- scene->_background2.setup2(1332, 5, 1, 165, 95, 110, 1);
+ scene->_background2.setup2(1332, 5, 1, 165, 95, 110, EFFECT_SHADED);
scene->_gameBoardSide[1]._handCard[0]._card.postInit();
scene->_gameBoardSide[1]._handCard[0]._card.setVisage(1332);
@@ -2654,10 +2664,10 @@ void Scene1337::Action1::signal() {
waitFrames(60);
scene->actionDisplay(1331, 14, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- scene->_gameBoardSide[2]._delayPile[0]._card.postInit();
- scene->_gameBoardSide[2]._delayPile[0]._card.setVisage(1332);
- scene->_gameBoardSide[2]._delayPile[0]._card.setPosition(scene->_gameBoardSide[2]._delayPile[0]._stationPos, 0);
- scene->_gameBoardSide[2]._delayPile[0]._card.hide();
+ scene->_gameBoardSide[2]._delayCard._card.postInit();
+ scene->_gameBoardSide[2]._delayCard._card.setVisage(1332);
+ scene->_gameBoardSide[2]._delayCard._card.setPosition(scene->_gameBoardSide[2]._delayCard._stationPos, 0);
+ scene->_gameBoardSide[2]._delayCard._card.hide();
scene->_gameBoardSide[3]._handCard[2]._cardId = 0;
scene->_gameBoardSide[3]._handCard[2].remove();
@@ -2666,13 +2676,13 @@ void Scene1337::Action1::signal() {
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
- scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[2]._delayPile[0]._stationPos, this);
+ scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[2]._delayCard._stationPos, this);
}
break;
case 6: {
scene->_animatedCard._card.hide();
- scene->_gameBoardSide[2]._delayPile[0]._cardId = 21;
- scene->setAnimationInfo(&scene->_gameBoardSide[2]._delayPile[0]);
+ scene->_gameBoardSide[2]._delayCard._cardId = 21;
+ scene->setAnimationInfo(&scene->_gameBoardSide[2]._delayCard);
scene->_aSound1.play(57);
R2_GLOBALS._sceneObjects->draw();
@@ -2731,12 +2741,12 @@ void Scene1337::Action1::signal() {
scene->_lowerDisplayCard[6].remove();
scene->_lowerDisplayCard[7].remove();
- scene->_discardPile._cardId = scene->_gameBoardSide[2]._delayPile[0]._cardId;
+ scene->_discardPile._cardId = scene->_gameBoardSide[2]._delayCard._cardId;
- scene->_gameBoardSide[2]._delayPile[0]._cardId = 0;
- scene->_gameBoardSide[2]._delayPile[0]._card.remove();
+ scene->_gameBoardSide[2]._delayCard._cardId = 0;
+ scene->_gameBoardSide[2]._delayCard._card.remove();
- scene->_animatedCard._card.setPosition(scene->_gameBoardSide[2]._delayPile[0]._stationPos, 0);
+ scene->_animatedCard._card.setPosition(scene->_gameBoardSide[2]._delayCard._stationPos, 0);
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
@@ -2750,10 +2760,10 @@ void Scene1337::Action1::signal() {
R2_GLOBALS._sceneObjects->draw();
- scene->_gameBoardSide[2]._delayPile[0]._card.postInit();
- scene->_gameBoardSide[2]._delayPile[0]._card.setVisage(1332);
- scene->_gameBoardSide[2]._delayPile[0]._card.setPosition(scene->_gameBoardSide[2]._delayPile[0]._stationPos, 0);
- scene->_gameBoardSide[2]._delayPile[0]._card.hide();
+ scene->_gameBoardSide[2]._delayCard._card.postInit();
+ scene->_gameBoardSide[2]._delayCard._card.setVisage(1332);
+ scene->_gameBoardSide[2]._delayCard._card.setPosition(scene->_gameBoardSide[2]._delayCard._stationPos, 0);
+ scene->_gameBoardSide[2]._delayCard._card.hide();
scene->_gameBoardSide[3]._handCard[1]._cardId = 0;
scene->_gameBoardSide[3]._handCard[1].remove();
@@ -2762,13 +2772,13 @@ void Scene1337::Action1::signal() {
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
- scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[2]._delayPile[0]._stationPos, this);
+ scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[2]._delayCard._stationPos, this);
}
break;
case 8: {
scene->_animatedCard._card.hide();
- scene->_gameBoardSide[2]._delayPile[0]._cardId = 14;
- scene->setAnimationInfo(&scene->_gameBoardSide[2]._delayPile[0]);
+ scene->_gameBoardSide[2]._delayCard._cardId = 14;
+ scene->setAnimationInfo(&scene->_gameBoardSide[2]._delayCard);
scene->_aSound1.play(57);
R2_GLOBALS._sceneObjects->draw();
@@ -2861,17 +2871,17 @@ void Scene1337::Action1::signal() {
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
- scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[2]._delayPile[0]._stationPos, this);
+ scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[2]._delayCard._stationPos, this);
}
break;
case 9: {
scene->_aSound1.play(58);
- scene->_gameBoardSide[2]._delayPile[0]._cardId = 0;
- scene->_gameBoardSide[2]._delayPile[0].remove();
+ scene->_gameBoardSide[2]._delayCard._cardId = 0;
+ scene->_gameBoardSide[2]._delayCard.remove();
scene->_animatedCard._card.setStrip(5);
scene->_animatedCard._card.setFrame(1);
scene->_animatedCard._card.animate(ANIM_MODE_2, NULL);
- scene->_animatedCard._card.setPosition(scene->_gameBoardSide[2]._delayPile[0]._stationPos, 0);
+ scene->_animatedCard._card.setPosition(scene->_gameBoardSide[2]._delayCard._stationPos, 0);
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
@@ -3026,8 +3036,8 @@ void Scene1337::Action1::signal() {
scene->_gameBoardSide[1]._outpostStation[i]._card.remove();
}
- scene->_gameBoardSide[2]._delayPile[0]._cardId = 0;
- scene->_gameBoardSide[2]._delayPile[0]._card.remove();
+ scene->_gameBoardSide[2]._delayCard._cardId = 0;
+ scene->_gameBoardSide[2]._delayCard._card.remove();
scene->_discardPile._cardId = 0;
scene->_discardPile._card.remove();
@@ -3083,7 +3093,7 @@ void Scene1337::Action2::signal() {
break;
case 3:
scene->_shuffleAnimation._card.remove();
- scene->_background2.setup2(1332, 5, 1, 162, 95, 110, 1);
+ scene->_background2.setup2(1332, 5, 1, 162, 95, 110, EFFECT_SHADED);
scene->_shuffleEndedFl = true;
break;
default:
@@ -3091,6 +3101,9 @@ void Scene1337::Action2::signal() {
}
}
+/**
+ * Deal cards
+ */
void Scene1337::Action3::signal() {
Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
@@ -3343,7 +3356,7 @@ void Scene1337::Action3::signal() {
scene->_gameBoardSide[0]._handCard[2]._card.setStrip(5);
scene->_gameBoardSide[0]._handCard[2]._card.setFrame(1);
scene->_gameBoardSide[0]._handCard[2]._card.fixPriority(170);
- scene->_gameBoardSide[0]._handCard[2]._card.hide();
+ scene->_animatedCard._card.hide();
default:
break;
}
@@ -3364,15 +3377,15 @@ void Scene1337::Action4::signal() {
switch (_actionIndex++) {
case 0:
- if ((scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._cardId == 0) && (scene->subC264B(scene->_gameBoardSide[scene->_currentPlayerNumb]._delayPile[0]._cardId))) {
+ if ((scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._cardId == 0) && (scene->subC264B(scene->_gameBoardSide[scene->_currentPlayerNumb]._delayCard._cardId))) {
if (scene->_cardsAvailableNumb < 0)
- scene->subC264B(scene->_gameBoardSide[scene->_currentPlayerNumb]._delayPile[0]._cardId);
+ scene->shuffleCards();
scene->_animatedCard._card.setPosition(Common::Point(162, 95), 0);
scene->_animatedCard._card.show();
scene->_aSound2.play(61);
NpcMover *mover = new NpcMover();
- scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldB94, this);
+ scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[scene->_currentPlayerNumb]._card1Pos, this);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._cardId = scene->_availableCardsPile[scene->_cardsAvailableNumb];
scene->_availableCardsPile[scene->_cardsAvailableNumb] = 0;
@@ -3386,14 +3399,14 @@ void Scene1337::Action4::signal() {
}
break;
case 1:
- if ( ( scene->_animatedCard._card._position.x == scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldB94.x)
- && ( scene->_animatedCard._card._position.y == scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldB94.y) ) {
+ if ( ( scene->_animatedCard._card._position.x == scene->_gameBoardSide[scene->_currentPlayerNumb]._card1Pos.x)
+ && ( scene->_animatedCard._card._position.y == scene->_gameBoardSide[scene->_currentPlayerNumb]._card1Pos.y) ) {
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._card.postInit();
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._card._moveDiff = Common::Point(30, 30);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._card.setVisage(1332);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._card.setPosition(scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._stationPos, 0);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._card.setStrip(1);
- scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._card.setFrame(scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldBA4);
+ scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._card.setFrame(scene->_gameBoardSide[scene->_currentPlayerNumb]._frameNum);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._card.fixPriority(170);
}
@@ -3401,7 +3414,7 @@ void Scene1337::Action4::signal() {
scene->setAnimationInfo(&scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]);
scene->_animatedCard._card.hide();
- if ((scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._cardId == 0) && (scene->subC264B(scene->_gameBoardSide[scene->_currentPlayerNumb]._delayPile[0]._cardId == 0))) {
+ if ((scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[0]._cardId == 0) && (scene->subC264B(scene->_gameBoardSide[scene->_currentPlayerNumb]._delayCard._cardId == 0))) {
if (scene->_cardsAvailableNumb < 0)
scene->shuffleCards();
scene->_animatedCard._card.setPosition(Common::Point(162, 95));
@@ -3410,7 +3423,7 @@ void Scene1337::Action4::signal() {
scene->_aSound2.play(61);
NpcMover *mover = new NpcMover();
- scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldB98, this);
+ scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[scene->_currentPlayerNumb]._card2Pos, this);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]._cardId = scene->_availableCardsPile[scene->_cardsAvailableNumb];
scene->_availableCardsPile[scene->_cardsAvailableNumb] = 0;
@@ -3421,14 +3434,14 @@ void Scene1337::Action4::signal() {
signal();
break;
case 2:
- if ( ( scene->_animatedCard._card._position.x == scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldB98.x)
- && ( scene->_animatedCard._card._position.y == scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldB98.y) ) {
+ if ( ( scene->_animatedCard._card._position.x == scene->_gameBoardSide[scene->_currentPlayerNumb]._card2Pos.x)
+ && ( scene->_animatedCard._card._position.y == scene->_gameBoardSide[scene->_currentPlayerNumb]._card2Pos.y) ) {
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]._card.postInit();
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]._card._moveDiff = Common::Point(30, 30);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]._card.setVisage(1332);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]._card.setPosition(scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]._stationPos, 0);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]._card.setStrip(1);
- scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]._card.setFrame(scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldBA4);
+ scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]._card.setFrame(scene->_gameBoardSide[scene->_currentPlayerNumb]._frameNum);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]._card.fixPriority(170);
}
@@ -3436,7 +3449,7 @@ void Scene1337::Action4::signal() {
scene->setAnimationInfo(&scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[1]);
scene->_animatedCard._card.hide();
- if ((scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._cardId == 0) && (scene->subC264B(scene->_gameBoardSide[scene->_currentPlayerNumb]._delayPile[0]._cardId == 0))) {
+ if ((scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._cardId == 0) && (scene->subC264B(scene->_gameBoardSide[scene->_currentPlayerNumb]._delayCard._cardId == 0))) {
if (scene->_cardsAvailableNumb < 0)
scene->shuffleCards();
scene->_animatedCard._card.setPosition(Common::Point(162, 95));
@@ -3445,7 +3458,7 @@ void Scene1337::Action4::signal() {
scene->_aSound2.play(61);
NpcMover *mover = new NpcMover();
- scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldB9C, this);
+ scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[scene->_currentPlayerNumb]._card3Pos, this);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._cardId = scene->_availableCardsPile[scene->_cardsAvailableNumb];
scene->_availableCardsPile[scene->_cardsAvailableNumb] = 0;
@@ -3456,14 +3469,14 @@ void Scene1337::Action4::signal() {
signal();
break;
case 3:
- if ( ( scene->_animatedCard._card._position.x == scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldB9C.x)
- && ( scene->_animatedCard._card._position.y == scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldB9C.y) ) {
+ if ( ( scene->_animatedCard._card._position.x == scene->_gameBoardSide[scene->_currentPlayerNumb]._card3Pos.x)
+ && ( scene->_animatedCard._card._position.y == scene->_gameBoardSide[scene->_currentPlayerNumb]._card3Pos.y) ) {
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._card.postInit();
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._card._moveDiff = Common::Point(30, 30);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._card.setVisage(1332);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._card.setPosition(scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._stationPos, 0);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._card.setStrip(1);
- scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._card.setFrame(scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldBA4);
+ scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._card.setFrame(scene->_gameBoardSide[scene->_currentPlayerNumb]._frameNum);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]._card.fixPriority(170);
}
@@ -3471,7 +3484,7 @@ void Scene1337::Action4::signal() {
scene->setAnimationInfo(&scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[2]);
scene->_animatedCard._card.hide();
- if ((scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._cardId == 0) && (scene->subC264B(scene->_gameBoardSide[scene->_currentPlayerNumb]._delayPile[0]._cardId == 0))) {
+ if ((scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._cardId == 0) && (scene->subC264B(scene->_gameBoardSide[scene->_currentPlayerNumb]._delayCard._cardId == 0))) {
if (scene->_cardsAvailableNumb < 0)
scene->shuffleCards();
scene->_animatedCard._card.setPosition(Common::Point(162, 95));
@@ -3480,7 +3493,7 @@ void Scene1337::Action4::signal() {
scene->_aSound2.play(61);
NpcMover *mover = new NpcMover();
- scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldBA0, this);
+ scene->_animatedCard._card.addMover(mover, &scene->_gameBoardSide[scene->_currentPlayerNumb]._card4Pos, this);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._cardId = scene->_availableCardsPile[scene->_cardsAvailableNumb];
scene->_availableCardsPile[scene->_cardsAvailableNumb] = 0;
@@ -3491,14 +3504,14 @@ void Scene1337::Action4::signal() {
signal();
break;
case 4:
- if ( ( scene->_animatedCard._card._position.x == scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldBA0.x)
- && ( scene->_animatedCard._card._position.y == scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldBA0.y) ) {
+ if ( ( scene->_animatedCard._card._position.x == scene->_gameBoardSide[scene->_currentPlayerNumb]._card4Pos.x)
+ && ( scene->_animatedCard._card._position.y == scene->_gameBoardSide[scene->_currentPlayerNumb]._card4Pos.y) ) {
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._card.postInit();
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._card._moveDiff = Common::Point(30, 30);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._card.setVisage(1332);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._card.setPosition(scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._stationPos, 0);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._card.setStrip(1);
- scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._card.setFrame(scene->_gameBoardSide[scene->_currentPlayerNumb]._fieldBA4);
+ scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._card.setFrame(scene->_gameBoardSide[scene->_currentPlayerNumb]._frameNum);
scene->_gameBoardSide[scene->_currentPlayerNumb]._handCard[3]._card.fixPriority(170);
}
@@ -3533,8 +3546,8 @@ void Scene1337::Action5::signal() {
switch (_actionIndex++) {
case 0: {
- scene->_availableCardsPile[scene->_field3E26] = scene->_field3EF0->_cardId;
- scene->_field3E26--;
+ scene->_availableCardsPile[scene->_currentDiscardIndex] = scene->_discardCard->_cardId;
+ scene->_currentDiscardIndex--;
if (!g_globals->_sceneObjects->contains(&scene->_discardPile._card)) {
scene->_discardPile._card.postInit();
scene->_discardPile._card.hide();
@@ -3543,15 +3556,15 @@ void Scene1337::Action5::signal() {
scene->_discardPile._card.fixPriority(170);
}
- scene->_discardPile._cardId = scene->_field3EF0->_cardId;
- scene->_field3EF0->_cardId = 0;
- scene->_field3EF0->_card.remove();
+ scene->_discardPile._cardId = scene->_discardCard->_cardId;
+ scene->_discardCard->_cardId = 0;
+ scene->_discardCard->_card.remove();
- if (scene->_field3EF0 == &scene->_item6) {
+ if (scene->_discardCard == &scene->_selectedCard) {
scene->setCursorData(5, 1, 4);
scene->subC4CEC();
}
- scene->_animatedCard._card.setPosition(scene->_field3EF0->_stationPos, 0);
+ scene->_animatedCard._card.setPosition(scene->_discardCard->_stationPos, 0);
scene->_animatedCard._card.show();
Common::Point pt(128, 95);
NpcMover *mover = new NpcMover();
@@ -3581,10 +3594,10 @@ void Scene1337::Action6::signal() {
scene->_field3EF4->_card.setPosition(scene->_field3EF4->_stationPos);
scene->_field3EF4->_card.fixPriority(170);
- scene->_field3EF0->_cardId = 0;
- scene->_field3EF0->_card.remove();
+ scene->_discardCard->_cardId = 0;
+ scene->_discardCard->_card.remove();
- scene->_animatedCard._card.setPosition(scene->_field3EF0->_stationPos);
+ scene->_animatedCard._card.setPosition(scene->_discardCard->_stationPos);
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
@@ -3595,7 +3608,7 @@ void Scene1337::Action6::signal() {
scene->_animatedCard._card.hide();
scene->setAnimationInfo(scene->_field3EF4);
scene->_aSound1.play(59);
- if (scene->_field3EF0 == &scene->_item6) {
+ if (scene->_discardCard == &scene->_selectedCard) {
scene->setCursorData(5, 1, 4);
scene->subC4CEC();
}
@@ -3611,30 +3624,29 @@ void Scene1337::Action7::signal() {
switch (_actionIndex++) {
case 0: {
- scene->_field3EF4->_cardId = scene->_field3EF0->_cardId;
+ scene->_field3EF4->_cardId = scene->_discardCard->_cardId;
- scene->_field3EF0->_cardId = 0;
- scene->_field3EF0->_card.remove();
+ scene->_discardCard->_cardId = 0;
+ scene->_discardCard->_card.remove();
- scene->_animatedCard._card.setPosition(scene->_field3EF0->_stationPos, 0);
+ scene->_animatedCard._card.setPosition(scene->_discardCard->_stationPos, 0);
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
scene->_animatedCard._card.addMover(mover, &scene->_field3EF4->_stationPos, this);
}
break;
case 1:
- if (scene->_field3EF0 == &scene->_item6) {
+ if (scene->_discardCard == &scene->_selectedCard) {
scene->setCursorData(5, 1, 4);
scene->subC4CEC();
}
scene->setAnimationInfo(scene->_field3EF4);
scene->_aSound1.play(59);
scene->_item5._cardId = 1;
- scene->_item5._stationPos.x = scene->_field3EF4->_stationPos.x;
- scene->_item5._stationPos.y = scene->_field3EF4->_stationPos.y;
+ scene->_item5._stationPos = scene->_field3EF4->_stationPos;
scene->_item5._card.postInit();
scene->_item5._card.hide();
- scene->_item5._card._flags = 0x200;
+ scene->_item5._card._flags = OBJFLAG_HIDING;
scene->subC4A39(&scene->_item5);
break;
@@ -3648,13 +3660,13 @@ void Scene1337::Action8::signal() {
switch (_actionIndex++) {
case 0: {
- scene->_availableCardsPile[scene->_field3E26] = scene->_field3EF4->_cardId;
- scene->_field3E26--;
+ scene->_availableCardsPile[scene->_currentDiscardIndex] = scene->_field3EF4->_cardId;
+ scene->_currentDiscardIndex--;
- scene->_field3EF4->_cardId = scene->_field3EF0->_cardId;
- scene->_field3EF0->_card.remove();
+ scene->_field3EF4->_cardId = scene->_discardCard->_cardId;
+ scene->_discardCard->_card.remove();
- scene->_animatedCard._card.setPosition(scene->_field3EF0->_stationPos, 0);
+ scene->_animatedCard._card.setPosition(scene->_discardCard->_stationPos, 0);
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
@@ -3664,7 +3676,7 @@ void Scene1337::Action8::signal() {
case 1:
scene->_animatedCard._card.hide();
- if (scene->_field3EF0 == &scene->_item6) {
+ if (scene->_discardCard == &scene->_selectedCard) {
scene->setCursorData(5, 1, 4);
scene->subC4CEC();
}
@@ -3682,17 +3694,17 @@ void Scene1337::Action9::signal() {
switch (_actionIndex++) {
case 0: {
- scene->_field3EF4->_cardId = scene->_field3EF0->_cardId;
+ scene->_field3EF4->_cardId = scene->_discardCard->_cardId;
scene->_field3EF4->_card.postInit();
scene->_field3EF4->_card.hide();
scene->_field3EF4->_card.setVisage(1332);
scene->_field3EF4->_card.setPosition(scene->_field3EF4->_stationPos, 0);
scene->_field3EF4->_card.fixPriority(170);
- scene->_field3EF0->_cardId = 0;
- scene->_field3EF0->_card.remove();
+ scene->_discardCard->_cardId = 0;
+ scene->_discardCard->_card.remove();
- scene->_animatedCard._card.setPosition(scene->_field3EF0->_stationPos, 0);
+ scene->_animatedCard._card.setPosition(scene->_discardCard->_stationPos, 0);
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
@@ -3704,7 +3716,7 @@ void Scene1337::Action9::signal() {
scene->setAnimationInfo(scene->_field3EF4);
scene->_aSound1.play(57);
- if (scene->_field3EF0 == &scene->_item6) {
+ if (scene->_discardCard == &scene->_selectedCard) {
scene->setCursorData(5, 1, 4);
scene->subC4CEC();
}
@@ -3726,17 +3738,17 @@ void Scene1337::Action10::signal() {
scene->_field3EF8->_card.setVisage(1332);
scene->_field3EF8->_card.setPosition(scene->_field3EF8->_stationPos, 0);
scene->_field3EF8->_card.fixPriority(170);
- scene->_field3EF8->_cardId = scene->_field3EF0->_cardId;
+ scene->_field3EF8->_cardId = scene->_discardCard->_cardId;
- scene->_field3EF0->_cardId = 0;
- scene->_field3EF0->_card.remove();
+ scene->_discardCard->_cardId = 0;
+ scene->_discardCard->_card.remove();
- if (scene->_field3EF0 == &scene->_item6) {
+ if (scene->_discardCard == &scene->_selectedCard) {
scene->setCursorData(5, 1, 4);
scene->subC4CEC();
}
- scene->_animatedCard._card.setPosition(scene->_field3EF0->_stationPos, 0);
+ scene->_animatedCard._card.setPosition(scene->_discardCard->_stationPos, 0);
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
scene->_animatedCard._card.addMover(mover, &scene->_field3EF8->_stationPos, this);
@@ -3849,10 +3861,10 @@ void Scene1337::Action10::signal() {
g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks);
}
- scene->_item6._stationPos = event.mousePos;
+ scene->_selectedCard._stationPos = event.mousePos;
for (int i = 0; i <= 7; i++) {
- if ((scene->subC2BF8(&scene->_gameBoardSide[2]._outpostStation[i], scene->_item6._stationPos) != 0) && (scene->_gameBoardSide[2]._outpostStation[i]._cardId != 0)) {
+ if (scene->_gameBoardSide[2]._outpostStation[i].isIn(scene->_selectedCard._stationPos) && (scene->_gameBoardSide[2]._outpostStation[i]._cardId != 0)) {
scene->_field3EF4 = &scene->_gameBoardSide[2]._outpostStation[0];
found2 = true;
break;
@@ -3863,8 +3875,8 @@ void Scene1337::Action10::signal() {
}
}
- scene->_availableCardsPile[scene->_field3E26] = scene->_field3EF4->_cardId;
- scene->_field3E26--;
+ scene->_availableCardsPile[scene->_currentDiscardIndex] = scene->_field3EF4->_cardId;
+ scene->_currentDiscardIndex--;
scene->_field3EF4->_cardId = 0;
scene->_field3EF4->_card.remove();
@@ -3902,9 +3914,9 @@ void Scene1337::Action11::signal() {
scene->_animatedCard._card.setPosition(scene->_field3EF4->_stationPos, 0);
scene->setCursorData(5, 1, 4);
} else {
- scene->_field3EF0->_cardId = 0;
- scene->_field3EF0->_card.remove();
- scene->_animatedCard._card.setPosition(scene->_field3EF0->_stationPos, 0);
+ scene->_discardCard->_cardId = 0;
+ scene->_discardCard->_card.remove();
+ scene->_animatedCard._card.setPosition(scene->_discardCard->_stationPos, 0);
}
scene->_animatedCard._card.show();
@@ -3930,8 +3942,8 @@ void Scene1337::Action11::signal() {
}
if ((found) && (scene->subC3E92(scene->_field4240) != -1)) {
- scene->_field3EF0 = &scene->_gameBoardSide[0]._handCard[i];
- scene->_field3EF4 = &scene->_gameBoardSide[0]._arr4[0];
+ scene->_discardCard = &scene->_gameBoardSide[0]._handCard[i];
+ scene->_field3EF4 = &scene->_gameBoardSide[0]._emptyStationPos;
if (scene->_field4240 != 0) {
int tmpVal = scene->subC3E92(scene->_field4240);
scene->_field3EF8 = &scene->_gameBoardSide[scene->_field4240]._handCard[tmpVal];
@@ -3949,8 +3961,8 @@ void Scene1337::Action11::signal() {
}
if ((found) && (scene->subC3E92(scene->_field4240) != -1)) {
- scene->_field3EF0 = &scene->_gameBoardSide[1]._handCard[i];
- scene->_field3EF4 = &scene->_gameBoardSide[1]._arr4[0];
+ scene->_discardCard = &scene->_gameBoardSide[1]._handCard[i];
+ scene->_field3EF4 = &scene->_gameBoardSide[1]._emptyStationPos;
if (scene->_field4240 != 1) {
int tmpVal = scene->subC3E92(scene->_field4240);
scene->_field3EF8 = &scene->_gameBoardSide[scene->_field4240]._handCard[tmpVal];
@@ -3973,8 +3985,8 @@ void Scene1337::Action11::signal() {
scene->subC4CEC();
else {
scene->subC4CEC();
- scene->_field3EF0 = &scene->_gameBoardSide[2]._handCard[i];
- scene->_field3EF4 = &scene->_gameBoardSide[2]._arr4[0];
+ scene->_discardCard = &scene->_gameBoardSide[2]._handCard[i];
+ scene->_field3EF4 = &scene->_gameBoardSide[2]._emptyStationPos;
if (scene->_field4240 != 2) {
int tmpVal = scene->subC3E92(scene->_field4240);
scene->_field3EF8 = &scene->_gameBoardSide[scene->_field4240]._handCard[tmpVal];
@@ -3993,8 +4005,8 @@ void Scene1337::Action11::signal() {
}
if ((found) && (scene->subC3E92(scene->_field4240) != -1)) {
- scene->_field3EF0 = &scene->_gameBoardSide[3]._handCard[i];
- scene->_field3EF4 = &scene->_gameBoardSide[3]._arr4[0];
+ scene->_discardCard = &scene->_gameBoardSide[3]._handCard[i];
+ scene->_field3EF4 = &scene->_gameBoardSide[3]._emptyStationPos;
if (scene->_field4240 != 3) {
int tmpVal = scene->subC3E92(scene->_field4240);
scene->_field3EF8 = &scene->_gameBoardSide[scene->_field4240]._handCard[tmpVal];
@@ -4045,13 +4057,13 @@ void Scene1337::Action11::signal() {
g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks);
}
- scene->_item6._stationPos = event.mousePos;
+ scene->_selectedCard._stationPos = event.mousePos;
found = false;
if (scene->_field4242 != 2) {
for (i = 0; i <= 3; i++) {
- if ((scene->subC2BF8(&scene->_gameBoardSide[scene->_field4242]._handCard[i], scene->_item6._stationPos) != 0) && (scene->_gameBoardSide[scene->_field4242]._handCard[i]._cardId != 0)) {
+ if (scene->_gameBoardSide[scene->_field4242]._handCard[i].isIn(scene->_selectedCard._stationPos) && (scene->_gameBoardSide[scene->_field4242]._handCard[i]._cardId != 0)) {
scene->_field3EF8 = &scene->_gameBoardSide[scene->_field4242]._handCard[i];
found = true;
break;
@@ -4069,13 +4081,13 @@ void Scene1337::Action11::signal() {
}
}
- scene->_field3EF0->_card.postInit();
- scene->_field3EF0->_card.hide();
- scene->_field3EF0->_card.setVisage(1332);
- scene->_field3EF0->_card.setPosition(scene->_field3EF0->_stationPos, 0);
- scene->_field3EF0->_card.fixPriority(170);
- scene->_field3EF0->_card.setStrip2(1);
- scene->_field3EF0->_cardId = scene->_field3EF8->_cardId;
+ scene->_discardCard->_card.postInit();
+ scene->_discardCard->_card.hide();
+ scene->_discardCard->_card.setVisage(1332);
+ scene->_discardCard->_card.setPosition(scene->_discardCard->_stationPos, 0);
+ scene->_discardCard->_card.fixPriority(170);
+ scene->_discardCard->_card.setStrip2(1);
+ scene->_discardCard->_cardId = scene->_field3EF8->_cardId;
scene->_field3EF8->_cardId = 0;
scene->_field3EF8->_card.remove();
@@ -4084,26 +4096,26 @@ void Scene1337::Action11::signal() {
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
- scene->_animatedCard._card.addMover(mover, &scene->_field3EF0->_stationPos, this);
+ scene->_animatedCard._card.addMover(mover, &scene->_discardCard->_stationPos, this);
}
break;
case 2:
scene->_animatedCard._card.hide();
switch (scene->_field4240) {
case 0:
- scene->_field3EF0->_card.setFrame(2);
- scene->_field3EF0->_card.show();
+ scene->_discardCard->_card.setFrame(2);
+ scene->_discardCard->_card.show();
break;
case 1:
- scene->_field3EF0->_card.setFrame(4);
- scene->_field3EF0->_card.show();
+ scene->_discardCard->_card.setFrame(4);
+ scene->_discardCard->_card.show();
break;
case 3:
- scene->_field3EF0->_card.setFrame(3);
- scene->_field3EF0->_card.show();
+ scene->_discardCard->_card.setFrame(3);
+ scene->_discardCard->_card.show();
break;
default:
- scene->setAnimationInfo(scene->_field3EF0);
+ scene->setAnimationInfo(scene->_discardCard);
break;
}
@@ -4124,11 +4136,12 @@ void Scene1337::Action12::signal() {
signal();
break;
case 1: {
- scene->_availableCardsPile[scene->_field3E26] = scene->_field3EF4->_cardId;
- scene->_field3EF4->_cardId = scene->_field3EF0->_cardId;
- scene->_field3EF0->_cardId = 0;
- scene->_field3EF0->_card.remove();
- scene->_animatedCard._card.setPosition(scene->_field3EF0->_stationPos, 0);
+ scene->_availableCardsPile[scene->_currentDiscardIndex] = scene->_field3EF4->_cardId;
+ scene->_currentDiscardIndex++;
+ scene->_field3EF4->_cardId = scene->_discardCard->_cardId;
+ scene->_discardCard->_cardId = 0;
+ scene->_discardCard->_card.remove();
+ scene->_animatedCard._card.setPosition(scene->_discardCard->_stationPos, 0);
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
@@ -4192,11 +4205,11 @@ void Scene1337::Action12::signal() {
g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks);
}
- scene->_item6._stationPos = event.mousePos;
+ scene->_selectedCard._stationPos = event.mousePos;
if (scene->_field4240 == 0) {
for (i = 0; i <= 3; i++) {
- if ((scene->subC2BF8(&scene->_gameBoardSide[0]._handCard[i], scene->_item6._stationPos) != 0) && (scene->_gameBoardSide[0]._handCard[i]._cardId != 0)) {
+ if (scene->_gameBoardSide[0]._handCard[i].isIn(scene->_selectedCard._stationPos) && (scene->_gameBoardSide[0]._handCard[i]._cardId != 0)) {
found = true;
scene->_field3EF8 = &scene->_gameBoardSide[0]._handCard[i];
break;
@@ -4206,7 +4219,7 @@ void Scene1337::Action12::signal() {
if (scene->_field4240 == 3) {
for (i = 0; i <= 3; i++) {
- if ((scene->subC2BF8(&scene->_gameBoardSide[3]._handCard[i], scene->_item6._stationPos) != 0) && (scene->_gameBoardSide[3]._handCard[i]._cardId != 0)) {
+ if (scene->_gameBoardSide[3]._handCard[i].isIn(scene->_selectedCard._stationPos) && (scene->_gameBoardSide[3]._handCard[i]._cardId != 0)) {
found = true;
scene->_field3EF8 = &scene->_gameBoardSide[3]._handCard[i];
break;
@@ -4216,7 +4229,7 @@ void Scene1337::Action12::signal() {
if (scene->_field4240 == 1) {
for (i = 0; i <= 3; i++) {
- if ((scene->subC2BF8(&scene->_gameBoardSide[1]._handCard[i], scene->_item6._stationPos) != 0) && (scene->_gameBoardSide[1]._handCard[i]._cardId != 0)) {
+ if (scene->_gameBoardSide[1]._handCard[i].isIn(scene->_selectedCard._stationPos) && (scene->_gameBoardSide[1]._handCard[i]._cardId != 0)) {
found = true;
scene->_field3EF8 = &scene->_gameBoardSide[1]._handCard[i];
break;
@@ -4242,13 +4255,13 @@ void Scene1337::Action12::signal() {
}
}
- scene->_field3EF0->_card.postInit();
- scene->_field3EF0->_card.hide();
- scene->_field3EF0->_card.setVisage(1332);
- scene->_field3EF0->_card.setPosition(scene->_field3EF0->_stationPos);
- scene->_field3EF0->_card.fixPriority(170);
- scene->_field3EF0->_card.setStrip2(1);
- scene->_field3EF0->_cardId = scene->_field3EF8->_cardId;
+ scene->_discardCard->_card.postInit();
+ scene->_discardCard->_card.hide();
+ scene->_discardCard->_card.setVisage(1332);
+ scene->_discardCard->_card.setPosition(scene->_discardCard->_stationPos);
+ scene->_discardCard->_card.fixPriority(170);
+ scene->_discardCard->_card.setStrip2(1);
+ scene->_discardCard->_cardId = scene->_field3EF8->_cardId;
scene->_field3EF8->_cardId = 0;
scene->_field3EF8->_card.remove();
@@ -4258,26 +4271,26 @@ void Scene1337::Action12::signal() {
scene->_aSound1.play(57);
NpcMover *mover = new NpcMover();
- scene->_animatedCard._card.addMover(mover, &scene->_field3EF0->_stationPos, this);
+ scene->_animatedCard._card.addMover(mover, &scene->_discardCard->_stationPos, this);
}
break;
case 3:
scene->_animatedCard._card.hide();
switch (scene->_field4242) {
case 0:
- scene->_field3EF0->_card.setFrame2(2);
- scene->_field3EF0->_card.show();
+ scene->_discardCard->_card.setFrame2(2);
+ scene->_discardCard->_card.show();
break;
case 1:
- scene->_field3EF0->_card.setFrame2(4);
- scene->_field3EF0->_card.show();
+ scene->_discardCard->_card.setFrame2(4);
+ scene->_discardCard->_card.show();
break;
case 3:
- scene->_field3EF0->_card.setFrame2(3);
- scene->_field3EF0->_card.show();
+ scene->_discardCard->_card.setFrame2(3);
+ scene->_discardCard->_card.show();
break;
default:
- scene->setAnimationInfo(scene->_field3EF0);
+ scene->setAnimationInfo(scene->_discardCard);
break;
}
scene->subC4A39(scene->_field3EF4);
@@ -4292,15 +4305,15 @@ void Scene1337::Action13::signal() {
switch (_actionIndex++) {
case 0: {
- scene->_availableCardsPile[scene->_field3E26] = scene->_field3EF4->_cardId;
- scene->_field3E26--;
+ scene->_availableCardsPile[scene->_currentDiscardIndex] = scene->_field3EF4->_cardId;
+ scene->_currentDiscardIndex--;
- scene->_field3EF4->_cardId = scene->_field3EF0->_cardId;
+ scene->_field3EF4->_cardId = scene->_discardCard->_cardId;
- scene->_field3EF0->_cardId = 0;
- scene->_field3EF0->_card.remove();
+ scene->_discardCard->_cardId = 0;
+ scene->_discardCard->_card.remove();
- scene->_animatedCard._card.setPosition(scene->_field3EF0->_stationPos, 0);
+ scene->_animatedCard._card.setPosition(scene->_discardCard->_stationPos, 0);
scene->_animatedCard._card.show();
NpcMover *mover = new NpcMover();
@@ -4337,9 +4350,9 @@ void Scene1337::postInit(SceneObjectList *OwnerList) {
_unkFctPtr412 = NULL;
- _field3EF0 = NULL;
- _field3EF4 = NULL;
- _field3EF8 = NULL;
+ _discardCard = nullptr;
+ _field3EF4 = nullptr;
+ _field3EF8 = nullptr;
_gameBoardSide[2]._handCard[0]._stationPos = Common::Point(10, 174);
_gameBoardSide[2]._handCard[1]._stationPos = Common::Point(37, 174);
@@ -4355,15 +4368,15 @@ void Scene1337::postInit(SceneObjectList *OwnerList) {
_gameBoardSide[2]._outpostStation[6]._stationPos = Common::Point(171, 174);
_gameBoardSide[2]._outpostStation[7]._stationPos = Common::Point(145, 174);
- _gameBoardSide[2]._delayPile[0]._stationPos = Common::Point(199, 174);
+ _gameBoardSide[2]._delayCard._stationPos = Common::Point(199, 174);
- _gameBoardSide[2]._arr4[0]._stationPos = Common::Point(145, 148);
+ _gameBoardSide[2]._emptyStationPos._stationPos = Common::Point(145, 148);
- _gameBoardSide[2]._fieldB94 = Common::Point(10, 174);
- _gameBoardSide[2]._fieldB98 = Common::Point(37, 174);
- _gameBoardSide[2]._fieldB9C = Common::Point(64, 174);
- _gameBoardSide[2]._fieldBA0 = Common::Point(91, 174);
- _gameBoardSide[2]._fieldBA4 = 2;
+ _gameBoardSide[2]._card1Pos = Common::Point(10, 174);
+ _gameBoardSide[2]._card2Pos = Common::Point(37, 174);
+ _gameBoardSide[2]._card3Pos = Common::Point(64, 174);
+ _gameBoardSide[2]._card4Pos = Common::Point(91, 174);
+ _gameBoardSide[2]._frameNum = 2;
_gameBoardSide[3]._handCard[0]._stationPos = Common::Point(14, 14);
_gameBoardSide[3]._handCard[1]._stationPos = Common::Point(14, 36);
@@ -4379,15 +4392,15 @@ void Scene1337::postInit(SceneObjectList *OwnerList) {
_gameBoardSide[3]._outpostStation[6]._stationPos = Common::Point(37, 118);
_gameBoardSide[3]._outpostStation[7]._stationPos = Common::Point(37, 92);
- _gameBoardSide[3]._delayPile[0]._stationPos = Common::Point(37, 145);
+ _gameBoardSide[3]._delayCard._stationPos = Common::Point(37, 145);
- _gameBoardSide[3]._arr4[0]._stationPos = Common::Point(63, 92);
+ _gameBoardSide[3]._emptyStationPos._stationPos = Common::Point(63, 92);
- _gameBoardSide[3]._fieldB94 = Common::Point(14, 14);
- _gameBoardSide[3]._fieldB98 = Common::Point(14, 36);
- _gameBoardSide[3]._fieldB9C = Common::Point(14, 58);
- _gameBoardSide[3]._fieldBA0 = Common::Point(14, 80);
- _gameBoardSide[3]._fieldBA4 = 3;
+ _gameBoardSide[3]._card1Pos = Common::Point(14, 14);
+ _gameBoardSide[3]._card2Pos = Common::Point(14, 36);
+ _gameBoardSide[3]._card3Pos = Common::Point(14, 58);
+ _gameBoardSide[3]._card4Pos = Common::Point(14, 80);
+ _gameBoardSide[3]._frameNum = 3;
_gameBoardSide[0]._handCard[0]._stationPos = Common::Point(280, 5);
_gameBoardSide[0]._handCard[1]._stationPos = Common::Point(253, 5);
@@ -4403,15 +4416,15 @@ void Scene1337::postInit(SceneObjectList *OwnerList) {
_gameBoardSide[0]._outpostStation[6]._stationPos = Common::Point(119, 16);
_gameBoardSide[0]._outpostStation[7]._stationPos = Common::Point(145, 16);
- _gameBoardSide[0]._delayPile[0]._stationPos = Common::Point(91, 16);
+ _gameBoardSide[0]._delayCard._stationPos = Common::Point(91, 16);
- _gameBoardSide[0]._arr4[0]._stationPos = Common::Point(145, 42);
+ _gameBoardSide[0]._emptyStationPos._stationPos = Common::Point(145, 42);
- _gameBoardSide[0]._fieldB94 = Common::Point(280, 5);
- _gameBoardSide[0]._fieldB98 = Common::Point(253, 5);
- _gameBoardSide[0]._fieldB9C = Common::Point(226, 5);
- _gameBoardSide[0]._fieldBA0 = Common::Point(199, 5);
- _gameBoardSide[0]._fieldBA4 = 2;
+ _gameBoardSide[0]._card1Pos = Common::Point(280, 5);
+ _gameBoardSide[0]._card2Pos = Common::Point(253, 5);
+ _gameBoardSide[0]._card3Pos = Common::Point(226, 5);
+ _gameBoardSide[0]._card4Pos = Common::Point(199, 5);
+ _gameBoardSide[0]._frameNum = 2;
_gameBoardSide[1]._handCard[0]._stationPos = Common::Point(283, 146);
_gameBoardSide[1]._handCard[1]._stationPos = Common::Point(283, 124);
@@ -4427,15 +4440,15 @@ void Scene1337::postInit(SceneObjectList *OwnerList) {
_gameBoardSide[1]._outpostStation[6]._stationPos = Common::Point(253, 70);
_gameBoardSide[1]._outpostStation[7]._stationPos = Common::Point(253, 96);
- _gameBoardSide[1]._delayPile[0]._stationPos = Common::Point(253, 43);
+ _gameBoardSide[1]._delayCard._stationPos = Common::Point(253, 43);
- _gameBoardSide[1]._arr4[0]._stationPos = Common::Point(227, 96);
+ _gameBoardSide[1]._emptyStationPos._stationPos = Common::Point(227, 96);
- _gameBoardSide[1]._fieldB94 = Common::Point(283, 146);
- _gameBoardSide[1]._fieldB98 = Common::Point(283, 124);
- _gameBoardSide[1]._fieldB9C = Common::Point(283, 102);
- _gameBoardSide[1]._fieldBA0 = Common::Point(283, 80);
- _gameBoardSide[1]._fieldBA4 = 4;
+ _gameBoardSide[1]._card1Pos = Common::Point(283, 146);
+ _gameBoardSide[1]._card2Pos = Common::Point(283, 124);
+ _gameBoardSide[1]._card3Pos = Common::Point(283, 102);
+ _gameBoardSide[1]._card4Pos = Common::Point(283, 80);
+ _gameBoardSide[1]._frameNum = 4;
subPostInit();
}
@@ -4478,10 +4491,10 @@ void Scene1337::process(Event &event) {
}
void Scene1337::dispatch() {
- if (_instructionsDisplayedFl == 0) {
+ if (!_instructionsDisplayedFl) {
++_instructionsWaitCount;
if (_instructionsWaitCount == 4) {
- _instructionsDisplayedFl = 1;
+ _instructionsDisplayedFl = true;
suggestInstructions();
}
}
@@ -4501,7 +4514,7 @@ void Scene1337::actionDisplay(int resNum, int lineNum, int x, int y, int arg5, i
SceneItem::display(resNum, lineNum, SET_X, x, SET_Y, y, SET_KEEP_ONSCREEN, 0, SET_WIDTH, width, SET_POS_MODE, -1, SET_TEXT_MODE, textMode, SET_FONT, fontNum, SET_FG_COLOR, colFG, SET_EXT_BGCOLOR, colBGExt, SET_EXT_FGCOLOR, colFGExt, LIST_END);
}
-void Scene1337::setAnimationInfo(unkObj1337sub1 *subObj) {
+void Scene1337::setAnimationInfo(Card *subObj) {
if (!subObj)
return;
@@ -4889,21 +4902,11 @@ void Scene1337::subC2835(int arg1) {
subC4A39(&_gameBoardSide[arg1]._handCard[i]);
}
-bool Scene1337::subC2BF8(unkObj1337sub1 *subObj1, Common::Point pt) {
- if ((subObj1->_stationPos.x > pt.x) || (subObj1->_stationPos.x + 24 < pt.x))
- return false;
-
- if ((subObj1->_stationPos.y > pt.y) || (subObj1->_stationPos.y + 24 < pt.y))
- return false;
-
- return true;
-}
-
void Scene1337::subC2C2F() {
bool found = true;
- if (_gameBoardSide[3]._delayPile[0]._cardId != 0) {
- switch (_gameBoardSide[3]._delayPile[0]._cardId) {
+ if (_gameBoardSide[3]._delayCard._cardId != 0) {
+ switch (_gameBoardSide[3]._delayCard._cardId) {
case 10:
// No break on purpose
case 12:
@@ -4919,14 +4922,14 @@ void Scene1337::subC2C2F() {
case 20:
// No break on purpose
case 21:
- subC4A39(&_gameBoardSide[3]._delayPile[0]);
+ subC4A39(&_gameBoardSide[3]._delayCard);
found = false;
break;
default:
found = false;
int i;
for (i = 0; i <= 3; i++) {
- if (subC3386(_gameBoardSide[3]._delayPile[0]._cardId, _gameBoardSide[3]._handCard[i]._cardId)) {
+ if (subC3386(_gameBoardSide[3]._delayCard._cardId, _gameBoardSide[3]._handCard[i]._cardId)) {
found = true;
break;
}
@@ -4934,7 +4937,7 @@ void Scene1337::subC2C2F() {
if (found) {
found = false;
- subC34A1(&_gameBoardSide[3]._handCard[i], &_gameBoardSide[3]._delayPile[0]);
+ subC34A1(&_gameBoardSide[3]._handCard[i], &_gameBoardSide[3]._delayCard);
}
break;
}
@@ -4949,7 +4952,7 @@ void Scene1337::subC2C2F() {
found = false;
for (int i = 0; i <= 7; i++) {
- if ((_gameBoardSide[3]._outpostStation[i]._cardId == 0) && (!subC2687(_gameBoardSide[3]._delayPile[0]._cardId))) {
+ if ((_gameBoardSide[3]._outpostStation[i]._cardId == 0) && (!subC2687(_gameBoardSide[3]._delayCard._cardId))) {
subC340B(&_gameBoardSide[3]._handCard[randIndx], &_gameBoardSide[3]._outpostStation[i]);
found = true;
break;
@@ -4971,7 +4974,7 @@ void Scene1337::subC2C2F() {
if (!found) {
for (int i = 0; i <= 7; i++) {
- if ((_gameBoardSide[3]._outpostStation[i]._cardId == 1) && (!subC2687(_gameBoardSide[3]._delayPile[0]._cardId))) {
+ if ((_gameBoardSide[3]._outpostStation[i]._cardId == 1) && (!subC2687(_gameBoardSide[3]._delayCard._cardId))) {
int tmpVal = 0;
for (int j = 0; j <= 7; j++) {
@@ -5055,7 +5058,7 @@ void Scene1337::subC2C2F() {
// It's understandable for 'i', which helps making sure that tmpVal is used properly,
// but it's suspect for j
for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[tmpRandIndx]._delayPile[0]._cardId == 0) && (subC32B1(tmpRandIndx, _gameBoardSide[3]._handCard[randIndx]._cardId))) {
+ if ((_gameBoardSide[tmpRandIndx]._delayCard._cardId == 0) && (subC32B1(tmpRandIndx, _gameBoardSide[3]._handCard[randIndx]._cardId))) {
tmpVal = j;
}
}
@@ -5071,7 +5074,7 @@ void Scene1337::subC2C2F() {
if (tmpVal != -1) {
// Useless second identical check skipped
- subC3456(&_gameBoardSide[3]._handCard[randIndx], &_gameBoardSide[tmpVal]._delayPile[0]);
+ subC3456(&_gameBoardSide[3]._handCard[randIndx], &_gameBoardSide[tmpVal]._delayCard);
return;
}
}
@@ -5083,7 +5086,7 @@ void Scene1337::subC2C2F() {
subC4A39(&_gameBoardSide[3]._handCard[randIndx]);
}
-void Scene1337::subC318B(int arg1, unkObj1337sub1 *subObj1, int arg3) {
+void Scene1337::subC318B(int arg1, Card *subObj1, int arg3) {
_field4240 = arg1;
_field4242 = arg3;
@@ -5095,8 +5098,8 @@ void Scene1337::subC318B(int arg1, unkObj1337sub1 *subObj1, int arg3) {
break;
}
- _field3EF0 = subObj1;
- _field3EF4 = &_gameBoardSide[arg3]._arr4[0];
+ _discardCard = subObj1;
+ _field3EF4 = &_gameBoardSide[arg3]._emptyStationPos;
_field3EF8 = &_gameBoardSide[arg3]._handCard[randIndx];
_item1.setAction(&_action11);
@@ -5189,9 +5192,9 @@ bool Scene1337::subC3386(int arg1, int arg2) {
return false;
}
-void Scene1337::subC33C0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
+void Scene1337::subC33C0(Card *subObj1, Card *subObj2) {
_field3EF4 = subObj2;
- _field3EF0 = subObj1;
+ _discardCard = subObj1;
_item1.setAction(&_action7);
}
@@ -5212,28 +5215,28 @@ int Scene1337::subC3E92(int arg1) {
return randIndx;
}
-void Scene1337::subC340B(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
- _field3EF0 = subObj1;
+void Scene1337::subC340B(Card *subObj1, Card *subObj2) {
+ _discardCard = subObj1;
_field3EF4 = subObj2;
_item1.setAction(&_action6);
}
-void Scene1337::subC3456(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
- _field3EF0 = subObj1;
+void Scene1337::subC3456(Card *subObj1, Card *subObj2) {
+ _discardCard = subObj1;
_field3EF4 = subObj2;
_item1.setAction(&_action9);
}
-void Scene1337::subC34A1(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
- _field3EF0 = subObj1;
+void Scene1337::subC34A1(Card *subObj1, Card *subObj2) {
+ _discardCard = subObj1;
_field3EF4 = subObj2;
_item1.setAction(&_action8);
}
-Scene1337::unkObj1337sub1 *Scene1337::subC34EC(int arg1) {
+Scene1337::Card *Scene1337::subC34EC(int arg1) {
for (int i = 0; i <= 7; i++) {
if (_gameBoardSide[arg1]._outpostStation[i]._cardId == 1) {
return &_gameBoardSide[arg1]._outpostStation[i];
@@ -5249,16 +5252,16 @@ Scene1337::unkObj1337sub1 *Scene1337::subC34EC(int arg1) {
return NULL;
}
-void Scene1337::subC358E(unkObj1337sub1 *subObj1, int arg2) {
- _field3EF0 = subObj1;
+void Scene1337::subC358E(Card *subObj1, int arg2) {
+ _discardCard = subObj1;
_field3EF4 = subC34EC(arg2);
- _field3EF8 = &_gameBoardSide[arg2]._arr4[0];
+ _field3EF8 = &_gameBoardSide[arg2]._emptyStationPos;
_field4240 = arg2;
_item1.setAction(&_action10);
}
-void Scene1337::subC4A39(unkObj1337sub1 *subObj) {
- _field3EF0 = subObj;
+void Scene1337::subC4A39(Card *subObj) {
+ _discardCard = subObj;
_item1.setAction(&_action5);
}
@@ -5277,8 +5280,8 @@ void Scene1337::subC4CEC() {
}
}
-void Scene1337::subC51A0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
- _field3EF0 = subObj1;
+void Scene1337::subC51A0(Card *subObj1, Card *subObj2) {
+ _discardCard = subObj1;
_field3EF4 = subObj2;
_item1.setAction(&_action13);
@@ -5496,15 +5499,15 @@ void Scene1337::subPostInit() {
_availableCardsPile[99] = 0;
_cardsAvailableNumb = 98;
- _field3E26 = 98;
+ _currentDiscardIndex = 98; // CHECKME: Would make more sense at pos 99
_discardPile._cardId = 0;
_discardPile._stationPos = Common::Point(128, 95);
- _item8._cardId = 0;
- _item8._stationPos = Common::Point(162, 95);
+ _stockPile._cardId = 0;
+ _stockPile._stationPos = Common::Point(162, 95);
- _item6._cardId = 0;
+ _selectedCard._cardId = 0;
_animatedCard._card.postInit();
_animatedCard._card.setVisage(1332);
@@ -5530,10 +5533,10 @@ void Scene1337::subPostInit() {
_field4246 = false;
_field424A = -1;
- _background1.setup2(9531, 1, 1, 249, 168, 155, 0);
+ _background1.setup2(9531, 1, 1, 249, 168, 155, EFFECT_NONE);
_autoplay = false;
- _instructionsDisplayedFl = 0;
+ _instructionsDisplayedFl = false;
_instructionsWaitCount = 0;
}
@@ -5544,7 +5547,7 @@ void Scene1337::suggestInstructions() {
if (MessageDialog::show(NEED_INSTRUCTIONS, NO_MSG, YES_MSG) == 0) {
if (R2_GLOBALS._v57709 == 0)
subD18F5();
- firstShuffle();
+ dealCards();
} else {
if (R2_GLOBALS._v57709 == 0)
subD18F5();
@@ -5578,7 +5581,7 @@ void Scene1337::shuffleCards() {
// CHECKME: This will fail if i == 0, which shouldn't happen
// as we don't shuffle cards when no card is available.
_cardsAvailableNumb = i - 1;
- _field3E26 = 98;
+ _currentDiscardIndex = 98; // CHECKME: Would make more sense at pos 99
break;
}
}
@@ -5591,6 +5594,8 @@ void Scene1337::shuffleCards() {
}
_shuffleEndedFl = false;
+
+ // Shuffle cards
_animatedCard._card.setAction(&_action2);
while(!_shuffleEndedFl && !g_vm->shouldQuit()) {
@@ -5601,9 +5606,11 @@ void Scene1337::shuffleCards() {
}
}
-void Scene1337::firstShuffle() {
+void Scene1337::dealCards() {
_animatedCard._card._moveDiff = Common::Point(30, 30);
shuffleCards();
+
+ // Deal cards
_item1.setAction(&_action3);
}
void Scene1337::subCD193() {
@@ -5618,10 +5625,10 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
if (arg1 == 3) {
int i;
for (i = 0; i <= 7; i++) {
- if ( (subC2BF8(&_gameBoardSide[2]._outpostStation[i], pt))
- || (subC2BF8(&_gameBoardSide[0]._outpostStation[i], pt))
- || (subC2BF8(&_gameBoardSide[1]._outpostStation[i], pt))
- || (subC2BF8(&_gameBoardSide[3]._outpostStation[i], pt)) ) {
+ if ( _gameBoardSide[2]._outpostStation[i].isIn(pt)
+ || _gameBoardSide[0]._outpostStation[i].isIn(pt)
+ || _gameBoardSide[1]._outpostStation[i].isIn(pt)
+ || _gameBoardSide[3]._outpostStation[i].isIn(pt) ) {
found = true;
break;
}
@@ -5657,36 +5664,36 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
break;
}
} else {
- if ( (subC2BF8(&_gameBoardSide[2]._delayPile[0], pt))
- || (subC2BF8(&_gameBoardSide[0]._delayPile[0], pt))
- || (subC2BF8(&_gameBoardSide[1]._delayPile[0], pt))
- || (subC2BF8(&_gameBoardSide[3]._delayPile[0], pt)) ) {
+ if ( _gameBoardSide[2]._delayCard.isIn(pt)
+ || _gameBoardSide[0]._delayCard.isIn(pt)
+ || _gameBoardSide[1]._delayCard.isIn(pt)
+ || _gameBoardSide[3]._delayCard.isIn(pt) ) {
found = true;
}
if (found) {
switch (curReg) {
case 5:
- if (_gameBoardSide[2]._delayPile[0]._cardId != 0)
- displayDialog(_gameBoardSide[2]._delayPile[0]._cardId);
+ if (_gameBoardSide[2]._delayCard._cardId != 0)
+ displayDialog(_gameBoardSide[2]._delayCard._cardId);
else
actionDisplay(1330, 10, 159, 10, 1, 200, 0, 7, 0, 154, 154);
break;
case 10:
- if (_gameBoardSide[3]._delayPile[0]._cardId != 0)
- displayDialog(_gameBoardSide[3]._delayPile[0]._cardId);
+ if (_gameBoardSide[3]._delayCard._cardId != 0)
+ displayDialog(_gameBoardSide[3]._delayCard._cardId);
else
actionDisplay(1330, 16, 159, 10, 1, 200, 0, 7, 0, 154, 154);
break;
case 15:
- if (_gameBoardSide[0]._delayPile[0]._cardId != 0)
- displayDialog(_gameBoardSide[3]._delayPile[0]._cardId);
+ if (_gameBoardSide[0]._delayCard._cardId != 0)
+ displayDialog(_gameBoardSide[3]._delayCard._cardId);
else
actionDisplay(1330, 13, 159, 10, 1, 200, 0, 7, 0, 154, 154);
break;
case 20:
- if (_gameBoardSide[1]._delayPile[0]._cardId != 0)
- displayDialog(_gameBoardSide[1]._delayPile[0]._cardId);
+ if (_gameBoardSide[1]._delayCard._cardId != 0)
+ displayDialog(_gameBoardSide[1]._delayCard._cardId);
else
actionDisplay(1330, 18, 159, 10, 1, 200, 0, 7, 0, 154, 154);
break;
@@ -5694,28 +5701,28 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
break;
}
} else {
- if (subC2BF8(&_discardPile, pt)) {
+ if (_discardPile.isIn(pt)) {
if (_discardPile._cardId != 0)
displayDialog(_discardPile._cardId);
else
actionDisplay(1330, 7, 159, 10, 1, 200, 0, 7, 0, 154, 154);
} else if (_background1._bounds.contains(pt)) {
actionDisplay(1330, 43, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- } else if (subC2BF8(&_item8, pt)) {
+ } else if (_stockPile.isIn(pt)) {
actionDisplay(1330, 4, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- } else if ( (subC2BF8(&_gameBoardSide[2]._arr4[0], pt))
- || (subC2BF8(&_gameBoardSide[3]._arr4[0], pt))
- || (subC2BF8(&_gameBoardSide[0]._arr4[0], pt))
- || (subC2BF8(&_gameBoardSide[1]._arr4[0], pt)) ) {
+ } else if ( (_gameBoardSide[2]._emptyStationPos.isIn(pt))
+ || (_gameBoardSide[3]._emptyStationPos.isIn(pt))
+ || (_gameBoardSide[0]._emptyStationPos.isIn(pt))
+ || (_gameBoardSide[1]._emptyStationPos.isIn(pt)) ) {
actionDisplay(1330, 32, 159, 10, 1, 200, 0, 7, 0, 154, 154);
} else {
- if (subC2BF8(&_gameBoardSide[2]._handCard[0], pt))
+ if (_gameBoardSide[2]._handCard[0].isIn(pt))
displayDialog(_gameBoardSide[2]._handCard[0]._cardId);
- else if (subC2BF8(&_gameBoardSide[2]._handCard[1], pt))
+ else if (_gameBoardSide[2]._handCard[1].isIn(pt))
displayDialog(_gameBoardSide[2]._handCard[1]._cardId);
- else if (subC2BF8(&_gameBoardSide[2]._handCard[2], pt))
+ else if (_gameBoardSide[2]._handCard[2].isIn(pt))
displayDialog(_gameBoardSide[2]._handCard[2]._cardId);
- else if (subC2BF8(&_gameBoardSide[2]._handCard[3], pt))
+ else if (_gameBoardSide[2]._handCard[3].isIn(pt))
displayDialog(_gameBoardSide[2]._handCard[3]._cardId);
else if ((curReg >= 6) && (curReg <= 9))
actionDisplay(1330, 29, 159, 10, 1, 200, 0, 7, 0, 154, 154);
@@ -5756,7 +5763,7 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
return;
for (int i = 0; i <= 7; i++) {
- if (subC2BF8(&_gameBoardSide[2]._outpostStation[i], pt)) {
+ if (_gameBoardSide[2]._outpostStation[i].isIn(pt)) {
switch (_gameBoardSide[2]._outpostStation[i]._cardId) {
case 0:
actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
@@ -5770,7 +5777,7 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
}
found = true;
break;
- } else if (subC2BF8(&_gameBoardSide[0]._outpostStation[i], pt)) {
+ } else if (_gameBoardSide[0]._outpostStation[i].isIn(pt)) {
switch (_gameBoardSide[0]._outpostStation[i]._cardId) {
case 0:
actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
@@ -5781,7 +5788,7 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
}
found = true;
break;
- } else if (subC2BF8(&_gameBoardSide[1]._outpostStation[i], pt)) {
+ } else if (_gameBoardSide[1]._outpostStation[i].isIn(pt)) {
switch (_gameBoardSide[1]._outpostStation[i]._cardId) {
case 0:
actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
@@ -5792,7 +5799,7 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
}
found = true;
break;
- } else if (subC2BF8(&_gameBoardSide[3]._outpostStation[i], pt)) {
+ } else if (_gameBoardSide[3]._outpostStation[i].isIn(pt)) {
switch (_gameBoardSide[3]._outpostStation[i]._cardId) {
case 0:
actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
@@ -5806,8 +5813,9 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
}
}
- if (subC2BF8(&_gameBoardSide[2]._delayPile[0], pt)) {
- if (_gameBoardSide[0]._delayPile[0]._cardId != 0) {
+ if (_gameBoardSide[2]._delayCard.isIn(pt)) {
+ // The original uses _gameBoardSide[0], which is obviously a bug.
+ if (_gameBoardSide[2]._delayCard._cardId != 0) {
actionDisplay(1330, 39, 159, 10, 1, 200, 0, 7, 0, 154, 154);
} else {
actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
@@ -5815,8 +5823,8 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
found = true;
}
- if (subC2BF8(&_gameBoardSide[3]._delayPile[0], pt)) {
- if (_gameBoardSide[3]._delayPile[0]._cardId != 0) {
+ if (_gameBoardSide[3]._delayCard.isIn(pt)) {
+ if (_gameBoardSide[3]._delayCard._cardId != 0) {
actionDisplay(1330, 145, 20, 99, 1, 136, 0, 7, 0, 172, 172);
} else {
actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
@@ -5824,8 +5832,8 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
found = true;
}
- if (subC2BF8(&_gameBoardSide[1]._delayPile[0], pt)) {
- if (_gameBoardSide[1]._delayPile[0]._cardId != 0) {
+ if (_gameBoardSide[1]._delayCard.isIn(pt)) {
+ if (_gameBoardSide[1]._delayCard._cardId != 0) {
actionDisplay(1330, 144, 300, 99, 1, 136, 0, 7, 0, 117, 117);
} else {
actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
@@ -5833,8 +5841,8 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
found = true;
}
- if (subC2BF8(&_gameBoardSide[0]._delayPile[0], pt)) {
- if (_gameBoardSide[0]._delayPile[0]._cardId != 0) {
+ if (_gameBoardSide[0]._delayCard.isIn(pt)) {
+ if (_gameBoardSide[0]._delayCard._cardId != 0) {
actionDisplay(1330, 1, 159, 10, 1, 200, 0, 7, 0, 154, 154);
} else {
actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
@@ -5842,17 +5850,17 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
found = true;
}
- if (subC2BF8(&_gameBoardSide[3]._arr4[0], pt)) {
+ if (_gameBoardSide[3]._emptyStationPos.isIn(pt)) {
actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
found = true;
}
- if (subC2BF8(&_gameBoardSide[1]._arr4[0], pt)) {
+ if (_gameBoardSide[1]._emptyStationPos.isIn(pt)) {
actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
found = true;
}
- if (subC2BF8(&_gameBoardSide[0]._arr4[0], pt)) {
+ if (_gameBoardSide[0]._emptyStationPos.isIn(pt)) {
actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
found = true;
}
@@ -5865,9 +5873,9 @@ void Scene1337::subCDB90(int arg1, Common::Point pt) {
return;
}
- if (subC2BF8(&_discardPile, pt))
+ if (_discardPile.isIn(pt))
actionDisplay(1330, 9, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- else if (subC2BF8(&_item8, pt))
+ else if (_stockPile.isIn(pt))
actionDisplay(1330, 5, 159, 10, 1, 200, 0, 7, 0, 154, 154);
else {
switch (curReg) {
@@ -5919,8 +5927,8 @@ void Scene1337::subCF31D() {
bool found;
int count;
- if (this->_gameBoardSide[1]._delayPile[0]._cardId != 0) {
- switch (_gameBoardSide[1]._delayPile[0]._cardId) {
+ if (this->_gameBoardSide[1]._delayCard._cardId != 0) {
+ switch (_gameBoardSide[1]._delayCard._cardId) {
case 10:
// No break on purpose
case 12:
@@ -5937,13 +5945,13 @@ void Scene1337::subCF31D() {
// No break on purpose
case 21:
tmpVal = 0;
- subC4A39(&_gameBoardSide[1]._delayPile[0]);
+ subC4A39(&_gameBoardSide[1]._delayCard);
break;
default:
found = false;
int i;
for (i = 0; i <= 3; i++) {
- if (subC3386(_gameBoardSide[1]._delayPile[0]._cardId, _gameBoardSide[1]._handCard[i]._cardId)) {
+ if (subC3386(_gameBoardSide[1]._delayCard._cardId, _gameBoardSide[1]._handCard[i]._cardId)) {
found = true;
break;
}
@@ -5951,7 +5959,7 @@ void Scene1337::subCF31D() {
if (found) {
tmpVal = 0;
- subC34A1(&_gameBoardSide[1]._handCard[i], &_gameBoardSide[1]._delayPile[0]);
+ subC34A1(&_gameBoardSide[1]._handCard[i], &_gameBoardSide[1]._delayCard);
}
}
}
@@ -5978,7 +5986,7 @@ void Scene1337::subCF31D() {
for (int j = 0; j <= 7; j++) {
if (_gameBoardSide[1]._outpostStation[j]._cardId == 1) {
- if (!subC2687(_gameBoardSide[1]._delayPile[0]._cardId)) {
+ if (!subC2687(_gameBoardSide[1]._delayCard._cardId)) {
count = 0;
for (int k = 0; k <= 7; k++) {
if ((_gameBoardSide[1]._outpostStation[k]._cardId > 1) && (_gameBoardSide[1]._outpostStation[k]._cardId <= 9))
@@ -6002,7 +6010,7 @@ void Scene1337::subCF31D() {
tmpVal = subC2719(1);
if (tmpVal != -1) {
for (int i = 0; i <= 7; i++) {
- if ((_gameBoardSide[1]._outpostStation[i]._cardId == 0) && (!subC2687(_gameBoardSide[1]._delayPile[0]._cardId))) {
+ if ((_gameBoardSide[1]._outpostStation[i]._cardId == 0) && (!subC2687(_gameBoardSide[1]._delayCard._cardId))) {
subC340B(&_gameBoardSide[1]._handCard[tmpVal], &_gameBoardSide[1]._outpostStation[i]);
found = true;
break;
@@ -6066,7 +6074,7 @@ void Scene1337::subCF31D() {
for (int k = 0; k <= 7; k++) {
// CHECKME: 'k' is not used in that loop.
// It looks suspicious.
- if ((_gameBoardSide[tmpVal]._delayPile[0]._cardId == 0) && (subC32B1(tmpVal, _gameBoardSide[1]._handCard[i]._cardId))) {
+ if ((_gameBoardSide[tmpVal]._delayCard._cardId == 0) && (subC32B1(tmpVal, _gameBoardSide[1]._handCard[i]._cardId))) {
count = tmpVal;
break;
}
@@ -6089,7 +6097,7 @@ void Scene1337::subCF31D() {
}
if (found)
- subC3456(&_gameBoardSide[1]._handCard[i], &_gameBoardSide[count]._delayPile[0]);
+ subC3456(&_gameBoardSide[1]._handCard[i], &_gameBoardSide[count]._delayCard);
else {
int j;
for (j = 0; j <= 3; j++) {
@@ -6100,7 +6108,7 @@ void Scene1337::subCF31D() {
if (rndVal != 1) {
for (int m = 0; m <= 7; m++) {
// 'm' is not used in that loop. It looks suspicious.
- if ((_gameBoardSide[rndVal]._delayPile[0]._cardId == 0) && (_gameBoardSide[1]._handCard[j]._cardId == 1)) {
+ if ((_gameBoardSide[rndVal]._delayCard._cardId == 0) && (_gameBoardSide[1]._handCard[j]._cardId == 1)) {
count = rndVal;
break;
}
@@ -6121,7 +6129,7 @@ void Scene1337::subCF31D() {
}
if (found)
- subC3456(&_gameBoardSide[1]._handCard[j], &_gameBoardSide[count]._delayPile[0]);
+ subC3456(&_gameBoardSide[1]._handCard[j], &_gameBoardSide[count]._delayCard);
else
subC2835(1);
}
@@ -6131,8 +6139,8 @@ void Scene1337::subCF31D() {
void Scene1337::subCF979() {
bool found = true;
- if (_gameBoardSide[0]._delayPile[0]._cardId != 0) {
- switch (_gameBoardSide[0]._delayPile[0]._cardId) {
+ if (_gameBoardSide[0]._delayCard._cardId != 0) {
+ switch (_gameBoardSide[0]._delayCard._cardId) {
case 10:
//No break on purpose
case 12:
@@ -6148,7 +6156,7 @@ void Scene1337::subCF979() {
case 20:
//No break on purpose
case 21:
- subC4A39(&_gameBoardSide[0]._delayPile[0]);
+ subC4A39(&_gameBoardSide[0]._delayCard);
found = false;
break;
default:
@@ -6156,7 +6164,7 @@ void Scene1337::subCF979() {
found = false;
for (i = 0; i <= 3; i++) {
- if (subC3386(_gameBoardSide[0]._delayPile[0]._cardId, _gameBoardSide[0]._handCard[i]._cardId)) {
+ if (subC3386(_gameBoardSide[0]._delayCard._cardId, _gameBoardSide[0]._handCard[i]._cardId)) {
found = true;
break;
}
@@ -6164,7 +6172,7 @@ void Scene1337::subCF979() {
if (found) {
found = false;
- subC34A1(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[0]._delayPile[0]);
+ subC34A1(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[0]._delayCard);
}
break;
}
@@ -6189,7 +6197,7 @@ void Scene1337::subCF979() {
if (!flag) {
for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[0]._outpostStation[j]._cardId == 1) && (!subC2687(_gameBoardSide[0]._delayPile[0]._cardId))) {
+ if ((_gameBoardSide[0]._outpostStation[j]._cardId == 1) && (!subC2687(_gameBoardSide[0]._delayCard._cardId))) {
int count = 0;
for (int k = 0; k <= 7; k++) {
if ((_gameBoardSide[0]._outpostStation[k]._cardId > 1) && (_gameBoardSide[0]._outpostStation[k]._cardId <= 9)) {
@@ -6219,7 +6227,7 @@ void Scene1337::subCF979() {
if (tmpVal != -1) {
for (int i = 0; i <= 7; i++) {
- if ((_gameBoardSide[0]._outpostStation[i]._cardId == 0) && (!subC2687(_gameBoardSide[0]._delayPile[0]._cardId))) {
+ if ((_gameBoardSide[0]._outpostStation[i]._cardId == 0) && (!subC2687(_gameBoardSide[0]._delayCard._cardId))) {
subC340B(&_gameBoardSide[0]._handCard[tmpVal], &_gameBoardSide[0]._outpostStation[i]);
found = true;
break;
@@ -6262,8 +6270,8 @@ void Scene1337::subCF979() {
if (subC27B5(_gameBoardSide[0]._handCard[i]._cardId) != -1) {
// The variable 'j' is not used in the inner code of the loop. It's suspect
for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[2]._delayPile[0]._cardId == 0) && (subC32B1(2, _gameBoardSide[0]._handCard[i]._cardId))) {
- subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[2]._delayPile[0]);
+ if ((_gameBoardSide[2]._delayCard._cardId == 0) && (subC32B1(2, _gameBoardSide[0]._handCard[i]._cardId))) {
+ subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[2]._delayCard);
found = true;
break;
}
@@ -6281,8 +6289,8 @@ void Scene1337::subCF979() {
if (subC27F9(_gameBoardSide[0]._handCard[i]._cardId) != -1) {
// The variable 'j' is not used in the inner code of the loop. It's suspect
for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[2]._delayPile[0]._cardId == 0) && (subC32B1(2, _gameBoardSide[0]._handCard[i]._cardId))) {
- subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[2]._delayPile[0]);
+ if ((_gameBoardSide[2]._delayCard._cardId == 0) && (subC32B1(2, _gameBoardSide[0]._handCard[i]._cardId))) {
+ subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[2]._delayCard);
found = true;
}
}
@@ -6325,8 +6333,8 @@ void Scene1337::subCF979() {
if (tmpVal != -1) {
// The variable 'j' is not used in the inner code of the loop. It's suspect.
for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[1]._delayPile[0]._cardId == 0) && (subC32B1(1, _gameBoardSide[0]._handCard[i]._cardId))) {
- subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[1]._delayPile[0]);
+ if ((_gameBoardSide[1]._delayCard._cardId == 0) && (subC32B1(1, _gameBoardSide[0]._handCard[i]._cardId))) {
+ subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[1]._delayCard);
found = true;
}
}
@@ -6334,8 +6342,8 @@ void Scene1337::subCF979() {
if (!found) {
// The variable 'j' is not used in the inner code of the loop. It's suspect.
for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[3]._delayPile[0]._cardId == 0) && (subC32B1(3, _gameBoardSide[0]._handCard[i]._cardId))) {
- subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[3]._delayPile[0]);
+ if ((_gameBoardSide[3]._delayCard._cardId == 0) && (subC32B1(3, _gameBoardSide[0]._handCard[i]._cardId))) {
+ subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[3]._delayCard);
found = true;
}
}
@@ -6354,8 +6362,8 @@ void Scene1337::subCF979() {
if (tmpVal != -1) {
// The variable 'j' is not used in the inner code of the loop. It's suspect.
for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[1]._delayPile[0]._cardId == 0) && (subC32B1(1, _gameBoardSide[0]._handCard[i]._cardId))) {
- subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[1]._delayPile[0]);
+ if ((_gameBoardSide[1]._delayCard._cardId == 0) && (subC32B1(1, _gameBoardSide[0]._handCard[i]._cardId))) {
+ subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[1]._delayCard);
found = true;
}
}
@@ -6363,8 +6371,8 @@ void Scene1337::subCF979() {
if (!found) {
// The variable 'j' is not used in the inner code of the loop. It's suspect.
for (int j = 0; j <= 7; j++) {
- if ((_gameBoardSide[3]._delayPile[0]._cardId == 0) && (subC32B1(3, _gameBoardSide[0]._handCard[i]._cardId))) {
- subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[3]._delayPile[0]);
+ if ((_gameBoardSide[3]._delayCard._cardId == 0) && (subC32B1(3, _gameBoardSide[0]._handCard[i]._cardId))) {
+ subC3456(&_gameBoardSide[0]._handCard[i], &_gameBoardSide[3]._delayCard);
found = true;
}
}
@@ -6386,83 +6394,91 @@ void Scene1337::subD026D() {
}
void Scene1337::subD0281() {
- if (subC27F9(this->_gameBoardSide[2]._delayPile[0]._cardId) == -1)
+ if (subC27F9(this->_gameBoardSide[2]._delayCard._cardId) == -1)
_unkFctPtr412 = &Scene1337::subD026D;
else
- subC4A39(&_gameBoardSide[2]._delayPile[0]);
+ subC4A39(&_gameBoardSide[2]._delayCard);
}
void Scene1337::subD02CA() {
- _item6._stationPos = g_globals->_events._mousePos;
+ _selectedCard._stationPos = g_globals->_events._mousePos;
if (R2_GLOBALS._v57810 == 200) {
- int di;
- for (di = 0; di < 4; di++) {
- if ((subC2BF8(&_gameBoardSide[2]._handCard[di], _item6._stationPos) != 0) && (_gameBoardSide[2]._handCard[di]._cardId != 0)) {
- _item6._cardId = _gameBoardSide[2]._handCard[di]._cardId;
- _item6._stationPos = _gameBoardSide[2]._handCard[di]._stationPos;
- // _item6._actorName = _arrunkObj1337[2]._arr1[di]._actorName;
- _item6._fieldE = _gameBoardSide[2]._handCard[di]._fieldE;
- _item6._field10 = _gameBoardSide[2]._handCard[di]._field10;
- warning("_item6._field12 = _arrunkObj1337[2]._arr1[di]._field12;");
- warning("_item6._field14 = _arrunkObj1337[2]._arr1[di]._field14;");
- warning("_item6._field16 = _arrunkObj1337[2]._arr1[di]._field16;");
- _item6._sceneRegionId = _gameBoardSide[2]._handCard[di]._sceneRegionId;
- _item6._position = _gameBoardSide[2]._handCard[di]._position;
- _item6._yDiff = _gameBoardSide[2]._handCard[di]._yDiff;
- _item6._bounds = _gameBoardSide[2]._handCard[di]._bounds;
- _item6._resNum = _gameBoardSide[2]._handCard[di]._resNum;
- _item6._lookLineNum = _gameBoardSide[2]._handCard[di]._lookLineNum;
- _item6._talkLineNum = _gameBoardSide[2]._handCard[di]._talkLineNum;
- _item6._useLineNum = _gameBoardSide[2]._handCard[di]._useLineNum;
- _item6._action = _gameBoardSide[2]._handCard[di]._action;
- warning("_item6._field0 = _arrunkObj1337[2]._arr1[di]._field0;");
- _item6._card._updateStartFrame = _gameBoardSide[2]._handCard[di]._card._updateStartFrame;
- _item6._card._walkStartFrame = _gameBoardSide[2]._handCard[di]._card._walkStartFrame;
+ int i;
+ for (i = 0; i < 4; i++) {
+ if ((_gameBoardSide[2]._handCard[i].isIn(_selectedCard._stationPos)) && (_gameBoardSide[2]._handCard[i]._cardId != 0)) {
+ Card *handcard = &_gameBoardSide[2]._handCard[i];
+ _selectedCard._cardId = handcard->_cardId;
+ _selectedCard._stationPos = handcard->_stationPos;
+ // _selectedCard._actorName = handcard->_actorName;
+ _selectedCard._fieldE = handcard->_fieldE;
+ _selectedCard._field10 = handcard->_field10;
+ warning("_selectedCard._field12 = handcard->_field12;");
+ warning("_selectedCard._field14 = handcard->_field14;");
+ warning("_selectedCard._field16 = handcard->_field16;");
+ _selectedCard._sceneRegionId = handcard->_sceneRegionId;
+ _selectedCard._position = handcard->_position;
+ _selectedCard._yDiff = handcard->_yDiff;
+ _selectedCard._bounds = handcard->_bounds;
+ _selectedCard._resNum = handcard->_resNum;
+ _selectedCard._lookLineNum = handcard->_lookLineNum;
+ _selectedCard._talkLineNum = handcard->_talkLineNum;
+ _selectedCard._useLineNum = handcard->_useLineNum;
+ _selectedCard._action = handcard->_action;
+ warning("_selectedCard._field0 = handcard->_field0;");
+ _selectedCard._card._updateStartFrame = handcard->_card._updateStartFrame;
+ _selectedCard._card._walkStartFrame = handcard->_card._walkStartFrame;
// _field2E is named _field3C in R2R
- _item6._card._field2E = _gameBoardSide[2]._handCard[di]._card._field2E;
- _item6._card._percent = _gameBoardSide[2]._handCard[di]._card._percent;
- _item6._card._priority = _gameBoardSide[2]._handCard[di]._card._priority;
- _item6._card._angle = _gameBoardSide[2]._handCard[di]._card._angle;
- _item6._card._flags = _gameBoardSide[2]._handCard[di]._card._flags;
- _item6._card._xe = _gameBoardSide[2]._handCard[di]._card._xe;
- _item6._card._xs = _gameBoardSide[2]._handCard[di]._card._xs;
- _item6._card._paneRects[0] = _gameBoardSide[2]._handCard[di]._card._paneRects[0];
- _item6._card._paneRects[1] = _gameBoardSide[2]._handCard[di]._card._paneRects[1];
- _item6._card._visage = _gameBoardSide[2]._handCard[di]._card._visage;
- _item6._card._objectWrapper = _gameBoardSide[2]._handCard[di]._card._objectWrapper;
- _item6._card._strip = _gameBoardSide[2]._handCard[di]._card._strip;
- _item6._card._animateMode = _gameBoardSide[2]._handCard[di]._card._animateMode;
- _item6._card._frame = _gameBoardSide[2]._handCard[di]._card._frame;
- _item6._card._endFrame = _gameBoardSide[2]._handCard[di]._card._endFrame;
+ _selectedCard._card._field2E = handcard->_card._field2E;
+ _selectedCard._card._percent = handcard->_card._percent;
+ _selectedCard._card._priority = handcard->_card._priority;
+ _selectedCard._card._angle = handcard->_card._angle;
+ _selectedCard._card._flags = handcard->_card._flags;
+ _selectedCard._card._xe = handcard->_card._xe;
+ _selectedCard._card._xs = handcard->_card._xs;
+ _selectedCard._card._paneRects[0] = handcard->_card._paneRects[0];
+ _selectedCard._card._paneRects[1] = handcard->_card._paneRects[1];
+ _selectedCard._card._visage = handcard->_card._visage;
+ _selectedCard._card._objectWrapper = handcard->_card._objectWrapper;
+ _selectedCard._card._strip = handcard->_card._strip;
+ _selectedCard._card._animateMode = handcard->_card._animateMode;
+ _selectedCard._card._frame = handcard->_card._frame;
+ _selectedCard._card._endFrame = handcard->_card._endFrame;
// _field68 is named _field76 in R2R
- _item6._card._field68 = _gameBoardSide[2]._handCard[di]._card._field68;
- _item6._card._frameChange = _gameBoardSide[2]._handCard[di]._card._frameChange;
- _item6._card._numFrames = _gameBoardSide[2]._handCard[di]._card._numFrames;
- _item6._card._regionIndex = _gameBoardSide[2]._handCard[di]._card._regionIndex;
- _item6._card._mover = _gameBoardSide[2]._handCard[di]._card._mover;
- _item6._card._moveDiff = _gameBoardSide[2]._handCard[di]._card._moveDiff;
- _item6._card._moveRate = _gameBoardSide[2]._handCard[di]._card._moveRate;
- _item6._card._actorDestPos = _gameBoardSide[2]._handCard[di]._card._actorDestPos;
- _item6._card._endAction = _gameBoardSide[2]._handCard[di]._card._endAction;
- _item6._card._regionBitList = _gameBoardSide[2]._handCard[di]._card._regionBitList;
- // _item6._object1._actorName = _arrunkObj1337[2]._arr1[di]._object1._actorName;
- _item6._card._fieldE = _gameBoardSide[2]._handCard[di]._card._fieldE;
- _item6._card._field10 = _gameBoardSide[2]._handCard[di]._card._field10;
- warning("_item6._object1._field12 = _arrunkObj1337[2]._arr1[di]._object1._field12;");
- warning("_item6._object1._field14 = _arrunkObj1337[2]._arr1[di]._object1._field14;");
- warning("_item6._object1._field16 = _arrunkObj1337[2]._arr1[di]._object1._field16;");
- _item6._card = _gameBoardSide[2]._handCard[di]._card;
- }
- }
-
- if (di == 4) {
- subCDB90(1, _item6._stationPos);
+ _selectedCard._card._field68 = handcard->_card._field68;
+ _selectedCard._card._frameChange = handcard->_card._frameChange;
+ _selectedCard._card._numFrames = handcard->_card._numFrames;
+ _selectedCard._card._regionIndex = handcard->_card._regionIndex;
+ _selectedCard._card._mover = handcard->_card._mover;
+ _selectedCard._card._moveDiff = handcard->_card._moveDiff;
+ _selectedCard._card._moveRate = handcard->_card._moveRate;
+ _selectedCard._card._actorDestPos = handcard->_card._actorDestPos;
+ _selectedCard._card._endAction = handcard->_card._endAction;
+ _selectedCard._card._regionBitList = handcard->_card._regionBitList;
+ // _selectedCard._object1._actorName = handcard->_object1._actorName;
+ _selectedCard._card._fieldE = handcard->_card._fieldE;
+ _selectedCard._card._field10 = handcard->_card._field10;
+ warning("_selectedCard._card._field12 = handcard->_card._field12;");
+ warning("_selectedCard._card._field14 = handcard->_card._field14;");
+ warning("_selectedCard._card._field16 = handcard->_card._field16;");
+ // _selectedCard._card = _gameBoardSide[2]._handCard[i]._card;
+
+ _gameBoardSide[2]._handCard[i]._cardId = 0;
+ _gameBoardSide[2]._handCard[i]._card.remove();
+ break;
+ }
+ }
+
+ if (i == 4) {
+ subCDB90(1, _selectedCard._stationPos);
subD0281();
return;
+ } else {
+ setCursorData(1332, _selectedCard._card._strip, _selectedCard._card._frame);
+ R2_GLOBALS._sceneObjects->draw();
}
} else if (R2_GLOBALS._v57810 == 300) {
- subCDB90(3, _item6._stationPos);
+ subCDB90(3, _selectedCard._stationPos);
subD0281();
return;
} else {
@@ -6471,22 +6487,19 @@ void Scene1337::subD02CA() {
return;
}
- // That continues the block when R2_GLOBALS._v57810 == 200 and di != 4
- setCursorData(1332, _item6._card._strip, _item6._card._frame);
- R2_GLOBALS._sceneObjects->draw();
Event event;
bool found = false;
bool found_di;
for (;;) {
if ( ((g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN)) && (event.btnState == BTNSHIFT_RIGHT))
|| (g_globals->_events.getEvent(event, EVENT_KEYPRESS)) ){
- _item6._stationPos = g_globals->_events._mousePos;
+ _selectedCard._stationPos = g_globals->_events._mousePos;
found_di = false;
for (int i = 0; i <= 3; i ++) {
- if (subC2BF8(&_gameBoardSide[2]._handCard[i], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
+ if (_gameBoardSide[2]._handCard[i].isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
if (_gameBoardSide[2]._handCard[i]._cardId == 0) {
- _gameBoardSide[2]._handCard[i]._cardId = _item6._cardId;
+ _gameBoardSide[2]._handCard[i]._cardId = _selectedCard._cardId;
_gameBoardSide[2]._handCard[i]._card.postInit();
_gameBoardSide[2]._handCard[i]._card.hide();
_gameBoardSide[2]._handCard[i]._card.setVisage(1332);
@@ -6507,34 +6520,34 @@ void Scene1337::subD02CA() {
}
if ((!found) && (!found_di)) {
- if (subC2BF8(&_discardPile, Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
- subC4A39(&_item6);
+ if (_discardPile.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
+ subC4A39(&_selectedCard);
} else if (!found) {
bool foundVar4;
int i;
- if (_item6._cardId == 1) {
+ if (_selectedCard._cardId == 1) {
foundVar4 = false;
for (i = 0; i <= 7; i++) {
- if (subC2BF8(&_gameBoardSide[2]._outpostStation[i], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
+ if (_gameBoardSide[2]._outpostStation[i].isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
foundVar4 = true;
break;
}
}
if ((foundVar4) && (_gameBoardSide[2]._outpostStation[i]._cardId == 0)) {
- if (subC27B5(_gameBoardSide[2]._delayPile[0]._cardId) != -1) {
+ if (subC27B5(_gameBoardSide[2]._delayCard._cardId) != -1) {
actionDisplay(1330, 55, 159, 10, 1, 200, 0, 7, 0, 154, 154);
} else {
- subC340B(&_item6, &_gameBoardSide[2]._outpostStation[i]);
+ subC340B(&_selectedCard, &_gameBoardSide[2]._outpostStation[i]);
return;
}
} else {
actionDisplay(1330, 56, 159, 10, 1, 200, 0, 7, 0, 154, 154);
}
- } else if (_item6._cardId <= 9) {
+ } else if (_selectedCard._cardId <= 9) {
foundVar4 = false;
for (i = 0; i <= 7; i++) {
- if (subC2BF8(&_gameBoardSide[2]._outpostStation[i], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
+ if (_gameBoardSide[2]._outpostStation[i].isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
foundVar4 = true;
break;
}
@@ -6543,32 +6556,32 @@ void Scene1337::subD02CA() {
foundVar4 = false;
int j;
for (j = 0; j <= 7; j++) {
- if (_item6._cardId == _gameBoardSide[2]._outpostStation[j]._cardId) {
+ if (_selectedCard._cardId == _gameBoardSide[2]._outpostStation[j]._cardId) {
foundVar4 = true;
break;
}
}
if (foundVar4) {
actionDisplay(1330, 34, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- } else if (subC27B5(_gameBoardSide[2]._delayPile[0]._cardId) != -1) {
+ } else if (subC27B5(_gameBoardSide[2]._delayCard._cardId) != -1) {
actionDisplay(1330, 35, 159, 10, 1, 200, 0, 7, 0, 154, 154);
} else {
if (j == 7)
_field424A = 2;
- subC33C0(&_item6, &_gameBoardSide[2]._outpostStation[i]);
+ subC33C0(&_selectedCard, &_gameBoardSide[2]._outpostStation[i]);
return;
}
} else {
actionDisplay(1330, 37, 159, 10, 1, 200, 0, 7, 0, 154, 154);
}
} else {
- if ((_item6._cardId == 26) || (_item6._cardId == 30) ||(_item6._cardId == 32) || (_item6._cardId == 28)) {
- if (subC2BF8(&_gameBoardSide[2]._delayPile[0], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
+ if ((_selectedCard._cardId == 26) || (_selectedCard._cardId == 30) ||(_selectedCard._cardId == 32) || (_selectedCard._cardId == 28)) {
+ if (_gameBoardSide[2]._delayCard.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
actionDisplay(1330, 42, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- } else if (!subC3386(_gameBoardSide[2]._delayPile[0]._cardId, _item6._cardId)) {
- if (_gameBoardSide[2]._delayPile[0]._cardId != 0) {
- switch (_gameBoardSide[2]._delayPile[0]._cardId) {
+ } else if (!subC3386(_gameBoardSide[2]._delayCard._cardId, _selectedCard._cardId)) {
+ if (_gameBoardSide[2]._delayCard._cardId != 0) {
+ switch (_gameBoardSide[2]._delayCard._cardId) {
case 11:
actionDisplay(1330, 68, 159, 10, 1, 200, 0, 7, 0, 154, 154);
break;
@@ -6588,36 +6601,36 @@ void Scene1337::subD02CA() {
actionDisplay(1330, 41, 159, 10, 1, 200, 0, 7, 0, 154, 154);
}
} else {
- subC34A1(&_item6, &_gameBoardSide[2]._delayPile[0]);
+ subC34A1(&_selectedCard, &_gameBoardSide[2]._delayCard);
return;
}
} else {
- if ((subC27F9(_item6._cardId) == -1) && (subC27B5(_item6._cardId) == -1)) {
- if (_item6._cardId == 13) {
- if (subC2BF8(&_gameBoardSide[0]._arr4[0], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
+ if ((subC27F9(_selectedCard._cardId) == -1) && (subC27B5(_selectedCard._cardId) == -1)) {
+ if (_selectedCard._cardId == 13) {
+ if (_gameBoardSide[0]._emptyStationPos.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
for (int k = 0; k <= 7; k++) {
if (_gameBoardSide[0]._outpostStation[k]._cardId != 0) {
found = true;
- subC358E(&_item6, 0);
+ subC358E(&_selectedCard, 0);
}
}
if (!found)
actionDisplay(1330, 74, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- } else if (subC2BF8(&_gameBoardSide[3]._arr4[0], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
+ } else if (_gameBoardSide[3]._emptyStationPos.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
for (int k = 0; k <= 7; k++) {
if (_gameBoardSide[3]._outpostStation[k]._cardId != 0) {
found = true;
- subC358E(&_item6, 3);
+ subC358E(&_selectedCard, 3);
}
}
if (!found)
actionDisplay(1330, 74, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- } else if (subC2BF8(&_gameBoardSide[1]._arr4[0], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
+ } else if (_gameBoardSide[1]._emptyStationPos.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
for (int k = 0; k <= 7; k++) {
if (_gameBoardSide[1]._outpostStation[k]._cardId == 0) {
found = true;
- subC358E(&_item6, 1);
+ subC358E(&_selectedCard, 1);
}
}
if (!found)
@@ -6625,9 +6638,9 @@ void Scene1337::subD02CA() {
} else {
actionDisplay(1330, 128, 159, 10, 1, 200, 0, 7, 0, 154, 154);
}
- } else if (_item6._cardId == 25) {
+ } else if (_selectedCard._cardId == 25) {
int k;
- if (subC2BF8(&_gameBoardSide[0]._arr4[0], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
+ if (_gameBoardSide[0]._emptyStationPos.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
if ( (_gameBoardSide[0]._handCard[0]._cardId != 0)
|| (_gameBoardSide[0]._handCard[1]._cardId != 0)
|| (_gameBoardSide[0]._handCard[2]._cardId != 0)
@@ -6641,7 +6654,7 @@ void Scene1337::subD02CA() {
} else {
actionDisplay(1330, 99, 159, 10, 1, 200, 0, 7, 0, 154, 154);
}
- } else if (subC2BF8(&_gameBoardSide[1]._arr4[0], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
+ } else if (_gameBoardSide[1]._emptyStationPos.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
if ( (_gameBoardSide[1]._handCard[0]._cardId != 0)
|| (_gameBoardSide[1]._handCard[1]._cardId != 0)
|| (_gameBoardSide[1]._handCard[2]._cardId != 0)
@@ -6657,7 +6670,7 @@ void Scene1337::subD02CA() {
}
}
- if (subC2BF8(&_gameBoardSide[3]._arr4[0], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
+ if (_gameBoardSide[3]._emptyStationPos.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
if ( (_gameBoardSide[3]._handCard[0]._cardId != 0)
|| (_gameBoardSide[3]._handCard[1]._cardId != 0)
|| (_gameBoardSide[3]._handCard[2]._cardId != 0)
@@ -6674,17 +6687,17 @@ void Scene1337::subD02CA() {
} else {
actionDisplay(1330, 129, 159, 10, 1, 200, 0, 7, 0, 154, 154);
}
- } else if (_item6._cardId == 29) {
+ } else if (_selectedCard._cardId == 29) {
actionDisplay(1330, 136, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- } else if (_item6._cardId == 27) {
+ } else if (_selectedCard._cardId == 27) {
actionDisplay(1330, 137, 159, 10, 1, 200, 0, 7, 0, 154, 154);
}
} else {
- if (subC2BF8(&_gameBoardSide[0]._delayPile[0], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
- if (_gameBoardSide[0]._delayPile[0]._cardId != 0) {
+ if (_gameBoardSide[0]._delayCard.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
+ if (_gameBoardSide[0]._delayCard._cardId != 0) {
actionDisplay(1330, 15, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- } else if (!subC32B1(0, _item6._cardId)) {
- switch (_item6._cardId) {
+ } else if (!subC32B1(0, _selectedCard._cardId)) {
+ switch (_selectedCard._cardId) {
case 10:
actionDisplay(1330, 66, 159, 10, 1, 200, 0, 7, 0, 154, 154);
break;
@@ -6713,14 +6726,14 @@ void Scene1337::subD02CA() {
break;
}
} else {
- subC3456(&_item6, &_gameBoardSide[0]._delayPile[0]);
+ subC3456(&_selectedCard, &_gameBoardSide[0]._delayCard);
found = true;
}
- } else if (subC2BF8(&_gameBoardSide[3]._delayPile[0], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
- if (_gameBoardSide[3]._delayPile[0]._cardId != 0) {
+ } else if (_gameBoardSide[3]._delayCard.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
+ if (_gameBoardSide[3]._delayCard._cardId != 0) {
actionDisplay(1330, 17, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- } else if (!subC32B1(3, _item6._cardId)) {
- switch (_item6._cardId) {
+ } else if (!subC32B1(3, _selectedCard._cardId)) {
+ switch (_selectedCard._cardId) {
case 10:
actionDisplay(1330, 66, 159, 10, 1, 200, 0, 7, 0, 154, 154);
break;
@@ -6749,14 +6762,14 @@ void Scene1337::subD02CA() {
break;
}
} else {
- subC3456(&_item6, &_gameBoardSide[3]._delayPile[0]);
+ subC3456(&_selectedCard, &_gameBoardSide[3]._delayCard);
found = true;
}
- } else if (subC2BF8(&_gameBoardSide[1]._delayPile[0], Common::Point(_item6._stationPos.x + 12, _item6._stationPos.y + 12)) != 0) {
- if (_gameBoardSide[1]._delayPile[0]._cardId != 0) {
+ } else if (_gameBoardSide[1]._delayCard.isIn(Common::Point(_selectedCard._stationPos.x + 12, _selectedCard._stationPos.y + 12))) {
+ if (_gameBoardSide[1]._delayCard._cardId != 0) {
actionDisplay(1330, 19, 159, 10, 1, 200, 0, 7, 0, 154, 154);
- } else if (!subC32B1(1, _item6._cardId)) {
- switch (_item6._cardId) {
+ } else if (!subC32B1(1, _selectedCard._cardId)) {
+ switch (_selectedCard._cardId) {
case 10:
actionDisplay(1330, 66, 159, 10, 1, 200, 0, 7, 0, 154, 154);
break;
@@ -6785,7 +6798,7 @@ void Scene1337::subD02CA() {
break;
}
} else {
- subC3456(&_item6, &_gameBoardSide[1]._delayPile[0]);
+ subC3456(&_selectedCard, &_gameBoardSide[1]._delayCard);
found = true;
}
} else {
@@ -6858,6 +6871,7 @@ void Scene1337::setCursorData(int resNum, int rlbNum, int frameNum) {
}
void Scene1337::subD18F5() {
+ warning("subD18F5 - %d", R2_GLOBALS._v57709);
if (R2_GLOBALS._v57709 == 0)
R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
@@ -6865,6 +6879,7 @@ void Scene1337::subD18F5() {
}
void Scene1337::subD1917() {
+ warning("subD1917 - %d", R2_GLOBALS._v57709);
if (R2_GLOBALS._v57709 != 0) {
R2_GLOBALS._v57709--;
if (R2_GLOBALS._v57709 != 0) {
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h
index 45ed746bac..0ac7c663b5 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.h
@@ -183,31 +183,32 @@ public:
};
class Scene1337 : public SceneExt {
- class unkObj1337sub1: public SceneHotspot {
+ class Card: public SceneHotspot {
public:
SceneObject _card;
int _cardId;
Common::Point _stationPos;
- unkObj1337sub1();
+ Card();
void synchronize(Serializer &s);
+ bool isIn(Common::Point pt);
};
- class unkObj1337_1: public SceneHotspot {
+ class GameBoardSide: public SceneHotspot {
public:
- unkObj1337sub1 _handCard[4];
- unkObj1337sub1 _outpostStation[8];
- unkObj1337sub1 _delayPile[1];
- unkObj1337sub1 _arr4[1];
+ Card _handCard[4];
+ Card _outpostStation[8];
+ Card _delayCard;
+ Card _emptyStationPos;
- Common::Point _fieldB94;
- Common::Point _fieldB98;
- Common::Point _fieldB9C;
- Common::Point _fieldBA0;
- int _fieldBA4;
+ Common::Point _card1Pos;
+ Common::Point _card2Pos;
+ Common::Point _card3Pos;
+ Common::Point _card4Pos;
+ int _frameNum;
- unkObj1337_1();
+ GameBoardSide();
void synchronize(Serializer &s);
};
@@ -276,7 +277,7 @@ public:
ASound _aSound2;
BackgroundSceneObject _background1;
bool _autoplay;
- unkObj1337_1 _gameBoardSide[4];
+ GameBoardSide _gameBoardSide[4];
SceneItem _item1;
SceneObject _currentPlayerArrow;
Action1 _action1;
@@ -292,20 +293,22 @@ public:
Action11 _action11;
Action12 _action12;
Action13 _action13;
- unkObj1337sub1 _animatedCard;
- unkObj1337sub1 _shuffleAnimation;
- unkObj1337sub1 _item4;
+ Card _animatedCard;
+ Card _shuffleAnimation;
+ Card _item4;
BackgroundSceneObject _background2;
int _cardsAvailableNumb;
- int _field3E26;
+
+ // Discarded cards are put in the available cards pile, with an higher index so there no conflict
+ int _currentDiscardIndex;
int _availableCardsPile[100];
- unkObj1337sub1 *_field3EF0;
- unkObj1337sub1 *_field3EF4;
- unkObj1337sub1 *_field3EF8;
- unkObj1337sub1 _item5;
- unkObj1337sub1 _item6;
- unkObj1337sub1 _discardPile;
- unkObj1337sub1 _item8;
+ Card *_discardCard;
+ Card *_field3EF4;
+ Card *_field3EF8;
+ Card _item5;
+ Card _selectedCard;
+ Card _discardPile;
+ Card _stockPile;
bool _shuffleEndedFl;
int _currentPlayerNumb;
int _field4240;
@@ -313,7 +316,7 @@ public:
bool _field4244;
bool _field4246;
int _field424A;
- int _instructionsDisplayedFl;
+ bool _instructionsDisplayedFl;
int _instructionsWaitCount;
int _cursorCurRes;
int _cursorCurStrip;
@@ -326,7 +329,7 @@ public:
virtual void synchronize(Serializer &s);
void actionDisplay(int resNum, int lineNum, int x, int y, int arg5, int width, int textMode, int fontNum, int colFG, int colBGExt, int colFGExt);
- void setAnimationInfo(unkObj1337sub1 *subObj);
+ void setAnimationInfo(Card *subObj);
void subC20E5();
void subC20F9();
void subC2586();
@@ -339,30 +342,29 @@ public:
int subC27B5(int arg1);
int subC27F9(int arg1);
void subC2835(int arg1);
- bool subC2BF8(unkObj1337sub1 *subObj1, Common::Point pt);
void subC2C2F();
- void subC318B(int arg1, unkObj1337sub1 *subObj2, int arg3);
+ void subC318B(int arg1, Card *subObj2, int arg3);
int subC3257(int arg1);
bool subC32B1(int arg1, int arg2);
int subC331B(int arg1);
bool subC3386(int arg1, int arg2);
- void subC33C0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
- void subC3456(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
- void subC340B(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
- void subC34A1(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
- unkObj1337sub1 *subC34EC(int arg1);
- void subC358E(unkObj1337sub1 *subObj1, int arg2);
+ void subC33C0(Card *subObj1, Card *subObj2);
+ void subC3456(Card *subObj1, Card *subObj2);
+ void subC340B(Card *subObj1, Card *subObj2);
+ void subC34A1(Card *subObj1, Card *subObj2);
+ Card *subC34EC(int arg1);
+ void subC358E(Card *subObj1, int arg2);
int subC3E92(int arg1);
- void subC4A39(unkObj1337sub1 *subObj);
+ void subC4A39(Card *subObj);
void subC4CD2();
void subC4CEC();
- void subC51A0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
+ void subC51A0(Card *subObj1, Card *subObj2);
void displayDialog(int dialogNumb);
void subPostInit();
void displayInstructions();
void suggestInstructions();
void shuffleCards();
- void firstShuffle();
+ void dealCards();
void subCD193();
void subCDB90(int arg1, Common::Point pt);
void subCF31D();
diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp
index 286f83defe..e39a15f469 100644
--- a/engines/wintermute/base/base_file_manager.cpp
+++ b/engines/wintermute/base/base_file_manager.cpp
@@ -246,8 +246,13 @@ bool BaseFileManager::registerPackages() {
// Italian
} else if (_language == Common::IT_ITA && (fileName != "italian.dcp" && fileName != "xlanguage_it.dcp")) {
continue;
+ // Latvian
+ } else if (_language == Common::LV_LAT && (fileName != "latvian.dcp" && fileName != "xlanguage_lv.dcp")) {
+ // TODO: 'latvian.dcp' is just guesswork. Is there any
+ // game using Latvian and using this filename?
+ continue;
// Polish
- } else if (_language == Common::PL_POL && (fileName != "polish.dcp" && fileName != "xlanguage_po.dcp")) {
+ } else if (_language == Common::PL_POL && (fileName != "polish.dcp" && fileName != "xlanguage_pl.dcp")) {
continue;
// Portuguese
} else if (_language == Common::PT_BRA && (fileName != "portuguese.dcp" && fileName != "xlanguage_pt.dcp")) {
diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h
index 46e05f2768..bec52c4957 100644
--- a/engines/wintermute/detection_tables.h
+++ b/engines/wintermute/detection_tables.h
@@ -689,6 +689,118 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO0()
},
+ // Reversion: The Escape Version 1.3.2369 (Chinese)
+ {
+ "reversion1",
+ "Version 1.3.2369",
+ {
+ {"xlanguage_nz.dcp", 0, "7146dfa43ffdf0886e034fffe2c8a0c0", 13722261},
+ {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204},
+ AD_LISTEND
+ },
+ Common::ZH_CNA,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Reversion: The Escape Version 1.3.2369 (English)
+ {
+ "reversion1",
+ "Version 1.3.2369",
+ {
+ {"xlanguage_en.dcp", 0, "64b6fa7eedc09c231f6ce046e77fee05", 11339619},
+ {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Reversion: The Escape Version 1.3.2369 (French)
+ {
+ "reversion1",
+ "Version 1.3.2369",
+ {
+ {"xlanguage_fr.dcp", 0, "d561d562224afea809153a1fd9fdb0c0", 11963210},
+ {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204},
+ AD_LISTEND
+ },
+ Common::FR_FRA,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Reversion: The Escape Version 1.3.2369 (German)
+ {
+ "reversion1",
+ "Version 1.3.2369",
+ {
+ {"xlanguage_de.dcp", 0, "4e3f614c36bd6bae74b8cc83e663a8f0", 14040310},
+ {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204},
+ AD_LISTEND
+ },
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Reversion: The Escape Version 1.3.2369 (Italian)
+ {
+ "reversion1",
+ "Version 1.3.2369",
+ {
+ {"xlanguage_it.dcp", 0, "10d09b7fe61946f09dd91d5e8d090f94", 11913752},
+ {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204},
+ AD_LISTEND
+ },
+ Common::IT_ITA,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Reversion: The Escape Version 1.3.2369 (Latvian)
+ {
+ "reversion1",
+ "Version 1.3.2369",
+ {
+ {"xlanguage_lv.dcp", 0, "704359ab5040b0dab6545064d7aa6eb9", 11414925},
+ {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204},
+ AD_LISTEND
+ },
+ Common::LV_LAT,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Reversion: The Escape Version 1.3.2369 (Polish)
+ {
+ "reversion1",
+ "Version 1.3.2369",
+ {
+ {"xlanguage_pl.dcp", 0, "c4ad33f57e1e998169552d521c1d6638", 11532215},
+ {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204},
+ AD_LISTEND
+ },
+ Common::PL_POL,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Reversion: The Escape Version 1.3.2369 (Portuguese)
+ {
+ "reversion1",
+ "Version 1.3.2369",
+ {
+ {"xlanguage_pt.dcp", 0, "886886b6b14aadac844078de856799a6", 10620797},
+ {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204},
+ AD_LISTEND
+ },
+ Common::PT_BRA,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
// Reversion: The Meeting (Chinese)
{
"reversion2",