From: Holger Schemel Date: Tue, 16 Mar 2004 20:13:27 +0000 (+0100) Subject: rnd-20040316-2-src X-Git-Tag: 3.1.0^2~47 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ac957b4b971616010f690fa00dd9b2b910520163;p=rocksndiamonds.git rnd-20040316-2-src * added option "no scrolling when relocating" for instant teleporting --- diff --git a/ChangeLog b/ChangeLog index c0b1940a..21e28ba2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2004-03-16 + * added option "no scrolling when relocating" for instant teleporting + 2004-03-15 * added trigger element and trigger player to use as target elements * added copy and paste editor functions for custom and group elements @@ -19,7 +22,7 @@ 2004-03-08 * fixed totally broken (every 8th frame skipped) step-by-step recording * fixed bug with requester not displayed when quick-loading interrupted - * added option "can fall into acid (with gravity)" for player elements + * added option "can fall into acid (with gravity)" for players * fixed bug with player not falling when snapping down with gravity 2004-03-07 diff --git a/src/conftime.h b/src/conftime.h index 434376c9..f6f56cff 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-03-16 03:44]" +#define COMPILE_DATE_STRING "[2004-03-16 21:11]" diff --git a/src/editor.c b/src/editor.c index 2627994b..bbe1d19d 100644 --- a/src/editor.c +++ b/src/editor.c @@ -524,33 +524,34 @@ #define GADGET_ID_USE_SPRING_BUG (GADGET_ID_CHECKBUTTON_FIRST + 7) #define GADGET_ID_BLOCK_LAST_FIELD (GADGET_ID_CHECKBUTTON_FIRST + 8) #define GADGET_ID_SP_BLOCK_LAST_FIELD (GADGET_ID_CHECKBUTTON_FIRST + 9) -#define GADGET_ID_CAN_FALL_INTO_ACID (GADGET_ID_CHECKBUTTON_FIRST + 10) -#define GADGET_ID_CAN_MOVE_INTO_ACID (GADGET_ID_CHECKBUTTON_FIRST + 11) -#define GADGET_ID_DONT_COLLIDE_WITH (GADGET_ID_CHECKBUTTON_FIRST + 12) -#define GADGET_ID_CUSTOM_EXPLODE_RESULT (GADGET_ID_CHECKBUTTON_FIRST + 13) -#define GADGET_ID_CUSTOM_EXPLODE_FIRE (GADGET_ID_CHECKBUTTON_FIRST + 14) -#define GADGET_ID_CUSTOM_EXPLODE_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 15) -#define GADGET_ID_CUSTOM_EXPLODE_IMPACT (GADGET_ID_CHECKBUTTON_FIRST + 16) -#define GADGET_ID_CUSTOM_WALK_TO_OBJECT (GADGET_ID_CHECKBUTTON_FIRST + 17) -#define GADGET_ID_CUSTOM_DEADLY (GADGET_ID_CHECKBUTTON_FIRST + 18) -#define GADGET_ID_CUSTOM_CAN_MOVE (GADGET_ID_CHECKBUTTON_FIRST + 19) -#define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 20) -#define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 21) -#define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 22) -#define GADGET_ID_CUSTOM_ACCESSIBLE (GADGET_ID_CHECKBUTTON_FIRST + 23) -#define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 24) -#define GADGET_ID_CUSTOM_USE_TEMPLATE (GADGET_ID_CHECKBUTTON_FIRST + 25) -#define GADGET_ID_CUSTOM_CAN_CHANGE (GADGET_ID_CHECKBUTTON_FIRST + 26) -#define GADGET_ID_CHANGE_USE_CONTENT (GADGET_ID_CHECKBUTTON_FIRST + 27) -#define GADGET_ID_CHANGE_USE_EXPLOSION (GADGET_ID_CHECKBUTTON_FIRST + 28) -#define GADGET_ID_CHANGE_ONLY_COMPLETE (GADGET_ID_CHECKBUTTON_FIRST + 29) -#define GADGET_ID_CHANGE_USE_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 30) -#define GADGET_ID_CHANGE_DELAY (GADGET_ID_CHECKBUTTON_FIRST + 31) -#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 32) -#define GADGET_ID_CHANGE_BY_OTHER_ACT (GADGET_ID_CHECKBUTTON_FIRST + 33) +#define GADGET_ID_INSTANT_RELOCATION (GADGET_ID_CHECKBUTTON_FIRST + 10) +#define GADGET_ID_CAN_FALL_INTO_ACID (GADGET_ID_CHECKBUTTON_FIRST + 11) +#define GADGET_ID_CAN_MOVE_INTO_ACID (GADGET_ID_CHECKBUTTON_FIRST + 12) +#define GADGET_ID_DONT_COLLIDE_WITH (GADGET_ID_CHECKBUTTON_FIRST + 13) +#define GADGET_ID_CUSTOM_EXPLODE_RESULT (GADGET_ID_CHECKBUTTON_FIRST + 14) +#define GADGET_ID_CUSTOM_EXPLODE_FIRE (GADGET_ID_CHECKBUTTON_FIRST + 15) +#define GADGET_ID_CUSTOM_EXPLODE_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 16) +#define GADGET_ID_CUSTOM_EXPLODE_IMPACT (GADGET_ID_CHECKBUTTON_FIRST + 17) +#define GADGET_ID_CUSTOM_WALK_TO_OBJECT (GADGET_ID_CHECKBUTTON_FIRST + 18) +#define GADGET_ID_CUSTOM_DEADLY (GADGET_ID_CHECKBUTTON_FIRST + 19) +#define GADGET_ID_CUSTOM_CAN_MOVE (GADGET_ID_CHECKBUTTON_FIRST + 20) +#define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 21) +#define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 22) +#define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 23) +#define GADGET_ID_CUSTOM_ACCESSIBLE (GADGET_ID_CHECKBUTTON_FIRST + 24) +#define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 25) +#define GADGET_ID_CUSTOM_USE_TEMPLATE (GADGET_ID_CHECKBUTTON_FIRST + 26) +#define GADGET_ID_CUSTOM_CAN_CHANGE (GADGET_ID_CHECKBUTTON_FIRST + 27) +#define GADGET_ID_CHANGE_USE_CONTENT (GADGET_ID_CHECKBUTTON_FIRST + 28) +#define GADGET_ID_CHANGE_USE_EXPLOSION (GADGET_ID_CHECKBUTTON_FIRST + 29) +#define GADGET_ID_CHANGE_ONLY_COMPLETE (GADGET_ID_CHECKBUTTON_FIRST + 30) +#define GADGET_ID_CHANGE_USE_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 31) +#define GADGET_ID_CHANGE_DELAY (GADGET_ID_CHECKBUTTON_FIRST + 32) +#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 33) +#define GADGET_ID_CHANGE_BY_OTHER_ACT (GADGET_ID_CHECKBUTTON_FIRST + 34) /* gadgets for buttons in element list */ -#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 34) +#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 35) #define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \ ED_NUM_ELEMENTLIST_BUTTONS - 1) @@ -718,32 +719,33 @@ #define ED_CHECKBUTTON_ID_USE_SPRING_BUG 5 #define ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD 6 #define ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD 7 -#define ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID 8 -#define ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID 9 -#define ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH 10 -#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC 11 -#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE 12 -#define ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE 13 -#define ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT 14 -#define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE 15 -#define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL 16 -#define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH 17 -#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 18 -#define ED_CHECKBUTTON_ID_CUSTOM_DEADLY 19 -#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_RESULT 20 -#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE 21 -#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH 22 -#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT 23 -#define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE 24 -#define ED_CHECKBUTTON_ID_CHANGE_DELAY 25 -#define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT 26 -#define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT 27 -#define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION 28 -#define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT 29 -#define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE 30 -#define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM 31 - -#define ED_NUM_CHECKBUTTONS 32 +#define ED_CHECKBUTTON_ID_INSTANT_RELOCATION 8 +#define ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID 9 +#define ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID 10 +#define ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH 11 +#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC 12 +#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE 13 +#define ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE 14 +#define ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT 15 +#define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE 16 +#define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL 17 +#define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH 18 +#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 19 +#define ED_CHECKBUTTON_ID_CUSTOM_DEADLY 20 +#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_RESULT 21 +#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE 22 +#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH 23 +#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT 24 +#define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE 25 +#define ED_CHECKBUTTON_ID_CHANGE_DELAY 26 +#define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT 27 +#define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT 28 +#define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION 29 +#define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT 30 +#define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE 31 +#define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM 32 + +#define ED_NUM_CHECKBUTTONS 33 #define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_DOUBLE_SPEED #define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED @@ -1957,6 +1959,13 @@ static struct NULL, "block last field when moving", "player blocks last field when moving" }, + { + ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(2), + GADGET_ID_INSTANT_RELOCATION, GADGET_ID_NONE, + &level.instant_relocation, + NULL, + "no scrolling when relocating", "player gets relocated without delay" + }, { ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(0), GADGET_ID_CAN_FALL_INTO_ACID, GADGET_ID_NONE, @@ -6959,6 +6968,7 @@ static void DrawPropertiesConfig() MapCheckbuttonGadget(properties_element == EL_SP_MURPHY ? ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD : ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD); + MapCheckbuttonGadget(ED_CHECKBUTTON_ID_INSTANT_RELOCATION); } if (IS_GEM(properties_element)) diff --git a/src/files.c b/src/files.c index 56427a0a..dcb08760 100644 --- a/src/files.c +++ b/src/files.c @@ -29,7 +29,7 @@ #define CHUNK_SIZE_NONE -1 /* do not write chunk size */ #define FILE_VERS_CHUNK_SIZE 8 /* size of file version chunk */ #define LEVEL_HEADER_SIZE 80 /* size of level file header */ -#define LEVEL_HEADER_UNUSED 4 /* unused level header bytes */ +#define LEVEL_HEADER_UNUSED 3 /* unused level header bytes */ #define LEVEL_CHUNK_CNT2_SIZE 160 /* size of level CNT2 chunk */ #define LEVEL_CHUNK_CNT2_UNUSED 11 /* unused CNT2 chunk bytes */ #define LEVEL_CHUNK_CNT3_HEADER 16 /* size of level CNT3 header */ @@ -159,6 +159,7 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) level->em_slippery_gems = FALSE; level->block_last_field = FALSE; level->sp_block_last_field = TRUE; + level->instant_relocation = FALSE; level->can_move_into_acid_bits = ~0; /* everything can move into acid */ level->dont_collide_with_bits = ~0; /* always deadly when colliding */ @@ -691,6 +692,8 @@ static int LoadLevel_HEAD(FILE *file, int chunk_size, struct LevelInfo *level) level->use_spring_bug = (getFile8Bit(file) == 1 ? TRUE : FALSE); level->use_step_counter = (getFile8Bit(file) == 1 ? TRUE : FALSE); + level->instant_relocation = (getFile8Bit(file) == 1 ? TRUE : FALSE); + ReadUnusedBytesFromFile(file, LEVEL_HEADER_UNUSED); return chunk_size; @@ -2425,6 +2428,8 @@ static void SaveLevel_HEAD(FILE *file, struct LevelInfo *level) putFile8Bit(file, (level->use_spring_bug ? 1 : 0)); putFile8Bit(file, (level->use_step_counter ? 1 : 0)); + putFile8Bit(file, (level->instant_relocation ? 1 : 0)); + WriteUnusedBytesToFile(file, LEVEL_HEADER_UNUSED); } diff --git a/src/game.c b/src/game.c index a37659ec..2e4bc054 100644 --- a/src/game.c +++ b/src/game.c @@ -2613,17 +2613,13 @@ void RelocatePlayer(int x, int y, int element_raw) boolean no_delay = (tape.index_search); int frame_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay); int wait_delay_value = (no_delay ? 0 : frame_delay_value); -#if 1 int old_jx, old_jy; -#endif if (player->GameOver) /* do not reanimate dead player */ return; -#if 1 RemoveField(x, y); /* temporarily remove newly placed player */ DrawLevelField(x, y); -#endif if (player->present) { @@ -2645,19 +2641,17 @@ void RelocatePlayer(int x, int y, int element_raw) player->is_moving = FALSE; } -#if 1 old_jx = player->jx; old_jy = player->jy; -#endif Feld[x][y] = element; InitPlayerField(x, y, element, TRUE); -#if 0 - if (player == local_player) - { -#if 1 + if (player != local_player) /* do not visually relocate other players */ + return; + if (level.instant_relocation) + { scroll_x += (local_player->jx - old_jx); scroll_y += (local_player->jy - old_jy); @@ -2669,29 +2663,14 @@ void RelocatePlayer(int x, int y, int element_raw) if (scroll_y < SBY_Upper || scroll_y > SBY_Lower) scroll_y = (scroll_y < SBY_Upper ? SBY_Upper : SBY_Lower); -#else - scroll_x = (local_player->jx < SBX_Left + MIDPOSX ? SBX_Left : - local_player->jx > SBX_Right + MIDPOSX ? SBX_Right : - local_player->jx - MIDPOSX); - - scroll_y = (local_player->jy < SBY_Upper + MIDPOSY ? SBY_Upper : - local_player->jy > SBY_Lower + MIDPOSY ? SBY_Lower : - local_player->jy - MIDPOSY); -#endif - RedrawPlayfield(TRUE, 0,0,0,0); -#if 0 - DrawAllPlayers(); - BackToFront(); -#endif } - -#else - - if (player == local_player) + else { int scroll_xx = -999, scroll_yy = -999; + ScrollScreen(NULL, SCROLL_GO_ON); /* scroll last frame to full tile */ + while (scroll_xx != scroll_x || scroll_yy != scroll_y) { int dx = 0, dy = 0; @@ -2708,6 +2687,14 @@ void RelocatePlayer(int x, int y, int element_raw) dx = (scroll_xx < scroll_x ? +1 : scroll_xx > scroll_x ? -1 : 0); dy = (scroll_yy < scroll_y ? +1 : scroll_yy > scroll_y ? -1 : 0); +#if 1 + if (dx == 0 && dy == 0) /* no scrolling needed at all */ + break; +#else + if (scroll_xx == scroll_x && scroll_yy == scroll_y) + break; +#endif + scroll_x -= dx; scroll_y -= dy; @@ -2727,7 +2714,6 @@ void RelocatePlayer(int x, int y, int element_raw) Delay(wait_delay_value); } } -#endif } void Explode(int ex, int ey, int phase, int mode) @@ -8792,7 +8778,8 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) player->is_dropping = FALSE; -#if 1 +#if 0 + /* !!! ENABLE THIS FOR OLD VERSIONS !!! */ { static int trigger_sides[4][2] = { @@ -8941,8 +8928,9 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) player->LevelSolved = player->GameOver = TRUE; } -#if 0 +#if 1 /* !!! ENABLE THIS FOR NEW VERSIONS !!! */ + /* this breaks one level: "machine", level 000 */ { static int trigger_sides[4][2] = { diff --git a/src/main.h b/src/main.h index fd13bc90..44c50597 100644 --- a/src/main.h +++ b/src/main.h @@ -1444,7 +1444,9 @@ struct LevelInfo boolean block_last_field; /* player blocks previous field while moving */ boolean sp_block_last_field; /* player blocks previous field while moving */ boolean use_spring_bug; /* for compatibility with old levels */ + boolean instant_relocation; /* no visual delay when relocating player */ + /* ('int' instead of 'boolean' because used as selectbox value in editor) */ int use_step_counter; /* count steps instead of seconds for level */ short field[MAX_LEV_FIELDX][MAX_LEV_FIELDY];