Пример #1
0
		internal static void TakeDownUpdateType(Gore gore)
		{
			if (gore.realType > 0)
			{
				gore.type = gore.realType;
				gore.realType = 0;
			}
		}
Пример #2
0
		public override void OnSpawn(Gore gore)
		{
			gore.velocity = new Vector2(Main.rand.NextFloat() - 0.5f, Main.rand.NextFloat() * MathHelper.TwoPi);
			gore.numFrames = 8;
			gore.frame = (byte)Main.rand.Next(8);
			gore.frameCounter = (byte)Main.rand.Next(8);
			updateType = 910;
		}
Пример #3
0
 //in Terraria.Main.DrawGore and DrawGoreBehind replace type checks with this
 internal static bool DrawBackGore(Gore gore)
 {
     if (gore.modGore != null)
     {
         return gore.modGore.DrawBehind(gore);
     }
     return ((gore.type >= 706 && gore.type <= 717) || gore.type == 943) && (gore.frame < 7 || gore.frame > 9);
 }
Пример #4
0
		internal static void SetupUpdateType(Gore gore)
		{
			if (gore.modGore != null && gore.modGore.updateType > 0)
			{
				gore.realType = gore.type;
				gore.type = gore.modGore.updateType;
			}
		}
Пример #5
0
		//in Terraria.Gore add modGore property (internal set)
		//in Terraria.Gore.NewGore after resetting properties call ModGore.SetupGore(Main.gore[num]);
		internal static void SetupGore(Gore gore)
		{
			if (modGores.ContainsKey(gore.type))
			{
				gore.modGore = modGores[gore.type];
				gore.modGore.OnSpawn(gore);
			}
			else
			{
				gore.modGore = null;
			}
		}
Пример #6
0
        public void Update()
        {
            if (Main.netMode == 2 || !this.active)
            {
                return;
            }
            bool flag = this.type >= 1024 && this.type <= 1026;

            if (this.type >= 276 && this.type <= 282)
            {
                this.velocity.X *= 0.98f;
                this.velocity.Y *= 0.98f;
                if ((double)this.velocity.Y < (double)this.scale)
                {
                    this.velocity.Y += 0.05f;
                }
                if ((double)this.velocity.Y > 0.1)
                {
                    if ((double)this.velocity.X > 0.0)
                    {
                        this.rotation += 0.01f;
                    }
                    else
                    {
                        this.rotation -= 0.01f;
                    }
                }
            }
            if (this.type >= 570 && this.type <= 572)
            {
                this.scale -= 1f / 1000f;
                if ((double)this.scale <= 0.01)
                {
                    this.scale    = 0.01f;
                    Gore.goreTime = 0;
                }
                this.sticky   = false;
                this.rotation = this.velocity.X * 0.1f;
            }
            else if (this.type >= 706 && this.type <= 717 || this.type == 943)
            {
                this.alpha = (double)this.position.Y >= Main.worldSurface * 16.0 + 8.0 ? 100 : 0;
                int num1 = 4;
                ++this.frameCounter;
                if ((int)this.frame <= 4)
                {
                    int x = (int)((double)this.position.X / 16.0);
                    int y = (int)((double)this.position.Y / 16.0) - 1;
                    if (WorldGen.InWorld(x, y, 0) && !Main.tile[x, y].active())
                    {
                        this.active = false;
                    }
                    if ((int)this.frame == 0)
                    {
                        num1 = 24 + Main.rand.Next(256);
                    }
                    if ((int)this.frame == 1)
                    {
                        num1 = 24 + Main.rand.Next(256);
                    }
                    if ((int)this.frame == 2)
                    {
                        num1 = 24 + Main.rand.Next(256);
                    }
                    if ((int)this.frame == 3)
                    {
                        num1 = 24 + Main.rand.Next(96);
                    }
                    if ((int)this.frame == 5)
                    {
                        num1 = 16 + Main.rand.Next(64);
                    }
                    if (this.type == 716)
                    {
                        num1 *= 2;
                    }
                    if (this.type == 717)
                    {
                        num1 *= 4;
                    }
                    if (this.type == 943 && (int)this.frame < 6)
                    {
                        num1 = 4;
                    }
                    if ((int)this.frameCounter >= num1)
                    {
                        this.frameCounter = (byte)0;
                        ++this.frame;
                        if ((int)this.frame == 5)
                        {
                            int index = Gore.NewGore(this.position, this.velocity, this.type, 1f);
                            Main.gore[index].frame     = (byte)9;
                            Main.gore[index].velocity *= 0.0f;
                        }
                        if (this.type == 943 && (int)this.frame > 4)
                        {
                            if (Main.rand.Next(2) == 0)
                            {
                                Gore gore = Main.gore[Gore.NewGore(this.position, this.velocity, this.type, this.scale)];
                                gore.frameCounter = (byte)0;
                                gore.frame        = (byte)7;
                                gore.velocity     = Vector2.UnitY * 1f;
                            }
                            if (Main.rand.Next(2) == 0)
                            {
                                Gore gore = Main.gore[Gore.NewGore(this.position, this.velocity, this.type, this.scale)];
                                gore.frameCounter = (byte)0;
                                gore.frame        = (byte)7;
                                gore.velocity     = Vector2.UnitY * 2f;
                            }
                        }
                    }
                }
                else if ((int)this.frame <= 6)
                {
                    int num2 = 8;
                    if (this.type == 716)
                    {
                        num2 *= 2;
                    }
                    if (this.type == 717)
                    {
                        num2 *= 3;
                    }
                    if ((int)this.frameCounter >= num2)
                    {
                        this.frameCounter = (byte)0;
                        ++this.frame;
                        if ((int)this.frame == 7)
                        {
                            this.active = false;
                        }
                    }
                }
                else if ((int)this.frame <= 9)
                {
                    int num2 = 6;
                    if (this.type == 716)
                    {
                        num2             = (int)((double)num2 * 1.5);
                        this.velocity.Y += 0.175f;
                    }
                    else if (this.type == 717)
                    {
                        num2            *= 2;
                        this.velocity.Y += 0.15f;
                    }
                    else if (this.type == 943)
                    {
                        num2             = (int)((double)num2 * 1.5);
                        this.velocity.Y += 0.2f;
                    }
                    else
                    {
                        this.velocity.Y += 0.2f;
                    }
                    if ((double)this.velocity.Y < 0.5)
                    {
                        this.velocity.Y = 0.5f;
                    }
                    if ((double)this.velocity.Y > 12.0)
                    {
                        this.velocity.Y = 12f;
                    }
                    if ((int)this.frameCounter >= num2)
                    {
                        this.frameCounter = (byte)0;
                        ++this.frame;
                    }
                    if ((int)this.frame > 9)
                    {
                        this.frame = (byte)7;
                    }
                }
                else
                {
                    if (this.type == 716)
                    {
                        num1 *= 2;
                    }
                    else if (this.type == 717)
                    {
                        num1 *= 6;
                    }
                    this.velocity.Y += 0.1f;
                    if ((int)this.frameCounter >= num1)
                    {
                        this.frameCounter = (byte)0;
                        ++this.frame;
                    }
                    this.velocity *= 0.0f;
                    if ((int)this.frame > 14)
                    {
                        this.active = false;
                    }
                }
            }
            else if (this.type == 11 || this.type == 12 || (this.type == 13 || this.type == 61) || (this.type == 62 || this.type == 63 || (this.type == 99 || this.type == 220)) || (this.type == 221 || this.type == 222 || this.type >= 375 && this.type <= 377 || (this.type >= 435 && this.type <= 437 || this.type >= 861 && this.type <= 862)))
            {
                this.velocity.Y *= 0.98f;
                this.velocity.X *= 0.98f;
                this.scale      -= 0.007f;
                if ((double)this.scale < 0.1)
                {
                    this.scale = 0.1f;
                    this.alpha = (int)byte.MaxValue;
                }
            }
            else if (this.type == 16 || this.type == 17)
            {
                this.velocity.Y *= 0.98f;
                this.velocity.X *= 0.98f;
                this.scale      -= 0.01f;
                if ((double)this.scale < 0.1)
                {
                    this.scale = 0.1f;
                    this.alpha = (int)byte.MaxValue;
                }
            }
            else if (this.type == 331)
            {
                this.alpha      += 5;
                this.velocity.Y *= 0.95f;
                this.velocity.X *= 0.95f;
                this.rotation    = this.velocity.X * 0.1f;
            }
            else if (GoreID.Sets.SpecialAI[this.type] == 3)
            {
                if ((int)++this.frameCounter >= 8 && (double)this.velocity.Y > 0.200000002980232)
                {
                    this.frameCounter = (byte)0;
                    int num = (int)this.frame / 4;
                    if ((int)++this.frame >= 4 + num * 4)
                    {
                        this.frame = (byte)(num * 4);
                    }
                }
            }
            else if (GoreID.Sets.SpecialAI[this.type] != 1 && GoreID.Sets.SpecialAI[this.type] != 2)
            {
                if (this.type >= 907 && this.type <= 909)
                {
                    this.rotation    = 0.0f;
                    this.velocity.X *= 0.98f;
                    if ((double)this.velocity.Y > 0.0 && (double)this.velocity.Y < 1.0 / 1000.0)
                    {
                        this.velocity.Y = (float)((double)Main.rand.NextFloat() * -3.0 - 0.5);
                    }
                    if ((double)this.velocity.Y > -1.0)
                    {
                        this.velocity.Y -= 0.1f;
                    }
                    if ((double)this.scale < 1.0)
                    {
                        this.scale += 0.1f;
                    }
                    if ((int)++this.frameCounter >= 8)
                    {
                        this.frameCounter = (byte)0;
                        if ((int)++this.frame >= 3)
                        {
                            this.frame = (byte)0;
                        }
                    }
                }
                else if (this.type < 411 || this.type > 430)
                {
                    this.velocity.Y += 0.2f;
                }
            }
            this.rotation += this.velocity.X * 0.1f;
            if (this.type >= 580 && this.type <= 582)
            {
                this.rotation    = 0.0f;
                this.velocity.X *= 0.95f;
            }
            if (GoreID.Sets.SpecialAI[this.type] == 2)
            {
                if (this.timeLeft < 60)
                {
                    this.alpha += Main.rand.Next(1, 7);
                }
                else if (this.alpha > 100)
                {
                    this.alpha -= Main.rand.Next(1, 4);
                }
                if (this.alpha < 0)
                {
                    this.alpha = 0;
                }
                if (this.alpha > (int)byte.MaxValue)
                {
                    this.timeLeft = 0;
                }
                this.velocity.X = (float)(((double)this.velocity.X * 50.0 + (double)Main.windSpeed * 2.0 + (double)Main.rand.Next(-10, 11) * 0.100000001490116) / 51.0);
                float num1 = 0.0f;
                if ((double)this.velocity.X < 0.0)
                {
                    num1 = this.velocity.X * 0.2f;
                }
                this.velocity.Y = (float)(((double)this.velocity.Y * 50.0 - 0.349999994039536 + (double)num1 + (double)Main.rand.Next(-10, 11) * 0.200000002980232) / 51.0);
                this.rotation   = this.velocity.X * 0.6f;
                float num2 = -1f;
                if (Main.goreLoaded[this.type])
                {
                    Rectangle rectangle1 = new Rectangle((int)this.position.X, (int)this.position.Y, (int)((double)Main.goreTexture[this.type].Width * (double)this.scale), (int)((double)Main.goreTexture[this.type].Height * (double)this.scale));
                    for (int index = 0; index < (int)byte.MaxValue; ++index)
                    {
                        if (Main.player[index].active && !Main.player[index].dead)
                        {
                            Rectangle rectangle2 = new Rectangle((int)Main.player[index].position.X, (int)Main.player[index].position.Y, Main.player[index].width, Main.player[index].height);
                            if (rectangle1.Intersects(rectangle2))
                            {
                                this.timeLeft = 0;
                                num2          = Main.player[index].velocity.Length();
                                break;
                            }
                        }
                    }
                }
                if (this.timeLeft > 0)
                {
                    if (Main.rand.Next(2) == 0)
                    {
                        --this.timeLeft;
                    }
                    if (Main.rand.Next(50) == 0)
                    {
                        this.timeLeft -= 5;
                    }
                    if (Main.rand.Next(100) == 0)
                    {
                        this.timeLeft -= 10;
                    }
                }
                else
                {
                    this.alpha = (int)byte.MaxValue;
                    if (Main.goreLoaded[this.type] && (double)num2 != -1.0)
                    {
                        float num3 = (float)((double)Main.goreTexture[this.type].Width * (double)this.scale * 0.800000011920929);
                        float x    = this.position.X;
                        float y    = this.position.Y;
                        float num4 = (float)Main.goreTexture[this.type].Width * this.scale;
                        float num5 = (float)Main.goreTexture[this.type].Height * this.scale;
                        int   Type = 31;
                        for (int index1 = 0; (double)index1 < (double)num3; ++index1)
                        {
                            int index2 = Dust.NewDust(new Vector2(x, y), (int)num4, (int)num5, Type, 0.0f, 0.0f, 0, new Color(), 1f);
                            Main.dust[index2].velocity *= (float)((1.0 + (double)num2) / 3.0);
                            Main.dust[index2].noGravity = true;
                            Main.dust[index2].alpha     = 100;
                            Main.dust[index2].scale     = this.scale;
                        }
                    }
                }
            }
            if (this.type >= 411 && this.type <= 430)
            {
                this.alpha      = 50;
                this.velocity.X = (float)(((double)this.velocity.X * 50.0 + (double)Main.windSpeed * 2.0 + (double)Main.rand.Next(-10, 11) * 0.100000001490116) / 51.0);
                this.velocity.Y = (float)(((double)this.velocity.Y * 50.0 - 0.25 + (double)Main.rand.Next(-10, 11) * 0.200000002980232) / 51.0);
                this.rotation   = this.velocity.X * 0.3f;
                if (Main.goreLoaded[this.type])
                {
                    Rectangle rectangle1 = new Rectangle((int)this.position.X, (int)this.position.Y, (int)((double)Main.goreTexture[this.type].Width * (double)this.scale), (int)((double)Main.goreTexture[this.type].Height * (double)this.scale));
                    for (int index = 0; index < (int)byte.MaxValue; ++index)
                    {
                        if (Main.player[index].active && !Main.player[index].dead)
                        {
                            Rectangle rectangle2 = new Rectangle((int)Main.player[index].position.X, (int)Main.player[index].position.Y, Main.player[index].width, Main.player[index].height);
                            if (rectangle1.Intersects(rectangle2))
                            {
                                this.timeLeft = 0;
                            }
                        }
                    }
                    if (Collision.SolidCollision(this.position, (int)((double)Main.goreTexture[this.type].Width * (double)this.scale), (int)((double)Main.goreTexture[this.type].Height * (double)this.scale)))
                    {
                        this.timeLeft = 0;
                    }
                }
                if (this.timeLeft > 0)
                {
                    if (Main.rand.Next(2) == 0)
                    {
                        --this.timeLeft;
                    }
                    if (Main.rand.Next(50) == 0)
                    {
                        this.timeLeft -= 5;
                    }
                    if (Main.rand.Next(100) == 0)
                    {
                        this.timeLeft -= 10;
                    }
                }
                else
                {
                    this.alpha = (int)byte.MaxValue;
                    if (Main.goreLoaded[this.type])
                    {
                        float num1 = (float)((double)Main.goreTexture[this.type].Width * (double)this.scale * 0.800000011920929);
                        float x    = this.position.X;
                        float y    = this.position.Y;
                        float num2 = (float)Main.goreTexture[this.type].Width * this.scale;
                        float num3 = (float)Main.goreTexture[this.type].Height * this.scale;
                        int   Type = 176;
                        if (this.type >= 416 && this.type <= 420)
                        {
                            Type = 177;
                        }
                        if (this.type >= 421 && this.type <= 425)
                        {
                            Type = 178;
                        }
                        if (this.type >= 426 && this.type <= 430)
                        {
                            Type = 179;
                        }
                        for (int index1 = 0; (double)index1 < (double)num1; ++index1)
                        {
                            int index2 = Dust.NewDust(new Vector2(x, y), (int)num2, (int)num3, Type, 0.0f, 0.0f, 0, new Color(), 1f);
                            Main.dust[index2].noGravity = true;
                            Main.dust[index2].alpha     = 100;
                            Main.dust[index2].scale     = this.scale;
                        }
                    }
                }
            }
            else if (GoreID.Sets.SpecialAI[this.type] != 3 && GoreID.Sets.SpecialAI[this.type] != 1)
            {
                if (this.type >= 706 && this.type <= 717 || this.type == 943)
                {
                    if (this.type == 716)
                    {
                        float num1 = 0.6f;
                        float num2 = (int)this.frame != 0 ? ((int)this.frame != 1 ? ((int)this.frame != 2 ? ((int)this.frame != 3 ? ((int)this.frame != 4 ? ((int)this.frame != 5 ? ((int)this.frame != 6 ? ((int)this.frame > 9 ? ((int)this.frame != 10 ? ((int)this.frame != 11 ? ((int)this.frame != 12 ? ((int)this.frame != 13 ? ((int)this.frame != 14 ? 0.0f : num1 * 0.1f) : num1 * 0.2f) : num1 * 0.3f) : num1 * 0.4f) : num1 * 0.5f) : num1 * 0.5f) : num1 * 0.2f) : num1 * 0.4f) : num1 * 0.5f) : num1 * 0.4f) : num1 * 0.3f) : num1 * 0.2f) : num1 * 0.1f;
                        Lighting.AddLight(this.position + new Vector2(8f, 8f), 1f * num2, 0.5f * num2, 0.1f * num2);
                    }
                    Vector2 velocity = this.velocity;
                    this.velocity = Collision.TileCollision(this.position, this.velocity, 16, 14, false, false, 1);
                    if (this.velocity != velocity)
                    {
                        if ((int)this.frame < 10)
                        {
                            this.frame        = (byte)10;
                            this.frameCounter = (byte)0;
                            if (this.type != 716 && this.type != 717 && this.type != 943)
                            {
                                Main.PlaySound(39, (int)this.position.X + 8, (int)this.position.Y + 8, Main.rand.Next(2), 1f, 0.0f);
                            }
                        }
                    }
                    else if (Collision.WetCollision(this.position + this.velocity, 16, 14))
                    {
                        if ((int)this.frame < 10)
                        {
                            this.frame        = (byte)10;
                            this.frameCounter = (byte)0;
                            if (this.type != 716 && this.type != 717 && this.type != 943)
                            {
                                Main.PlaySound(39, (int)this.position.X + 8, (int)this.position.Y + 8, 2, 1f, 0.0f);
                            }
                            ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(this.position + new Vector2(8f, 8f), 1f, RippleShape.Square, 0.0f);
                        }
                        int index1 = (int)((double)this.position.X + 8.0) / 16;
                        int index2 = (int)((double)this.position.Y + 14.0) / 16;
                        if (Main.tile[index1, index2] != null && (int)Main.tile[index1, index2].liquid > 0)
                        {
                            this.velocity  *= 0.0f;
                            this.position.Y = (float)(index2 * 16 - (int)Main.tile[index1, index2].liquid / 16);
                        }
                    }
                }
                else if (this.sticky)
                {
                    int num1 = 32;
                    if (Main.goreLoaded[this.type])
                    {
                        num1 = Main.goreTexture[this.type].Width;
                        if (Main.goreTexture[this.type].Height < num1)
                        {
                            num1 = Main.goreTexture[this.type].Height;
                        }
                    }
                    if (flag)
                    {
                        num1 = 4;
                    }
                    int num2 = (int)((double)num1 * 0.899999976158142);
                    this.velocity = Collision.TileCollision(this.position, this.velocity, (int)((double)num2 * (double)this.scale), (int)((double)num2 * (double)this.scale), false, false, 1);
                    if ((double)this.velocity.Y == 0.0)
                    {
                        if (flag)
                        {
                            this.velocity.X *= 0.94f;
                        }
                        else
                        {
                            this.velocity.X *= 0.97f;
                        }
                        if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01)
                        {
                            this.velocity.X = 0.0f;
                        }
                    }
                    if (this.timeLeft > 0)
                    {
                        this.timeLeft -= GoreID.Sets.DisappearSpeed[this.type];
                    }
                    else
                    {
                        this.alpha += GoreID.Sets.DisappearSpeedAlpha[this.type];
                    }
                }
                else
                {
                    this.alpha += 2 * GoreID.Sets.DisappearSpeedAlpha[this.type];
                }
            }
            if (this.type >= 907 && this.type <= 909)
            {
                int num1 = 32;
                if (Main.goreLoaded[this.type])
                {
                    num1 = Main.goreTexture[this.type].Width;
                    if (Main.goreTexture[this.type].Height < num1)
                    {
                        num1 = Main.goreTexture[this.type].Height;
                    }
                }
                int     num2    = (int)((double)num1 * 0.899999976158142);
                Vector4 vector4 = Collision.SlopeCollision(this.position, this.velocity, num2, num2, 0.0f, true);
                this.position.X = vector4.X;
                this.position.Y = vector4.Y;
                this.velocity.X = vector4.Z;
                this.velocity.Y = vector4.W;
            }
            if (GoreID.Sets.SpecialAI[this.type] == 1)
            {
                if ((double)this.velocity.Y < 0.0)
                {
                    Vector2 Velocity = new Vector2(this.velocity.X, 0.6f);
                    int     num1     = 32;
                    if (Main.goreLoaded[this.type])
                    {
                        num1 = Main.goreTexture[this.type].Width;
                        if (Main.goreTexture[this.type].Height < num1)
                        {
                            num1 = Main.goreTexture[this.type].Height;
                        }
                    }
                    int     num2    = (int)((double)num1 * 0.899999976158142);
                    Vector2 vector2 = Collision.TileCollision(this.position, Velocity, (int)((double)num2 * (double)this.scale), (int)((double)num2 * (double)this.scale), false, false, 1);
                    vector2.X *= 0.97f;
                    if ((double)vector2.X > -0.01 && (double)vector2.X < 0.01)
                    {
                        vector2.X = 0.0f;
                    }
                    if (this.timeLeft > 0)
                    {
                        --this.timeLeft;
                    }
                    else
                    {
                        ++this.alpha;
                    }
                    this.velocity.X = vector2.X;
                }
                else
                {
                    this.velocity.Y += (float)Math.PI / 60f;
                    Vector2 Velocity = new Vector2(Vector2.UnitY.RotatedBy((double)this.velocity.Y, new Vector2()).X * 2f, Math.Abs(Vector2.UnitY.RotatedBy((double)this.velocity.Y, new Vector2()).Y) * 3f) * 2f;
                    int     num      = 32;
                    if (Main.goreLoaded[this.type])
                    {
                        num = Main.goreTexture[this.type].Width;
                        if (Main.goreTexture[this.type].Height < num)
                        {
                            num = Main.goreTexture[this.type].Height;
                        }
                    }
                    Vector2 vector2 = Velocity;
                    Vector2 v       = Collision.TileCollision(this.position, Velocity, (int)((double)num * (double)this.scale), (int)((double)num * (double)this.scale), false, false, 1);
                    if (v != vector2)
                    {
                        this.velocity.Y = -1f;
                    }
                    this.position += v;
                    this.rotation  = v.ToRotation() + 3.141593f;
                    if (this.timeLeft > 0)
                    {
                        --this.timeLeft;
                    }
                    else
                    {
                        ++this.alpha;
                    }
                }
            }
            else if (GoreID.Sets.SpecialAI[this.type] == 3)
            {
                if ((double)this.velocity.Y < 0.0)
                {
                    Vector2 Velocity = new Vector2(this.velocity.X, -0.2f);
                    int     num1     = 8;
                    if (Main.goreLoaded[this.type])
                    {
                        num1 = Main.goreTexture[this.type].Width;
                        if (Main.goreTexture[this.type].Height < num1)
                        {
                            num1 = Main.goreTexture[this.type].Height;
                        }
                    }
                    int     num2    = (int)((double)num1 * 0.899999976158142);
                    Vector2 vector2 = Collision.TileCollision(this.position, Velocity, (int)((double)num2 * (double)this.scale), (int)((double)num2 * (double)this.scale), false, false, 1);
                    vector2.X *= 0.94f;
                    if ((double)vector2.X > -0.01 && (double)vector2.X < 0.01)
                    {
                        vector2.X = 0.0f;
                    }
                    if (this.timeLeft > 0)
                    {
                        this.timeLeft -= GoreID.Sets.DisappearSpeed[this.type];
                    }
                    else
                    {
                        this.alpha += GoreID.Sets.DisappearSpeedAlpha[this.type];
                    }
                    this.velocity.X = vector2.X;
                }
                else
                {
                    this.velocity.Y += (float)Math.PI / 180f;
                    Vector2 Velocity = new Vector2(Vector2.UnitY.RotatedBy((double)this.velocity.Y, new Vector2()).X * 1f, Math.Abs(Vector2.UnitY.RotatedBy((double)this.velocity.Y, new Vector2()).Y) * 1f);
                    int     num      = 8;
                    if (Main.goreLoaded[this.type])
                    {
                        num = Main.goreTexture[this.type].Width;
                        if (Main.goreTexture[this.type].Height < num)
                        {
                            num = Main.goreTexture[this.type].Height;
                        }
                    }
                    Vector2 vector2 = Velocity;
                    Vector2 v       = Collision.TileCollision(this.position, Velocity, (int)((double)num * (double)this.scale), (int)((double)num * (double)this.scale), false, false, 1);
                    if (v != vector2)
                    {
                        this.velocity.Y = -1f;
                    }
                    this.position += v;
                    this.rotation  = v.ToRotation() + 1.570796f;
                    if (this.timeLeft > 0)
                    {
                        this.timeLeft -= GoreID.Sets.DisappearSpeed[this.type];
                    }
                    else
                    {
                        this.alpha += GoreID.Sets.DisappearSpeedAlpha[this.type];
                    }
                }
            }
            else
            {
                this.position += this.velocity;
            }
            if (this.alpha >= (int)byte.MaxValue)
            {
                this.active = false;
            }
            if ((double)this.light <= 0.0)
            {
                return;
            }
            float R = this.light * this.scale;
            float G = this.light * this.scale;
            float B = this.light * this.scale;

            if (this.type == 16)
            {
                B *= 0.3f;
                G *= 0.8f;
            }
            else if (this.type == 17)
            {
                G *= 0.6f;
                R *= 0.3f;
            }
            if (Main.goreLoaded[this.type])
            {
                Lighting.AddLight((int)(((double)this.position.X + (double)Main.goreTexture[this.type].Width * (double)this.scale / 2.0) / 16.0), (int)(((double)this.position.Y + (double)Main.goreTexture[this.type].Height * (double)this.scale / 2.0) / 16.0), R, G, B);
            }
            else
            {
                Lighting.AddLight((int)(((double)this.position.X + 32.0 * (double)this.scale / 2.0) / 16.0), (int)(((double)this.position.Y + 32.0 * (double)this.scale / 2.0) / 16.0), R, G, B);
            }
        }
