Exemplo n.º 1
0
    public static void gmGmkTruckMain(AppMain.OBS_OBJECT_WORK obj_work)
    {
        AppMain.GMS_GMK_TRUCK_WORK truck_work      = (AppMain.GMS_GMK_TRUCK_WORK)obj_work;
        AppMain.GMS_ENEMY_COM_WORK gmsEnemyComWork = (AppMain.GMS_ENEMY_COM_WORK)obj_work;
        if (truck_work.target_player == null)
        {
            AppMain.gmGmkTruckInitDeathFall(obj_work, (AppMain.GMS_PLAYER_WORK)null);
            obj_work.ppFunc(obj_work);
        }
        else if (((int)truck_work.target_player.player_flag & 262144) == 0)
        {
            AppMain.gmGmkTruckInitFree(obj_work, truck_work.target_player);
            obj_work.ppFunc(obj_work);
        }
        else if (((int)truck_work.target_player.gmk_flag2 & 64) != 0)
        {
            AppMain.gmGmkTruckInitDeathFall(obj_work, truck_work.target_player);
            obj_work.ppFunc(obj_work);
        }
        else
        {
            if (((int)truck_work.target_player.player_flag & 1024) != 0)
            {
                obj_work.pos.z = 983040;
            }
            AppMain.GMS_PLAYER_WORK targetPlayer = truck_work.target_player;
            obj_work.prev_pos       = obj_work.pos;
            obj_work.pos.x          = targetPlayer.obj_work.pos.x;
            obj_work.pos.y          = targetPlayer.obj_work.pos.y;
            obj_work.move.x         = obj_work.pos.x - obj_work.prev_pos.x;
            obj_work.move.y         = obj_work.pos.y - obj_work.prev_pos.y;
            obj_work.move.z         = obj_work.pos.z - obj_work.prev_pos.z;
            obj_work.dir            = targetPlayer.obj_work.dir;
            obj_work.dir.z         += targetPlayer.obj_work.dir_fall;
            obj_work.vib_timer      = targetPlayer.obj_work.vib_timer;
            obj_work.disp_flag     &= 4294967279U;
            truck_work.tire_dir_spd = ((int)targetPlayer.obj_work.move_flag & 1) == 0 ? AppMain.ObjSpdDownSet(truck_work.tire_dir_spd, 128) : targetPlayer.obj_work.spd_m;
            truck_work.tire_dir    += (ushort)AppMain.FX_Div(truck_work.tire_dir_spd, 65536);
            int  id  = -1;
            uint num = 0;
            if (0 <= targetPlayer.act_state && targetPlayer.act_state <= 7 || (targetPlayer.act_state == 69 || targetPlayer.act_state == 70) || (targetPlayer.act_state == 74 || targetPlayer.act_state == 76 || targetPlayer.act_state == 75))
            {
                id  = 3;
                num = 4U;
            }
            else if (71 <= targetPlayer.act_state && targetPlayer.act_state <= 72)
            {
                id  = 0;
                num = 4U;
            }
            else if (((int)targetPlayer.obj_work.move_flag & 1) == 0)
            {
                id  = 1;
                num = 4U;
            }
            else if (((int)targetPlayer.obj_work.move_flag & 1) != 0 && ((int)targetPlayer.obj_work.move_flag & 4194304) == 0)
            {
                id = 2;
            }
            else if (obj_work.obj_3d.act_id[0] == 2 && ((int)obj_work.disp_flag & 8) != 0)
            {
                id  = targetPlayer.obj_work.spd_m == 0 ? 3 : 0;
                num = 4U;
            }
            else if (11 <= targetPlayer.act_state && targetPlayer.act_state <= 16 && (obj_work.obj_3d.act_id[0] != 2 || ((int)obj_work.disp_flag & 8) != 0))
            {
                id  = 3;
                num = 4U;
            }
            if (id != -1 && obj_work.obj_3d.act_id[0] != id)
            {
                AppMain.ObjDrawObjectActionSet3DNNBlend(obj_work, id);
                obj_work.disp_flag |= num;
            }
            if (obj_work.obj_3d.act_id[0] != 3 && (11 > targetPlayer.act_state || targetPlayer.act_state > 16 || obj_work.obj_3d.act_id[0] != 2))
            {
                obj_work.obj_3d.frame[0] = targetPlayer.obj_work.obj_3d.frame[0];
            }
            truck_work.slope_f_y_dir = (ushort)0;
            truck_work.slope_f_z_dir = (ushort)0;
            truck_work.slope_z_dir   = (ushort)0;
            float x;
            float y;
            float z;
            if (((int)targetPlayer.player_flag & 4) == 0)
            {
                x = 0.0f;
                y = 8f;
                z = -5f;
            }
            else
            {
                x = 0.0f;
                y = 8f;
                z = 5f;
            }
            AppMain.nnMakeUnitMatrix(obj_work.obj_3d.user_obj_mtx_r);
            AppMain.nnTranslateMatrix(obj_work.obj_3d.user_obj_mtx_r, obj_work.obj_3d.user_obj_mtx_r, truck_work.trans_r.x, truck_work.trans_r.y, truck_work.trans_r.z);
            if (((int)targetPlayer.gmk_flag & 262144) != 0 && targetPlayer.gmk_work3 != 0)
            {
                AppMain.NNS_MATRIX nnsMatrix = AppMain.GlobalPool <AppMain.NNS_MATRIX> .Alloc();

                truck_work.slope_z_dir   = (ushort)targetPlayer.gmk_work3;
                truck_work.slope_f_z_dir = (ushort)(AppMain.MTM_MATH_ABS(targetPlayer.gmk_work3) >> 2);
                truck_work.slope_f_y_dir = (ushort)(targetPlayer.gmk_work3 >> 2);
                AppMain.nnMakeUnitMatrix(nnsMatrix);
                AppMain.nnTranslateMatrix(nnsMatrix, nnsMatrix, -x, -y, -z);
                AppMain.nnRotateXMatrix(nnsMatrix, nnsMatrix, (int)truck_work.slope_z_dir);
                AppMain.nnRotateYMatrix(nnsMatrix, nnsMatrix, (int)truck_work.slope_f_y_dir);
                AppMain.nnRotateZMatrix(nnsMatrix, nnsMatrix, (int)truck_work.slope_f_z_dir);
                AppMain.nnTranslateMatrix(nnsMatrix, nnsMatrix, x, y, z);
                AppMain.nnMultiplyMatrix(obj_work.obj_3d.user_obj_mtx_r, obj_work.obj_3d.user_obj_mtx_r, nnsMatrix);
                AppMain.GlobalPool <AppMain.NNS_MATRIX> .Release(nnsMatrix);
            }
            if (((int)targetPlayer.obj_work.move_flag & 1) != 0 && AppMain.MTM_MATH_ABS(targetPlayer.obj_work.spd_m) >= AppMain.GMD_GMK_TRUCK_SPARK_EFCT_SMALL_MIN_SPD && (truck_work.efct_f_spark == null || truck_work.efct_b_spark == null))
            {
                AppMain.gmGmkTruckCreateSparkEfct(truck_work, 27);
            }
            if (truck_work.h_snd_lorry.au_player.sound == null || truck_work.h_snd_lorry.au_player.sound[0] == null)
            {
                truck_work.h_snd_lorry = AppMain.GsSoundAllocSeHandle();
                truck_work.h_snd_lorry.au_player.SetAisac("Speed", 0.0f);
                AppMain.GmSoundPlaySEForce("Lorry", truck_work.h_snd_lorry, true);
            }
            AppMain.gmGmkTruckSetMoveSeParam(obj_work, truck_work.h_snd_lorry, targetPlayer, ((int)targetPlayer.player_flag & 16777216) != 0 ? 1 : 0);
        }
    }
    // Token: 0x06000670 RID: 1648 RVA: 0x00039260 File Offset: 0x00037460
    public static void gmGmkTruckMain(AppMain.OBS_OBJECT_WORK obj_work)
    {
        AppMain.GMS_GMK_TRUCK_WORK gms_GMK_TRUCK_WORK = (AppMain.GMS_GMK_TRUCK_WORK)obj_work;
        if (gms_GMK_TRUCK_WORK.target_player == null)
        {
            AppMain.gmGmkTruckInitDeathFall(obj_work, null);
            obj_work.ppFunc(obj_work);
            return;
        }
        if ((gms_GMK_TRUCK_WORK.target_player.player_flag & 262144U) == 0U)
        {
            AppMain.gmGmkTruckInitFree(obj_work, gms_GMK_TRUCK_WORK.target_player);
            obj_work.ppFunc(obj_work);
            return;
        }
        if ((gms_GMK_TRUCK_WORK.target_player.gmk_flag2 & 64U) != 0U)
        {
            AppMain.gmGmkTruckInitDeathFall(obj_work, gms_GMK_TRUCK_WORK.target_player);
            obj_work.ppFunc(obj_work);
            return;
        }
        if ((gms_GMK_TRUCK_WORK.target_player.player_flag & 1024U) != 0U)
        {
            obj_work.pos.z = 983040;
        }
        AppMain.GMS_PLAYER_WORK target_player = gms_GMK_TRUCK_WORK.target_player;
        obj_work.prev_pos   = obj_work.pos;
        obj_work.pos.x      = target_player.obj_work.pos.x;
        obj_work.pos.y      = target_player.obj_work.pos.y;
        obj_work.move.x     = obj_work.pos.x - obj_work.prev_pos.x;
        obj_work.move.y     = obj_work.pos.y - obj_work.prev_pos.y;
        obj_work.move.z     = obj_work.pos.z - obj_work.prev_pos.z;
        obj_work.dir        = target_player.obj_work.dir;
        obj_work.dir.z      = ( ushort )(obj_work.dir.z + target_player.obj_work.dir_fall);
        obj_work.vib_timer  = target_player.obj_work.vib_timer;
        obj_work.disp_flag &= 4294967279U;
        if ((target_player.obj_work.move_flag & 1U) != 0U)
        {
            gms_GMK_TRUCK_WORK.tire_dir_spd = target_player.obj_work.spd_m;
        }
        else
        {
            gms_GMK_TRUCK_WORK.tire_dir_spd = AppMain.ObjSpdDownSet(gms_GMK_TRUCK_WORK.tire_dir_spd, 128);
        }
        AppMain.GMS_GMK_TRUCK_WORK gms_GMK_TRUCK_WORK2 = gms_GMK_TRUCK_WORK;
        gms_GMK_TRUCK_WORK2.tire_dir += ( ushort )AppMain.FX_Div(gms_GMK_TRUCK_WORK.tire_dir_spd, 65536);
        int  num  = -1;
        uint num2 = 0U;

        if ((0 <= target_player.act_state && target_player.act_state <= 7) || target_player.act_state == 69 || target_player.act_state == 70 || target_player.act_state == 74 || target_player.act_state == 76 || target_player.act_state == 75)
        {
            num  = 3;
            num2 = 4U;
        }
        else if (71 <= target_player.act_state && target_player.act_state <= 72)
        {
            num  = 0;
            num2 = 4U;
        }
        else if ((target_player.obj_work.move_flag & 1U) == 0U)
        {
            num  = 1;
            num2 = 4U;
        }
        else if ((target_player.obj_work.move_flag & 1U) != 0U && (target_player.obj_work.move_flag & 4194304U) == 0U)
        {
            num = 2;
        }
        else if (obj_work.obj_3d.act_id[0] == 2 && (obj_work.disp_flag & 8U) != 0U)
        {
            if (target_player.obj_work.spd_m != 0)
            {
                num = 0;
            }
            else
            {
                num = 3;
            }
            num2 = 4U;
        }
        else if (11 <= target_player.act_state && target_player.act_state <= 16 && (obj_work.obj_3d.act_id[0] != 2 || (obj_work.disp_flag & 8U) != 0U))
        {
            num  = 3;
            num2 = 4U;
        }
        if (num != -1 && obj_work.obj_3d.act_id[0] != num)
        {
            AppMain.ObjDrawObjectActionSet3DNNBlend(obj_work, num);
            obj_work.disp_flag |= num2;
        }
        if (obj_work.obj_3d.act_id[0] != 3 && (11 > target_player.act_state || target_player.act_state > 16 || obj_work.obj_3d.act_id[0] != 2))
        {
            obj_work.obj_3d.frame[0] = target_player.obj_work.obj_3d.frame[0];
        }
        gms_GMK_TRUCK_WORK.slope_f_y_dir = 0;
        gms_GMK_TRUCK_WORK.slope_f_z_dir = 0;
        gms_GMK_TRUCK_WORK.slope_z_dir   = 0;
        float num3;
        float num4;
        float num5;

        if ((target_player.player_flag & 4U) == 0U)
        {
            num3 = 0f;
            num4 = 8f;
            num5 = -5f;
        }
        else
        {
            num3 = 0f;
            num4 = 8f;
            num5 = 5f;
        }
        AppMain.nnMakeUnitMatrix(obj_work.obj_3d.user_obj_mtx_r);
        AppMain.nnTranslateMatrix(obj_work.obj_3d.user_obj_mtx_r, obj_work.obj_3d.user_obj_mtx_r, gms_GMK_TRUCK_WORK.trans_r.x, gms_GMK_TRUCK_WORK.trans_r.y, gms_GMK_TRUCK_WORK.trans_r.z);
        if ((target_player.gmk_flag & 262144U) != 0U && target_player.gmk_work3 != 0)
        {
            AppMain.NNS_MATRIX nns_MATRIX = AppMain.GlobalPool <AppMain.NNS_MATRIX> .Alloc();

            gms_GMK_TRUCK_WORK.slope_z_dir   = ( ushort )target_player.gmk_work3;
            gms_GMK_TRUCK_WORK.slope_f_z_dir = ( ushort )(AppMain.MTM_MATH_ABS(target_player.gmk_work3) >> 2);
            gms_GMK_TRUCK_WORK.slope_f_y_dir = ( ushort )(target_player.gmk_work3 >> 2);
            AppMain.nnMakeUnitMatrix(nns_MATRIX);
            AppMain.nnTranslateMatrix(nns_MATRIX, nns_MATRIX, -num3, -num4, -num5);
            AppMain.nnRotateXMatrix(nns_MATRIX, nns_MATRIX, ( int )gms_GMK_TRUCK_WORK.slope_z_dir);
            AppMain.nnRotateYMatrix(nns_MATRIX, nns_MATRIX, ( int )gms_GMK_TRUCK_WORK.slope_f_y_dir);
            AppMain.nnRotateZMatrix(nns_MATRIX, nns_MATRIX, ( int )gms_GMK_TRUCK_WORK.slope_f_z_dir);
            AppMain.nnTranslateMatrix(nns_MATRIX, nns_MATRIX, num3, num4, num5);
            AppMain.nnMultiplyMatrix(obj_work.obj_3d.user_obj_mtx_r, obj_work.obj_3d.user_obj_mtx_r, nns_MATRIX);
            AppMain.GlobalPool <AppMain.NNS_MATRIX> .Release(nns_MATRIX);
        }
        if ((target_player.obj_work.move_flag & 1U) != 0U && AppMain.MTM_MATH_ABS(target_player.obj_work.spd_m) >= AppMain.GMD_GMK_TRUCK_SPARK_EFCT_SMALL_MIN_SPD && (gms_GMK_TRUCK_WORK.efct_f_spark == null || gms_GMK_TRUCK_WORK.efct_b_spark == null))
        {
            AppMain.gmGmkTruckCreateSparkEfct(gms_GMK_TRUCK_WORK, 27);
        }
        if (gms_GMK_TRUCK_WORK.h_snd_lorry.au_player.sound == null || gms_GMK_TRUCK_WORK.h_snd_lorry.au_player.sound[0] == null)
        {
            gms_GMK_TRUCK_WORK.h_snd_lorry = AppMain.GsSoundAllocSeHandle();
            gms_GMK_TRUCK_WORK.h_snd_lorry.au_player.SetAisac("Speed", 0f);
            AppMain.GmSoundPlaySEForce("Lorry", gms_GMK_TRUCK_WORK.h_snd_lorry, true);
        }
        AppMain.gmGmkTruckSetMoveSeParam(obj_work, gms_GMK_TRUCK_WORK.h_snd_lorry, target_player, ((target_player.player_flag & 16777216U) != 0U) ? 1 : 0);
    }