25#include "common/random.h"
26#include "common/serializer.h"
28#include "graphics/managed_surface.h"
30#include "pelrock/detection.h"
31#include "pelrock/types.h"
39struct PelrockGameDescription;
47class PelrockEventManager;
64 void loadInventoryArrows();
70 void walkTo(
int x,
int y);
71 void walkAndAction(
HotSpot *hotspot, VerbIcon action);
72 AlfredDirection calculateAlfredsDirection(
HotSpot *hotspot);
75 VerbIcon isActionUnder(
int x,
int y);
76 bool isAlfredUnder(
int x,
int y);
77 int isHotspotUnder(
int x,
int y);
78 Exit *isExitUnder(
int x,
int y);
79 bool isSpriteUnder(
Sprite *sprite,
int x,
int y);
81 void showActionBalloon(
int posx,
int posy,
int curFrame);
83 int getScrollPositionForItem(
int item);
86 void updateAnimations();
87 void renderOverlay(
int overlayMode);
89 void doAction(VerbIcon action,
HotSpot *hotspot);
93 void chooseAlfredStateAndDraw();
96 void drawAlfred(
byte *buf);
97 void drawNextFrame(
Sprite *animSet);
98 void animateTalkingNPC(
Sprite *animSet);
99 void pickupIconFlash();
101 void playSoundIfNeeded();
103 void showInventoryOverlay();
105 void checkMouseOverInventoryOverlay(
int x);
106 int checkMouseClickInventoryOverlay(
int x);
111 void extraScreenLoop();
112 void walkLoop(int16 x, int16 y, AlfredDirection direction);
114 void checkMouseHover();
115 void checkMouseClick(
int x,
int y);
116 void checkLongMouseClick(
int x,
int y);
119 int _currentStep = 0;
120 PathContext _currentContext = {
nullptr,
nullptr, 0, 0, 0};
126 HotSpot *_currentHotspot =
nullptr;
130 QueuedAction _queuedAction = {NO_ACTION, -1,
false,
false};
132 bool shouldPlayIntro =
false;
133 bool gameInitialized =
false;
134 bool screenReady =
false;
137 byte *_alfredSprite =
nullptr;
139 int _numPressedX = 0;
141 bool _mouseDisabled =
false;
145 int _renderSkipAmount = 0;
146 int _renderSkipCounter = 0;
148 int _fightFrameCounter = 0;
149 int _fightSorcererSpriteIdx = -1;
150 bool _fightSorcererAppeared =
false;
151 bool _fightSpellCast =
false;
152 int _fightSpellFrameCounter = 0;
153 bool _fightInBlockingAnim =
false;
154 bool _disableAmbientSounds =
false;
155 bool _isDogPeeing =
false;
156 bool _disableAction =
false;
157 bool _roomChangedDuringAnimation =
false;
173 byte _npcTalkSpeedByte = 0;
180 bool _autoSaveAllowed =
true;
189 uint32 getFeatures()
const;
209 bool isScreenSaverDisabled()
const;
225 return _autoSaveAllowed;
247 void setScreen(
int s);
248 void setScreenAndPrepare(
int s, AlfredDirection dir);
249 void loadExtraScreenAndPresent(
int screenIndex);
250 void waitForSpecialAnimation();
251 bool renderScene(
int overlayMode = OVERLAY_NONE);
252 void mouseHoverForMap();
253 void frameTriggers();
254 void maybeHaveDogPee();
255 void maybePlayPostIntro();
256 void maybeShakeEffect();
257 void resetPasserByAnim(
int startX,
int startY,
Sprite *sprite);
258 void handleFightRoomFrame();
259 void paintDebugLayer();
261 void maybeUpdatePasserByAnim(uint32 frameCount);
262 void changeCursor(
Cursor cursor);
264 void travelToEgypt();
266 bool shouldSkipFrame();
269 void doExtraActions(
int roomNumber);
270 void pyramidCollapse();
273 void initGodsSequences(
int roomNumber);
274 void addInventoryItem(
int item);
275 void buyFromStore(
HotSpot *hotspot,
int stickerId);
276 void performActionTrigger(uint16 actionTrigger);
277 void dialogActionTrigger(uint16 actionTrigger,
byte room,
byte rootIndex);
279 void turnLightsOff();
282 void advanceQuotesConversation(
byte rootIndex,
byte room);
285 void executeAction(VerbIcon action,
HotSpot *hotspot);
286 void openRoomDrawer(
HotSpot *hotspot);
287 void closeRoomDrawer(
HotSpot *hotspot);
288 void openClosedDrawer(
HotSpot *hotspot);
289 void openRoomDoor(
HotSpot *hotspot);
290 void closeRoomDoor(
HotSpot *hotspot);
291 void pickUpAndDisable(
HotSpot *hotspot);
292 void grabKetchup(
HotSpot *hotspot);
293 void grabMustard(
HotSpot *hotspot);
294 void grabSpicey(
HotSpot *hotspot);
295 void openKitchenDoor(
HotSpot *hotspot);
297 void openKitchenDrawer(
HotSpot *hotspot);
298 void openKitchenDoorFromInside(
HotSpot *hotspot);
299 void useSpicySauceWithBurger(
int inventoryObject,
HotSpot *hotspot);
300 void openShopDoor(
HotSpot *hotspot);
301 void closeShopDoor(
HotSpot *hotspot);
302 void openLamppost(
HotSpot *hotspot);
303 void openDoor(
HotSpot *hotspot,
int doorIndex,
int sticker,
bool masculine,
bool stayClosed);
304 void closeDoor(
HotSpot *hotspot,
int doorIndex,
int sticker,
bool masculine,
bool stayOpen);
305 void pickUpPhoto(
HotSpot *hotspot);
306 void pickYellowBook(
HotSpot *hotspot);
307 void pickUpBrick(
HotSpot *hotspot);
308 void openIceCreamShopDoor(
HotSpot *hotspot);
309 void pickupGarbageCan(
HotSpot *hotspot);
310 void noOpAction(
HotSpot *hotspot);
311 void noOpItem(
int item,
HotSpot *hotspot);
312 void useOnAlfred(
int inventoryObject);
313 void sayRandomIncorrectResponse();
314 void chooseCorrectDoor();
315 void useCardWithATM(
int inventoryObject,
HotSpot *hotspot);
316 void useBrickWithWindow(
int inventoryObject,
HotSpot *hotspot);
317 void moveCable(
HotSpot *hotspot);
318 void useBrickWithShopWindow(
int inventoryObject,
HotSpot *hotspot);
319 void pickGuitar(
HotSpot *hotspot);
320 void pickFish(
HotSpot *hotspot);
321 void pickTeddyBear(
HotSpot *hotspot);
322 void pickDiscs(
HotSpot *hotspot);
323 void pickMonkeyBrain(
HotSpot *hotspot);
324 void pickBooks(
HotSpot *hotspot);
325 void pickPalette(
HotSpot *hotspot);
326 void pickCandy(
HotSpot *hotspot);
327 void pickConch(
HotSpot *hotspot);
328 void pickHat(
HotSpot *hotspot);
329 void pickCord(
HotSpot *hotspot);
330 void pickAmulet(
HotSpot *hotspot);
331 void openPlug(
HotSpot *hotspot);
332 void useCordWithPlug(
int inventoryObject,
HotSpot *hotspot);
333 void pickCables(
HotSpot *hotspot);
334 void showIdToGuard(
int inventoryObject,
HotSpot *hotspot);
336 void giveMoneyToGuard(
int inventoryObject,
HotSpot *hotspot);
337 void openMuseumDoor(
HotSpot *hotspot);
338 void closeMuseumDoor(
HotSpot *hotspot);
339 void pickupFruit(
HotSpot *hotspot);
340 void useAmuletWithStatue(
int inventoryObject,
HotSpot *hotspot);
341 void useSecretCodeWithStatue(
int inventoryObject,
HotSpot *hotspot);
342 void pickUpLetter(
HotSpot *hotspot);
343 void openLibraryOutdoorsDoor(
HotSpot *hotspot);
344 void closeLibraryOutdoorsDoor(
HotSpot *hotspot);
345 void openLibraryIndoorsDoor(
HotSpot *hotspot);
346 void closeLibraryIndoorsDoor(
HotSpot *hotspot);
347 void pickBooksFromShelf1(
HotSpot *hotspot);
348 void pickBooksFromShelf2(
HotSpot *hotspot);
349 void pickBooksFromShelf3(
HotSpot *hotspot);
350 void giveSecretCodeToLibrarian(
int inventoryObject,
HotSpot *hotspot);
351 void useBrickWithLibrarian(
int inventoryObject,
HotSpot *hotspot);
352 void openNewspaperDoor(
HotSpot *hotspot);
353 void closeNewspaperDoor(
HotSpot *hotspot);
354 void openNewspaperBossDor(
HotSpot *hotspot);
355 void closeNewspaperBossDoor(
HotSpot *hotspot);
356 void openTravelAgencyDoor(
HotSpot *hotspot);
357 void closeTravelAgencyDoor(
HotSpot *hotspot);
358 void usePumpkinWithRiver(
int inventoryObject,
HotSpot *hotspot);
359 void playAlfredSpecialAnim(
int anim,
bool reverse =
false);
360 void waitForSoundEnd(
int channel = 0);
361 void pickupSunflower(
HotSpot *hotspot);
362 void checkIngredients();
363 void pickUpBook(
int i);
364 void pickUpChainsaw(
HotSpot *hotspot);
365 void pickUpSpellbook(
HotSpot *hotspot);
366 void pickUpBoot(
HotSpot *hotspot);
367 void pickupCondoms(
HotSpot *hotspot);
368 void openEgyptMuseumDoor(
HotSpot *hotspot);
369 void closeEgyptMuseumDoor(
HotSpot *hotspot);
370 void pushSymbol1(
HotSpot *hotspot);
371 void pushSymbol2(
HotSpot *hotspot);
372 void pushSymbol3(
HotSpot *hotspot);
373 void pushSymbol4(
HotSpot *hotspot);
374 void pickUpHairStrand(
HotSpot *hotspot);
375 void openJailFloorTile(
HotSpot *hotspot);
376 void openTunnelDrawer(
HotSpot *hotspot);
377 void useKeyWithPortrait(
int inventoryObject,
HotSpot *hotspot);
378 void openSafe(
HotSpot *hotspot);
379 void openTunnelDoor(
HotSpot *hotspot);
380 void closeTunnelDoor(
HotSpot *hotspot);
381 void useDollWithBed(
int inventoryObject,
HotSpot *hotspot);
382 void giveMagazineToGuard(
int inventoryObject,
HotSpot *hotspot);
383 void giveWaterToGuard(
int inventoryObject,
HotSpot *hotspot);
384 void guardMovement();
385 void pickUpStone(
HotSpot *hotspot);
386 void playSpecialAnim(uint32 offset,
bool compressed,
int x,
int y,
int width,
int height,
int numFrames);
387 void giveStoneToSlaves(
int inventoryObject,
HotSpot *hotspot);
388 void swimmingPoolCutscene(
HotSpot *hotspot);
389 void pickUpStones(
HotSpot *hotspot);
390 void pickUpMud(
HotSpot *hotspot);
391 void openPyramidDoor(
HotSpot *hotspot);
392 void usePumpkinWithPond(
int inventoryObject,
HotSpot *hotspot);
393 void useWaterOnFakeStone(
int inventoryObject,
HotSpot *hotspot);
394 void useWigWithPot(
int inventoryObject,
HotSpot *hotspot);
395 void magicFormula(
int inventoryObject,
HotSpot *hotspot);
396 void smokeAnimation(
int spriteIndex,
bool hide =
true);
398 void openArchitectDoor(
HotSpot *hotspot);
399 void closeArchitectDoor(
HotSpot *hotspot);
400 void pickupPyramidMap(
HotSpot *hotspot);
401 void openArchitectDoorFromInside(
HotSpot *hotspot);
402 void closeArchitectDoorFromInside(
HotSpot *hotspot);
403 void checkAllSymbols();
404 void openMcDoor(
HotSpot *hotspot);
405 void closeMcDoor(
HotSpot *hotspot);
406 void pickupBush(
HotSpot *hotspot);
407 void teleportToPrincess();
409 void animateStatuePaletteFade(
bool reverse =
false);
410 void pickUpMatches(
HotSpot *hotspot);
411 void antiPiracyEffect();
412 void checkObjectsForPart2();
413 void waitForActionEnd();
417#define SHOULD_QUIT ::Pelrock::g_engine->shouldQuit()
uint getRandomNumber(uint max)
Definition: serializer.h:80
EngineFeature
Definition: engine.h:282
@ kSupportsReturnToLauncher
Definition: engine.h:296
@ kSupportsSavingDuringRuntime
Definition: engine.h:314
@ kSupportsLoadingDuringRuntime
Definition: engine.h:305
Definition: managed_surface.h:51
Definition: graphics.h:38
Definition: small_font_double.h:31
Definition: graphics.h:32
Definition: large_font.h:27
bool hasFeature(EngineFeature f) const override
Definition: pelrock.h:211
bool canSaveAutosaveCurrently() override
Definition: pelrock.h:224
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: pelrock.h:220
Common::String getGameId() const
Common::Error syncGame(Common::Serializer &s)
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: pelrock.h:217
Common::Error run() override
bool isAlternateTiming() const
uint32 getRandomNumber(uint maxNum)
Definition: pelrock.h:199
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave=false) override
Definition: pelrock.h:238
Common::Error loadGameStream(Common::SeekableReadStream *stream) override
Definition: pelrock.h:242
Definition: resources.h:30
Definition: small_font.h:30
Definition: formatinfo.h:28
Definition: advancedDetector.h:164
Definition: atari-cursor.h:35
Definition: atari-screen.h:58