rnd-20070321-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_DIRECT             0
22 #define DRAW_BUFFERED           1
23 #define DRAW_BACKBUFFER         2
24
25 /* for DrawElementShifted */
26 #define NO_CUTTING              0
27 #define CUT_ABOVE               (1 << 0)
28 #define CUT_BELOW               (1 << 1)
29 #define CUT_LEFT                (1 << 2)
30 #define CUT_RIGHT               (1 << 3)
31
32 /* for masking functions */
33 #define NO_MASKING              0
34 #define USE_MASKING             1
35  
36 /* for MoveDoor */
37 #define DOOR_OPEN_1             (1 << 0)
38 #define DOOR_OPEN_2             (1 << 1)
39 #define DOOR_CLOSE_1            (1 << 2)
40 #define DOOR_CLOSE_2            (1 << 3)
41 #define DOOR_OPEN_ALL           (DOOR_OPEN_1 | DOOR_OPEN_2)
42 #define DOOR_CLOSE_ALL          (DOOR_CLOSE_1 | DOOR_CLOSE_2)
43 #define DOOR_ACTION_1           (DOOR_OPEN_1 | DOOR_CLOSE_1)
44 #define DOOR_ACTION_2           (DOOR_OPEN_2 | DOOR_CLOSE_2)
45 #define DOOR_ACTION             (DOOR_ACTION_1 | DOOR_ACTION_2)
46 #define DOOR_COPY_BACK          (1 << 4)
47 #define DOOR_NO_COPY_BACK       (1 << 5)
48 #define DOOR_NO_DELAY           (1 << 6)
49 #define DOOR_FORCE_REDRAW       (1 << 7)
50 #define DOOR_GET_STATE          (1 << 8)
51 #define DOOR_SET_STATE          (1 << 9)
52
53 /* for Request */
54 #define REQ_ASK                 (1 << 0)
55 #define REQ_CONFIRM             (1 << 1)
56 #define REQ_PLAYER              (1 << 2)
57 #define REQ_STAY_OPEN           (1 << 3)
58 #define REQ_STAY_CLOSED         (1 << 4)
59 #define REQ_REOPEN              (1 << 5)
60
61 #define REQUEST_WAIT_FOR_INPUT  (REQ_ASK | REQ_CONFIRM | REQ_PLAYER)
62
63 void DumpTile(int, int);
64
65 void DrawMaskedBorder_FIELD();
66 void DrawMaskedBorder_DOOR_1();
67 void DrawMaskedBorder_DOOR_2();
68 void DrawMaskedBorder_DOOR_3();
69 void DrawMaskedBorder_ALL();
70 void DrawMaskedBorder(int);
71
72 void SetDrawtoField(int);
73 void RedrawPlayfield(boolean, int, int, int, int);
74 void BackToFront();
75 void FadeToFront();
76
77 void FadeIn(int);
78 void FadeOut(int);
79 void FadeCross(int);
80 void FadeCrossSaveBackbuffer();
81 void FadeSetEnterMenu();
82 void FadeSetLeaveMenu();
83 void FadeSetStartItem();
84 void FadeSetFromType(int);
85 void FadeSetDisabled();
86 void FadeSkipNextFadeIn();
87 void FadeSkipNextFadeOut();
88
89 void ClearWindow();
90 void SetWindowBackgroundImageIfDefined(int);
91 void SetMainBackgroundImageIfDefined(int);
92 void SetDoorBackgroundImageIfDefined(int);
93 void SetWindowBackgroundImage(int);
94 void SetMainBackgroundImage(int);
95 void SetDoorBackgroundImage(int);
96 void SetPanelBackground();
97 void DrawBackground(int, int, int, int);
98 void DrawBackgroundForFont(int, int, int, int, int);
99 void DrawBackgroundForGraphic(int, int, int, int, int);
100
101 void MarkTileDirty(int, int);
102 void SetBorderElement();
103 void FloodFillLevel(int, int, int, short[MAX_LEV_FIELDX][MAX_LEV_FIELDY],
104                     int, int);
105
106 void SetRandomAnimationValue(int, int);
107 int getGraphicAnimationFrame(int, int);
108 void DrawGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
109 void DrawGraphicAnimation(int, int, int);
110 void DrawLevelGraphicAnimation(int, int, int);
111 void DrawLevelElementAnimation(int, int, int);
112 void DrawLevelGraphicAnimationIfNeeded(int, int, int);
113 void DrawLevelElementAnimationIfNeeded(int, int, int);
114
115 void DrawAllPlayers(void);
116 void DrawPlayerField(int, int);
117 void DrawPlayer(struct PlayerInfo *);
118
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 DrawMiniGraphic(int, int, int);
127 void getMiniGraphicSource(int, Bitmap **, int *, int *);
128 void DrawMiniGraphicExt(DrawBuffer *, int, int, int);
129
130 void DrawScreenElementExt(int, int, int, int, int, int, int);
131 void DrawLevelElementExt(int, int, int, int, int, int, int);
132 void DrawScreenElementShifted(int, int, int, int, int, int);
133 void DrawLevelElementShifted(int, int, int, int, int, int);
134 void DrawScreenElementThruMask(int, int, int);
135 void DrawLevelElementThruMask(int, int, int);
136 void DrawLevelFieldThruMask(int, int);
137 void DrawLevelFieldCrumbledSand(int, int);
138 void DrawLevelFieldCrumbledSandDigging(int, int, int, int);
139 void DrawLevelFieldCrumbledSandNeighbours(int, int);
140 void DrawScreenElement(int, int, int);
141 void DrawLevelElement(int, int, int);
142 void DrawScreenField(int, int);
143 void DrawLevelField(int, int);
144
145 void DrawMiniElement(int, int, int);
146 void DrawMiniElementOrWall(int, int, int, int);
147
148 void ShowEnvelope();
149
150 void DrawLevel(void);
151 void DrawMiniLevel(int, int, int, int);
152 void DrawPreviewLevel(boolean);
153
154 void WaitForEventToContinue();
155 boolean Request(char *, unsigned int);
156 unsigned int OpenDoor(unsigned int);
157 unsigned int CloseDoor(unsigned int);
158 unsigned int GetDoorState(void);
159 unsigned int SetDoorState(unsigned int);
160 unsigned int MoveDoor(unsigned int);
161
162 void DrawSpecialEditorDoor();
163 void UndrawSpecialEditorDoor();
164
165 void CreateToolButtons();
166 void FreeToolButtons();
167
168 int map_element_RND_to_EM(int);
169 int map_element_EM_to_RND(int);
170 int map_direction_RND_to_EM(int);
171 int map_direction_EM_to_RND(int);
172
173 void map_android_clone_elements_RND_to_EM(struct LevelInfo *);
174 void map_android_clone_elements_EM_to_RND(struct LevelInfo *);
175
176 int get_next_element(int);
177 int el_act_dir2img(int, int, int);
178 int el_act2img(int, int);
179 int el_dir2img(int, int);
180 int el2baseimg(int);
181 int el2img(int);
182 int el2edimg(int);
183 int el2preimg(int);
184 int font2baseimg(int);
185
186 int getBeltNrFromBeltElement(int);
187 int getBeltNrFromBeltActiveElement(int);
188 int getBeltNrFromBeltSwitchElement(int);
189 int getBeltDirNrFromBeltElement(int);
190 int getBeltDirNrFromBeltSwitchElement(int);
191 int getBeltDirFromBeltElement(int);
192 int getBeltDirFromBeltSwitchElement(int);
193 int getBeltElementFromBeltNrAndBeltDir(int, int);
194 int getBeltSwitchElementFromBeltNrAndBeltDir(int, int);
195
196 unsigned int InitRND(long);
197 void InitGraphicInfo_EM(void);
198
199 void PlayMenuSoundExt(int);
200 void PlayMenuSound();
201 void PlayMenuSoundStereo(int, int);
202 void PlayMenuSoundIfLoopExt(int);
203 void PlayMenuSoundIfLoop();
204 void PlayMenuMusicExt(int);
205 void PlayMenuMusic();
206 void PlaySoundActivating();
207 void PlaySoundSelecting();
208
209 void ToggleFullscreenIfNeeded();
210
211 #endif  /* TOOLS_H */