22 #ifndef SWORD1_LOGIC_H 23 #define SWORD1_LOGIC_H 26 #include "sword1/sworddefs.h" 27 #include "sword1/objectman.h" 28 #include "common/util.h" 29 #include "common/random.h" 39 #define NON_ZERO_SCRIPT_VARS 95 40 #define NUM_SCRIPT_VARS 1179 53 typedef int (Logic::*BSMcodeTable)(Object *, int32, int32, int32, int32, int32, int32, int32);
61 void setControlPanelObject(
Control *control);
62 void newScreen(uint32 screen);
64 void updateScreenParams();
65 void runMouseScript(Object *cpt, int32 scriptId);
66 void startPositions(uint32 pos);
67 bool canShowDebugTextNumber();
68 void plotRouteGrid(Object *megaObject);
70 static uint32 _scriptVars[NUM_SCRIPT_VARS];
72 int cfnPresetScript(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
88 uint8 _speechClickDelay = 0;
90 bool _psxFudgeRandom =
false;
92 int scriptManager(Object *compact, uint32
id);
93 void processLogic(Object *compact, uint32
id);
94 int interpretScript(Object *compact,
int id,
Header *scriptModule,
int scriptBase,
int scriptNum);
96 int logicWaitTalk(Object *compact);
97 int logicStartTalk(Object *compact);
98 int logicArAnimate(Object *compact, uint32
id);
99 int speechDriver(Object *compact);
100 int fullAnimDriver(Object *compact);
101 int animDriver(Object *compact);
103 void setupMcodeTable();
104 const BSMcodeTable *_mcodeTable;
107 int fnBackground(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
108 int fnForeground(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
109 int fnSort(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
110 int fnNoSprite(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
111 int fnMegaSet(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
112 int fnAnim(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
113 int fnSetFrame(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
114 int fnFullAnim(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
115 int fnFullSetFrame(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
116 int fnFadeDown(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
117 int fnFadeUp(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
118 int fnCheckFade(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
119 int fnSetSpritePalette(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
120 int fnSetWholePalette(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
121 int fnSetFadeTargetPalette(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
122 int fnSetPaletteToFade(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
123 int fnSetPaletteToCut(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
124 int fnPlaySequence(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
126 int fnIdle(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
127 int fnPause(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
128 int fnPauseSeconds(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
129 int fnQuit(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
130 int fnKillId(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
131 int fnSuicide(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
132 int fnNewScript(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
133 int fnSubScript(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
134 int fnRestartScript(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
135 int fnSetBookmark(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
136 int fnGotoBookmark(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
137 int fnSendSync(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
138 int fnWaitSync(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
140 int cfnClickInteract(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
141 int cfnSetScript(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
143 int fnInteract(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
144 int fnIssueEvent(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
145 int fnCheckForEvent(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
146 int fnWipeHands(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
147 int fnISpeak(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
148 int fnTheyDo(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
149 int fnTheyDoWeWait(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
150 int fnWeWait(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
151 int fnChangeSpeechText(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
152 int fnTalkError(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
153 int fnStartTalk(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
154 int fnCheckForTextLine(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
155 int fnAddTalkWaitStatusBit(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
156 int fnRemoveTalkWaitStatusBit(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
158 int fnNoHuman(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
159 int fnAddHuman(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
160 int fnBlankMouse(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
161 int fnNormalMouse(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
162 int fnLockMouse(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
163 int fnUnlockMouse(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
164 int fnSetMousePointer(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
165 int fnSetMouseLuggage(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
166 int fnMouseOn(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
167 int fnMouseOff(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
168 int fnChooser(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
169 int fnEndChooser(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
170 int fnStartMenu(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
171 int fnEndMenu(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
173 int cfnReleaseMenu(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
175 int fnAddSubject(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
176 int fnAddObject(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
177 int fnRemoveObject(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
178 int fnEnterSection(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
179 int fnLeaveSection(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
180 int fnChangeFloor(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
181 int fnWalk(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
182 int fnTurn(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
183 int fnStand(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
184 int fnStandAt(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
185 int fnFace(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
186 int fnFaceXy(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
187 int fnIsFacing(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
188 int fnGetTo(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
189 int fnGetToError(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
190 int fnGetPos(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
191 int fnGetGamepadXy(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
192 int fnPlayFx(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
193 int fnStopFx(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
194 int fnPlayMusic(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
195 int fnStopMusic(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
196 int fnInnerSpace(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
197 int fnRandom(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
198 int fnSetScreen(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
199 int fnPreload(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
200 int fnCheckCD(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
201 int fnRestartGame(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
202 int fnQuitGame(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
203 int fnDeathScreen(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
204 int fnSetParallax(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
205 int fnTdebug(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
207 int fnRedFlash(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
208 int fnBlueFlash(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
209 int fnYellow(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
210 int fnGreen(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
211 int fnPurple(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
212 int fnBlack(Object *cpt, int32
id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
213 static const uint32 _scriptVarInit[NON_ZERO_SCRIPT_VARS][2];
214 static const uint8 *
const _startData[];
215 static const uint8 *
const _helperData[];
216 void startPosCallFn(uint8 fnId, uint32 param1, uint32 param2, uint32 param3);
217 void runStartScript(
const uint8 *data);
220 enum StartPosOpcodes {
Definition: atari-screen.h:60
Definition: animation.h:38
Definition: eventman.h:36
Definition: objectman.h:33
Definition: control.h:120