1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
3 *----------------------------------------------------------*
4 * (c) 1995-2006 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * tape.h                                                   *
12 ***********************************************************/
13 
14 #ifndef TAPE_H
15 #define TAPE_H
16 
17 
18 /* values for TapeTogglePause() */
19 #define	TAPE_TOGGLE_MANUAL	TRUE
20 #define	TAPE_TOGGLE_AUTOMATIC	FALSE
21 
22 /* values for tape properties */
23 #define MAX_TAPE_LEN		(1000 * FRAMES_PER_SECOND) /* max.time x fps */
24 
25 /* some positions in the video tape control window */
26 #define VIDEO_DISPLAY1_XPOS	5
27 #define VIDEO_DISPLAY1_YPOS	5
28 #define VIDEO_DISPLAY2_XPOS	5
29 #define VIDEO_DISPLAY2_YPOS	41
30 #define VIDEO_DISPLAY_XSIZE	90
31 #define VIDEO_DISPLAY_YSIZE	31
32 #define VIDEO_BUTTON_XSIZE	18
33 #define VIDEO_BUTTON_YSIZE	18
34 #define VIDEO_CONTROL_XPOS	5
35 #define VIDEO_CONTROL_YPOS	77
36 #define VIDEO_CONTROL_XSIZE	VIDEO_DISPLAY_XSIZE
37 #define VIDEO_CONTROL_YSIZE	VIDEO_BUTTON_YSIZE
38 
39 /* values for video tape control */
40 #define VIDEO_STATE_PLAY_OFF	(1 << 0)
41 #define VIDEO_STATE_PLAY_ON	(1 << 1)
42 #define VIDEO_STATE_PLAY	(VIDEO_STATE_PLAY_OFF	| VIDEO_STATE_PLAY_ON)
43 #define VIDEO_STATE_REC_OFF	(1 << 2)
44 #define VIDEO_STATE_REC_ON	(1 << 3)
45 #define VIDEO_STATE_REC		(VIDEO_STATE_REC_OFF	| VIDEO_STATE_REC_ON)
46 #define VIDEO_STATE_PAUSE_OFF	(1 << 4)
47 #define VIDEO_STATE_PAUSE_ON	(1 << 5)
48 #define VIDEO_STATE_PAUSE	(VIDEO_STATE_PAUSE_OFF	| VIDEO_STATE_PAUSE_ON)
49 #define VIDEO_STATE_DATE_OFF	(1 << 6)
50 #define VIDEO_STATE_DATE_ON	(1 << 7)
51 #define VIDEO_STATE_DATE	(VIDEO_STATE_DATE_OFF	| VIDEO_STATE_DATE_ON)
52 #define VIDEO_STATE_TIME_OFF	(1 << 8)
53 #define VIDEO_STATE_TIME_ON	(1 << 9)
54 #define VIDEO_STATE_TIME	(VIDEO_STATE_TIME_OFF	| VIDEO_STATE_TIME_ON)
55 
56 #define VIDEO_STATE_FFWD_OFF	(1 << 10)
57 #define VIDEO_STATE_FFWD_ON	(1 << 11)
58 #define VIDEO_STATE_FFWD	(VIDEO_STATE_FFWD_OFF	| VIDEO_STATE_FFWD_ON)
59 #define VIDEO_STATE_PBEND_OFF	(1 << 12)
60 #define VIDEO_STATE_PBEND_ON	(1 << 13)
61 #define VIDEO_STATE_PBEND	(VIDEO_STATE_PBEND_OFF	| VIDEO_STATE_PBEND_ON)
62 #define VIDEO_STATE_WARP_OFF	(1 << 14)
63 #define VIDEO_STATE_WARP_ON	(1 << 15)
64 #define VIDEO_STATE_WARP	(VIDEO_STATE_WARP_OFF	| VIDEO_STATE_WARP_ON)
65 #define VIDEO_STATE_WARP2_OFF	(1 << 16)
66 #define VIDEO_STATE_WARP2_ON	(1 << 17)
67 #define VIDEO_STATE_WARP2	(VIDEO_STATE_WARP_OFF	| VIDEO_STATE_WARP_ON)
68 #define VIDEO_STATE_1STEP_OFF	(1 << 18)
69 #define VIDEO_STATE_1STEP_ON	(1 << 19)
70 #define VIDEO_STATE_1STEP	(VIDEO_STATE_1STEP_OFF	| VIDEO_STATE_1STEP_ON)
71 
72 #define VIDEO_PRESS_PLAY_ON	(1 << 20)
73 #define VIDEO_PRESS_PLAY_OFF	(1 << 21)
74 #define VIDEO_PRESS_PLAY	(VIDEO_PRESS_PLAY_OFF	| VIDEO_PRESS_PLAY_ON)
75 #define VIDEO_PRESS_REC_ON	(1 << 22)
76 #define VIDEO_PRESS_REC_OFF	(1 << 23)
77 #define VIDEO_PRESS_REC		(VIDEO_PRESS_REC_OFF	| VIDEO_PRESS_REC_ON)
78 #define VIDEO_PRESS_PAUSE_ON	(1 << 24)
79 #define VIDEO_PRESS_PAUSE_OFF	(1 << 25)
80 #define VIDEO_PRESS_PAUSE	(VIDEO_PRESS_PAUSE_OFF	| VIDEO_PRESS_PAUSE_ON)
81 #define VIDEO_PRESS_STOP_ON	(1 << 26)
82 #define VIDEO_PRESS_STOP_OFF	(1 << 27)
83 #define VIDEO_PRESS_STOP	(VIDEO_PRESS_STOP_OFF	| VIDEO_PRESS_STOP_ON)
84 #define VIDEO_PRESS_EJECT_ON	(1 << 28)
85 #define VIDEO_PRESS_EJECT_OFF	(1 << 29)
86 #define VIDEO_PRESS_EJECT	(VIDEO_PRESS_EJECT_OFF	| VIDEO_PRESS_EJECT_ON)
87 
88 /* tags to draw video display labels or symbols only */
89 /* (negative values to prevent misinterpretation in DrawVideoDisplay(), where
90    the variable "value" is also used for tape length -- better fix this) */
91 #define VIDEO_DISPLAY_DEFAULT		0
92 #define VIDEO_DISPLAY_LABEL_ONLY	-1
93 #define VIDEO_DISPLAY_SYMBOL_ONLY	-2
94 
95 
96 struct TapeInfo
97 {
98   int file_version;	/* file format version the tape is stored with    */
99   int game_version;	/* game release version the tape was created with */
100   int engine_version;	/* game engine version the tape was recorded with */
101 
102   char *level_identifier;
103   int level_nr;
104   unsigned long random_seed;
105   unsigned long date;
106   unsigned long counter;
107   unsigned long length;
108   unsigned long length_seconds;
109   unsigned int delay_played;
110   boolean pause_before_death;
111   boolean recording, playing, pausing;
112   boolean fast_forward;
113   boolean warp_forward;
114   boolean deactivate_display;
115   boolean auto_play;
116   boolean auto_play_level_solved;
117   boolean quick_resume;
118   boolean single_step;
119   boolean changed;
120   boolean player_participates[MAX_PLAYERS];
121   int num_participating_players;
122   int centered_player_nr_next;
123   boolean set_centered_player;
124 
125   struct
126   {
127     byte action[MAX_PLAYERS];
128     byte delay;
129   } pos[MAX_TAPE_LEN];
130 
131   boolean no_valid_file;	/* set when tape file missing or invalid */
132 };
133 
134 
135 void DrawVideoDisplay(unsigned long, unsigned long);
136 void DrawCompleteVideoDisplay(void);
137 
138 void TapeDeactivateDisplayOn();
139 void TapeDeactivateDisplayOff(boolean);
140 
141 void TapeSetDateFromEpochSeconds(time_t);
142 void TapeSetDateFromNow();
143 
144 void TapeStartRecording(long);
145 void TapeHaltRecording(void);
146 void TapeStopRecording(void);
147 void TapeRecordAction(byte *);
148 void TapeTogglePause(boolean);
149 void TapeStartPlaying(void);
150 void TapeStopPlaying(void);
151 byte *TapePlayAction(void);
152 void TapeStop(void);
153 void TapeErase(void);
154 unsigned int GetTapeLength(void);
155 void TapeQuickSave(void);
156 void TapeQuickLoad(void);
157 void InsertSolutionTape(void);
158 
159 void AutoPlayTape(void);
160 
161 void CreateTapeButtons();
162 void FreeTapeButtons();
163 void MapTapeEjectButton();
164 void MapTapeWarpButton();
165 void MapTapeButtons();
166 void UnmapTapeButtons();
167 
168 void HandleTapeButtonKeys(Key);
169 
170 #endif
171