Skip to content

Commit d475e78

Browse files
WeylonSantanapandinocoder
authored andcommitted
using cached variables
1 parent 26163a4 commit d475e78

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

Intersect.Editor/Core/Graphics.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,14 +1344,16 @@ bool alternate
13441344
return;
13451345
}
13461346

1347+
var mapWidth = Options.Instance.Map.MapWidth;
1348+
var mapHeight = Options.Instance.Map.MapHeight;
13471349
var x1 = 0;
1348-
var x2 = Options.Instance.Map.MapWidth;
1350+
var x2 = mapWidth;
13491351
var y1 = 0;
1350-
var y2 = Options.Instance.Map.MapHeight;
1352+
var y2 = mapHeight;
13511353
var tileWidth = Options.Instance.Map.TileWidth;
13521354
var tileHeight = Options.Instance.Map.TileHeight;
1353-
var xoffset = CurrentView.Left + gridX * tileWidth * Options.Instance.Map.MapWidth;
1354-
var yoffset = CurrentView.Top + gridY * Options.Instance.Map.TileHeight * Options.Instance.Map.MapHeight;
1355+
var xoffset = CurrentView.Left + gridX * tileWidth * mapWidth;
1356+
var yoffset = CurrentView.Top + gridY * tileHeight * mapHeight;
13551357

13561358
if (screenShotting)
13571359
{
@@ -1405,7 +1407,7 @@ bool alternate
14051407
}
14061408

14071409
float xpos = x * tileWidth + xoffset;
1408-
float ypos = y * Options.Instance.Map.TileHeight + yoffset;
1410+
float ypos = y * tileHeight + yoffset;
14091411

14101412
// we have the graphic, now lets build based on type
14111413
switch (resourceGraphic.TextureType)
@@ -1421,9 +1423,9 @@ bool alternate
14211423
continue;
14221424
}
14231425

1424-
if (texture.Height > Options.Instance.Map.TileHeight)
1426+
if (texture.Height > tileHeight)
14251427
{
1426-
ypos -= texture.Height - Options.Instance.Map.TileHeight;
1428+
ypos -= texture.Height - tileHeight;
14271429
}
14281430

14291431
if (texture.Width > tileWidth)
@@ -1455,9 +1457,9 @@ bool alternate
14551457
continue;
14561458
}
14571459

1458-
if ((resourceGraphic.Height + 1) * Options.Instance.Map.TileHeight > Options.Instance.Map.TileHeight)
1460+
if ((resourceGraphic.Height + 1) * tileHeight > tileHeight)
14591461
{
1460-
ypos -= (resourceGraphic.Height + 1) * Options.Instance.Map.TileHeight - Options.Instance.Map.TileHeight;
1462+
ypos -= (resourceGraphic.Height + 1) * tileHeight - tileHeight;
14611463
}
14621464

14631465
if ((resourceGraphic.Width + 1) * tileWidth > tileWidth)
@@ -1470,9 +1472,9 @@ bool alternate
14701472
xpos,
14711473
ypos,
14721474
resourceGraphic.X * tileWidth,
1473-
resourceGraphic.Y * Options.Instance.Map.TileHeight,
1475+
resourceGraphic.Y * tileHeight,
14741476
(resourceGraphic.Width + 1) * tileWidth,
1475-
(resourceGraphic.Height + 1) * Options.Instance.Map.TileHeight,
1477+
(resourceGraphic.Height + 1) * tileHeight,
14761478
renderTarget
14771479
);
14781480
}
@@ -1486,7 +1488,7 @@ bool alternate
14861488
}
14871489

14881490
xpos += tileWidth / 2f;
1489-
ypos += Options.Instance.Map.TileHeight / 2f;
1491+
ypos += tileHeight / 2f;
14901492

14911493
var animationInstance = tmpMap.GetAttributeAnimation(tmpMap.Attributes[x, y], animation.Id);
14921494

@@ -1525,7 +1527,7 @@ bool alternate
15251527
if (animation != null)
15261528
{
15271529
float xpos = x * tileWidth + xoffset + tileWidth / 2;
1528-
float ypos = y * Options.Instance.Map.TileHeight + yoffset + Options.Instance.Map.TileHeight / 2;
1530+
float ypos = y * tileHeight + yoffset + tileHeight / 2;
15291531
if (tmpMap.Attributes[x, y] != null)
15301532
{
15311533
var animInstance = tmpMap.GetAttributeAnimation(tmpMap.Attributes[x, y], animation.Id);

0 commit comments

Comments
 (0)