From: Holger Schemel Date: Sat, 21 Jan 2006 15:51:39 +0000 (+0100) Subject: rnd-20060121-2-src X-Git-Tag: 3.2.0^2~81 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=c5d03f36989babf47697957101ecebe9b7b9cbe8;p=rocksndiamonds.git rnd-20060121-2-src --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index a85fa0e8..52f0f135 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -3668,13 +3668,13 @@ struct ConfigInfo image_config[] = /* !!! TEMPORARILY STORED HERE -- PROBABLY TO BE CHANGED !!! */ /* (for testing, change filename back to "emc_object dot pcx") */ - { "emc_object", "RocksEMC.pcx" }, + { "emc_object", "emc_object.pcx" }, #if 0 { "emc_object.scale_up_factor", "2" }, #endif /* (for testing, change filename back to "emc_sprite dot pcx") */ - { "emc_sprite", "RocksEMC.pcx" }, + { "emc_sprite", "emc_sprite.pcx" }, #if 0 { "emc_sprite.scale_up_factor", "2" }, #endif diff --git a/src/conftime.h b/src/conftime.h index acf6db27..a8f32364 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-01-20 03:45]" +#define COMPILE_DATE_STRING "[2006-01-21 16:50]" diff --git a/src/files.c b/src/files.c index 39ecf24b..6b395bf0 100644 --- a/src/files.c +++ b/src/files.c @@ -5698,7 +5698,7 @@ void LoadHelpAnimInfo() i_to_a(element_action_info[i].value)); /* do not store direction index (bit) here, but direction value! */ - for (i = 0; i < NUM_DIRECTIONS; i++) + for (i = 0; i < NUM_DIRECTIONS_FULL; i++) setHashEntry(direction_hash, element_direction_info[i].suffix, i_to_a(1 << element_direction_info[i].value)); diff --git a/src/game.c b/src/game.c index e1cd4686..8cbcc8ee 100644 --- a/src/game.c +++ b/src/game.c @@ -4905,7 +4905,7 @@ inline static void TurnRoundExt(int x, int y) int start_pos = check_pos[MovDir[x][y] & 0x0f]; int i; - MovDelay[x][y] = level.android_move_time; + MovDelay[x][y] = level.android_move_time * 8 + 1; if (start_pos < 0) /* (should never happen) */ return; @@ -5177,7 +5177,7 @@ static void TurnRound(int x, int y) GfxFrame[x][y] = 0; if (MovDelay[x][y]) - GfxAction[x][y] = ACTION_TURNING_FROM_LEFT + MV_DIR_BIT(direction); + GfxAction[x][y] = ACTION_TURNING_FROM_LEFT + MV_DIR_TO_BIT(direction); } static boolean JustBeingPushed(int x, int y) @@ -10368,7 +10368,7 @@ void RemovePlayer(struct PlayerInfo *player) static void setFieldForSnapping(int x, int y, int element, int direction) { struct ElementInfo *ei = &element_info[element]; - int direction_bit = MV_DIR_BIT(direction); + int direction_bit = MV_DIR_TO_BIT(direction); int graphic_snapping = ei->direction_graphic[ACTION_SNAPPING][direction_bit]; int action = (graphic_snapping != IMG_EMPTY_SPACE ? ACTION_SNAPPING : IS_DIGGABLE(element) ? ACTION_DIGGING : ACTION_COLLECTING); diff --git a/src/init.c b/src/init.c index 02fef905..dd2296b8 100644 --- a/src/init.c +++ b/src/init.c @@ -320,7 +320,7 @@ void InitElementGraphicInfo() element_info[i].graphic[act] = -1; element_info[i].crumbled[act] = -1; - for (dir = 0; dir < NUM_DIRECTIONS; dir++) + for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++) { element_info[i].direction_graphic[act][dir] = -1; element_info[i].direction_crumbled[act][dir] = -1; @@ -404,7 +404,7 @@ void InitElementGraphicInfo() if (crumbled) { if (direction < 0) - for (dir = 0; dir < NUM_DIRECTIONS; dir++) + for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++) element_info[element].direction_crumbled[action][dir] = -1; if (direction > -1) @@ -415,7 +415,7 @@ void InitElementGraphicInfo() else { if (direction < 0) - for (dir = 0; dir < NUM_DIRECTIONS; dir++) + for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++) element_info[element].direction_graphic[action][dir] = -1; if (direction > -1) @@ -443,7 +443,7 @@ void InitElementGraphicInfo() element_info[i].crumbled[act] = element_info[crumbled_like].crumbled[act]; for (act = 0; act < NUM_ACTIONS; act++) - for (dir = 0; dir < NUM_DIRECTIONS; dir++) + for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++) element_info[i].direction_crumbled[act][dir] = element_info[crumbled_like].direction_crumbled[act][dir]; } @@ -452,7 +452,7 @@ void InitElementGraphicInfo() { element_info[i].graphic[ACTION_DIGGING] = element_info[diggable_like].graphic[ACTION_DIGGING]; - for (dir = 0; dir < NUM_DIRECTIONS; dir++) + for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++) element_info[i].direction_graphic[ACTION_DIGGING][dir] = element_info[diggable_like].direction_graphic[ACTION_DIGGING][dir]; } @@ -489,7 +489,7 @@ void InitElementGraphicInfo() if (graphic > 0 && graphic_info[graphic].bitmap == NULL) element_info[i].crumbled[act] = -1; - for (dir = 0; dir < NUM_DIRECTIONS; dir++) + for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++) { graphic = element_info[i].direction_graphic[act][dir]; if (graphic > 0 && graphic_info[graphic].bitmap == NULL) @@ -508,7 +508,7 @@ void InitElementGraphicInfo() { for (act = 0; act < NUM_ACTIONS; act++) { - for (dir = 0; dir < NUM_DIRECTIONS; dir++) + for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++) { int graphic = element_info[i].direction_graphic[act][dir]; int move_dir = (act == ACTION_FALLING ? MV_BIT_DOWN : dir); @@ -566,8 +566,8 @@ void InitElementGraphicInfo() { int default_graphic = element_info[i].graphic[ACTION_DEFAULT]; int default_crumbled = element_info[i].crumbled[ACTION_DEFAULT]; - int default_direction_graphic[NUM_DIRECTIONS]; - int default_direction_crumbled[NUM_DIRECTIONS]; + int default_direction_graphic[NUM_DIRECTIONS_FULL]; + int default_direction_crumbled[NUM_DIRECTIONS_FULL]; if (default_graphic == -1) default_graphic = IMG_UNKNOWN; @@ -580,7 +580,7 @@ void InitElementGraphicInfo() default_crumbled = IMG_EMPTY; #endif - for (dir = 0; dir < NUM_DIRECTIONS; dir++) + for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++) { default_direction_graphic[dir] = element_info[i].direction_graphic[ACTION_DEFAULT][dir]; @@ -653,7 +653,7 @@ void InitElementGraphicInfo() default_action_crumbled = default_crumbled; #endif - for (dir = 0; dir < NUM_DIRECTIONS; dir++) + for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++) { /* use action graphic as the default direction graphic, if undefined */ int default_action_direction_graphic = element_info[i].graphic[act]; @@ -725,7 +725,7 @@ void InitElementGraphicInfo() if (graphic_info[crumbled].anim_frames == 1) graphic_info[crumbled].anim_mode = ANIM_NONE; - for (dir = 0; dir < NUM_DIRECTIONS; dir++) + for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++) { graphic = element_info[i].direction_graphic[act][dir]; crumbled = element_info[i].direction_crumbled[act][dir]; @@ -4133,7 +4133,7 @@ static void InitArtworkConfig() static char *sound_id_prefix[2 * MAX_NUM_ELEMENTS + 1]; static char *music_id_prefix[NUM_MUSIC_PREFIXES + 1]; static char *action_id_suffix[NUM_ACTIONS + 1]; - static char *direction_id_suffix[NUM_DIRECTIONS + 1]; + static char *direction_id_suffix[NUM_DIRECTIONS_FULL + 1]; static char *special_id_suffix[NUM_SPECIAL_GFX_ARGS + 1]; static char *level_id_suffix[MAX_LEVELS + 1]; static char *dummy[1] = { NULL }; @@ -4207,9 +4207,9 @@ static void InitArtworkConfig() action_id_suffix[i] = element_action_info[i].suffix; action_id_suffix[NUM_ACTIONS] = NULL; - for (i = 0; i < NUM_DIRECTIONS; i++) + for (i = 0; i < NUM_DIRECTIONS_FULL; i++) direction_id_suffix[i] = element_direction_info[i].suffix; - direction_id_suffix[NUM_DIRECTIONS] = NULL; + direction_id_suffix[NUM_DIRECTIONS_FULL] = NULL; for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) special_id_suffix[i] = special_suffix_info[i].suffix; diff --git a/src/libgame/system.h b/src/libgame/system.h index a164fbe2..3fd6798d 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -95,6 +95,14 @@ #define NUM_DIRECTIONS 4 +/* diagonal movement directions are used in a different contect than buttons */ +#define MV_BIT_UPLEFT 4 +#define MV_BIT_UPRIGHT 5 +#define MV_BIT_DOWNLEFT 6 +#define MV_BIT_DOWNRIGHT 7 + +#define NUM_DIRECTIONS_FULL 8 + /* values for special "button" bitmasks */ #define BUTTON_1 4 #define BUTTON_2 5 @@ -106,6 +114,11 @@ #define MV_UP (1 << MV_BIT_UP) #define MV_DOWN (1 << MV_BIT_DOWN) +#define MV_UPLEFT (MV_UP | MV_LEFT) +#define MV_UPRIGHT (MV_UP | MV_RIGHT) +#define MV_DOWNLEFT (MV_DOWN | MV_LEFT) +#define MV_DOWNRIGHT (MV_DOWN | MV_RIGHT) + #define MV_HORIZONTAL (MV_LEFT | MV_RIGHT) #define MV_VERTICAL (MV_UP | MV_DOWN) #define MV_ALL_DIRECTIONS (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN) @@ -118,15 +131,32 @@ #define KEY_BUTTON (KEY_BUTTON_1 | KEY_BUTTON_2) #define KEY_ACTION (KEY_MOTION | KEY_BUTTON) -#define MV_DIR_BIT(x) ((x) == MV_LEFT ? MV_BIT_LEFT : \ - (x) == MV_RIGHT ? MV_BIT_RIGHT : \ - (x) == MV_UP ? MV_BIT_UP : MV_BIT_DOWN) - -#define MV_DIR_OPPOSITE(x) ((x) == MV_LEFT ? MV_RIGHT : \ - (x) == MV_RIGHT ? MV_LEFT : \ - (x) == MV_UP ? MV_DOWN : \ - (x) == MV_DOWN ? MV_UP : MV_NONE) - +#define MV_DIR_FROM_BIT(x) ((x) < NUM_DIRECTIONS ? 1 << (x) : \ + (x) == MV_BIT_UPLEFT ? MV_UPLEFT : \ + (x) == MV_BIT_UPRIGHT ? MV_UPRIGHT : \ + (x) == MV_BIT_DOWNLEFT ? MV_DOWNLEFT : \ + (x) == MV_BIT_DOWNRIGHT ? MV_DOWNRIGHT : \ + MV_NONE) + +#define MV_DIR_TO_BIT(x) ((x) == MV_LEFT ? MV_BIT_LEFT : \ + (x) == MV_RIGHT ? MV_BIT_RIGHT : \ + (x) == MV_UP ? MV_BIT_UP : \ + (x) == MV_DOWN ? MV_BIT_DOWN : \ + (x) == MV_UPLEFT ? MV_BIT_UPLEFT : \ + (x) == MV_UPRIGHT ? MV_BIT_UPRIGHT : \ + (x) == MV_DOWNLEFT ? MV_BIT_DOWNLEFT : \ + (x) == MV_DOWNRIGHT ? MV_BIT_DOWNRIGHT : \ + MV_BIT_DOWN) + +#define MV_DIR_OPPOSITE(x) ((x) == MV_LEFT ? MV_RIGHT : \ + (x) == MV_RIGHT ? MV_LEFT : \ + (x) == MV_UP ? MV_DOWN : \ + (x) == MV_DOWN ? MV_UP : \ + (x) == MV_UPLEFT ? MV_DOWNRIGHT : \ + (x) == MV_UPRIGHT ? MV_DOWNLEFT : \ + (x) == MV_DOWNLEFT ? MV_UPRIGHT : \ + (x) == MV_DOWNRIGHT ? MV_UPLEFT : \ + MV_NONE) /* values for animation mode (frame order and direction) */ #define ANIM_NONE 0 diff --git a/src/main.c b/src/main.c index d62be79e..9c2a781c 100644 --- a/src/main.c +++ b/src/main.c @@ -4458,12 +4458,16 @@ struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] = { NULL, 0, 0 } }; -struct ElementDirectionInfo element_direction_info[NUM_DIRECTIONS + 1] = +struct ElementDirectionInfo element_direction_info[NUM_DIRECTIONS_FULL + 1] = { { ".left", MV_BIT_LEFT }, { ".right", MV_BIT_RIGHT }, { ".up", MV_BIT_UP }, { ".down", MV_BIT_DOWN }, + { ".upleft", MV_BIT_UP }, + { ".upright", MV_BIT_RIGHT }, + { ".downleft", MV_BIT_LEFT }, + { ".downright", MV_BIT_DOWN }, { NULL, 0 } }; diff --git a/src/main.h b/src/main.h index c131ffc0..c9948bf0 100644 --- a/src/main.h +++ b/src/main.h @@ -2161,11 +2161,11 @@ struct ElementInfo /* ---------- graphic and sound definitions ---------- */ int graphic[NUM_ACTIONS]; /* default graphics for several actions */ - int direction_graphic[NUM_ACTIONS][NUM_DIRECTIONS]; + int direction_graphic[NUM_ACTIONS][NUM_DIRECTIONS_FULL]; /* special graphics for left/right/up/down */ int crumbled[NUM_ACTIONS]; /* crumbled graphics for several actions */ - int direction_crumbled[NUM_ACTIONS][NUM_DIRECTIONS]; + int direction_crumbled[NUM_ACTIONS][NUM_DIRECTIONS_FULL]; /* crumbled graphics for left/right/up/down */ int special_graphic[NUM_SPECIAL_GFX_ARGS]; diff --git a/src/screens.c b/src/screens.c index fbedf9c4..ae2843a1 100644 --- a/src/screens.c +++ b/src/screens.c @@ -887,7 +887,7 @@ static char *getHelpText(int element, int action, int direction) strcat(token, element_action_info[action].suffix); if (direction != -1) - strcat(token, element_direction_info[MV_DIR_BIT(direction)].suffix); + strcat(token, element_direction_info[MV_DIR_TO_BIT(direction)].suffix); return getHashEntry(helptext_info, token); } diff --git a/src/tools.c b/src/tools.c index 62dda7ed..f382840a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -3336,11 +3336,11 @@ em_object_mapping_list[] = }, { Yandroid_ne, FALSE, FALSE, - EL_EMC_ANDROID, ACTION_TURNING_FROM_UP, MV_BIT_RIGHT + EL_EMC_ANDROID, ACTION_GROWING, MV_BIT_UPRIGHT }, { Yandroid_neB, FALSE, TRUE, - EL_EMC_ANDROID, ACTION_TURNING_FROM_UP, MV_BIT_RIGHT + EL_EMC_ANDROID, ACTION_SHRINKING, MV_BIT_UPRIGHT }, { Yandroid_e, FALSE, FALSE, @@ -3352,11 +3352,11 @@ em_object_mapping_list[] = }, { Yandroid_se, FALSE, FALSE, - EL_EMC_ANDROID, ACTION_TURNING_FROM_DOWN, MV_BIT_RIGHT + EL_EMC_ANDROID, ACTION_GROWING, MV_BIT_DOWNRIGHT }, { Yandroid_seB, FALSE, TRUE, - EL_EMC_ANDROID, ACTION_TURNING_FROM_DOWN, MV_BIT_RIGHT + EL_EMC_ANDROID, ACTION_SHRINKING, MV_BIT_DOWNRIGHT }, { Yandroid_s, FALSE, FALSE, @@ -3368,11 +3368,11 @@ em_object_mapping_list[] = }, { Yandroid_sw, FALSE, FALSE, - EL_EMC_ANDROID, ACTION_TURNING_FROM_DOWN, MV_BIT_LEFT + EL_EMC_ANDROID, ACTION_GROWING, MV_BIT_DOWNLEFT }, { Yandroid_swB, FALSE, TRUE, - EL_EMC_ANDROID, ACTION_TURNING_FROM_DOWN, MV_BIT_LEFT + EL_EMC_ANDROID, ACTION_SHRINKING, MV_BIT_DOWNLEFT }, { Yandroid_w, FALSE, FALSE, @@ -3384,11 +3384,11 @@ em_object_mapping_list[] = }, { Yandroid_nw, FALSE, FALSE, - EL_EMC_ANDROID, ACTION_TURNING_FROM_UP, MV_BIT_LEFT + EL_EMC_ANDROID, ACTION_GROWING, MV_BIT_UPLEFT }, { Yandroid_nwB, FALSE, TRUE, - EL_EMC_ANDROID, ACTION_TURNING_FROM_UP, MV_BIT_LEFT + EL_EMC_ANDROID, ACTION_SHRINKING, MV_BIT_UPLEFT }, { Xspring, TRUE, FALSE, @@ -5534,7 +5534,7 @@ int el_act_dir2img(int element, int action, int direction) if (direction == MV_NONE) return element_info[element].graphic[action]; - direction = MV_DIR_BIT(direction); + direction = MV_DIR_TO_BIT(direction); return element_info[element].direction_graphic[action][direction]; } @@ -5542,7 +5542,7 @@ int el_act_dir2img(int element, int action, int direction) int el_act_dir2img(int element, int action, int direction) { element = GFX_ELEMENT(element); - direction = MV_DIR_BIT(direction); /* default: MV_NONE => MV_DOWN */ + direction = MV_DIR_TO_BIT(direction); /* default: MV_NONE => MV_DOWN */ /* direction_graphic[][] == graphic[] for undefined direction graphics */ return element_info[element].direction_graphic[action][direction]; @@ -5557,7 +5557,7 @@ static int el_act_dir2crm(int element, int action, int direction) if (direction == MV_NONE) return element_info[element].crumbled[action]; - direction = MV_DIR_BIT(direction); + direction = MV_DIR_TO_BIT(direction); return element_info[element].direction_crumbled[action][direction]; } @@ -5565,7 +5565,7 @@ static int el_act_dir2crm(int element, int action, int direction) static int el_act_dir2crm(int element, int action, int direction) { element = GFX_ELEMENT(element); - direction = MV_DIR_BIT(direction); /* default: MV_NONE => MV_DOWN */ + direction = MV_DIR_TO_BIT(direction); /* default: MV_NONE => MV_DOWN */ /* direction_graphic[][] == graphic[] for undefined direction graphics */ return element_info[element].direction_crumbled[action][direction]; @@ -5695,7 +5695,8 @@ void InitGraphicInfo_EM(void) object_mapping[e].action = em_object_mapping_list[i].action; if (em_object_mapping_list[i].direction != -1) - object_mapping[e].direction = (1 << em_object_mapping_list[i].direction); + object_mapping[e].direction = + MV_DIR_FROM_BIT(em_object_mapping_list[i].direction); } for (i = 0; em_player_mapping_list[i].action_em != -1; i++) @@ -5710,7 +5711,7 @@ void InitGraphicInfo_EM(void) if (em_player_mapping_list[i].direction != -1) player_mapping[p][a].direction = - (1 << em_player_mapping_list[i].direction); + MV_DIR_FROM_BIT(em_player_mapping_list[i].direction); } for (i = 0; i < TILE_MAX; i++) @@ -6026,6 +6027,13 @@ void InitGraphicInfo_EM(void) (i << 16) | (j << 12) | (g_em->width << 6) | g_em->height; #if DEBUG_EM_GFX + +#if 1 + /* skip check for EMC elements not contained in original EMC artwork */ + if (element == EL_EMC_FAKE_ACID) + continue; +#endif + if (g_em->bitmap != debug_bitmap || g_em->src_x != debug_src_x || g_em->src_y != debug_src_y ||