From 784245c2e4dd32b84cff6c6044380c7801cb5513 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 11 Jun 2004 04:02:35 +0200 Subject: [PATCH] rnd-20040611-1-src * fixed bug with wrong door state after trying to quickload empty tape * version number set to 3.1.1 * version 3.1.0 released --- CHANGES | 3 +++ ChangeLog | 9 +++++++ src/conftime.h | 2 +- src/editor.c | 5 +--- src/game.c | 58 +++++++++++++++++++++++++++++++++++++++++ src/main.h | 4 +-- src/tape.c | 22 +++++++++++----- src/tools.c | 70 ++++++++++++++++++++++++++++---------------------- src/tools.h | 18 ++++++------- 9 files changed, 138 insertions(+), 53 deletions(-) diff --git a/CHANGES b/CHANGES index 05c4210e..af8e379c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +Release Version 3.1.1 [?? ??? ????] +----------------------------------- + Release Version 3.1.0 [07 JUN 2004] ----------------------------------- - fixed obvious bug with wrong "Murphy" graphics (when digging etc.) diff --git a/ChangeLog b/ChangeLog index 0e836744..929c9f4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-06-11 + * fixed bug with wrong door state after trying to quickload empty tape + +2004-06-07 + * version number set to 3.1.1 + +2004-06-07 + * version 3.1.0 released + 2004-06-07 * fixed bug with crash when writing user levelinfo.conf the first time diff --git a/src/conftime.h b/src/conftime.h index 7e962cc6..10db8e49 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-06-07 01:56]" +#define COMPILE_DATE_STRING "[2004-06-11 03:48]" diff --git a/src/editor.c b/src/editor.c index 9236f0a9..e8a4d645 100644 --- a/src/editor.c +++ b/src/editor.c @@ -9401,9 +9401,6 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed) else { CloseDoor(DOOR_CLOSE_1); - BlitBitmap(bitmap_db_door, bitmap_db_door, - DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE, - DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); - OpenDoor(DOOR_OPEN_1); + OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); } } diff --git a/src/game.c b/src/game.c index 762035dc..6de0372c 100644 --- a/src/game.c +++ b/src/game.c @@ -27,6 +27,9 @@ /* EXPERIMENTAL STUFF */ #define USE_NEW_AMOEBA_CODE FALSE +/* EXPERIMENTAL STUFF */ +#define USE_NEW_MOVEMENT FALSE + /* for DigField() */ #define DF_NO_PUSH 0 #define DF_DIG 1 @@ -5293,6 +5296,11 @@ void StartMoving(int x, int y) CheckCollision[x][y] = 0; +#if 0 + if (IS_PLAYER(x, y + 1)) + printf("::: we ARE now killing the player [%d]\n", FrameCounter); +#endif + Impact(x, y); } else if (IS_FREE(x, y + 1) && element == EL_SPRING && level.use_spring_bug) @@ -6368,9 +6376,24 @@ void ContinueMoving(int x, int y) else if (element == EL_PENGUIN) TestIfFriendTouchesBadThing(newx, newy); +#if USE_NEW_MOVEMENT +#if 0 + if (CAN_FALL(element) && direction == MV_DOWN && + (newy == lev_fieldy - 1 || !IS_FREE(x, newy + 1)) && + IS_PLAYER(x, newy + 1)) + printf("::: we would now kill the player [%d]\n", FrameCounter); +#endif + + /* give the player one last chance (one more frame) to move away */ + if (CAN_FALL(element) && direction == MV_DOWN && + (newy == lev_fieldy - 1 || !IS_FREE(x, newy + 1)) && + !IS_PLAYER(x, newy + 1)) + Impact(x, newy); +#else if (CAN_FALL(element) && direction == MV_DOWN && (newy == lev_fieldy - 1 || !IS_FREE(x, newy + 1))) Impact(x, newy); +#endif #if 1 if (pushed_by_player) @@ -9484,14 +9507,30 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) #else #if 1 + +#if 0 + printf("::: %d <= %d < %d ?\n", player->move_delay, FrameCounter, + player->move_delay + player->move_delay_value); +#endif + if (!FrameReached(&player->move_delay, player->move_delay_value)) + { +#if 0 + printf("::: can NOT move\n"); +#endif + return FALSE; + } #else if (!FrameReached(&player->move_delay, player->move_delay_value) && !(tape.playing && tape.file_version < FILE_VERSION_2_0)) return FALSE; #endif +#endif + +#if 0 + printf("::: COULD move now\n"); #endif /* store if player is automatically moved to next field */ @@ -9623,6 +9662,10 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) if (moved & MF_MOVING) { +#if 0 + printf("::: REALLY moves now\n"); +#endif + if (old_jx != jx && old_jy == jy) player->MovDir = (old_jx < jx ? MV_RIGHT : MV_LEFT); else if (old_jx == jx && old_jy != jy) @@ -9702,6 +9745,15 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) player->last_move_dir = MV_NO_MOVING; */ player->is_moving = FALSE; + +#if USE_NEW_MOVEMENT + /* player is ALLOWED to move, but CANNOT move (something blocks his way) */ + /* ensure that the player is also allowed to move in the next frame */ + /* (currently, the player is forced to wait eight frames before he can try + again!!!) */ + + player->move_delay = -1; /* allow direct movement in the next frame */ +#endif } if (game.engine_version < VERSION_IDENT(3,0,7,0)) @@ -9730,8 +9782,14 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) player->actual_frame_counter = FrameCounter; player->GfxPos = move_stepsize * (player->MovPos / move_stepsize); +#if USE_NEW_MOVEMENT + if (player->block_last_field && + Feld[last_jx][last_jy] == EL_EMPTY) + Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING; +#else if (Feld[last_jx][last_jy] == EL_EMPTY) Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING; +#endif #if 0 DrawPlayer(player); diff --git a/src/main.h b/src/main.h index 0bf9a365..b4c3c495 100644 --- a/src/main.h +++ b/src/main.h @@ -1269,8 +1269,8 @@ #define PROGRAM_VERSION_MAJOR 3 #define PROGRAM_VERSION_MINOR 1 -#define PROGRAM_VERSION_PATCH 0 -#define PROGRAM_VERSION_BUILD 5 +#define PROGRAM_VERSION_PATCH 1 +#define PROGRAM_VERSION_BUILD 0 #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel" diff --git a/src/tape.c b/src/tape.c index 66ca33c0..6b1b011c 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1152,13 +1152,19 @@ void TapeQuickSave() void TapeQuickLoad() { + char *filename = getTapeFilename(level_nr); + + if (!fileExists(filename)) + { + Request("No tape for this level !", REQ_CONFIRM); + + return; + } + if (tape.recording && !Request("Stop recording and load tape ?", REQ_ASK | REQ_STAY_CLOSED)) { - BlitBitmap(bitmap_db_door, bitmap_db_door, - DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, - DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); - OpenDoor(DOOR_OPEN_1); + OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); return; } @@ -1176,8 +1182,12 @@ void TapeQuickLoad() tape.quick_resume = TRUE; } - else - Request("No tape for this level !", REQ_CONFIRM); + else /* this should not happen (basically checked above) */ + { + int reopen_door = (game_status == GAME_MODE_PLAYING ? REQ_REOPEN : 0); + + Request("No tape for this level !", REQ_CONFIRM | reopen_door); + } } } diff --git a/src/tools.c b/src/tools.c index 68bac2ef..f714b184 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2116,7 +2116,7 @@ boolean Request(char *text, unsigned int req_state) /* pause network game while waiting for request to answer */ if (options.network && game_status == GAME_MODE_PLAYING && - req_state & REQUEST_WAIT_FOR) + req_state & REQUEST_WAIT_FOR_INPUT) SendToServer_PausePlaying(); #endif @@ -2128,12 +2128,15 @@ boolean Request(char *text, unsigned int req_state) UnmapAllGadgets(); - CloseDoor(DOOR_CLOSE_1); + if (old_door_state & DOOR_OPEN_1) + { + CloseDoor(DOOR_CLOSE_1); - /* save old door content */ - BlitBitmap(bitmap_db_door, bitmap_db_door, - DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, - DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1); + /* save old door content */ + BlitBitmap(bitmap_db_door, bitmap_db_door, + DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, + DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1); + } SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1); @@ -2206,7 +2209,7 @@ boolean Request(char *text, unsigned int req_state) ClearEventQueue(); #endif - if (!(req_state & REQUEST_WAIT_FOR)) + if (!(req_state & REQUEST_WAIT_FOR_INPUT)) { SetDrawBackgroundMask(REDRAW_FIELD); @@ -2350,13 +2353,9 @@ boolean Request(char *text, unsigned int req_state) { CloseDoor(DOOR_CLOSE_1); - if (!(req_state & REQ_STAY_CLOSED) && (old_door_state & DOOR_OPEN_1)) - { - BlitBitmap(bitmap_db_door, bitmap_db_door, - DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, - DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); - OpenDoor(DOOR_OPEN_1); - } + if (((old_door_state & DOOR_OPEN_1) && !(req_state & REQ_STAY_CLOSED)) || + (req_state & REQ_REOPEN)) + OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); } RemapAllGadgets(); @@ -2367,7 +2366,7 @@ boolean Request(char *text, unsigned int req_state) /* continue network game after request */ if (options.network && game_status == GAME_MODE_PLAYING && - req_state & REQUEST_WAIT_FOR) + req_state & REQUEST_WAIT_FOR_INPUT) SendToServer_ContinuePlaying(); #endif @@ -2382,33 +2381,42 @@ boolean Request(char *text, unsigned int req_state) unsigned int OpenDoor(unsigned int door_state) { - unsigned int new_door_state; - if (door_state & DOOR_COPY_BACK) { - BlitBitmap(bitmap_db_door, bitmap_db_door, - DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE + VYSIZE, - DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); + if (door_state & DOOR_OPEN_1) + BlitBitmap(bitmap_db_door, bitmap_db_door, + DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, + DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); + + if (door_state & DOOR_OPEN_2) + BlitBitmap(bitmap_db_door, bitmap_db_door, + DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY2, VXSIZE, VYSIZE, + DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2); + door_state &= ~DOOR_COPY_BACK; } - new_door_state = MoveDoor(door_state); - - return(new_door_state); + return MoveDoor(door_state); } unsigned int CloseDoor(unsigned int door_state) { - unsigned int new_door_state; + unsigned int old_door_state = GetDoorState(); - BlitBitmap(backbuffer, bitmap_db_door, - DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); - BlitBitmap(backbuffer, bitmap_db_door, - VX, VY, VXSIZE, VYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2); + if (!(door_state & DOOR_NO_COPY_BACK)) + { + if (old_door_state & DOOR_OPEN_1) + BlitBitmap(backbuffer, bitmap_db_door, + DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); - new_door_state = MoveDoor(door_state); + if (old_door_state & DOOR_OPEN_2) + BlitBitmap(backbuffer, bitmap_db_door, + VX, VY, VXSIZE, VYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2); + + door_state &= ~DOOR_NO_COPY_BACK; + } - return(new_door_state); + return MoveDoor(door_state); } unsigned int GetDoorState() @@ -2503,7 +2511,7 @@ unsigned int MoveDoor(unsigned int door_state) { BlitBitmap(bitmap_db_door, drawto, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1 + i / 2, - DXSIZE,DYSIZE - i / 2, DX, DY); + DXSIZE, DYSIZE - i / 2, DX, DY); ClearRectangle(drawto, DX, DY + DYSIZE - i / 2, DXSIZE, i / 2); } diff --git a/src/tools.h b/src/tools.h index 022473a9..373ded53 100644 --- a/src/tools.h +++ b/src/tools.h @@ -43,20 +43,20 @@ #define DOOR_ACTION_2 (DOOR_OPEN_2 | DOOR_CLOSE_2) #define DOOR_ACTION (DOOR_ACTION_1 | DOOR_ACTION_2) #define DOOR_COPY_BACK (1 << 4) -#define DOOR_NO_DELAY (1 << 5) -#define DOOR_GET_STATE (1 << 6) -#define DOOR_SET_STATE (1 << 7) +#define DOOR_NO_COPY_BACK (1 << 5) +#define DOOR_NO_DELAY (1 << 6) +#define DOOR_GET_STATE (1 << 7) +#define DOOR_SET_STATE (1 << 8) /* for Request */ #define REQ_ASK (1 << 0) -#define REQ_OPEN (1 << 1) -#define REQ_CLOSE (1 << 2) -#define REQ_CONFIRM (1 << 3) +#define REQ_CONFIRM (1 << 1) +#define REQ_PLAYER (1 << 2) +#define REQ_STAY_OPEN (1 << 3) #define REQ_STAY_CLOSED (1 << 4) -#define REQ_STAY_OPEN (1 << 5) -#define REQ_PLAYER (1 << 6) +#define REQ_REOPEN (1 << 5) -#define REQUEST_WAIT_FOR (REQ_ASK | REQ_CONFIRM | REQ_PLAYER) +#define REQUEST_WAIT_FOR_INPUT (REQ_ASK | REQ_CONFIRM | REQ_PLAYER) void DumpTile(int, int); -- 2.34.1