rnd-20140115-2-src
[rocksndiamonds.git] / src / tools.h
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 * tools.h                                                  *
12 ***********************************************************/
13
14 #ifndef TOOLS_H
15 #define TOOLS_H
16
17 #include "main.h"
18 #include "game.h"
19
20 /* for SetDrawtoField */
21 #define DRAW_BUFFERED           1
22 #define DRAW_BACKBUFFER         2
23
24 /* for DrawElementShifted */
25 #define NO_CUTTING              0
26 #define CUT_ABOVE               (1 << 0)
27 #define CUT_BELOW               (1 << 1)
28 #define CUT_LEFT                (1 << 2)
29 #define CUT_RIGHT               (1 << 3)
30
31 /* for masking functions */
32 #define NO_MASKING              0
33 #define USE_MASKING             1
34  
35 /* for MoveDoor */
36 #define DOOR_OPEN_1             (1 << 0)
37 #define DOOR_OPEN_2             (1 << 1)
38 #define DOOR_CLOSE_1            (1 << 2)
39 #define DOOR_CLOSE_2            (1 << 3)
40 #define DOOR_OPEN_ALL           (DOOR_OPEN_1 | DOOR_OPEN_2)
41 #define DOOR_CLOSE_ALL          (DOOR_CLOSE_1 | DOOR_CLOSE_2)
42 #define DOOR_ACTION_1           (DOOR_OPEN_1 | DOOR_CLOSE_1)
43 #define DOOR_ACTION_2           (DOOR_OPEN_2 | DOOR_CLOSE_2)
44 #define DOOR_ACTION             (DOOR_ACTION_1 | DOOR_ACTION_2)
45 #define DOOR_COPY_BACK          (1 << 4)
46 #define DOOR_NO_COPY_BACK       (1 << 5)
47 #define DOOR_NO_DELAY           (1 << 6)
48 #define DOOR_FORCE_REDRAW       (1 << 7)
49 #define DOOR_GET_STATE          (1 << 8)
50 #define DOOR_SET_STATE          (1 << 9)
51
52 /* for Request */
53 #define REQ_ASK                 (1 << 0)
54 #define REQ_CONFIRM             (1 << 1)
55 #define REQ_PLAYER              (1 << 2)
56 #define REQ_STAY_OPEN           (1 << 3)
57 #define REQ_STAY_CLOSED         (1 << 4)
58 #define REQ_REOPEN              (1 << 5)
59
60 #define REQUEST_WAIT_FOR_INPUT  (REQ_ASK | REQ_CONFIRM | REQ_PLAYER)
61
62
63 struct RequestButtonInfo
64 {
65   struct TextPosInfo yes;
66   struct TextPosInfo no;
67   struct TextPosInfo confirm;
68   struct TextPosInfo player_1;
69   struct TextPosInfo player_2;
70   struct TextPosInfo player_3;
71   struct TextPosInfo player_4;
72 };
73
74 struct RequestInfo
75 {
76   struct RequestButtonInfo button;
77 };
78
79 extern struct RequestInfo request;
80
81
82 void DumpTile(int, int);
83
84 void DrawMaskedBorder_FIELD();
85 void DrawMaskedBorder_DOOR_1();
86 void DrawMaskedBorder_DOOR_2();
87 void DrawMaskedBorder_DOOR_3();
88 void DrawMaskedBorder_ALL();
89 void DrawMaskedBorder(int);
90
91 void SetDrawtoField(int);
92 void RedrawPlayfield(boolean, int, int, int, int);
93 void BlitScreenToBitmap(Bitmap *);
94 void BackToFront();
95
96 void FadeIn(int);
97 void FadeOut(int);
98 void FadeSetEnterMenu();
99 void FadeSetLeaveMenu();
100 void FadeSetEnterScreen();
101 void FadeSetNextScreen();
102 void FadeSetLeaveScreen();
103 void FadeSetFromType(int);
104 void FadeSetDisabled();
105 void FadeSkipNextFadeIn();
106 void FadeSkipNextFadeOut();
107
108 void ClearField();
109 void SetWindowBackgroundImageIfDefined(int);
110 void SetMainBackgroundImageIfDefined(int);
111 void SetDoorBackgroundImageIfDefined(int);
112 void SetWindowBackgroundImage(int);
113 void SetMainBackgroundImage(int);
114 void SetDoorBackgroundImage(int);
115 void SetPanelBackground();
116 void DrawBackground(int, int, int, int);
117 void DrawBackgroundForFont(int, int, int, int, int);
118 void DrawBackgroundForGraphic(int, int, int, int, int);
119
120 void MarkTileDirty(int, int);
121 void SetBorderElement();
122 void FloodFillLevel(int, int, int, short[MAX_LEV_FIELDX][MAX_LEV_FIELDY],
123                     int, int);
124
125 void SetRandomAnimationValue(int, int);
126 int getGraphicAnimationFrame(int, int);
127
128 void DrawGraphicAnimation(int, int, int);
129 void DrawGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
130
131 void DrawFixedGraphicAnimation(int, int, int);
132 void DrawFixedGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
133
134 void DrawLevelGraphicAnimation(int, int, int);
135 void DrawLevelElementAnimation(int, int, int);
136 void DrawLevelGraphicAnimationIfNeeded(int, int, int);
137 void DrawLevelElementAnimationIfNeeded(int, int, int);
138
139 void DrawAllPlayers(void);
140 void DrawPlayerField(int, int);
141 void DrawPlayer(struct PlayerInfo *);
142
143 void getSizedGraphicSourceExt(int, int, int, Bitmap **, int *, int *, boolean);
144 void getFixedGraphicSourceExt(int, int, Bitmap **, int *, int *, boolean);
145 void getSizedGraphicSource(int, int, int, Bitmap **, int *, int *);
146 void getFixedGraphicSource(int, int, Bitmap **, int *, int *);
147 void getMiniGraphicSource(int, Bitmap **, int *, int *);
148 void getGraphicSourceExt(int, int, Bitmap **, int *, int *, boolean);
149 void getGraphicSource(int, int, Bitmap **, int *, int *);
150
151 void DrawGraphic(int, int, int, int);
152 void DrawGraphicExt(DrawBuffer *, int, int, int, int);
153 void DrawGraphicThruMask(int, int, int, int);
154 void DrawGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
155
156 void DrawFixedGraphic(int, int, int, int);
157 void DrawFixedGraphicExt(DrawBuffer *, int, int, int, int);
158 void DrawFixedGraphicThruMask(int, int, int, int);
159 void DrawFixedGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
160
161 void DrawSizedGraphic(int, int, int, int, int);
162 void DrawSizedGraphicExt(DrawBuffer *, int, int, int, int, int);
163
164 void DrawMiniGraphic(int, int, int);
165 void DrawMiniGraphicExt(DrawBuffer *, int, int, int);
166
167 void DrawScreenElementExt(int, int, int, int, int, int, int);
168 void DrawLevelElementExt(int, int, int, int, int, int, int);
169 void DrawScreenElementShifted(int, int, int, int, int, int);
170 void DrawLevelElementShifted(int, int, int, int, int, int);
171 void DrawScreenElementThruMask(int, int, int);
172 void DrawLevelElementThruMask(int, int, int);
173 void DrawLevelFieldThruMask(int, int);
174 void DrawLevelFieldCrumbled(int, int);
175 void DrawLevelFieldCrumbledDigging(int, int, int, int);
176 void DrawLevelFieldCrumbledNeighbours(int, int);
177 void DrawScreenElement(int, int, int);
178 void DrawLevelElement(int, int, int);
179 void DrawScreenField(int, int);
180 void DrawLevelField(int, int);
181
182 void DrawMiniElement(int, int, int);
183 void DrawMiniElementOrWall(int, int, int, int);
184
185 void ShowEnvelope(int);
186 void ShowEnvelopeDoor(char *text, int);
187
188 void DrawLevel(void);
189 void DrawMiniLevel(int, int, int, int);
190 void DrawPreviewLevelInitial(void);
191 void DrawPreviewLevelAnimation(void);
192
193 void WaitForEventToContinue();
194 boolean Request(char *, unsigned int);
195 unsigned int OpenDoor(unsigned int);
196 unsigned int CloseDoor(unsigned int);
197 unsigned int GetDoorState(void);
198 unsigned int SetDoorState(unsigned int);
199 unsigned int MoveDoor(unsigned int);
200
201 void DrawSpecialEditorDoor();
202 void UndrawSpecialEditorDoor();
203
204 void CreateToolButtons();
205 void FreeToolButtons();
206
207 int map_element_RND_to_EM(int);
208 int map_element_EM_to_RND(int);
209 int map_direction_RND_to_EM(int);
210 int map_direction_EM_to_RND(int);
211
212 void map_android_clone_elements_RND_to_EM(struct LevelInfo *);
213 void map_android_clone_elements_EM_to_RND(struct LevelInfo *);
214
215 int map_element_RND_to_SP(int);
216 int map_element_SP_to_RND(int);
217 int map_action_SP_to_RND(int);
218
219 int get_next_element(int);
220 int el_act_dir2img(int, int, int);
221 int el_act2img(int, int);
222 int el_dir2img(int, int);
223 int el2baseimg(int);
224 int el2img(int);
225 int el2edimg(int);
226 int el2preimg(int);
227 int el2panelimg(int);
228 int font2baseimg(int);
229
230 int getBeltNrFromBeltElement(int);
231 int getBeltNrFromBeltActiveElement(int);
232 int getBeltNrFromBeltSwitchElement(int);
233 int getBeltDirNrFromBeltElement(int);
234 int getBeltDirNrFromBeltSwitchElement(int);
235 int getBeltDirFromBeltElement(int);
236 int getBeltDirFromBeltSwitchElement(int);
237 int getBeltElementFromBeltNrAndBeltDirNr(int, int);
238 int getBeltElementFromBeltNrAndBeltDir(int, int);
239 int getBeltSwitchElementFromBeltNrAndBeltDirNr(int, int);
240 int getBeltSwitchElementFromBeltNrAndBeltDir(int, int);
241
242 unsigned int InitRND(int);
243 void InitGraphicInfo_EM(void);
244
245 void PlayMenuSoundExt(int);
246 void PlayMenuSound();
247 void PlayMenuSoundStereo(int, int);
248 void PlayMenuSoundIfLoopExt(int);
249 void PlayMenuSoundIfLoop();
250 void PlayMenuMusicExt(int);
251 void PlayMenuMusic();
252 void PlaySoundActivating();
253 void PlaySoundSelecting();
254
255 void ToggleFullscreenIfNeeded();
256 void ChangeViewportPropertiesIfNeeded();
257
258 #endif  /* TOOLS_H */