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; pnr<MAX_PLAYERS; pnr++)
if (key == *key_info[i].key_custom)
key_action |= key_info[i].action;
+ if (tape.single_step && clear_button_2[pnr])
+ {
+ stored_player[pnr].action &= ~MV_BUTTON_2;
+ clear_button_2[pnr] = FALSE;
+ }
+
if (key_status == KEY_PRESSED)
stored_player[pnr].action |= key_action;
else
stored_player[pnr].action &= ~key_action;
+
+ if (tape.single_step && tape.recording && tape.pausing)
+ {
+ if (key_status == KEY_PRESSED &&
+ (key_action & (MV_MOTION | MV_BUTTON_1)))
+ {
+ TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+
+ if (key_action & MV_MOTION)
+ {
+ if (stored_player[pnr].action & MV_BUTTON_2)
+ bomb_placed[pnr] = TRUE;
+ }
+ }
+ else if (key_status == KEY_RELEASED &&
+ (key_action & MV_BUTTON_2))
+ {
+ if (!bomb_placed[pnr])
+ {
+ TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+
+ stored_player[pnr].action |= MV_BUTTON_2;
+ clear_button_2[pnr] = TRUE;
+ }
+
+ bomb_placed[pnr] = FALSE;
+ }
+ }
+ else if (tape.recording && tape.pausing)
+ TapeTogglePause(TAPE_TOGGLE_MANUAL);
}
}
else
player->frame_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;
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))
{
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 ---------- */
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);
}
}
#endif
}
else
- TapeTogglePause();
+ TapeTogglePause(TAPE_TOGGLE_MANUAL);
break;
case GAME_CTRL_ID_PLAY:
#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
{
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,
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)
#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
#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)
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;
boolean fast_forward;
boolean index_search;
boolean quick_resume;
+ boolean single_step;
boolean changed;
boolean player_participates[MAX_PLAYERS];
int num_participating_players;
/* 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<MAX_PLAYERS; i++)
tape.player_participates[i] = FALSE;
+}
+
+static void TapeRewind()
+{
+ tape.counter = 0;
+ tape.delay_played = 0;
+ tape.pause_before_death = FALSE;
+ tape.recording = FALSE;
+ tape.playing = FALSE;
+ tape.fast_forward = FALSE;
+ tape.index_search = FALSE;
+ tape.quick_resume = FALSE;
+ tape.single_step = FALSE;
+
+ InitRND(tape.random_seed);
+}
+
+void TapeStartRecording()
+{
+ if (!TAPE_IS_STOPPED(tape))
+ TapeStop();
+
+ TapeErase();
+ TapeRewind();
+
+ tape.recording = TRUE;
DrawVideoDisplay(VIDEO_STATE_REC_ON, 0);
DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date);
}
}
-void TapeTogglePause()
+void TapeTogglePause(boolean toggle_manual)
{
unsigned long state;
+#if 0
if (!tape.recording && !tape.playing)
return;
+#endif
tape.pausing = !tape.pausing;
tape.fast_forward = FALSE;
tape.pause_before_death = FALSE;
+ if (tape.single_step && toggle_manual)
+ tape.single_step = FALSE;
+
state = (tape.pausing ? VIDEO_STATE_PAUSE_ON : VIDEO_STATE_PAUSE_OFF);
if (tape.playing)
state |= VIDEO_STATE_PBEND_OFF;
tape.quick_resume = FALSE;
TapeAppendRecording();
- TapeTogglePause();
+ TapeTogglePause(toggle_manual);
}
}
}
if (!TAPE_IS_STOPPED(tape))
TapeStop();
- tape.counter = 0;
- tape.delay_played = 0;
- tape.pause_before_death = FALSE;
- tape.recording = FALSE;
- tape.playing = TRUE;
- tape.pausing = FALSE;
- tape.fast_forward = FALSE;
- tape.index_search = FALSE;
- tape.quick_resume = FALSE;
+ TapeRewind();
- InitRND(tape.random_seed);
+ tape.playing = TRUE;
DrawVideoDisplay(VIDEO_STATE_PLAY_ON, 0);
DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date);
if (TimePlayed > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH)
{
- TapeTogglePause();
+ TapeTogglePause(TAPE_TOGGLE_MANUAL);
return NULL;
}
}
if (tape.counter >= tape.length) /* end of tape reached */
{
if (tape.index_search)
- TapeTogglePause();
+ TapeTogglePause(TAPE_TOGGLE_MANUAL);
else
TapeStop();
}
}
-void TapeErase()
-{
- tape.length = 0;
-}
-
unsigned int GetTapeLength()
{
unsigned int tape_length = 0;
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)
if (tape.playing)
TapeIndexSearch();
else if (tape.recording)
- ; /* setting index mark -- not yet implemented */
+ TapeSingleStep();
break;
case TAPE_CTRL_ID_STOP:
break;
case TAPE_CTRL_ID_PAUSE:
- TapeTogglePause();
+ TapeTogglePause(TAPE_TOGGLE_MANUAL);
break;
case TAPE_CTRL_ID_RECORD:
if (tape.playing) /* PLAYING -> PAUSING -> RECORDING */
TapeAppendRecording();
else
- TapeTogglePause();
+ TapeTogglePause(TAPE_TOGGLE_MANUAL);
}
break;
{
if (tape.pausing) /* PAUSE -> PLAY */
{
- TapeTogglePause();
+ TapeTogglePause(TAPE_TOGGLE_MANUAL);
}
else if (!tape.fast_forward) /* PLAY -> FAST FORWARD PLAY */
{
#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
void TapeHaltRecording(void);
void TapeStopRecording(void);
void TapeRecordAction(byte *);
-void TapeTogglePause(void);
+void TapeTogglePause(boolean);
void TapeStartPlaying(void);
void TapeStopPlaying(void);
byte *TapePlayAction(void);
-#define COMPILE_DATE_STRING "[2002-04-17 00:07]"
+#define COMPILE_DATE_STRING "[2002-04-18 02:20]"