-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwarperCutscene.h
63 lines (52 loc) · 3.73 KB
/
warperCutscene.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef WARPERCUTSCENE_H_INCLUDED
#define WARPERCUTSCENE_H_INCLUDED
#include "warper.h"
#include "warperInterface.h"
typedef struct _warperActor {
cDoubleRect position; /**< actual actor position */
warperAnimatedSprite* animatedSpr; /**< sprite->drawRect is to be ignored; this is only for render info purposes */
bool pauseAnimationWhenWaiting; /**< true, if this animated sprite should not continue to play while waiting for a textbox to be closed. This flag isn't used internally, and should be read by whatever function is playing the cutscene to block animations when waiting */
} warperActor;
typedef struct _warperAnimation
{
warperActor* actors; /**< Array of `warperActor`s */
int numActors;
int currentFrame;
int frameCount; /**< Number of transition frames between last animation and this one */
} warperAnimation;
typedef struct _warperCutsceneBox
{
warperTextBox** boxes; /**< Array of `warperTextBox*`s */
cResource** boxResources; /**< Array of `cResource*`s */
int* framesAppear; /**< array of integers that specify what frame of the corresponding animation this box should appear (pauses current animation until it closes and lasts until the next animation starts playing) */
int numBoxes;
int currentBox;
} warperCutsceneBox;
typedef struct _warperCutscene {
warperAnimation* animations;
warperCutsceneBox* boxes; /**< Array of `warperCutsceneBox`s, length equal to numAnimations. Each box in the array corresponds to an animation at the same index. boxes[i].numBoxes == 0 means to not display a box there */
int numAnimations;
int currentAnimation;
int totalFrames; /**< Total number of animations' (transitions') frames */
bool waitingForBox; /**< true if animation should not progress past the current animation */
char* tilemapFilepath; /**< holds the filepath to the source of the tilemap we base this cutscene on */
int tilemapLine; /**< holds the line number corresponding to the tilemap we base this cutscene on */
} warperCutscene;
void initWarperActor(warperActor* actor, cDoubleRect pos, warperAnimatedSprite* spr, bool pauseSpriteWhenWaiting);
void importWarperActor(warperActor* actor, char* data, warperAnimatedSprite* animSprites, int numAnimSprites, cSprite* sprites, int numSprites);
char* exportWarperActor(warperActor actor, warperAnimatedSprite** sprites, int numSprites);
void initWarperAnimation(warperAnimation* animation, warperActor* actors, int actorsLength, int frames);
void destroyWarperAnimation(warperAnimation* animation);
void importWarperAnimation(warperAnimation* animation, char* data, warperAnimatedSprite* animSprites, int numAnimSprites, cSprite* sprites, int numSprites);
char* exportWarperAnimation(warperAnimation animation, warperAnimatedSprite** sprites, int numSprites);
void initWarperCutsceneBox(warperCutsceneBox* box, warperTextBox** boxes, int* framesAppear, int boxesLength);
void incrementWarperCutsceneBox(warperCutscene* cutscene);
void destroyWarperCutsceneBox(warperCutsceneBox* box, bool destroyResources);
void importWarperCutsceneBox(warperCutsceneBox* box, char* data);
char* exportWarperCutsceneBox(warperCutsceneBox box);
void initWarperCutscene(warperCutscene* cutscene, warperAnimation* animations, warperCutsceneBox* boxes, int animationsLength, char* tilemapFilepath, int tilemapLine);
void iterateWarperCutscene(warperCutscene* cutscene);
void destroyWarperCutscene(warperCutscene* cutscene, bool destroyAnimations, bool destroyTextBoxes, bool destroyBoxResources);
void importWarperCutscene(warperCutscene* cutscene, char* filepath, cSprite*** cutsceneSprites, int* numSprites, cResource*** cutsceneResources, int* numResources);
void exportWarperCutscene(warperCutscene cutscene, char* filepath);
#endif // WARPERCUTSCENE_H_INCLUDED