[Scummvm-git-logs] scummvm master -> 8225b5e276f4d2acb1b5928fc2955677859d4896
AndywinXp
noreply at scummvm.org
Thu Sep 21 16:05:36 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8225b5e276 SWORD1: PSX: Correctly implement fnRandom() and fnIdle()
Commit: 8225b5e276f4d2acb1b5928fc2955677859d4896
https://github.com/scummvm/scummvm/commit/8225b5e276f4d2acb1b5928fc2955677859d4896
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-09-21T18:05:26+02:00
Commit Message:
SWORD1: PSX: Correctly implement fnRandom() and fnIdle()
This changes the timing intervalat which George performs his
idle animation. Thanks Joost Peters for pointing this out!
Changed paths:
engines/sword1/logic.cpp
engines/sword1/logic.h
diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index cb456c45a1d..c7e7bf3ac5b 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -983,6 +983,12 @@ int Logic::fnIdle(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int
// George never idles, he just does rest anims (if in suitable pose)
if (id == GEORGE) {
+ // The PSX deliberately sets a flag here to instruct fnRandom() to return
+ // the minimum value of the target random range;
+ // this changes the way (rather, the timing at which) George idles in-game.
+ if (SwordEngine::isPsx())
+ _psxFudgeRandom = true;
+
fnNewScript(cpt, id, SCR_george_rest_anim_script, 0, 0, 0, 0, 0);
} else {
cpt->o_logic = LOGIC_idle;
@@ -1551,7 +1557,15 @@ int Logic::fnGetToError(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32
}
int Logic::fnRandom(Object *compact, int32 id, int32 min, int32 max, int32 e, int32 f, int32 z, int32 x) {
- _scriptVars[RETURN_VALUE] = _rnd.getRandomNumberRng(min, max);
+ if (SwordEngine::isPsx() && _psxFudgeRandom) {
+ // If this PSX flag is active, just set the random value as the range minimum.
+ // This changes the timing at which George gets into is idle animation.
+ _psxFudgeRandom = false;
+ _scriptVars[RETURN_VALUE] = min;
+ } else {
+ _scriptVars[RETURN_VALUE] = _rnd.getRandomNumberRng(min, max);
+ }
+
return SCRIPT_CONT;
}
diff --git a/engines/sword1/logic.h b/engines/sword1/logic.h
index 73fe9cfc54d..0bb3ead688f 100644
--- a/engines/sword1/logic.h
+++ b/engines/sword1/logic.h
@@ -85,6 +85,7 @@ private:
bool _speechRunning, _speechFinished, _textRunning;
uint8 _speechClickDelay;
Common::RandomSource _rnd;
+ bool _psxFudgeRandom = false; // Used within fnIdle() and fnRandom() for the PSX version
int scriptManager(Object *compact, uint32 id);
void processLogic(Object *compact, uint32 id);
More information about the Scummvm-git-logs
mailing list