Example #1
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            v5 = Math.Min(Math.Max((int)item.Scale.Z, -1), 0);
            if (v5 < 0)
            {
                transform.Push();
                transform.NJTranslate(item.Position);
                transform.NJRotateY(item.Rotation.Y);
                float Scale = item.Scale.X + 1.0f;
                transform.NJScale(Scale, Scale, Scale);
                result = HitResult.Min(result, modelB.CheckHit(Near, Far, Viewport, Projection, View, transform, meshesB));
                transform.Pop();
                return(result);
            }
            if (v5 >= 0)
            {
                transform.Push();
                transform.NJTranslate(item.Position);
                transform.NJRotateY(item.Rotation.Y);
                float Scale = item.Scale.X + 1.0f;
                transform.NJScale(Scale, Scale, Scale);
                result = HitResult.Min(result, modelA.CheckHit(Near, Far, Viewport, Projection, View, transform, meshesA));
                transform.Pop();
                return(result);
            }
            return(result);
        }
Example #2
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            transform.Push();
            transform.NJTranslate(item.Position.ToVector3());
            transform.NJRotateY(item.Rotation.Y);
            transform.Push();
            transform.NJTranslate(0, 0, 10);
            transform.NJScale(0.1000000014901161f, 0.1000000014901161f, 2);
            result = HitResult.Min(result, model.CheckHit(Near, Far, Viewport, Projection, View, transform, meshes));
            transform.Pop();
            transform.Push();
            transform.NJTranslate(0, 0, 20);
            transform.NJRotateX(0x2000);
            transform.NJTranslate(0, 0, -3);
            transform.NJScale(0.1000000014901161f, 0.1000000014901161f, 0.699999988079071f);
            result = HitResult.Min(result, model.CheckHit(Near, Far, Viewport, Projection, View, transform, meshes));
            transform.Pop();
            transform.Push();
            transform.NJTranslate(0, 0, 20);
            transform.NJRotateX(0xE000);
            transform.NJTranslate(0, 0, -3);
            transform.NJScale(0.1000000014901161f, 0.1000000014901161f, 0.699999988079071f);
            result = HitResult.Min(result, model.CheckHit(Near, Far, Viewport, Projection, View, transform, meshes));
            transform.Pop();
            transform.NJScale((item.Scale.X + 10) / 5f, (item.Scale.Y + 10) / 5f, 0.1000000014901161f);
            result = HitResult.Min(result, model.CheckHit(Near, Far, Viewport, Projection, View, transform, meshes));
            transform.Pop();
            return(result);
        }
Example #3
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            transform.Push();
            transform.NJTranslate(item.Position);
            transform.Push();
            transform.NJScale(4.5f, 4.5f, 4.5f);
            result = HitResult.Min(result, sphere.CheckHit(Near, Far, Viewport, Projection, View, transform, spheremsh));
            transform.Pop();
            switch (type)
            {
            case WhaleDefType.AOSummon:
            default:
                transform.NJTranslate(item.Scale);
                transform.NJRotateY(item.Rotation.Y);
                break;

            case WhaleDefType.AOKill:
                transform.NJRotateZ(0x8000);
                break;

            case WhaleDefType.POSummon:
                transform.NJTranslate(item.Scale);
                transform.NJRotateX(0x2000);
                transform.NJRotateY(item.Rotation.Y);
                break;
            }
            transform.NJScale(0.4f, 0.4f, 0.4f);
            result = HitResult.Min(result, whale.CheckHit(Near, Far, Viewport, Projection, View, transform, whalemsh));
            transform.Pop();
            return(result);
        }
Example #4
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJRotateY(item.Rotation.Y);
            transform.TranslateLocal(0, 110f, 0);
            transform.Push();
            result = HitResult.Min(result, arch.CheckHit(Near, Far, Viewport, Projection, View, transform, archmsh));
            transform.Pop();
            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJRotateY(item.Rotation.Y);
            transform.TranslateLocal(0, 0, 73f);
            transform.Push();
            result = HitResult.Min(result, side1.CheckHit(Near, Far, Viewport, Projection, View, transform, side1msh));
            transform.Pop();
            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJRotateY(item.Rotation.Y);
            transform.TranslateLocal(0, 0, -57f);
            transform.Push();
            result = HitResult.Min(result, side2.CheckHit(Near, Far, Viewport, Projection, View, transform, side2msh));
            transform.Pop();
            return(result);
        }
Example #5
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            transform.Push();
            transform.NJTranslate(item.Position);
            result = HitResult.Min(result, model.CheckHit(Near, Far, Viewport, Projection, View, transform, meshes));
            transform.Pop();
            return(result);
        }
