forked from bailli/Johnny
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTTMPlayer.h
106 lines (82 loc) · 2.18 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
#ifndef TTMPLAYER_H
#define TTMPLAYER_H
#include "TTMFile.h"
#include "BMPFile.h"
#include "RESFile.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;
u_int16_t num;
u_int8_t flags;
std::pair<u_int16_t, u_int16_t> color;
int8_t 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<u_int16_t, u_int16_t> currentColor;
std::string name;
u_int16_t resNo;
u_int16_t sceneNo;
u_int16_t originalScene;
u_int16_t delay;
u_int16_t remainingDelay;
u_int16_t waitCount;
u_int16_t waitDelay;
u_int16_t imgSlot;
int16_t audioSample;
int16_t repeat;
int16_t maxTicks;
int32_t 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;
RESFile *res;
TTMFile *ttm;
std::string screen;
public:
u_int16_t getDelay();
u_int16_t getRemainigDelay(u_int32_t ticks);
SDL_Rect getClipRect() { return clipRect; }
int16_t getSample() { int16_t tmp = audioSample; audioSample = -1; return tmp; }
std::string getSCRName() { return screen; }
bool isFinished() { return isDone; }
bool isClipped() { return clipRegion; }
u_int8_t needsSave();
void kill() { toBeKilled = true; }
std::pair<u_int16_t, u_int16_t> getHash() { return std::make_pair(resNo, originalScene); }
//Needs to be freed
SDL_Texture *savedImage;
SDL_Texture *fg;
void advanceScript();
void renderForeground();
TTMPlayer(std::string ttmName, u_int16_t resNo, u_int16_t scene, int16_t repeatCount, RESFile *resFile, BMPFile **images, SDL_Color *pal, SDL_Renderer *rendererContext);
~TTMPlayer();
};
}
#endif // TTMPLAYER_H