[Scummvm-git-logs] scummvm master -> d1e522baca8f017057971768ff39a30c245cca3b
neuromancer
noreply at scummvm.org
Fri Sep 15 07:11:55 UTC 2023
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:
e6a1f794f0 FREESCAPE: correctly handle game binary variables
d1e522baca FREESCAPE: stop the clock when game is paused
Commit: e6a1f794f075e376b07b98823d5cc7f4bb1e22f6
https://github.com/scummvm/scummvm/commit/e6a1f794f075e376b07b98823d5cc7f4bb1e22f6
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-09-15T09:04:53+02:00
Commit Message:
FREESCAPE: correctly handle game binary variables
Changed paths:
engines/freescape/freescape.cpp
engines/freescape/freescape.h
engines/freescape/games/castle.cpp
engines/freescape/games/dark/dark.cpp
engines/freescape/games/driller/driller.cpp
engines/freescape/games/eclipse.cpp
engines/freescape/language/instruction.cpp
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 177436bbc76..9982a695128 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -674,24 +674,26 @@ bool FreescapeEngine::checkIfGameEnded() {
}
void FreescapeEngine::setGameBit(int index) {
- _gameStateBits[_currentArea->getAreaID()] |= (1 << (index - 1));
+ _gameStateBits |= (1 << (index - 1));
}
void FreescapeEngine::clearGameBit(int index) {
- _gameStateBits[_currentArea->getAreaID()] &= ~(1 << (index - 1));
+ _gameStateBits &= ~(1 << (index - 1));
}
void FreescapeEngine::toggleGameBit(int index) {
- _gameStateBits[_currentArea->getAreaID()] ^= (1 << (index - 1));
+ _gameStateBits ^= (1 << (index - 1));
}
+bool FreescapeEngine::getGameBit(int index) {
+ return (_gameStateBits >> (index - 1)) & 1;
+}
void FreescapeEngine::initGameState() {
for (int i = 0; i < k8bitMaxVariable; i++) // TODO: check maximum variable
_gameStateVars[i] = 0;
- for (auto &it : _areaMap)
- _gameStateBits[it._key] = 0;
+ _gameStateBits = 0;
}
void FreescapeEngine::rotate(float xoffset, float yoffset) {
@@ -786,10 +788,7 @@ Common::Error FreescapeEngine::loadGameStream(Common::SeekableReadStream *stream
_gameStateVars[key] = stream->readUint32LE();
}
- for (uint i = 0; i < _gameStateBits.size(); i++) {
- uint16 key = stream->readUint16LE();
- _gameStateBits[key] = stream->readUint32LE();
- }
+ _gameStateBits = stream->readUint32LE();
for (uint i = 0; i < _areaMap.size(); i++) {
uint16 key = stream->readUint16LE();
@@ -829,10 +828,7 @@ Common::Error FreescapeEngine::saveGameStream(Common::WriteStream *stream, bool
stream->writeUint32LE(it._value);
}
- for (auto &it : _gameStateBits) {
- stream->writeUint16LE(it._key);
- stream->writeUint32LE(it._value);
- }
+ stream->writeUint32LE(_gameStateBits);
for (auto &it : _areaMap) {
stream->writeUint16LE(it._key);
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 7243947c161..2a5906e4157 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -59,7 +59,6 @@ enum CameraMovement {
typedef Common::HashMap<uint16, Area *> AreaMap;
typedef Common::Array<byte *> ColorMap;
typedef Common::HashMap<uint16, int32> StateVars;
-typedef Common::HashMap<uint16, uint32> StateBits;
enum {
kFreescapeDebugMove = 1 << 0,
@@ -397,9 +396,10 @@ public:
void setGameBit(int index);
void clearGameBit(int index);
void toggleGameBit(int index);
+ bool getGameBit(int index);
StateVars _gameStateVars;
- StateBits _gameStateBits;
+ uint32 _gameStateBits;
virtual bool checkIfGameEnded();
bool _forceEndGame;
bool _playerWasCrushed;
diff --git a/engines/freescape/games/castle.cpp b/engines/freescape/games/castle.cpp
index 62b0fd58109..01e7147e6b2 100644
--- a/engines/freescape/games/castle.cpp
+++ b/engines/freescape/games/castle.cpp
@@ -253,8 +253,6 @@ void CastleEngine::loadAssetsAmigaDemo() {
void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
- if (!_gameStateBits.contains(areaID))
- _gameStateBits[areaID] = 0;
assert(_areaMap.contains(areaID));
_currentArea = _areaMap[areaID];
@@ -332,10 +330,10 @@ void CastleEngine::initGameState() {
for (int i = 0; i < k8bitMaxVariable; i++) // TODO: check maximum variable
_gameStateVars[i] = 0;
- for (auto &it : _areaMap) {
+ for (auto &it : _areaMap)
it._value->resetArea();
- _gameStateBits[it._key] = 0;
- }
+
+ _gameStateBits = 0;
//_gameStateVars[k8bitVariableEnergy] = _initialFuel;
//_gameStateVars[k8bitVariableShield] = _initialShield;
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 8063ae62200..8d2262bc0d3 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -167,10 +167,10 @@ void DarkEngine::initGameState() {
for (int i = 0; i < k8bitMaxVariable; i++) // TODO: check maximum variable
_gameStateVars[i] = 0;
- for (auto &it : _areaMap) {
+ for (auto &it : _areaMap)
it._value->resetArea();
- _gameStateBits[it._key] = 0;
- }
+
+ _gameStateBits = 0;
_gameStateVars[k8bitVariableEnergy] = _initialEnergy;
_gameStateVars[k8bitVariableShield] = _initialShield;
@@ -429,8 +429,6 @@ bool DarkEngine::checkIfGameEnded() {
void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
- if (!_gameStateBits.contains(areaID))
- _gameStateBits[areaID] = 0;
if (!_exploredAreas.contains(areaID)) {
_gameStateVars[k8bitVariableScore] += 17500;
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index 6d6cdcd9b47..9ed307698a8 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -96,8 +96,6 @@ DrillerEngine::~DrillerEngine() {
void DrillerEngine::gotoArea(uint16 areaID, int entranceID) {
int prevAreaID = _currentArea ? _currentArea->getAreaID(): -1;
debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
- if (!_gameStateBits.contains(areaID))
- _gameStateBits[areaID] = 0;
if (!_areaMap.contains(areaID)) {
assert(isDOS() && isDemo());
@@ -552,7 +550,7 @@ bool DrillerEngine::checkDrill(const Math::Vector3d position) {
void DrillerEngine::addSkanner(Area *area) {
- debug("area: %d", area->getAreaID());
+ debugC(1, kFreescapeDebugParser, "Adding skanner to area: %d", area->getAreaID());
GeometricObject *obj = nullptr;
int16 id;
@@ -695,7 +693,6 @@ void DrillerEngine::initGameState() {
for (auto &it : _areaMap) {
it._value->resetArea();
- _gameStateBits[it._key] = 0;
if (_drillStatusByArea[it._key] != kDrillerNoRig)
removeDrill(it._value);
_drillStatusByArea[it._key] = kDrillerNoRig;
@@ -705,6 +702,7 @@ void DrillerEngine::initGameState() {
}
_drillSuccessByArea[it._key] = 0;
}
+ _gameStateBits = 0;
_gameStateVars[k8bitVariableEnergy] = _initialTankEnergy;
_gameStateVars[k8bitVariableShield] = _initialTankShield;
diff --git a/engines/freescape/games/eclipse.cpp b/engines/freescape/games/eclipse.cpp
index 36dca4b0ef4..7ba7a435dc1 100644
--- a/engines/freescape/games/eclipse.cpp
+++ b/engines/freescape/games/eclipse.cpp
@@ -111,8 +111,6 @@ void EclipseEngine::loadAssetsDOSFullGame() {
void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
- if (!_gameStateBits.contains(areaID))
- _gameStateBits[areaID] = 0;
assert(_areaMap.contains(areaID));
_currentArea = _areaMap[areaID];
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index aa5e4dde6fd..0c85d4340c8 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -604,11 +604,11 @@ void FreescapeEngine::executeToggleBit(FCLInstruction &instruction) {
}
bool FreescapeEngine::executeEndIfBitNotEqual(FCLInstruction &instruction) {
- uint16 index = instruction._source - 1; // Starts in 1
+ uint16 index = instruction._source;
uint16 value = instruction._destination;
- assert(index < 32);
+ assert(index <= 32);
debugC(1, kFreescapeDebugCode, "End condition if bit %d is not equal to %d!", index, value);
- return (((_gameStateBits[_currentArea->getAreaID()] >> index) & 1) != value);
+ return (getGameBit(index) != value);
}
void FreescapeEngine::executeSwapJet(FCLInstruction &instruction) {
Commit: d1e522baca8f017057971768ff39a30c245cca3b
https://github.com/scummvm/scummvm/commit/d1e522baca8f017057971768ff39a30c245cca3b
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-09-15T09:04:53+02:00
Commit Message:
FREESCAPE: stop the clock when game is paused
Changed paths:
engines/freescape/freescape.cpp
engines/freescape/games/dark/dark.cpp
engines/freescape/games/driller/driller.cpp
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 9982a695128..13a1173b00d 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -912,6 +912,8 @@ void FreescapeEngine::getTimeFromCountdown(int &seconds, int &minutes, int &hour
static void countdownCallback(void *refCon) {
FreescapeEngine* self = (FreescapeEngine *)refCon;
+ if (self->isPaused())
+ return;
self->_ticks++;
if (self->_ticks % 50 == 0)
self->_countdown--;
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 8d2262bc0d3..e5dab377dac 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -729,6 +729,7 @@ void DarkEngine::drawSensorShoot(Sensor *sensor) {
}
void DarkEngine::drawInfoMenu() {
+ PauseToken pauseToken = pauseEngine();
_savedScreen = _gfx->getScreenshot();
uint32 color = 0;
switch (_renderMode) {
@@ -810,6 +811,7 @@ void DarkEngine::drawInfoMenu() {
delete _savedScreen;
surface->free();
delete surface;
+ pauseToken.clear();
}
void DarkEngine::loadMessagesVariableSize(Common::SeekableReadStream *file, int offset, int number) {
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index 9ed307698a8..fd2769eb641 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -198,6 +198,7 @@ void DrillerEngine::loadAssetsFullGame() {
}
void DrillerEngine::drawInfoMenu() {
+ PauseToken pauseToken = pauseEngine();
_savedScreen = _gfx->getScreenshot();
uint32 color = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
@@ -331,6 +332,7 @@ void DrillerEngine::drawInfoMenu() {
delete _savedScreen;
surface->free();
delete surface;
+ pauseToken.clear();
}
Math::Vector3d getProjectionToPlane(const Math::Vector3d &vect, const Math::Vector3d normal) {
More information about the Scummvm-git-logs
mailing list