aboutsummaryrefslogtreecommitdiff
path: root/sky/logic.h
blob: b0cea353b37eee3637456469dc3f9c0cbe47268e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2003 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header$
 *
 */

#ifndef SKYLOGIC_H
#define SKYLOGIC_H

#include "sky/sky.h"
#include "sky/disk.h"
#include "sky/grid.h"
#include "sky/autoroute.h"
#include "sky/musicbase.h"
#include "sky/mouse.h"

class SkyLogic {
public:
	SkyLogic(SkyDisk *skyDisk, SkyGrid *skyGrid, SkyText *skyText, SkyMusicBase *skyMusic, SkyMouse *skyMouse, uint32 gameVersion);
	void engine();

	void lreturn();
	void logicScript();
	void autoRoute();
	void arAnim();
	void arTurn();
	void alt();
	void anim();
	void turn();
	void cursor();
	void talk();
	void listen();
	void stopped();
	void choose();
	void frames();
	void pause();
	void waitSync();
	void simpleAnim();


	uint32 fnCacheChip(uint32 a, uint32 b, uint32 c);
	uint32 fnCacheFast(uint32 a, uint32 b, uint32 c);
	uint32 fnDrawScreen(uint32 a, uint32 b, uint32 c);
	uint32 fnAr(uint32 a, uint32 b, uint32 c);
	uint32 fnArAnimate(uint32 a, uint32 b, uint32 c);
	uint32 fnIdle(uint32 a, uint32 b, uint32 c);
	uint32 fnInteract(uint32 a, uint32 b, uint32 c);
	uint32 fnStartSub(uint32 a, uint32 b, uint32 c);
	uint32 fnTheyStartSub(uint32 a, uint32 b, uint32 c);
	uint32 fnAssignBase(uint32 a, uint32 b, uint32 c);
	uint32 fnDiskMouse(uint32 a, uint32 b, uint32 c);
	uint32 fnNormalMouse(uint32 a, uint32 b, uint32 c);
	uint32 fnBlankMouse(uint32 a, uint32 b, uint32 c);
	uint32 fnCrossMouse(uint32 a, uint32 b, uint32 c);
	uint32 fnCursorRight(uint32 a, uint32 b, uint32 c);
	uint32 fnCursorLeft(uint32 a, uint32 b, uint32 c);
	uint32 fnCursorDown(uint32 a, uint32 b, uint32 c);
	uint32 fnOpenHand(uint32 a, uint32 b, uint32 c);
	uint32 fnCloseHand(uint32 a, uint32 b, uint32 c);
	uint32 fnGetTo(uint32 a, uint32 b, uint32 c);
	uint32 fnSetToStand(uint32 a, uint32 b, uint32 c);
	uint32 fnTurnTo(uint32 a, uint32 b, uint32 c);
	uint32 fnArrived(uint32 a, uint32 b, uint32 c);
	uint32 fnLeaving(uint32 a, uint32 b, uint32 c);
	uint32 fnSetAlternate(uint32 a, uint32 b, uint32 c);
	uint32 fnAltSetAlternate(uint32 a, uint32 b, uint32 c);
	uint32 fnKillId(uint32 a, uint32 b, uint32 c);
	uint32 fnNoHuman(uint32 a, uint32 b, uint32 c);
	uint32 fnAddHuman(uint32 a, uint32 b, uint32 c);
	uint32 fnAddButtons(uint32 a, uint32 b, uint32 c);
	uint32 fnNoButtons(uint32 a, uint32 b, uint32 c);
	uint32 fnSetStop(uint32 a, uint32 b, uint32 c);
	uint32 fnClearStop(uint32 a, uint32 b, uint32 c);
	uint32 fnPointerText(uint32 a, uint32 b, uint32 c);
	uint32 fnQuit(uint32 a, uint32 b, uint32 c);
	uint32 fnSpeakMe(uint32 a, uint32 b, uint32 c);
	uint32 fnSpeakMeDir(uint32 a, uint32 b, uint32 c);
	uint32 fnSpeakWait(uint32 a, uint32 b, uint32 c);
	uint32 fnSpeakWaitDir(uint32 a, uint32 b, uint32 c);
	uint32 fnChooser(uint32 a, uint32 b, uint32 c);
	uint32 fnHighlight(uint32 a, uint32 b, uint32 c);
	uint32 fnTextKill(uint32 a, uint32 b, uint32 c);
	uint32 fnStopMode(uint32 a, uint32 b, uint32 c);
	uint32 fnWeWait(uint32 a, uint32 b, uint32 c);
	uint32 fnSendSync(uint32 a, uint32 b, uint32 c);
	uint32 fnSendFastSync(uint32 a, uint32 b, uint32 c);
	uint32 fnSendRequest(uint32 a, uint32 b, uint32 c);
	uint32 fnClearRequest(uint32 a, uint32 b, uint32 c);
	uint32 fnCheckRequest(uint32 a, uint32 b, uint32 c);
	uint32 fnStartMenu(uint32 a, uint32 b, uint32 c);
	uint32 fnUnhighlight(uint32 a, uint32 b, uint32 c);
	uint32 fnFaceId(uint32 a, uint32 b, uint32 c);
	uint32 fnForeground(uint32 a, uint32 b, uint32 c);
	uint32 fnBackground(uint32 a, uint32 b, uint32 c);
	uint32 fnNewBackground(uint32 a, uint32 b, uint32 c);
	uint32 fnSort(uint32 a, uint32 b, uint32 c);
	uint32 fnNoSpriteEngine(uint32 a, uint32 b, uint32 c);
	uint32 fnNoSpritesA6(uint32 a, uint32 b, uint32 c);
	uint32 fnResetId(uint32 a, uint32 b, uint32 c);
	uint32 fnToggleGrid(uint32 a, uint32 b, uint32 c);
	uint32 fnPause(uint32 a, uint32 b, uint32 c);
	uint32 fnRunAnimMod(uint32 a, uint32 b, uint32 c);
	uint32 fnSimpleMod(uint32 a, uint32 b, uint32 c);
	uint32 fnRunFrames(uint32 a, uint32 b, uint32 c);
	uint32 fnAwaitSync(uint32 a, uint32 b, uint32 c);
	uint32 fnIncMegaSet(uint32 a, uint32 b, uint32 c);
	uint32 fnDecMegaSet(uint32 a, uint32 b, uint32 c);
	uint32 fnSetMegaSet(uint32 a, uint32 b, uint32 c);
	uint32 fnMoveItems(uint32 a, uint32 b, uint32 c);
	uint32 fnNewList(uint32 a, uint32 b, uint32 c);
	uint32 fnAskThis(uint32 a, uint32 b, uint32 c);
	uint32 fnRandom(uint32 a, uint32 b, uint32 c);
	uint32 fnPersonHere(uint32 a, uint32 b, uint32 c);
	uint32 fnToggleMouse(uint32 a, uint32 b, uint32 c);
	uint32 fnMouseOn(uint32 a, uint32 b, uint32 c);
	uint32 fnMouseOff(uint32 a, uint32 b, uint32 c);
	uint32 fnFetchX(uint32 a, uint32 b, uint32 c);
	uint32 fnFetchY(uint32 a, uint32 b, uint32 c);
	uint32 fnTestList(uint32 a, uint32 b, uint32 c);
	uint32 fnFetchPlace(uint32 a, uint32 b, uint32 c);
	uint32 fnCustomJoey(uint32 a, uint32 b, uint32 c);
	uint32 fnSetPalette(uint32 a, uint32 b, uint32 c);
	uint32 fnTextModule(uint32 a, uint32 b, uint32 c);
	uint32 fnChangeName(uint32 a, uint32 b, uint32 c);
	uint32 fnMiniLoad(uint32 a, uint32 b, uint32 c);
	uint32 fnFlushBuffers(uint32 a, uint32 b, uint32 c);
	uint32 fnFlushChip(uint32 a, uint32 b, uint32 c);
	uint32 fnSaveCoods(uint32 a, uint32 b, uint32 c);
	uint32 fnPlotGrid(uint32 a, uint32 b, uint32 c);
	uint32 fnRemoveGrid(uint32 a, uint32 b, uint32 c);
	uint32 fnEyeball(uint32 a, uint32 b, uint32 c);
	uint32 fnCursorUp(uint32 a, uint32 b, uint32 c);
	uint32 fnLeaveSection(uint32 a, uint32 b, uint32 c);
	uint32 fnEnterSection(uint32 sectionNo, uint32 b, uint32 c);
	uint32 fnRestoreGame(uint32 a, uint32 b, uint32 c);
	uint32 fnRestartGame(uint32 a, uint32 b, uint32 c);
	uint32 fnNewSwingSeq(uint32 a, uint32 b, uint32 c);
	uint32 fnWaitSwingEnd(uint32 a, uint32 b, uint32 c);
	uint32 fnSkipIntroCode(uint32 a, uint32 b, uint32 c);
	uint32 fnBlankScreen(uint32 a, uint32 b, uint32 c);
	uint32 fnPrintCredit(uint32 a, uint32 b, uint32 c);
	uint32 fnLookAt(uint32 a, uint32 b, uint32 c);
	uint32 fnLincTextModule(uint32 a, uint32 b, uint32 c);
	uint32 fnTextKill2(uint32 a, uint32 b, uint32 c);
	uint32 fnSetFont(uint32 a, uint32 b, uint32 c);
	uint32 fnStartFx(uint32 a, uint32 b, uint32 c);
	uint32 fnStopFx(uint32 a, uint32 b, uint32 c);
	uint32 fnStartMusic(uint32 a, uint32 b, uint32 c);
	uint32 fnStopMusic(uint32 a, uint32 b, uint32 c);
	uint32 fnFadeDown(uint32 a, uint32 b, uint32 c);
	uint32 fnFadeUp(uint32 a, uint32 b, uint32 c);
	uint32 fnQuitToDos(uint32 a, uint32 b, uint32 c);
	uint32 fnPauseFx(uint32 a, uint32 b, uint32 c);
	uint32 fnUnPauseFx(uint32 a, uint32 b, uint32 c);
	uint32 fnPrintf(uint32 a, uint32 b, uint32 c);

	static uint16 _screen;
	
protected:
	void push(uint32);
	uint32 pop();
	void checkModuleLoaded(uint16 moduleNo);
	uint32 script(Compact *compact, uint16 scriptNo, uint16 offset);
	bool collide(Compact *cpt);
	void initScriptVariables();
	void mainAnim();

	uint16 *_moduleList[16];
	uint32 _stack[20];
	byte _stackPtr;

	Compact *_compact;
	uint32 _scriptVariables[838];

	uint32 _currentSection;
	uint32 _saveCurrentSection;
	
	uint32 _gameVersion;
	
	SkyDisk *_skyDisk;
	SkyGrid *_skyGrid;
	SkyText *_skyText;
	SkyMusicBase *_skyMusic;
	SkyAutoRoute *_skyAutoRoute;
	SkyMouse *_skyMouse;
};

#endif