25 #include "common/error.h" 26 #include "common/file.h" 27 #include "common/fs.h" 28 #include "common/hash-str.h" 29 #include "common/random.h" 30 #include "common/scummsys.h" 31 #include "common/serializer.h" 32 #include "common/system.h" 33 #include "common/util.h" 34 #include "engines/engine.h" 35 #include "engines/savestate.h" 36 #include "graphics/managed_surface.h" 37 #include "graphics/screen.h" 38 #include "image/png.h" 40 #include "pelrock/chrono.h" 41 #include "pelrock/detection.h" 42 #include "pelrock/dialog.h" 43 #include "pelrock/events.h" 44 #include "pelrock/fonts/large_font.h" 45 #include "pelrock/fonts/small_font.h" 46 #include "pelrock/fonts/small_font_double.h" 47 #include "pelrock/graphics.h" 48 #include "pelrock/menu.h" 49 #include "pelrock/resources.h" 50 #include "pelrock/room.h" 51 #include "pelrock/sound.h" 52 #include "pelrock/types.h" 53 #include "pelrock/video.h" 57 struct PelrockGameDescription;
68 void loadInventoryArrows();
74 void walkTo(
int x,
int y);
75 void walkAndAction(
HotSpot *hotspot, VerbIcon action);
76 AlfredDirection calculateAlfredsDirection(
HotSpot *hotspot);
79 VerbIcon isActionUnder(
int x,
int y);
80 bool isAlfredUnder(
int x,
int y);
81 int isHotspotUnder(
int x,
int y);
82 Exit *isExitUnder(
int x,
int y);
83 bool isSpriteUnder(
Sprite *sprite,
int x,
int y);
85 void showActionBalloon(
int posx,
int posy,
int curFrame);
87 int getScrollPositionForItem(
int item);
90 void updateAnimations();
91 void renderOverlay(
int overlayMode);
93 void doAction(VerbIcon action,
HotSpot *hotspot);
97 void chooseAlfredStateAndDraw();
100 void drawAlfred(byte *buf);
101 void drawNextFrame(
Sprite *animSet);
102 void animateTalkingNPC(
Sprite *animSet);
103 void pickupIconFlash();
105 void playSoundIfNeeded();
107 void showInventoryOverlay();
109 void checkMouseOverInventoryOverlay(
int x);
110 int checkMouseClickInventoryOverlay(
int x);
115 void extraScreenLoop();
116 void walkLoop(int16 x, int16 y, AlfredDirection direction);
118 void checkMouseHover();
119 void checkMouseClick(
int x,
int y);
120 void checkLongMouseClick(
int x,
int y);
123 int _currentStep = 0;
124 PathContext _currentContext = {
nullptr,
nullptr, 0, 0, 0};
130 HotSpot *_currentHotspot =
nullptr;
134 QueuedAction _queuedAction = {NO_ACTION, -1,
false,
false};
136 bool shouldPlayIntro =
false;
137 bool gameInitialized =
false;
138 bool screenReady =
false;
141 byte *_alfredSprite =
nullptr;
143 int _numPressedX = 0;
145 bool _mouseDisabled =
false;
149 int _renderSkipAmount = 0;
150 int _renderSkipCounter = 0;
152 int _fightFrameCounter = 0;
153 int _fightSorcererSpriteIdx = -1;
154 bool _fightSorcererAppeared =
false;
155 bool _fightSpellCast =
false;
156 int _fightSpellFrameCounter = 0;
157 bool _fightInBlockingAnim =
false;
158 bool _disableAmbientSounds =
false;
159 bool _isDogPeeing =
false;
160 bool _disableAction =
false;
176 byte _npcTalkSpeedByte = 0;
183 bool _autoSaveAllowed =
true;
192 uint32 getFeatures()
const;
212 bool isScreenSaverDisabled()
const;
228 return _autoSaveAllowed;
250 void setScreen(
int s);
251 void setScreenAndPrepare(
int s, AlfredDirection dir);
252 void loadExtraScreenAndPresent(
int screenIndex);
253 void waitForSpecialAnimation();
254 bool renderScene(
int overlayMode = OVERLAY_NONE);
255 void mouseHoverForMap();
256 void frameTriggers();
257 void maybeHaveDogPee();
258 void maybePlayPostIntro();
259 void maybeShakeEffect();
260 void resetPasserByAnim(
int startX,
int startY,
Sprite *sprite);
261 void handleFightRoomFrame();
262 void paintDebugLayer();
264 void maybeUpdatePasserByAnim(uint32 frameCount);
265 void changeCursor(
Cursor cursor);
267 void travelToEgypt();
269 bool shouldSkipFrame();
272 void doExtraActions(
int roomNumber);
273 void pyramidCollapse();
276 void initGodsSequences(
int roomNumber);
277 void addInventoryItem(
int item);
278 void buyFromStore(
HotSpot *hotspot,
int stickerId);
279 void performActionTrigger(uint16 actionTrigger);
280 void dialogActionTrigger(uint16 actionTrigger, byte room, byte rootIndex);
282 void turnLightsOff();
285 void advanceQuotesConversation(byte rootIndex, byte room);
288 void executeAction(VerbIcon action,
HotSpot *hotspot);
289 void openRoomDrawer(
HotSpot *hotspot);
290 void closeRoomDrawer(
HotSpot *hotspot);
291 void openClosedDrawer(
HotSpot *hotspot);
292 void openRoomDoor(
HotSpot *hotspot);
293 void closeRoomDoor(
HotSpot *hotspot);
294 void pickUpAndDisable(
HotSpot *hotspot);
295 void grabKetchup(
HotSpot *hotspot);
296 void grabMustard(
HotSpot *hotspot);
297 void grabSpicey(
HotSpot *hotspot);
298 void openKitchenDoor(
HotSpot *hotspot);
300 void openKitchenDrawer(HotSpot *hotspot);
301 void openKitchenDoorFromInside(HotSpot *hotspot);
302 void useSpicySauceWithBurger(
int inventoryObject, HotSpot *hotspot);
303 void openShopDoor(HotSpot *hotspot);
304 void closeShopDoor(HotSpot *hotspot);
305 void openLamppost(HotSpot *hotspot);
306 void openDoor(HotSpot *hotspot,
int doorIndex,
int sticker,
bool masculine,
bool stayClosed);
307 void closeDoor(HotSpot *hotspot,
int doorIndex,
int sticker,
bool masculine,
bool stayOpen);
308 void pickUpPhoto(HotSpot *hotspot);
309 void pickYellowBook(HotSpot *hotspot);
310 void pickUpBrick(HotSpot *hotspot);
311 void openIceCreamShopDoor(HotSpot *hotspot);
312 void pickupGarbageCan(HotSpot *hotspot);
313 void noOpAction(HotSpot *hotspot);
314 void noOpItem(
int item, HotSpot *hotspot);
315 void useOnAlfred(
int inventoryObject);
316 void sayRandomIncorrectResponse();
317 void chooseCorrectDoor();
318 void useCardWithATM(
int inventoryObject, HotSpot *hotspot);
319 void useBrickWithWindow(
int inventoryObject, HotSpot *hotspot);
320 void moveCable(HotSpot *hotspot);
321 void useBrickWithShopWindow(
int inventoryObject, HotSpot *hotspot);
322 void pickGuitar(HotSpot *hotspot);
323 void pickFish(HotSpot *hotspot);
324 void pickTeddyBear(HotSpot *hotspot);
325 void pickDiscs(HotSpot *hotspot);
326 void pickMonkeyBrain(HotSpot *hotspot);
327 void pickBooks(HotSpot *hotspot);
328 void pickPalette(HotSpot *hotspot);
329 void pickCandy(HotSpot *hotspot);
330 void pickConch(HotSpot *hotspot);
331 void pickHat(HotSpot *hotspot);
332 void pickCord(HotSpot *hotspot);
333 void pickAmulet(HotSpot *hotspot);
334 void openPlug(HotSpot *hotspot);
335 void useCordWithPlug(
int inventoryObject, HotSpot *hotspot);
336 void pickCables(HotSpot *hotspot);
337 void showIdToGuard(
int inventoryObject, HotSpot *hotspot);
339 void giveMoneyToGuard(
int inventoryObject, HotSpot *hotspot);
340 void openMuseumDoor(HotSpot *hotspot);
341 void closeMuseumDoor(HotSpot *hotspot);
342 void pickupFruit(HotSpot *hotspot);
343 void useAmuletWithStatue(
int inventoryObject, HotSpot *hotspot);
344 void useSecretCodeWithStatue(
int inventoryObject, HotSpot *hotspot);
345 void pickUpLetter(HotSpot *hotspot);
346 void openLibraryOutdoorsDoor(HotSpot *hotspot);
347 void closeLibraryOutdoorsDoor(HotSpot *hotspot);
348 void openLibraryIndoorsDoor(HotSpot *hotspot);
349 void closeLibraryIndoorsDoor(HotSpot *hotspot);
350 void pickBooksFromShelf1(HotSpot *hotspot);
351 void pickBooksFromShelf2(HotSpot *hotspot);
352 void pickBooksFromShelf3(HotSpot *hotspot);
353 void giveSecretCodeToLibrarian(
int inventoryObject, HotSpot *hotspot);
354 void useBrickWithLibrarian(
int inventoryObject, HotSpot *hotspot);
355 void openNewspaperDoor(HotSpot *hotspot);
356 void closeNewspaperDoor(HotSpot *hotspot);
357 void openNewspaperBossDor(HotSpot *hotspot);
358 void closeNewspaperBossDoor(HotSpot *hotspot);
359 void openTravelAgencyDoor(HotSpot *hotspot);
360 void closeTravelAgencyDoor(HotSpot *hotspot);
361 void usePumpkinWithRiver(
int inventoryObject, HotSpot *hotspot);
362 void playAlfredSpecialAnim(
int anim,
bool reverse =
false);
363 void waitForSoundEnd(
int channel = 0);
364 void pickupSunflower(HotSpot *hotspot);
365 void checkIngredients();
366 void pickUpBook(
int i);
367 void pickUpChainsaw(HotSpot *hotspot);
368 void pickUpSpellbook(HotSpot *hotspot);
369 void pickUpBoot(HotSpot *hotspot);
370 void pickupCondoms(HotSpot *hotspot);
371 void openEgyptMuseumDoor(HotSpot *hotspot);
372 void closeEgyptMuseumDoor(HotSpot *hotspot);
373 void pushSymbol1(HotSpot *hotspot);
374 void pushSymbol2(HotSpot *hotspot);
375 void pushSymbol3(HotSpot *hotspot);
376 void pushSymbol4(HotSpot *hotspot);
377 void pickUpHairStrand(HotSpot *hotspot);
378 void openJailFloorTile(HotSpot *hotspot);
379 void openTunnelDrawer(HotSpot *hotspot);
380 void useKeyWithPortrait(
int inventoryObject, HotSpot *hotspot);
381 void openSafe(HotSpot *hotspot);
382 void openTunnelDoor(HotSpot *hotspot);
383 void closeTunnelDoor(HotSpot *hotspot);
384 void useDollWithBed(
int inventoryObject, HotSpot *hotspot);
385 void giveMagazineToGuard(
int inventoryObject, HotSpot *hotspot);
386 void giveWaterToGuard(
int inventoryObject, HotSpot *hotspot);
387 void guardMovement();
388 void pickUpStone(HotSpot *hotspot);
389 void playSpecialAnim(uint32 offset,
bool compressed,
int x,
int y,
int width,
int height,
int numFrames);
390 void giveStoneToSlaves(
int inventoryObject, HotSpot *hotspot);
391 void swimmingPoolCutscene(HotSpot *hotspot);
392 void pickUpStones(HotSpot *hotspot);
393 void pickUpMud(HotSpot *hotspot);
394 void openPyramidDoor(HotSpot *hotspot);
395 void usePumpkinWithPond(
int inventoryObject, HotSpot *hotspot);
396 void useWaterOnFakeStone(
int inventoryObject, HotSpot *hotspot);
397 void useWigWithPot(
int inventoryObject, HotSpot *hotspot);
398 void magicFormula(
int inventoryObject, HotSpot *hotspot);
399 void smokeAnimation(
int spriteIndex,
bool hide =
true);
401 void openArchitectDoor(HotSpot *hotspot);
402 void closeArchitectDoor(HotSpot *hotspot);
403 void pickupPyramidMap(HotSpot *hotspot);
404 void openArchitectDoorFromInside(HotSpot *hotspot);
405 void closeArchitectDoorFromInside(HotSpot *hotspot);
406 void checkAllSymbols();
407 void openMcDoor(HotSpot *hotspot);
408 void closeMcDoor(HotSpot *hotspot);
409 void pickupBush(HotSpot *hotspot);
410 void teleportToPrincess();
412 void animateStatuePaletteFade(
bool reverse =
false);
413 void pickUpMatches(HotSpot *hotspot);
414 void antiPiracyEffect();
415 void checkObjectsForPart2();
416 void waitForActionEnd();
420 #define SHOULD_QUIT ::Pelrock::g_engine->shouldQuit() Definition: managed_surface.h:51
EngineFeature
Definition: engine.h:258
bool canSaveAutosaveCurrently() override
Definition: pelrock.h:227
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: pelrock.h:223
Definition: advancedDetector.h:164
Common::Error syncGame(Common::Serializer &s)
uint getRandomNumber(uint max)
uint32 getRandomNumber(uint maxNum)
Definition: pelrock.h:202
Common::Error loadGameStream(Common::SeekableReadStream *stream) override
Definition: pelrock.h:245
Definition: serializer.h:80
Definition: small_font.h:33
Definition: graphics.h:36
Definition: atari-cursor.h:35
Definition: resources.h:36
bool hasFeature(EngineFeature f) const override
Definition: pelrock.h:214
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave=false) override
Definition: pelrock.h:241
bool isAlternateTiming() const
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: pelrock.h:220
Definition: small_font_double.h:36
Definition: large_font.h:30
Common::Error run() override
Common::String getGameId() const