public unsafe void DrawDust(WorldView drawView) { fixed(Dust *ptr = dust) { Dust * ptr2 = ptr; Vector2 pivot = new Vector2(4f, 4f); Vector2 pos = default(Vector2); for (int num = size - 1; num >= 0; num--) { if (ptr2->active != 0) { int num2 = (int)ptr2->position.X; int num3 = (int)ptr2->position.Y; if (view != null || drawView.clipArea.Contains(num2, num3)) { Color newColor = (!ptr2->noLight && ptr2->type != 6 && ptr2->type != 15 && (ptr2->type < 59 || ptr2->type > 64)) ? drawView.lighting.GetColor(num2 + 4 >> 4, num3 + 4 >> 4) : Color.White; ptr2->GetAlpha(ref newColor); if (newColor.PackedValue == 0) { ptr2->active = 0; } else { pos.X = num2 - drawView.screenPosition.X; pos.Y = num3 - drawView.screenPosition.Y; SpriteSheet <_sheetSprites> .Draw(218, ref pos, ref ptr2->frame, newColor, ptr2->rotation, ref pivot, ptr2->scale); if (ptr2->color.PackedValue != 0) { ptr2->GetColor(ref newColor); SpriteSheet <_sheetSprites> .Draw(218, ref pos, ref ptr2->frame, newColor, ptr2->rotation, ref pivot, ptr2->scale); } } } } ptr2++; } } }
public static void Draw(WorldView view) { Rectangle rect = default(Rectangle); rect.X = (view.viewWidth >> 1) - 190; rect.Y = 210; rect.Width = 380; rect.Height = 168; Main.DrawRect(451, rect, 64); Color c = Color.White; int num = (view.viewWidth >> 1) - 100; int num2 = 230; bool flag = UI.main.CanPlayOnline(); if (cursorY == 0) { view.ui.DrawInventoryCursor(num, num2, 1.0); } else { c = (flag ? Color.White : new Color(128, 128, 128, 255)); SpriteSheet <_sheetSprites> .Draw(451, num, num2, c); } if (UI.main.isOnline) { SpriteSheet <_sheetSprites> .Draw(202, num + 10, num2 + 10, c); } UI.DrawStringLC(UI.fontSmall, Lang.menu[6], num + 60, num2 + 26, c); num2 += 64; if (cursorY == 1) { view.ui.DrawInventoryCursor(num, num2, 1.0); } else { c = ((flag && UI.main.isOnline) ? Color.White : new Color(128, 128, 128, 255)); SpriteSheet <_sheetSprites> .Draw(451, num, num2, c); } if (UI.main.isInviteOnly) { SpriteSheet <_sheetSprites> .Draw(202, num + 10, num2 + 10, c); } UI.DrawStringLC(UI.fontSmall, Lang.menu[7], num + 60, num2 + 26, c); string text = (WorldSelect.WorldName() != null) ? Lang.menu[10] : Lang.menu[11]; float num3 = 1f; if (cursorY != 2) { c = new Color(240, 240, 240, 240); } else { num3 *= 1f + UI.cursorAlpha * 0.1f; c = new Color(UI.cursorColor.A, UI.cursorColor.A, 100, 255); } Vector2 pivot = UI.MeasureString(UI.fontBig, text); pivot.X *= 0.5f; pivot.Y *= 0.5f; UI.DrawStringScaled(pos: new Vector2(view.viewWidth >> 1, 454f), font: UI.fontBig, s: text, c: c, pivot: pivot, scale: num3); }
public void DrawMap(WorldView view) { int num = view.SAFE_AREA_OFFSET_L + ((UI.numActiveViews > 1) ? 340 : 290); int sAFE_AREA_OFFSET_T = view.SAFE_AREA_OFFSET_T; mapDestH = (short)(540 - view.SAFE_AREA_OFFSET_T - view.SAFE_AREA_OFFSET_B - 36); int num2 = view.viewWidth - view.SAFE_AREA_OFFSET_R - num; if (!isThreadDone) { Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, view.screenProjection); SpriteSheet <_sheetSprites> .Draw(1012, num + (num2 >> 1), sAFE_AREA_OFFSET_T + (mapDestH >> 1), Color.White, (float)((double)Main.frameCounter * (Math.PI / 30.0)), 1f); return; } alpha += 16; if (alpha > 255) { alpha = 255; } int num3 = num + (num2 >> 1); int num4 = sAFE_AREA_OFFSET_T + (mapDestH >> 1); Matrix view2 = Matrix.CreateTranslation(-num3, -num4, 0f) * Matrix.CreateScale(mapScale, mapScale, 1f) * Matrix.CreateTranslation(num3, num4, 0f); view.screenProjection.View = view2; Rectangle scissorRectangle = default(Rectangle); if (view.isFullScreen()) { scissorRectangle.X = num; scissorRectangle.Y = sAFE_AREA_OFFSET_T; scissorRectangle.Width = num2; scissorRectangle.Height = mapDestH; } else { scissorRectangle.X = (num >> 1) + view.activeViewport.X; scissorRectangle.Y = (sAFE_AREA_OFFSET_T >> 1) + view.activeViewport.Y; scissorRectangle.Width = num2 >> 1; scissorRectangle.Height = mapDestH >> 1; } WorldView.graphicsDevice.ScissorRectangle = scissorRectangle; Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, WorldView.scissorTest, view.screenProjection); int num5 = mapX / texWidth; int num6 = (mapX + num2 - 1) / texWidth; if (num6 >= mapTexture.Length) { num6 = mapTexture.Length - 1; } Vector2 position = new Vector2(num, sAFE_AREA_OFFSET_T); Rectangle rectangle = default(Rectangle); rectangle.X = mapX - num5 * texWidth; rectangle.Y = mapY; rectangle.Width = Math.Min(num2, texWidth - rectangle.X); rectangle.Height = mapDestH; Color color = new Color(alpha, alpha, alpha, alpha); for (int i = num5; i <= num6; i++) { Main.spriteBatch.Draw(mapTexture[i], position, rectangle, color); position.X += rectangle.Width; rectangle.X = 0; rectangle.Width = texWidth; } switch (Main.magmaBGFrame) { case 0: rectangle.X = 659; rectangle.Y = 10; break; case 1: rectangle.X = 659; rectangle.Y = 0; break; default: rectangle.X = 759; rectangle.Y = 10; break; } rectangle.Width = 10; rectangle.Height = 10; for (int num7 = 195; num7 >= 0; num7--) { NPC nPC = Main.npc[num7]; if (nPC.active != 0) { int num8 = nPC.aabb.X >> 4; int num9 = nPC.aabb.Y >> 4; if (num8 >= 0 && num9 >= 0 && num8 < Main.maxTilesX && num9 < Main.maxTilesY && (Main.tile[num8, num9].flags & Tile.Flags.VISITED) == Tile.Flags.VISITED) { num8 -= 34 + mapX; if (num8 >= 0 && num8 + 4 < num2) { num9 -= 34 + mapY; if (num9 >= 0 && num9 + 4 < mapDestH) { int headTextureId = nPC.getHeadTextureId(); if (headTextureId < 0) { color = new Color(106, 0, 66, 127); color.R = (byte)(color.R * UI.cursorColor.A >> 8); color.G = (byte)(color.G * UI.cursorColor.A >> 8); color.B = (byte)(color.B * UI.cursorColor.A >> 8); color.A = (byte)(color.A * UI.cursorColor.A >> 8); SpriteSheet <_sheetSprites> .DrawCentered(218, num + num8, sAFE_AREA_OFFSET_T + num9, rectangle, color); } else { SpriteSheet <_sheetSprites> .DrawScaled(1255 + headTextureId, num + num8, sAFE_AREA_OFFSET_T + num9, 0.5f, new Color(248, 248, 248, 248), (nPC.spriteDirection >= 0)?SpriteEffects.FlipHorizontally : SpriteEffects.None); } } } } } } Main.spriteBatch.End(); Matrix world = view.screenProjection.World; float num10 = (float)(0.6875 + 0.0625 * Math.Sin((double)Main.frameCounter * 0.083333333333333329)); view2 = Matrix.CreateTranslation(-10f, -8f, 0f) * Matrix.CreateScale(num10, num10, 1f); for (int num11 = 7; num11 >= 0; num11--) { Player player = Main.player[num11]; if (player.active != 0 && !player.dead) { int num12 = player.aabb.X >> 4; int num13 = player.aabb.Y >> 4; if ((Main.tile[num12, num13].flags & Tile.Flags.VISITED) != 0) { num12 -= 34 + mapX; num13 -= 34 + mapY; Vector2 position2 = player.position; player.position.X = view.screenPosition.X; player.position.Y = view.screenPosition.Y; view.screenProjection.World = view2 * Matrix.CreateTranslation(num + num12, sAFE_AREA_OFFSET_T + num13, 0f); Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, WorldView.scissorTest, view.screenProjection); player.Draw(view, isMenu: true, isIcon: true); Main.spriteBatch.End(); player.position = position2; player.aabb.X = (int)position2.X; player.aabb.Y = (int)position2.Y; } } } view.screenProjection.World = world; view.screenProjection.View = Matrix.Identity; Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, view.screenProjection); }