Skip to content

Commit

Permalink
Adjust overlay draw offsets to match the games
Browse files Browse the repository at this point in the history
  • Loading branch information
ZivDero committed Jan 25, 2025
1 parent 1453679 commit 394f459
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/TSMapEditor/Models/Overlay.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace TSMapEditor.Models
using TSMapEditor.Models.Enums;

namespace TSMapEditor.Models
{
public class Overlay : GameObject
{
Expand Down Expand Up @@ -26,13 +28,23 @@ public override int GetShadowFrameIndex(int frameCount)

public override int GetYDrawOffset()
{
// Vanilla draws Veinhole monsters separately, not as overlays, and with an offset I can't make sense of.
if (OverlayType.IsVeinholeMonster)
return Constants.CellSizeY * -2;
return Constants.IsRA2YR ? -58 : -49;

int offset = 0;

// These are hardcoded and the same between TS and YR, so seemingly unrelated to the cell size.
if (OverlayType.Tiberium || OverlayType.Wall || OverlayType.IsVeins || OverlayType.Crate)
return Constants.CellSizeY / -2;
offset -= 12;

if (OverlayType.Land == LandType.Railroad)
offset -= 1;

if (OverlayType.IsVeins)
offset -= 1;

return 0;
return offset;
}
}
}

0 comments on commit 394f459

Please sign in to comment.