diff options
-rw-r--r-- | engines/parallaction/debug.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/exec_ns.cpp | 97 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 43 | ||||
-rw-r--r-- | engines/parallaction/inventory.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 65 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 119 | ||||
-rw-r--r-- | engines/parallaction/parallaction_br.cpp | 30 | ||||
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 26 | ||||
-rw-r--r-- | engines/parallaction/walk.cpp | 2 |
9 files changed, 264 insertions, 124 deletions
diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp index c94d0b4a69..5e419def52 100644 --- a/engines/parallaction/debug.cpp +++ b/engines/parallaction/debug.cpp @@ -135,7 +135,7 @@ bool Debugger::Cmd_Jobs(int argc, const char **argv) { "|tag| description |\n" "+---+-------------------------------------------------------------+\n"); for ( ; b != e; b++) { - DebugPrintf("|%3i| %-60s|\n", (*b)->_tag, _jobDescriptions[(*b)->_tag] ); + DebugPrintf("|%3i| %-60s|\n", (*b)->_job->_tag, _jobDescriptions[(*b)->_job->_tag] ); } DebugPrintf("+---+-------------------------------------------------------------+\n"); diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index 641a23b772..f5a7579eaf 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -181,7 +181,7 @@ DECLARE_INSTRUCTION_OPCODE(move) { int16 y = inst->_opB.getRValue(); WalkNodeList *v4 = _char._builder.buildPath(x, y); - addJob(&jobWalk, v4, kPriority19 ); + addJob(kJobWalk, v4, kPriority19 ); _engineFlags |= kEngineWalking; } @@ -259,7 +259,7 @@ DECLARE_COMMAND_OPCODE(location) { DECLARE_COMMAND_OPCODE(open) { _cmdRunCtxt.cmd->u._zone->_flags &= ~kFlagsClosed; if (_cmdRunCtxt.cmd->u._zone->u.door->_cnv) { - addJob(&jobToggleDoor, (void*)_cmdRunCtxt.cmd->u._zone, kPriority18 ); + addJob(kJobToggleDoor, (void*)_cmdRunCtxt.cmd->u._zone, kPriority18 ); } } @@ -267,7 +267,7 @@ DECLARE_COMMAND_OPCODE(open) { DECLARE_COMMAND_OPCODE(close) { _cmdRunCtxt.cmd->u._zone->_flags |= kFlagsClosed; if (_cmdRunCtxt.cmd->u._zone->u.door->_cnv) { - addJob(&jobToggleDoor, (void*)_cmdRunCtxt.cmd->u._zone, kPriority18 ); + addJob(kJobToggleDoor, (void*)_cmdRunCtxt.cmd->u._zone, kPriority18 ); } } @@ -283,7 +283,7 @@ DECLARE_COMMAND_OPCODE(on) { _cmdRunCtxt.cmd->u._zone->_flags &= ~kFlagsRemove; _cmdRunCtxt.cmd->u._zone->_flags |= kFlagsActive; if ((_cmdRunCtxt.cmd->u._zone->_type & 0xFFFF) == kZoneGet) { - addJob(&jobDisplayDroppedItem, _cmdRunCtxt.cmd->u._zone, kPriority17 ); + addJob(kJobDisplayDroppedItem, _cmdRunCtxt.cmd->u._zone, kPriority17 ); } } } @@ -326,7 +326,7 @@ DECLARE_COMMAND_OPCODE(move) { WalkNodeList *vC = _char._builder.buildPath(_cmdRunCtxt.cmd->u._move.x, _cmdRunCtxt.cmd->u._move.y); - addJob(&jobWalk, vC, kPriority19 ); + addJob(kJobWalk, vC, kPriority19 ); _engineFlags |= kEngineWalking; } @@ -336,7 +336,7 @@ DECLARE_COMMAND_OPCODE(stop) { } -void jobDisplayAnimations(void *parm, Job *j) { +void Parallaction_ns::jobDisplayAnimations(void *parm, Job *j) { Graphics::Surface v14; @@ -380,7 +380,7 @@ void jobDisplayAnimations(void *parm, Job *j) { } -void jobEraseAnimations(void *arg_0, Job *j) { +void Parallaction_ns::jobEraseAnimations(void *arg_0, Job *j) { debugC(3, kDebugJobs, "jobEraseAnimations"); for (AnimationList::iterator it = _vm->_animations.begin(); it != _vm->_animations.end(); it++) { @@ -404,7 +404,7 @@ void jobEraseAnimations(void *arg_0, Job *j) { } -void jobRunScripts(void *parm, Job *j) { +void Parallaction_ns::jobRunScripts(void *parm, Job *j) { debugC(3, kDebugJobs, "jobRunScripts"); static uint16 modCounter = 0; @@ -594,7 +594,7 @@ uint16 Parallaction::runZone(Zone *z) { if (z->_flags & kFlagsLocked) break; z->_flags ^= kFlagsClosed; if (z->u.door->_cnv == NULL) break; - addJob(&jobToggleDoor, z, kPriority18 ); + addJob(kJobToggleDoor, z, kPriority18 ); break; case kZoneHear: @@ -615,7 +615,7 @@ uint16 Parallaction::runZone(Zone *z) { // // ZONE TYPE: DOOR // -void jobToggleDoor(void *parm, Job *j) { +void Parallaction_ns::jobToggleDoor(void *parm, Job *j) { static byte count = 0; @@ -652,12 +652,12 @@ void jobToggleDoor(void *parm, Job *j) { int16 Parallaction::pickupItem(Zone *z) { int r = addInventoryItem(z->u.get->_icon); if (r == 0) - addJob(&jobRemovePickedItem, z, kPriority17 ); + addJob(kJobRemovePickedItem, z, kPriority17 ); return r; } -void jobRemovePickedItem(void *parm, Job *j) { +void Parallaction_ns::jobRemovePickedItem(void *parm, Job *j) { Zone *z = (Zone*)parm; @@ -678,7 +678,7 @@ void jobRemovePickedItem(void *parm, Job *j) { return; } -void jobDisplayDroppedItem(void *parm, Job *j) { +void Parallaction_ns::jobDisplayDroppedItem(void *parm, Job *j) { // printf("jobDisplayDroppedItem..."); Zone *z = (Zone*)parm; @@ -853,4 +853,75 @@ void Parallaction_ns::initOpcodes() { +void Parallaction_ns::jobDisplayLabel(void *parm, Job *j) { + + Label *label = (Label*)parm; + debugC(9, kDebugJobs, "jobDisplayLabel (%p)", (const void*) label); + + if (label->_cnv.w == 0) + return; + _vm->_gfx->flatBlitCnv(&label->_cnv, _vm->_gfx->_labelPosition[0].x, _vm->_gfx->_labelPosition[0].y, Gfx::kBitBack); + + return; +} + +void Parallaction_ns::jobEraseLabel(void *parm, Job *j) { + Label *label = (Label*)parm; + + debugC(9, kDebugJobs, "jobEraseLabel (%p)", (const void*) label); + + int16 _si, _di; + + if (_vm->_activeItem._id != 0) { + _si = _vm->_mousePos.x + 16 - label->_cnv.w/2; + _di = _vm->_mousePos.y + 34; + } else { + _si = _vm->_mousePos.x + 8 - label->_cnv.w/2; + _di = _vm->_mousePos.y + 21; + } + + if (_si < 0) _si = 0; + if (_di > 190) _di = 190; + + if (label->_cnv.w + _si > _vm->_screenWidth) + _si = _vm->_screenWidth - label->_cnv.w; + + Common::Rect r(label->_cnv.w, label->_cnv.h); + r.moveTo(_vm->_gfx->_labelPosition[1]); + _vm->_gfx->restoreBackground(r); + + _vm->_gfx->_labelPosition[1] = _vm->_gfx->_labelPosition[0]; + _vm->_gfx->_labelPosition[0].x = _si; + _vm->_gfx->_labelPosition[0].y = _di; + + return; +} + + + +// this Job uses a static counter to delay removal +// and is in fact only used to remove jEraseLabel jobs +// +void Parallaction_ns::jobWaitRemoveJob(void *parm, Job *j) { + Job *arg = (Job*)parm; + + static uint16 count = 0; + + debugC(3, kDebugJobs, "jobWaitRemoveJob: count = %i", count); + + _engineFlags |= kEngineBlockInput; + + count++; + if (count == 2) { + count = 0; + _vm->removeJob(arg); + _engineFlags &= ~kEngineBlockInput; + j->_finished = 1; + } + + return; +} + + + } // namespace Parallaction diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 1cf5216963..2508633c87 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -410,49 +410,6 @@ void Gfx::blit(const Common::Rect& r, uint16 z, byte *data, Gfx::Buffers buffer) } -void jobDisplayLabel(void *parm, Job *j) { - - Label *label = (Label*)parm; - debugC(9, kDebugJobs, "jobDisplayLabel (%p)", (const void*) label); - - if (label->_cnv.w == 0) - return; - _vm->_gfx->flatBlitCnv(&label->_cnv, _vm->_gfx->_labelPosition[0].x, _vm->_gfx->_labelPosition[0].y, Gfx::kBitBack); - - return; -} - -void jobEraseLabel(void *parm, Job *j) { - Label *label = (Label*)parm; - - debugC(9, kDebugJobs, "jobEraseLabel (%p)", (const void*) label); - - int16 _si, _di; - - if (_vm->_activeItem._id != 0) { - _si = _vm->_mousePos.x + 16 - label->_cnv.w/2; - _di = _vm->_mousePos.y + 34; - } else { - _si = _vm->_mousePos.x + 8 - label->_cnv.w/2; - _di = _vm->_mousePos.y + 21; - } - - if (_si < 0) _si = 0; - if (_di > 190) _di = 190; - - if (label->_cnv.w + _si > _vm->_screenWidth) - _si = _vm->_screenWidth - label->_cnv.w; - - Common::Rect r(label->_cnv.w, label->_cnv.h); - r.moveTo(_vm->_gfx->_labelPosition[1]); - _vm->_gfx->restoreBackground(r); - - _vm->_gfx->_labelPosition[1] = _vm->_gfx->_labelPosition[0]; - _vm->_gfx->_labelPosition[0].x = _si; - _vm->_gfx->_labelPosition[0].y = _di; - - return; -} diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index 0a286e4204..e0b5d38fc9 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -233,7 +233,7 @@ int16 getInventoryItemIndex(int16 pos) { -void jobShowInventory(void *parm, Job *j) { +void Parallaction_ns::jobShowInventory(void *parm, Job *j) { // printf("job_showInventory()..."); int16 slot = getNumUsedSlots(); @@ -255,7 +255,7 @@ void jobShowInventory(void *parm, Job *j) { -void jobHideInventory(void *parm, Job *j) { +void Parallaction_ns::jobHideInventory(void *parm, Job *j) { // printf("job_hideInventory()\n"); static uint16 count = 0; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 9bdf90f287..cab1658b29 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -283,9 +283,9 @@ void waitUntilLeftClick() { void Parallaction::runGame() { - addJob(&jobEraseAnimations, (void*)1, kPriority20); - _jRunScripts = addJob(&jobRunScripts, 0, kPriority15); - addJob(&jobDisplayAnimations, 0, kPriority3); + addJob(kJobEraseAnimations, (void*)1, kPriority20); + _jRunScripts = addJob(kJobRunScripts, 0, kPriority15); + addJob(kJobDisplayAnimations, 0, kPriority3); _gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2); @@ -364,14 +364,14 @@ void Parallaction::processInput(InputData *data) { _gfx->_labelPosition[1].y = -1000; _gfx->_labelPosition[0].x = -1000; _gfx->_labelPosition[0].y = -1000; - _jDrawLabel = addJob(&jobDisplayLabel, (void*)data->_label, kPriority0); - _jEraseLabel = addJob(&jobEraseLabel, (void*)data->_label, kPriority20); + _jDrawLabel = addJob(kJobDisplayLabel, (void*)data->_label, kPriority0); + _jEraseLabel = addJob(kJobEraseLabel, (void*)data->_label, kPriority20); break; case kEvExitZone: debugC(2, kDebugInput, "processInput: kEvExitZone"); removeJob(_jDrawLabel); - addJob(&jobWaitRemoveJob, _jEraseLabel, kPriority15); + addJob(kJobWaitRemoveJob, _jEraseLabel, kPriority15); _jDrawLabel = NULL; break; @@ -393,12 +393,12 @@ void Parallaction::processInput(InputData *data) { if (_jDrawLabel != 0) { removeJob(_jDrawLabel); _jDrawLabel = NULL; - addJob(&jobWaitRemoveJob, _jEraseLabel, kPriority2); + addJob(kJobWaitRemoveJob, _jEraseLabel, kPriority2); } if (hitZone(kZoneYou, _mousePos.x, _mousePos.y) == 0) changeCursor(kCursorArrow); removeJob(_jRunScripts); - _jDrawInventory = addJob(&jobShowInventory, 0, kPriority2); + _jDrawInventory = addJob(kJobShowInventory, 0, kPriority2); openInventory(); break; @@ -408,8 +408,8 @@ void Parallaction::processInput(InputData *data) { // activates item changeCursor(data->_inventoryIndex); } - _jRunScripts = addJob(&jobRunScripts, 0, kPriority15); - addJob(&jobHideInventory, 0, kPriority20); + _jRunScripts = addJob(kJobRunScripts, 0, kPriority15); + addJob(kJobHideInventory, 0, kPriority20); removeJob(_jDrawInventory); break; @@ -426,7 +426,7 @@ void Parallaction::processInput(InputData *data) { if (_char._ani._flags & kFlagsRemove) break; if ((_char._ani._flags & kFlagsActive) == 0) break; WalkNodeList *v4 = _char._builder.buildPath(data->_mousePos.x, data->_mousePos.y); - addJob(&jobWalk, v4, kPriority19); + addJob(kJobWalk, v4, kPriority19); _engineFlags |= kEngineWalking; // inhibits processing of input until walking is over } break; @@ -621,7 +621,7 @@ void Parallaction::changeCursor(int32 index) { if (_jDrawLabel != NULL) { removeJob(_jDrawLabel); - addJob(&jobWaitRemoveJob, _jEraseLabel, kPriority15 ); + addJob(kJobWaitRemoveJob, _jEraseLabel, kPriority15 ); _jDrawLabel = NULL; } @@ -672,21 +672,22 @@ void Parallaction::freeCharacter() { (higher priorities values comes first in the list) */ int compareJobPriority(const JobPointer &j1, const JobPointer &j2) { - return (j1->_tag >= j2->_tag ? -1 : 1); + return (j1->_job->_tag >= j2->_job->_tag ? -1 : 1); } -Job *Parallaction::addJob(JobFn fn, void *parm, uint16 tag) { +Job *Parallaction::addJob(uint functionId, void *parm, uint16 tag) { debugC(3, kDebugJobs, "addJob(%i)", tag); Job *v8 = new Job; v8->_parm = parm; - v8->_fn = fn; v8->_tag = tag; v8->_finished = 0; v8->_count = 0; - _jobs.insertSorted(v8, compareJobPriority); + JobOpcode *op = createJobOpcode(functionId, v8); + + _jobs.insertSorted(op, compareJobPriority); return v8; } @@ -718,7 +719,8 @@ void Parallaction::runJobs() { JobList::iterator it = _jobs.begin(); while (it != _jobs.end()) { - if ((*it)->_finished == 1) + Job *job = (*it)->_job; + if (job->_finished == 1) it = _jobs.erase(it); else it++; @@ -726,8 +728,9 @@ void Parallaction::runJobs() { it = _jobs.begin(); while (it != _jobs.end()) { - debugC(9, kDebugJobs, "runJobs: %i", (*it)->_tag); - (*(*it)->_fn)((*it)->_parm, (*it)); + Job *job = (*it)->_job; + debugC(9, kDebugJobs, "runJobs: %i", job->_tag); + (*(*it))(); it++; } @@ -735,30 +738,6 @@ void Parallaction::runJobs() { return; } -// this Job uses a static counter to delay removal -// and is in fact only used to remove jEraseLabel jobs -// -void jobWaitRemoveJob(void *parm, Job *j) { - Job *arg = (Job*)parm; - - static uint16 count = 0; - - debugC(3, kDebugJobs, "jobWaitRemoveJob: count = %i", count); - - _engineFlags |= kEngineBlockInput; - - count++; - if (count == 2) { - count = 0; - _vm->removeJob(arg); - _engineFlags &= ~kEngineBlockInput; - j->_finished = 1; - } - - return; -} - - Table::Table(uint32 size) : _size(size), _used(0), _disposeMemory(true) { _data = (char**)malloc(sizeof(char*)*size); diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index a2f52575f6..433587780e 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -140,22 +140,18 @@ struct PARALLACTIONGameDescription; struct Job; -typedef void (*JobFn)(void*, Job*); struct Job { uint16 _count; // # of executions left uint16 _tag; // used for ordering uint16 _finished; void * _parm; - JobFn _fn; public: - Job() : _count(0), _tag(0), _finished(0), _parm(NULL), _fn(NULL) { + Job() : _count(0), _tag(0), _finished(0), _parm(NULL) { } }; -typedef Job* JobPointer; -typedef ManagedList<JobPointer> JobList; extern uint16 _mouseButtons; extern uint16 _score; @@ -192,19 +188,6 @@ extern const char *_minidrkiName; void waitUntilLeftClick(); -void jobRemovePickedItem(void*, Job *j); -void jobDisplayDroppedItem(void*, Job *j); -void jobToggleDoor(void*, Job *j); -void jobEraseAnimations(void *arg_0, Job *j); -void jobWalk(void*, Job *j); -void jobRunScripts(void*, Job *j); -void jobDisplayAnimations(void*, Job *j); -void jobDisplayLabel(void *parm, Job *j); -void jobWaitRemoveJob(void *parm, Job *j); -void jobShowInventory(void *parm, Job *j); -void jobHideInventory(void *parm, Job *j); -void jobEraseLabel(void *parm, Job *j); - class Debugger; @@ -337,9 +320,65 @@ 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 + kJobClearSubtitle = 10, + kJobDrawSubtitle, + kJobWaitRemoveSubtitleJob, + kJobPauseSfx, + kJobStopFollower, + kJobScroll +}; #define DECLARE_UNQUALIFIED_ZONE_PARSER(sig) void locZoneParse_##sig() @@ -400,12 +439,12 @@ public: void changeCursor(int32 index); void showCursor(bool visible); - - Job *addJob(JobFn fn, void *parm, uint16 tag); + 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); @@ -563,6 +602,18 @@ public: virtual void parseLocation(const char* name) = 0; + virtual void jobDisplayAnimations(void*, Job *j) = 0; + virtual void jobEraseAnimations(void *arg_0, Job *j) = 0; + virtual void jobRunScripts(void*, Job *j) = 0; + virtual void jobDisplayDroppedItem(void*, Job *j) = 0; + virtual void jobRemovePickedItem(void*, Job *j) = 0; + virtual void jobToggleDoor(void*, Job *j) = 0; + virtual void jobWalk(void*, Job *j) = 0; + virtual void jobDisplayLabel(void *parm, Job *j) = 0; + virtual void jobEraseLabel(void *parm, Job *j) = 0; + virtual void jobWaitRemoveJob(void *parm, Job *j) = 0; + + public: const char **_zoneFlagNamesRes; const char **_zoneTypeNamesRes; @@ -589,6 +640,13 @@ public: void renderLabel(Graphics::Surface *cnv, char *text); void setMousePointer(int16 index); + void initJobs(); + + typedef void (Parallaction_ns::*JobFn)(void*, Job*); + + const JobFn *_jobsFn; + JobOpcode* createJobOpcode(uint functionId, Job *job); + void loadGame(); void saveGame(); @@ -653,6 +711,19 @@ private: const Callable *_callables; protected: + void jobDisplayAnimations(void*, Job *j); + void jobEraseAnimations(void *arg_0, Job *j); + void jobRunScripts(void*, Job *j); + void jobDisplayDroppedItem(void*, Job *j); + void jobRemovePickedItem(void*, Job *j); + void jobToggleDoor(void*, Job *j); + void jobWalk(void*, Job *j); + void jobDisplayLabel(void *parm, Job *j); + void jobEraseLabel(void *parm, Job *j); + void jobWaitRemoveJob(void *parm, Job *j); + void jobShowInventory(void *parm, Job *j); + void jobHideInventory(void *parm, Job *j); + // location parser OpcodeSet _locationParsers; OpcodeSet _locationZoneParsers; @@ -860,6 +931,12 @@ private: void freeFonts(); void initOpcodes(); void initParsers(); + void initJobs(); + + typedef void (*JobFn)(void*, Job*); + const JobFn *_jobsFn; + JobOpcode* createJobOpcode(uint functionId, Job *job); + void changeLocation(char *location); void changeCharacter(const char *name); diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index e09a48dd9d..a3a926bf02 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -357,5 +357,35 @@ void Parallaction_br::changeCharacter(const char *name) { } +void Parallaction_br::initJobs() { +/* + static const JobFn jobs[] = { + &Parallaction_br::jobDisplayAnimations, + &Parallaction_br::jobEraseAnimations, + &Parallaction_br::jobDisplayDroppedItem, + &Parallaction_br::jobRemovePickedItem, + &Parallaction_br::jobRunScripts, + &Parallaction_br::jobWalk, + &Parallaction_br::jobDrawLabel, + &Parallaction_br::jobEraseLabel, + &Parallaction_br::jobWaitRemoveLabelJob, + &Parallaction_br::jobToggleDoor, + &Parallaction_br::jobClearSubtitle, + &Parallaction_br::jobDrawSubtitle, + &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); +} + } // namespace Parallaction diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index db0cdf84e7..fb0ca0dd7d 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -71,6 +71,7 @@ int Parallaction_ns::init() { _soundMan = new AmigaSoundMan(this); } + initJobs(); initResources(); initFonts(); initCursors(); @@ -384,4 +385,29 @@ void Parallaction_ns::changeCharacter(const char *name) { return; } +void Parallaction_ns::initJobs() { + + static const JobFn jobs[] = { + &Parallaction_ns::jobDisplayAnimations, + &Parallaction_ns::jobEraseAnimations, + &Parallaction_ns::jobDisplayDroppedItem, + &Parallaction_ns::jobRemovePickedItem, + &Parallaction_ns::jobRunScripts, + &Parallaction_ns::jobWalk, + &Parallaction_ns::jobDisplayLabel, + &Parallaction_ns::jobEraseLabel, + &Parallaction_ns::jobWaitRemoveJob, + &Parallaction_ns::jobToggleDoor, + &Parallaction_ns::jobShowInventory, + &Parallaction_ns::jobHideInventory + }; + + _jobsFn = jobs; + + +}; + +JobOpcode* Parallaction_ns::createJobOpcode(uint functionId, Job *job) { + return new OpcodeImpl2<Parallaction_ns>(this, _jobsFn[functionId], job); +} } // namespace Parallaction diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index 57bdb1badb..f25e907f37 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -384,7 +384,7 @@ void Parallaction::finalizeWalk(WalkNodeList *list) { delete list; } -void jobWalk(void *parm, Job *j) { +void Parallaction_ns::jobWalk(void *parm, Job *j) { WalkNodeList *list = (WalkNodeList*)parm; _vm->_char._ani._oldPos.x = _vm->_char._ani._left; |