X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=36a3e357f08699f98656ee4d9bc28eac4faa5c2a;hb=1e2c52c04364f8b724bde8ee540c56dd1062a1c9;hp=34673f372ffffac791b2c965d24ea1414262beac;hpb=3d52a86d358f5b1a4b36b80df5d659bce1f5a3a6;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 34673f37..36a3e357 100644 --- a/src/init.c +++ b/src/init.c @@ -27,6 +27,7 @@ #include "config.h" #include "conf_e2g.c" /* include auto-generated data structure definitions */ +#include "conf_esg.c" /* include auto-generated data structure definitions */ static char *image_filename[NUM_PICTURES] = @@ -57,29 +58,31 @@ static char *image_filename[NUM_PICTURES] = static Bitmap *bitmap_font_initial = NULL; -static void InitGlobal(void); -static void InitSetup(void); -static void InitPlayerInfo(void); -static void InitLevelInfo(void); -static void InitArtworkInfo(void); -static void InitLevelArtworkInfo(void); -static void InitNetworkServer(void); -static void InitArtworkConfig(void); -static void InitImages(void); -static void InitMixer(void); -static void InitSound(void); -static void InitMusic(void); -static void InitGfx(void); -static void InitGfxBackground(void); -static void InitGadgets(void); -static void InitElementProperties(void); -static void InitElementGraphicInfo(void); -static void InitElementSoundInfo(void); -static void InitGraphicInfo(void); +static void InitGlobal(); +static void InitSetup(); +static void InitPlayerInfo(); +static void InitLevelInfo(); +static void InitArtworkInfo(); +static void InitLevelArtworkInfo(); +static void InitNetworkServer(); +static void InitArtworkConfig(); +static void InitImages(); +static void InitMixer(); +static void InitSound(); +static void InitMusic(); +static void InitGfx(); +static void InitGfxBackground(); +static void InitGadgets(); +static void InitElementSmallImages(); +static void InitElementGraphicInfo(); +static void InitElementSpecialGraphicInfo(); +static void InitElementSoundInfo(); +static void InitElementProperties(); +static void InitGraphicInfo(); static void InitSoundInfo(); static void Execute_Command(char *); -void OpenAll(void) +void OpenAll() { InitGlobal(); /* initialize some global variables */ @@ -188,12 +191,10 @@ static void InitArtworkConfig() static char *sound_class_prefix[MAX_NUM_ELEMENTS + 1]; static char *action_suffix[NUM_ACTIONS + 1]; static char *direction_suffix[NUM_DIRECTIONS + 1]; + static char *special_suffix[NUM_SPECIAL_GFX_ARGS + 1]; static char *dummy[1] = { NULL }; int i; - for (i=0; iwidth / 2, - tst_bitmap->height / 2); - - BlitBitmap(tmp_bitmap, tst_bitmap, 0, 0, 256, 224, 0, 448); - - FreeBitmap(tmp_bitmap); - } - -#else -#ifdef TARGET_SDL - - { - Bitmap tmp_bitmap; - SDL_Surface *dst = SDLZoomSurface(graphic_info[IMG_SAND].bitmap->surface, - 0.5, 0.5); - tmp_bitmap.surface = dst; - - BlitBitmap(&tmp_bitmap, graphic_info[IMG_SAND].bitmap, - 0, 0, 256, 224, 0, 448); - - SDL_FreeSurface(dst); - } - -#elif defined(PLATFORM_MSDOS) - - stretch_blit((BITMAP *)(graphic_info[IMG_SAND].bitmap->drawable), - (BITMAP *)(graphic_info[IMG_SAND].bitmap->drawable), - 0, 0, 512, 448, - 0, 448, 256, 224); - -#endif -#endif } static void ReinitializeSounds() { - InitElementSoundInfo(); /* initialize element/sound config info */ - InitSoundInfo(); /* initialize sounds info from config file */ + InitElementSoundInfo(); /* element game sound mapping */ + InitSoundInfo(); /* sound properties mapping */ - InitPlaySoundLevel(); /* initialize internal game sound values */ + InitPlaySoundLevel(); /* internal game sound settings */ } static void ReinitializeMusic() @@ -749,6 +713,25 @@ void InitGadgets() gadgets_initialized = TRUE; } +void InitElementSmallImages() +{ + struct PropertyMapping *property_mapping = getImageListPropertyMapping(); + int num_property_mappings = getImageListPropertyMappingSize(); + int i; + + /* initialize normal images from static configuration */ + for (i=0; element_to_graphic[i].element > -1; i++) + CreateImageWithSmallImages(element_to_graphic[i].graphic); + + /* initialize special images from static configuration */ + for (i=0; element_to_special_graphic[i].element > -1; i++) + CreateImageWithSmallImages(element_to_special_graphic[i].graphic); + + /* initialize images from dynamic configuration */ + for (i=0; i < num_property_mappings; i++) + CreateImageWithSmallImages(property_mapping[i].artwork_index); +} + void InitElementGraphicInfo() { struct PropertyMapping *property_mapping = getImageListPropertyMapping(); @@ -775,7 +758,7 @@ void InitElementGraphicInfo() element_info[i].graphic[ACTION_DEFAULT] = IMG_CUSTOM_START + (i - EL_CUSTOM_START); - /* initialize element/graphic mapping from static configuration */ + /* initialize normal element/graphic mapping from static configuration */ for (i=0; element_to_graphic[i].element > -1; i++) { int element = element_to_graphic[i].element; @@ -792,14 +775,18 @@ void InitElementGraphicInfo() element_info[element].graphic[action] = graphic; } - /* initialize element/graphic mapping from dynamic configuration */ + /* initialize normal element/graphic mapping from dynamic configuration */ for (i=0; i < num_property_mappings; i++) { int element = property_mapping[i].base_index; int action = property_mapping[i].ext1_index; int direction = property_mapping[i].ext2_index; + int special = property_mapping[i].ext3_index; int graphic = property_mapping[i].artwork_index; + if (special != -1) + continue; + if (action < 0) action = ACTION_DEFAULT; @@ -849,6 +836,46 @@ void InitElementGraphicInfo() } } +void InitElementSpecialGraphicInfo() +{ + struct PropertyMapping *property_mapping = getImageListPropertyMapping(); + int num_property_mappings = getImageListPropertyMappingSize(); + int i; + + /* always start with reliable default values */ + for (i=0; i -1; i++) + { + int element = element_to_special_graphic[i].element; + int special = element_to_special_graphic[i].special; + int graphic = element_to_special_graphic[i].graphic; + + if (special == GFX_SPECIAL_ARG_EDITOR) + element_info[element].editor_graphic = graphic; + else if (special == GFX_SPECIAL_ARG_PREVIEW) + element_info[element].preview_graphic = graphic; + } + + /* initialize special element/graphic mapping from dynamic configuration */ + for (i=0; i < num_property_mappings; i++) + { + int element = property_mapping[i].base_index; + int special = property_mapping[i].ext3_index; + int graphic = property_mapping[i].artwork_index; + + if (special == GFX_SPECIAL_ARG_EDITOR) + element_info[element].editor_graphic = graphic; + else if (special == GFX_SPECIAL_ARG_PREVIEW) + element_info[element].preview_graphic = graphic; + } +} + static void InitElementSoundInfo() { /* soon to come */