X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=6c54ab4ba23e6395914f71aea4c1393229f685e8;hb=a750ba6776fdfb711f5da2e6094c8010cd19645a;hp=b10b8ec9fa1aff18f4b6caaa28dd2e2380c65fd8;hpb=b1aea9dea523d02f9539d7d85761861092ad4a83;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index b10b8ec9..6c54ab4b 100644 --- a/src/init.c +++ b/src/init.c @@ -26,8 +26,20 @@ #include "cartoons.h" #include "config.h" +#include "conf_e2g.c" /* include auto-generated data structure definitions */ + + static char *image_filename[NUM_PICTURES] = { +#if 0 + "RocksScreen.pcx", + "RocksDoor.pcx", + "RocksToons.pcx", + "RocksFontBig.pcx", + "RocksFontSmall.pcx", + "RocksFontMedium.pcx", + "RocksFontEM.pcx" +#else "RocksScreen.pcx", "RocksElements.pcx", "RocksDoor.pcx", @@ -40,6 +52,7 @@ static char *image_filename[NUM_PICTURES] = "RocksFontSmall.pcx", "RocksFontMedium.pcx", "RocksFontEM.pcx" +#endif }; static void InitSetup(void); @@ -106,9 +119,9 @@ void OpenAll(void) InitLevelInfo(); InitLevelArtworkInfo(); - InitGadgets(); /* needs to know number of level series */ InitImages(); /* needs to know current level directory */ InitSound(); /* needs to know current level directory */ + InitGadgets(); /* needs images + number of level series */ InitGfxBackground(); InitToons(); @@ -211,6 +224,8 @@ static void InitTileClipmasks() unsigned long clip_gc_valuemask; #if defined(TARGET_X11_NATIVE) + +#if 0 GC copy_clipmask_gc; static struct @@ -264,13 +279,15 @@ static void InitTileClipmasks() { GFX2_SHIELD_ACTIVE, 3 }, { -1, 0 } }; +#endif + #endif /* TARGET_X11_NATIVE */ #endif /* TARGET_X11 */ int i; /* initialize pixmap array for special X11 tile clipping to Pixmap 'None' */ - for(i=0; idrawable, clip_gc_valuemask, &clip_gc_values); - for(i=0; iclip_mask) { @@ -298,6 +315,7 @@ static void InitTileClipmasks() #if defined(TARGET_X11_NATIVE) +#if 0 /* create graphic context structures needed for clipping */ clip_gc_values.graphics_exposures = False; clip_gc_valuemask = GCGraphicsExposures; @@ -305,11 +323,11 @@ static void InitTileClipmasks() clip_gc_valuemask, &clip_gc_values); /* create only those clipping Pixmaps we really need */ - for(i=0; tile_needs_clipping[i].start>=0; i++) + for (i=0; tile_needs_clipping[i].start>=0; i++) { int j; - for(j=0; jstored_clip_gc) { @@ -392,7 +411,7 @@ void InitGfx() DrawInitText("Loading graphics:", 120, FC_GREEN); - for(i=0; i -1) @@ -976,15 +1007,87 @@ void InitElementInfo() element_info[element].has_direction_graphic[GFX_ACTION_DEFAULT] = TRUE; i++; } +#else + + i = 0; + while (element_to_graphic[i].element > -1) + { + int element = element_to_graphic[i].element; + int direction = element_to_graphic[i].direction; + int action = element_to_graphic[i].action; + int graphic = element_to_graphic[i].graphic; + + if (action > -1) + action = graphics_action_mapping[action]; + else + action = GFX_ACTION_DEFAULT; + + if (direction > -1) + { + direction = MV_DIR_BIT(direction); + + element_info[element].direction_graphic[action][direction] = graphic; + } + else + element_info[element].graphic[action] = graphic; + + i++; + } + + /* now set all '-1' values to element specific default values */ + for (i=0; i -1) + { + int action = element_to_graphic[i].action; + int graphic = element_to_graphic[i].graphic; + + if (action == -1) + action = GFX_ACTION_DEFAULT; + + gfx_action[graphic] = action; + + i++; + } + + for (i=0; i 1) + new_graphic_info[i].anim_mode = ANIM_LOOP; else - new_graphic_info[i].anim_mode = ANIM_NORMAL; - - /* additionally, animation can be either pingpong or pingpong2 layout */ - if (parameter[GFX_ARG_PINGPONG]) - new_graphic_info[i].anim_mode |= ANIM_PINGPONG; - else if (parameter[GFX_ARG_PINGPONG2]) - new_graphic_info[i].anim_mode |= ANIM_PINGPONG2; + new_graphic_info[i].anim_mode = ANIM_NONE; + + /* set additional flag to play animation frames in reverse order */ + if (parameter[GFX_ARG_MODE_REVERSE]) + new_graphic_info[i].anim_mode |= ANIM_REVERSE; + +#if 1 + /* set first frame of animation after determining animation mode */ + new_graphic_info[i].anim_start_frame = parameter[GFX_ARG_START_FRAME]; + if (new_graphic_info[i].anim_start_frame == -1) + new_graphic_info[i].anim_start_frame = 0; + else if (new_graphic_info[i].anim_mode & ANIM_REVERSE) + new_graphic_info[i].anim_start_frame = + new_graphic_info[i].anim_frames + - new_graphic_info[i].anim_start_frame - 1; +#else + /* set first frame of animation after determining animation mode */ + new_graphic_info[i].anim_start_frame = parameter[GFX_ARG_START_FRAME]; + if (parameter[GFX_ARG_START_FRAME] == -1) /* default: start with ... */ + { + if (parameter[GFX_ARG_MODE_REVERSE]) + new_graphic_info[i].anim_start_frame = + new_graphic_info[i].anim_frames - 1; /* ... last frame */ + else + new_graphic_info[i].anim_start_frame = 0; /* ... first frame */ + } +#endif +#if 1 /* animation synchronized with global frame counter, not move position */ new_graphic_info[i].anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC]; + if (parameter[GFX_ARG_GLOBAL_SYNC] == -1) + new_graphic_info[i].anim_global_sync = + (gfx_action[i] == GFX_ACTION_DEFAULT ? TRUE : FALSE); +#else + /* animation synchronized with global frame counter, not move position */ + new_graphic_info[i].anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC]; +#endif + + /* now check if the loaded image is large enough for the animation */ + last_frame = new_graphic_info[i].anim_frames - 1; + + getGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y); + if (src_x + TILEX > src_bitmap->width || + src_y + TILEY > src_bitmap->height) + Error(ERR_EXIT, "InitGraphicInfo: image bitmap '%s' too small for graphic object %d (normal size)", src_bitmap->source_filename, i); + + getMiniGraphicSource(i, &src_bitmap, &src_x, &src_y); + if (src_x + MINI_TILEX > src_bitmap->width || + src_y + MINI_TILEY > src_bitmap->height) + Error(ERR_EXIT, "InitGraphicInfo: image bitmap '%s' too small for graphic object %d ('mini' size)", src_bitmap->source_filename, i); + + getMicroGraphicSource(i, &src_bitmap, &src_x, &src_y); + if (src_x + MICRO_TILEX > src_bitmap->width || + src_y + MICRO_TILEY > src_bitmap->height) + Error(ERR_EXIT, "InitGraphicInfo: image bitmap '%s' too small for graphic object %d ('micro' size)", src_bitmap->source_filename, i); + + +#if 0 + { + int j; + + if (i == IMG_EMERALD) + { + for (j=0; j %d\n", image_config_suffix[j].token, parameter[j]); + printf("-> %d\n", new_graphic_info[i].anim_frames); + printf("\n"); + } + } +#endif - new_graphic_info[i].anim_vertical = parameter[GFX_ARG_VERTICAL]; } + #if 0 printf("D> %d\n", image_files[GFX_BD_DIAMOND].parameter[GFX_ARG_NUM_FRAMES]); printf("W> %d\n", image_files[GFX_ROBOT_WHEEL].parameter[GFX_ARG_NUM_FRAMES]); @@ -1587,7 +1788,7 @@ void InitElementProperties() EL_SP_SNIKSNAK, EL_SP_ELECTRON, EL_BALLOON, - EL_SPRING_MOVING + EL_SPRING }; static int ep_can_move_num = SIZEOF_ARRAY_INT(ep_can_move); @@ -1685,7 +1886,7 @@ void InitElementProperties() EL_EXIT_CLOSED, EL_EXIT_OPEN, EL_STEELWALL, - EL_PLAYER, + EL_PLAYER1, EL_BD_FIREFLY, EL_BD_FIREFLY_1, EL_BD_FIREFLY_2, @@ -1708,7 +1909,7 @@ void InitElementProperties() EL_SOKOBAN_OBJECT, EL_SOKOBAN_FIELD_EMPTY, EL_SOKOBAN_FIELD_FULL, - EL_PLAYER, + EL_PLAYER1, EL_INVISIBLE_STEELWALL }; static int ep_sb_element_num = SIZEOF_ARRAY_INT(ep_sb_element); @@ -1865,10 +2066,10 @@ void InitElementProperties() EL_BOMB, EL_DYNAMITE_ACTIVE, EL_DYNAMITE, - EL_DYNABOMB_ACTIVE_1, - EL_DYNABOMB_ACTIVE_2, - EL_DYNABOMB_ACTIVE_3, - EL_DYNABOMB_ACTIVE_4, + EL_DYNABOMB_PLAYER1_ACTIVE, + EL_DYNABOMB_PLAYER2_ACTIVE, + EL_DYNABOMB_PLAYER3_ACTIVE, + EL_DYNABOMB_PLAYER4_ACTIVE, EL_DYNABOMB_NR, EL_DYNABOMB_SZ, EL_DYNABOMB_XL, @@ -1921,7 +2122,6 @@ void InitElementProperties() static int ep_player[] = { - EL_PLAYER, EL_PLAYER1, EL_PLAYER2, EL_PLAYER3, @@ -2056,10 +2256,10 @@ void InitElementProperties() static int ep_active_bomb[] = { EL_DYNAMITE_ACTIVE, - EL_DYNABOMB_ACTIVE_1, - EL_DYNABOMB_ACTIVE_2, - EL_DYNABOMB_ACTIVE_3, - EL_DYNABOMB_ACTIVE_4 + EL_DYNABOMB_PLAYER1_ACTIVE, + EL_DYNABOMB_PLAYER2_ACTIVE, + EL_DYNABOMB_PLAYER3_ACTIVE, + EL_DYNABOMB_PLAYER4_ACTIVE }; static int ep_active_bomb_num = SIZEOF_ARRAY_INT(ep_active_bomb); @@ -2256,20 +2456,20 @@ void InitElementProperties() static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *); static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *); - for(i=0; i