Skip to content

Commit

Permalink
HOPKINS: Rename several structures
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Jan 21, 2013
1 parent daa6c88 commit de2fa9a
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 154 deletions.
34 changes: 14 additions & 20 deletions engines/hopkins/anim.cpp
Expand Up @@ -535,8 +535,6 @@ void AnimationManager::clearAnim() {
* Load Sprite Bank
*/
int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) {
byte *v13;
byte *v19;
int result = 0;
_vm->_globals.Bank[idx]._loadedFl = true;
_vm->_globals.Bank[idx]._filename = filename;
Expand All @@ -557,26 +555,22 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) {

_vm->_globals.Bank[idx]._data = fileDataPtr;

int v8 = 0;
int objectDataIdx = 0;
int width;
int height;
for(;;) {
width = _vm->_objectsManager.getWidth(fileDataPtr, v8);
height = _vm->_objectsManager.getHeight(fileDataPtr, v8);
for(objectDataIdx = 0; objectDataIdx <= 249; objectDataIdx++) {
width = _vm->_objectsManager.getWidth(fileDataPtr, objectDataIdx);
height = _vm->_objectsManager.getHeight(fileDataPtr, objectDataIdx);
if (!width && !height)
break;

++v8;
if (v8 > 249)
break;
}

if (v8 > 249) {
if (objectDataIdx > 249) {
_vm->_globals.freeMemory(fileDataPtr);
_vm->_globals.Bank[idx]._loadedFl = false;
result = -2;
}
_vm->_globals.Bank[idx].field1A = v8;
_vm->_globals.Bank[idx]._objDataIdx = objectDataIdx;

Common::String ofsFilename = _vm->_globals.Bank[idx]._filename;
char ch;
Expand All @@ -588,20 +582,20 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) {

Common::File f;
if (f.exists(ofsFilename)) {
v19 = _vm->_fileManager.loadFile(ofsFilename);
v13 = v19;
for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx].field1A; ++objIdx, v13 += 8) {
int x1 = (int16)READ_LE_UINT16(v13);
int y1 = (int16)READ_LE_UINT16(v13 + 2);
int x2 = (int16)READ_LE_UINT16(v13 + 4);
int y2 = (int16)READ_LE_UINT16(v13 + 6);
byte *ofsData = _vm->_fileManager.loadFile(ofsFilename);
byte *curOfsData = ofsData;
for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx]._objDataIdx; ++objIdx, curOfsData += 8) {
int x1 = (int16)READ_LE_UINT16(curOfsData);
int y1 = (int16)READ_LE_UINT16(curOfsData + 2);
int x2 = (int16)READ_LE_UINT16(curOfsData + 4);
int y2 = (int16)READ_LE_UINT16(curOfsData + 6);

_vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0);
if (_vm->_globals.Bank[idx]._fileHeader == 2)
_vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1);
}

_vm->_globals.freeMemory(v19);
_vm->_globals.freeMemory(ofsData);
result = 0;
}

Expand Down
4 changes: 2 additions & 2 deletions engines/hopkins/globals.cpp
Expand Up @@ -81,7 +81,7 @@ Globals::Globals() {
for (int i = 0; i < 6; ++i)
Common::fill((byte *)&Liste[i], (byte *)&Liste[i] + sizeof(ListeItem), 0);
for (int i = 0; i < 35; ++i)
Common::fill((byte *)&Liste2[i], (byte *)&Liste2[i] + sizeof(Liste2Item), 0);
Common::fill((byte *)&Liste2[i], (byte *)&Liste2[i] + sizeof(ListeItem), 0);
for (int i = 0; i < 30; ++i) {
Common::fill((byte *)&_lockedAnims[i], (byte *)&_lockedAnims[i] + sizeof(LockAnimItem), 0);
Common::fill((byte *)&VBob[i], (byte *)&VBob[i] + sizeof(VBobItem), 0);
Expand Down Expand Up @@ -337,7 +337,7 @@ void Globals::clearAll() {
}

for (int idx = 0; idx < 100; ++idx) {
CarreZone[idx].field0 = 0;
CarreZone[idx]._enabledFl = 0;
}

BUFFERTAPE = allocMemory(85000);
Expand Down
33 changes: 12 additions & 21 deletions engines/hopkins/globals.h
Expand Up @@ -48,14 +48,14 @@ struct ZonePItem {
};

struct CarreZoneItem {
int field0;
int field2;
int field4;
int field6;
int field8;
int fieldA;
int fieldC;
bool fieldE;
int _enabledFl;
int _left;
int _right;
int _top;
int _bottom;
int _minZoneLineIdx;
int _maxZoneLineIdx;
bool _squareZoneFl;
};

struct BqeAnimItem {
Expand All @@ -68,22 +68,13 @@ struct BankItem {
bool _loadedFl;
Common::String _filename;
int _fileHeader;
int field1A;
int _objDataIdx;
};

struct ListeItem {
bool field0;
int field2;
int field4;
int _width;
int _height;
int fieldA;
};

struct Liste2Item {
bool _visibleFl;
int _xp;
int _yp;
int _posX;
int _posY;
int _width;
int _height;
};
Expand Down Expand Up @@ -312,7 +303,7 @@ class Globals {
BankItem Bank[8];
BobItem _bob[36];
ListeItem Liste[6];
Liste2Item Liste2[35];
ListeItem Liste2[35];
LockAnimItem _lockedAnims[30];
VBobItem VBob[30];
ObjetWItem ObjetW[300];
Expand Down

0 comments on commit de2fa9a

Please sign in to comment.