From: Holger Schemel Date: Thu, 13 Feb 2020 17:41:22 +0000 (+0100) Subject: renamed some fields in level structure for EM engine X-Git-Tag: 4.2.0.0~120 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=724fbe31d039f8b7272f45b18f18a8d9ea2281df;p=rocksndiamonds.git renamed some fields in level structure for EM engine --- diff --git a/src/files.c b/src/files.c index 15f43aa6..5958d83c 100644 --- a/src/files.c +++ b/src/files.c @@ -3521,8 +3521,8 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) cav->width = MIN(level->fieldx, MAX_PLAYFIELD_WIDTH); cav->height = MIN(level->fieldy, MAX_PLAYFIELD_HEIGHT); - cav->time_seconds = level->time; - cav->required_initial = level->gems_needed; + cav->time_seconds = level->time; + cav->required = level->gems_needed; cav->emerald_score = level->score[SC_EMERALD]; cav->diamond_score = level->score[SC_DIAMOND]; @@ -3542,13 +3542,13 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) map_element_RND_to_EM(level->yamyam_content[i].e[x][y]); cav->amoeba_time = level->amoeba_speed; - cav->wonderwall_time_initial = level->time_magic_wall; + cav->wonderwall_time = level->time_magic_wall; cav->wheel_time = level->time_wheel; cav->android_move_time = level->android_move_time; cav->android_clone_time = level->android_clone_time; cav->ball_random = level->ball_random; - cav->ball_state_initial = level->ball_state_initial; + cav->ball_state = level->ball_state_initial; cav->ball_time = level->ball_time; cav->num_ball_arrays = level->num_ball_contents; @@ -3559,10 +3559,10 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) cav->lenses_time = level->lenses_time; cav->magnify_time = level->magnify_time; - cav->wind_direction_initial = + cav->wind_direction = map_direction_RND_to_EM(level->wind_direction_initial); - cav->wind_cnt_initial = (level->wind_direction_initial != MV_NONE ? - cav->wind_time : 0); + cav->wind_cnt = (level->wind_direction_initial != MV_NONE ? + cav->wind_time : 0); for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) for (j = 0; j < 8; j++) @@ -3575,7 +3575,7 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) // first fill the complete playfield with the default border element for (y = 0; y < EM_MAX_CAVE_HEIGHT; y++) for (x = 0; x < EM_MAX_CAVE_WIDTH; x++) - cav->cave_raw[x][y] = Zborder; + cav->cave[x][y] = Zborder; // then copy the real level contents from level file into the playfield for (y = 0; y < cav->height; y++) for (x = 0; x < cav->width; x++) @@ -3585,7 +3585,7 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) if (level->field[x][y] == EL_AMOEBA_DEAD) new_element = map_element_RND_to_EM(EL_AMOEBA_WET); - cav->cave_raw[x][y] = new_element; + cav->cave[x][y] = new_element; } for (i = 0; i < MAX_PLAYERS; i++) @@ -3604,7 +3604,7 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) cav->player_x[player_nr] = x; cav->player_y[player_nr] = y; - cav->cave_raw[x][y] = map_element_RND_to_EM(EL_EMPTY); + cav->cave[x][y] = map_element_RND_to_EM(EL_EMPTY); } } } @@ -3630,7 +3630,7 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) level->fieldy = MIN(cav->height, MAX_LEV_FIELDY); level->time = cav->time_seconds; - level->gems_needed = cav->required_initial; + level->gems_needed = cav->required; sprintf(level->name, "Level %d", level->file_info.nr); @@ -3654,13 +3654,13 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) map_element_EM_to_RND(cav->eater_array[i][y * 3 + x]); level->amoeba_speed = cav->amoeba_time; - level->time_magic_wall = cav->wonderwall_time_initial; + level->time_magic_wall = cav->wonderwall_time; level->time_wheel = cav->wheel_time; level->android_move_time = cav->android_move_time; level->android_clone_time = cav->android_clone_time; level->ball_random = cav->ball_random; - level->ball_state_initial = cav->ball_state_initial; + level->ball_state_initial = cav->ball_state; level->ball_time = cav->ball_time; level->num_ball_contents = cav->num_ball_arrays; @@ -3672,7 +3672,7 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) level->magnify_time = cav->magnify_time; level->wind_direction_initial = - map_direction_EM_to_RND(cav->wind_direction_initial); + map_direction_EM_to_RND(cav->wind_direction); for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) for (j = 0; j < 8; j++) @@ -3684,7 +3684,7 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) // convert the playfield (some elements need special treatment) for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++) { - int new_element = map_element_EM_to_RND(cav->cave_raw[x][y]); + int new_element = map_element_EM_to_RND(cav->cave[x][y]); if (new_element == EL_AMOEBA_WET && level->amoeba_speed == 0) new_element = EL_AMOEBA_DEAD; diff --git a/src/game_em/cave.c b/src/game_em/cave.c index de52ccf6..43732aa1 100644 --- a/src/game_em/cave.c +++ b/src/game_em/cave.c @@ -28,29 +28,23 @@ void setLevelInfoToDefaults_EM(void) cav.player_y[i] = -1; } - cav.lenses_cnt_initial = 0; - cav.magnify_cnt_initial = 0; + cav.lenses_cnt = 0; + cav.magnify_cnt = 0; - cav.wheel_cnt_initial = 0; - cav.wheel_x_initial = 1; - cav.wheel_y_initial = 1; + cav.wheel_cnt = 0; + cav.wheel_x = 1; + cav.wheel_y = 1; cav.wind_time = 9999; - cav.wind_cnt_initial = 0; + cav.wind_cnt = 0; - cav.wonderwall_state_initial = 0; - cav.wonderwall_time_initial = 0; + cav.wonderwall_state = 0; + cav.wonderwall_time = 0; cav.num_ball_arrays = 8; for (i = 0; i < TILE_MAX; i++) cav.android_array[i] = Xblank; - - for (i = 0; i < MAX_PLAYERS; i++) - { - ply[i].exists = 0; - ply[i].alive_initial = FALSE; - } } diff --git a/src/game_em/cave.h b/src/game_em/cave.h index 936f2848..36446707 100644 --- a/src/game_em/cave.h +++ b/src/game_em/cave.h @@ -8,25 +8,25 @@ struct CAVE { - int width; /* playfield width */ - int height; /* playfield height */ + int width; /* cave width */ + int height; /* cave height */ int player_x[MAX_PLAYERS]; /* player x pos */ int player_y[MAX_PLAYERS]; /* player y pos */ int time_seconds; /* available time (seconds) */ - int required_initial; /* emeralds needed */ + int required; /* emeralds needed */ int alien_score; /* score for killing alien */ int amoeba_time; /* amoeba speed */ - int android_move_cnt_initial; /* android move counter (initial) */ + int android_move_cnt; /* android move counter */ int android_move_time; /* android move reset time */ - int android_clone_cnt_initial;/* android clone counter (initial) */ + int android_clone_cnt; /* android clone counter */ int android_clone_time; /* android clone reset time */ int ball_cnt; /* ball counter */ int ball_pos; /* ball array pos counter */ int ball_random; /* ball is random flag */ - int ball_state_initial; /* ball active flag (initial) */ + int ball_state; /* ball active flag */ int ball_time; /* ball reset time */ int bug_score; /* score for killing bug */ int diamond_score; /* score for collecting diamond */ @@ -36,25 +36,25 @@ struct CAVE int emerald_score; /* score for collecting emerald */ int exit_score; /* score for entering exit */ int key_score; /* score for colleting key */ - int lenses_cnt_initial; /* lenses counter (initial) */ + int lenses_cnt; /* lenses counter */ int lenses_score; /* score for collecting lenses */ int lenses_time; /* lenses reset time */ - int magnify_cnt_initial; /* magnify counter (initial) */ + int magnify_cnt; /* magnify counter */ int magnify_score; /* score for collecting magnifier */ int magnify_time; /* magnify reset time */ int nut_score; /* score for cracking nut */ int shine_cnt; /* shine counter for emerald/diamond */ int slurp_score; /* score for slurping alien */ int tank_score; /* score for killing tank */ - int wheel_cnt_initial; /* wheel counter (initial) */ - int wheel_x_initial; /* wheel x pos (initial) */ - int wheel_y_initial; /* wheel y pos (initial) */ + int wheel_cnt; /* wheel counter */ + int wheel_x; /* wheel x pos */ + int wheel_y; /* wheel y pos */ int wheel_time; /* wheel reset time */ - int wind_cnt_initial; /* wind counter (initial) */ - int wind_direction_initial; /* wind direction (initial) */ + int wind_cnt; /* wind time counter */ + int wind_direction; /* wind direction */ int wind_time; /* wind reset time */ - int wonderwall_state_initial; /* wonderwall active flag (initial) */ - int wonderwall_time_initial; /* wonderwall time (initial) */ + int wonderwall_state; /* wonderwall active flag */ + int wonderwall_time; /* wonderwall time */ int num_ball_arrays; /* number of ball data arrays used */ @@ -62,7 +62,7 @@ struct CAVE short ball_array[8][8]; /* ball data */ short android_array[TILE_MAX]; /* android clone table */ - short cave_raw[CAVE_WIDTH][CAVE_HEIGHT]; + short cave[CAVE_WIDTH][CAVE_HEIGHT]; /* cave data */ }; #endif // CAVE_H diff --git a/src/game_em/convert.c b/src/game_em/convert.c index 3510b25f..7d5d3ef0 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -41,7 +41,7 @@ void prepare_em_level(void) for (x = 0; x < lev.width; x++) for (y = 0; y < lev.height; y++) - lev.cave[lev.left + x][lev.top + y] = cav.cave_raw[x][y]; + lev.cave[lev.left + x][lev.top + y] = cav.cave[x][y]; for (x = lev.left; x < lev.right; x++) for (y = lev.top; y < lev.bottom; y++) @@ -49,7 +49,7 @@ void prepare_em_level(void) lev.time = cav.time_seconds; - lev.required = cav.required_initial; + lev.required = cav.required; lev.score = 0; lev.eater_score = cav.eater_score; @@ -76,7 +76,7 @@ void prepare_em_level(void) lev.ball_time = cav.ball_time; lev.ball_cnt = cav.ball_time; - lev.ball_state = cav.ball_state_initial; + lev.ball_state = cav.ball_state; lev.ball_random = cav.ball_random; lev.ball_pos = 0; @@ -84,22 +84,22 @@ void prepare_em_level(void) lev.shine_cnt = 0; lev.lenses_time = cav.lenses_time; - lev.lenses_cnt = cav.lenses_cnt_initial; + lev.lenses_cnt = cav.lenses_cnt; lev.magnify_time = cav.magnify_time; - lev.magnify_cnt = cav.magnify_cnt_initial; + lev.magnify_cnt = cav.magnify_cnt; lev.wheel_time = cav.wheel_time; - lev.wheel_cnt = cav.wheel_cnt_initial; - lev.wheel_x = cav.wheel_x_initial; - lev.wheel_y = cav.wheel_y_initial; + lev.wheel_cnt = cav.wheel_cnt; + lev.wheel_x = cav.wheel_x; + lev.wheel_y = cav.wheel_y; lev.wind_time = cav.wind_time; - lev.wind_cnt = cav.wind_cnt_initial; - lev.wind_direction = cav.wind_direction_initial; + lev.wind_cnt = cav.wind_cnt; + lev.wind_direction = cav.wind_direction; - lev.wonderwall_time = cav.wonderwall_time_initial; - lev.wonderwall_state = cav.wonderwall_state_initial; + lev.wonderwall_time = cav.wonderwall_time; + lev.wonderwall_state = cav.wonderwall_state; lev.killed_out_of_time = FALSE; diff --git a/src/game_em/emerald.h b/src/game_em/emerald.h index 38a2656f..b2fbc165 100644 --- a/src/game_em/emerald.h +++ b/src/game_em/emerald.h @@ -620,13 +620,13 @@ enum struct LOGIC { - int width; /* playfield width */ - int height; /* playfield height */ + int width; /* cave width */ + int height; /* cave height */ - int left; /* playfield left edge */ - int top; /* playfield top edge */ - int right; /* playfield right edge */ - int bottom; /* playfield bottom edge */ + int left; /* cave left edge */ + int top; /* cave top edge */ + int right; /* cave right edge */ + int bottom; /* cave bottom edge */ int time; /* time remaining */ int required; /* emeralds needed */ diff --git a/src/game_em/reademc.c b/src/game_em/reademc.c index 0ee0e17b..705de11d 100644 --- a/src/game_em/reademc.c +++ b/src/game_em/reademc.c @@ -333,7 +333,7 @@ void convert_em_level(unsigned char *src, int file_version) if (cav.time_seconds > 9999) cav.time_seconds = 9999; - cav.required_initial = src[2095]; + cav.required = src[2095]; /* scores */ @@ -367,40 +367,40 @@ void convert_em_level(unsigned char *src, int file_version) temp = 9999; cav.amoeba_time = temp; - cav.wonderwall_time_initial = GET_BE16(src[2102]); + cav.wonderwall_time = GET_BE16(src[2102]); - cav.wind_cnt_initial = src[2149] & 15 ? cav.wind_time : 0; + cav.wind_cnt = src[2149] & 15 ? cav.wind_time : 0; temp = src[2149]; - cav.wind_direction_initial = (temp & 8 ? 0 : - temp & 1 ? 1 : - temp & 2 ? 2 : - temp & 4 ? 3 : 0); + cav.wind_direction = (temp & 8 ? 0 : + temp & 1 ? 1 : + temp & 2 ? 2 : + temp & 4 ? 3 : 0); /* global flags */ - cav.ball_random = src[2162] & 1 ? 1 : 0; - cav.ball_state_initial = src[2162] & 128 ? 1 : 0; + cav.ball_random = src[2162] & 1 ? 1 : 0; + cav.ball_state = src[2162] & 128 ? 1 : 0; for (temp = 1; temp < 2047; temp++) { switch (src[temp]) { case 36: /* wonderwall */ - cav.wonderwall_state_initial = 1; - cav.wonderwall_time_initial = 9999; + cav.wonderwall_state = 1; + cav.wonderwall_time = 9999; break; case 40: /* wheel */ - cav.wheel_x_initial = temp & 63; - cav.wheel_y_initial = temp >> 6; - cav.wheel_cnt_initial = cav.wheel_time; + cav.wheel_x = temp & 63; + cav.wheel_y = temp >> 6; + cav.wheel_cnt = cav.wheel_time; break; case 163: /* fake blank */ - cav.lenses_cnt_initial = 9999; + cav.lenses_cnt = 9999; break; case 164: /* fake grass */ - cav.magnify_cnt_initial = 9999; + cav.magnify_cnt = 9999; break; } } @@ -456,18 +456,18 @@ void convert_em_level(unsigned char *src, int file_version) /* first fill the complete playfield with the default border element */ for (y = 0; y < CAVE_HEIGHT; y++) for (x = 0; x < CAVE_WIDTH; x++) - cav.cave_raw[x][y] = Zborder; + cav.cave[x][y] = Zborder; /* then copy the real level contents from level file into the playfield */ temp = 0; for (y = 0; y < cav.height; y++) for (x = 0; x < cav.width; x++) - cav.cave_raw[x][y] = map_emc[src[temp++]]; + cav.cave[x][y] = map_emc[src[temp++]]; /* at last, set the two players at their positions in the playfield */ /* (native EM[C] levels always have exactly two players in a level) */ for (i = 0; i < 2; i++) - cav.cave_raw[cav.player_x[i]][cav.player_y[i]] = Zplayer; + cav.cave[cav.player_x[i]][cav.player_y[i]] = Zplayer; native_em_level.file_version = file_version; }