22 #ifndef NANCY_STATE_SCENE_H 23 #define NANCY_STATE_SCENE_H 25 #include "common/singleton.h" 26 #include "common/queue.h" 28 #include "engines/nancy/commontypes.h" 29 #include "engines/nancy/puzzledata.h" 31 #include "engines/nancy/action/actionmanager.h" 33 #include "engines/nancy/state/state.h" 34 #include "engines/nancy/state/scenestream.h" 36 #include "engines/nancy/ui/fullscreenimage.h" 37 #include "engines/nancy/ui/viewport.h" 38 #include "engines/nancy/ui/textbox.h" 39 #include "engines/nancy/ui/inventorybox.h" 40 #include "engines/nancy/ui/taskbar/inventorypopup.h" 41 #include "engines/nancy/ui/taskbar/notebookpopup.h" 42 #include "engines/nancy/ui/taskbar/cellphonepopup.h" 43 #include "engines/nancy/ui/taskbar/conversationpopup.h" 46 class SeekableReadStream;
54 struct SceneChangeDescription;
57 class ConversationSound;
58 class PlaySecondaryMovie;
75 class ViewportOrnaments;
76 class TextboxOrnaments;
77 class InventoryBoxOrnaments;
97 uint16 videoFormat = kLargeVideoFormat;
101 byte panningType = kPan360;
102 uint16 numberOfVideoFrames = 0;
103 uint16 degreesPerRotation = 18;
104 uint16 totalViewAngle = 0;
105 uint16 horizontalScrollDelta = 1;
106 uint16 verticalScrollDelta = 10;
107 uint16 horizontalEdgeSize = 15;
108 uint16 verticalEdgeSize = 15;
109 Time slowMoveTimeDelta = 400;
110 Time fastMoveTimeDelta = 66;
113 Math::Vector3d listenerPosition;
123 void process()
override;
124 void onStateEnter(
const NancyState::NancyState prevState)
override;
125 bool onStateExit(
const NancyState::NancyState nextState)
override;
128 void setDestroyOnExit() { _destroyOnExit =
true; }
132 void loadSecondChance() { _isLoadingSecondChance =
true; }
140 bool isRunningAd()
const {
return _isRunningAd; }
147 void addSceneVisit(uint16 sceneID) { _flags.sceneCounts.getOrCreateVal(sceneID)++; }
148 void pushScene(int16 itemID = -1);
152 void viewInventoryItem(int16 itemID);
153 void returnViewedInventoryItem();
154 void popScene(
bool inventory =
false);
155 int16 getPushedInvItemID()
const {
return _sceneState.pushedInvItemID; }
164 void startUIPrepScene(int16 uiType, int16 prepSceneID);
165 void finishUIPrepScene();
166 bool isUIPrepActive()
const {
return _uiPrep.active; }
167 uint16 getSceneCounts(int16 hours)
const {
168 return _flags.sceneCounts.contains(hours) ? _flags.sceneCounts[hours] : 0;
171 void setPlayerTime(
Time time, byte relative);
172 Time getPlayerTime()
const {
return _timers.playerTime; }
173 Time getTimerTime()
const {
return _timers.timerIsActive ? _timers.timerTime : 0; }
174 uint getPlayerTimeMinutes()
const;
175 byte getPlayerTOD()
const;
178 void requestSleep() { _timers.sleepRequested =
true; }
179 void setPlayerDay(int16 day);
181 void addItemToInventory(int16
id);
182 void removeItemFromInventory(int16
id,
bool pickUp =
true);
187 void addItemToCharacterInventory(uint characterIndex, int16
id);
188 void removeItemFromCharacterInventory(uint characterIndex, int16
id,
bool pickUp =
false);
189 byte hasCharacterItem(uint characterIndex, int16
id);
190 void setCharacterItemDisabledState(uint characterIndex, int16
id, byte state);
194 void giveItemToCharacter(uint characterIndex, int16
id,
bool intoHand,
bool forceIntoHand);
196 int32 getCharacterUIResource(uint characterIndex, uint index);
197 int16 getHeldItem()
const {
return _flags.heldItem; }
198 void setHeldItem(int16
id);
199 void setNoHeldItem();
200 byte hasItem(int16
id)
const;
201 byte getItemDisabledState(int16
id)
const {
return _flags.disabledItems[id]; }
202 void setItemDisabledState(int16
id, byte state) {
203 if ((uint16)
id < _flags.disabledItems.size())
204 _flags.disabledItems[
id] = state;
209 void installInventorySoundOverride(byte command,
const SoundDescription &sound,
210 const Common::String &caption, uint16 itemID, byte characterIndex = kPlayerCharacterActive);
211 void playItemCantSound(int16 itemID = -1,
bool notHoldingSound =
false);
213 void setEventFlag(int16 label, byte flag);
215 bool getEventFlag(int16 label, byte flag)
const;
219 bool isSoftwareTimerActive(uint16 index)
const;
220 int32 getSoftwareTimerState(uint16 index)
const;
221 uint32 getSoftwareTimerElapsed(uint16 index)
const;
225 int32 getSoftwareTimerPercentLeft(uint16 index)
const;
233 int32 getUIResource(uint index, byte characterIndex = kPlayerCharacterActive);
234 void setUIResource(uint index, int32 value, byte characterIndex = kPlayerCharacterActive);
236 void setLogicCondition(int16 label, byte flag);
237 bool getLogicCondition(int16 label, byte flag)
const;
238 void clearLogicConditions();
239 Time getLogicConditionTimestamp(int16 label)
const {
240 return _flags.logicConditions[label].timestamp;
243 void setDifficulty(uint difficulty) { _difficulty = difficulty; }
244 uint16 getDifficulty()
const {
return _difficulty; }
246 byte getHintsRemaining()
const {
return _hintsRemaining[_difficulty]; }
247 void useHint(uint16 characterID, uint16 hintID);
249 void requestStateChange(NancyState::NancyState state) { _gameStateRequested = state; }
250 void resetStateToInit() { _state = kInit; }
252 void resetAndStartTimer() { _timers.timerIsActive =
true; _timers.timerTime = 0; }
253 void stopTimer() { _timers.timerIsActive =
false; _timers.timerTime = 0; }
255 Time getMovementTimeDelta(
bool fast)
const {
return fast ? _sceneState.summary.fastMoveTimeDelta : _sceneState.summary.slowMoveTimeDelta; }
260 void setPlayerScrolling(
bool enabled);
261 bool getPlayerScrolling()
const;
263 void registerGraphics();
269 bool changePlayerCharacter(uint characterIndex);
273 void setPlayerCharacterDesign(uint characterIndex,
const Common::String &designName);
295 Action::ActionManager &getActionManager() {
return _streams.getRunning() ? _streams.getRunning()->getActionManager() : _actionManager; }
300 void processMainStream();
301 double getFrameSeconds()
const {
return _frameSeconds; }
303 SceneChangeDescription &getSceneInfo() {
return _streams.getRunning() ? _streams.getRunning()->getSceneInfo() : _sceneState.currentScene; }
310 const SceneSummary &getSceneSummary()
const {
return _sceneState.summary; }
316 void notifyRandomMovieARLoaded() { _hadRandomMovieARThisScene =
true; }
323 void beginLightning(int16 distance, uint16 pulseTime, int16 rgbPercent);
327 #ifdef ENABLE_NANCY_V4 331 void changeScene(
const Common::String &sceneName, uint16 frameID);
334 void onScriptedUILoaded();
339 bool receiveMainSceneMessage(
const Script::Message &message,
bool &wasTaken);
343 void specialEffect(byte type, uint16 fadeToBlackTime, uint16 frameTime);
344 void specialEffect(byte type, uint16 totalTime, uint16 fadeToBlackTime,
Common::Rect rect);
356 State getState()
const {
return _state; }
357 void setState(State state) { _state = state; }
361 void closeActivePopups();
368 bool timerIsActive =
false;
370 Time playerTimeNextMinute;
371 bool sleepRequested =
false;
381 void load(
bool fromSaveFile =
false);
382 #ifdef ENABLE_NANCY_V4 383 void loadScriptedScene(
bool fromSaveFile);
393 void tickSoftwareTimers(uint32 deltaMs);
398 void updateEndOfDay();
399 void advanceDayValue();
406 int16 getCharacterHeldItem(uint characterIndex);
407 void setCharacterHeldItem(uint characterIndex, int16
id);
408 void returnCharacterHeldItem(uint characterIndex);
413 void playPlayerCantSound(int16 itemID);
415 void initStaticData();
419 void clearSceneData(
bool nextIsNoArt =
false);
420 void clearPuzzleData();
423 int16 eventFlagToIndex(int16 label)
const;
427 bool applyPlayerCharacter(uint characterIndex);
432 void storeCharacterInventory(uint characterIndex);
433 void loadCharacterInventory(uint characterIndex);
434 void storeCharacterResources(uint characterIndex);
435 void loadCharacterResources(uint characterIndex);
439 void inheritBrotherProgress(uint characterIndex);
446 bool isScenePushed =
false;
448 int16 pushedInvItemID = -1;
449 bool isInvScenePushed =
false;
465 int16 primaryVideoResponsePicked = -1;
468 struct InventorySoundOverride {
469 bool isDefault =
false;
490 Time _buttonPressActivationTime;
494 int _pendingTaskbarButton;
506 SceneState _sceneState;
510 int16 _lastHintCharacter;
512 NancyState::NancyState _gameStateRequested;
533 #ifdef ENABLE_NANCY_V4 536 bool _isScriptedUIReady =
false;
547 double _frameSeconds = 0.0;
553 bool _hadRandomMovieARThisScene =
false;
556 bool _escHeld =
false;
559 bool _hasSkippedMovie =
false;
561 bool _isLoadingSecondChance =
false;
576 uint32 startMillis = 0;
582 #define NancySceneState Nancy::State::Scene::instance() 587 #endif // NANCY_STATE_SCENE_H
Definition: managed_surface.h:51
Definition: viewport.h:42
Definition: commontypes.h:186
Definition: puzzledata.h:38
Definition: inventorybox.h:42
Definition: secondarymovie.h:47
Definition: conversation.h:41
Definition: scenecontext.h:52
Definition: serializer.h:80
Definition: actionmanager.h:48
Definition: soundequalizerpuzzle.h:27
Definition: renderobject.h:36
Definition: ornaments.h:30
Definition: lightning.h:32
Definition: viewportfader.h:33
Definition: algorithm.h:29
Definition: commontypes.h:306
Definition: puzzledata.h:384
Definition: puzzledata.h:374
Definition: ornaments.h:38
Definition: fullscreenimage.h:30
Definition: ornaments.h:46
Definition: scenestream.h:152
Definition: commontypes.h:201
Definition: hash-str.h:49
Definition: hash-str.h:45
Definition: actionmanager.h:32
Definition: singleton.h:42