From: Holger Schemel Date: Fri, 17 Feb 2017 22:15:25 +0000 (+0100) Subject: fixed mapping level file game elements between RND and MM formats X-Git-Tag: 4.1.0.0~220 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d6cdd73c614433eb90eede7cf5cc512b0ef0b721;p=rocksndiamonds.git fixed mapping level file game elements between RND and MM formats --- diff --git a/src/game_mm/export.h b/src/game_mm/export.h index 2bbd5dc4..b36ab430 100644 --- a/src/game_mm/export.h +++ b/src/game_mm/export.h @@ -18,17 +18,36 @@ #define MM_MAX_PLAYFIELD_SIZE (MM_MAX_PLAYFIELD_WIDTH * \ MM_MAX_PLAYFIELD_HEIGHT) -#define MAX_NUM_AMOEBA 100 -#define MAX_NUM_BEAMERS 8 +#define MAX_NUM_AMOEBA 100 +#define MAX_NUM_BEAMERS 8 -#define MAX_LASER_LEN 256 -#define MAX_LASER_ENERGY 100 -#define MAX_LASER_OVERLOAD 100 +#define MAX_LASER_LEN 256 +#define MAX_LASER_ENERGY 100 +#define MAX_LASER_OVERLOAD 100 -#define MM_LEVEL_SCORE_ELEMENTS 16 +#define MM_LEVEL_SCORE_ELEMENTS 16 -#define MM_MAX_LEVEL_NAME_LEN 32 -#define MM_MAX_LEVEL_AUTHOR_LEN 32 +#define MM_MAX_LEVEL_NAME_LEN 32 +#define MM_MAX_LEVEL_AUTHOR_LEN 32 + + +#define EL_EMPTY_NATIVE_MM 0 +#define EL_DF_EMPTY_NATIVE_MM 304 + +#define EL_MM_START_NATIVE_MM 0 +#define EL_MM_END_NATIVE_MM 430 + +#define EL_CHAR_START_NATIVE_MM 160 +#define EL_CHAR_END_NATIVE_MM 239 + +#define EL_DF_START_NATIVE_MM 240 +#define EL_DF_END_NATIVE_MM 355 + +#define EL_MM_RUNTIME_START_NATIVE_MM 500 +#define EL_MM_RUNTIME_END_NATIVE_MM 504 + +#define EL_MM_DUMMY_START_NATIVE_MM 700 +#define EL_MM_DUMMY_END_NATIVE_MM 709 /* ------------------------------------------------------------------------- */ diff --git a/src/tools.c b/src/tools.c index fcc82f30..fb1fc5ed 100644 --- a/src/tools.c +++ b/src/tools.c @@ -7230,12 +7230,56 @@ int map_action_SP_to_RND(int action_sp) int map_element_RND_to_MM(int element_rnd) { - return (element_rnd > 1000 ? element_rnd - 1000 : 0); + return (element_rnd >= EL_CHAR_START && + element_rnd <= EL_CHAR_END ? + EL_CHAR_START_NATIVE_MM + element_rnd - EL_CHAR_START : + + 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 && + element_rnd <= EL_MM_END ? + EL_MM_START_NATIVE_MM + element_rnd - EL_MM_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 : + + 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_EMPTY_NATIVE_MM); } int map_element_MM_to_RND(int element_mm) { - return 1000 + element_mm; + return (element_mm == EL_EMPTY_NATIVE_MM || + element_mm == EL_DF_EMPTY_NATIVE_MM ? + 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_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_NATIVE_MM && + element_mm <= EL_MM_END_NATIVE_MM ? + EL_MM_START + element_mm - EL_MM_START_NATIVE_MM : + + 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_DUMMY_START_NATIVE_MM && + element_mm <= EL_MM_DUMMY_END_NATIVE_MM ? + EL_MM_DUMMY_START + element_mm - EL_MM_DUMMY_START_NATIVE_MM : + + EL_EMPTY); } int get_next_element(int element)