{ "door_2.step_delay", "10" },
{ "door_2.anim_mode", "default" },
- { "[player].boring_delay_fixed", "0" },
- { "[player].boring_delay_random", "0" },
- { "[player].sleeping_delay_fixed", "0" },
- { "[player].sleeping_delay_random", "0" },
+ { "[player].boring_delay_fixed", "-1" },
+ { "[player].boring_delay_random", "-1" },
+ { "[player].sleeping_delay_fixed", "-1" },
+ { "[player].sleeping_delay_random", "-1" },
{ NULL, NULL }
};
-#define COMPILE_DATE_STRING "[2003-11-24 02:22]"
+#define COMPILE_DATE_STRING "[2003-11-25 00:01]"
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;
}
}
graphic_info[graphic].anim_delay_fixed =
parameter[GFX_ARG_ANIM_DELAY_FIXED];
if (parameter[GFX_ARG_ANIM_DELAY_RANDOM] != ARG_UNDEFINED_VALUE)
- graphic_info[graphic].anim_delay_fixed =
+ graphic_info[graphic].anim_delay_random =
parameter[GFX_ARG_ANIM_DELAY_RANDOM];
if (parameter[GFX_ARG_POST_DELAY_FIXED] != ARG_UNDEFINED_VALUE)
- graphic_info[graphic].anim_delay_fixed =
+ graphic_info[graphic].post_delay_fixed =
parameter[GFX_ARG_POST_DELAY_FIXED];
if (parameter[GFX_ARG_POST_DELAY_RANDOM] != ARG_UNDEFINED_VALUE)
- graphic_info[graphic].anim_delay_fixed =
+ graphic_info[graphic].post_delay_random =
parameter[GFX_ARG_POST_DELAY_RANDOM];
/* this is only used for toon animations */
{ ".changing", ACTION_CHANGING, FALSE },
{ ".exploding", ACTION_EXPLODING, FALSE },
{ ".boring", ACTION_BORING, FALSE },
- { ".boring:1", ACTION_BORING_1, FALSE },
- { ".boring:2", ACTION_BORING_2, FALSE },
- { ".boring:3", ACTION_BORING_3, FALSE },
- { ".boring:4", ACTION_BORING_4, FALSE },
- { ".boring:5", ACTION_BORING_5, FALSE },
- { ".boring:6", ACTION_BORING_6, FALSE },
- { ".boring:7", ACTION_BORING_7, FALSE },
- { ".boring:8", ACTION_BORING_8, FALSE },
+ { ".boring[1]", ACTION_BORING_1, FALSE },
+ { ".boring[2]", ACTION_BORING_2, FALSE },
+ { ".boring[3]", ACTION_BORING_3, FALSE },
+ { ".boring[4]", ACTION_BORING_4, FALSE },
+ { ".boring[5]", ACTION_BORING_5, FALSE },
+ { ".boring[6]", ACTION_BORING_6, FALSE },
+ { ".boring[7]", ACTION_BORING_7, FALSE },
+ { ".boring[8]", ACTION_BORING_8, FALSE },
{ ".sleeping", ACTION_SLEEPING, FALSE },
- { ".sleeping:1", ACTION_SLEEPING_1, FALSE },
- { ".sleeping:2", ACTION_SLEEPING_2, FALSE },
- { ".sleeping:3", ACTION_SLEEPING_3, FALSE },
+ { ".sleeping[1]", ACTION_SLEEPING_1, FALSE },
+ { ".sleeping[2]", ACTION_SLEEPING_2, FALSE },
+ { ".sleeping[3]", ACTION_SLEEPING_3, FALSE },
{ ".dying", ACTION_DYING, FALSE },
{ ".turning", ACTION_TURNING, FALSE },
{ ".turning_from_left", ACTION_TURNING_FROM_LEFT, FALSE },
int frame_counter_bored;
int frame_counter_sleeping;
+ int anim_delay_counter;
+ int post_delay_counter;
+
+ int special_action_bored;
+ int special_action_sleeping;
+
+ int num_special_action_bored;
+ int num_special_action_sleeping;
+
int switch_x, switch_y;
int show_envelope;
DrawLevelFieldCrumbledSand(x, y);
}
+static int getPlayerAction(struct PlayerInfo *player, int move_dir)
+{
+ int action = (player->is_pushing ? ACTION_PUSHING :
+ player->is_digging ? ACTION_DIGGING :
+ player->is_collecting ? ACTION_COLLECTING :
+ player->is_moving ? ACTION_MOVING :
+ player->is_snapping ? ACTION_SNAPPING :
+ player->is_sleeping ? ACTION_SLEEPING :
+ player->is_bored ? ACTION_BORING :
+ player->is_waiting ? ACTION_WAITING : ACTION_DEFAULT);
+
+ if (player->is_sleeping)
+ {
+ if (player->num_special_action_sleeping > 0)
+ {
+ if (player->anim_delay_counter == 0 && player->post_delay_counter == 0)
+ {
+ int special_action =
+ ACTION_BORING_1 + SimpleRND(player->num_special_action_sleeping);
+ int special_graphic =
+ el_act_dir2img(player->element_nr, special_action, move_dir);
+
+ player->anim_delay_counter =
+ graphic_info[special_graphic].anim_delay_fixed +
+ SimpleRND(graphic_info[special_graphic].anim_delay_random);
+ player->post_delay_counter =
+ graphic_info[special_graphic].post_delay_fixed +
+ SimpleRND(graphic_info[special_graphic].post_delay_random);
+
+ player->special_action_sleeping = special_action;
+ }
+
+ if (player->anim_delay_counter > 0)
+ {
+ action = player->special_action_sleeping;
+ player->anim_delay_counter--;
+ }
+ else if (player->post_delay_counter > 0)
+ {
+ player->post_delay_counter--;
+ }
+ }
+ }
+ else if (player->is_bored)
+ {
+ if (player->num_special_action_bored > 0)
+ {
+ if (player->anim_delay_counter == 0 && player->post_delay_counter == 0)
+ {
+ int special_action =
+ ACTION_BORING_1 + SimpleRND(player->num_special_action_bored);
+ int special_graphic =
+ el_act_dir2img(player->element_nr, special_action, move_dir);
+
+ player->anim_delay_counter =
+ graphic_info[special_graphic].anim_delay_fixed +
+ SimpleRND(graphic_info[special_graphic].anim_delay_random);
+ player->post_delay_counter =
+ graphic_info[special_graphic].post_delay_fixed +
+ SimpleRND(graphic_info[special_graphic].post_delay_random);
+
+ player->special_action_bored = special_action;
+ }
+
+ if (player->anim_delay_counter > 0)
+ {
+ action = player->special_action_bored;
+ player->anim_delay_counter--;
+ }
+ else if (player->post_delay_counter > 0)
+ {
+ player->post_delay_counter--;
+ }
+ }
+ }
+
+ return action;
+}
+
static int getPlayerGraphic(struct PlayerInfo *player, int move_dir)
{
if (player->use_murphy_graphic)
if (element == EL_EXPLOSION)
return;
+#if 1
+
+ action = getPlayerAction(player, move_dir);
+
+#else
+
action = (player->is_pushing ? ACTION_PUSHING :
player->is_digging ? ACTION_DIGGING :
player->is_collecting ? ACTION_COLLECTING :
player->is_bored ? ACTION_BORING :
player->is_waiting ? ACTION_WAITING : ACTION_DEFAULT);
- if (player->is_bored || player->is_sleeping)
+ if (player->is_bored && player->num_special_action_bored > 0)
{
- /* ... */
+ if (player->anim_delay_counter == 0 && player->post_delay_counter == 0)
+ {
+ int graphic_waiting;
+
+ action = ACTION_BORING_1 + SimpleRND(player->num_special_action_bored);
+ special_graphic = el_act_dir2img(EL_SP_MURPHY, action, move_dir);
+
+ player->anim_delay_counter =
+ graphic_info[special_graphic].anim_delay_fixed +
+ SimpleRND(graphic_info[special_graphic].anim_delay_random);
+ player->post_delay_counter =
+ graphic_info[special_graphic].post_delay_fixed +
+ SimpleRND(graphic_info[special_graphic].post_delay_random);
+ player->special_action_bored = action;
+ }
+
+ if (player->anim_delay_counter > 0)
+ {
+ action = player->special_action_bored;
+ player->anim_delay_counter--;
+ }
+
+ if (player->post_delay_counter > 0)
+ {
+ player->post_delay_counter--;
+ }
}
+#endif
#if 0
printf("::: '%s'\n", element_action_info[action].suffix);