Пример #7
0
 protected override void Update(GameTime gameTime)
 {
     if (fixedTiming)
     {
         if (base.IsActive)
         {
             base.IsFixedTimeStep = false;
             this.graphics.SynchronizeWithVerticalRetrace = true;
         }
         else
         {
             base.IsFixedTimeStep = true;
         }
     }
     else
     {
         base.IsFixedTimeStep = true;
     }
     this.UpdateMusic();
     if (!showSplash)
     {
         if (!gameMenu && (Main.netMode != 2))
         {
             saveTimer++;
             if (saveTimer > 0x4650)
             {
                 saveTimer = 0;
                 WorldGen.saveToonWhilePlaying();
             }
         }
         else
         {
             saveTimer = 0;
         }
         if (rand.Next(0x1869f) == 0)
         {
             rand = new Random((int) DateTime.Now.Ticks);
         }
         updateTime++;
         if (updateTime >= 60)
         {
             frameRate = drawTime;
             updateTime = 0;
             drawTime = 0;
             if (frameRate == 60)
             {
                 Lighting.lightPasses = 2;
                 Lighting.lightSkip = 0;
                 cloudLimit = 100;
                 Gore.goreTime = 0x4b0;
             }
             else if (frameRate >= 0x3a)
             {
                 Lighting.lightPasses = 2;
                 Lighting.lightSkip = 0;
                 cloudLimit = 100;
                 Gore.goreTime = 600;
             }
             else if (frameRate >= 0x2b)
             {
                 Lighting.lightPasses = 2;
                 Lighting.lightSkip = 1;
                 cloudLimit = 0x4b;
                 Gore.goreTime = 300;
             }
             else if (frameRate >= 0x1c)
             {
                 if (!gameMenu)
                 {
                     Liquid.maxLiquid = 0xbb8;
                     Liquid.cycles = 6;
                 }
                 Lighting.lightPasses = 2;
                 Lighting.lightSkip = 2;
                 cloudLimit = 50;
                 Gore.goreTime = 180;
             }
             else
             {
                 Lighting.lightPasses = 2;
                 Lighting.lightSkip = 4;
                 cloudLimit = 0;
                 Gore.goreTime = 0;
             }
             if (Liquid.quickSettle)
             {
                 Liquid.maxLiquid = Liquid.resLiquid;
                 Liquid.cycles = 1;
             }
             else if (frameRate == 60)
             {
                 Liquid.maxLiquid = 0x1388;
                 Liquid.cycles = 7;
             }
             else if (frameRate >= 0x3a)
             {
                 Liquid.maxLiquid = 0x1388;
                 Liquid.cycles = 12;
             }
             else if (frameRate >= 0x2b)
             {
                 Liquid.maxLiquid = 0xfa0;
                 Liquid.cycles = 13;
             }
             else if (frameRate >= 0x1c)
             {
                 Liquid.maxLiquid = 0xdac;
                 Liquid.cycles = 15;
             }
             else
             {
                 Liquid.maxLiquid = 0xbb8;
                 Liquid.cycles = 0x11;
             }
             if (Main.netMode == 2)
             {
                 cloudLimit = 0;
             }
         }
         if (!base.IsActive)
         {
             hasFocus = false;
         }
         else
         {
             hasFocus = true;
         }
         if (!base.IsActive && (Main.netMode == 0))
         {
             base.IsMouseVisible = true;
             if ((Main.netMode != 2) && (myPlayer >= 0))
             {
                 player[myPlayer].delayUseItem = true;
             }
             mouseLeftRelease = false;
             mouseRightRelease = false;
             if (gameMenu)
             {
                 UpdateMenu();
             }
         }
         else
         {
             base.IsMouseVisible = false;
             if ((keyState.IsKeyDown(Keys.F10) && !chatMode) && !editSign)
             {
                 if (frameRelease)
                 {
                     PlaySound(12, -1, -1, 1);
                     if (showFrameRate)
                     {
                         showFrameRate = false;
                     }
                     else
                     {
                         showFrameRate = true;
                     }
                 }
                 frameRelease = false;
             }
             else
             {
                 frameRelease = true;
             }
             if (keyState.IsKeyDown(Keys.F11))
             {
                 if (releaseUI)
                 {
                     if (hideUI)
                     {
                         hideUI = false;
                     }
                     else
                     {
                         hideUI = true;
                     }
                 }
                 releaseUI = false;
             }
             else
             {
                 releaseUI = true;
             }
             if ((keyState.IsKeyDown(Keys.LeftAlt) || keyState.IsKeyDown(Keys.RightAlt)) && keyState.IsKeyDown(Keys.Enter))
             {
                 if (this.toggleFullscreen)
                 {
                     this.graphics.ToggleFullScreen();
                     chatRelease = false;
                 }
                 this.toggleFullscreen = false;
             }
             else
             {
                 this.toggleFullscreen = true;
             }
             oldMouseState = mouseState;
             mouseState = Mouse.GetState();
             keyState = Keyboard.GetState();
             if (editSign)
             {
                 chatMode = false;
             }
             if (chatMode)
             {
                 string chatText = Main.chatText;
                 Main.chatText = GetInputText(Main.chatText);
                 while (fontMouseText.MeasureString(Main.chatText).X > 470f)
                 {
                     Main.chatText = Main.chatText.Substring(0, Main.chatText.Length - 1);
                 }
                 if (chatText != Main.chatText)
                 {
                     PlaySound(12, -1, -1, 1);
                 }
                 if (inputTextEnter && chatRelease)
                 {
                     if (Main.chatText != "")
                     {
                         NetMessage.SendData(0x19, -1, -1, Main.chatText, myPlayer, 0f, 0f, 0f);
                     }
                     Main.chatText = "";
                     chatMode = false;
                     chatRelease = false;
                     PlaySound(11, -1, -1, 1);
                 }
             }
             if (keyState.IsKeyDown(Keys.Enter) && (Main.netMode == 1))
             {
                 if ((chatRelease && !chatMode) && !editSign)
                 {
                     PlaySound(10, -1, -1, 1);
                     chatMode = true;
                     Main.chatText = "";
                 }
                 chatRelease = false;
             }
             else
             {
                 chatRelease = true;
             }
             if (gameMenu)
             {
                 UpdateMenu();
                 if (Main.netMode != 2)
                 {
                     return;
                 }
             }
             if (debugMode)
             {
                 UpdateDebug();
             }
             if (Main.netMode == 1)
             {
                 for (int num = 0; num < 0x2c; num++)
                 {
                     if (player[myPlayer].inventory[num].IsNotTheSameAs(clientPlayer.inventory[num]))
                     {
                         NetMessage.SendData(5, -1, -1, player[myPlayer].inventory[num].name, myPlayer, (float) num, 0f, 0f);
                     }
                 }
                 if (player[myPlayer].armor[0].IsNotTheSameAs(clientPlayer.armor[0]))
                 {
                     NetMessage.SendData(5, -1, -1, player[myPlayer].armor[0].name, myPlayer, 44f, 0f, 0f);
                 }
                 if (player[myPlayer].armor[1].IsNotTheSameAs(clientPlayer.armor[1]))
                 {
                     NetMessage.SendData(5, -1, -1, player[myPlayer].armor[1].name, myPlayer, 45f, 0f, 0f);
                 }
                 if (player[myPlayer].armor[2].IsNotTheSameAs(clientPlayer.armor[2]))
                 {
                     NetMessage.SendData(5, -1, -1, player[myPlayer].armor[2].name, myPlayer, 46f, 0f, 0f);
                 }
                 if (player[myPlayer].armor[3].IsNotTheSameAs(clientPlayer.armor[3]))
                 {
                     NetMessage.SendData(5, -1, -1, player[myPlayer].armor[3].name, myPlayer, 47f, 0f, 0f);
                 }
                 if (player[myPlayer].armor[4].IsNotTheSameAs(clientPlayer.armor[4]))
                 {
                     NetMessage.SendData(5, -1, -1, player[myPlayer].armor[4].name, myPlayer, 48f, 0f, 0f);
                 }
                 if (player[myPlayer].armor[5].IsNotTheSameAs(clientPlayer.armor[5]))
                 {
                     NetMessage.SendData(5, -1, -1, player[myPlayer].armor[5].name, myPlayer, 49f, 0f, 0f);
                 }
                 if (player[myPlayer].chest != clientPlayer.chest)
                 {
                     NetMessage.SendData(0x21, -1, -1, "", player[myPlayer].chest, 0f, 0f, 0f);
                 }
                 if (player[myPlayer].talkNPC != clientPlayer.talkNPC)
                 {
                     NetMessage.SendData(40, -1, -1, "", myPlayer, 0f, 0f, 0f);
                 }
                 if (player[myPlayer].zoneEvil != clientPlayer.zoneEvil)
                 {
                     NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f);
                 }
                 if (player[myPlayer].zoneMeteor != clientPlayer.zoneMeteor)
                 {
                     NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f);
                 }
                 if (player[myPlayer].zoneDungeon != clientPlayer.zoneDungeon)
                 {
                     NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f);
                 }
                 if (player[myPlayer].zoneJungle != clientPlayer.zoneJungle)
                 {
                     NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f);
                 }
             }
             if (Main.netMode == 1)
             {
                 clientPlayer = (Player) player[myPlayer].clientClone();
             }
             for (int i = 0; i < 8; i++)
             {
                 if (ignoreErrors)
                 {
                     try
                     {
                         player[i].UpdatePlayer(i);
                     }
                     catch
                     {
                     }
                 }
                 else
                 {
                     player[i].UpdatePlayer(i);
                 }
             }
             if (Main.netMode != 1)
             {
                 NPC.SpawnNPC();
             }
             for (int j = 0; j < 8; j++)
             {
                 player[j].activeNPCs = 0;
                 player[j].townNPCs = 0;
             }
             for (int k = 0; k < 0x3e8; k++)
             {
                 if (ignoreErrors)
                 {
                     try
                     {
                         npc[k].UpdateNPC(k);
                     }
                     catch
                     {
                         npc[k] = new NPC();
                     }
                 }
                 else
                 {
                     npc[k].UpdateNPC(k);
                 }
             }
             for (int m = 0; m < 200; m++)
             {
                 if (ignoreErrors)
                 {
                     try
                     {
                         gore[m].Update();
                     }
                     catch
                     {
                         gore[m] = new Gore();
                     }
                 }
                 else
                 {
                     gore[m].Update();
                 }
             }
             for (int n = 0; n < 0x3e8; n++)
             {
                 if (ignoreErrors)
                 {
                     try
                     {
                         projectile[n].Update(n);
                     }
                     catch
                     {
                         projectile[n] = new Projectile();
                     }
                 }
                 else
                 {
                     projectile[n].Update(n);
                 }
             }
             for (int num7 = 0; num7 < 200; num7++)
             {
                 if (ignoreErrors)
                 {
                     try
                     {
                         item[num7].UpdateItem(num7);
                     }
                     catch
                     {
                         item[num7] = new Item();
                     }
                 }
                 else
                 {
                     item[num7].UpdateItem(num7);
                 }
             }
             if (ignoreErrors)
             {
                 try
                 {
                     Dust.UpdateDust();
                 }
                 catch
                 {
                     for (int num8 = 0; num8 < 0x7d0; num8++)
                     {
                         dust[num8] = new Dust();
                     }
                 }
             }
             else
             {
                 Dust.UpdateDust();
             }
             if (Main.netMode != 2)
             {
                 CombatText.UpdateCombatText();
             }
             if (ignoreErrors)
             {
                 try
                 {
                     UpdateTime();
                 }
                 catch
                 {
                     checkForSpawns = 0;
                 }
             }
             else
             {
                 UpdateTime();
             }
             if (Main.netMode != 1)
             {
                 if (ignoreErrors)
                 {
                     try
                     {
                         WorldGen.UpdateWorld();
                         UpdateInvasion();
                     }
                     catch
                     {
                     }
                 }
                 else
                 {
                     WorldGen.UpdateWorld();
                     UpdateInvasion();
                 }
             }
             if (ignoreErrors)
             {
                 try
                 {
                     if (Main.netMode == 2)
                     {
                         UpdateServer();
                     }
                     if (Main.netMode == 1)
                     {
                         UpdateClient();
                     }
                 }
                 catch
                 {
                     int netMode = Main.netMode;
                 }
             }
             else
             {
                 if (Main.netMode == 2)
                 {
                     UpdateServer();
                 }
                 if (Main.netMode == 1)
                 {
                     UpdateClient();
                     if (this.graphics.PreferredBackBufferHeight == 600)
                     {
                         this.QuitGame();
                     }
                     if (this.graphics.PreferredBackBufferWidth == 800)
                     {
                         this.QuitGame();
                     }
                 }
             }
             if (ignoreErrors)
             {
                 try
                 {
                     for (int num9 = 0; num9 < numChatLines; num9++)
                     {
                         if (chatLine[num9].showTime > 0)
                         {
                             ChatLine line1 = chatLine[num9];
                             line1.showTime--;
                         }
                     }
                 }
                 catch
                 {
                     for (int num10 = 0; num10 < numChatLines; num10++)
                     {
                         chatLine[num10] = new ChatLine();
                     }
                 }
             }
             else
             {
                 for (int num11 = 0; num11 < numChatLines; num11++)
                 {
                     if (chatLine[num11].showTime > 0)
                     {
                         ChatLine line2 = chatLine[num11];
                         line2.showTime--;
                     }
                 }
             }
             base.Update(gameTime);
         }
     }
 }
