/* file identifier strings */
#define LEVEL_COOKIE "ROCKSNDIAMONDS_LEVEL_FILE_VERSION_2.0"
#define SCORE_COOKIE "ROCKSNDIAMONDS_SCORE_FILE_VERSION_1.2"
-#define TAPE_COOKIE "ROCKSNDIAMONDS_TAPE_FILE_VERSION_1.2"
+#define TAPE_COOKIE "ROCKSNDIAMONDS_TAPE_FILE_VERSION_2.0"
#define SETUP_COOKIE "ROCKSNDIAMONDS_SETUP_FILE_VERSION_1.2"
#define LEVELSETUP_COOKIE "ROCKSNDIAMONDS_LEVELSETUP_FILE_VERSION_1.2"
#define LEVELINFO_COOKIE "ROCKSNDIAMONDS_LEVELINFO_FILE_VERSION_1.2"
#define LEVEL_COOKIE_12 "ROCKSNDIAMONDS_LEVEL_FILE_VERSION_1.2"
#define LEVEL_COOKIE_14 "ROCKSNDIAMONDS_LEVEL_FILE_VERSION_1.4"
#define TAPE_COOKIE_10 "ROCKSNDIAMONDS_LEVELREC_FILE_VERSION_1.0"
+#define TAPE_COOKIE_12 "ROCKSNDIAMONDS_TAPE_FILE_VERSION_1.2"
/* file names and filename extensions */
#if !defined(PLATFORM_MSDOS)
}
}
+#if DEBUG
+ printf("\nTAPE OF LEVEL %d\n", level_nr);
+#endif
+
for(i=0; i<tape.length; i++)
{
if (i >= MAX_TAPELEN)
if (tape.player_participates[j])
tape.pos[i].action[j] = fgetc(file);
+
+#if DEBUG
+ {
+ int x = tape.pos[i].action[j];
+
+ printf("%d:%02x ", j, x);
+ printf("[%c%c%c%c|%c%c] - ",
+ (x & JOY_LEFT ? '<' : ' '),
+ (x & JOY_RIGHT ? '>' : ' '),
+ (x & JOY_UP ? '^' : ' '),
+ (x & JOY_DOWN ? 'v' : ' '),
+ (x & JOY_BUTTON_1 ? '1' : ' '),
+ (x & JOY_BUTTON_2 ? '2' : ' '));
+ }
+#endif
+
}
tape.pos[i].delay = fgetc(file);
+#if DEBUG
+ printf("[%03d]\n", tape.pos[i].delay);
+#endif
+
if (file_version == FILE_VERSION_1_0)
{
/* eliminate possible diagonal moves in old tapes */
tape.length += num_moves;
}
}
+ else if (file_version < FILE_VERSION_2_0)
+ {
+ if (tape.pos[i].delay > 1)
+ {
+ /* action part */
+ tape.pos[i + 1] = tape.pos[i];
+ tape.pos[i + 1].delay = 1;
+
+ /* delay part */
+ for(j=0; j<MAX_PLAYERS; j++)
+ tape.pos[i].action[j] = MV_NO_MOVING;
+ tape.pos[i].delay--;
+
+ i++;
+ tape.length++;
+ }
+ }
if (feof(file))
break;
game_status = HALLOFFAME;
DrawHallOfFame(hi_pos);
if (raise_level)
+ {
level_nr++;
+ TapeErase();
+ }
}
else
{
game_status = MAINMENU;
if (raise_level)
+ {
level_nr++;
+ TapeErase();
+ }
DrawMainMenu();
}
static int num_stored_actions = 0;
static boolean save_tape_entry = FALSE;
boolean moved = FALSE, snapped = FALSE, bombed = FALSE;
- int jx = player->jx, jy = player->jy;
int left = player_action & JOY_LEFT;
int right = player_action & JOY_RIGHT;
int up = player_action & JOY_UP;
if (player_action)
{
+#if 0
save_tape_entry = TRUE;
+#endif
player->frame_reset_delay = 0;
if (button1)
moved = MoveFigure(player, dx, dy);
}
+#if 0
if (tape.recording && (moved || snapped || bombed))
{
if (bombed && !moved)
player_action &= JOY_BUTTON;
stored_player_action[player->index_nr] = player_action;
+#if 1
+ save_tape_entry = TRUE;
+#endif
}
else if (tape.playing && snapped)
SnapField(player, 0, 0); /* stop snapping */
+#else
+ stored_player_action[player->index_nr] = player_action;
+#endif
}
else
{
player->Frame = 0;
}
+#if 0
if (tape.recording && num_stored_actions >= MAX_PLAYERS && save_tape_entry)
{
TapeRecordAction(stored_player_action);
num_stored_actions = 0;
save_tape_entry = FALSE;
}
+#else
+ if (tape.recording && num_stored_actions >= MAX_PLAYERS)
+ {
+ TapeRecordAction(stored_player_action);
+ num_stored_actions = 0;
+ }
+#endif
+#if 0
if (tape.playing && !tape.pausing && !player_action &&
tape.counter < tape.length)
{
+ int jx = player->jx, jy = player->jy;
int next_joy =
tape.pos[tape.counter].action[player->index_nr] & (JOY_LEFT|JOY_RIGHT);
}
}
}
+#endif
}
void GameActions()
if (!player->active || (!dx && !dy))
return FALSE;
+#if 0
if (!FrameReached(&player->move_delay, player->move_delay_value) &&
!tape.playing)
return FALSE;
+#else
+ if (!FrameReached(&player->move_delay, player->move_delay_value) &&
+ !(tape.playing && tape.file_version < FILE_VERSION_2_0))
+ return FALSE;
+#endif
/* remove the last programmed player action */
player->programmed_action = 0;
if (player->push_delay == 0)
player->push_delay = FrameCounter;
+#if 0
if (!FrameReached(&player->push_delay, player->push_delay_value) &&
!tape.playing && element != EL_SPRING)
return MF_NO_ACTION;
+#else
+ if (!FrameReached(&player->push_delay, player->push_delay_value) &&
+ !(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
+ element != EL_SPRING)
+ return MF_NO_ACTION;
+#endif
RemoveField(x, y);
Feld[x+dx][y+dy] = element;
if (player->push_delay == 0)
player->push_delay = FrameCounter;
+#if 0
if (!FrameReached(&player->push_delay, player->push_delay_value) &&
!tape.playing && element != EL_BALLOON)
return MF_NO_ACTION;
+#else
+ if (!FrameReached(&player->push_delay, player->push_delay_value) &&
+ !(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
+ element != EL_BALLOON)
+ return MF_NO_ACTION;
+#endif
if (IS_SB_ELEMENT(element))
{
int index_nr, client_nr, element_nr;
byte action; /* action from local input device */
- byte effective_action; /* action aknowledged from network server
+ byte effective_action; /* action acknowledged from network server
or summarized over all configured input
devices when in single player mode */
byte programmed_action; /* action forced by game itself (like moving
#include "tools.h"
#include "files.h"
#include "network.h"
+#include "cartoons.h"
/* tape button identifiers */
#define TAPE_CTRL_ID_EJECT 0
void TapeStopRecording()
{
+#if 0
int i;
+#endif
if (!tape.recording)
return;
+#if 0
for(i=0; i<MAX_PLAYERS; i++)
tape.pos[tape.counter].action[i] = 0;
+#endif
tape.counter++;
tape.length = tape.counter;
DrawVideoDisplay(VIDEO_STATE_REC_OFF, 0);
}
+#if 0
void TapeRecordAction(byte joy[MAX_PLAYERS])
{
int i;
tape.pos[tape.counter].delay = 0;
}
+#else
+
+void TapeRecordAction(byte action[MAX_PLAYERS])
+{
+ int i;
+
+ if (!tape.recording || tape.pausing)
+ return;
+
+ if (tape.counter >= MAX_TAPELEN-1)
+ {
+ TapeStopRecording();
+ return;
+ }
+
+ if (tape.pos[tape.counter].delay > 0) /* already stored action */
+ {
+ boolean changed_events = FALSE;
+
+ for(i=0; i<MAX_PLAYERS; i++)
+ if (tape.pos[tape.counter].action[i] != action[i])
+ changed_events = TRUE;
+
+ if (changed_events || tape.pos[tape.counter].delay >= 255)
+ {
+ tape.counter++;
+ tape.pos[tape.counter].delay = 0;
+ }
+ else
+ tape.pos[tape.counter].delay++;
+ }
+
+ if (tape.pos[tape.counter].delay == 0) /* store new action */
+ {
+ for(i=0; i<MAX_PLAYERS; i++)
+ tape.pos[tape.counter].action[i] = action[i];
+
+ tape.pos[tape.counter].delay++;
+ }
+}
+#endif
+
+#if 0
void TapeRecordDelay()
{
int i;
}
}
+#else
+
+void TapeRecordDelay()
+{
+}
+#endif
+
void TapeTogglePause()
{
unsigned long state;
DrawVideoDisplay(VIDEO_STATE_PLAY_OFF, 0);
}
+#if 0
byte *TapePlayAction()
{
static byte joy[MAX_PLAYERS];
return(joy);
}
+#else
+
+byte *TapePlayAction()
+{
+ static byte action[MAX_PLAYERS];
+ int i;
+
+ if (!tape.playing || tape.pausing)
+ return NULL;
+
+ if (tape.pause_before_death) /* STOP 10s BEFORE PLAYER GETS KILLED... */
+ {
+ if (!(FrameCounter % 20))
+ {
+ if ((FrameCounter / 20) % 2)
+ DrawVideoDisplay(VIDEO_STATE_PBEND_ON, VIDEO_DISPLAY_LABEL_ONLY);
+ else
+ DrawVideoDisplay(VIDEO_STATE_PBEND_OFF, VIDEO_DISPLAY_LABEL_ONLY);
+ }
+
+ if (TimePlayed > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH)
+ {
+ TapeTogglePause();
+ return NULL;
+ }
+ }
+
+ if (tape.counter >= tape.length)
+ {
+ TapeStop();
+ return NULL;
+ }
+
+ for(i=0; i<MAX_PLAYERS; i++)
+ action[i] = tape.pos[tape.counter].action[i];
+
+ tape.delay_played++;
+ if (tape.delay_played >= tape.pos[tape.counter].delay)
+ {
+ tape.counter++;
+ tape.delay_played = 0;
+ }
+
+ return action;
+}
+#endif
+
+#if 0
boolean TapePlayDelay()
{
if (!tape.playing || tape.pausing)
return(FALSE);
}
+#else
+
+boolean TapePlayDelay()
+{
+ return TRUE|FALSE; /* ...it doesn't matter at all */
+}
+#endif
+
void TapeStop()
{
TapeStopRecording();
#endif
{
game_status = PLAYING;
+ StopAnimation();
InitGame();
}
}
TapeStartPlaying();
game_status = PLAYING;
+ StopAnimation();
InitGame();
}
else if (tape.playing)