From 42164ca7e4355ad0d1590a3539be2719c2e8c9e6 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 9 Nov 2003 13:55:02 +0100 Subject: [PATCH] rnd-20031109-1-src * fixed tape recording when player is created from CE element change --- ChangeLog | 7 +++ src/conf_gfx.c | 12 ++--- src/conftime.h | 2 +- src/game.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 133 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64c29de7..088f2930 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ +2003-11-08 + * fixed tape recording when player is created from CE element change + 2003-11-04 * introduced "turning..." action graphic for elements with move delay + (non-CE: bug, spaceship, sniksnak, mole, pacman, yamyam) + +2003-11-03 + * prevent "extended" changed elements from delay change in same frame 2003-11-02 * fixed bug when pushing element that can move away to the side diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 67bc7ca0..1b9fd4ee 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -889,7 +889,7 @@ struct ConfigInfo image_config[] = { "bug.moving.down.delay", "4" }, { "bug.moving.down.offset", "128" }, { "bug.turning_from_right.up", "RocksMore.pcx" }, - { "bug.turning_from_right.up.xpos", "1" }, + { "bug.turning_from_right.up.xpos", "0" }, { "bug.turning_from_right.up.ypos", "6" }, { "bug.turning_from_right.up.frames", "4" }, { "bug.turning_from_right.up.delay", "2" }, @@ -925,13 +925,13 @@ struct ConfigInfo image_config[] = { "bug.turning_from_up.right.delay", "2" }, { "bug.turning_from_up.right.anim_mode", "linear" }, { "bug.turning_from_left.up", "RocksMore.pcx" }, - { "bug.turning_from_left.up.xpos", "12" }, + { "bug.turning_from_left.up.xpos", "13" }, { "bug.turning_from_left.up.ypos", "6" }, { "bug.turning_from_left.up.frames", "4" }, { "bug.turning_from_left.up.delay", "2" }, { "bug.turning_from_left.up.anim_mode", "linear" }, { "bug.turning_from_down.left", "RocksMore.pcx" }, - { "bug.turning_from_down.left.xpos", "8" }, + { "bug.turning_from_down.left.xpos", "9" }, { "bug.turning_from_down.left.ypos", "6" }, { "bug.turning_from_down.left.frames", "4" }, { "bug.turning_from_down.left.delay", "2" }, @@ -983,7 +983,7 @@ struct ConfigInfo image_config[] = { "spaceship.moving.down.delay", "4" }, { "spaceship.moving.down.offset", "128" }, { "spaceship.turning_from_right.up", "RocksMore.pcx" }, - { "spaceship.turning_from_right.up.xpos", "1" }, + { "spaceship.turning_from_right.up.xpos", "0" }, { "spaceship.turning_from_right.up.ypos", "5" }, { "spaceship.turning_from_right.up.frames", "4" }, { "spaceship.turning_from_right.up.delay", "2" }, @@ -1019,13 +1019,13 @@ struct ConfigInfo image_config[] = { "spaceship.turning_from_up.right.delay", "2" }, { "spaceship.turning_from_up.right.anim_mode","linear" }, { "spaceship.turning_from_left.up", "RocksMore.pcx" }, - { "spaceship.turning_from_left.up.xpos", "12" }, + { "spaceship.turning_from_left.up.xpos", "13" }, { "spaceship.turning_from_left.up.ypos", "5" }, { "spaceship.turning_from_left.up.frames", "4" }, { "spaceship.turning_from_left.up.delay", "2" }, { "spaceship.turning_from_left.up.anim_mode", "linear" }, { "spaceship.turning_from_down.left", "RocksMore.pcx" }, - { "spaceship.turning_from_down.left.xpos", "8" }, + { "spaceship.turning_from_down.left.xpos", "9" }, { "spaceship.turning_from_down.left.ypos", "5" }, { "spaceship.turning_from_down.left.frames", "4" }, { "spaceship.turning_from_down.left.delay", "2" }, diff --git a/src/conftime.h b/src/conftime.h index 9cdc2429..41258204 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-11-08 16:59]" +#define COMPILE_DATE_STRING "[2003-11-09 01:50]" diff --git a/src/game.c b/src/game.c index c7dc1009..cfb239c9 100644 --- a/src/game.c +++ b/src/game.c @@ -5904,6 +5904,100 @@ static boolean CheckElementChange(int x, int y, int element, int trigger_event) return CheckElementSideChange(x, y, element, CH_SIDE_ANY, trigger_event, -1); } +#if 1 +static byte PlayerActions(struct PlayerInfo *player, byte player_action) +{ +#if 0 + static byte stored_player_action[MAX_PLAYERS]; + static int num_stored_actions = 0; +#endif + boolean moved = FALSE, snapped = FALSE, dropped = FALSE; + int left = player_action & JOY_LEFT; + int right = player_action & JOY_RIGHT; + int up = player_action & JOY_UP; + int down = player_action & JOY_DOWN; + int button1 = player_action & JOY_BUTTON_1; + int button2 = player_action & JOY_BUTTON_2; + int dx = (left ? -1 : right ? 1 : 0); + int dy = (up ? -1 : down ? 1 : 0); + +#if 0 + stored_player_action[player->index_nr] = 0; + num_stored_actions++; +#endif + +#if 0 + printf("::: player %d [%d]\n", player->index_nr, FrameCounter); +#endif + + if (!player->active || tape.pausing) + return 0; + + if (player_action) + { +#if 0 + printf("::: player %d acts [%d]\n", player->index_nr, FrameCounter); +#endif + + if (button1) + snapped = SnapField(player, dx, dy); + else + { + if (button2) + dropped = DropElement(player); + + moved = MovePlayer(player, dx, dy); + } + + if (tape.single_step && tape.recording && !tape.pausing) + { + if (button1 || (dropped && !moved)) + { + TapeTogglePause(TAPE_TOGGLE_AUTOMATIC); + SnapField(player, 0, 0); /* stop snapping */ + } + } + +#if 1 + return player_action; +#else + stored_player_action[player->index_nr] = player_action; +#endif + } + else + { +#if 0 + printf("::: player %d waits [%d]\n", player->index_nr, FrameCounter); +#endif + + /* no actions for this player (no input at player's configured device) */ + + DigField(player, 0, 0, 0, 0, DF_NO_PUSH); + SnapField(player, 0, 0); + CheckGravityMovement(player); + + if (player->MovPos == 0) + InitPlayerGfxAnimation(player, ACTION_DEFAULT, player->MovDir); + + if (player->MovPos == 0) /* needed for tape.playing */ + player->is_moving = FALSE; + + return 0; + } + +#if 0 + if (tape.recording && num_stored_actions >= MAX_PLAYERS) + { + printf("::: player %d recorded [%d]\n", player->index_nr, FrameCounter); + + TapeRecordAction(stored_player_action); + num_stored_actions = 0; + } +#endif +} + +#else + static void PlayerActions(struct PlayerInfo *player, byte player_action) { static byte stored_player_action[MAX_PLAYERS]; @@ -5921,11 +6015,15 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action) stored_player_action[player->index_nr] = 0; num_stored_actions++; + printf("::: player %d [%d]\n", player->index_nr, FrameCounter); + if (!player->active || tape.pausing) return; if (player_action) { + printf("::: player %d acts [%d]\n", player->index_nr, FrameCounter); + if (button1) snapped = SnapField(player, dx, dy); else @@ -5949,6 +6047,8 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action) } else { + printf("::: player %d waits [%d]\n", player->index_nr, FrameCounter); + /* no actions for this player (no input at player's configured device) */ DigField(player, 0, 0, 0, 0, DF_NO_PUSH); @@ -5964,10 +6064,13 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action) if (tape.recording && num_stored_actions >= MAX_PLAYERS) { + printf("::: player %d recorded [%d]\n", player->index_nr, FrameCounter); + TapeRecordAction(stored_player_action); num_stored_actions = 0; } } +#endif void GameActions() { @@ -5977,6 +6080,9 @@ void GameActions() int i, x, y, element, graphic; byte *recorded_player_action; byte summarized_player_action = 0; +#if 1 + byte tape_action[MAX_PLAYERS]; +#endif if (game_status != GAME_MODE_PLAYING) return; @@ -6039,7 +6145,7 @@ void GameActions() if (!options.network && !setup.team_mode) local_player->effective_action = summarized_player_action; - for (i=0; i