aboutsummaryrefslogtreecommitdiff
path: root/sword2/logic.h
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-11-08 15:47:51 +0000
committerTorbjörn Andersson2003-11-08 15:47:51 +0000
commit688c80b0620ae5765355a4048864bb3de84ebf74 (patch)
tree497d8efc73b08f5a4d58c45c52b7a6bafa1975ff /sword2/logic.h
parentb04ddef7506bfa08527da9e79040c583fb765b2e (diff)
downloadscummvm-rg350-688c80b0620ae5765355a4048864bb3de84ebf74.tar.gz
scummvm-rg350-688c80b0620ae5765355a4048864bb3de84ebf74.tar.bz2
scummvm-rg350-688c80b0620ae5765355a4048864bb3de84ebf74.zip
Moved more stuff into classes, changed some static allocation to dynamic,
and removed some of the references to global variables. At this point I believe everything in the main game engine has been moved into classes - not necessarily the correct ones, but still... However, there is some stuff in the driver directory that need to be taken care of as well. svn-id: r11207
Diffstat (limited to 'sword2/logic.h')
-rw-r--r--sword2/logic.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/sword2/logic.h b/sword2/logic.h
index 8892329c9d..7d3e64bc5c 100644
--- a/sword2/logic.h
+++ b/sword2/logic.h
@@ -22,10 +22,13 @@
#ifndef _LOGIC
#define _LOGIC
+#include "sword2/events.h"
#include "sword2/header.h"
#include "sword2/memory.h"
+#include "sword2/router.h"
#include "sword2/speech.h"
#include "sword2/startup.h"
+#include "sword2/sync.h"
#include "sword2/driver/driver96.h"
namespace Sword2 {
@@ -37,8 +40,12 @@ namespace Sword2 {
#define MAX_SEQUENCE_TEXT_LINES 15
+class Sword2Engine;
+
class Logic {
private:
+ Sword2Engine *_vm;
+
// Point to the global variable data
int32 *_globals;
@@ -161,8 +168,15 @@ private:
uint32 initStartMenu(void);
+ int16 _standbyX; // see fnSetStandbyCoords()
+ int16 _standbyY;
+ int16 _standbyDir;
+
+ int whatTarget(int startX, int startY, int destX, int destY);
+
public:
- Logic() : _globals(NULL), _kills(0), _debugFlag(false),
+ Logic(Sword2Engine *vm) :
+ _vm(vm), _globals(NULL), _kills(0), _debugFlag(false),
_smackerLeadOut(0), _sequenceTextLines(0), _speechTime(0),
_animId(0), _leftClickDelay(0), _rightClickDelay(0),
_defaultResponseId(0), _totalStartups(0),
@@ -170,6 +184,9 @@ public:
_speechScriptWaiting(0), _speechTextBlocNo(0),
_choosing(false), _unpauseZone(0) {
memset(_subjectList, 0, sizeof(_subjectList));
+ memset(_eventList, 0, sizeof(_eventList));
+ memset(_syncList, 0, sizeof(_syncList));
+ _router = new Router();
setupOpcodes();
initStartMenu();
}
@@ -202,6 +219,34 @@ public:
int32 executeOpcode(int op, int32 *params);
+ struct _event_unit {
+ uint32 id;
+ uint32 interact_id;
+ };
+
+ _event_unit _eventList[MAX_events];
+
+ void sendEvent(uint32 id, uint32 interact_id);
+ void setPlayerActionEvent(uint32 id, uint32 interact_id);
+ void startEvent(void);
+ bool checkEventWaiting(void);
+ void clearEvent(uint32 id);
+ void killAllIdsEvents(uint32 id);
+
+ uint32 countEvents(void);
+
+ struct _sync_unit {
+ uint32 id;
+ uint32 sync;
+ };
+
+ _sync_unit _syncList[MAX_syncs];
+
+ void clearSyncs(uint32 id);
+ bool getSync(void);
+
+ Router *_router;
+
int32 fnTestFunction(int32 *params);
int32 fnTestFlags(int32 *params);
int32 fnRegisterStartPoint(int32 *params);