1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
7 // http://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_REDRAW (1 << 7)
44 #define DOOR_GET_STATE (1 << 8)
45 #define DOOR_SET_STATE (1 << 9)
47 #define DOOR_1 (DOOR_ACTION_1)
48 #define DOOR_2 (DOOR_ACTION_2)
49 #define DOOR_OPEN (DOOR_OPEN_ALL)
50 #define DOOR_CLOSE (DOOR_CLOSE_ALL)
52 #define DOOR_INDEX_FROM_TOKEN(x) ((x) == DOOR_1 ? 0 : 1)
53 #define DOOR_TOKEN_FROM_INDEX(x) ((x) == 0 ? DOOR_1 ? : DOOR_2)
54 #define REDRAW_DOOR_FROM_TOKEN(x) ((x) == DOOR_1 ? REDRAW_DOOR_1 : \
58 #define REQ_ASK (1 << 0)
59 #define REQ_CONFIRM (1 << 1)
60 #define REQ_PLAYER (1 << 2)
61 #define REQ_STAY_OPEN (1 << 3)
62 #define REQ_STAY_CLOSED (1 << 4)
63 #define REQ_REOPEN (1 << 5)
65 #define REQUEST_WAIT_FOR_INPUT (REQ_ASK | REQ_CONFIRM | REQ_PLAYER)
68 void DumpTile(int, int);
70 void DrawMaskedBorder_FIELD();
71 void DrawMaskedBorder_DOOR_1();
72 void DrawMaskedBorder_DOOR_2();
73 void DrawMaskedBorder_DOOR_3();
74 void DrawMaskedBorder_ALL();
75 void DrawMaskedBorder(int);
76 void DrawMaskedBorderToTarget(int);
78 void SetDrawtoField(int);
79 void RedrawPlayfield();
80 void BlitScreenToBitmap_RND(Bitmap *);
81 void BlitScreenToBitmap(Bitmap *);
83 void BackToFront_WithFrameDelay(unsigned int);
87 void FadeSetEnterMenu();
88 void FadeSetLeaveMenu();
89 void FadeSetEnterScreen();
90 void FadeSetNextScreen();
91 void FadeSetLeaveScreen();
92 void FadeSetFromType(int);
93 void FadeSetDisabled();
94 void FadeSkipNextFadeIn();
95 void FadeSkipNextFadeOut();
97 Bitmap *getGlobalBorderBitmapFromStatus(int);
100 void SetWindowBackgroundImageIfDefined(int);
101 void SetMainBackgroundImageIfDefined(int);
102 void SetDoorBackgroundImageIfDefined(int);
103 void SetWindowBackgroundImage(int);
104 void SetMainBackgroundImage(int);
105 void SetDoorBackgroundImage(int);
106 void SetPanelBackground();
107 void DrawBackground(int, int, int, int);
108 void DrawBackgroundForFont(int, int, int, int, int);
109 void DrawBackgroundForGraphic(int, int, int, int, int);
110 boolean CheckIfGlobalBorderHasChanged();
111 void RedrawGlobalBorder();
113 void MarkTileDirty(int, int);
114 void SetBorderElement();
115 void FloodFillLevel(int, int, int, short[MAX_LEV_FIELDX][MAX_LEV_FIELDY],
118 void SetRandomAnimationValue(int, int);
119 int getGraphicAnimationFrame(int, int);
121 void DrawFixedGraphicAnimation(int, int, int);
122 void DrawFixedGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
124 void DrawLevelGraphicAnimation(int, int, int);
125 void DrawLevelElementAnimation(int, int, int);
126 void DrawLevelGraphicAnimationIfNeeded(int, int, int);
127 void DrawLevelElementAnimationIfNeeded(int, int, int);
129 void DrawAllPlayers(void);
130 void DrawPlayerField(int, int);
131 void DrawPlayer(struct PlayerInfo *);
133 void getGraphicSourceBitmap(int, int, Bitmap **);
134 void getGraphicSourceXY(int, int, int *, int *, boolean);
135 void getSizedGraphicSourceExt(int, int, int, Bitmap **, int *, int *, boolean);
136 void getFixedGraphicSourceExt(int, int, Bitmap **, int *, int *, boolean);
137 void getSizedGraphicSource(int, int, int, Bitmap **, int *, int *);
138 void getFixedGraphicSource(int, int, Bitmap **, int *, int *);
139 void getMiniGraphicSource(int, Bitmap **, int *, int *);
140 void getGraphicSource(int, int, Bitmap **, int *, int *);
142 void DrawGraphic(int, int, int, int);
143 void DrawGraphicExt(DrawBuffer *, int, int, int, int);
144 void DrawGraphicThruMask(int, int, int, int);
145 void DrawGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
147 void DrawFixedGraphic(int, int, int, int);
148 void DrawFixedGraphicExt(DrawBuffer *, int, int, int, int);
149 void DrawFixedGraphicThruMask(int, int, int, int);
150 void DrawFixedGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
152 void DrawSizedGraphic(int, int, int, int, int);
153 void DrawSizedGraphicExt(DrawBuffer *, int, int, int, int, int);
155 void DrawMiniGraphic(int, int, int);
156 void DrawMiniGraphicExt(DrawBuffer *, int, int, int);
158 void DrawScreenElementExt(int, int, int, int, int, int, int);
159 void DrawLevelElementExt(int, int, int, int, int, int, int);
160 void DrawScreenElementShifted(int, int, int, int, int, int);
161 void DrawLevelElementShifted(int, int, int, int, int, int);
162 void DrawScreenElementThruMask(int, int, int);
163 void DrawLevelElementThruMask(int, int, int);
164 void DrawLevelFieldThruMask(int, int);
165 void DrawLevelFieldCrumbled(int, int);
166 void DrawLevelFieldCrumbledDigging(int, int, int, int);
167 void DrawLevelFieldCrumbledNeighbours(int, int);
168 void DrawScreenElement(int, int, int);
169 void DrawLevelElement(int, int, int);
170 void DrawScreenField(int, int);
171 void DrawLevelField(int, int);
173 void DrawSizedElement(int, int, int, int);
174 void DrawSizedElementOrWall(int, int, int, int, int);
176 void DrawMiniElement(int, int, int);
177 void DrawMiniElementOrWall(int, int, int, int);
179 void ShowEnvelope(int);
180 void ShowEnvelopeDoor(char *text, int);
183 void DrawSizedLevel(int, int, int, int, int);
184 void DrawMiniLevel(int, int, int, int);
185 void DrawPreviewLevelInitial(void);
186 void DrawPreviewLevelAnimation(void);
188 void WaitForEventToContinue(void);
189 boolean Request(char *, unsigned int);
190 void InitGraphicCompatibilityInfo_Doors(void);
191 void InitDoors(void);
192 unsigned int OpenDoor(unsigned int);
193 unsigned int CloseDoor(unsigned int);
194 unsigned int GetDoorState(void);
195 unsigned int SetDoorState(unsigned int);
196 unsigned int MoveDoor(unsigned int);
198 void DrawSpecialEditorDoor();
199 void UndrawSpecialEditorDoor();
201 void CreateToolButtons();
202 void FreeToolButtons();
204 int map_element_RND_to_EM(int);
205 int map_element_EM_to_RND(int);
206 int map_direction_RND_to_EM(int);
207 int map_direction_EM_to_RND(int);
209 void map_android_clone_elements_RND_to_EM(struct LevelInfo *);
210 void map_android_clone_elements_EM_to_RND(struct LevelInfo *);
212 int map_element_RND_to_SP(int);
213 int map_element_SP_to_RND(int);
214 int map_action_SP_to_RND(int);
216 int get_next_element(int);
217 int el_act_dir2img(int, int, int);
218 int el_act2img(int, int);
219 int el_dir2img(int, int);
224 int el2panelimg(int);
225 int font2baseimg(int);
227 int getBeltNrFromBeltElement(int);
228 int getBeltNrFromBeltActiveElement(int);
229 int getBeltNrFromBeltSwitchElement(int);
230 int getBeltDirNrFromBeltElement(int);
231 int getBeltDirNrFromBeltSwitchElement(int);
232 int getBeltDirFromBeltElement(int);
233 int getBeltDirFromBeltSwitchElement(int);
234 int getBeltElementFromBeltNrAndBeltDirNr(int, int);
235 int getBeltElementFromBeltNrAndBeltDir(int, int);
236 int getBeltSwitchElementFromBeltNrAndBeltDirNr(int, int);
237 int getBeltSwitchElementFromBeltNrAndBeltDir(int, int);
239 unsigned int InitRND(int);
240 void InitGraphicInfo_EM(void);
242 void PlayMenuSoundExt(int);
243 void PlayMenuSound();
244 void PlayMenuSoundStereo(int, int);
245 void PlayMenuSoundIfLoopExt(int);
246 void PlayMenuSoundIfLoop();
247 void PlayMenuMusicExt(int);
248 void PlayMenuMusic();
249 void PlaySoundActivating();
250 void PlaySoundSelecting();
252 void SetAnimStatus(int);
253 void SetGameStatus(int);
254 void SetFontStatus(int);
255 void ResetFontStatus();
257 void ToggleFullscreenOrChangeWindowScalingIfNeeded();
258 void ChangeViewportPropertiesIfNeeded();