boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */
boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */
boolean emulate_sp = TRUE; /* unless non-SUPAPLEX elements found */
- int i, j, x, y;
+ int i, j, k, x, y;
InitGameEngine();
/* don't play tapes over network */
network_playing = (options.network && !tape.playing);
- for (i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i < MAX_PLAYERS; i++)
{
struct PlayerInfo *player = &stored_player[i];
player->lights_still_needed = 0;
player->friends_still_needed = 0;
- for (j=0; j<4; j++)
+ for (j=0; j < 4; j++)
player->key[j] = FALSE;
player->dynabomb_count = 0;
player->frame_counter_bored = -1;
player->frame_counter_sleeping = -1;
+ player->anim_delay_counter = 0;
+ player->post_delay_counter = 0;
+
+ player->special_action_bored = ACTION_DEFAULT;
+ player->special_action_sleeping = ACTION_DEFAULT;
+
+ player->num_special_action_bored = 0;
+ player->num_special_action_sleeping = 0;
+
+ /* determine number of special actions for bored and sleeping animation */
+ for (j=ACTION_BORING_1; j <= ACTION_BORING_8; j++)
+ {
+ boolean found = FALSE;
+
+ for (k=0; k < NUM_DIRECTIONS; k++)
+ if (el_act_dir2img(player->element_nr, j, k) !=
+ el_act_dir2img(player->element_nr, ACTION_DEFAULT, k))
+ found = TRUE;
+
+ if (found)
+ player->num_special_action_bored++;
+ else
+ break;
+ }
+ for (j=ACTION_SLEEPING_1; j <= ACTION_SLEEPING_3; j++)
+ {
+ boolean found = FALSE;
+
+ for (k=0; k < NUM_DIRECTIONS; k++)
+ if (el_act_dir2img(player->element_nr, j, k) !=
+ el_act_dir2img(player->element_nr, ACTION_DEFAULT, k))
+ found = TRUE;
+
+ if (found)
+ player->num_special_action_sleeping++;
+ else
+ break;
+ }
+
player->switch_x = -1;
player->switch_y = -1;
if (!was_waiting) /* not waiting -> waiting */
{
player->is_waiting = TRUE;
- player->is_bored = FALSE;
- player->is_sleeping = FALSE;
player->frame_counter_bored =
- (FrameCounter +
- game.player_boring_delay_fixed +
- SimpleRND(game.player_boring_delay_random));
+ FrameCounter +
+ game.player_boring_delay_fixed +
+ SimpleRND(game.player_boring_delay_random);
player->frame_counter_sleeping =
- (FrameCounter +
- game.player_sleeping_delay_fixed +
- SimpleRND(game.player_sleeping_delay_random));
+ FrameCounter +
+ game.player_sleeping_delay_fixed +
+ SimpleRND(game.player_sleeping_delay_random);
InitPlayerGfxAnimation(player, ACTION_WAITING, player->MovDir);
}
- if (FrameCounter >= player->frame_counter_bored)
- player->is_bored = TRUE;
- if (FrameCounter >= player->frame_counter_sleeping)
+ if (game.player_sleeping_delay_fixed != -1 &&
+ game.player_sleeping_delay_random != -1 &&
+ player->anim_delay_counter == 0 &&
+ player->post_delay_counter == 0 &&
+ FrameCounter >= player->frame_counter_sleeping)
player->is_sleeping = TRUE;
+ else if (game.player_boring_delay_fixed != -1 &&
+ game.player_boring_delay_random != -1 &&
+ FrameCounter >= player->frame_counter_bored)
+ player->is_bored = TRUE;
action = (player->is_sleeping ? ACTION_SLEEPING :
player->is_bored ? ACTION_BORING : ACTION_WAITING);
player->frame_counter_bored = -1;
player->frame_counter_sleeping = -1;
+
+ player->anim_delay_counter = 0;
+ player->post_delay_counter = 0;
}
}