コード例 #1
0
ファイル: Main.cs プロジェクト: Heloo88/ModTerraria_Heloo
        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
            }
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: Heloo88/ModTerraria_Heloo
 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);
     }
 }
コード例 #3
0
ファイル: Main.cs プロジェクト: Restrictment/TerrariaAPI
 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);
         }
     }
 }
コード例 #4
0
ファイル: Main.cs プロジェクト: Heloo88/ModTerraria_Heloo
        protected void DrawMenu()
        {
            string[] strArray3 = new string[1];
            Vector2 vector9;
            render = false;
            Star.UpdateStars();
            Cloud.UpdateClouds();
            holyTiles = 0;
            evilTiles = 0;
            jungleTiles = 0;
            chatMode = false;
            for (int i = 0; i < numChatLines; i++)
            {
                chatLine[i] = new ChatLine();
            }
            this.DrawFPS();
            screenLastPosition = screenPosition;
            screenPosition.Y = (float)((worldSurface * 16.0) - screenHeight);
            if (grabSky)
            {
                screenPosition.X += (mouseX - (screenWidth / 2)) * 0.02f;
            }
            else
            {
                screenPosition.X += 2f;
            }
            if (screenPosition.X > 2.147484E+09f)
            {
                screenPosition.X = 0f;
            }
            if (screenPosition.X < -2.147484E+09f)
            {
                screenPosition.X = 0f;
            }
            background = 0;
            byte r = (byte)((0xff + (tileColor.R * 2)) / 3);
            Color color = new Color(r, r, r, 0xff);
            this.logoRotation += this.logoRotationSpeed * 3E-05f;
            if (this.logoRotation > 0.1)
            {
                this.logoRotationDirection = -1f;
            }
            else if (this.logoRotation < -0.1)
            {
                this.logoRotationDirection = 1f;
            }
            if ((this.logoRotationSpeed < 20f) & (this.logoRotationDirection == 1f))
            {
                this.logoRotationSpeed++;
            }
            else if ((this.logoRotationSpeed > -20f) & (this.logoRotationDirection == -1f))
            {
                this.logoRotationSpeed--;
            }
            this.logoScale += this.logoScaleSpeed * 1E-05f;
            if (this.logoScale > 1.1)
            {
                this.logoScaleDirection = -1f;
            }
            else if (this.logoScale < 0.9)
            {
                this.logoScaleDirection = 1f;
            }
            if ((this.logoScaleSpeed < 50f) & (this.logoScaleDirection == 1f))
            {
                this.logoScaleSpeed++;
            }
            else if ((this.logoScaleSpeed > -50f) & (this.logoScaleDirection == -1f))
            {
                this.logoScaleSpeed--;
            }
            Color color2 = new Color((int)((byte)(color.R * (((float)LogoA) / 255f))), (int)((byte)(color.G * (((float)LogoA) / 255f))), (int)((byte)(color.B * (((float)LogoA) / 255f))), (int)((byte)(color.A * (((float)LogoA) / 255f))));
            Color color3 = new Color((int)((byte)(color.R * (((float)LogoB) / 255f))), (int)((byte)(color.G * (((float)LogoB) / 255f))), (int)((byte)(color.B * (((float)LogoB) / 255f))), (int)((byte)(color.A * (((float)LogoB) / 255f))));
            LogoT = false;
            if (!LogoT)
            {
                this.spriteBatch.Draw(logoTexture, new Vector2((float)(screenWidth / 2), 100f), new Rectangle(0, 0, logoTexture.Width, logoTexture.Height), color2, this.logoRotation, new Vector2((float)(logoTexture.Width / 2), (float)(logoTexture.Height / 2)), this.logoScale, SpriteEffects.None, 0f);
            }
            else
            {
                this.spriteBatch.Draw(logo3Texture, new Vector2((float)(screenWidth / 2), 100f), new Rectangle(0, 0, logoTexture.Width, logoTexture.Height), color2, this.logoRotation, new Vector2((float)(logoTexture.Width / 2), (float)(logoTexture.Height / 2)), this.logoScale, SpriteEffects.None, 0f);
            }
            this.spriteBatch.Draw(logo2Texture, new Vector2((float)(screenWidth / 2), 100f), new Rectangle(0, 0, logoTexture.Width, logoTexture.Height), color3, this.logoRotation, new Vector2((float)(logoTexture.Width / 2), (float)(logoTexture.Height / 2)), this.logoScale, SpriteEffects.None, 0f);
            if (dayTime)
            {
                LogoA += 2;
                if (LogoA > 0xff)
                {
                    LogoA = 0xff;
                }
                LogoB--;
                if (LogoB < 0)
                {
                    LogoB = 0;
                }
            }
            else
            {
                LogoB += 2;
                if (LogoB > 0xff)
                {
                    LogoB = 0xff;
                }
                LogoA--;
                if (LogoA < 0)
                {
                    LogoA = 0;
                    LogoT = true;
                }
            }
            int num3 = 250;
            int num4 = screenWidth / 2;
            int num5 = 80;
            int num6 = 0;
            int menuMode = Main.menuMode;
            int index = -1;
            int num9 = 0;
            int num10 = 0;
            bool flag = false;
            bool flag2 = false;
            bool flag3 = false;
            int num11 = 0;
            bool[] flagArray = new bool[maxMenuItems];
            bool[] flagArray2 = new bool[maxMenuItems];
            int[] numArray = new int[maxMenuItems];
            int[] numArray2 = new int[maxMenuItems];
            byte[] buffer = new byte[maxMenuItems];
            float[] numArray3 = new float[maxMenuItems];
            bool[] flagArray3 = new bool[maxMenuItems];
            for (int j = 0; j < maxMenuItems; j++)
            {
                flagArray[j] = false;
                flagArray2[j] = false;
                numArray[j] = 0;
                numArray2[j] = 0;
                numArray3[j] = 1f;
            }
            string[] strArray = new string[maxMenuItems];
            if (Main.menuMode == -1)
            {
                Main.menuMode = 0;
            }
            if (netMode == 2)
            {
                bool flag4 = true;
                for (int num13 = 0; num13 < 8; num13++)
                {
                    if (num13 < 0xff)
                    {
                        try
                        {
                            strArray[num13] = Netplay.serverSock[num13].statusText;
                            if (Netplay.serverSock[num13].active && showSpam)
                            {
                                IntPtr ptr = new IntPtr();
                                object obj2 = strArray3[(int)ptr];
                                (strArray3 = strArray)[(int)(ptr = (IntPtr)num13)] = string.Concat(new object[] { obj2, " (", NetMessage.buffer[num13].spamCount, ")" });
                            }
                        }
                        catch
                        {
                            strArray[num13] = "";
                        }
                        flagArray[num13] = true;
                        if ((strArray[num13] != "") && (strArray[num13] != null))
                        {
                            flag4 = false;
                        }
                    }
                }
                if (flag4)
                {
                    strArray[0] = "Start a new instance of Terraria to join!";
                    strArray[1] = "Running on port " + Netplay.serverPort + ".";
                }
                num6 = 11;
                strArray[9] = statusText;
                flagArray[9] = true;
                num3 = 170;
                num5 = 30;
                numArray[10] = 20;
                numArray[10] = 40;
                strArray[10] = "Disconnect";
                if (this.selectedMenu == 10)
                {
                    Netplay.disconnect = true;
                    PlaySound(11, -1, -1, 1);
                }
                goto Label_36F5;
            }
            if (Main.menuMode == 0x1f)
            {
                string password = Netplay.password;
                Netplay.password = GetInputText(Netplay.password);
                if (password != Netplay.password)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Server Requires Password:"******"|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    Netplay.disconnect = true;
                    Netplay.password = "";
                }
                else if ((this.selectedMenu == 2) || inputTextEnter)
                {
                    NetMessage.SendData(0x26, -1, -1, Netplay.password, 0, 0f, 0f, 0f, 0);
                    Main.menuMode = 14;
                }
                goto Label_36F5;
            }
            if ((netMode == 1) || (Main.menuMode == 14))
            {
                num6 = 2;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 300;
                strArray[1] = "Cancel";
                if (this.selectedMenu == 1)
                {
                    Netplay.disconnect = true;
                    Netplay.clientSock.tcpClient.Close();
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    netMode = 0;
                    try
                    {
                        this.tServer.Kill();
                    }
                    catch
                    {
                    }
                }
                goto Label_36F5;
            }
            if (Main.menuMode == 30)
            {
                string str2 = Netplay.password;
                Netplay.password = GetInputText(Netplay.password);
                if (str2 != Netplay.password)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Enter Server Password:"******"|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 6;
                    Netplay.password = "";
                }
                else if (((this.selectedMenu == 2) || inputTextEnter) || autoPass)
                {
                    this.tServer.StartInfo.FileName = "TerrariaServer.exe";
                    this.tServer.StartInfo.Arguments = "-autoshutdown -world \"" + worldPathName + "\" -password \"" + Netplay.password + "\"";
                    if (libPath != "")
                    {
                        ProcessStartInfo startInfo = this.tServer.StartInfo;
                        startInfo.Arguments = startInfo.Arguments + " -loadlib " + libPath;
                    }
                    this.tServer.StartInfo.UseShellExecute = false;
                    this.tServer.StartInfo.CreateNoWindow = true;
                    this.tServer.Start();
                    Netplay.SetIP("127.0.0.1");
                    autoPass = true;
                    statusText = "Starting server...";
                    Netplay.StartClient();
                    Main.menuMode = 10;
                }
                goto Label_36F5;
            }
            if (Main.menuMode == 15)
            {
                num6 = 2;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 80;
                num5 = 400;
                strArray[1] = "Back";
                if (this.selectedMenu == 1)
                {
                    Netplay.disconnect = true;
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    netMode = 0;
                }
                goto Label_36F5;
            }
            if (Main.menuMode == 200)
            {
                num6 = 3;
                strArray[0] = "Load failed!";
                flagArray[0] = true;
                num3 -= 30;
                numArray[1] = 70;
                numArray[2] = 50;
                strArray[1] = "Load Backup";
                strArray[2] = "Cancel";
                if (this.selectedMenu == 1)
                {
                    if (File.Exists(worldPathName + ".bak"))
                    {
                        File.Copy(worldPathName + ".bak", worldPathName, true);
                        File.Delete(worldPathName + ".bak");
                        PlaySound(10, -1, -1, 1);
                        WorldGen.playWorld();
                        Main.menuMode = 10;
                    }
                    else
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 0;
                        netMode = 0;
                    }
                }
                if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    netMode = 0;
                }
                goto Label_36F5;
            }
            if (Main.menuMode == 0xc9)
            {
                num6 = 3;
                strArray[0] = "Load failed!";
                flagArray[0] = true;
                flagArray[1] = true;
                num3 -= 30;
                numArray[1] = -30;
                numArray[2] = 50;
                strArray[1] = "No backup found";
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    netMode = 0;
                }
                goto Label_36F5;
            }
            if (Main.menuMode == 10)
            {
                num6 = 1;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 300;
                goto Label_36F5;
            }
            if (Main.menuMode == 100)
            {
                num6 = 1;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 300;
                goto Label_36F5;
            }
            if (Main.menuMode == 0)
            {
                menuMultiplayer = false;
                menuServer = false;
                netMode = 0;
                strArray[0] = "Single Player";
                strArray[1] = "Multiplayer";
                strArray[2] = "Settings";
                strArray[3] = "Exit";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    this.QuitGame();
                }
                if (this.selectedMenu == 1)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 12;
                }
                if (this.selectedMenu == 2)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 11;
                }
                if (this.selectedMenu == 0)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 1;
                    LoadPlayers();
                }
                goto Label_36F5;
            }
            if (Main.menuMode == 1)
            {
                myPlayer = 0;
                num3 = 190;
                num5 = 50;
                strArray[5] = "Create Character";
                strArray[6] = "Delete";
                if (numLoadPlayers == 5)
                {
                    flagArray2[5] = true;
                    strArray[5] = "";
                }
                else if (numLoadPlayers == 0)
                {
                    flagArray2[6] = true;
                    strArray[6] = "";
                }
                strArray[7] = "Back";
                for (int num14 = 0; num14 < 5; num14++)
                {
                    if (num14 < numLoadPlayers)
                    {
                        strArray[num14] = loadPlayer[num14].name;
                        buffer[num14] = loadPlayer[num14].difficulty;
                    }
                    else
                    {
                        strArray[num14] = null;
                    }
                }
                num6 = 8;
                if ((this.focusMenu >= 0) && (this.focusMenu < numLoadPlayers))
                {
                    index = this.focusMenu;
                    Vector2 vector = fontDeathText.MeasureString(strArray[index]);
                    num9 = (int)(((screenWidth / 2) + (vector.X * 0.5)) + 10.0);
                    num10 = (num3 + (num5 * this.focusMenu)) + 4;
                }
                if (this.selectedMenu == 7)
                {
                    autoJoin = false;
                    autoPass = false;
                    PlaySound(11, -1, -1, 1);
                    if (menuMultiplayer)
                    {
                        Main.menuMode = 12;
                        menuMultiplayer = false;
                        menuServer = false;
                    }
                    else
                    {
                        Main.menuMode = 0;
                    }
                }
                else if (this.selectedMenu == 5)
                {
                    loadPlayer[numLoadPlayers] = new Player();
                    loadPlayer[numLoadPlayers].inventory[0].SetDefaults("Copper Shortsword");
                    loadPlayer[numLoadPlayers].inventory[0].Prefix(-1);
                    loadPlayer[numLoadPlayers].inventory[1].SetDefaults("Copper Pickaxe");
                    loadPlayer[numLoadPlayers].inventory[1].Prefix(-1);
                    loadPlayer[numLoadPlayers].inventory[2].SetDefaults("Copper Axe");
                    loadPlayer[numLoadPlayers].inventory[2].Prefix(-1);
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 2;
                }
                else if (this.selectedMenu == 6)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 4;
                }
                else if (this.selectedMenu >= 0)
                {
                    if (menuMultiplayer)
                    {
                        this.selectedPlayer = this.selectedMenu;
                        player[myPlayer] = (Player)loadPlayer[this.selectedPlayer].Clone();
                        playerPathName = loadPlayerPath[this.selectedPlayer];
                        PlaySound(10, -1, -1, 1);
                        if (autoJoin)
                        {
                            if (Netplay.SetIP(Main.getIP))
                            {
                                Main.menuMode = 10;
                                Netplay.StartClient();
                            }
                            else if (Netplay.SetIP2(Main.getIP))
                            {
                                Main.menuMode = 10;
                                Netplay.StartClient();
                            }
                            autoJoin = false;
                        }
                        else if (menuServer)
                        {
                            LoadWorlds();
                            Main.menuMode = 6;
                        }
                        else
                        {
                            Main.menuMode = 13;
                        }
                    }
                    else
                    {
                        myPlayer = 0;
                        this.selectedPlayer = this.selectedMenu;
                        player[myPlayer] = (Player)loadPlayer[this.selectedPlayer].Clone();
                        playerPathName = loadPlayerPath[this.selectedPlayer];
                        LoadWorlds();
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 6;
                    }
                }
                goto Label_36F5;
            }
            if (Main.menuMode != 2)
            {
                if (Main.menuMode == 0xde)
                {
                    if (this.focusMenu == 3)
                    {
                        strArray[0] = "Hardcore characters die for good";
                    }
                    else if (this.focusMenu == 2)
                    {
                        strArray[0] = "Mediumcore characters drop items on death";
                    }
                    else if (this.focusMenu == 1)
                    {
                        strArray[0] = "Softcore characters drop money on death";
                    }
                    else
                    {
                        strArray[0] = "Select difficulty";
                    }
                    num5 = 50;
                    numArray[1] = 0x19;
                    numArray[2] = 0x19;
                    numArray[3] = 0x19;
                    flagArray[0] = true;
                    strArray[1] = "Softcore";
                    strArray[2] = "Mediumcore";
                    buffer[2] = 1;
                    strArray[3] = "Hardcore";
                    buffer[3] = 2;
                    num6 = 4;
                    if (this.selectedMenu == 1)
                    {
                        loadPlayer[numLoadPlayers].difficulty = 0;
                        Main.menuMode = 2;
                    }
                    else if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 2;
                        loadPlayer[numLoadPlayers].difficulty = 1;
                    }
                    else if (this.selectedMenu == 3)
                    {
                        loadPlayer[numLoadPlayers].difficulty = 2;
                        Main.menuMode = 2;
                    }
                }
                else if (Main.menuMode == 20)
                {
                    if (this.selectedMenu == 0)
                    {
                        Main.menuMode = 0x15;
                        PlaySound(10, -1, -1, 1);
                        this.selColor = loadPlayer[numLoadPlayers].shirtColor;
                    }
                    if (this.selectedMenu == 1)
                    {
                        Main.menuMode = 0x16;
                        PlaySound(10, -1, -1, 1);
                        this.selColor = loadPlayer[numLoadPlayers].underShirtColor;
                    }
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 0x17;
                        PlaySound(10, -1, -1, 1);
                        this.selColor = loadPlayer[numLoadPlayers].pantsColor;
                    }
                    if (this.selectedMenu == 3)
                    {
                        this.selColor = loadPlayer[numLoadPlayers].shoeColor;
                        Main.menuMode = 0x18;
                        PlaySound(10, -1, -1, 1);
                    }
                    strArray[0] = "Shirt";
                    strArray[1] = "Undershirt";
                    strArray[2] = "Pants";
                    strArray[3] = "Shoes";
                    num3 = 260;
                    num5 = 50;
                    numArray[5] = 20;
                    strArray[5] = "Back";
                    num6 = 6;
                    index = numLoadPlayers;
                    num9 = (screenWidth / 2) - 0x10;
                    num10 = 210;
                    if (this.selectedMenu == 5)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 2;
                    }
                }
                else if (Main.menuMode == 0x11)
                {
                    index = numLoadPlayers;
                    num9 = (screenWidth / 2) - 0x10;
                    num10 = 210;
                    flag = true;
                    num11 = 390;
                    num3 = 260;
                    num5 = 60;
                    loadPlayer[index].hairColor = this.selColor;
                    num6 = 3;
                    strArray[0] = "Hair " + (loadPlayer[index].hair + 1);
                    strArray[1] = "Hair Color";
                    flagArray[1] = true;
                    numArray[2] = 150;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 0)
                    {
                        PlaySound(12, -1, -1, 1);
                        Player player1 = loadPlayer[index];
                        player1.hair++;
                        if (loadPlayer[index].hair >= 0x24)
                        {
                            loadPlayer[index].hair = 0;
                        }
                    }
                    else if (this.selectedMenu2 == 0)
                    {
                        PlaySound(12, -1, -1, 1);
                        Player player2 = loadPlayer[index];
                        player2.hair--;
                        if (loadPlayer[index].hair < 0)
                        {
                            loadPlayer[index].hair = 0x23;
                        }
                    }
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 2;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                else if (Main.menuMode == 0x12)
                {
                    index = numLoadPlayers;
                    num9 = (screenWidth / 2) - 0x10;
                    num10 = 210;
                    flag = true;
                    num11 = 370;
                    num3 = 240;
                    num5 = 60;
                    loadPlayer[index].eyeColor = this.selColor;
                    num6 = 3;
                    strArray[0] = "";
                    strArray[1] = "Eye Color";
                    flagArray[1] = true;
                    numArray[2] = 170;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 2;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                else if (Main.menuMode == 0x13)
                {
                    index = numLoadPlayers;
                    num9 = (screenWidth / 2) - 0x10;
                    num10 = 210;
                    flag = true;
                    num11 = 370;
                    num3 = 240;
                    num5 = 60;
                    loadPlayer[index].skinColor = this.selColor;
                    num6 = 3;
                    strArray[0] = "";
                    strArray[1] = "Skin Color";
                    flagArray[1] = true;
                    numArray[2] = 170;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 2;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                else if (Main.menuMode == 0x15)
                {
                    index = numLoadPlayers;
                    num9 = (screenWidth / 2) - 0x10;
                    num10 = 210;
                    flag = true;
                    num11 = 370;
                    num3 = 240;
                    num5 = 60;
                    loadPlayer[index].shirtColor = this.selColor;
                    num6 = 3;
                    strArray[0] = "";
                    strArray[1] = "Shirt Color";
                    flagArray[1] = true;
                    numArray[2] = 170;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 20;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                else if (Main.menuMode == 0x16)
                {
                    index = numLoadPlayers;
                    num9 = (screenWidth / 2) - 0x10;
                    num10 = 210;
                    flag = true;
                    num11 = 370;
                    num3 = 240;
                    num5 = 60;
                    loadPlayer[index].underShirtColor = this.selColor;
                    num6 = 3;
                    strArray[0] = "";
                    strArray[1] = "Undershirt Color";
                    flagArray[1] = true;
                    numArray[2] = 170;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 20;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                else if (Main.menuMode == 0x17)
                {
                    index = numLoadPlayers;
                    num9 = (screenWidth / 2) - 0x10;
                    num10 = 210;
                    flag = true;
                    num11 = 370;
                    num3 = 240;
                    num5 = 60;
                    loadPlayer[index].pantsColor = this.selColor;
                    num6 = 3;
                    strArray[0] = "";
                    strArray[1] = "Pants Color";
                    flagArray[1] = true;
                    numArray[2] = 170;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 20;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                else if (Main.menuMode == 0x18)
                {
                    index = numLoadPlayers;
                    num9 = (screenWidth / 2) - 0x10;
                    num10 = 210;
                    flag = true;
                    num11 = 370;
                    num3 = 240;
                    num5 = 60;
                    loadPlayer[index].shoeColor = this.selColor;
                    num6 = 3;
                    strArray[0] = "";
                    strArray[1] = "Shoe Color";
                    flagArray[1] = true;
                    numArray[2] = 170;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 20;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                else if (Main.menuMode == 3)
                {
                    string name = loadPlayer[numLoadPlayers].name;
                    loadPlayer[numLoadPlayers].name = GetInputText(loadPlayer[numLoadPlayers].name);
                    if (loadPlayer[numLoadPlayers].name.Length > Player.nameLen)
                    {
                        loadPlayer[numLoadPlayers].name = loadPlayer[numLoadPlayers].name.Substring(0, Player.nameLen);
                    }
                    if (name != loadPlayer[numLoadPlayers].name)
                    {
                        PlaySound(12, -1, -1, 1);
                    }
                    strArray[0] = "Enter Character Name:";
                    flagArray2[2] = true;
                    if (loadPlayer[numLoadPlayers].name != "")
                    {
                        if (loadPlayer[numLoadPlayers].name.Substring(0, 1) == " ")
                        {
                            loadPlayer[numLoadPlayers].name = "";
                        }
                        for (int num18 = 0; num18 < loadPlayer[numLoadPlayers].name.Length; num18++)
                        {
                            if (loadPlayer[numLoadPlayers].name.Substring(num18, 1) != " ")
                            {
                                flagArray2[2] = false;
                            }
                        }
                    }
                    this.textBlinkerCount++;
                    if (this.textBlinkerCount >= 20)
                    {
                        if (this.textBlinkerState == 0)
                        {
                            this.textBlinkerState = 1;
                        }
                        else
                        {
                            this.textBlinkerState = 0;
                        }
                        this.textBlinkerCount = 0;
                    }
                    strArray[1] = loadPlayer[numLoadPlayers].name;
                    if (this.textBlinkerState == 1)
                    {
                        (strArray3 = strArray)[1] = strArray3[1] + "|";
                        numArray2[1] = 1;
                    }
                    else
                    {
                        (strArray3 = strArray)[1] = strArray3[1] + " ";
                    }
                    flagArray[0] = true;
                    flagArray[1] = true;
                    numArray[1] = -20;
                    numArray[2] = 20;
                    strArray[2] = "Accept";
                    strArray[3] = "Back";
                    num6 = 4;
                    if (this.selectedMenu == 3)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 2;
                    }
                    if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter))
                    {
                        loadPlayer[numLoadPlayers].name.Trim();
                        loadPlayerPath[numLoadPlayers] = nextLoadPlayer();
                        Player.SavePlayer(loadPlayer[numLoadPlayers], loadPlayerPath[numLoadPlayers]);
                        LoadPlayers();
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 1;
                    }
                }
                else if (Main.menuMode == 4)
                {
                    num3 = 220;
                    num5 = 60;
                    strArray[5] = "Back";
                    for (int num19 = 0; num19 < 5; num19++)
                    {
                        if (num19 < numLoadPlayers)
                        {
                            strArray[num19] = loadPlayer[num19].name;
                            buffer[num19] = loadPlayer[num19].difficulty;
                        }
                        else
                        {
                            strArray[num19] = null;
                        }
                    }
                    num6 = 6;
                    if ((this.focusMenu >= 0) && (this.focusMenu < numLoadPlayers))
                    {
                        index = this.focusMenu;
                        Vector2 vector2 = fontDeathText.MeasureString(strArray[index]);
                        num9 = (int)(((screenWidth / 2) + (vector2.X * 0.5)) + 10.0);
                        num10 = (num3 + (num5 * this.focusMenu)) + 4;
                    }
                    if (this.selectedMenu == 5)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 1;
                    }
                    else if (this.selectedMenu >= 0)
                    {
                        this.selectedPlayer = this.selectedMenu;
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 5;
                    }
                }
                else if (Main.menuMode == 5)
                {
                    strArray[0] = "Delete " + loadPlayer[this.selectedPlayer].name + "?";
                    flagArray[0] = true;
                    strArray[1] = "Yes";
                    strArray[2] = "No";
                    num6 = 3;
                    if (this.selectedMenu == 1)
                    {
                        ErasePlayer(this.selectedPlayer);
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 1;
                    }
                    else if (this.selectedMenu == 2)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 1;
                    }
                }
                else if (Main.menuMode == 6)
                {
                    num3 = 190;
                    num5 = 50;
                    strArray[5] = "Create World";
                    strArray[6] = "Delete";
                    if (numLoadWorlds == 5)
                    {
                        flagArray2[5] = true;
                        strArray[5] = "";
                    }
                    else if (numLoadWorlds == 0)
                    {
                        flagArray2[6] = true;
                        strArray[6] = "";
                    }
                    strArray[7] = "Back";
                    for (int num20 = 0; num20 < 5; num20++)
                    {
                        if (num20 < numLoadWorlds)
                        {
                            strArray[num20] = loadWorld[num20];
                        }
                        else
                        {
                            strArray[num20] = null;
                        }
                    }
                    num6 = 8;
                    if (this.selectedMenu == 7) // pressed BACK
                    {
                        if (menuMultiplayer)
                        {
                            Main.menuMode = 12;
                        }
                        else
                        {
                            Main.menuMode = 1;
                        }
                        PlaySound(11, -1, -1, 1);
                    }
                    else if (this.selectedMenu == 5)    // Create World
                    {
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 0x10;
                        Main.newWorldName = "World " + (numLoadWorlds + 1);
                    }
                    else if (this.selectedMenu == 6)    // Delete World
                    {
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 8;
                    }
                    else if (this.selectedMenu >= 0)
                    {
                        if (menuMultiplayer)
                        {
                            PlaySound(10, -1, -1, 1);
                            worldPathName = loadWorldPath[this.selectedMenu];
                            Main.menuMode = 30;
                        }
                        else
                        {
                            PlaySound(10, -1, -1, 1);
                            worldPathName = loadWorldPath[this.selectedMenu];
                            WorldGen.playWorld();
                            Main.menuMode = 10;
                        }
                    }
                }
                else if (Main.menuMode == 7)
                {
                    string newWorldName = Main.newWorldName;
                    Main.newWorldName = GetInputText(Main.newWorldName);
                    if (Main.newWorldName.Length > 20)
                    {
                        Main.newWorldName = Main.newWorldName.Substring(0, 20);
                    }
                    if (newWorldName != Main.newWorldName)
                    {
                        PlaySound(12, -1, -1, 1);
                    }
                    strArray[0] = "Enter World Name:";
                    flagArray2[2] = true;
                    if (Main.newWorldName != "")
                    {
                        if (Main.newWorldName.Substring(0, 1) == " ")
                        {
                            Main.newWorldName = "";
                        }
                        for (int num21 = 0; num21 < Main.newWorldName.Length; num21++)
                        {
                            if (Main.newWorldName != " ")
                            {
                                flagArray2[2] = false;
                            }
                        }
                    }
                    this.textBlinkerCount++;
                    if (this.textBlinkerCount >= 20)
                    {
                        if (this.textBlinkerState == 0)
                        {
                            this.textBlinkerState = 1;
                        }
                        else
                        {
                            this.textBlinkerState = 0;
                        }
                        this.textBlinkerCount = 0;
                    }
                    strArray[1] = Main.newWorldName;
                    if (this.textBlinkerState == 1)
                    {
                        (strArray3 = strArray)[1] = strArray3[1] + "|";
                        numArray2[1] = 1;
                    }
                    else
                    {
                        (strArray3 = strArray)[1] = strArray3[1] + " ";
                    }
                    flagArray[0] = true;
                    flagArray[1] = true;
                    numArray[1] = -20;
                    numArray[2] = 20;
                    strArray[2] = "Accept";
                    strArray[3] = "Back";
                    num6 = 4;
                    if (this.selectedMenu == 3)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 0x10;
                    }
                    if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter))
                    {
                        Main.menuMode = 10;
                        worldName = Main.newWorldName;
                        worldPathName = nextLoadWorld();
                        WorldGen.CreateNewWorld();
                    }
                }
                else if (Main.menuMode == 8)
                {
                    num3 = 220;
                    num5 = 60;
                    strArray[5] = "Back";
                    for (int num22 = 0; num22 < 5; num22++)
                    {
                        if (num22 < numLoadWorlds)
                        {
                            strArray[num22] = loadWorld[num22];
                        }
                        else
                        {
                            strArray[num22] = null;
                        }
                    }
                    num6 = 6;
                    if (this.selectedMenu == 5)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 1;
                    }
                    else if (this.selectedMenu >= 0)
                    {
                        this.selectedWorld = this.selectedMenu;
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 9;
                    }
                }
                else if (Main.menuMode == 9)
                {
                    strArray[0] = "Delete " + loadWorld[this.selectedWorld] + "?";
                    flagArray[0] = true;
                    strArray[1] = "Yes";
                    strArray[2] = "No";
                    num6 = 3;
                    if (this.selectedMenu == 1)
                    {
                        EraseWorld(this.selectedWorld);
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 6;
                    }
                    else if (this.selectedMenu == 2)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 6;
                    }
                }
                else if (Main.menuMode == 0x457)
                {
                    num3 = 210;
                    num5 = 0x2e;
                    for (int num23 = 0; num23 < 7; num23++)
                    {
                        numArray3[num23] = 0.9f;
                    }
                    numArray[7] = 10;
                    num6 = 8;
                    if (this.graphics.IsFullScreen)
                    {
                        strArray[0] = "Go Windowed";
                    }
                    else
                    {
                        strArray[0] = "Go Fullscreen";
                    }
                    this.bgScroll = (int)Math.Round((double)((1f - caveParrallax) * 500f));
                    strArray[1] = "Resolution";
                    strArray[2] = "Parallax";
                    if (fixedTiming)
                    {
                        strArray[3] = "Frame Skip Off (Not Recommended)";
                    }
                    else
                    {
                        strArray[3] = "Frame Skip On (Recommended)";
                    }
                    if (Lighting.lightMode == 0)
                    {
                        strArray[4] = "Lighting: Color";
                    }
                    else if (Lighting.lightMode == 1)
                    {
                        strArray[4] = "Lighting: White";
                    }
                    else if (Lighting.lightMode == 2)
                    {
                        strArray[4] = "Lighting: Retro";
                    }
                    else if (Lighting.lightMode == 3)
                    {
                        strArray[4] = "Lighting: Trippy";
                    }
                    if (qaStyle == 0)
                    {
                        strArray[5] = "Quality: Auto";
                    }
                    else if (qaStyle == 1)
                    {
                        strArray[5] = "Quality: High";
                    }
                    else if (qaStyle == 2)
                    {
                        strArray[5] = "Quality: Medium";
                    }
                    else
                    {
                        strArray[5] = "Quality: Low";
                    }
                    if (owBack)
                    {
                        strArray[6] = "Background On";
                    }
                    else
                    {
                        strArray[6] = "Background Off";
                    }
                    if (this.selectedMenu == 6)
                    {
                        PlaySound(12, -1, -1, 1);
                        if (owBack)
                        {
                            owBack = false;
                        }
                        else
                        {
                            owBack = true;
                        }
                    }
                    strArray[7] = "Back";
                    if (this.selectedMenu == 7)
                    {
                        PlaySound(11, -1, -1, 1);
                        this.SaveSettings();
                        Main.menuMode = 11;
                    }
                    if (this.selectedMenu == 5)
                    {
                        PlaySound(12, -1, -1, 1);
                        qaStyle++;
                        if (qaStyle > 3)
                        {
                            qaStyle = 0;
                        }
                    }
                    if (this.selectedMenu == 4)
                    {
                        PlaySound(12, -1, -1, 1);
                        Lighting.lightMode++;
                        if (Lighting.lightMode >= 4)
                        {
                            Lighting.lightMode = 0;
                        }
                    }
                    if (this.selectedMenu == 3)
                    {
                        PlaySound(12, -1, -1, 1);
                        if (fixedTiming)
                        {
                            fixedTiming = false;
                        }
                        else
                        {
                            fixedTiming = true;
                        }
                    }
                    if (this.selectedMenu == 2)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 0x1c;
                    }
                    if (this.selectedMenu == 1)
                    {
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 0x6f;
                    }
                    if (this.selectedMenu == 0)
                    {
                        this.graphics.ToggleFullScreen();
                    }
                }
                else if (Main.menuMode == 11)
                {
                    num3 = 180;
                    num5 = 0x30;
                    numArray[7] = 10;
                    num6 = 8;
                    strArray[0] = "Video";
                    strArray[1] = "Cursor Color";
                    strArray[2] = "Volume";
                    strArray[3] = "Controls";
                    if (autoSave)
                    {
                        strArray[4] = "Autosave On";
                    }
                    else
                    {
                        strArray[4] = "Autosave Off";
                    }
                    if (autoPause)
                    {
                        strArray[5] = "Autopause On";
                    }
                    else
                    {
                        strArray[5] = "Autopause Off";
                    }
                    if (showItemText)
                    {
                        strArray[6] = "Pickup Text On";
                    }
                    else
                    {
                        strArray[6] = "Pickup Text Off";
                    }
                    strArray[7] = "Back";
                    if (this.selectedMenu == 7)
                    {
                        PlaySound(11, -1, -1, 1);
                        this.SaveSettings();
                        Main.menuMode = 0;
                    }
                    if (this.selectedMenu == 6)
                    {
                        PlaySound(12, -1, -1, 1);
                        if (showItemText)
                        {
                            showItemText = false;
                        }
                        else
                        {
                            showItemText = true;
                        }
                    }
                    if (this.selectedMenu == 5)
                    {
                        PlaySound(12, -1, -1, 1);
                        if (autoPause)
                        {
                            autoPause = false;
                        }
                        else
                        {
                            autoPause = true;
                        }
                    }
                    if (this.selectedMenu == 4)
                    {
                        PlaySound(12, -1, -1, 1);
                        if (autoSave)
                        {
                            autoSave = false;
                        }
                        else
                        {
                            autoSave = true;
                        }
                    }
                    if (this.selectedMenu == 3)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 0x1b;
                    }
                    if (this.selectedMenu == 2)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 0x1a;
                    }
                    if (this.selectedMenu == 1)
                    {
                        PlaySound(10, -1, -1, 1);
                        this.selColor = mouseColor;
                        Main.menuMode = 0x19;
                    }
                    if (this.selectedMenu == 0)
                    {
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 0x457;
                    }
                }
                else if (Main.menuMode != 0x6f)
                {
                    if (Main.menuMode == 0x19)
                    {
                        flag = true;
                        num11 = 370;
                        num3 = 240;
                        num5 = 60;
                        mouseColor = this.selColor;
                        num6 = 3;
                        strArray[0] = "";
                        strArray[1] = "Cursor Color";
                        flagArray[1] = true;
                        numArray[2] = 170;
                        numArray[1] = 10;
                        strArray[2] = "Back";
                        if (this.selectedMenu == 2)
                        {
                            Main.menuMode = 11;
                            PlaySound(11, -1, -1, 1);
                        }
                    }
                    else if (Main.menuMode == 0x1a)
                    {
                        flag2 = true;
                        num3 = 240;
                        num5 = 60;
                        num6 = 3;
                        strArray[0] = "";
                        strArray[1] = "Volume";
                        flagArray[1] = true;
                        numArray[2] = 170;
                        numArray[1] = 10;
                        strArray[2] = "Back";
                        if (this.selectedMenu == 2)
                        {
                            Main.menuMode = 11;
                            PlaySound(11, -1, -1, 1);
                        }
                    }
                    else if (Main.menuMode == 0x1c)
                    {
                        caveParrallax = 1f - (((float)this.bgScroll) / 500f);
                        flag3 = true;
                        num3 = 240;
                        num5 = 60;
                        num6 = 3;
                        strArray[0] = "";
                        strArray[1] = "Parallax";
                        flagArray[1] = true;
                        numArray[2] = 170;
                        numArray[1] = 10;
                        strArray[2] = "Back";
                        if (this.selectedMenu == 2)
                        {
                            Main.menuMode = 0x457;
                            PlaySound(11, -1, -1, 1);
                        }
                    }
                    else if (Main.menuMode == 0x1b)
                    {
                        num3 = 0xb0;
                        num5 = 0x1c;
                        num6 = 14;
                        string[] strArray2 = new string[] { cUp, cDown, cLeft, cRight, cJump, cThrowItem, cInv, cHeal, cMana, cBuff, cHook, cTorch };
                        if (this.setKey >= 0)
                        {
                            strArray2[this.setKey] = "_";
                        }
                        strArray[0] = "Up             " + strArray2[0];
                        strArray[1] = "Down          " + strArray2[1];
                        strArray[2] = "Left            " + strArray2[2];
                        strArray[3] = "Right          " + strArray2[3];
                        strArray[4] = "Jump          " + strArray2[4];
                        strArray[5] = "Throw         " + strArray2[5];
                        strArray[6] = "Inventory      " + strArray2[6];
                        strArray[7] = "Quick Heal    " + strArray2[7];
                        strArray[8] = "Quick Mana   " + strArray2[8];
                        strArray[9] = "Quick Buff    " + strArray2[9];
                        strArray[10] = "Grapple        " + strArray2[10];
                        strArray[11] = "Auto Select    " + strArray2[11];
                        for (int num26 = 0; num26 < 12; num26++)
                        {
                            flagArray3[num26] = true;
                            numArray3[num26] = 0.55f;
                            numArray2[num26] = -80;
                        }
                        numArray3[12] = 0.8f;
                        numArray3[13] = 0.8f;
                        numArray[12] = 6;
                        strArray[12] = "Reset to Default";
                        numArray[13] = 0x10;
                        strArray[13] = "Back";
                        if (this.selectedMenu == 13)
                        {
                            Main.menuMode = 11;
                            PlaySound(11, -1, -1, 1);
                        }
                        else if (this.selectedMenu == 12)
                        {
                            cUp = "W";
                            cDown = "S";
                            cLeft = "A";
                            cRight = "D";
                            cJump = "Space";
                            cThrowItem = "T";
                            cInv = "Escape";
                            cHeal = "H";
                            cMana = "M";
                            cBuff = "B";
                            cHook = "E";
                            cTorch = "LeftShift";
                            this.setKey = -1;
                            PlaySound(11, -1, -1, 1);
                        }
                        else if (this.selectedMenu >= 0)
                        {
                            this.setKey = this.selectedMenu;
                        }
                        if (this.setKey >= 0)
                        {
                            Keys[] pressedKeys = keyState.GetPressedKeys();
                            if (pressedKeys.Length > 0)
                            {
                                string str5 = pressedKeys[0].ToString();
                                if (str5 != "None")
                                {
                                    if (this.setKey == 0)
                                    {
                                        cUp = str5;
                                    }
                                    if (this.setKey == 1)
                                    {
                                        cDown = str5;
                                    }
                                    if (this.setKey == 2)
                                    {
                                        cLeft = str5;
                                    }
                                    if (this.setKey == 3)
                                    {
                                        cRight = str5;
                                    }
                                    if (this.setKey == 4)
                                    {
                                        cJump = str5;
                                    }
                                    if (this.setKey == 5)
                                    {
                                        cThrowItem = str5;
                                    }
                                    if (this.setKey == 6)
                                    {
                                        cInv = str5;
                                    }
                                    if (this.setKey == 7)
                                    {
                                        cHeal = str5;
                                    }
                                    if (this.setKey == 8)
                                    {
                                        cMana = str5;
                                    }
                                    if (this.setKey == 9)
                                    {
                                        cBuff = str5;
                                    }
                                    if (this.setKey == 10)
                                    {
                                        cHook = str5;
                                    }
                                    if (this.setKey == 11)
                                    {
                                        cTorch = str5;
                                    }
                                    this.setKey = -1;
                                }
                            }
                        }
                    }
                    else if (Main.menuMode == 12)
                    {
                        menuServer = false;
                        strArray[0] = "Join";
                        strArray[1] = "Host & Play";
                        strArray[2] = "Back";
                        if (this.selectedMenu == 0)
                        {
                            LoadPlayers();
                            menuMultiplayer = true;
                            PlaySound(10, -1, -1, 1);
                            Main.menuMode = 1;
                        }
                        else if (this.selectedMenu == 1)
                        {
                            LoadPlayers();
                            PlaySound(10, -1, -1, 1);
                            Main.menuMode = 1;
                            menuMultiplayer = true;
                            menuServer = true;
                        }
                        if (this.selectedMenu == 2)
                        {
                            PlaySound(11, -1, -1, 1);
                            Main.menuMode = 0;
                        }
                        num6 = 3;
                    }
                    else if (Main.menuMode == 13)
                    {
                        string getIP = Main.getIP;
                        Main.getIP = GetInputText(Main.getIP);
                        if (getIP != Main.getIP)
                        {
                            PlaySound(12, -1, -1, 1);
                        }
                        strArray[0] = "Enter Server IP Address:";
                        flagArray2[9] = true;
                        if (Main.getIP != "")
                        {
                            if (Main.getIP.Substring(0, 1) == " ")
                            {
                                Main.getIP = "";
                            }
                            for (int num27 = 0; num27 < Main.getIP.Length; num27++)
                            {
                                if (Main.getIP != " ")
                                {
                                    flagArray2[9] = false;
                                }
                            }
                        }
                        this.textBlinkerCount++;
                        if (this.textBlinkerCount >= 20)
                        {
                            if (this.textBlinkerState == 0)
                            {
                                this.textBlinkerState = 1;
                            }
                            else
                            {
                                this.textBlinkerState = 0;
                            }
                            this.textBlinkerCount = 0;
                        }
                        strArray[1] = Main.getIP;
                        if (this.textBlinkerState == 1)
                        {
                            (strArray3 = strArray)[1] = strArray3[1] + "|";
                            numArray2[1] = 1;
                        }
                        else
                        {
                            (strArray3 = strArray)[1] = strArray3[1] + " ";
                        }
                        flagArray[0] = true;
                        flagArray[1] = true;
                        numArray[9] = 0x2c;
                        numArray[10] = 0x40;
                        strArray[9] = "Accept";
                        strArray[10] = "Back";
                        num6 = 11;
                        num3 = 180;
                        num5 = 30;
                        numArray[1] = 0x13;
                        for (int num28 = 2; num28 < 9; num28++)
                        {
                            int num29 = num28 - 2;
                            if ((recentWorld[num29] != null) && (recentWorld[num29] != ""))
                            {
                                strArray[num28] = string.Concat(new object[] { recentWorld[num29], " (", recentIP[num29], ":", recentPort[num29], ")" });
                            }
                            else
                            {
                                strArray[num28] = "";
                                flagArray[num28] = true;
                            }
                            numArray3[num28] = 0.6f;
                            numArray[num28] = 40;
                        }
                        if ((this.selectedMenu >= 2) && (this.selectedMenu < 9))
                        {
                            autoPass = false;
                            int num30 = this.selectedMenu - 2;
                            Netplay.serverPort = recentPort[num30];
                            Main.getIP = recentIP[num30];
                            if (Netplay.SetIP(Main.getIP))
                            {
                                Main.menuMode = 10;
                                Netplay.StartClient();
                            }
                            else if (Netplay.SetIP2(Main.getIP))
                            {
                                Main.menuMode = 10;
                                Netplay.StartClient();
                            }
                        }
                        if (this.selectedMenu == 10)
                        {
                            PlaySound(11, -1, -1, 1);
                            Main.menuMode = 1;
                        }
                        if ((this.selectedMenu == 9) || (!flagArray2[2] && inputTextEnter))
                        {
                            PlaySound(12, -1, -1, 1);
                            Main.menuMode = 0x83;
                        }
                    }
                    else if (Main.menuMode == 0x83)
                    {
                        int num31 = 0x1e61;
                        string getPort = Main.getPort;
                        Main.getPort = GetInputText(Main.getPort);
                        if (getPort != Main.getPort)
                        {
                            PlaySound(12, -1, -1, 1);
                        }
                        strArray[0] = "Enter Server Port:";
                        flagArray2[2] = true;
                        if (Main.getPort != "")
                        {
                            bool flag5 = false;
                            try
                            {
                                num31 = Convert.ToInt32(Main.getPort);
                                if ((num31 > 0) && (num31 <= 0xffff))
                                {
                                    flag5 = true;
                                }
                            }
                            catch
                            {
                            }
                            if (flag5)
                            {
                                flagArray2[2] = false;
                            }
                        }
                        this.textBlinkerCount++;
                        if (this.textBlinkerCount >= 20)
                        {
                            if (this.textBlinkerState == 0)
                            {
                                this.textBlinkerState = 1;
                            }
                            else
                            {
                                this.textBlinkerState = 0;
                            }
                            this.textBlinkerCount = 0;
                        }
                        strArray[1] = Main.getPort;
                        if (this.textBlinkerState == 1)
                        {
                            (strArray3 = strArray)[1] = strArray3[1] + "|";
                            numArray2[1] = 1;
                        }
                        else
                        {
                            (strArray3 = strArray)[1] = strArray3[1] + " ";
                        }
                        flagArray[0] = true;
                        flagArray[1] = true;
                        numArray[1] = -20;
                        numArray[2] = 20;
                        strArray[2] = "Accept";
                        strArray[3] = "Back";
                        num6 = 4;
                        if (this.selectedMenu == 3)
                        {
                            PlaySound(11, -1, -1, 1);
                            Main.menuMode = 1;
                        }
                        if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter))
                        {
                            Netplay.serverPort = num31;
                            autoPass = false;
                            if (Netplay.SetIP(Main.getIP))
                            {
                                Main.menuMode = 10;
                                Netplay.StartClient();
                            }
                            else if (Netplay.SetIP2(Main.getIP))
                            {
                                Main.menuMode = 10;
                                Netplay.StartClient();
                            }
                        }
                    }
                    else if (Main.menuMode == 0x10)
                    {
                        num3 = 200;
                        num5 = 60;
                        numArray[1] = 30;
                        numArray[2] = 30;
                        numArray[3] = 30;
                        numArray[4] = 30;
                        numArray[5] = 45;
                        strArray[0] = "Choose world size:";
                        flagArray[0] = true;
                        strArray[1] = "Small";
                        strArray[2] = "Medium";
                        strArray[3] = "Large";
                        strArray[4] = "Tiny";
                        strArray[5] = "Back";
                        num6 = 6;
                        if (this.selectedMenu == 5) // CHECK: must be equal to back button
                        {
                            Main.menuMode = 6;
                            PlaySound(11, -1, -1, 1);
                        }
                        else if (this.selectedMenu > 0)
                        {
                            // WORLD SIZES INITIALISING
                            if (this.selectedMenu == 1)
                            {
                                maxTilesX = 0x1068; //4200
                                maxTilesY = 0x4b0;  //1200
                            }
                            else if (this.selectedMenu == 2)
                            {
                                maxTilesX = 0x1900; //6400
                                maxTilesY = 0x708;  //1800
                            }

                            else if (this.selectedMenu == 4)
                            {

                                maxTilesX = Mods.ModGenerateWorld.tinySizeX; //4200
                                maxTilesY = Mods.ModGenerateWorld.tinySizeY;  //1200

                            }
                            else
                            {
                                maxTilesX = 0x20d0;
                                maxTilesY = 0x960;
                            }
                            Main.menuMode = 7;
                            PlaySound(10, -1, -1, 1);
                            WorldGen.setWorldSize();
                        }
                    }
                }
                else
                {
                    num3 = 240;
                    num5 = 60;
                    num6 = 3;
                    strArray[0] = "Fullscreen Resolution";
                    strArray[1] = this.graphics.PreferredBackBufferWidth + "x" + this.graphics.PreferredBackBufferHeight;
                    flagArray[0] = true;
                    numArray[2] = 170;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 1)
                    {
                        PlaySound(12, -1, -1, 1);
                        int num24 = 0;
                        for (int num25 = 0; num25 < this.numDisplayModes; num25++)
                        {
                            if ((this.displayWidth[num25] == this.graphics.PreferredBackBufferWidth) && (this.displayHeight[num25] == this.graphics.PreferredBackBufferHeight))
                            {
                                num24 = num25;
                                break;
                            }
                        }
                        num24++;
                        if (num24 >= this.numDisplayModes)
                        {
                            num24 = 0;
                        }
                        this.graphics.PreferredBackBufferWidth = this.displayWidth[num24];
                        this.graphics.PreferredBackBufferHeight = this.displayHeight[num24];
                    }
                    if (this.selectedMenu == 2)
                    {
                        if (this.graphics.IsFullScreen)
                        {
                            this.graphics.ApplyChanges();
                        }
                        Main.menuMode = 0x457;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                goto Label_36F5;
            }
            if (this.selectedMenu == 0)
            {
                Main.menuMode = 0x11;
                PlaySound(10, -1, -1, 1);
                this.selColor = loadPlayer[numLoadPlayers].hairColor;
            }
            if (this.selectedMenu == 1)
            {
                Main.menuMode = 0x12;
                PlaySound(10, -1, -1, 1);
                this.selColor = loadPlayer[numLoadPlayers].eyeColor;
            }
            if (this.selectedMenu == 2)
            {
                Main.menuMode = 0x13;
                PlaySound(10, -1, -1, 1);
                this.selColor = loadPlayer[numLoadPlayers].skinColor;
            }
            if (this.selectedMenu == 3)
            {
                Main.menuMode = 20;
                PlaySound(10, -1, -1, 1);
            }
            strArray[0] = "Hair";
            strArray[1] = "Eyes";
            strArray[2] = "Skin";
            strArray[3] = "Clothes";
            num3 = 220;
            for (int k = 0; k < 9; k++)
            {
                if (k < 6)
                {
                    numArray3[k] = 0.75f;
                }
                else
                {
                    numArray3[k] = 0.9f;
                }
            }
            num5 = 0x26;
            numArray[6] = 6;
            numArray[7] = 12;
            numArray[8] = 0x12;
            index = numLoadPlayers;
            num9 = (screenWidth / 2) - 0x10;
            num10 = 0xb0;
            if (loadPlayer[index].male)
            {
                strArray[4] = "Male";
            }
            else
            {
                strArray[4] = "Female";
            }
            if (this.selectedMenu == 4)
            {
                if (loadPlayer[index].male)
                {
                    PlaySound(20, -1, -1, 1);
                    loadPlayer[index].male = false;
                }
                else
                {
                    PlaySound(1, -1, -1, 1);
                    loadPlayer[index].male = true;
                }
            }
            if (loadPlayer[index].difficulty == 2)
            {
                strArray[5] = "Hardcore";
                buffer[5] = loadPlayer[index].difficulty;
            }
            else if (loadPlayer[index].difficulty == 1)
            {
                strArray[5] = "Mediumcore";
                buffer[5] = loadPlayer[index].difficulty;
            }
            else
            {
                strArray[5] = "Softcore";
            }
            if (this.selectedMenu == 5)
            {
                PlaySound(10, -1, -1, 1);
                Main.menuMode = 0xde;
            }
            if (this.selectedMenu == 7)
            {
                PlaySound(12, -1, -1, 1);
                loadPlayer[index].hair = rand.Next(0x24);
                loadPlayer[index].eyeColor = this.randColor();
                while (((loadPlayer[index].eyeColor.R + loadPlayer[index].eyeColor.G) + loadPlayer[index].eyeColor.B) > 300)
                {
                    loadPlayer[index].eyeColor = this.randColor();
                }
                loadPlayer[index].hairColor = this.randColor();
                loadPlayer[index].pantsColor = this.randColor();
                loadPlayer[index].shirtColor = this.randColor();
                loadPlayer[index].shoeColor = this.randColor();
                loadPlayer[index].skinColor = this.randColor();
                float num16 = rand.Next(60, 120) * 0.01f;
                if (num16 > 1f)
                {
                    num16 = 1f;
                }
                loadPlayer[index].skinColor.R = (byte)(rand.Next(240, 0xff) * num16);
                loadPlayer[index].skinColor.G = (byte)(rand.Next(110, 140) * num16);
                loadPlayer[index].skinColor.B = (byte)(rand.Next(0x4b, 110) * num16);
                loadPlayer[index].underShirtColor = this.randColor();
                switch ((loadPlayer[index].hair + 1))
                {
                    case 5:
                    case 6:
                    case 7:
                    case 10:
                    case 12:
                    case 0x13:
                    case 0x16:
                    case 0x17:
                    case 0x1a:
                    case 0x1b:
                    case 30:
                    case 0x21:
                        loadPlayer[index].male = false;
                        goto Label_15B1;
                }
                loadPlayer[index].male = true;
            }
            Label_15B1:
            strArray[7] = "Random";
            strArray[6] = "Create";
            strArray[8] = "Back";
            num6 = 9;
            if (this.selectedMenu == 8)
            {
                PlaySound(11, -1, -1, 1);
                Main.menuMode = 1;
            }
            else if (this.selectedMenu == 6)
            {
                PlaySound(10, -1, -1, 1);
                loadPlayer[numLoadPlayers].name = "";
                Main.menuMode = 3;
            }
            Label_36F5:
            if (Main.menuMode != menuMode)
            {
                num6 = 0;
                for (int num32 = 0; num32 < maxMenuItems; num32++)
                {
                    this.menuItemScale[num32] = 0.8f;
                }
            }
            int focusMenu = this.focusMenu;
            this.selectedMenu = -1;
            this.selectedMenu2 = -1;
            this.focusMenu = -1;
            for (int m = 0; m < num6; m++)
            {
                if (strArray[m] != null)
                {
                    if (flag)
                    {
                        string text = "";
                        for (int num35 = 0; num35 < 6; num35++)
                        {
                            int num36 = num11;
                            int num37 = (370 + (screenWidth / 2)) - 400;
                            switch (num35)
                            {
                                case 0:
                                    text = "Red:";
                                    break;

                                case 1:
                                    text = "Green:";
                                    num36 += 30;
                                    break;

                                case 2:
                                    text = "Blue:";
                                    num36 += 60;
                                    break;

                                case 3:
                                    text = this.selColor.R.ToString();
                                    num37 += 90;
                                    break;

                                case 4:
                                    text = this.selColor.G.ToString();
                                    num37 += 90;
                                    num36 += 30;
                                    break;

                                case 5:
                                    text = this.selColor.B.ToString();
                                    num37 += 90;
                                    num36 += 60;
                                    break;
                            }
                            for (int num38 = 0; num38 < 5; num38++)
                            {
                                Color black = Color.Black;
                                if (num38 == 4)
                                {
                                    black = color;
                                    black.R = (byte)((0xff + black.R) / 2);
                                    black.G = (byte)((0xff + black.R) / 2);
                                    black.B = (byte)((0xff + black.R) / 2);
                                }
                                int num39 = 0xff;
                                int num40 = black.R - (0xff - num39);
                                if (num40 < 0)
                                {
                                    num40 = 0;
                                }
                                black = new Color((int)((byte)num40), (int)((byte)num40), (int)((byte)num40), (int)((byte)num39));
                                int num41 = 0;
                                int num42 = 0;
                                switch (num38)
                                {
                                    case 0:
                                        num41 = -2;
                                        break;

                                    case 1:
                                        num41 = 2;
                                        break;

                                    case 2:
                                        num42 = -2;
                                        break;

                                    case 3:
                                        num42 = 2;
                                        break;
                                }
                                vector9 = new Vector2();
                                this.spriteBatch.DrawString(fontDeathText, text, new Vector2((float)(num37 + num41), (float)(num36 + num42)), black, 0f, vector9, (float)0.5f, SpriteEffects.None, 0f);
                            }
                        }
                        bool flag6 = false;
                        for (int num43 = 0; num43 < 2; num43++)
                        {
                            for (int num44 = 0; num44 < 3; num44++)
                            {
                                int num45 = (num11 + (num44 * 30)) - 12;
                                int num46 = (360 + (screenWidth / 2)) - 400;
                                float scale = 0.9f;
                                if (num43 == 0)
                                {
                                    num46 -= 70;
                                    num45 += 2;
                                }
                                else
                                {
                                    num46 -= 40;
                                }
                                text = "-";
                                if (num43 == 1)
                                {
                                    text = "+";
                                }
                                Vector2 vector3 = new Vector2(24f, 24f);
                                int num48 = 0x8e;
                                if (((mouseX > num46) && (mouseX < (num46 + vector3.X))) && ((mouseY > (num45 + 13)) && (mouseY < ((num45 + 13) + vector3.Y))))
                                {
                                    if (this.focusColor != ((num43 + 1) * (num44 + 10)))
                                    {
                                        PlaySound(12, -1, -1, 1);
                                    }
                                    this.focusColor = (num43 + 1) * (num44 + 10);
                                    flag6 = true;
                                    num48 = 0xff;
                                    if (mouseLeft)
                                    {
                                        if (this.colorDelay <= 1)
                                        {
                                            if (this.colorDelay == 0)
                                            {
                                                this.colorDelay = 40;
                                            }
                                            else
                                            {
                                                this.colorDelay = 3;
                                            }
                                            int num49 = num43;
                                            if (num43 == 0)
                                            {
                                                num49 = -1;
                                                if (((this.selColor.R + this.selColor.G) + this.selColor.B) <= 150)
                                                {
                                                    num49 = 0;
                                                }
                                            }
                                            if (((num44 == 0) && ((this.selColor.R + num49) >= 0)) && ((this.selColor.R + num49) <= 0xff))
                                            {
                                                this.selColor.R = (byte)(this.selColor.R + num49);
                                            }
                                            if (((num44 == 1) && ((this.selColor.G + num49) >= 0)) && ((this.selColor.G + num49) <= 0xff))
                                            {
                                                this.selColor.G = (byte)(this.selColor.G + num49);
                                            }
                                            if (((num44 == 2) && ((this.selColor.B + num49) >= 0)) && ((this.selColor.B + num49) <= 0xff))
                                            {
                                                this.selColor.B = (byte)(this.selColor.B + num49);
                                            }
                                        }
                                        this.colorDelay--;
                                    }
                                    else
                                    {
                                        this.colorDelay = 0;
                                    }
                                }
                                for (int num50 = 0; num50 < 5; num50++)
                                {
                                    Color color5 = Color.Black;
                                    if (num50 == 4)
                                    {
                                        color5 = color;
                                        color5.R = (byte)((0xff + color5.R) / 2);
                                        color5.G = (byte)((0xff + color5.R) / 2);
                                        color5.B = (byte)((0xff + color5.R) / 2);
                                    }
                                    int num51 = color5.R - (0xff - num48);
                                    if (num51 < 0)
                                    {
                                        num51 = 0;
                                    }
                                    color5 = new Color((int)((byte)num51), (int)((byte)num51), (int)((byte)num51), (int)((byte)num48));
                                    int num52 = 0;
                                    int num53 = 0;
                                    switch (num50)
                                    {
                                        case 0:
                                            num52 = -2;
                                            break;

                                        case 1:
                                            num52 = 2;
                                            break;

                                        case 2:
                                            num53 = -2;
                                            break;

                                        case 3:
                                            num53 = 2;
                                            break;
                                    }
                                    vector9 = new Vector2();
                                    this.spriteBatch.DrawString(fontDeathText, text, new Vector2((float)(num46 + num52), (float)(num45 + num53)), color5, 0f, vector9, scale, SpriteEffects.None, 0f);
                                }
                            }
                        }
                        if (!flag6)
                        {
                            this.focusColor = 0;
                            this.colorDelay = 0;
                        }
                    }
                    if (flag3)
                    {
                        int num54 = 400;
                        string str9 = "";
                        for (int num55 = 0; num55 < 4; num55++)
                        {
                            int num56 = num54;
                            int num57 = (370 + (screenWidth / 2)) - 400;
                            if (num55 == 0)
                            {
                                str9 = "Parallax: " + this.bgScroll;
                            }
                            for (int num58 = 0; num58 < 5; num58++)
                            {
                                Color color6 = Color.Black;
                                if (num58 == 4)
                                {
                                    color6 = color;
                                    color6.R = (byte)((0xff + color6.R) / 2);
                                    color6.G = (byte)((0xff + color6.R) / 2);
                                    color6.B = (byte)((0xff + color6.R) / 2);
                                }
                                int num59 = 0xff;
                                int num60 = color6.R - (0xff - num59);
                                if (num60 < 0)
                                {
                                    num60 = 0;
                                }
                                color6 = new Color((int)((byte)num60), (int)((byte)num60), (int)((byte)num60), (int)((byte)num59));
                                int num61 = 0;
                                int num62 = 0;
                                switch (num58)
                                {
                                    case 0:
                                        num61 = -2;
                                        break;

                                    case 1:
                                        num61 = 2;
                                        break;

                                    case 2:
                                        num62 = -2;
                                        break;

                                    case 3:
                                        num62 = 2;
                                        break;
                                }
                                vector9 = new Vector2();
                                this.spriteBatch.DrawString(fontDeathText, str9, new Vector2((float)(num57 + num61), (float)(num56 + num62)), color6, 0f, vector9, (float)0.5f, SpriteEffects.None, 0f);
                            }
                        }
                        bool flag7 = false;
                        for (int num63 = 0; num63 < 2; num63++)
                        {
                            for (int num64 = 0; num64 < 1; num64++)
                            {
                                int num65 = (num54 + (num64 * 30)) - 12;
                                int num66 = (360 + (screenWidth / 2)) - 400;
                                float num67 = 0.9f;
                                if (num63 == 0)
                                {
                                    num66 -= 70;
                                    num65 += 2;
                                }
                                else
                                {
                                    num66 -= 40;
                                }
                                str9 = "-";
                                if (num63 == 1)
                                {
                                    str9 = "+";
                                }
                                Vector2 vector4 = new Vector2(24f, 24f);
                                int num68 = 0x8e;
                                if (((mouseX > num66) && (mouseX < (num66 + vector4.X))) && ((mouseY > (num65 + 13)) && (mouseY < ((num65 + 13) + vector4.Y))))
                                {
                                    if (this.focusColor != ((num63 + 1) * (num64 + 10)))
                                    {
                                        PlaySound(12, -1, -1, 1);
                                    }
                                    this.focusColor = (num63 + 1) * (num64 + 10);
                                    flag7 = true;
                                    num68 = 0xff;
                                    if (mouseLeft)
                                    {
                                        if (this.colorDelay <= 1)
                                        {
                                            if (this.colorDelay == 0)
                                            {
                                                this.colorDelay = 40;
                                            }
                                            else
                                            {
                                                this.colorDelay = 3;
                                            }
                                            int num69 = num63;
                                            if (num63 == 0)
                                            {
                                                num69 = -1;
                                            }
                                            if (num64 == 0)
                                            {
                                                this.bgScroll += num69;
                                                if (this.bgScroll > 100)
                                                {
                                                    this.bgScroll = 100;
                                                }
                                                if (this.bgScroll < 0)
                                                {
                                                    this.bgScroll = 0;
                                                }
                                            }
                                        }
                                        this.colorDelay--;
                                    }
                                    else
                                    {
                                        this.colorDelay = 0;
                                    }
                                }
                                for (int num70 = 0; num70 < 5; num70++)
                                {
                                    Color color7 = Color.Black;
                                    if (num70 == 4)
                                    {
                                        color7 = color;
                                        color7.R = (byte)((0xff + color7.R) / 2);
                                        color7.G = (byte)((0xff + color7.R) / 2);
                                        color7.B = (byte)((0xff + color7.R) / 2);
                                    }
                                    int num71 = color7.R - (0xff - num68);
                                    if (num71 < 0)
                                    {
                                        num71 = 0;
                                    }
                                    color7 = new Color((int)((byte)num71), (int)((byte)num71), (int)((byte)num71), (int)((byte)num68));
                                    int num72 = 0;
                                    int num73 = 0;
                                    switch (num70)
                                    {
                                        case 0:
                                            num72 = -2;
                                            break;

                                        case 1:
                                            num72 = 2;
                                            break;

                                        case 2:
                                            num73 = -2;
                                            break;

                                        case 3:
                                            num73 = 2;
                                            break;
                                    }
                                    vector9 = new Vector2();
                                    this.spriteBatch.DrawString(fontDeathText, str9, new Vector2((float)(num66 + num72), (float)(num65 + num73)), color7, 0f, vector9, num67, SpriteEffects.None, 0f);
                                }
                            }
                        }
                        if (!flag7)
                        {
                            this.focusColor = 0;
                            this.colorDelay = 0;
                        }
                    }
                    if (flag2)
                    {
                        int num74 = 400;
                        string str10 = "";
                        for (int num75 = 0; num75 < 4; num75++)
                        {
                            int num76 = num74;
                            int num77 = (370 + (screenWidth / 2)) - 400;
                            switch (num75)
                            {
                                case 0:
                                    str10 = "Sound:";
                                    break;

                                case 1:
                                    str10 = "Music:";
                                    num76 += 30;
                                    break;

                                case 2:
                                    str10 = Math.Round((double)(soundVolume * 100f)) + "%";
                                    num77 += 90;
                                    break;

                                case 3:
                                    str10 = Math.Round((double)(musicVolume * 100f)) + "%";
                                    num77 += 90;
                                    num76 += 30;
                                    break;
                            }
                            for (int num78 = 0; num78 < 5; num78++)
                            {
                                Color color8 = Color.Black;
                                if (num78 == 4)
                                {
                                    color8 = color;
                                    color8.R = (byte)((0xff + color8.R) / 2);
                                    color8.G = (byte)((0xff + color8.R) / 2);
                                    color8.B = (byte)((0xff + color8.R) / 2);
                                }
                                int num79 = 0xff;
                                int num80 = color8.R - (0xff - num79);
                                if (num80 < 0)
                                {
                                    num80 = 0;
                                }
                                color8 = new Color((int)((byte)num80), (int)((byte)num80), (int)((byte)num80), (int)((byte)num79));
                                int num81 = 0;
                                int num82 = 0;
                                switch (num78)
                                {
                                    case 0:
                                        num81 = -2;
                                        break;

                                    case 1:
                                        num81 = 2;
                                        break;

                                    case 2:
                                        num82 = -2;
                                        break;

                                    case 3:
                                        num82 = 2;
                                        break;
                                }
                                vector9 = new Vector2();
                                this.spriteBatch.DrawString(fontDeathText, str10, new Vector2((float)(num77 + num81), (float)(num76 + num82)), color8, 0f, vector9, (float)0.5f, SpriteEffects.None, 0f);
                            }
                        }
                        bool flag8 = false;
                        for (int num83 = 0; num83 < 2; num83++)
                        {
                            for (int num84 = 0; num84 < 2; num84++)
                            {
                                int num90;
                                int num85 = (num74 + (num84 * 30)) - 12;
                                int num86 = (360 + (screenWidth / 2)) - 400;
                                float num87 = 0.9f;
                                if (num83 == 0)
                                {
                                    num86 -= 70;
                                    num85 += 2;
                                }
                                else
                                {
                                    num86 -= 40;
                                }
                                str10 = "-";
                                if (num83 == 1)
                                {
                                    str10 = "+";
                                }
                                Vector2 vector5 = new Vector2(24f, 24f);
                                int num88 = 0x8e;
                                if (((mouseX <= num86) || (mouseX >= (num86 + vector5.X))) || ((mouseY <= (num85 + 13)) || (mouseY >= ((num85 + 13) + vector5.Y))))
                                {
                                    goto Label_4460;
                                }
                                if (this.focusColor != ((num83 + 1) * (num84 + 10)))
                                {
                                    PlaySound(12, -1, -1, 1);
                                }
                                this.focusColor = (num83 + 1) * (num84 + 10);
                                flag8 = true;
                                num88 = 0xff;
                                if (!mouseLeft)
                                {
                                    goto Label_4459;
                                }
                                if (this.colorDelay <= 1)
                                {
                                    if (this.colorDelay == 0)
                                    {
                                        this.colorDelay = 40;
                                    }
                                    else
                                    {
                                        this.colorDelay = 3;
                                    }
                                    int num89 = num83;
                                    if (num83 == 0)
                                    {
                                        num89 = -1;
                                    }
                                    switch (num84)
                                    {
                                        case 0:
                                            soundVolume += num89 * 0.01f;
                                            if (soundVolume > 1f)
                                            {
                                                soundVolume = 1f;
                                            }
                                            if (soundVolume < 0f)
                                            {
                                                soundVolume = 0f;
                                            }
                                            break;

                                        case 1:
                                            musicVolume += num89 * 0.01f;
                                            if (musicVolume > 1f)
                                            {
                                                musicVolume = 1f;
                                            }
                                            if (musicVolume < 0f)
                                            {
                                                musicVolume = 0f;
                                            }
                                            goto Label_4449;
                                    }
                                }
                            Label_4449:
                                this.colorDelay--;
                                goto Label_4460;
                            Label_4459:
                                this.colorDelay = 0;
                            Label_4460:
                                num90 = 0;
                                while (num90 < 5)
                                {
                                    Color color9 = Color.Black;
                                    if (num90 == 4)
                                    {
                                        color9 = color;
                                        color9.R = (byte)((0xff + color9.R) / 2);
                                        color9.G = (byte)((0xff + color9.R) / 2);
                                        color9.B = (byte)((0xff + color9.R) / 2);
                                    }
                                    int num91 = color9.R - (0xff - num88);
                                    if (num91 < 0)
                                    {
                                        num91 = 0;
                                    }
                                    color9 = new Color((int)((byte)num91), (int)((byte)num91), (int)((byte)num91), (int)((byte)num88));
                                    int num92 = 0;
                                    int num93 = 0;
                                    switch (num90)
                                    {
                                        case 0:
                                            num92 = -2;
                                            break;

                                        case 1:
                                            num92 = 2;
                                            break;

                                        case 2:
                                            num93 = -2;
                                            break;

                                        case 3:
                                            num93 = 2;
                                            break;
                                    }
                                    vector9 = new Vector2();
                                    this.spriteBatch.DrawString(fontDeathText, str10, new Vector2((float)(num86 + num92), (float)(num85 + num93)), color9, 0f, vector9, num87, SpriteEffects.None, 0f);
                                    num90++;
                                }
                            }
                        }
                        if (!flag8)
                        {
                            this.focusColor = 0;
                            this.colorDelay = 0;
                        }
                    }
                    for (int num94 = 0; num94 < 5; num94++)
                    {
                        Color hcColor = Color.Black;
                        if (num94 == 4)
                        {
                            hcColor = color;
                            if (buffer[m] == 2)
                            {
                                hcColor = Main.hcColor;
                            }
                            else if (buffer[m] == 1)
                            {
                                hcColor = mcColor;
                            }
                            hcColor.R = (byte)((0xff + hcColor.R) / 2);
                            hcColor.G = (byte)((0xff + hcColor.G) / 2);
                            hcColor.B = (byte)((0xff + hcColor.B) / 2);
                        }
                        int num95 = (int)(255f * ((this.menuItemScale[m] * 2f) - 1f));
                        if (flagArray[m])
                        {
                            num95 = 0xff;
                        }
                        int num96 = hcColor.R - (0xff - num95);
                        if (num96 < 0)
                        {
                            num96 = 0;
                        }
                        int num97 = hcColor.G - (0xff - num95);
                        if (num97 < 0)
                        {
                            num97 = 0;
                        }
                        int num98 = hcColor.B - (0xff - num95);
                        if (num98 < 0)
                        {
                            num98 = 0;
                        }
                        hcColor = new Color((int)((byte)num96), (int)((byte)num97), (int)((byte)num98), (int)((byte)num95));
                        int num99 = 0;
                        int num100 = 0;
                        switch (num94)
                        {
                            case 0:
                                num99 = -2;
                                break;

                            case 1:
                                num99 = 2;
                                break;

                            case 2:
                                num100 = -2;
                                break;

                            case 3:
                                num100 = 2;
                                break;
                        }
                        Vector2 origin = fontDeathText.MeasureString(strArray[m]);
                        origin.X *= 0.5f;
                        origin.Y *= 0.5f;
                        float num101 = this.menuItemScale[m];
                        if ((Main.menuMode == 15) && (m == 0))
                        {
                            num101 *= 0.35f;
                        }
                        else if (netMode == 2)
                        {
                            num101 *= 0.5f;
                        }
                        num101 *= numArray3[m];
                        if (!flagArray3[m])
                        {
                            this.spriteBatch.DrawString(fontDeathText, strArray[m], new Vector2((float)((num4 + num99) + numArray2[m]), (((num3 + (num5 * m)) + num100) + (origin.Y * numArray3[m])) + numArray[m]), hcColor, 0f, origin, num101, SpriteEffects.None, 0f);
                        }
                        else
                        {
                            this.spriteBatch.DrawString(fontDeathText, strArray[m], new Vector2((float)((num4 + num99) + numArray2[m]), (((num3 + (num5 * m)) + num100) + (origin.Y * numArray3[m])) + numArray[m]), hcColor, 0f, new Vector2(0f, origin.Y), num101, SpriteEffects.None, 0f);
                        }
                    }
                    if (!flagArray3[m])
                    {
                        if ((((mouseX > ((num4 - ((strArray[m].Length * 10) * numArray3[m])) + numArray2[m])) && (mouseX < ((num4 + ((strArray[m].Length * 10) * numArray3[m])) + numArray2[m]))) && ((mouseY > ((num3 + (num5 * m)) + numArray[m])) && (mouseY < (((num3 + (num5 * m)) + numArray[m]) + (50f * numArray3[m]))))) && hasFocus)
                        {
                            this.focusMenu = m;
                            if (flagArray[m] || flagArray2[m])
                            {
                                this.focusMenu = -1;
                            }
                            else
                            {
                                if (focusMenu != this.focusMenu)
                                {
                                    PlaySound(12, -1, -1, 1);
                                }
                                if (mouseLeftRelease && mouseLeft)
                                {
                                    this.selectedMenu = m;
                                }
                                if (mouseRightRelease && mouseRight)
                                {
                                    this.selectedMenu2 = m;
                                }
                            }
                        }
                    }
                    else if ((((mouseX > (num4 + numArray2[m])) && (mouseX < ((num4 + ((strArray[m].Length * 20) * numArray3[m])) + numArray2[m]))) && ((mouseY > ((num3 + (num5 * m)) + numArray[m])) && (mouseY < (((num3 + (num5 * m)) + numArray[m]) + (50f * numArray3[m]))))) && hasFocus)
                    {
                        this.focusMenu = m;
                        if (flagArray[m] || flagArray2[m])
                        {
                            this.focusMenu = -1;
                        }
                        else
                        {
                            if (focusMenu != this.focusMenu)
                            {
                                PlaySound(12, -1, -1, 1);
                            }
                            if (mouseLeftRelease && mouseLeft)
                            {
                                this.selectedMenu = m;
                            }
                            if (mouseRightRelease && mouseRight)
                            {
                                this.selectedMenu2 = m;
                            }
                        }
                    }
                }
            }
            for (int n = 0; n < maxMenuItems; n++)
            {
                if (n == this.focusMenu)
                {
                    if (this.menuItemScale[n] < 1f)
                    {
                        this.menuItemScale[n] += 0.02f;
                    }
                    if (this.menuItemScale[n] > 1f)
                    {
                        this.menuItemScale[n] = 1f;
                    }
                }
                else if (this.menuItemScale[n] > 0.8)
                {
                    this.menuItemScale[n] -= 0.02f;
                }
            }
            if (index >= 0)
            {
                loadPlayer[index].PlayerFrame();
                loadPlayer[index].position.X = num9 + screenPosition.X;
                loadPlayer[index].position.Y = num10 + screenPosition.Y;
                this.DrawPlayer(loadPlayer[index]);
            }
            for (int num103 = 0; num103 < 5; num103++)
            {
                Color color11 = Color.Black;
                if (num103 == 4)
                {
                    color11 = color;
                    color11.R = (byte)((0xff + color11.R) / 2);
                    color11.G = (byte)((0xff + color11.R) / 2);
                    color11.B = (byte)((0xff + color11.R) / 2);
                }
                color11.A = (byte)(color11.A * 0.3f);
                int num104 = 0;
                int num105 = 0;
                switch (num103)
                {
                    case 0:
                        num104 = -2;
                        break;

                    case 1:
                        num104 = 2;
                        break;

                    case 2:
                        num105 = -2;
                        break;

                    case 3:
                        num105 = 2;
                        break;
                }
                string str11 = "Copyright \x00a9 2011 Re-Logic";
                Vector2 vector7 = fontMouseText.MeasureString(str11);
                vector7.X *= 0.5f;
                vector7.Y *= 0.5f;
                this.spriteBatch.DrawString(fontMouseText, str11, new Vector2(((screenWidth - vector7.X) + num104) - 10f, ((screenHeight - vector7.Y) + num105) - 2f), color11, 0f, vector7, (float)1f, SpriteEffects.None, 0f);
            }
            for (int num106 = 0; num106 < 5; num106++)
            {
                Color color12 = Color.Black;
                if (num106 == 4)
                {
                    color12 = color;
                    color12.R = (byte)((0xff + color12.R) / 2);
                    color12.G = (byte)((0xff + color12.R) / 2);
                    color12.B = (byte)((0xff + color12.R) / 2);
                }
                color12.A = (byte)(color12.A * 0.3f);
                int num107 = 0;
                int num108 = 0;
                switch (num106)
                {
                    case 0:
                        num107 = -2;
                        break;

                    case 1:
                        num107 = 2;
                        break;

                    case 2:
                        num108 = -2;
                        break;

                    case 3:
                        num108 = 2;
                        break;
                }
                Vector2 vector8 = fontMouseText.MeasureString(versionNumber);
                vector8.X *= 0.5f;
                vector8.Y *= 0.5f;
                this.spriteBatch.DrawString(fontMouseText, versionNumber, new Vector2((vector8.X + num107) + 10f, ((screenHeight - vector8.Y) + num108) - 2f), color12, 0f, vector8, (float)1f, SpriteEffects.None, 0f);
            }
            vector9 = new Vector2();
            this.spriteBatch.Draw(cursorTexture, new Vector2((float)(mouseX + 1), (float)(mouseY + 1)), new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height), new Color((int)(cursorColor.R * 0.2f), (int)(cursorColor.G * 0.2f), (int)(cursorColor.B * 0.2f), (int)(cursorColor.A * 0.5f)), 0f, vector9, (float)(cursorScale * 1.1f), SpriteEffects.None, 0f);
            this.spriteBatch.Draw(cursorTexture, new Vector2((float)mouseX, (float)mouseY), new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height), cursorColor, 0f, new Vector2(), cursorScale, SpriteEffects.None, 0f);
            if (fadeCounter > 0)
            {
                Color white = Color.White;
                byte num109 = 0;
                fadeCounter--;
                float num110 = (((float)fadeCounter) / 75f) * 255f;
                num109 = (byte)num110;
                white = new Color((int)num109, (int)num109, (int)num109, (int)num109);
                this.spriteBatch.Draw(fadeTexture, new Rectangle(0, 0, screenWidth, screenHeight), white);
            }
            this.spriteBatch.End();
            if (mouseLeft)
            {
                mouseLeftRelease = false;
            }
            else
            {
                mouseLeftRelease = true;
            }
            if (mouseRight)
            {
                mouseRightRelease = false;
            }
            else
            {
                mouseRightRelease = true;
            }
        }