Пример #8
0
        protected override void Initialize()
        {
            if (webProtect)
            {
                this.getAuth();
                while (!webAuth)
                {
                    base.Exit();
                }
            }
            if (rand == null)
            {
                rand = new Random((int) DateTime.Now.Ticks);
            }
            if (WorldGen.genRand == null)
            {
                WorldGen.genRand = new Random((int) DateTime.Now.Ticks);
            }
            this.OpenSettings();
            switch (rand.Next(5))
            {
                case 0:
                    base.Window.Title = "Terraria: Dig Peon, Dig!";
                    break;

                case 1:
                    base.Window.Title = "Terraria: Epic Dirt";
                    break;

                case 2:
                    base.Window.Title = "Terraria: Hey Guys!";
                    break;

                case 3:
                    base.Window.Title = "Terraria: Sand is Overpowered";
                    goto Label_00CF;
            }
            base.Window.Title = "Terraria: Shut Up and Dig Gaiden!";
            Label_00CF:
            tileSolid[0] = true;
            tileBlockLight[0] = true;
            tileSolid[1] = true;
            tileBlockLight[1] = true;
            tileSolid[2] = true;
            tileBlockLight[2] = true;
            tileSolid[3] = false;
            tileNoAttach[3] = true;
            tileNoFail[3] = true;
            tileSolid[4] = false;
            tileNoAttach[4] = true;
            tileNoFail[4] = true;
            tileNoFail[0x18] = true;
            tileSolid[5] = false;
            tileSolid[6] = true;
            tileBlockLight[6] = true;
            tileSolid[7] = true;
            tileBlockLight[7] = true;
            tileSolid[8] = true;
            tileBlockLight[8] = true;
            tileSolid[9] = true;
            tileBlockLight[9] = true;
            tileBlockLight[10] = true;
            tileSolid[10] = true;
            tileNoAttach[10] = true;
            tileBlockLight[10] = true;
            tileSolid[11] = false;
            tileSolidTop[0x13] = true;
            tileSolid[0x13] = true;
            tileSolid[0x16] = true;
            tileSolid[0x17] = true;
            tileSolid[0x19] = true;
            tileSolid[30] = true;
            tileNoFail[0x20] = true;
            tileBlockLight[0x20] = true;
            tileSolid[0x25] = true;
            tileBlockLight[0x25] = true;
            tileSolid[0x26] = true;
            tileBlockLight[0x26] = true;
            tileSolid[0x27] = true;
            tileBlockLight[0x27] = true;
            tileSolid[40] = true;
            tileBlockLight[40] = true;
            tileSolid[0x29] = true;
            tileBlockLight[0x29] = true;
            tileSolid[0x2b] = true;
            tileBlockLight[0x2b] = true;
            tileSolid[0x2c] = true;
            tileBlockLight[0x2c] = true;
            tileSolid[0x2d] = true;
            tileBlockLight[0x2d] = true;
            tileSolid[0x2e] = true;
            tileBlockLight[0x2e] = true;
            tileSolid[0x2f] = true;
            tileBlockLight[0x2f] = true;
            tileSolid[0x30] = true;
            tileBlockLight[0x30] = true;
            tileSolid[0x35] = true;
            tileBlockLight[0x35] = true;
            tileSolid[0x36] = true;
            tileBlockLight[0x34] = true;
            tileSolid[0x38] = true;
            tileBlockLight[0x38] = true;
            tileSolid[0x39] = true;
            tileBlockLight[0x39] = true;
            tileSolid[0x3a] = true;
            tileBlockLight[0x3a] = true;
            tileSolid[0x3b] = true;
            tileBlockLight[0x3b] = true;
            tileSolid[60] = true;
            tileBlockLight[60] = true;
            tileSolid[0x3f] = true;
            tileBlockLight[0x3f] = true;
            tileStone[0x3f] = true;
            tileSolid[0x40] = true;
            tileBlockLight[0x40] = true;
            tileStone[0x40] = true;
            tileSolid[0x41] = true;
            tileBlockLight[0x41] = true;
            tileStone[0x41] = true;
            tileSolid[0x42] = true;
            tileBlockLight[0x42] = true;
            tileStone[0x42] = true;
            tileSolid[0x43] = true;
            tileBlockLight[0x43] = true;
            tileStone[0x43] = true;
            tileSolid[0x44] = true;
            tileBlockLight[0x44] = true;
            tileStone[0x44] = true;
            tileSolid[0x4b] = true;
            tileBlockLight[0x4b] = true;
            tileSolid[0x4c] = true;
            tileBlockLight[0x4c] = true;
            tileSolid[70] = true;
            tileBlockLight[70] = true;
            tileBlockLight[0x33] = true;
            tileNoFail[50] = true;
            tileNoAttach[50] = true;
            tileDungeon[0x29] = true;
            tileDungeon[0x2b] = true;
            tileDungeon[0x2c] = true;
            tileBlockLight[30] = true;
            tileBlockLight[0x19] = true;
            tileBlockLight[0x17] = true;
            tileBlockLight[0x16] = true;
            tileBlockLight[0x3e] = true;
            tileSolidTop[0x12] = true;
            tileSolidTop[14] = true;
            tileSolidTop[0x10] = true;
            tileNoAttach[20] = true;
            tileNoAttach[0x13] = true;
            tileNoAttach[13] = true;
            tileNoAttach[14] = true;
            tileNoAttach[15] = true;
            tileNoAttach[0x10] = true;
            tileNoAttach[0x11] = true;
            tileNoAttach[0x12] = true;
            tileNoAttach[0x13] = true;
            tileNoAttach[0x15] = true;
            tileNoAttach[0x1b] = true;
            tileFrameImportant[3] = true;
            tileFrameImportant[5] = true;
            tileFrameImportant[10] = true;
            tileFrameImportant[11] = true;
            tileFrameImportant[12] = true;
            tileFrameImportant[13] = true;
            tileFrameImportant[14] = true;
            tileFrameImportant[15] = true;
            tileFrameImportant[0x10] = true;
            tileFrameImportant[0x11] = true;
            tileFrameImportant[0x12] = true;
            tileFrameImportant[20] = true;
            tileFrameImportant[0x15] = true;
            tileFrameImportant[0x18] = true;
            tileFrameImportant[0x1a] = true;
            tileFrameImportant[0x1b] = true;
            tileFrameImportant[0x1c] = true;
            tileFrameImportant[0x1d] = true;
            tileFrameImportant[0x1f] = true;
            tileFrameImportant[0x21] = true;
            tileFrameImportant[0x22] = true;
            tileFrameImportant[0x23] = true;
            tileFrameImportant[0x24] = true;
            tileFrameImportant[0x2a] = true;
            tileFrameImportant[50] = true;
            tileFrameImportant[0x37] = true;
            tileFrameImportant[0x3d] = true;
            tileFrameImportant[0x47] = true;
            tileFrameImportant[0x48] = true;
            tileFrameImportant[0x49] = true;
            tileFrameImportant[0x4a] = true;
            tileFrameImportant[0x4d] = true;
            tileFrameImportant[0x4e] = true;
            tileFrameImportant[0x4f] = true;
            tileTable[14] = true;
            tileTable[0x12] = true;
            tileTable[0x13] = true;
            tileWaterDeath[4] = true;
            tileWaterDeath[0x33] = true;
            tileLavaDeath[3] = true;
            tileLavaDeath[5] = true;
            tileLavaDeath[10] = true;
            tileLavaDeath[11] = true;
            tileLavaDeath[12] = true;
            tileLavaDeath[13] = true;
            tileLavaDeath[14] = true;
            tileLavaDeath[15] = true;
            tileLavaDeath[0x10] = true;
            tileLavaDeath[0x11] = true;
            tileLavaDeath[0x12] = true;
            tileLavaDeath[0x13] = true;
            tileLavaDeath[20] = true;
            tileLavaDeath[0x1b] = true;
            tileLavaDeath[0x1c] = true;
            tileLavaDeath[0x1d] = true;
            tileLavaDeath[0x20] = true;
            tileLavaDeath[0x21] = true;
            tileLavaDeath[0x22] = true;
            tileLavaDeath[0x23] = true;
            tileLavaDeath[0x24] = true;
            tileLavaDeath[0x2a] = true;
            tileLavaDeath[0x31] = true;
            tileLavaDeath[50] = true;
            tileLavaDeath[0x34] = true;
            tileLavaDeath[0x37] = true;
            tileLavaDeath[0x3d] = true;
            tileLavaDeath[0x3e] = true;
            tileLavaDeath[0x45] = true;
            tileLavaDeath[0x47] = true;
            tileLavaDeath[0x48] = true;
            tileLavaDeath[0x49] = true;
            tileLavaDeath[0x4a] = true;
            tileLavaDeath[0x4e] = true;
            tileLavaDeath[0x4f] = true;
            wallHouse[1] = true;
            wallHouse[4] = true;
            wallHouse[5] = true;
            wallHouse[6] = true;
            wallHouse[10] = true;
            wallHouse[11] = true;
            wallHouse[12] = true;
            for (int i = 0; i < maxMenuItems; i++)
            {
                this.menuItemScale[i] = 0.8f;
            }
            for (int j = 0; j < 0x7d0; j++)
            {
                dust[j] = new Dust();
            }
            for (int k = 0; k < 0xc9; k++)
            {
                item[k] = new Item();
            }
            for (int m = 0; m < 0x3e9; m++)
            {
                npc[m] = new NPC();
                npc[m].whoAmI = m;
            }
            for (int n = 0; n < 9; n++)
            {
                player[n] = new Player();
            }
            for (int num7 = 0; num7 < 0x3e9; num7++)
            {
                projectile[num7] = new Projectile();
            }
            for (int num8 = 0; num8 < 0xc9; num8++)
            {
                gore[num8] = new Gore();
            }
            for (int num9 = 0; num9 < 100; num9++)
            {
                cloud[num9] = new Cloud();
            }
            for (int num10 = 0; num10 < 100; num10++)
            {
                combatText[num10] = new CombatText();
            }
            for (int num11 = 0; num11 < Recipe.maxRecipes; num11++)
            {
                recipe[num11] = new Recipe();
                availableRecipeY[num11] = 0x41 * num11;
            }
            Recipe.SetupRecipes();
            for (int num12 = 0; num12 < numChatLines; num12++)
            {
                chatLine[num12] = new ChatLine();
            }
            for (int num13 = 0; num13 < Liquid.resLiquid; num13++)
            {
                liquid[num13] = new Liquid();
            }
            for (int num14 = 0; num14 < 0x2710; num14++)
            {
                liquidBuffer[num14] = new LiquidBuffer();
            }
            this.graphics.PreferredBackBufferWidth = screenWidth;
            this.graphics.PreferredBackBufferHeight = screenHeight;
            this.graphics.ApplyChanges();
            this.shop[0] = new Chest();
            this.shop[1] = new Chest();
            this.shop[1].SetupShop(1);
            this.shop[2] = new Chest();
            this.shop[2].SetupShop(2);
            this.shop[3] = new Chest();
            this.shop[3].SetupShop(3);
            this.shop[4] = new Chest();
            this.shop[4].SetupShop(4);
            teamColor[0] = Color.White;
            teamColor[1] = new Color(230, 40, 20);
            teamColor[2] = new Color(20, 200, 30);
            teamColor[3] = new Color(0x4b, 90, 0xff);
            teamColor[4] = new Color(200, 180, 0);
            Netplay.Init();
            if (skipMenu)
            {
                WorldGen.clearWorld();
                gameMenu = false;
                LoadPlayers();
                player[myPlayer] = (Player) loadPlayer[0].Clone();
                PlayerPath = loadPlayerPath[0];
                LoadWorlds();
                WorldGen.generateWorld(-1);
                WorldGen.EveryTileFrame();
                player[myPlayer].Spawn();
            }
            else
            {
                IntPtr systemMenu = GetSystemMenu(base.Window.Handle, false);
                int menuItemCount = GetMenuItemCount(systemMenu);
                RemoveMenu(systemMenu, menuItemCount - 1, 0x400);
            }
            base.Initialize();
            Star.SpawnStars();
        }
Пример #9
0
 //in Terraria.Gore.Update at beginning of if block checking for active add
 //  if(this.modGore != null && !this.modGore.Update(this)) { return; }
 public virtual bool Update(Gore gore)
 {
     return true;
 }
Пример #10
0
 public virtual void OnSpawn(Gore gore)
 {
 }
