Exemple #1
0
        public void CreateMirroredDecal(float timeInSeconds = -1f)
        {
            Vector3 dir;
            float   rotAngle = 0f;

            switch (MirrorFlip)
            {
            case GraffitiMethods.MirrorFlip.Mirror:
                rotAngle = RotationAngle - ((RotationAngle - 180f) * 2f);
                break;

            case GraffitiMethods.MirrorFlip.Mirror2:
                rotAngle = (RotationAngle - ((RotationAngle - 180f) * 2f)) - 180f;
                break;

            case GraffitiMethods.MirrorFlip.Flip:
                rotAngle = RotationAngle - 180f;
                break;

            case GraffitiMethods.MirrorFlip.Flip2:
                rotAngle = RotationAngle;
                break;
            }

            Vector3 pos = GetMirroredPos(out dir);

            MirroredHandle = DecalHelper.AddDecalTexture(TaggedVehicle.GetOffsetInWorldCoords(pos), dir, rotAngle, GraffitiOG.TextureDictionary, GraffitiOG.TextureName, GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].DecalTypeID, DisplayWidth, DisplayHeight, RGB_Red, RGB_Green, RGB_Blue, RGB_Alpha, timeInSeconds, true, TaggedVehicle);
        }
Exemple #2
0
        public override void Remove()
        {
            if (DecalTypeIndexIsValid() && isCounted)
            {
                GraffitiOG.LoadedCount--;
                if (GraffitiOG.LoadedCount < 1)
                {
                    GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].Available = true;
                    GraffitiOG.DecalTypeIndex = -1;
                }
                isCounted = false;
            }

            DecalHelper.RemoveDecal(Handle);

            Handle            = -1337;
            justMadeRedundant = true;

            DeleteMirroredDecal();

            if (TaggedVehicle != null && TaggedVehicle.Exists())
            {
                DecalHelper.RemoveDecalsInRange(TaggedVehicle.GetOffsetInWorldCoords(Location), 0.0000000000001f);
            }
        }
Exemple #3
0
        public override void CreateDecal(float timeInSeconds = -1f)
        {
            if (GraffitiOG.LoadedCount > 0 || GraffitiMethods.AvailableDecalTypeExists())
            {
                if (GraffitiOG.LoadedCount < 1)
                {
                    GraffitiOG.LoadedCount    = 0; // Just in case it some how goes negative..
                    GraffitiOG.DecalTypeIndex = GraffitiMethods.NextAvailableDecalType();
                }

                if (!DecalTypeIndexIsValid())
                {
                    return;
                }

                GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].Available = false;
                Handle = DecalHelper.AddDecalTexture(TaggedVehicle.GetOffsetInWorldCoords(Location), Direction, RotationAngle, GraffitiOG.TextureDictionary, GraffitiOG.TextureName, GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].DecalTypeID, DisplayWidth, DisplayHeight, RGB_Red, RGB_Green, RGB_Blue, RGB_Alpha, timeInSeconds, true, TaggedVehicle);

                if (MirrorFlip != GraffitiMethods.MirrorFlip.None)
                {
                    CreateMirroredDecal(timeInSeconds);
                }

                if (Exists() && !isCounted)
                {
                    GraffitiOG.LoadedCount++;
                    isCounted = true;
                }
            }
            else
            {
                UI.ShowSubtitle("There are too many decals in this area!\nSome will not display.", 1);
            }
        }
Exemple #4
0
        public override void CreateDecal(float timeInSeconds = -1f)
        {
            if (GraffitiOG.LoadedCount > 0 || GraffitiMethods.AvailableDecalTypeExists())
            {
                if (GraffitiOG.LoadedCount < 1)
                {
                    GraffitiOG.LoadedCount    = 0; // Just in case it some how goes negative..
                    GraffitiOG.DecalTypeIndex = GraffitiMethods.NextAvailableDecalType();
                }

                if (!DecalTypeIndexIsValid())
                {
                    return;
                }

                GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].Available = false;
                Handle = DecalHelper.AddDecalTexture(Location, Direction, RotationAngle, GraffitiOG.TextureDictionary, GraffitiOG.TextureName, GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].DecalTypeID, DisplayWidth, DisplayHeight, 255f, 255f, 255f, 255f, timeInSeconds);

                if (Exists() && !isCounted)
                {
                    GraffitiOG.LoadedCount++;
                    isCounted = true;
                }
            }
            else
            {
                UI.ShowSubtitle("There are too many decals in this area!\nSome will not display.", 1);
            }
        }
