25 #include "macs2/character.h" 26 #include "macs2/events.h" 27 #include "macs2/gameobjects.h" 28 #include "macs2/macs2.h" 50 bool onRightSide =
false;
51 bool mouthAnimActive =
false;
57 int16 mouthAnimCounter = 0;
70 bool _pendingMapOpen =
false;
81 uint32 _bgAnimTickCounter = 0;
97 enum class SaveLoadSubMode {
102 SaveLoadSubMode _saveLoadSubMode = SaveLoadSubMode::None;
103 uint16 _saveLoadPageIndex = 0;
104 bool _saveConfirmArmed =
false;
105 bool _loadConfirmArmed =
false;
106 bool _helpButtonDisabled =
false;
107 uint16 _clickedButtonIndex = 0;
110 int _currentFadeValue = -1;
111 FadeMode _fadeMode = FadeMode::None;
112 bool _cursorSuppressedForFade =
false;
113 bool _cursorWasVisibleBeforeFade =
false;
118 uint16 _saveLoadButtonWidth = 0;
119 uint16 _saveLoadButtonHeight = 0;
126 uint16 _inventoryScrollOffset = 0;
128 static const uint16 kMaxSceneObjects = 0x200;
129 mutable uint16 _sortedObjectCount = 0;
130 mutable uint16 _sortedObjectIndices[kMaxSceneObjects + 1];
131 mutable Character *_characterByObjectIndex[kMaxSceneObjects + 1] = {};
133 void openOriginalSaveLoadPanel();
136 void closeOriginalSaveLoadPanel();
138 void drawDarkRectangle(uint16 x, uint16 y, uint16 width, uint16 height);
142 void beginFadeCursorSuppression();
148 void runInventoryPanelScriptIfPending(
bool excludeCloseButton);
190 void renderStringWithFont(uint16 x, uint16 y,
const Common::String &s,
const GlyphData *glyphs, uint16 numGlyphs);
194 void drawSpriteTransparent(
int shadingTableOffset, uint8 depthThreshold, uint16 scalingFactor,
195 int16 drawX, int16 drawY, uint16 srcWidth, uint16 srcHeight,
197 void drawSpriteScaled(
int shadingTableOffset, uint8 depthThreshold, int16 drawX, int16 drawY,
198 uint16 srcWidth, uint16 srcHeight,
const byte *srcPixels,
201 void drawSprite(int16 x, int16 y, uint16 width, uint16 height, byte *data,
Graphics::ManagedSurface &s,
bool mirrored,
bool useDepth =
false, uint8 depth = 0,
bool clipToGameArea =
false);
202 void drawSprite(int16 x, int16 y,
const Sprite &sprite,
Graphics::ManagedSurface &s,
bool mirrored,
bool useDepth =
false, uint8 depth = 0,
bool clipToGameArea =
false);
203 void drawSprite(int16 x, int16 y,
const GlyphData &glyph,
Graphics::ManagedSurface &s,
bool mirrored,
bool useDepth =
false, uint8 depth = 0,
bool clipToGameArea =
false);
204 void drawSprite(
const Common::Point &pos, uint16 width, uint16 height, byte *data,
Graphics::ManagedSurface &s,
bool mirrored,
bool useDepth =
false, uint8 depth = 0,
bool clipToGameArea =
false);
210 void sortObjectListByY()
const;
211 void buildSortedObjectList(
int low,
int high)
const;
215 int findInventoryItem(
const GameObject *item);
217 void applyPaletteWithFade(
const Graphics::Palette &sourcePalette,
int fadeValue);
224 ViewMode _currentMode = ViewMode::VM_GAME;
225 bool _paletteDirty =
true;
226 bool _isShowingTextBox =
false;
227 bool _isShowingDialoguePanel =
false;
228 bool _continueScriptAfterUI =
false;
230 uint16 _dialogueChoiceCount = 0;
235 bool _started =
false;
237 bool _autoclickActive =
false;
256 enum UiPanelState : uint16 {
258 kUiPanelActionBar = 1,
259 kUiPanelInventory = 2,
260 kUiPanelContainerInventory = 3,
263 UiPanelState _uiPanelState = kUiPanelNone;
268 enum PendingPanelRequest : uint16 {
269 kPanelRequestNone = 0,
270 kPanelRequestInventory = 1,
271 kPanelRequestContainerInventory = 2,
272 kPanelRequestSaveLoad = 3,
273 kPanelRequestSaveLoadActive = 4
275 PendingPanelRequest _pendingPanelRequest = kPanelRequestNone;
277 bool _uiBackgroundRestorePending =
false;
278 bool _isDialogueChoiceInputActive =
false;
279 Script::MouseMode _savedCursorMode = Script::MouseMode::Walk;
281 enum class InventoryButtonIndex {
294 enum class MainMenuButtonIndex {
307 uint16 _hoverAreaId = 0;
308 uint16 _hoverHotspotId = 0;
326 bool hasPersistentActionBar()
const;
327 bool shouldShowActionBar()
const;
328 void ensureActionBar();
330 int actionBarTopY()
const;
335 bool isHelpButtonDisabled()
const {
return _helpButtonDisabled; }
337 void restoreUiPaletteEntries();
339 void clearClickedButtonIndex() { _clickedButtonIndex = 0; }
343 void flushPendingCharacterDeletes();
344 void transferPickupTarget(
GameObject *targetObject);
345 void finishPanelCloseAfterRelease(UiPanelState closedFromState);
353 void setInventorySource(
GameObject *newInventorySource);
354 void refreshProtagonistInventoryAfterLoad(uint16 actorIndex);
355 void openInventory(
GameObject *newInventorySource);
357 void closeInventory();
359 bool isInventorySourceProtagonist()
const;
363 Character *getCharacterByIndex(uint16 index)
const;
364 void rebuildCharacterLookupTable()
const;
366 int getCharacterArrayIndex(
const Character *c)
const;
379 void draw()
override;
380 bool tick()
override;
387 void openScriptActionBar(
const Common::Point &position, Script::MouseMode restoreCursorMode);
389 void closeScriptActionBar(Script::MouseMode &outSavedCursorMode);
392 void layoutActionBarButtons();
394 void drawSceneUpdate();
395 void drawSceneFrame(
bool fullUpdate);
397 void handleTextBoxInput();
398 void dismissDialoguePanel();
399 bool handleDialogueChoiceClick(
int clickY,
int clickX);
401 void startFading(uint16 speed = 4);
403 void startFadeToBlack(uint16 speed = 4);
404 void startFadingWithSpeed(uint16 speed);
406 void instantSceneCut();
413 const BorderStyle &style,
bool fillCenter,
bool fillSides,
427 void triggerDialogueChoice(uint8 index);
430 void clearOverlayTextEntries();
431 void drawOverlayTextEntries();
Definition: managed_surface.h:51
Definition: messages.h:58
Definition: gameobjects.h:107
Definition: messages.h:75
Definition: messages.h:69
Definition: messages.h:63
Definition: character.h:33
constexpr int PALETTE_COUNT
Definition: palette.h:42
Definition: messages.h:42
Definition: messages.h:33
Simple class for handling a palette data.
Definition: palette.h:61
Definition: actionbar.h:31
Definition: actionbar.h:43