rnd-20100407-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 void DrawGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
107 void DrawGraphicAnimation(int, int, int);
108 void DrawLevelGraphicAnimation(int, int, int);
109 void DrawLevelElementAnimation(int, int, int);
110 void DrawLevelGraphicAnimationIfNeeded(int, int, int);
111 void DrawLevelElementAnimationIfNeeded(int, int, int);
112
113 void DrawAllPlayers(void);
114 void DrawPlayerField(int, int);
115 void DrawPlayer(struct PlayerInfo *);
116
117 void getSizedGraphicSource(int, int, int, Bitmap **, int *, int *);
118 void getMiniGraphicSource(int, Bitmap **, int *, int *);
119 void getGraphicSourceExt(int, int, Bitmap **, int *, int *, boolean);
120 void getGraphicSource(int, int, Bitmap **, int *, int *);
121 void DrawGraphic(int, int, int, int);
122 void DrawGraphicExt(DrawBuffer *, int, int, int, int);
123 void DrawGraphicThruMask(int, int, int, int);
124 void DrawGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
125
126 void DrawSizedGraphic(int, int, int, int, int);
127 void DrawSizedGraphicExt(DrawBuffer *, int, int, int, int, int);
128 void DrawMiniGraphic(int, int, int);
129 void DrawMiniGraphicExt(DrawBuffer *, int, int, int);
130
131 void DrawScreenElementExt(int, int, int, int, int, int, int);
132 void DrawLevelElementExt(int, int, int, int, int, int, int);
133 void DrawScreenElementShifted(int, int, int, int, int, int);
134 void DrawLevelElementShifted(int, int, int, int, int, int);
135 void DrawScreenElementThruMask(int, int, int);
136 void DrawLevelElementThruMask(int, int, int);
137 void DrawLevelFieldThruMask(int, int);
138 void DrawLevelFieldCrumbled(int, int);
139 void DrawLevelFieldCrumbledDigging(int, int, int, int);
140 void DrawLevelFieldCrumbledNeighbours(int, int);
141 void DrawScreenElement(int, int, int);
142 void DrawLevelElement(int, int, int);
143 void DrawScreenField(int, int);
144 void DrawLevelField(int, int);
145
146 void DrawMiniElement(int, int, int);
147 void DrawMiniElementOrWall(int, int, int, int);
148
149 void ShowEnvelope();
150
151 void DrawLevel(void);
152 void DrawMiniLevel(int, int, int, int);
153 void DrawPreviewLevel(boolean);
154
155 void WaitForEventToContinue();
156 boolean Request(char *, unsigned int);
157 unsigned int OpenDoor(unsigned int);
158 unsigned int CloseDoor(unsigned int);
159 unsigned int GetDoorState(void);
160 unsigned int SetDoorState(unsigned int);
161 unsigned int MoveDoor(unsigned int);
162
163 void DrawSpecialEditorDoor();
164 void UndrawSpecialEditorDoor();
165
166 void CreateToolButtons();
167 void FreeToolButtons();
168
169 int map_element_RND_to_EM(int);
170 int map_element_EM_to_RND(int);
171 int map_direction_RND_to_EM(int);
172 int map_direction_EM_to_RND(int);
173
174 void map_android_clone_elements_RND_to_EM(struct LevelInfo *);
175 void map_android_clone_elements_EM_to_RND(struct LevelInfo *);
176
177 int map_element_RND_to_SP(int);
178 int map_element_SP_to_RND(int);
179 int map_action_SP_to_RND(int);
180
181 int get_next_element(int);
182 int el_act_dir2img(int, int, int);
183 int el_act2img(int, int);
184 int el_dir2img(int, int);
185 int el2baseimg(int);
186 int el2img(int);
187 int el2edimg(int);
188 int el2preimg(int);
189 int el2panelimg(int);
190 int font2baseimg(int);
191
192 int getBeltNrFromBeltElement(int);
193 int getBeltNrFromBeltActiveElement(int);
194 int getBeltNrFromBeltSwitchElement(int);
195 int getBeltDirNrFromBeltElement(int);
196 int getBeltDirNrFromBeltSwitchElement(int);
197 int getBeltDirFromBeltElement(int);
198 int getBeltDirFromBeltSwitchElement(int);
199 int getBeltElementFromBeltNrAndBeltDirNr(int, int);
200 int getBeltElementFromBeltNrAndBeltDir(int, int);
201 int getBeltSwitchElementFromBeltNrAndBeltDirNr(int, int);
202 int getBeltSwitchElementFromBeltNrAndBeltDir(int, int);
203
204 unsigned int InitRND(long);
205 void InitGraphicInfo_EM(void);
206
207 void PlayMenuSoundExt(int);
208 void PlayMenuSound();
209 void PlayMenuSoundStereo(int, int);
210 void PlayMenuSoundIfLoopExt(int);
211 void PlayMenuSoundIfLoop();
212 void PlayMenuMusicExt(int);
213 void PlayMenuMusic();
214 void PlaySoundActivating();
215 void PlaySoundSelecting();
216
217 void ToggleFullscreenIfNeeded();
218 void ChangeViewportPropertiesIfNeeded();
219
220 #endif  /* TOOLS_H */