From: Holger Schemel Date: Mon, 10 Feb 2020 00:38:51 +0000 (+0100) Subject: changed order of cave parameter initializations in EM engine X-Git-Tag: 4.2.0.0~132 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2a861b43467aa2bc7ac5cc9b056ee6d5694a5b22;p=rocksndiamonds.git changed order of cave parameter initializations in EM engine --- diff --git a/src/game_em/reademc.c b/src/game_em/reademc.c index 2036e5cb..bad2bfbb 100644 --- a/src/game_em/reademc.c +++ b/src/game_em/reademc.c @@ -149,30 +149,15 @@ void convert_em_level(unsigned char *src, int file_version) }; int i, x, y, temp; + /* common to all emc caves */ + lev.time_seconds = GET_BE16(src[2110]); if (lev.time_seconds > 9999) lev.time_seconds = 9999; lev.required_initial = src[2095]; - for (i = 0; i < 2; i++) - { - temp = GET_BE16(src[2096 + i * 2]); - ply[i].x_initial = (temp & 63); - ply[i].y_initial = (temp >> 6 & 31); - } - - temp = GET_BE16(src[2100]) * 28; - if (temp > 9999) - temp = 9999; - lev.amoeba_time = temp; - - lev.android_move_time = GET_BE16(src[2164]); - lev.android_clone_time = GET_BE16(src[2166]); - - lev.ball_random = src[2162] & 1 ? 1 : 0; - lev.ball_state_initial = src[2162] & 128 ? 1 : 0; - lev.ball_time = GET_BE16(src[2160]); + /* scores */ lev.emerald_score = src[2084]; lev.diamond_score = src[2085]; @@ -189,25 +174,88 @@ void convert_em_level(unsigned char *src, int file_version) lev.magnify_score = src[2152]; lev.slurp_score = src[2153]; + /* times */ + + lev.android_move_time = GET_BE16(src[2164]); + lev.android_clone_time = GET_BE16(src[2166]); + lev.ball_time = GET_BE16(src[2160]); + lev.lenses_time = GET_BE16(src[2154]); lev.magnify_time = GET_BE16(src[2156]); lev.wheel_time = GET_BE16(src[2104]); + temp = GET_BE16(src[2100]) * 28; + if (temp > 9999) + temp = 9999; + lev.amoeba_time = temp; + + lev.wonderwall_time_initial = GET_BE16(src[2102]); + lev.wind_cnt_initial = src[2149] & 15 ? lev.wind_time : 0; temp = src[2149]; lev.wind_direction_initial = (temp & 8 ? 0 : temp & 1 ? 1 : temp & 2 ? 2 : temp & 4 ? 3 : 0); + /* global flags */ - lev.wonderwall_time_initial = GET_BE16(src[2102]); + lev.ball_random = src[2162] & 1 ? 1 : 0; + lev.ball_state_initial = src[2162] & 128 ? 1 : 0; + + for (temp = 1; temp < 2047; temp++) + { + switch (src[temp]) + { + case 36: /* wonderwall */ + lev.wonderwall_state_initial = 1; + lev.wonderwall_time_initial = 9999; + break; + + case 40: /* wheel */ + lev.wheel_x_initial = temp & 63; + lev.wheel_y_initial = temp >> 6; + lev.wheel_cnt_initial = lev.wheel_time; + break; + + case 163: /* fake blank */ + lev.lenses_cnt_initial = 9999; + break; + + case 164: /* fake grass */ + lev.magnify_cnt_initial = 9999; + break; + } + } + + /* android */ + + temp = GET_BE16(src[2168]); + + lev.android_emerald = (temp & 1) != 0; + lev.android_diamond = (temp & 2) != 0; + lev.android_stone = (temp & 4) != 0; + lev.android_bomb = (temp & 8) != 0; + lev.android_nut = (temp & 16) != 0; + lev.android_tank = (temp & 32) != 0; + lev.android_eater = (temp & 64) != 0; + lev.android_bug = (temp & 128) != 0; + lev.android_alien = (temp & 256) != 0; + lev.android_spring = (temp & 512) != 0; + lev.android_balloon = (temp & 1024) != 0; + lev.android_amoeba = (temp & 2048) != 0; + lev.android_dynamite = (temp & 4096) != 0; + + /* eaters */ for (i = 0; i < 8; i++) for (x = 0; x < 9; x++) lev.eater_array[i][x] = get_em_element(src[eater_offset[i] + x], file_version); + /* ball */ + temp = get_em_element(src[2159], file_version); + for (y = 0; y < 8; y++) { if (src[2162] & 1) @@ -228,47 +276,18 @@ void convert_em_level(unsigned char *src, int file_version) } } - temp = GET_BE16(src[2168]); - - lev.android_emerald = (temp & 1) != 0; - lev.android_diamond = (temp & 2) != 0; - lev.android_stone = (temp & 4) != 0; - lev.android_bomb = (temp & 8) != 0; - lev.android_nut = (temp & 16) != 0; - lev.android_tank = (temp & 32) != 0; - lev.android_eater = (temp & 64) != 0; - lev.android_bug = (temp & 128) != 0; - lev.android_alien = (temp & 256) != 0; - lev.android_spring = (temp & 512) != 0; - lev.android_balloon = (temp & 1024) != 0; - lev.android_amoeba = (temp & 2048) != 0; - lev.android_dynamite = (temp & 4096) != 0; + /* players */ - for (temp = 1; temp < 2047; temp++) + for (i = 0; i < 2; i++) { - switch (src[temp]) - { - case 36: /* wonderwall */ - lev.wonderwall_state_initial = 1; - lev.wonderwall_time_initial = 9999; - break; - - case 40: /* wheel */ - lev.wheel_x_initial = temp & 63; - lev.wheel_y_initial = temp >> 6; - lev.wheel_cnt_initial = lev.wheel_time; - break; - - case 163: /* fake blank */ - lev.lenses_cnt_initial = 9999; - break; + temp = GET_BE16(src[2096 + i * 2]); - case 164: /* fake grass */ - lev.magnify_cnt_initial = 9999; - break; - } + ply[i].x_initial = (temp & 63); + ply[i].y_initial = (temp >> 6 & 31); } + /* cave */ + /* first fill the complete playfield with the default border element */ for (y = 0; y < CAVE_HEIGHT; y++) for (x = 0; x < CAVE_WIDTH; x++)