Пример #11
0
        protected override void Initialize()
        {
            if (rand == null)
            {
                rand = new Random((int) DateTime.Now.Ticks);
            }
            if (WorldGen.genRand == null)
            {
                WorldGen.genRand = new Random((int) DateTime.Now.Ticks);
            }
            switch (rand.Next(5))
            {
                case 0:
                    base.Window.Title = "Terraria: Dig Peon, Dig!";
                    break;

                case 1:
                    base.Window.Title = "Terraria: Epic Dirt";
                    break;

                case 2:
                    base.Window.Title = "Terraria: Hey Guys!";
                    break;

                case 3:
                    base.Window.Title = "Terraria: Sand is Overpowered";
                    goto Label_00AD;
            }
            base.Window.Title = "Terraria: Shut Up and Dig Gaiden!";
            Label_00AD:
            tileShine[0x16] = 0x47e;
            tileShine[6] = 0x47e;
            tileShine[7] = 0x44c;
            tileShine[8] = 0x3e8;
            tileShine[9] = 0x41a;
            tileShine[12] = 0x3e8;
            tileShine[0x15] = 0x3e8;
            tileShine[0x3f] = 900;
            tileShine[0x40] = 900;
            tileShine[0x41] = 900;
            tileShine[0x42] = 900;
            tileShine[0x43] = 900;
            tileShine[0x44] = 900;
            tileShine[0x2d] = 0x76c;
            tileShine[0x2e] = 0x7d0;
            tileShine[0x2f] = 0x834;
            tileCut[3] = true;
            tileCut[0x18] = true;
            tileCut[0x1c] = true;
            tileCut[0x20] = true;
            tileCut[0x33] = true;
            tileCut[0x34] = true;
            tileCut[0x3d] = true;
            tileCut[0x3e] = true;
            tileCut[0x45] = true;
            tileCut[0x47] = true;
            tileCut[0x49] = true;
            tileCut[0x4a] = true;
            tileCut[0x52] = true;
            tileCut[0x53] = true;
            tileCut[0x54] = true;
            tileAlch[0x52] = true;
            tileAlch[0x53] = true;
            tileAlch[0x54] = true;
            tileFrameImportant[0x52] = true;
            tileFrameImportant[0x53] = true;
            tileFrameImportant[0x54] = true;
            tileFrameImportant[0x55] = true;
            tileSolid[0] = true;
            tileBlockLight[0] = true;
            tileSolid[1] = true;
            tileBlockLight[1] = true;
            tileSolid[2] = true;
            tileBlockLight[2] = true;
            tileSolid[3] = false;
            tileNoAttach[3] = true;
            tileNoFail[3] = true;
            tileSolid[4] = false;
            tileNoAttach[4] = true;
            tileNoFail[4] = true;
            tileNoFail[0x18] = true;
            tileSolid[5] = false;
            tileSolid[6] = true;
            tileBlockLight[6] = true;
            tileSolid[7] = true;
            tileBlockLight[7] = true;
            tileSolid[8] = true;
            tileBlockLight[8] = true;
            tileSolid[9] = true;
            tileBlockLight[9] = true;
            tileBlockLight[10] = true;
            tileSolid[10] = true;
            tileNoAttach[10] = true;
            tileBlockLight[10] = true;
            tileSolid[11] = false;
            tileSolidTop[0x13] = true;
            tileSolid[0x13] = true;
            tileSolid[0x16] = true;
            tileSolid[0x17] = true;
            tileSolid[0x19] = true;
            tileSolid[30] = true;
            tileNoFail[0x20] = true;
            tileBlockLight[0x20] = true;
            tileSolid[0x25] = true;
            tileBlockLight[0x25] = true;
            tileSolid[0x26] = true;
            tileBlockLight[0x26] = true;
            tileSolid[0x27] = true;
            tileBlockLight[0x27] = true;
            tileSolid[40] = true;
            tileBlockLight[40] = true;
            tileSolid[0x29] = true;
            tileBlockLight[0x29] = true;
            tileSolid[0x2b] = true;
            tileBlockLight[0x2b] = true;
            tileSolid[0x2c] = true;
            tileBlockLight[0x2c] = true;
            tileSolid[0x2d] = true;
            tileBlockLight[0x2d] = true;
            tileSolid[0x2e] = true;
            tileBlockLight[0x2e] = true;
            tileSolid[0x2f] = true;
            tileBlockLight[0x2f] = true;
            tileSolid[0x30] = true;
            tileBlockLight[0x30] = true;
            tileSolid[0x35] = true;
            tileBlockLight[0x35] = true;
            tileSolid[0x36] = true;
            tileBlockLight[0x34] = true;
            tileSolid[0x38] = true;
            tileBlockLight[0x38] = true;
            tileSolid[0x39] = true;
            tileBlockLight[0x39] = true;
            tileSolid[0x3a] = true;
            tileBlockLight[0x3a] = true;
            tileSolid[0x3b] = true;
            tileBlockLight[0x3b] = true;
            tileSolid[60] = true;
            tileBlockLight[60] = true;
            tileSolid[0x3f] = true;
            tileBlockLight[0x3f] = true;
            tileStone[0x3f] = true;
            tileSolid[0x40] = true;
            tileBlockLight[0x40] = true;
            tileStone[0x40] = true;
            tileSolid[0x41] = true;
            tileBlockLight[0x41] = true;
            tileStone[0x41] = true;
            tileSolid[0x42] = true;
            tileBlockLight[0x42] = true;
            tileStone[0x42] = true;
            tileSolid[0x43] = true;
            tileBlockLight[0x43] = true;
            tileStone[0x43] = true;
            tileSolid[0x44] = true;
            tileBlockLight[0x44] = true;
            tileStone[0x44] = true;
            tileSolid[0x4b] = true;
            tileBlockLight[0x4b] = true;
            tileSolid[0x4c] = true;
            tileBlockLight[0x4c] = true;
            tileSolid[70] = true;
            tileBlockLight[70] = true;
            tileBlockLight[0x33] = true;
            tileNoFail[50] = true;
            tileNoAttach[50] = true;
            tileDungeon[0x29] = true;
            tileDungeon[0x2b] = true;
            tileDungeon[0x2c] = true;
            tileBlockLight[30] = true;
            tileBlockLight[0x19] = true;
            tileBlockLight[0x17] = true;
            tileBlockLight[0x16] = true;
            tileBlockLight[0x3e] = true;
            tileSolidTop[0x12] = true;
            tileSolidTop[14] = true;
            tileSolidTop[0x10] = true;
            tileNoAttach[20] = true;
            tileNoAttach[0x13] = true;
            tileNoAttach[13] = true;
            tileNoAttach[14] = true;
            tileNoAttach[15] = true;
            tileNoAttach[0x10] = true;
            tileNoAttach[0x11] = true;
            tileNoAttach[0x12] = true;
            tileNoAttach[0x13] = true;
            tileNoAttach[0x15] = true;
            tileNoAttach[0x1b] = true;
            tileFrameImportant[3] = true;
            tileFrameImportant[5] = true;
            tileFrameImportant[10] = true;
            tileFrameImportant[11] = true;
            tileFrameImportant[12] = true;
            tileFrameImportant[13] = true;
            tileFrameImportant[14] = true;
            tileFrameImportant[15] = true;
            tileFrameImportant[0x10] = true;
            tileFrameImportant[0x11] = true;
            tileFrameImportant[0x12] = true;
            tileFrameImportant[20] = true;
            tileFrameImportant[0x15] = true;
            tileFrameImportant[0x18] = true;
            tileFrameImportant[0x1a] = true;
            tileFrameImportant[0x1b] = true;
            tileFrameImportant[0x1c] = true;
            tileFrameImportant[0x1d] = true;
            tileFrameImportant[0x1f] = true;
            tileFrameImportant[0x21] = true;
            tileFrameImportant[0x22] = true;
            tileFrameImportant[0x23] = true;
            tileFrameImportant[0x24] = true;
            tileFrameImportant[0x2a] = true;
            tileFrameImportant[50] = true;
            tileFrameImportant[0x37] = true;
            tileFrameImportant[0x3d] = true;
            tileFrameImportant[0x47] = true;
            tileFrameImportant[0x48] = true;
            tileFrameImportant[0x49] = true;
            tileFrameImportant[0x4a] = true;
            tileFrameImportant[0x4d] = true;
            tileFrameImportant[0x4e] = true;
            tileFrameImportant[0x4f] = true;
            tileFrameImportant[0x51] = true;
            tileTable[14] = true;
            tileTable[0x12] = true;
            tileTable[0x13] = true;
            tileWaterDeath[4] = true;
            tileWaterDeath[0x33] = true;
            tileLavaDeath[3] = true;
            tileLavaDeath[5] = true;
            tileLavaDeath[10] = true;
            tileLavaDeath[11] = true;
            tileLavaDeath[12] = true;
            tileLavaDeath[13] = true;
            tileLavaDeath[14] = true;
            tileLavaDeath[15] = true;
            tileLavaDeath[0x10] = true;
            tileLavaDeath[0x11] = true;
            tileLavaDeath[0x12] = true;
            tileLavaDeath[0x13] = true;
            tileLavaDeath[20] = true;
            tileLavaDeath[0x1b] = true;
            tileLavaDeath[0x1c] = true;
            tileLavaDeath[0x1d] = true;
            tileLavaDeath[0x20] = true;
            tileLavaDeath[0x21] = true;
            tileLavaDeath[0x22] = true;
            tileLavaDeath[0x23] = true;
            tileLavaDeath[0x24] = true;
            tileLavaDeath[0x2a] = true;
            tileLavaDeath[0x31] = true;
            tileLavaDeath[50] = true;
            tileLavaDeath[0x34] = true;
            tileLavaDeath[0x37] = true;
            tileLavaDeath[0x3d] = true;
            tileLavaDeath[0x3e] = true;
            tileLavaDeath[0x45] = true;
            tileLavaDeath[0x47] = true;
            tileLavaDeath[0x48] = true;
            tileLavaDeath[0x49] = true;
            tileLavaDeath[0x4a] = true;
            tileLavaDeath[0x4f] = true;
            tileLavaDeath[80] = true;
            tileLavaDeath[0x51] = true;
            wallHouse[1] = true;
            wallHouse[4] = true;
            wallHouse[5] = true;
            wallHouse[6] = true;
            wallHouse[10] = true;
            wallHouse[11] = true;
            wallHouse[12] = true;
            tileNoFail[0x3d] = true;
            tileNoFail[0x49] = true;
            tileNoFail[0x4a] = true;
            tileNoFail[0x52] = true;
            tileNoFail[0x53] = true;
            tileNoFail[0x54] = true;

            for (int i = 0; i < 0x56; i++)
            {
                tileName[i] = "";
            }
            tileName[13] = "Bottle";
            tileName[14] = "Table";
            tileName[15] = "Chair";
            tileName[0x10] = "Anvil";
            tileName[0x11] = "Furnace";
            tileName[0x12] = "Workbench";
            tileName[0x1a] = "Demon Altar";
            tileName[0x4d] = "Hellforge";

            tileName[254] = "Portal"; //Mod

            for (int j = 0; j < maxMenuItems; j++)
            {
                this.menuItemScale[j] = 0.8f;
            }
            for (int k = 0; k < 0x3e8; k++)
            {
                dust[k] = new Dust();
            }
            for (int m = 0; m < 0xc9; m++)
            {
                Main.item[m] = new Item();
            }
            for (int n = 0; n < 0x3e9; n++)
            {
                npc[n] = new NPC();
                npc[n].whoAmI = n;
            }
            for (int num7 = 0; num7 < 0x100; num7++)
            {
                player[num7] = new Player();
            }
            for (int num8 = 0; num8 < 0x3e9; num8++)
            {
                projectile[num8] = new Projectile();
            }
            for (int num9 = 0; num9 < 0xc9; num9++)
            {
                gore[num9] = new Gore();
            }
            for (int num10 = 0; num10 < 100; num10++)
            {
                cloud[num10] = new Cloud();
            }
            for (int num11 = 0; num11 < 100; num11++)
            {
                combatText[num11] = new CombatText();
            }
            for (int num12 = 0; num12 < 100; num12++)
            {
                itemText[num12] = new ItemText();
            }
            for (int num13 = 0; num13 < 0x1000; num13++) //Mod: added more items
            {
                if (num13 < 0x147 || (num13 >= minAddedItems && num13 <= maxAddedItems)) //Mod
                {
                    Item item = new Item();
                    item.SetDefaults(num13, false);
                    itemName[num13] = item.name;
                }
            }
            for (int num14 = 0; num14 < Recipe.maxRecipes; num14++)
            {
                recipe[num14] = new Recipe();
                availableRecipeY[num14] = 0x41 * num14;
            }
            Recipe.SetupRecipes();
            for (int num15 = 0; num15 < numChatLines; num15++)
            {
                chatLine[num15] = new ChatLine();
            }
            for (int num16 = 0; num16 < Liquid.resLiquid; num16++)
            {
                liquid[num16] = new Liquid();
            }
            for (int num17 = 0; num17 < 0x2710; num17++)
            {
                liquidBuffer[num17] = new LiquidBuffer();
            }
            this.shop[0] = new Chest();
            this.shop[1] = new Chest();
            this.shop[1].SetupShop(1);
            this.shop[2] = new Chest();
            this.shop[2].SetupShop(2);
            this.shop[3] = new Chest();
            this.shop[3].SetupShop(3);
            this.shop[4] = new Chest();
            this.shop[4].SetupShop(4);
            this.shop[5] = new Chest();
            this.shop[5].SetupShop(5);
            teamColor[0] = Color.White;
            teamColor[1] = new Color(230, 40, 20);
            teamColor[2] = new Color(20, 200, 30);
            teamColor[3] = new Color(0x4b, 90, 0xff);
            teamColor[4] = new Color(200, 180, 0);
            if (menuMode == 1)
            {
                LoadPlayers();
            }
            Netplay.Init();
            if (skipMenu)
            {
                WorldGen.clearWorld();
                gameMenu = false;
                LoadPlayers();
                player[myPlayer] = (Player) loadPlayer[0].Clone();
                PlayerPath = loadPlayerPath[0];
                LoadWorlds();
                WorldGen.generateWorld(-1);
                WorldGen.EveryTileFrame();
                player[myPlayer].Spawn();
            }
            else
            {
                IntPtr systemMenu = GetSystemMenu(base.Window.Handle, false);
                int menuItemCount = GetMenuItemCount(systemMenu);
                RemoveMenu(systemMenu, menuItemCount - 1, 0x400);
            }
            if (!dedServ)
            {
                this.graphics.PreferredBackBufferWidth = screenWidth;
                this.graphics.PreferredBackBufferHeight = screenHeight;
                this.graphics.ApplyChanges();
                base.Initialize();
                base.Window.AllowUserResizing = true;
                this.OpenSettings();
                Star.SpawnStars();
                foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
                {
                    if (((mode.Width < minScreenW) || (mode.Height < minScreenH)) || ((mode.Width > maxScreenW) || (mode.Height > maxScreenH)))
                    {
                        continue;
                    }
                    bool flag = true;
                    for (int num19 = 0; num19 < this.numDisplayModes; num19++)
                    {
                        if ((mode.Width == this.displayWidth[num19]) && (mode.Height == this.displayHeight[num19]))
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        this.displayHeight[this.numDisplayModes] = mode.Height;
                        this.displayWidth[this.numDisplayModes] = mode.Width;
                        this.numDisplayModes++;
                    }
                }
                if (autoJoin)
                {
                    LoadPlayers();
                    menuMode = 1;
                    menuMultiplayer = true;
                }
            }
        }
