improved configurability of tape date and time display positions
[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
54 #define VIDEO_STATE_FFWD_OFF    (1 << 10)
55 #define VIDEO_STATE_FFWD_ON     (1 << 11)
56 #define VIDEO_STATE_FFWD        (VIDEO_STATE_FFWD_OFF   | VIDEO_STATE_FFWD_ON)
57 #define VIDEO_STATE_PBEND_OFF   (1 << 12)
58 #define VIDEO_STATE_PBEND_ON    (1 << 13)
59 #define VIDEO_STATE_PBEND       (VIDEO_STATE_PBEND_OFF  | VIDEO_STATE_PBEND_ON)
60 #define VIDEO_STATE_WARP_OFF    (1 << 14)
61 #define VIDEO_STATE_WARP_ON     (1 << 15)
62 #define VIDEO_STATE_WARP        (VIDEO_STATE_WARP_OFF   | VIDEO_STATE_WARP_ON)
63 #define VIDEO_STATE_WARP2_OFF   (1 << 16)
64 #define VIDEO_STATE_WARP2_ON    (1 << 17)
65 #define VIDEO_STATE_WARP2       (VIDEO_STATE_WARP_OFF   | VIDEO_STATE_WARP_ON)
66 #define VIDEO_STATE_1STEP_OFF   (1 << 18)
67 #define VIDEO_STATE_1STEP_ON    (1 << 19)
68 #define VIDEO_STATE_1STEP       (VIDEO_STATE_1STEP_OFF  | VIDEO_STATE_1STEP_ON)
69
70 #define VIDEO_PRESS_PLAY_ON     (1 << 20)
71 #define VIDEO_PRESS_PLAY_OFF    (1 << 21)
72 #define VIDEO_PRESS_PLAY        (VIDEO_PRESS_PLAY_OFF   | VIDEO_PRESS_PLAY_ON)
73 #define VIDEO_PRESS_REC_ON      (1 << 22)
74 #define VIDEO_PRESS_REC_OFF     (1 << 23)
75 #define VIDEO_PRESS_REC         (VIDEO_PRESS_REC_OFF    | VIDEO_PRESS_REC_ON)
76 #define VIDEO_PRESS_PAUSE_ON    (1 << 24)
77 #define VIDEO_PRESS_PAUSE_OFF   (1 << 25)
78 #define VIDEO_PRESS_PAUSE       (VIDEO_PRESS_PAUSE_OFF  | VIDEO_PRESS_PAUSE_ON)
79 #define VIDEO_PRESS_STOP_ON     (1 << 26)
80 #define VIDEO_PRESS_STOP_OFF    (1 << 27)
81 #define VIDEO_PRESS_STOP        (VIDEO_PRESS_STOP_OFF   | VIDEO_PRESS_STOP_ON)
82 #define VIDEO_PRESS_EJECT_ON    (1 << 28)
83 #define VIDEO_PRESS_EJECT_OFF   (1 << 29)
84 #define VIDEO_PRESS_EJECT       (VIDEO_PRESS_EJECT_OFF  | VIDEO_PRESS_EJECT_ON)
85
86 /* tags to draw video display labels or symbols only */
87 /* (negative values to prevent misinterpretation in DrawVideoDisplay(), where
88    the variable "value" is also used for tape length -- better fix this) */
89 #define VIDEO_DISPLAY_DEFAULT           0
90 #define VIDEO_DISPLAY_LABEL_ONLY        -1
91 #define VIDEO_DISPLAY_SYMBOL_ONLY       -2
92
93
94 struct TapeButtonInfo
95 {
96   struct Rect eject;
97   struct Rect stop;
98   struct Rect pause;
99   struct Rect record;
100   struct Rect play;
101 };
102
103 struct TapeSymbolInfo
104 {
105   struct Rect eject;
106   struct Rect stop;
107   struct Rect pause;
108   struct Rect record;
109   struct Rect play;
110   struct Rect fast_forward;
111   struct Rect warp_forward;
112   struct Rect warp_forward_blind;
113   struct Rect pause_before_end;
114   struct Rect single_step;
115 };
116
117 struct TapeLabelInfo
118 {
119   struct Rect eject;
120   struct Rect stop;
121   struct Rect pause;
122   struct Rect record;
123   struct Rect play;
124   struct Rect fast_forward;
125   struct Rect warp_forward;
126   struct Rect warp_forward_blind;
127   struct Rect pause_before_end;
128   struct Rect single_step;
129   struct Rect date;
130   struct Rect time;
131 };
132
133 struct TapeTextInfo
134 {
135   struct TextPosInfo date;
136   struct TextPosInfo date_yyyy;
137   struct TextPosInfo date_yy;
138   struct TextPosInfo date_mmm;
139   struct TextPosInfo date_mm;
140   struct TextPosInfo date_dd;
141
142   struct TextPosInfo time;
143   struct TextPosInfo time_hh;
144   struct TextPosInfo time_mm;
145   struct TextPosInfo time_ss;
146 };
147
148 struct TapeInfo
149 {
150   int file_version;     /* file format version the tape is stored with    */
151   int game_version;     /* game release version the tape was created with */
152   int engine_version;   /* game engine version the tape was recorded with */
153
154   char *level_identifier;
155   int level_nr;
156   unsigned int random_seed;
157   unsigned int date;
158   unsigned int counter;
159   unsigned int length;
160   unsigned int length_seconds;
161   unsigned int delay_played;
162   boolean pause_before_death;
163   boolean recording, playing, pausing;
164   boolean fast_forward;
165   boolean warp_forward;
166   boolean deactivate_display;
167   boolean auto_play;
168   boolean auto_play_level_solved;
169   boolean quick_resume;
170   boolean single_step;
171   boolean changed;
172   boolean player_participates[MAX_PLAYERS];
173   int num_participating_players;
174   int centered_player_nr_next;
175   boolean set_centered_player;
176
177   struct
178   {
179     byte action[MAX_PLAYERS];
180     byte delay;
181   } pos[MAX_TAPE_LEN];
182
183   struct TapeButtonInfo button;
184   struct TapeSymbolInfo symbol;
185   struct TapeLabelInfo label;
186   struct TapeTextInfo text;
187
188   boolean show_game_buttons;    /* show game buttons in tape viewport */
189
190   boolean no_valid_file;        /* set when tape file missing or invalid */
191 };
192
193
194 void DrawVideoDisplay(unsigned int, unsigned int);
195 void DrawCompleteVideoDisplay(void);
196
197 void TapeDeactivateDisplayOn();
198 void TapeDeactivateDisplayOff(boolean);
199
200 void TapeSetDateFromEpochSeconds(time_t);
201 void TapeSetDateFromNow();
202
203 void TapeStartRecording(int);
204 void TapeHaltRecording(void);
205 void TapeStopRecording(void);
206 void TapeRecordAction(byte *);
207 void TapeTogglePause(boolean);
208 void TapeStartPlaying(void);
209 void TapeStopPlaying(void);
210 byte *TapePlayAction(void);
211 void TapeStop(void);
212 void TapeErase(void);
213 unsigned int GetTapeLength(void);
214 void TapeQuickSave(void);
215 void TapeQuickLoad(void);
216 void InsertSolutionTape(void);
217
218 void AutoPlayTape(void);
219
220 void CreateTapeButtons();
221 void FreeTapeButtons();
222 void MapTapeEjectButton();
223 void MapTapeWarpButton();
224 void MapTapeButtons();
225 void UnmapTapeButtons();
226
227 void HandleTapeButtonKeys(Key);
228
229 #endif