aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--queen/cutaway.cpp8
-rw-r--r--queen/logic.cpp15
-rw-r--r--queen/logic.h9
3 files changed, 28 insertions, 4 deletions
diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp
index e7a9318dae..a79e0c74b2 100644
--- a/queen/cutaway.cpp
+++ b/queen/cutaway.cpp
@@ -966,7 +966,7 @@ void QueenCutaway::updateGameState() {
for (int i = 0; i < gameStateCount; i++) {
int16 stateIndex = (int16)READ_BE_UINT16(ptr); ptr += 2;
- /*int16 stateValue = (int16)READ_BE_UINT16(ptr);*/ ptr += 2;
+ int16 stateValue = (int16)READ_BE_UINT16(ptr); ptr += 2;
int16 objectIndex = (int16)READ_BE_UINT16(ptr); ptr += 2;
int16 areaIndex = (int16)READ_BE_UINT16(ptr); ptr += 2;
int16 areaSubIndex = (int16)READ_BE_UINT16(ptr); ptr += 2;
@@ -975,11 +975,11 @@ void QueenCutaway::updateGameState() {
bool update = false;
if (stateIndex > 0) {
- // XXX if(GAMESTATE[stateIndex] == stateValue)
- // XXX update = true;
+ if(_queenLogic->gameState(stateIndex) == stateValue)
+ update = true;
}
else {
- // XXX GAMESTATE[abs(stateIndex)] = stateValue;
+ _queenLogic->gameState(abs(stateIndex), stateValue);
update = true;
}
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 5307e6ff4f..e0c25af80d 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -382,4 +382,19 @@ uint16 QueenLogic::findFrame(uint16 obj) {
return framenum;
}
+int16 QueenLogic::gameState(int index) {
+ if (index >= 0 && index < GAME_STATE_COUNT)
+ return _gameState[index];
+ else
+ error("[QueenLogic::gameState] invalid index: %i", index);
+}
+
+void QueenLogic::gameState(int index, int16 newValue) {
+ if (index >= 0 && index < GAME_STATE_COUNT)
+ _gameState[index] = newValue;
+ else
+ error("[QueenLogic::gameState] invalid index: %i", index);
+}
+
+
} // End of namespace Queen
diff --git a/queen/logic.h b/queen/logic.h
index 93af38d6b7..1ce226ad2b 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -68,6 +68,8 @@ public:
uint16 walkOffCount();
uint16 *walkOffData(int index);
+ int16 gameState(int index);
+ void gameState(int index, int16 newValue);
protected:
uint8 *_jas;
@@ -95,6 +97,13 @@ protected:
uint16 (*_actorData)[12];
int16 (*_area)[11][8];
uint16 (*_walkOffData)[3];
+
+ enum {
+ GAME_STATE_COUNT = 211
+ };
+
+ int16 _gameState[GAME_STATE_COUNT];
+
uint16 _maxAnimatedFrame, _maxStaticFrame, _maxAnimatedFrameLen; // FMAXA, FMAX, FMAXALEN
QueenResource *_resource;