From: Holger Schemel Date: Sun, 2 May 2004 22:33:20 +0000 (+0200) Subject: rnd-20040503-1-src X-Git-Tag: 3.1.0^2~9 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0cb7e467765fe1ac2797cb58c069fcca56d43877;p=rocksndiamonds.git rnd-20040503-1-src * fixed bug with creating walkable custom element under player (again) * fixed bug with not copying explosion type when copying CEs in editor * fixed graphical bug when drawing player in setup menu (input devices) * fixed graphical bug when the player is pushing an accessible element * fixed bug with classic switchable elements triggering CE changes * fixed bug with entering/leaving walkable element in RelocatePlayer() * added special behaviour of Supaplex ports with gravity enabled * fixed bug with broken tubes after placing/exploding dynamite in them * fixed bug with exploding dynamite under player due to other explosion --- diff --git a/ChangeLog b/ChangeLog index bb065a92..91719802 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-05-02 + * fixed bug with creating walkable custom element under player (again) + * fixed bug with not copying explosion type when copying CEs in editor + * fixed graphical bug when drawing player in setup menu (input devices) + * fixed graphical bug when the player is pushing an accessible element + * fixed bug with classic switchable elements triggering CE changes + * fixed bug with entering/leaving walkable element in RelocatePlayer() + * added special behaviour of Supaplex ports with gravity enabled + +2004-04-30 + * fixed bug with broken tubes after placing/exploding dynamite in them + * fixed bug with exploding dynamite under player due to other explosion + 2004-04-27 * added option "handicap" for "levelinfo.conf" (thanks to Niko Böhm) * added network multiplayer code for Windows (thanks to Niko Böhm) diff --git a/src/conftime.h b/src/conftime.h index 273c2edd..878eea86 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-04-30 08:31]" +#define COMPILE_DATE_STRING "[2004-05-02 19:17]" diff --git a/src/editor.c b/src/editor.c index a544dfa1..17f95fde 100644 --- a/src/editor.c +++ b/src/editor.c @@ -5651,6 +5651,7 @@ static void copy_custom_element_settings(int element_from, int element_to) for (x = 0; x < 3; x++) ei_to->content[x][y] = ei_from->content[x][y]; + ei_to->explosion_type = ei_from->explosion_type; ei_to->explosion_delay = ei_from->explosion_delay; ei_to->ignition_delay = ei_from->ignition_delay; diff --git a/src/files.c b/src/files.c index b3350860..fa71b177 100644 --- a/src/files.c +++ b/src/files.c @@ -248,6 +248,7 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) element_info[element].move_pattern = MV_ALL_DIRECTIONS; element_info[element].move_direction_initial = MV_START_AUTOMATIC; element_info[element].move_stepsize = TILEX / 8; + element_info[element].move_enter_element = EL_EMPTY_SPACE; element_info[element].move_leave_element = EL_EMPTY_SPACE; element_info[element].move_leave_type = LEAVE_TYPE_UNLIMITED; diff --git a/src/game.c b/src/game.c index da79bbf9..467603a8 100644 --- a/src/game.c +++ b/src/game.c @@ -2830,6 +2830,14 @@ void RelocatePlayer(int jx, int jy, int el_player_raw) int element = Feld[jx][jy]; boolean player_relocated = (old_jx != jx || old_jy != jy); + int move_dir_horiz = (jx < old_jx ? MV_LEFT : jx > old_jx ? MV_RIGHT : 0); + int move_dir_vert = (jy < old_jy ? MV_UP : jy > old_jy ? MV_DOWN : 0); +#if 1 + int enter_side_horiz = MV_DIR_OPPOSITE(move_dir_horiz); + int enter_side_vert = MV_DIR_OPPOSITE(move_dir_vert); + int leave_side_horiz = move_dir_horiz; + int leave_side_vert = move_dir_vert; +#else static int trigger_sides[4][2] = { /* enter side leave side */ @@ -2838,13 +2846,12 @@ void RelocatePlayer(int jx, int jy, int el_player_raw) { CH_SIDE_BOTTOM, CH_SIDE_TOP }, /* moving up */ { CH_SIDE_TOP, CH_SIDE_BOTTOM } /* moving down */ }; - int move_dir_horiz = (jx < old_jx ? MV_LEFT : jx > old_jx ? MV_RIGHT : 0); - int move_dir_vert = (jy < old_jy ? MV_UP : jy > old_jy ? MV_DOWN : 0); int enter_side_horiz = trigger_sides[MV_DIR_BIT(move_dir_horiz)][0]; int enter_side_vert = trigger_sides[MV_DIR_BIT(move_dir_vert)][0]; - int enter_side = enter_side_horiz | enter_side_vert; int leave_side_horiz = trigger_sides[MV_DIR_BIT(move_dir_horiz)][1]; int leave_side_vert = trigger_sides[MV_DIR_BIT(move_dir_vert)][1]; +#endif + int enter_side = enter_side_horiz | enter_side_vert; int leave_side = leave_side_horiz | leave_side_vert; if (player->GameOver) /* do not reanimate dead player */ @@ -2914,6 +2921,14 @@ void RelocatePlayer(int jx, int jy, int el_player_raw) Changed[jx][jy] = 0; /* allow another change */ #endif +#if 0 + printf("::: player entering %d, %d from %s ...\n", jx, jy, + enter_side == MV_LEFT ? "left" : + enter_side == MV_RIGHT ? "right" : + enter_side == MV_UP ? "top" : + enter_side == MV_DOWN ? "bottom" : "oops! no idea!"); +#endif + #if 1 if (IS_CUSTOM_ELEMENT(element)) CheckElementChangeByPlayer(jx, jy, element, CE_ENTERED_BY_PLAYER, @@ -6296,6 +6311,9 @@ void ContinueMoving(int x, int y) #if 1 if (pushed_by_player) { +#if 1 + int dig_side = MV_DIR_OPPOSITE(direction); +#else static int trigger_sides[4] = { CH_SIDE_RIGHT, /* moving left */ @@ -6304,6 +6322,7 @@ void ContinueMoving(int x, int y) CH_SIDE_TOP, /* moving down */ }; int dig_side = trigger_sides[MV_DIR_BIT(direction)]; +#endif struct PlayerInfo *player = PLAYERINFO(x, y); CheckElementChangeByPlayer(newx, newy, element, CE_PUSHED_BY_PLAYER, @@ -7508,8 +7527,15 @@ static boolean ChangeElementNow(int x, int y, int element, int page) (IS_WALKABLE(e) && ELEM_IS_PLAYER(content_element) && !IS_MOVING(ex, ey) && !IS_BLOCKED(ex, ey))); #else + +#if 0 is_empty = (IS_FREE(ex, ey) || (IS_PLAYER(ex, ey) && IS_WALKABLE(content_element))); +#else + is_empty = (IS_FREE(ex, ey) || + (IS_FREE_OR_PLAYER(ex, ey) && IS_WALKABLE(content_element))); +#endif + #endif is_walkable = (is_empty || IS_WALKABLE(e)); is_diggable = (is_empty || IS_DIGGABLE(e)); @@ -9048,6 +9074,14 @@ static boolean canMoveToValidFieldWithGravity(int x, int y, int move_dir) int nexty = newy + dy; #endif +#if 1 + return (IN_LEV_FIELD(newx, newy) && !IS_FREE_OR_PLAYER(newx, newy) && + IS_GRAVITY_REACHABLE(Feld[newx][newy]) && + (!IS_SP_PORT(Feld[newx][newy]) || move_dir == MV_UP) && + (IS_DIGGABLE(Feld[newx][newy]) || + IS_WALKABLE_FROM(Feld[newx][newy], opposite_dir) || + canPassField(newx, newy, move_dir))); +#else #if 1 return (IN_LEV_FIELD(newx, newy) && !IS_FREE_OR_PLAYER(newx, newy) && IS_GRAVITY_REACHABLE(Feld[newx][newy]) && @@ -9071,6 +9105,7 @@ static boolean canMoveToValidFieldWithGravity(int x, int y, int move_dir) (level.can_pass_to_walkable || IS_FREE(nextx, nexty))))); #endif #endif +#endif } static void CheckGravityMovement(struct PlayerInfo *player) @@ -9525,6 +9560,11 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) if (game.engine_version < VERSION_IDENT(3,1,0,0)) #endif { + int move_direction = player->MovDir; +#if 1 + int enter_side = MV_DIR_OPPOSITE(move_direction); + int leave_side = move_direction; +#else static int trigger_sides[4][2] = { /* enter side leave side */ @@ -9533,9 +9573,9 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) { CH_SIDE_BOTTOM, CH_SIDE_TOP }, /* moving up */ { CH_SIDE_TOP, CH_SIDE_BOTTOM } /* moving down */ }; - int move_direction = player->MovDir; int enter_side = trigger_sides[MV_DIR_BIT(move_direction)][0]; int leave_side = trigger_sides[MV_DIR_BIT(move_direction)][1]; +#endif int old_element = Feld[old_jx][old_jy]; int new_element = Feld[jx][jy]; @@ -9680,6 +9720,11 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) if (game.engine_version >= VERSION_IDENT(3,1,0,0)) #endif { + int move_direction = player->MovDir; +#if 1 + int enter_side = MV_DIR_OPPOSITE(move_direction); + int leave_side = move_direction; +#else static int trigger_sides[4][2] = { /* enter side leave side */ @@ -9688,9 +9733,9 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) { CH_SIDE_BOTTOM, CH_SIDE_TOP }, /* moving up */ { CH_SIDE_TOP, CH_SIDE_BOTTOM } /* moving down */ }; - int move_direction = player->MovDir; int enter_side = trigger_sides[MV_DIR_BIT(move_direction)][0]; int leave_side = trigger_sides[MV_DIR_BIT(move_direction)][1]; +#endif int old_jx = last_jx; int old_jy = last_jy; int old_element = Feld[old_jx][old_jy]; @@ -10570,13 +10615,6 @@ int DigField(struct PlayerInfo *player, int oldx, int oldy, int x, int y, int real_dx, int real_dy, int mode) { - static int trigger_sides[4] = - { - CH_SIDE_RIGHT, /* moving left */ - CH_SIDE_LEFT, /* moving right */ - CH_SIDE_BOTTOM, /* moving up */ - CH_SIDE_TOP, /* moving down */ - }; #if 0 boolean use_spring_bug = (game.engine_version < VERSION_IDENT(2,2,0,0)); #endif @@ -10590,7 +10628,18 @@ int DigField(struct PlayerInfo *player, dy == -1 ? MV_UP : dy == +1 ? MV_DOWN : MV_NO_MOVING); int opposite_direction = MV_DIR_OPPOSITE(move_direction); +#if 1 + int dig_side = MV_DIR_OPPOSITE(move_direction); +#else + static int trigger_sides[4] = + { + CH_SIDE_RIGHT, /* moving left */ + CH_SIDE_LEFT, /* moving right */ + CH_SIDE_BOTTOM, /* moving up */ + CH_SIDE_TOP, /* moving down */ + }; int dig_side = trigger_sides[MV_DIR_BIT(move_direction)]; +#endif int old_element = Feld[jx][jy]; int element; @@ -11253,7 +11302,13 @@ int DigField(struct PlayerInfo *player, else if (IS_SWITCHABLE(element)) { if (PLAYER_SWITCHING(player, x, y)) + { + CheckTriggeredElementChangeByPlayer(x,y, element, + CE_OTHER_GETS_PRESSED, + player->index_bit, dig_side); + return MF_ACTION; + } player->is_switching = TRUE; player->switch_x = x; @@ -11340,6 +11395,13 @@ int DigField(struct PlayerInfo *player, #endif } + CheckTriggeredElementChangeByPlayer(x, y, element, + CE_OTHER_IS_SWITCHING, + player->index_bit, dig_side); + + CheckTriggeredElementChangeByPlayer(x,y, element,CE_OTHER_GETS_PRESSED, + player->index_bit, dig_side); + return MF_ACTION; } else @@ -11477,6 +11539,12 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) boolean DropElement(struct PlayerInfo *player) { + int old_element, new_element; + int dropx = player->jx, dropy = player->jy; + int drop_direction = player->MovDir; +#if 1 + int drop_side = drop_direction; +#else static int trigger_sides[4] = { CH_SIDE_LEFT, /* dropping left */ @@ -11484,10 +11552,8 @@ boolean DropElement(struct PlayerInfo *player) CH_SIDE_TOP, /* dropping up */ CH_SIDE_BOTTOM, /* dropping down */ }; - int old_element, new_element; - int dropx = player->jx, dropy = player->jy; - int drop_direction = player->MovDir; int drop_side = trigger_sides[MV_DIR_BIT(drop_direction)]; +#endif int drop_element = (player->inventory_size > 0 ? player->inventory_element[player->inventory_size - 1] : player->inventory_infinite_element != EL_UNDEFINED ? diff --git a/src/main.h b/src/main.h index b1c8303e..0c793a0b 100644 --- a/src/main.h +++ b/src/main.h @@ -1255,11 +1255,11 @@ #define PROGRAM_VERSION_MAJOR 3 #define PROGRAM_VERSION_MINOR 1 #define PROGRAM_VERSION_PATCH 0 -#define PROGRAM_VERSION_BUILD 3 +#define PROGRAM_VERSION_BUILD 4 #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel" -#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2003 by Holger Schemel" +#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2004 by Holger Schemel" #define ICON_TITLE_STRING PROGRAM_TITLE_STRING #define COOKIE_PREFIX "ROCKSNDIAMONDS" @@ -1689,6 +1689,7 @@ struct ElementInfo int move_pattern; /* direction movable element moves to */ int move_direction_initial; /* initial direction element moves to */ int move_stepsize; /* step size element moves with */ + int move_enter_element; /* element that can be entered (and removed) */ int move_leave_element; /* element that can be left behind */ int move_leave_type; /* change (limited) or leave (unlimited) */ diff --git a/src/screens.c b/src/screens.c index 2196c6e4..12901f03 100644 --- a/src/screens.c +++ b/src/screens.c @@ -2409,6 +2409,8 @@ static void drawPlayerSetupInputInfo(int player_nr) DrawText(mSX+11*32, mSY+2*32, int2str(player_nr +1, 1), FONT_INPUT_1_ACTIVE); #if 1 + ClearRectangleOnBackground(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY, + TILEX, TILEY); DrawGraphicThruMaskExt(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY, PLAYER_NR_GFX(IMG_PLAYER_1, player_nr), 0); #else diff --git a/src/tools.c b/src/tools.c index da54ef18..5ce30b1f 100644 --- a/src/tools.c +++ b/src/tools.c @@ -61,7 +61,7 @@ static char *print_if_not_empty(int element) void DumpTile(int x, int y) { int sx = SCREENX(x); - int sy = SCREENX(y); + int sy = SCREENY(y); printf_line("-", 79); printf("Field Info: SCREEN(%d, %d), LEVEL(%d, %d)\n", sx, sy, x, y); @@ -890,11 +890,27 @@ void DrawPlayer(struct PlayerInfo *player) /* draw elements the player is just walking/passing through/under */ /* ----------------------------------------------------------------------- */ - /* handle the field the player is leaving ... */ - if (player_is_moving && IS_ACCESSIBLE_INSIDE(last_element)) - DrawLevelField(last_jx, last_jy); - else if (player_is_moving && IS_ACCESSIBLE_UNDER(last_element)) - DrawLevelFieldThruMask(last_jx, last_jy); + if (player_is_moving) + { + /* handle the field the player is leaving ... */ + if (IS_ACCESSIBLE_INSIDE(last_element)) + DrawLevelField(last_jx, last_jy); + else if (IS_ACCESSIBLE_UNDER(last_element)) + DrawLevelFieldThruMask(last_jx, last_jy); + } + +#if 1 + /* do not redraw accessible elements if the player is just pushing them */ + if (!player_is_moving || !player->is_pushing) + { + /* ... and the field the player is entering */ + if (IS_ACCESSIBLE_INSIDE(element)) + DrawLevelField(jx, jy); + else if (IS_ACCESSIBLE_UNDER(element)) + DrawLevelFieldThruMask(jx, jy); + } + +#else #if 0 /* !!! I have forgotton what this should be good for !!! */ @@ -908,6 +924,7 @@ void DrawPlayer(struct PlayerInfo *player) else if (IS_ACCESSIBLE_UNDER(element)) DrawLevelFieldThruMask(jx, jy); } +#endif if (setup.direct_draw) { @@ -2880,7 +2897,7 @@ int get_next_element(int element) int el_act_dir2img(int element, int action, int direction) { element = GFX_ELEMENT(element); - direction = MV_DIR_BIT(direction); + direction = MV_DIR_BIT(direction); /* default: MV_NO_MOVING => MV_DOWN */ return element_info[element].direction_graphic[action][direction]; } @@ -2888,7 +2905,7 @@ int el_act_dir2img(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); + direction = MV_DIR_BIT(direction); /* default: MV_NO_MOVING => MV_DOWN */ return element_info[element].direction_crumbled[action][direction]; }