diff options
author | Travis Howell | 2006-11-05 08:27:15 +0000 |
---|---|---|
committer | Travis Howell | 2006-11-05 08:27:15 +0000 |
commit | 05dcf9c11db19f0b4da7892cfdc052b0df5f3ab6 (patch) | |
tree | 8cd01575c3507951a419a61fec9941c02dd8340c /engines/agos | |
parent | 5c72acb536c967454be352288afc6c491ab77cb7 (diff) | |
download | scummvm-rg350-05dcf9c11db19f0b4da7892cfdc052b0df5f3ab6.tar.gz scummvm-rg350-05dcf9c11db19f0b4da7892cfdc052b0df5f3ab6.tar.bz2 scummvm-rg350-05dcf9c11db19f0b4da7892cfdc052b0df5f3ab6.zip |
Cleanup
svn-id: r24626
Diffstat (limited to 'engines/agos')
-rw-r--r-- | engines/agos/intern.h | 3 | ||||
-rw-r--r-- | engines/agos/res.cpp | 5 | ||||
-rw-r--r-- | engines/agos/rooms.cpp | 27 | ||||
-rw-r--r-- | engines/agos/saveload.cpp | 22 |
4 files changed, 21 insertions, 36 deletions
diff --git a/engines/agos/intern.h b/engines/agos/intern.h index eab0d9a449..7eed262f1c 100644 --- a/engines/agos/intern.h +++ b/engines/agos/intern.h @@ -45,8 +45,7 @@ struct SubSuperRoom : Child { uint16 roomX; uint16 roomY; uint16 roomZ; - uint16 *roomExitStates; - uint16 roomExit[1]; + uint16 roomExitStates[1]; }; struct SubObject : Child { diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 68b7ab5fe9..d26957fdd6 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -402,17 +402,16 @@ void AGOSEngine::readItemChildren(Common::SeekableReadStream *in, Item *item, ui j = x * y * z; size = SubSuperRoom_SIZE; for (i = 0; i != j; i++) - size += sizeof(subSuperRoom->roomExit[0]); + size += sizeof(subSuperRoom->roomExitStates[0]); subSuperRoom = (SubSuperRoom *)allocateChildBlock(item, 4, size); subSuperRoom->subroutine_id = id; subSuperRoom->roomX = x; subSuperRoom->roomY = y; subSuperRoom->roomZ = z; - subSuperRoom->roomExitStates = (uint16 *)calloc(j, sizeof(uint16)); for (i = k = 0; i != j; i++) - subSuperRoom->roomExit[k++] = in->readUint16BE(); + subSuperRoom->roomExitStates[k++] = in->readUint16BE(); } else if (getGameType() == GType_ELVIRA1) { SubGenExit *genExit = (SubGenExit *)allocateChildBlock(item, 4, sizeof(SubGenExit)); genExit->dest[0] = (uint16)fileReadItemID(in); diff --git a/engines/agos/rooms.cpp b/engines/agos/rooms.cpp index e287d22b28..3612a63d15 100644 --- a/engines/agos/rooms.cpp +++ b/engines/agos/rooms.cpp @@ -193,7 +193,6 @@ void AGOSEngine::moveDirn_e1(Item *i, uint x) { // Elvira 2 specific int AGOSEngine::changeExitStates(SubSuperRoom *sr, int n, int d, uint16 s) { int b, bd; - uint16 *c; uint16 mask = 3; uint16 bs = s; @@ -238,22 +237,18 @@ int AGOSEngine::changeExitStates(SubSuperRoom *sr, int n, int d, uint16 s) { return 0; } n--; - c = sr->roomExitStates; - c += n; d <<= 1; mask <<= d; s <<= d; - *c &= ~mask; - *c |= s; + sr->roomExitStates[n] &= ~mask; + sr->roomExitStates[n] |= s; mask = 3; n += b; - c = sr->roomExitStates; - c += n; bd <<= 1; mask <<= bd; bs <<= bd; - *c &= ~mask; - *c |= bs; + sr->roomExitStates[n] &= ~mask; + sr->roomExitStates[n] |= bs; return 1; } @@ -261,17 +256,14 @@ uint16 AGOSEngine::getExitState(Item *i, uint16 x, uint16 d) { SubSuperRoom *sr; uint16 mask = 3; uint16 n; - uint16 *c; sr = (SubSuperRoom *)findChildOfType(i, 4); if (sr == NULL) return 0; - c = sr->roomExitStates; - c += x - 1; d <<= 1; mask <<= d; - n = *c & mask; + n = sr->roomExitStates[x - 1] & mask; n >>= d; return n; } @@ -283,19 +275,16 @@ void AGOSEngine::setExitState(Item *i, uint16 n, uint16 d, uint16 s) { } void AGOSEngine::setSRExit(Item *i, int n, int d, uint16 s) { - uint16 *c; uint16 mask = 3; SubSuperRoom *sr = (SubSuperRoom *)findChildOfType(i, 4); if (sr) { n--; - c = sr->roomExitStates; - c += n; d <<= 1; mask <<= d; s <<= d; - *c &= ~mask; - *c |= s; + sr->roomExitStates[n] &= ~mask; + sr->roomExitStates[n] |= s; } } @@ -316,7 +305,7 @@ void AGOSEngine::moveDirn_e2(Item *i, uint x) { case 0: a = -(sr->roomX); break; case 1: a = 1; break; case 2: a = sr->roomX; break; - case 3: a = (uint16)-1; break; + case 3: a = 0xFFFF; break; case 4: a = -(sr->roomX * sr->roomY); break; case 5: a = (sr->roomX * sr->roomY); break; default: return; diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp index 8f7ec7a203..a0f973d844 100644 --- a/engines/agos/saveload.cpp +++ b/engines/agos/saveload.cpp @@ -134,8 +134,8 @@ char *AGOSEngine::genSaveName(int slot) { void AGOSEngine::quickLoadOrSave() { // Quick load & save is only supported complete version of Simon the Sorcerer 1/2 - if (getGameType() != GType_SIMON1 && getGameType() != GType_SIMON2 && - !(getFeatures() & GF_DEMO)) { + if (getGameType() != GType_SIMON1 && getGameType() != GType_SIMON2 || + (getFeatures() & GF_DEMO)) { return; } @@ -617,8 +617,8 @@ bool AGOSEngine::loadGame_e1(const char *filename) { killAllTimers(); for (num = f->readUint32BE(); num; num--) { uint32 timeout = f->readUint32BE(); - uint16 func_to_call = f->readUint16BE(); - addTimeEvent(timeout, func_to_call); + uint16 subroutine_id = f->readUint16BE(); + addTimeEvent(timeout, subroutine_id); } item_index = 1; @@ -814,8 +814,8 @@ bool AGOSEngine::loadGame(const char *filename) { killAllTimers(); for (num = f->readUint32BE(); num; num--) { uint32 timeout = f->readUint32BE(); - uint16 func_to_call = f->readUint16BE(); - addTimeEvent(timeout, func_to_call); + uint16 subroutine_id = f->readUint16BE(); + addTimeEvent(timeout, subroutine_id); } item_index = 1; @@ -845,9 +845,8 @@ bool AGOSEngine::loadGame(const char *filename) { SubSuperRoom *sr = (SubSuperRoom *)findChildOfType(item, 4); if (sr) { uint16 n = sr->roomX * sr->roomY * sr->roomZ; - uint16 *c = sr->roomExitStates; - while(n--) - *c++ = f->readUint16BE(); + for (i = j = 0; i != n; i++) + sr->roomExitStates[j++] = f->readUint16BE(); } SubObject *o = (SubObject *)findChildOfType(item, 2); @@ -975,9 +974,8 @@ bool AGOSEngine::saveGame(uint slot, const char *caption) { SubSuperRoom *sr = (SubSuperRoom *)findChildOfType(item, 4); if (sr) { uint16 n = sr->roomX * sr->roomY * sr->roomZ; - uint16 *c = sr->roomExitStates; - while(n--) - f->writeUint16BE(*c++); + for (i = j = 0; i != n; i++) + f->writeUint16BE(sr->roomExitStates[j++]); } SubObject *o = (SubObject *)findChildOfType(item, 2); |