[Scummvm-cvs-logs] SF.net SVN: scummvm: [28318] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Jul 29 23:14:18 CEST 2007


Revision: 28318
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28318&view=rev
Author:   peres001
Date:     2007-07-29 14:14:17 -0700 (Sun, 29 Jul 2007)

Log Message:
-----------
Refactored allegedly ugly code.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/staticres.cpp

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-07-29 21:08:39 UTC (rev 28317)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-07-29 21:14:17 UTC (rev 28318)
@@ -492,12 +492,15 @@
 	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 @@
 	void _c_closeMusic(void*);
 	void _c_HBOn(void*);
 
-	Callable _callables[25];
+	const Callable *_callables;
 };
 
 class Parallaction_br : public Parallaction {
@@ -544,6 +547,7 @@
 	int init();
 
 public:
+	typedef void (Parallaction_br::*Callable)(void*);
 	virtual	void callFunction(uint index, void* parm);
 
 public:
@@ -553,7 +557,7 @@
 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 @@
 	void _c_albcycle(void*);
 	void _c_password(void*);
 
-	Callable _callables[6];
+	const Callable *_callables;
 };
 
 // FIXME: remove global

Modified: scummvm/trunk/engines/parallaction/staticres.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/staticres.cpp	2007-07-29 21:08:39 UTC (rev 28317)
+++ scummvm/trunk/engines/parallaction/staticres.cpp	2007-07-29 21:14:17 UTC (rev 28318)
@@ -483,8 +483,73 @@
 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 @@
 	_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 @@
 	_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;
 	}
 
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list