22 #ifndef LILLIPUT_LILLIPUT_H 23 #define LILLIPUT_LILLIPUT_H 25 #include "lilliput/console.h" 26 #include "lilliput/script.h" 27 #include "lilliput/sound.h" 28 #include "lilliput/stream.h" 29 #include "lilliput/detection.h" 31 #include "common/file.h" 32 #include "common/rect.h" 33 #include "common/events.h" 35 #include "engines/engine.h" 36 #include "graphics/surface.h" 54 static const int kSavegameVersion = 1;
56 enum LilliputDebugChannels {
57 kDebugEngine = 1 << 0,
58 kDebugScript = 1 << 1,
60 kDebugEngineTBC = 1 << 3,
61 kDebugScriptTBC = 1 << 4
64 enum InterfaceHotspotStatus {
72 #define kSeqNoInc 1 << 0 73 #define kSeqRepeat 1 << 1 75 struct LilliputGameDescription;
96 int _smallAnimsFrameIndex;
98 byte _handleOpcodeReturnCode;
100 byte _lastAnimationTick;
106 byte _keyboard_nextIndex;
107 byte _keyboard_oldIndex;
110 bool _refreshScreenFlag;
112 int8 _lastInterfaceHotspotIndex;
113 byte _lastInterfaceHotspotButton;
117 byte _codeEntered[3];
118 char _homeInDirLikelyhood[4];
120 byte *_bufferCubegfx;
123 byte *_bufferIsoChars;
124 byte *_bufferIdeogram;
127 byte _curPalette[768];
128 byte _displayStringBuf[160];
133 int _word10800_ERULES;
136 int _nextCharacterIndex;
138 int8 _waitingSignalCharacterId;
139 uint16 _newModesEvaluatedNumber;
141 bool _displayGreenHand;
142 bool _isCursorGreenHand;
143 int _currentDisplayCharacter;
144 int _displayStringIndex;
148 int16 _mapSavedPixelIndex[40];
149 byte _mapSavedPixel[40];
150 int16 _characterSignals[40];
151 int16 _signalArr[40];
152 int16 _signalArray[30];
155 int16 _currentScriptCharacter;
157 int8 _characterPosAltitude[40];
158 int16 _characterFrameArray[40];
159 int8 _characterCarried[40];
160 int8 _characterBehindDist[40];
161 byte _characterAboveDist[40];
162 byte _spriteSizeArray[40];
163 byte _characterDirectionArray[40];
164 byte _characterMobility[40];
165 byte _characterTypes[40];
166 byte _characterBehaviour[40];
168 byte _characterVariables[1400 + 3120];
169 byte *_currentCharacterAttributes;
170 byte _poseArray[40 * 32];
171 int *_packedStringIndex;
172 int _packedStringNumb;
173 char *_packedStrings;
178 int *_arrayGameScriptIndex;
179 int _gameScriptIndexSize;
180 byte *_arrayGameScripts;
189 int _interfaceHotspotNumb;
190 byte _interfaceTwoStepAction[20];
192 Common::KeyCode _keyboardMapping[20];
194 byte _savedSurfaceUnderMouse[16 * 16];
195 byte _charactersToDisplay[40];
198 int8 _characterMagicPuffFrame[40];
200 byte _specialCubes[40];
201 byte _doorEntranceMask[4];
202 byte _doorExitMask[4];
203 byte _savedSurfaceGameArea1[176 * 256];
204 byte _savedSurfaceGameArea2[176 * 256];
205 byte _savedSurfaceGameArea3[176 * 256];
206 byte _savedSurfaceSpeech[16 * 252];
209 uint32 getFeatures()
const;
210 const char *getGameId()
const;
215 void display16x16IndexedBuf(byte *buf,
int index,
Common::Point pos,
bool transparent =
true,
bool updateScreen =
true);
216 void display16x16Buf(byte *buf,
Common::Point pos,
bool transparent =
true,
bool updateScreen =
true);
218 void saveSurfaceGameArea();
219 void saveSurfaceSpeech();
220 void displayInterfaceHotspots();
221 void displayLandscape();
222 void displaySpeechBubble();
223 void displaySpeech(byte *buf);
224 void initGameAreaDisplay();
225 void displayIsometricBlock(byte *buf,
int var1,
int posX,
int posY,
int var3);
226 void displayGameArea();
227 void prepareGameArea();
228 void displayRefreshScreen();
229 void restoreSurfaceSpeech();
230 void displayCharacterStatBar(int8 type, int16 averagePosX, int8 score, int16 posY);
231 void displayCharacter(
int index,
Common::Point pos,
int flags);
233 void displayChar(
int index,
int var1);
234 void displaySmallAnims();
235 void displaySmallIndexedAnim(byte index, byte subIndex);
237 void unselectInterfaceHotspots();
238 void startNavigateFromMap();
239 void resetSmallAnims();
240 void paletteFadeOut();
241 void paletteFadeIn();
243 void sortCharacters();
244 void scrollToViewportCharacterTarget();
246 void checkSpeechClosing();
247 void updateCharPosSequence();
248 void evaluateDirections(
int index);
249 byte homeInAvoidDeadEnds(
int indexb,
int indexs);
250 void signalDispatcher(byte type, byte index,
int var4);
251 void sendMessageToCharacter(byte index,
int var4);
255 byte sequenceEnd(
int index);
256 void homeInPathFinding(
int index);
260 void checkNumericCode();
261 void keyboard_handleInterfaceShortcuts(
bool &forceReturnFl);
262 byte sequenceCharacterHomeIn(
int index,
Common::Point param1);
264 void addCharToBuf(byte character);
265 void numberToString(
int param1);
266 void handleCharacterTimers();
267 byte sequenceMoveCharacter(
int idx,
int moveType,
int poseType);
268 void setCharacterPose(
int idx,
int poseIdx);
269 void checkSpecialCubes();
270 void checkInteractions();
271 byte sequenceSetCharacterDirection(
int index,
int direction,
int poseType);
272 void handleSignals();
273 void checkInterfaceActivationDelay();
274 int16 checkObstacle(
int x1,
int y1,
int x2,
int y2);
275 void displayCharactersOnMap();
276 void restoreMapPoints();
277 void displayHeroismIndicator();
278 void handleGameMouseClick();
279 void handleInterfaceHotspot(byte index, byte button);
280 void checkInterfaceHotspots(
bool &forceReturnFl);
282 void checkClickOnCharacter(
Common::Point pos,
bool &forceReturnFl);
285 void displaySpeechBubbleTailLine(
Common::Point pos,
int var2);
286 void displaySpeechLine(
int vgaIndex, byte *srcBuf,
int &bufIndex);
287 void checkMapClosing(
bool &forceReturnFl);
288 void turnCharacter1(
int index);
289 void turnCharacter2(
int index);
290 void moveCharacterUp1(
int index);
291 void moveCharacterUp2(
int index);
292 void moveCharacterDown1(
int index);
293 void moveCharacterDown2(
int index);
294 void moveCharacterSpeed2(
int index);
295 void moveCharacterSpeed4(
int index);
296 void moveCharacterBack2(
int index);
297 void moveCharacterSpeed3(
int index);
298 void moveCharacterForward(
int index, int16 speed);
299 void checkCollision(
int index,
Common::Point pos,
int direction);
300 byte sequenceSeekMovingCharacter(
int index,
Common::Point var1);
302 byte sequenceRepeat(
int index,
Common::Point var1,
int tmpVal);
303 void homeInChooseDirection(
int index);
306 byte *loadVGA(
const Common::Path &filename,
int fileSize,
bool loadPal);
307 byte *loadRaw(
const Common::Path &filename,
int filesize);
312 void fixPaletteEntries(uint8 *palette,
int num);
314 GameType getGameType()
const;
318 const char *getCopyrightString()
const;
321 void syncSoundSettings()
override;
330 int _skipDisplayFlag1;
331 int _skipDisplayFlag2;
334 bool _delayedReactivationAction;
335 int8 _selectedCharacterId;
336 byte _numCharactersToDisplay;
341 void setCurrentCharacter(
int index);
342 void unselectInterfaceButton();
343 void moveCharacters();
344 void setNextDisplayCharacter(
int var1);
345 void handleGameScripts();
348 byte *getCharacterAttributesPtr(int16 index);
352 bool _keyboard_checkKeyboard();
353 void _keyboard_resetKeyboardBuffer();
EngineFeature
Definition: engine.h:253
EventType
Definition: events.h:49
Definition: lilliput.h:77
Definition: algorithm.h:29
Definition: lilliput.h:83
Definition: detection.h:35