[Scummvm-git-logs] scummvm master -> eebdfa702903f8874b2eba1864c3dc102b066229
dreammaster
noreply at scummvm.org
Mon Jan 15 03:07:03 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8a3046c067 M4: RIDDLE: Add Riddle specific console sub-class
eebdfa7029 M4: RIDDLE: Properly implementing walker methods
Commit: 8a3046c067547f331c2d77742764bb203bc468cb
https://github.com/scummvm/scummvm/commit/8a3046c067547f331c2d77742764bb203bc468cb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-01-14T17:11:29-08:00
Commit Message:
M4: RIDDLE: Add Riddle specific console sub-class
Changed paths:
A engines/m4/riddle/console.cpp
A engines/m4/riddle/console.h
engines/m4/burger/console.cpp
engines/m4/burger/console.h
engines/m4/console.cpp
engines/m4/console.h
engines/m4/module.mk
engines/m4/riddle/riddle.cpp
diff --git a/engines/m4/burger/console.cpp b/engines/m4/burger/console.cpp
index a9c4ea1597f..0bc749c75f9 100644
--- a/engines/m4/burger/console.cpp
+++ b/engines/m4/burger/console.cpp
@@ -27,9 +27,26 @@ namespace M4 {
namespace Burger {
Console::Console() : M4::Console() {
+ registerCmd("global", WRAP_METHOD(Console, cmdGlobal));
registerCmd("test", WRAP_METHOD(Console, cmdTest));
}
+bool Console::cmdGlobal(int argc, const char **argv) {
+ if (argc == 2) {
+ int flagNum = atol(argv[1]);
+ debugPrintf("Global %d = %d\n", flagNum, _G(flags)[flagNum]);
+ } else if (argc == 3) {
+ int flagNum = atol(argv[1]);
+ int flagVal = atol(argv[2]);
+ _G(flags)[flagNum] = flagVal;
+ debugPrintf("Global set\n");
+ } else {
+ debugPrintf("Global <num> [<value>]\n");
+ }
+
+ return true;
+}
+
bool Console::cmdTest(int argc, const char **argv) {
int tests = _G(flags)[kFirstTestPassed] ? 1 : 0 +
_G(flags)[kSecondTestPassed] ? 1 : 0 +
@@ -41,6 +58,5 @@ bool Console::cmdTest(int argc, const char **argv) {
return true;
}
-
} // End of namespace Burger
} // End of namespace M4
diff --git a/engines/m4/burger/console.h b/engines/m4/burger/console.h
index b7e268d6959..69a8c9aecc3 100644
--- a/engines/m4/burger/console.h
+++ b/engines/m4/burger/console.h
@@ -31,6 +31,7 @@ namespace Burger {
class Console : public M4::Console {
private:
bool cmdTest(int argc, const char **argv);
+ bool cmdGlobal(int argc, const char **argv);
public:
Console();
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 407e7acfdd9..95091ec50e3 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -22,14 +22,11 @@
#include "m4/console.h"
#include "m4/m4.h"
#include "m4/vars.h"
-#include "m4/burger/vars.h"
-#include "m4/burger/burger.h"
namespace M4 {
Console::Console() : GUI::Debugger() {
registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
- registerCmd("global", WRAP_METHOD(Console, cmdGlobal));
registerCmd("item", WRAP_METHOD(Console, cmdItem));
registerCmd("hyperwalk", WRAP_METHOD(Console, cmdHyperwalk));
registerCmd("digi", WRAP_METHOD(Console, cmdDigi));
@@ -47,24 +44,6 @@ bool Console::cmdTeleport(int argc, const char **argv) {
}
}
-bool Console::cmdGlobal(int argc, const char **argv) {
- if (!Burger::g_vars) {
- debugPrintf("Not Orion Burger\n");
- } else if (argc == 2) {
- int flagNum = atol(argv[1]);
- debugPrintf("Global %d = %d\n", flagNum, Burger::g_vars->_flags[flagNum]);
- } else if (argc == 3) {
- int flagNum = atol(argv[1]);
- int flagVal = atol(argv[2]);
- Burger::g_vars->_flags[flagNum] = flagVal;
- debugPrintf("Global set\n");
- } else {
- debugPrintf("Global <num> [<value>]\n");
- }
-
- return true;
-}
-
bool Console::cmdItem(int argc, const char **argv) {
if (argc == 2) {
inv_give_to_player(argv[1]);
diff --git a/engines/m4/console.h b/engines/m4/console.h
index b7a2848497c..429a9ba73a6 100644
--- a/engines/m4/console.h
+++ b/engines/m4/console.h
@@ -30,7 +30,6 @@ namespace M4 {
class Console : public GUI::Debugger {
private:
bool cmdTeleport(int argc, const char **argv);
- bool cmdGlobal(int argc, const char **argv);
bool cmdItem(int argc, const char **argv);
bool cmdHyperwalk(int argc, const char **argv);
bool cmdDigi(int argc, const char **argv);
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 9868d874ca1..c893277fd8c 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -304,6 +304,7 @@ MODULE_OBJS = \
riddle/rooms/section9/room918.o \
riddle/rooms/section9/room996.o \
riddle/riddle.o \
+ riddle/console.o \
riddle/flags.o \
riddle/hotkeys.o \
riddle/inventory.o \
diff --git a/engines/m4/riddle/console.cpp b/engines/m4/riddle/console.cpp
new file mode 100644
index 00000000000..b8888166925
--- /dev/null
+++ b/engines/m4/riddle/console.cpp
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "m4/riddle/console.h"
+#include "m4/riddle/vars.h"
+#include "m4/riddle/riddle.h"
+
+namespace M4 {
+namespace Riddle {
+
+Console::Console() : M4::Console() {
+ registerCmd("global", WRAP_METHOD(Console, cmdGlobal));
+}
+
+bool Console::cmdGlobal(int argc, const char **argv) {
+ if (argc == 2) {
+ int flagNum = atol(argv[1]);
+ debugPrintf("Global %d = %d\n", flagNum, _G(flags)[flagNum]);
+ } else if (argc == 3) {
+ int flagNum = atol(argv[1]);
+ int flagVal = atol(argv[2]);
+ _G(flags)[flagNum] = flagVal;
+ debugPrintf("Global set\n");
+ } else {
+ debugPrintf("Global <num> [<value>]\n");
+ }
+
+ return true;
+}
+
+} // End of namespace Riddle
+} // End of namespace M4
diff --git a/engines/m4/riddle/console.h b/engines/m4/riddle/console.h
new file mode 100644
index 00000000000..4e51558e8cd
--- /dev/null
+++ b/engines/m4/riddle/console.h
@@ -0,0 +1,43 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef M4_RIDDLE_CONSOLE_H
+#define M4_RIDDLE_CONSOLE_H
+
+#include "m4/console.h"
+
+namespace M4 {
+namespace Riddle {
+
+class Console : public M4::Console {
+private:
+ bool cmdGlobal(int argc, const char **argv);
+
+public:
+ Console();
+ ~Console() override {}
+};
+
+} // End of namespace Riddle
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/riddle/riddle.cpp b/engines/m4/riddle/riddle.cpp
index 9216ee4f0e5..a3834725177 100644
--- a/engines/m4/riddle/riddle.cpp
+++ b/engines/m4/riddle/riddle.cpp
@@ -21,6 +21,7 @@
#include "common/debug.h"
#include "m4/riddle/riddle.h"
+#include "m4/riddle/console.h"
#include "m4/riddle/vars.h"
#include "m4/core/errors.h"
#include "m4/console.h"
@@ -46,7 +47,7 @@ M4::Vars *RiddleEngine::createVars() {
}
void RiddleEngine::setupConsole() {
- setDebugger(new M4::Console());
+ setDebugger(new Riddle::Console());
}
void RiddleEngine::showEngineInfo() {
Commit: eebdfa702903f8874b2eba1864c3dc102b066229
https://github.com/scummvm/scummvm/commit/eebdfa702903f8874b2eba1864c3dc102b066229
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-01-14T19:04:31-08:00
Commit Message:
M4: RIDDLE: Properly implementing walker methods
Changed paths:
engines/m4/adv_r/adv_trigger.cpp
engines/m4/burger/walker.cpp
engines/m4/riddle/walker.cpp
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index 8c12bdea4e1..c031a0200f5 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -44,7 +44,10 @@ int32 kernel_trigger_create(int32 trigger_num) {
}
bool kernel_trigger_dispatch_now(int32 trigger_num) {
- return kernel_trigger_dispatchx(kernel_trigger_create(trigger_num));
+ if (g_engine->getGameType() == GType_Riddle)
+ return kernel_trigger_dispatchx(trigger_num);
+ else
+ return kernel_trigger_dispatchx(kernel_trigger_create(trigger_num));
}
void cisco_dispatch_triggers() {
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index a2f255ef81a..8948fa18a11 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -36,12 +36,12 @@ namespace Burger {
#define NUM_SHADOW_SERIES 5
// These are the walker types
-#define WALKER_WILBUR 0
-#define WALKER_FLUMIX 1
+#define WALKER_PLAYER 0
+#define WALKER_ALT 1
// These are the shadow types
-#define SHADOW_WILBUR 0
-#define SHADOW_FLUMIX 1
+#define SHADOW_PLAYER 0
+#define SHADOW_ALT 1
static const char *WILBUR_SERIES[8] = {
"WILBUR01", "WILBUR02", "WILBUR03", "WILBUR04", "WILBUR05",
@@ -155,8 +155,8 @@ machine *Walker::walk_initialize_walker() {
_G(player).walker_visible = true;
// Wilbur walker
- _G(player).walker_type = WALKER_WILBUR;
- _G(player).shadow_type = SHADOW_WILBUR;
+ _G(player).walker_type = WALKER_PLAYER;
+ _G(player).shadow_type = SHADOW_PLAYER;
_G(globals)[GLB_TEMP_1] = _G(player).walker_type << 16;
_G(globals)[GLB_TEMP_2] = WALKER_SERIES_HASH << 24; // starting series hash of default walker GAMECTRL loads shadows starting @ 0
diff --git a/engines/m4/riddle/walker.cpp b/engines/m4/riddle/walker.cpp
index 4c335c108d7..ab241999374 100644
--- a/engines/m4/riddle/walker.cpp
+++ b/engines/m4/riddle/walker.cpp
@@ -36,117 +36,91 @@ namespace Riddle {
#define NUM_SHADOW_SERIES 5
// These are the walker types
-#define WALKER_WILBUR 0
-#define WALKER_FLUMIX 1
+#define WALKER_PLAYER 0
+#define WALKER_ALT 1
// These are the shadow types
-#define SHADOW_WILBUR 0
-#define SHADOW_FLUMIX 1
+#define SHADOW_PLAYER 0
+#define SHADOW_ALT 1
-static const char *WILBUR_SERIES[8] = {
- "WILBUR01", "WILBUR02", "WILBUR03", "WILBUR04", "WILBUR05",
- "WILBUR07", "WILBUR08", "WILBUR09"
+static const char *RIPLEY_SERIES[5] = {
+ "test1", "test2", "test3", "test4", "test5"
};
-static const int16 WILBUR_SERIES_DIRS[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, -1
+static const int16 RIPLEY_SERIES_DIRS[] = {
+ 0, 1, 2, 3, 4, -4
};
-static const char *WILBUR_SHADOWS[5] = {
- "WILBUR01_SHADOW", "WILBUR02_SHADOW", "WILBUR03_SHADOW",
- "WILBUR04_SHADOW", "WILBUR05_SHADOW"
+static const char *RIPLEY_SHADOWS[5] = {
+ "ripsh1", "ripsh2", "ripsh3", "ripsh4", "ripsh5"
};
-static const int16 WILBUR_SHADOWS_DIRS[6] = {
- 8, 9, 10, 11, 12, -1
+static const int16 RIPLEY_SHADOWS_DIRS[6] = {
+ 10, 11, 12, 13, 14, -1
+};
+
+static const char *SAFARI_SERIES[4] = {
+ "rip safari walker position 1",
+ "rip safari walker position 2",
+ "rip safari walker position 3",
+ "rip safari walker position 4"
+};
+static const int16 SAFARI_SERIES_DIRS[] = {
+ 0, 1, 2, 3, 4, -4
+};
+
+static const char *SAFARI_SHADOWS[8] = {
+ "safari shadow 1", "safari shadow 2", "safari shadow 3",
+ "safari shadow 4", "safari shadow 5", "trek feng walker pos 3",
+ "trek feng walker pos 4", "trek feng walker pos 5"
+};
+static const int16 SAFARI_SHADOWS_DIRS[6] = {
+ 10, 11, 12, 13, 14, -1
};
void Walker::player_walker_callback(frac16 myMessage, machine *sender) {
-#ifdef TODO
- int32 triggerType, soundNumber;
+ int32 triggerType, subVal;
triggerType = _G(globals)[GLB_TEMP_1] >> 16;
+ subVal = _G(globals)[GLB_TEMP_3] >> 16;
switch (triggerType) {
case 0:
+ default:
// Ignore this trigger, it's not important
- break;
+ return;
case 1:
- // Specific action is finished
- // If user trigger is desired, dispatch it
- if (myMessage >> 16 >= 0)
- // Trigger will go to where it was called from
- kernel_trigger_dispatchx(myMessage);
break;
case 2:
- // Walker has arrived at a node
- if (walker_has_walk_finished(sender)) {
- // Walks walker to next node if not at end of walk
- sendWSMessage(ENDWALK << 16, 0, sender, 0, nullptr, 1);
- }
+ if (walker_has_walk_finished(sender))
+ sendWSMessage(0x30000, 0, nullptr, 0, nullptr, 1);
+ else
+ _G(player).waiting_for_walk = false;
break;
case 3:
- // Walker has finished his walk and is facing final direction
- _G(player).waiting_for_walk = false;
-
- // if user trigger is desired, dispatch it
- if (myMessage >> 16 >= 0)
- // trigger will go to where it was called from
- kernel_trigger_dispatchx(myMessage);
- break;
-
- case 20:
- // Walker wants to make a sound
- soundNumber = myMessage >> 16;
- switch (soundNumber) {
- case 21:
- case 22:
- case 25:
- if (!_G(flags)[V298])
- _G(digi).playRandom();
- break;
-
- case 23:
- switch (imath_ranged_rand(1, 3)) {
- case 1:
- digi_play("crack1", 1, 50, NO_TRIGGER, GLOBAL_SCENE);
- break;
- case 2:
- digi_play("crack2", 1, 60, NO_TRIGGER, GLOBAL_SCENE);
- break;
- case 3:
- digi_play("crack3", 1, 80, NO_TRIGGER, GLOBAL_SCENE);
- break;
- default:
- break;
- }
- break;
-
- case 24:
- if (!_G(flags)[V298])
- digi_play("hmmm", 1, 60, NO_TRIGGER, GLOBAL_SCENE);
- break;
-
- default:
- break;
- }
- break;
-
- default:
_G(player).waiting_for_walk = false;
break;
}
-#endif
+
+ if (triggerType >= 0)
+ kernel_trigger_dispatchx(myMessage);
}
bool Walker::walk_load_walker_and_shadow_series() {
- return ws_walk_load_walker_series(WILBUR_SERIES_DIRS, WILBUR_SERIES, true) &&
- ws_walk_load_shadow_series(WILBUR_SHADOWS_DIRS, WILBUR_SHADOWS);
+ switch (_G(player).walker_type) {
+ case 0:
+ return ws_walk_load_walker_series(RIPLEY_SERIES_DIRS, RIPLEY_SERIES, true) &&
+ ws_walk_load_shadow_series(RIPLEY_SHADOWS_DIRS, RIPLEY_SHADOWS);
+ case 1:
+ return ws_walk_load_walker_series(SAFARI_SERIES_DIRS, SAFARI_SERIES, true) &&
+ ws_walk_load_shadow_series(SAFARI_SHADOWS_DIRS, SAFARI_SHADOWS);
+ default:
+ return false;
+ }
}
machine *Walker::walk_initialize_walker() {
-#ifdef TODO
machine *m;
int32 s;
@@ -158,8 +132,8 @@ machine *Walker::walk_initialize_walker() {
_G(player).walker_visible = true;
// Wilbur walker
- _G(player).walker_type = WALKER_WILBUR;
- _G(player).shadow_type = SHADOW_WILBUR;
+ _G(player).walker_type = WALKER_PLAYER;
+ _G(player).shadow_type = SHADOW_PLAYER;
_G(globals)[GLB_TEMP_1] = _G(player).walker_type << 16;
_G(globals)[GLB_TEMP_2] = WALKER_SERIES_HASH << 24; // starting series hash of default walker GAMECTRL loads shadows starting @ 0
@@ -172,7 +146,7 @@ machine *Walker::walk_initialize_walker() {
_G(globals)[GLB_TEMP_6] = s;
_G(globals)[GLB_TEMP_7] = 3 << 16; // facing
- m = TriggerMachineByHash(WALKER_HASH, nullptr, _G(player).walker_type + WALKER_HASH, 0, player_walker_callback, false, "Wilbur Walker");
+ m = TriggerMachineByHash(WALKER_HASH, nullptr, _G(player).walker_type + WALKER_HASH, 0, player_walker_callback, false, "PLAYER WALKER");
// we need to all init sequences to happen immediately (init coordinates)
cycleEngines(nullptr, &(_G(currentSceneDef).depth_table[0]),
@@ -182,23 +156,10 @@ machine *Walker::walk_initialize_walker() {
}
return m;
-#else
- return nullptr;
-#endif
}
void Walker::reset_walker_sprites() {
-#ifdef TODO
- if (_G(roomVal3)) {
- for (int i = 0; WILBUR_SERIES_DIRS[i] != -1; ++i) {
- series_load(WILBUR_SERIES[i], WILBUR_SERIES_DIRS[i]);
- }
- }
-
- ws_unhide_walker(_G(my_walker));
- gr_restore_palette();
- kernel_timing_trigger(1, 1026);
-#endif
+ error("TODO: reset_walker_sprites");
}
void Walker::unloadSprites() {
@@ -234,12 +195,16 @@ void player_walk_to(int32 x, int32 y, int32 facing_x, int32 facing_y, int trigge
_G(player_facing_y) = facing_y;
_G(player_trigger) = trigger;
player_hotspot_walk_override(x, y, -1, gSET_FACING);
+#else
+ error("TODO: player_walk_to");
#endif
}
void player_walk_to(int32 x, int32 y, int trigger) {
#ifdef TODO
player_walk_to(x, y, _G(hotspot_x), _G(hotspot_y), trigger);
+#else
+ error("TODO: player_walk_to");
#endif
}
More information about the Scummvm-git-logs
mailing list