-
Notifications
You must be signed in to change notification settings - Fork 4
/
TTMPlayer.h
107 lines (82 loc) · 2.13 KB
/
TTMPlayer.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef TTMPLAYER_H
#define TTMPLAYER_H
#include "TTMFile.h"
#include "BMPFile.h"
#include "RESFile.h"
#include "ADSFile.h"
#include "defines.h"
#include <list>
#ifdef WIN32
#include <SDL.h>
#else
#include <SDL2/SDL.h>
#endif
namespace SCRANTIC {
struct SceneItem {
SDL_Texture *tex;
SDL_Rect src;
SDL_Rect dest;
u16 num;
u8 flags;
std::pair<u16, u16> color;
i8 itemType;
};
class TTMPlayer {
protected:
std::vector<Command> script;
std::vector<Command>::iterator scriptPos;
std::list<SceneItem> items;
std::list<SceneItem> queuedItems;
std::list<SceneItem>::iterator itemPos;
SDL_Color *palette;
std::pair<u16, u16> currentColor;
std::string name;
u16 resNo;
u16 sceneNo;
u16 originalScene;
u16 delay;
u16 remainingDelay;
u16 waitCount;
u16 waitDelay;
u16 imgSlot;
i16 audioSample;
i16 repeat;
i16 maxTicks;
i32 jumpToScript;
SDL_Renderer *renderer;
bool clipRegion;
bool alreadySaved;
bool saveNewImage;
bool saveImage;
bool isDone;
bool toBeKilled;
bool selfDestruct;
bool selfDestructActive;
SDL_Rect clipRect;
SDL_Rect saveRect;
BMPFile **images;
BMPFile *oldImages[MAX_IMAGES];
RESFile *res;
TTMFile *ttm;
std::string screen;
public:
u16 getDelay() { return delay; };
u16 getRemainigDelay(u32 ticks);
SDL_Rect getClipRect() { return clipRect; }
i16 getSample() { i16 tmp = audioSample; audioSample = -1; return tmp; }
std::string getSCRName() { return screen; }
bool isFinished() { return isDone; }
bool isClipped() { return clipRegion; }
u8 needsSave();
void kill() { toBeKilled = true; }
u16 getHash() { return SCRANTIC::ADSFile::makeHash(resNo, originalScene); }
//Needs to be freed
SDL_Texture *savedImage;
SDL_Texture *fg;
void advanceScript();
void renderForeground(i16 shiftX = 0, i16 shiftY = 0);
TTMPlayer(const std::string &ttmName, u16 resNo, u16 scene, i16 repeatCount, RESFile *resFile, BMPFile **images, SDL_Color *pal, SDL_Renderer *rendererContext);
~TTMPlayer();
};
}
#endif // TTMPLAYER_H