Remove byte[] allocations for GasTileOverlaySystem.UpdateChunkTile (#12617)

This commit is contained in:
DrSmugleaf
2022-11-16 08:27:49 +01:00
committed by GitHub
parent 0350f635d1
commit f92f288047
4 changed files with 62 additions and 47 deletions

View File

@@ -166,7 +166,7 @@ namespace Content.Client.Atmos.Overlays
while (enumerator.MoveNext(out var gas))
{
if (gas.Value.Opacity == null)
if (gas.Opacity == null!)
continue;
var tilePosition = chunk.Origin + (enumerator.X, enumerator.Y);
@@ -175,7 +175,7 @@ namespace Content.Client.Atmos.Overlays
for (var i = 0; i < _gasCount; i++)
{
var opacity = gas.Value.Opacity[i];
var opacity = gas.Opacity[i];
if (opacity > 0)
drawHandle.DrawTexture(_frames[i][_frameCounter[i]], tilePosition, Color.White.WithAlpha(opacity));
}
@@ -190,14 +190,14 @@ namespace Content.Client.Atmos.Overlays
while (enumerator.MoveNext(out var gas))
{
if (gas.Value.FireState == 0)
if (gas.FireState == 0)
continue;
var index = chunk.Origin + (enumerator.X, enumerator.Y);
if (!localBounds.Contains(index))
continue;
var state = gas.Value.FireState - 1;
var state = gas.FireState - 1;
var texture = _fireFrames[state][_fireFrameCounter[state]];
drawHandle.DrawTexture(texture, index);
}