From: Holger Schemel Date: Thu, 18 Apr 2002 00:22:33 +0000 (+0200) Subject: rnd-20020418-1-src X-Git-Tag: 2.1.0^2~57 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=4e3bc17b6150a17a76cba2da2daa96af65bde5b9;p=rocksndiamonds.git rnd-20020418-1-src --- diff --git a/src/events.c b/src/events.c index f67bc13e..468da146 100644 --- a/src/events.c +++ b/src/events.c @@ -423,6 +423,9 @@ void HandleKey(Key key, int key_status) if (game_status == PLAYING) { + /* only needed for single-step tape recording mode */ + static boolean clear_button_2[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE }; + static boolean bomb_placed[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE }; int pnr; for (pnr=0; pnrframe_reset_delay = 0; - player->push_delay = 0; - player->push_delay_value = 5; - - player->move_delay = 0; player->last_move_dir = MV_NO_MOVING; player->is_moving = FALSE; + player->move_delay = -1; /* no initial move delay */ player->move_delay_value = (level.double_speed ? MOVE_DELAY_HIGH_SPEED : MOVE_DELAY_NORMAL_SPEED); + player->push_delay = 0; + player->push_delay_value = 5; + player->snapped = FALSE; player->last_jx = player->last_jy = 0; @@ -4289,6 +4289,15 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action) moved = MoveFigure(player, dx, dy); } + if (tape.single_step && tape.recording && !tape.pausing) + { + if (button1 || (bombed && !moved)) + { + TapeTogglePause(TAPE_TOGGLE_AUTOMATIC); + SnapField(player, 0, 0); /* stop snapping */ + } + } + #if 0 if (tape.recording && (moved || snapped || bombed)) { @@ -4396,7 +4405,7 @@ void GameActions() action_delay_value = (tape.playing && tape.fast_forward ? FfwdFrameDelay : GameFrameDelay); - if (tape.playing && tape.index_search) + if (tape.playing && tape.index_search && !tape.pausing) action_delay_value = 0; /* ---------- main game synchronization point ---------- */ @@ -5194,6 +5203,10 @@ void ScrollFigure(struct PlayerInfo *player, int mode) if (!local_player->friends_still_needed) player->LevelSolved = player->GameOver = TRUE; } + + if (tape.single_step && tape.recording && !tape.pausing && + !player->programmed_action) + TapeTogglePause(TAPE_TOGGLE_AUTOMATIC); } } @@ -6508,7 +6521,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) #endif } else - TapeTogglePause(); + TapeTogglePause(TAPE_TOGGLE_MANUAL); break; case GAME_CTRL_ID_PLAY: diff --git a/src/libgame/joystick.h b/src/libgame/joystick.h index cf048f11..37f02a90 100644 --- a/src/libgame/joystick.h +++ b/src/libgame/joystick.h @@ -59,9 +59,10 @@ #define JOY_RIGHT MV_RIGHT #define JOY_UP MV_UP #define JOY_DOWN MV_DOWN -#define JOY_BUTTON_1 (1 << 4) -#define JOY_BUTTON_2 (1 << 5) -#define JOY_BUTTON (JOY_BUTTON_1 | JOY_BUTTON_2) +#define JOY_BUTTON_1 MV_BUTTON_1 +#define JOY_BUTTON_2 MV_BUTTON_2 +#define JOY_MOTION MV_MOTION +#define JOY_BUTTON MV_BUTTON #define JOY_BUTTON_NOT_PRESSED 0 #define JOY_BUTTON_PRESSED 1 diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 6fe6949b..67f337db 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -159,12 +159,13 @@ boolean FrameReached(unsigned long *frame_counter_var, { unsigned long actual_frame_counter = FrameCounter; - if (actual_frame_counter < *frame_counter_var+frame_delay && + if (actual_frame_counter < *frame_counter_var + frame_delay && actual_frame_counter >= *frame_counter_var) - return(FALSE); + return FALSE; *frame_counter_var = actual_frame_counter; - return(TRUE); + + return TRUE; } boolean DelayReached(unsigned long *counter_var, @@ -174,10 +175,11 @@ boolean DelayReached(unsigned long *counter_var, if (actual_counter < *counter_var + delay && actual_counter >= *counter_var) - return(FALSE); + return FALSE; *counter_var = actual_counter; - return(TRUE); + + return TRUE; } void WaitUntilDelayReached(unsigned long *counter_var, unsigned long delay) diff --git a/src/libgame/system.h b/src/libgame/system.h index 17411f8d..71582633 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -52,12 +52,16 @@ #define DEFAULT_KEY_SAVE_GAME KSYM_F1 #define DEFAULT_KEY_LOAD_GAME KSYM_F2 -/* values for move directions */ +/* values for move directions and special "button" keys */ #define MV_NO_MOVING 0 #define MV_LEFT (1 << 0) #define MV_RIGHT (1 << 1) #define MV_UP (1 << 2) #define MV_DOWN (1 << 3) +#define MV_BUTTON_1 (1 << 4) +#define MV_BUTTON_2 (1 << 5) +#define MV_MOTION (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN) +#define MV_BUTTON (MV_BUTTON_1 | MV_BUTTON_2) /* values for button status */ #define MB_NOT_PRESSED FALSE diff --git a/src/main.h b/src/main.h index 42eeba63..68cac8cd 100644 --- a/src/main.h +++ b/src/main.h @@ -156,7 +156,7 @@ #define IS_DRAWABLE(e) ((e) < EL_BLOCKED) #define IS_NOT_DRAWABLE(e) ((e) >= EL_BLOCKED) #define TAPE_IS_EMPTY(x) ((x).length == 0) -#define TAPE_IS_STOPPED(x) (!(x).recording && !(x).playing &&!(x).pausing) +#define TAPE_IS_STOPPED(x) (!(x).recording && !(x).playing) #define PLAYERINFO(x,y) (&stored_player[StorePlayer[x][y]-EL_SPIELER1]) #define SHIELD_ON(p) ((p)->shield_passive_time_left > 0) @@ -234,12 +234,12 @@ struct PlayerInfo boolean LevelSolved, GameOver; boolean snapped; - unsigned long move_delay; - int move_delay_value; - int last_move_dir; int is_moving; + unsigned long move_delay; + int move_delay_value; + unsigned long push_delay; unsigned long push_delay_value; @@ -304,6 +304,7 @@ struct TapeInfo boolean fast_forward; boolean index_search; boolean quick_resume; + boolean single_step; boolean changed; boolean player_participates[MAX_PLAYERS]; int num_participating_players; diff --git a/src/tape.c b/src/tape.c index 8cbc41f6..73e73a7d 100644 --- a/src/tape.c +++ b/src/tape.c @@ -290,29 +290,50 @@ void DrawCompleteVideoDisplay() /* tape control functions */ /* ========================================================================= */ -void TapeStartRecording() +void TapeErase() { - time_t zeit1 = time(NULL); - struct tm *zeit2 = localtime(&zeit1); + time_t epoch_seconds = time(NULL); + struct tm *time = localtime(&epoch_seconds); int i; - if (!TAPE_IS_STOPPED(tape)) - TapeStop(); - - tape.level_nr = level_nr; tape.length = 0; tape.counter = 0; + + tape.level_nr = level_nr; tape.pos[tape.counter].delay = 0; - tape.recording = TRUE; - tape.playing = FALSE; - tape.pausing = FALSE; tape.changed = TRUE; - tape.date = 10000*(zeit2->tm_year%100) + 100*zeit2->tm_mon + zeit2->tm_mday; - tape.random_seed = InitRND(NEW_RANDOMIZE); + tape.date = 10000*(time->tm_year % 100) + 100*time->tm_mon + time->tm_mday; tape.game_version = GAME_VERSION_ACTUAL; + tape.random_seed = InitRND(NEW_RANDOMIZE); for(i=0; i tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH) { - TapeTogglePause(); + TapeTogglePause(TAPE_TOGGLE_MANUAL); return NULL; } } @@ -538,7 +556,7 @@ byte *TapePlayAction() if (tape.counter >= tape.length) /* end of tape reached */ { if (tape.index_search) - TapeTogglePause(); + TapeTogglePause(TAPE_TOGGLE_MANUAL); else TapeStop(); @@ -571,11 +589,6 @@ void TapeStop() } } -void TapeErase() -{ - tape.length = 0; -} - unsigned int GetTapeLength() { unsigned int tape_length = 0; @@ -596,11 +609,24 @@ void TapeIndexSearch() if (!tape.fast_forward || tape.pause_before_death) { + tape.pausing = FALSE; + SetDrawDeactivationMask(REDRAW_FIELD | REDRAW_DOOR_1); audio.sound_deactivated = TRUE; } } +void TapeSingleStep() +{ + if (options.network) + return; + + if (!tape.pausing) + TapeTogglePause(TAPE_TOGGLE_MANUAL); + + tape.single_step = !tape.single_step; +} + void TapeQuickSave() { if (game_status == PLAYING) @@ -799,7 +825,7 @@ static void HandleTapeButtons(struct GadgetInfo *gi) if (tape.playing) TapeIndexSearch(); else if (tape.recording) - ; /* setting index mark -- not yet implemented */ + TapeSingleStep(); break; case TAPE_CTRL_ID_STOP: @@ -807,7 +833,7 @@ static void HandleTapeButtons(struct GadgetInfo *gi) break; case TAPE_CTRL_ID_PAUSE: - TapeTogglePause(); + TapeTogglePause(TAPE_TOGGLE_MANUAL); break; case TAPE_CTRL_ID_RECORD: @@ -818,7 +844,7 @@ static void HandleTapeButtons(struct GadgetInfo *gi) if (tape.playing) /* PLAYING -> PAUSING -> RECORDING */ TapeAppendRecording(); else - TapeTogglePause(); + TapeTogglePause(TAPE_TOGGLE_MANUAL); } break; @@ -834,7 +860,7 @@ static void HandleTapeButtons(struct GadgetInfo *gi) { if (tape.pausing) /* PAUSE -> PLAY */ { - TapeTogglePause(); + TapeTogglePause(TAPE_TOGGLE_MANUAL); } else if (!tape.fast_forward) /* PLAY -> FAST FORWARD PLAY */ { diff --git a/src/tape.h b/src/tape.h index bbc03d87..a3743d38 100644 --- a/src/tape.h +++ b/src/tape.h @@ -16,6 +16,11 @@ #include "main.h" + +/* values for TapeTogglePause() */ +#define TAPE_TOGGLE_MANUAL TRUE +#define TAPE_TOGGLE_AUTOMATIC FALSE + /* some positions in the video tape control window */ #define VIDEO_DISPLAY1_XPOS 5 #define VIDEO_DISPLAY1_YPOS 5 @@ -83,7 +88,7 @@ void TapeStartRecording(void); void TapeHaltRecording(void); void TapeStopRecording(void); void TapeRecordAction(byte *); -void TapeTogglePause(void); +void TapeTogglePause(boolean); void TapeStartPlaying(void); void TapeStopPlaying(void); byte *TapePlayAction(void); diff --git a/src/timestamp.h b/src/timestamp.h index 5d730212..fac99224 100644 --- a/src/timestamp.h +++ b/src/timestamp.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2002-04-17 00:07]" +#define COMPILE_DATE_STRING "[2002-04-18 02:20]"