aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-03-24 17:27:56 +0100
committerStrangerke2013-03-24 17:27:56 +0100
commit94893636e421a4c90d7a443e3cdb9ff241ed8953 (patch)
tree6083f3743f9ea760734a1bda8fa8dbc20587330b /engines
parentd149303b4d12ff10683886e5d0a0307e8ff95abd (diff)
downloadscummvm-rg350-94893636e421a4c90d7a443e3cdb9ff241ed8953.tar.gz
scummvm-rg350-94893636e421a4c90d7a443e3cdb9ff241ed8953.tar.bz2
scummvm-rg350-94893636e421a4c90d7a443e3cdb9ff241ed8953.zip
HOPKINS: Move counter to ObjectsManager, rename it to follow coding conventions
Diffstat (limited to 'engines')
-rw-r--r--engines/hopkins/globals.cpp1
-rw-r--r--engines/hopkins/globals.h1
-rw-r--r--engines/hopkins/objects.cpp43
-rw-r--r--engines/hopkins/objects.h5
-rw-r--r--engines/hopkins/script.cpp12
5 files changed, 32 insertions, 30 deletions
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index 940e18afaf..db7dca7c7f 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -128,7 +128,6 @@ Globals::Globals(HopkinsEngine *vm) {
_checkDistanceFl = false;
_characterType = 0;
_actionMoveTo = false;
- Compteur = 0;
_actionDirection = DIR_NONE;
_creditsStartX = -1;
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index 026b85caa3..e74324978e 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.h
@@ -311,7 +311,6 @@ public:
ListeItem Liste2[35];
BankItem Bank[8];
VBobItem VBob[30];
- int Compteur;
int compteur_71;
Globals(HopkinsEngine *vm);
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 84ea104dc4..c3e28bd993 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -83,6 +83,7 @@ ObjectsManager::ObjectsManager(HopkinsEngine *vm) {
_gestureBuf = NULL;
_curGestureFile = 0;
_headSprites = NULL;
+ _homeRateCounter = 0;
}
ObjectsManager::~ObjectsManager() {
@@ -1251,8 +1252,8 @@ void ObjectsManager::GOHOME() {
if (_vm->_linesManager->_route == (RouteItem *)g_PTRNUL)
return;
- if (_vm->_globals->Compteur > 1) {
- --_vm->_globals->Compteur;
+ if (_homeRateCounter > 1) {
+ --_homeRateCounter;
return;
}
@@ -1263,7 +1264,7 @@ void ObjectsManager::GOHOME() {
int oldPosX = 0;
int oldPosY = 0;
int oldFrameIdx = 0;
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
if (_vm->_globals->_oldDirection == DIR_NONE) {
computeAndSetSpriteSize();
newPosX = _vm->_linesManager->_route->_x;
@@ -1288,7 +1289,7 @@ void ObjectsManager::GOHOME() {
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
computeAndSetSpriteSize();
setFlipSprite(0, false);
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
_vm->_globals->_oldDirection = DIR_NONE;
if (zoneId > 0) {
@@ -1304,7 +1305,7 @@ void ObjectsManager::GOHOME() {
}
}
}
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
return;
}
if (_vm->_globals->_oldDirection == DIR_RIGHT) {
@@ -1329,7 +1330,7 @@ void ObjectsManager::GOHOME() {
if (oldFrameIdx > 35)
oldFrameIdx = 24;
}
- _vm->_globals->Compteur = 5 / _vm->_globals->_speed;
+ _homeRateCounter = 5 / _vm->_globals->_speed;
}
if (_vm->_globals->_oldDirection == DIR_LEFT) {
if (_vm->_globals->_oldFrameIndex < 24 || _vm->_globals->_oldFrameIndex > 35) {
@@ -1352,7 +1353,7 @@ void ObjectsManager::GOHOME() {
if (oldFrameIdx > 35)
oldFrameIdx = 24;
}
- _vm->_globals->Compteur = 5 / _vm->_globals->_speed;
+ _homeRateCounter = 5 / _vm->_globals->_speed;
}
if (_vm->_globals->_oldDirection == DIR_UP) {
if (_vm->_globals->_oldFrameIndex > 11) {
@@ -1372,7 +1373,7 @@ void ObjectsManager::GOHOME() {
if (oldFrameIdx > 11)
oldFrameIdx = 0;
}
- _vm->_globals->Compteur = 4 / _vm->_globals->_speed;
+ _homeRateCounter = 4 / _vm->_globals->_speed;
}
if (_vm->_globals->_oldDirection == DIR_DOWN) {
@@ -1393,7 +1394,7 @@ void ObjectsManager::GOHOME() {
if (oldFrameIdx > 59)
oldFrameIdx = 48;
}
- _vm->_globals->Compteur = 4 / _vm->_globals->_speed;
+ _homeRateCounter = 4 / _vm->_globals->_speed;
}
if (_vm->_globals->_oldDirection == DIR_UP_RIGHT) {
if (_vm->_globals->_oldFrameIndex < 12 || _vm->_globals->_oldFrameIndex > 23) {
@@ -1417,7 +1418,7 @@ void ObjectsManager::GOHOME() {
if (oldFrameIdx > 23)
oldFrameIdx = 12;
}
- _vm->_globals->Compteur = 5 / _vm->_globals->_speed;
+ _homeRateCounter = 5 / _vm->_globals->_speed;
}
if (_vm->_globals->_oldDirection == DIR_UP_LEFT) {
if (_vm->_globals->_oldFrameIndex < 12 || _vm->_globals->_oldFrameIndex > 23) {
@@ -1440,7 +1441,7 @@ void ObjectsManager::GOHOME() {
if (oldFrameIdx > 23)
oldFrameIdx = 12;
}
- _vm->_globals->Compteur = 5 / _vm->_globals->_speed;
+ _homeRateCounter = 5 / _vm->_globals->_speed;
}
if (_vm->_globals->_oldDirection == DIR_DOWN_RIGHT) {
if (_vm->_globals->_oldFrameIndex < 36 || _vm->_globals->_oldFrameIndex > 47) {
@@ -1464,7 +1465,7 @@ void ObjectsManager::GOHOME() {
if (oldFrameIdx > 47)
oldFrameIdx = 36;
}
- _vm->_globals->Compteur = 5 / _vm->_globals->_speed;
+ _homeRateCounter = 5 / _vm->_globals->_speed;
}
if (_vm->_globals->_oldDirection == DIR_DOWN_LEFT) {
if (_vm->_globals->_oldFrameIndex < 36 || _vm->_globals->_oldFrameIndex > 47) {
@@ -1488,7 +1489,7 @@ void ObjectsManager::GOHOME() {
if (oldFrameIdx > 47)
oldFrameIdx = 36;
}
- _vm->_globals->Compteur = 5 / _vm->_globals->_speed;
+ _homeRateCounter = 5 / _vm->_globals->_speed;
}
bool loopCond = false;
do {
@@ -1508,7 +1509,7 @@ void ObjectsManager::GOHOME() {
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
computeAndSetSpriteSize();
setFlipSprite(0, false);
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
_vm->_globals->_oldDirection = DIR_NONE;
_oldCharacterPosX = getSpriteX(0);
_oldCharacterPosY = getSpriteY(0);
@@ -1525,7 +1526,7 @@ void ObjectsManager::GOHOME() {
}
}
}
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
return;
}
if (_vm->_globals->_oldDirection != newDirection)
@@ -1555,7 +1556,7 @@ void ObjectsManager::GOHOME() {
if ((_vm->_globals->_oldDirection == DIR_UP) || (_vm->_globals->_oldDirection == DIR_UP_RIGHT) || (_vm->_globals->_oldDirection == DIR_RIGHT) ||
(_vm->_globals->_oldDirection == DIR_DOWN_RIGHT) || (_vm->_globals->_oldDirection == DIR_DOWN))
setFlipSprite(0, false);
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
}
_vm->_globals->_oldDirection = newDirection;
_vm->_globals->_oldDirectionSpriteIdx = newDirection + 59;
@@ -1890,7 +1891,7 @@ void ObjectsManager::handleLeftButton() {
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
computeAndSetSpriteSize();
setFlipSprite(0, false);
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
_vm->_globals->_oldDirection = DIR_NONE;
} else {
_vm->_linesManager->_route = _vm->_linesManager->PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390);
@@ -1898,7 +1899,7 @@ void ObjectsManager::handleLeftButton() {
_vm->_linesManager->PACOURS_PROPRE(_vm->_linesManager->_route);
_oldCharacterPosX = getSpriteX(0);
_oldCharacterPosY = getSpriteY(0);
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
if (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL || oldRoute == _vm->_linesManager->_route) {
_vm->_globals->_oldDirection = DIR_NONE;
} else {
@@ -1912,7 +1913,7 @@ void ObjectsManager::handleLeftButton() {
_vm->_linesManager->PACOURS_PROPRE(_vm->_linesManager->_route);
_oldCharacterPosX = getSpriteX(0);
_oldCharacterPosY = getSpriteY(0);
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
if (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL || oldRoute == _vm->_linesManager->_route)
_vm->_globals->_oldDirection = DIR_NONE;
else
@@ -3695,7 +3696,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo
_vm->_globals->_checkDistanceFl = true;
_oldCharacterPosX = getSpriteX(0);
_vm->_globals->_oldDirection = DIR_NONE;
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
_vm->_linesManager->_route = _vm->_linesManager->PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345);
_vm->_globals->_checkDistanceFl = true;
@@ -3811,7 +3812,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
_oldCharacterPosX = _characterPos.x;
_oldCharacterPosY = _characterPos.y;
_vm->_globals->_oldDirection = DIR_NONE;
- _vm->_globals->Compteur = 0;
+ _homeRateCounter = 0;
for (int idx = 0; idx < 5; ++idx)
_vm->_eventsManager->refreshScreenAndEvents();
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index a0dd59a793..9e22a5286d 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.h
@@ -95,6 +95,7 @@ private:
bool _oldFlipFl;
int _curGestureFile;
byte *_gestureBuf;
+ int _homeRateCounter;
void sprite_alone(const byte *objectData, byte *sprite, int objIndex);
void removeObjectDataBuf();
@@ -221,12 +222,14 @@ public:
void doActionLeft(int idx);
void doActionDiagRight(int idx);
void doActionDiagLeft(int idx);
+ byte *loadObjectFromFile(int objIndex, bool mode);
+
+ void resetHomeRateCounter() { _homeRateCounter = 0; }
void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile,
const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen);
void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile,
const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen);
- byte *loadObjectFromFile(int objIndex, bool mode);
void OPTI_OBJET();
void SPACTION(byte *spriteData, const Common::String &animationSeq, int speed, bool flipFl);
void BOB_VIVANT(int idx);
diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp
index 56dc5e1dba..373b28a8e0 100644
--- a/engines/hopkins/script.cpp
+++ b/engines/hopkins/script.cpp
@@ -985,7 +985,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals->_checkDistanceFl = true;
_vm->_objectsManager->_oldCharacterPosX = _vm->_objectsManager->getSpriteX(0);
_vm->_globals->_oldDirection = DIR_NONE;
- _vm->_globals->Compteur = 0;
+ _vm->_objectsManager->resetHomeRateCounter();
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
_vm->_linesManager->_route = _vm->_linesManager->PARCOURS2(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 445, 332);
_vm->_globals->_checkDistanceFl = true;
@@ -1103,7 +1103,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals->_checkDistanceFl = true;
_vm->_objectsManager->_oldCharacterPosX = _vm->_objectsManager->getSpriteX(0);
_vm->_globals->_oldDirection = DIR_NONE;
- _vm->_globals->Compteur = 0;
+ _vm->_objectsManager->resetHomeRateCounter();
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
_vm->_linesManager->_route = _vm->_linesManager->PARCOURS2(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 119, 268);
_vm->_globals->_checkDistanceFl = true;
@@ -1420,7 +1420,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals->_checkDistanceFl = true;
_vm->_objectsManager->_oldCharacterPosX = _vm->_objectsManager->getSpriteX(0);
_vm->_globals->_oldDirection = DIR_NONE;
- _vm->_globals->Compteur = 0;
+ _vm->_objectsManager->resetHomeRateCounter();
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
switch (_vm->_globals->_saveData->_data[svField253]) {
case 1:
@@ -1667,7 +1667,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals->_checkDistanceFl = true;
_vm->_objectsManager->_oldCharacterPosX = _vm->_objectsManager->getSpriteX(0);
_vm->_globals->_oldDirection = DIR_NONE;
- _vm->_globals->Compteur = 0;
+ _vm->_objectsManager->resetHomeRateCounter();
_vm->_globals->_checkDistanceFl = true;
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
_vm->_linesManager->_route = _vm->_linesManager->PARCOURS2(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 361, 325);
@@ -1695,7 +1695,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals->_checkDistanceFl = true;
_vm->_objectsManager->_oldCharacterPosX = _vm->_objectsManager->getSpriteX(0);
_vm->_globals->_oldDirection = DIR_NONE;
- _vm->_globals->Compteur = 0;
+ _vm->_objectsManager->resetHomeRateCounter();
_vm->_globals->_checkDistanceFl = true;
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
_vm->_linesManager->_route = _vm->_linesManager->PARCOURS2(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 361, 325);
@@ -2007,7 +2007,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals->_checkDistanceFl = true;
_vm->_objectsManager->_oldCharacterPosX = _vm->_objectsManager->getSpriteX(0);
_vm->_globals->_oldDirection = DIR_NONE;
- _vm->_globals->Compteur = 0;
+ _vm->_objectsManager->resetHomeRateCounter();
_vm->_globals->_checkDistanceFl = true;
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
_vm->_linesManager->_route = _vm->_linesManager->PARCOURS2(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 488, 280);