aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-03-17 15:17:42 +0100
committerStrangerke2013-03-17 15:17:42 +0100
commit43b9f5daff882f1ebc6cc4ffd962c64fd43f7930 (patch)
tree31115e09d2ab35d41163c955efff6f509f737418 /engines
parentf809f71f2eb14dfe9e125788d186d22a641899bb (diff)
downloadscummvm-rg350-43b9f5daff882f1ebc6cc4ffd962c64fd43f7930.tar.gz
scummvm-rg350-43b9f5daff882f1ebc6cc4ffd962c64fd43f7930.tar.bz2
scummvm-rg350-43b9f5daff882f1ebc6cc4ffd962c64fd43f7930.zip
HOPKINS: Some renaming in ObjectsManager
Diffstat (limited to 'engines')
-rw-r--r--engines/hopkins/objects.cpp54
-rw-r--r--engines/hopkins/objects.h6
-rw-r--r--engines/hopkins/script.cpp8
-rw-r--r--engines/hopkins/talk.cpp14
4 files changed, 38 insertions, 44 deletions
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index d9a9e00fa4..d262ff653b 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -838,9 +838,9 @@ void ObjectsManager::computeSprite(int idx) {
offY = getOffsetY(spr->_spriteData, spr->_spriteIndex, false);
}
- int tmpX = spr->field12 + offX;
+ int tmpX = spr->_deltaX + offX;
int deltaX = tmpX;
- int tmpY = spr->field14 + offY;
+ int tmpY = spr->_deltaY + offY;
int deltaY = tmpY;
int zoomPercent = 0;
int reducePercent = 0;
@@ -927,10 +927,7 @@ void ObjectsManager::displayBobAnim() {
continue;
_bob[idx].field1C = false;
- int v1 = _bob[idx].field20;
- if (v1 == -1)
- v1 = 50;
- if (_bob[idx]._animData == g_PTRNUL || _bob[idx]._disabledAnimationFl || v1 <= 0) {
+ if (_bob[idx]._animData == g_PTRNUL || _bob[idx]._disabledAnimationFl || _bob[idx].field20 == 0 || _bob[idx].field20 < -1) {
if (_bob[idx].field1E == 1 || _bob[idx].field1E == 2)
_bob[idx].field1C = true;
continue;
@@ -964,11 +961,9 @@ void ObjectsManager::displayBobAnim() {
_bob[idx]._flipFl = (dataPtr[2 * dataIdx + 9] != 0);
_bob[idx]._animDataIdx += 5;
- int v5 = _bob[idx].field12;
- if (v5 > 0) {
- int v6 = v5 / _vm->_globals._speed;
- _bob[idx].field12 = v5 / _vm->_globals._speed;
- if (v6 > 0) {
+ if (_bob[idx].field12 > 0) {
+ _bob[idx].field12 /= _vm->_globals._speed;
+ if (_bob[idx].field12 > 0) {
_bob[idx].field14 = 1;
if (_bob[idx].field1E == 1 || _bob[idx].field1E == 2)
_bob[idx].field1C = true;
@@ -998,13 +993,11 @@ void ObjectsManager::displayBobAnim() {
_bob[idx]._frameIndex = v21[8];
_bob[idx]._flipFl = (v21[9] != 0);
_bob[idx]._animDataIdx += 5;
- int v10 = _bob[idx].field12;
- if (v10 > 0) {
- int v11 = v10 / _vm->_globals._speed;
- _bob[idx].field12 = v11;
+ if (_bob[idx].field12 > 0) {
+ _bob[idx].field12 /= _vm->_globals._speed;
// Original code. It can't be negative, so the check is on == 0
- if (v11 <= 0)
+ if (_bob[idx].field12 <= 0)
_bob[idx].field12 = 1;
}
}
@@ -1058,13 +1051,13 @@ void ObjectsManager::displayBobAnim() {
_bob[i]._oldY = 0;
if (_bob[i].field0 == 10 && !_bob[i]._disabledAnimationFl && _bob[i].field1C) {
CALCUL_BOB(i);
- int v19 = _bob[i]._oldX2 + _bob[i]._oldHeight + _bob[i]._oldY;
+ int priority = _bob[i]._oldX2 + _bob[i]._oldHeight + _bob[i]._oldY;
- if (v19 > 450)
- v19 = 600;
+ if (priority > 450)
+ priority = 600;
if (_bob[i]._activeFl)
- beforeSort(SORT_BOB, i, v19);
+ beforeSort(SORT_BOB, i, priority);
}
}
}
@@ -1194,7 +1187,7 @@ void ObjectsManager::animateSprite(int idx) {
_sprite[idx]._animationType = 1;
}
-void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int a8, int a9) {
+void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int deltaX, int deltaY) {
assert (idx <= MAX_SPRITE);
SpriteItem *spr = &_sprite[idx];
@@ -1203,8 +1196,8 @@ void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos,
spr->_spriteIndex = spriteIndex;
spr->_zoomFactor = zoomFactor;
spr->_flipFl = flipFl;
- spr->field12 = a8;
- spr->field14 = a9;
+ spr->_deltaX = deltaX;
+ spr->_deltaY = deltaY;
spr->_animationType = 0;
if (READ_BE_UINT24(spriteData) == MKTAG24('R', 'L', 'E')) {
@@ -3154,22 +3147,23 @@ void ObjectsManager::loadLinkFile(const Common::String &file) {
}
int curLineIdx = 0;
- int v28;
- do {
- v28 = READ_LE_INT16(curDataPtr + 2 * curDataIdx);
- if (v28 != -1) {
+ for (;;) {
+ int bobZoneId = READ_LE_INT16(curDataPtr + 2 * curDataIdx);
+ if (bobZoneId != -1) {
_vm->_linesManager.addZoneLine(
curLineIdx,
READ_LE_INT16(curDataPtr + 2 * curDataIdx + 2),
READ_LE_INT16(curDataPtr + 2 * curDataIdx + 4),
READ_LE_INT16(curDataPtr + 2 * curDataIdx + 6),
READ_LE_INT16(curDataPtr + 2 * curDataIdx + 8),
- v28);
- _vm->_linesManager.ZONEP[v28]._enabledFl = true;
+ bobZoneId);
+ _vm->_linesManager.ZONEP[bobZoneId]._enabledFl = true;
}
curDataIdx += 5;
++curLineIdx;
- } while (v28 != -1);
+ if (bobZoneId == -1)
+ break;
+ }
for (int i = 1; i <= 100; i++) {
_vm->_linesManager.ZONEP[i]._destX = READ_LE_INT16(curDataPtr + 2 * curDataIdx);
_vm->_linesManager.ZONEP[i]._destY = READ_LE_INT16(curDataPtr + 2 * curDataIdx + 2);
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index 677cbe3a4f..a1ea0dd6b1 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.h
@@ -39,8 +39,8 @@ struct SpriteItem {
int _zoomFactor;
bool _flipFl;
int _spriteIndex;
- int field12;
- int field14;
+ int _deltaX;
+ int _deltaY;
bool _rleFl;
bool _activeFl;
int _destX;
@@ -174,7 +174,7 @@ public:
int getHeight(const byte *objectData, int idx);
byte *loadSprite(const Common::String &file);
void loadLinkFile(const Common::String &file);
- void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int a8, int a9);
+ void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int deltaX, int deltaY);
void animateSprite(int idx);
void removeSprite(int idx);
void setSpriteX(int idx, int xp);
diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp
index 50f7999077..92374495c6 100644
--- a/engines/hopkins/script.cpp
+++ b/engines/hopkins/script.cpp
@@ -937,8 +937,8 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals._characterType = 1;
_vm->_globals._saveData->_data[svAlternateSpriteFl] = 1;
_vm->_globals.loadCharacterData();
- _vm->_objectsManager._sprite[0].field12 = 28;
- _vm->_objectsManager._sprite[0].field14 = 155;
+ _vm->_objectsManager._sprite[0]._deltaX = 28;
+ _vm->_objectsManager._sprite[0]._deltaY = 155;
_vm->_objectsManager.computeAndSetSpriteSize();
break;
@@ -947,8 +947,8 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals._characterType = 0;
_vm->_globals._saveData->_data[svAlternateSpriteFl] = 0;
_vm->_globals.loadCharacterData();
- _vm->_objectsManager._sprite[0].field12 = 34;
- _vm->_objectsManager._sprite[0].field14 = 190;
+ _vm->_objectsManager._sprite[0]._deltaX = 34;
+ _vm->_objectsManager._sprite[0]._deltaY = 190;
_vm->_objectsManager.computeAndSetSpriteSize();
break;
diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp
index ac83b9c878..e90f0f84aa 100644
--- a/engines/hopkins/talk.cpp
+++ b/engines/hopkins/talk.cpp
@@ -604,19 +604,19 @@ void TalkManager::BOB_VISU_PARLE(int idx) {
_vm->_objectsManager._priorityFl = true;
if (!_vm->_objectsManager._bob[idx].field0) {
_vm->_objectsManager.resetBob(idx);
- byte *v5 = _vm->_globals._animBqe[idx]._data;
- int v4 = READ_LE_INT16(v5 + 2);
- if (!v4)
- v4 = 1;
- if (READ_LE_INT16(v5 + 24)) {
+ byte *bqeData = _vm->_globals._animBqe[idx]._data;
+ int newField1E = READ_LE_INT16(bqeData + 2);
+ if (!newField1E)
+ newField1E = 1;
+ if (READ_LE_INT16(bqeData + 24)) {
_vm->_objectsManager._bob[idx]._isSpriteFl = true;
_vm->_objectsManager._bob[idx]._zoomFactor = 0;
_vm->_objectsManager._bob[idx]._flipFl = false;
_vm->_objectsManager._bob[idx]._animData = _vm->_globals._animBqe[idx]._data;
_vm->_objectsManager._bob[idx].field0 = 10;
- v5 = _characterSprite;
+ bqeData = _characterSprite;
_vm->_objectsManager._bob[idx]._spriteData = _characterSprite;
- _vm->_objectsManager._bob[idx].field1E = v4;
+ _vm->_objectsManager._bob[idx].field1E = newField1E;
_vm->_objectsManager._bob[idx].field20 = -1;
_vm->_objectsManager._bob[idx].field22 = 0;
}