+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
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
# -----------------------------------------------------------------------------
-#define COMPILE_DATE_STRING "2007-10-18 02:23"
+#define COMPILE_DATE_STRING "2007-10-20 02:03"
#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
{ 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;
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;
#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
}
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)
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 */
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 *);
*(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;
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;
/* 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 | \
/* derived values for setup screen */
#define TYPE_VALUE (TYPE_BOOLEAN_STYLE | \
+ TYPE_SWITCH3 | \
+ TYPE_YES_NO_AUTO | \
TYPE_KEY | \
TYPE_KEY_X11 | \
TYPE_INTEGER | \
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;
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
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)
{ 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:" },
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
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;
}
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;
xpos = MENU_SCREEN_START_XPOS;
if (type & TYPE_QUERY)
- {
value_string = "<press key>";
- }
}
else if (type & TYPE_STRING)
{
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)
}
}
+#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);
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;
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)
else
{
if (setup_info[y].type & TYPE_VALUE)
- changeSetupValue(y);
+ changeSetupValue(y, dx);
}
}
}
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
if (fade_type & fade_type_skip)
fade_type_skip = FADE_TYPE_NONE;
+#if 1
+ fade_delay = 0;
+#else
return;
+#endif
}
#if 1
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 */
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