コード例 #5
0
ファイル: Main.cs プロジェクト: Restrictment/TerrariaAPI
        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();
        }
コード例 #6
0
ファイル: Main.cs プロジェクト: Restrictment/TerrariaAPI
        protected void DrawMenu()
        {
            string[] strArray3;
            Vector2 vector9;
            evilTiles = 0;
            chatMode = false;
            for (int i = 0; i < numChatLines; i++)
            {
                chatLine[i] = new ChatLine();
            }
            this.DrawFPS();
            screenPosition.Y = (float) ((worldSurface * 16.0) - screenHeight);
            background = 0;
            byte r = (byte) ((0xff + (tileColor.R * 2)) / 3);
            Color color = new Color(r, r, r, 0xff);
            this.logoRotation += this.logoRotationSpeed * 3E-05f;
            if (this.logoRotation > 0.1)
            {
                this.logoRotationDirection = -1f;
            }
            else if (this.logoRotation < -0.1)
            {
                this.logoRotationDirection = 1f;
            }
            if ((this.logoRotationSpeed < 20f) & (this.logoRotationDirection == 1f))
            {
                this.logoRotationSpeed++;
            }
            else if ((this.logoRotationSpeed > -20f) & (this.logoRotationDirection == -1f))
            {
                this.logoRotationSpeed--;
            }
            this.logoScale += this.logoScaleSpeed * 1E-05f;
            if (this.logoScale > 1.1)
            {
                this.logoScaleDirection = -1f;
            }
            else if (this.logoScale < 0.9)
            {
                this.logoScaleDirection = 1f;
            }
            if ((this.logoScaleSpeed < 50f) & (this.logoScaleDirection == 1f))
            {
                this.logoScaleSpeed++;
            }
            else if ((this.logoScaleSpeed > -50f) & (this.logoScaleDirection == -1f))
            {
                this.logoScaleSpeed--;
            }
            this.spriteBatch.Draw(logoTexture, new Vector2((float) (screenWidth / 2), 100f), new Rectangle(0, 0, logoTexture.Width, logoTexture.Height), color, this.logoRotation, new Vector2((float) (logoTexture.Width / 2), (float) (logoTexture.Height / 2)), this.logoScale, SpriteEffects.None, 0f);
            int num3 = 250;
            int num4 = screenWidth / 2;
            int num5 = 80;
            int num6 = 0;
            int menuMode = Main.menuMode;
            int index = -1;
            int num9 = 0;
            int num10 = 0;
            bool flag = false;
            bool flag2 = false;
            bool flag3 = false;
            int num11 = 0;
            bool[] flagArray = new bool[maxMenuItems];
            bool[] flagArray2 = new bool[maxMenuItems];
            int[] numArray = new int[maxMenuItems];
            int[] numArray2 = new int[maxMenuItems];
            for (int j = 0; j < maxMenuItems; j++)
            {
                flagArray[j] = false;
                flagArray2[j] = false;
                numArray[j] = 0;
                numArray2[j] = 0;
            }
            string[] strArray = new string[maxMenuItems];
            if (Main.menuMode == -1)
            {
                Main.menuMode = 0;
            }
            if (netMode == 2)
            {
                bool flag4 = true;
                for (int num13 = 0; num13 < 8; num13++)
                {
                    if (num13 < 8)
                    {
                        try
                        {
                            strArray[num13] = Netplay.serverSock[num13].statusText;
                            if (Netplay.serverSock[num13].active && showSpam)
                            {
                                IntPtr ptr = new IntPtr();
                                strArray3 = new string[(int)ptr + 1];
                                object obj2 = strArray3[(int) ptr];
                                (strArray3 = strArray)[(int) (ptr = (IntPtr) num13)] = string.Concat(new object[] { obj2, " (", NetMessage.buffer[num13].spamCount, ")" });
                            }
                        }
                        catch
                        {
                            strArray[num13] = "";
                        }
                        flagArray[num13] = true;
                        if ((strArray[num13] != "") && (strArray[num13] != null))
                        {
                            flag4 = false;
                        }
                    }
                }
                if (flag4)
                {
                    strArray[0] = "Start a new instance of Terraria to join!";
                    strArray[1] = "Running on port 7777.";
                }
                num6 = 11;
                strArray[9] = statusText;
                flagArray[9] = true;
                num3 = 170;
                num5 = 30;
                numArray[10] = 20;
                numArray[10] = 40;
                strArray[10] = "Disconnect";
                if (this.selectedMenu == 10)
                {
                    Netplay.disconnect = true;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x1f)
            {
                string password = Netplay.password;
                Netplay.password = GetInputText(Netplay.password);
                if (password != Netplay.password)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Server Requires Password:"******"|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    Netplay.disconnect = true;
                    Netplay.password = "";
                }
                else if ((this.selectedMenu == 2) || inputTextEnter)
                {
                    NetMessage.SendData(0x26, -1, -1, Netplay.password, 0, 0f, 0f, 0f);
                    Main.menuMode = 14;
                }
            }
            else if ((netMode == 1) || (Main.menuMode == 14))
            {
                num6 = 2;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 300;
                strArray[1] = "Cancel";
                if (this.selectedMenu == 1)
                {
                    Netplay.disconnect = true;
                    Netplay.clientSock.tcpClient.Close();
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    netMode = 0;
                }
            }
            else if (Main.menuMode == 30)
            {
                string str2 = Netplay.password;
                Netplay.password = GetInputText(Netplay.password);
                if (str2 != Netplay.password)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Enter Server Password:"******"|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 6;
                    Netplay.password = "";
                }
                else if ((this.selectedMenu == 2) || inputTextEnter)
                {
                    WorldGen.serverLoadWorld();
                    Main.menuMode = 10;
                }
            }
            else if (Main.menuMode == 15)
            {
                num6 = 2;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 80;
                num5 = 400;
                strArray[1] = "Back";
                if (this.selectedMenu == 1)
                {
                    Netplay.disconnect = true;
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    netMode = 0;
                }
            }
            else if (Main.menuMode == 10)
            {
                num6 = 1;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 300;
            }
            else if (Main.menuMode == 0)
            {
                menuMultiplayer = false;
                netMode = 0;
                strArray[0] = "Single Player";
                strArray[1] = "Multiplayer";
                strArray[2] = "Settings";
                strArray[3] = "Exit";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    this.QuitGame();
                }
                if (this.selectedMenu == 1)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 12;
                }
                if (this.selectedMenu == 2)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 11;
                }
                if (this.selectedMenu == 0)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 1;
                    LoadPlayers();
                }
            }
            else if (Main.menuMode == 1)
            {
                myPlayer = 0;
                num3 = 190;
                num5 = 50;
                strArray[5] = "Create Character";
                strArray[6] = "Delete";
                if (numLoadPlayers == 5)
                {
                    flagArray2[5] = true;
                    strArray[5] = "";
                }
                else if (numLoadPlayers == 0)
                {
                    flagArray2[6] = true;
                    strArray[6] = "";
                }
                strArray[7] = "Back";
                for (int num14 = 0; num14 < 5; num14++)
                {
                    if (num14 < numLoadPlayers)
                    {
                        strArray[num14] = loadPlayer[num14].name;
                    }
                    else
                    {
                        strArray[num14] = null;
                    }
                }
                num6 = 8;
                if ((this.focusMenu >= 0) && (this.focusMenu < numLoadPlayers))
                {
                    index = this.focusMenu;
                    Vector2 vector = fontDeathText.MeasureString(strArray[index]);
                    num9 = (int) (((screenWidth / 2) + (vector.X * 0.5)) + 10.0);
                    num10 = (num3 + (num5 * this.focusMenu)) + 4;
                }
                if (this.selectedMenu == 7)
                {
                    PlaySound(11, -1, -1, 1);
                    if (menuMultiplayer)
                    {
                        Main.menuMode = 12;
                    }
                    else
                    {
                        Main.menuMode = 0;
                    }
                    menuMultiplayer = false;
                }
                else if (this.selectedMenu == 5)
                {
                    loadPlayer[numLoadPlayers] = new Player();
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 2;
                }
                else if (this.selectedMenu == 6)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 4;
                }
                else if (this.selectedMenu >= 0)
                {
                    if (menuMultiplayer)
                    {
                        this.selectedPlayer = this.selectedMenu;
                        player[myPlayer] = (Player) loadPlayer[this.selectedPlayer].Clone();
                        playerPathName = loadPlayerPath[this.selectedPlayer];
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 13;
                    }
                    else
                    {
                        myPlayer = 0;
                        this.selectedPlayer = this.selectedMenu;
                        player[myPlayer] = (Player) loadPlayer[this.selectedPlayer].Clone();
                        playerPathName = loadPlayerPath[this.selectedPlayer];
                        LoadWorlds();
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 6;
                    }
                }
            }
            else if (Main.menuMode == 2)
            {
                if (this.selectedMenu == 0)
                {
                    Main.menuMode = 0x11;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].hairColor;
                }
                if (this.selectedMenu == 1)
                {
                    Main.menuMode = 0x12;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].eyeColor;
                }
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 0x13;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].skinColor;
                }
                if (this.selectedMenu == 3)
                {
                    Main.menuMode = 20;
                    PlaySound(10, -1, -1, 1);
                }
                strArray[0] = "Hair";
                strArray[1] = "Eyes";
                strArray[2] = "Skin";
                strArray[3] = "Clothes";
                num3 = 260;
                num5 = 50;
                numArray[4] = 20;
                numArray[5] = 20;
                strArray[4] = "Create";
                strArray[5] = "Back";
                num6 = 6;
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                if (this.selectedMenu == 5)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 1;
                }
                else if (this.selectedMenu == 4)
                {
                    PlaySound(10, -1, -1, 1);
                    loadPlayer[numLoadPlayers].name = "";
                    Main.menuMode = 3;
                }
            }
            else if (Main.menuMode == 20)
            {
                if (this.selectedMenu == 0)
                {
                    Main.menuMode = 0x15;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].shirtColor;
                }
                if (this.selectedMenu == 1)
                {
                    Main.menuMode = 0x16;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].underShirtColor;
                }
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 0x17;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].pantsColor;
                }
                if (this.selectedMenu == 3)
                {
                    this.selColor = loadPlayer[numLoadPlayers].shoeColor;
                    Main.menuMode = 0x18;
                    PlaySound(10, -1, -1, 1);
                }
                strArray[0] = "Shirt";
                strArray[1] = "Undershirt";
                strArray[2] = "Pants";
                strArray[3] = "Misc";
                num3 = 260;
                num5 = 50;
                numArray[5] = 20;
                strArray[5] = "Back";
                num6 = 6;
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                if (this.selectedMenu == 5)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 2;
                }
            }
            else if (Main.menuMode == 0x11)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 390;
                num3 = 260;
                num5 = 60;
                loadPlayer[index].hairColor = this.selColor;
                num6 = 3;
                strArray[0] = "Hair " + (loadPlayer[index].hair + 1);
                strArray[1] = "Hair Color";
                flagArray[1] = true;
                numArray[2] = 150;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 0)
                {
                    PlaySound(12, -1, -1, 1);
                    Player player1 = loadPlayer[index];
                    player1.hair++;
                    if (loadPlayer[index].hair >= 0x11)
                    {
                        loadPlayer[index].hair = 0;
                    }
                }
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 2;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x12)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].eyeColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Eye Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 2;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x13)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].skinColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Skin Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 2;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x15)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].shirtColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Shirt Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 20;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x16)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].underShirtColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Undershirt Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 20;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x17)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].pantsColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Pants Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 20;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x18)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].shoeColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Misc Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 20;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 3)
            {
                string name = loadPlayer[numLoadPlayers].name;
                loadPlayer[numLoadPlayers].name = GetInputText(loadPlayer[numLoadPlayers].name);
                if (loadPlayer[numLoadPlayers].name.Length > 20)
                {
                    loadPlayer[numLoadPlayers].name = loadPlayer[numLoadPlayers].name.Substring(0, 20);
                }
                if (name != loadPlayer[numLoadPlayers].name)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Enter Character Name:";
                flagArray2[2] = true;
                if (loadPlayer[numLoadPlayers].name != "")
                {
                    if (loadPlayer[numLoadPlayers].name.Substring(0, 1) == " ")
                    {
                        loadPlayer[numLoadPlayers].name = "";
                    }
                    for (int num15 = 0; num15 < loadPlayer[numLoadPlayers].name.Length; num15++)
                    {
                        if (loadPlayer[numLoadPlayers].name.Substring(num15, 1) != " ")
                        {
                            flagArray2[2] = false;
                        }
                    }
                }
                this.textBlinkerCount++;
                if (this.textBlinkerCount >= 20)
                {
                    if (this.textBlinkerState == 0)
                    {
                        this.textBlinkerState = 1;
                    }
                    else
                    {
                        this.textBlinkerState = 0;
                    }
                    this.textBlinkerCount = 0;
                }
                strArray[1] = loadPlayer[numLoadPlayers].name;
                if (this.textBlinkerState == 1)
                {
                    (strArray3 = strArray)[1] = strArray3[1] + "|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 2;
                }
                if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter))
                {
                    loadPlayerPath[numLoadPlayers] = nextLoadPlayer();
                    Player.SavePlayer(loadPlayer[numLoadPlayers], loadPlayerPath[numLoadPlayers]);
                    LoadPlayers();
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 1;
                }
            }
            else if (Main.menuMode == 4)
            {
                num3 = 220;
                num5 = 60;
                strArray[5] = "Back";
                for (int num16 = 0; num16 < 5; num16++)
                {
                    if (num16 < numLoadPlayers)
                    {
                        strArray[num16] = loadPlayer[num16].name;
                    }
                    else
                    {
                        strArray[num16] = null;
                    }
                }
                num6 = 6;
                if ((this.focusMenu >= 0) && (this.focusMenu < numLoadPlayers))
                {
                    index = this.focusMenu;
                    Vector2 vector2 = fontDeathText.MeasureString(strArray[index]);
                    num9 = (int) (((screenWidth / 2) + (vector2.X * 0.5)) + 10.0);
                    num10 = (num3 + (num5 * this.focusMenu)) + 4;
                }
                if (this.selectedMenu == 5)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 1;
                }
                else if (this.selectedMenu >= 0)
                {
                    this.selectedPlayer = this.selectedMenu;
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 5;
                }
            }
            else if (Main.menuMode == 5)
            {
                strArray[0] = "Delete " + loadPlayer[this.selectedPlayer].name + "?";
                flagArray[0] = true;
                strArray[1] = "Yes";
                strArray[2] = "No";
                num6 = 3;
                if (this.selectedMenu == 1)
                {
                    ErasePlayer(this.selectedPlayer);
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 1;
                }
                else if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 1;
                }
            }
            else if (Main.menuMode == 6)
            {
                num3 = 190;
                num5 = 50;
                strArray[5] = "Create World";
                strArray[6] = "Delete";
                if (numLoadWorlds == 5)
                {
                    flagArray2[5] = true;
                    strArray[5] = "";
                }
                else if (numLoadWorlds == 0)
                {
                    flagArray2[6] = true;
                    strArray[6] = "";
                }
                strArray[7] = "Back";
                for (int num17 = 0; num17 < 5; num17++)
                {
                    if (num17 < numLoadWorlds)
                    {
                        strArray[num17] = loadWorld[num17];
                    }
                    else
                    {
                        strArray[num17] = null;
                    }
                }
                num6 = 8;
                if (this.selectedMenu == 7)
                {
                    if (menuMultiplayer)
                    {
                        Main.menuMode = 12;
                    }
                    else
                    {
                        Main.menuMode = 1;
                    }
                    PlaySound(11, -1, -1, 1);
                }
                else if (this.selectedMenu == 5)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 0x10;
                    Main.newWorldName = "World " + (numLoadWorlds + 1);
                }
                else if (this.selectedMenu == 6)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 8;
                }
                else if (this.selectedMenu >= 0)
                {
                    if (menuMultiplayer)
                    {
                        PlaySound(10, -1, -1, 1);
                        worldPathName = loadWorldPath[this.selectedMenu];
                        Main.menuMode = 30;
                    }
                    else
                    {
                        PlaySound(10, -1, -1, 1);
                        worldPathName = loadWorldPath[this.selectedMenu];
                        WorldGen.playWorld();
                        Main.menuMode = 10;
                    }
                }
            }
            else if (Main.menuMode == 7)
            {
                string newWorldName = Main.newWorldName;
                Main.newWorldName = GetInputText(Main.newWorldName);
                if (Main.newWorldName.Length > 20)
                {
                    Main.newWorldName = Main.newWorldName.Substring(0, 20);
                }
                if (newWorldName != Main.newWorldName)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Enter World Name:";
                flagArray2[2] = true;
                if (Main.newWorldName != "")
                {
                    if (Main.newWorldName.Substring(0, 1) == " ")
                    {
                        Main.newWorldName = "";
                    }
                    for (int num18 = 0; num18 < Main.newWorldName.Length; num18++)
                    {
                        if (Main.newWorldName != " ")
                        {
                            flagArray2[2] = false;
                        }
                    }
                }
                this.textBlinkerCount++;
                if (this.textBlinkerCount >= 20)
                {
                    if (this.textBlinkerState == 0)
                    {
                        this.textBlinkerState = 1;
                    }
                    else
                    {
                        this.textBlinkerState = 0;
                    }
                    this.textBlinkerCount = 0;
                }
                strArray[1] = Main.newWorldName;
                if (this.textBlinkerState == 1)
                {
                    (strArray3 = strArray)[1] = strArray3[1] + "|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0x10;
                }
                if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter))
                {
                    Main.menuMode = 10;
                    worldName = Main.newWorldName;
                    worldPathName = nextLoadWorld();
                    WorldGen.CreateNewWorld();
                }
            }
            else if (Main.menuMode == 8)
            {
                num3 = 220;
                num5 = 60;
                strArray[5] = "Back";
                for (int num19 = 0; num19 < 5; num19++)
                {
                    if (num19 < numLoadWorlds)
                    {
                        strArray[num19] = loadWorld[num19];
                    }
                    else
                    {
                        strArray[num19] = null;
                    }
                }
                num6 = 6;
                if (this.selectedMenu == 5)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 1;
                }
                else if (this.selectedMenu >= 0)
                {
                    this.selectedWorld = this.selectedMenu;
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 9;
                }
            }
            else if (Main.menuMode == 9)
            {
                strArray[0] = "Delete " + loadWorld[this.selectedWorld] + "?";
                flagArray[0] = true;
                strArray[1] = "Yes";
                strArray[2] = "No";
                num6 = 3;
                if (this.selectedMenu == 1)
                {
                    EraseWorld(this.selectedWorld);
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 6;
                }
                else if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 6;
                }
            }
            else if (Main.menuMode == 11)
            {
                num3 = 180;
                num5 = 60;
                numArray[6] = 10;
                num6 = 7;
                if (this.graphics.IsFullScreen)
                {
                    strArray[0] = "Fullscreen Mode";
                }
                else
                {
                    strArray[0] = "Windowed Mode";
                }
                this.bgScroll = (int) Math.Round((double) ((1f - caveParrallax) * 500f));
                strArray[1] = "Cursor Color";
                strArray[2] = "Volume";
                strArray[3] = "Controls";
                strArray[4] = "Parallax";
                if (fixedTiming)
                {
                    strArray[5] = "Frame Skip Off";
                }
                else
                {
                    strArray[5] = "Frame Skip On";
                }
                strArray[6] = "Back";
                if (this.selectedMenu == 6)
                {
                    PlaySound(11, -1, -1, 1);
                    this.SaveSettings();
                    Main.menuMode = 0;
                }
                if (this.selectedMenu == 5)
                {
                    PlaySound(12, -1, -1, 1);
                    if (fixedTiming)
                    {
                        fixedTiming = false;
                    }
                    else
                    {
                        fixedTiming = true;
                    }
                }
                if (this.selectedMenu == 4)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0x1c;
                }
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0x1b;
                }
                if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0x1a;
                }
                if (this.selectedMenu == 1)
                {
                    PlaySound(10, -1, -1, 1);
                    this.selColor = mouseColor;
                    Main.menuMode = 0x19;
                }
                if (this.selectedMenu == 0)
                {
                    this.graphics.ToggleFullScreen();
                }
            }
            else if (Main.menuMode == 0x19)
            {
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                mouseColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Cursor Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 11;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x1a)
            {
                flag2 = true;
                num3 = 240;
                num5 = 60;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Volume";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 11;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x1c)
            {
                caveParrallax = 1f - (((float) this.bgScroll) / 500f);
                flag3 = true;
                num3 = 240;
                num5 = 60;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Parallax";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 11;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x1b)
            {
                num3 = 190;
                num5 = 50;
                num6 = 8;
                string[] strArray2 = new string[] { cUp, cDown, cLeft, cRight, cJump, cThrowItem, cInv };
                if (this.setKey >= 0)
                {
                    strArray2[this.setKey] = "_";
                }
                strArray[0] = "Up........." + strArray2[0];
                strArray[1] = "Down......." + strArray2[1];
                strArray[2] = "Left......." + strArray2[2];
                strArray[3] = "Right......" + strArray2[3];
                strArray[4] = "Jump......." + strArray2[4];
                strArray[5] = "Throw......" + strArray2[5];
                strArray[6] = "Inventory.." + strArray2[6];
                numArray[7] = 10;
                strArray[7] = "Back";
                if (this.selectedMenu == 7)
                {
                    Main.menuMode = 11;
                    PlaySound(11, -1, -1, 1);
                }
                else if (this.selectedMenu >= 0)
                {
                    this.setKey = this.selectedMenu;
                }
                if (this.setKey >= 0)
                {
                    Keys[] pressedKeys = keyState.GetPressedKeys();
                    if (pressedKeys.Length > 0)
                    {
                        string str5 = pressedKeys[0].ToString();
                        if (this.setKey == 0)
                        {
                            cUp = str5;
                        }
                        if (this.setKey == 1)
                        {
                            cDown = str5;
                        }
                        if (this.setKey == 2)
                        {
                            cLeft = str5;
                        }
                        if (this.setKey == 3)
                        {
                            cRight = str5;
                        }
                        if (this.setKey == 4)
                        {
                            cJump = str5;
                        }
                        if (this.setKey == 5)
                        {
                            cThrowItem = str5;
                        }
                        if (this.setKey == 6)
                        {
                            cInv = str5;
                        }
                        this.setKey = -1;
                    }
                }
            }
            else if (Main.menuMode == 12)
            {
                strArray[0] = "Join";
                strArray[1] = "Start Server";
                strArray[2] = "Back";
                if (this.selectedMenu == 0)
                {
                    LoadPlayers();
                    menuMultiplayer = true;
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 1;
                }
                else if (this.selectedMenu == 1)
                {
                    LoadWorlds();
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 6;
                    menuMultiplayer = true;
                }
                if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                }
                num6 = 3;
            }
            else if (Main.menuMode == 13)
            {
                string getIP = Main.getIP;
                Main.getIP = GetInputText(Main.getIP);
                if (getIP != Main.getIP)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Enter Server IP Address:";
                flagArray2[2] = true;
                if (Main.getIP != "")
                {
                    if (Main.getIP.Substring(0, 1) == " ")
                    {
                        Main.getIP = "";
                    }
                    for (int num20 = 0; num20 < Main.getIP.Length; num20++)
                    {
                        if (Main.getIP != " ")
                        {
                            flagArray2[2] = false;
                        }
                    }
                }
                this.textBlinkerCount++;
                if (this.textBlinkerCount >= 20)
                {
                    if (this.textBlinkerState == 0)
                    {
                        this.textBlinkerState = 1;
                    }
                    else
                    {
                        this.textBlinkerState = 0;
                    }
                    this.textBlinkerCount = 0;
                }
                strArray[1] = Main.getIP;
                if (this.textBlinkerState == 1)
                {
                    (strArray3 = strArray)[1] = strArray3[1] + "|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 1;
                }
                if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter))
                {
                    if (Netplay.SetIP(Main.getIP))
                    {
                        Main.menuMode = 10;
                        Netplay.StartClient();
                    }
                    else if (Netplay.SetIP2(Main.getIP))
                    {
                        Main.menuMode = 10;
                        Netplay.StartClient();
                    }
                }
            }
            else if (Main.menuMode == 0x10)
            {
                num3 = 200;
                num5 = 60;
                numArray[1] = 30;
                numArray[2] = 30;
                numArray[3] = 30;
                numArray[4] = 70;
                strArray[0] = "Choose world size:";
                flagArray[0] = true;
                strArray[1] = "Small";
                strArray[2] = "Medium";
                strArray[3] = "Large";
                strArray[4] = "Back";
                num6 = 5;
                if (this.selectedMenu == 4)
                {
                    Main.menuMode = 6;
                    PlaySound(11, -1, -1, 1);
                }
                else if (this.selectedMenu > 0)
                {
                    if (this.selectedMenu == 1)
                    {
                        maxTilesX = 0x1068;
                        maxTilesY = 0x4b0;
                    }
                    else if (this.selectedMenu == 2)
                    {
                        maxTilesX = 0x189c;
                        maxTilesY = 0x708;
                    }
                    else
                    {
                        maxTilesX = 0x20d0;
                        maxTilesY = 0x960;
                    }
                    Main.menuMode = 7;
                    PlaySound(10, -1, -1, 1);
                    WorldGen.setWorldSize();
                }
            }
            if (Main.menuMode != menuMode)
            {
                num6 = 0;
                for (int num21 = 0; num21 < maxMenuItems; num21++)
                {
                    this.menuItemScale[num21] = 0.8f;
                }
            }
            int focusMenu = this.focusMenu;
            this.selectedMenu = -1;
            this.focusMenu = -1;
            for (int k = 0; k < num6; k++)
            {
                if (strArray[k] != null)
                {
                    if (flag)
                    {
                        string text = "";
                        for (int num24 = 0; num24 < 6; num24++)
                        {
                            int num25 = num11;
                            int num26 = 370;
                            switch (num24)
                            {
                                case 0:
                                    text = "Red:";
                                    break;

                                case 1:
                                    text = "Green:";
                                    num25 += 30;
                                    break;

                                case 2:
                                    text = "Blue:";
                                    num25 += 60;
                                    break;

                                case 3:
                                    text = this.selColor.R.ToString();
                                    num26 += 90;
                                    break;

                                case 4:
                                    text = this.selColor.G.ToString();
                                    num26 += 90;
                                    num25 += 30;
                                    break;

                                case 5:
                                    text = this.selColor.B.ToString();
                                    num26 += 90;
                                    num25 += 60;
                                    break;
                            }
                            for (int num27 = 0; num27 < 5; num27++)
                            {
                                Color black = Color.Black;
                                if (num27 == 4)
                                {
                                    black = color;
                                    black.R = (byte) ((0xff + black.R) / 2);
                                    black.G = (byte) ((0xff + black.R) / 2);
                                    black.B = (byte) ((0xff + black.R) / 2);
                                }
                                int num28 = 0xff;
                                int num29 = black.R - (0xff - num28);
                                if (num29 < 0)
                                {
                                    num29 = 0;
                                }
                                black = new Color((int) ((byte) num29), (int) ((byte) num29), (int) ((byte) num29), (int) ((byte) num28));
                                int num30 = 0;
                                int num31 = 0;
                                switch (num27)
                                {
                                    case 0:
                                        num30 = -2;
                                        break;

                                    case 1:
                                        num30 = 2;
                                        break;

                                    case 2:
                                        num31 = -2;
                                        break;

                                    case 3:
                                        num31 = 2;
                                        break;
                                }
                                vector9 = new Vector2();
                                this.spriteBatch.DrawString(fontDeathText, text, new Vector2((float) (num26 + num30), (float) (num25 + num31)), black, 0f, vector9, (float) 0.5f, SpriteEffects.None, 0f);
                            }
                        }
                        bool flag5 = false;
                        for (int num32 = 0; num32 < 2; num32++)
                        {
                            for (int num33 = 0; num33 < 3; num33++)
                            {
                                int num34 = (num11 + (num33 * 30)) - 12;
                                int num35 = 360;
                                float scale = 0.9f;
                                if (num32 == 0)
                                {
                                    num35 -= 70;
                                    num34 += 2;
                                }
                                else
                                {
                                    num35 -= 40;
                                }
                                text = "-";
                                if (num32 == 1)
                                {
                                    text = "+";
                                }
                                Vector2 vector3 = new Vector2(24f, 24f);
                                int num37 = 0x8e;
                                if (((mouseState.X > num35) && (mouseState.X < (num35 + vector3.X))) && ((mouseState.Y > (num34 + 13)) && (mouseState.Y < ((num34 + 13) + vector3.Y))))
                                {
                                    if (this.focusColor != ((num32 + 1) * (num33 + 10)))
                                    {
                                        PlaySound(12, -1, -1, 1);
                                    }
                                    this.focusColor = (num32 + 1) * (num33 + 10);
                                    flag5 = true;
                                    num37 = 0xff;
                                    if (mouseState.LeftButton == ButtonState.Pressed)
                                    {
                                        if (this.colorDelay <= 1)
                                        {
                                            if (this.colorDelay == 0)
                                            {
                                                this.colorDelay = 40;
                                            }
                                            else
                                            {
                                                this.colorDelay = 3;
                                            }
                                            int num38 = num32;
                                            if (num32 == 0)
                                            {
                                                num38 = -1;
                                                if (((this.selColor.R + this.selColor.G) + this.selColor.B) < 0xff)
                                                {
                                                    num38 = 0;
                                                }
                                            }
                                            if (((num33 == 0) && ((this.selColor.R + num38) >= 0)) && ((this.selColor.R + num38) <= 0xff))
                                            {
                                                this.selColor.R = (byte) (this.selColor.R + num38);
                                            }
                                            if (((num33 == 1) && ((this.selColor.G + num38) >= 0)) && ((this.selColor.G + num38) <= 0xff))
                                            {
                                                this.selColor.G = (byte) (this.selColor.G + num38);
                                            }
                                            if (((num33 == 2) && ((this.selColor.B + num38) >= 0)) && ((this.selColor.B + num38) <= 0xff))
                                            {
                                                this.selColor.B = (byte) (this.selColor.B + num38);
                                            }
                                        }
                                        this.colorDelay--;
                                    }
                                    else
                                    {
                                        this.colorDelay = 0;
                                    }
                                }
                                for (int num39 = 0; num39 < 5; num39++)
                                {
                                    Color color3 = Color.Black;
                                    if (num39 == 4)
                                    {
                                        color3 = color;
                                        color3.R = (byte) ((0xff + color3.R) / 2);
                                        color3.G = (byte) ((0xff + color3.R) / 2);
                                        color3.B = (byte) ((0xff + color3.R) / 2);
                                    }
                                    int num40 = color3.R - (0xff - num37);
                                    if (num40 < 0)
                                    {
                                        num40 = 0;
                                    }
                                    color3 = new Color((int) ((byte) num40), (int) ((byte) num40), (int) ((byte) num40), (int) ((byte) num37));
                                    int num41 = 0;
                                    int num42 = 0;
                                    switch (num39)
                                    {
                                        case 0:
                                            num41 = -2;
                                            break;

                                        case 1:
                                            num41 = 2;
                                            break;

                                        case 2:
                                            num42 = -2;
                                            break;

                                        case 3:
                                            num42 = 2;
                                            break;
                                    }
                                    vector9 = new Vector2();
                                    this.spriteBatch.DrawString(fontDeathText, text, new Vector2((float) (num35 + num41), (float) (num34 + num42)), color3, 0f, vector9, scale, SpriteEffects.None, 0f);
                                }
                            }
                        }
                        if (!flag5)
                        {
                            this.focusColor = 0;
                            this.colorDelay = 0;
                        }
                    }
                    if (flag3)
                    {
                        int num43 = 400;
                        string str8 = "";
                        for (int num44 = 0; num44 < 4; num44++)
                        {
                            int num45 = num43;
                            int num46 = 370;
                            if (num44 == 0)
                            {
                                str8 = "Parallax: " + this.bgScroll;
                            }
                            for (int num47 = 0; num47 < 5; num47++)
                            {
                                Color color4 = Color.Black;
                                if (num47 == 4)
                                {
                                    color4 = color;
                                    color4.R = (byte) ((0xff + color4.R) / 2);
                                    color4.G = (byte) ((0xff + color4.R) / 2);
                                    color4.B = (byte) ((0xff + color4.R) / 2);
                                }
                                int num48 = 0xff;
                                int num49 = color4.R - (0xff - num48);
                                if (num49 < 0)
                                {
                                    num49 = 0;
                                }
                                color4 = new Color((int) ((byte) num49), (int) ((byte) num49), (int) ((byte) num49), (int) ((byte) num48));
                                int num50 = 0;
                                int num51 = 0;
                                switch (num47)
                                {
                                    case 0:
                                        num50 = -2;
                                        break;

                                    case 1:
                                        num50 = 2;
                                        break;

                                    case 2:
                                        num51 = -2;
                                        break;

                                    case 3:
                                        num51 = 2;
                                        break;
                                }
                                vector9 = new Vector2();
                                this.spriteBatch.DrawString(fontDeathText, str8, new Vector2((float) (num46 + num50), (float) (num45 + num51)), color4, 0f, vector9, (float) 0.5f, SpriteEffects.None, 0f);
                            }
                        }
                        bool flag6 = false;
                        for (int num52 = 0; num52 < 2; num52++)
                        {
                            for (int num53 = 0; num53 < 1; num53++)
                            {
                                int num54 = (num43 + (num53 * 30)) - 12;
                                int num55 = 360;
                                float num56 = 0.9f;
                                if (num52 == 0)
                                {
                                    num55 -= 70;
                                    num54 += 2;
                                }
                                else
                                {
                                    num55 -= 40;
                                }
                                str8 = "-";
                                if (num52 == 1)
                                {
                                    str8 = "+";
                                }
                                Vector2 vector4 = new Vector2(24f, 24f);
                                int num57 = 0x8e;
                                if (((mouseState.X > num55) && (mouseState.X < (num55 + vector4.X))) && ((mouseState.Y > (num54 + 13)) && (mouseState.Y < ((num54 + 13) + vector4.Y))))
                                {
                                    if (this.focusColor != ((num52 + 1) * (num53 + 10)))
                                    {
                                        PlaySound(12, -1, -1, 1);
                                    }
                                    this.focusColor = (num52 + 1) * (num53 + 10);
                                    flag6 = true;
                                    num57 = 0xff;
                                    if (mouseState.LeftButton == ButtonState.Pressed)
                                    {
                                        if (this.colorDelay <= 1)
                                        {
                                            if (this.colorDelay == 0)
                                            {
                                                this.colorDelay = 40;
                                            }
                                            else
                                            {
                                                this.colorDelay = 3;
                                            }
                                            int num58 = num52;
                                            if (num52 == 0)
                                            {
                                                num58 = -1;
                                            }
                                            if (num53 == 0)
                                            {
                                                this.bgScroll += num58;
                                                if (this.bgScroll > 100)
                                                {
                                                    this.bgScroll = 100;
                                                }
                                                if (this.bgScroll < 0)
                                                {
                                                    this.bgScroll = 0;
                                                }
                                            }
                                        }
                                        this.colorDelay--;
                                    }
                                    else
                                    {
                                        this.colorDelay = 0;
                                    }
                                }
                                for (int num59 = 0; num59 < 5; num59++)
                                {
                                    Color color5 = Color.Black;
                                    if (num59 == 4)
                                    {
                                        color5 = color;
                                        color5.R = (byte) ((0xff + color5.R) / 2);
                                        color5.G = (byte) ((0xff + color5.R) / 2);
                                        color5.B = (byte) ((0xff + color5.R) / 2);
                                    }
                                    int num60 = color5.R - (0xff - num57);
                                    if (num60 < 0)
                                    {
                                        num60 = 0;
                                    }
                                    color5 = new Color((int) ((byte) num60), (int) ((byte) num60), (int) ((byte) num60), (int) ((byte) num57));
                                    int num61 = 0;
                                    int num62 = 0;
                                    switch (num59)
                                    {
                                        case 0:
                                            num61 = -2;
                                            break;

                                        case 1:
                                            num61 = 2;
                                            break;

                                        case 2:
                                            num62 = -2;
                                            break;

                                        case 3:
                                            num62 = 2;
                                            break;
                                    }
                                    vector9 = new Vector2();
                                    this.spriteBatch.DrawString(fontDeathText, str8, new Vector2((float) (num55 + num61), (float) (num54 + num62)), color5, 0f, vector9, num56, SpriteEffects.None, 0f);
                                }
                            }
                        }
                        if (!flag6)
                        {
                            this.focusColor = 0;
                            this.colorDelay = 0;
                        }
                    }
                    if (flag2)
                    {
                        int num63 = 400;
                        string str9 = "";
                        for (int num64 = 0; num64 < 4; num64++)
                        {
                            int num65 = num63;
                            int num66 = 370;
                            switch (num64)
                            {
                                case 0:
                                    str9 = "Sound:";
                                    break;

                                case 1:
                                    str9 = "Music:";
                                    num65 += 30;
                                    break;

                                case 2:
                                    str9 = Math.Round((double) (soundVolume * 100f)) + "%";
                                    num66 += 90;
                                    break;

                                case 3:
                                    str9 = Math.Round((double) (musicVolume * 100f)) + "%";
                                    num66 += 90;
                                    num65 += 30;
                                    break;
                            }
                            for (int num67 = 0; num67 < 5; num67++)
                            {
                                Color color6 = Color.Black;
                                if (num67 == 4)
                                {
                                    color6 = color;
                                    color6.R = (byte) ((0xff + color6.R) / 2);
                                    color6.G = (byte) ((0xff + color6.R) / 2);
                                    color6.B = (byte) ((0xff + color6.R) / 2);
                                }
                                int num68 = 0xff;
                                int num69 = color6.R - (0xff - num68);
                                if (num69 < 0)
                                {
                                    num69 = 0;
                                }
                                color6 = new Color((int) ((byte) num69), (int) ((byte) num69), (int) ((byte) num69), (int) ((byte) num68));
                                int num70 = 0;
                                int num71 = 0;
                                switch (num67)
                                {
                                    case 0:
                                        num70 = -2;
                                        break;

                                    case 1:
                                        num70 = 2;
                                        break;

                                    case 2:
                                        num71 = -2;
                                        break;

                                    case 3:
                                        num71 = 2;
                                        break;
                                }
                                vector9 = new Vector2();
                                this.spriteBatch.DrawString(fontDeathText, str9, new Vector2((float) (num66 + num70), (float) (num65 + num71)), color6, 0f, vector9, (float) 0.5f, SpriteEffects.None, 0f);
                            }
                        }
                        bool flag7 = false;
                        for (int num72 = 0; num72 < 2; num72++)
                        {
                            for (int num73 = 0; num73 < 2; num73++)
                            {
                                int num79;
                                int num74 = (num63 + (num73 * 30)) - 12;
                                int num75 = 360;
                                float num76 = 0.9f;
                                if (num72 == 0)
                                {
                                    num75 -= 70;
                                    num74 += 2;
                                }
                                else
                                {
                                    num75 -= 40;
                                }
                                str9 = "-";
                                if (num72 == 1)
                                {
                                    str9 = "+";
                                }
                                Vector2 vector5 = new Vector2(24f, 24f);
                                int num77 = 0x8e;
                                if (((mouseState.X <= num75) || (mouseState.X >= (num75 + vector5.X))) || ((mouseState.Y <= (num74 + 13)) || (mouseState.Y >= ((num74 + 13) + vector5.Y))))
                                {
                                    goto Label_3001;
                                }
                                if (this.focusColor != ((num72 + 1) * (num73 + 10)))
                                {
                                    PlaySound(12, -1, -1, 1);
                                }
                                this.focusColor = (num72 + 1) * (num73 + 10);
                                flag7 = true;
                                num77 = 0xff;
                                if (mouseState.LeftButton != ButtonState.Pressed)
                                {
                                    goto Label_2FFA;
                                }
                                if (this.colorDelay <= 1)
                                {
                                    if (this.colorDelay == 0)
                                    {
                                        this.colorDelay = 40;
                                    }
                                    else
                                    {
                                        this.colorDelay = 3;
                                    }
                                    int num78 = num72;
                                    if (num72 == 0)
                                    {
                                        num78 = -1;
                                    }
                                    switch (num73)
                                    {
                                        case 0:
                                            soundVolume += num78 * 0.01f;
                                            if (soundVolume > 1f)
                                            {
                                                soundVolume = 1f;
                                            }
                                            if (soundVolume < 0f)
                                            {
                                                soundVolume = 0f;
                                            }
                                            break;

                                        case 1:
                                            musicVolume += num78 * 0.01f;
                                            if (musicVolume > 1f)
                                            {
                                                musicVolume = 1f;
                                            }
                                            if (musicVolume < 0f)
                                            {
                                                musicVolume = 0f;
                                            }
                                            goto Label_2FEA;
                                    }
                                }
                            Label_2FEA:
                                this.colorDelay--;
                                goto Label_3001;
                            Label_2FFA:
                                this.colorDelay = 0;
                            Label_3001:
                                num79 = 0;
                                while (num79 < 5)
                                {
                                    Color color7 = Color.Black;
                                    if (num79 == 4)
                                    {
                                        color7 = color;
                                        color7.R = (byte) ((0xff + color7.R) / 2);
                                        color7.G = (byte) ((0xff + color7.R) / 2);
                                        color7.B = (byte) ((0xff + color7.R) / 2);
                                    }
                                    int num80 = color7.R - (0xff - num77);
                                    if (num80 < 0)
                                    {
                                        num80 = 0;
                                    }
                                    color7 = new Color((int) ((byte) num80), (int) ((byte) num80), (int) ((byte) num80), (int) ((byte) num77));
                                    int num81 = 0;
                                    int num82 = 0;
                                    switch (num79)
                                    {
                                        case 0:
                                            num81 = -2;
                                            break;

                                        case 1:
                                            num81 = 2;
                                            break;

                                        case 2:
                                            num82 = -2;
                                            break;

                                        case 3:
                                            num82 = 2;
                                            break;
                                    }
                                    vector9 = new Vector2();
                                    this.spriteBatch.DrawString(fontDeathText, str9, new Vector2((float) (num75 + num81), (float) (num74 + num82)), color7, 0f, vector9, num76, SpriteEffects.None, 0f);
                                    num79++;
                                }
                            }
                        }
                        if (!flag7)
                        {
                            this.focusColor = 0;
                            this.colorDelay = 0;
                        }
                    }
                    for (int num83 = 0; num83 < 5; num83++)
                    {
                        Color color8 = Color.Black;
                        if (num83 == 4)
                        {
                            color8 = color;
                            color8.R = (byte) ((0xff + color8.R) / 2);
                            color8.G = (byte) ((0xff + color8.R) / 2);
                            color8.B = (byte) ((0xff + color8.R) / 2);
                        }
                        int num84 = (int) (255f * ((this.menuItemScale[k] * 2f) - 1f));
                        if (flagArray[k])
                        {
                            num84 = 0xff;
                        }
                        int num85 = color8.R - (0xff - num84);
                        if (num85 < 0)
                        {
                            num85 = 0;
                        }
                        color8 = new Color((int) ((byte) num85), (int) ((byte) num85), (int) ((byte) num85), (int) ((byte) num84));
                        int num86 = 0;
                        int num87 = 0;
                        switch (num83)
                        {
                            case 0:
                                num86 = -2;
                                break;

                            case 1:
                                num86 = 2;
                                break;

                            case 2:
                                num87 = -2;
                                break;

                            case 3:
                                num87 = 2;
                                break;
                        }

                        Vector2 origin = fontDeathText.MeasureString(strArray[k]);
                        origin.X *= 0.5f;
                        origin.Y *= 0.5f;
                        float num88 = this.menuItemScale[k];
                        if ((Main.menuMode == 15) && (k == 0))
                        {
                            num88 *= 0.35f;
                        }
                        else if (netMode == 2)
                        {
                            num88 *= 0.5f;
                        }
                        this.spriteBatch.DrawString(fontDeathText, strArray[k], new Vector2((float) ((num4 + num86) + numArray2[k]), (((num3 + (num5 * k)) + num87) + origin.Y) + numArray[k]), color8, 0f, origin, num88, SpriteEffects.None, 0f);
                    }
                    if ((((mouseState.X > ((num4 - (strArray[k].Length * 10)) + numArray2[k])) && (mouseState.X < ((num4 + (strArray[k].Length * 10)) + numArray2[k]))) && ((mouseState.Y > ((num3 + (num5 * k)) + numArray[k])) && (mouseState.Y < (((num3 + (num5 * k)) + 50) + numArray[k])))) && hasFocus)
                    {
                        this.focusMenu = k;
                        if (flagArray[k] || flagArray2[k])
                        {
                            this.focusMenu = -1;
                        }
                        else
                        {
                            if (focusMenu != this.focusMenu)
                            {
                                PlaySound(12, -1, -1, 1);
                            }
                            if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed))
                            {
                                this.selectedMenu = k;
                            }
                        }
                    }
                }
            }
            for (int m = 0; m < maxMenuItems; m++)
            {
                if (m == this.focusMenu)
                {
                    if (this.menuItemScale[m] < 1f)
                    {
                        this.menuItemScale[m] += 0.02f;
                    }
                    if (this.menuItemScale[m] > 1f)
                    {
                        this.menuItemScale[m] = 1f;
                    }
                }
                else if (this.menuItemScale[m] > 0.8)
                {
                    this.menuItemScale[m] -= 0.02f;
                }
            }
            if (index >= 0)
            {
                loadPlayer[index].PlayerFrame();
                loadPlayer[index].position.X = num9 + screenPosition.X;
                loadPlayer[index].position.Y = num10 + screenPosition.Y;
                this.DrawPlayer(loadPlayer[index]);
            }
            for (int n = 0; n < 5; n++)
            {
                Color color9 = Color.Black;
                if (n == 4)
                {
                    color9 = color;
                    color9.R = (byte) ((0xff + color9.R) / 2);
                    color9.G = (byte) ((0xff + color9.R) / 2);
                    color9.B = (byte) ((0xff + color9.R) / 2);
                }
                color9.A = (byte) (color9.A * 0.3f);
                int num91 = 0;
                int num92 = 0;
                switch (n)
                {
                    case 0:
                        num91 = -2;
                        break;

                    case 1:
                        num91 = 2;
                        break;

                    case 2:
                        num92 = -2;
                        break;

                    case 3:
                        num92 = 2;
                        break;
                }
                string str10 = "Copyright 2011 Re-Logic";
                Vector2 vector7 = fontMouseText.MeasureString(str10);
                vector7.X *= 0.5f;
                vector7.Y *= 0.5f;
                this.spriteBatch.DrawString(fontMouseText, str10, new Vector2(((screenWidth - vector7.X) + num91) - 10f, ((screenHeight - vector7.Y) + num92) - 2f), color9, 0f, vector7, (float) 1f, SpriteEffects.None, 0f);
            }
            for (int num93 = 0; num93 < 5; num93++)
            {
                Color color10 = Color.Black;
                if (num93 == 4)
                {
                    color10 = color;
                    color10.R = (byte) ((0xff + color10.R) / 2);
                    color10.G = (byte) ((0xff + color10.R) / 2);
                    color10.B = (byte) ((0xff + color10.R) / 2);
                }
                color10.A = (byte) (color10.A * 0.3f);
                int num94 = 0;
                int num95 = 0;
                switch (num93)
                {
                    case 0:
                        num94 = -2;
                        break;

                    case 1:
                        num94 = 2;
                        break;

                    case 2:
                        num95 = -2;
                        break;

                    case 3:
                        num95 = 2;
                        break;
                }
                Vector2 vector8 = fontMouseText.MeasureString(versionNumber);
                vector8.X *= 0.5f;
                vector8.Y *= 0.5f;
                this.spriteBatch.DrawString(fontMouseText, versionNumber, new Vector2((vector8.X + num94) + 10f, ((screenHeight - vector8.Y) + num95) - 2f), color10, 0f, vector8, (float) 1f, SpriteEffects.None, 0f);
            }
            vector9 = new Vector2();
            this.spriteBatch.Draw(cursorTexture, new Vector2((float) (mouseState.X + 1), (float) (mouseState.Y + 1)), new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height), new Color((int) (cursorColor.R * 0.2f), (int) (cursorColor.G * 0.2f), (int) (cursorColor.B * 0.2f), (int) (cursorColor.A * 0.5f)), 0f, vector9, (float) (cursorScale * 1.1f), SpriteEffects.None, 0f);
            vector9 = new Vector2();
            this.spriteBatch.Draw(cursorTexture, new Vector2((float) mouseState.X, (float) mouseState.Y), new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height), cursorColor, 0f, vector9, cursorScale, SpriteEffects.None, 0f);
            if (fadeCounter > 0)
            {
                Color white = Color.White;
                byte num96 = 0;
                fadeCounter--;
                float num97 = (((float) fadeCounter) / 75f) * 255f;
                num96 = (byte) num97;
                white = new Color((int) num96, (int) num96, (int) num96, (int) num96);
                this.spriteBatch.Draw(fadeTexture, new Vector2(0f, 0f), new Rectangle(0, 0, splashTexture.Width, splashTexture.Height), white, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f);
            }
            this.spriteBatch.End();
            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                mouseLeftRelease = false;
            }
            else
            {
                mouseLeftRelease = true;
            }
            if (mouseState.RightButton == ButtonState.Pressed)
            {
                mouseRightRelease = false;
            }
            else
            {
                mouseRightRelease = true;
            }
        }
