21 #ifndef PELROCK_TYPES_H 22 #define PELROCK_TYPES_H 24 #include "common/debug.h" 25 #include "common/rect.h" 26 #include "common/scummsys.h" 27 #include "common/system.h" 28 #include "common/types.h" 46 const byte kActionMaskNone = 0;
47 const byte kActionMaskOpen = 1;
48 const byte kActionMaskClose = 2;
49 const byte kActionMaskUnknown = 4;
50 const byte kActionMaskPickup = 8;
51 const byte kActionMaskTalk = 16;
52 const byte kActionMaskPush = 32;
53 const byte kActionMaskPull = 128;
69 const int kCursorWidth = 16;
70 const int kCursorHeight = 18;
71 const int kCursorSize = 288;
73 const int kVerbIconWidth = 60;
74 const int kVerbIconHeight = 60;
75 const int kNumVerbIcons = 9;
77 const int kBalloonWidth = 247;
78 const int kBalloonHeight = 112;
79 const int kBalloonFrames = 4;
81 const int kAlfredFrameWidth = 51;
82 const int kAlfredFrameHeight = 102;
84 const int kTalkAnimationSpeed = 2;
85 const int kAlfredAnimationSpeed = 2;
87 const int kAlfredIdleAnimationFrameCount = 300;
88 const int kAlfredIdleScreenSaverFrameCount = 1090;
90 const int kInventoryPageSize = 10;
92 const int kAlfredInitialPosX = 235;
93 const int kAlfredInitialPosY = 279;
96 const byte kMoveRight = 0x01;
97 const byte kMoveLeft = 0x02;
98 const byte kMoveHoriz = 0x03;
99 const byte kMoveDown = 0x04;
100 const byte kMoveUp = 0x08;
101 const byte kMoveVert = 0x0C;
102 const int kMaxPathLength = 100;
103 const int kMaxMovementSteps = 100;
104 const byte kPathEnd = 0xFF;
106 const byte kAlfredColor = 0x0D;
111 OVERLAY_PICKUP_ICON = 2,
116 const byte kPasserbyRight = 0;
117 const byte kPasserbyLeft = 1;
118 const byte kPasserbyDown = 2;
120 const byte kIconBlinkPeriod = 4;
122 enum AlfredAnimState {
132 enum AlfredDirection {
140 byte *animData =
nullptr;
150 AlfredSpecialAnim(
int nF,
int width,
int height,
int nBudas, uint32 off,
int lCount, uint32 sz,
int spd = 2)
151 : numFrames(nF), w(width), h(height), loopCount(lCount), size(sz), speed(spd) {
164 bool isActive =
false;
169 bool isAlfredUnder =
false;
173 bool isActive =
false;
174 int invStartingPos = 0;
175 int flashingIconIndex = -1;
178 byte *arrows[2] = {
nullptr,
nullptr};
180 bool posInInventorySelectionArea(
int x,
int y) {
181 return inventorySelectionArea.
contains(x, y);
186 AlfredAnimState animState = ALFRED_IDLE;
187 AlfredDirection direction = ALFRED_DOWN;
189 uint16 movementSpeedX = 6;
190 uint16 movementSpeedY = 5;
191 uint16 x = kAlfredInitialPosX;
192 uint16 y = kAlfredInitialPosY;
193 byte w = kAlfredFrameWidth;
194 byte h = kAlfredFrameHeight;
195 int idleFrameCounter = 0;
196 int screenSaverFrameCounter = 0;
197 bool isWalkingCancelable =
true;
199 void setState(AlfredAnimState nextState) {
200 animState = nextState;
205 idleFrameCounter = 0;
206 screenSaverFrameCounter = 0;
211 bool enabled =
false;
240 uint16 movementCount;
241 uint16 compressed_length;
246 uint32 paletteOffset;
272 byte **animData =
nullptr;
275 byte elpapsedFrames = 0;
276 uint16 movementFlags = 0;
300 int curAnimIndex = 0;
303 bool isHotspotDisabled;
304 bool disableAfterSequence =
false;
305 bool isTalking =
false;
306 byte talkingAnimIndex = 0;
319 byte actionFlags = 0;
321 bool isEnabled =
true;
322 bool isSprite =
false;
327 uint32 spritePointer = 0;
331 int8 offsetXAnimA = 0;
332 int8 offsetYAnimA = 0;
337 byte numFramesAnimA = 0;
341 int8 offsetXAnimB = 0;
342 int8 offsetYAnimB = 0;
347 byte numFramesAnimB = 0;
353 byte currentFrameAnimA = 0;
354 byte currentFrameAnimB = 0;
356 byte **animA =
nullptr;
357 byte **animB =
nullptr;
363 bool isAction =
false;
364 uint16 actionTrigger = 0;
432 byte iconData[60 * 60];
449 byte curFrameCount = 0;
462 byte paletteMode = 0;
465 byte unknownBytes[7] = {0};
467 byte curFrameCount = 0;
472 byte paletteMode = 0;
479 uint32 frameTrigger = 0x3FF;
488 PasserByAnim(byte spriteIndex_, int16 startX_, int16 startY_, byte dir_, int16 resetCoord_, byte targetZIndex_, uint32 frameTrigger_)
489 : frameTrigger(frameTrigger_), startX(startX_), startY(startY_), resetCoord(resetCoord_), dir(dir_), spriteIndex(spriteIndex_), targetZIndex(targetZIndex_) {}
495 byte currentAnimIndex = 0;
498 RoomPasserBys(byte roomNum, byte nAnims) : roomNumber(roomNum), numAnims(nAnims) {}
509 bool isDisabled =
false;
510 bool shouldDisableOnSelect =
false;
511 bool hasConversationEndMarker =
false;
512 bool isTerminator =
false;
522 byte *data =
nullptr;
525 #define FLAG_BOSS_WIRED_MONEY 0 526 #define FLAG_BOSS_IN_JAIL 1 527 #define FLAG_SPICY_SAUCE_PLACED 2 528 #define FLAG_BROKEN_GLASS 3 529 #define FLAG_FIRST_TIME_IN_SHOP 4 530 #define FLAG_ELECTROSHOCK 5 531 #define FLAG_CABLES_PLACED 6 532 #define FLAG_DOORMAN_BRIBED 7 533 #define FLAG_BOOK_MEMORIZED 8 534 #define FLAG_ALFRED_SMART 9 535 #define FLAG_ALFRED_SPEAKS_EGYPTIAN 10 536 #define FLAG_SALESMAN_LEAVES_ALFRED_ALONE 11 537 #define FLAG_TRAVEL_TO_EGYPT 12 538 #define FLAG_SOLVED_PARADOX 13 539 #define FLAG_CROCODILE_ON 14 540 #define FLAG_LOOKED_SYMBOL_MUSEUM_EXTERIOR 15 541 #define FLAG_SECRET_DOOR_OPEN 16 542 #define FLAG_STOLE_PRINCESS_HAIR 17 543 #define FLAG_TO_JAIL 18 544 #define FLAG_SAFE_COMBINATION 19 545 #define FLAG_DOLL_PLACED 20 546 #define FLAG_GUARD_WATER_DRINKED 21 547 #define FLAG_GUARD_PEEING 22 548 #define FLAG_PYRAMID_COLLAPSED 23 549 #define FLAG_PYRAMID_COLLAPSED2 24 550 #define FLAG_GUARD_HAVINGFUN 25 551 #define FLAG_MAGIC_FORMULA 26 552 #define FLAG_TIME_TRAVEL 27 553 #define FLAG_EUNUCH_APPEARS 28 554 #define FLAG_PHARAOH_VIEWING 29 555 #define FLAG_TO_WORK 30 556 #define FLAG_STONE_GIVEN 31 557 #define FLAG_COLLECTED_STONES 32 558 #define FLAG_DRUNK_GUARDS 33 559 #define FLAG_FAKE_STONE_WET 34 560 #define FLAG_CORRECT_DOOR 35 561 #define FLAG_TRAPDOOR_OPEN 36 562 #define FLAG_PRINCESS_ROOM 37 563 #define FLAG_GET_THE_PRINCESS 38 564 #define FLAG_GAME_RESTART 39 565 #define FLAG_CORRIDORS 40 566 #define FLAG_GODS_STANCES 41 567 #define FLAG_END_OF_GAME 42 568 #define FLAG_FROM_INTRO 43 569 #define FLAG_STONE_THROWN 44 570 #define FLAG_USED_WATER 45 571 #define FLAG_OPEN_SHOP 46 572 #define FLAG_DRINKS_NUMBER 47 573 #define FLAG_COLLECTED_INGREDIENTS 48 574 #define FLAG_GUARD_ASKS_FOR_STUFF 49 575 #define FLAG_GUARD_ID_DELIVERED 50 576 #define FLAG_TRAVELAGENCY_OPEN 51 577 #define FLAG_MERCHANT_SLOGANS 52 578 #define FLAG_HOOKER_250_TIMES 53 579 #define FLAG_CORRECT_ANSWERS 54 580 #define FLAG_CHEAT_CODE_ENABLED 55 581 #define FLAG_RIDDLE_PRESENTED 56 582 #define FLAG_SYMBOLS_PUSHED 57 583 #define FLAG_MERCHANT_GIVENITEMS 58 584 #define FLAG_CORRECT_DOOR_CHOSEN 59 585 #define FLAG_SKELETON_RECOGNIZES 60 586 #define FLAG_PIGEON_DEAD 61 587 #define FLAG_RECIPE_TAKEN 62 589 const int kNumGameFlags = 63;
592 byte flags[kNumGameFlags];
594 GameState stateGame = INTRO;
597 int16 selectedInventoryItem = -1;
599 int libraryShelf = -1;
600 int selectedBookIndex = -1;
601 char bookLetter =
'\0';
615 delete[] conversationCurrentRoot;
616 conversationCurrentRoot =
nullptr;
620 memset(conversationCurrentRoot, 0xFF, 112);
621 for (
int i = 0; i < kNumGameFlags; i++)
623 flags[FLAG_FIRST_TIME_IN_SHOP] =
true;
624 inventoryItems.
clear();
625 stickersPerRoom.
clear();
626 roomExitChanges.
clear();
627 roomWalkBoxChanges.
clear();
628 roomHotSpotChanges.
clear();
629 spriteChanges.
clear();
632 selectedBookIndex = -1;
637 void clearBranches() {
638 for(
auto &entry : disabledBranches) {
640 if (resetEntry.data) {
641 delete[] resetEntry.data;
642 resetEntry.data =
nullptr;
646 disabledBranches.clear();
650 disabledBranches[entry.room].push_back(entry);
653 byte getFlag(
int flagIndex)
const {
654 if (flagIndex < 0 || flagIndex >= kNumGameFlags)
656 return flags[flagIndex];
659 bool getBoolFlag(
int flagIndex)
const {
660 return getFlag(flagIndex) != 0;
663 void setFlag(
int flagIndex, byte value) {
664 if (flagIndex < 0 || flagIndex >= kNumGameFlags)
666 flags[flagIndex] = value;
669 void addInventoryItem(
int id) {
673 void clearInventory() {
674 inventoryItems.
clear();
675 selectedInventoryItem = -1;
678 void removeInventoryItem(
int id) {
679 for (uint i = 0; i < inventoryItems.
size(); i++) {
680 if (inventoryItems[i] ==
id) {
685 if (selectedInventoryItem ==
id) {
686 if (inventoryItems.
size() > 0) {
687 selectedInventoryItem = inventoryItems[0];
689 selectedInventoryItem = -1;
694 bool hasInventoryItem(
int id)
const {
695 for (uint i = 0; i < inventoryItems.
size(); i++) {
696 if (inventoryItems[i] ==
id) {
704 byte *conversationCurrentRoot =
new byte[112];
706 int getCurrentRoot(byte room,
int npc)
const {
709 return (conversationCurrentRoot[room * 2 + npc] == 0xFF) ? -1 : conversationCurrentRoot[room * 2 + npc];
712 void setCurrentRoot(byte room,
int root,
int npc) {
715 if (root < 0 || root > 254) {
716 conversationCurrentRoot[room * 2 + npc] = 0xFF;
718 conversationCurrentRoot[room * 2 + npc] = (byte)root;
722 int findFirstBookIndex() {
723 for (uint i = 0; i < inventoryItems.
size(); i++) {
724 int x = inventoryItems[i];
725 if ((x >= 11) && (x <= 58))
731 int booksInInventory() {
732 int l = inventoryItems.
size();
734 for (
int i = 0; i < l; i++) {
735 int x = inventoryItems[i];
736 if ((x >= 11) && (x <= 58))
744 byte currentRoom = 0;
747 AlfredDirection alfredDir = ALFRED_DOWN;
virtual void setShakePos(int shakeXOffset, int shakeYOffset)=0
void clear(bool shrinkArray=0)
Definition: hashmap.h:431
void clear()
Definition: array.h:321
void push_back(const T &element)
Definition: array.h:181
Definition: atari-cursor.h:35
size_type size() const
Definition: array.h:316
bool contains(T x, T y) const
Definition: rect.h:246
T remove_at(size_type idx)
Definition: array.h:261