1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
7 // https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
10 // ============================================================================
19 // for DrawElementShifted
21 #define CUT_ABOVE (1 << 0)
22 #define CUT_BELOW (1 << 1)
23 #define CUT_LEFT (1 << 2)
24 #define CUT_RIGHT (1 << 3)
26 // for masking functions
31 #define DOOR_OPEN_1 (1 << 0)
32 #define DOOR_OPEN_2 (1 << 1)
33 #define DOOR_CLOSE_1 (1 << 2)
34 #define DOOR_CLOSE_2 (1 << 3)
35 #define DOOR_OPEN_ALL (DOOR_OPEN_1 | DOOR_OPEN_2)
36 #define DOOR_CLOSE_ALL (DOOR_CLOSE_1 | DOOR_CLOSE_2)
37 #define DOOR_ACTION_1 (DOOR_OPEN_1 | DOOR_CLOSE_1)
38 #define DOOR_ACTION_2 (DOOR_OPEN_2 | DOOR_CLOSE_2)
39 #define DOOR_ACTION (DOOR_ACTION_1 | DOOR_ACTION_2)
40 #define DOOR_COPY_BACK (1 << 4)
41 #define DOOR_NO_COPY_BACK (1 << 5)
42 #define DOOR_NO_DELAY (1 << 6)
43 #define DOOR_FORCE_ANIM (1 << 7)
44 #define DOOR_FORCE_REDRAW (1 << 8)
45 #define DOOR_GET_STATE (1 << 9)
46 #define DOOR_SET_STATE (1 << 10)
48 #define DOOR_1 (DOOR_ACTION_1)
49 #define DOOR_2 (DOOR_ACTION_2)
50 #define DOOR_OPEN (DOOR_OPEN_ALL)
51 #define DOOR_CLOSE (DOOR_CLOSE_ALL)
53 #define DOOR_INDEX_FROM_TOKEN(x) ((x) == DOOR_1 ? 0 : 1)
54 #define DOOR_TOKEN_FROM_INDEX(x) ((x) == 0 ? DOOR_1 ? : DOOR_2)
55 #define REDRAW_DOOR_FROM_TOKEN(x) ((x) == DOOR_1 ? REDRAW_DOOR_1 : \
59 #define REQ_ASK (1 << 0)
60 #define REQ_CONFIRM (1 << 1)
61 #define REQ_PLAYER (1 << 2)
62 #define REQ_STAY_OPEN (1 << 3)
63 #define REQ_STAY_CLOSED (1 << 4)
64 #define REQ_REOPEN (1 << 5)
66 #define REQUEST_WAIT_FOR_INPUT (REQ_ASK | REQ_CONFIRM | REQ_PLAYER)
69 int getFieldbufferOffsetX_RND(int, int);
70 int getFieldbufferOffsetY_RND(int, int);
72 int getLevelFromScreenX(int);
73 int getLevelFromScreenY(int);
75 int getScreenFieldSizeX(void);
76 int getScreenFieldSizeY(void);
78 void DumpTile(int, int);
79 void DumpTileFromScreen(int, int);
81 void DrawMaskedBorder_FIELD(void);
82 void DrawMaskedBorder_DOOR_1(void);
83 void DrawMaskedBorder_DOOR_2(void);
84 void DrawMaskedBorder_DOOR_3(void);
85 void DrawMaskedBorder_ALL(void);
86 void DrawMaskedBorder(int);
87 void DrawMaskedBorderToTarget(int);
88 void DrawTileCursor(int);
90 void SetDrawtoField(int);
91 int GetDrawtoField(void);
92 void RedrawPlayfield(void);
93 void BlitScreenToBitmapExt_RND(Bitmap *, int, int);
94 void BlitScreenToBitmap_RND(Bitmap *);
95 void BlitScreenToBitmap(Bitmap *);
96 void BackToFront(void);
97 void BackToFront_WithFrameDelay(unsigned int);
101 void FadeSetEnterMenu(void);
102 void FadeSetLeaveMenu(void);
103 void FadeSetEnterScreen(void);
104 void FadeSetNextScreen(void);
105 void FadeSetLeaveScreen(void);
106 void FadeSetFromType(int);
107 void FadeSetDisabled(void);
108 void FadeSkipNextFadeIn(void);
109 void FadeSkipNextFadeOut(void);
111 Bitmap *getGlobalBorderBitmapFromStatus(int);
113 void ClearField(void);
114 void SetWindowBackgroundImageIfDefined(int);
115 void SetMainBackgroundImageIfDefined(int);
116 void SetDoorBackgroundImageIfDefined(int);
117 void SetWindowBackgroundImage(int);
118 void SetMainBackgroundImage(int);
119 void SetDoorBackgroundImage(int);
120 void SetPanelBackground(void);
121 void DrawBackground(int, int, int, int);
122 void DrawBackgroundForFont(int, int, int, int, int);
123 void DrawBackgroundForGraphic(int, int, int, int, int);
124 boolean CheckIfGlobalBorderHasChanged(void);
125 void RedrawGlobalBorder(void);
127 void MarkTileDirty(int, int);
128 void SetBorderElement(void);
129 void FloodFillLevel(int, int, int, short[][MAX_LEV_FIELDY], int, int);
130 void FloodFillLevelExt(int, int, int, int, int y, short field[][y], int, int);
132 void SetRandomAnimationValue(int, int);
133 int getGraphicAnimationFrame(int, int);
134 int getGraphicAnimationFrameXY(int, int, int);
136 void DrawFixedGraphicAnimation(int, int, int);
137 void DrawFixedGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
139 void DrawLevelGraphicAnimation(int, int, int);
140 void DrawLevelElementAnimation(int, int, int);
141 void DrawLevelGraphicAnimationIfNeeded(int, int, int);
142 void DrawLevelElementAnimationIfNeeded(int, int, int);
144 void DrawAllPlayers(void);
145 void DrawPlayerField(int, int);
146 void DrawPlayer(struct PlayerInfo *);
148 void getGraphicSourceBitmap(int, int, Bitmap **);
149 void getGraphicSourceXY(int, int, int *, int *, boolean);
150 void getSizedGraphicSourceExt(int, int, int, Bitmap **, int *, int *, boolean);
151 void getSizedGraphicSource(int, int, int, Bitmap **, int *, int *);
152 void getFixedGraphicSource(int, int, Bitmap **, int *, int *);
153 void getMiniGraphicSource(int, Bitmap **, int *, int *);
154 void getGlobalAnimGraphicSource(int, int, Bitmap **, int *, int *);
155 void getGraphicSource(int, int, Bitmap **, int *, int *);
157 void DrawGraphic(int, int, int, int);
158 void DrawGraphicExt(DrawBuffer *, int, int, int, int);
159 void DrawGraphicThruMask(int, int, int, int);
160 void DrawGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
162 void DrawFixedGraphic(int, int, int, int);
163 void DrawFixedGraphicExt(DrawBuffer *, int, int, int, int);
164 void DrawFixedGraphicThruMask(int, int, int, int);
165 void DrawFixedGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
167 void DrawSizedGraphic(int, int, int, int, int);
168 void DrawSizedGraphicExt(DrawBuffer *, int, int, int, int, int);
169 void DrawSizedGraphicThruMask(int, int, int, int, int);
170 void DrawSizedGraphicThruMaskExt(DrawBuffer *, int, int, int, int, int);
172 void DrawMiniGraphic(int, int, int);
173 void DrawMiniGraphicExt(DrawBuffer *, int, int, int);
175 void DrawScreenElementExt(int, int, int, int, int, int, int);
176 void DrawLevelElementExt(int, int, int, int, int, int, int);
177 void DrawScreenElementShifted(int, int, int, int, int, int);
178 void DrawLevelElementShifted(int, int, int, int, int, int);
179 void DrawScreenElementThruMask(int, int, int);
180 void DrawLevelElementThruMask(int, int, int);
181 void DrawLevelFieldThruMask(int, int);
182 void DrawLevelFieldCrumbled(int, int);
183 void DrawLevelFieldCrumbledDigging(int, int, int, int);
184 void DrawLevelFieldCrumbledNeighbours(int, int);
185 void DrawScreenGraphic(int, int, int, int);
186 void DrawLevelGraphic(int, int, int, int);
187 void DrawScreenElement(int, int, int);
188 void DrawLevelElement(int, int, int);
189 void DrawScreenField(int, int);
190 void DrawLevelField(int, int);
192 void DrawSizedWallParts_MM(int, int, int, int, boolean, int);
193 void DrawSizedElement(int, int, int, int);
194 void DrawSizedElementThruMask(int, int, int, int);
195 void DrawSizedElementOrWall(int, int, int, int, int);
197 void DrawMiniElement(int, int, int);
198 void DrawMiniElementOrWall(int, int, int, int);
200 void ShowEnvelope(int);
201 void ShowEnvelopeDoor(char *, int);
202 void DrawEnvelopeRequestToScreen(int, int);
205 void DrawSizedLevel(int, int, int, int, int);
206 void DrawMiniLevel(int, int, int, int);
207 void DrawPreviewPlayers(void);
208 void DrawPreviewLevelInitial(void);
209 void DrawPreviewLevelAnimation(void);
211 void DrawNetworkPlayers(void);
212 void ClearNetworkPlayers(void);
214 void WaitForEventToContinue(void);
215 boolean Request(char *, unsigned int);
216 void InitGraphicCompatibilityInfo_Doors(void);
217 void InitDoors(void);
218 unsigned int OpenDoor(unsigned int);
219 unsigned int CloseDoor(unsigned int);
220 unsigned int GetDoorState(void);
221 unsigned int SetDoorState(unsigned int);
222 unsigned int MoveDoor(unsigned int);
224 void DrawSpecialEditorDoor(void);
225 void UndrawSpecialEditorDoor(void);
227 void CreateToolButtons(void);
228 void FreeToolButtons(void);
230 int map_element_RND_to_EM_cave(int);
231 int map_element_EM_to_RND_cave(int);
232 int map_element_EM_to_RND_game(int);
233 int map_direction_RND_to_EM(int);
234 int map_direction_EM_to_RND(int);
236 void map_android_clone_elements_RND_to_EM(struct LevelInfo *);
237 void map_android_clone_elements_EM_to_RND(struct LevelInfo *);
239 int map_element_RND_to_SP(int);
240 int map_element_SP_to_RND(int);
241 int map_action_SP_to_RND(int);
243 int map_element_RND_to_MM(int);
244 int map_element_MM_to_RND(int);
245 int map_action_MM_to_RND(int);
246 int map_sound_MM_to_RND(int);
247 int map_mm_wall_element(int);
248 int map_mm_wall_element_editor(int);
250 int get_next_element(int);
251 int el_act_dir2img(int, int, int);
252 int el_act2img(int, int);
253 int el_dir2img(int, int);
258 int el2panelimg(int);
259 int font2baseimg(int);
261 int getBeltNrFromBeltElement(int);
262 int getBeltNrFromBeltActiveElement(int);
263 int getBeltNrFromBeltSwitchElement(int);
264 int getBeltDirNrFromBeltElement(int);
265 int getBeltDirNrFromBeltSwitchElement(int);
266 int getBeltDirFromBeltElement(int);
267 int getBeltDirFromBeltSwitchElement(int);
268 int getBeltElementFromBeltNrAndBeltDirNr(int, int);
269 int getBeltElementFromBeltNrAndBeltDir(int, int);
270 int getBeltSwitchElementFromBeltNrAndBeltDirNr(int, int);
271 int getBeltSwitchElementFromBeltNrAndBeltDir(int, int);
273 unsigned int InitRND(int);
274 void InitGraphicInfo_EM(void);
276 void PlayMenuSoundExt(int);
277 void PlayMenuSound(void);
278 void PlayMenuSoundStereo(int, int);
279 void PlayMenuSoundIfLoopExt(int);
280 void PlayMenuSoundIfLoop(void);
281 void PlayMenuMusicExt(int);
282 void PlayMenuMusic(void);
283 void PlayMenuSoundsAndMusic(void);
284 void FadeMenuSoundsAndMusic(void);
285 void PlaySoundActivating(void);
286 void PlaySoundSelecting(void);
288 void SetAnimStatus(int);
289 void SetGameStatus(int);
290 void SetFontStatus(int);
291 void ResetFontStatus(void);
293 void SetLevelSetInfo(char *, int);
295 void ToggleFullscreenIfNeeded(void);
296 void ChangeWindowScalingIfNeeded(void);
297 void ChangeVsyncModeIfNeeded(void);
298 void ChangeViewportPropertiesIfNeeded(void);
300 boolean CheckIfAllViewportsHaveChanged(void);
301 boolean CheckFadeAll(void);
303 void OpenURL(char *);
304 void OpenURLFromHash(SetupFileHash *, int);
306 void TestGeneratingUUIDs(void);