X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftools.c;h=106d251ed5c7d45d01c0dcde7be7d1324f4e43b7;hb=8c3a8e72f2bebc6a732f11cac24a4f3ca21dd730;hp=068afdef8b6fa22003b984360fc6213366455718;hpb=942ec4881e3b21c130df9ae105d06c2c633fa192;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 068afdef..106d251e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -529,90 +529,6 @@ void DrawLevelElementAnimationIfNeeded(int x, int y, int element) 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 last_special_action = player->special_action_sleeping; - int num_special_action = player->num_special_action_sleeping; - int special_action = - (last_special_action == ACTION_DEFAULT ? ACTION_SLEEPING_1 : - last_special_action == ACTION_SLEEPING ? ACTION_SLEEPING : - last_special_action < ACTION_SLEEPING_1 + num_special_action - 1 ? - last_special_action + 1 : 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) @@ -714,7 +630,7 @@ void DrawPlayer(struct PlayerInfo *player) #if 1 - action = getPlayerAction(player, move_dir); + action = GetPlayerAction(player, move_dir); #else