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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Jan 28 14:10:50 CET 2008


Revision: 30675
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30675&view=rev
Author:   peres001
Date:     2008-01-28 05:10:49 -0800 (Mon, 28 Jan 2008)

Log Message:
-----------
Removed all job routines. Stubs have been left for future reference in the code for BRA.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/debug.cpp
    scummvm/trunk/engines/parallaction/debug.h
    scummvm/trunk/engines/parallaction/exec_br.cpp
    scummvm/trunk/engines/parallaction/exec_ns.cpp
    scummvm/trunk/engines/parallaction/gfxbase.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_br.cpp
    scummvm/trunk/engines/parallaction/parallaction_ns.cpp
    scummvm/trunk/engines/parallaction/parser_ns.cpp
    scummvm/trunk/engines/parallaction/walk.cpp
    scummvm/trunk/engines/parallaction/walk.h

Modified: scummvm/trunk/engines/parallaction/debug.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/debug.cpp	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/debug.cpp	2008-01-28 13:10:49 UTC (rev 30675)
@@ -32,31 +32,6 @@
 namespace Parallaction {
 
 
-const char *_jobDescriptions[] = {
-	"draw label",
-	"draw mouse",
-	"delayed label deletion || show inventory",
-	"draw animations",
-	"NONE",
-	"NONE",
-	"NONE",
-	"NONE",
-	"NONE",
-	"NONE",
-	"NONE",
-	"NONE",
-	"NONE",
-	"NONE",
-	"NONE",
-	"delayed label deletion || run scripts || erase animations",
-	"NONE",
-	"put item || pickup item",
-	"toggle door",
-	"walk",
-	"erase label || hide inventory",
-	"erase mouse"
-};
-
 Debugger::Debugger(Parallaction *vm)
 	: GUI::Debugger() {
 	_vm = vm;
@@ -64,7 +39,6 @@
 	DCmd_Register("continue",	WRAP_METHOD(Debugger, Cmd_Exit));
 	DCmd_Register("location",	WRAP_METHOD(Debugger, Cmd_Location));
 	DCmd_Register("give",		WRAP_METHOD(Debugger, Cmd_Give));
-	DCmd_Register("jobs",		WRAP_METHOD(Debugger, Cmd_Jobs));
 	DCmd_Register("zones",		WRAP_METHOD(Debugger, Cmd_Zones));
 	DCmd_Register("animations",	WRAP_METHOD(Debugger, Cmd_Animations));
 	DCmd_Register("localflags",	WRAP_METHOD(Debugger, Cmd_LocalFlags));
@@ -124,9 +98,6 @@
 
 bool Debugger::Cmd_LocalFlags(int argc, const char **argv) {
 
-	JobList::iterator b = _vm->_jobs.begin();
-	JobList::iterator e = _vm->_jobs.end();
-
 	uint32 flags = _vm->_localFlags[_vm->_currentLocationIndex];
 
 	DebugPrintf("+------------------------------+---------+\n"
@@ -157,23 +128,6 @@
 }
 
 
-bool Debugger::Cmd_Jobs(int argc, const char **argv) {
-
-	JobList::iterator b = _vm->_jobs.begin();
-	JobList::iterator e = _vm->_jobs.end();
-
-	DebugPrintf("+---+-------------------------------------------------------------+\n"
-				"|tag| description                                                 |\n"
-				"+---+-------------------------------------------------------------+\n");
-	for ( ; b != e; b++) {
-		DebugPrintf("|%3i| %-60s|\n", (*b)->_job->_tag, _jobDescriptions[(*b)->_job->_tag] );
-	}
-	DebugPrintf("+---+-------------------------------------------------------------+\n");
-
-
-	return true;
-}
-
 bool Debugger::Cmd_Zones(int argc, const char **argv) {
 
 	ZoneList::iterator b = _vm->_zones.begin();

Modified: scummvm/trunk/engines/parallaction/debug.h
===================================================================
--- scummvm/trunk/engines/parallaction/debug.h	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/debug.h	2008-01-28 13:10:49 UTC (rev 30675)
@@ -22,7 +22,6 @@
 	bool Cmd_DebugLevel(int argc, const char **argv);
 	bool Cmd_Location(int argc, const char **argv);
 	bool Cmd_Give(int argc, const char **argv);
-	bool Cmd_Jobs(int argc, const char **argv);
 	bool Cmd_Zones(int argc, const char **argv);
 	bool Cmd_Animations(int argc, const char **argv);
 	bool Cmd_LocalFlags(int argc, const char **argv);

Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp	2008-01-28 13:10:49 UTC (rev 30675)
@@ -425,14 +425,13 @@
 }
 
 
-
+#if 0
 void Parallaction_br::jobDisplaySubtitle(void *parm, Job *job) {
 //	_gfx->drawLabel(_subtitle0);
 //	_gfx->drawLabel(_subtitle1);
 }
 
 void Parallaction_br::jobEraseSubtitle(void *parm, Job *job) {
-#if 0
 	Common::Rect r;
 
 	if (_subtitle0._old.x != -1000) {
@@ -452,9 +451,8 @@
 		_gfx->restoreBackground(r);
 	}
 	_subtitle1._old = _subtitle1._pos;
-#endif
 }
-
+#endif
 DECLARE_INSTRUCTION_OPCODE(text) {
 	Instruction *inst = (*_instRunCtxt.inst);
 	setupSubtitles(inst->_text, inst->_text2, inst->_y);
@@ -582,7 +580,7 @@
 
 }
 
-
+#if 0
 void Parallaction_br::jobWaitRemoveLabelJob(void *parm, Job *job) {
 
 }
@@ -606,9 +604,9 @@
 void Parallaction_br::jobScroll(void *parm, Job *job) {
 
 }
+#endif
 
 
 
 
-
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-01-28 13:10:49 UTC (rev 30675)
@@ -338,11 +338,8 @@
 
 			_gfx->showGfxObj(obj, true);
 			obj->frame = frame;
-//			obj->setFrame(frame);
 			obj->x = v18->_left;
 			obj->y = v18->_top;
-//			obj->setPos(v18->_top, v18->_left);
-//			obj->setZ(_si);
 			obj->z = _si;
 		}
 
@@ -363,7 +360,7 @@
 
 
 void Parallaction_ns::eraseAnimations() {
-	debugC(9, kDebugExec, "jobEraseAnimations");
+	debugC(9, kDebugExec, "eraseAnimations");
 
 	for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++) {
 
@@ -384,7 +381,7 @@
 
 
 void Parallaction_ns::runScripts() {
-	debugC(9, kDebugExec, "jobRunScripts");
+	debugC(9, kDebugExec, "runScripts");
 
 	if (_engineFlags & kEnginePauseJobs) {
 		return;

Modified: scummvm/trunk/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-01-28 13:10:49 UTC (rev 30675)
@@ -130,6 +130,7 @@
 	// TODO: some zones don't appear because of wrong masking (3 or 0?)
 	// TODO: Dr.Ki is not visible inside the club
 
+
 	for (uint i = 0; i < 3; i++) {
 
 		GfxObjList::iterator b = _gfxobjList[i].begin();

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-01-28 13:10:49 UTC (rev 30675)
@@ -293,7 +293,6 @@
 			eraseAnimations();
 			runScripts();
 			walk();
-			runJobs();
 			drawAnimations();
 		}
 
@@ -623,39 +622,6 @@
 }
 
 
-
-/*
-	helper function to provide *descending* ordering of the job list
-	(higher priorities values comes first in the list)
-*/
-int compareJobPriority(const JobPointer &j1, const JobPointer &j2) {
-	return (j1->_job->_tag >= j2->_job->_tag ? -1 : 1);
-}
-
-Job *Parallaction::addJob(uint functionId, void *parm, uint16 tag) {
-	debugC(9, kDebugExec, "addJob(%i)", tag);
-
-	Job *v8 = new Job;
-
-	v8->_parm = parm;
-	v8->_tag = tag;
-	v8->_finished = 0;
-	v8->_count = 0;
-
-	JobOpcode *op = createJobOpcode(functionId, v8);
-
-	_jobs.insertSorted(op, compareJobPriority);
-
-	return v8;
-}
-
-void Parallaction::removeJob(Job *j) {
-	debugC(9, kDebugExec, "addJob(%i)", j->_tag);
-
-	j->_finished = 1;
-	return;
-}
-
 void Parallaction::pauseJobs() {
 	debugC(9, kDebugExec, "pausing jobs execution");
 
@@ -670,34 +636,7 @@
 	return;
 }
 
-void Parallaction::runJobs() {
 
-	if (_engineFlags & kEnginePauseJobs) return;
-
-	JobList::iterator it = _jobs.begin();
-	while (it != _jobs.end()) {
-		Job *job = (*it)->_job;
-		if (job->_finished == 1)
-			it = _jobs.erase(it);
-		else
-			it++;
-	}
-
-	it = _jobs.begin();
-	while (it != _jobs.end()) {
-		Job *job = (*it)->_job;
-		debugC(9, kDebugExec, "runJobs: %i", job->_tag);
-		(*(*it))();
-		it++;
-	}
-
-
-	return;
-}
-
-
-
-
 void Parallaction::pushParserTables(OpcodeSet *opcodes, Table *statements) {
 	_opcodes.push(_currentOpcodes);
 	_statements.push(_currentStatements);
@@ -970,10 +909,6 @@
 	}
 
 	_walkPath = _builder.buildPath(x, y);
-
-//	WalkNodeList *list = _builder.buildPath(x, y);
-//	_vm->addJob(kJobWalk, list, kPriority19 );
-
 	_engineFlags |= kEngineWalking;
 }
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-01-28 13:10:49 UTC (rev 30675)
@@ -141,20 +141,6 @@
 
 
 
-struct Job;
-
-struct Job {
-	uint16		_count;			// # of executions left
-	uint16		_tag;			// used for ordering
-	uint16		_finished;
-	void *		_parm;
-
-public:
-	Job() : _count(0), _tag(0), _finished(0), _parm(NULL) {
-	}
-};
-
-
 extern uint16		_mouseButtons;
 extern char			_password[8];
 extern uint16		_score;
@@ -288,65 +274,8 @@
 
 typedef Common::Array<const Opcode*>	OpcodeSet;
 
-class JobOpcode {
 
-public:
-	Job *_job;
 
-	JobOpcode(Job *job) : _job(job) { }
-
-	virtual void operator()() const = 0;
-	virtual ~JobOpcode() {
-		delete _job;
-	}
-};
-
-template <class T>
-class OpcodeImpl2 : public JobOpcode {
-
-	typedef void (T::*Fn)(void *, Job*);
-
-	T*	_instance;
-	Fn	_fn;
-
-public:
-	OpcodeImpl2(T* instance, const Fn &fn, Job* job) : JobOpcode(job), _instance(instance), _fn(fn) { }
-
-	void operator()() const {
-		(_instance->*_fn)(_job->_parm, _job);
-	}
-
-};
-
-typedef JobOpcode* JobPointer;
-typedef ManagedList<JobPointer> JobList;
-
-enum Jobs {
-	kJobDisplayAnimations = 0,
-	kJobEraseAnimations = 1,
-	kJobDisplayDroppedItem = 2,
-	kJobRemovePickedItem = 3,
-	kJobRunScripts = 4,
-	kJobWalk = 5,
-	kJobDisplayLabel = 6,
-	kJobEraseLabel = 7,
-	kJobWaitRemoveJob = 8,
-	kJobToggleDoor = 9,
-
-	// NS specific
-	kJobShowInventory = 10,
-	kJobHideInventory,
-
-	// BRA specific
-	kJobEraseSubtitle = 10,
-	kJobDisplaySubtitle,
-	kJobWaitRemoveSubtitleJob,
-	kJobPauseSfx,
-	kJobStopFollower,
-	kJobScroll
-};
-
-
 #define DECLARE_UNQUALIFIED_ZONE_PARSER(sig) void locZoneParse_##sig()
 #define DECLARE_UNQUALIFIED_ANIM_PARSER(sig) void locAnimParse_##sig()
 #define DECLARE_UNQUALIFIED_COMMAND_PARSER(sig) void cmdParse_##sig()
@@ -415,12 +344,8 @@
 
 	void		showCursor(bool visible);
 
-	Job			*addJob(uint functionId, void *parm, uint16 tag);
-	void		removeJob(Job *j);
 	void		pauseJobs();
 	void		resumeJobs();
-	void		runJobs();
-	virtual		JobOpcode* createJobOpcode(uint functionId, Job *job) = 0;
 
 	void		finalizeWalk(WalkNodeList *list);
 	int16		selectWalkFrame(const Common::Point& pos, const WalkNode* from);
@@ -524,8 +449,6 @@
 	uint32		_baseTime;
 	char		_characterName1[50];	// only used in changeCharacter
 
-	JobList		_jobs;
-
 	Common::String	_saveFileName;
 
 	bool		_hasLocationSound;
@@ -576,9 +499,6 @@
 
 	virtual void parseLocation(const char* name) = 0;
 
-	virtual void jobDisplayDroppedItem(void*, Job *j) = 0;
-	virtual void jobRemovePickedItem(void*, Job *j) = 0;
-	virtual void jobToggleDoor(void*, Job *j) = 0;
 	void updateDoor(Zone *z);
 
 	virtual void runScripts() = 0;
@@ -672,13 +592,6 @@
 	virtual	void callFunction(uint index, void* parm);
 	void setMousePointer(uint32 value);
 
-	void	initJobs();
-
-	typedef void (Parallaction_ns::*JobFn)(void*, Job*);
-
-	const JobFn		*_jobsFn;
-	JobOpcode*	createJobOpcode(uint functionId, Job *job);
-
 	bool loadGame();
 	bool saveGame();
 
@@ -752,10 +665,6 @@
 	const Callable *_callables;
 
 protected:
-	void jobDisplayDroppedItem(void*, Job *j) { }
-	void jobRemovePickedItem(void*, Job *j)  { }
-	void jobToggleDoor(void*, Job *j)  { }
-
 	void runScripts();
 	void walk();
 	void drawAnimations();
@@ -992,16 +901,10 @@
 	void		freeFonts();
 	void		initOpcodes();
 	void		initParsers();
-	void		initJobs();
 
 	void setArrowCursor();
 	void setInventoryCursor(int pos);
 
-
-	typedef void (Parallaction_br::*JobFn)(void*, Job*);
-	const JobFn		*_jobsFn;
-	JobOpcode*		createJobOpcode(uint functionId, Job *job);
-
 	void		changeLocation(char *location);
 	void		changeCharacter(const char *name);
 
@@ -1146,10 +1049,8 @@
 	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(stop);
 	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
 
-	Job *_jDisplaySubtitle;
-	Job *_jEraseSubtitle;
 	void setupSubtitles(char *s, char *s2, int y);
-
+#if 0
 	void jobWaitRemoveLabelJob(void *parm, Job *job);
 	void jobDisplaySubtitle(void *parm, Job *job);
 	void jobEraseSubtitle(void *parm, Job *job);
@@ -1157,7 +1058,7 @@
 	void jobPauseSfx(void *parm, Job *job);
 	void jobStopFollower(void *parm, Job *job);
 	void jobScroll(void *parm, Job *job);
-
+#endif
 };
 
 // FIXME: remove global

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-01-28 13:10:49 UTC (rev 30675)
@@ -75,7 +75,6 @@
 
 	_activeZone2 = 0;
 
-	initJobs();
 	initResources();
 	initFonts();
 	initCursors();
@@ -354,35 +353,7 @@
 
 }
 
-void Parallaction_br::initJobs() {
 
-	static const JobFn jobs[] = {
-		0,
-		0,
-		&Parallaction_br::jobDisplayDroppedItem,
-		&Parallaction_br::jobRemovePickedItem,
-		0,
-		0,
-		0,
-		0,
-		&Parallaction_br::jobWaitRemoveLabelJob,
-		&Parallaction_br::jobToggleDoor,
-		&Parallaction_br::jobEraseSubtitle,
-		&Parallaction_br::jobDisplaySubtitle,
-		&Parallaction_br::jobWaitRemoveSubtitleJob,
-		&Parallaction_br::jobPauseSfx,
-		&Parallaction_br::jobStopFollower,
-		&Parallaction_br::jobScroll
-	};
-
-	_jobsFn = jobs;
-}
-
-JobOpcode* Parallaction_br::createJobOpcode(uint functionId, Job *job) {
-	return new OpcodeImpl2<Parallaction_br>(this, _jobsFn[functionId], job);
-}
-
-
 void Parallaction_br::setArrowCursor() {
 
 

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-01-28 13:10:49 UTC (rev 30675)
@@ -131,7 +131,6 @@
 		_soundMan = new AmigaSoundMan(this);
 	}
 
-	initJobs();
 	initResources();
 	initFonts();
 	initCursors();
@@ -295,9 +294,6 @@
 
 	_soundMan->playLocationMusic(location);
 
-	// WORKAROUND: this hideLabel has been added to avoid crashes caused by
-	// execution of label jobs after a location switch. The other workaround in
-	// Parallaction::runGame should have been rendered useless by this one.
 	_gfx->setFloatingLabel(0);
 	_gfx->freeLabels();
 
@@ -308,12 +304,6 @@
 
 	_animations.remove(&_char._ani);
 
-	// WORKAROUND: eat up any pending short-lived job that may be referring to the
-	// current location before the actual switch is performed, or engine may
-	// segfault because of invalid pointers.
-	runJobs();
-	runJobs();
-
 	freeLocation();
 
 	LocationName locname;
@@ -424,30 +414,6 @@
 	return;
 }
 
