From 29fc833ae1b5e46a429a9fa82098e8ad94f6f400 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 10 Feb 2003 02:43:59 +0100 Subject: [PATCH] rnd-20030210-1-src --- src/cartoons.c | 327 ++----------------------------------------- src/conf_gfx.c | 137 +++++++++++++++++- src/conf_gfx.h | 69 +++++---- src/conftime.h | 2 +- src/editor.c | 37 ++++- src/files.c | 7 +- src/game.c | 47 ++++++- src/init.c | 24 ++-- src/libgame/image.c | 12 +- src/libgame/image.h | 2 +- src/libgame/misc.c | 13 +- src/libgame/sound.c | 12 +- src/libgame/sound.h | 2 +- src/libgame/system.h | 7 +- src/libgame/toons.c | 49 +++++-- src/libgame/toons.h | 11 +- src/main.h | 7 +- 17 files changed, 370 insertions(+), 395 deletions(-) diff --git a/src/cartoons.c b/src/cartoons.c index eb43b98d..b9552504 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -17,318 +17,9 @@ /* values for toon definition */ -#if 0 -#define NUM_TOONS 18 -#else -#define NUM_TOONS 6 -#endif +#define MAX_NUM_TOONS 20 -#define DWARF_XSIZE 40 -#define DWARF_YSIZE 48 -#define DWARF_X 2 -#define DWARF_Y 72 -#define DWARF2_Y 186 -#define DWARF_FRAMES 8 -#define DWARF_DELAY 5 -#define DWARF_STEPSIZE 4 -#define JUMPER_XSIZE 48 -#define JUMPER_YSIZE 56 -#define JUMPER_X 2 -#define JUMPER_Y 125 -#define JUMPER_FRAMES 8 -#define JUMPER_DELAY 5 -#define JUMPER_STEPSIZE 4 -#define CLOWN_XSIZE 80 -#define CLOWN_YSIZE 110 -#define CLOWN_X 327 -#define CLOWN_Y 10 -#define CLOWN_FRAMES 1 -#define CLOWN_DELAY 5 -#define CLOWN_STEPSIZE 4 -#define BIRD_XSIZE 32 -#define BIRD_YSIZE 30 -#define BIRD1_X 2 -#define BIRD1_Y 2 -#define BIRD2_X 2 -#define BIRD2_Y 37 -#define BIRD_FRAMES 8 -#define BIRD_DELAY 2 -#define BIRD_STEPSIZE 4 - -struct ToonInfo toons[NUM_TOONS] = -{ -#if 0 - { - IMG_GLOBAL_TOONS, - DWARF_XSIZE, DWARF_YSIZE, - DWARF_X, DWARF_Y, - DWARF_FRAMES, - DWARF_DELAY, - DWARF_STEPSIZE, - ANIM_LOOP, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_GLOBAL_TOONS, - DWARF_XSIZE, DWARF_YSIZE, - DWARF_X, DWARF2_Y, - DWARF_FRAMES, - DWARF_DELAY, - DWARF_STEPSIZE, - ANIM_LOOP, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_GLOBAL_TOONS, - JUMPER_XSIZE, JUMPER_YSIZE, - JUMPER_X, JUMPER_Y, - JUMPER_FRAMES, - JUMPER_DELAY, - JUMPER_STEPSIZE, - ANIM_LOOP, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_GLOBAL_TOONS, - CLOWN_XSIZE, CLOWN_YSIZE, - CLOWN_X, CLOWN_Y, - CLOWN_FRAMES, - CLOWN_DELAY, - CLOWN_STEPSIZE, - ANIM_LOOP, - ANIMDIR_UP, - ANIMPOS_ANY - }, - { - IMG_GLOBAL_TOONS, - BIRD_XSIZE, BIRD_YSIZE, - BIRD1_X, BIRD1_Y, - BIRD_FRAMES, - BIRD_DELAY, - BIRD_STEPSIZE, - ANIM_PINGPONG, - ANIMDIR_RIGHT, - ANIMPOS_UPPER - }, - { - IMG_GLOBAL_TOONS, - BIRD_XSIZE, BIRD_YSIZE, - BIRD2_X, BIRD2_Y, - BIRD_FRAMES, - BIRD_DELAY, - BIRD_STEPSIZE, - ANIM_PINGPONG, - ANIMDIR_LEFT, - ANIMPOS_UPPER - }, -#else - { - IMG_TOON_1, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_TOON_2, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_TOON_3, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_TOON_4, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_UP, - ANIMPOS_ANY - }, - { - IMG_TOON_5, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_UPPER - }, - { - IMG_TOON_6, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_UPPER - }, -#endif - -#if 0 - { - IMG_PLAYER1_MOVING_LEFT, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_PLAYER1_MOVING_RIGHT, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_PENGUIN_MOVING_LEFT, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_PENGUIN_MOVING_RIGHT, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_MOLE_MOVING_LEFT, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_MOLE_MOVING_RIGHT, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_PIG_MOVING_LEFT, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_PIG_MOVING_RIGHT, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_DRAGON_MOVING_LEFT, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_DRAGON_MOVING_RIGHT, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_SATELLITE_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_ANY - }, - { - IMG_SATELLITE_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_ANY - }, -#endif - -}; +static struct ToonInfo toons[MAX_NUM_TOONS]; static void PrepareBackbuffer() { @@ -368,11 +59,16 @@ boolean ToonNeedsRedraw() void InitToons() { + int num_toons = MAX_NUM_TOONS; int i; - for (i=0; i 0 && global.num_toons < MAX_NUM_TOONS) + num_toons = global.num_toons; + + for (i=0; i < num_toons; i++) { - int graphic = toons[i].graphic; + int graphic = IMG_TOON_1 + i; + struct FileInfo *image = getImageListEntry(graphic); toons[i].bitmap = graphic_info[graphic].bitmap; @@ -389,11 +85,14 @@ void InitToons() toons[i].step_offset = graphic_info[graphic].step_offset; toons[i].step_delay = graphic_info[graphic].step_delay; + + toons[i].direction = image->parameter[GFX_ARG_DIRECTION]; + toons[i].position = image->parameter[GFX_ARG_POSITION]; } InitToonScreen(bitmap_db_door, BackToFront, PrepareBackbuffer, ToonNeedsRedraw, - toons, NUM_TOONS, + toons, num_toons, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, GAME_FRAME_DELAY); } diff --git a/src/conf_gfx.c b/src/conf_gfx.c index e96e5de5..830e88d2 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -43,6 +43,8 @@ struct ConfigInfo image_config_suffix[] = { ".global_sync", "false", TYPE_BOOLEAN }, { ".step_offset", "4", TYPE_INTEGER }, { ".step_delay", "1", TYPE_INTEGER }, + { ".direction", ARG_UNDEFINED, TYPE_STRING }, + { ".position", ARG_UNDEFINED, TYPE_STRING }, { ".name", ARG_UNDEFINED, TYPE_STRING }, { NULL, NULL, 0 } @@ -2693,10 +2695,6 @@ struct ConfigInfo image_config[] = /* images not associated to game elements (used for menu screens etc.) */ /* keyword to stop parser: "NO_MORE_ELEMENT_IMAGES" <-- do not change! */ - { "global.border", "RocksScreen.pcx" }, - { "global.door", "RocksDoor.pcx" }, - { "global.toons", "RocksToons.pcx" }, - { "toon_1", "RocksToons.pcx" }, { "toon_1.x", "2" }, { "toon_1.y", "72" }, @@ -2706,6 +2704,8 @@ struct ConfigInfo image_config[] = { "toon_1.delay", "1" }, { "toon_1.step_offset", "4" }, { "toon_1.step_delay", "5" }, + { "toon_1.direction", "right" }, + { "toon_1.position", "bottom" }, { "toon_2", "RocksToons.pcx" }, { "toon_2.x", "2" }, @@ -2716,6 +2716,8 @@ struct ConfigInfo image_config[] = { "toon_2.delay", "1" }, { "toon_2.step_offset", "4" }, { "toon_2.step_delay", "5" }, + { "toon_2.direction", "left" }, + { "toon_2.position", "bottom" }, { "toon_3", "RocksToons.pcx" }, { "toon_3.x", "2" }, @@ -2726,6 +2728,8 @@ struct ConfigInfo image_config[] = { "toon_3.delay", "1" }, { "toon_3.step_offset", "4" }, { "toon_3.step_delay", "5" }, + { "toon_3.direction", "right" }, + { "toon_3.position", "bottom" }, { "toon_4", "RocksToons.pcx" }, { "toon_4.x", "327" }, @@ -2736,6 +2740,8 @@ struct ConfigInfo image_config[] = { "toon_4.delay", "1" }, { "toon_4.step_offset", "1" }, { "toon_4.step_delay", "1" }, + { "toon_4.direction", "up" }, + { "toon_4.position", "any" }, { "toon_5", "RocksToons.pcx" }, { "toon_5.x", "2" }, @@ -2747,6 +2753,8 @@ struct ConfigInfo image_config[] = { "toon_5.mode_pingpong2", "true" }, { "toon_5.step_offset", "2" }, { "toon_5.step_delay", "1" }, + { "toon_5.direction", "right" }, + { "toon_5.position", "upper" }, { "toon_6", "RocksToons.pcx" }, { "toon_6.x", "2" }, @@ -2758,6 +2766,127 @@ struct ConfigInfo image_config[] = { "toon_6.mode_pingpong2", "true" }, { "toon_6.step_offset", "2" }, { "toon_6.step_delay", "1" }, + { "toon_6.direction", "left" }, + { "toon_6.position", "upper" }, + + { "toon_7", "RocksHeroes.pcx" }, + { "toon_7.xpos", "0" }, + { "toon_7.ypos", "1" }, + { "toon_7.frames", "4" }, + { "toon_7.delay", "4" }, + { "toon_7.direction", "left" }, + { "toon_7.position", "bottom" }, + + { "toon_8", "RocksHeroes.pcx" }, + { "toon_8.xpos", "4" }, + { "toon_8.ypos", "1" }, + { "toon_8.frames", "4" }, + { "toon_8.delay", "4" }, + { "toon_8.direction", "right" }, + { "toon_8.position", "bottom" }, + + { "toon_9", "RocksHeroes.pcx" }, + { "toon_9.xpos", "8" }, + { "toon_9.ypos", "7" }, + { "toon_9.frames", "4" }, + { "toon_9.delay", "2" }, + { "toon_9.direction", "left" }, + { "toon_9.position", "bottom" }, + + { "toon_10", "RocksHeroes.pcx" }, + { "toon_10.xpos", "12" }, + { "toon_10.ypos", "7" }, + { "toon_10.frames", "4" }, + { "toon_10.delay", "2" }, + { "toon_10.direction", "right" }, + { "toon_10.position", "bottom" }, + + { "toon_11", "RocksHeroes.pcx" }, + { "toon_11.xpos", "8" }, + { "toon_11.ypos", "5" }, + { "toon_11.frames", "4" }, + { "toon_11.delay", "2" }, + { "toon_11.direction", "left" }, + { "toon_11.position", "bottom" }, + + { "toon_12", "RocksHeroes.pcx" }, + { "toon_12.xpos", "12" }, + { "toon_12.ypos", "5" }, + { "toon_12.frames", "4" }, + { "toon_12.delay", "2" }, + { "toon_12.direction", "right" }, + { "toon_12.position", "bottom" }, + + { "toon_13", "RocksHeroes.pcx" }, + { "toon_13.xpos", "8" }, + { "toon_13.ypos", "1" }, + { "toon_13.frames", "4" }, + { "toon_13.delay", "2" }, + { "toon_13.direction", "left" }, + { "toon_13.position", "bottom" }, + + { "toon_14", "RocksHeroes.pcx" }, + { "toon_14.xpos", "12" }, + { "toon_14.ypos", "1" }, + { "toon_14.frames", "4" }, + { "toon_14.delay", "2" }, + { "toon_14.direction", "right" }, + { "toon_14.position", "bottom" }, + + { "toon_15", "RocksHeroes.pcx" }, + { "toon_15.xpos", "8" }, + { "toon_15.ypos", "3" }, + { "toon_15.frames", "4" }, + { "toon_15.delay", "2" }, + { "toon_15.direction", "left" }, + { "toon_15.position", "bottom" }, + + { "toon_16", "RocksHeroes.pcx" }, + { "toon_16.xpos", "12" }, + { "toon_16.ypos", "3" }, + { "toon_16.frames", "4" }, + { "toon_16.delay", "2" }, + { "toon_16.direction", "right" }, + { "toon_16.position", "bottom" }, + + { "toon_17", "RocksHeroes.pcx" }, + { "toon_17.xpos", "8" }, + { "toon_17.ypos", "9" }, + { "toon_17.frames", "8" }, + { "toon_17.delay", "2" }, + { "toon_17.direction", "left" }, + { "toon_17.position", "any" }, + + { "toon_18", "RocksHeroes.pcx" }, + { "toon_18.xpos", "8" }, + { "toon_18.ypos", "9" }, + { "toon_18.frames", "8" }, + { "toon_18.delay", "2" }, + { "toon_18.direction", "right" }, + { "toon_18.position", "any" }, + + { "toon_19", "RocksElements.pcx" }, + { "toon_19.xpos", "8" }, + { "toon_19.ypos", "0" }, + { "toon_19.frames", "2" }, + { "toon_19.delay", "4" }, + { "toon_19.direction", "down" }, + { "toon_19.position", "any" }, + + { "toon_20", "RocksElements.pcx" }, + { "toon_20.xpos", "10" }, + { "toon_20.ypos", "0" }, + { "toon_20.frames", "2" }, + { "toon_20.delay", "4" }, + { "toon_20.direction", "down" }, + { "toon_20.position", "any" }, + + { "global.num_toons", "20" }, + + { "global.border", "RocksScreen.pcx" }, + { "global.door", "RocksDoor.pcx" }, + + { "menu.main.hide_static_text", "false" }, { "font.big", "RocksFontBig.pcx" }, { "font.medium", "RocksFontMedium.pcx" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index b2b0dab0..9244c8dd 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -785,34 +785,47 @@ #define IMG_CUSTOM_126 764 #define IMG_CUSTOM_127 765 #define IMG_CUSTOM_128 766 -#define IMG_GLOBAL_BORDER 767 -#define IMG_GLOBAL_DOOR 768 -#define IMG_GLOBAL_TOONS 769 -#define IMG_TOON_1 770 -#define IMG_TOON_2 771 -#define IMG_TOON_3 772 -#define IMG_TOON_4 773 -#define IMG_TOON_5 774 -#define IMG_TOON_6 775 -#define IMG_FONT_BIG 776 -#define IMG_FONT_MEDIUM 777 -#define IMG_FONT_SMALL 778 -#define IMG_FONT_EM 779 -#define IMG_BACKGROUND_DEFAULT 780 -#define IMG_BACKGROUND_DOOR 781 -#define IMG_BACKGROUND_MAIN 782 -#define IMG_BACKGROUND_LEVEL_SERIES 783 -#define IMG_BACKGROUND_HALL_OF_FAME 784 -#define IMG_BACKGROUND_EDITOR_SETTINGS_LEVEL 785 -#define IMG_BACKGROUND_EDITOR_SETTINGS_ELEMENT 786 -#define IMG_BACKGROUND_INFO 787 -#define IMG_BACKGROUND_SETUP 788 -#define IMG_INFO_FONT_EM_1 789 -#define IMG_INFO_FONT_EM_2 790 -#define IMG_INFO_FONT_EM_3 791 -#define IMG_INFO_FONT_EM_4 792 -#define IMG_INFO_FONT_EM_5 793 +#define IMG_TOON_1 767 +#define IMG_TOON_2 768 +#define IMG_TOON_3 769 +#define IMG_TOON_4 770 +#define IMG_TOON_5 771 +#define IMG_TOON_6 772 +#define IMG_TOON_7 773 +#define IMG_TOON_8 774 +#define IMG_TOON_9 775 +#define IMG_TOON_10 776 +#define IMG_TOON_11 777 +#define IMG_TOON_12 778 +#define IMG_TOON_13 779 +#define IMG_TOON_14 780 +#define IMG_TOON_15 781 +#define IMG_TOON_16 782 +#define IMG_TOON_17 783 +#define IMG_TOON_18 784 +#define IMG_TOON_19 785 +#define IMG_TOON_20 786 +#define IMG_GLOBAL_BORDER 787 +#define IMG_GLOBAL_DOOR 788 +#define IMG_FONT_BIG 789 +#define IMG_FONT_MEDIUM 790 +#define IMG_FONT_SMALL 791 +#define IMG_FONT_EM 792 +#define IMG_BACKGROUND_DEFAULT 793 +#define IMG_BACKGROUND_DOOR 794 +#define IMG_BACKGROUND_MAIN 795 +#define IMG_BACKGROUND_LEVEL_SERIES 796 +#define IMG_BACKGROUND_HALL_OF_FAME 797 +#define IMG_BACKGROUND_EDITOR_SETTINGS_LEVEL 798 +#define IMG_BACKGROUND_EDITOR_SETTINGS_ELEMENT 799 +#define IMG_BACKGROUND_INFO 800 +#define IMG_BACKGROUND_SETUP 801 +#define IMG_INFO_FONT_EM_1 802 +#define IMG_INFO_FONT_EM_2 803 +#define IMG_INFO_FONT_EM_3 804 +#define IMG_INFO_FONT_EM_4 805 +#define IMG_INFO_FONT_EM_5 806 -#define NUM_IMAGE_FILES 794 +#define NUM_IMAGE_FILES 807 #endif /* CONF_GFX_H */ diff --git a/src/conftime.h b/src/conftime.h index 71df4b09..9c30de7e 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-02-09 21:58]" +#define COMPILE_DATE_STRING "[2003-02-10 02:41]" diff --git a/src/editor.c b/src/editor.c index 407d3107..633a5586 100644 --- a/src/editor.c +++ b/src/editor.c @@ -293,10 +293,11 @@ #define GADGET_ID_CUSTOM_INDESTRUCTIBLE 78 #define GADGET_ID_CUSTOM_CAN_FALL 79 #define GADGET_ID_CUSTOM_CAN_SMASH 80 -#define GADGET_ID_CUSTOM_SLIPPERY 81 +#define GADGET_ID_CUSTOM_PUSHABLE 81 +#define GADGET_ID_CUSTOM_SLIPPERY 82 /* gadgets for buttons in element list */ -#define GADGET_ID_ELEMENTLIST_FIRST 82 +#define GADGET_ID_ELEMENTLIST_FIRST 83 #define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \ ED_NUM_ELEMENTLIST_BUTTONS - 1) @@ -364,9 +365,10 @@ #define ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE 5 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL 6 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH 7 -#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 8 +#define ED_CHECKBUTTON_ID_CUSTOM_PUSHABLE 8 +#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 9 -#define ED_NUM_CHECKBUTTONS 9 +#define ED_NUM_CHECKBUTTONS 10 #define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_DOUBLE_SPEED #define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED @@ -439,6 +441,7 @@ static struct boolean indestructible; boolean can_fall; boolean can_smash; + boolean pushable; boolean slippery; } custom_element_properties[NUM_CUSTOM_ELEMENTS]; @@ -717,6 +720,12 @@ static struct }, { ED_SETTINGS_XPOS, ED_COUNTER_YPOS(7), + GADGET_ID_CUSTOM_PUSHABLE, + &custom_element_properties[0].pushable, + "pushable", "element can be pushed" + }, + { + ED_SETTINGS_XPOS, ED_COUNTER_YPOS(8), GADGET_ID_CUSTOM_SLIPPERY, &custom_element_properties[0].slippery, "slippery", "other elements can fall down from it" @@ -2490,6 +2499,9 @@ static void CopyCustomElementPropertiesToEditor() custom_element_properties[i].can_smash = ((properties & EP_BIT_CAN_SMASH) != 0 ? TRUE : FALSE); + custom_element_properties[i].pushable = + ((properties & EP_BIT_PUSHABLE) != 0 ? TRUE : FALSE); + custom_element_properties[i].slippery = ((properties & EP_BIT_SLIPPERY) != 0 ? TRUE : FALSE); } @@ -2520,6 +2532,11 @@ static void CopyCustomElementPropertiesToGame() else Properties1[element] &= ~EP_BIT_CAN_SMASH; + if (custom_element_properties[i].pushable) + Properties1[element] |= EP_BIT_PUSHABLE; + else + Properties1[element] &= ~EP_BIT_PUSHABLE; + if (custom_element_properties[i].slippery) Properties1[element] |= EP_BIT_SLIPPERY; else @@ -3173,6 +3190,18 @@ static void DrawPropertiesWindow() GDI_CHECKED, *checkbutton_info[i].value, GDI_END); MapCheckbuttonGadget(i); + /* draw checkbutton gadget */ + i = ED_CHECKBUTTON_ID_CUSTOM_PUSHABLE; + x = checkbutton_info[i].x + xoffset_right2; + y = checkbutton_info[i].y + yoffset_right2; + + checkbutton_info[i].value = &custom_element_properties[nr].pushable; + + DrawTextF(x, y, font_color, checkbutton_info[i].text); + ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id], + GDI_CHECKED, *checkbutton_info[i].value, GDI_END); + MapCheckbuttonGadget(i); + /* draw checkbutton gadget */ i = ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY; x = checkbutton_info[i].x + xoffset_right2; diff --git a/src/files.c b/src/files.c index a453554b..902b3b89 100644 --- a/src/files.c +++ b/src/files.c @@ -1701,15 +1701,20 @@ void LoadSpecialMenuDesignSettings() struct SetupFileList *setup_file_list; char *value; + /* !!! CHANGE THIS !!! (redundant initialization) !!! */ gfx.menu_main_hide_static_text = FALSE; + global.num_toons = 20; if ((setup_file_list = loadSetupFileList(filename)) == NULL) return; value = getTokenValue(setup_file_list, "menu.main.hide_static_text"); - if (value != NULL) gfx.menu_main_hide_static_text = get_boolean_from_string(value); + value = getTokenValue(setup_file_list, "global.num_toons"); + if (value != NULL) + global.num_toons = get_integer_from_string(value); + freeSetupFileList(setup_file_list); } diff --git a/src/game.c b/src/game.c index 4a297314..5f3f9689 100644 --- a/src/game.c +++ b/src/game.c @@ -6068,7 +6068,9 @@ int DigField(struct PlayerInfo *player, case EL_SPRING: if (mode == DF_SNAP) return MF_NO_ACTION; + /* no "break" -- fall through to next case */ + /* the following elements can be pushed by "snapping" */ case EL_BD_ROCK: if (dy) @@ -6089,7 +6091,8 @@ int DigField(struct PlayerInfo *player, player->push_delay = FrameCounter; #if 0 if (!FrameReached(&player->push_delay, player->push_delay_value) && - !tape.playing && element != EL_SPRING) + !tape.playing && + element != EL_SPRING) return MF_NO_ACTION; #else if (!FrameReached(&player->push_delay, player->push_delay_value) && @@ -6400,6 +6403,48 @@ int DigField(struct PlayerInfo *player, break; default: + if (IS_PUSHABLE(element)) + { + if (mode == DF_SNAP) + return MF_NO_ACTION; + + if (CAN_FALL(element) && dy) + return MF_NO_ACTION; + + player->Pushing = TRUE; + + if (!IN_LEV_FIELD(x+dx, y+dy) || !IS_FREE(x+dx, y+dy)) + return MF_NO_ACTION; + + if (dx && real_dy) + { + if (IN_LEV_FIELD(jx, jy+real_dy) && !IS_SOLID(Feld[jx][jy+real_dy])) + return MF_NO_ACTION; + } + else if (dy && real_dx) + { + if (IN_LEV_FIELD(jx+real_dx, jy) && !IS_SOLID(Feld[jx+real_dx][jy])) + return MF_NO_ACTION; + } + + if (player->push_delay == 0) + player->push_delay = FrameCounter; + + if (!FrameReached(&player->push_delay, player->push_delay_value) && + !(tape.playing && tape.file_version < FILE_VERSION_2_0)) + return MF_NO_ACTION; + + RemoveField(x, y); + Feld[x + dx][y + dy] = element; + + player->push_delay_value = 2 + RND(8); + + DrawLevelField(x + dx, y + dy); + PlaySoundLevelElementAction(x, y, element, ACTION_PUSHING); + + break; + } + return MF_NO_ACTION; } diff --git a/src/init.c b/src/init.c index 60f6febb..3d3a02cc 100644 --- a/src/init.c +++ b/src/init.c @@ -167,6 +167,14 @@ static void InitArtworkConfig() static char *direction_suffix[NUM_DIRECTIONS + 1]; static char *special_suffix[NUM_SPECIAL_GFX_ARGS + 1]; static char *dummy[1] = { NULL }; + static char *ignore_image_tokens[] = + { + "name", + "sort_priority", + "menu.main.hide_static_text", + "global.num_toons", + NULL + }; int i; for (i=0; inum_ext3_suffixes++; + image_info->num_ignore_tokens = 0; + for (i=0; ignore_tokens[i] != NULL; i++) + image_info->num_ignore_tokens++; + image_info->base_prefixes = base_prefixes; image_info->ext1_suffixes = ext1_suffixes; image_info->ext2_suffixes = ext2_suffixes; image_info->ext3_suffixes = ext3_suffixes; + image_info->ignore_tokens = ignore_tokens; image_info->num_property_mapping_entries = 0; diff --git a/src/libgame/image.h b/src/libgame/image.h index 88e18dda..63050285 100644 --- a/src/libgame/image.h +++ b/src/libgame/image.h @@ -82,7 +82,7 @@ char *getImageConfigFilename(); int getImageListPropertyMappingSize(); struct PropertyMapping *getImageListPropertyMapping(); void InitImageList(struct ConfigInfo *, int, struct ConfigInfo *, - char **, char **, char **, char **); + char **, char **, char **, char **, char **); void ReloadCustomImages(); void CreateImageWithSmallImages(int); diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 3e3f5b71..f35620c2 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1579,6 +1579,11 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list, } } + /* the following tokens are no file definitions, but other config tokens */ + if (strcmp(config_list[i].token, "global.num_toons") == 0 || + strcmp(config_list[i].token, "menu.main.hide_static_text") == 0) + is_file_entry = FALSE; + if (is_file_entry) { if (i > 0) @@ -1745,12 +1750,14 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) char **ext1_suffixes = artwork_info->ext1_suffixes; char **ext2_suffixes = artwork_info->ext2_suffixes; char **ext3_suffixes = artwork_info->ext3_suffixes; + char **ignore_tokens = artwork_info->ignore_tokens; int num_file_list_entries = artwork_info->num_file_list_entries; int num_suffix_list_entries = artwork_info->num_suffix_list_entries; int num_base_prefixes = artwork_info->num_base_prefixes; int num_ext1_suffixes = artwork_info->num_ext1_suffixes; int num_ext2_suffixes = artwork_info->num_ext2_suffixes; int num_ext3_suffixes = artwork_info->num_ext3_suffixes; + int num_ignore_tokens = artwork_info->num_ignore_tokens; char *filename = getCustomArtworkConfigFilename(artwork_info->type); struct SetupFileList *setup_file_list; struct SetupFileList *extra_file_list = NULL; @@ -1809,9 +1816,9 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) for (i=0; inext) diff --git a/src/libgame/sound.c b/src/libgame/sound.c index 3f1d04e9..1c0da669 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -1794,10 +1794,9 @@ struct PropertyMapping *getSoundListPropertyMapping() void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries, struct ConfigInfo *config_suffix_list, - char **base_prefixes, - char **ext1_suffixes, - char **ext2_suffixes, - char **ext3_suffixes) + char **base_prefixes, char **ext1_suffixes, + char **ext2_suffixes, char **ext3_suffixes, + char **ignore_tokens) { int i; @@ -1838,10 +1837,15 @@ void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries, for (i=0; ext3_suffixes[i] != NULL; i++) sound_info->num_ext3_suffixes++; + sound_info->num_ignore_tokens = 0; + for (i=0; ignore_tokens[i] != NULL; i++) + sound_info->num_ignore_tokens++; + sound_info->base_prefixes = base_prefixes; sound_info->ext1_suffixes = ext1_suffixes; sound_info->ext2_suffixes = ext2_suffixes; sound_info->ext3_suffixes = ext3_suffixes; + sound_info->ignore_tokens = ignore_tokens; sound_info->num_property_mapping_entries = 0; diff --git a/src/libgame/sound.h b/src/libgame/sound.h index 6bebb5dc..a23f03f0 100644 --- a/src/libgame/sound.h +++ b/src/libgame/sound.h @@ -148,7 +148,7 @@ struct FileInfo *getSoundListEntry(int); int getSoundListPropertyMappingSize(); struct PropertyMapping *getSoundListPropertyMapping(); void InitSoundList(struct ConfigInfo *, int, struct ConfigInfo *, - char **, char **, char **, char **); + char **, char **, char **, char **, char **); void InitReloadCustomSounds(char *); void InitReloadCustomMusic(char *); void FreeAllSounds(void); diff --git a/src/libgame/system.h b/src/libgame/system.h index 532f079a..03250949 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -536,26 +536,25 @@ struct ArtworkListInfo int num_file_list_entries; int num_dynamic_file_list_entries; - struct FileInfo *file_list; /* static artwork file array */ struct FileInfo *dynamic_file_list; /* dynamic artwrk file array */ int num_suffix_list_entries; - struct ConfigInfo *suffix_list; /* parameter suffixes array */ int num_base_prefixes; int num_ext1_suffixes; int num_ext2_suffixes; int num_ext3_suffixes; - char **base_prefixes; /* base token prefixes array */ char **ext1_suffixes; /* property suffixes array 1 */ char **ext2_suffixes; /* property suffixes array 2 */ char **ext3_suffixes; /* property suffixes array 3 */ - int num_property_mapping_entries; + int num_ignore_tokens; + char **ignore_tokens; /* file tokens to be ignored */ + int num_property_mapping_entries; struct PropertyMapping *property_mapping; /* mapping token -> artwork */ int sizeof_artwork_list_entry; diff --git a/src/libgame/toons.c b/src/libgame/toons.c index 5c0d4444..c8c71e3a 100644 --- a/src/libgame/toons.c +++ b/src/libgame/toons.c @@ -81,6 +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 char *direction = NULL; + + setString(&direction, getStringToLower(direction_raw)); + + 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); +} + void InitToonScreen(Bitmap *save_buffer, void (*update_function)(void), void (*prepare_backbuffer_function)(void), @@ -154,11 +166,12 @@ boolean AnimateToon(int toon_nr, boolean restart) struct ToonInfo *anim = &screen_info.toons[toon_nr]; Bitmap *anim_bitmap = screen_info.toons[toon_nr].bitmap; GC anim_clip_gc = anim_bitmap->stored_clip_gc; + int direction = get_toon_direction(anim->direction); if (restart) { - horiz_move = (anim->direction & (ANIMDIR_LEFT | ANIMDIR_RIGHT)); - vert_move = (anim->direction & (ANIMDIR_UP | ANIMDIR_DOWN)); + horiz_move = (direction & (MV_LEFT | MV_RIGHT)); + vert_move = (direction & (MV_UP | MV_DOWN)); anim_delay_value = anim->step_delay * screen_info.frame_delay_value; frame = getAnimationFrame(anim->anim_frames, anim->anim_delay, @@ -167,16 +180,20 @@ boolean AnimateToon(int toon_nr, boolean restart) if (horiz_move) { - if (anim->position == ANIMPOS_UP) + int pos_bottom = screen_info.height - anim->height; + + if (strcmp(anim->position, "top") == 0) pos_y = 0; - else if (anim->position == ANIMPOS_DOWN) - pos_y = screen_info.height - anim->height; - else if (anim->position == ANIMPOS_UPPER) - pos_y = SimpleRND((screen_info.height - anim->height) / 2); + else if (strcmp(anim->position, "bottom") == 0) + pos_y = pos_bottom; + else if (strcmp(anim->position, "upper") == 0) + pos_y = SimpleRND(pos_bottom / 2); + else if (strcmp(anim->position, "lower") == 0) + pos_y = pos_bottom / 2 + SimpleRND(pos_bottom / 2); else - pos_y = SimpleRND(screen_info.height - anim->height); + pos_y = SimpleRND(pos_bottom); - if (anim->direction == ANIMDIR_RIGHT) + if (direction == MV_RIGHT) { delta_x = anim->step_offset; pos_x = -anim->width + delta_x; @@ -186,18 +203,21 @@ boolean AnimateToon(int toon_nr, boolean restart) delta_x = -anim->step_offset; pos_x = screen_info.width + delta_x; } + delta_y = 0; } else { - if (anim->position == ANIMPOS_LEFT) + int pos_right = screen_info.width - anim->width; + + if (strcmp(anim->position, "left") == 0) pos_x = 0; - else if (anim->position == ANIMPOS_RIGHT) - pos_x = screen_info.width - anim->width; + else if (strcmp(anim->position, "right") == 0) + pos_x = pos_right; else - pos_x = SimpleRND(screen_info.width - anim->width); + pos_x = SimpleRND(pos_right); - if (anim->direction == ANIMDIR_DOWN) + if (direction == MV_DOWN) { delta_y = anim->step_offset; pos_y = -anim->height + delta_y; @@ -207,6 +227,7 @@ boolean AnimateToon(int toon_nr, boolean restart) delta_y = -anim->step_offset; pos_y = screen_info.width + delta_y; } + delta_x = 0; } } diff --git a/src/libgame/toons.h b/src/libgame/toons.h index 8ea41d18..a30cbe63 100644 --- a/src/libgame/toons.h +++ b/src/libgame/toons.h @@ -26,6 +26,7 @@ #define ANIM_REVERSE (1 << 4) #define ANIM_RANDOM (1 << 5) +#if 0 /* values for toon animation direction */ #define ANIMDIR_LEFT 1 #define ANIMDIR_RIGHT 2 @@ -38,6 +39,7 @@ #define ANIMPOS_UP 4 #define ANIMPOS_DOWN 8 #define ANIMPOS_UPPER 16 +#endif struct ToonScreenInfo @@ -58,6 +60,7 @@ struct ToonScreenInfo struct ToonInfo { +#if 0 int graphic; int width, height; int src_x, src_y; @@ -72,7 +75,11 @@ struct ToonInfo int anim_start_frame; Bitmap *bitmap; /* dynamically initialized */ -#if 0 + char *direction_str; + char *position_str; + +#else + Bitmap *bitmap; int src_x, src_y; int width, height; @@ -82,6 +89,8 @@ struct ToonInfo int anim_mode; int step_offset; int step_delay; + char *direction; + char *position; #endif }; diff --git a/src/main.h b/src/main.h index 12d5ea23..f6a456e9 100644 --- a/src/main.h +++ b/src/main.h @@ -784,8 +784,11 @@ #define GFX_ARG_GLOBAL_SYNC 19 #define GFX_ARG_STEP_OFFSET 20 #define GFX_ARG_STEP_DELAY 21 +#define GFX_ARG_DIRECTION 22 +#define GFX_ARG_POSITION 23 +#define GFX_ARG_NAME 24 -#define NUM_GFX_ARGS 22 +#define NUM_GFX_ARGS 25 /* values for sound configuration suffixes */ @@ -1002,6 +1005,8 @@ struct GlobalInfo char *autoplay_leveldir; int autoplay_level_nr; + int num_toons; + float frames_per_second; boolean fps_slowdown; int fps_slowdown_factor; -- 2.34.1