22#ifndef HOLLYWOOD_MONSTERS_SCENES_PLAYABLE_PLAYABLE_SCENE_H
23#define HOLLYWOOD_MONSTERS_SCENES_PLAYABLE_PLAYABLE_SCENE_H
25#include "common/array.h"
26#include "common/random.h"
27#include "common/str.h"
28#include "common/types.h"
29#include "graphics/managed_surface.h"
31#include "hollywood/monsters/gameplay/dialogue_menu.h"
32#include "hollywood/monsters/gameplay/game_loop.h"
33#include "hollywood/monsters/gameplay/panel_art.h"
34#include "hollywood/monsters/graphics.h"
35#include "hollywood/monsters/music.h"
36#include "hollywood/resource.h"
37#include "hollywood/monsters/scenes/animation_channels.h"
38#include "hollywood/monsters/scenes/animation_layers.h"
39#include "hollywood/monsters/scenes/animation_player.h"
40#include "hollywood/monsters/scenes/playable/action_overlay.h"
41#include "hollywood/monsters/scenes/playable/action_overlay_player.h"
42#include "hollywood/monsters/scenes/playable/actor_path_controller.h"
43#include "hollywood/monsters/scenes/playable/actor_types.h"
44#include "hollywood/monsters/scenes/playable/ambient_audio.h"
45#include "hollywood/monsters/scenes/playable/scene_config.h"
46#include "hollywood/monsters/scenes/playable/scene_surface_state.h"
47#include "hollywood/monsters/scenes/playable/speech_controller.h"
48#include "hollywood/monsters/scenes/scene_data.h"
49#include "hollywood/monsters/scenes/scene_resources.h"
50#include "hollywood/scene_text_store.h"
51#include "hollywood/monsters/scenes/speech_overlay.h"
60class InventoryMediaPlayer;
97 template<
class FrameTarget>
100 finishMediaStep(_scene.playAnimationFrames(target, range));
104 template<
class FrameTarget>
107 finishMediaStep(_scene.playAndPresentAnimationFrames(target, range));
111 template<
class FrameTarget>
115 finishMediaStep(_scene.playAndPresentAnimationTransition(target, transition));
121 uint16 descriptorCount,
const byte *frameMap, uint frameMapSize,
125 bool clearAtEnd =
true) {
126 return resourceLayerFrames(layerId, chunkIndex, descriptorCount,
127 nullptr, 0, range, clearAtEnd);
132 uint16 descriptorCount,
const byte (&frameMap)[size],
134 return resourceLayerFrames(layerId, chunkIndex, descriptorCount,
135 frameMap, size, range, clearAtEnd);
143 const byte *frameMap, uint frameMapSize, uint32 frameMillis);
147 bool cancelOnSkip =
false);
152 BlockingSequence &primarySpeech(uint16 rowIndex,
byte frameIndex, uint16 centerX,
153 uint16 topY,
byte red,
byte green,
byte blue);
172 void finishMediaStep(
bool completed);
180 enum TransitionFrameMode {
181 kIndependentTransitionFrames,
182 kCumulativeTransitionFrames
188 virtual void drawFrame(
byte frame) = 0;
191 template<
class Callback>
195 _callback(callback) {
198 void drawFrame(
byte frame)
override { _callback(frame); }
201 const Callback &_callback;
206 kPaletteMaskUsedBytes = 0x100,
207 kScenePaletteRegionCount = 21,
208 kScenePaletteRegionBoundaryCandidateCount = 3,
209 kScenePaletteRegionRouteStepCount = 19,
210 kSceneRouteBoundaryPointCount = kScenePaletteRegionCount * kScenePaletteRegionCount * kScenePaletteRegionBoundaryCandidateCount,
211 kSceneRouteStepCount = kScenePaletteRegionCount * kScenePaletteRegionCount * kScenePaletteRegionRouteStepCount,
212 kResource000TableByteCount = 400,
213 kAmbientSoundSlotCount = 3,
214 kActorFacingCount = 6,
215 kActorBankSegmentCount = 2 * (kActorFacingCount + 1),
216 kActorCelsPerFacing = 13,
217 kActiveActorDescriptorSize = 28,
218 kActiveActorFacingRunStride = 160000,
219 kSecondaryActorDescriptorSize = 16,
220 kSecondaryActorFramesPerFacing = 5,
221 kSecondaryActorFacingRunStride = 16000,
222 kActorPaletteFirstColor = 0xd0,
223 kActorPaletteColorCount = 0x19,
224 kActorPaletteBaseBytes = kActorPaletteColorCount * 3,
225 kActorPaletteAdjustmentClassCount = (kRouteBoundaryPoints - kPaletteAdjustTable) / 2,
226 kActorPaletteBytes = 0x90,
227 kStage003DecodeKeySize = 0x141,
228 kSpeechCueDescriptorTableSize = 20000,
229 kStage003SmallRowSize = 0x29,
230 kStage003LargeRowSize = 0x141,
231 kStage003LargeRowBaseIndex = 500,
232 kOriginalSpeechLineHeight = 20
237 const char *resourceArchiveName()
const;
238 uint sceneInitialRequiredChunkCount()
const;
239 uint sceneArenaFirstChunk()
const;
240 uint sceneArenaLastChunk()
const;
241 uint sceneStageIndex()
const;
242 const char *sceneDebugName()
const;
243 uint16 sceneViewportXOffset()
const;
244 uint16 sceneViewportMinXOffset()
const;
245 uint16 sceneViewportMaxXOffset()
const;
246 byte inventoryOwnerIndex()
const;
247 void initializeInventoryOwnerState();
248 uint resource000ActorPaletteTableEntry()
const;
249 uint32 inventoryActionTableExtraOffset()
const;
250 uint resource003InventoryRowsOffsetIndex()
const;
251 uint32 speechCueDescriptorTableOffset()
const;
252 byte walkablePaletteMaxRegion()
const;
253 const char *musicArchiveName()
const;
254 const char *soundBank0ArchiveName()
const;
255 bool shouldLoadInventoryActionTables()
const;
256 bool shouldLoadActorDepthTables()
const;
257 bool usesActorDepthTest()
const;
258 bool isMainFlowStateInScene(uint16 stateId)
const;
260 bool didLeaveSceneAfterLoop()
const;
263 virtual uint resource000ActorBankTableEntry()
const;
264 virtual const byte *actorPathStepDeltaTable()
const;
265 virtual uint actorPathStepDeltaTableSize()
const;
267 virtual uint framebufferResourceChunkIndex()
const;
268 virtual int alternatePaletteResourceChunkIndex()
const;
269 virtual bool isAlternatePaletteResourceActive()
const;
271 virtual int replacementFillRunsResourceChunkIndex()
const;
272 virtual int replacementPaletteMaskResourceChunkIndex()
const;
273 virtual bool shouldConvertSavedFramebufferFF()
const;
274 virtual bool shouldLoadArenaChunk(uint index)
const;
276 virtual void runExitSideEffectsAfterLoop();
278 virtual bool shouldPresentPreviewBeforeEntrySequence()
const;
280 virtual bool shouldUseActorDepthTest(
int actorWorldX,
int actorWorldY)
const;
283 virtual void initializeCustomPreviewState();
284 virtual void drawCustomComposite(
bool drawActiveActor,
byte activeFacing,
byte activeCel,
int activeWorldX,
int activeWorldY,
285 bool drawSecondaryActor,
byte secondaryFacing,
byte secondaryFrame,
int secondaryWorldX,
int secondaryWorldY,
286 byte actorDrawOrderMode);
289 virtual void prepareCustomComposite(
bool drawActors,
byte activeFacing,
int activeWorldX,
290 int activeWorldY,
byte actorDrawOrderMode);
291 virtual void drawCustomBackgroundComposite(
int activeWorldX,
int activeWorldY);
293 virtual void drawCustomActorForegroundComposite(
int activeWorldX,
int activeWorldY,
294 byte actorDrawOrderMode);
295 virtual void drawCustomForegroundComposite(
int activeWorldX,
int activeWorldY);
296 virtual bool shouldDrawSecondaryActorInPlayableComposite()
const;
297 virtual bool shouldApplyGameplayPanelObjectPalette()
const;
298 virtual void runCustomEntrySequence();
299 virtual void prepareCustomGameplayLoop();
300 virtual void advanceCustomGameplayLoop(uint32 delta);
302 virtual void advancePrimarySpeechAnimation(uint32 delta);
303 virtual void advanceAmbientAudio(uint32 delta);
305 virtual void realtimeSpeechEnded(
byte speechId,
bool completed);
307 virtual bool dispatchCustomSceneAction(uint16 handlerId);
309 virtual bool shouldPlayGameplayClickPath()
const;
311 virtual byte customizeSceneActionFacing(uint16 handlerId,
byte calculatedFacing)
const;
313 virtual bool adjustCustomWalkTargetToFloorMask(
int &targetX,
int &targetY)
const;
315 virtual void prepareCustomActorPathRoute(
int startX,
int startY);
316 bool customizeRouteSegment(
byte currentRegion,
byte nextRegion,
const ActorPathBuildState &state,
317 const ScenePoint &boundary,
int &requestedFacing,
bool &restoredStepDeltas)
override;
318 bool customizeRouteFinal(
byte currentRegion,
byte targetRegion,
const ActorPathBuildState &state,
319 int targetX,
int targetY,
int &requestedFacing,
bool &restoredStepDeltas)
override;
321 virtual bool applyCustomSceneStateToHotspotsAndPatches(
byte selector);
322 virtual bool shouldAnimatePrimarySpeechLine()
const;
323 virtual void setPrimaryLeftSpeechFrame(
byte frameIndex);
325 void handleAnimationFrameHook(
byte hookId, uint frame)
override;
327 virtual void advanceTransitionAnimation(uint32 delta);
328 virtual void advanceFullscreenAnimation(uint32 delta);
332 AmbientAudioProfile createRandomAmbientAudioProfile(
byte soundFirstCueId,
byte soundCueCount,
333 byte soundVolumePercent,
byte soundProbabilityModulus,
byte musicFirstCueId,
334 byte musicCueCount,
byte musicVolumePercent,
byte musicProbabilityModulus)
const;
336 byte musicCueCount = 5,
byte musicProbabilityModulus = 50)
const;
337 bool playResidentSoundEffect(
byte soundEffectId,
byte volumePercent = 100);
338 bool playActiveActorFootstep();
341 bool hasSavedActiveActorPoseForCurrentState()
const;
342 void restoreActiveActorPoseFromGameState();
343 void syncActiveActorPoseToGameState();
344 void setActiveActorPose(
int worldX,
int worldY,
byte facing,
byte cel = 0);
347 void initializeFramebuffers();
348 uint framebufferByteCount()
const;
351 void copyBaseFramebufferToSceneFramebuffer();
352 void restoreBaseFramebufferFromOriginal();
353 bool isFramebufferOffsetValid(uint offset)
const;
354 byte savedFramebufferPixelAt(uint offset)
const;
361 void captureActorPaletteBase();
363 bool loadStage003SceneRows();
367 bool loadArenaChunk(uint index);
368 bool initializeActorDepthTables();
369 void updateActorDepthThresholds(
byte actorDrawOrderMode);
370 void expandFillRunsToSavedFramebuffer();
371 bool initializeScenePathTables();
374 void initializePreviewState();
375 void initializeDefaultPreviewState();
376 void drawPreviewComposite();
377 void drawCutsceneComposite(
bool drawActiveActor,
byte activeFacing,
byte activeCel,
int activeWorldX,
int activeWorldY,
378 bool drawSecondaryActor,
byte secondaryFacing,
byte secondaryFrame,
int secondaryWorldX,
int secondaryWorldY,
379 byte actorDrawOrderMode = 0);
380 void drawPlayableComposite();
381 void drawActiveAndSecondaryActorFrames(
bool drawActiveActor,
byte activeFacing,
byte activeCel,
int activeWorldX,
int activeWorldY,
382 bool drawSecondaryActor,
byte secondaryFacing,
byte secondaryFrame,
int secondaryWorldX,
int secondaryWorldY,
383 int minimumYExclusive);
384 void drawActiveActorFrame(
byte facing,
byte cel,
int worldX,
int worldY,
int minimumYExclusive);
385 void updateActorPaletteForWorldPoint(
int worldX,
int worldY);
386 int drawSecondaryActorFrame(
byte facing,
byte frame,
int worldX,
int worldY);
387 int drawActorRun(
const Common::Array<byte> &runStreams, uint cursor, uint runBase, uint runCount,
388 int spriteX,
int spriteY,
int minimumYExclusive,
int actorWorldX,
int actorWorldY, uint *nextCursor =
nullptr);
389 int drawActorPaletteRemapRun(
const Common::Array<byte> &runStreams, uint cursor, uint runBase, uint runCount,
390 int spriteX,
int spriteY,
int minimumYExclusive,
int actorWorldX,
int actorWorldY);
391 void runEntryCutscene();
392 void runEntryPath(
int startX,
int startY,
byte startFacing,
int targetX,
int targetY);
395 bool runBasicGameplayLoop();
398 uint16 viewportXOffset()
const override;
399 uint16 viewportYOffset()
const override;
400 void prepareGameplayLoop()
override;
401 void advanceGameplayLoop(uint32 delta)
override;
402 void drawGameplayFrame()
override;
404 void invalidatePresentationPalette()
override;
406 Common::Path optionsMenuSoundBank0ArchiveName()
const override;
407 bool optionsMenuSpeechPreviewSampleId(uint16 &sampleId)
const override;
408 void suspendAudioForOptionsMenu()
override;
409 void refreshTranslatedText()
override;
410 bool shouldExitGameplayLoop()
const override;
411 Common::String inventoryItemName(
byte owner,
byte itemId)
const override;
412 void beginSharedInventorySpeechLine(uint16 rowIndex,
byte frameIndex)
override;
413 byte randomSharedInventorySpeechFrame(
byte maxFrameIndex)
override;
414 void playSharedInventorySound(
byte sampleId)
override;
415 void showTravelScreenViewer()
override;
416 bool showInventoryMedia(InventoryMediaId mediaId)
override;
417 bool playSueTapeRecording()
override;
422 void updateAmbientAudioAndMusicCues(uint32 delta);
423 void resetAmbientAudioState();
424 void ensureAmbientSoundCuePlaying(
byte slotIndex, uint16 cueId,
byte volumePercent);
425 void stopAmbientSoundCues();
430 void advanceSecondaryActorSpeechAnimation(uint32 delta);
431 void advanceSecondaryActorSpeechFrame();
432 void advancePrimaryLeftSpeechFrame();
433 void advancePrimaryDialogueSpeechFrame(uint32 delta);
435 bool startRealtimePrimarySpeechLine(uint16 rowIndex,
byte frameIndex, uint16 centerX,
436 uint16 topY,
byte red,
byte green,
byte blue,
byte animationGroup,
byte speechId,
437 byte volumePercent = 0xff);
438 bool startRealtimeSecondarySpeechLine(uint16 rowIndex,
byte frameIndex,
byte speechId);
439 bool waitForRealtimeSpeech(
bool allowSkip =
true);
440 void advanceRealtimeSpeech(uint32 delta);
441 void stopRealtimeSpeech();
442 bool isRealtimeSpeechActive()
const {
return _realtimeSpeechActive; }
443 bool isRealtimeSecondarySpeechActive()
const {
444 return _realtimeSpeechActive && !_realtimeSpeechPrimary;
446 byte realtimeSpeechId()
const {
return _realtimeSpeechId; }
447 void startRealtimeSpeechPart();
448 void finishRealtimeSpeech(
bool completed);
451 void processSceneActionClick(
const GameplayLoopCursorState &state);
452 void processSceneRelationClick(
const GameplayLoopCursorState &state,
byte itemId);
453 bool gameplayActionInputBlocked()
const;
454 void runGameplayAction(uint16 handlerId);
455 bool dispatchGenericInventoryAction(
const GameplayLoopCursorState &state);
456 void dispatchSceneAction(uint16 handlerId);
457 bool dispatchGenericSceneAction(uint16 handlerId);
460 bool walkActiveActorTo(
int targetX,
int targetY,
byte finalFacing,
byte finalCel,
bool cancelOnSkip =
false);
461 void startConcurrentActorPath(
int targetX,
int targetY,
byte finalFacing,
byte finalCel,
462 uint32 frameMillis,
bool snapToTargetIfNoPath =
false);
464 bool startPlayerDirectedActorPath(
int targetX,
int targetY,
byte finalFacing,
465 byte finalCel, uint16 actionHandlerId);
466 void finishConcurrentActorPath(
bool allowSkip =
false);
467 void cancelConcurrentActorPath();
468 bool concurrentActorPathActive()
const {
return _concurrentActorPathActive; }
469 bool adjustWalkTargetToFloorMask(
int &targetX,
int &targetY)
const;
470 void queueActorPathWithPaletteRegionRouting(
int startX,
int startY,
int targetX,
int targetY,
471 byte finalFacing,
byte finalCel);
472 byte paletteRegionAt(
int x,
int y)
const override;
473 byte walkableMaskAt(
int x,
int y)
const;
474 void resetActorPathStepDeltas();
475 byte calculateFacingTowardPoint(
int fromX,
int fromY,
int toX,
int toY)
const;
479 void applySceneStateToHotspotsAndPatches(
byte selector);
480 void rebuildWalkablePaletteMask();
482 bool unlockTravelDestination(
byte destinationId);
483 void requestTravelScreenSelection(
byte currentChapterId);
486 bool hasInventoryItem(
byte itemId)
const;
487 void addInventoryItem(
byte itemId);
488 void removeInventoryItem(
byte itemId);
491 Common::String dialogueMenuText(
byte stageId,
byte textRowId)
const override;
492 void advanceDialogueMenu(uint32 delta)
override;
493 void drawDialogueMenuFrame()
override;
494 void presentDialogueMenuFrame(
const DialogueMenuState &state)
override;
498 void runActorReplacement(uint chunkIndex, uint descriptorCount,
const byte *frameMap, uint frameMapSize,
500 void runActorReplacement(
const ActionOverlaySpec &spec);
501 void runSceneOverlay(uint chunkIndex, uint descriptorCount,
const byte *frameMap,
502 uint frameMapSize, uint32 frameMillis);
503 void runSceneOverlay(
const ActionOverlaySpec &spec);
506 virtual byte primarySpeechAnimationBaseFrame(
byte animationGroup)
const;
507 virtual byte primarySpeechAnimationInitialFrame(
byte animationGroup,
byte baseFrame)
const;
509 virtual byte primarySpeechAnimationFrameCount(
byte animationGroup)
const;
511 virtual uint32 primarySpeechAnimationFrameMillis(
byte animationGroup)
const;
513 virtual byte primarySpeechVolumePercent(
byte animationGroup)
const;
514 virtual void setPrimarySpeechAnimationFrame(
byte animationGroup,
byte frameIndex);
515 virtual void primarySpeechAnimationStarted(
byte animationGroup,
byte baseFrame);
516 virtual void primarySpeechAnimationRestored(
byte animationGroup,
byte baseFrame);
520 bool waitSceneMillis(uint32 millis,
bool allowSkip =
true);
523 void resetViewportFromScene();
524 void centerViewportOnActor(
int actorWorldX);
525 void advanceViewportScroll(uint32 delta);
528 void clearSpeechOverlay();
529 void clearAllSpeechOverlays();
530 void drawSpeechOverlay();
533 void drawMappedSpriteFrame(uint chunkIndex, uint descriptorCount,
const byte *frameMap, uint frameMapSize,
byte frameIndex);
534 void restoreResourceSpriteLayerBackground(
const ResourceSpriteLayer &layer,
const Graphics::Surface &background);
535 void drawResourceSpriteLayer(
const ResourceSpriteLayer &layer);
536 void restoreSceneLayerBackground(uint layerId,
const Graphics::Surface &background);
537 void drawSceneLayer(uint layerId);
538 void drawLayerStack(SceneAnimationStratum stratum);
539 void drawActionOverlayAtStratum(SceneAnimationStratum stratum);
540 void drawActionOverlayLayer();
541 template<
class FrameTarget>
542 bool playAnimationFrames(FrameTarget &target,
const AnimationFrameRange &range) {
543 return _animationPlayer.play(target, range);
545 template<
class FrameTarget>
546 bool playAndPresentAnimationFrames(FrameTarget &target,
const AnimationFrameRange &range) {
547 return _animationPlayer.playAndPresent(target, range);
549 bool playAnimationFrames(uint layerId,
const AnimationFrameRange &range) {
550 if (!_sceneLayers.hasLayer(layerId))
552 return playAnimationFrames(_sceneLayers.layer(layerId), range);
554 bool playAndPresentAnimationFrames(uint layerId,
const AnimationFrameRange &range) {
555 if (!_sceneLayers.hasLayer(layerId))
557 return playAndPresentAnimationFrames(_sceneLayers.layer(layerId), range);
559 template<
class FrameTarget>
560 bool playAnimationTransition(FrameTarget &target,
const AnimationTransition &transition) {
561 return _animationPlayer.transition(target, transition);
563 template<
class FrameTarget>
564 bool playAndPresentAnimationTransition(FrameTarget &target,
const AnimationTransition &transition) {
565 return _animationPlayer.transitionAndPresent(target, transition);
567 bool playAnimationTransition(uint layerId,
const AnimationTransition &transition) {
568 if (!_sceneLayers.hasLayer(layerId))
570 return playAnimationTransition(_sceneLayers.layer(layerId), transition);
572 bool playAndPresentAnimationTransition(uint layerId,
573 const AnimationTransition &transition) {
574 if (!_sceneLayers.hasLayer(layerId))
576 return playAndPresentAnimationTransition(_sceneLayers.layer(layerId), transition);
578 bool playResourceLayerSequence(uint layerId, uint chunkIndex, uint16 descriptorCount,
579 const byte *frameMap, uint frameMapSize,
const AnimationFrameRange &range,
580 bool clearAtEnd =
true);
581 bool playResourceLayerSequence(uint layerId, uint chunkIndex, uint16 descriptorCount,
582 const AnimationFrameRange &range,
bool clearAtEnd =
true) {
583 return playResourceLayerSequence(layerId, chunkIndex, descriptorCount,
584 nullptr, 0, range, clearAtEnd);
587 bool playResourceLayerSequence(uint layerId, uint chunkIndex, uint16 descriptorCount,
588 const byte (&frameMap)[size],
const AnimationFrameRange &range,
589 bool clearAtEnd =
true) {
590 return playResourceLayerSequence(layerId, chunkIndex, descriptorCount,
591 frameMap, size, range, clearAtEnd);
593 void clearSceneLayer(uint layerId);
596 void drawClipFrameDeltaFromResource(
const Common::Array<byte> &resource, uint32 frameTableOffset,
597 uint32 chunkSize, uint tableEntryCount,
byte frameIndex);
598 void drawClipFrameDelta(uint chunkIndex, uint tableEntryCount,
byte frameIndex);
599 void playDeltaClip(uint chunkIndex, uint tableEntryCount, uint frameCount, uint32 frameMillis,
600 uint firstFrame = 0);
602 bool playTransitionFrames(TransitionFrameRenderer &renderer,
byte firstFrame,
603 byte lastFrame, uint32 frameMillis, TransitionFrameMode mode,
bool allowSkip =
true);
604 template<
class Callback>
605 bool playTransitionFrames(
const Callback &drawFrame,
byte firstFrame,
byte lastFrame,
606 uint32 frameMillis, TransitionFrameMode mode,
bool allowSkip =
true) {
607 TransitionFrameCallbackRenderer<Callback> renderer(drawFrame);
608 return playTransitionFrames(
static_cast<TransitionFrameRenderer &
>(renderer),
609 firstFrame, lastFrame, frameMillis, mode, allowSkip);
612 bool waitDeltaClipFrameMillis(uint32 millis);
614 bool waitFullscreenAnimationFrame(uint32 millis,
bool allowSkip);
618 uint frameCount, uint32 frameMillis);
619 bool fadePaletteFromBlack();
620 bool fadePaletteToBlack();
623 bool animationPlaybackShouldStop()
const override;
624 void presentAnimationFrame()
override;
625 bool waitForAnimationFrame(uint32 millis,
bool allowSkip)
override;
626 bool consumeAnimationFastForwardRequest()
override;
627 void handleAnimationFrameEvent(
const AnimationFrameEvent &event, uint frame)
override;
632 void beginSecondarySpeechLine(uint16 rowIndex,
byte frameIndex);
633 bool startSecondarySpeechLine(uint16 rowIndex,
byte frameIndex,
bool positional =
true);
634 void beginStaticSecondarySpeechLine(uint16 rowIndex,
byte frameIndex);
635 void beginPrimarySpeechLine(uint16 rowIndex,
byte frameIndex, uint16 centerX, uint16 topY,
636 byte red,
byte green,
byte blue);
637 void beginPrimarySpeechLineWithAnimationGroup(uint16 rowIndex,
byte frameIndex, uint16 centerX, uint16 topY,
638 byte red,
byte green,
byte blue,
byte animationGroup);
639 void beginPrimaryLeftSpeechLine(uint16 rowIndex,
byte frameIndex);
640 void runSpeechLine(SpeechOverlay &overlay, uint16 rowIndex,
byte frameIndex, uint16 centerX, uint16 topY,
641 byte colorIndex,
bool useRequestedTop,
bool animatePrimaryLeft,
bool animatePrimaryDialogue,
642 byte primaryAnimationGroup = 0xff);
643 void runSpeechCue(SpeechOverlay &overlay, uint16 textRecordId,
byte continuationCount, uint16 voiceSampleId,
644 uint16 centerX, uint16 topY,
byte colorIndex,
bool useRequestedTop,
bool animatePrimaryLeft,
645 bool animatePrimaryDialogue,
byte primaryAnimationGroup = 0xff);
646 bool getStage003Cue(uint16 rowIndex,
byte frameIndex, uint16 &textRecordId,
byte &continuationCount,
647 uint16 &voiceSampleId)
const;
648 bool getStaticSpeechCue(uint16 rowIndex,
byte frameIndex, uint16 &textRecordId,
byte &continuationCount,
649 uint16 &voiceSampleId)
const;
651 Common::String getResource003LargeTextRecord(uint16 recordId)
const;
652 void calculateSpeechOverlayBounds(SpeechOverlay &overlay,
int centerX,
int topY,
bool useRequestedTop,
654 void calculateSecondarySpeechBounds(
int actorWorldX,
int actorWorldY);
655 bool waitForSpeechOrDelay(uint32 fallbackMillis,
bool animatePrimaryLeft);
656 bool consumeStepAdvanceRequest();
657 bool runSueTapeSpeechLine(InventoryMediaPlayer &media, uint16 rowIndex,
byte frameIndex,
658 byte red,
byte green,
byte blue,
byte &animationFrame, uint32 &animationMillis);
659 bool waitForFullscreenMediaDismissal();
660 bool pollFullscreenMediaEvents(
bool &dismissed);
661 void installFullscreenInventoryMedia(
const InventoryMediaPlayer &media,
667 void setPaletteEntry6Bit(
byte colorIndex,
byte red,
byte green,
byte blue);
668 byte paletteEntryComponent6Bit(
byte colorIndex, uint component)
const;
669 void applyGameplayPanelPalette();
672 void drawGameplayPanel(
Graphics::Surface &surface,
const GameplayPanelState &panelState);
673 void drawVerbPanel(
Graphics::Surface &surface,
const GameplayPanelState &panelState);
674 void drawInventoryPanel(
Graphics::Surface &surface,
const GameplayPanelState &panelState);
675 void presentFrame(
const SceneHoverCaption *hoverCaption =
nullptr,
676 const GameplayPanelState *panelState =
nullptr,
const DialogueMenuState *dialogueMenuState =
nullptr);
680 virtual bool pollEvents(
bool allowSkip);
683 HollywoodEngine *_vm;
684 PlayableSceneConfig _config;
685 uint16 _sceneStateId;
691 SceneResources _resources;
692 ResourceChunkTable &_sceneChunkTable;
693 uint32 (&_resourceChunkOffsets)[kResourceChunkCount];
698 SceneSurfaceState _surfaceState;
716 Palette6Bit &_displayPalette;
727 SceneTextStore _textStore;
732 ActorPathController _pathController;
739 GameplayPanelArt _panelArt;
740 SceneHotspotTable _hotspots;
741 SoundBank0Player _soundBank0;
742 SoundBank0Player _ambientSoundBank0;
743 SoundBank0Player _additionalAmbientSoundBank0Slots[kAmbientSoundSlotCount - 1];
744 ResidentSoundEffectPlayer _residentSoundEffects;
746 SceneLayerStack _sceneLayers;
747 RealtimeAnimationTracks _realtimeAnimationTracks;
748 SceneAnimationPlayer _animationPlayer;
749 TimedAnimationChannel _concurrentActorPathChannel;
752 SpeechController _speechController;
753 SpeechPlayer _realtimeSpeechPlayer;
754 SpeechPlayer &_speech;
755 SpeechOverlay &_speechOverlay;
756 SpeechOverlay &_primarySpeechOverlay;
757 byte &_primaryLeftSpeechLastFrame;
758 byte &_primaryDialogueSpeechLastFrame;
759 byte &_primaryDialogueSpeechGroup;
760 bool &_primaryLeftSpeechActive;
761 bool &_primaryDialogueSpeechActive;
762 uint32 &_secondaryActorTimerAccumulator;
763 uint32 &_primaryLeftSpeechTimerAccumulator;
764 uint32 &_primaryDialogueSpeechTimerAccumulator;
765 byte &_secondaryActorFrame;
766 uint32 _realtimeSpeechElapsed;
767 uint32 _realtimeSpeechDuration;
768 uint16 _realtimeSpeechTextRecordId;
769 uint16 _realtimeSpeechVoiceSampleId;
770 uint16 _realtimeSpeechCenterX;
771 uint16 _realtimeSpeechTopY;
772 byte _realtimeSpeechContinuationPart;
773 byte _realtimeSpeechContinuationCount;
774 byte _realtimeSpeechAnimationGroup;
775 byte _realtimeSpeechId;
776 byte _realtimeSpeechVolumePercent;
777 bool _realtimeSpeechActive;
778 bool _realtimeSpeechPrimary;
781 ActionOverlayPlayer _actionOverlayPlayer;
782 bool &_hideActiveActor;
785 bool _inventoryItems[121];
786 byte _sceneStateFlags[8];
787 uint32 _ambientMusicTimerAccumulator;
788 byte _previousAmbientMusicTrackId;
789 byte _currentAmbientSoundCueId;
790 byte _previousAmbientSoundCueId;
791 uint16 _viewportXOffset;
792 uint16 _viewportMinXOffset;
793 uint16 _viewportMaxXOffset;
794 int _lastViewportScrollActorWorldX;
795 uint _concurrentActorPathFrameIndex;
796 bool _concurrentActorPathActive;
797 bool _actorPathPlaybackActive;
798 bool _playerDirectedActorPathActive;
799 bool _playerDirectedActorPathFootstepPlayed;
800 uint16 _pendingGameplayActionHandlerId;
801 int _activeActorWorldX;
802 int _activeActorWorldY;
803 byte _activeActorFacing;
804 byte _activeActorCel;
805 byte _activeActorDrawOrderMode;
806 byte _lastSceneActionItemId;
807 byte _lastInventoryActionItemId;
808 byte _lastInventoryPrimaryItemId;
810 bool _stepAdvanceRequested;
813 void runActionOverlay(
const ActionOverlaySpec &spec, SceneAnimationStratum stratum,
814 bool hideActiveActor);
815 void advanceConcurrentActorPath(uint32 delta);
816 void handleActorPathFootstep(
bool terminalFrame,
bool &footstepPlayed);
Definition: managed_surface.h:51
Definition: actor_path_controller.h:50
Definition: game_loop.h:82
Definition: hollywood.h:47
Definition: playable_scene.h:93
Definition: playable_scene.h:192
Definition: playable_scene.h:185
Definition: playable_scene.h:84
Definition: animation_player.h:166
Definition: hotspots.h:62
Definition: hotspots.h:118
Definition: formatinfo.h:28
Definition: action_overlay.h:63
Definition: actor_types.h:59
Definition: ambient_audio.h:44
Definition: animation_player.h:34
Definition: animation_player.h:134
Definition: game_loop.h:44
Definition: game_loop.h:60
Definition: scene_config.h:81
Definition: scene_config.h:64
Definition: scene_data.h:29