fixed bug with CE actions "show envelope" and "exit player" when moving
[rocksndiamonds.git] / src / game_mm / mm_init.c
1 // ============================================================================
2 // Mirror Magic -- McDuffin's Revenge
3 // ----------------------------------------------------------------------------
4 // (c) 1994-2017 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // mm_init.c
10 // ============================================================================
11
12 #include "main_mm.h"
13
14 #include "mm_main.h"
15
16
17 struct EngineSnapshotInfo_MM engine_snapshot_mm;
18
19
20 unsigned int InitEngineRandom_MM(int seed)
21 {
22   return InitEngineRandom(seed);
23 }
24
25 void InitElementProperties_MM(void)
26 {
27   int i,j;
28
29   static int ep_grid[] =
30   {
31     EL_GRID_STEEL_00,
32     EL_GRID_STEEL_01,
33     EL_GRID_STEEL_02,
34     EL_GRID_STEEL_03,
35     EL_GRID_WOOD_00,
36     EL_GRID_WOOD_01,
37     EL_GRID_WOOD_02,
38     EL_GRID_WOOD_03,
39   };
40   static int ep_grid_num = sizeof(ep_grid) / sizeof(int);
41
42   static int ep_mcduffin[] =
43   {
44     EL_MCDUFFIN_RIGHT,
45     EL_MCDUFFIN_UP,
46     EL_MCDUFFIN_LEFT,
47     EL_MCDUFFIN_DOWN,
48   };
49   static int ep_mcduffin_num = sizeof(ep_mcduffin) / sizeof(int);
50
51   static int ep_rectangle[] =
52   {
53     EL_EXIT_CLOSED,
54     EL_EXIT_OPENING_1,
55     EL_EXIT_OPENING_2,
56     EL_EXIT_OPEN,
57     EL_BLOCK_STONE,
58     EL_BLOCK_WOOD,
59     EL_GATE_STONE,
60     EL_GATE_WOOD
61   };
62   static int ep_rectangle_num = sizeof(ep_rectangle) / sizeof(int);
63
64   static int ep_mirror[] =
65   {
66     EL_MIRROR_00,
67     EL_MIRROR_01,
68     EL_MIRROR_02,
69     EL_MIRROR_03,
70     EL_MIRROR_04,
71     EL_MIRROR_05,
72     EL_MIRROR_06,
73     EL_MIRROR_07,
74     EL_MIRROR_08,
75     EL_MIRROR_09,
76     EL_MIRROR_10,
77     EL_MIRROR_11,
78     EL_MIRROR_12,
79     EL_MIRROR_13,
80     EL_MIRROR_14,
81     EL_MIRROR_15,
82   };
83   static int ep_mirror_num = sizeof(ep_mirror) / sizeof(int);
84
85   static int ep_mirror_fixed[] =
86   {
87     EL_MIRROR_FIXED_00,
88     EL_MIRROR_FIXED_01,
89     EL_MIRROR_FIXED_02,
90     EL_MIRROR_FIXED_03,
91   };
92   static int ep_mirror_fixed_num = sizeof(ep_mirror_fixed) / sizeof(int);
93
94   static int ep_polar[] =
95   {
96     EL_POLAR_00,
97     EL_POLAR_01,
98     EL_POLAR_02,
99     EL_POLAR_03,
100     EL_POLAR_04,
101     EL_POLAR_05,
102     EL_POLAR_06,
103     EL_POLAR_07,
104     EL_POLAR_08,
105     EL_POLAR_09,
106     EL_POLAR_10,
107     EL_POLAR_11,
108     EL_POLAR_12,
109     EL_POLAR_13,
110     EL_POLAR_14,
111     EL_POLAR_15,
112   };
113   static int ep_polar_num = sizeof(ep_polar) / sizeof(int);
114
115   static int ep_polar_cross[] =
116   {
117     EL_POLAR_CROSS_00,
118     EL_POLAR_CROSS_01,
119     EL_POLAR_CROSS_02,
120     EL_POLAR_CROSS_03,
121   };
122   static int ep_polar_cross_num = sizeof(ep_polar_cross) / sizeof(int);
123
124   static int ep_beamer[] =
125   {
126     EL_BEAMER_00,
127     EL_BEAMER_01,
128     EL_BEAMER_02,
129     EL_BEAMER_03,
130     EL_BEAMER_04,
131     EL_BEAMER_05,
132     EL_BEAMER_06,
133     EL_BEAMER_07,
134     EL_BEAMER_08,
135     EL_BEAMER_09,
136     EL_BEAMER_10,
137     EL_BEAMER_11,
138     EL_BEAMER_12,
139     EL_BEAMER_13,
140     EL_BEAMER_14,
141     EL_BEAMER_15,
142   };
143   static int ep_beamer_num = sizeof(ep_beamer) / sizeof(int);
144
145   static int ep_reflecting[] =
146   {
147   };
148   static int ep_reflecting_num = sizeof(ep_reflecting) / sizeof(int);
149
150   static int ep_absorbing[] =
151   {
152   };
153   static int ep_absorbing_num = sizeof(ep_absorbing) / sizeof(int);
154
155   static int ep_inactive[] =
156   {
157   };
158   static int ep_inactive_num = sizeof(ep_inactive) / sizeof(int);
159
160   static int ep_wall[] =
161   {
162   };
163   static int ep_wall_num = sizeof(ep_wall) / sizeof(int);
164
165   static int ep_pacman[] =
166   {
167     EL_PACMAN_RIGHT,
168     EL_PACMAN_UP,
169     EL_PACMAN_LEFT,
170     EL_PACMAN_DOWN,
171   };
172   static int ep_pacman_num = sizeof(ep_pacman) / sizeof(int);
173
174   static long ep_bit[] =
175   {
176     EP_BIT_GRID,
177     EP_BIT_MCDUFFIN,
178     EP_BIT_RECTANGLE,
179     EP_BIT_MIRROR,
180     EP_BIT_MIRROR_FIXED,
181     EP_BIT_POLAR,
182     EP_BIT_POLAR_CROSS,
183     EP_BIT_BEAMER,
184     EP_BIT_REFLECTING,
185     EP_BIT_ABSORBING,
186     EP_BIT_INACTIVE,
187     EP_BIT_WALL,
188     EP_BIT_PACMAN,
189   };
190   static int *ep_array[] =
191   {
192     ep_grid,
193     ep_mcduffin,
194     ep_rectangle,
195     ep_mirror,
196     ep_mirror_fixed,
197     ep_polar,
198     ep_polar_cross,
199     ep_beamer,
200     ep_reflecting,
201     ep_absorbing,
202     ep_inactive,
203     ep_wall,
204     ep_pacman,
205   };
206   static int *ep_num[] =
207   {
208     &ep_grid_num,
209     &ep_mcduffin_num,
210     &ep_rectangle_num,
211     &ep_mirror_num,
212     &ep_mirror_fixed_num,
213     &ep_polar_num,
214     &ep_polar_cross_num,
215     &ep_beamer_num,
216     &ep_reflecting_num,
217     &ep_absorbing_num,
218     &ep_inactive_num,
219     &ep_wall_num,
220     &ep_pacman_num,
221   };
222   static int num_properties = sizeof(ep_num) / sizeof(int *);
223
224   for(i = 0; i < MAX_ELEMENTS; i++)
225     Elementeigenschaften[i] = 0;
226
227   for(i = 0; i < num_properties; i++)
228     for(j = 0; j < *(ep_num[i]); j++)
229       Elementeigenschaften[(ep_array[i])[j]] |= ep_bit[i];
230
231   for(i = EL_CHAR_START; i <= EL_CHAR_END; i++)
232     Elementeigenschaften[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
233
234   for(i = EL_WALL_START; i <= EL_WALL_END; i++)
235     Elementeigenschaften[i] |= EP_BIT_WALL;
236 }
237
238 void mm_open_all(void)
239 {
240   InitElementProperties_MM();
241 }
242
243 void mm_close_all(void)
244 {
245 }