X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsetup.c;h=53659bddbe8a2840e8b514e7f878d5d5119d10ce;hb=681df696173f472fe28e49b9e8e01b34dc34629b;hp=06190e0b4c71671fb1f1b76989bf5aadb9a9e7f9;hpb=dc51f089096a0c775d2a03d0b862a14d6ce88d51;p=rocksndiamonds.git diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 06190e0b..53659bdd 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -797,6 +797,32 @@ char *getEditorSetupFilename(void) return filename; } +char *getFilenameFromCurrentLevelDirUpward(char *basename) +{ + // global variable "leveldir_current" must be modified in the loop below + LevelDirTree *leveldir_current_last = leveldir_current; + static char *filename = NULL; + + // check for filename in path from current to topmost tree node + + while (leveldir_current != NULL) + { + checked_free(filename); + + filename = getPath2(getCurrentLevelDir(), basename); + + if (fileExists(filename)) + break; + + leveldir_current = leveldir_current->node_parent; + } + + // restore global variable "leveldir_current" modified in above loop + leveldir_current = leveldir_current_last; + + return filename; +} + char *getHelpAnimFilename(void) { static char *filename = NULL; @@ -2831,10 +2857,11 @@ SetupFileHash *loadSetupFileHash(char *filename) #define LEVELINFO_TOKEN_HANDICAP 29 #define LEVELINFO_TOKEN_TIME_LIMIT 30 #define LEVELINFO_TOKEN_SKIP_LEVELS 31 -#define LEVELINFO_TOKEN_USE_EMC_TILES 32 -#define LEVELINFO_TOKEN_INFO_SCREENS_FROM_MAIN 33 +#define LEVELINFO_TOKEN_ALLOW_SKIPPING_LEVELS 32 +#define LEVELINFO_TOKEN_USE_EMC_TILES 33 +#define LEVELINFO_TOKEN_INFO_SCREENS_FROM_MAIN 34 -#define NUM_LEVELINFO_TOKENS 34 +#define NUM_LEVELINFO_TOKENS 35 static LevelDirTree ldi; @@ -3233,7 +3260,7 @@ void setSetupInfo(struct TokenInfo *token_info, break; case TYPE_SWITCH_3_STATES: - *(int *)setup_value = get_switch3_from_string(token_value); + *(int *)setup_value = get_switch_3_state_from_string(token_value); break; case TYPE_KEY: @@ -4862,8 +4889,9 @@ char *getSetupValue(int type, void *value) break; case TYPE_SWITCH_3_STATES: - strcpy(value_string, (*(int *)value == MODE_AUTO ? "auto" : - *(int *)value == FALSE ? "off" : "on")); + strcpy(value_string, (*(int *)value == STATE_AUTO ? "auto" : + *(int *)value == STATE_ASK ? "ask" : + *(int *)value == STATE_FALSE ? "off" : "on")); break; case TYPE_YES_NO: @@ -4871,12 +4899,17 @@ char *getSetupValue(int type, void *value) break; case TYPE_YES_NO_AUTO: - strcpy(value_string, (*(int *)value == MODE_AUTO ? "auto" : - *(int *)value == FALSE ? "no" : "yes")); + strcpy(value_string, (*(int *)value == STATE_AUTO ? "auto" : + *(int *)value == STATE_FALSE ? "no" : "yes")); + break; + + case TYPE_YES_NO_ASK: + strcpy(value_string, (*(int *)value == STATE_ASK ? "ask" : + *(int *)value == STATE_FALSE ? "no" : "yes")); break; case TYPE_ECS_AGA: - strcpy(value_string, (*(boolean *)value ? "AGA" : "ECS")); + strcpy(value_string, (*(boolean *)value ? "new" : "old")); break; case TYPE_KEY: