Advertisement
Guest User

map draw layer

a guest
Jan 23rd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.47 KB | None | 0 0
  1.  public void Draw(int layer = 0)
  2.         {
  3.             if (this._reRenderMap)
  4.             {
  5.                 this.MapRendered = false;
  6.                 this.ReleaseRenderTextures();
  7.                 this._preRenderLayer = 0;
  8.                 this._preRenderStage = 0;
  9.                 this._reRenderMap = false;
  10.             }
  11.             if (layer == 0)
  12.             {
  13.                 this.DrawPanorama();
  14.             }
  15.             if (!this.MapRendered)
  16.             {
  17.                 if (Globals.Database.RenderCaching)
  18.                 {
  19.                     return;
  20.                 }
  21.                 switch (layer)
  22.                 {
  23.                     case 0:
  24.                     {
  25.                         for (int i = 0; i < 3; i++)
  26.                         {
  27.                             this.DrawMapLayer(null, i, Globals.AnimFrame, this.GetX(), this.GetY());
  28.                         }
  29.                         break;
  30.                     }
  31.                     case 1:
  32.                     {
  33.                         this.DrawMapLayer(null, 3, Globals.AnimFrame, this.GetX(), this.GetY());
  34.                         break;
  35.                     }
  36.                     case 2:
  37.                     {
  38.                         this.DrawMapLayer(null, 4, Globals.AnimFrame, this.GetX(), this.GetY());
  39.                         break;
  40.                     }
  41.                 }
  42.             }
  43.             else if (layer == 0)
  44.             {
  45.                 GameGraphics.DrawGameTexture(this.LowerTextures[Globals.AnimFrame], this.GetX(), this.GetY(), null, GameBlendModes.None, null, 0f);
  46.             }
  47.             else if (layer != 1)
  48.             {
  49.                 GameGraphics.DrawGameTexture(this.PeakTextures[Globals.AnimFrame], this.GetX(), this.GetY(), null, GameBlendModes.None, null, 0f);
  50.             }
  51.             else
  52.             {
  53.                 GameGraphics.DrawGameTexture(this.UpperTextures[Globals.AnimFrame], this.GetX(), this.GetY(), null, GameBlendModes.None, null, 0f);
  54.             }
  55.             if (layer == 0)
  56.             {
  57.                 foreach (KeyValuePair<int, MapItemInstance> item in this.MapItems)
  58.                 {
  59.                     ItemBase itemBase = ItemBase.GetItem(item.Value.ItemNum);
  60.                     if (itemBase != null)
  61.                     {
  62.                         GameTexture itemTex = Globals.ContentManager.GetTexture(GameContentManager.TextureType.Item, itemBase.Pic);
  63.                         if (itemTex != null)
  64.                         {
  65.                             GameGraphics.DrawGameTexture(itemTex, this.GetX() + (float)(item.Value.X * Options.TileWidth), this.GetY() + (float)(item.Value.Y * Options.TileHeight), null, GameBlendModes.None, null, 0f);
  66.                         }
  67.                     }
  68.                 }
  69.                 foreach (LightBase light in base.Lights)
  70.                 {
  71.                     double w = (double)light.Size;
  72.                     float x = this.GetX() + (float)(light.TileX * Options.TileWidth + light.OffsetX) + (float)Options.TileWidth / 2f;
  73.                     float y = this.GetY() + (float)(light.TileY * Options.TileHeight + light.OffsetY) + (float)Options.TileHeight / 2f;
  74.                     GameGraphics.AddLight((int)x, (int)y, (int)w, light.Intensity, light.Expand, light.Color);
  75.                 }
  76.                 this.UpdateMapAttributes();
  77.             }
  78.             if (layer == 2)
  79.             {
  80.                 this.DrawFog();
  81.                 this.DrawOverlayGraphic();
  82.             }
  83.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement