aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2007-07-29 21:14:17 +0000
committerNicola Mettifogo2007-07-29 21:14:17 +0000
commitd9e6db79b53b46f933178f07d1ff69650a8fcd6f (patch)
tree14aa3e4bc748892df65deb28592447d88f9ff4a0 /engines/parallaction
parentb89bd7462c698b32cd80e16a02d80d48804a9e89 (diff)
downloadscummvm-rg350-d9e6db79b53b46f933178f07d1ff69650a8fcd6f.tar.gz
scummvm-rg350-d9e6db79b53b46f933178f07d1ff69650a8fcd6f.tar.bz2
scummvm-rg350-d9e6db79b53b46f933178f07d1ff69650a8fcd6f.zip
Refactored allegedly ugly code.
svn-id: r28318
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/parallaction.h12
-rw-r--r--engines/parallaction/staticres.cpp124
2 files changed, 76 insertions, 60 deletions
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 53ae64a136..31b125c92a 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -492,12 +492,15 @@ public:
int init();
public:
+ typedef void (Parallaction_ns::*Callable)(void*);
+
virtual void callFunction(uint index, void* parm);
private:
void initResources();
- typedef void (Parallaction_ns::*Callable)(void*);
+ static const Callable _dosCallables[25];
+ static const Callable _amigaCallables[25];
// common callables
void _c_play_boogie(void*);
@@ -532,7 +535,7 @@ private:
void _c_closeMusic(void*);
void _c_HBOn(void*);
- Callable _callables[25];
+ const Callable *_callables;
};
class Parallaction_br : public Parallaction {
@@ -544,6 +547,7 @@ public:
int init();
public:
+ typedef void (Parallaction_br::*Callable)(void*);
virtual void callFunction(uint index, void* parm);
public:
@@ -553,7 +557,7 @@ public:
private:
void initResources();
- typedef void (Parallaction_br::*Callable)(void*);
+ static const Callable _dosCallables[6];
void _c_blufade(void*);
void _c_resetpalette(void*);
@@ -562,7 +566,7 @@ private:
void _c_albcycle(void*);
void _c_password(void*);
- Callable _callables[6];
+ const Callable *_callables;
};
// FIXME: remove global
diff --git a/engines/parallaction/staticres.cpp b/engines/parallaction/staticres.cpp
index 6ff3b8a948..046176a933 100644
--- a/engines/parallaction/staticres.cpp
+++ b/engines/parallaction/staticres.cpp
@@ -483,8 +483,73 @@ const char *_minidoughName = "minidough";
const char *_minidrkiName = "minidrki";
#define CALLABLE_NS(x) &Parallaction_ns::x
+
+const Parallaction_ns::Callable Parallaction_ns::_dosCallables[] = {
+ CALLABLE_NS(_c_play_boogie),
+ CALLABLE_NS(_c_play_boogie),
+ CALLABLE_NS(_c_startIntro),
+ CALLABLE_NS(_c_endIntro),
+ CALLABLE_NS(_c_moveSheet),
+ CALLABLE_NS(_c_sketch),
+ CALLABLE_NS(_c_shade),
+ CALLABLE_NS(_c_score),
+ CALLABLE_NS(_c_null),
+ CALLABLE_NS(_c_null),
+ CALLABLE_NS(_c_null),
+ CALLABLE_NS(_c_fade),
+ CALLABLE_NS(_c_play_boogie),
+ CALLABLE_NS(_c_moveSarc),
+ CALLABLE_NS(_c_contaFoglie),
+ CALLABLE_NS(_c_zeroFoglie),
+ CALLABLE_NS(_c_trasformata),
+ CALLABLE_NS(_c_offMouse),
+ CALLABLE_NS(_c_onMouse),
+ CALLABLE_NS(_c_setMask),
+ CALLABLE_NS(_c_endComment),
+ CALLABLE_NS(_c_frankenstein),
+ CALLABLE_NS(_c_finito),
+ CALLABLE_NS(_c_ridux),
+ CALLABLE_NS(_c_testResult)
+};
+
+const Parallaction_ns::Callable Parallaction_ns::_amigaCallables[] = {
+ CALLABLE_NS(_c_projector),
+ CALLABLE_NS(_c_HBOff),
+ CALLABLE_NS(_c_startIntro),
+ CALLABLE_NS(_c_endIntro),
+ CALLABLE_NS(_c_moveSheet),
+ CALLABLE_NS(_c_sketch),
+ CALLABLE_NS(_c_shade),
+ CALLABLE_NS(_c_score),
+ CALLABLE_NS(_c_offSound),
+ CALLABLE_NS(_c_startMusic),
+ CALLABLE_NS(_c_closeMusic),
+ CALLABLE_NS(_c_fade),
+ CALLABLE_NS(_c_play_boogie),
+ CALLABLE_NS(_c_moveSarc),
+ CALLABLE_NS(_c_contaFoglie),
+ CALLABLE_NS(_c_zeroFoglie),
+ CALLABLE_NS(_c_trasformata),
+ CALLABLE_NS(_c_offMouse),
+ CALLABLE_NS(_c_onMouse),
+ CALLABLE_NS(_c_setMask),
+ CALLABLE_NS(_c_endComment),
+ CALLABLE_NS(_c_frankenstein),
+ CALLABLE_NS(_c_finito),
+ CALLABLE_NS(_c_ridux),
+ CALLABLE_NS(_c_testResult)
+};
+
#define CALLABLE_BR(x) &Parallaction_br::x
+const Parallaction_br::Callable Parallaction_br::_dosCallables[] = {
+ CALLABLE_BR(_c_blufade),
+ CALLABLE_BR(_c_resetpalette),
+ CALLABLE_BR(_c_ferrcycle),
+ CALLABLE_BR(_c_lipsinc),
+ CALLABLE_BR(_c_albcycle),
+ CALLABLE_BR(_c_password)
+};
void Parallaction_ns::initResources() {
@@ -504,57 +569,9 @@ void Parallaction_ns::initResources() {
_localFlagNames->addData("visited");
if (getPlatform() == Common::kPlatformPC) {
- _callables[0] = CALLABLE_NS(_c_play_boogie);
- _callables[1] = CALLABLE_NS(_c_play_boogie);
- _callables[2] = CALLABLE_NS(_c_startIntro);
- _callables[3] = CALLABLE_NS(_c_endIntro);
- _callables[4] = CALLABLE_NS(_c_moveSheet);
- _callables[5] = CALLABLE_NS(_c_sketch);
- _callables[6] = CALLABLE_NS(_c_shade);
- _callables[7] = CALLABLE_NS(_c_score);
- _callables[8] = CALLABLE_NS(_c_null);
- _callables[9] = CALLABLE_NS(_c_null);
- _callables[10] = CALLABLE_NS(_c_null);
- _callables[11] = CALLABLE_NS(_c_fade);
- _callables[12] = CALLABLE_NS(_c_play_boogie);
- _callables[13] = CALLABLE_NS(_c_moveSarc);
- _callables[14] = CALLABLE_NS(_c_contaFoglie);
- _callables[15] = CALLABLE_NS(_c_zeroFoglie);
- _callables[16] = CALLABLE_NS(_c_trasformata);
- _callables[17] = CALLABLE_NS(_c_offMouse);
- _callables[18] = CALLABLE_NS(_c_onMouse);
- _callables[19] = CALLABLE_NS(_c_setMask);
- _callables[20] = CALLABLE_NS(_c_endComment);
- _callables[21] = CALLABLE_NS(_c_frankenstein);
- _callables[22] = CALLABLE_NS(_c_finito);
- _callables[23] = CALLABLE_NS(_c_ridux);
- _callables[24] = CALLABLE_NS(_c_testResult);
+ _callables = _dosCallables;
} else {
- _callables[0] = CALLABLE_NS(_c_projector);
- _callables[1] = CALLABLE_NS(_c_HBOff);
- _callables[2] = CALLABLE_NS(_c_startIntro);
- _callables[3] = CALLABLE_NS(_c_endIntro);
- _callables[4] = CALLABLE_NS(_c_moveSheet);
- _callables[5] = CALLABLE_NS(_c_sketch);
- _callables[6] = CALLABLE_NS(_c_shade);
- _callables[7] = CALLABLE_NS(_c_score);
- _callables[8] = CALLABLE_NS(_c_offSound);
- _callables[9] = CALLABLE_NS(_c_startMusic);
- _callables[10] = CALLABLE_NS(_c_closeMusic);
- _callables[11] = CALLABLE_NS(_c_fade);
- _callables[12] = CALLABLE_NS(_c_HBOn);
- _callables[13] = CALLABLE_NS(_c_moveSarc);
- _callables[14] = CALLABLE_NS(_c_contaFoglie);
- _callables[15] = CALLABLE_NS(_c_zeroFoglie);
- _callables[16] = CALLABLE_NS(_c_trasformata);
- _callables[17] = CALLABLE_NS(_c_offMouse);
- _callables[18] = CALLABLE_NS(_c_onMouse);
- _callables[19] = CALLABLE_NS(_c_setMask);
- _callables[20] = CALLABLE_NS(_c_endComment);
- _callables[21] = CALLABLE_NS(_c_frankenstein);
- _callables[22] = CALLABLE_NS(_c_finito);
- _callables[23] = CALLABLE_NS(_c_ridux);
- _callables[24] = CALLABLE_NS(_c_testResult);
+ _callables = _amigaCallables;
}
}
@@ -580,12 +597,7 @@ void Parallaction_br::initResources() {
_localFlagNames->addData("visited");
if (getPlatform() == Common::kPlatformPC) {
- _callables[0] = CALLABLE_BR(_c_blufade);
- _callables[1] = CALLABLE_BR(_c_resetpalette);
- _callables[2] = CALLABLE_BR(_c_ferrcycle);
- _callables[3] = CALLABLE_BR(_c_lipsinc);
- _callables[4] = CALLABLE_BR(_c_albcycle);
- _callables[5] = CALLABLE_BR(_c_password);
+ _callables = _dosCallables;
}
}