Exemple #1
0
        public void LoadStatics(TileMatrixData tileData, Map map)
        {
            // get data from the tile Matrix
            byte[] groundData = tileData.GetLandChunk(ChunkX, ChunkY);
            int staticLength;
            byte[] staticsData = tileData.GetStaticChunk(ChunkX, ChunkY, out staticLength);

            // load the ground data into the tiles.
            int groundDataIndex = 0;
            for (int i = 0; i < 64; i++)
            {
                int tileID = groundData[groundDataIndex++] + (groundData[groundDataIndex++] << 8);
                int tileZ = (sbyte)groundData[groundDataIndex++];

                Ground ground = new Ground(tileID, map);
                ground.Position.Set((int)ChunkX * 8 + i % 8, (int)ChunkY * 8 + (i / 8), tileZ);
            }

            // load the statics data into the tiles
            int countStatics = staticLength / 7;
            int staticDataIndex = 0;
            for (int i = 0; i < countStatics; i++)
            {
                int iTileID = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] << 8);
                int iX = staticsData[staticDataIndex++];
                int iY = staticsData[staticDataIndex++];
                int iTileZ = (sbyte)staticsData[staticDataIndex++];
                int hue = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] * 256);

                StaticItem item = new StaticItem(iTileID, hue, i, map);
                item.Position.Set((int)ChunkX * 8 + iX, (int)ChunkY * 8 + iY, iTileZ);
            }
        }
 public MovingEffect(Map map,int sourceSerial, int targetSerial, int xSource, int ySource, int zSource, int xTarget, int yTarget, int zTarget, int itemID, int hue)
     : this(map, itemID, hue)
 {
     AEntity source = WorldModel.Entities.GetObject<AEntity>(sourceSerial, false);
     if (source != null)
     {
         if (source is Mobile)
         {
             base.SetSource(source.X, source.Y, source.Z);
             Mobile mobile = source as Mobile;
             if ((!mobile.IsClientEntity && !mobile.IsMoving) && ((xSource | ySource | zSource) != 0))
             {
                 source.Position.Set(xSource, ySource, zSource);
             }
         }
         else if (source is Item)
         {
             base.SetSource(source.X, source.Y, source.Z);
             Item item = source as Item;
             if ((xSource | ySource | zSource) != 0)
             {
                 item.Position.Set(xSource, ySource, zSource);
             }
         }
         else
         {
             base.SetSource(xSource, ySource, zSource);
         }
     }
     else
     {
         base.SetSource(xSource, ySource, zSource);
     }
     AEntity target = WorldModel.Entities.GetObject<AEntity>(targetSerial, false);
     if (target != null)
     {
         if (target is Mobile)
         {
             base.SetTarget(target);
             Mobile mobile = target as Mobile;
             if ((!mobile.IsClientEntity && !mobile.IsMoving) && ((xTarget | yTarget | zTarget) != 0))
             {
                 mobile.Position.Set(xTarget, yTarget, zTarget);
             }
         }
         else if (target is Item)
         {
             base.SetTarget(target);
             Item item = target as Item;
             if ((xTarget | yTarget | zTarget) != 0)
             {
                 item.Position.Set(xTarget, yTarget, zTarget);
             }
         }
         else
         {
             base.SetSource(xTarget, yTarget, zTarget);
         }
     }
 }
        public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
        {
            if (!m_AllowDefer)
            {
                if (CheckDefer(map, drawPosition))
                    return false;
            }
            else
            {
                m_AllowDefer = false;
            }

            int displayItemdID = (m_Animated) ? Effect.ItemID + ((Effect.FramesActive / m_AnimData.FrameInterval) % m_AnimData.FrameCount) : Effect.ItemID;

            if (displayItemdID != m_DisplayItemID)
            {
                m_DisplayItemID = displayItemdID;
                DrawTexture = IO.ArtData.GetStaticTexture(m_DisplayItemID);
                DrawArea = new Rectangle(DrawTexture.Width / 2 - 22, DrawTexture.Height - World.WorldViews.IsometricRenderer.TileSizeI + (Entity.Z * 4), DrawTexture.Width, DrawTexture.Height);
                PickType = PickType.PickNothing;
                DrawFlip = false;
            }

            // Update hue vector.
            HueVector = Utility.GetHueVector(Entity.Hue);

            return base.Draw(spriteBatch, drawPosition, mouseOverList, map);
        }
