aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kiehl2003-05-26 19:38:49 +0000
committerOliver Kiehl2003-05-26 19:38:49 +0000
commit1124e8e432b6b3219816889e1294939a927d865b (patch)
tree3a294a57dedbb0cf2b4d392dfe633c7f7d25f0d6
parentd08a06ea88d640acf2f8e7cbf6a92b7cbb25e19a (diff)
downloadscummvm-rg350-1124e8e432b6b3219816889e1294939a927d865b.tar.gz
scummvm-rg350-1124e8e432b6b3219816889e1294939a927d865b.tar.bz2
scummvm-rg350-1124e8e432b6b3219816889e1294939a927d865b.zip
cleanup (add supportive function getMegaSet() )
svn-id: r8014
-rw-r--r--sky/autoroute.cpp2
-rw-r--r--sky/compact.cpp15
-rw-r--r--sky/compact.h1
-rw-r--r--sky/logic.cpp4
4 files changed, 19 insertions, 3 deletions
diff --git a/sky/autoroute.cpp b/sky/autoroute.cpp
index 352abe791c..1cd6534317 100644
--- a/sky/autoroute.cpp
+++ b/sky/autoroute.cpp
@@ -70,7 +70,7 @@ uint16 SkyAutoRoute::autoRoute(Compact *cpt, uint16 **pSaveRoute) {
uint8 stretch1, stretch2; // bl / bh
stretch1 = 0;
- MegaSet *mega = (MegaSet *)SkyCompact::getCompactElem(cpt, C_GRID_WIDTH + cpt->extCompact->megaSet);
+ MegaSet *mega = SkyCompact::getMegaSet(cpt, cpt->extCompact->megaSet);
stretch2 = (uint8)(mega->gridWidth & 0xff);
uint16 cnt;
diff --git a/sky/compact.cpp b/sky/compact.cpp
index e11d6c5fdc..e584e99b63 100644
--- a/sky/compact.cpp
+++ b/sky/compact.cpp
@@ -50,6 +50,21 @@
namespace SkyCompact {
+MegaSet *getMegaSet(Compact *cpt, uint16 megaSet) {
+ switch (megaSet) {
+ case 0:
+ return cpt->extCompact->megaSet0;
+ case 1 + NEXT_MEGA_SET:
+ return cpt->extCompact->megaSet1;
+ case 2 + NEXT_MEGA_SET*2:
+ return cpt->extCompact->megaSet2;
+ case 3 + NEXT_MEGA_SET*3:
+ return cpt->extCompact->megaSet3;
+ default:
+ error("Invalid MegaSet (%d)", megaSet);
+ }
+}
+
uint16 *getSub(Compact *cpt, uint16 mode) {
switch (mode) {
case 0:
diff --git a/sky/compact.h b/sky/compact.h
index 364731ec9c..361957bab8 100644
--- a/sky/compact.h
+++ b/sky/compact.h
@@ -27,6 +27,7 @@
#include "sky/skydefs.h"
namespace SkyCompact {
+ MegaSet *getMegaSet(Compact *cpt, uint16 megaSet);
uint16 *getSub(Compact *cpt, uint16 mode);
void *getCompactElem(Compact *cpt, uint32 off);
diff --git a/sky/logic.cpp b/sky/logic.cpp
index 58c2292f98..5df3ffedf8 100644
--- a/sky/logic.cpp
+++ b/sky/logic.cpp
@@ -517,8 +517,8 @@ void SkyLogic::simpleAnim() {
}
bool SkyLogic::collide(Compact *cpt) {
- MegaSet *m1 = (MegaSet *)SkyCompact::getCompactElem(_compact, C_GRID_WIDTH + _compact->extCompact->megaSet);
- MegaSet *m2 = (MegaSet *)SkyCompact::getCompactElem(cpt, C_GRID_WIDTH + cpt->extCompact->megaSet);
+ MegaSet *m1 = SkyCompact::getMegaSet(_compact, _compact->extCompact->megaSet);
+ MegaSet *m2 = SkyCompact::getMegaSet(cpt, cpt->extCompact->megaSet);
// target's base coordinates
uint16 x = cpt->xcood & 0xfff8;