diff options
author | Oliver Kiehl | 2003-05-26 19:55:28 +0000 |
---|---|---|
committer | Oliver Kiehl | 2003-05-26 19:55:28 +0000 |
commit | 304f89540b7cc4adb6ee7768569a70595dadb0ef (patch) | |
tree | e2de22197f696d2ad65408a7e71c1d0eaf08009d /sky | |
parent | 1124e8e432b6b3219816889e1294939a927d865b (diff) | |
download | scummvm-rg350-304f89540b7cc4adb6ee7768569a70595dadb0ef.tar.gz scummvm-rg350-304f89540b7cc4adb6ee7768569a70595dadb0ef.tar.bz2 scummvm-rg350-304f89540b7cc4adb6ee7768569a70595dadb0ef.zip |
cleanup (add supportive function getTurnTable() )
svn-id: r8015
Diffstat (limited to 'sky')
-rw-r--r-- | sky/compact.cpp | 18 | ||||
-rw-r--r-- | sky/compact.h | 1 | ||||
-rw-r--r-- | sky/logic.cpp | 8 |
3 files changed, 22 insertions, 5 deletions
diff --git a/sky/compact.cpp b/sky/compact.cpp index e584e99b63..4d75548ada 100644 --- a/sky/compact.cpp +++ b/sky/compact.cpp @@ -65,6 +65,24 @@ MegaSet *getMegaSet(Compact *cpt, uint16 megaSet) { } } +uint16 **getTurnTable(Compact *cpt, uint16 megaSet, uint16 dir) { + MegaSet *m = getMegaSet(cpt, megaSet); + switch (dir) { + case 0: + return m->turnTable->turnTableUp; + case 1: + return m->turnTable->turnTableDown; + case 2: + return m->turnTable->turnTableLeft; + case 3: + return m->turnTable->turnTableRight; + case 4: + return m->turnTable->turnTableTalk; + default: + error("No TurnTable (%d) in MegaSet (%d)", dir, megaSet); + } +} + uint16 *getSub(Compact *cpt, uint16 mode) { switch (mode) { case 0: diff --git a/sky/compact.h b/sky/compact.h index 361957bab8..2db3318380 100644 --- a/sky/compact.h +++ b/sky/compact.h @@ -28,6 +28,7 @@ namespace SkyCompact { MegaSet *getMegaSet(Compact *cpt, uint16 megaSet); + uint16 **getTurnTable(Compact *cpt, uint16 megaSet, uint16 dir); uint16 *getSub(Compact *cpt, uint16 mode); void *getCompactElem(Compact *cpt, uint32 off); diff --git a/sky/logic.cpp b/sky/logic.cpp index 5df3ffedf8..1c9566fbe1 100644 --- a/sky/logic.cpp +++ b/sky/logic.cpp @@ -301,8 +301,7 @@ void SkyLogic::mainAnim() { // ok, setup turning _compact->extCompact->dir = *(sequence + 1); - uint16 **tt = (uint16 **)SkyCompact::getCompactElem(_compact, - C_TURN_TABLE + _compact->extCompact->megaSet + dir * 20); + uint16 **tt = SkyCompact::getTurnTable(_compact,_compact->extCompact->megaSet, dir); if (tt[_compact->extCompact->dir]) { _compact->extCompact->turnProg = tt[_compact->extCompact->dir]; _compact->logic = L_AR_TURNING; @@ -1247,11 +1246,10 @@ uint32 SkyLogic::fnSetToStand(uint32 a, uint32 b, uint32 c) { uint32 SkyLogic::fnTurnTo(uint32 dir, uint32 b, uint32 c) { // turn compact to direction dir - uint16 curDir = _compact->extCompact->dir * 20; // get current direction + uint16 curDir = _compact->extCompact->dir; // get current direction _compact->extCompact->dir = (uint16)(dir & 0xffff); // set new direction - uint16 **tt = (uint16 **)SkyCompact::getCompactElem(_compact, - C_TURN_TABLE + _compact->extCompact->megaSet + curDir); + uint16 **tt = SkyCompact::getTurnTable(_compact, _compact->extCompact->megaSet, curDir); if (!tt[dir]) return 1; // keep going |