Exemple #4
0
 public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOver, Map map, bool roofHideFlag)
 {
     if (Entity.NoDraw)
     {
         return false;
     }
     // Update Display texture, if necessary.
     if (Entity.DisplayItemID != m_DisplayItemID)
     {
         m_DisplayItemID = Entity.DisplayItemID;
         DrawTexture = Provider.GetItemTexture(m_DisplayItemID);
         if (DrawTexture == null) // ' no draw ' item.
         {
             return false;
         }
         DrawArea = new Rectangle(DrawTexture.Width / 2 - IsometricRenderer.TILE_SIZE_INTEGER_HALF, DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER + (Entity.Z * 4), DrawTexture.Width, DrawTexture.Height);
         PickType = PickType.PickObjects;
         DrawFlip = false;
     }
     if (DrawTexture == null) // ' no draw ' item.
     {
         return false;
     }
     DrawArea.Y = DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER + (Entity.Z * 4);
     HueVector = Utility.GetHueVector(Entity.Hue, Entity.ItemData.IsPartialHue, false, false);
     if (Entity.Amount > 1 && Entity.ItemData.IsGeneric && Entity.DisplayItemID == Entity.ItemID)
     {
         int offset = Entity.ItemData.Unknown4;
         Vector3 offsetDrawPosition = new Vector3(drawPosition.X - 5, drawPosition.Y - 5, 0);
         base.Draw(spriteBatch, offsetDrawPosition, mouseOver, map, roofHideFlag);
     }
     bool drawn = base.Draw(spriteBatch, drawPosition, mouseOver, map, roofHideFlag);
     DrawOverheads(spriteBatch, drawPosition, mouseOver, map, DrawArea.Y - IsometricRenderer.TILE_SIZE_INTEGER_HALF);
     return drawn;
 }
Exemple #5
0
 public MovingEffect(Map map,int itemID, int hue)
     : base(map)
 {
     Hue = hue;
     itemID &= 0x3fff;
     m_ItemID = itemID | 0x4000;
 }
        public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
        {
            if (!m_AllowDefer)
            {
                if (CheckDefer(map, drawPosition))
                    return false;
            }
            else
            {
                m_AllowDefer = false;
            }

            int displayItemdID = (m_Animated) ? Effect.ItemID + ((Effect.FramesActive / m_AnimData.FrameInterval) % m_AnimData.FrameCount) : Effect.ItemID;

            if (displayItemdID != m_DisplayItemID)
            {
                m_DisplayItemID = displayItemdID;
                IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
                DrawTexture = provider.GetItemTexture(m_DisplayItemID);
                DrawArea = new Rectangle(DrawTexture.Width / 2 - 22, DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER, DrawTexture.Width, DrawTexture.Height);
                PickType = PickType.PickNothing;
                DrawFlip = false;
            }

            DrawArea.X = 0 - (int)((Entity.Position.X_offset - Entity.Position.Y_offset) * 22);
            DrawArea.Y = 0 + (int)((Entity.Position.Z_offset + Entity.Z) * 4) - (int)((Entity.Position.X_offset + Entity.Position.Y_offset) * 22);

            Rotation = Effect.AngleToTarget;

            // Update hue vector.
            HueVector = Utility.GetHueVector(Entity.Hue);

            return base.Draw(spriteBatch, drawPosition, mouseOverList, map);
        }
 public AnimatedItemEffect(Map map, int itemID, int hue, int duration)
     : base(map)
 {
     ItemID = (itemID & 0x3fff) | 0x4000;
     Hue = hue;
     Duration = duration;
 }
