From 2a706382e0b0f677253e24a4672facfe4059aa42 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 26 Apr 2024 16:39:14 +0200 Subject: [PATCH] renamed preprocessor constants --- src/files.c | 20 ++++++++++---------- src/game_bd/main_bd.c | 16 ++++++++-------- src/game_mm/mm_tools.c | 4 ++-- src/init.c | 6 +++--- src/libgame/misc.c | 2 +- src/libgame/setup.c | 14 +++++++------- src/libgame/types.h | 16 ++++++++-------- src/screens.c | 32 ++++++++++++++++---------------- 8 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/files.c b/src/files.c index ce671c74..60d21c32 100644 --- a/src/files.c +++ b/src/files.c @@ -11629,7 +11629,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->team_mode = FALSE; si->handicap = TRUE; si->skip_levels = TRUE; - si->allow_skipping_levels = MODE_ASK; + si->allow_skipping_levels = STATE_ASK; si->increment_levels = TRUE; si->auto_play_next_level = TRUE; si->count_score_after_game = TRUE; @@ -11657,10 +11657,10 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->bd_skip_hatching = FALSE; si->bd_scroll_delay = TRUE; si->bd_show_invisible_outbox = FALSE; - si->bd_smooth_movements = MODE_AUTO; - si->bd_pushing_graphics = MODE_TRUE; - si->bd_up_down_graphics = MODE_TRUE; - si->bd_skip_falling_sounds = MODE_AUTO; + si->bd_smooth_movements = STATE_AUTO; + si->bd_pushing_graphics = STATE_TRUE; + si->bd_up_down_graphics = STATE_TRUE; + si->bd_skip_falling_sounds = STATE_AUTO; si->bd_palette_c64 = GD_DEFAULT_PALETTE_C64; si->bd_palette_c64dtv = GD_DEFAULT_PALETTE_C64DTV; si->bd_palette_atari = GD_DEFAULT_PALETTE_ATARI; @@ -11676,9 +11676,9 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->sounds_set = getStringCopy(SND_CLASSIC_SUBDIR); si->music_set = getStringCopy(MUS_CLASSIC_SUBDIR); - si->override_level_graphics = MODE_FALSE; - si->override_level_sounds = MODE_FALSE; - si->override_level_music = MODE_FALSE; + si->override_level_graphics = STATE_FALSE; + si->override_level_sounds = STATE_FALSE; + si->override_level_music = STATE_FALSE; si->volume_simple = 100; // percent si->volume_loops = 100; // percent @@ -11888,7 +11888,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->debug.show_frames_per_second = FALSE; - si->debug.xsn_mode = MODE_AUTO; + si->debug.xsn_mode = STATE_AUTO; si->debug.xsn_percent = 0; si->options.verbose = FALSE; @@ -12456,7 +12456,7 @@ void SaveSetup_Default(void) fprintf(file, "\n"); for (i = 0; i < ARRAY_SIZE(debug_setup_tokens); i++) if (!strPrefix(debug_setup_tokens[i].text, "debug.xsn_") || - setup.debug.xsn_mode != MODE_AUTO) + setup.debug.xsn_mode != STATE_AUTO) fprintf(file, "%s\n", getSetupLine(debug_setup_tokens, "", i)); fprintf(file, "\n"); diff --git a/src/game_bd/main_bd.c b/src/game_bd/main_bd.c index 8151af43..a3078e99 100644 --- a/src/game_bd/main_bd.c +++ b/src/game_bd/main_bd.c @@ -442,29 +442,29 @@ boolean use_native_bd_graphics_engine(void) // check if smooth game element movements selected in setup menu boolean use_bd_smooth_movements(void) { - return ((setup.bd_smooth_movements == MODE_TRUE) || - (setup.bd_smooth_movements == MODE_AUTO && !use_native_bd_graphics_engine())); + return ((setup.bd_smooth_movements == STATE_TRUE) || + (setup.bd_smooth_movements == STATE_AUTO && !use_native_bd_graphics_engine())); } // check if player pushing graphics selected in setup menu boolean use_bd_pushing_graphics(void) { - return ((setup.bd_pushing_graphics == MODE_TRUE) || - (setup.bd_pushing_graphics == MODE_AUTO && !use_native_bd_graphics_engine())); + return ((setup.bd_pushing_graphics == STATE_TRUE) || + (setup.bd_pushing_graphics == STATE_AUTO && !use_native_bd_graphics_engine())); } // check if player up/down graphics selected in setup menu boolean use_bd_up_down_graphics(void) { - return ((setup.bd_up_down_graphics == MODE_TRUE) || - (setup.bd_up_down_graphics == MODE_AUTO && !use_native_bd_graphics_engine())); + return ((setup.bd_up_down_graphics == STATE_TRUE) || + (setup.bd_up_down_graphics == STATE_AUTO && !use_native_bd_graphics_engine())); } // check if skipping falling sounds selected in setup menu boolean skip_bd_falling_sounds(void) { - return ((setup.bd_skip_falling_sounds == MODE_TRUE) || - (setup.bd_skip_falling_sounds == MODE_AUTO && !game.use_native_bd_sound_engine)); + return ((setup.bd_skip_falling_sounds == STATE_TRUE) || + (setup.bd_skip_falling_sounds == STATE_AUTO && !game.use_native_bd_sound_engine)); } Bitmap **GetTitleScreenBitmaps_BD(void) diff --git a/src/game_mm/mm_tools.c b/src/game_mm/mm_tools.c index 331d85d4..9d688e14 100644 --- a/src/game_mm/mm_tools.c +++ b/src/game_mm/mm_tools.c @@ -845,14 +845,14 @@ static void DrawTileCursor_Xsn(int draw_target) if (debug) setup.debug.xsn_percent = percent; - if (setup.debug.xsn_mode != MODE_AUTO) + if (setup.debug.xsn_mode != STATE_AUTO) percent = setup.debug.xsn_percent; setup.debug.xsn_percent = percent; active = (percent > 0); - if ((active && !active_last) || setup.debug.xsn_mode != MODE_AUTO) + if ((active && !active_last) || setup.debug.xsn_mode != STATE_AUTO) removeHideSetupEntry(&setup.debug.xsn_mode); else if (!active && active_last) setHideSetupEntry(&setup.debug.xsn_mode); diff --git a/src/init.c b/src/init.c index c2a19781..9fb4b482 100644 --- a/src/init.c +++ b/src/init.c @@ -6270,9 +6270,9 @@ static void InitOverrideArtwork(void) gfx.override_level_music = FALSE; // now check if this level set has definitions for custom elements - if (setup.override_level_graphics == MODE_AUTO || - setup.override_level_sounds == MODE_AUTO || - setup.override_level_music == MODE_AUTO) + if (setup.override_level_graphics == STATE_AUTO || + setup.override_level_sounds == STATE_AUTO || + setup.override_level_music == STATE_AUTO) redefined_ce_found = (CheckArtworkTypeForRedefinedCustomElements(ARTWORK_TYPE_GRAPHICS) | CheckArtworkTypeForRedefinedCustomElements(ARTWORK_TYPE_SOUNDS) | diff --git a/src/libgame/misc.c b/src/libgame/misc.c index c953e1b0..af2ac9bc 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -2966,7 +2966,7 @@ int get_switch3_from_string(char *s) get_integer_from_string(s) == 1) result = TRUE; else if (strEqual(s_lower, "auto")) - result = MODE_AUTO; + result = STATE_AUTO; free(s_lower); diff --git a/src/libgame/setup.c b/src/libgame/setup.c index a9a62d4e..9aa4ab31 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -4863,9 +4863,9 @@ char *getSetupValue(int type, void *value) break; case TYPE_SWITCH_3_STATES: - strcpy(value_string, (*(int *)value == MODE_AUTO ? "auto" : - *(int *)value == MODE_ASK ? "ask" : - *(int *)value == MODE_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: @@ -4873,13 +4873,13 @@ char *getSetupValue(int type, void *value) break; case TYPE_YES_NO_AUTO: - strcpy(value_string, (*(int *)value == MODE_AUTO ? "auto" : - *(int *)value == MODE_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 == MODE_ASK ? "ask" : - *(int *)value == MODE_FALSE ? "no" : "yes")); + strcpy(value_string, (*(int *)value == STATE_ASK ? "ask" : + *(int *)value == STATE_FALSE ? "no" : "yes")); break; case TYPE_ECS_AGA: diff --git a/src/libgame/types.h b/src/libgame/types.h index 19a0f870..f7d8ad46 100644 --- a/src/libgame/types.h +++ b/src/libgame/types.h @@ -32,12 +32,12 @@ typedef unsigned char byte; #undef FALSE #endif -#ifdef MODE_AUTO -#undef MODE_AUTO +#ifdef STATE_AUTO +#undef STATE_AUTO #endif -#ifdef MODE_ASK -#undef MODE_ASK +#ifdef STATE_ASK +#undef STATE_ASK #endif // values for boolean data type @@ -45,10 +45,10 @@ typedef unsigned char byte; #define FALSE 0 // values for 3-state data type (for "yes/no/auto" or "yes/no/ask") -#define MODE_TRUE 1 -#define MODE_FALSE 0 -#define MODE_AUTO -1 -#define MODE_ASK -1 +#define STATE_TRUE 1 +#define STATE_FALSE 0 +#define STATE_AUTO -1 +#define STATE_ASK -1 #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) diff --git a/src/screens.c b/src/screens.c index e0a8e334..2f53800c 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1929,7 +1929,7 @@ void DrawMainMenu(void) SetAnimationFirstLevel(leveldir_current->first_level); // level_nr may have been set to value over handicap with level editor - if (setup.allow_skipping_levels != MODE_TRUE && level_nr > leveldir_current->handicap_level) + if (setup.allow_skipping_levels != STATE_TRUE && level_nr > leveldir_current->handicap_level) level_nr = leveldir_current->handicap_level; LoadLevel(level_nr); @@ -2286,13 +2286,13 @@ static void HandleMainMenu_SelectLevel(int step, int direction, if (new_level_nr > leveldir_current->last_level) new_level_nr = leveldir_current->last_level; - if (setup.allow_skipping_levels != MODE_TRUE && new_level_nr > leveldir_current->handicap_level) + if (setup.allow_skipping_levels != STATE_TRUE && new_level_nr > leveldir_current->handicap_level) { // skipping levels is only allowed when trying to skip single level // (also, skipping BD style intermission levels is always possible) if (new_level_nr == old_level_nr + 1 && (level.bd_intermission || - (setup.allow_skipping_levels == MODE_ASK && + (setup.allow_skipping_levels == STATE_ASK && Request("Level still unsolved! Skip it anyway?", REQ_ASK)))) { leveldir_current->handicap_level++; @@ -5720,7 +5720,7 @@ static void HandleHallOfFame_SelectLevel(int step, int direction) if (new_level_nr > leveldir_current->last_level) new_level_nr = leveldir_current->last_level; - if (setup.allow_skipping_levels != MODE_TRUE && new_level_nr > leveldir_current->handicap_level) + if (setup.allow_skipping_levels != STATE_TRUE && new_level_nr > leveldir_current->handicap_level) new_level_nr = leveldir_current->handicap_level; if (new_level_nr != old_level_nr) @@ -8386,11 +8386,11 @@ static int getSetupValueFont(int type, void *value) else if (type & TYPE_BOOLEAN_STYLE) return (*(boolean *)value ? FONT_OPTION_ON : FONT_OPTION_OFF); else if (type & TYPE_YES_NO_AUTO) - return (*(int *)value == MODE_AUTO ? FONT_OPTION_ON : - *(int *)value == MODE_FALSE ? FONT_OPTION_OFF : FONT_OPTION_ON); + return (*(int *)value == STATE_AUTO ? FONT_OPTION_ON : + *(int *)value == STATE_FALSE ? FONT_OPTION_OFF : FONT_OPTION_ON); else if (type & TYPE_YES_NO_ASK) - return (*(int *)value == MODE_ASK ? FONT_OPTION_ON : - *(int *)value == MODE_FALSE ? FONT_OPTION_OFF : FONT_OPTION_ON); + return (*(int *)value == STATE_ASK ? FONT_OPTION_ON : + *(int *)value == STATE_FALSE ? FONT_OPTION_OFF : FONT_OPTION_ON); else if (type & TYPE_PLAYER) return FONT_VALUE_1; else @@ -8534,19 +8534,19 @@ static void changeSetupValue(int screen_pos, int setup_info_pos_raw, int dx) { *(int *)si->value = (dx == -1 ? - (*(int *)si->value == MODE_AUTO ? MODE_TRUE : - *(int *)si->value == MODE_TRUE ? MODE_FALSE : MODE_AUTO) : - (*(int *)si->value == MODE_TRUE ? MODE_AUTO : - *(int *)si->value == MODE_AUTO ? MODE_FALSE : MODE_TRUE)); + (*(int *)si->value == STATE_AUTO ? STATE_TRUE : + *(int *)si->value == STATE_TRUE ? STATE_FALSE : STATE_AUTO) : + (*(int *)si->value == STATE_TRUE ? STATE_AUTO : + *(int *)si->value == STATE_AUTO ? STATE_FALSE : STATE_TRUE)); } else if (si->type & TYPE_YES_NO_ASK) { *(int *)si->value = (dx == -1 ? - (*(int *)si->value == MODE_ASK ? MODE_TRUE : - *(int *)si->value == MODE_TRUE ? MODE_FALSE : MODE_ASK) : - (*(int *)si->value == MODE_TRUE ? MODE_ASK : - *(int *)si->value == MODE_ASK ? MODE_FALSE : MODE_TRUE)); + (*(int *)si->value == STATE_ASK ? STATE_TRUE : + *(int *)si->value == STATE_TRUE ? STATE_FALSE : STATE_ASK) : + (*(int *)si->value == STATE_TRUE ? STATE_ASK : + *(int *)si->value == STATE_ASK ? STATE_FALSE : STATE_TRUE)); } else if (si->type & TYPE_KEY) { -- 2.34.1