From 7a821f79cb735d048869b503279c402800afa44a Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 1 Sep 2003 19:18:39 +0200 Subject: [PATCH] rnd-20030901-B-src --- CHANGES | 1 - src/conf_fnt.c | 4 - src/conf_gfx.c | 5 -- src/conf_gfx.h | 89 +++++++++++---------- src/conftime.h | 2 +- src/editor.c | 166 ++++++++------------------------------- src/files.c | 181 +------------------------------------------ src/game.c | 81 +------------------ src/init.c | 18 +++-- src/libgame/setup.c | 165 +++++++++++++++++++++++++++++++++++---- src/libgame/sound.c | 8 +- src/libgame/system.h | 2 - src/libgame/text.c | 2 +- src/libgame/toons.c | 17 ++-- src/main.c | 1 - src/main.h | 17 ++-- src/screens.c | 2 - src/tools.c | 43 +++------- src/tools.h | 1 - 19 files changed, 282 insertions(+), 523 deletions(-) diff --git a/CHANGES b/CHANGES index e57b06e9..9ee229b4 100644 --- a/CHANGES +++ b/CHANGES @@ -3,7 +3,6 @@ Release Version 3.0.3 [?? ??? ????] - fixed bug (missing array boundary check) which could crash the game - fixed problem with setting mouse cursor in SDL version in fullscreen - fixed problem with flickering when drawing toon animations - - fixed problem with player animation when snapping and moving Release Version 3.0.2 [22 AUG 2003] ----------------------------------- diff --git a/src/conf_fnt.c b/src/conf_fnt.c index ef44d538..0a191dda 100644 --- a/src/conf_fnt.c +++ b/src/conf_fnt.c @@ -75,10 +75,6 @@ font_to_graphic[] = FONT_TEXT_1, GFX_SPECIAL_ARG_PREVIEW, IMG_FONT_TEXT_1_PREVIEW }, - { - FONT_TEXT_1, GFX_SPECIAL_ARG_PLAYING, - IMG_FONT_TEXT_1_PLAYING - }, { FONT_TEXT_1, GFX_SPECIAL_ARG_SCORES, IMG_FONT_TEXT_1_SCORES diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 3bd3223f..258b7fde 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -3263,11 +3263,6 @@ struct ConfigInfo image_config[] = { "font.text_1.PREVIEW.y", "160" }, { "font.text_1.PREVIEW.width", "16" }, { "font.text_1.PREVIEW.height", "16" }, - { "font.text_1.PLAYING", "RocksFontEM.pcx" }, - { "font.text_1.PLAYING.x", "0" }, - { "font.text_1.PLAYING.y", "160" }, - { "font.text_1.PLAYING.width", "16" }, - { "font.text_1.PLAYING.height", "16" }, { "font.text_1.SCORES", "RocksFontMedium.pcx" }, { "font.text_1.SCORES.x", "0" }, { "font.text_1.SCORES.y", "480" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index 71edd97e..41fe2b22 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1248,51 +1248,50 @@ #define IMG_FONT_TEXT_1 1227 #define IMG_FONT_TEXT_1_LEVELS 1228 #define IMG_FONT_TEXT_1_PREVIEW 1229 -#define IMG_FONT_TEXT_1_PLAYING 1230 -#define IMG_FONT_TEXT_1_SCORES 1231 -#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1232 -#define IMG_FONT_TEXT_2 1233 -#define IMG_FONT_TEXT_2_LEVELS 1234 -#define IMG_FONT_TEXT_2_PREVIEW 1235 -#define IMG_FONT_TEXT_2_SCORES 1236 -#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1237 -#define IMG_FONT_TEXT_3 1238 -#define IMG_FONT_TEXT_3_LEVELS 1239 -#define IMG_FONT_TEXT_3_PREVIEW 1240 -#define IMG_FONT_TEXT_3_SCORES 1241 -#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1242 -#define IMG_FONT_TEXT_4 1243 -#define IMG_FONT_TEXT_4_LEVELS 1244 -#define IMG_FONT_TEXT_4_SCORES 1245 -#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1246 -#define IMG_FONT_INPUT_1 1247 -#define IMG_FONT_INPUT_1_MAIN 1248 -#define IMG_FONT_INPUT_1_ACTIVE 1249 -#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1250 -#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1251 -#define IMG_FONT_INPUT_2 1252 -#define IMG_FONT_INPUT_2_ACTIVE 1253 -#define IMG_FONT_OPTION_OFF 1254 -#define IMG_FONT_OPTION_ON 1255 -#define IMG_FONT_VALUE_1 1256 -#define IMG_FONT_VALUE_2 1257 -#define IMG_FONT_VALUE_OLD 1258 -#define IMG_FONT_LEVEL_NUMBER 1259 -#define IMG_FONT_TAPE_RECORDER 1260 -#define IMG_FONT_GAME_INFO 1261 -#define IMG_GLOBAL_BORDER 1262 -#define IMG_GLOBAL_DOOR 1263 -#define IMG_EDITOR_ELEMENT_BORDER 1264 -#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1265 -#define IMG_BACKGROUND 1266 -#define IMG_BACKGROUND_MAIN 1267 -#define IMG_BACKGROUND_LEVELS 1268 -#define IMG_BACKGROUND_SCORES 1269 -#define IMG_BACKGROUND_EDITOR 1270 -#define IMG_BACKGROUND_INFO 1271 -#define IMG_BACKGROUND_SETUP 1272 -#define IMG_BACKGROUND_DOOR 1273 +#define IMG_FONT_TEXT_1_SCORES 1230 +#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1231 +#define IMG_FONT_TEXT_2 1232 +#define IMG_FONT_TEXT_2_LEVELS 1233 +#define IMG_FONT_TEXT_2_PREVIEW 1234 +#define IMG_FONT_TEXT_2_SCORES 1235 +#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1236 +#define IMG_FONT_TEXT_3 1237 +#define IMG_FONT_TEXT_3_LEVELS 1238 +#define IMG_FONT_TEXT_3_PREVIEW 1239 +#define IMG_FONT_TEXT_3_SCORES 1240 +#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1241 +#define IMG_FONT_TEXT_4 1242 +#define IMG_FONT_TEXT_4_LEVELS 1243 +#define IMG_FONT_TEXT_4_SCORES 1244 +#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1245 +#define IMG_FONT_INPUT_1 1246 +#define IMG_FONT_INPUT_1_MAIN 1247 +#define IMG_FONT_INPUT_1_ACTIVE 1248 +#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1249 +#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1250 +#define IMG_FONT_INPUT_2 1251 +#define IMG_FONT_INPUT_2_ACTIVE 1252 +#define IMG_FONT_OPTION_OFF 1253 +#define IMG_FONT_OPTION_ON 1254 +#define IMG_FONT_VALUE_1 1255 +#define IMG_FONT_VALUE_2 1256 +#define IMG_FONT_VALUE_OLD 1257 +#define IMG_FONT_LEVEL_NUMBER 1258 +#define IMG_FONT_TAPE_RECORDER 1259 +#define IMG_FONT_GAME_INFO 1260 +#define IMG_GLOBAL_BORDER 1261 +#define IMG_GLOBAL_DOOR 1262 +#define IMG_EDITOR_ELEMENT_BORDER 1263 +#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1264 +#define IMG_BACKGROUND 1265 +#define IMG_BACKGROUND_MAIN 1266 +#define IMG_BACKGROUND_LEVELS 1267 +#define IMG_BACKGROUND_SCORES 1268 +#define IMG_BACKGROUND_EDITOR 1269 +#define IMG_BACKGROUND_INFO 1270 +#define IMG_BACKGROUND_SETUP 1271 +#define IMG_BACKGROUND_DOOR 1272 -#define NUM_IMAGE_FILES 1274 +#define NUM_IMAGE_FILES 1273 #endif /* CONF_GFX_H */ diff --git a/src/conftime.h b/src/conftime.h index b3ed1b20..d69a3b08 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-08-30 14:20]" +#define COMPILE_DATE_STRING "[2003-09-01 19:13]" diff --git a/src/editor.c b/src/editor.c index 636e21dc..12053e07 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1867,7 +1867,7 @@ static int edit_mode_properties; static int element_shift = 0; -static int editor_hl_boulderdash[] = +static int editor_el_boulderdash[] = { EL_CHAR('B'), EL_CHAR('O'), @@ -1883,10 +1883,7 @@ static int editor_hl_boulderdash[] = EL_CHAR('A'), EL_CHAR('S'), EL_CHAR('H'), -}; -static int editor_el_boulderdash[] = -{ EL_PLAYER_1, EL_EMPTY, EL_SAND, @@ -1912,10 +1909,9 @@ static int editor_el_boulderdash[] = EL_BD_FIREFLY_DOWN, EL_EMPTY, }; -static int num_editor_hl_boulderdash = SIZEOF_ARRAY_INT(editor_hl_boulderdash); static int num_editor_el_boulderdash = SIZEOF_ARRAY_INT(editor_el_boulderdash); -static int editor_hl_emerald_mine[] = +static int editor_el_emerald_mine[] = { EL_CHAR('E'), EL_CHAR('M'), @@ -1931,10 +1927,7 @@ static int editor_hl_emerald_mine[] = EL_CHAR('I'), EL_CHAR('N'), EL_CHAR('E'), -}; -static int editor_el_emerald_mine[] = -{ EL_PLAYER_1, EL_PLAYER_2, EL_PLAYER_3, @@ -2010,19 +2003,15 @@ static int editor_el_emerald_mine[] = EL_EM_GATE_3_GRAY, EL_EM_GATE_4_GRAY, }; -static int num_editor_hl_emerald_mine=SIZEOF_ARRAY_INT(editor_hl_emerald_mine); -static int num_editor_el_emerald_mine=SIZEOF_ARRAY_INT(editor_el_emerald_mine); +static int num_editor_el_emerald_mine = SIZEOF_ARRAY_INT(editor_el_emerald_mine); -static int editor_hl_more[] = +static int editor_el_more[] = { EL_CHAR('M'), EL_CHAR('O'), EL_CHAR('R'), EL_CHAR('E'), -}; -static int editor_el_more[] = -{ EL_KEY_1, EL_KEY_2, EL_KEY_3, @@ -2118,10 +2107,9 @@ static int editor_el_more[] = EL_EMC_WALL_6, EL_EMC_WALL_7, }; -static int num_editor_hl_more = SIZEOF_ARRAY_INT(editor_hl_more); static int num_editor_el_more = SIZEOF_ARRAY_INT(editor_el_more); -static int editor_hl_sokoban[] = +static int editor_el_sokoban[] = { EL_CHAR('S'), EL_CHAR('O'), @@ -2132,19 +2120,15 @@ static int editor_hl_sokoban[] = EL_CHAR('B'), EL_CHAR('A'), EL_CHAR('N'), -}; -static int editor_el_sokoban[] = -{ EL_SOKOBAN_OBJECT, EL_SOKOBAN_FIELD_EMPTY, EL_SOKOBAN_FIELD_FULL, EL_STEELWALL, }; -static int num_editor_hl_sokoban = SIZEOF_ARRAY_INT(editor_hl_sokoban); static int num_editor_el_sokoban = SIZEOF_ARRAY_INT(editor_el_sokoban); -static int editor_hl_supaplex[] = +static int editor_el_supaplex[] = { EL_CHAR('S'), EL_CHAR('U'), @@ -2155,10 +2139,7 @@ static int editor_hl_supaplex[] = EL_CHAR('L'), EL_CHAR('E'), EL_CHAR('X'), -}; -static int editor_el_supaplex[] = -{ EL_SP_EMPTY, EL_SP_ZONK, EL_SP_BASE, @@ -2209,10 +2190,9 @@ static int editor_el_supaplex[] = EL_SP_CHIP_TOP, EL_SP_CHIP_BOTTOM, }; -static int num_editor_hl_supaplex = SIZEOF_ARRAY_INT(editor_hl_supaplex); static int num_editor_el_supaplex = SIZEOF_ARRAY_INT(editor_el_supaplex); -static int editor_hl_diamond_caves[] = +static int editor_el_diamond_caves[] = { EL_CHAR('D'), EL_CHAR('I'), @@ -2233,10 +2213,7 @@ static int editor_hl_diamond_caves[] = EL_CHAR(' '), EL_CHAR('I'), EL_CHAR('I'), -}; -static int editor_el_diamond_caves[] = -{ EL_PEARL, EL_CRYSTAL, EL_WALL_PEARL, @@ -2297,10 +2274,9 @@ static int editor_el_diamond_caves[] = EL_EXTRA_TIME, EL_EMPTY, }; -static int num_editor_hl_diamond_caves = SIZEOF_ARRAY_INT(editor_hl_diamond_caves); static int num_editor_el_diamond_caves = SIZEOF_ARRAY_INT(editor_el_diamond_caves); -static int editor_hl_dx_boulderdash[] = +static int editor_el_dx_boulderdash[] = { EL_CHAR('D'), EL_CHAR('X'), @@ -2321,10 +2297,7 @@ static int editor_hl_dx_boulderdash[] = EL_CHAR('A'), EL_CHAR('S'), EL_CHAR('H'), -}; -static int editor_el_dx_boulderdash[] = -{ EL_SPRING, EL_TUBE_RIGHT_DOWN, EL_TUBE_HORIZONTAL_DOWN, @@ -2345,19 +2318,15 @@ static int editor_el_dx_boulderdash[] = EL_EMPTY, EL_EMPTY }; -static int num_editor_hl_dx_boulderdash = SIZEOF_ARRAY_INT(editor_hl_dx_boulderdash); static int num_editor_el_dx_boulderdash = SIZEOF_ARRAY_INT(editor_el_dx_boulderdash); -static int editor_hl_chars[] = +static int editor_el_chars[] = { EL_CHAR('T'), EL_CHAR('E'), EL_CHAR('X'), EL_CHAR('T'), -}; -static int editor_el_chars[] = -{ EL_CHAR(' '), EL_CHAR('!'), EL_CHAR('"'), @@ -2448,10 +2417,9 @@ static int editor_el_chars[] = EL_CHAR(FONT_ASCII_CURSOR), EL_CHAR(' ') }; -static int num_editor_hl_chars = SIZEOF_ARRAY_INT(editor_hl_chars); static int num_editor_el_chars = SIZEOF_ARRAY_INT(editor_el_chars); -static int editor_hl_custom[] = +static int editor_el_custom[] = { EL_CHAR('C'), EL_CHAR('U'), @@ -2472,10 +2440,7 @@ static int editor_hl_custom[] = EL_CHAR('N'), EL_CHAR('T'), EL_CHAR('S'), -}; -static int editor_el_custom[] = -{ EL_CUSTOM_START + 0, EL_CUSTOM_START + 1, EL_CUSTOM_START + 2, @@ -2636,13 +2601,8 @@ static int editor_el_custom[] = EL_CUSTOM_START + 126, EL_CUSTOM_START + 127 }; -static int num_editor_hl_custom = SIZEOF_ARRAY_INT(editor_hl_custom); static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom); -static int editor_hl_custom_more[] = -{ -}; - static int editor_el_custom_more[] = { EL_CUSTOM_START + 128, @@ -2805,7 +2765,6 @@ static int editor_el_custom_more[] = EL_CUSTOM_START + 254, EL_CUSTOM_START + 255 }; -static int num_editor_hl_custom_more = SIZEOF_ARRAY_INT(editor_hl_custom_more); static int num_editor_el_custom_more = SIZEOF_ARRAY_INT(editor_el_custom_more); static int *editor_elements = NULL; /* dynamically allocated */ @@ -2814,10 +2773,6 @@ static int num_editor_elements = 0; /* dynamically determined */ static struct { boolean *setup_value; - - int *headline_list; - int *headline_list_size; - int *element_list; int *element_list_size; @@ -2825,61 +2780,28 @@ static struct } editor_elements_info[] = { - { - &setup.editor.el_boulderdash, - editor_hl_boulderdash, &num_editor_hl_boulderdash, - editor_el_boulderdash, &num_editor_el_boulderdash - }, - { - &setup.editor.el_emerald_mine, - editor_hl_emerald_mine, &num_editor_hl_emerald_mine, - editor_el_emerald_mine, &num_editor_el_emerald_mine - }, - { - &setup.editor.el_more, - editor_hl_more, &num_editor_hl_more, - editor_el_more, &num_editor_el_more - }, - { - &setup.editor.el_sokoban, - editor_hl_sokoban, &num_editor_hl_sokoban, - editor_el_sokoban, &num_editor_el_sokoban - }, - { - &setup.editor.el_supaplex, - editor_hl_supaplex, &num_editor_hl_supaplex, - editor_el_supaplex, &num_editor_el_supaplex - }, - { - &setup.editor.el_diamond_caves, - editor_hl_diamond_caves, &num_editor_hl_diamond_caves, - editor_el_diamond_caves, &num_editor_el_diamond_caves - }, - { - &setup.editor.el_dx_boulderdash, - editor_hl_dx_boulderdash, &num_editor_hl_dx_boulderdash, - editor_el_dx_boulderdash, &num_editor_el_dx_boulderdash - }, - { - &setup.editor.el_chars, - editor_hl_chars, &num_editor_hl_chars, - editor_el_chars, &num_editor_el_chars - }, - { - &setup.editor.el_custom, - editor_hl_custom, &num_editor_hl_custom, - editor_el_custom, &num_editor_el_custom - }, - { - &setup.editor.el_custom_more, - editor_hl_custom_more, &num_editor_hl_custom_more, - editor_el_custom_more, &num_editor_el_custom_more - }, - { - NULL, - NULL, NULL, - NULL, NULL - } + { &setup.editor.el_boulderdash, editor_el_boulderdash, + &num_editor_el_boulderdash }, + { &setup.editor.el_emerald_mine, editor_el_emerald_mine, + &num_editor_el_emerald_mine }, + { &setup.editor.el_more, editor_el_more, + &num_editor_el_more }, + { &setup.editor.el_sokoban, editor_el_sokoban, + &num_editor_el_sokoban }, + { &setup.editor.el_supaplex, editor_el_supaplex, + &num_editor_el_supaplex }, + { &setup.editor.el_diamond_caves, editor_el_diamond_caves, + &num_editor_el_diamond_caves }, + { &setup.editor.el_dx_boulderdash, editor_el_dx_boulderdash, + &num_editor_el_dx_boulderdash }, + { &setup.editor.el_chars, editor_el_chars, + &num_editor_el_chars }, + { &setup.editor.el_custom, editor_el_custom, + &num_editor_el_custom }, + { &setup.editor.el_custom_more, editor_el_custom_more, + &num_editor_el_custom_more }, + { NULL, NULL, + NULL } }; @@ -2901,15 +2823,8 @@ static void ReinitializeElementList() /* determine size of element list */ for (i=0; editor_elements_info[i].setup_value != NULL; i++) - { if (*editor_elements_info[i].setup_value) - { - if (setup.editor.el_headlines) - num_editor_elements += *editor_elements_info[i].headline_list_size; - num_editor_elements += *editor_elements_info[i].element_list_size; - } - } if (num_editor_elements < ED_NUM_ELEMENTLIST_BUTTONS) { @@ -2924,17 +2839,9 @@ static void ReinitializeElementList() /* fill element list */ for (i=0; editor_elements_info[i].setup_value != NULL; i++) - { if (*editor_elements_info[i].setup_value) - { - if (setup.editor.el_headlines) - for (j=0; j < *editor_elements_info[i].headline_list_size; j++) - editor_elements[pos++] = editor_elements_info[i].headline_list[j]; - - for (j=0; j < *editor_elements_info[i].element_list_size; j++) + for (j=0; j<*editor_elements_info[i].element_list_size; j++) editor_elements[pos++] = editor_elements_info[i].element_list[j]; - } - } /* correct position of element list scrollbar */ if (element_shift < 0) @@ -2945,20 +2852,14 @@ static void ReinitializeElementList() static void ReinitializeElementListButtons() { - static boolean last_setup_value_headlines = FALSE; static boolean initialization_needed = TRUE; int i; if (!initialization_needed) /* check if editor element setup has changed */ - { - if (last_setup_value_headlines != setup.editor.el_headlines) - initialization_needed = TRUE; - for (i=0; editor_elements_info[i].setup_value != NULL; i++) if (editor_elements_info[i].last_setup_value != *editor_elements_info[i].setup_value) initialization_needed = TRUE; - } if (!initialization_needed) return; @@ -2967,7 +2868,6 @@ static void ReinitializeElementListButtons() CreateLevelEditorGadgets(); /* store current setup values for next invocation of this function */ - last_setup_value_headlines = setup.editor.el_headlines; for (i=0; editor_elements_info[i].setup_value != NULL; i++) editor_elements_info[i].last_setup_value = *editor_elements_info[i].setup_value; diff --git a/src/files.c b/src/files.c index 4ef0174a..db3a432d 100644 --- a/src/files.c +++ b/src/files.c @@ -719,170 +719,6 @@ void LoadLevelFromFilename(struct LevelInfo *level, char *filename) fclose(file); } -#if 1 - -static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) -{ - if (leveldir_current == NULL) /* only when dumping level */ - return; - - /* determine correct game engine version of current level */ - if (IS_LEVELCLASS_CONTRIBUTION(leveldir_current) || - IS_LEVELCLASS_USER(leveldir_current)) - { -#if 0 - printf("\n::: This level is private or contributed: '%s'\n", filename); -#endif - - /* For user contributed and private levels, use the version of - the game engine the levels were created for. - Since 2.0.1, the game engine version is now directly stored - in the level file (chunk "VERS"), so there is no need anymore - to set the game version from the file version (except for old, - pre-2.0 levels, where the game version is still taken from the - file format version used to store the level -- see above). */ - - /* do some special adjustments to support older level versions */ - if (level->file_version == FILE_VERSION_1_0) - { - Error(ERR_WARN, "level file '%s'has version number 1.0", filename); - Error(ERR_WARN, "using high speed movement for player"); - - /* player was faster than monsters in (pre-)1.0 levels */ - level->double_speed = TRUE; - } - - /* Default behaviour for EM style gems was "slippery" only in 2.0.1 */ - if (level->game_version == VERSION_IDENT(2,0,1)) - level->em_slippery_gems = TRUE; - } - else - { -#if 0 - printf("\n::: ALWAYS USE LATEST ENGINE FOR THIS LEVEL: [%d] '%s'\n", - leveldir_current->sort_priority, filename); -#endif - - /* Always use the latest version of the game engine for all but - user contributed and private levels; this allows for actual - corrections in the game engine to take effect for existing, - converted levels (from "classic" or other existing games) to - make the game emulation more accurate, while (hopefully) not - breaking existing levels created from other players. */ - - level->game_version = GAME_VERSION_ACTUAL; - - /* Set special EM style gems behaviour: EM style gems slip down from - normal, steel and growing wall. As this is a more fundamental change, - it seems better to set the default behaviour to "off" (as it is more - natural) and make it configurable in the level editor (as a property - of gem style elements). Already existing converted levels (neither - private nor contributed levels) are changed to the new behaviour. */ - - if (level->file_version < FILE_VERSION_2_0) - level->em_slippery_gems = TRUE; - } -} - -static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) -{ - int i, j; - - /* map custom element change events that have changed in newer versions - (these following values have accidentally changed in version 3.0.1) */ - if (level->game_version <= VERSION_IDENT(3,0,0)) - { - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) - { - int element = EL_CUSTOM_START + i; - - /* order of checking events to be mapped is important */ - for (j=CE_BY_OTHER; j >= CE_BY_PLAYER; j--) - { - if (HAS_CHANGE_EVENT(element, j - 2)) - { - SET_CHANGE_EVENT(element, j - 2, FALSE); - SET_CHANGE_EVENT(element, j, TRUE); - } - } - - /* order of checking events to be mapped is important */ - for (j=CE_OTHER_GETS_COLLECTED; j >= CE_COLLISION; j--) - { - if (HAS_CHANGE_EVENT(element, j - 1)) - { - SET_CHANGE_EVENT(element, j - 1, FALSE); - SET_CHANGE_EVENT(element, j, TRUE); - } - } - } - } - - /* initialize "can_change" field for old levels with only one change page */ - if (level->game_version <= VERSION_IDENT(3,0,2)) - { - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) - { - int element = EL_CUSTOM_START + i; - - if (CAN_CHANGE(element)) - element_info[element].change->can_change = TRUE; - } - } - - /* initialize element properties for level editor etc. */ - InitElementPropertiesEngine(level->game_version); -} - -static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename) -{ - int x, y; - - /* map elements that have changed in newer versions */ - for(y=0; yfieldy; y++) - { - for(x=0; xfieldx; x++) - { - int element = level->field[x][y]; - - if (level->game_version <= VERSION_IDENT(2,2,0)) - { - /* map game font elements */ - element = (element == EL_CHAR('[') ? EL_CHAR_AUMLAUT : - element == EL_CHAR('\\') ? EL_CHAR_OUMLAUT : - element == EL_CHAR(']') ? EL_CHAR_UUMLAUT : - element == EL_CHAR('^') ? EL_CHAR_COPYRIGHT : element); - } - - if (level->game_version < VERSION_IDENT(3,0,0)) - { - /* map Supaplex gravity tube elements */ - element = (element == EL_SP_GRAVITY_PORT_LEFT ? EL_SP_PORT_LEFT : - element == EL_SP_GRAVITY_PORT_RIGHT ? EL_SP_PORT_RIGHT : - element == EL_SP_GRAVITY_PORT_UP ? EL_SP_PORT_UP : - element == EL_SP_GRAVITY_PORT_DOWN ? EL_SP_PORT_DOWN : - element); - } - - level->field[x][y] = element; - } - } - - /* copy elements to runtime playfield array */ - for(x=0; xfield[x][y]; - - /* initialize level size variables for faster access */ - lev_fieldx = level->fieldx; - lev_fieldy = level->fieldy; - - /* determine border element for this level */ - SetBorderElement(); -} - -#else - static void LoadLevel_InitLevel(struct LevelInfo *level, char *filename) { int i, j, x, y; @@ -1035,17 +871,12 @@ static void LoadLevel_InitLevel(struct LevelInfo *level, char *filename) InitElementPropertiesEngine(level->game_version); } -#endif - void LoadLevelTemplate(int level_nr) { char *filename = getLevelFilename(level_nr); LoadLevelFromFilename(&level_template, filename); - LoadLevel_InitVersion(&level, filename); - LoadLevel_InitElements(&level, filename); - ActivateLevelTemplate(); } @@ -1058,13 +889,7 @@ void LoadLevel(int level_nr) if (level.use_custom_template) LoadLevelTemplate(-1); -#if 1 - LoadLevel_InitVersion(&level, filename); - LoadLevel_InitElements(&level, filename); - LoadLevel_InitPlayfield(&level, filename); -#else LoadLevel_InitLevel(&level, filename); -#endif } static void SaveLevel_VERS(FILE *file, struct LevelInfo *level) @@ -2065,9 +1890,8 @@ void SaveScore(int level_nr) #define SETUP_TOKEN_EDITOR_EL_DX_BOULDERDASH 6 #define SETUP_TOKEN_EDITOR_EL_CHARS 7 #define SETUP_TOKEN_EDITOR_EL_CUSTOM 8 -#define SETUP_TOKEN_EDITOR_EL_HEADLINES 9 -#define NUM_EDITOR_SETUP_TOKENS 10 +#define NUM_EDITOR_SETUP_TOKENS 9 /* shortcut setup */ #define SETUP_TOKEN_SHORTCUT_SAVE_GAME 0 @@ -2153,7 +1977,6 @@ static struct TokenInfo editor_setup_tokens[] = { TYPE_SWITCH, &sei.el_chars, "editor.el_chars" }, { TYPE_SWITCH, &sei.el_custom, "editor.el_custom" }, { TYPE_SWITCH, &sei.el_custom_more, "editor.el_custom_more" }, - { TYPE_SWITCH, &sei.el_headlines, "editor.el_headlines" }, }; static struct TokenInfo shortcut_setup_tokens[] = @@ -2251,8 +2074,6 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->editor.el_custom = TRUE; si->editor.el_custom_more = FALSE; - si->editor.el_headlines = TRUE; - si->shortcut.save_game = DEFAULT_KEY_SAVE_GAME; si->shortcut.load_game = DEFAULT_KEY_LOAD_GAME; si->shortcut.toggle_pause = DEFAULT_KEY_TOGGLE_PAUSE; diff --git a/src/game.c b/src/game.c index 91c8841a..0f2aff31 100644 --- a/src/game.c +++ b/src/game.c @@ -1989,75 +1989,6 @@ void CheckDynamite(int x, int y) Bang(x, y); } -void ShowEnvelope() -{ - int i, x, y; - - /* open envelope window horizontally */ - for (i=2; i <= level.envelope_xsize + 2; i += 2) - { - int startx = (SXSIZE / MINI_TILEX - i) / 2; - int starty = (SYSIZE / MINI_TILEY) / 2 - 1; - - SetDrawtoField(DRAW_BUFFERED); - - BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); - - SetDrawtoField(DRAW_BACKBUFFER); - - for (y=0; y < 2; y++) for (x=0; x < i; x++) - { - int ex = (x == 0 ? -1 : x == i - 1 ? +1 : 0); - int ey = (y == 0 ? -1 : y == 1 ? +1 : 0); - - DrawEnvelopeBorder(startx + x, starty + y, ex, ey); - } - - redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; - BackToFront(); - - Delay(GAME_FRAME_DELAY); - } - - /* open envelope window vertically */ - for (i=2; i <= level.envelope_ysize + 2; i += 2) - { - int xsize = level.envelope_xsize + 2; - int startx = (SXSIZE / MINI_TILEX - (xsize - 1)) / 2; - int starty = (SYSIZE / MINI_TILEY - i) / 2; - - SetDrawtoField(DRAW_BUFFERED); - - BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); - - SetDrawtoField(DRAW_BACKBUFFER); - - for (y=0; y < i; y++) for (x=0; x < xsize; x++) - { - int ex = (x == 0 ? -1 : x == xsize - 1 ? +1 : 0); - int ey = (y == 0 ? -1 : y == i - 1 ? +1 : 0); - - DrawEnvelopeBorder(startx + x, starty + y, ex, ey); - } - - DrawTextToTextArea(SX + (startx + 1) * MINI_TILEX, - SY + (starty + 1) * MINI_TILEY, level.envelope, - FONT_TEXT_1, level.envelope_xsize, i - 2); - - redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; - BackToFront(); - - Delay(GAME_FRAME_DELAY); - } - - Delay(3000); - - SetDrawtoField(DRAW_BUFFERED); - - redraw_mask |= REDRAW_FIELD; - BackToFront(); -} - void RelocatePlayer(int x, int y, int element) { struct PlayerInfo *player = &stored_player[element - EL_PLAYER_1]; @@ -6790,7 +6721,7 @@ void TestIfElementTouchesCustomElement(int x, int y) /* check for change of center element (but change it only once) */ if (IS_CUSTOM_ELEMENT(center_element) && - HAS_ANY_CHANGE_EVENT(center_element, CE_OTHER_IS_TOUCHING) && + element_info[center_element].change_events & CE_OTHER_IS_TOUCHING && !change_center_element) { for (j=0; j < element_info[center_element].num_change_pages; j++) @@ -6798,7 +6729,7 @@ void TestIfElementTouchesCustomElement(int x, int y) struct ElementChangeInfo *change = &element_info[center_element].change_page[j]; - if (change->events & CH_EVENT_BIT(CE_OTHER_IS_TOUCHING) && + if (change->events & CE_OTHER_IS_TOUCHING && change->trigger_element == border_element) { change_center_element = TRUE; @@ -6811,14 +6742,14 @@ void TestIfElementTouchesCustomElement(int x, int y) /* check for change of border element */ if (IS_CUSTOM_ELEMENT(border_element) && - HAS_ANY_CHANGE_EVENT(border_element, CE_OTHER_IS_TOUCHING)) + element_info[border_element].change_events & CE_OTHER_IS_TOUCHING) { for (j=0; j < element_info[border_element].num_change_pages; j++) { struct ElementChangeInfo *change = &element_info[border_element].change_page[j]; - if (change->events & CH_EVENT_BIT(CE_OTHER_IS_TOUCHING) && + if (change->events & CE_OTHER_IS_TOUCHING && change->trigger_element == center_element) { CheckElementChangeExt(xx,yy, border_element,CE_OTHER_IS_TOUCHING, j); @@ -7580,10 +7511,6 @@ int DigField(struct PlayerInfo *player, el2edimg(EL_KEY_1 + key_nr)); redraw_mask |= REDRAW_DOOR_1; } - else if (element == EL_ENVELOPE) - { - ShowEnvelope(); - } else if (IS_DROPPABLE(element)) /* can be collected and dropped */ { int i; diff --git a/src/init.c b/src/init.c index 86b4ecae..05619cc4 100644 --- a/src/init.c +++ b/src/init.c @@ -554,22 +554,24 @@ void InitElementGraphicInfo() { for (act=0; act 0 && graphic_info[graphic].bitmap == NULL) element_info[i].graphic[act] = -1; - if (graphic_info[element_info[i].crumbled[act]].bitmap == NULL) + graphic = element_info[i].crumbled[act]; + if (graphic > 0 && graphic_info[graphic].bitmap == NULL) element_info[i].crumbled[act] = -1; for (dir=0; dir 0 && graphic_info[graphic].bitmap == NULL) element_info[i].direction_graphic[act][dir] = -1; graphic = element_info[i].direction_crumbled[act][dir]; - if (graphic_info[graphic].bitmap == NULL) + if (graphic > 0 && graphic_info[graphic].bitmap == NULL) element_info[i].direction_crumbled[act][dir] = -1; } } @@ -892,6 +894,10 @@ static void InitGraphicInfo() graphic_info = checked_calloc(num_images * sizeof(struct GraphicInfo)); +#if 0 + printf("::: graphic_info: %d entries\n", num_images); +#endif + #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND) if (clipmasks_initialized) { diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 4cd8921e..4d8abb26 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -859,8 +859,13 @@ void dumpTreeInfo(TreeInfo *node, int depth) for (i=0; i<(depth + 1) * 3; i++) printf(" "); +#if 1 + printf("filename == '%s' ['%s', '%s'] [%d])\n", + node->filename, node->fullpath, node->basepath, node->user_defined); +#else printf("filename == '%s' (%s) [%s] (%d)\n", node->filename, node->name, node->identifier, node->sort_priority); +#endif if (node->node_group != NULL) dumpTreeInfo(node->node_group, depth + 1); @@ -1619,6 +1624,45 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ldi, TreeInfo *parent) #endif } +static void freeTreeInfo(TreeInfo *ldi) +{ + if (ldi->filename) + free(ldi->filename); + if (ldi->fullpath) + free(ldi->fullpath); + if (ldi->basepath) + free(ldi->basepath); + if (ldi->identifier) + free(ldi->identifier); + + if (ldi->name) + free(ldi->name); + if (ldi->name_sorting) + free(ldi->name_sorting); + if (ldi->author) + free(ldi->author); + + if (ldi->class_desc) + free(ldi->class_desc); + + if (ldi->type == TREE_TYPE_LEVEL_DIR) + { + if (ldi->graphics_set) + free(ldi->graphics_set); + if (ldi->sounds_set) + free(ldi->sounds_set); + if (ldi->music_set) + free(ldi->music_set); + + if (ldi->graphics_path) + free(ldi->graphics_path); + if (ldi->sounds_path) + free(ldi->sounds_path); + if (ldi->music_path) + free(ldi->music_path); + } +} + void setSetupInfo(struct TokenInfo *token_info, int token_nr, char *token_value) { @@ -1710,6 +1754,18 @@ static void createParentTreeInfoNode(TreeInfo *node_parent) ti_new->node_parent = node_parent; ti_new->parent_link = TRUE; +#if 1 + setString(&ti_new->identifier, node_parent->identifier); + setString(&ti_new->name, ".. (parent directory)"); + setString(&ti_new->name_sorting, ti_new->name); + + setString(&ti_new->filename, ".."); + setString(&ti_new->fullpath, node_parent->fullpath); + + ti_new->sort_priority = node_parent->sort_priority; + + setString(&ti_new->class_desc, getLevelClassDescription(ti_new)); +#else ti_new->identifier = getStringCopy(node_parent->identifier); ti_new->name = ".. (parent directory)"; ti_new->name_sorting = getStringCopy(ti_new->name); @@ -1718,7 +1774,9 @@ static void createParentTreeInfoNode(TreeInfo *node_parent) ti_new->fullpath = getStringCopy(node_parent->fullpath); ti_new->sort_priority = node_parent->sort_priority; + ti_new->class_desc = getLevelClassDescription(ti_new); +#endif pushTreeInfo(&node_parent->node_group, ti_new); } @@ -1765,11 +1823,16 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, getHashEntry(setup_file_hash, levelinfo_tokens[i].text)); *leveldir_new = ldi; +#if 1 + if (strcmp(leveldir_new->name, ANONYMOUS_NAME) == 0) + setString(&leveldir_new->name, leveldir_new->filename); +#else if (strcmp(leveldir_new->name, ANONYMOUS_NAME) == 0) { free(leveldir_new->name); leveldir_new->name = getStringCopy(leveldir_new->filename); } +#endif DrawInitText(leveldir_new->name, 150, FC_YELLOW); @@ -1781,12 +1844,12 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, if (node_parent == NULL) /* top level group */ { - leveldir_new->basepath = level_directory; - leveldir_new->fullpath = leveldir_new->filename; + leveldir_new->basepath = getStringCopy(level_directory); + leveldir_new->fullpath = getStringCopy(leveldir_new->filename); } else /* sub level group */ { - leveldir_new->basepath = node_parent->basepath; + leveldir_new->basepath = getStringCopy(node_parent->basepath); leveldir_new->fullpath = getPath2(node_parent->fullpath, directory_name); } @@ -1796,11 +1859,20 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, leveldir_new->last_level = leveldir_new->first_level + leveldir_new->levels - 1; +#if 1 + leveldir_new->user_defined = + (strcmp(leveldir_new->basepath, options.level_directory) != 0); +#else leveldir_new->user_defined = (leveldir_new->basepath == options.level_directory ? FALSE : TRUE); +#endif leveldir_new->color = LEVELCOLOR(leveldir_new); +#if 1 + setString(&leveldir_new->class_desc, getLevelClassDescription(leveldir_new)); +#else leveldir_new->class_desc = getLevelClassDescription(leveldir_new); +#endif leveldir_new->handicap_level = /* set handicap to default value */ (leveldir_new->user_defined ? @@ -1981,11 +2053,16 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first, getHashEntry(setup_file_hash, levelinfo_tokens[i].text)); *artwork_new = ldi; +#if 1 + if (strcmp(artwork_new->name, ANONYMOUS_NAME) == 0) + setString(&artwork_new->name, artwork_new->filename); +#else if (strcmp(artwork_new->name, ANONYMOUS_NAME) == 0) { free(artwork_new->name); artwork_new->name = getStringCopy(artwork_new->filename); } +#endif #if 0 DrawInitText(artwork_new->name, 150, FC_YELLOW); @@ -2009,42 +2086,86 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first, artwork_new->fullpath = getPath2(node_parent->fullpath, directory_name); } +#if 1 + artwork_new->user_defined = + (strcmp(artwork_new->basepath, OPTIONS_ARTWORK_DIRECTORY(type)) != 0); +#else artwork_new->user_defined = (artwork_new->basepath == OPTIONS_ARTWORK_DIRECTORY(type) ? FALSE : TRUE); +#endif /* (may use ".sort_priority" from "setup_file_hash" above) */ artwork_new->color = ARTWORKCOLOR(artwork_new); +#if 1 + setString(&artwork_new->class_desc, getLevelClassDescription(artwork_new)); +#else artwork_new->class_desc = getLevelClassDescription(artwork_new); +#endif if (setup_file_hash == NULL) /* (after determining ".user_defined") */ { +#if 0 if (artwork_new->name != NULL) + { free(artwork_new->name); + artwork_new->name = NULL; + } +#endif + +#if 0 + if (artwork_new->identifier != NULL) + { + free(artwork_new->identifier); + artwork_new->identifier = NULL; + } +#endif if (strcmp(artwork_new->filename, ".") == 0) { if (artwork_new->user_defined) { +#if 1 + setString(&artwork_new->identifier, "private"); +#else artwork_new->identifier = getStringCopy("private"); +#endif artwork_new->sort_priority = ARTWORKCLASS_USER; } else { +#if 1 + setString(&artwork_new->identifier, "classic"); +#else artwork_new->identifier = getStringCopy("classic"); +#endif artwork_new->sort_priority = ARTWORKCLASS_CLASSICS; } /* set to new values after changing ".sort_priority" */ artwork_new->color = ARTWORKCOLOR(artwork_new); +#if 1 + setString(&artwork_new->class_desc, + getLevelClassDescription(artwork_new)); +#else artwork_new->class_desc = getLevelClassDescription(artwork_new); +#endif } else { +#if 1 + setString(&artwork_new->identifier, artwork_new->filename); +#else artwork_new->identifier = getStringCopy(artwork_new->filename); +#endif } +#if 1 + setString(&artwork_new->name, artwork_new->identifier); + setString(&artwork_new->name_sorting, artwork_new->name); +#else artwork_new->name = getStringCopy(artwork_new->identifier); artwork_new->name_sorting = getStringCopy(artwork_new->name); +#endif } DrawInitText(artwork_new->name, 150, FC_YELLOW); @@ -2122,6 +2243,15 @@ static TreeInfo *getDummyArtworkInfo(int type) setTreeInfoToDefaults(artwork_new, type); +#if 1 + setString(&artwork_new->filename, UNDEFINED_FILENAME); + setString(&artwork_new->fullpath, UNDEFINED_FILENAME); + setString(&artwork_new->basepath, UNDEFINED_FILENAME); + + setString(&artwork_new->identifier, UNDEFINED_FILENAME); + setString(&artwork_new->name, UNDEFINED_FILENAME); + setString(&artwork_new->name_sorting, UNDEFINED_FILENAME); +#else artwork_new->filename = getStringCopy(UNDEFINED_FILENAME); artwork_new->fullpath = getStringCopy(UNDEFINED_FILENAME); artwork_new->basepath = getStringCopy(UNDEFINED_FILENAME); @@ -2132,6 +2262,7 @@ static TreeInfo *getDummyArtworkInfo(int type) artwork_new->identifier = getStringCopy(UNDEFINED_FILENAME); artwork_new->name = getStringCopy(UNDEFINED_FILENAME); artwork_new->name_sorting = getStringCopy(UNDEFINED_FILENAME); +#endif return artwork_new; } @@ -2316,6 +2447,7 @@ void LoadLevelArtworkInfo() static void SaveUserLevelInfo() { + LevelDirTree *level_info; char *filename; FILE *file; int i; @@ -2329,20 +2461,21 @@ static void SaveUserLevelInfo() return; } + level_info = newTreeInfo(); + /* always start with reliable default values */ - setTreeInfoToDefaults(&ldi, TREE_TYPE_LEVEL_DIR); + setTreeInfoToDefaults(level_info, TREE_TYPE_LEVEL_DIR); -#if 0 - /* !!! FIX ME !!! */ - setString(&ldi.name, getLoginName()); - setString(&ldi.author, getRealName()); - ldi.levels = 100; - ldi.first_level = 1; - ldi.sort_priority = LEVELCLASS_USER_START; - ldi.readonly = FALSE; - setString(&ldi.graphics_set, GFX_CLASSIC_SUBDIR); - setString(&ldi.sounds_set, SND_CLASSIC_SUBDIR); - setString(&ldi.music_set, MUS_CLASSIC_SUBDIR); +#if 1 + setString(&level_info->name, getLoginName()); + setString(&level_info->author, getRealName()); + level_info->levels = 100; + level_info->first_level = 1; + level_info->sort_priority = LEVELCLASS_USER_START; + level_info->readonly = FALSE; + setString(&level_info->graphics_set, GFX_CLASSIC_SUBDIR); + setString(&level_info->sounds_set, SND_CLASSIC_SUBDIR); + setString(&level_info->music_set, MUS_CLASSIC_SUBDIR); #else ldi.name = getStringCopy(getLoginName()); ldi.author = getStringCopy(getRealName()); @@ -2358,6 +2491,7 @@ static void SaveUserLevelInfo() fprintf(file, "%s\n\n", getFormattedSetupEntry(TOKEN_STR_FILE_IDENTIFIER, getCookie("LEVELINFO"))); + ldi = *level_info; for (i=0; i SOUND_MAX_RIGHT) stereo_position = SOUND_MAX_RIGHT; + memset(&snd_ctrl, 0, sizeof(SoundControl)); /* to make valgrind happy */ + snd_ctrl.active = TRUE; snd_ctrl.nr = nr; snd_ctrl.volume = volume; @@ -2092,6 +2096,8 @@ void StopSoundExt(int nr, int state) if (!audio.sound_available) return; + memset(&snd_ctrl, 0, sizeof(SoundControl)); /* to make valgrind happy */ + snd_ctrl.active = FALSE; snd_ctrl.nr = nr; snd_ctrl.state = state; diff --git a/src/libgame/system.h b/src/libgame/system.h index 73ec0f79..a9f1efa1 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -485,8 +485,6 @@ struct SetupEditorInfo boolean el_chars; boolean el_custom; boolean el_custom_more; - - boolean el_headlines; }; struct SetupShortcutInfo diff --git a/src/libgame/text.c b/src/libgame/text.c index 6b5f03e0..d7c264d8 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -330,7 +330,7 @@ void DrawTextToTextArea(int x, int y, char *text, int font_nr, int area_xsize, int area_ysize) { int area_line = 0; - int font_height = getFontHeight(font_nr); + int font_height = getFontWidth(font_nr); if (text == NULL) return; diff --git a/src/libgame/toons.c b/src/libgame/toons.c index f2684b40..048696f6 100644 --- a/src/libgame/toons.c +++ b/src/libgame/toons.c @@ -81,17 +81,18 @@ int getAnimationFrame(int num_frames, int delay, int mode, int start_frame, /* toon animation functions */ /* ========================================================================= */ -static int get_toon_direction(char *direction_raw) +static int get_toon_direction(char *direction_string_raw) { - static char *direction = NULL; + char *direction_string = getStringToLower(direction_string_raw); + int direction = (strcmp(direction_string, "left") == 0 ? MV_LEFT : + strcmp(direction_string, "right") == 0 ? MV_RIGHT : + strcmp(direction_string, "up") == 0 ? MV_UP : + strcmp(direction_string, "down") == 0 ? MV_DOWN : + MV_NO_MOVING); - /* !!! MEMORY LEAK HERE! FIX IT! !!! */ - setString(&direction, getStringToLower(direction_raw)); + free(direction_string); - return (strcmp(direction, "left") == 0 ? MV_LEFT : - strcmp(direction, "right") == 0 ? MV_RIGHT : - strcmp(direction, "up") == 0 ? MV_UP : - strcmp(direction, "down") == 0 ? MV_DOWN : MV_NO_MOVING); + return direction; } void InitToonScreen(Bitmap *save_buffer, diff --git a/src/main.c b/src/main.c index 380af747..479e0122 100644 --- a/src/main.c +++ b/src/main.c @@ -3687,7 +3687,6 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1] = { ".EDITOR", GAME_MODE_EDITOR, }, { ".INFO", GAME_MODE_INFO, }, { ".SETUP", GAME_MODE_SETUP, }, - { ".PLAYING", GAME_MODE_PLAYING, }, { ".DOOR", GAME_MODE_PSEUDO_DOOR, }, { ".PREVIEW", GAME_MODE_PSEUDO_PREVIEW, }, { ".CRUMBLED", GAME_MODE_PSEUDO_CRUMBLED, }, diff --git a/src/main.h b/src/main.h index 68ad89ca..8a0fca2c 100644 --- a/src/main.h +++ b/src/main.h @@ -895,12 +895,11 @@ #define GFX_SPECIAL_ARG_EDITOR 3 #define GFX_SPECIAL_ARG_INFO 4 #define GFX_SPECIAL_ARG_SETUP 5 -#define GFX_SPECIAL_ARG_PLAYING 6 -#define GFX_SPECIAL_ARG_DOOR 7 -#define GFX_SPECIAL_ARG_PREVIEW 8 -#define GFX_SPECIAL_ARG_CRUMBLED 9 +#define GFX_SPECIAL_ARG_DOOR 6 +#define GFX_SPECIAL_ARG_PREVIEW 7 +#define GFX_SPECIAL_ARG_CRUMBLED 8 -#define NUM_SPECIAL_GFX_ARGS 10 +#define NUM_SPECIAL_GFX_ARGS 9 /* values for image configuration suffixes */ @@ -980,12 +979,12 @@ #define GAME_MODE_EDITOR 3 #define GAME_MODE_INFO 4 #define GAME_MODE_SETUP 5 -#define GAME_MODE_PLAYING 6 -#define GAME_MODE_PSEUDO_DOOR 7 -#define GAME_MODE_PSEUDO_PREVIEW 8 -#define GAME_MODE_PSEUDO_CRUMBLED 9 +#define GAME_MODE_PSEUDO_DOOR 6 +#define GAME_MODE_PSEUDO_PREVIEW 7 +#define GAME_MODE_PSEUDO_CRUMBLED 8 /* there are no special config file suffixes for these modes */ +#define GAME_MODE_PLAYING 9 #define GAME_MODE_PSEUDO_TYPENAME 10 #define GAME_MODE_QUIT 11 diff --git a/src/screens.c b/src/screens.c index 0d3b008a..2b13ad56 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1813,8 +1813,6 @@ static struct TokenInfo setup_info_editor[] = { TYPE_SWITCH, &setup.editor.el_custom, "Custom:" }, { TYPE_SWITCH, &setup.editor.el_custom_more, "More Custom:" }, { TYPE_EMPTY, NULL, "" }, - { TYPE_SWITCH, &setup.editor.el_headlines, "Headlines:" }, - { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, { 0, NULL, NULL } }; diff --git a/src/tools.c b/src/tools.c index 28c64bdf..b986e81e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1371,12 +1371,12 @@ static int getBorderElement(int x, int y) { EL_STEELWALL, EL_INVISIBLE_STEELWALL } }; int steel_type = (BorderElement == EL_STEELWALL ? 0 : 1); - int steel_position = (x == -1 && y == -1 ? 0 : - x == lev_fieldx && y == -1 ? 1 : - x == -1 && y == lev_fieldy ? 2 : - x == lev_fieldx && y == lev_fieldy ? 3 : - x == -1 || x == lev_fieldx ? 4 : - y == -1 || y == lev_fieldy ? 5 : 6); + int steel_position = (x == -1 && y == -1 ? 0 : + x == lev_fieldx && y == -1 ? 1 : + x == -1 && y == lev_fieldy ? 2 : + x == lev_fieldx && y == lev_fieldy ? 3 : + x == -1 || x == lev_fieldx ? 4 : + y == -1 || y == lev_fieldy ? 5 : 6); return border[steel_position][steel_type]; } @@ -1525,31 +1525,6 @@ void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y) DrawMiniGraphic(sx, sy, el2edimg(getBorderElement(x, y))); } -void DrawEnvelopeBorder(int sx, int sy, int ex, int ey) -{ - int border[8][2] = - { - { EL_STEELWALL_TOPLEFT, EL_INVISIBLE_STEELWALL_TOPLEFT }, - { EL_STEELWALL_TOPRIGHT, EL_INVISIBLE_STEELWALL_TOPRIGHT }, - { EL_STEELWALL_BOTTOMLEFT, EL_INVISIBLE_STEELWALL_BOTTOMLEFT }, - { EL_STEELWALL_BOTTOMRIGHT, EL_INVISIBLE_STEELWALL_BOTTOMRIGHT }, - { EL_STEELWALL_VERTICAL, EL_INVISIBLE_STEELWALL_VERTICAL }, - { EL_STEELWALL_HORIZONTAL, EL_INVISIBLE_STEELWALL_HORIZONTAL }, - { EL_STEELWALL, EL_INVISIBLE_STEELWALL }, - { EL_EMPTY, EL_EMPTY } - }; - int steel_type = (BorderElement == EL_STEELWALL ? 0 : 1); - int steel_position = (ex == -1 && ey == -1 ? 0 : - ex == +1 && ey == -1 ? 1 : - ex == -1 && ey == +1 ? 2 : - ex == +1 && ey == +1 ? 3 : - ex == -1 || ex == +1 ? 4 : - ey == -1 || ey == +1 ? 5 : 7); - int element = border[steel_position][steel_type]; - - DrawMiniGraphic(sx, sy, el2edimg(element)); -} - void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) { Bitmap *src_bitmap = graphic_info[graphic].bitmap; @@ -1801,6 +1776,10 @@ boolean Request(char *text, unsigned int req_state) unsigned int old_door_state; int last_game_status = game_status; /* save current game status */ +#if 1 + SetMouseCursor(CURSOR_DEFAULT); +#endif + #if defined(PLATFORM_UNIX) /* pause network game while waiting for request to answer */ if (options.network && @@ -1911,7 +1890,9 @@ boolean Request(char *text, unsigned int req_state) SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1); +#if 0 SetMouseCursor(CURSOR_DEFAULT); +#endif while(result < 0) { diff --git a/src/tools.h b/src/tools.h index 05f6ed30..e7a65872 100644 --- a/src/tools.h +++ b/src/tools.h @@ -112,7 +112,6 @@ void DrawLevelField(int, int); void DrawMiniElement(int, int, int); void DrawMiniElementOrWall(int, int, int, int); -void DrawEnvelopeBorder(int, int, int, int); void getMicroGraphicSource(int, Bitmap **, int *, int *); void DrawMicroElement(int, int, int); -- 2.34.1