[Scummvm-cvs-logs] scummvm master -> 873ba15b66b799641d2f22ac00df2142e84c0101

m-kiewitz m_kiewitz at users.sourceforge.net
Sun Feb 14 23:04:56 CET 2016


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:
873ba15b66 AGI: Changes to vm var seconds heuristic (delay loop detection)


Commit: 873ba15b66b799641d2f22ac00df2142e84c0101
    https://github.com/scummvm/scummvm/commit/873ba15b66b799641d2f22ac00df2142e84c0101
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-14T23:05:28+01:00

Commit Message:
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

Changed paths:
    engines/agi/agi.h
    engines/agi/global.cpp



diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index ad5d320..fe70c4e 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 fe3becc..a7a39e9 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;
 }






More information about the Scummvm-git-logs mailing list