[Scummvm-git-logs] scummvm master -> 7292e3673cd5c460faf099012233836770debdc2
neuromancer
noreply at scummvm.org
Wed Sep 4 08:31:08 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:
f8b518ccb9 FREESCAPE: refactor key collection code
7292e3673c FREESCAPE: correctly execute nested if/else
Commit: f8b518ccb975e27758c8c17abc7286a265cdf16a
https://github.com/scummvm/scummvm/commit/f8b518ccb975e27758c8c17abc7286a265cdf16a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-04T10:30:11+02:00
Commit Message:
FREESCAPE: refactor key collection code
Changed paths:
engines/freescape/freescape.h
engines/freescape/games/castle/castle.cpp
engines/freescape/games/castle/castle.h
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index d9e3202ff04..1e8b58b07fb 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -399,7 +399,7 @@ public:
void executeMakeVisible(FCLInstruction &instruction);
void executeToggleVisibility(FCLInstruction &instruction);
void executeDestroy(FCLInstruction &instruction);
- void executeRedraw(FCLInstruction &instruction);
+ virtual void executeRedraw(FCLInstruction &instruction);
void executeSound(FCLInstruction &instruction);
void executeDelay(FCLInstruction &instruction);
bool executeEndIfNotEqual(FCLInstruction &instruction);
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 7176f966cd8..695471a3f34 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -439,6 +439,10 @@ void CastleEngine::executePrint(FCLInstruction &instruction) {
insertTemporaryMessage(_messagesList[index], _countdown - 3);
}
+void CastleEngine::executeRedraw(FCLInstruction &instruction) {
+ FreescapeEngine::executeRedraw(instruction);
+ tryToCollectKey();
+}
void CastleEngine::loadAssets() {
FreescapeEngine::loadAssets();
@@ -793,16 +797,19 @@ void CastleEngine::checkSensors() {
}*/
}
-void CastleEngine::updateTimeVariables() {
- if (_gameStateControl != kFreescapeGameStatePlaying)
- return;
- // This function only executes "on collision" room/global conditions
-
+void CastleEngine::tryToCollectKey() {
if (_gameStateVars[32] > 0) { // Key collected!
setGameBit(_gameStateVars[32]);
_gameStateVars[32] = 0;
_numberKeys++;
}
+}
+
+void CastleEngine::updateTimeVariables() {
+ if (_gameStateControl != kFreescapeGameStatePlaying)
+ return;
+ // This function only executes "on collision" room/global conditions
+ tryToCollectKey();
int seconds, minutes, hours;
getTimeFromCountdown(seconds, minutes, hours);
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index 741cb8a3b3b..6da8f50c255 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -64,6 +64,7 @@ public:
void executePrint(FCLInstruction &instruction) override;
void executeMakeInvisible(FCLInstruction &instruction) override;
+ void executeRedraw(FCLInstruction &instruction) override;
void gotoArea(uint16 areaID, int entranceID) override;
Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
@@ -103,6 +104,7 @@ private:
void loadDOSFonts(Common::SeekableReadStream *file, int pos);
void drawFullscreenRiddleAndWait(uint16 riddle);
void drawRiddle(uint16 riddle, uint32 front, uint32 back, Graphics::Surface *surface);
+ void tryToCollectKey();
void addGhosts();
Texture *_optionTexture;
};
Commit: 7292e3673cd5c460faf099012233836770debdc2
https://github.com/scummvm/scummvm/commit/7292e3673cd5c460faf099012233836770debdc2
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-04T10:30:11+02:00
Commit Message:
FREESCAPE: correctly execute nested if/else
Changed paths:
engines/freescape/language/instruction.cpp
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 6bed2972a39..0eeb07e891d 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -146,6 +146,7 @@ void FreescapeEngine::executeLocalGlobalConditions(bool shot, bool collided, boo
bool FreescapeEngine::executeCode(FCLInstructionVector &code, bool shot, bool collided, bool timer, bool activated) {
int ip = 0;
bool skip = false;
+ bool elseFound = false;
bool executed = false;
int codeSize = code.size();
assert(codeSize > 0);
@@ -190,11 +191,16 @@ bool FreescapeEngine::executeCode(FCLInstructionVector &code, bool shot, bool co
break;
case Token::ELSE:
+ if (elseFound && skip)
+ break;
+
+ elseFound = true;
skip = !skip;
break;
case Token::ENDIF:
skip = false;
+ elseFound = false;
break;
case Token::SWAPJET:
More information about the Scummvm-git-logs
mailing list