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

svn-id: r30675
This commit is contained in:
Nicola Mettifogo 2008-01-28 13:10:49 +00:00
parent 1888cbe50b
commit cce8e25960
12 changed files with 12 additions and 297 deletions

View File

@ -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 @@ Debugger::Debugger(Parallaction *vm)
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_Locations(int argc, const char **argv) {
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_Give(int argc, const char **argv) {
}
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();

View File

@ -22,7 +22,6 @@ protected:
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);

View File

@ -425,14 +425,13 @@ DECLARE_INSTRUCTION_OPCODE(print) {
}
#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 @@ void Parallaction_br::jobEraseSubtitle(void *parm, Job *job) {
_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 @@ void Parallaction_br::initOpcodes() {
}
#if 0
void Parallaction_br::jobWaitRemoveLabelJob(void *parm, Job *job) {
}
@ -606,7 +604,7 @@ void Parallaction_br::jobStopFollower(void *parm, Job *job) {
void Parallaction_br::jobScroll(void *parm, Job *job) {
}
#endif

View File

@ -338,11 +338,8 @@ void Parallaction_ns::drawAnimations() {
_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::drawAnimations() {
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::eraseAnimations() {
void Parallaction_ns::runScripts() {
debugC(9, kDebugExec, "jobRunScripts");
debugC(9, kDebugExec, "runScripts");
if (_engineFlags & kEnginePauseJobs) {
return;

View File

@ -130,6 +130,7 @@ void Gfx::drawGfxObjects(Graphics::Surface &surf) {
// 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();

View File

@ -293,7 +293,6 @@ void Parallaction::runGame() {
eraseAnimations();
runScripts();
walk();
runJobs();
drawAnimations();
}
@ -623,39 +622,6 @@ void Parallaction::freeCharacter() {
}
/*
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,33 +636,6 @@ void Parallaction::resumeJobs() {
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);
@ -970,10 +909,6 @@ void Character::scheduleWalk(int16 x, int16 y) {
}
_walkPath = _builder.buildPath(x, y);
// WalkNodeList *list = _builder.buildPath(x, y);
// _vm->addJob(kJobWalk, list, kPriority19 );
_engineFlags |= kEngineWalking;
}

View File

@ -141,20 +141,6 @@ struct PARALLACTIONGameDescription;
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,63 +274,6 @@ public:
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()
@ -415,12 +344,8 @@ public:
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 @@ protected: // data
uint32 _baseTime;
char _characterName1[50]; // only used in changeCharacter
JobList _jobs;
Common::String _saveFileName;
bool _hasLocationSound;
@ -576,9 +499,6 @@ public:
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 @@ public:
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 @@ private:
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 @@ private:
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 @@ private:
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 @@ private:
void jobPauseSfx(void *parm, Job *job);
void jobStopFollower(void *parm, Job *job);
void jobScroll(void *parm, Job *job);
#endif
};
// FIXME: remove global

View File

@ -75,7 +75,6 @@ int Parallaction_br::init() {
_activeZone2 = 0;
initJobs();
initResources();
initFonts();
initCursors();
@ -354,34 +353,6 @@ void Parallaction_br::changeCharacter(const char *name) {
}
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() {

View File

@ -131,7 +131,6 @@ int Parallaction_ns::init() {
_soundMan = new AmigaSoundMan(this);
}
initJobs();
initResources();
initFonts();
initCursors();
@ -295,9 +294,6 @@ void Parallaction_ns::changeLocation(char *location) {
_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 @@ void Parallaction_ns::changeLocation(char *location) {
_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 @@ void Parallaction_ns::changeCharacter(const char *name) {
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;

View File

@ -1288,8 +1288,6 @@ void Parallaction_ns::parseGetData(Script &script, Zone *z) {
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 @@ void Parallaction_ns::parseDoorData(Script &script, Zone *z) {
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;

View File

@ -398,12 +398,12 @@ void Parallaction_ns::walk() {
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 @@ void Parallaction_ns::walk() {
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 {

View File

@ -31,7 +31,6 @@
namespace Parallaction {
struct Animation;
struct Job;
struct WalkNode {
int16 _x;
@ -48,8 +47,6 @@ public:
typedef ManagedList<WalkNode*> WalkNodeList;
void jobWalk(void*, Job *j);
struct PathBuffer {
// handles a 1-bit depth buffer used for masking non-walkable areas