Exemple #8
0
 public StaticItem(int itemID, int hue,  int sortInfluence, Map map)
     : base(Serial.Null, map)
 {
     ItemID = itemID;
     Hue = hue;
     SortInfluence = sortInfluence;
 }
        public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
        {
            if (!m_AllowDefer)
            {
                if (CheckDefer(map, drawPosition))
                    return false;
            }
            else
            {
                m_AllowDefer = false;
            }

            int displayItemdID = 0x4e20 + Effect.FramesActive;

            if (displayItemdID != m_DisplayItemID)
            {
                m_DisplayItemID = displayItemdID;
                DrawTexture = IO.GumpData.GetGumpXNA(displayItemdID);
                Point offset = m_Offsets[m_DisplayItemID - 20000];
                DrawArea = new Rectangle(offset.X, DrawTexture.Height - 33 + (Entity.Z * 4) + offset.Y, DrawTexture.Width, DrawTexture.Height);
                PickType = PickType.PickNothing;
                DrawFlip = false;
            }

            // Update hue vector.
            HueVector = Utility.GetHueVector(Entity.Hue);

            return base.Draw(spriteBatch, drawPosition, mouseOverList, map);
        }
 public AnimatedItemEffect(Map map, int sourceSerial, int xSource, int ySource, int zSource, int ItemID, int Hue, int duration)
     : this(map, ItemID, Hue, duration)
 {
     AEntity source = WorldModel.Entities.GetObject<AEntity>(sourceSerial, false);
     if (source != null)
     {
         if (source is Mobile)
         {
             Mobile mobile = source as Mobile;
             if ((!mobile.IsClientEntity && !mobile.IsMoving) && (((xSource != 0) || (ySource != 0)) || (zSource != 0)))
             {
                 mobile.Position.Set(xSource, ySource, zSource);
             }
             SetSource(mobile);
         }
         else if (source is Item)
         {
             Item item = source as Item;
             if (((xSource != 0) || (ySource != 0)) || (zSource != 0))
             {
                 item.Position.Set(xSource, ySource, zSource);
             }
             SetSource(item);
         }
         else
         {
             SetSource(xSource, ySource, zSource);
         }
     }
     else
     {
         SetSource(xSource, ySource, zSource);
     }
 }
Exemple #11
0
        public void CreateSeasonalTileInfo()
        {
            m_StaticCounts = new Dictionary<int, int>();

            TileMatrixData tileData = new TileMatrixData(0);

            Map map = new Map(0);

            for (uint y = 0; y < tileData.ChunkHeight; y++)
            {
                Tracer.Info("Map Parser: row {0}.", y);
                for (uint x = 0; x < tileData.ChunkWidth; x++)
                {
                    ParseMapBlock(tileData, x, y);
                }
            }

            var items = from pair in m_StaticCounts
                        orderby pair.Value descending
                        select pair;

            using (FileStream file = new FileStream(@"AllTiles.txt", FileMode.Create))
            {
                StreamWriter stream = new StreamWriter(file);
                foreach (KeyValuePair<int, int> pair in items)
                {
                    ItemData itemData = TileData.ItemData[pair.Key];
                    if ((itemData.IsBackground || itemData.IsFoliage) && !itemData.IsWet && !itemData.IsSurface)
                        stream.WriteLine(string.Format("{0},{1} ; {2}", pair.Key, pair.Value, itemData.Name));
                }
                stream.Flush();
                file.Flush();
            }
        }
Exemple #12
0
 public BaseBook(Serial serial, Map map, bool writable, string title, string author)
     : base(serial, map)
 {
     m_Title = title;
     m_Author = author;
     m_IsEditable = writable;
     m_Pages = new BookPageInfo[0];
 }
