#define MM_MAX_LEVEL_AUTHOR_LEN 32
-#define EL_EMPTY_NATIVE_MM 0
-#define EL_DF_EMPTY_NATIVE_MM 304
+#define EL_MM_START_1_NATIVE 0
+#define EL_MM_END_1_NATIVE 155
-#define EL_MM_START_NATIVE_MM 0
-#define EL_MM_END_NATIVE_MM 430
+#define EL_MM_CHAR_START_NATIVE 160
+#define EL_MM_CHAR_END_NATIVE 239
-#define EL_CHAR_START_NATIVE_MM 160
-#define EL_CHAR_END_NATIVE_MM 239
+#define EL_MM_START_2_NATIVE 240
+#define EL_MM_END_2_NATIVE 430
-#define EL_DF_START_NATIVE_MM 240
-#define EL_DF_END_NATIVE_MM 355
+#define EL_MM_RUNTIME_START_NATIVE 500
+#define EL_MM_RUNTIME_END_NATIVE 504
-#define EL_MM_RUNTIME_START_NATIVE_MM 500
-#define EL_MM_RUNTIME_END_NATIVE_MM 504
+#define EL_MM_DUMMY_START_NATIVE 700
+#define EL_MM_DUMMY_END_NATIVE 709
-#define EL_MM_DUMMY_START_NATIVE_MM 700
-#define EL_MM_DUMMY_END_NATIVE_MM 709
+/* elements to be specially mapped */
+#define EL_MM_EMPTY_NATIVE 0
+#define EL_DF_EMPTY_NATIVE 304
/* ------------------------------------------------------------------------- */
*/
/* "real" level elements */
#define EL_MM_START 0
+#define EL_MM_START_1 EL_MM_START
+
#define EL_EMPTY 0
#define EL_MIRROR_START 1
#define EL_MIRROR_00 (EL_MIRROR_START + 0)
#define EL_GRID_WOOD_END EL_GRID_WOOD_03
#define EL_FUEL_EMPTY 155
+#define EL_MM_END_1 155
+
#define EL_CHAR_START 160
#define EL_CHAR_ASCII0 (EL_CHAR_START-32)
#define EL_CHAR_AUSRUF (EL_CHAR_ASCII0+33)
(x) == CHAR_BYTE_UMLAUT_U ? EL_CHAR_UE : \
EL_CHAR_A + (x) - 'A')
+#define EL_MM_START_2 240
+
/* elements for "Deflektor" style levels */
-#define EL_DF_START 240
+#define EL_DF_START EL_MM_START_2
#define EL_DF_MIRROR_START EL_DF_START
#define EL_DF_MIRROR_00 (EL_DF_MIRROR_START + 0)
#define EL_DF_STEEL_WALL 429
#define EL_DF_WOODEN_WALL 430
-#define EL_MM_END 430
+#define EL_MM_END_2 430
+#define EL_MM_END EL_MM_END_2
/* "real" (and therefore drawable) runtime elements */
#define EL_EXIT_OPENING 500
return base_element + (element_phase + step + num_elements) % num_elements;
}
+static int map_element(int element)
+{
+ switch (element)
+ {
+ case EL_WALL_STEEL: return EL_STEEL_WALL;
+ case EL_WALL_WOOD: return EL_WOODEN_WALL;
+ case EL_WALL_ICE: return EL_ICE_WALL;
+ case EL_WALL_AMOEBA: return EL_AMOEBA_WALL;
+ case EL_DF_WALL_STEEL: return EL_DF_STEEL_WALL;
+ case EL_DF_WALL_WOOD: return EL_DF_WOODEN_WALL;
+
+ default: return element;
+ }
+}
+
int el2gfx(int element)
{
+ element = map_element(element);
+
switch (element)
{
case EL_LIGHTBALL:
#define EL_FROM_LEVEL_TEMPLATE 863
#define EL_MM_START 864
+#define EL_MM_START_1 EL_MM_START
+
#define EL_MM_EMPTY_SPACE (EL_MM_START + 0)
#define EL_MM_EMPTY EL_MM_EMPTY_SPACE
#define EL_MM_MIRROR_START (EL_MM_START + 1)
#define EL_MM_WOODEN_GRID_FIXED_END EL_MM_WOODEN_GRID_FIXED_03
#define EL_MM_FUEL_EMPTY (EL_MM_START + 155)
-#define EL_DF_START (EL_MM_START + 156)
+#define EL_MM_END_1 (EL_MM_START + 155)
+#define EL_MM_START_2 (EL_MM_START + 156)
+
+#define EL_DF_START EL_MM_START_2
#define EL_DF_START2 (EL_DF_START - 240)
#define EL_DF_MIRROR_START EL_DF_START
#define EL_DF_STEEL_WALL 1209
#define EL_DF_WOODEN_WALL 1210
-#define EL_MM_END (EL_DF_START2 + 430)
+#define EL_MM_END_2 (EL_DF_START2 + 430)
+#define EL_MM_END EL_MM_END_2
#define NUM_FILE_ELEMENTS 1211
int map_element_RND_to_MM(int element_rnd)
{
- return (element_rnd >= EL_CHAR_START &&
- element_rnd <= EL_CHAR_END ?
- EL_CHAR_START_NATIVE_MM + element_rnd - EL_CHAR_START :
+ return (element_rnd >= EL_MM_START_1 &&
+ element_rnd <= EL_MM_END_1 ?
+ EL_MM_START_1_NATIVE + element_rnd - EL_MM_START_1 :
- element_rnd >= EL_DF_START &&
- element_rnd <= EL_DF_END ?
- EL_DF_START_NATIVE_MM + element_rnd - EL_DF_START :
+ element_rnd >= EL_MM_START_2 &&
+ element_rnd <= EL_MM_END_2 ?
+ EL_MM_START_2_NATIVE + element_rnd - EL_MM_START_2 :
- element_rnd >= EL_MM_START &&
- element_rnd <= EL_MM_END ?
- EL_MM_START_NATIVE_MM + element_rnd - EL_MM_START :
+ element_rnd >= EL_CHAR_START &&
+ element_rnd <= EL_CHAR_END ?
+ EL_MM_CHAR_START_NATIVE + element_rnd - EL_CHAR_START :
element_rnd >= EL_MM_RUNTIME_START &&
element_rnd <= EL_MM_RUNTIME_END ?
- EL_MM_RUNTIME_START_NATIVE_MM + element_rnd - EL_MM_RUNTIME_START :
+ EL_MM_RUNTIME_START_NATIVE + element_rnd - EL_MM_RUNTIME_START :
element_rnd >= EL_MM_DUMMY_START &&
element_rnd <= EL_MM_DUMMY_END ?
- EL_MM_DUMMY_START_NATIVE_MM + element_rnd - EL_MM_DUMMY_START :
+ EL_MM_DUMMY_START_NATIVE + element_rnd - EL_MM_DUMMY_START :
- EL_EMPTY_NATIVE_MM);
+ EL_MM_EMPTY_NATIVE);
}
int map_element_MM_to_RND(int element_mm)
{
- return (element_mm == EL_EMPTY_NATIVE_MM ||
- element_mm == EL_DF_EMPTY_NATIVE_MM ?
+ return (element_mm == EL_MM_EMPTY_NATIVE ||
+ element_mm == EL_DF_EMPTY_NATIVE ?
EL_EMPTY :
- element_mm >= EL_CHAR_START_NATIVE_MM &&
- element_mm <= EL_CHAR_END_NATIVE_MM ?
- EL_CHAR_START + element_mm - EL_CHAR_START_NATIVE_MM :
+ element_mm >= EL_MM_START_1_NATIVE &&
+ element_mm <= EL_MM_END_1_NATIVE ?
+ EL_MM_START_1 + element_mm - EL_MM_START_1_NATIVE :
- element_mm >= EL_DF_START_NATIVE_MM &&
- element_mm <= EL_DF_END_NATIVE_MM ?
- EL_DF_START + element_mm - EL_DF_START_NATIVE_MM :
+ element_mm >= EL_MM_START_2_NATIVE &&
+ element_mm <= EL_MM_END_2_NATIVE ?
+ EL_MM_START_2 + element_mm - EL_MM_START_2_NATIVE :
- element_mm >= EL_MM_START_NATIVE_MM &&
- element_mm <= EL_MM_END_NATIVE_MM ?
- EL_MM_START + element_mm - EL_MM_START_NATIVE_MM :
+ element_mm >= EL_MM_CHAR_START_NATIVE &&
+ element_mm <= EL_MM_CHAR_END_NATIVE ?
+ EL_CHAR_START + element_mm - EL_MM_CHAR_START_NATIVE :
- element_mm >= EL_MM_RUNTIME_START_NATIVE_MM &&
- element_mm <= EL_MM_RUNTIME_END_NATIVE_MM ?
- EL_MM_RUNTIME_START + element_mm - EL_MM_RUNTIME_START_NATIVE_MM :
+ element_mm >= EL_MM_RUNTIME_START_NATIVE &&
+ element_mm <= EL_MM_RUNTIME_END_NATIVE ?
+ EL_MM_RUNTIME_START + element_mm - EL_MM_RUNTIME_START_NATIVE :
- element_mm >= EL_MM_DUMMY_START_NATIVE_MM &&
- element_mm <= EL_MM_DUMMY_END_NATIVE_MM ?
- EL_MM_DUMMY_START + element_mm - EL_MM_DUMMY_START_NATIVE_MM :
+ element_mm >= EL_MM_DUMMY_START_NATIVE &&
+ element_mm <= EL_MM_DUMMY_END_NATIVE ?
+ EL_MM_DUMMY_START + element_mm - EL_MM_DUMMY_START_NATIVE :
EL_EMPTY);
}