From fbc19ab3b41cb88b75d3ab35f8d2b0c67a5c5fbc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 29 Jan 2013 08:12:43 +0100 Subject: HOPKINS: Various renaming --- engines/hopkins/anim.cpp | 8 +++--- engines/hopkins/anim.h | 4 +-- engines/hopkins/globals.cpp | 12 ++++----- engines/hopkins/globals.h | 2 +- engines/hopkins/objects.cpp | 61 ++++++++++++++++++++++----------------------- engines/hopkins/objects.h | 14 +++++------ 6 files changed, 50 insertions(+), 51 deletions(-) (limited to 'engines') diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 1875932a53..7e7c621a8e 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -211,7 +211,7 @@ EXIT: /** * Play Animation, type 2 */ -void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { +void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { int v5; byte *screenCopy = NULL; int oldScrollVal = 0; @@ -291,7 +291,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint if (_vm->_eventsManager._escKeyFl) goto LABEL_114; _vm->_eventsManager.refreshEvents(); - if (_vm->_eventsManager._rateCounter >= a2) + if (_vm->_eventsManager._rateCounter >= rate1) goto LABEL_48; } if (_vm->_graphicsManager._skipVideoLockFl) @@ -368,7 +368,7 @@ LABEL_88: while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= a4) + if (_vm->_eventsManager._rateCounter >= rate3) goto LABEL_114; } } @@ -378,7 +378,7 @@ LABEL_88: while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= a3) + if (_vm->_eventsManager._rateCounter >= rate2) goto LABEL_77; } LABEL_114: diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index c5e6461044..e89d2155b9 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -49,8 +49,8 @@ public: void loadAnim(const Common::String &animName); void clearAnim(); - void playAnim(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); - void playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4); + void playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3); + void playAnim2(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3); void playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); void playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); }; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a8ee4e4063..5d27768522 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -412,7 +412,7 @@ void Globals::resetCache() { Cache[idx]._x = 0; Cache[idx]._y = 0; Cache[idx]._spriteIndex = 0; - Cache[idx].fieldA = 0; + Cache[idx]._useCount = 0; Cache[idx]._width = 0; Cache[idx]._height = 0; Cache[idx].field10 = false; @@ -432,11 +432,11 @@ void Globals::CACHE_OFF(int v1) { } void Globals::CACHE_SUB(int idx) { - Cache[idx].fieldA = 0; + Cache[idx]._useCount = 0; } void Globals::CACHE_ADD(int idx) { - Cache[idx].fieldA = 1; + Cache[idx]._useCount = 1; } // Load Cache @@ -467,18 +467,18 @@ void Globals::loadCache(const Common::String &file) { Cache[v6]._x = v4; Cache[v6]._y = v5; if (spriteData == g_PTRNUL) { - Cache[i].fieldA = 0; + Cache[i]._useCount = 0; } else { int v8 = _vm->_objectsManager.getWidth(spriteData, v11); int v9 = _vm->_objectsManager.getHeight(spriteData, v11); Cache[i]._spriteData = spriteData; Cache[i]._width = v8; Cache[i]._height = v9; - Cache[i].fieldA = 1; + Cache[i]._useCount = 1; } if ( !Cache[i]._x && !Cache[i]._y && !Cache[i]._spriteIndex) - Cache[i].fieldA = 0; + Cache[i]._useCount = 0; v15 += 5; } CACHE_ON(); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f17156cee9..8676c9384a 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -155,7 +155,7 @@ struct CacheItem { int _y; int _width; int _height; - int fieldA; + int _useCount; byte *_spriteData; bool field10; int field14; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e488c24321..558c006b98 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -353,7 +353,7 @@ void ObjectsManager::displaySprite() { DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index); break; case SORT_CACHE: - DEF_CACHE(_vm->_globals._sortedDisplay[idx]._index); + displayCache(_vm->_globals._sortedDisplay[idx]._index); break; default: break; @@ -370,7 +370,7 @@ void ObjectsManager::displaySprite() { DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index); break; case SORT_CACHE: - DEF_CACHE(_vm->_globals._sortedDisplay[idx]._index); + displayCache(_vm->_globals._sortedDisplay[idx]._index); break; default: break; @@ -606,7 +606,7 @@ void ObjectsManager::BOB_OFFSET(int idx, int offset) { } void ObjectsManager::SCBOB(int idx) { - if (_vm->_globals.Cache[idx].fieldA <= 0) + if (_vm->_globals.Cache[idx]._useCount == 0) return; for (int i = 0; i <= 20; i++) { @@ -621,7 +621,7 @@ void ObjectsManager::SCBOB(int idx) { || (cachedRight >= _vm->_globals._bob[i]._oldWidth && _vm->_globals._bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x) || (_vm->_globals._bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight) || (_vm->_globals._bob[i]._oldWidth <= _vm->_globals.Cache[idx]._x && oldRight >= cachedRight)) - ++_vm->_globals.Cache[idx].fieldA; + ++_vm->_globals.Cache[idx]._useCount; } } } @@ -712,10 +712,10 @@ void ObjectsManager::CALCUL_BOB(int idx) { void ObjectsManager::checkCache() { for (int cacheIdx = 0; cacheIdx <= 19; cacheIdx++) { - if (_vm->_globals.Cache[cacheIdx].fieldA <= 0) + if (_vm->_globals.Cache[cacheIdx]._useCount == 0) continue; - int oldFieldA = _vm->_globals.Cache[cacheIdx].fieldA; + int _oldEnableCount = _vm->_globals.Cache[cacheIdx]._useCount; for (int spriteIdx = 0; spriteIdx <= 4; spriteIdx++) { if (_sprite[spriteIdx]._animationType == 1 && _sprite[spriteIdx]._spriteIndex != 250) { int right = _sprite[spriteIdx]._width + _sprite[spriteIdx]._destX; @@ -728,16 +728,16 @@ void ObjectsManager::checkCache() { || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX) || (_vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX && right <= cachedRight) || (_vm->_globals.Cache[cacheIdx]._x >= _sprite[spriteIdx]._destX && right >= cachedRight)) - ++_vm->_globals.Cache[cacheIdx].fieldA; + ++_vm->_globals.Cache[cacheIdx]._useCount; } } } SCBOB(cacheIdx); - if (_vm->_globals.Cache[cacheIdx].fieldA == oldFieldA) { + if (_vm->_globals.Cache[cacheIdx]._useCount == _oldEnableCount) { if (_vm->_globals.Cache[cacheIdx].field10) { _vm->_globals.Cache[cacheIdx].field10 = false; - _vm->_globals.Cache[cacheIdx].fieldA = 1; + _vm->_globals.Cache[cacheIdx]._useCount = 1; } } else { int priority = _vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y; @@ -745,7 +745,7 @@ void ObjectsManager::checkCache() { priority = 500; beforeSort(SORT_CACHE, cacheIdx, priority); - _vm->_globals.Cache[cacheIdx].fieldA = 1; + _vm->_globals.Cache[cacheIdx]._useCount = 1; _vm->_globals.Cache[cacheIdx].field10 = true; } } @@ -789,7 +789,7 @@ void ObjectsManager::DEF_SPRITE(int idx) { _vm->_globals.Liste[idx]._posX + _vm->_globals.Liste[idx]._width, _vm->_globals.Liste[idx]._posY + _vm->_globals.Liste[idx]._height); } -void ObjectsManager::DEF_CACHE(int idx) { +void ObjectsManager::displayCache(int idx) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.CACHE_BANQUE[1], _vm->_globals.Cache[idx]._x + 300, _vm->_globals.Cache[idx]._y + 300, _vm->_globals.Cache[idx]._spriteIndex); @@ -839,7 +839,7 @@ void ObjectsManager::computeSprite(int idx) { deltaY = _vm->_graphicsManager.zoomIn(tmpY, zoomPercent); } else { tmpY = abs(tmpX); - deltaY = -_vm->_graphicsManager.zoomIn(abs(tmpX), zoomPercent); + deltaY = -_vm->_graphicsManager.zoomIn(tmpY, zoomPercent); } } else if (reducePercent) { if (tmpX >= 0) @@ -851,7 +851,7 @@ void ObjectsManager::computeSprite(int idx) { deltaY = _vm->_graphicsManager.zoomOut(tmpY, reducePercent); } else { tmpY = abs(tmpX); - deltaY = -_vm->_graphicsManager.zoomOut(abs(tmpX), reducePercent); + deltaY = -_vm->_graphicsManager.zoomOut(tmpY, reducePercent); } } @@ -883,12 +883,11 @@ void ObjectsManager::computeSprite(int idx) { } // Before Sort -void ObjectsManager::beforeSort(SortMode triMode, int index, int priority) { +void ObjectsManager::beforeSort(SortMode sortMode, int index, int priority) { ++_vm->_globals._sortedDisplayCount; - if (_vm->_globals._sortedDisplayCount > 48) - error("NBTRI too high"); + assert (_vm->_globals._sortedDisplayCount <= 48); - _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._sortMode = triMode; + _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._sortMode = sortMode; _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._index = index; _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._priority = priority; } @@ -980,7 +979,7 @@ void ObjectsManager::displayBobAnim() { if (v10 > 0) { int v11 = v10 / _vm->_globals._speed; - _vm->_globals._bob[idx].field12 = v10 / _vm->_globals._speed; + _vm->_globals._bob[idx].field12 = v11; // Original code. It can't be negative, so the check is on == 0 if (v11 <= 0) _vm->_globals._bob[idx].field12 = 1; @@ -2993,9 +2992,9 @@ void ObjectsManager::disableZone(int idx) { } -void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int a4) { +void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int animAction) { // Set Hopkins animation and position - if (a4 != 3) { + if (animAction != 3) { setBobAnimation(idx); SET_BOBPOSI(idx, fromPosi); } @@ -3005,9 +3004,9 @@ void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int a4) { _vm->_eventsManager.VBL(); } while (destPosi != BOBPOSI(idx)); - if (!a4) + if (!animAction) stopBobAnimation(idx); - else if (a4 == 4) { + else if (animAction == 4) { _vm->_graphicsManager.fastDisplay(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._oldX, _vm->_globals._bob[idx]._oldY, _vm->_globals._bob[idx]._frameIndex); stopBobAnimation(idx); @@ -3121,16 +3120,16 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.Cache[cacheIdx]._y = v10; if (!_vm->_globals.CACHE_BANQUE[1]) { - _vm->_globals.Cache[cacheIdx].fieldA = 0; + _vm->_globals.Cache[cacheIdx]._useCount = 0; } else { _vm->_globals.Cache[cacheIdx]._spriteData = _vm->_globals.CACHE_BANQUE[1]; _vm->_globals.Cache[cacheIdx]._width = getWidth(_vm->_globals.CACHE_BANQUE[1], v8); _vm->_globals.Cache[cacheIdx]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], v8); - _vm->_globals.Cache[cacheIdx].fieldA = 1; + _vm->_globals.Cache[cacheIdx]._useCount = 1; } if (!_vm->_globals.Cache[cacheIdx]._x && !_vm->_globals.Cache[cacheIdx]._y && !_vm->_globals.Cache[cacheIdx]._spriteIndex) - _vm->_globals.Cache[cacheIdx].fieldA = 0; + _vm->_globals.Cache[cacheIdx]._useCount = 0; v36 += 5; } @@ -3477,7 +3476,7 @@ void ObjectsManager::enableVerb(int idx, int a2) { } } -void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, bool flipFl) { +void ObjectsManager::ACTION(const byte *spriteData, const Common::String &actionStr, int a3, int a4, int speed, bool flipFl) { bool tokenCompleteFl; char curChar; int spriteIndex; @@ -3499,7 +3498,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in for (;;) { tokenCompleteFl = false; - curChar = a2[strPos]; + curChar = actionStr[strPos]; if (curChar == ',') { idx = atoi(tmpStr.c_str()); tmpStr = ""; @@ -3520,7 +3519,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in _sprite[0]._spriteData = spriteData; _sprite[0]._spriteIndex = idx; } - for (int v10 = 0; v10 < realSpeed; v10++) + for (int i = 0; i < realSpeed; i++) _vm->_eventsManager.VBL(); if (idx == -1) break; @@ -3706,9 +3705,9 @@ void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, in } } -void ObjectsManager::lockAnimX(int idx, int a2) { +void ObjectsManager::lockAnimX(int idx, int x) { _vm->_globals._lockedAnims[idx]._enableFl = true; - _vm->_globals._lockedAnims[idx]._posX = a2; + _vm->_globals._lockedAnims[idx]._posX = x; } void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, @@ -3733,7 +3732,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (!s4.empty()) { if (initializeScreen) _vm->_graphicsManager.INI_ECRAN(s4, initializeScreen); - if (!s4.empty() && !initializeScreen) + else _vm->_graphicsManager.INI_ECRAN2(s4, initializeScreen); } _vm->_eventsManager.mouseOn(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index d0d61c954c..5f6633d82b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -124,9 +124,9 @@ public: void checkCache(); void DEF_SPRITE(int idx); - void DEF_CACHE(int idx); + void displayCache(int idx); void computeSprite(int idx); - void beforeSort(SortMode triMode, int index, int priority); + void beforeSort(SortMode sortMode, int index, int priority); void displayBobAnim(); void displayVBob(); @@ -161,12 +161,12 @@ public: void computeAndSetSpriteSize(); void nextVerbIcon(); void handleRightButton(); - void initBorder(int a1); + void initBorder(int zoneIdx); void nextObjectIcon(int idx); void takeInventoryObject(int idx); void OPTI_OBJET(); void handleSpecialGames(); - void BOB_VIVANT(int a1); + void BOB_VIVANT(int idx); void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); void VBOB_OFF(int idx); void ACTION_DOS(int idx); @@ -178,7 +178,7 @@ public: void enableZone(int idx); void disableZone(int idx); - void OPTI_ONE(int idx, int fromPosi, int destPosi, int a4); + void OPTI_ONE(int idx, int fromPosi, int destPosi, int animAction); int BOBPOSI(int idx); void setBobAnimation(int idx); void stopBobAnimation(int idx); @@ -194,11 +194,11 @@ public: void disableVerb(int idx, int a2); void enableVerb(int idx, int a2); - void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, bool flipFl); + void ACTION(const byte *spriteData, const Common::String &actionStr, int a3, int a4, int speed, bool flipFl); void SPACTION(byte *spriteData, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl); void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed); void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx); - void lockAnimX(int idx, int a2); + void lockAnimX(int idx, int x); /** * Game scene control method -- cgit v1.2.3