Exemple #13
0
 public void SetMap(Map map)
 {
     if (map != Map)
     {
         Map = map;
         Position.Tile = Position3D.NullTile;
     }
 }
        public static void Render(SpriteBatch3D spriteBatch, MouseOverList mouseOverList, Map map)
        {
            if (m_Views.Count > 0)
            {
                for (int i = 0; i < m_Views.Count; i++)
                {
                    m_Views[i].View.Draw(spriteBatch, m_Views[i].DrawPosition, mouseOverList, map);
                }

                m_Views.Clear();
            }
        }
 public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
 {
     if (Entity is Mobile)
     {
         Mobile mobile = Entity as Mobile;
         if (!mobile.IsAlive || mobile.IsDisposed || mobile.Body == 0)
         {
             return false;
         }
     }
     m_BaseView.SetAllowDefer();
     return m_BaseView.Draw(spriteBatch, m_DrawPosition, mouseOverList, map);
 }
Exemple #16
0
        public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
        {
            int facing = MirrorFacingForDraw(Entity.Facing);
            int frameIndex = (int)(Entity.Frame * BodyConverter.DeathAnimationFrameCount(Entity.Body));

            AnimationFrame animationFrame = getFrame(Entity.Body, facing, frameIndex, Entity.Hue);

            DrawTexture = animationFrame.Texture;
            DrawArea = new Rectangle(0, 0, DrawTexture.Width, DrawTexture.Height);
            DrawFlip = false;

            return base.Draw(spriteBatch, drawPosition, mouseOverList, map);
        }
Exemple #17
0
 public LightningEffect(Map map, int sourceSerial, int xSource, int ySource, int zSource, int hue)
     : this(map, hue)
 {
     AEntity source = WorldModel.Entities.GetObject<AEntity>(sourceSerial, false);
     if (source != null)
     {
         SetSource(source);
     }
     else
     {
         SetSource(xSource, ySource, zSource);
     }
 }
Exemple #18
0
        // ============================================================
        // Ctor, Dispose, Update, and CreateView()
        // ============================================================
        public Mobile(Serial serial, Map map)
            : base(serial, map)
        {
            Equipment = new MobileEquipment(this);
            m_movement = new MobileMovement(this);
            m_movement.RequiresUpdate = true;

            Health = new CurrentMaxValue();
            Stamina = new CurrentMaxValue();
            Mana = new CurrentMaxValue();
            Followers = new CurrentMaxValue();
            Weight = new CurrentMaxValue();
            Flags = new MobileFlags();
        }
Exemple #19
0
        public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map, bool roofHideFlag)
        {
            if (m_NoDraw)
                return false;

            if (m_MustUpdateSurroundings)
            {
                updateSurroundingsAndNormals(Entity.Map);
                m_MustUpdateSurroundings = false;
            }

            if (!m_DrawAs3DStretched)
                return base.Draw(spriteBatch, drawPosition, mouseOverList, map, roofHideFlag);
            else
                return Draw3DStretched(spriteBatch, drawPosition, mouseOverList, map);
        }
Exemple #20
0
 public override bool DrawInternal(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOver, Map map, bool roofHideFlag)
 {
     int displayItemdID = (m_Animated) ? Effect.ItemID + ((Effect.FramesActive / m_AnimData.FrameInterval) % m_AnimData.FrameCount) : Effect.ItemID;
     if (displayItemdID != m_DisplayItemID)
     {
         m_DisplayItemID = displayItemdID;
         DrawTexture = Provider.GetItemTexture(m_DisplayItemID);
         DrawArea = new Rectangle(DrawTexture.Width / 2 - IsometricRenderer.TILE_SIZE_INTEGER_HALF, DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER, DrawTexture.Width, DrawTexture.Height);
         PickType = PickType.PickNothing;
         DrawFlip = false;
     }
     DrawArea.X = 0 - (int)((Entity.Position.X_offset - Entity.Position.Y_offset) * IsometricRenderer.TILE_SIZE_INTEGER_HALF);
     DrawArea.Y = 0 + (int)((Entity.Position.Z_offset + Entity.Z) * 4) - (int)((Entity.Position.X_offset + Entity.Position.Y_offset) * IsometricRenderer.TILE_SIZE_INTEGER_HALF);
     Rotation = Effect.AngleToTarget;
     HueVector = Utility.GetHueVector(Entity.Hue);
     return base.Draw(spriteBatch, drawPosition, mouseOver, map, roofHideFlag);
 }
        public override bool DrawInternal(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map, bool roofHideFlag)
        {
            int facing = MirrorFacingForDraw(Entity.Facing);
            int frameIndex = (int)(Entity.Frame * BodyConverter.DeathAnimationFrameCount(Entity.Body));

            IAnimationFrame animationFrame = getFrame(Entity.Body, facing, frameIndex, Entity.Hue);

            DrawFlip = (MirrorFacingForDraw(Entity.Facing) > 4) ? true : false;

            DrawTexture = animationFrame.Texture;

            DrawArea = new Rectangle(
                animationFrame.Center.X - IsometricRenderer.TILE_SIZE_INTEGER_HALF,
                DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER_HALF + (Entity.Z * 4) + animationFrame.Center.Y, DrawTexture.Width, DrawTexture.Height);

            return base.Draw(spriteBatch, drawPosition, mouseOverList, map, roofHideFlag);
        }
