[Scummvm-git-logs] scummvm master -> f61afc2b871e3c973033671b41626bca25a905f4
sluicebox
noreply at scummvm.org
Mon Dec 30 22:26:08 UTC 2024
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3138057f69 AGI: Implement AGIv1 set.bit and clear.bit opcodes
94c91b5439 AGI: PREAGI: Add missing left space to TROLL menus
f61afc2b87 SCI: Fix SQ5 introduction speeds
Commit: 3138057f690621238100c189cf05cfaab49e2526
https://github.com/scummvm/scummvm/commit/3138057f690621238100c189cf05cfaab49e2526
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-12-30T14:25:42-08:00
Commit Message:
AGI: Implement AGIv1 set.bit and clear.bit opcodes
Changed paths:
engines/agi/op_cmd.cpp
engines/agi/opcodes.cpp
engines/agi/opcodes.h
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 42c73ecb410..2bd64b652d7 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -2299,6 +2299,22 @@ void cmdNewRoomVV1(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
vm->setVar(13, 1);
}
+void cmdSetBit(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
+ uint16 bit = parameter[0];
+ uint16 varNr = parameter[1];
+
+ byte varVal = vm->getVar(varNr);
+ vm->setVar(varNr, varVal | (1 << bit));
+}
+
+void cmdClearBit(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
+ uint16 bit = parameter[0];
+ uint16 varNr = parameter[1];
+
+ byte varVal = vm->getVar(varNr);
+ vm->setVar(varNr, varVal & ~(1 << bit));
+}
+
// The AGI256 interpreter modified opcode 170 to load 256 color pictures
void cmdAgi256LoadPic(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
// Load the picture. Similar to void cmdLoadPic.
diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp
index 1ad3b709cb1..237b03295f8 100644
--- a/engines/agi/opcodes.cpp
+++ b/engines/agi/opcodes.cpp
@@ -148,8 +148,8 @@ static const AgiOpCodeDefinitionEntry opCodesV1[] = {
{ "load.view", "n", &cmdLoadView }, // 5D
{ "...", "", &cmdUnknown }, // 5E unused in KQ2 or BC
{ "...", "", &cmdUnknown }, // 5F BC script 102 when attempting to fill flask
- { "setbit", "nv", &cmdUnknown }, // 60
- { "...", "nv", &cmdUnknown }, // 61 # clearbit, unused in KQ2 or BC
+ { "set.bit", "nv", &cmdSetBit }, // 60 BC
+ { "clear.bit", "nv", &cmdClearBit }, // 61
{ "set.upper.left", "nn", &cmdSetUpperLeft } // 62 BC Apple II
};
diff --git a/engines/agi/opcodes.h b/engines/agi/opcodes.h
index 4d3f745736e..26bf778eb49 100644
--- a/engines/agi/opcodes.h
+++ b/engines/agi/opcodes.h
@@ -225,6 +225,8 @@ void cmdAdjEgoMoveToXY(AgiGame *state, AgiEngine *vm, uint8 *p);
void cmdSetSpeed(AgiGame *state, AgiEngine *vm, uint8 *p);
void cmdSetItemView(AgiGame *state, AgiEngine *vm, uint8 *p);
void cmdCallV1(AgiGame *state, AgiEngine *vm, uint8 *p);
+void cmdSetBit(AgiGame *state, AgiEngine *vm, uint8 *p);
+void cmdClearBit(AgiGame *state, AgiEngine *vm, uint8 *p);
void cmdUnknown(AgiGame *state, AgiEngine *vm, uint8 *p);
void condEqual(AgiGame *state, AgiEngine *vm, uint8 *p);
Commit: 94c91b5439e1fce2e8a53a640dc793c03f8b23a9
https://github.com/scummvm/scummvm/commit/94c91b5439e1fce2e8a53a640dc793c03f8b23a9
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-12-30T14:25:42-08:00
Commit Message:
AGI: PREAGI: Add missing left space to TROLL menus
Changed paths:
engines/agi/preagi/troll.cpp
diff --git a/engines/agi/preagi/troll.cpp b/engines/agi/preagi/troll.cpp
index 3741fc21053..1081a6dc9dd 100644
--- a/engines/agi/preagi/troll.cpp
+++ b/engines/agi/preagi/troll.cpp
@@ -445,7 +445,9 @@ int TrollEngine::drawRoom(char *menu) {
_system->updateScreen();
int n = 0;
- strncat(menu, (char *)_gameData + _locMessagesIdx[_currentRoom], 39);
+ menu[0] = ' '; // leading space
+ menu[1] = '\0';
+ strncat(menu, (char *)_gameData + _locMessagesIdx[_currentRoom], 38);
for (int i = 0; i < 3; i++) {
if (_roomDescs[_roomPicture - 1].options[i]) {
@@ -550,8 +552,6 @@ void TrollEngine::gameLoop() {
memset(_inventory, 0, sizeof(_inventory));
while (!done && !shouldQuit()) {
- *menu = 0;
-
currentOption = 0;
numberOfOptions = drawRoom(menu);
Commit: f61afc2b871e3c973033671b41626bca25a905f4
https://github.com/scummvm/scummvm/commit/f61afc2b871e3c973033671b41626bca25a905f4
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-12-30T14:25:43-08:00
Commit Message:
SCI: Fix SQ5 introduction speeds
Fixes comets not animating in the star field, bug #15622
Fixes speed and timing when exiting simulator, bug #15610
The introduction scenes are heavily dependent on both CPU speed and the
undefined lag that occurs in the original interpreter when animating
many actors at once. Now our speed throttler adjusts for this.
Thanks to @GermanTribun and @eriktorbjorn for reporting.
Big thanks to @PickledDog for testing and recording on a 386 and a 486.
Changed paths:
engines/sci/engine/kmisc.cpp
engines/sci/engine/vm.h
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 0db69581e9e..5f3d20ce429 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -112,8 +112,7 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
uint32 neededSleep = g_sci->_speedThrottleDelay; // 30 ms (kSpeedThrottleDefaultDelay)
- // WORKAROUNDS for scripts that are polling too quickly in scenes that
- // are not animating much
+ // WORKAROUNDS for scripts that require specific speed throttling behavior
switch (g_sci->getGameId()) {
case GID_CASTLEBRAIN:
// In Castle of Dr. Brain, memory color matching puzzle in the first
@@ -139,6 +138,40 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
neededSleep = 60;
}
break;
+ case GID_SQ5:
+ switch (s->currentRoomNumber()) {
+ case 104:
+ // Introduction: star field. Requires extra speed throttling to achieve
+ // comet animations and intended timing. Comets and fast stars move at
+ // unthrottled speed, but the comet's animation cycle speed is based on
+ // clock time and unsynchronized with movement. On a 386/33, the comets
+ // animate and become streaks, but even a 486/50 is too fast for this.
+ // The comets move so fast that they reach their destination before they
+ // can animate beyond their initial 1x1 pixel cel. Bug #15622
+ s->_throttleTrigger = true;
+ neededSleep = 90;
+ break;
+ case 110: {
+ // Introduction: exiting the simulator. Requires extra speed throttling to
+ // achieve intended timing. All actors in this room have unthrottled speed.
+ // This may have been to compensate for the interpreter lag when animating
+ // so many actors. Without that lag, and the CPU this scene was timed for,
+ // everything moves and animates too fast. However, we must not apply extra
+ // throttling to the second half of this scene, or else ego will walk slowly.
+ // The original interpreter did not lag here, because it removed the earlier
+ // actors from the cast. We detect this by querying the cast size. Bug #15610
+ const reg_t cast = s->variables[VAR_GLOBAL][kGlobalVarCast];
+ const uint16 castSize = readSelectorValue(s->_segMan, cast, SELECTOR(size));
+ if (castSize != 5) { // only throttle before ego begins walking
+ s->_throttleTrigger = true;
+ neededSleep = 90;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
// Don't throttle SCI1.1 speed test rooms. Prevents delays at startup.
// We generically patch these scripts to calculate a passing result,
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index b114fb1849a..74dd6a1e7a6 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -145,6 +145,7 @@ enum GlobalVar {
kGlobalVarCurrentRoom = 2,
kGlobalVarSpeed = 3, // SCI16
kGlobalVarQuit = 4,
+ kGlobalVarCast = 5,
kGlobalVarSounds = 8,
kGlobalVarPlanes = 10, // SCI32
kGlobalVarCurrentRoomNo = 11,
More information about the Scummvm-git-logs
mailing list