コード例 #1
0
void StateControl_CrocodileSetKeyAnim(struct entity_s *ent, struct ss_animation_s *ss_anim, int key_anim)
{
    switch(key_anim)
    {
        case ANIMATION_KEY_INIT:
            switch(ss_anim->model->id)
            {
                case TR_MODEL_CROCODILE_UW_TR1:
                    Anim_SetAnimation(ss_anim, TR_ANIMATION_CROCODILE_UW_FLOW, 0);
                    break;

                case TR_MODEL_CROCODILE_OF_TR1:
                    Anim_SetAnimation(ss_anim, TR_ANIMATION_CROCODILE_OF_STAY, 0);
                    break;
            }
            break;

        case ANIMATION_KEY_DEAD:
            switch(ss_anim->model->id)
            {
                case TR_MODEL_CROCODILE_UW_TR1:
                    Anim_SetAnimation(ss_anim, TR_ANIMATION_CROCODILE_UW_DEAD, 0);
                    break;

                case TR_MODEL_CROCODILE_OF_TR1:
                    Anim_SetAnimation(ss_anim, TR_ANIMATION_CROCODILE_OF_DEAD, 0);
                    break;
            }
            break;
    }
}
コード例 #2
0
void StateControl_WolfSetKeyAnim(struct entity_s *ent, struct ss_animation_s *ss_anim, int key_anim)
{
    switch(key_anim)
    {
        case ANIMATION_KEY_INIT:
            Anim_SetAnimation(ss_anim, TR_ANIMATION_WOLF_STAY_TO_IDLE, -1);
            break;

        case ANIMATION_KEY_DEAD:
            Anim_SetAnimation(ss_anim, TR_ANIMATION_WOLF_DEAD1, 0);
            break;
    }
}
コード例 #3
0
void StateControl_TorsoBossSetKeyAnim(struct entity_s *ent, struct ss_animation_s *ss_anim, int key_anim)
{
    switch(key_anim)
    {
        case ANIMATION_KEY_INIT:
            Anim_SetAnimation(ss_anim, TR_ANIMATION_TORSO_BOSS_INIT, 0);
            break;

        case ANIMATION_KEY_DEAD:
            Anim_SetAnimation(ss_anim, TR_ANIMATION_TORSO_BOSS_DEAD, 0);
            break;
    }
}
コード例 #4
0
void StateControl_BearSetKeyAnim(struct entity_s *ent, struct ss_animation_s *ss_anim, int key_anim)
{
    switch(key_anim)
    {
        case ANIMATION_KEY_INIT:
            Anim_SetAnimation(ss_anim, TR_ANIMATION_BEAR_STAY, 0);
            break;
    }
}
コード例 #5
0
void StateControl_RaptorSetKeyAnim(struct entity_s *ent, struct ss_animation_s *ss_anim, int key_anim)
{
    uint16_t current_state = Anim_GetCurrentState(ss_anim);

    switch(key_anim)
    {
        case ANIMATION_KEY_INIT:
            Anim_SetAnimation(ss_anim, TR_ANIMATION_RAPTOR_STAY, 0);
            break;

        case ANIMATION_KEY_DEAD:
            if(current_state == TR_STATE_RAPTOR_STAY)
            {
                Anim_SetAnimation(ss_anim, TR_ANIMATION_RAPTOR_DEAD1, 0);
            }
            else
            {
                Anim_SetAnimation(ss_anim, TR_ANIMATION_RAPTOR_DEAD2, 0);
            }
            break;
    }
}
コード例 #6
0
int StateControl_Crocodile(struct entity_s *ent, struct ss_animation_s *ss_anim)
{
    character_command_p cmd = &ent->character->cmd;
    character_state_p state = &ent->character->state;
    skeletal_model_p sm = ss_anim->model;
    uint16_t current_state = Anim_GetCurrentState(ss_anim);

    ent->character->rotate_speed_mult = 1.0f;
    ss_anim->anim_frame_flags = ANIM_NORMAL_CONTROL;

    state->sprint = 0x00;
    state->crouch = 0x00;
    state->attack = 0x00;

    switch(ent->move_type)
    {
        case MOVE_ON_WATER:
            ent->move_type = MOVE_UNDERWATER;
        case MOVE_UNDERWATER:
            sm = World_GetModelByID(TR_MODEL_CROCODILE_UW_TR1);
            if(sm && ss_anim->model->id != TR_MODEL_CROCODILE_UW_TR1)
            {
                ss_anim->model = sm;
                Anim_SetAnimation(ss_anim, TR_ANIMATION_CROCODILE_UW_FLOW, 0);
            }
            break;

        case MOVE_ON_FLOOR:
            sm = World_GetModelByID(TR_MODEL_CROCODILE_OF_TR1);
            if(sm && ss_anim->model->id != TR_MODEL_CROCODILE_OF_TR1)
            {
                ss_anim->model = sm;
                Anim_SetAnimation(ss_anim, TR_ANIMATION_CROCODILE_OF_STAY, 0);
            }
            break;
    }

    if(ss_anim->model->id == TR_MODEL_CROCODILE_UW_TR1)
    {
        ent->character->parameters.param[PARAM_AIR] = 1000;
        ent->character->parameters.maximum[PARAM_AIR] = 1000;

        switch(current_state)
        {
            case TR_STATE_CROCODILE_UW_FLOW: // -> 2
                if(state->dead)
                {
                    Entity_SetAnimation(ent, ANIM_TYPE_BASE, TR_ANIMATION_CROCODILE_UW_DEAD, 0, NULL);
                }
                else if(cmd->action)
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_UW_ATTACK;
                }
                else
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_UW_FLOW;
                }
                break;

            case TR_STATE_CROCODILE_UW_ATTACK: // -> 1
                state->attack = 0x01;
                ent->dir_flag = ENT_MOVE_FORWARD;
                if(!state->dead && cmd->action)
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_UW_ATTACK;
                }
                else
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_UW_FLOW;
                }
                break;
                
        case TR_STATE_CROCODILE_DEAD:
            state->dead = 0x02;
            break;
        };
    }
    else if(ss_anim->model->id == TR_MODEL_CROCODILE_OF_TR1)
    {
        switch(current_state)
        {
            case TR_STATE_CROCODILE_STAY: // -> 2 -> 3 -> 4 -> 5
                if(state->dead)
                {
                    Entity_SetAnimation(ent, ANIM_TYPE_BASE, TR_ANIMATION_CROCODILE_OF_DEAD, 0, NULL);
                }
                else if(cmd->action)
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_ATTACK;
                }
                else if(cmd->move[0] > 0)
                {
                    ss_anim->next_state = (cmd->shift) ? (TR_STATE_CROCODILE_WALK) : (TR_STATE_CROCODILE_RUN);
                }
                else if(cmd->roll)
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_RUN_RIGHT;
                }
                else
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_STAY;
                }
                break;

            case TR_STATE_CROCODILE_WALK: // -> 1 -> 2
                ent->dir_flag = ENT_MOVE_FORWARD;
                if(!state->dead && (cmd->move[0] > 0))
                {
                    ss_anim->next_state = (cmd->shift) ? (TR_STATE_CROCODILE_WALK) : (TR_STATE_CROCODILE_RUN);
                }
                else
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_STAY;
                }
                break;

            case TR_STATE_CROCODILE_RUN: // -> 1 -> 3
                ent->dir_flag = ENT_MOVE_FORWARD;
                if(!state->dead && (cmd->move[0] > 0))
                {
                    ss_anim->next_state = (cmd->shift) ? (TR_STATE_CROCODILE_WALK) : (TR_STATE_CROCODILE_RUN);
                }
                else
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_STAY;
                }
                break;

            case TR_STATE_CROCODILE_RUN_RIGHT:
                ent->dir_flag = ENT_MOVE_FORWARD;
                cmd->rot[0] = -1;
                if(!state->dead && cmd->roll)
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_RUN_RIGHT;
                }
                else
                {
                    ss_anim->next_state = TR_STATE_CROCODILE_WALK;
                }
                break;

            case TR_STATE_CROCODILE_ATTACK:
                state->attack = 0x01;
                break;
                
            case TR_STATE_CROCODILE_DEAD:
                state->dead = 0x02;
                break;
        };
    }

    return 0;
}