Exemple #22
0
        public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map, bool roofHideFlag)
        {
            if (Body == 0)
                return false;

            if (roofHideFlag)
            {
                int x = (Entity is Mobile) ? (Entity as Mobile).DestinationPosition.X : Entity.X;
                int y = (Entity is Mobile) ? (Entity as Mobile).DestinationPosition.Y : Entity.Y;
                if (CheckUnderSurface(map, x, y))
                    return false;
            }

            CheckDefer(map, drawPosition);

            return DrawInternal(spriteBatch, drawPosition, mouseOverList, map, roofHideFlag);
        }
Exemple #23
0
 public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOver, Map map, bool roofHideFlag)
 {
     if (m_BaseView.Entity is Mobile)
     {
         Mobile mobile = m_BaseView.Entity as Mobile;
         if (!mobile.IsAlive || mobile.IsDisposed || mobile.Body == 0)
         {
             Entity.Dispose();
             return false;
         }
     }
     /*m_BaseView.SetYClipLine(m_DrawPosition.Y - 22 -
         ((m_BaseView.Entity.Position.Z + m_BaseView.Entity.Position.Z_offset) * 4) +
         ((m_BaseView.Entity.Position.X_offset + m_BaseView.Entity.Position.Y_offset) * IsometricRenderer.TILE_SIZE_INTEGER_HALF));*/
     bool success = m_BaseView.DrawInternal(spriteBatch, m_DrawPosition, mouseOver, map, roofHideFlag);
     /*m_BaseView.ClearYClipLine();*/
     return success;
 }
        public override bool DrawInternal(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOver, Map map, bool roofHideFlag)
        {
            int displayItemdID = (m_Animated) ? Effect.ItemID + ((Effect.FramesActive / m_AnimData.FrameInterval) % m_AnimData.FrameCount) : Effect.ItemID;

            if (displayItemdID != m_DisplayItemID)
            {
                m_DisplayItemID = displayItemdID;
                DrawTexture = Provider.GetItemTexture(m_DisplayItemID);
                DrawArea = new Rectangle(DrawTexture.Width / 2 - 22, DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER + (Entity.Z * 4), DrawTexture.Width, DrawTexture.Height);
                PickType = PickType.PickNothing;
                DrawFlip = false;
            }

            // Update hue vector.
            HueVector = Utility.GetHueVector(Entity.Hue);

            return base.Draw(spriteBatch, drawPosition, mouseOver, map, roofHideFlag);
        }