コード例 #7
0
ファイル: Main.cs プロジェクト: skylerdavidson/tkj-mod
        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;
                }
            }
        }
コード例 #8
0
ファイル: Main.cs プロジェクト: skylerdavidson/tkj-mod
        protected void DrawMenu()
        {
            string[] strArray3 = new string[1];
            Vector2 vector9;
            Star.UpdateStars();
            Cloud.UpdateClouds();
            evilTiles = 0;
            jungleTiles = 0;
            chatMode = false;
            for (int i = 0; i < numChatLines; i++)
            {
                chatLine[i] = new ChatLine();
            }
            this.DrawFPS();
            screenPosition.Y = (float) ((worldSurface * 16.0) - screenHeight);
            background = 0;
            byte r = (byte) ((0xff + (tileColor.R * 2)) / 3);
            Color color = new Color(r, r, r, 0xff);
            this.logoRotation += this.logoRotationSpeed * 3E-05f;
            if (this.logoRotation > 0.1)
            {
                this.logoRotationDirection = -1f;
            }
            else if (this.logoRotation < -0.1)
            {
                this.logoRotationDirection = 1f;
            }
            if ((this.logoRotationSpeed < 20f) & (this.logoRotationDirection == 1f))
            {
                this.logoRotationSpeed++;
            }
            else if ((this.logoRotationSpeed > -20f) & (this.logoRotationDirection == -1f))
            {
                this.logoRotationSpeed--;
            }
            this.logoScale += this.logoScaleSpeed * 1E-05f;
            if (this.logoScale > 1.1)
            {
                this.logoScaleDirection = -1f;
            }
            else if (this.logoScale < 0.9)
            {
                this.logoScaleDirection = 1f;
            }
            if ((this.logoScaleSpeed < 50f) & (this.logoScaleDirection == 1f))
            {
                this.logoScaleSpeed++;
            }
            else if ((this.logoScaleSpeed > -50f) & (this.logoScaleDirection == -1f))
            {
                this.logoScaleSpeed--;
            }
            this.spriteBatch.Draw(logoTexture, new Vector2((float) (screenWidth / 2), 100f), new Rectangle(0, 0, logoTexture.Width, logoTexture.Height), color, this.logoRotation, new Vector2((float) (logoTexture.Width / 2), (float) (logoTexture.Height / 2)), this.logoScale, SpriteEffects.None, 0f);
            int num3 = 250;
            int num4 = screenWidth / 2;
            int num5 = 80;
            int num6 = 0;
            int menuMode = Main.menuMode;
            int index = -1;
            int num9 = 0;
            int num10 = 0;
            bool flag = false;
            bool flag2 = false;
            bool flag3 = false;
            int num11 = 0;
            bool[] flagArray = new bool[maxMenuItems];
            bool[] flagArray2 = new bool[maxMenuItems];
            int[] numArray = new int[maxMenuItems];
            int[] numArray2 = new int[maxMenuItems];
            bool[] flagArray3 = new bool[maxMenuItems];
            float[] numArray3 = new float[maxMenuItems];
            bool[] flagArray4 = new bool[maxMenuItems];
            for (int j = 0; j < maxMenuItems; j++)
            {
                flagArray[j] = false;
                flagArray2[j] = false;
                numArray[j] = 0;
                numArray2[j] = 0;
                numArray3[j] = 1f;
            }
            string[] strArray = new string[maxMenuItems];
            if (Main.menuMode == -1)
            {
                Main.menuMode = 0;
            }
            if (netMode == 2)
            {
                bool flag4 = true;
                for (int num13 = 0; num13 < 8; num13++)
                {
                    if (num13 < 0xff)
                    {
                        try
                        {
                            strArray[num13] = Netplay.serverSock[num13].statusText;
                            if (Netplay.serverSock[num13].active && showSpam)
                            {
                                IntPtr ptr = new IntPtr();
                                object obj2 = strArray3[(int) ptr];
                                (strArray3 = strArray)[(int) (ptr = (IntPtr) num13)] = string.Concat(new object[] { obj2, " (", NetMessage.buffer[num13].spamCount, ")" });
                            }
                        }
                        catch
                        {
                            strArray[num13] = "";
                        }
                        flagArray[num13] = true;
                        if ((strArray[num13] != "") && (strArray[num13] != null))
                        {
                            flag4 = false;
                        }
                    }
                }
                if (flag4)
                {
                    strArray[0] = "Start a new instance of Terraria to join!";
                    strArray[1] = "Running on port " + Netplay.serverPort + ".";
                }
                num6 = 11;
                strArray[9] = statusText;
                flagArray[9] = true;
                num3 = 170;
                num5 = 30;
                numArray[10] = 20;
                numArray[10] = 40;
                strArray[10] = "Disconnect";
                if (this.selectedMenu == 10)
                {
                    Netplay.disconnect = true;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x1f)
            {
                string password = Netplay.password;
                Netplay.password = GetInputText(Netplay.password);
                if (password != Netplay.password)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Server Requires Password:"******"|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    Netplay.disconnect = true;
                    Netplay.password = "";
                }
                else if ((this.selectedMenu == 2) || inputTextEnter)
                {
                    NetMessage.SendData(0x26, -1, -1, Netplay.password, 0, 0f, 0f, 0f, 0);
                    Main.menuMode = 14;
                }
            }
            else if ((netMode == 1) || (Main.menuMode == 14))
            {
                num6 = 2;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 300;
                strArray[1] = "Cancel";
                if (this.selectedMenu == 1)
                {
                    Netplay.disconnect = true;
                    Netplay.clientSock.tcpClient.Close();
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    netMode = 0;
                    try
                    {
                        this.tServer.Kill();
                    }
                    catch
                    {
                    }
                }
            }
            else if (Main.menuMode == 30)
            {
                string str2 = Netplay.password;
                Netplay.password = GetInputText(Netplay.password);
                if (str2 != Netplay.password)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Enter Server Password:"******"|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 6;
                    Netplay.password = "";
                }
                else if (((this.selectedMenu == 2) || inputTextEnter) || autoPass)
                {
                    this.tServer.StartInfo.FileName = "TerrariaServer.exe";
                    this.tServer.StartInfo.Arguments = "-autoshutdown -world \"" + worldPathName + "\" -password \"" + Netplay.password + "\"";
                    if (libPath != "")
                    {
                        ProcessStartInfo startInfo = this.tServer.StartInfo;
                        startInfo.Arguments = startInfo.Arguments + " -loadlib " + libPath;
                    }
                    this.tServer.StartInfo.UseShellExecute = false;
                    this.tServer.StartInfo.CreateNoWindow = true;
                    this.tServer.Start();
                    Netplay.SetIP("127.0.0.1");
                    autoPass = true;
                    statusText = "Starting server...";
                    Netplay.StartClient();
                    Main.menuMode = 10;
                }
            }
            else if (Main.menuMode == 15)
            {
                num6 = 2;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 80;
                num5 = 400;
                strArray[1] = "Back";
                if (this.selectedMenu == 1)
                {
                    Netplay.disconnect = true;
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    netMode = 0;
                }
            }
            else if (Main.menuMode == 200)
            {
                num6 = 3;
                strArray[0] = "Load failed!";
                flagArray[0] = true;
                num3 -= 30;
                numArray[1] = 70;
                numArray[2] = 50;
                strArray[1] = "Load Backup";
                strArray[2] = "Cancel";
                if (this.selectedMenu == 1)
                {
                    if (File.Exists(worldPathName + ".bak"))
                    {
                        File.Copy(worldPathName + ".bak", worldPathName, true);
                        File.Delete(worldPathName + ".bak");
                        PlaySound(10, -1, -1, 1);
                        WorldGen.playWorld();
                        Main.menuMode = 10;
                    }
                    else
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 0;
                        netMode = 0;
                    }
                }
                if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    netMode = 0;
                }
            }
            else if (Main.menuMode == 0xc9)
            {
                num6 = 3;
                strArray[0] = "Load failed!";
                flagArray[0] = true;
                flagArray[1] = true;
                num3 -= 30;
                numArray[1] = -30;
                numArray[2] = 50;
                strArray[1] = "No backup found";
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0;
                    netMode = 0;
                }
            }
            else if (Main.menuMode == 10)
            {
                num6 = 1;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 300;
            }
            else if (Main.menuMode == 100)
            {
                num6 = 1;
                strArray[0] = statusText;
                flagArray[0] = true;
                num3 = 300;
            }
            else if (Main.menuMode == 0)
            {
                menuMultiplayer = false;
                menuServer = false;
                netMode = 0;
                strArray[0] = "Single Player";
                strArray[1] = "Multiplayer";
                strArray[2] = "Settings";
                strArray[3] = "Exit";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    this.QuitGame();
                }
                if (this.selectedMenu == 1)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 12;
                }
                if (this.selectedMenu == 2)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 11;
                }
                if (this.selectedMenu == 0)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 1;
                    LoadPlayers();
                }
            }
            else if (Main.menuMode == 1)
            {
                myPlayer = 0;
                num3 = 190;
                num5 = 50;
                strArray[5] = "Create Character";
                strArray[6] = "Delete";
                if (numLoadPlayers == 5)
                {
                    flagArray2[5] = true;
                    strArray[5] = "";
                }
                else if (numLoadPlayers == 0)
                {
                    flagArray2[6] = true;
                    strArray[6] = "";
                }
                strArray[7] = "Back";
                for (int num14 = 0; num14 < 5; num14++)
                {
                    if (num14 < numLoadPlayers)
                    {
                        strArray[num14] = loadPlayer[num14].name;
                        if (loadPlayer[num14].hardCore)
                        {
                            flagArray3[num14] = true;
                        }
                    }
                    else
                    {
                        strArray[num14] = null;
                    }
                }
                num6 = 8;
                if ((this.focusMenu >= 0) && (this.focusMenu < numLoadPlayers))
                {
                    index = this.focusMenu;
                    Vector2 vector = fontDeathText.MeasureString(strArray[index]);
                    num9 = (int) (((screenWidth / 2) + (vector.X * 0.5)) + 10.0);
                    num10 = (num3 + (num5 * this.focusMenu)) + 4;
                }
                if (this.selectedMenu == 7)
                {
                    autoJoin = false;
                    autoPass = false;
                    PlaySound(11, -1, -1, 1);
                    if (menuMultiplayer)
                    {
                        Main.menuMode = 12;
                        menuMultiplayer = false;
                        menuServer = false;
                    }
                    else
                    {
                        Main.menuMode = 0;
                    }
                }
                else if (this.selectedMenu == 5)
                {
                    loadPlayer[numLoadPlayers] = new Player();
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 2;
                }
                else if (this.selectedMenu == 6)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 4;
                }
                else if (this.selectedMenu >= 0)
                {
                    if (menuMultiplayer)
                    {
                        this.selectedPlayer = this.selectedMenu;
                        player[myPlayer] = (Player) loadPlayer[this.selectedPlayer].Clone();
                        playerPathName = loadPlayerPath[this.selectedPlayer];
                        PlaySound(10, -1, -1, 1);
                        if (autoJoin)
                        {
                            if (Netplay.SetIP(Main.getIP))
                            {
                                Main.menuMode = 10;
                                Netplay.StartClient();
                            }
                            else if (Netplay.SetIP2(Main.getIP))
                            {
                                Main.menuMode = 10;
                                Netplay.StartClient();
                            }
                            autoJoin = false;
                        }
                        else if (menuServer)
                        {
                            LoadWorlds();
                            Main.menuMode = 6;
                        }
                        else
                        {
                            Main.menuMode = 13;
                        }
                    }
                    else
                    {
                        myPlayer = 0;
                        this.selectedPlayer = this.selectedMenu;
                        player[myPlayer] = (Player) loadPlayer[this.selectedPlayer].Clone();
                        playerPathName = loadPlayerPath[this.selectedPlayer];
                        LoadWorlds();
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 6;
                    }
                }
            }
            else if (Main.menuMode == 2)
            {
                if (this.selectedMenu == 0)
                {
                    Main.menuMode = 0x11;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].hairColor;
                }
                if (this.selectedMenu == 1)
                {
                    Main.menuMode = 0x12;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].eyeColor;
                }
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 0x13;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].skinColor;
                }
                if (this.selectedMenu == 3)
                {
                    Main.menuMode = 20;
                    PlaySound(10, -1, -1, 1);
                }
                strArray[0] = "Hair";
                strArray[1] = "Eyes";
                strArray[2] = "Skin";
                strArray[3] = "Clothes";
                num3 = 240;
                num5 = 0x2d;
                numArray[5] = 20;
                numArray[6] = 20;
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 200;
                if (loadPlayer[index].hardCore)
                {
                    if (this.selectedMenu == 4)
                    {
                        loadPlayer[index].hardCore = false;
                    }
                    strArray[4] = "Hardcore";
                    flagArray3[4] = true;
                }
                else
                {
                    if (this.selectedMenu == 4)
                    {
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 0xde;
                    }
                    strArray[4] = "Softcore";
                }
                strArray[5] = "Create";
                strArray[6] = "Back";
                num6 = 7;
                if (this.selectedMenu == 6)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 1;
                }
                else if (this.selectedMenu == 5)
                {
                    PlaySound(10, -1, -1, 1);
                    loadPlayer[numLoadPlayers].name = "";
                    Main.menuMode = 3;
                }
            }
            else if (Main.menuMode == 0xde)
            {
                strArray[0] = "Hardcore characters restart on death.";
                strArray[1] = "Are you sure?";
                num5 = 50;
                numArray[2] = 0x19;
                numArray[3] = 0x19;
                flagArray[0] = true;
                flagArray[1] = true;
                strArray[2] = "Yes";
                strArray[3] = "No";
                num6 = 4;
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 2;
                    loadPlayer[numLoadPlayers].hardCore = true;
                }
                else if (this.selectedMenu == 3)
                {
                    loadPlayer[numLoadPlayers].hardCore = false;
                    Main.menuMode = 2;
                }
            }
            else if (Main.menuMode == 20)
            {
                if (this.selectedMenu == 0)
                {
                    Main.menuMode = 0x15;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].shirtColor;
                }
                if (this.selectedMenu == 1)
                {
                    Main.menuMode = 0x16;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].underShirtColor;
                }
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 0x17;
                    PlaySound(10, -1, -1, 1);
                    this.selColor = loadPlayer[numLoadPlayers].pantsColor;
                }
                if (this.selectedMenu == 3)
                {
                    this.selColor = loadPlayer[numLoadPlayers].shoeColor;
                    Main.menuMode = 0x18;
                    PlaySound(10, -1, -1, 1);
                }
                strArray[0] = "Shirt";
                strArray[1] = "Undershirt";
                strArray[2] = "Pants";
                strArray[3] = "Misc";
                num3 = 260;
                num5 = 50;
                numArray[5] = 20;
                strArray[5] = "Back";
                num6 = 6;
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                if (this.selectedMenu == 5)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 2;
                }
            }
            else if (Main.menuMode == 0x11)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 390;
                num3 = 260;
                num5 = 60;
                loadPlayer[index].hairColor = this.selColor;
                num6 = 3;
                strArray[0] = "Hair " + (loadPlayer[index].hair + 1);
                strArray[1] = "Hair Color";
                flagArray[1] = true;
                numArray[2] = 150;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 0)
                {
                    PlaySound(12, -1, -1, 1);
                    Player player1 = loadPlayer[index];
                    player1.hair++;
                    if (loadPlayer[index].hair >= 0x11)
                    {
                        loadPlayer[index].hair = 0;
                    }
                }
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 2;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x12)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].eyeColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Eye Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 2;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x13)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].skinColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Skin Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 2;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x15)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].shirtColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Shirt Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 20;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x16)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].underShirtColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Undershirt Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 20;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x17)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].pantsColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Pants Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 20;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 0x18)
            {
                index = numLoadPlayers;
                num9 = (screenWidth / 2) - 0x10;
                num10 = 210;
                flag = true;
                num11 = 370;
                num3 = 240;
                num5 = 60;
                loadPlayer[index].shoeColor = this.selColor;
                num6 = 3;
                strArray[0] = "";
                strArray[1] = "Misc Color";
                flagArray[1] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 2)
                {
                    Main.menuMode = 20;
                    PlaySound(11, -1, -1, 1);
                }
            }
            else if (Main.menuMode == 3)
            {
                string name = loadPlayer[numLoadPlayers].name;
                loadPlayer[numLoadPlayers].name = GetInputText(loadPlayer[numLoadPlayers].name);
                if (loadPlayer[numLoadPlayers].name.Length > Player.nameLen)
                {
                    loadPlayer[numLoadPlayers].name = loadPlayer[numLoadPlayers].name.Substring(0, Player.nameLen);
                }
                if (name != loadPlayer[numLoadPlayers].name)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Enter Character Name:";
                flagArray2[2] = true;
                if (loadPlayer[numLoadPlayers].name != "")
                {
                    if (loadPlayer[numLoadPlayers].name.Substring(0, 1) == " ")
                    {
                        loadPlayer[numLoadPlayers].name = "";
                    }
                    for (int num15 = 0; num15 < loadPlayer[numLoadPlayers].name.Length; num15++)
                    {
                        if (loadPlayer[numLoadPlayers].name.Substring(num15, 1) != " ")
                        {
                            flagArray2[2] = false;
                        }
                    }
                }
                this.textBlinkerCount++;
                if (this.textBlinkerCount >= 20)
                {
                    if (this.textBlinkerState == 0)
                    {
                        this.textBlinkerState = 1;
                    }
                    else
                    {
                        this.textBlinkerState = 0;
                    }
                    this.textBlinkerCount = 0;
                }
                strArray[1] = loadPlayer[numLoadPlayers].name;
                if (this.textBlinkerState == 1)
                {
                    (strArray3 = strArray)[1] = strArray3[1] + "|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 2;
                }
                if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter))
                {
                    loadPlayer[numLoadPlayers].name.Trim();
                    loadPlayerPath[numLoadPlayers] = nextLoadPlayer();
                    Player.SavePlayer(loadPlayer[numLoadPlayers], loadPlayerPath[numLoadPlayers]);
                    LoadPlayers();
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 1;
                }
            }
            else if (Main.menuMode == 4)
            {
                num3 = 220;
                num5 = 60;
                strArray[5] = "Back";
                for (int num16 = 0; num16 < 5; num16++)
                {
                    if (num16 < numLoadPlayers)
                    {
                        strArray[num16] = loadPlayer[num16].name;
                        if (loadPlayer[num16].hardCore)
                        {
                            flagArray3[num16] = true;
                        }
                    }
                    else
                    {
                        strArray[num16] = null;
                    }
                }
                num6 = 6;
                if ((this.focusMenu >= 0) && (this.focusMenu < numLoadPlayers))
                {
                    index = this.focusMenu;
                    Vector2 vector2 = fontDeathText.MeasureString(strArray[index]);
                    num9 = (int) (((screenWidth / 2) + (vector2.X * 0.5)) + 10.0);
                    num10 = (num3 + (num5 * this.focusMenu)) + 4;
                }
                if (this.selectedMenu == 5)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 1;
                }
                else if (this.selectedMenu >= 0)
                {
                    this.selectedPlayer = this.selectedMenu;
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 5;
                }
            }
            else if (Main.menuMode == 5)
            {
                strArray[0] = "Delete " + loadPlayer[this.selectedPlayer].name + "?";
                flagArray[0] = true;
                strArray[1] = "Yes";
                strArray[2] = "No";
                num6 = 3;
                if (this.selectedMenu == 1)
                {
                    ErasePlayer(this.selectedPlayer);
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 1;
                }
                else if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 1;
                }
            }
            else if (Main.menuMode == 6)
            {
                num3 = 190;
                num5 = 50;
                strArray[5] = "Create World";
                strArray[6] = "Delete";
                if (numLoadWorlds == 5)
                {
                    flagArray2[5] = true;
                    strArray[5] = "";
                }
                else if (numLoadWorlds == 0)
                {
                    flagArray2[6] = true;
                    strArray[6] = "";
                }
                strArray[7] = "Back";
                for (int num17 = 0; num17 < 5; num17++)
                {
                    if (num17 < numLoadWorlds)
                    {
                        strArray[num17] = loadWorld[num17];
                    }
                    else
                    {
                        strArray[num17] = null;
                    }
                }
                num6 = 8;
                if (this.selectedMenu == 7)
                {
                    if (menuMultiplayer)
                    {
                        Main.menuMode = 12;
                    }
                    else
                    {
                        Main.menuMode = 1;
                    }
                    PlaySound(11, -1, -1, 1);
                }
                else if (this.selectedMenu == 5)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 0x10;
                    Main.newWorldName = "World " + (numLoadWorlds + 1);
                }
                else if (this.selectedMenu == 6)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 8;
                }
                else if (this.selectedMenu >= 0)
                {
                    if (menuMultiplayer)
                    {
                        PlaySound(10, -1, -1, 1);
                        worldPathName = loadWorldPath[this.selectedMenu];
                        Main.menuMode = 30;
                    }
                    else
                    {
                        PlaySound(10, -1, -1, 1);
                        worldPathName = loadWorldPath[this.selectedMenu];
                        WorldGen.playWorld();
                        Main.menuMode = 10;
                    }
                }
            }
            else if (Main.menuMode == 7)
            {
                string newWorldName = Main.newWorldName;
                Main.newWorldName = GetInputText(Main.newWorldName);
                if (Main.newWorldName.Length > 20)
                {
                    Main.newWorldName = Main.newWorldName.Substring(0, 20);
                }
                if (newWorldName != Main.newWorldName)
                {
                    PlaySound(12, -1, -1, 1);
                }
                strArray[0] = "Enter World Name:";
                flagArray2[2] = true;
                if (Main.newWorldName != "")
                {
                    if (Main.newWorldName.Substring(0, 1) == " ")
                    {
                        Main.newWorldName = "";
                    }
                    for (int num18 = 0; num18 < Main.newWorldName.Length; num18++)
                    {
                        if (Main.newWorldName != " ")
                        {
                            flagArray2[2] = false;
                        }
                    }
                }
                this.textBlinkerCount++;
                if (this.textBlinkerCount >= 20)
                {
                    if (this.textBlinkerState == 0)
                    {
                        this.textBlinkerState = 1;
                    }
                    else
                    {
                        this.textBlinkerState = 0;
                    }
                    this.textBlinkerCount = 0;
                }
                strArray[1] = Main.newWorldName;
                if (this.textBlinkerState == 1)
                {
                    (strArray3 = strArray)[1] = strArray3[1] + "|";
                    numArray2[1] = 1;
                }
                else
                {
                    (strArray3 = strArray)[1] = strArray3[1] + " ";
                }
                flagArray[0] = true;
                flagArray[1] = true;
                numArray[1] = -20;
                numArray[2] = 20;
                strArray[2] = "Accept";
                strArray[3] = "Back";
                num6 = 4;
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0x10;
                }
                if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter))
                {
                    Main.menuMode = 10;
                    worldName = Main.newWorldName;
                    worldPathName = nextLoadWorld();
                    WorldGen.CreateNewWorld();
                }
            }
            else if (Main.menuMode == 8)
            {
                num3 = 220;
                num5 = 60;
                strArray[5] = "Back";
                for (int num19 = 0; num19 < 5; num19++)
                {
                    if (num19 < numLoadWorlds)
                    {
                        strArray[num19] = loadWorld[num19];
                    }
                    else
                    {
                        strArray[num19] = null;
                    }
                }
                num6 = 6;
                if (this.selectedMenu == 5)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 1;
                }
                else if (this.selectedMenu >= 0)
                {
                    this.selectedWorld = this.selectedMenu;
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 9;
                }
            }
            else if (Main.menuMode == 9)
            {
                strArray[0] = "Delete " + loadWorld[this.selectedWorld] + "?";
                flagArray[0] = true;
                strArray[1] = "Yes";
                strArray[2] = "No";
                num6 = 3;
                if (this.selectedMenu == 1)
                {
                    EraseWorld(this.selectedWorld);
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 6;
                }
                else if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 6;
                }
            }
            else if (Main.menuMode == 0x457)
            {
                num5 = 60;
                numArray[4] = 10;
                num6 = 8;
                if (this.graphics.IsFullScreen)
                {
                    strArray[0] = "Go Windowed";
                }
                else
                {
                    strArray[0] = "Go Fullscreen";
                }
                this.bgScroll = (int) Math.Round((double) ((1f - caveParrallax) * 500f));
                strArray[1] = "Resolution";
                strArray[2] = "Parallax";
                if (fixedTiming)
                {
                    strArray[3] = "Frame Skip Off";
                }
                else
                {
                    strArray[3] = "Frame Skip On";
                }
                strArray[4] = "Back";
                if (this.selectedMenu == 4)
                {
                    PlaySound(11, -1, -1, 1);
                    this.SaveSettings();
                    Main.menuMode = 11;
                }
                if (this.selectedMenu == 3)
                {
                    PlaySound(12, -1, -1, 1);
                    if (fixedTiming)
                    {
                        fixedTiming = false;
                    }
                    else
                    {
                        fixedTiming = true;
                    }
                }
                if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0x1c;
                }
                if (this.selectedMenu == 1)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 0x6f;
                }
                if (this.selectedMenu == 0)
                {
                    this.graphics.ToggleFullScreen();
                }
            }
            else if (Main.menuMode == 11)
            {
                num3 = 190;
                num5 = 50;
                numArray[6] = 10;
                num6 = 8;
                strArray[0] = "Video";
                strArray[1] = "Cursor Color";
                strArray[2] = "Volume";
                strArray[3] = "Controls";
                if (autoSave)
                {
                    strArray[4] = "Autosave On";
                }
                else
                {
                    strArray[4] = "Autosave Off";
                }
                if (autoPause)
                {
                    strArray[5] = "Autopause On";
                }
                else
                {
                    strArray[5] = "Autopause Off";
                }
                strArray[6] = "Back";
                if (this.selectedMenu == 6)
                {
                    PlaySound(11, -1, -1, 1);
                    this.SaveSettings();
                    Main.menuMode = 0;
                }
                if (this.selectedMenu == 5)
                {
                    PlaySound(12, -1, -1, 1);
                    if (autoPause)
                    {
                        autoPause = false;
                    }
                    else
                    {
                        autoPause = true;
                    }
                }
                if (this.selectedMenu == 4)
                {
                    PlaySound(12, -1, -1, 1);
                    if (autoSave)
                    {
                        autoSave = false;
                    }
                    else
                    {
                        autoSave = true;
                    }
                }
                if (this.selectedMenu == 3)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0x1b;
                }
                if (this.selectedMenu == 2)
                {
                    PlaySound(11, -1, -1, 1);
                    Main.menuMode = 0x1a;
                }
                if (this.selectedMenu == 1)
                {
                    PlaySound(10, -1, -1, 1);
                    this.selColor = mouseColor;
                    Main.menuMode = 0x19;
                }
                if (this.selectedMenu == 0)
                {
                    PlaySound(10, -1, -1, 1);
                    Main.menuMode = 0x457;
                }
            }
            else if (Main.menuMode != 0x6f)
            {
                if (Main.menuMode == 0x19)
                {
                    flag = true;
                    num11 = 370;
                    num3 = 240;
                    num5 = 60;
                    mouseColor = this.selColor;
                    num6 = 3;
                    strArray[0] = "";
                    strArray[1] = "Cursor Color";
                    flagArray[1] = true;
                    numArray[2] = 170;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 11;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                else if (Main.menuMode == 0x1a)
                {
                    flag2 = true;
                    num3 = 240;
                    num5 = 60;
                    num6 = 3;
                    strArray[0] = "";
                    strArray[1] = "Volume";
                    flagArray[1] = true;
                    numArray[2] = 170;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 11;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                else if (Main.menuMode == 0x1c)
                {
                    caveParrallax = 1f - (((float) this.bgScroll) / 500f);
                    flag3 = true;
                    num3 = 240;
                    num5 = 60;
                    num6 = 3;
                    strArray[0] = "";
                    strArray[1] = "Parallax";
                    flagArray[1] = true;
                    numArray[2] = 170;
                    numArray[1] = 10;
                    strArray[2] = "Back";
                    if (this.selectedMenu == 2)
                    {
                        Main.menuMode = 0x457;
                        PlaySound(11, -1, -1, 1);
                    }
                }
                else if (Main.menuMode == 0x1b)
                {
                    num3 = 180;
                    num5 = 30;
                    num6 = 12;
                    string[] strArray2 = new string[] { cUp, cDown, cLeft, cRight, cJump, cThrowItem, cInv, cHeal, cMana, cBuff };
                    if (this.setKey >= 0)
                    {
                        strArray2[this.setKey] = "_";
                    }
                    strArray[0] = "Up             " + strArray2[0];
                    strArray[1] = "Down          " + strArray2[1];
                    strArray[2] = "Left            " + strArray2[2];
                    strArray[3] = "Right          " + strArray2[3];
                    strArray[4] = "Jump          " + strArray2[4];
                    strArray[5] = "Throw         " + strArray2[5];
                    strArray[6] = "Inventory      " + strArray2[6];
                    strArray[7] = "Quick Heal    " + strArray2[7];
                    strArray[8] = "Quick Mana   " + strArray2[8];
                    strArray[9] = "Quick Buff    " + strArray2[9];
                    for (int num22 = 0; num22 < 10; num22++)
                    {
                        flagArray4[num22] = true;
                        numArray3[num22] = 0.6f;
                        numArray2[num22] = -80;
                    }
                    numArray3[10] = 0.8f;
                    numArray3[11] = 0.8f;
                    numArray[10] = 10;
                    strArray[10] = "Reset to Default";
                    numArray[11] = 20;
                    strArray[11] = "Back";
                    if (this.selectedMenu == 11)
                    {
                        Main.menuMode = 11;
                        PlaySound(11, -1, -1, 1);
                    }
                    else if (this.selectedMenu == 10)
                    {
                        cUp = "W";
                        cDown = "S";
                        cLeft = "A";
                        cRight = "D";
                        cJump = "Space";
                        cThrowItem = "Q";
                        cInv = "Escape";
                        cHeal = "H";
                        cMana = "M";
                        cBuff = "B";
                        this.setKey = -1;
                        PlaySound(11, -1, -1, 1);
                    }
                    else if (this.selectedMenu >= 0)
                    {
                        this.setKey = this.selectedMenu;
                    }
                    if (this.setKey >= 0)
                    {
                        Keys[] pressedKeys = keyState.GetPressedKeys();
                        if (pressedKeys.Length > 0)
                        {
                            string str5 = pressedKeys[0].ToString();
                            if (this.setKey == 0)
                            {
                                cUp = str5;
                            }
                            if (this.setKey == 1)
                            {
                                cDown = str5;
                            }
                            if (this.setKey == 2)
                            {
                                cLeft = str5;
                            }
                            if (this.setKey == 3)
                            {
                                cRight = str5;
                            }
                            if (this.setKey == 4)
                            {
                                cJump = str5;
                            }
                            if (this.setKey == 5)
                            {
                                cThrowItem = str5;
                            }
                            if (this.setKey == 6)
                            {
                                cInv = str5;
                            }
                            if (this.setKey == 7)
                            {
                                cHeal = str5;
                            }
                            if (this.setKey == 8)
                            {
                                cMana = str5;
                            }
                            if (this.setKey == 9)
                            {
                                cBuff = str5;
                            }
                            this.setKey = -1;
                        }
                    }
                }
                else if (Main.menuMode == 12)
                {
                    menuServer = false;
                    strArray[0] = "Join";
                    strArray[1] = "Host & Play";
                    strArray[2] = "Back";
                    if (this.selectedMenu == 0)
                    {
                        LoadPlayers();
                        menuMultiplayer = true;
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 1;
                    }
                    else if (this.selectedMenu == 1)
                    {
                        LoadPlayers();
                        PlaySound(10, -1, -1, 1);
                        Main.menuMode = 1;
                        menuMultiplayer = true;
                        menuServer = true;
                    }
                    if (this.selectedMenu == 2)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 0;
                    }
                    num6 = 3;
                }
                else if (Main.menuMode == 13)
                {
                    string getIP = Main.getIP;
                    Main.getIP = GetInputText(Main.getIP);
                    if (getIP != Main.getIP)
                    {
                        PlaySound(12, -1, -1, 1);
                    }
                    strArray[0] = "Enter Server IP Address:";
                    flagArray2[2] = true;
                    if (Main.getIP != "")
                    {
                        if (Main.getIP.Substring(0, 1) == " ")
                        {
                            Main.getIP = "";
                        }
                        for (int num23 = 0; num23 < Main.getIP.Length; num23++)
                        {
                            if (Main.getIP != " ")
                            {
                                flagArray2[2] = false;
                            }
                        }
                    }
                    this.textBlinkerCount++;
                    if (this.textBlinkerCount >= 20)
                    {
                        if (this.textBlinkerState == 0)
                        {
                            this.textBlinkerState = 1;
                        }
                        else
                        {
                            this.textBlinkerState = 0;
                        }
                        this.textBlinkerCount = 0;
                    }
                    strArray[1] = Main.getIP;
                    if (this.textBlinkerState == 1)
                    {
                        (strArray3 = strArray)[1] = strArray3[1] + "|";
                        numArray2[1] = 1;
                    }
                    else
                    {
                        (strArray3 = strArray)[1] = strArray3[1] + " ";
                    }
                    flagArray[0] = true;
                    flagArray[1] = true;
                    numArray[1] = -20;
                    numArray[2] = 20;
                    strArray[2] = "Accept";
                    strArray[3] = "Back";
                    num6 = 4;
                    if (this.selectedMenu == 3)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 1;
                    }
                    if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter))
                    {
                        PlaySound(12, -1, -1, 1);
                        Main.menuMode = 0x83;
                    }
                }
                else if (Main.menuMode == 0x83)
                {
                    int num24 = 0x1e61;
                    string getPort = Main.getPort;
                    Main.getPort = GetInputText(Main.getPort);
                    if (getPort != Main.getPort)
                    {
                        PlaySound(12, -1, -1, 1);
                    }
                    strArray[0] = "Enter Server Port:";
                    flagArray2[2] = true;
                    if (Main.getPort != "")
                    {
                        bool flag5 = false;
                        try
                        {
                            num24 = Convert.ToInt32(Main.getPort);
                            if ((num24 > 0) && (num24 <= 0xffff))
                            {
                                flag5 = true;
                            }
                        }
                        catch
                        {
                        }
                        if (flag5)
                        {
                            flagArray2[2] = false;
                        }
                    }
                    this.textBlinkerCount++;
                    if (this.textBlinkerCount >= 20)
                    {
                        if (this.textBlinkerState == 0)
                        {
                            this.textBlinkerState = 1;
                        }
                        else
                        {
                            this.textBlinkerState = 0;
                        }
                        this.textBlinkerCount = 0;
                    }
                    strArray[1] = Main.getPort;
                    if (this.textBlinkerState == 1)
                    {
                        (strArray3 = strArray)[1] = strArray3[1] + "|";
                        numArray2[1] = 1;
                    }
                    else
                    {
                        (strArray3 = strArray)[1] = strArray3[1] + " ";
                    }
                    flagArray[0] = true;
                    flagArray[1] = true;
                    numArray[1] = -20;
                    numArray[2] = 20;
                    strArray[2] = "Accept";
                    strArray[3] = "Back";
                    num6 = 4;
                    if (this.selectedMenu == 3)
                    {
                        PlaySound(11, -1, -1, 1);
                        Main.menuMode = 1;
                    }
                    if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter))
                    {
                        Netplay.serverPort = num24;
                        autoPass = false;
                        if (Netplay.SetIP(Main.getIP))
                        {
                            Main.menuMode = 10;
                            Netplay.StartClient();
                        }
                        else if (Netplay.SetIP2(Main.getIP))
                        {
                            Main.menuMode = 10;
                            Netplay.StartClient();
                        }
                    }
                }
                else if (Main.menuMode == 0x10)
                {
                    num3 = 200;
                    num5 = 60;
                    numArray[1] = 30;
                    numArray[2] = 30;
                    numArray[3] = 30;
                    numArray[4] = 70;
                    strArray[0] = "Choose world size:";
                    flagArray[0] = true;
                    strArray[1] = "Small";
                    strArray[2] = "Medium";
                    strArray[3] = "Large";
                    strArray[4] = "Back";
                    num6 = 5;
                    if (this.selectedMenu == 4)
                    {
                        Main.menuMode = 6;
                        PlaySound(11, -1, -1, 1);
                    }
                    else if (this.selectedMenu > 0)
                    {
                        if (this.selectedMenu == 1)
                        {
                            maxTilesX = 0x1068;
                            maxTilesY = 0x4b0;
                        }
                        else if (this.selectedMenu == 2)
                        {
                            maxTilesX = 0x189c;
                            maxTilesY = 0x708;
                        }
                        else
                        {
                            maxTilesX = 0x20d0;
                            maxTilesY = 0x960;
                        }
                        Main.menuMode = 7;
                        PlaySound(10, -1, -1, 1);
                        WorldGen.setWorldSize();
                    }
                }
            }
            else
            {
                num3 = 240;
                num5 = 60;
                num6 = 3;
                strArray[0] = "Fullscreen Resolution";
                strArray[1] = this.graphics.PreferredBackBufferWidth + "x" + this.graphics.PreferredBackBufferHeight;
                flagArray[0] = true;
                numArray[2] = 170;
                numArray[1] = 10;
                strArray[2] = "Back";
                if (this.selectedMenu == 1)
                {
                    PlaySound(12, -1, -1, 1);
                    int num20 = 0;
                    for (int num21 = 0; num21 < this.numDisplayModes; num21++)
                    {
                        if ((this.displayWidth[num21] == this.graphics.PreferredBackBufferWidth) && (this.displayHeight[num21] == this.graphics.PreferredBackBufferHeight))
                        {
                            num20 = num21;
                            break;
                        }
                    }
                    num20++;
                    if (num20 >= this.numDisplayModes)
                    {
                        num20 = 0;
                    }
                    this.graphics.PreferredBackBufferWidth = this.displayWidth[num20];
                    this.graphics.PreferredBackBufferHeight = this.displayHeight[num20];
                }
                if (this.selectedMenu == 2)
                {
                    if (this.graphics.IsFullScreen)
                    {
                        this.graphics.ApplyChanges();
                    }
                    Main.menuMode = 0x457;
                    PlaySound(11, -1, -1, 1);
                }
            }
            if (Main.menuMode != menuMode)
            {
                num6 = 0;
                for (int num25 = 0; num25 < maxMenuItems; num25++)
                {
                    this.menuItemScale[num25] = 0.8f;
                }
            }
            int focusMenu = this.focusMenu;
            this.selectedMenu = -1;
            this.focusMenu = -1;
            for (int k = 0; k < num6; k++)
            {
                if (strArray[k] != null)
                {
                    if (flag)
                    {
                        string text = "";
                        for (int num28 = 0; num28 < 6; num28++)
                        {
                            int num29 = num11;
                            int num30 = (370 + (screenWidth / 2)) - 400;
                            switch (num28)
                            {
                                case 0:
                                    text = "Red:";
                                    break;

                                case 1:
                                    text = "Green:";
                                    num29 += 30;
                                    break;

                                case 2:
                                    text = "Blue:";
                                    num29 += 60;
                                    break;

                                case 3:
                                    text = this.selColor.R.ToString();
                                    num30 += 90;
                                    break;

                                case 4:
                                    text = this.selColor.G.ToString();
                                    num30 += 90;
                                    num29 += 30;
                                    break;

                                case 5:
                                    text = this.selColor.B.ToString();
                                    num30 += 90;
                                    num29 += 60;
                                    break;
                            }
                            for (int num31 = 0; num31 < 5; num31++)
                            {
                                Color black = Color.Black;
                                if (num31 == 4)
                                {
                                    black = color;
                                    black.R = (byte) ((0xff + black.R) / 2);
                                    black.G = (byte) ((0xff + black.R) / 2);
                                    black.B = (byte) ((0xff + black.R) / 2);
                                }
                                int num32 = 0xff;
                                int num33 = black.R - (0xff - num32);
                                if (num33 < 0)
                                {
                                    num33 = 0;
                                }
                                black = new Color((int) ((byte) num33), (int) ((byte) num33), (int) ((byte) num33), (int) ((byte) num32));
                                int num34 = 0;
                                int num35 = 0;
                                switch (num31)
                                {
                                    case 0:
                                        num34 = -2;
                                        break;

                                    case 1:
                                        num34 = 2;
                                        break;

                                    case 2:
                                        num35 = -2;
                                        break;

                                    case 3:
                                        num35 = 2;
                                        break;
                                }
                                vector9 = new Vector2();
                                this.spriteBatch.DrawString(fontDeathText, text, new Vector2((float) (num30 + num34), (float) (num29 + num35)), black, 0f, vector9, (float) 0.5f, SpriteEffects.None, 0f);
                            }
                        }
                        bool flag6 = false;
                        for (int num36 = 0; num36 < 2; num36++)
                        {
                            for (int num37 = 0; num37 < 3; num37++)
                            {
                                int num38 = (num11 + (num37 * 30)) - 12;
                                int num39 = (360 + (screenWidth / 2)) - 400;
                                float scale = 0.9f;
                                if (num36 == 0)
                                {
                                    num39 -= 70;
                                    num38 += 2;
                                }
                                else
                                {
                                    num39 -= 40;
                                }
                                text = "-";
                                if (num36 == 1)
                                {
                                    text = "+";
                                }
                                Vector2 vector3 = new Vector2(24f, 24f);
                                int num41 = 0x8e;
                                if (((mouseState.X > num39) && (mouseState.X < (num39 + vector3.X))) && ((mouseState.Y > (num38 + 13)) && (mouseState.Y < ((num38 + 13) + vector3.Y))))
                                {
                                    if (this.focusColor != ((num36 + 1) * (num37 + 10)))
                                    {
                                        PlaySound(12, -1, -1, 1);
                                    }
                                    this.focusColor = (num36 + 1) * (num37 + 10);
                                    flag6 = true;
                                    num41 = 0xff;
                                    if (mouseState.LeftButton == ButtonState.Pressed)
                                    {
                                        if (this.colorDelay <= 1)
                                        {
                                            if (this.colorDelay == 0)
                                            {
                                                this.colorDelay = 40;
                                            }
                                            else
                                            {
                                                this.colorDelay = 3;
                                            }
                                            int num42 = num36;
                                            if (num36 == 0)
                                            {
                                                num42 = -1;
                                                if (((this.selColor.R + this.selColor.G) + this.selColor.B) < 0xff)
                                                {
                                                    num42 = 0;
                                                }
                                            }
                                            if (((num37 == 0) && ((this.selColor.R + num42) >= 0)) && ((this.selColor.R + num42) <= 0xff))
                                            {
                                                this.selColor.R = (byte) (this.selColor.R + num42);
                                            }
                                            if (((num37 == 1) && ((this.selColor.G + num42) >= 0)) && ((this.selColor.G + num42) <= 0xff))
                                            {
                                                this.selColor.G = (byte) (this.selColor.G + num42);
                                            }
                                            if (((num37 == 2) && ((this.selColor.B + num42) >= 0)) && ((this.selColor.B + num42) <= 0xff))
                                            {
                                                this.selColor.B = (byte) (this.selColor.B + num42);
                                            }
                                        }
                                        this.colorDelay--;
                                    }
                                    else
                                    {
                                        this.colorDelay = 0;
                                    }
                                }
                                for (int num43 = 0; num43 < 5; num43++)
                                {
                                    Color color3 = Color.Black;
                                    if (num43 == 4)
                                    {
                                        color3 = color;
                                        color3.R = (byte) ((0xff + color3.R) / 2);
                                        color3.G = (byte) ((0xff + color3.R) / 2);
                                        color3.B = (byte) ((0xff + color3.R) / 2);
                                    }
                                    int num44 = color3.R - (0xff - num41);
                                    if (num44 < 0)
                                    {
                                        num44 = 0;
                                    }
                                    color3 = new Color((int) ((byte) num44), (int) ((byte) num44), (int) ((byte) num44), (int) ((byte) num41));
                                    int num45 = 0;
                                    int num46 = 0;
                                    switch (num43)
                                    {
                                        case 0:
                                            num45 = -2;
                                            break;

                                        case 1:
                                            num45 = 2;
                                            break;

                                        case 2:
                                            num46 = -2;
                                            break;

                                        case 3:
                                            num46 = 2;
                                            break;
                                    }
                                    vector9 = new Vector2();
                                    this.spriteBatch.DrawString(fontDeathText, text, new Vector2((float) (num39 + num45), (float) (num38 + num46)), color3, 0f, vector9, scale, SpriteEffects.None, 0f);
                                }
                            }
                        }
                        if (!flag6)
                        {
                            this.focusColor = 0;
                            this.colorDelay = 0;
                        }
                    }
                    if (flag3)
                    {
                        int num47 = 400;
                        string str9 = "";
                        for (int num48 = 0; num48 < 4; num48++)
                        {
                            int num49 = num47;
                            int num50 = (370 + (screenWidth / 2)) - 400;
                            if (num48 == 0)
                            {
                                str9 = "Parallax: " + this.bgScroll;
                            }
                            for (int num51 = 0; num51 < 5; num51++)
                            {
                                Color color4 = Color.Black;
                                if (num51 == 4)
                                {
                                    color4 = color;
                                    color4.R = (byte) ((0xff + color4.R) / 2);
                                    color4.G = (byte) ((0xff + color4.R) / 2);
                                    color4.B = (byte) ((0xff + color4.R) / 2);
                                }
                                int num52 = 0xff;
                                int num53 = color4.R - (0xff - num52);
                                if (num53 < 0)
                                {
                                    num53 = 0;
                                }
                                color4 = new Color((int) ((byte) num53), (int) ((byte) num53), (int) ((byte) num53), (int) ((byte) num52));
                                int num54 = 0;
                                int num55 = 0;
                                switch (num51)
                                {
                                    case 0:
                                        num54 = -2;
                                        break;

                                    case 1:
                                        num54 = 2;
                                        break;

                                    case 2:
                                        num55 = -2;
                                        break;

                                    case 3:
                                        num55 = 2;
                                        break;
                                }
                                vector9 = new Vector2();
                                this.spriteBatch.DrawString(fontDeathText, str9, new Vector2((float) (num50 + num54), (float) (num49 + num55)), color4, 0f, vector9, (float) 0.5f, SpriteEffects.None, 0f);
                            }
                        }
                        bool flag7 = false;
                        for (int num56 = 0; num56 < 2; num56++)
                        {
                            for (int num57 = 0; num57 < 1; num57++)
                            {
                                int num58 = (num47 + (num57 * 30)) - 12;
                                int num59 = (360 + (screenWidth / 2)) - 400;
                                float num60 = 0.9f;
                                if (num56 == 0)
                                {
                                    num59 -= 70;
                                    num58 += 2;
                                }
                                else
                                {
                                    num59 -= 40;
                                }
                                str9 = "-";
                                if (num56 == 1)
                                {
                                    str9 = "+";
                                }
                                Vector2 vector4 = new Vector2(24f, 24f);
                                int num61 = 0x8e;
                                if (((mouseState.X > num59) && (mouseState.X < (num59 + vector4.X))) && ((mouseState.Y > (num58 + 13)) && (mouseState.Y < ((num58 + 13) + vector4.Y))))
                                {
                                    if (this.focusColor != ((num56 + 1) * (num57 + 10)))
                                    {
                                        PlaySound(12, -1, -1, 1);
                                    }
                                    this.focusColor = (num56 + 1) * (num57 + 10);
                                    flag7 = true;
                                    num61 = 0xff;
                                    if (mouseState.LeftButton == ButtonState.Pressed)
                                    {
                                        if (this.colorDelay <= 1)
                                        {
                                            if (this.colorDelay == 0)
                                            {
                                                this.colorDelay = 40;
                                            }
                                            else
                                            {
                                                this.colorDelay = 3;
                                            }
                                            int num62 = num56;
                                            if (num56 == 0)
                                            {
                                                num62 = -1;
                                            }
                                            if (num57 == 0)
                                            {
                                                this.bgScroll += num62;
                                                if (this.bgScroll > 100)
                                                {
                                                    this.bgScroll = 100;
                                                }
                                                if (this.bgScroll < 0)
                                                {
                                                    this.bgScroll = 0;
                                                }
                                            }
                                        }
                                        this.colorDelay--;
                                    }
                                    else
                                    {
                                        this.colorDelay = 0;
                                    }
                                }
                                for (int num63 = 0; num63 < 5; num63++)
                                {
                                    Color color5 = Color.Black;
                                    if (num63 == 4)
                                    {
                                        color5 = color;
                                        color5.R = (byte) ((0xff + color5.R) / 2);
                                        color5.G = (byte) ((0xff + color5.R) / 2);
                                        color5.B = (byte) ((0xff + color5.R) / 2);
                                    }
                                    int num64 = color5.R - (0xff - num61);
                                    if (num64 < 0)
                                    {
                                        num64 = 0;
                                    }
                                    color5 = new Color((int) ((byte) num64), (int) ((byte) num64), (int) ((byte) num64), (int) ((byte) num61));
                                    int num65 = 0;
                                    int num66 = 0;
                                    switch (num63)
                                    {
                                        case 0:
                                            num65 = -2;
                                            break;

                                        case 1:
                                            num65 = 2;
                                            break;

                                        case 2:
                                            num66 = -2;
                                            break;

                                        case 3:
                                            num66 = 2;
                                            break;
                                    }
                                    vector9 = new Vector2();
                                    this.spriteBatch.DrawString(fontDeathText, str9, new Vector2((float) (num59 + num65), (float) (num58 + num66)), color5, 0f, vector9, num60, SpriteEffects.None, 0f);
                                }
                            }
                        }
                        if (!flag7)
                        {
                            this.focusColor = 0;
                            this.colorDelay = 0;
                        }
                    }
                    if (flag2)
                    {
                        int num67 = 400;
                        string str10 = "";
                        for (int num68 = 0; num68 < 4; num68++)
                        {
                            int recipeBatch = num67;
                            int num70 = (370 + (screenWidth / 2)) - 400;
                            switch (num68)
                            {
                                case 0:
                                    str10 = "Sound:";
                                    break;

                                case 1:
                                    str10 = "Music:";
                                    recipeBatch += 30;
                                    break;

                                case 2:
                                    str10 = Math.Round((double) (soundVolume * 100f)) + "%";
                                    num70 += 90;
                                    break;

                                case 3:
                                    str10 = Math.Round((double) (musicVolume * 100f)) + "%";
                                    num70 += 90;
                                    recipeBatch += 30;
                                    break;
                            }
                            for (int num71 = 0; num71 < 5; num71++)
                            {
                                Color color6 = Color.Black;
                                if (num71 == 4)
                                {
                                    color6 = color;
                                    color6.R = (byte) ((0xff + color6.R) / 2);
                                    color6.G = (byte) ((0xff + color6.R) / 2);
                                    color6.B = (byte) ((0xff + color6.R) / 2);
                                }
                                int num72 = 0xff;
                                int num73 = color6.R - (0xff - num72);
                                if (num73 < 0)
                                {
                                    num73 = 0;
                                }
                                color6 = new Color((int) ((byte) num73), (int) ((byte) num73), (int) ((byte) num73), (int) ((byte) num72));
                                int num74 = 0;
                                int num75 = 0;
                                switch (num71)
                                {
                                    case 0:
                                        num74 = -2;
                                        break;

                                    case 1:
                                        num74 = 2;
                                        break;

                                    case 2:
                                        num75 = -2;
                                        break;

                                    case 3:
                                        num75 = 2;
                                        break;
                                }
                                vector9 = new Vector2();
                                this.spriteBatch.DrawString(fontDeathText, str10, new Vector2((float) (num70 + num74), (float) (recipeBatch + num75)), color6, 0f, vector9, (float) 0.5f, SpriteEffects.None, 0f);
                            }
                        }
                        bool flag8 = false;
                        for (int num76 = 0; num76 < 2; num76++)
                        {
                            for (int num77 = 0; num77 < 2; num77++)
                            {
                                int num83;
                                int num78 = (num67 + (num77 * 30)) - 12;
                                int num79 = (360 + (screenWidth / 2)) - 400;
                                float num80 = 0.9f;
                                if (num76 == 0)
                                {
                                    num79 -= 70;
                                    num78 += 2;
                                }
                                else
                                {
                                    num79 -= 40;
                                }
                                str10 = "-";
                                if (num76 == 1)
                                {
                                    str10 = "+";
                                }
                                Vector2 vector5 = new Vector2(24f, 24f);
                                int num81 = 0x8e;
                                if (((mouseState.X <= num79) || (mouseState.X >= (num79 + vector5.X))) || ((mouseState.Y <= (num78 + 13)) || (mouseState.Y >= ((num78 + 13) + vector5.Y))))
                                {
                                    goto Label_3A2D;
                                }
                                if (this.focusColor != ((num76 + 1) * (num77 + 10)))
                                {
                                    PlaySound(12, -1, -1, 1);
                                }
                                this.focusColor = (num76 + 1) * (num77 + 10);
                                flag8 = true;
                                num81 = 0xff;
                                if (mouseState.LeftButton != ButtonState.Pressed)
                                {
                                    goto Label_3A26;
                                }
                                if (this.colorDelay <= 1)
                                {
                                    if (this.colorDelay == 0)
                                    {
                                        this.colorDelay = 40;
                                    }
                                    else
                                    {
                                        this.colorDelay = 3;
                                    }
                                    int num82 = num76;
                                    if (num76 == 0)
                                    {
                                        num82 = -1;
                                    }
                                    switch (num77)
                                    {
                                        case 0:
                                            soundVolume += num82 * 0.01f;
                                            if (soundVolume > 1f)
                                            {
                                                soundVolume = 1f;
                                            }
                                            if (soundVolume < 0f)
                                            {
                                                soundVolume = 0f;
                                            }
                                            break;

                                        case 1:
                                            musicVolume += num82 * 0.01f;
                                            if (musicVolume > 1f)
                                            {
                                                musicVolume = 1f;
                                            }
                                            if (musicVolume < 0f)
                                            {
                                                musicVolume = 0f;
                                            }
                                            goto Label_3A16;
                                    }
                                }
                            Label_3A16:
                                this.colorDelay--;
                                goto Label_3A2D;
                            Label_3A26:
                                this.colorDelay = 0;
                            Label_3A2D:
                                num83 = 0;
                                while (num83 < 5)
                                {
                                    Color color7 = Color.Black;
                                    if (num83 == 4)
                                    {
                                        color7 = color;
                                        color7.R = (byte) ((0xff + color7.R) / 2);
                                        color7.G = (byte) ((0xff + color7.R) / 2);
                                        color7.B = (byte) ((0xff + color7.R) / 2);
                                    }
                                    int num84 = color7.R - (0xff - num81);
                                    if (num84 < 0)
                                    {
                                        num84 = 0;
                                    }
                                    color7 = new Color((int) ((byte) num84), (int) ((byte) num84), (int) ((byte) num84), (int) ((byte) num81));
                                    int num85 = 0;
                                    int num86 = 0;
                                    switch (num83)
                                    {
                                        case 0:
                                            num85 = -2;
                                            break;

                                        case 1:
                                            num85 = 2;
                                            break;

                                        case 2:
                                            num86 = -2;
                                            break;

                                        case 3:
                                            num86 = 2;
                                            break;
                                    }
                                    vector9 = new Vector2();
                                    this.spriteBatch.DrawString(fontDeathText, str10, new Vector2((float) (num79 + num85), (float) (num78 + num86)), color7, 0f, vector9, num80, SpriteEffects.None, 0f);
                                    num83++;
                                }
                            }
                        }
                        if (!flag8)
                        {
                            this.focusColor = 0;
                            this.colorDelay = 0;
                        }
                    }
                    for (int num87 = 0; num87 < 5; num87++)
                    {
                        Color hcColor = Color.Black;
                        if (num87 == 4)
                        {
                            hcColor = color;
                            if (flagArray3[k])
                            {
                                hcColor = Main.hcColor;
                            }
                            hcColor.R = (byte) ((0xff + hcColor.R) / 2);
                            hcColor.G = (byte) ((0xff + hcColor.G) / 2);
                            hcColor.B = (byte) ((0xff + hcColor.B) / 2);
                        }
                        int num88 = (int) (255f * ((this.menuItemScale[k] * 2f) - 1f));
                        if (flagArray[k])
                        {
                            num88 = 0xff;
                        }
                        int num89 = hcColor.R - (0xff - num88);
                        if (num89 < 0)
                        {
                            num89 = 0;
                        }
                        int num90 = hcColor.G - (0xff - num88);
                        if (num90 < 0)
                        {
                            num90 = 0;
                        }
                        int num91 = hcColor.B - (0xff - num88);
                        if (num91 < 0)
                        {
                            num91 = 0;
                        }
                        hcColor = new Color((int) ((byte) num89), (int) ((byte) num90), (int) ((byte) num91), (int) ((byte) num88));
                        int num92 = 0;
                        int num93 = 0;
                        switch (num87)
                        {
                            case 0:
                                num92 = -2;
                                break;

                            case 1:
                                num92 = 2;
                                break;

                            case 2:
                                num93 = -2;
                                break;

                            case 3:
                                num93 = 2;
                                break;
                        }
                        Vector2 origin = fontDeathText.MeasureString(strArray[k]);
                        origin.X *= 0.5f;
                        origin.Y *= 0.5f;
                        float num94 = this.menuItemScale[k];
                        if ((Main.menuMode == 15) && (k == 0))
                        {
                            num94 *= 0.35f;
                        }
                        else if (netMode == 2)
                        {
                            num94 *= 0.5f;
                        }
                        num94 *= numArray3[k];
                        if (!flagArray4[k])
                        {
                            this.spriteBatch.DrawString(fontDeathText, strArray[k], new Vector2((float) ((num4 + num92) + numArray2[k]), (((num3 + (num5 * k)) + num93) + (origin.Y * numArray3[k])) + numArray[k]), hcColor, 0f, origin, num94, SpriteEffects.None, 0f);
                        }
                        else
                        {
                            this.spriteBatch.DrawString(fontDeathText, strArray[k], new Vector2((float) ((num4 + num92) + numArray2[k]), (((num3 + (num5 * k)) + num93) + (origin.Y * numArray3[k])) + numArray[k]), hcColor, 0f, new Vector2(0f, origin.Y), num94, SpriteEffects.None, 0f);
                        }
                    }
                    if (!flagArray4[k])
                    {
                        if ((((mouseState.X > ((num4 - ((strArray[k].Length * 10) * numArray3[k])) + numArray2[k])) && (mouseState.X < ((num4 + ((strArray[k].Length * 10) * numArray3[k])) + numArray2[k]))) && ((mouseState.Y > ((num3 + (num5 * k)) + numArray[k])) && (mouseState.Y < (((num3 + (num5 * k)) + numArray[k]) + (50f * numArray3[k]))))) && hasFocus)
                        {
                            this.focusMenu = k;
                            if (flagArray[k] || flagArray2[k])
                            {
                                this.focusMenu = -1;
                            }
                            else
                            {
                                if (focusMenu != this.focusMenu)
                                {
                                    PlaySound(12, -1, -1, 1);
                                }
                                if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed))
                                {
                                    this.selectedMenu = k;
                                }
                            }
                        }
                    }
                    else if ((((mouseState.X > (num4 + numArray2[k])) && (mouseState.X < ((num4 + ((strArray[k].Length * 20) * numArray3[k])) + numArray2[k]))) && ((mouseState.Y > ((num3 + (num5 * k)) + numArray[k])) && (mouseState.Y < (((num3 + (num5 * k)) + numArray[k]) + (50f * numArray3[k]))))) && hasFocus)
                    {
                        this.focusMenu = k;
                        if (flagArray[k] || flagArray2[k])
                        {
                            this.focusMenu = -1;
                        }
                        else
                        {
                            if (focusMenu != this.focusMenu)
                            {
                                PlaySound(12, -1, -1, 1);
                            }
                            if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed))
                            {
                                this.selectedMenu = k;
                            }
                        }
                    }
                }
            }
            for (int m = 0; m < maxMenuItems; m++)
            {
                if (m == this.focusMenu)
                {
                    if (this.menuItemScale[m] < 1f)
                    {
                        this.menuItemScale[m] += 0.02f;
                    }
                    if (this.menuItemScale[m] > 1f)
                    {
                        this.menuItemScale[m] = 1f;
                    }
                }
                else if (this.menuItemScale[m] > 0.8)
                {
                    this.menuItemScale[m] -= 0.02f;
                }
            }
            if (index >= 0)
            {
                loadPlayer[index].PlayerFrame();
                loadPlayer[index].position.X = num9 + screenPosition.X;
                loadPlayer[index].position.Y = num10 + screenPosition.Y;
                this.DrawPlayer(loadPlayer[index]);
            }
            for (int n = 0; n < 5; n++)
            {
                Color color9 = Color.Black;
                if (n == 4)
                {
                    color9 = color;
                    color9.R = (byte) ((0xff + color9.R) / 2);
                    color9.G = (byte) ((0xff + color9.R) / 2);
                    color9.B = (byte) ((0xff + color9.R) / 2);
                }
                color9.A = (byte) (color9.A * 0.3f);
                int num97 = 0;
                int num98 = 0;
                switch (n)
                {
                    case 0:
                        num97 = -2;
                        break;

                    case 1:
                        num97 = 2;
                        break;

                    case 2:
                        num98 = -2;
                        break;

                    case 3:
                        num98 = 2;
                        break;
                }
                string str11 = "Copyright \x00a9 2011 Re-Logic";
                Vector2 vector7 = fontMouseText.MeasureString(str11);
                vector7.X *= 0.5f;
                vector7.Y *= 0.5f;
                this.spriteBatch.DrawString(fontMouseText, str11, new Vector2(((screenWidth - vector7.X) + num97) - 10f, ((screenHeight - vector7.Y) + num98) - 2f), color9, 0f, vector7, (float) 1f, SpriteEffects.None, 0f);
            }
            for (int num99 = 0; num99 < 5; num99++)
            {
                Color color10 = Color.Black;
                if (num99 == 4)
                {
                    color10 = color;
                    color10.R = (byte) ((0xff + color10.R) / 2);
                    color10.G = (byte) ((0xff + color10.R) / 2);
                    color10.B = (byte) ((0xff + color10.R) / 2);
                }
                color10.A = (byte) (color10.A * 0.3f);
                int num100 = 0;
                int num101 = 0;
                switch (num99)
                {
                    case 0:
                        num100 = -2;
                        break;

                    case 1:
                        num100 = 2;
                        break;

                    case 2:
                        num101 = -2;
                        break;

                    case 3:
                        num101 = 2;
                        break;
                }
                Vector2 vector8 = fontMouseText.MeasureString(versionNumber);
                vector8.X *= 0.5f;
                vector8.Y *= 0.5f;
                this.spriteBatch.DrawString(fontMouseText, versionNumber, new Vector2((vector8.X + num100) + 10f, ((screenHeight - vector8.Y) + num101) - 2f), color10, 0f, vector8, (float) 1f, SpriteEffects.None, 0f);
            }
            vector9 = new Vector2();
            this.spriteBatch.Draw(cursorTexture, new Vector2((float) (mouseState.X + 1), (float) (mouseState.Y + 1)), new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height), new Color((int) (cursorColor.R * 0.2f), (int) (cursorColor.G * 0.2f), (int) (cursorColor.B * 0.2f), (int) (cursorColor.A * 0.5f)), 0f, vector9, (float) (cursorScale * 1.1f), SpriteEffects.None, 0f);
            this.spriteBatch.Draw(cursorTexture, new Vector2((float) mouseState.X, (float) mouseState.Y), new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height), cursorColor, 0f, new Vector2(), cursorScale, SpriteEffects.None, 0f);
            if (fadeCounter > 0)
            {
                Color white = Color.White;
                byte num102 = 0;
                fadeCounter--;
                float num103 = (((float) fadeCounter) / 75f) * 255f;
                num102 = (byte) num103;
                white = new Color((int) num102, (int) num102, (int) num102, (int) num102);
                this.spriteBatch.Draw(fadeTexture, new Rectangle(0, 0, screenWidth, screenHeight), white);
            }
            this.spriteBatch.End();
            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                mouseLeftRelease = false;
            }
            else
            {
                mouseLeftRelease = true;
            }
            if (mouseState.RightButton == ButtonState.Pressed)
            {
                mouseRightRelease = false;
            }
            else
            {
                mouseRightRelease = true;
            }
        }
コード例 #9
0
ファイル: Main.cs プロジェクト: skylerdavidson/tkj-mod
 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);
     }
 }