Example #6
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJScale((item.Scale.X + 1f), (item.Scale.X + 1f), (item.Scale.X + 1f));
            transform.Push();
            result = HitResult.Min(result, sphere.CheckHit(Near, Far, Viewport, Projection, View, transform, spheremsh));
            transform.Pop();
            return(result);
        }
Example #7
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJRotateObject(item.Rotation);
            transform.NJTranslate(2f, 0f, 0f);
            transform.Push();
            result = HitResult.Min(result, frog.CheckHit(Near, Far, Viewport, Projection, View, transform, frogmsh));
            transform.Pop();
            return(result);
        }
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            for (int i = 0; i < Math.Min(item.Scale.X + 1, 8); i++)
            {
                transform.Push();
                if (item.Scale.Z == 1)                 // circle
                {
                    double  v4 = i * 360.0;
                    Vector3 v7 = new Vector3(
                        ObjectHelper.NJSin((int)(v4 / item.Scale.X * 65536.0 * 0.002777777777777778)) * item.Scale.Y,
                        0,
                        ObjectHelper.NJCos((int)(v4 / item.Scale.X * 65536.0 * 0.002777777777777778)) * item.Scale.Y);
                    transform.Push();
                    transform.NJTranslate(item.Position);
                    transform.NJRotateObject(item.Rotation);
                    Vector3 pos = Vector3.TransformCoordinate(v7, transform.Top);
                    transform.Pop();
                    transform.NJTranslate(pos);
                    result = HitResult.Min(result, model.CheckHit(Near, Far, Viewport, Projection, View, transform, meshes));
                }
                else                 // line
                {
                    transform.Push();
                    transform.NJTranslate(item.Position);
                    transform.NJRotateObject(item.Rotation);
                    double v5;
                    if (i % 2 == 1)
                    {
                        v5 = i * item.Scale.Y * -0.5;
                    }
                    else
                    {
                        v5 = Math.Ceiling(i * 0.5) * item.Scale.Y;
                    }
                    Vector3 pos = Vector3.TransformCoordinate(new Vector3(0, 0, (float)v5), transform.Top);
                    transform.Pop();
                    transform.NJTranslate(pos);
                    result = HitResult.Min(result, model.CheckHit(Near, Far, Viewport, Projection, View, transform, meshes));
                }
                transform.Pop();
            }
            return(result);
        }
Example #9
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJScale(4.5f, 4.5f, 4.5f);
            transform.Push();
            result = HitResult.Min(result, sphere.CheckHit(Near, Far, Viewport, Projection, View, transform, spheremsh));
            transform.Pop();
            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJRotateX(0x2000);
            transform.NJScale(0.40000001f, 0.40000001f, 0.40000001f);
            transform.Push();
            result = HitResult.Min(result, whale.CheckHit(Near, Far, Viewport, Projection, View, transform, whalemsh));
            transform.Pop();
            return(result);
        }
Example #10
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJRotateY(item.Rotation.Y);
            transform.NJTranslate(0, 110, 0);
            result = HitResult.Min(result, arch.CheckHit(Near, Far, Viewport, Projection, View, transform, archmsh));
            transform.Pop();
            transform.Push();
            transform.NJTranslate(ObjectHelper.NJSin(item.Rotation.Y) * 73 + item.Position.X, item.Position.Y, ObjectHelper.NJCos(item.Rotation.Y) * 73 + item.Position.Z);
            result = HitResult.Min(result, side1.CheckHit(Near, Far, Viewport, Projection, View, transform, side1msh));
            transform.Pop();
            transform.Push();
            transform.NJTranslate(item.Position.X - ObjectHelper.NJSin(item.Rotation.Y) * 57, item.Position.Y, item.Position.Z - ObjectHelper.NJCos(item.Rotation.Y) * 57);
            result = HitResult.Min(result, side2.CheckHit(Near, Far, Viewport, Projection, View, transform, side2msh));
            transform.Pop();
            return(result);
        }
Example #11
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;
            int       ScaleX = (int)item.Scale.X;

            switch (ScaleX)
            {
            case 1:
                transform.Push();
                transform.NJTranslate(item.Position);
                transform.NJRotateObject(item.Rotation);
                result = HitResult.Min(result, modelB.CheckHit(Near, Far, Viewport, Projection, View, transform, meshesB));
                transform.Pop();
                break;

            case 2:
                transform.Push();
                transform.NJTranslate(item.Position);
                transform.NJRotateObject(item.Rotation);
                result = HitResult.Min(result, modelC.CheckHit(Near, Far, Viewport, Projection, View, transform, meshesC));
                transform.Pop();
                break;

            case 3:
                transform.Push();
                transform.NJTranslate(item.Position);
                transform.NJRotateObject(item.Rotation);
                result = HitResult.Min(result, modelD.CheckHit(Near, Far, Viewport, Projection, View, transform, meshesD));
                transform.Pop();
                break;

            default:
                transform.Push();
                transform.NJTranslate(item.Position);
                transform.NJRotateObject(item.Rotation);
                result = HitResult.Min(result, modelA.CheckHit(Near, Far, Viewport, Projection, View, transform, meshesA));
                transform.Pop();
                break;
            }
            return(result);
        }