Exemple #25
0
 void OnClick()
 {
     Directory.CreateDirectory("Chunks");
     IsometricLighting lighting = new IsometricLighting();
     MouseOverList mouseOverNull = new MouseOverList(new MousePicking());
     SpriteBatch3D spritebatch = Service.Get<SpriteBatch3D>();
     RenderTarget2D render = new RenderTarget2D(spritebatch.GraphicsDevice, Width + WidthExtra * 2, Height + HeightExtra * 2 + HeightExtra2);
     Map map = new Map(0);
     for (int chunky = 0; chunky < 10; chunky++)
     {
         for (int chunkx = 0; chunkx < 10; chunkx++)
         {
             spritebatch.GraphicsDevice.SetRenderTarget(render);
             spritebatch.Reset();
             uint cx = (uint)chunkx + 200;
             uint cy = (uint)chunky + 200;
             map.CenterPosition = new Point((int)(cx << 3), (int)(cy << 3));
             MapChunk chunk = map.GetMapChunk(cx, cy);
             chunk.LoadStatics(map.MapData, map);
             int z = 0;
             for (int i = 0; i < 64; i++)
             {
                 int y = (i / 8);
                 int x = (i % 8);
                 int sy = y * 22 + x * 22 + HeightExtra + HeightExtra2;
                 int sx = 22 * 8 - y * 22 + x * 22 + WidthExtra;
                 MapTile tile = chunk.Tiles[i];
                 tile.ForceSort();
                 for (int j = 0; j < tile.Entities.Count; j++)
                 {
                     AEntity e = tile.Entities[j];
                     AEntityView view = e.GetView();
                     view.Draw(spritebatch, new Vector3(sx, sy, 0), mouseOverNull, map, false);
                 }
             }
             spritebatch.SetLightIntensity(lighting.IsometricLightLevel);
             spritebatch.SetLightDirection(lighting.IsometricLightDirection);
             spritebatch.GraphicsDevice.Clear(Color.Transparent);
             spritebatch.FlushSprites(true);
             spritebatch.GraphicsDevice.SetRenderTarget(null);
             render.SaveAsPng(new FileStream($"Chunks/{cy}-{cx}.png", FileMode.Create), render.Width, render.Height);
         }
     }
 }
Exemple #26
0
        public void Update(Map map, Position3D center, MousePicking mousePick)
        {
            int pixelScale = (Settings.UserInterface.PlayWindowPixelDoubling) ? 2 : 1;
            if (m_RenderTargetSprites == null || m_RenderTargetSprites.Width != Settings.UserInterface.PlayWindowGumpResolution.Width / pixelScale || m_RenderTargetSprites.Height != Settings.UserInterface.PlayWindowGumpResolution.Height / pixelScale)
            {
                if (m_RenderTargetSprites != null)
                    m_RenderTargetSprites.Dispose();
                m_RenderTargetSprites = new RenderTarget2D(
                    m_SpriteBatch.GraphicsDevice, 
                    Settings.UserInterface.PlayWindowGumpResolution.Width / pixelScale, 
                    Settings.UserInterface.PlayWindowGumpResolution.Height / pixelScale, 
                    false, 
                    SurfaceFormat.Color, 
                    DepthFormat.Depth24Stencil8, 
                    0, 
                    RenderTargetUsage.DiscardContents);
            }

            DetermineIfClientIsUnderEntity(map, center);
            DrawEntities(map, center, mousePick, out m_DrawOffset);
        }
        public override bool DrawInternal(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOver, Map map, bool roofHideFlag)
        {
            int displayItemdID = 0x4e20 + Effect.FramesActive;
            if (displayItemdID > 0x4e29)
            {
                return false;
            }
            if (displayItemdID != m_DisplayItemID)
            {
                m_DisplayItemID = displayItemdID;
                DrawTexture = Provider.GetUITexture(displayItemdID);
                Point offset = s_Offsets[m_DisplayItemID - 20000];
                DrawArea = new Rectangle(offset.X, DrawTexture.Height - 33 + (Entity.Z * 4) + offset.Y, DrawTexture.Width, DrawTexture.Height);
                PickType = PickType.PickNothing;
                DrawFlip = false;
            }

            // Update hue vector.
            HueVector = Utility.GetHueVector(Entity.Hue);

            return base.Draw(spriteBatch, drawPosition, mouseOver, map, roofHideFlag);
        }
