From: Holger Schemel Date: Sat, 20 Oct 2007 00:10:23 +0000 (+0200) Subject: rnd-20071020-1-src X-Git-Tag: 3.2.6.0^2~29 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=401f78b66d66488fe465945bef36b10faa6b55ef;p=rocksndiamonds.git rnd-20071020-1-src * merged override and auto-override options into new override options with a new data type than can take the values "no", "yes" and "auto" --- diff --git a/ChangeLog b/ChangeLog index 72d8cd60..5f4d6475 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-10-20 + * merged override and auto-override options into new override options + with a new data type than can take the values "no", "yes" and "auto" + 2007-10-18 * fixed growing steel wall to also leave behind steel wall instead of normal, destructible wall diff --git a/Makefile b/Makefile index d31608d9..ea1154ef 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ CROSS_PATH_MSDOS = /usr/local/cross-msdos/i386-msdosdjgpp CROSS_PATH_WIN32 = /usr/local/cross-tools/i386-mingw32msvc # compile special edition of R'n'D instead of the normal (classic) version -# SPECIAL_EDITION = rnd_jue +SPECIAL_EDITION = rnd_jue # ----------------------------------------------------------------------------- diff --git a/src/conftime.h b/src/conftime.h index 8a9e3345..2968c64d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-10-18 02:23" +#define COMPILE_DATE_STRING "2007-10-20 02:03" diff --git a/src/files.c b/src/files.c index 3b51e6e2..45dec406 100644 --- a/src/files.c +++ b/src/files.c @@ -8013,9 +8013,8 @@ void SaveScore(int nr) #define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 28 #define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 29 #define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 30 -#define SETUP_TOKEN_AUTO_OVERRIDE_ARTWORK 31 -#define NUM_GLOBAL_SETUP_TOKENS 32 +#define NUM_GLOBAL_SETUP_TOKENS 31 /* editor setup */ #define SETUP_TOKEN_EDITOR_EL_BOULDERDASH 0 @@ -8140,10 +8139,9 @@ static struct TokenInfo global_setup_tokens[] = { TYPE_STRING, &si.graphics_set, "graphics_set" }, { TYPE_STRING, &si.sounds_set, "sounds_set" }, { TYPE_STRING, &si.music_set, "music_set" }, - { TYPE_SWITCH, &si.override_level_graphics, "override_level_graphics" }, - { TYPE_SWITCH, &si.override_level_sounds, "override_level_sounds" }, - { TYPE_SWITCH, &si.override_level_music, "override_level_music" }, - { TYPE_SWITCH, &si.auto_override_artwork, "auto_override_artwork" }, + { TYPE_SWITCH3,&si.override_level_graphics, "override_level_graphics" }, + { TYPE_SWITCH3,&si.override_level_sounds, "override_level_sounds" }, + { TYPE_SWITCH3,&si.override_level_music, "override_level_music" }, }; static boolean not_used = FALSE; @@ -8298,7 +8296,6 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->override_level_graphics = FALSE; si->override_level_sounds = FALSE; si->override_level_music = FALSE; - si->auto_override_artwork = FALSE; si->editor.el_boulderdash = TRUE; si->editor.el_emerald_mine = TRUE; @@ -8357,7 +8354,9 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) #if defined(CREATE_SPECIAL_EDITION_RND_JUE) si->handicap = FALSE; si->fullscreen = TRUE; - si->auto_override_artwork = TRUE; + si->override_level_graphics = AUTO; + si->override_level_sounds = AUTO; + si->override_level_music = AUTO; #endif } diff --git a/src/init.c b/src/init.c index 5d862c6f..6ef48aee 100644 --- a/src/init.c +++ b/src/init.c @@ -5758,71 +5758,94 @@ static boolean CheckArtworkConfigForCustomElements(char *filename) return redefined_ce_found; } -static void InitOverrideArtwork() +static boolean CheckArtworkTypeForRedefinedCustomElements(int type) { - boolean init_override_from_setup = TRUE; - - gfx.override_level_graphics = FALSE; - gfx.override_level_sounds = FALSE; - gfx.override_level_music = FALSE; - - if (setup.auto_override_artwork) - { - char *filename_base, *filename_local; - boolean redefined_ce_found = FALSE; + char *filename_base, *filename_local; + boolean redefined_ce_found = FALSE; - setLevelArtworkDir(artwork.gfx_first); + setLevelArtworkDir(ARTWORK_FIRST_NODE(artwork, type)); #if 0 - printf("::: leveldir_current->identifier == '%s'\n", - leveldir_current == NULL ? "[NULL]" : leveldir_current->identifier); - printf("::: leveldir_current->graphics_path == '%s'\n", - leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_path); - printf("::: leveldir_current->graphics_set == '%s'\n", - leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_set); - printf("::: getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) == '%s'\n", - leveldir_current == NULL ? "[NULL]" : LEVELDIR_ARTWORK_SET(leveldir_current, ARTWORK_TYPE_GRAPHICS)); + printf("::: leveldir_current->identifier == '%s'\n", + leveldir_current == NULL ? "[NULL]" : leveldir_current->identifier); + printf("::: leveldir_current->graphics_path == '%s'\n", + leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_path); + printf("::: leveldir_current->graphics_set == '%s'\n", + leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_set); + printf("::: getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) == '%s'\n", + leveldir_current == NULL ? "[NULL]" : + LEVELDIR_ARTWORK_SET(leveldir_current, type)); #endif - /* first look for special artwork configured in level series config */ - filename_base = getCustomArtworkLevelConfigFilename(ARTWORK_TYPE_GRAPHICS); + /* first look for special artwork configured in level series config */ + filename_base = getCustomArtworkLevelConfigFilename(type); #if 0 - printf("::: filename_base == '%s'\n", filename_base); + printf("::: filename_base == '%s'\n", filename_base); #endif - if (fileExists(filename_base)) - redefined_ce_found |= CheckArtworkConfigForCustomElements(filename_base); + if (fileExists(filename_base)) + redefined_ce_found |= CheckArtworkConfigForCustomElements(filename_base); - filename_local = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS); + filename_local = getCustomArtworkConfigFilename(type); #if 0 - printf("::: filename_local == '%s'\n", filename_local); + printf("::: filename_local == '%s'\n", filename_local); #endif - if (filename_local != NULL && !strEqual(filename_base, filename_local)) - redefined_ce_found |= CheckArtworkConfigForCustomElements(filename_local); + if (filename_local != NULL && !strEqual(filename_base, filename_local)) + redefined_ce_found |= CheckArtworkConfigForCustomElements(filename_local); #if 0 - printf("::: redefined_ce_found == %d\n", redefined_ce_found); + printf("::: redefined_ce_found == %d\n", redefined_ce_found); #endif - if (!redefined_ce_found) - { - gfx.override_level_graphics = TRUE; - gfx.override_level_sounds = TRUE; - gfx.override_level_music = TRUE; + return redefined_ce_found; +} - init_override_from_setup = FALSE; - } - } +static void InitOverrideArtwork() +{ + boolean redefined_ce_found = FALSE; + + /* to check if this level set redefines any CEs, do not use overriding */ + gfx.override_level_graphics = FALSE; + gfx.override_level_sounds = FALSE; + gfx.override_level_music = FALSE; + + /* now check if this level set has definitions for custom elements */ + if (setup.override_level_graphics == AUTO || + setup.override_level_sounds == AUTO || + setup.override_level_music == AUTO) + redefined_ce_found = + (CheckArtworkTypeForRedefinedCustomElements(ARTWORK_TYPE_GRAPHICS) | + CheckArtworkTypeForRedefinedCustomElements(ARTWORK_TYPE_SOUNDS) | + CheckArtworkTypeForRedefinedCustomElements(ARTWORK_TYPE_MUSIC)); - if (init_override_from_setup) +#if 0 + printf("::: redefined_ce_found == %d\n", redefined_ce_found); +#endif + + if (redefined_ce_found) { - gfx.override_level_graphics = setup.override_level_graphics; - gfx.override_level_sounds = setup.override_level_sounds; - gfx.override_level_music = setup.override_level_music; + /* this level set has CE definitions: change "AUTO" to "FALSE" */ + gfx.override_level_graphics = (setup.override_level_graphics == TRUE); + gfx.override_level_sounds = (setup.override_level_sounds == TRUE); + gfx.override_level_music = (setup.override_level_music == TRUE); } + else + { + /* this level set has no CE definitions: change "AUTO" to "TRUE" */ + gfx.override_level_graphics = (setup.override_level_graphics != FALSE); + gfx.override_level_sounds = (setup.override_level_sounds != FALSE); + gfx.override_level_music = (setup.override_level_music != FALSE); + } + +#if 0 + printf("::: => %d, %d, %d\n", + gfx.override_level_graphics, + gfx.override_level_sounds, + gfx.override_level_music); +#endif } static char *getNewArtworkIdentifier(int type) diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 9d23c75f..05dae3dd 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1600,6 +1600,24 @@ boolean get_boolean_from_string(char *s) return result; } +int get_switch3_from_string(char *s) +{ + char *s_lower = getStringToLower(s); + int result = FALSE; + + if (strEqual(s_lower, "true") || + strEqual(s_lower, "yes") || + strEqual(s_lower, "on") || + get_integer_from_string(s) == 1) + result = TRUE; + else if (strEqual(s_lower, "auto")) + result = AUTO; + + free(s_lower); + + return result; +} + /* ------------------------------------------------------------------------- */ /* functions for generic lists */ diff --git a/src/libgame/misc.h b/src/libgame/misc.h index 29aaee70..66dbda05 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -169,6 +169,7 @@ char getValidConfigValueChar(char); int get_integer_from_string(char *); boolean get_boolean_from_string(char *); +int get_switch3_from_string(char *); ListNode *newListNode(void); void addNodeToList(ListNode **, char *, void *); diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 65e504e5..3e539249 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -2687,6 +2687,10 @@ void setSetupInfo(struct TokenInfo *token_info, *(boolean *)setup_value = get_boolean_from_string(token_value); break; + case TYPE_SWITCH3: + *(int *)setup_value = get_switch3_from_string(token_value); + break; + case TYPE_KEY: *(Key *)setup_value = getKeyFromKeyName(token_value); break; @@ -3749,10 +3753,20 @@ char *getSetupValue(int type, void *value) strcpy(value_string, (*(boolean *)value ? "on" : "off")); break; + case TYPE_SWITCH3: + strcpy(value_string, (*(int *)value == AUTO ? "auto" : + *(int *)value == FALSE ? "off" : "on")); + break; + case TYPE_YES_NO: strcpy(value_string, (*(boolean *)value ? "yes" : "no")); break; + case TYPE_YES_NO_AUTO: + strcpy(value_string, (*(int *)value == AUTO ? "auto" : + *(int *)value == FALSE ? "no" : "yes")); + break; + case TYPE_ECS_AGA: strcpy(value_string, (*(boolean *)value ? "AGA" : "ECS")); break; diff --git a/src/libgame/setup.h b/src/libgame/setup.h index 02a815ab..414cf74e 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -21,33 +21,35 @@ /* values for setup file handling */ #define TYPE_BOOLEAN (1 << 0) #define TYPE_SWITCH (1 << 1) -#define TYPE_YES_NO (1 << 2) -#define TYPE_ECS_AGA (1 << 3) -#define TYPE_KEY (1 << 4) -#define TYPE_KEY_X11 (1 << 5) -#define TYPE_INTEGER (1 << 6) -#define TYPE_STRING (1 << 7) -#define TYPE_ELEMENT (1 << 8) -#define TYPE_GRAPHIC (1 << 9) +#define TYPE_SWITCH3 (1 << 2) +#define TYPE_YES_NO (1 << 3) +#define TYPE_YES_NO_AUTO (1 << 4) +#define TYPE_ECS_AGA (1 << 5) +#define TYPE_KEY (1 << 6) +#define TYPE_KEY_X11 (1 << 7) +#define TYPE_INTEGER (1 << 8) +#define TYPE_STRING (1 << 9) +#define TYPE_ELEMENT (1 << 10) +#define TYPE_GRAPHIC (1 << 11) /* additional values for setup screen */ -#define TYPE_ENTER_SCREEN (1 << 10) -#define TYPE_LEAVE_SCREEN (1 << 11) -#define TYPE_ENTER_MENU (1 << 12) -#define TYPE_LEAVE_MENU (1 << 13) -#define TYPE_ENTER_LIST (1 << 14) -#define TYPE_LEAVE_LIST (1 << 15) -#define TYPE_EMPTY (1 << 16) -#define TYPE_KEYTEXT (1 << 17) - -#define TYPE_GHOSTED (1 << 18) -#define TYPE_QUERY (1 << 19) +#define TYPE_ENTER_SCREEN (1 << 12) +#define TYPE_LEAVE_SCREEN (1 << 13) +#define TYPE_ENTER_MENU (1 << 14) +#define TYPE_LEAVE_MENU (1 << 15) +#define TYPE_ENTER_LIST (1 << 16) +#define TYPE_LEAVE_LIST (1 << 17) +#define TYPE_EMPTY (1 << 18) +#define TYPE_KEYTEXT (1 << 19) + +#define TYPE_GHOSTED (1 << 20) +#define TYPE_QUERY (1 << 21) /* additional values for internal purposes */ -#define TYPE_BITFIELD (1 << 20) -#define TYPE_CONTENT (1 << 21) -#define TYPE_ELEMENT_LIST (1 << 22) -#define TYPE_CONTENT_LIST (1 << 23) +#define TYPE_BITFIELD (1 << 22) +#define TYPE_CONTENT (1 << 23) +#define TYPE_ELEMENT_LIST (1 << 24) +#define TYPE_CONTENT_LIST (1 << 25) /* derived values for setup file handling */ #define TYPE_BOOLEAN_STYLE (TYPE_BOOLEAN | \ @@ -57,6 +59,8 @@ /* derived values for setup screen */ #define TYPE_VALUE (TYPE_BOOLEAN_STYLE | \ + TYPE_SWITCH3 | \ + TYPE_YES_NO_AUTO | \ TYPE_KEY | \ TYPE_KEY_X11 | \ TYPE_INTEGER | \ diff --git a/src/libgame/system.h b/src/libgame/system.h index 28e5a2ea..3791f1e6 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -870,10 +870,9 @@ struct SetupInfo char *graphics_set; char *sounds_set; char *music_set; - boolean override_level_graphics; - boolean override_level_sounds; - boolean override_level_music; - boolean auto_override_artwork; + int override_level_graphics; /* not boolean -- can also be "AUTO" */ + int override_level_sounds; /* not boolean -- can also be "AUTO" */ + int override_level_music; /* not boolean -- can also be "AUTO" */ struct SetupEditorInfo editor; struct SetupEditorCascadeInfo editor_cascade; diff --git a/src/libgame/types.h b/src/libgame/types.h index f4d0e820..d6f49bdd 100644 --- a/src/libgame/types.h +++ b/src/libgame/types.h @@ -26,11 +26,22 @@ typedef int boolean; typedef unsigned char byte; #endif -#ifndef FALSE -#define FALSE 0 -#define TRUE (!FALSE) +#ifdef TRUE +#undef TRUE +#endif + +#ifdef FALSE +#undef FALSE #endif +#ifdef AUTO +#undef AUTO +#endif + +#define TRUE 1 +#define FALSE 0 +#define AUTO -1 + #ifndef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif diff --git a/src/screens.c b/src/screens.c index 9b2a6ef9..6097a04b 100644 --- a/src/screens.c +++ b/src/screens.c @@ -2010,7 +2010,8 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button) if (info_info[choice].type & menu_navigation_type || info_info[choice].type & TYPE_ENTER_SCREEN || - info_info[choice].type & TYPE_BOOLEAN_STYLE) + info_info[choice].type & TYPE_BOOLEAN_STYLE || + info_info[choice].type & TYPE_YES_NO_AUTO) button = MB_MENU_CHOICE; } else if (dy) @@ -4210,10 +4211,16 @@ static struct TokenInfo setup_info_artwork[] = { TYPE_STRING, &music_set_name, "" }, { TYPE_EMPTY, NULL, "" }, #if 1 +#if 1 + { TYPE_YES_NO_AUTO,&setup.override_level_graphics,"Override Level Graphics:"}, + { TYPE_YES_NO_AUTO,&setup.override_level_sounds, "Override Level Sounds:" }, + { TYPE_YES_NO_AUTO,&setup.override_level_music, "Override Level Music:" }, +#else { TYPE_YES_NO, &setup.override_level_graphics,"Override Level Graphics:" }, { TYPE_YES_NO, &setup.override_level_sounds, "Override Level Sounds:" }, { TYPE_YES_NO, &setup.override_level_music, "Override Level Music:" }, { TYPE_YES_NO, &setup.auto_override_artwork, "Auto-Override Non-CE Sets:" }, +#endif #else { TYPE_STRING, NULL, "Override Level Artwork:"}, { TYPE_YES_NO, &setup.override_level_graphics, "Graphics:" }, @@ -4330,11 +4337,12 @@ static Key getSetupKey() static int getSetupTextFont(int type) { - if (type & (TYPE_SWITCH | - TYPE_YES_NO | - TYPE_STRING | - TYPE_ECS_AGA | - TYPE_KEYTEXT | + if (type & (TYPE_SWITCH | + TYPE_YES_NO | + TYPE_YES_NO_AUTO | + TYPE_STRING | + TYPE_ECS_AGA | + TYPE_KEYTEXT | TYPE_ENTER_LIST)) return FONT_MENU_2; else @@ -4351,6 +4359,9 @@ static int getSetupValueFont(int type, void *value) return FONT_VALUE_1; 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 == AUTO ? FONT_OPTION_ON : + *(int *)value == FALSE ? FONT_OPTION_OFF : FONT_OPTION_ON); else return FONT_VALUE_1; } @@ -4363,11 +4374,13 @@ static void drawSetupValue(int pos) int ypos = MENU_SCREEN_START_YPOS + pos; int startx = mSX + xpos * 32; int starty = mSY + ypos * 32; - int font_nr, font_width; + int font_nr, font_width, font_height; int type = setup_info[pos].type; void *value = setup_info[pos].value; char *value_string = getSetupValue(type, value); +#if 1 int i; +#endif if (value_string == NULL) return; @@ -4377,9 +4390,7 @@ static void drawSetupValue(int pos) xpos = MENU_SCREEN_START_XPOS; if (type & TYPE_QUERY) - { value_string = ""; - } } else if (type & TYPE_STRING) { @@ -4390,11 +4401,16 @@ static void drawSetupValue(int pos) if (strlen(value_string) > max_value_len) value_string[max_value_len] = '\0'; } + else if (type & TYPE_YES_NO_AUTO) + { + xpos = MENU_SCREEN_VALUE_XPOS - 1; + } startx = mSX + xpos * 32; starty = mSY + ypos * 32; font_nr = getSetupValueFont(type, value); font_width = getFontWidth(font_nr); + font_height = getFontHeight(font_nr); /* downward compatibility correction for Juergen Bonhagen's menu settings */ if (setup_mode != SETUP_MODE_INPUT) @@ -4431,8 +4447,12 @@ static void drawSetupValue(int pos) } } +#if 0 + DrawBackground(startx, starty, SX + SXSIZE - startx, font_height); +#else for (i = 0; i <= MENU_SCREEN_MAX_XPOS - xpos; i++) DrawText(startx + i * font_width, starty, " ", font_nr); +#endif DrawText(startx, starty, value_string, font_nr); @@ -4440,12 +4460,21 @@ static void drawSetupValue(int pos) getFontBitmapInfo(font_nr)->draw_xoffset = font_draw_xoffset_old; } -static void changeSetupValue(int pos) +static void changeSetupValue(int pos, int dx) { if (setup_info[pos].type & TYPE_BOOLEAN_STYLE) { *(boolean *)setup_info[pos].value ^= TRUE; } + else if (setup_info[pos].type & TYPE_YES_NO_AUTO) + { + *(int *)setup_info[pos].value = + (dx == -1 ? + (*(int *)setup_info[pos].value == AUTO ? TRUE : + *(int *)setup_info[pos].value == TRUE ? FALSE : AUTO) : + (*(int *)setup_info[pos].value == TRUE ? AUTO : + *(int *)setup_info[pos].value == AUTO ? FALSE : TRUE)); + } else if (setup_info[pos].type & TYPE_KEY) { Key key; @@ -4658,7 +4687,8 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button) int menu_navigation_type = (dx < 0 ? TYPE_LEAVE : TYPE_ENTER); if (setup_info[choice].type & menu_navigation_type || - setup_info[choice].type & TYPE_BOOLEAN_STYLE) + setup_info[choice].type & TYPE_BOOLEAN_STYLE || + setup_info[choice].type & TYPE_YES_NO_AUTO) button = MB_MENU_CHOICE; } else if (dy) @@ -4709,7 +4739,7 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button) else { if (setup_info[y].type & TYPE_VALUE) - changeSetupValue(y); + changeSetupValue(y, dx); } } } diff --git a/src/tools.c b/src/tools.c index b26add56..804f4a35 100644 --- a/src/tools.c +++ b/src/tools.c @@ -503,6 +503,16 @@ static void FadeExt(int fade_mask, int fade_mode, int fade_type) return; } +#if 0 + printf("::: !!! FADING %d ... [%d] [%d]\n", fade_mode, fade_type, + fade_type_skip); +#endif + +#if 1 + fade_delay = fading.fade_delay; + post_delay = (fade_mode == FADE_MODE_FADE_OUT ? fading.post_delay : 0); +#endif + if (fade_type_skip != FADE_TYPE_NONE) { #if 0 @@ -513,7 +523,11 @@ static void FadeExt(int fade_mask, int fade_mode, int fade_type) if (fade_type & fade_type_skip) fade_type_skip = FADE_TYPE_NONE; +#if 1 + fade_delay = 0; +#else return; +#endif } #if 1 @@ -553,8 +567,10 @@ static void FadeExt(int fade_mask, int fade_mode, int fade_type) width = FULL_SXSIZE; height = FULL_SYSIZE; +#if 0 fade_delay = fading.fade_delay; post_delay = (fade_mode == FADE_MODE_FADE_OUT ? fading.post_delay : 0); +#endif if (border.draw_masked_when_fading) draw_border_function = DrawMaskedBorder_FIELD; /* update when fading */ @@ -568,8 +584,10 @@ static void FadeExt(int fade_mask, int fade_mode, int fade_type) width = WIN_XSIZE; height = WIN_YSIZE; +#if 0 fade_delay = fading.fade_delay; post_delay = (fade_mode == FADE_MODE_FADE_OUT ? fading.post_delay : 0); +#endif } #if 1