Пример #12
0
 protected override void Update(GameTime gameTime)
 {
     if (Main.netMode != 2)
     {
         snowing();
     }
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     WorldGen.destroyObject = false;
     if (!dedServ)
     {
         if (fixedTiming)
         {
             if (base.IsActive)
             {
                 base.IsFixedTimeStep = false;
             }
             else
             {
                 base.IsFixedTimeStep = true;
             }
         }
         else
         {
             base.IsFixedTimeStep = true;
         }
         this.graphics.SynchronizeWithVerticalRetrace = true;
         this.UpdateMusic();
         if (showSplash)
         {
             return;
         }
         if (!gameMenu && (Main.netMode == 1))
         {
             if (!saveTime.IsRunning)
             {
                 saveTime.Start();
             }
             if (saveTime.ElapsedMilliseconds > 0x493e0)
             {
                 saveTime.Reset();
                 WorldGen.saveToonWhilePlaying();
             }
         }
         else if (!gameMenu && autoSave)
         {
             if (!saveTime.IsRunning)
             {
                 saveTime.Start();
             }
             if (saveTime.ElapsedMilliseconds > 0x927c0)
             {
                 saveTime.Reset();
                 WorldGen.saveToonWhilePlaying();
                 WorldGen.saveAndPlay();
             }
         }
         else if (saveTime.IsRunning)
         {
             saveTime.Stop();
         }
         if (teamCooldown > 0)
         {
             teamCooldown--;
         }
         updateTime++;
         if (fpsTimer.ElapsedMilliseconds >= 0x3e8)
         {
             if (fpsCount >= (30f + (30f * gfxQuality)))
             {
                 gfxQuality += gfxRate;
                 gfxRate += 0.005f;
             }
             else if (fpsCount < (29f + (30f * gfxQuality)))
             {
                 gfxRate = 0.01f;
                 gfxQuality -= 0.1f;
             }
             if (gfxQuality < 0f)
             {
                 gfxQuality = 0f;
             }
             if (gfxQuality > 1f)
             {
                 gfxQuality = 1f;
             }
             if (maxQ && base.IsActive)
             {
                 gfxQuality = 1f;
                 maxQ = false;
             }
             updateRate = uCount;
             frameRate = fpsCount;
             fpsCount = 0;
             fpsTimer.Restart();
             updateTime = 0;
             drawTime = 0;
             uCount = 0;
             if (Main.netMode == 2)
             {
                 cloudLimit = 0;
             }
         }
         if (fixedTiming)
         {
             float num = 16f;
             float elapsedMilliseconds = updateTimer.ElapsedMilliseconds;
             if ((elapsedMilliseconds + uCarry) < num)
             {
                 drawSkip = true;
                 return;
             }
             uCarry += elapsedMilliseconds - num;
             if (uCarry > 1000f)
             {
                 uCarry = 1000f;
             }
             updateTimer.Restart();
         }
         uCount++;
         drawSkip = false;
         if (qaStyle == 1)
         {
             gfxQuality = 1f;
         }
         else if (qaStyle == 2)
         {
             gfxQuality = 0.5f;
         }
         else if (qaStyle == 3)
         {
             gfxQuality = 0f;
         }
         numDust = (int)(2000f * ((gfxQuality * 0.75f) + 0.25f));
         Gore.goreTime = (int)(600f * gfxQuality);
         cloudLimit = (int)(100f * gfxQuality);
         Liquid.maxLiquid = (int)(2500f + (2500f * gfxQuality));
         Liquid.cycles = (int)(17f - (10f * gfxQuality));
         if (gfxQuality < 0.5)
         {
             this.graphics.SynchronizeWithVerticalRetrace = false;
         }
         else
         {
             this.graphics.SynchronizeWithVerticalRetrace = true;
         }
         if (gfxQuality < 0.2)
         {
             Lighting.maxRenderCount = 8;
         }
         else if (gfxQuality < 0.4)
         {
             Lighting.maxRenderCount = 7;
         }
         else if (gfxQuality < 0.6)
         {
             Lighting.maxRenderCount = 6;
         }
         else if (gfxQuality < 0.8)
         {
             Lighting.maxRenderCount = 5;
         }
         else
         {
             Lighting.maxRenderCount = 4;
         }
         if (Liquid.quickSettle)
         {
             Liquid.maxLiquid = Liquid.resLiquid;
             Liquid.cycles = 1;
         }
         if (!base.IsActive)
         {
             hasFocus = false;
         }
         else
         {
             hasFocus = true;
         }
         if (!base.IsActive && (Main.netMode == 0))
         {
             base.IsMouseVisible = true;
             if ((Main.netMode != 2) && (myPlayer >= 0))
             {
                 player[myPlayer].delayUseItem = true;
             }
             mouseLeftRelease = false;
             mouseRightRelease = false;
             if (gameMenu)
             {
                 UpdateMenu();
             }
             gamePaused = true;
             return;
         }
         base.IsMouseVisible = false;
         demonTorch += demonTorchDir * 0.01f;
         if (demonTorch > 1f)
         {
             demonTorch = 1f;
             demonTorchDir = -1;
         }
         if (demonTorch < 0f)
         {
             demonTorch = 0f;
             demonTorchDir = 1;
         }
         int num3 = 7;
         if (this.DiscoStyle == 0)
         {
             DiscoG += num3;
             if (DiscoG >= 0xff)
             {
                 DiscoG = 0xff;
                 this.DiscoStyle++;
             }
             DiscoR -= num3;
             if (DiscoR <= 0)
             {
                 DiscoR = 0;
             }
         }
         else if (this.DiscoStyle == 1)
         {
             DiscoB += num3;
             if (DiscoB >= 0xff)
             {
                 DiscoB = 0xff;
                 this.DiscoStyle++;
             }
             DiscoG -= num3;
             if (DiscoG <= 0)
             {
                 DiscoG = 0;
             }
         }
         else
         {
             DiscoR += num3;
             if (DiscoR >= 0xff)
             {
                 DiscoR = 0xff;
                 this.DiscoStyle = 0;
             }
             DiscoB -= num3;
             if (DiscoB <= 0)
             {
                 DiscoB = 0;
             }
         }
         if ((keyState.IsKeyDown(Keys.F10) && !chatMode) && !editSign)
         {
             if (frameRelease)
             {
                 PlaySound(12, -1, -1, 1);
                 if (showFrameRate)
                 {
                     showFrameRate = false;
                 }
                 else
                 {
                     showFrameRate = true;
                 }
             }
             frameRelease = false;
         }
         else
         {
             frameRelease = true;
         }
         if ((keyState.IsKeyDown(Keys.F9) && !chatMode) && !editSign)
         {
             if (RGBRelease)
             {
                 Lighting.lightCounter += 100;
                 PlaySound(12, -1, -1, 1);
                 Lighting.lightMode++;
                 if (Lighting.lightMode >= 4)
                 {
                     Lighting.lightMode = 0;
                 }
                 if ((Lighting.lightMode == 2) || (Lighting.lightMode == 0))
                 {
                     renderCount = 0;
                     renderNow = true;
                     int num4 = (screenWidth / 0x10) + (Lighting.offScreenTiles * 2);
                     int num5 = (screenHeight / 0x10) + (Lighting.offScreenTiles * 2);
                     for (int i = 0; i < num4; i++)
                     {
                         for (int j = 0; j < num5; j++)
                         {
                             Lighting.color[i, j] = 0f;
                             Lighting.colorG[i, j] = 0f;
                             Lighting.colorB[i, j] = 0f;
                         }
                     }
                 }
             }
             RGBRelease = false;
         }
         else
         {
             RGBRelease = true;
         }
         if ((keyState.IsKeyDown(Keys.F8) && !chatMode) && !editSign)
         {
             if (netRelease)
             {
                 PlaySound(12, -1, -1, 1);
                 if (netDiag)
                 {
                     netDiag = false;
                 }
                 else
                 {
                     netDiag = true;
                 }
             }
             netRelease = false;
         }
         else
         {
             netRelease = true;
         }
         if ((keyState.IsKeyDown(Keys.F7) && !chatMode) && !editSign)
         {
             if (drawRelease)
             {
                 PlaySound(12, -1, -1, 1);
                 if (drawDiag)
                 {
                     drawDiag = false;
                 }
                 else
                 {
                     drawDiag = true;
                 }
             }
             drawRelease = false;
         }
         else
         {
             drawRelease = true;
         }
         if (keyState.IsKeyDown(Keys.F11))
         {
             if (releaseUI)
             {
                 if (hideUI)
                 {
                     hideUI = false;
                 }
                 else
                 {
                     hideUI = true;
                 }
             }
             releaseUI = false;
         }
         else
         {
             releaseUI = true;
         }
         if ((keyState.IsKeyDown(Keys.LeftAlt) || keyState.IsKeyDown(Keys.RightAlt)) && keyState.IsKeyDown(Keys.Enter))
         {
             if (this.toggleFullscreen)
             {
                 this.graphics.ToggleFullScreen();
                 chatRelease = false;
             }
             this.toggleFullscreen = false;
         }
         else
         {
             this.toggleFullscreen = true;
         }
         if (!gamePad || gameMenu)
         {
             oldMouseState = mouseState;
             mouseState = Mouse.GetState();
             mouseX = mouseState.X;
             mouseY = mouseState.Y;
             mouseLeft = false;
             mouseRight = false;
             if (mouseState.LeftButton == ButtonState.Pressed)
             {
                 mouseLeft = true;
             }
             if (mouseState.RightButton == ButtonState.Pressed)
             {
                 mouseRight = true;
             }
         }
         keyState = Keyboard.GetState();
         if (editSign)
         {
             chatMode = false;
         }
         if (chatMode)
         {
             if (keyState.IsKeyDown(Keys.Escape))
             {
                 chatMode = false;
             }
             string chatText = Main.chatText;
             Main.chatText = GetInputText(Main.chatText);
             while (fontMouseText.MeasureString(Main.chatText).X > 470f)
             {
                 Main.chatText = Main.chatText.Substring(0, Main.chatText.Length - 1);
             }
             if (chatText != Main.chatText)
             {
                 PlaySound(12, -1, -1, 1);
             }
             if (inputTextEnter && chatRelease)
             {
                 //if (Main.chatText != "")
                 if (Main.chatText != "" && Mods.ModHooks.onChat(Main.chatText))
                 {
                     NetMessage.SendData(0x19, -1, -1, Main.chatText, myPlayer, 0f, 0f, 0f, 0);
                 }
                 Main.chatText = "";
                 chatMode = false;
                 chatRelease = false;
                 player[myPlayer].releaseHook = false;
                 player[myPlayer].releaseThrow = false;
                 PlaySound(11, -1, -1, 1);
             }
         }
         //
         // original code:
         //if ((keyState.IsKeyDown(Keys.Enter) && (Main.netMode == 1)) && (!keyState.IsKeyDown(Keys.LeftAlt) && !keyState.IsKeyDown(Keys.RightAlt)))
         //
         // ALLOW CHAT IN SINGLEPLAYER
         //
         if ((keyState.IsKeyDown(Keys.Enter)) && (!keyState.IsKeyDown(Keys.LeftAlt) && !keyState.IsKeyDown(Keys.RightAlt)))
         {
             if ((chatRelease && !chatMode) && (!editSign && !keyState.IsKeyDown(Keys.Escape)))
             {
                 PlaySound(10, -1, -1, 1);
                 chatMode = true;
                 Main.chatText = "";
             }
             chatRelease = false;
         }
         else
         {
             chatRelease = true;
         }
         if (gameMenu)
         {
             UpdateMenu();
             if (Main.netMode != 2)
             {
                 return;
             }
             gamePaused = false;
         }
     }
     if (Main.netMode == 1)
     {
         for (int k = 0; k < 0x31; k++)
         {
             if (player[myPlayer].inventory[k].IsNotTheSameAs(clientPlayer.inventory[k]))
             {
                 NetMessage.SendData(5, -1, -1, player[myPlayer].inventory[k].name, myPlayer, (float)k, (float)player[myPlayer].inventory[k].prefix, 0f, 0);
             }
         }
         if (player[myPlayer].armor[0].IsNotTheSameAs(clientPlayer.armor[0]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[0].name, myPlayer, 49f, (float)player[myPlayer].armor[0].prefix, 0f, 0);
         }
         if (player[myPlayer].armor[1].IsNotTheSameAs(clientPlayer.armor[1]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[1].name, myPlayer, 50f, (float)player[myPlayer].armor[1].prefix, 0f, 0);
         }
         if (player[myPlayer].armor[2].IsNotTheSameAs(clientPlayer.armor[2]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[2].name, myPlayer, 51f, (float)player[myPlayer].armor[2].prefix, 0f, 0);
         }
         if (player[myPlayer].armor[3].IsNotTheSameAs(clientPlayer.armor[3]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[3].name, myPlayer, 52f, (float)player[myPlayer].armor[3].prefix, 0f, 0);
         }
         if (player[myPlayer].armor[4].IsNotTheSameAs(clientPlayer.armor[4]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[4].name, myPlayer, 53f, (float)player[myPlayer].armor[4].prefix, 0f, 0);
         }
         if (player[myPlayer].armor[5].IsNotTheSameAs(clientPlayer.armor[5]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[5].name, myPlayer, 54f, (float)player[myPlayer].armor[5].prefix, 0f, 0);
         }
         if (player[myPlayer].armor[6].IsNotTheSameAs(clientPlayer.armor[6]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[6].name, myPlayer, 55f, (float)player[myPlayer].armor[6].prefix, 0f, 0);
         }
         if (player[myPlayer].armor[7].IsNotTheSameAs(clientPlayer.armor[7]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[7].name, myPlayer, 56f, (float)player[myPlayer].armor[7].prefix, 0f, 0);
         }
         if (player[myPlayer].armor[8].IsNotTheSameAs(clientPlayer.armor[8]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[8].name, myPlayer, 57f, (float)player[myPlayer].armor[8].prefix, 0f, 0);
         }
         if (player[myPlayer].armor[9].IsNotTheSameAs(clientPlayer.armor[9]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[9].name, myPlayer, 58f, (float)player[myPlayer].armor[9].prefix, 0f, 0);
         }
         if (player[myPlayer].armor[10].IsNotTheSameAs(clientPlayer.armor[10]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[10].name, myPlayer, 59f, (float)player[myPlayer].armor[10].prefix, 0f, 0);
         }
         if (player[myPlayer].chest != clientPlayer.chest)
         {
             NetMessage.SendData(0x21, -1, -1, "", player[myPlayer].chest, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].talkNPC != clientPlayer.talkNPC)
         {
             NetMessage.SendData(40, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].zoneEvil != clientPlayer.zoneEvil)
         {
             NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].zoneMeteor != clientPlayer.zoneMeteor)
         {
             NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].zoneDungeon != clientPlayer.zoneDungeon)
         {
             NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].zoneJungle != clientPlayer.zoneJungle)
         {
             NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].zoneHoly != clientPlayer.zoneHoly)
         {
             NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         bool flag = false;
         for (int m = 0; m < 10; m++)
         {
             if (player[myPlayer].buffType[m] != clientPlayer.buffType[m])
             {
                 flag = true;
             }
         }
         if (flag)
         {
             NetMessage.SendData(50, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
             NetMessage.SendData(13, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
     }
     if (Main.netMode == 1)
     {
         clientPlayer = (Player)player[myPlayer].clientClone();
     }
     if (((Main.netMode == 0) && ((playerInventory || (npcChatText != "")) || (player[myPlayer].sign >= 0))) && autoPause)
     {
         Keys[] pressedKeys = keyState.GetPressedKeys();
         player[myPlayer].controlInv = false;
         for (int n = 0; n < pressedKeys.Length; n++)
         {
             if ((pressedKeys[n]).ToString() == cInv)
             {
                 player[myPlayer].controlInv = true;
             }
         }
         if (player[myPlayer].controlInv)
         {
             if (player[myPlayer].releaseInventory)
             {
                 player[myPlayer].toggleInv();
             }
             player[myPlayer].releaseInventory = false;
         }
         else
         {
             player[myPlayer].releaseInventory = true;
         }
         if (playerInventory)
         {
             int num11 = (mouseState.ScrollWheelValue - oldMouseState.ScrollWheelValue) / 120;
             focusRecipe += num11;
             if (focusRecipe > (numAvailableRecipes - 1))
             {
                 focusRecipe = numAvailableRecipes - 1;
             }
             if (focusRecipe < 0)
             {
                 focusRecipe = 0;
             }
             player[myPlayer].dropItemCheck();
         }
         player[myPlayer].head = player[myPlayer].armor[0].headSlot;
         player[myPlayer].body = player[myPlayer].armor[1].bodySlot;
         player[myPlayer].legs = player[myPlayer].armor[2].legSlot;
         if (!player[myPlayer].hostile)
         {
             if (player[myPlayer].armor[8].headSlot >= 0)
             {
                 player[myPlayer].head = player[myPlayer].armor[8].headSlot;
             }
             if (player[myPlayer].armor[9].bodySlot >= 0)
             {
                 player[myPlayer].body = player[myPlayer].armor[9].bodySlot;
             }
             if (player[myPlayer].armor[10].legSlot >= 0)
             {
                 player[myPlayer].legs = player[myPlayer].armor[10].legSlot;
             }
         }
         if (editSign)
         {
             if (player[myPlayer].sign == -1)
             {
                 editSign = false;
             }
             else
             {
                 npcChatText = GetInputText(npcChatText);
                 if (inputTextEnter)
                 {
                     byte[] bytes = new byte[] { 10 };
                     npcChatText = npcChatText + Encoding.ASCII.GetString(bytes);
                 }
             }
         }
         gamePaused = true;
     }
     else
     {
         gamePaused = false;
         if ((!dedServ && (screenPosition.Y < ((worldSurface * 16.0) + 16.0))) && (Main.netMode != 2))
         {
             Star.UpdateStars();
             Cloud.UpdateClouds();
         }
         for (int num12 = 0; num12 < 0xff; num12++)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     player[num12].UpdatePlayer(num12);
                 }
                 catch
                 {
                 }
             }
             else
             {
                 player[num12].UpdatePlayer(num12);
             }
         }
         if (Main.netMode != 1)
         {
             NPC.SpawnNPC();
         }
         for (int num13 = 0; num13 < 0xff; num13++)
         {
             player[num13].activeNPCs = 0f;
             player[num13].townNPCs = 0f;
         }
         if ((wof >= 0) && !npc[wof].active)
         {
             wof = -1;
         }
         for (int num14 = 0; num14 < 200; num14++)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     npc[num14].UpdateNPC(num14);
                 }
                 catch (Exception)
                 {
                     npc[num14] = new NPC();
                 }
             }
             else
             {
                 npc[num14].UpdateNPC(num14);
             }
         }
         for (int num15 = 0; num15 < 200; num15++)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     gore[num15].Update();
                 }
                 catch
                 {
                     gore[num15] = new Gore();
                 }
             }
             else
             {
                 gore[num15].Update();
             }
         }
         for (int num16 = 0; num16 < 0x3e8; num16++)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     projectile[num16].Update(num16);
                 }
                 catch
                 {
                     projectile[num16] = new Projectile();
                 }
             }
             else
             {
                 projectile[num16].Update(num16);
             }
         }
         for (int num17 = 0; num17 < 200; num17++)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     item[num17].UpdateItem(num17);
                 }
                 catch
                 {
                     item[num17] = new Item();
                 }
             }
             else
             {
                 item[num17].UpdateItem(num17);
             }
         }
         if (ignoreErrors)
         {
             try
             {
                 Dust.UpdateDust();
             }
             catch
             {
                 for (int num18 = 0; num18 < 0x7d0; num18++)
                 {
                     dust[num18] = new Dust();
                 }
             }
         }
         else
         {
             Dust.UpdateDust();
         }
         if (Main.netMode != 2)
         {
             CombatText.UpdateCombatText();
             ItemText.UpdateItemText();
         }
         if (ignoreErrors)
         {
             try
             {
                 UpdateTime();
             }
             catch
             {
                 checkForSpawns = 0;
             }
         }
         else
         {
             UpdateTime();
         }
         if (Main.netMode != 1)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     WorldGen.UpdateWorld();
                     UpdateInvasion();
                 }
                 catch
                 {
                 }
             }
             else
             {
                 WorldGen.UpdateWorld();
                 UpdateInvasion();
             }
         }
         if (ignoreErrors)
         {
             try
             {
                 if (Main.netMode == 2)
                 {
                     UpdateServer();
                 }
                 if (Main.netMode == 1)
                 {
                     UpdateClient();
                 }
             }
             catch
             {
                 int netMode = Main.netMode;
             }
         }
         else
         {
             if (Main.netMode == 2)
             {
                 UpdateServer();
             }
             if (Main.netMode == 1)
             {
                 UpdateClient();
             }
         }
         if (ignoreErrors)
         {
             try
             {
                 for (int num19 = 0; num19 < numChatLines; num19++)
                 {
                     if (chatLine[num19].showTime > 0)
                     {
                         ChatLine line1 = chatLine[num19];
                         line1.showTime--;
                     }
                 }
             }
             catch
             {
                 for (int num20 = 0; num20 < numChatLines; num20++)
                 {
                     chatLine[num20] = new ChatLine();
                 }
             }
         }
         else
         {
             for (int num21 = 0; num21 < numChatLines; num21++)
             {
                 if (chatLine[num21].showTime > 0)
                 {
                     ChatLine line2 = chatLine[num21];
                     line2.showTime--;
                 }
             }
         }
         upTimer = stopwatch.ElapsedMilliseconds;
         if (upTimerMaxDelay > 0f)
         {
             upTimerMaxDelay--;
         }
         else
         {
             upTimerMax = 0f;
         }
         if (upTimer > upTimerMax)
         {
             upTimerMax = upTimer;
             upTimerMaxDelay = 400f;
         }
         base.Update(gameTime);
     }
 }
Пример #13
0
 public static Gore NewGoreDirect(Vector2 Position, Vector2 Velocity, int Type, float Scale = 1f)
 {
     return(Main.gore[Gore.NewGore(Position, Velocity, Type, Scale)]);
 }
Пример #14
0
 //in Terraria.Gore add modGore property (internal set)
 //in Terraria.Gore.NewGore after resetting properties call ModGore.SetupGore(Main.gore[num]);
 internal static void SetupGore(Gore gore)
 {
     if (gore.type >= GoreID.Count)
     {
         gore.modGore = gores[gore.type];
         gore.modGore.OnSpawn(gore);
     }
     else
     {
         gore.modGore = null;
     }
 }
Пример #15
0
        public override bool Update(Gore gore)
        {
            if (gore.position.Y < Main.worldSurface * 16.0 + 8.0)
            {
                gore.alpha = 0;
            }
            else
            {
                gore.alpha = 100;
            }
            int frameDuration = 4;
            gore.frameCounter += 1;
            if (gore.frame <= 4)
            {
                int tileX = (int)(gore.position.X / 16f);
                int tileY = (int)(gore.position.Y / 16f) - 1;
                if (WorldGen.InWorld(tileX, tileY, 0) && !Main.tile[tileX, tileY].active())
                {
                    gore.active = false;
                }
                if (gore.frame == 0 || gore.frame == 1 || gore.frame == 2)
                {
                    frameDuration = 24 + Main.rand.Next(256);
                }
                if (gore.frame == 3)
                {
                    frameDuration = 24 + Main.rand.Next(96);
                }
                if ((int)gore.frameCounter >= frameDuration)
                {
                    gore.frameCounter = 0;
                    gore.frame += 1;
                    if (gore.frame == 5)
                    {
                        int droplet = Gore.NewGore(gore.position, gore.velocity, gore.type, 1f);
                        Main.gore[droplet].frame = 9;
                        Main.gore[droplet].velocity *= 0f;
                    }
                }
            }
            else if (gore.frame <= 6)
            {
                frameDuration = 8;
                if ((int)gore.frameCounter >= frameDuration)
                {
                    gore.frameCounter = 0;
                    gore.frame += 1;
                    if (gore.frame == 7)
                    {
                        gore.active = false;
                    }
                }
            }
            else if (gore.frame <= 9)
            {
                frameDuration = 6;
                gore.velocity.Y += 0.2f;
                if (gore.velocity.Y < 0.5f)
                {
                    gore.velocity.Y = 0.5f;
                }
                if (gore.velocity.Y > 12f)
                {
                    gore.velocity.Y = 12f;
                }
                if ((int)gore.frameCounter >= frameDuration)
                {
                    gore.frameCounter = 0;
                    gore.frame += 1;
                }
                if (gore.frame > 9)
                {
                    gore.frame = 7;
                }
            }
            else
            {
                gore.velocity.Y += 0.1f;
                if ((int)gore.frameCounter >= frameDuration)
                {
                    gore.frameCounter = 0;
                    gore.frame += 1;
                }
                gore.velocity *= 0f;
                if (gore.frame > 14)
                {
                    gore.active = false;
                }
            }

            Vector2 oldVelocity = gore.velocity;
            gore.velocity = Collision.TileCollision(gore.position, gore.velocity, 16, 14, false, false, 1);
            if (gore.velocity != oldVelocity)
            {
                if (gore.frame < 10)
                {
                    gore.frame = 10;
                    gore.frameCounter = 0;
                    Main.PlaySound(SoundID.Drip, (int)gore.position.X + 8, (int)gore.position.Y + 8, Main.rand.Next(2));
                }
            }
            else if (Collision.WetCollision(gore.position + gore.velocity, 16, 14))
            {
                if (gore.frame < 10)
                {
                    gore.frame = 10;
                    gore.frameCounter = 0;
                    Main.PlaySound(SoundID.Drip, (int)gore.position.X + 8, (int)gore.position.Y + 8, 2);
                }
                int tileX = (int)(gore.position.X + 8f) / 16;
                int tileY = (int)(gore.position.Y + 14f) / 16;
                if (Main.tile[tileX, tileY] != null && Main.tile[tileX, tileY].liquid > 0)
                {
                    gore.velocity *= 0f;
                    gore.position.Y = tileY * 16 - (int)(Main.tile[tileX, tileY].liquid / 16);
                }
            }

            gore.position += gore.velocity;
            return false;
        }
Пример #16
0
 public override void OnSpawn(Gore gore)
 {
     gore.numFrames = 15;
     gore.behindTiles = true;
     gore.timeLeft = Gore.goreTime * 3;
 }
