public static WalkAnimation PoolInstance(Mobile m, int x, int y, int z, int dir) { if (m_Pool == null) { m_Pool = new Queue(); } if (m_Pool.Count > 0) { WalkAnimation animation = (WalkAnimation)m_Pool.Dequeue(); animation.Initialize(m, x, y, z, dir); return(animation); } return(new WalkAnimation(m, x, y, z, dir)); }
public void UpdatePosition() { double normalized = this.m_Sync.Normalized; if (normalized >= 1.0) { if (this.m_Timer == null) { this.m_Timer = new Timer(new OnTick(this.Delete_OnTick), 0, 1); this.m_Timer.Start(false); } } else { if (normalized >= 0.5) { this.Alpha = (float)(1.0 - ((normalized - 0.5) * 2.0)); } int xWorld = Renderer.m_xWorld; int yWorld = Renderer.m_yWorld; int zWorld = Renderer.m_zWorld; int x = this.m_Mobile.X; int y = this.m_Mobile.Y; int z = this.m_Mobile.Z; x -= xWorld; y -= yWorld; z -= zWorld; int num8 = (Engine.GameWidth >> 1) + ((x - y) * 0x16); int num9 = (((Engine.GameHeight >> 1) + 0x16) + ((x + y) * 0x16)) - (z * 4); num8 += Engine.GameX; num9 += Engine.GameY; if (this.m_Mobile.Walking.Count > 0) { WalkAnimation animation = (WalkAnimation)this.m_Mobile.Walking.Peek(); int xOffset = 0; int yOffset = 0; int fOffset = 0; if (animation.Snapshot(ref xOffset, ref yOffset, ref fOffset)) { num8 += xOffset; num9 += yOffset; } } num8 -= Renderer.m_xScroll; num9 -= Renderer.m_yScroll; this.X = (num8 - (((base.Image.xMax - base.Image.xMin) + 1) / 2)) - base.Image.xMin; this.Y = (num9 - 30) - ((int)(normalized * 40.0)); base.Scissor(new Clipper(Engine.GameX, Engine.GameY, Engine.GameWidth, Engine.GameHeight)); } }
public override bool Slice() { if ((Renderer.m_Frames - this.m_Start) >= 10) { return(false); } int xWorld = Renderer.m_xWorld; int yWorld = Renderer.m_yWorld; int zWorld = Renderer.m_zWorld; int x = 0; int y = 0; int z = 0; int xOffset = 0; int yOffset = 0; int fOffset = 0; base.GetSource(out x, out y, out z); x -= xWorld; y -= yWorld; z -= zWorld; int num10 = ((Engine.GameWidth >> 1) - 0x16) + ((x - y) * 0x16); int num11 = (((Engine.GameHeight >> 1) + 11) + ((x + y) * 0x16)) - (z * 4); num10 += Engine.GameX; num11 += Engine.GameY; num10 -= Renderer.m_xScroll; num11 -= Renderer.m_yScroll; if ((base.m_Source != null) && (base.m_Source.GetType() == typeof(Mobile))) { Mobile source = (Mobile)base.m_Source; if (source.Walking.Count > 0) { WalkAnimation animation = (WalkAnimation)source.Walking.Peek(); if (animation.Snapshot(ref xOffset, ref yOffset, ref fOffset)) { num10 += xOffset; num11 += yOffset; } } } Texture gump = (Renderer.m_Dead ? Hues.Grayscale : this.m_Hue).GetGump(0x4e20 + (Renderer.m_Frames - this.m_Start)); if (this.m_tCache != gump) { this.m_tCache = gump; this.m_vCache.Invalidate(); } this.m_vCache.DrawGame(gump, num10 - (gump.Width / 2), num11 - gump.Height); return(true); }
public override bool Slice() { int xWorld = Renderer.m_xWorld; int yWorld = Renderer.m_yWorld; int zWorld = Renderer.m_zWorld; int x = 0; int y = 0; int z = 0; int xOffset = 0; int yOffset = 0; int fOffset = 0; base.GetSource(out x, out y, out z); x -= xWorld; y -= yWorld; z -= zWorld; int num10 = (Engine.GameWidth >> 1) + ((x - y) * 0x16); int num11 = (((Engine.GameHeight >> 1) + 0x16) + ((x + y) * 0x16)) - (z * 4); num10 += Engine.GameX; num11 += Engine.GameY; if ((base.m_Source != null) && (base.m_Source.GetType() == typeof(Mobile))) { Mobile source = (Mobile)base.m_Source; if (source.Walking.Count > 0) { WalkAnimation animation = (WalkAnimation)source.Walking.Peek(); if (animation.Snapshot(ref xOffset, ref yOffset, ref fOffset)) { num10 += xOffset; num11 += yOffset; } } } num10 -= Renderer.m_xScroll; num11 -= Renderer.m_yScroll; Texture t = null; IHue hue = Renderer.m_Dead ? Hues.Grayscale : this.m_Hue; if (this.m_Animated) { if ((Renderer.m_Frames - this.m_Start) >= this.m_Duration) { return(false); } t = hue.GetItem(this.m_ItemID + this.m_Animation[((Renderer.m_Frames - this.m_Start) / this.m_Delay) % this.m_FrameCount]); } else { if ((Renderer.m_Frames - this.m_Start) >= this.m_Duration) { return(false); } t = hue.GetItem(this.m_ItemID); } if (this.m_vCache == null) { this.m_vCache = base.VCPool.GetInstance(); } switch (this.m_RenderMode) { case 2: Renderer.SetAlpha(1f); Renderer.SetAlphaEnable(true); Renderer.SetBlendType(DrawBlendType.Additive); break; case 3: Renderer.SetAlpha(1.5f); Renderer.SetAlphaEnable(true); Renderer.SetBlendType(DrawBlendType.Additive); break; case 4: Renderer.SetAlpha(0.5f); Renderer.SetAlphaEnable(true); Renderer.SetBlendType(DrawBlendType.Normal); break; } this.m_vCache.DrawGame(t, num10 - (t.Width / 2), num11 - t.Height); switch (this.m_RenderMode) { case 2: case 3: case 4: Renderer.SetAlphaEnable(false); Renderer.SetBlendType(DrawBlendType.Normal); break; } return(true); }
public override bool Slice() { double normalized = base.m_Sync.Normalized; if (normalized >= 1.0) { return(false); } int xWorld = Renderer.m_xWorld; int yWorld = Renderer.m_yWorld; int zWorld = Renderer.m_zWorld; int x = 0; int y = 0; int z = 0; int xOffset = 0; int yOffset = 0; int fOffset = 0; base.GetSource(out x, out y, out z); x -= xWorld; y -= yWorld; z -= zWorld; int num11 = (Engine.GameWidth >> 1) + ((x - y) * 0x16); int num12 = ((Engine.ScreenHeight >> 1) + ((x + y) * 0x16)) - (z * 4); num11 += Engine.GameX; num12 += Engine.GameY; num11 -= Renderer.m_xScroll; num12 -= Renderer.m_yScroll; if ((base.m_Source != null) && (base.m_Source.GetType() == typeof(Mobile))) { Mobile source = (Mobile)base.m_Source; if (source.Walking.Count > 0) { WalkAnimation animation = (WalkAnimation)source.Walking.Peek(); if (animation.Snapshot(ref xOffset, ref yOffset, ref fOffset)) { num11 += xOffset; num12 += yOffset; } } num12 -= 30; } base.GetTarget(out x, out y, out z); x -= xWorld; y -= yWorld; z -= zWorld; int num13 = (Engine.GameWidth >> 1) + ((x - y) * 0x16); int num14 = ((Engine.GameHeight >> 1) + ((x + y) * 0x16)) - (z * 4); num13 += Engine.GameX; num14 += Engine.GameY; num13 -= Renderer.m_xScroll; num14 -= Renderer.m_yScroll; if ((base.m_Target != null) && (base.m_Target.GetType() == typeof(Mobile))) { Mobile target = (Mobile)base.m_Target; if (target.Walking.Count > 0) { WalkAnimation animation2 = (WalkAnimation)target.Walking.Peek(); if (animation2.Snapshot(ref xOffset, ref yOffset, ref fOffset)) { num13 += xOffset; num14 += yOffset; } } num14 -= 30; } Texture t = null; if (base.m_Animated) { if (Renderer.m_Dead) { t = Hues.Grayscale.GetItem(base.m_ItemID + base.m_Animation[((Renderer.m_Frames - base.m_Start) / base.m_Delay) % base.m_FrameCount]); } else { t = base.m_Hue.GetItem(base.m_ItemID + base.m_Animation[((Renderer.m_Frames - base.m_Start) / base.m_Delay) % base.m_FrameCount]); } } else if (Renderer.m_Dead) { t = Hues.Grayscale.GetItem(base.m_ItemID); } else { t = base.m_Hue.GetItem(base.m_ItemID); } if (base.m_Source == null) { num11 -= t.Width / 2; num12 += 0x16 - t.Height; } else { num11 -= t.xMin + ((t.xMax - t.xMin) / 2); num12 -= t.yMin + ((t.yMax - t.yMin) / 2); } if (base.m_Target == null) { num13 -= t.Width / 2; num14 += 0x16 - t.Height; } else { num13 -= t.xMin + ((t.xMax - t.xMin) / 2); num14 -= t.yMin + ((t.yMax - t.yMin) / 2); } int num15 = num11 + ((int)((num13 - num11) * normalized)); int num16 = num12 + ((int)((num14 - num12) * normalized)); if (this.m_vCache == null) { this.m_vCache = base.VCPool.GetInstance(); } this.m_vCache.DrawGame(t, num15, num16); if (this.m_Double) { if (this.m_vCacheDouble == null) { this.m_vCacheDouble = base.VCPool.GetInstance(); } this.m_vCacheDouble.DrawGame(t, num15 + 5, num16 + 5); } return(true); }
public override bool Slice() { double normalized = this.m_Sync.Normalized; if (normalized >= 1.0) { return(false); } int xWorld = Renderer.m_xWorld; int yWorld = Renderer.m_yWorld; int zWorld = Renderer.m_zWorld; int x = 0; int y = 0; int z = 0; int xOffset = 0; int yOffset = 0; int fOffset = 0; base.GetSource(out x, out y, out z); x -= xWorld; y -= yWorld; z -= zWorld; int num11 = (Engine.GameWidth >> 1) + ((x - y) * 0x16); int num12 = ((Engine.GameHeight >> 1) + ((x + y) * 0x16)) - (z * 4); if (base.m_Source is Mobile) { num12 -= 30; } num11 += Engine.GameX; num12 += Engine.GameY; num11 -= Renderer.m_xScroll; num12 -= Renderer.m_yScroll; if ((base.m_Source != null) && (base.m_Source.GetType() == typeof(Mobile))) { Mobile source = (Mobile)base.m_Source; if (source.Walking.Count > 0) { WalkAnimation animation = (WalkAnimation)source.Walking.Peek(); if (animation.Snapshot(ref xOffset, ref yOffset, ref fOffset)) { num11 += xOffset; num12 += yOffset; } } } base.GetTarget(out x, out y, out z); x -= xWorld; y -= yWorld; z -= zWorld; int num13 = (Engine.GameWidth >> 1) + ((x - y) * 0x16); int num14 = ((Engine.GameHeight >> 1) + ((x + y) * 0x16)) - (z * 4); if (base.m_Target is Mobile) { num14 -= 50; } num13 += Engine.GameX; num14 += Engine.GameY; num13 -= Renderer.m_xScroll; num14 -= Renderer.m_yScroll; if ((base.m_Target != null) && (base.m_Target.GetType() == typeof(Mobile))) { Mobile target = (Mobile)base.m_Target; if (target.Walking.Count > 0) { WalkAnimation animation2 = (WalkAnimation)target.Walking.Peek(); if (animation2.Snapshot(ref xOffset, ref yOffset, ref fOffset)) { num13 += xOffset; num14 += yOffset; } } } Texture item = null; IHue hue = Renderer.m_Dead ? Hues.Grayscale : this.m_Hue; if (this.m_Animated) { item = hue.GetItem(this.m_ItemID + this.m_Animation[((Renderer.m_Frames - this.m_Start) / this.m_Delay) % this.m_FrameCount]); } else { item = hue.GetItem(this.m_ItemID); } switch (this.m_RenderMode) { case 2: Renderer.SetAlpha(1f); Renderer.SetAlphaEnable(true); Renderer.SetBlendType(DrawBlendType.Additive); break; case 3: Renderer.SetAlpha(1.5f); Renderer.SetAlphaEnable(true); Renderer.SetBlendType(DrawBlendType.Additive); break; case 4: Renderer.SetAlpha(0.5f); Renderer.SetAlphaEnable(true); Renderer.SetBlendType(DrawBlendType.Normal); break; } int num15 = num11 + ((int)((num13 - num11) * normalized)); int num16 = num12 + ((int)((num14 - num12) * normalized)); item.DrawRotated(num15, num16, Math.Atan2((double)(num12 - num14), (double)(num11 - num13))); switch (this.m_RenderMode) { case 2: case 3: case 4: Renderer.SetAlphaEnable(false); Renderer.SetBlendType(DrawBlendType.Normal); break; } return(true); }
private void Initialize(Mobile m, int NewX, int NewY, int NewZ, int NewDir) { this.m_Mobile = m; this.m_NewX = NewX; this.m_NewY = NewY; this.m_NewZ = NewZ; this.m_NewDir = NewDir; int x = 0; int y = 0; int z = 0; if (m.Walking.Count == 0) { x = m.X; y = m.Y; z = m.Z; } else { IEnumerator enumerator = m.Walking.GetEnumerator(); WalkAnimation current = null; while (enumerator.MoveNext()) { current = (WalkAnimation)enumerator.Current; } if (current != null) { x = current.m_NewX; y = current.m_NewY; z = current.m_NewZ; } } if (!m.Player) { Engine.EquipSort(m, NewDir & 0x87); m.Direction = (byte)NewDir; } this.m_Advance = false; this.m_Sync = null; if (((x != NewX) || (y != NewY)) || (z != NewZ)) { int num4 = NewX - x; int num5 = NewY - y; int num6 = NewZ - z; int num7 = (num4 - num5) * 0x16; int num8 = ((num4 + num5) * 0x16) - (num6 * 4); this.m_X = num7; this.m_Y = num8; int idx = (NewDir >> 7) & 1; ArrayList equip = m.Equip; bool mounted = (equip.Count > 0) && (((EquipEntry)equip[0]).m_Layer == Layer.Mount); if ((m.Player && Engine.GMPrivs) && ((Engine.m_WalkSpeed != 0.4f) || (Engine.m_RunSpeed != 0.2f))) { this.m_Duration = (idx == 0) ? Engine.m_WalkSpeed : Engine.m_RunSpeed; } else { this.m_Duration = GetDuration(mounted, idx); } if (m.Player && (m.Body == 0x3db)) { this.m_Duration *= 0.25f; } this.m_Frames = GetFrames(mounted, idx); } else { this.m_X = 0; this.m_Y = 0; this.m_Duration = 0.1f; this.m_Frames = 0f; } }