From: Holger Schemel Date: Thu, 13 Feb 2020 00:12:28 +0000 (+0100) Subject: removed runtime values from level structure for EM and SP engine X-Git-Tag: 4.2.0.0~129 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=5e53b3af62af5a0fb7726afebf62dc4a5c297596;p=rocksndiamonds.git removed runtime values from level structure for EM and SP engine --- diff --git a/src/events.c b/src/events.c index 21836c9d..6def0cb6 100644 --- a/src/events.c +++ b/src/events.c @@ -1275,7 +1275,7 @@ static void HandleButtonOrFinger_FollowFinger(int mx, int my, int button) int last_move_dir = (ABS(dx) > ABS(dy) ? MV_VERTICAL : MV_HORIZONTAL); if (level.game_engine_type == GAME_ENGINE_TYPE_EM) - level.native_em_level->ply[0]->last_move_dir = last_move_dir; + game_em.ply[0]->last_move_dir = last_move_dir; else local_player->last_move_dir = last_move_dir; diff --git a/src/game.c b/src/game.c index 1f019a4e..fbe34cc7 100644 --- a/src/game.c +++ b/src/game.c @@ -2126,9 +2126,9 @@ static int compareGamePanelOrderInfo(const void *object1, const void *object2) int getPlayerInventorySize(int player_nr) { if (level.game_engine_type == GAME_ENGINE_TYPE_EM) - return level.native_em_level->ply[player_nr]->dynamite; + return game_em.ply[player_nr]->dynamite; else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) - return level.native_sp_level->game_sp->red_disk_count; + return game_sp.red_disk_count; else return stored_player[player_nr].inventory_size; } @@ -2212,32 +2212,32 @@ static void UpdateGameControlValues(void) int time = (game.LevelSolved ? game.LevelSolved_CountingTime : level.game_engine_type == GAME_ENGINE_TYPE_EM ? - level.native_em_level->lev->time : + game_em.lev->time : level.game_engine_type == GAME_ENGINE_TYPE_SP ? - level.native_sp_level->game_sp->time_played : + game_sp.time_played : level.game_engine_type == GAME_ENGINE_TYPE_MM ? game_mm.energy_left : game.no_time_limit ? TimePlayed : TimeLeft); int score = (game.LevelSolved ? game.LevelSolved_CountingScore : level.game_engine_type == GAME_ENGINE_TYPE_EM ? - level.native_em_level->lev->score : + game_em.lev->score : level.game_engine_type == GAME_ENGINE_TYPE_SP ? - level.native_sp_level->game_sp->score : + game_sp.score : level.game_engine_type == GAME_ENGINE_TYPE_MM ? game_mm.score : game.score); int gems = (level.game_engine_type == GAME_ENGINE_TYPE_EM ? - level.native_em_level->lev->required : + game_em.lev->required : level.game_engine_type == GAME_ENGINE_TYPE_SP ? - level.native_sp_level->game_sp->infotrons_still_needed : + game_sp.infotrons_still_needed : level.game_engine_type == GAME_ENGINE_TYPE_MM ? game_mm.kettles_still_needed : game.gems_still_needed); int exit_closed = (level.game_engine_type == GAME_ENGINE_TYPE_EM ? - level.native_em_level->lev->required > 0 : + game_em.lev->required > 0 : level.game_engine_type == GAME_ENGINE_TYPE_SP ? - level.native_sp_level->game_sp->infotrons_still_needed > 0 : + game_sp.infotrons_still_needed > 0 : level.game_engine_type == GAME_ENGINE_TYPE_MM ? game_mm.kettles_still_needed > 0 || game_mm.lights_still_needed > 0 : @@ -2277,7 +2277,7 @@ static void UpdateGameControlValues(void) { if (level.game_engine_type == GAME_ENGINE_TYPE_EM) { - if (level.native_em_level->ply[i]->keys & (1 << k)) + if (game_em.ply[i]->keys & (1 << k)) game_panel_controls[GAME_PANEL_KEY_1 + k].value = get_key_element_from_nr(k); } @@ -2305,7 +2305,7 @@ static void UpdateGameControlValues(void) { if (level.game_engine_type == GAME_ENGINE_TYPE_EM) { - if (level.native_em_level->ply[player_nr]->keys & (1 << k)) + if (game_em.ply[player_nr]->keys & (1 << k)) game_panel_controls[GAME_PANEL_KEY_1 + k].value = get_key_element_from_nr(k); } @@ -4492,7 +4492,7 @@ static void LevelSolved(void) game.GameOver = TRUE; game.score_final = (level.game_engine_type == GAME_ENGINE_TYPE_EM ? - level.native_em_level->lev->score : + game_em.lev->score : level.game_engine_type == GAME_ENGINE_TYPE_MM ? game_mm.score : game.score); @@ -11240,7 +11240,7 @@ static void CheckLevelTime(void) if (!TimeLeft && setup.time_limit) { if (level.game_engine_type == GAME_ENGINE_TYPE_EM) - level.native_em_level->lev->killed_out_of_time = TRUE; + game_em.lev->killed_out_of_time = TRUE; else for (i = 0; i < MAX_PLAYERS; i++) KillPlayer(&stored_player[i]); @@ -11251,8 +11251,7 @@ static void CheckLevelTime(void) game_panel_controls[GAME_PANEL_TIME].value = TimePlayed; } - level.native_em_level->lev->time = - (game.no_time_limit ? TimePlayed : TimeLeft); + game_em.lev->time = (game.no_time_limit ? TimePlayed : TimeLeft); } if (tape.recording || tape.playing) diff --git a/src/game_em/cave.c b/src/game_em/cave.c index cc863029..585bfd2f 100644 --- a/src/game_em/cave.c +++ b/src/game_em/cave.c @@ -18,6 +18,10 @@ void setLevelInfoToDefaults_EM(void) for (i = 0; i < MAX_PLAYERS; i++) native_em_level.ply[i] = &ply[i]; + game_em.lev = &lev; + for (i = 0; i < MAX_PLAYERS; i++) + game_em.ply[i] = &ply[i]; + lev.width = 64; lev.height = 32; diff --git a/src/game_em/export.h b/src/game_em/export.h index 12838297..acd000b5 100644 --- a/src/game_em/export.h +++ b/src/game_em/export.h @@ -38,6 +38,9 @@ struct GameInfo_EM int last_moving_player; int last_player_direction[MAX_PLAYERS]; + + struct LEVEL *lev; + struct PLAYER *ply[MAX_PLAYERS]; }; struct LevelInfo_EM @@ -48,9 +51,6 @@ struct LevelInfo_EM struct LEVEL *lev; struct PLAYER *ply[MAX_PLAYERS]; - - /* used for runtime values */ - struct GameInfo_EM *game_em; }; struct GraphicInfo_EM diff --git a/src/game_sp/export.h b/src/game_sp/export.h index 11ef9edd..d8b964fd 100644 --- a/src/game_sp/export.h +++ b/src/game_sp/export.h @@ -123,9 +123,6 @@ struct LevelInfo_SP byte playfield[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT]; struct DemoInfo_SP demo; - - // used for runtime values - struct GameInfo_SP *game_sp; }; struct GraphicInfo_SP diff --git a/src/game_sp/file.c b/src/game_sp/file.c index 4e8c9a8f..a702fd4d 100644 --- a/src/game_sp/file.c +++ b/src/game_sp/file.c @@ -19,8 +19,6 @@ void setLevelInfoToDefaults_SP(void) char *empty_title = "-------- EMPTY --------"; int i, x, y; - native_sp_level.game_sp = &game_sp; - native_sp_level.width = SP_STD_PLAYFIELD_WIDTH; native_sp_level.height = SP_STD_PLAYFIELD_HEIGHT;