Example #12
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJRotateY(item.Rotation.Y);
            transform.Push();
            transform.NJTranslate(Base.Position[0], (Base.Position[1]), Base.Position[2]);
            result = HitResult.Min(result, Base.CheckHit(Near, Far, Viewport, Projection, View, transform, BaseMsh));
            transform.Pop();
            transform.Push();
            transform.NJTranslate(Fan.Position[0], (Fan.Position[1] + 30.0f), Fan.Position[2]);
            result = HitResult.Min(result, Fan.CheckHit(Near, Far, Viewport, Projection, View, transform, FanMsh));
            transform.Pop();
            transform.Push();
            transform.NJTranslate(Cap.Position[0], (Cap.Position[1] + 44.0f), Cap.Position[2]);
            result = HitResult.Min(result, Cap.CheckHit(Near, Far, Viewport, Projection, View, transform, CapMsh));
            transform.Pop();
            transform.Pop();
            return(result);
        }
Example #13
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            v5 = (ulong)item.Scale.X;
            if (v5 != 0)
            {
                v6 = (int)v5 - 1;
                if (v6 == 0)
                {
                    transform.Push();
                    transform.NJTranslate(item.Position);
                    transform.NJRotateObject(item.Rotation);
                    result = HitResult.Min(result, modelB.CheckHit(Near, Far, Viewport, Projection, View, transform, meshesB));
                    transform.Pop();
                    return(result);
                }
                if (v6 == 1)
                {
                    transform.Push();
                    transform.NJTranslate(item.Position);
                    transform.NJRotateObject(item.Rotation);
                    result = HitResult.Min(result, modelC.CheckHit(Near, Far, Viewport, Projection, View, transform, meshesC));
                    transform.Pop();
                    return(result);
                }
            }
            else
            {
                transform.Push();
                transform.NJTranslate(item.Position);
                transform.NJRotateObject(item.Rotation);
                result = HitResult.Min(result, modelA.CheckHit(Near, Far, Viewport, Projection, View, transform, meshesA));
                transform.Pop();
                return(result);
            }
            return(result);
        }
Example #14
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;
            int       rows   = (int)Math.Max(item.Scale.X, 1);
            int       cols   = (int)Math.Max(item.Scale.Z, 1);

            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJRotateObject(item.Rotation.X & 0xC000, item.Rotation.Y, 0);
            transform.NJTranslate((1 - rows) * 7.5f, 0, (1 - cols) * 7.5f);
            for (int i = 0; i < rows; ++i)
            {
                transform.Push();
                for (int j = 0; j < cols; ++j)
                {
                    result = HitResult.Min(result, model.CheckHit(Near, Far, Viewport, Projection, View, transform, meshes));
                    transform.NJTranslate(0, 0, 15);
                }
                transform.Pop();
                transform.NJTranslate(15, 0, 0);
            }
            transform.Pop();
            return(result);
        }
Example #15
0
        public override HitResult CheckHit(SETItem item, Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
        {
            HitResult result = HitResult.NoHit;

            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJRotateY(item.Rotation.Y);
            result = HitResult.Min(result, ballmodel.CheckHit(Near, Far, Viewport, Projection, View, transform, ballmeshes));
            transform.Pop();
            double v24 = item.Scale.X * 0.05000000074505806;

            transform.Push();
            double v22 = item.Scale.X * 0.5 + item.Position.Y;

            transform.NJTranslate(item.Position.X, (float)v22, item.Position.Z);
            transform.NJScale(1.0f, (float)v24, 1.0f);
            result = HitResult.Min(result, cylindermodel.CheckHit(Near, Far, Viewport, Projection, View, transform, cylindermeshes));
            transform.Pop();
            transform.Push();
            transform.NJTranslate(item.Position.X, item.Position.Y + item.Scale.Z, item.Position.Z);
            result = HitResult.Min(result, spheremodel.CheckHit(Near, Far, Viewport, Projection, View, transform, spheremeshes));
            transform.Pop();
            return(result);
        }