Пример #17
0
 public void SetMount(int m, Player mountedPlayer, bool faceLeft = false)
 {
     if (this._type == m || m <= -1 || m >= 7)
     {
         return;
     }
     if (m == 5 && mountedPlayer.wet)
     {
         return;
     }
     if (this._active)
     {
         mountedPlayer.ClearBuff(this._data.buff);
         if (this._type == 6)
         {
             mountedPlayer.ClearBuff(this._data.extraBuff);
             mountedPlayer.cartFlip           = false;
             mountedPlayer.fullRotation       = 0f;
             mountedPlayer.fullRotationOrigin = Vector2.Zero;
             mountedPlayer.lastBoost          = Vector2.Zero;
         }
     }
     else
     {
         this._active = true;
     }
     this._flyTime    = 0;
     this._type       = m;
     this._data       = Mount.mounts[m];
     this._fatigueMax = (float)this._data.fatigueMax;
     if (this._type == 6 && !faceLeft)
     {
         mountedPlayer.AddBuff(this._data.extraBuff, 3600, true);
         this._flipDraw = true;
     }
     else
     {
         mountedPlayer.AddBuff(this._data.buff, 3600, true);
         this._flipDraw = false;
     }
     mountedPlayer.position.Y = mountedPlayer.position.Y + (float)mountedPlayer.height;
     mountedPlayer.height     = 42 + this._data.heightBoost;
     mountedPlayer.position.Y = mountedPlayer.position.Y - (float)mountedPlayer.height;
     if (Main.netMode != 2)
     {
         for (int i = 0; i < 100; i++)
         {
             if (this._type == 6)
             {
                 if (i % 10 == 0)
                 {
                     int type = Main.rand.Next(61, 64);
                     int num  = Gore.NewGore(new Vector2(mountedPlayer.position.X - 20f, mountedPlayer.position.Y), Vector2.Zero, type, 1f);
                     Main.gore[num].alpha    = 100;
                     Main.gore[num].velocity = Vector2.Transform(new Vector2(1f, 0f), Matrix.CreateRotationZ((float)(Main.rand.NextDouble() * 6.2831854820251465)));
                 }
             }
             else
             {
                 int num2 = Dust.NewDust(new Vector2(mountedPlayer.position.X - 20f, mountedPlayer.position.Y), mountedPlayer.width + 40, mountedPlayer.height, this._data.spawnDust, 0f, 0f, 0, default(Color), 1f);
                 Main.dust[num2].scale += (float)Main.rand.Next(-10, 21) * 0.01f;
                 if (Main.rand.Next(2) == 0)
                 {
                     Main.dust[num2].scale    *= 1.3f;
                     Main.dust[num2].noGravity = true;
                 }
                 else
                 {
                     Main.dust[num2].velocity *= 0.5f;
                 }
                 Main.dust[num2].velocity += mountedPlayer.velocity * 0.8f;
             }
         }
     }
     if (mountedPlayer.whoAmi == Main.myPlayer)
     {
         NetMessage.SendData(13, -1, -1, "", mountedPlayer.whoAmi, 0f, 0f, 0f, 0);
     }
 }