Exemple #5
0
        public override void ManageInWorld()
        {
            if (!Initialized())
            {
                return;
            }

            if (IsWithinViewingRange())
            {
                if (Exists())
                {
                    // Debug
                    if (GraffitiMethods.SeeInfoMode)
                    {
                        ShowInfo3D();
                    }

                    if (!DecalTypeIndexIsValid())
                    {
                        return;
                    }
                    GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].Available = false;
                    DecalHelper.AddTextureToDecalType(GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].DecalTypeID, GraffitiOG.TextureDictionary, GraffitiOG.TextureName);
                }
                else
                {
                    this.CreateDecal();
                }
                justMadeRedundant = false;
            }
            else if (!IsWithinViewingRange())
            {
                if (!justMadeRedundant)
                {
                    /*if (this.Exists())
                     * {
                     *  this.Remove();
                     * }
                     * else
                     * {
                     *  if (DecalTypeIndexIsValid() && isCounted)
                     *  {
                     *      GraffitiOG.LoadedCount--;
                     *      if (GraffitiOG.LoadedCount < 1)
                     *      {
                     *          GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].Available = true;
                     *          GraffitiOG.DecalTypeIndex = -1;
                     *      }
                     *      isCounted = false;
                     *  }
                     *  justMadeRedundant = true;
                     * }*/

                    this.Remove();
                }
            }
        }
Exemple #6
0
        public void DeleteMirroredDecal()
        {
            DecalHelper.RemoveDecal(MirroredHandle);

            Vector3 temp;

            if (TaggedVehicle != null && TaggedVehicle.Exists())
            {
                DecalHelper.RemoveDecalsInRange(TaggedVehicle.GetOffsetInWorldCoords(GetMirroredPos(out temp)), 0.0000000000001f);
            }
        }
Exemple #7
0
        public virtual void Remove()
        {
            if (DecalTypeIndexIsValid() && isCounted)
            {
                GraffitiOG.LoadedCount--;
                if (GraffitiOG.LoadedCount < 1)
                {
                    GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].Available = true;
                    GraffitiOG.DecalTypeIndex = -1;
                }
                isCounted = false;
            }

            DecalHelper.RemoveDecal(Handle);
            DecalHelper.RemoveDecalsInRange(Location, 0.0000000000001f);

            Handle            = -1337;
            justMadeRedundant = true;
        }
Exemple #8
0
        public static bool DisplayTemporaryGraffiti()
        {
            if (UsableDecalTypes.Any(d => d.Available)) //((LastHitDecalTypeIndex != -1 && UsableDecalTypes[LastHitDecalTypeIndex].Available) || NextAvailableDecalType(out LastHitDecalTypeIndex))
            {
                RaycastResult ray = World.Raycast(GameplayCamera.Position, GameplayCamera.Position + GameplayCamera.Direction * 2000, IntersectOptions.Map | IntersectOptions.Mission_Entities | IntersectOptions.Objects, Game.Player.Character);

                //int handle = TextureClasses.AddDecalTexture(ray.HitCoords, -ray.SurfaceNormal, new Vector3(unkX, unkY, unkZ).Normalized, "graffiti", "black_angel_wings", TextureClasses.DecalTypes.solidPool_oil, 3.84f, 3.555f, 255f, 255f, 255f, 255f, 0.5f);

                //Vector2 temp = MathHelper.PointOnCircle(1f, RotationAngle, new Vector2(0f, 0f));
                //Vector3 unkVec3 = Quaternion.FromToRotation(-ray.SurfaceNormal, -ray.SurfaceNormal) * new Vector3(temp.Y, temp.X, 0f);
                //Vector3 unkVec3 = Quaternion.RotationAxis(-ray.SurfaceNormal, MathUtil.DegreesToRadians(RotationAngle)) * new Vector3(1f, 1f, 1f);

                Vector2 grafSize = ResizedWidthHeightBasedOnNewWidth(LastSelectedGraffiti.TextureWidth, LastSelectedGraffiti.TextureHeight, 2f, WidthHeightSizeCoeff);

                LastHitLocation      = ray.HitCoords;
                LastHitDirection     = -ray.SurfaceNormal;
                LastHitRotationAngle = RotationAngle;
                LastHitGrafSize      = grafSize;

                if (ray.DitHitEntity && GTAVFunctions.GTAFunction.EntityIsAVehicle(ray.HitEntity))
                {
                    LastHitVehicle = (Vehicle)ray.HitEntity;
                }
                else
                {
                    LastHitVehicle = null;
                }

                int handle = DecalHelper.AddDecalTexture(ray.HitCoords, -ray.SurfaceNormal, RotationAngle, LastSelectedGraffiti.TextureDictionary, LastSelectedGraffiti.TextureName, 9007, grafSize.X, grafSize.Y, 255f, 255f, 255f, 255f, 0.5f, true, LastHitVehicle);

                /*UI.ShowSubtitle(
                 *  "Angle: " + RotationAngle
                 + "~n~SurfaceNormal: " + -ray.SurfaceNormal
                 +  , 1);*/
                return(true);
            }
            else
            {
                UI.ShowSubtitle("Too many decals nearby!\nYou cannot place anymore here.", 1);
                return(false);
            }
        }
Exemple #9
0
 public bool Exists()
 {
     return(DecalHelper.IsDecalAlive(Handle));
 }