added configurability of different window size for title screens
[rocksndiamonds.git] / src / tape.h
1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // tape.h
10 // ============================================================================
11
12 #ifndef TAPE_H
13 #define TAPE_H
14
15
16 /* values for TapeTogglePause() */
17 #define TAPE_TOGGLE_MANUAL      TRUE
18 #define TAPE_TOGGLE_AUTOMATIC   FALSE
19
20 /* values for tape properties */
21 #define MAX_TAPE_LEN            (1000 * FRAMES_PER_SECOND) /* max.time x fps */
22
23 /* some positions in the video tape control window */
24 #define VIDEO_DISPLAY1_XPOS     5
25 #define VIDEO_DISPLAY1_YPOS     5
26 #define VIDEO_DISPLAY2_XPOS     5
27 #define VIDEO_DISPLAY2_YPOS     41
28 #define VIDEO_DISPLAY_XSIZE     90
29 #define VIDEO_DISPLAY_YSIZE     31
30 #define VIDEO_BUTTON_XSIZE      18
31 #define VIDEO_BUTTON_YSIZE      18
32 #define VIDEO_CONTROL_XPOS      5
33 #define VIDEO_CONTROL_YPOS      77
34 #define VIDEO_CONTROL_XSIZE     VIDEO_DISPLAY_XSIZE
35 #define VIDEO_CONTROL_YSIZE     VIDEO_BUTTON_YSIZE
36
37 /* values for video tape control */
38 #define VIDEO_STATE_PLAY_OFF    (1 << 0)
39 #define VIDEO_STATE_PLAY_ON     (1 << 1)
40 #define VIDEO_STATE_PLAY        (VIDEO_STATE_PLAY_OFF   | VIDEO_STATE_PLAY_ON)
41 #define VIDEO_STATE_REC_OFF     (1 << 2)
42 #define VIDEO_STATE_REC_ON      (1 << 3)
43 #define VIDEO_STATE_REC         (VIDEO_STATE_REC_OFF    | VIDEO_STATE_REC_ON)
44 #define VIDEO_STATE_PAUSE_OFF   (1 << 4)
45 #define VIDEO_STATE_PAUSE_ON    (1 << 5)
46 #define VIDEO_STATE_PAUSE       (VIDEO_STATE_PAUSE_OFF  | VIDEO_STATE_PAUSE_ON)
47 #define VIDEO_STATE_DATE_OFF    (1 << 6)
48 #define VIDEO_STATE_DATE_ON     (1 << 7)
49 #define VIDEO_STATE_DATE        (VIDEO_STATE_DATE_OFF   | VIDEO_STATE_DATE_ON)
50 #define VIDEO_STATE_TIME_OFF    (1 << 8)
51 #define VIDEO_STATE_TIME_ON     (1 << 9)
52 #define VIDEO_STATE_TIME        (VIDEO_STATE_TIME_OFF   | VIDEO_STATE_TIME_ON)
53 #define VIDEO_STATE_FRAME_OFF   (1 << 10)
54 #define VIDEO_STATE_FRAME_ON    (1 << 11)
55 #define VIDEO_STATE_FRAME       (VIDEO_STATE_FRAME_OFF  | VIDEO_STATE_FRAME_ON)
56
57 #define VIDEO_STATE_FFWD_OFF    (1 << 12)
58 #define VIDEO_STATE_FFWD_ON     (1 << 13)
59 #define VIDEO_STATE_FFWD        (VIDEO_STATE_FFWD_OFF   | VIDEO_STATE_FFWD_ON)
60 #define VIDEO_STATE_PBEND_OFF   (1 << 14)
61 #define VIDEO_STATE_PBEND_ON    (1 << 15)
62 #define VIDEO_STATE_PBEND       (VIDEO_STATE_PBEND_OFF  | VIDEO_STATE_PBEND_ON)
63 #define VIDEO_STATE_WARP_OFF    (1 << 16)
64 #define VIDEO_STATE_WARP_ON     (1 << 17)
65 #define VIDEO_STATE_WARP        (VIDEO_STATE_WARP_OFF   | VIDEO_STATE_WARP_ON)
66 #define VIDEO_STATE_WARP2_OFF   (1 << 18)
67 #define VIDEO_STATE_WARP2_ON    (1 << 19)
68 #define VIDEO_STATE_WARP2       (VIDEO_STATE_WARP_OFF   | VIDEO_STATE_WARP_ON)
69 #define VIDEO_STATE_1STEP_OFF   (1 << 20)
70 #define VIDEO_STATE_1STEP_ON    (1 << 21)
71 #define VIDEO_STATE_1STEP       (VIDEO_STATE_1STEP_OFF  | VIDEO_STATE_1STEP_ON)
72
73 #define VIDEO_PRESS_PLAY_ON     (1 << 22)
74 #define VIDEO_PRESS_PLAY_OFF    (1 << 23)
75 #define VIDEO_PRESS_PLAY        (VIDEO_PRESS_PLAY_OFF   | VIDEO_PRESS_PLAY_ON)
76 #define VIDEO_PRESS_REC_ON      (1 << 24)
77 #define VIDEO_PRESS_REC_OFF     (1 << 25)
78 #define VIDEO_PRESS_REC         (VIDEO_PRESS_REC_OFF    | VIDEO_PRESS_REC_ON)
79 #define VIDEO_PRESS_PAUSE_ON    (1 << 26)
80 #define VIDEO_PRESS_PAUSE_OFF   (1 << 27)
81 #define VIDEO_PRESS_PAUSE       (VIDEO_PRESS_PAUSE_OFF  | VIDEO_PRESS_PAUSE_ON)
82 #define VIDEO_PRESS_STOP_ON     (1 << 28)
83 #define VIDEO_PRESS_STOP_OFF    (1 << 29)
84 #define VIDEO_PRESS_STOP        (VIDEO_PRESS_STOP_OFF   | VIDEO_PRESS_STOP_ON)
85 #define VIDEO_PRESS_EJECT_ON    (1 << 30)
86 #define VIDEO_PRESS_EJECT_OFF   (1 << 31)
87 #define VIDEO_PRESS_EJECT       (VIDEO_PRESS_EJECT_OFF  | VIDEO_PRESS_EJECT_ON)
88
89 /* tags to draw video display labels or symbols only */
90 /* (negative values to prevent misinterpretation in DrawVideoDisplay(), where
91    the variable "value" is also used for tape length -- better fix this) */
92 #define VIDEO_DISPLAY_DEFAULT           0
93 #define VIDEO_DISPLAY_LABEL_ONLY        -1
94 #define VIDEO_DISPLAY_SYMBOL_ONLY       -2
95
96
97 struct TapeButtonInfo
98 {
99   struct XY eject;
100   struct XY stop;
101   struct XY pause;
102   struct XY record;
103   struct XY play;
104 };
105
106 struct TapeSymbolInfo
107 {
108   struct XY eject;
109   struct XY stop;
110   struct XY pause;
111   struct XY record;
112   struct XY play;
113   struct XY fast_forward;
114   struct XY warp_forward;
115   struct XY warp_forward_blind;
116   struct XY pause_before_end;
117   struct XY single_step;
118 };
119
120 struct TapeLabelInfo
121 {
122   struct XY eject;
123   struct XY stop;
124   struct XY pause;
125   struct XY record;
126   struct XY play;
127   struct XY fast_forward;
128   struct XY warp_forward;
129   struct XY warp_forward_blind;
130   struct XY pause_before_end;
131   struct XY single_step;
132   struct XY date;
133   struct XY time;
134 };
135
136 struct TapeTextInfo
137 {
138   struct TextPosInfo date;
139   struct TextPosInfo date_yyyy;
140   struct TextPosInfo date_yy;
141   struct TextPosInfo date_mon;
142   struct TextPosInfo date_mm;
143   struct TextPosInfo date_dd;
144
145   struct TextPosInfo time;
146   struct TextPosInfo time_hh;
147   struct TextPosInfo time_mm;
148   struct TextPosInfo time_ss;
149
150   struct TextPosInfo frame;
151 };
152
153 struct TapeInfo
154 {
155   int file_version;     /* file format version the tape is stored with    */
156   int game_version;     /* game release version the tape was created with */
157   int engine_version;   /* game engine version the tape was recorded with */
158
159   char *level_identifier;
160   int level_nr;
161   unsigned int random_seed;
162   unsigned int date;
163   unsigned int counter;
164   unsigned int length;
165   unsigned int length_frames;
166   unsigned int length_seconds;
167   unsigned int delay_played;
168   boolean pause_before_death;
169   boolean recording, playing, pausing;
170   boolean fast_forward;
171   boolean warp_forward;
172   boolean deactivate_display;
173   boolean auto_play;
174   boolean auto_play_level_solved;
175   boolean quick_resume;
176   boolean single_step;
177   boolean changed;
178   boolean player_participates[MAX_PLAYERS];
179   int num_participating_players;
180   int centered_player_nr_next;
181   boolean set_centered_player;
182
183   struct
184   {
185     byte action[MAX_PLAYERS];
186     byte delay;
187   } pos[MAX_TAPE_LEN];
188
189   struct TapeButtonInfo button;
190   struct TapeSymbolInfo symbol;
191   struct TapeLabelInfo label;
192   struct TapeTextInfo text;
193
194   boolean show_game_buttons;    /* show game buttons in tape viewport */
195
196   boolean no_valid_file;        /* set when tape file missing or invalid */
197 };
198
199
200 void DrawVideoDisplay(unsigned int, unsigned int);
201 void DrawCompleteVideoDisplay(void);
202
203 void TapeDeactivateDisplayOn();
204 void TapeDeactivateDisplayOff(boolean);
205
206 void TapeSetDateFromEpochSeconds(time_t);
207 void TapeSetDateFromNow();
208
209 void TapeStartRecording(int);
210 void TapeHaltRecording(void);
211 void TapeStopRecording(void);
212 void TapeRecordAction(byte *);
213 void TapeTogglePause(boolean);
214 void TapeStartPlaying(void);
215 void TapeStopPlaying(void);
216 byte *TapePlayAction(void);
217 void TapeStop(void);
218 void TapeErase(void);
219 unsigned int GetTapeLengthFrames(void);
220 unsigned int GetTapeLengthSeconds(void);
221 void TapeQuickSave(void);
222 void TapeQuickLoad(void);
223 void InsertSolutionTape(void);
224
225 void AutoPlayTape(void);
226
227 void CreateTapeButtons();
228 void FreeTapeButtons();
229 void MapTapeEjectButton();
230 void MapTapeWarpButton();
231 void MapTapeButtons();
232 void UnmapTapeButtons();
233
234 void HandleTapeButtonKeys(Key);
235
236 #endif