Пример #18
0
        protected override void Initialize()
        {
            NPC.clrNames();
            NPC.setNames();
            bgAlpha[0] = 1f;
            bgAlpha2[0] = 1f;
            for (int i = 0; i < 0x6f; i++)
            {
                projFrames[i] = 1;
            }
            projFrames[0x48] = 4;
            projFrames[0x56] = 4;
            projFrames[0x57] = 4;
            projFrames[0x66] = 2;
            debuff[20] = true;
            debuff[0x15] = true;
            debuff[0x16] = true;
            debuff[0x17] = true;
            debuff[0x18] = true;
            debuff[0x19] = true;
            debuff[0x1c] = true;
            debuff[30] = true;
            debuff[0x1f] = true;
            debuff[0x20] = true;
            debuff[0x21] = true;
            debuff[0x22] = true;
            debuff[0x23] = true;
            debuff[0x24] = true;
            debuff[0x25] = true;
            debuff[0x26] = true;
            debuff[0x27] = true;
            buffName[1] = "Obsidian Skin";
            buffTip[1] = "Immune to lava";
            buffName[2] = "Regeneration";
            buffTip[2] = "Provides life regeneration";
            buffName[3] = "Swiftness";
            buffTip[3] = "25% increased movement speed";
            buffName[4] = "Gills";
            buffTip[4] = "Breathe water instead of air";
            buffName[5] = "Ironskin";
            buffTip[5] = "Increase defense by 8";
            buffName[6] = "Mana Regeneration";
            buffTip[6] = "Increased mana regeneration";
            buffName[7] = "Magic Power";
            buffTip[7] = "20% increased magic damage";
            buffName[8] = "Featherfall";
            buffTip[8] = "Press UP or DOWN to control speed of descent";
            buffName[9] = "Spelunker";
            buffTip[9] = "Shows the location of treasure and ore";
            buffName[10] = "Invisibility";
            buffTip[10] = "Grants invisibility";
            buffName[11] = "Shine";
            buffTip[11] = "Emitting light";
            buffName[12] = "Night Owl";
            buffTip[12] = "Increased night vision";
            buffName[13] = "Battle";
            buffTip[13] = "Increased enemy spawn rate";
            buffName[14] = "Thorns";
            buffTip[14] = "Attackers also take damage";
            buffName[15] = "Water Walking";
            buffTip[15] = "Press DOWN to enter water";
            buffName[0x10] = "Archery";
            buffTip[0x10] = "20% increased arrow damage and speed";
            buffName[0x11] = "Hunter";
            buffTip[0x11] = "Shows the location of enemies";
            buffName[0x12] = "Gravitation";
            buffTip[0x12] = "Press UP or DOWN to reverse gravity";
            buffName[0x13] = "Orb of Light";
            buffTip[0x13] = "A magical orb that provides light";
            buffName[20] = "Poisoned";
            buffTip[20] = "Slowly losing life";
            buffName[0x15] = "Potion Sickness";
            buffTip[0x15] = "Cannot consume anymore healing items";
            buffName[0x16] = "Darkness";
            buffTip[0x16] = "Decreased light vision";
            buffName[0x17] = "Cursed";
            buffTip[0x17] = "Cannot use any items";
            buffName[0x18] = "On Fire!";
            buffTip[0x18] = "Slowly losing life";
            buffName[0x19] = "Tipsy";
            buffTip[0x19] = "Increased melee abilities, lowered defense";
            buffName[0x1a] = "Well Fed";
            buffTip[0x1a] = "Minor improvements to all stats";
            buffName[0x1b] = "Fairy";
            buffTip[0x1b] = "A fairy is following you";
            buffName[0x1c] = "Werewolf";
            buffTip[0x1c] = "Physical abilities are increased";
            buffName[0x1d] = "Clairvoyance";
            buffTip[0x1d] = "Magic powers are increased";
            buffName[30] = "Bleeding";
            buffTip[30] = "Cannot regenerate life";
            buffName[0x1f] = "Confused";
            buffTip[0x1f] = "Movement is reversed";
            buffName[0x20] = "Slow";
            buffTip[0x20] = "Movement speed is reduced";
            buffName[0x21] = "Weak";
            buffTip[0x21] = "Physical abilities are decreased";
            buffName[0x22] = "Merfolk";
            buffTip[0x22] = "Can breathe and move easily underwater";
            buffName[0x23] = "Silenced";
            buffTip[0x23] = "Cannot use items that require mana";
            buffName[0x24] = "Broken Armor";
            buffTip[0x24] = "Defense is cut in half";
            buffName[0x25] = "Horrified";
            buffTip[0x25] = "You have seen something nasty, there is no escape.";
            buffName[0x26] = "The Tongue";
            buffTip[0x26] = "You are being sucked into the mouth";
            buffName[0x27] = "Cursed Inferno";
            buffTip[0x27] = "Losing life";
            for (int j = 0; j < 10; j++)
            {
                recentWorld[j] = "";
                recentIP[j] = "";
                recentPort[j] = 0;
            }
            if (rand == null)
            {
                rand = new Random((int)DateTime.Now.Ticks);
            }
            if (WorldGen.genRand == null)
            {
                WorldGen.genRand = new Random((int)DateTime.Now.Ticks);
            }
            switch (rand.Next(15))
            {
                case 0:
                    base.Window.Title = "Terraria: Dig Peon, Dig!";
                    break;

                case 1:
                    base.Window.Title = "Terraria: Epic Dirt";
                    break;

                case 2:
                    base.Window.Title = "Terraria: Hey Guys!";
                    break;

                case 3:
                    base.Window.Title = "Terraria: Sand is Overpowered";
                    break;

                case 4:
                    base.Window.Title = "Terraria Part 3: The Return of the Guide";
                    break;

                case 5:
                    base.Window.Title = "Terraria: A Bunnies Tale";
                    break;

                case 6:
                    base.Window.Title = "Terraria: Dr. Bones and The Temple of Blood Moon";
                    break;

                case 7:
                    base.Window.Title = "Terraria: Slimeassic Park";
                    break;

                case 8:
                    base.Window.Title = "Terraria: The Grass is Greener on This Side";
                    break;

                case 9:
                    base.Window.Title = "Terraria: Small Blocks, Not for Children Under the Age of 5";
                    break;

                case 10:
                    base.Window.Title = "Terraria: Digger T' Blocks";
                    break;

                case 11:
                    base.Window.Title = "Terraria: There is No Cow Layer";
                    break;

                case 12:
                    base.Window.Title = "Terraria: Suspicous Looking Eyeballs";
                    break;

                case 13:
                    base.Window.Title = "Terraria: Purple Grass!";
                    break;

                case 14:
                    base.Window.Title = "Terraria: Noone Dug Behind!";
                    break;

                default:
                    base.Window.Title = "Terraria: Shut Up and Dig Gaiden!";
                    break;
            }
            lo = rand.Next(6);
            //ADDED TILEOPTIONS for flags:  (tiki = 0x56)
            tileHammer[150] = true;
            tileLighted[150] = true;
            tileLavaDeath[150] = true;
            tileFrameImportant[150] = true;
            tileNoAttach[150] = true;
            tileName[150] = "Red Flag";     //CHANGED: ADDED

            tileHammer[151] = true;
            //tileLighted[151] = true;
            tileLavaDeath[151] = true;
            //tileFrameImportant[151] = true;
            tileNoAttach[151] = true;
            tileName[151] = "Blue Flag";     //CHANGED: ADDED

            //ORIG
            tileShine2[6] = true;
            tileShine2[7] = true;
            tileShine2[8] = true;
            tileShine2[9] = true;
            tileShine2[12] = true;
            tileShine2[0x15] = true;
            tileShine2[0x16] = true;
            tileShine2[0x19] = true;
            tileShine2[0x2d] = true;
            tileShine2[0x2e] = true;
            tileShine2[0x2f] = true;
            tileShine2[0x3f] = true;
            tileShine2[0x40] = true;
            tileShine2[0x41] = true;
            tileShine2[0x42] = true;
            tileShine2[0x43] = true;
            tileShine2[0x44] = true;
            tileShine2[0x6b] = true;
            tileShine2[0x6c] = true;
            tileShine2[0x6f] = true;
            tileShine2[0x79] = true;
            tileShine2[0x7a] = true;
            tileShine2[0x75] = true;
            tileShine[0x81] = 300;
            tileHammer[0x8d] = true;
            tileHammer[4] = true;
            tileHammer[10] = true;
            tileHammer[11] = true;
            tileHammer[12] = true;
            tileHammer[13] = true;
            tileHammer[14] = true;
            tileHammer[15] = true;
            tileHammer[0x10] = true;
            tileHammer[0x11] = true;
            tileHammer[0x12] = true;
            tileHammer[0x13] = true;
            tileHammer[0x15] = true;
            tileHammer[0x1a] = true;
            tileHammer[0x1c] = true;
            tileHammer[0x1d] = true;
            tileHammer[0x1f] = true;
            tileHammer[0x21] = true;
            tileHammer[0x22] = true;
            tileHammer[0x23] = true;
            tileHammer[0x24] = true;
            tileHammer[0x2a] = true;
            tileHammer[0x30] = true;
            tileHammer[0x31] = true;
            tileHammer[50] = true;
            tileHammer[0x36] = true;
            tileHammer[0x37] = true;
            tileHammer[0x4d] = true;
            tileHammer[0x4e] = true;
            tileHammer[0x4f] = true;
            tileHammer[0x51] = true;
            tileHammer[0x55] = true;
            tileHammer[0x56] = true;
            tileHammer[0x57] = true;
            tileHammer[0x58] = true;
            tileHammer[0x59] = true;
            tileHammer[90] = true;
            tileHammer[0x5b] = true;
            tileHammer[0x5c] = true;
            tileHammer[0x5d] = true;
            tileHammer[0x5e] = true;
            tileHammer[0x5f] = true;
            tileHammer[0x60] = true;
            tileHammer[0x61] = true;
            tileHammer[0x62] = true;
            tileHammer[0x63] = true;
            tileHammer[100] = true;
            tileHammer[0x65] = true;
            tileHammer[0x66] = true;
            tileHammer[0x67] = true;
            tileHammer[0x68] = true;
            tileHammer[0x69] = true;
            tileHammer[0x6a] = true;
            tileHammer[0x72] = true;
            tileHammer[0x7d] = true;
            tileHammer[0x7e] = true;
            tileHammer[0x80] = true;
            tileHammer[0x81] = true;
            tileHammer[0x84] = true;
            tileHammer[0x85] = true;
            tileHammer[0x86] = true;
            tileHammer[0x87] = true;
            tileHammer[0x88] = true;
            tileFrameImportant[0x8b] = true;
            tileHammer[0x8b] = true;
            tileLighted[0x95] = true;
            tileFrameImportant[0x95] = true;
            tileHammer[0x95] = true;
            tileFrameImportant[0x8e] = true;
            tileHammer[0x8e] = true;
            tileFrameImportant[0x8f] = true;
            tileHammer[0x8f] = true;
            tileFrameImportant[0x90] = true;
            tileHammer[0x90] = true;
            tileStone[0x83] = true;
            tileFrameImportant[0x88] = true;
            tileFrameImportant[0x89] = true;
            tileFrameImportant[0x8a] = true;
            tileBlockLight[0x89] = true;
            tileSolid[0x89] = true;
            tileBlockLight[0x91] = true;
            tileSolid[0x91] = true;
            tileMergeDirt[0x91] = true;
            tileBlockLight[0x92] = true;
            tileSolid[0x92] = true;
            tileMergeDirt[0x92] = true;
            tileBlockLight[0x93] = true;
            tileSolid[0x93] = true;
            tileMergeDirt[0x93] = true;
            tileBlockLight[0x94] = true;
            tileSolid[0x94] = true;
            tileMergeDirt[0x94] = true;
            tileBlockLight[0x8a] = true;
            tileSolid[0x8a] = true;
            tileBlockLight[140] = true;
            tileSolid[140] = true;
            tileAxe[5] = true;
            tileAxe[30] = true;
            tileAxe[0x48] = true;
            tileAxe[80] = true;
            tileAxe[0x7c] = true;
            tileShine[0x16] = 0x47e;
            tileShine[6] = 0x47e;
            tileShine[7] = 0x44c;
            tileShine[8] = 0x3e8;
            tileShine[9] = 0x41a;
            tileShine[12] = 0x3e8;
            tileShine[0x15] = 0x4b0;
            tileShine[0x3f] = 900;
            tileShine[0x40] = 900;
            tileShine[0x41] = 900;
            tileShine[0x42] = 900;
            tileShine[0x43] = 900;
            tileShine[0x44] = 900;
            tileShine[0x2d] = 0x76c;
            tileShine[0x2e] = 0x7d0;
            tileShine[0x2f] = 0x834;
            tileShine[0x7a] = 0x708;
            tileShine[0x79] = 0x73a;
            tileShine[0x7d] = 600;
            tileShine[0x6d] = 0x2328;
            tileShine[110] = 0x2328;
            tileShine[0x74] = 0x2328;
            tileShine[0x75] = 0x2328;
            tileShine[0x76] = 0x1f40;
            tileShine[0x6b] = 950;
            tileShine[0x6c] = 900;
            tileShine[0x6f] = 850;
            tileLighted[4] = true;
            tileLighted[0x11] = true;
            tileLighted[0x85] = true;
            tileLighted[0x1f] = true;
            tileLighted[0x21] = true;
            tileLighted[0x22] = true;
            tileLighted[0x23] = true;
            tileLighted[0x24] = true;
            tileLighted[0x25] = true;
            tileLighted[0x2a] = true;
            tileLighted[0x31] = true;
            tileLighted[0x3a] = true;
            tileLighted[0x3d] = true;
            tileLighted[70] = true;
            tileLighted[0x47] = true;
            tileLighted[0x48] = true;
            tileLighted[0x4c] = true;
            tileLighted[0x4d] = true;
            tileLighted[0x13] = true;
            tileLighted[0x16] = true;
            tileLighted[0x1a] = true;
            tileLighted[0x53] = true;
            tileLighted[0x54] = true;
            tileLighted[0x5c] = true;
            tileLighted[0x5d] = true;
            tileLighted[0x5f] = true;
            tileLighted[0x62] = true;
            tileLighted[100] = true;
            tileLighted[0x6d] = true;
            tileLighted[0x7d] = true;
            tileLighted[0x7e] = true;
            tileLighted[0x81] = true;
            tileLighted[140] = true;
            tileMergeDirt[1] = true;
            tileMergeDirt[6] = true;
            tileMergeDirt[7] = true;
            tileMergeDirt[8] = true;
            tileMergeDirt[9] = true;
            tileMergeDirt[0x16] = true;
            tileMergeDirt[0x19] = true;
            tileMergeDirt[30] = true;
            tileMergeDirt[0x25] = true;
            tileMergeDirt[0x26] = true;
            tileMergeDirt[40] = true;
            tileMergeDirt[0x35] = true;
            tileMergeDirt[0x38] = true;
            tileMergeDirt[0x6b] = true;
            tileMergeDirt[0x6c] = true;
            tileMergeDirt[0x6f] = true;
            tileMergeDirt[0x70] = true;
            tileMergeDirt[0x74] = true;
            tileMergeDirt[0x75] = true;
            tileMergeDirt[0x7b] = true;
            tileMergeDirt[140] = true;
            tileMergeDirt[0x27] = true;
            tileMergeDirt[0x7a] = true;
            tileMergeDirt[0x79] = true;
            tileMergeDirt[120] = true;
            tileMergeDirt[0x77] = true;
            tileMergeDirt[0x76] = true;
            tileMergeDirt[0x2f] = true;
            tileMergeDirt[0x2e] = true;
            tileMergeDirt[0x2d] = true;
            tileMergeDirt[0x2c] = true;
            tileMergeDirt[0x2b] = true;
            tileMergeDirt[0x29] = true;
            tileFrameImportant[3] = true;
            tileFrameImportant[4] = true;
            tileFrameImportant[5] = true;
            tileFrameImportant[10] = true;
            tileFrameImportant[11] = true;
            tileFrameImportant[12] = true;
            tileFrameImportant[13] = true;
            tileFrameImportant[14] = true;
            tileFrameImportant[15] = true;
            tileFrameImportant[0x10] = true;
            tileFrameImportant[0x11] = true;
            tileFrameImportant[0x12] = true;
            tileFrameImportant[20] = true;
            tileFrameImportant[0x15] = true;
            tileFrameImportant[0x18] = true;
            tileFrameImportant[0x1a] = true;
            tileFrameImportant[0x1b] = true;
            tileFrameImportant[0x1c] = true;
            tileFrameImportant[0x1d] = true;
            tileFrameImportant[0x1f] = true;
            tileFrameImportant[0x21] = true;
            tileFrameImportant[0x22] = true;
            tileFrameImportant[0x23] = true;
            tileFrameImportant[0x24] = true;
            tileFrameImportant[0x2a] = true;
            tileFrameImportant[50] = true;
            tileFrameImportant[0x37] = true;
            tileFrameImportant[0x3d] = true;
            tileFrameImportant[0x47] = true;
            tileFrameImportant[0x48] = true;
            tileFrameImportant[0x49] = true;
            tileFrameImportant[0x4a] = true;
            tileFrameImportant[0x4d] = true;
            tileFrameImportant[0x4e] = true;
            tileFrameImportant[0x4f] = true;
            tileFrameImportant[0x51] = true;
            tileFrameImportant[0x52] = true;
            tileFrameImportant[0x53] = true;
            tileFrameImportant[0x54] = true;
            tileFrameImportant[0x55] = true;
            tileFrameImportant[0x56] = true;
            tileFrameImportant[0x57] = true;
            tileFrameImportant[0x58] = true;
            tileFrameImportant[0x59] = true;
            tileFrameImportant[90] = true;
            tileFrameImportant[0x5b] = true;
            tileFrameImportant[0x5c] = true;
            tileFrameImportant[0x5d] = true;
            tileFrameImportant[0x5e] = true;
            tileFrameImportant[0x5f] = true;
            tileFrameImportant[0x60] = true;
            tileFrameImportant[0x61] = true;
            tileFrameImportant[0x62] = true;
            tileFrameImportant[0x63] = true;
            tileFrameImportant[0x65] = true;
            tileFrameImportant[0x66] = true;
            tileFrameImportant[0x67] = true;
            tileFrameImportant[0x68] = true;
            tileFrameImportant[0x69] = true;
            tileFrameImportant[100] = true;
            tileFrameImportant[0x6a] = true;
            tileFrameImportant[110] = true;
            tileFrameImportant[0x71] = true;
            tileFrameImportant[0x72] = true;
            tileFrameImportant[0x7d] = true;
            tileFrameImportant[0x7e] = true;
            tileFrameImportant[0x80] = true;
            tileFrameImportant[0x81] = true;
            tileFrameImportant[0x84] = true;
            tileFrameImportant[0x85] = true;
            tileFrameImportant[0x86] = true;
            tileFrameImportant[0x87] = true;
            tileFrameImportant[0x8d] = true;
            tileCut[3] = true;
            tileCut[0x18] = true;
            tileCut[0x1c] = true;
            tileCut[0x20] = true;
            tileCut[0x33] = true;
            tileCut[0x34] = true;
            tileCut[0x3d] = true;
            tileCut[0x3e] = true;
            tileCut[0x45] = true;
            tileCut[0x47] = true;
            tileCut[0x49] = true;
            tileCut[0x4a] = true;
            tileCut[0x52] = true;
            tileCut[0x53] = true;
            tileCut[0x54] = true;
            tileCut[110] = true;
            tileCut[0x71] = true;
            tileCut[0x73] = true;
            tileAlch[0x52] = true;
            tileAlch[0x53] = true;
            tileAlch[0x54] = true;
            tileLavaDeath[0x68] = true;
            tileLavaDeath[110] = true;
            tileLavaDeath[0x71] = true;
            tileLavaDeath[0x73] = true;
            tileSolid[0x7f] = true;
            tileSolid[130] = true;
            tileBlockLight[130] = true;
            tileBlockLight[0x83] = true;
            tileSolid[0x6b] = true;
            tileBlockLight[0x6b] = true;
            tileSolid[0x6c] = true;
            tileBlockLight[0x6c] = true;
            tileSolid[0x6f] = true;
            tileBlockLight[0x6f] = true;
            tileSolid[0x6d] = true;
            tileBlockLight[0x6d] = true;
            tileSolid[110] = false;
            tileNoAttach[110] = true;
            tileNoFail[110] = true;
            tileSolid[0x70] = true;
            tileBlockLight[0x70] = true;
            tileSolid[0x74] = true;
            tileBlockLight[0x74] = true;
            tileSolid[0x75] = true;
            tileBlockLight[0x75] = true;
            tileSolid[0x7b] = true;
            tileBlockLight[0x7b] = true;
            tileSolid[0x76] = true;
            tileBlockLight[0x76] = true;
            tileSolid[0x77] = true;
            tileBlockLight[0x77] = true;
            tileSolid[120] = true;
            tileBlockLight[120] = true;
            tileSolid[0x79] = true;
            tileBlockLight[0x79] = true;
            tileSolid[0x7a] = true;
            tileBlockLight[0x7a] = true;
            tileBlockLight[0x73] = true;
            tileSolid[0] = true;
            tileBlockLight[0] = true;
            tileSolid[1] = true;
            tileBlockLight[1] = true;
            tileSolid[2] = true;
            tileBlockLight[2] = true;
            tileSolid[3] = false;
            tileNoAttach[3] = true;
            tileNoFail[3] = true;
            tileSolid[4] = false;
            tileNoAttach[4] = true;
            tileNoFail[4] = true;
            tileNoFail[0x18] = true;
            tileSolid[5] = false;
            tileSolid[6] = true;
            tileBlockLight[6] = true;
            tileSolid[7] = true;
            tileBlockLight[7] = true;
            tileSolid[8] = true;
            tileBlockLight[8] = true;
            tileSolid[9] = true;
            tileBlockLight[9] = true;
            tileBlockLight[10] = true;
            tileSolid[10] = true;
            tileNoAttach[10] = true;
            tileBlockLight[10] = true;
            tileSolid[11] = false;
            tileSolidTop[0x13] = true;
            tileSolid[0x13] = true;
            tileSolid[0x16] = true;
            tileSolid[0x17] = true;
            tileSolid[0x19] = true;
            tileSolid[30] = true;
            tileNoFail[0x20] = true;
            tileBlockLight[0x20] = true;
            tileSolid[0x25] = true;
            tileBlockLight[0x25] = true;
            tileSolid[0x26] = true;
            tileBlockLight[0x26] = true;
            tileSolid[0x27] = true;
            tileBlockLight[0x27] = true;
            tileSolid[40] = true;
            tileBlockLight[40] = true;
            tileSolid[0x29] = true;
            tileBlockLight[0x29] = true;
            tileSolid[0x2b] = true;
            tileBlockLight[0x2b] = true;
            tileSolid[0x2c] = true;
            tileBlockLight[0x2c] = true;
            tileSolid[0x2d] = true;
            tileBlockLight[0x2d] = true;
            tileSolid[0x2e] = true;
            tileBlockLight[0x2e] = true;
            tileSolid[0x2f] = true;
            tileBlockLight[0x2f] = true;
            tileSolid[0x30] = true;
            tileBlockLight[0x30] = true;
            tileSolid[0x35] = true;
            tileBlockLight[0x35] = true;
            tileSolid[0x36] = true;
            tileBlockLight[0x34] = true;
            tileSolid[0x38] = true;
            tileBlockLight[0x38] = true;
            tileSolid[0x39] = true;
            tileBlockLight[0x39] = true;
            tileSolid[0x3a] = true;
            tileBlockLight[0x3a] = true;
            tileSolid[0x3b] = true;
            tileBlockLight[0x3b] = true;
            tileSolid[60] = true;
            tileBlockLight[60] = true;
            tileSolid[0x3f] = true;
            tileBlockLight[0x3f] = true;
            tileStone[0x3f] = true;
            tileStone[130] = true;
            tileSolid[0x40] = true;
            tileBlockLight[0x40] = true;
            tileStone[0x40] = true;
            tileSolid[0x41] = true;
            tileBlockLight[0x41] = true;
            tileStone[0x41] = true;
            tileSolid[0x42] = true;
            tileBlockLight[0x42] = true;
            tileStone[0x42] = true;
            tileSolid[0x43] = true;
            tileBlockLight[0x43] = true;
            tileStone[0x43] = true;
            tileSolid[0x44] = true;
            tileBlockLight[0x44] = true;
            tileStone[0x44] = true;
            tileSolid[0x4b] = true;
            tileBlockLight[0x4b] = true;
            tileSolid[0x4c] = true;
            tileBlockLight[0x4c] = true;
            tileSolid[70] = true;
            tileBlockLight[70] = true;
            tileNoFail[50] = true;
            tileNoAttach[50] = true;
            tileDungeon[0x29] = true;
            tileDungeon[0x2b] = true;
            tileDungeon[0x2c] = true;
            tileBlockLight[30] = true;
            tileBlockLight[0x19] = true;
            tileBlockLight[0x17] = true;
            tileBlockLight[0x16] = true;
            tileBlockLight[0x3e] = true;
            tileSolidTop[0x12] = true;
            tileSolidTop[14] = true;
            tileSolidTop[0x10] = true;
            tileSolidTop[0x72] = true;
            tileNoAttach[20] = true;
            tileNoAttach[0x13] = true;
            tileNoAttach[13] = true;
            tileNoAttach[14] = true;
            tileNoAttach[15] = true;
            tileNoAttach[0x10] = true;
            tileNoAttach[0x11] = true;
            tileNoAttach[0x12] = true;
            tileNoAttach[0x13] = true;
            tileNoAttach[0x15] = true;
            tileNoAttach[0x1b] = true;
            tileNoAttach[0x72] = true;
            tileTable[14] = true;
            tileTable[0x12] = true;
            tileTable[0x13] = true;
            tileTable[0x72] = true;
            tileNoAttach[0x56] = true;
            tileNoAttach[0x57] = true;
            tileNoAttach[0x58] = true;
            tileNoAttach[0x59] = true;
            tileNoAttach[90] = true;
            tileLavaDeath[0x56] = true;
            tileLavaDeath[0x57] = true;
            tileLavaDeath[0x58] = true;
            tileLavaDeath[0x59] = true;
            tileLavaDeath[0x7d] = true;
            tileLavaDeath[0x7e] = true;
            tileLavaDeath[0x65] = true;
            tileTable[0x65] = true;
            tileNoAttach[0x65] = true;
            tileLavaDeath[0x66] = true;
            tileNoAttach[0x66] = true;
            tileNoAttach[0x5e] = true;
            tileNoAttach[0x5f] = true;
            tileNoAttach[0x60] = true;
            tileNoAttach[0x61] = true;
            tileNoAttach[0x62] = true;
            tileNoAttach[0x63] = true;
            tileLavaDeath[0x5e] = true;
            tileLavaDeath[0x5f] = true;
            tileLavaDeath[0x60] = true;
            tileLavaDeath[0x61] = true;
            tileLavaDeath[0x62] = true;
            tileLavaDeath[0x63] = true;
            tileLavaDeath[100] = true;
            tileLavaDeath[0x67] = true;
            tileTable[0x57] = true;
            tileTable[0x58] = true;
            tileSolidTop[0x57] = true;
            tileSolidTop[0x58] = true;
            tileSolidTop[0x65] = true;
            tileNoAttach[0x5b] = true;
            tileLavaDeath[0x5b] = true;
            tileNoAttach[0x5c] = true;
            tileLavaDeath[0x5c] = true;
            tileNoAttach[0x5d] = true;
            tileLavaDeath[0x5d] = true;
            tileWaterDeath[4] = true;
            tileWaterDeath[0x33] = true;
            tileWaterDeath[0x5d] = true;
            tileWaterDeath[0x62] = true;
            tileLavaDeath[3] = true;
            tileLavaDeath[5] = true;
            tileLavaDeath[10] = true;
            tileLavaDeath[11] = true;
            tileLavaDeath[12] = true;
            tileLavaDeath[13] = true;
            tileLavaDeath[14] = true;
            tileLavaDeath[15] = true;
            tileLavaDeath[0x10] = true;
            tileLavaDeath[0x11] = true;
            tileLavaDeath[0x12] = true;
            tileLavaDeath[0x13] = true;
            tileLavaDeath[20] = true;
            tileLavaDeath[0x1b] = true;
            tileLavaDeath[0x1c] = true;
            tileLavaDeath[0x1d] = true;
            tileLavaDeath[0x20] = true;
            tileLavaDeath[0x21] = true;
            tileLavaDeath[0x22] = true;
            tileLavaDeath[0x23] = true;
            tileLavaDeath[0x24] = true;
            tileLavaDeath[0x2a] = true;
            tileLavaDeath[0x31] = true;
            tileLavaDeath[50] = true;
            tileLavaDeath[0x34] = true;
            tileLavaDeath[0x37] = true;
            tileLavaDeath[0x3d] = true;
            tileLavaDeath[0x3e] = true;
            tileLavaDeath[0x45] = true;
            tileLavaDeath[0x47] = true;
            tileLavaDeath[0x48] = true;
            tileLavaDeath[0x49] = true;
            tileLavaDeath[0x4a] = true;
            tileLavaDeath[0x4f] = true;
            tileLavaDeath[80] = true;
            tileLavaDeath[0x51] = true;
            tileLavaDeath[0x6a] = true;
            wallHouse[1] = true;
            wallHouse[4] = true;
            wallHouse[5] = true;
            wallHouse[6] = true;
            wallHouse[10] = true;
            wallHouse[11] = true;
            wallHouse[12] = true;
            wallHouse[0x10] = true;
            wallHouse[0x11] = true;
            wallHouse[0x12] = true;
            wallHouse[0x13] = true;
            wallHouse[20] = true;
            wallHouse[0x15] = true;
            wallHouse[0x16] = true;
            wallHouse[0x17] = true;
            wallHouse[0x18] = true;
            wallHouse[0x19] = true;
            wallHouse[0x1a] = true;
            wallHouse[0x1b] = true;
            wallHouse[0x1d] = true;
            wallHouse[30] = true;
            wallHouse[0x1f] = true;
            for (int k = 0; k < 0x20; k++)
            {
                switch (k)
                {
                    case 20:
                        wallBlend[k] = 14;
                        break;

                    case 0x13:
                        wallBlend[k] = 9;
                        break;

                    case 0x12:
                        wallBlend[k] = 8;
                        break;

                    case 0x11:
                        wallBlend[k] = 7;
                        break;

                    case 0x10:
                        wallBlend[k] = 2;
                        break;

                    default:
                        wallBlend[k] = k;
                        break;
                }
            }
            tileNoFail[0x20] = true;
            tileNoFail[0x3d] = true;
            tileNoFail[0x45] = true;
            tileNoFail[0x49] = true;
            tileNoFail[0x4a] = true;
            tileNoFail[0x52] = true;
            tileNoFail[0x53] = true;
            tileNoFail[0x54] = true;
            tileNoFail[110] = true;
            tileNoFail[0x71] = true;
            for (int m = 0; m < maxTileSets; m++)    //CHANGED: orig 150
            {
                tileName[m] = "";
                if (tileSolid[m])
                {
                    tileNoSunLight[m] = true;
                }
            }
            tileNoSunLight[0x13] = false;
            tileNoSunLight[11] = true;
            tileName[13] = "Bottle";
            tileName[14] = "Table";
            tileName[15] = "Chair";
            tileName[0x10] = "Anvil";
            tileName[0x11] = "Furnace";
            tileName[0x12] = "Workbench";
            tileName[0x1a] = "Demon Altar";
            tileName[0x4d] = "Hellforge";
            tileName[0x56] = "Loom";
            tileName[0x5e] = "Keg";
            tileName[0x60] = "Cooking Pot";
            tileName[0x65] = "Bookcase";
            tileName[0x6a] = "Sawmill";
            tileName[0x72] = "Tinkerer's Workshop";
            tileName[0x85] = "Adamantite Forge";
            tileName[0x86] = "Mythril Anvil";

            for (int n = 0; n < maxMenuItems; n++)
            {
                this.menuItemScale[n] = 0.8f;
            }
            for (int num7 = 0; num7 < 0x7d1; num7++)
            {
                dust[num7] = new Dust();
            }
            for (int num8 = 0; num8 < 0xc9; num8++)
            {
                Main.item[num8] = new Item();
            }
            for (int num9 = 0; num9 < 0xc9; num9++)
            {
                npc[num9] = new NPC();
                npc[num9].whoAmI = num9;
            }
            for (int num10 = 0; num10 < 0x100; num10++)
            {
                player[num10] = new Player();
            }
            for (int num11 = 0; num11 < 0x3e9; num11++)
            {
                projectile[num11] = new Projectile();
            }
            for (int num12 = 0; num12 < 0xc9; num12++)
            {
                gore[num12] = new Gore();
            }
            for (int num13 = 0; num13 < 100; num13++)
            {
                cloud[num13] = new Cloud();
            }
            for (int num14 = 0; num14 < 100; num14++)
            {
                combatText[num14] = new CombatText();
            }
            for (int num15 = 0; num15 < 20; num15++)
            {
                itemText[num15] = new ItemText();
            }
            for (int num16 = 0; num16 < maxItemTypes; num16++) //CHANGED, orig 0x25b
            {
                Item item = new Item();
                item.SetDefaults(num16, false);
                itemName[num16] = item.name;
                if (item.headSlot > 0)
                {
                    Item.headType[item.headSlot] = item.type;
                }
                if (item.bodySlot > 0)
                {
                    Item.bodyType[item.bodySlot] = item.type;
                }
                if (item.legSlot > 0)
                {
                    Item.legType[item.legSlot] = item.type;
                }
            }
            for (int num17 = 0; num17 < Recipe.maxRecipes; num17++)
            {
                recipe[num17] = new Recipe();
                availableRecipeY[num17] = 0x41 * num17;
            }
            Recipe.SetupRecipes();
            for (int num18 = 0; num18 < numChatLines; num18++)
            {
                chatLine[num18] = new ChatLine();
            }
            for (int num19 = 0; num19 < Liquid.resLiquid; num19++)
            {
                liquid[num19] = new Liquid();
            }
            for (int num20 = 0; num20 < 0x2710; num20++)
            {
                liquidBuffer[num20] = new LiquidBuffer();
            }
            this.shop[0] = new Chest();
            this.shop[1] = new Chest();
            this.shop[1].SetupShop(1);
            this.shop[2] = new Chest();
            this.shop[2].SetupShop(2);
            this.shop[3] = new Chest();
            this.shop[3].SetupShop(3);
            this.shop[4] = new Chest();
            this.shop[4].SetupShop(4);
            this.shop[5] = new Chest();
            this.shop[5].SetupShop(5);
            this.shop[6] = new Chest();
            this.shop[6].SetupShop(6);
            this.shop[7] = new Chest();
            this.shop[7].SetupShop(7);
            this.shop[8] = new Chest();
            this.shop[8].SetupShop(8);
            this.shop[9] = new Chest();
            this.shop[9].SetupShop(9);
            teamColor[0] = Color.White;
            teamColor[1] = new Color(230, 40, 20);
            teamColor[2] = new Color(20, 200, 30);
            teamColor[3] = new Color(0x4b, 90, 0xff);
            teamColor[4] = new Color(200, 180, 0);
            if (menuMode == 1)
            {
                LoadPlayers();
            }
            Netplay.Init();
            /*if (skipMenu) // CHANGED: wasnt working so made new skipmenu (line 17280)
            {
                WorldGen.clearWorld();
                gameMenu = false;
                LoadPlayers();
                player[myPlayer] = (Player)loadPlayer[0].Clone();
                PlayerPath = loadPlayerPath[0];
                LoadWorlds();
                WorldGen.generateWorld(-1);
                WorldGen.EveryTileFrame();
                player[myPlayer].Spawn();
            }
            else
            {*/
                IntPtr systemMenu = GetSystemMenu(base.Window.Handle, false);
                int menuItemCount = GetMenuItemCount(systemMenu);
                RemoveMenu(systemMenu, menuItemCount - 1, 0x400);
            //}
            if (!dedServ)
            {
                this.graphics.PreferredBackBufferWidth = screenWidth;
                this.graphics.PreferredBackBufferHeight = screenHeight;
                this.graphics.ApplyChanges();
                base.Initialize();
                base.Window.AllowUserResizing = true;
                this.OpenSettings();
                this.OpenRecent();
                Star.SpawnStars();
                foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
                {
                    if (((mode.Width < minScreenW) || (mode.Height < minScreenH)) || ((mode.Width > maxScreenW) || (mode.Height > maxScreenH)))
                    {
                        continue;
                    }
                    bool flag = true;
                    for (int num22 = 0; num22 < this.numDisplayModes; num22++)
                    {
                        if ((mode.Width == this.displayWidth[num22]) && (mode.Height == this.displayHeight[num22]))
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        this.displayHeight[this.numDisplayModes] = mode.Height;
                        this.displayWidth[this.numDisplayModes] = mode.Width;
                        this.numDisplayModes++;
                    }
                }
                if (autoJoin)
                {
                    LoadPlayers();
                    menuMode = 1;
                    menuMultiplayer = true;
                }
                fpsTimer.Start();
                updateTimer.Start();
            }
            if(Mods.ModMain.skipMenu)
            {
                Mods.ModMain.skipMenus();   //CHANGED: Try to skip menus
            }
        }
