aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/hugo/game.h12
-rw-r--r--engines/hugo/schedule.cpp54
-rw-r--r--engines/hugo/schedule.h7
-rw-r--r--engines/hugo/schedule_v1d.cpp56
-rw-r--r--engines/hugo/schedule_v2d.cpp56
5 files changed, 65 insertions, 120 deletions
diff --git a/engines/hugo/game.h b/engines/hugo/game.h
index 488f667bee..275f083d09 100644
--- a/engines/hugo/game.h
+++ b/engines/hugo/game.h
@@ -211,7 +211,7 @@ enum action_t { // Parameters:
START_OBJ, // 1 - Object number
INIT_OBJXY, // 2 - Object number, x,y
PROMPT, // 3 - index of prompt & response string, ptrs to action
- // lists. First if response matches, 2nd if not.
+ // lists. First if response matches, 2nd if not.
BKGD_COLOR, // 4 - new background color
INIT_OBJVXY, // 5 - Object number, vx, vy
INIT_CARRY, // 6 - Object number, carried status
@@ -520,7 +520,7 @@ struct act30 { // Type 30 - Start special m
};
struct act31 { // Type 31 - Exit special maze processing
- action_t actType; // The type of action
+ action_t actType; // The type of action
int timer; // Time to set off the action
};
@@ -638,17 +638,17 @@ struct act47 { // Type 47 - Init viewx,view
};
struct act48 { // Type 48 - Set curr_seq_p to frame n
- action_t actType; // The type of action
+ action_t actType; // The type of action
int timer; // Time to set off the action
int objNumb; // The object number
int seqIndex; // The index of seq array to set to
int frameIndex; // The index of frame to set to
};
-struct act49 { // Added by Strangerke - Type 79 - Play a sound (DOS way)
- action_t actType; // The type of action
+struct act49 { // Added by Strangerke - Type 79 - Play a song (DOS way)
+ action_t actType; // The type of action
int timer; // Time to set off the action
- uint16 soundIndex; // Sound index in string array
+ uint16 songIndex; // Song index in string array
};
union act {
diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp
index 6ea7bfd273..6e4e4f5de3 100644
--- a/engines/hugo/schedule.cpp
+++ b/engines/hugo/schedule.cpp
@@ -537,7 +537,7 @@ void Scheduler::loadActListArr(Common::File &in) {
break;
case OLD_SONG: //49
_actListArr[i][j].a49.timer = in.readSint16BE();
- _actListArr[i][j].a49.soundIndex = in.readUint16BE();
+ _actListArr[i][j].a49.songIndex = in.readUint16BE();
break;
default:
error("Engine - Unknown action type encountered: %d", _actListArr[i][j].a0.actType);
@@ -948,4 +948,56 @@ void Scheduler::restoreEvents(Common::SeekableReadStream *f) {
}
}
+/**
+* Insert the action pointed to by p into the timer event queue
+* The queue goes from head (earliest) to tail (latest) timewise
+*/
+void Scheduler::insertAction(act *action) {
+ debugC(1, kDebugSchedule, "insertAction() - Action type A%d", action->a0.actType);
+
+ // First, get and initialise the event structure
+ event_t *curEvent = getQueue();
+ curEvent->action = action;
+ switch (action->a0.actType) { // Assign whether local or global
+ case AGSCHEDULE:
+ curEvent->localActionFl = false; // Lasts over a new screen
+ break;
+ default:
+ curEvent->localActionFl = true; // Rest are for current screen only
+ break;
+ }
+
+ curEvent->time = action->a0.timer + getTicks(); // Convert rel to abs time
+
+ // Now find the place to insert the event
+ if (!_tailEvent) { // Empty queue
+ _tailEvent = _headEvent = curEvent;
+ curEvent->nextEvent = curEvent->prevEvent = 0;
+ } else {
+ event_t *wrkEvent = _tailEvent; // Search from latest time back
+ bool found = false;
+
+ while (wrkEvent && !found) {
+ if (wrkEvent->time <= curEvent->time) { // Found if new event later
+ found = true;
+ if (wrkEvent == _tailEvent) // New latest in list
+ _tailEvent = curEvent;
+ else
+ wrkEvent->nextEvent->prevEvent = curEvent;
+ curEvent->nextEvent = wrkEvent->nextEvent;
+ wrkEvent->nextEvent = curEvent;
+ curEvent->prevEvent = wrkEvent;
+ }
+ wrkEvent = wrkEvent->prevEvent;
+ }
+
+ if (!found) { // Must be earliest in list
+ _headEvent->prevEvent = curEvent; // So insert as new head
+ curEvent->nextEvent = _headEvent;
+ curEvent->prevEvent = 0;
+ _headEvent = curEvent;
+ }
+ }
+}
+
} // End of namespace Hugo
diff --git a/engines/hugo/schedule.h b/engines/hugo/schedule.h
index 32e988310e..436b6e7792 100644
--- a/engines/hugo/schedule.h
+++ b/engines/hugo/schedule.h
@@ -87,13 +87,13 @@ protected:
virtual const char *getCypher() = 0;
virtual event_t *doAction(event_t *curEvent) = 0;
virtual void delQueue(event_t *curEvent) = 0;
- virtual void insertAction(act *action) = 0;
event_t *getQueue();
uint32 getDosTicks(bool updateFl);
uint32 getWinTicks();
+ void insertAction(act *action);
};
class Scheduler_v1d : public Scheduler {
@@ -102,11 +102,9 @@ public:
~Scheduler_v1d();
virtual const char *getCypher();
-
virtual uint32 getTicks();
-
- virtual void insertAction(act *action);
virtual void runScheduler();
+
protected:
virtual void delQueue(event_t *curEvent);
virtual event_t *doAction(event_t *curEvent);
@@ -118,7 +116,6 @@ public:
virtual ~Scheduler_v2d();
virtual const char *getCypher();
- void insertAction(act *action);
protected:
void delQueue(event_t *curEvent);
event_t *doAction(event_t *curEvent);
diff --git a/engines/hugo/schedule_v1d.cpp b/engines/hugo/schedule_v1d.cpp
index 9098137662..e224c8acd0 100644
--- a/engines/hugo/schedule_v1d.cpp
+++ b/engines/hugo/schedule_v1d.cpp
@@ -247,12 +247,6 @@ event_t *Scheduler_v1d::doAction(event_t *curEvent) {
else
insertActionList(action->a25.actFailIndex);
break;
-// case SOUND: // act26: Play a sound (or tune)
-// if (action->a26.soundIndex < _vm->_tunesNbr)
-// _vm->_sound->playMusic(action->a26.soundIndex);
-// else
-// _vm->_sound->playSound(action->a26.soundIndex, BOTH_CHANNELS, MED_PRI);
-// break;
case ADD_SCORE: // act27: Add object's value to score
_vm->adjustScore(_vm->_object->_objects[action->a27.objNumb].objValue);
break;
@@ -266,10 +260,10 @@ event_t *Scheduler_v1d::doAction(event_t *curEvent) {
insertActionList(action->a29.actFailIndex);
break;
case OLD_SONG:
- //TODO For Hugo 1 and Hugo2 DOS: The songs were not stored in a DAT file, but directly as
+ //TODO For DOS versions: The songs were not stored in a DAT file, but directly as
//strings. the current play_music should be modified to use a strings instead of reading
//the file, in those cases. This replaces, for those DOS versions, act26.
- warning("STUB: doAction(act49)");
+ warning("STUB: doAction(act49) %s", _vm->_textData[action->a49.songIndex]);
break;
default:
error("An error has occurred: %s", "doAction");
@@ -286,52 +280,6 @@ event_t *Scheduler_v1d::doAction(event_t *curEvent) {
}
/**
-* Insert the action pointed to by p into the timer event queue
-* The queue goes from head (earliest) to tail (latest) timewise
-*/
-void Scheduler_v1d::insertAction(act *action) {
- debugC(1, kDebugSchedule, "insertAction() - Action type A%d", action->a0.actType);
-
- // First, get and initialise the event structure
- event_t *curEvent = getQueue();
- curEvent->action = action;
-
- curEvent->localActionFl = true; // Rest are for current screen only
-
- curEvent->time = action->a0.timer + getTicks(); // Convert rel to abs time
-
- // Now find the place to insert the event
- if (!_tailEvent) { // Empty queue
- _tailEvent = _headEvent = curEvent;
- curEvent->nextEvent = curEvent->prevEvent = 0;
- } else {
- event_t *wrkEvent = _tailEvent; // Search from latest time back
- bool found = false;
-
- while (wrkEvent && !found) {
- if (wrkEvent->time <= curEvent->time) { // Found if new event later
- found = true;
- if (wrkEvent == _tailEvent) // New latest in list
- _tailEvent = curEvent;
- else
- wrkEvent->nextEvent->prevEvent = curEvent;
- curEvent->nextEvent = wrkEvent->nextEvent;
- wrkEvent->nextEvent = curEvent;
- curEvent->prevEvent = wrkEvent;
- }
- wrkEvent = wrkEvent->prevEvent;
- }
-
- if (!found) { // Must be earliest in list
- _headEvent->prevEvent = curEvent; // So insert as new head
- curEvent->nextEvent = _headEvent;
- curEvent->prevEvent = 0;
- _headEvent = curEvent;
- }
- }
-}
-
-/**
* This is the scheduler which runs every tick. It examines the event queue
* for any events whose time has come. It dequeues these events and performs
* the action associated with the event, returning it to the free queue
diff --git a/engines/hugo/schedule_v2d.cpp b/engines/hugo/schedule_v2d.cpp
index 307d1ac46d..04302caf61 100644
--- a/engines/hugo/schedule_v2d.cpp
+++ b/engines/hugo/schedule_v2d.cpp
@@ -376,10 +376,10 @@ event_t *Scheduler_v2d::doAction(event_t *curEvent) {
_vm->_object->_objects[action->a48.objNumb].currImagePtr = _vm->_object->_objects[action->a48.objNumb].currImagePtr->nextSeqPtr;
break;
case OLD_SONG:
- //TODO For Hugo 1 and Hugo2 DOS: The songs were not stored in a DAT file, but directly as
+ //TODO For DOS versions: The songs were not stored in a DAT file, but directly as
//strings. the current play_music should be modified to use a strings instead of reading
//the file, in those cases. This replaces, for those DOS versions, act26.
- warning("STUB: doAction(act49)");
+ warning("STUB: doAction(act49) %s", _vm->_textData[action->a49.songIndex]);
break;
default:
error("An error has occurred: %s", "doAction");
@@ -394,56 +394,4 @@ event_t *Scheduler_v2d::doAction(event_t *curEvent) {
return wrkEvent; // Return next event ptr
}
}
-
-/**
-* Insert the action pointed to by p into the timer event queue
-* The queue goes from head (earliest) to tail (latest) timewise
-*/
-void Scheduler_v2d::insertAction(act *action) {
- debugC(1, kDebugSchedule, "insertAction() - Action type A%d", action->a0.actType);
-
- // First, get and initialise the event structure
- event_t *curEvent = getQueue();
- curEvent->action = action;
- switch (action->a0.actType) { // Assign whether local or global
- case AGSCHEDULE:
- curEvent->localActionFl = false; // Lasts over a new screen
- break;
- default:
- curEvent->localActionFl = true; // Rest are for current screen only
- break;
- }
-
- curEvent->time = action->a0.timer + getTicks(); // Convert rel to abs time
-
- // Now find the place to insert the event
- if (!_tailEvent) { // Empty queue
- _tailEvent = _headEvent = curEvent;
- curEvent->nextEvent = curEvent->prevEvent = 0;
- } else {
- event_t *wrkEvent = _tailEvent; // Search from latest time back
- bool found = false;
-
- while (wrkEvent && !found) {
- if (wrkEvent->time <= curEvent->time) { // Found if new event later
- found = true;
- if (wrkEvent == _tailEvent) // New latest in list
- _tailEvent = curEvent;
- else
- wrkEvent->nextEvent->prevEvent = curEvent;
- curEvent->nextEvent = wrkEvent->nextEvent;
- wrkEvent->nextEvent = curEvent;
- curEvent->prevEvent = wrkEvent;
- }
- wrkEvent = wrkEvent->prevEvent;
- }
-
- if (!found) { // Must be earliest in list
- _headEvent->prevEvent = curEvent; // So insert as new head
- curEvent->nextEvent = _headEvent;
- curEvent->prevEvent = 0;
- _headEvent = curEvent;
- }
- }
-}
} // End of namespace Hugo