From: Holger Schemel Date: Sat, 7 Apr 2007 01:40:23 +0000 (+0200) Subject: rnd-20070407-1-src X-Git-Tag: 3.2.4^2~42 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=e77c26313b1a1e3ddd884cdda005cb6758c1a100;p=rocksndiamonds.git rnd-20070407-1-src * fixed some general bugs with handling of ".active" elements and fonts --- diff --git a/ChangeLog b/ChangeLog index 7e713966..5fd95852 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-04-05 + * fixed some general bugs with handling of ".active" elements and fonts + 2007-04-04 * cleanup of game panel elements (some elements were not really needed) * added displaying of gravity state (on/off) as new game panel control diff --git a/src/Makefile b/src/Makefile index 83f5cdb6..d13e68bc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -197,7 +197,8 @@ CNFS = conf_gfx.h \ conf_fnt.c \ conf_g2s.c \ conf_g2m.c \ - conf_var.c + conf_var.c \ + conf_act.c CNFS_CMD = ../Scripts/create_element_defs.pl diff --git a/src/conf_act.c b/src/conf_act.c new file mode 100644 index 00000000..e52851e4 --- /dev/null +++ b/src/conf_act.c @@ -0,0 +1,360 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2006 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_act.c * +***********************************************************/ + +/* ----- this file was automatically generated -- do not edit by hand ----- */ + +#ifndef CONF_ACT_C +#define CONF_ACT_C + +/* values for active states of elements and fonts */ + +static struct +{ + int element; + int element_active; +} +element_with_active_state[] = +{ + { + EL_BD_MAGIC_WALL, + EL_BD_MAGIC_WALL_ACTIVE + }, + { + EL_CONVEYOR_BELT_1_LEFT, + EL_CONVEYOR_BELT_1_LEFT_ACTIVE + }, + { + EL_CONVEYOR_BELT_1_MIDDLE, + EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE + }, + { + EL_CONVEYOR_BELT_1_RIGHT, + EL_CONVEYOR_BELT_1_RIGHT_ACTIVE + }, + { + EL_CONVEYOR_BELT_2_LEFT, + EL_CONVEYOR_BELT_2_LEFT_ACTIVE + }, + { + EL_CONVEYOR_BELT_2_MIDDLE, + EL_CONVEYOR_BELT_2_MIDDLE_ACTIVE + }, + { + EL_CONVEYOR_BELT_2_RIGHT, + EL_CONVEYOR_BELT_2_RIGHT_ACTIVE + }, + { + EL_CONVEYOR_BELT_3_LEFT, + EL_CONVEYOR_BELT_3_LEFT_ACTIVE + }, + { + EL_CONVEYOR_BELT_3_MIDDLE, + EL_CONVEYOR_BELT_3_MIDDLE_ACTIVE + }, + { + EL_CONVEYOR_BELT_3_RIGHT, + EL_CONVEYOR_BELT_3_RIGHT_ACTIVE + }, + { + EL_CONVEYOR_BELT_4_LEFT, + EL_CONVEYOR_BELT_4_LEFT_ACTIVE + }, + { + EL_CONVEYOR_BELT_4_MIDDLE, + EL_CONVEYOR_BELT_4_MIDDLE_ACTIVE + }, + { + EL_CONVEYOR_BELT_4_RIGHT, + EL_CONVEYOR_BELT_4_RIGHT_ACTIVE + }, + { + EL_DC_GATE_WHITE_GRAY, + EL_DC_GATE_WHITE_GRAY_ACTIVE + }, + { + EL_DC_MAGIC_WALL, + EL_DC_MAGIC_WALL_ACTIVE + }, + { + EL_DC_TIMEGATE_SWITCH, + EL_DC_TIMEGATE_SWITCH_ACTIVE + }, + { + EL_DYNABOMB, + EL_DYNABOMB_ACTIVE + }, + { + EL_DYNABOMB_PLAYER_1, + EL_DYNABOMB_PLAYER_1_ACTIVE + }, + { + EL_DYNABOMB_PLAYER_2, + EL_DYNABOMB_PLAYER_2_ACTIVE + }, + { + EL_DYNABOMB_PLAYER_3, + EL_DYNABOMB_PLAYER_3_ACTIVE + }, + { + EL_DYNABOMB_PLAYER_4, + EL_DYNABOMB_PLAYER_4_ACTIVE + }, + { + EL_DYNAMITE, + EL_DYNAMITE_ACTIVE + }, + { + EL_EMC_DRIPPER, + EL_EMC_DRIPPER_ACTIVE + }, + { + EL_EMC_FAKE_GRASS, + EL_EMC_FAKE_GRASS_ACTIVE + }, + { + EL_EMC_GATE_5_GRAY, + EL_EMC_GATE_5_GRAY_ACTIVE + }, + { + EL_EMC_GATE_6_GRAY, + EL_EMC_GATE_6_GRAY_ACTIVE + }, + { + EL_EMC_GATE_7_GRAY, + EL_EMC_GATE_7_GRAY_ACTIVE + }, + { + EL_EMC_GATE_8_GRAY, + EL_EMC_GATE_8_GRAY_ACTIVE + }, + { + EL_EMC_MAGIC_BALL, + EL_EMC_MAGIC_BALL_ACTIVE + }, + { + EL_EMC_MAGIC_BALL_SWITCH, + EL_EMC_MAGIC_BALL_SWITCH_ACTIVE + }, + { + EL_EMC_SPRING_BUMPER, + EL_EMC_SPRING_BUMPER_ACTIVE + }, + { + EL_EM_DYNAMITE, + EL_EM_DYNAMITE_ACTIVE + }, + { + EL_EM_GATE_1_GRAY, + EL_EM_GATE_1_GRAY_ACTIVE + }, + { + EL_EM_GATE_2_GRAY, + EL_EM_GATE_2_GRAY_ACTIVE + }, + { + EL_EM_GATE_3_GRAY, + EL_EM_GATE_3_GRAY_ACTIVE + }, + { + EL_EM_GATE_4_GRAY, + EL_EM_GATE_4_GRAY_ACTIVE + }, + { + EL_GATE_1_GRAY, + EL_GATE_1_GRAY_ACTIVE + }, + { + EL_GATE_2_GRAY, + EL_GATE_2_GRAY_ACTIVE + }, + { + EL_GATE_3_GRAY, + EL_GATE_3_GRAY_ACTIVE + }, + { + EL_GATE_4_GRAY, + EL_GATE_4_GRAY_ACTIVE + }, + { + EL_INTERNAL_CASCADE_BD, + EL_INTERNAL_CASCADE_BD_ACTIVE + }, + { + EL_INTERNAL_CASCADE_CE, + EL_INTERNAL_CASCADE_CE_ACTIVE + }, + { + EL_INTERNAL_CASCADE_CHARS, + EL_INTERNAL_CASCADE_CHARS_ACTIVE + }, + { + EL_INTERNAL_CASCADE_DC, + EL_INTERNAL_CASCADE_DC_ACTIVE + }, + { + EL_INTERNAL_CASCADE_DX, + EL_INTERNAL_CASCADE_DX_ACTIVE + }, + { + EL_INTERNAL_CASCADE_DYNAMIC, + EL_INTERNAL_CASCADE_DYNAMIC_ACTIVE + }, + { + EL_INTERNAL_CASCADE_EM, + EL_INTERNAL_CASCADE_EM_ACTIVE + }, + { + EL_INTERNAL_CASCADE_EMC, + EL_INTERNAL_CASCADE_EMC_ACTIVE + }, + { + EL_INTERNAL_CASCADE_GE, + EL_INTERNAL_CASCADE_GE_ACTIVE + }, + { + EL_INTERNAL_CASCADE_REF, + EL_INTERNAL_CASCADE_REF_ACTIVE + }, + { + EL_INTERNAL_CASCADE_RND, + EL_INTERNAL_CASCADE_RND_ACTIVE + }, + { + EL_INTERNAL_CASCADE_SB, + EL_INTERNAL_CASCADE_SB_ACTIVE + }, + { + EL_INTERNAL_CASCADE_SP, + EL_INTERNAL_CASCADE_SP_ACTIVE + }, + { + EL_INTERNAL_CASCADE_STEEL_CHARS, + EL_INTERNAL_CASCADE_STEEL_CHARS_ACTIVE + }, + { + EL_INTERNAL_CASCADE_USER, + EL_INTERNAL_CASCADE_USER_ACTIVE + }, + { + EL_INVISIBLE_SAND, + EL_INVISIBLE_SAND_ACTIVE + }, + { + EL_INVISIBLE_STEELWALL, + EL_INVISIBLE_STEELWALL_ACTIVE + }, + { + EL_INVISIBLE_WALL, + EL_INVISIBLE_WALL_ACTIVE + }, + { + EL_LAMP, + EL_LAMP_ACTIVE + }, + { + EL_LIGHT_SWITCH, + EL_LIGHT_SWITCH_ACTIVE + }, + { + EL_MAGIC_WALL, + EL_MAGIC_WALL_ACTIVE + }, + { + EL_ROBOT_WHEEL, + EL_ROBOT_WHEEL_ACTIVE + }, + { + EL_SHIELD_DEADLY, + EL_SHIELD_DEADLY_ACTIVE + }, + { + EL_SHIELD_NORMAL, + EL_SHIELD_NORMAL_ACTIVE + }, + { + EL_SP_BUGGY_BASE, + EL_SP_BUGGY_BASE_ACTIVE + }, + { + EL_SP_DISK_RED, + EL_SP_DISK_RED_ACTIVE + }, + { + EL_SP_TERMINAL, + EL_SP_TERMINAL_ACTIVE + }, + { + EL_TIMEGATE_SWITCH, + EL_TIMEGATE_SWITCH_ACTIVE + }, + { + EL_TRAP, + EL_TRAP_ACTIVE + }, + { + -1, + -1 + }, +}; + + +static struct +{ + int font_nr; + int font_nr_active; +} +font_with_active_state[] = +{ + { + FONT_INPUT_1, + FONT_INPUT_1_ACTIVE + }, + { + FONT_INPUT_2, + FONT_INPUT_2_ACTIVE + }, + { + FONT_LEVEL_NUMBER, + FONT_LEVEL_NUMBER_ACTIVE + }, + { + FONT_MENU_1, + FONT_MENU_1_ACTIVE + }, + { + FONT_MENU_2, + FONT_MENU_2_ACTIVE + }, + { + FONT_TEXT_1, + FONT_TEXT_1_ACTIVE + }, + { + FONT_TEXT_2, + FONT_TEXT_2_ACTIVE + }, + { + FONT_TEXT_3, + FONT_TEXT_3_ACTIVE + }, + { + FONT_TEXT_4, + FONT_TEXT_4_ACTIVE + }, + { + -1, + -1 + }, +}; + +#endif /* CONF_ACT_C */ diff --git a/src/conftime.h b/src/conftime.h index 6d3909ea..685202d1 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-04-05 02:56" +#define COMPILE_DATE_STRING "2007-04-07 03:38" diff --git a/src/game.c b/src/game.c index d159b46f..2a9eabb0 100644 --- a/src/game.c +++ b/src/game.c @@ -5465,12 +5465,19 @@ static void InitBeltMovement() for (j = 0; j < NUM_BELT_PARTS; j++) { int element = belt_base_active_element[belt_nr] + j; - int graphic = el2img(element); + int graphic_1 = el2img(element); + int graphic_2 = el2panelimg(element); if (game.belt_dir[i] == MV_LEFT) - graphic_info[graphic].anim_mode &= ~ANIM_REVERSE; + { + graphic_info[graphic_1].anim_mode &= ~ANIM_REVERSE; + graphic_info[graphic_2].anim_mode &= ~ANIM_REVERSE; + } else - graphic_info[graphic].anim_mode |= ANIM_REVERSE; + { + graphic_info[graphic_1].anim_mode |= ANIM_REVERSE; + graphic_info[graphic_2].anim_mode |= ANIM_REVERSE; + } } } @@ -5546,12 +5553,19 @@ static void ToggleBeltSwitch(int x, int y) for (i = 0; i < NUM_BELT_PARTS; i++) { int element = belt_base_active_element[belt_nr] + i; - int graphic = el2img(element); + int graphic_1 = el2img(element); + int graphic_2 = el2panelimg(element); if (belt_dir == MV_LEFT) - graphic_info[graphic].anim_mode &= ~ANIM_REVERSE; + { + graphic_info[graphic_1].anim_mode &= ~ANIM_REVERSE; + graphic_info[graphic_2].anim_mode &= ~ANIM_REVERSE; + } else - graphic_info[graphic].anim_mode |= ANIM_REVERSE; + { + graphic_info[graphic_1].anim_mode |= ANIM_REVERSE; + graphic_info[graphic_2].anim_mode |= ANIM_REVERSE; + } } SCAN_PLAYFIELD(xx, yy) diff --git a/src/init.c b/src/init.c index 08177e1b..ee8df892 100644 --- a/src/init.c +++ b/src/init.c @@ -32,6 +32,7 @@ #include "conf_fnt.c" /* include auto-generated data structure definitions */ #include "conf_g2s.c" /* include auto-generated data structure definitions */ #include "conf_g2m.c" /* include auto-generated data structure definitions */ +#include "conf_act.c" /* include auto-generated data structure definitions */ #define CONFIG_TOKEN_FONT_INITIAL "font.initial" @@ -513,6 +514,16 @@ void InitElementGraphicInfo() int graphic = property_mapping[i].artwork_index; boolean crumbled = FALSE; +#if 0 + if ((element == EL_EM_DYNAMITE || + element == EL_EM_DYNAMITE_ACTIVE) && + action == ACTION_ACTIVE && + (special == GFX_SPECIAL_ARG_EDITOR || + special == GFX_SPECIAL_ARG_PANEL)) + printf("::: DYNAMIC: %d, %d, %d -> %d\n", + element, action, special, graphic); +#endif + if (special == GFX_SPECIAL_ARG_CRUMBLED) { special = -1; @@ -906,6 +917,15 @@ void InitElementSpecialGraphicInfo() boolean special_redefined = getImageListEntryFromImageID(graphic)->redefined; +#if 0 + if ((element == EL_EM_DYNAMITE || + element == EL_EM_DYNAMITE_ACTIVE) && + (special == GFX_SPECIAL_ARG_EDITOR || + special == GFX_SPECIAL_ARG_PANEL)) + printf("::: SPECIAL STATIC: %d, %d -> %d\n", + element, special, graphic); +#endif + /* if the base graphic ("emerald", for example) has been redefined, but not the special graphic ("emerald.EDITOR", for example), do not use an existing (in this case considered obsolete) special graphic @@ -919,13 +939,57 @@ void InitElementSpecialGraphicInfo() /* 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; + 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 0 + if ((element == EL_EM_DYNAMITE || + element == EL_EM_DYNAMITE_ACTIVE || + element == EL_CONVEYOR_BELT_1_MIDDLE || + element == EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE) && + (special == GFX_SPECIAL_ARG_EDITOR || + special == GFX_SPECIAL_ARG_PANEL)) + printf("::: SPECIAL DYNAMIC: %d, %d -> %d [%d]\n", + element, special, graphic, property_mapping[i].ext1_index); +#endif + +#if 0 + if (element == EL_CONVEYOR_BELT_1_MIDDLE && + action == ACTION_ACTIVE) + { + element = EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE; + action = -1; + } +#endif + +#if 0 + if (element == EL_MAGIC_WALL && + action == ACTION_ACTIVE) + { + element = EL_MAGIC_WALL_ACTIVE; + action = -1; + } +#endif + +#if 1 + /* for action ".active", replace element with active element, if exists */ + if (action == ACTION_ACTIVE && element != ELEMENT_ACTIVE(element)) + { + element = ELEMENT_ACTIVE(element); + action = -1; + } +#endif if (element >= MAX_NUM_ELEMENTS) continue; + /* do not change special graphic if action or direction was specified */ + if (action != -1 || direction != -1) + continue; + if (IS_SPECIAL_GFX_ARG(special)) element_info[element].special_graphic[special] = graphic; } @@ -4351,6 +4415,32 @@ static void InitGlobal() #endif } + /* always start with reliable default values (all elements) */ + for (i = 0; i < MAX_NUM_ELEMENTS; i++) + ActiveElement[i] = i; + + /* now add all entries that have an active state (active elements) */ + for (i = 0; element_with_active_state[i].element != -1; i++) + { + int element = element_with_active_state[i].element; + int element_active = element_with_active_state[i].element_active; + + ActiveElement[element] = element_active; + } + + /* always start with reliable default values (all fonts) */ + for (i = 0; i < NUM_FONTS; i++) + ActiveFont[i] = i; + + /* now add all entries that have an active state (active fonts) */ + for (i = 0; font_with_active_state[i].font_nr != -1; i++) + { + int font = font_with_active_state[i].font_nr; + int font_active = font_with_active_state[i].font_nr_active; + + ActiveFont[font] = font_active; + } + global.autoplay_leveldir = NULL; global.convert_leveldir = NULL; diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 95c5dfd3..e300b9bb 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -2322,10 +2322,20 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, base_index = i; +#if 0 + if (IS_PARENT_PROCESS()) + printf("===> MATCH: '%s', '%s'\n", token, base_prefix); +#endif + if (start_pos + len_base_prefix == len_token) /* exact match */ { exact_match = TRUE; +#if 0 + if (IS_PARENT_PROCESS()) + printf("===> EXACT MATCH: '%s', '%s'\n", token, base_prefix); +#endif + add_dynamic_file_list_entry(dynamic_file_list, num_dynamic_file_list_entries, extra_file_hash, @@ -2359,10 +2369,20 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, ext1_index = j; +#if 0 + if (IS_PARENT_PROCESS()) + printf("===> MATCH: '%s', '%s'\n", token, ext1_suffix); +#endif + if (start_pos + len_ext1_suffix == len_token) /* exact match */ { exact_match = TRUE; +#if 0 + if (IS_PARENT_PROCESS()) + printf("===> EXACT MATCH: '%s', '%s'\n", token, ext1_suffix); +#endif + add_dynamic_file_list_entry(dynamic_file_list, num_dynamic_file_list_entries, extra_file_hash, @@ -2401,10 +2421,20 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, ext2_index = k; +#if 0 + if (IS_PARENT_PROCESS()) + printf("===> MATCH: '%s', '%s'\n", token, ext2_suffix); +#endif + if (start_pos + len_ext2_suffix == len_token) /* exact match */ { exact_match = TRUE; +#if 0 + if (IS_PARENT_PROCESS()) + printf("===> EXACT MATCH: '%s', '%s'\n", token, ext2_suffix); +#endif + add_dynamic_file_list_entry(dynamic_file_list, num_dynamic_file_list_entries, extra_file_hash, @@ -2443,10 +2473,20 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, ext3_index = l; +#if 0 + if (IS_PARENT_PROCESS()) + printf("===> MATCH: '%s', '%s'\n", token, ext3_suffix); +#endif + if (start_pos + len_ext3_suffix == len_token) /* exact match */ { exact_match = TRUE; +#if 0 + if (IS_PARENT_PROCESS()) + printf("===> EXACT MATCH: '%s', '%s'\n", token, ext3_suffix); +#endif + add_dynamic_file_list_entry(dynamic_file_list, num_dynamic_file_list_entries, extra_file_hash, diff --git a/src/main.c b/src/main.c index 58b61507..0279b1a7 100644 --- a/src/main.c +++ b/src/main.c @@ -75,6 +75,9 @@ int GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; int GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +int ActiveElement[MAX_NUM_ELEMENTS]; +int ActiveFont[NUM_FONTS]; + int lev_fieldx, lev_fieldy; int scroll_x, scroll_y; diff --git a/src/main.h b/src/main.h index 3bd3d6be..eb6b4386 100644 --- a/src/main.h +++ b/src/main.h @@ -838,6 +838,11 @@ (d) == MV_UP ? "MV_UP" : \ (d) == MV_DOWN ? "MV_DOWN" : "(various)") +#define ELEMENT_ACTIVE(e) (ActiveElement[e]) + +#define FONT_ACTIVE(f) (ActiveFont[f]) + + /* fundamental game speed values */ #define MICROLEVEL_SCROLL_DELAY 50 /* delay for scrolling micro level */ #define MICROLEVEL_LABEL_DELAY 250 /* delay for micro level label */ @@ -1860,6 +1865,7 @@ #define NUM_FONTS 37 #define NUM_INITIAL_FONTS 4 +#if 0 #define FONT_ACTIVE(f) \ ((f) == FONT_MENU_1 ? FONT_MENU_1_ACTIVE : \ (f) == FONT_MENU_2 ? FONT_MENU_2_ACTIVE : \ @@ -1871,7 +1877,7 @@ (f) == FONT_INPUT_2 ? FONT_INPUT_2_ACTIVE : \ (f) == FONT_LEVEL_NUMBER ? FONT_LEVEL_NUMBER_ACTIVE : \ (f)) - +#endif /* values for game_status (must match special image configuration suffixes) */ #define GAME_MODE_DEFAULT 0 @@ -2667,6 +2673,9 @@ extern int GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern int GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +extern int ActiveElement[MAX_NUM_ELEMENTS]; +extern int ActiveFont[NUM_FONTS]; + extern int lev_fieldx, lev_fieldy; extern int scroll_x, scroll_y; diff --git a/src/screens.c b/src/screens.c index fb1fa837..97b32f42 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1257,6 +1257,21 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) title = title_default; #endif +#if 0 + { + int graphicA = element_info[EL_EM_DYNAMITE_ACTIVE].special_graphic[GFX_SPECIAL_ARG_EDITOR]; + int graphicB = element_info[EL_EM_DYNAMITE_ACTIVE].special_graphic[GFX_SPECIAL_ARG_PANEL]; + int graphic1 = element_info[EL_CONVEYOR_BELT_1_MIDDLE].special_graphic[GFX_SPECIAL_ARG_EDITOR]; + int graphic2 = element_info[EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE].special_graphic[GFX_SPECIAL_ARG_EDITOR]; + + printf("::: %d [%d] -> %d, %d [%d, %d]\n", + graphicA, graphicB, + graphic_info[graphicA].src_x, + graphic_info[graphicA].src_y, + graphic1, graphic2); + } +#endif + #if 0 printf("::: %d, %d\n", fading.anim_mode == ANIM_CROSSFADE, redraw_mask == REDRAW_ALL);