Пример #19
0
 public virtual bool DrawBehind(Gore gore)
 {
     return false;
 }
Пример #20
0
 //at beginning of Terraria.Gore.Update add
 //  if(this.modGore != null) { Color? modColor = this.modGore.GetAlpha(this, newColor);
 //    if(modColor.HasValue) { return modColor.Value; } }
 public virtual Color? GetAlpha(Gore gore, Color lightColor)
 {
     return null;
 }
Пример #21
0
 protected override void Update(GameTime gameTime)
 {
     if (!dedServ)
     {
         if (fixedTiming)
         {
             if (base.IsActive)
             {
                 base.IsFixedTimeStep = false;
                 this.graphics.SynchronizeWithVerticalRetrace = true;
             }
             else
             {
                 base.IsFixedTimeStep = true;
             }
         }
         else
         {
             base.IsFixedTimeStep = true;
         }
         this.UpdateMusic();
         if (showSplash)
         {
             return;
         }
         if (!gameMenu && (Main.netMode == 1))
         {
             if (!saveTime.IsRunning)
             {
                 saveTime.Start();
             }
             if (saveTime.ElapsedMilliseconds > 0x493e0)
             {
                 saveTime.Reset();
                 WorldGen.saveToonWhilePlaying();
             }
         }
         else if (!gameMenu && autoSave)
         {
             if (!saveTime.IsRunning)
             {
                 saveTime.Start();
             }
             if (saveTime.ElapsedMilliseconds > 0x927c0)
             {
                 saveTime.Reset();
                 WorldGen.saveToonWhilePlaying();
                 WorldGen.saveAndPlay();
             }
         }
         else if (saveTime.IsRunning)
         {
             saveTime.Stop();
         }
         if (teamCooldown > 0)
         {
             teamCooldown--;
         }
         updateTime++;
         if (updateTime >= 60)
         {
             frameRate = drawTime;
             updateTime = 0;
             drawTime = 0;
             if (frameRate == 60)
             {
                 Lighting.lightPasses = 2;
                 Lighting.lightSkip = 2;
                 cloudLimit = 100;
                 Gore.goreTime = 0x4b0;
                 numDust = 0x3e8;
             }
             else if (frameRate >= 0x3a)
             {
                 Lighting.lightPasses = 2;
                 Lighting.lightSkip = 2;
                 cloudLimit = 100;
                 Gore.goreTime = 600;
             }
             else if (frameRate >= 0x2b)
             {
                 Lighting.lightPasses = 2;
                 Lighting.lightSkip = 3;
                 cloudLimit = 0x4b;
                 Gore.goreTime = 300;
                 numDust = 300;
             }
             else if (frameRate >= 0x1c)
             {
                 if (!gameMenu)
                 {
                     Liquid.maxLiquid = 0xbb8;
                     Liquid.cycles = 6;
                 }
                 Lighting.lightPasses = 2;
                 Lighting.lightSkip = 4;
                 cloudLimit = 50;
                 Gore.goreTime = 180;
                 numDust = 100;
             }
             else
             {
                 Lighting.lightPasses = 2;
                 Lighting.lightSkip = 5;
                 cloudLimit = 0;
                 Gore.goreTime = 0;
                 numDust = 0;
             }
             if (Liquid.quickSettle)
             {
                 Liquid.maxLiquid = Liquid.resLiquid;
                 Liquid.cycles = 1;
             }
             else if (frameRate == 60)
             {
                 Liquid.maxLiquid = 0x1388;
                 Liquid.cycles = 7;
             }
             else if (frameRate >= 0x3a)
             {
                 Liquid.maxLiquid = 0x1388;
                 Liquid.cycles = 12;
             }
             else if (frameRate >= 0x2b)
             {
                 Liquid.maxLiquid = 0xfa0;
                 Liquid.cycles = 13;
             }
             else if (frameRate >= 0x1c)
             {
                 Liquid.maxLiquid = 0xdac;
                 Liquid.cycles = 15;
             }
             else
             {
                 Liquid.maxLiquid = 0xbb8;
                 Liquid.cycles = 0x11;
             }
             if (Main.netMode == 2)
             {
                 cloudLimit = 0;
             }
         }
         if (!base.IsActive)
         {
             hasFocus = false;
         }
         else
         {
             hasFocus = true;
         }
         if (!base.IsActive && (Main.netMode == 0))
         {
             base.IsMouseVisible = true;
             if ((Main.netMode != 2) && (myPlayer >= 0))
             {
                 player[myPlayer].delayUseItem = true;
             }
             mouseLeftRelease = false;
             mouseRightRelease = false;
             if (gameMenu)
             {
                 UpdateMenu();
             }
             gamePaused = true;
             return;
         }
         base.IsMouseVisible = false;
         if ((keyState.IsKeyDown(Keys.F10) && !chatMode) && !editSign)
         {
             if (frameRelease)
             {
                 PlaySound(12, -1, -1, 1);
                 if (showFrameRate)
                 {
                     showFrameRate = false;
                 }
                 else
                 {
                     showFrameRate = true;
                 }
             }
             frameRelease = false;
         }
         else
         {
             frameRelease = true;
         }
         if (keyState.IsKeyDown(Keys.F11))
         {
             if (releaseUI)
             {
                 if (hideUI)
                 {
                     hideUI = false;
                 }
                 else
                 {
                     hideUI = true;
                 }
             }
             releaseUI = false;
         }
         else
         {
             releaseUI = true;
         }
         if ((keyState.IsKeyDown(Keys.LeftAlt) || keyState.IsKeyDown(Keys.RightAlt)) && keyState.IsKeyDown(Keys.Enter))
         {
             if (this.toggleFullscreen)
             {
                 this.graphics.ToggleFullScreen();
                 chatRelease = false;
             }
             this.toggleFullscreen = false;
         }
         else
         {
             this.toggleFullscreen = true;
         }
         oldMouseState = mouseState;
         mouseState = Mouse.GetState();
         keyState = Keyboard.GetState();
         if (editSign)
         {
             chatMode = false;
         }
         if (chatMode)
         {
             string chatText = Main.chatText;
             Main.chatText = GetInputText(Main.chatText);
             while (fontMouseText.MeasureString(Main.chatText).X > 470f)
             {
                 Main.chatText = Main.chatText.Substring(0, Main.chatText.Length - 1);
             }
             if (chatText != Main.chatText)
             {
                 PlaySound(12, -1, -1, 1);
             }
             if (inputTextEnter && chatRelease)
             {
                 if (Main.chatText != "")
                 {
                     NetMessage.SendData(0x19, -1, -1, Main.chatText, myPlayer, 0f, 0f, 0f, 0);
                 }
                 Main.chatText = "";
                 chatMode = false;
                 chatRelease = false;
                 PlaySound(11, -1, -1, 1);
             }
         }
         if ((keyState.IsKeyDown(Keys.Enter) /*&& (Main.netMode == 1) //removed for singleplayer chat function*/) && (!keyState.IsKeyDown(Keys.LeftAlt) && !keyState.IsKeyDown(Keys.RightAlt)))
         {
             if ((chatRelease && !chatMode) && !editSign)
             {
                 PlaySound(10, -1, -1, 1);
                 chatMode = true;
                 Main.chatText = "";
             }
             chatRelease = false;
         }
         else
         {
             chatRelease = true;
         }
         if (gameMenu)
         {
             UpdateMenu();
             if (Main.netMode != 2)
             {
                 return;
             }
             gamePaused = false;
         }
     }
     if (Main.netMode == 1)
     {
         for (int i = 0; i < 0x2c; i++)
         {
             if (player[myPlayer].inventory[i].IsNotTheSameAs(clientPlayer.inventory[i]))
             {
                 NetMessage.SendData(5, -1, -1, player[myPlayer].inventory[i].name, myPlayer, (float) i, 0f, 0f, 0);
             }
         }
         if (player[myPlayer].armor[0].IsNotTheSameAs(clientPlayer.armor[0]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[0].name, myPlayer, 44f, 0f, 0f, 0);
         }
         if (player[myPlayer].armor[1].IsNotTheSameAs(clientPlayer.armor[1]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[1].name, myPlayer, 45f, 0f, 0f, 0);
         }
         if (player[myPlayer].armor[2].IsNotTheSameAs(clientPlayer.armor[2]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[2].name, myPlayer, 46f, 0f, 0f, 0);
         }
         if (player[myPlayer].armor[3].IsNotTheSameAs(clientPlayer.armor[3]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[3].name, myPlayer, 47f, 0f, 0f, 0);
         }
         if (player[myPlayer].armor[4].IsNotTheSameAs(clientPlayer.armor[4]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[4].name, myPlayer, 48f, 0f, 0f, 0);
         }
         if (player[myPlayer].armor[5].IsNotTheSameAs(clientPlayer.armor[5]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[5].name, myPlayer, 49f, 0f, 0f, 0);
         }
         if (player[myPlayer].armor[6].IsNotTheSameAs(clientPlayer.armor[6]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[6].name, myPlayer, 50f, 0f, 0f, 0);
         }
         if (player[myPlayer].armor[7].IsNotTheSameAs(clientPlayer.armor[7]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[7].name, myPlayer, 51f, 0f, 0f, 0);
         }
         if (player[myPlayer].armor[8].IsNotTheSameAs(clientPlayer.armor[8]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[8].name, myPlayer, 52f, 0f, 0f, 0);
         }
         if (player[myPlayer].armor[9].IsNotTheSameAs(clientPlayer.armor[9]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[9].name, myPlayer, 53f, 0f, 0f, 0);
         }
         if (player[myPlayer].armor[10].IsNotTheSameAs(clientPlayer.armor[10]))
         {
             NetMessage.SendData(5, -1, -1, player[myPlayer].armor[10].name, myPlayer, 54f, 0f, 0f, 0);
         }
         if (player[myPlayer].chest != clientPlayer.chest)
         {
             NetMessage.SendData(0x21, -1, -1, "", player[myPlayer].chest, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].talkNPC != clientPlayer.talkNPC)
         {
             NetMessage.SendData(40, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].zoneEvil != clientPlayer.zoneEvil)
         {
             NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].zoneMeteor != clientPlayer.zoneMeteor)
         {
             NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].zoneDungeon != clientPlayer.zoneDungeon)
         {
             NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         if (player[myPlayer].zoneJungle != clientPlayer.zoneJungle)
         {
             NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
         bool flag = false;
         for (int j = 0; j < 10; j++)
         {
             if (player[myPlayer].buffType[j] != clientPlayer.buffType[j])
             {
                 flag = true;
             }
         }
         if (flag)
         {
             NetMessage.SendData(50, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
             NetMessage.SendData(13, -1, -1, "", myPlayer, 0f, 0f, 0f, 0);
         }
     }
     if (Main.netMode == 1)
     {
         clientPlayer = (Player) player[myPlayer].clientClone();
     }
     if (((Main.netMode == 0) && ((playerInventory || (npcChatText != "")) || (player[myPlayer].sign >= 0))) && autoPause)
     {
         Keys[] pressedKeys = keyState.GetPressedKeys();
         player[myPlayer].controlInv = false;
         for (int k = 0; k < pressedKeys.Length; k++)
         {
             if ((pressedKeys[k]).ToString() == cInv)
             {
                 player[myPlayer].controlInv = true;
             }
         }
         if (player[myPlayer].controlInv)
         {
             if (player[myPlayer].releaseInventory)
             {
                 player[myPlayer].toggleInv();
             }
             player[myPlayer].releaseInventory = false;
         }
         else
         {
             player[myPlayer].releaseInventory = true;
         }
         if (playerInventory)
         {
             int num4 = (mouseState.ScrollWheelValue - oldMouseState.ScrollWheelValue) / 120;
             focusRecipe += num4;
             if (focusRecipe > (numAvailableRecipes - 1))
             {
                 focusRecipe = numAvailableRecipes - 1;
             }
             if (focusRecipe < 0)
             {
                 focusRecipe = 0;
             }
             player[myPlayer].dropItemCheck();
         }
         player[myPlayer].head = player[myPlayer].armor[0].headSlot;
         player[myPlayer].body = player[myPlayer].armor[1].bodySlot;
         player[myPlayer].legs = player[myPlayer].armor[2].legSlot;
         if (!player[myPlayer].hostile)
         {
             if (player[myPlayer].armor[8].headSlot >= 0)
             {
                 player[myPlayer].head = player[myPlayer].armor[8].headSlot;
             }
             if (player[myPlayer].armor[9].bodySlot >= 0)
             {
                 player[myPlayer].body = player[myPlayer].armor[9].bodySlot;
             }
             if (player[myPlayer].armor[10].legSlot >= 0)
             {
                 player[myPlayer].legs = player[myPlayer].armor[10].legSlot;
             }
         }
         if (editSign)
         {
             if (player[myPlayer].sign == -1)
             {
                 editSign = false;
             }
             else
             {
                 npcChatText = GetInputText(npcChatText);
                 if (inputTextEnter)
                 {
                     byte[] bytes = new byte[] { 10 };
                     npcChatText = npcChatText + Encoding.ASCII.GetString(bytes);
                 }
             }
         }
         gamePaused = true;
     }
     else
     {
         gamePaused = false;
         if ((!dedServ && (screenPosition.Y < ((worldSurface * 16.0) + 16.0))) && ((((0xff - tileColor.R) - 100) > 0) && (Main.netMode != 2)))
         {
             Star.UpdateStars();
             Cloud.UpdateClouds();
         }
         for (int m = 0; m < 0xff; m++)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     player[m].UpdatePlayer(m);
                 }
                 catch
                 {
                 }
             }
             else
             {
                 player[m].UpdatePlayer(m);
             }
         }
         if (Main.netMode != 1)
         {
             NPC.SpawnNPC();
         }
         for (int n = 0; n < 0xff; n++)
         {
             player[n].activeNPCs = 0f;
             player[n].townNPCs = 0f;
         }
         for (int num7 = 0; num7 < 0x3e8; num7++)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     npc[num7].UpdateNPC(num7);
                 }
                 catch (Exception)
                 {
                     npc[num7] = new NPC();
                 }
             }
             else
             {
                 npc[num7].UpdateNPC(num7);
             }
         }
         for (int num8 = 0; num8 < 200; num8++)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     gore[num8].Update();
                 }
                 catch
                 {
                     gore[num8] = new Gore();
                 }
             }
             else
             {
                 gore[num8].Update();
             }
         }
         for (int num9 = 0; num9 < 0x3e8; num9++)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     projectile[num9].Update(num9);
                 }
                 catch
                 {
                     projectile[num9] = new Projectile();
                 }
             }
             else
             {
                 projectile[num9].Update(num9);
             }
         }
         for (int num10 = 0; num10 < 200; num10++)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     item[num10].UpdateItem(num10);
                 }
                 catch
                 {
                     item[num10] = new Item();
                 }
             }
             else
             {
                 item[num10].UpdateItem(num10);
             }
         }
         if (ignoreErrors)
         {
             try
             {
                 Dust.UpdateDust();
             }
             catch
             {
                 for (int num11 = 0; num11 < 0x3e8; num11++)
                 {
                     dust[num11] = new Dust();
                 }
             }
         }
         else
         {
             Dust.UpdateDust();
         }
         if (Main.netMode != 2)
         {
             CombatText.UpdateCombatText();
             ItemText.UpdateItemText();
         }
         if (ignoreErrors)
         {
             try
             {
                 UpdateTime();
             }
             catch
             {
                 checkForSpawns = 0;
             }
         }
         else
         {
             UpdateTime();
         }
         if (Main.netMode != 1)
         {
             if (ignoreErrors)
             {
                 try
                 {
                     WorldGen.UpdateWorld();
                     UpdateInvasion();
                 }
                 catch
                 {
                 }
             }
             else
             {
                 WorldGen.UpdateWorld();
                 UpdateInvasion();
             }
         }
         if (ignoreErrors)
         {
             try
             {
                 if (Main.netMode == 2)
                 {
                     UpdateServer();
                 }
                 if (Main.netMode == 1)
                 {
                     UpdateClient();
                 }
             }
             catch
             {
                 int netMode = Main.netMode;
             }
         }
         else
         {
             if (Main.netMode == 2)
             {
                 UpdateServer();
             }
             if (Main.netMode == 1)
             {
                 UpdateClient();
             }
         }
         if (ignoreErrors)
         {
             try
             {
                 for (int num12 = 0; num12 < numChatLines; num12++)
                 {
                     if (chatLine[num12].showTime > 0)
                     {
                         ChatLine line1 = chatLine[num12];
                         line1.showTime--;
                     }
                 }
             }
             catch
             {
                 for (int num13 = 0; num13 < numChatLines; num13++)
                 {
                     chatLine[num13] = new ChatLine();
                 }
             }
         }
         else
         {
             for (int num14 = 0; num14 < numChatLines; num14++)
             {
                 if (chatLine[num14].showTime > 0)
                 {
                     ChatLine line2 = chatLine[num14];
                     line2.showTime--;
                 }
             }
         }
         base.Update(gameTime);
     }
 }