rnd-20100624-1-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 void DumpTile(int, int);
63
64 void DrawMaskedBorder_FIELD();
65 void DrawMaskedBorder_DOOR_1();
66 void DrawMaskedBorder_DOOR_2();
67 void DrawMaskedBorder_DOOR_3();
68 void DrawMaskedBorder_ALL();
69 void DrawMaskedBorder(int);
70
71 void SetDrawtoField(int);
72 void RedrawPlayfield(boolean, int, int, int, int);
73 void BackToFront();
74
75 void FadeIn(int);
76 void FadeOut(int);
77 void FadeSetEnterMenu();
78 void FadeSetLeaveMenu();
79 void FadeSetEnterScreen();
80 void FadeSetNextScreen();
81 void FadeSetLeaveScreen();
82 void FadeSetFromType(int);
83 void FadeSetDisabled();
84 void FadeSkipNextFadeIn();
85 void FadeSkipNextFadeOut();
86
87 void ClearField();
88 void SetWindowBackgroundImageIfDefined(int);
89 void SetMainBackgroundImageIfDefined(int);
90 void SetDoorBackgroundImageIfDefined(int);
91 void SetWindowBackgroundImage(int);
92 void SetMainBackgroundImage(int);
93 void SetDoorBackgroundImage(int);
94 void SetPanelBackground();
95 void DrawBackground(int, int, int, int);
96 void DrawBackgroundForFont(int, int, int, int, int);
97 void DrawBackgroundForGraphic(int, int, int, int, int);
98
99 void MarkTileDirty(int, int);
100 void SetBorderElement();
101 void FloodFillLevel(int, int, int, short[MAX_LEV_FIELDX][MAX_LEV_FIELDY],
102                     int, int);
103
104 void SetRandomAnimationValue(int, int);
105 int getGraphicAnimationFrame(int, int);
106
107 void DrawGraphicAnimation(int, int, int);
108 void DrawGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
109
110 void DrawFixedGraphicAnimation(int, int, int);
111 void DrawFixedGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
112
113 void DrawLevelGraphicAnimation(int, int, int);
114 void DrawLevelElementAnimation(int, int, int);
115 void DrawLevelGraphicAnimationIfNeeded(int, int, int);
116 void DrawLevelElementAnimationIfNeeded(int, int, int);
117
118 void DrawAllPlayers(void);
119 void DrawPlayerField(int, int);
120 void DrawPlayer(struct PlayerInfo *);
121
122 void getSizedGraphicSourceExt(int, int, int, Bitmap **, int *, int *, boolean);
123 void getFixedGraphicSourceExt(int, int, Bitmap **, int *, int *, boolean);
124 void getSizedGraphicSource(int, int, int, Bitmap **, int *, int *);
125 void getFixedGraphicSource(int, int, Bitmap **, int *, int *);
126 void getMiniGraphicSource(int, Bitmap **, int *, int *);
127 void getGraphicSourceExt(int, int, Bitmap **, int *, int *, boolean);
128 void getGraphicSource(int, int, Bitmap **, int *, int *);
129
130 void DrawGraphic(int, int, int, int);
131 void DrawGraphicExt(DrawBuffer *, int, int, int, int);
132 void DrawGraphicThruMask(int, int, int, int);
133 void DrawGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
134
135 void DrawFixedGraphic(int, int, int, int);
136 void DrawFixedGraphicExt(DrawBuffer *, int, int, int, int);
137 void DrawFixedGraphicThruMask(int, int, int, int);
138 void DrawFixedGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
139
140 void DrawSizedGraphic(int, int, int, int, int);
141 void DrawSizedGraphicExt(DrawBuffer *, int, int, int, int, int);
142
143 void DrawMiniGraphic(int, int, int);
144 void DrawMiniGraphicExt(DrawBuffer *, int, int, int);
145
146 void DrawScreenElementExt(int, int, int, int, int, int, int);
147 void DrawLevelElementExt(int, int, int, int, int, int, int);
148 void DrawScreenElementShifted(int, int, int, int, int, int);
149 void DrawLevelElementShifted(int, int, int, int, int, int);
150 void DrawScreenElementThruMask(int, int, int);
151 void DrawLevelElementThruMask(int, int, int);
152 void DrawLevelFieldThruMask(int, int);
153 void DrawLevelFieldCrumbled(int, int);
154 void DrawLevelFieldCrumbledDigging(int, int, int, int);
155 void DrawLevelFieldCrumbledNeighbours(int, int);
156 void DrawScreenElement(int, int, int);
157 void DrawLevelElement(int, int, int);
158 void DrawScreenField(int, int);
159 void DrawLevelField(int, int);
160
161 void DrawMiniElement(int, int, int);
162 void DrawMiniElementOrWall(int, int, int, int);
163
164 void ShowEnvelope(int);
165 void ShowEnvelopeDoor(char *text, int);
166
167 void DrawLevel(void);
168 void DrawMiniLevel(int, int, int, int);
169 void DrawPreviewLevel(boolean);
170
171 void WaitForEventToContinue();
172 boolean Request(char *, unsigned int);
173 unsigned int OpenDoor(unsigned int);
174 unsigned int CloseDoor(unsigned int);
175 unsigned int GetDoorState(void);
176 unsigned int SetDoorState(unsigned int);
177 unsigned int MoveDoor(unsigned int);
178
179 void DrawSpecialEditorDoor();
180 void UndrawSpecialEditorDoor();
181
182 void CreateToolButtons();
183 void FreeToolButtons();
184
185 int map_element_RND_to_EM(int);
186 int map_element_EM_to_RND(int);
187 int map_direction_RND_to_EM(int);
188 int map_direction_EM_to_RND(int);
189
190 void map_android_clone_elements_RND_to_EM(struct LevelInfo *);
191 void map_android_clone_elements_EM_to_RND(struct LevelInfo *);
192
193 int map_element_RND_to_SP(int);
194 int map_element_SP_to_RND(int);
195 int map_action_SP_to_RND(int);
196
197 int get_next_element(int);
198 int el_act_dir2img(int, int, int);
199 int el_act2img(int, int);
200 int el_dir2img(int, int);
201 int el2baseimg(int);
202 int el2img(int);
203 int el2edimg(int);
204 int el2preimg(int);
205 int el2panelimg(int);
206 int font2baseimg(int);
207
208 int getBeltNrFromBeltElement(int);
209 int getBeltNrFromBeltActiveElement(int);
210 int getBeltNrFromBeltSwitchElement(int);
211 int getBeltDirNrFromBeltElement(int);
212 int getBeltDirNrFromBeltSwitchElement(int);
213 int getBeltDirFromBeltElement(int);
214 int getBeltDirFromBeltSwitchElement(int);
215 int getBeltElementFromBeltNrAndBeltDirNr(int, int);
216 int getBeltElementFromBeltNrAndBeltDir(int, int);
217 int getBeltSwitchElementFromBeltNrAndBeltDirNr(int, int);
218 int getBeltSwitchElementFromBeltNrAndBeltDir(int, int);
219
220 unsigned int InitRND(long);
221 void InitGraphicInfo_EM(void);
222
223 void PlayMenuSoundExt(int);
224 void PlayMenuSound();
225 void PlayMenuSoundStereo(int, int);
226 void PlayMenuSoundIfLoopExt(int);
227 void PlayMenuSoundIfLoop();
228 void PlayMenuMusicExt(int);
229 void PlayMenuMusic();
230 void PlaySoundActivating();
231 void PlaySoundSelecting();
232
233 void ToggleFullscreenIfNeeded();
234 void ChangeViewportPropertiesIfNeeded();
235
236 #endif  /* TOOLS_H */