aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hopkins/globals.cpp6
-rw-r--r--engines/hopkins/globals.h2
-rw-r--r--engines/hopkins/objects.cpp161
-rw-r--r--engines/hopkins/objects.h4
4 files changed, 86 insertions, 87 deletions
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index d854c571be..fc45a9277b 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -150,7 +150,6 @@ Globals::Globals() {
CACHE_BANQUE[idx] = NULL;
SPRITE_ECRAN = NULL;
_saveData = NULL;
- _gestureBuf = NULL;
_inventoryObject = NULL;
_answerBuffer = g_PTRNUL;
ADR_FICHIER_OBJ = NULL;
@@ -159,7 +158,6 @@ Globals::Globals() {
// Reset flags
_censorshipFl = false;
- _curGestureFile = 0;
_disableInventFl = false;
NOMARCHE = false;
_optionDialogFl = false;
@@ -190,7 +188,6 @@ Globals::~Globals() {
CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]);
freeMemory(SPRITE_ECRAN);
freeMemory((byte *)_saveData);
- freeMemory(_gestureBuf);
freeMemory(_inventoryObject);
freeMemory(_answerBuffer);
freeMemory(ADR_FICHIER_OBJ);
@@ -275,9 +272,6 @@ void Globals::clearAll() {
_inventoryObject = allocMemory(2500);
ADR_FICHIER_OBJ = g_PTRNUL;
-
- _gestureBuf = g_PTRNUL;
- _curGestureFile = 0;
}
void Globals::loadCharacterData() {
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index babd145cb9..7e46773caa 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.h
@@ -315,8 +315,6 @@ public:
Common::String FICH_ZONE;
bool GOACTION;
int j_104;
- int _curGestureFile;
- byte *_gestureBuf;
Common::String FICH_TEXTE;
Globals();
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 89f00df5b0..0f7ff52f9e 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -76,10 +76,13 @@ ObjectsManager::ObjectsManager() {
_forestFl = false;
_mapCarPosX = _mapCarPosY = 0;
_forestSprite = NULL;
+ _gestureBuf = NULL;
+ _curGestureFile = 0;
}
ObjectsManager::~ObjectsManager() {
_vm->_globals.freeMemory(_forestSprite);
+ _vm->_globals.freeMemory(_gestureBuf);
}
void ObjectsManager::setParent(HopkinsEngine *vm) {
@@ -89,6 +92,8 @@ void ObjectsManager::setParent(HopkinsEngine *vm) {
void ObjectsManager::clearAll() {
_forestFl = false;
_forestSprite = g_PTRNUL;
+ _curGestureFile = 0;
+ _gestureBuf = _vm->_globals.freeMemory(_gestureBuf);
}
/**
@@ -2735,229 +2740,229 @@ void ObjectsManager::VBOB_OFF(int idx) {
}
void ObjectsManager::doActionBack(int idx) {
- if (_vm->_globals._curGestureFile != 1) {
- _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf);
- _vm->_globals._curGestureFile = 1;
- _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("DOS.SPR");
+ if (_curGestureFile != 1) {
+ _gestureBuf = _vm->_globals.freeMemory(_gestureBuf);
+ _curGestureFile = 1;
+ _gestureBuf = _vm->_fileManager.loadFile("DOS.SPR");
}
switch (idx) {
case 1:
- ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
+ ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
break;
case 2:
- SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, false);
break;
case 3:
- SPACTION1(_vm->_globals._gestureBuf, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8);
break;
case 4:
- ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
+ ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
break;
case 5:
- SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false);
break;
case 6:
- SPACTION1(_vm->_globals._gestureBuf, "20,19,18,17,16,15,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "20,19,18,17,16,15,-1,", 0, 0, 8);
break;
case 7:
- SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false);
break;
case 8:
- SPACTION1(_vm->_globals._gestureBuf, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8);
break;
case 9:
- SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false);
break;
case 10:
- SPACTION1(_vm->_globals._gestureBuf, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8);
break;
}
}
void ObjectsManager::doActionRight(int idx) {
- if (_vm->_globals._curGestureFile != 3) {
- _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf);
- _vm->_globals._curGestureFile = 3;
- _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("PROFIL.SPR");
+ if (_curGestureFile != 3) {
+ _gestureBuf = _vm->_globals.freeMemory(_gestureBuf);
+ _curGestureFile = 3;
+ _gestureBuf = _vm->_fileManager.loadFile("PROFIL.SPR");
}
switch (idx) {
case 1:
- ACTION(_vm->_globals._gestureBuf, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, false);
+ ACTION(_gestureBuf, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, false);
break;
case 2:
- SPACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, false);
break;
case 3:
- SPACTION1(_vm->_globals._gestureBuf, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8);
break;
case 4:
- ACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, false);
+ ACTION(_gestureBuf, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, false);
break;
case 5:
- SPACTION(_vm->_globals._gestureBuf, "23,24,25,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "23,24,25,-1,", 0, 0, 8, false);
break;
case 6:
- SPACTION1(_vm->_globals._gestureBuf, "24,,23,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "24,,23,-1,", 0, 0, 8);
break;
case 7:
- SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "23,24,25,26,27,-1,", 0, 0, 8, false);
break;
case 8:
- SPACTION1(_vm->_globals._gestureBuf, "26,25,24,23,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "26,25,24,23,-1,", 0, 0, 8);
break;
case 9:
- SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,28,29,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "23,24,25,26,27,28,29,-1,", 0, 0, 8, false);
break;
case 10:
- SPACTION1(_vm->_globals._gestureBuf, "28,27,26,25,24,23,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "28,27,26,25,24,23,-1,", 0, 0, 8);
break;
}
}
void ObjectsManager::doActionDiagRight(int idx) {
- if (_vm->_globals._curGestureFile != 4) {
- _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf);
- _vm->_globals._curGestureFile = 4;
- _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("3Q.SPR");
+ if (_curGestureFile != 4) {
+ _gestureBuf = _vm->_globals.freeMemory(_gestureBuf);
+ _curGestureFile = 4;
+ _gestureBuf = _vm->_fileManager.loadFile("3Q.SPR");
}
switch (idx) {
case 1:
- ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
+ ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
break;
case 2:
- SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, false);
break;
case 3:
- SPACTION1(_vm->_globals._gestureBuf, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8);
break;
case 4:
- ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
+ ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
break;
case 5:
- SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "15,16,17,18,-1,", 0, 0, 8, false);
break;
case 6:
- SPACTION1(_vm->_globals._gestureBuf, "17,16,15,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "17,16,15,-1,", 0, 0, 8);
break;
case 7:
- SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "15,16,17,18,19,20-1,", 0, 0, 8, false);
break;
case 8:
- SPACTION1(_vm->_globals._gestureBuf, "19,18,17,16,15,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "19,18,17,16,15,-1,", 0, 0, 8);
break;
case 9:
- SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false);
break;
case 10:
- SPACTION1(_vm->_globals._gestureBuf, "20,19,18,17,15,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "20,19,18,17,15,-1,", 0, 0, 8);
break;
}
}
void ObjectsManager::doActionFront(int idx) {
- if (_vm->_globals._curGestureFile != 2) {
- _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf);
- _vm->_globals._curGestureFile = 2;
- _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("FACE.SPR");
+ if (_curGestureFile != 2) {
+ _gestureBuf = _vm->_globals.freeMemory(_gestureBuf);
+ _curGestureFile = 2;
+ _gestureBuf = _vm->_fileManager.loadFile("FACE.SPR");
}
switch (idx) {
case 1:
- ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
+ ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
break;
case 2:
- SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,-1,", 0, 0, 8, false);
+ SPACTION(_gestureBuf, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,-1,", 0, 0, 8, false);
break;
case 3:
- SPACTION1(_vm->_globals._gestureBuf, "14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8);
break;
case 4:
- ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
+ ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false);
break;
}
}
void ObjectsManager::doActionDiagLeft(int idx) {
- if (_vm->_globals._curGestureFile != 4) {
- _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf);
- _vm->_globals._curGestureFile = 4;
- _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("3Q.SPR");
+ if (_curGestureFile != 4) {
+ _gestureBuf = _vm->_globals.freeMemory(_gestureBuf);
+ _curGestureFile = 4;
+ _gestureBuf = _vm->_fileManager.loadFile("3Q.SPR");
}
switch (idx) {
case 1:
- ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true);
+ ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true);
break;
case 2:
- SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, true);
+ SPACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, true);
break;
case 3:
- SPACTION1(_vm->_globals._gestureBuf, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8);
break;
case 4:
- ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true);
+ ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true);
break;
case 5:
- SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,-1,", 0, 0, 8, true);
+ SPACTION(_gestureBuf, "15,16,17,18,-1,", 0, 0, 8, true);
break;
case 6:
- SPACTION1(_vm->_globals._gestureBuf, "17,16,15,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "17,16,15,-1,", 0, 0, 8);
break;
case 7:
- SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,-1,", 0, 0, 8, true);
+ SPACTION(_gestureBuf, "15,16,17,18,19,20,-1,", 0, 0, 8, true);
break;
case 8:
- SPACTION1(_vm->_globals._gestureBuf, "19,18,17,16,15,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "19,18,17,16,15,-1,", 0, 0, 8);
break;
case 9:
- SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, true);
+ SPACTION(_gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, true);
break;
case 10:
- SPACTION1(_vm->_globals._gestureBuf, "20,19,18,17,15,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "20,19,18,17,15,-1,", 0, 0, 8);
break;
}
}
void ObjectsManager::doActionLeft(int idx) {
- if (_vm->_globals._curGestureFile != 3) {
- _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf);
- _vm->_globals._curGestureFile = 3;
- _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("PROFIL.SPR");
+ if (_curGestureFile != 3) {
+ _gestureBuf = _vm->_globals.freeMemory(_gestureBuf);
+ _curGestureFile = 3;
+ _gestureBuf = _vm->_fileManager.loadFile("PROFIL.SPR");
}
switch (idx) {
case 1:
- ACTION(_vm->_globals._gestureBuf, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, true);
+ ACTION(_gestureBuf, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, true);
break;
case 2:
- SPACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, true);
+ SPACTION(_gestureBuf, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, true);
break;
case 3:
- SPACTION1(_vm->_globals._gestureBuf, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8);
break;
case 4:
- ACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, true);
+ ACTION(_gestureBuf, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, true);
break;
case 5:
- SPACTION(_vm->_globals._gestureBuf, "23,24,25,-1,", 0, 0, 8, true);
+ SPACTION(_gestureBuf, "23,24,25,-1,", 0, 0, 8, true);
break;
case 6:
- SPACTION1(_vm->_globals._gestureBuf, "24,,23,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "24,,23,-1,", 0, 0, 8);
break;
case 7:
- SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,-1,", 0, 0, 8, true);
+ SPACTION(_gestureBuf, "23,24,25,26,27,-1,", 0, 0, 8, true);
break;
case 8:
- SPACTION1(_vm->_globals._gestureBuf, "26,25,24,23,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "26,25,24,23,-1,", 0, 0, 8);
break;
case 9:
- SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,28,29,-1,", 0, 0, 8, true);
+ SPACTION(_gestureBuf, "23,24,25,26,27,28,29,-1,", 0, 0, 8, true);
break;
case 10:
- SPACTION1(_vm->_globals._gestureBuf, "28,27,26,25,24,23,-1,", 0, 0, 8);
+ SPACTION1(_gestureBuf, "28,27,26,25,24,23,-1,", 0, 0, 8);
break;
}
}
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index 7093092bc2..ccf2e7a6ad 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.h
@@ -93,7 +93,9 @@ private:
int _verb;
int _oldSpriteIndex;
bool _oldFlipFl;
-private:
+ int _curGestureFile;
+ byte *_gestureBuf;
+
void sprite_alone(const byte *objectData, byte *sprite, int objIndex);
void DEL_FICHIER_OBJ();