From 275b9308b91358f688add8aa1c47cc46d499043b Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 13 Feb 2020 01:48:30 +0100 Subject: [PATCH] renamed level pointer in level structure for EM engine --- src/files.c | 148 +++++++++++++++++++++---------------------- src/game_em/cave.c | 2 +- src/game_em/export.h | 2 +- src/tools.c | 14 ++-- 4 files changed, 83 insertions(+), 83 deletions(-) diff --git a/src/files.c b/src/files.c index 1052d7fc..b2856c69 100644 --- a/src/files.c +++ b/src/files.c @@ -3515,58 +3515,58 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) { 2, 2 }, }; struct LevelInfo_EM *level_em = level->native_em_level; - struct LEVEL *lev = level_em->lev; + struct LEVEL *cav = level_em->cav; int i, j, x, y; - lev->width = MIN(level->fieldx, MAX_PLAYFIELD_WIDTH); - lev->height = MIN(level->fieldy, MAX_PLAYFIELD_HEIGHT); + cav->width = MIN(level->fieldx, MAX_PLAYFIELD_WIDTH); + cav->height = MIN(level->fieldy, MAX_PLAYFIELD_HEIGHT); - lev->time_seconds = level->time; - lev->required_initial = level->gems_needed; + cav->time_seconds = level->time; + cav->required_initial = level->gems_needed; - lev->emerald_score = level->score[SC_EMERALD]; - lev->diamond_score = level->score[SC_DIAMOND]; - lev->alien_score = level->score[SC_ROBOT]; - lev->tank_score = level->score[SC_SPACESHIP]; - lev->bug_score = level->score[SC_BUG]; - lev->eater_score = level->score[SC_YAMYAM]; - lev->nut_score = level->score[SC_NUT]; - lev->dynamite_score = level->score[SC_DYNAMITE]; - lev->key_score = level->score[SC_KEY]; - lev->exit_score = level->score[SC_TIME_BONUS]; + cav->emerald_score = level->score[SC_EMERALD]; + cav->diamond_score = level->score[SC_DIAMOND]; + cav->alien_score = level->score[SC_ROBOT]; + cav->tank_score = level->score[SC_SPACESHIP]; + cav->bug_score = level->score[SC_BUG]; + cav->eater_score = level->score[SC_YAMYAM]; + cav->nut_score = level->score[SC_NUT]; + cav->dynamite_score = level->score[SC_DYNAMITE]; + cav->key_score = level->score[SC_KEY]; + cav->exit_score = level->score[SC_TIME_BONUS]; for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) for (y = 0; y < 3; y++) for (x = 0; x < 3; x++) - lev->eater_array[i][y * 3 + x] = + cav->eater_array[i][y * 3 + x] = map_element_RND_to_EM(level->yamyam_content[i].e[x][y]); - lev->amoeba_time = level->amoeba_speed; - lev->wonderwall_time_initial = level->time_magic_wall; - lev->wheel_time = level->time_wheel; + cav->amoeba_time = level->amoeba_speed; + cav->wonderwall_time_initial = level->time_magic_wall; + cav->wheel_time = level->time_wheel; - lev->android_move_time = level->android_move_time; - lev->android_clone_time = level->android_clone_time; - lev->ball_random = level->ball_random; - lev->ball_state_initial = level->ball_state_initial; - lev->ball_time = level->ball_time; - lev->num_ball_arrays = level->num_ball_contents; + 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_time = level->ball_time; + cav->num_ball_arrays = level->num_ball_contents; - lev->lenses_score = level->lenses_score; - lev->magnify_score = level->magnify_score; - lev->slurp_score = level->slurp_score; + cav->lenses_score = level->lenses_score; + cav->magnify_score = level->magnify_score; + cav->slurp_score = level->slurp_score; - lev->lenses_time = level->lenses_time; - lev->magnify_time = level->magnify_time; + cav->lenses_time = level->lenses_time; + cav->magnify_time = level->magnify_time; - lev->wind_direction_initial = + cav->wind_direction_initial = map_direction_RND_to_EM(level->wind_direction_initial); - lev->wind_cnt_initial = (level->wind_direction_initial != MV_NONE ? - lev->wind_time : 0); + cav->wind_cnt_initial = (level->wind_direction_initial != MV_NONE ? + cav->wind_time : 0); for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) for (j = 0; j < 8; j++) - lev->ball_array[i][j] = + cav->ball_array[i][j] = map_element_RND_to_EM(level-> ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]); @@ -3578,7 +3578,7 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) level_em->cave[x][y] = Zborder; // then copy the real level contents from level file into the playfield - for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++) + for (y = 0; y < cav->height; y++) for (x = 0; x < cav->width; x++) { int new_element = map_element_RND_to_EM(level->field[x][y]); @@ -3590,19 +3590,19 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) for (i = 0; i < MAX_PLAYERS; i++) { - lev->player_x[i] = -1; - lev->player_y[i] = -1; + cav->player_x[i] = -1; + cav->player_y[i] = -1; } // initialize player positions and delete players from the playfield - for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++) + for (y = 0; y < cav->height; y++) for (x = 0; x < cav->width; x++) { if (ELEM_IS_PLAYER(level->field[x][y])) { int player_nr = GET_PLAYER_NR(level->field[x][y]); - lev->player_x[player_nr] = x; - lev->player_y[player_nr] = y; + cav->player_x[player_nr] = x; + cav->player_y[player_nr] = y; level_em->cave[x][y] = map_element_RND_to_EM(EL_EMPTY); } @@ -3623,27 +3623,27 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) { 2, 2 }, }; struct LevelInfo_EM *level_em = level->native_em_level; - struct LEVEL *lev = level_em->lev; + struct LEVEL *cav = level_em->cav; int i, j, x, y; - level->fieldx = MIN(lev->width, MAX_LEV_FIELDX); - level->fieldy = MIN(lev->height, MAX_LEV_FIELDY); + level->fieldx = MIN(cav->width, MAX_LEV_FIELDX); + level->fieldy = MIN(cav->height, MAX_LEV_FIELDY); - level->time = lev->time_seconds; - level->gems_needed = lev->required_initial; + level->time = cav->time_seconds; + level->gems_needed = cav->required_initial; sprintf(level->name, "Level %d", level->file_info.nr); - level->score[SC_EMERALD] = lev->emerald_score; - level->score[SC_DIAMOND] = lev->diamond_score; - level->score[SC_ROBOT] = lev->alien_score; - level->score[SC_SPACESHIP] = lev->tank_score; - level->score[SC_BUG] = lev->bug_score; - level->score[SC_YAMYAM] = lev->eater_score; - level->score[SC_NUT] = lev->nut_score; - level->score[SC_DYNAMITE] = lev->dynamite_score; - level->score[SC_KEY] = lev->key_score; - level->score[SC_TIME_BONUS] = lev->exit_score; + level->score[SC_EMERALD] = cav->emerald_score; + level->score[SC_DIAMOND] = cav->diamond_score; + level->score[SC_ROBOT] = cav->alien_score; + level->score[SC_SPACESHIP] = cav->tank_score; + level->score[SC_BUG] = cav->bug_score; + level->score[SC_YAMYAM] = cav->eater_score; + level->score[SC_NUT] = cav->nut_score; + level->score[SC_DYNAMITE] = cav->dynamite_score; + level->score[SC_KEY] = cav->key_score; + level->score[SC_TIME_BONUS] = cav->exit_score; level->num_yamyam_contents = MAX_ELEMENT_CONTENTS; @@ -3651,33 +3651,33 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) for (y = 0; y < 3; y++) for (x = 0; x < 3; x++) level->yamyam_content[i].e[x][y] = - map_element_EM_to_RND(lev->eater_array[i][y * 3 + x]); + map_element_EM_to_RND(cav->eater_array[i][y * 3 + x]); - level->amoeba_speed = lev->amoeba_time; - level->time_magic_wall = lev->wonderwall_time_initial; - level->time_wheel = lev->wheel_time; + level->amoeba_speed = cav->amoeba_time; + level->time_magic_wall = cav->wonderwall_time_initial; + level->time_wheel = cav->wheel_time; - level->android_move_time = lev->android_move_time; - level->android_clone_time = lev->android_clone_time; - level->ball_random = lev->ball_random; - level->ball_state_initial = lev->ball_state_initial; - level->ball_time = lev->ball_time; - level->num_ball_contents = lev->num_ball_arrays; + 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_time = cav->ball_time; + level->num_ball_contents = cav->num_ball_arrays; - level->lenses_score = lev->lenses_score; - level->magnify_score = lev->magnify_score; - level->slurp_score = lev->slurp_score; + level->lenses_score = cav->lenses_score; + level->magnify_score = cav->magnify_score; + level->slurp_score = cav->slurp_score; - level->lenses_time = lev->lenses_time; - level->magnify_time = lev->magnify_time; + level->lenses_time = cav->lenses_time; + level->magnify_time = cav->magnify_time; level->wind_direction_initial = - map_direction_EM_to_RND(lev->wind_direction_initial); + map_direction_EM_to_RND(cav->wind_direction_initial); for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) for (j = 0; j < 8; j++) level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]] = - map_element_EM_to_RND(lev->ball_array[i][j]); + map_element_EM_to_RND(cav->ball_array[i][j]); map_android_clone_elements_EM_to_RND(level); @@ -3696,8 +3696,8 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) { // in case of all players set to the same field, use the first player int nr = MAX_PLAYERS - i - 1; - int jx = lev->player_x[nr]; - int jy = lev->player_y[nr]; + int jx = cav->player_x[nr]; + int jy = cav->player_y[nr]; if (jx != -1 && jy != -1) level->field[jx][jy] = EL_PLAYER_1 + nr; diff --git a/src/game_em/cave.c b/src/game_em/cave.c index 7788ae70..b4dd5823 100644 --- a/src/game_em/cave.c +++ b/src/game_em/cave.c @@ -13,7 +13,7 @@ void setLevelInfoToDefaults_EM(void) int i; native_em_level.file_version = FILE_VERSION_EM_ACTUAL; - native_em_level.lev = &lev; + native_em_level.cav = &lev; game_em.lev = &lev; for (i = 0; i < MAX_PLAYERS; i++) diff --git a/src/game_em/export.h b/src/game_em/export.h index 6fac56ae..7379479f 100644 --- a/src/game_em/export.h +++ b/src/game_em/export.h @@ -49,7 +49,7 @@ struct LevelInfo_EM short cave[CAVE_WIDTH][CAVE_HEIGHT]; - struct LEVEL *lev; + struct LEVEL *cav; }; struct GraphicInfo_EM diff --git a/src/tools.c b/src/tools.c index 651fbb16..e19a352f 100644 --- a/src/tools.c +++ b/src/tools.c @@ -297,7 +297,7 @@ static int getLevelFromScreenY_RND(int sy) static int getLevelFromScreenX_EM(int sx) { - int level_xsize = level.native_em_level->lev->width; + int level_xsize = level.native_em_level->cav->width; int full_xsize = level_xsize * TILESIZE_VAR; sx -= (full_xsize < SXSIZE ? (SXSIZE - full_xsize) / 2 : 0); @@ -314,7 +314,7 @@ static int getLevelFromScreenX_EM(int sx) static int getLevelFromScreenY_EM(int sy) { - int level_ysize = level.native_em_level->lev->height; + int level_ysize = level.native_em_level->cav->height; int full_ysize = level_ysize * TILESIZE_VAR; sy -= (full_ysize < SYSIZE ? (SYSIZE - full_ysize) / 2 : 0); @@ -7751,11 +7751,11 @@ int map_element_EM_to_RND(int element_em) void map_android_clone_elements_RND_to_EM(struct LevelInfo *level) { struct LevelInfo_EM *level_em = level->native_em_level; - struct LEVEL *lev = level_em->lev; + struct LEVEL *cav = level_em->cav; int i, j; for (i = 0; i < TILE_MAX; i++) - lev->android_array[i] = Xblank; + cav->android_array[i] = Xblank; for (i = 0; i < level->num_android_clone_elements; i++) { @@ -7764,21 +7764,21 @@ void map_android_clone_elements_RND_to_EM(struct LevelInfo *level) for (j = 0; em_object_mapping_list[j].element_em != -1; j++) if (em_object_mapping_list[j].element_rnd == element_rnd) - lev->android_array[em_object_mapping_list[j].element_em] = element_em; + cav->android_array[em_object_mapping_list[j].element_em] = element_em; } } void map_android_clone_elements_EM_to_RND(struct LevelInfo *level) { struct LevelInfo_EM *level_em = level->native_em_level; - struct LEVEL *lev = level_em->lev; + struct LEVEL *cav = level_em->cav; int i, j; level->num_android_clone_elements = 0; for (i = 0; i < TILE_MAX; i++) { - int element_em = lev->android_array[i]; + int element_em = cav->android_array[i]; int element_rnd; boolean element_found = FALSE; -- 2.34.1