From 21859f94b784d557113a6470ed8fd7bceb48ba15 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 25 Jun 2022 10:46:52 +0200 Subject: [PATCH] added level info config option to disable time limit for all levels While it was already possible to disable the time limit in the setup menu to play a level without any time limit, the resulting tapes only replay successfully if the time limit is still disabled, of course. Obviously, this is not the case on the central high score server. However, the level sets in the "R'n'D jue 2022" games collection are all designed to be played without time limit, and the time limit is disabled in the default setup options of all games. This currently has the following two disadvantages: 1. The resulting tapes fail on the high score server, which has time limit always enabled. 2. If the user of "R'n'D jur 2022" games enables the time limit in the setup menu, the levels cannot be solved anymore. This patch adds a new time limit option to the level info config file, which makes it possible to flag whole level sets as "to be played with time limit disabled", regardless of what the individual user's setting for "time limit" was set to. This patch makes it possible to fix case (1) above by adding the new level info config option to all affected levels on the high score server, but would require a program update to also fix case (2) on the client side. --- src/game.c | 2 +- src/game.h | 2 +- src/libgame/setup.c | 11 ++++++++--- src/libgame/system.h | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/game.c b/src/game.c index e650f4d3..ce452e67 100644 --- a/src/game.c +++ b/src/game.c @@ -3819,7 +3819,7 @@ void InitGame(void) game.panel.active = TRUE; game.no_level_time_limit = (level.time == 0); - game.time_limit = (setup.time_limit); + game.time_limit = (leveldir_current->time_limit && setup.time_limit); game.yamyam_content_nr = 0; game.robot_wheel_active = FALSE; diff --git a/src/game.h b/src/game.h index e96f7f93..600485ea 100644 --- a/src/game.h +++ b/src/game.h @@ -204,7 +204,7 @@ struct GameInfo boolean explosions_delayed; boolean envelope_active; boolean no_level_time_limit; // (variable only in very special case) - boolean time_limit; // forced by setup option + boolean time_limit; // forced by levelset config or setup option int time_final; // time (in seconds) or steps left or played int score_time_final; // time (in frames) or steps played diff --git a/src/libgame/setup.c b/src/libgame/setup.c index fa696c58..5c16feb5 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -2730,10 +2730,11 @@ SetupFileHash *loadSetupFileHash(char *filename) #define LEVELINFO_TOKEN_EMPTY_LEVEL_NAME 27 #define LEVELINFO_TOKEN_FORCE_LEVEL_NAME 28 #define LEVELINFO_TOKEN_HANDICAP 29 -#define LEVELINFO_TOKEN_SKIP_LEVELS 30 -#define LEVELINFO_TOKEN_USE_EMC_TILES 31 +#define LEVELINFO_TOKEN_TIME_LIMIT 30 +#define LEVELINFO_TOKEN_SKIP_LEVELS 31 +#define LEVELINFO_TOKEN_USE_EMC_TILES 32 -#define NUM_LEVELINFO_TOKENS 32 +#define NUM_LEVELINFO_TOKENS 33 static LevelDirTree ldi; @@ -2770,6 +2771,7 @@ static struct TokenInfo levelinfo_tokens[] = { TYPE_STRING, &ldi.empty_level_name, "empty_level_name" }, { TYPE_BOOLEAN, &ldi.force_level_name, "force_level_name" }, { TYPE_BOOLEAN, &ldi.handicap, "handicap" }, + { TYPE_BOOLEAN, &ldi.time_limit, "time_limit" }, { TYPE_BOOLEAN, &ldi.skip_levels, "skip_levels" }, { TYPE_BOOLEAN, &ldi.use_emc_tiles, "use_emc_tiles" } }; @@ -2876,6 +2878,7 @@ static void setTreeInfoToDefaults(TreeInfo *ti, int type) ti->handicap_level = 0; ti->readonly = TRUE; ti->handicap = TRUE; + ti->time_limit = TRUE; ti->skip_levels = FALSE; ti->use_emc_tiles = FALSE; @@ -2961,6 +2964,7 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ti, TreeInfo *parent) ti->handicap_level = parent->handicap_level; ti->readonly = parent->readonly; ti->handicap = parent->handicap; + ti->time_limit = parent->time_limit; ti->skip_levels = parent->skip_levels; ti->use_emc_tiles = parent->use_emc_tiles; @@ -3033,6 +3037,7 @@ static TreeInfo *getTreeInfoCopy(TreeInfo *ti) ti_copy->user_defined = ti->user_defined; ti_copy->readonly = ti->readonly; ti_copy->handicap = ti->handicap; + ti_copy->time_limit = ti->time_limit; ti_copy->skip_levels = ti->skip_levels; ti_copy->use_emc_tiles = ti->use_emc_tiles; diff --git a/src/libgame/system.h b/src/libgame/system.h index 481290ee..d2aa685f 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1647,6 +1647,7 @@ struct TreeInfo boolean user_defined; // levels in user directory and marked as "private" boolean readonly; // readonly levels can not be changed with editor boolean handicap; // level set has no handicap when set to "false" + boolean time_limit; // level set has no time limit when set to "false" boolean skip_levels; // levels can be skipped when set to "true" boolean use_emc_tiles;// use (swapped) V5/V6 EMC tiles when set to "true" -- 2.34.1