-void Parallaction_ns::initJobs() {
-
-	static const JobFn jobs[] = {
-		0,
-		0,
-		&Parallaction_ns::jobDisplayDroppedItem,
-		&Parallaction_ns::jobRemovePickedItem,
-		0,
-		0,
-		0,
-		0,
-		0,
-		&Parallaction_ns::jobToggleDoor,
-		0,
-		0
-	};
-
-	_jobsFn = jobs;
-}
-
-JobOpcode* Parallaction_ns::createJobOpcode(uint functionId, Job *job) {
-	return new OpcodeImpl2<Parallaction_ns>(this, _jobsFn[functionId], job);
-}
-
 void Parallaction_ns::cleanupGame() {
 
 	_engineFlags &= ~kEngineTransformedDonna;

Modified: scummvm/trunk/engines/parallaction/parser_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_ns.cpp	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/parser_ns.cpp	2008-01-28 13:10:49 UTC (rev 30675)
@@ -1288,8 +1288,6 @@
 			bool visible = (z->_flags & kFlagsRemove) == 0;
 
 			GfxObj *obj = _gfx->loadGet(_tokens[1]);
-//			obj->setFrame(0);
-//			obj->setPos(z->_left, z->_top);
 			obj->frame = 0;
 			obj->x = z->_left;
 			obj->y = z->_top;
@@ -1353,8 +1351,6 @@
 			uint16 frame = (z->_flags & kFlagsClosed ? 0 : 1);
 
 			GfxObj *obj = _gfx->loadDoor(_tokens[1]);
-//			obj->setFrame(frame);
-//			obj->setPos(z->_left, z->_top);
 			obj->frame = frame;
 			obj->x = z->_left;
 			obj->y = z->_top;

Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/walk.cpp	2008-01-28 13:10:49 UTC (rev 30675)
@@ -398,12 +398,12 @@
 
 	if (it != list->end()) {
 		if ((*it)->_x == pos.x && (*it)->_y == pos.y) {
-			debugC(1, kDebugWalk, "jobWalk reached node (%i, %i)", (*it)->_x, (*it)->_y);
+			debugC(1, kDebugWalk, "walk reached node (%i, %i)", (*it)->_x, (*it)->_y);
 			it = list->erase(it);
 		}
 	}
 	if (it == list->end()) {
-		debugC(1, kDebugWalk, "jobWalk reached last node");
+		debugC(1, kDebugWalk, "walk reached last node");
 //		j->_finished = 1;
 		finalizeWalk(list);
 		return;
@@ -419,7 +419,7 @@
 	Common::Point newpos(_char._ani._left, _char._ani._top);
 
 	if (newpos == _char._ani._oldPos) {
-		debugC(1, kDebugWalk, "jobWalk was blocked by an unforeseen obstacle");
+		debugC(1, kDebugWalk, "walk was blocked by an unforeseen obstacle");
 //		j->_finished = 1;
 		finalizeWalk(list);
 	} else {

Modified: scummvm/trunk/engines/parallaction/walk.h
===================================================================
--- scummvm/trunk/engines/parallaction/walk.h	2008-01-28 12:31:14 UTC (rev 30674)
+++ scummvm/trunk/engines/parallaction/walk.h	2008-01-28 13:10:49 UTC (rev 30675)
@@ -31,7 +31,6 @@
 namespace Parallaction {
 
 struct Animation;
-struct Job;
 
 struct WalkNode {
 	int16	_x;
@@ -48,8 +47,6 @@
 typedef ManagedList<WalkNode*> WalkNodeList;
 
 
-void		 jobWalk(void*, Job *j);
-
 struct PathBuffer {
 	// handles a 1-bit depth buffer used for masking non-walkable areas
 


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