25 #include "common/array.h" 26 #include "common/events.h" 27 #include "common/file.h" 28 #include "common/memstream.h" 29 #include "common/random.h" 30 #include "common/savefile.h" 31 #include "common/serializer.h" 32 #include "common/str.h" 33 #include "common/substream.h" 34 #include "common/system.h" 35 #include "engines/engine.h" 36 #include "graphics/pixelformat.h" 37 #include "graphics/fontman.h" 38 #include "graphics/font.h" 39 #include "graphics/fonts/ttf.h" 41 #include "gnap/debugger.h" 42 #include "gnap/resource.h" 43 #include "gnap/scenes/scenecore.h" 44 #include "gnap/character.h" 45 #include "gnap/music.h" 56 class SequenceResource;
62 #define GNAP_SAVEGAME_VERSION 2 79 bool isFlag(uint16 flag)
const {
80 return (_flags & flag) != 0;
88 const int kMaxTimers = 10;
90 enum GnapDebugChannels {
97 SF_LOOK_CURSOR = 0x0001,
98 SF_GRAB_CURSOR = 0x0002,
99 SF_TALK_CURSOR = 0x0004,
100 SF_PLAT_CURSOR = 0x0008,
101 SF_DISABLED = 0x0010,
102 SF_WALKABLE = 0x0020,
103 SF_EXIT_L_CURSOR = 0x0040,
104 SF_EXIT_R_CURSOR = 0x0080,
105 SF_EXIT_U_CURSOR = 0x0100,
106 SF_EXIT_D_CURSOR = 0x0200,
107 SF_EXIT_NW_CURSOR = 0x0400,
108 SF_EXIT_NE_CURSOR = 0x0800,
109 SF_EXIT_SW_CURSOR = 0x1000,
110 SF_EXIT_SE_CURSOR = 0x2000
134 kGSPullOutDevice = 0,
135 kGSPullOutDeviceNonWorking = 1,
137 kGSBrainPulsating = 3,
139 kGSScratchingHead = 5,
158 kItemQuarterWithHole = 11,
159 kItemDiceQuarterHole = 12,
162 kItemGroceryStoreHat = 15,
166 kItemEmptyBucket = 19,
167 kItemBucketWithBeer = 20,
168 kItemBucketWithPill = 21,
172 kItemChickenBucket = 25,
187 kGFBarnPadlockOpen = 7,
188 kGFTruckFilledWithGas = 8,
189 kGFTruckKeysUsed = 9,
190 kGFPlatypusDisguised = 10,
192 kGFGnapControlsToyUFO = 12,
199 kGFGroceryStoreHatTaken = 19,
200 kGFPictureTaken = 20,
206 kGFPlatypusTalkingToAssistant = 26,
218 int _year, _month, _day;
253 int _lastUpdateClock;
256 bool _keyPressState[512];
257 bool _keyDownState[512];
261 int _timers[kMaxTimers], _savedTimers[kMaxTimers];
266 bool _sceneSavegameLoaded, _wasSavegameLoaded;
269 int _prevSceneNum, _currentSceneNum, _newSceneNum;
270 bool _sceneDone, _sceneWaiting;
272 uint32 _inventory, _gameFlags;
277 int _sceneClickedHotspot;
280 bool _isLeavingScene;
282 bool _isStockDatLoaded;
284 int _newCursorValue, _cursorValue;
286 int _verbCursor, _cursorIndex;
288 int _leftClickMouseX, _leftClickMouseY;
291 int _currGrabCursorX, _currGrabCursorY;
292 int _grabCursorSpriteIndex, _newGrabCursorSpriteIndex;
295 int _fullScreenSpriteId;
297 int _deviceX1, _deviceY1;
299 int _soundTimerIndexA;
300 int _soundTimerIndexB;
301 int _soundTimerIndexC;
305 void gameUpdateTick();
307 void restoreTimers();
313 int getRandom(
int max);
315 int readSavegameDescription(
int savegameNum,
Common::String &description);
316 int loadSavegame(
int savegameNum);
323 void delayTicks(
int val,
int idx,
bool updateCursor);
324 void delayTicksA(
int val,
int idx);
325 void delayTicksCursor(
int val);
327 void setHotspot(
int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags = SF_NONE,
328 int16 walkX = -1, int16 walkY = -1);
330 void updateCursorByHotspot();
331 int getClickedHotspotId();
333 int getInventoryItemSpriteNum(
int index);
335 void updateMouseCursor();
336 void setVerbCursor(
int verbCursor);
337 void setCursor(
int cursorIndex);
341 void setGrabCursorSprite(
int index);
342 void createGrabCursorSprite(
int spriteId);
343 void freeGrabCursorSprite();
344 void updateGrabCursorSprite(
int x,
int y);
347 void invAdd(
int itemId);
348 void invRemove(
int itemId);
349 bool invHas(
int itemId);
352 void setFlag(
int num);
353 void clearFlag(
int num);
354 bool isFlag(
int num);
357 void removeFullScreenSprite();
358 void showFullScreenSprite(
int resourceId);
360 void queueInsertDeviceIcon();
361 void insertDeviceIconActive();
362 void removeDeviceIconActive();
363 void setDeviceHotspot(
int hotspotIndex,
int x1,
int y1,
int x2,
int y2);
365 int getSequenceTotalDuration(
int resourceId);
367 bool isSoundPlaying(
int resourceId);
368 void playSound(
int resourceId,
bool looping);
369 void stopSound(
int resourceId);
370 void setSoundVolume(
int resourceId,
int volume);
374 void initGameFlags(
int num);
382 int initSceneLogic();
383 void runSceneLogic();
385 void checkGameKeys();
387 void startSoundTimerA(
int timerIndex);
389 void startSoundTimerB(
int timerIndex);
391 void startSoundTimerC(
int timerIndex);
393 void startIdleTimer(
int timerIndex);
394 void updateIdleTimer();
396 void screenEffect(
int dir, byte r, byte g, byte b);
398 bool isKeyStatus1(
int key);
399 bool isKeyStatus2(
int key);
400 void clearKeyStatus1(
int key);
401 void clearAllKeyStatus1();
407 int _menuSpritesIndex;
415 char _savegameFilenames[7][30];
419 int _menuInventoryIndices[30];
422 void createMenuSprite();
423 void freeMenuSprite();
424 void initMenuHotspots1();
425 void initMenuHotspots2();
426 void initMenuQuitQueryHotspots();
427 void initSaveLoadHotspots();
428 void drawInventoryFrames();
429 void insertInventorySprites();
430 void removeInventorySprites();
432 void updateMenuStatusInventory();
433 void updateMenuStatusMainMenu();
434 void updateMenuStatusSaveGame();
435 void updateMenuStatusLoadGame();
436 void updateMenuStatusQueryQuit();
439 int _gridMinX, _gridMinY;
440 int _gridMaxX, _gridMaxY;
441 bool isPointBlocked(
int gridX,
int gridY);
443 void initSceneGrid(
int gridMinX,
int gridMinY,
int gridMaxX,
int gridMaxY);
444 bool testWalk(
int animationIndex,
int someStatus,
int gridX1,
int gridY1,
int gridX2,
int gridY2);
447 void doCallback(
int callback);
450 int _toyUfoNextSequenceId, _toyUfoSequenceId;
452 int _toyUfoActionStatus;
456 void initGlobalSceneVars();
457 void playSequences(
int fullScreenSpriteId,
int sequenceId1,
int sequenceId2,
int sequenceId3);
460 int _s18GarbageCanPos;
463 void toyUfoSetStatus(
int flagNum);
464 int toyUfoGetSequenceId();
465 bool toyUfoCheckTimer();
466 void toyUfoFlyTo(
int destX,
int destY,
int minX,
int maxX,
int minY,
int maxY,
int animationIndex);
468 void playMidi(
const char *name);
474 #endif // GNAP_GNAP_H
Definition: winexe_pe.h:48
EngineFeature
Definition: engine.h:253
Definition: character.h:79
Definition: savefile.h:54
Definition: advancedDetector.h:163
bool contains(int16 x, int16 y) const
Definition: rect.h:210
Definition: memstream.h:194
Definition: serializer.h:79
Definition: datarchive.h:60
Definition: algorithm.h:29
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: character.h:25
Definition: resource.h:109
Definition: character.h:123
Definition: scenecore.h:31
Definition: debugger.h:32