22#ifndef HOLLYWOOD_MONSTERS_SCENES_PLAYABLE_ACTION_OVERLAY_H
23#define HOLLYWOOD_MONSTERS_SCENES_PLAYABLE_ACTION_OVERLAY_H
25#include "common/types.h"
27#include "hollywood/monsters/scenes/animation_events.h"
28#include "hollywood/monsters/scenes/animation_layers.h"
38 waitAfterFinalFrame(
true) {
44 bool waitAfterFinalFrame;
64 ActionOverlaySpec(uint newChunkIndex, uint newDescriptorCount, uint32 newFrameMillis) :
65 chunkIndex(newChunkIndex),
66 descriptorCount(newDescriptorCount),
69 frameMillis(newFrameMillis),
71 bookendLastFrame(
false),
72 appendFirstFrame(
false),
73 reversePlayback(
false),
74 hasDrawStratum(
false),
75 drawStratum(kSceneAnimationInFrontOfActors),
76 restoreBackgroundBeforeDraw(
false),
81 const byte *newFrameMap, uint newFrameMapSize, uint32 newFrameMillis) :
82 chunkIndex(newChunkIndex),
83 descriptorCount(newDescriptorCount),
84 frameMap(newFrameMap),
85 frameMapSize(newFrameMapSize),
86 frameMillis(newFrameMillis),
88 bookendLastFrame(
false),
89 appendFirstFrame(
false),
90 reversePlayback(
false),
91 hasDrawStratum(
false),
92 drawStratum(kSceneAnimationInFrontOfActors),
93 restoreBackgroundBeforeDraw(
false),
102 const uint frameCount = frameMap !=
nullptr ? frameMapSize : descriptorCount;
103 heldFrame = frame >= 0 && (uint)frame < frameCount ? frame : -1;
104 bookendLastFrame =
false;
105 appendFirstFrame =
false;
111 bookendLastFrame =
true;
112 appendFirstFrame =
false;
118 bookendLastFrame =
false;
119 appendFirstFrame =
true;
124 reversePlayback =
true;
129 hasDrawStratum =
true;
130 drawStratum = stratum;
135 restoreBackgroundBeforeDraw =
true;
140 options.waitAfterFinalFrame =
false;
145 options.allowSkip =
false;
150 options.firstFrame = firstFrame;
155 options.endFrame = endFrame;
160 options.firstFrame = firstFrame;
161 options.endFrame = endFrame;
165 uint playbackFrameCount()
const {
166 const uint frameCount = frameMap !=
nullptr ? frameMapSize : descriptorCount;
169 return frameCount + (heldFrame >= 0 || bookendLastFrame || appendFirstFrame ? 1 : 0);
172 uint targetFrame(uint playbackFrame)
const {
173 const uint frameCount = frameMap !=
nullptr ? frameMapSize : descriptorCount;
176 if (bookendLastFrame) {
177 if (playbackFrame == 0 || (reversePlayback && playbackFrame == frameCount))
178 return frameCount - 1;
179 return reversePlayback ? frameCount - playbackFrame - 1 : playbackFrame - 1;
181 if (appendFirstFrame && playbackFrame == frameCount)
183 uint frame = heldFrame < 0 || playbackFrame <= (uint)heldFrame ?
184 playbackFrame : playbackFrame - 1;
185 if (!reversePlayback)
187 return frameCount - 1 - frame;
191 uint descriptorCount;
192 const byte *frameMap;
196 bool bookendLastFrame;
197 bool appendFirstFrame;
198 bool reversePlayback;
200 SceneAnimationStratum drawStratum;
201 bool restoreBackgroundBeforeDraw;
Definition: animation_events.h:140
Definition: action_overlay.h:33
Definition: action_overlay.h:63