aboutsummaryrefslogtreecommitdiff
path: root/engines/hugo/schedule.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/hugo/schedule.h')
-rw-r--r--engines/hugo/schedule.h97
1 files changed, 65 insertions, 32 deletions
diff --git a/engines/hugo/schedule.h b/engines/hugo/schedule.h
index 285f7bd663..e6eb5d7947 100644
--- a/engines/hugo/schedule.h
+++ b/engines/hugo/schedule.h
@@ -35,71 +35,104 @@
namespace Hugo {
-#define kMaxEvents 50 /* Max events in event queue */
+#define SIGN(X) ((X < 0) ? -1 : 1)
+#define kMaxEvents 50 // Max events in event queue
struct event_t {
- act *action; /* Ptr to action to perform */
- bool localActionFl; /* TRUE if action is only for this screen */
- uint32 time; /* (absolute) time to perform action */
- struct event_t *prevEvent; /* Chain to previous event */
- struct event_t *nextEvent; /* Chain to next event */
+ act *action; // Ptr to action to perform
+ bool localActionFl; // true if action is only for this screen
+ uint32 time; // (absolute) time to perform action
+ struct event_t *prevEvent; // Chain to previous event
+ struct event_t *nextEvent; // Chain to next event
};
class Scheduler {
public:
- Scheduler(HugoEngine &vm);
+ Scheduler(HugoEngine *vm);
virtual ~Scheduler();
+ virtual void insertAction(act *action) = 0;
+ virtual void restoreEvents(Common::SeekableReadStream *f) = 0;
+ virtual void runScheduler() = 0;
+ virtual void saveEvents(Common::WriteStream *f) = 0;
+
void initEventQueue();
- void insertAction(act *action);
void insertActionList(uint16 actIndex);
void decodeString(char *line);
- void runScheduler();
- uint32 getTicks();
+ uint32 getWinTicks();
+ uint32 getDosTicks(bool updateFl);
+ void waitForRefresh(void);
void processBonus(int bonusIndex);
void newScreen(int screenIndex);
- void restoreEvents(Common::SeekableReadStream *f);
- void saveEvents(Common::WriteStream *f);
void restoreScreen(int screenIndex);
- void swapImages(int objNumb1, int objNumb2);
-private:
+protected:
+ HugoEngine *_vm;
+
enum seqTextSchedule {
kSsNoBackground = 0,
kSsBadSaveGame = 1
};
- HugoEngine &_vm;
+ event_t *_freeEvent; // Free list of event structures
+ event_t *_headEvent; // Head of list (earliest time)
+ event_t *_tailEvent; // Tail of list (latest time)
+ event_t _events[kMaxEvents]; // Statically declare event structures
- event_t _events[kMaxEvents]; /* Statically declare event structures */
-
- event_t *_freeEvent; /* Free list of event structures */
- event_t *_headEvent; /* Head of list (earliest time) */
- event_t *_tailEvent; /* Tail of list (latest time) */
+ virtual const char *getCypher() = 0;
+ virtual void delQueue(event_t *curEvent) = 0;
+ virtual event_t *doAction(event_t *curEvent) = 0;
event_t *getQueue();
- void delQueue(event_t *curEvent);
- event_t *doAction(event_t *curEvent);
-
- virtual const char *getCypher() = 0;
};
-class Scheduler_v1 : public Scheduler {
+class Scheduler_v1d : public Scheduler {
public:
- Scheduler_v1(HugoEngine &vm);
- ~Scheduler_v1();
+ Scheduler_v1d(HugoEngine *vm);
+ ~Scheduler_v1d();
+
+ virtual const char *getCypher();
+ virtual void insertAction(act *action);
+ virtual void restoreEvents(Common::SeekableReadStream *f);
+ virtual void saveEvents(Common::WriteStream *f);
+ virtual void runScheduler();
+protected:
+ virtual void delQueue(event_t *curEvent);
+ virtual event_t *doAction(event_t *curEvent);
+};
- const char *getCypher();
+class Scheduler_v2d : public Scheduler_v1d {
+public:
+ Scheduler_v2d(HugoEngine *vm);
+ virtual ~Scheduler_v2d();
+
+ virtual void insertAction(act *action);
+protected:
+ virtual void delQueue(event_t *curEvent);
+ virtual event_t *doAction(event_t *curEvent);
};
-class Scheduler_v2 : public Scheduler {
+class Scheduler_v3d : public Scheduler_v2d {
public:
- Scheduler_v2(HugoEngine &vm);
- ~Scheduler_v2();
+ Scheduler_v3d(HugoEngine *vm);
+ ~Scheduler_v3d();
const char *getCypher();
+protected:
+ virtual event_t *doAction(event_t *curEvent);
+
};
+class Scheduler_v1w : public Scheduler_v3d {
+public:
+ Scheduler_v1w(HugoEngine *vm);
+ ~Scheduler_v1w();
+
+ virtual event_t *doAction(event_t *curEvent);
+ void insertAction(act *action);
+ void restoreEvents(Common::SeekableReadStream *f);
+ void runScheduler();
+ void saveEvents(Common::WriteStream *f);
+};
} // End of namespace Hugo
-
#endif //HUGO_SCHEDULE_H