Exemple #28
0
        private bool Draw3DStretched(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
        {
            // this is an isometric stretched tile and needs a specialized draw routine.
            m_vertexBufferAlternate[0].Position = drawPosition + m_vertex0_yOffset;
            m_vertexBufferAlternate[1].Position = drawPosition + m_vertex1_yOffset;
            m_vertexBufferAlternate[2].Position = drawPosition + m_vertex2_yOffset;
            m_vertexBufferAlternate[3].Position = drawPosition + m_vertex3_yOffset;

            if (!spriteBatch.DrawSprite(DrawTexture, m_vertexBufferAlternate, s_Technique))
                return false;

            if ((mouseOverList.PickType & PickType) == PickType)
            {
                if (mouseOverList.IsMouseInObjectIsometric(m_vertexBufferAlternate))
                {
                    MouseOverItem item = new MouseOverItem(DrawTexture, m_vertexBufferAlternate[0].Position, Entity);
                    item.Vertices = new Vector3[4] { m_vertexBufferAlternate[0].Position, m_vertexBufferAlternate[1].Position, m_vertexBufferAlternate[2].Position, m_vertexBufferAlternate[3].Position };
                    mouseOverList.Add2DItem(item);
                }
            }

            return true;
        }
Exemple #29
0
        public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
        {
            if (Entity.NoDraw)
                return false;

            // Update Display texture, if necessary.
            if (Entity.DisplayItemID != m_DisplayItemID)
            {
                m_DisplayItemID = Entity.DisplayItemID;
                IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
                DrawTexture = provider.GetItemTexture(m_DisplayItemID);

                if(DrawTexture == null)
                {
                    return false;
                }

                DrawArea = new Rectangle(DrawTexture.Width / 2 - 22, DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER + (Entity.Z * 4), DrawTexture.Width, DrawTexture.Height);
                PickType = PickType.PickObjects;
                DrawFlip = false;
            }

            // Update hue vector.
            HueVector = Utility.GetHueVector(Entity.Hue, Entity.ItemData.IsPartialHue, false);

            if (Entity.Amount > 1 && Entity.ItemData.IsGeneric && Entity.DisplayItemID == Entity.ItemID)
            {
                int offset = Entity.ItemData.Unknown4;
                Vector3 offsetDrawPosition = new Vector3(drawPosition.X - 5, drawPosition.Y - 5, 0);
                base.Draw(spriteBatch, offsetDrawPosition, mouseOverList, map);
            }
            bool drawn = base.Draw(spriteBatch, drawPosition, mouseOverList, map);

            DrawOverheads(spriteBatch, drawPosition, mouseOverList, map, (int)DrawArea.Y - 22);

            return drawn;
        }
Exemple #30
0
        public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
        {
            if (Entity.NoDraw)
                return false;

            // Update Display texture, if necessary.
            if (Entity.DisplayItemID != m_DisplayItemID)
            {
                m_DisplayItemID = Entity.DisplayItemID;
                DrawTexture = IO.ArtData.GetStaticTexture(m_DisplayItemID);

                if(DrawTexture == null)
                {
                    return false;
                }

                DrawArea = new Rectangle(DrawTexture.Width / 2 - 22, DrawTexture.Height - World.WorldViews.IsometricRenderer.TileSizeI + (Entity.Z * 4), DrawTexture.Width, DrawTexture.Height);
                PickType = PickType.PickObjects;
                DrawFlip = false;
            }

            // Update hue vector.
            HueVector = Utility.GetHueVector(Entity.Hue, Entity.ItemData.IsPartialHue, false);

            if (Entity.Amount > 1 && Entity.ItemData.IsGeneric)
            {
                int offset = Entity.ItemData.Unknown4;
                Vector3 offsetDrawPosition = new Vector3(drawPosition.X - 5, drawPosition.Y - 5, 0);
                base.Draw(spriteBatch, offsetDrawPosition, mouseOverList, map);
            }
            bool drawn = base.Draw(spriteBatch, drawPosition, mouseOverList, map);

            DrawOverheads(spriteBatch, drawPosition, mouseOverList, map, (int)DrawArea.Y - 22);

            return drawn;
        }