diff options
author | Martin Kiewitz | 2016-02-14 23:05:28 +0100 |
---|---|---|
committer | Martin Kiewitz | 2016-02-14 23:05:28 +0100 |
commit | 873ba15b66b799641d2f22ac00df2142e84c0101 (patch) | |
tree | 4b4fe2bb938db74fac7e4256609f5d6515f1d27f /engines/agi | |
parent | 7b75936f56fc5ea089e3fc957a113dc7577e832f (diff) | |
download | scummvm-rg350-873ba15b66b799641d2f22ac00df2142e84c0101.tar.gz scummvm-rg350-873ba15b66b799641d2f22ac00df2142e84c0101.tar.bz2 scummvm-rg350-873ba15b66b799641d2f22ac00df2142e84c0101.zip |
AGI: Changes to vm var seconds heuristic (delay loop detection)
- small fix (forgot to reset the hit counter)
- rename methods
- added more information about PQ1 in comment
Diffstat (limited to 'engines/agi')
-rw-r--r-- | engines/agi/agi.h | 6 | ||||
-rw-r--r-- | engines/agi/global.cpp | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/engines/agi/agi.h b/engines/agi/agi.h index ad5d320f27..fe70c4ebc2 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -863,8 +863,10 @@ public: void executeAgiCommand(uint8, uint8 *); private: - void resetGetVarSecondsHeuristic(); uint32 _instructionCounter; /**< counts every instruction, that got executed, can wrap around */ + + void resetGetVarSecondsHeuristic(); + void getVarSecondsHeuristicTrigger(); uint32 _getVarSecondsHeuristicLastInstructionCounter; /**< last time VM_VAR_SECONDS were read */ uint16 _getVarSecondsHeuristicCounter; /**< how many times heuristic was triggered */ @@ -961,8 +963,6 @@ private: public: void redrawScreen(); - void getVarSecondsTrigger(); - void inGameTimerReset(uint32 newPlayTime = 0); void inGameTimerResetPassedCycles(); void inGameTimerPause(); diff --git a/engines/agi/global.cpp b/engines/agi/global.cpp index fe3beccb33..a7a39e9767 100644 --- a/engines/agi/global.cpp +++ b/engines/agi/global.cpp @@ -62,7 +62,7 @@ void AgiEngine::setVar(int16 varNr, byte newValue) { byte AgiEngine::getVar(int16 varNr) { switch (varNr) { case VM_VAR_SECONDS: - getVarSecondsTrigger(); + getVarSecondsHeuristicTrigger(); // is supposed to fall through case VM_VAR_MINUTES: case VM_VAR_HOURS: @@ -144,7 +144,7 @@ void AgiEngine::resetGetVarSecondsHeuristic() { } // Called, when the scripts read VM_VAR_SECONDS -void AgiEngine::getVarSecondsTrigger() { +void AgiEngine::getVarSecondsHeuristicTrigger() { uint32 counterDifference = _instructionCounter - _getVarSecondsHeuristicLastInstructionCounter; if (counterDifference <= 3) { @@ -153,7 +153,7 @@ void AgiEngine::getVarSecondsTrigger() { if (_getVarSecondsHeuristicCounter > 20) { // More than 20 times in a row? This really seems to be an inner loop waiting for seconds to change // This happens in at least: - // Police Quest 1 - Poker game + // Police Quest 1 - Poker game (room 75, responsible script 81) // Wait a few milliseconds, get events and update screen // We MUST NOT process AGI events in here @@ -163,6 +163,8 @@ void AgiEngine::getVarSecondsTrigger() { _getVarSecondsHeuristicCounter = 0; } + } else { + _getVarSecondsHeuristicCounter = 0; } _getVarSecondsHeuristicLastInstructionCounter = _instructionCounter; } |