X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=b0d66991e22a29c6ba28a0a53e7ec26b1a6d27b2;hb=d905e6df72c773e1943694b96710a2bc25cc863e;hp=48cd370b9e97de60ce37975d78d72fe00261d7ac;hpb=18f04ed2930c70cce6231148945cc24a1c662041;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 48cd370b..b0d66991 100644 --- a/src/init.c +++ b/src/init.c @@ -1,7 +1,7 @@ /*********************************************************** * Rocks'n'Diamonds -- McDuffin Strikes Back! * *----------------------------------------------------------* -* (c) 1995-2002 Artsoft Entertainment * +* (c) 1995-2006 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * @@ -250,7 +250,7 @@ void InitFontGraphicInfo() } } - /* initialize special element/graphic mapping from dynamic configuration */ + /* initialize special font/graphic mapping from dynamic configuration */ for (i = 0; i < num_property_mappings; i++) { int font_nr = property_mapping[i].base_index - MAX_NUM_ELEMENTS; @@ -268,6 +268,54 @@ void InitFontGraphicInfo() } } + /* reset non-redefined ".active" font graphics if normal font is redefined */ + /* (this different treatment is needed because normal and active fonts are + independently defined ("active" is not a property of font definitions!) */ + for (i = 0; i < NUM_FONTS; i++) + { + int font_nr_base = i; + int font_nr_active = FONT_ACTIVE(font_nr_base); + + /* check only those fonts with exist as normal and ".active" variant */ + if (font_nr_base != font_nr_active) + { + int base_graphic = font_info[font_nr_base].graphic; + int active_graphic = font_info[font_nr_active].graphic; + boolean base_redefined = + getImageListEntryFromImageID(base_graphic)->redefined; + boolean active_redefined = + getImageListEntryFromImageID(active_graphic)->redefined; + + /* if the base font ("font.menu_1", for example) has been redefined, + but not the active font ("font.menu_1.active", for example), do not + use an existing (in this case considered obsolete) active font + anymore, but use the automatically determined default font */ + if (base_redefined && !active_redefined) + font_info[font_nr_active].graphic = base_graphic; + + /* now also check each "special" font (which may be the same as above) */ + for (j = 0; j < NUM_SPECIAL_GFX_ARGS; j++) + { + int base_graphic = font_info[font_nr_base].special_graphic[j]; + int active_graphic = font_info[font_nr_active].special_graphic[j]; + boolean base_redefined = + getImageListEntryFromImageID(base_graphic)->redefined; + boolean active_redefined = + getImageListEntryFromImageID(active_graphic)->redefined; + + /* same as above, but check special graphic definitions, for example: + redefined "font.menu_1.MAIN" invalidates "font.menu_1.active.MAIN" */ + if (base_redefined && !active_redefined) + { + font_info[font_nr_active].special_graphic[j] = + font_info[font_nr_base].special_graphic[j]; + font_info[font_nr_active].special_bitmap_id[j] = + font_info[font_nr_base].special_bitmap_id[j]; + } + } + } + } + /* ---------- initialize font bitmap array ---------- */ if (font_bitmap_info != NULL) @@ -295,7 +343,7 @@ void InitFontGraphicInfo() if (graphic_info[graphic].anim_frames < MIN_NUM_CHARS_PER_FONT) { graphic_info[graphic].anim_frames = DEFAULT_NUM_CHARS_PER_FONT; - graphic_info[graphic].anim_frames_per_line= DEFAULT_NUM_CHARS_PER_LINE; + graphic_info[graphic].anim_frames_per_line = DEFAULT_NUM_CHARS_PER_LINE; } /* copy font relevant information from graphics information */ @@ -1817,7 +1865,6 @@ boolean getBitfieldProperty(int *bitfield, int property_bit_nr, int element) return FALSE; } -#if 1 static void resolve_group_element(int group_element, int recursion_depth) { static int group_nr; @@ -1864,7 +1911,6 @@ static void resolve_group_element(int group_element, int recursion_depth) } } } -#endif void InitElementPropertiesStatic() { @@ -3712,7 +3758,6 @@ void InitElementPropertiesEngine(int engine_version) property (which means that conditional property changes must be set to a reliable default value before) */ -#if 1 /* ---------- recursively resolve group elements ------------------------- */ for (i = 0; i < MAX_NUM_ELEMENTS; i++) @@ -3721,7 +3766,6 @@ void InitElementPropertiesEngine(int engine_version) for (i = 0; i < NUM_GROUP_ELEMENTS; i++) resolve_group_element(EL_GROUP_START + i, 0); -#endif /* set all special, combined or engine dependent element properties */ for (i = 0; i < MAX_NUM_ELEMENTS; i++) @@ -3924,58 +3968,6 @@ void InitElementPropertiesEngine(int engine_version) engine_version > VERSION_IDENT(2,0,1,0))); } -#if 0 - /* set default push delay values (corrected since version 3.0.7-1) */ - if (engine_version < VERSION_IDENT(3,0,7,1)) - { - game.default_push_delay_fixed = 2; - game.default_push_delay_random = 8; - } - else - { - game.default_push_delay_fixed = 8; - game.default_push_delay_random = 8; - } -#endif - -#if 0 - /* set uninitialized push delay values of custom elements in older levels */ - for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) - { - int element = EL_CUSTOM_START + i; - - if (element_info[element].push_delay_fixed == -1) - element_info[element].push_delay_fixed = game.default_push_delay_fixed; - if (element_info[element].push_delay_random == -1) - element_info[element].push_delay_random = game.default_push_delay_random; - } -#endif - -#if 0 - /* set some other uninitialized values of custom elements in older levels */ - if (engine_version < VERSION_IDENT(3,1,0,0)) - { - for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) - { - int element = EL_CUSTOM_START + i; - - element_info[element].access_direction = MV_ALL_DIRECTIONS; - - element_info[element].explosion_delay = 17; - element_info[element].ignition_delay = 8; - } - } -#endif - -#if 0 - /* set element properties that were handled incorrectly in older levels */ - if (engine_version < VERSION_IDENT(3,1,0,0)) - { - SET_PROPERTY(EL_SP_SNIKSNAK, EP_DONT_COLLIDE_WITH, FALSE); - SET_PROPERTY(EL_SP_ELECTRON, EP_DONT_COLLIDE_WITH, FALSE); - } -#endif - /* this is needed because some graphics depend on element properties */ if (game_status == GAME_MODE_PLAYING) InitElementGraphicInfo(); @@ -3985,34 +3977,6 @@ void InitElementPropertiesAfterLoading(int engine_version) { int i; -#if 0 - /* set default push delay values (corrected since version 3.0.7-1) */ - if (engine_version < VERSION_IDENT(3,0,7,1)) - { - game.default_push_delay_fixed = 2; - game.default_push_delay_random = 8; - } - else - { - game.default_push_delay_fixed = 8; - game.default_push_delay_random = 8; - } -#endif - -#if 0 - /* set uninitialized push delay values of custom elements in older levels */ - for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) - { - int element = EL_CUSTOM_START + i; - - if (element_info[element].push_delay_fixed == -1) - element_info[element].push_delay_fixed = game.default_push_delay_fixed; - if (element_info[element].push_delay_random == -1) - element_info[element].push_delay_random = game.default_push_delay_random; - } -#endif - -#if 1 /* set some other uninitialized values of custom elements in older levels */ if (engine_version < VERSION_IDENT(3,1,0,0)) { @@ -4026,7 +3990,6 @@ void InitElementPropertiesAfterLoading(int engine_version) element_info[element].ignition_delay = 8; } } -#endif } static void InitGlobal() @@ -4496,8 +4459,9 @@ void InitGfx() Error(ERR_EXIT, "cannot get filename for '%s'", CONFIG_TOKEN_FONT_INITIAL); /* create additional image buffers for double-buffering and cross-fading */ - bitmap_db_title = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); + bitmap_db_cross = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH); + bitmap_db_panel = CreateBitmap(DXSIZE, DYSIZE, DEFAULT_DEPTH); bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH); /* initialize screen properties */ @@ -4798,11 +4762,7 @@ void ReloadCustomArtwork(int force_reload) if (redraw_screen) { -#if 1 RedrawBackground(); -#else - InitGfxBackground(); -#endif /* force redraw of (open or closed) door graphics */ SetDoorState(DOOR_OPEN_ALL); @@ -4850,7 +4810,7 @@ void OpenAll() InitCounter(); InitRND(NEW_RANDOMIZE); - InitSimpleRND(NEW_RANDOMIZE); + InitSimpleRandom(NEW_RANDOMIZE); InitJoysticks(); @@ -4874,6 +4834,10 @@ void OpenAll() InitGfxBackground(); +#if 1 + em_open_all(); +#endif + if (global.autoplay_leveldir) { AutoPlayTape(); @@ -4887,10 +4851,6 @@ void OpenAll() game_status = GAME_MODE_MAIN; -#if 1 - em_open_all(); -#endif - DrawMainMenu(); InitNetworkServer();