From 72cfe38931c4d9dbcce52b7d01675819fbb8d09e Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Sun, 20 Jun 2021 16:20:18 +0200 Subject: [PATCH] Fixed Indicators being rendered at a wrong location when in the mirror dimension --- main.lua | 33 +++++++++++++++++++++++++++++++-- metadata.xml | 2 +- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/main.lua b/main.lua index fc8c1c55..50a036e1 100644 --- a/main.lua +++ b/main.lua @@ -359,7 +359,26 @@ function EID:printBulletPoints(description, renderPos) end end end +--------------------------------------------------------------------------- +---------------------------Handle New Room-------------------------------- +local function IsMirror() + local lvl = game:GetLevel() + for i=0,168 do + local data = lvl:GetRoomByIdx(i).Data + if data and data.Name == 'Knife Piece Room' then + return true + end + end + return false +end +local isMirrorRoom = false +function EID:onNewRoom() + if game:GetLevel():GetAbsoluteStage() == LevelStage.STAGE1_2 then + isMirrorRoom = IsMirror() + end +end +EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom) --------------------------------------------------------------------------- ---------------------------Handle Rendering-------------------------------- @@ -374,11 +393,16 @@ function EID:renderIndicator(entity) return end local repDiv = 1 + local entityPos = Isaac.WorldToScreen(entity.Position) + local sprite = entity:GetSprite() if REPENTANCE then repDiv = 255 + if isMirrorRoom then + local screenCenter = EID:GetScreenSize()/2 + entityPos.X = entityPos.X - (entityPos-screenCenter).X * 2 + sprite.FlipX = true + end end - local sprite = entity:GetSprite() - local entityPos = Isaac.WorldToScreen(entity.Position) if EID.Config["Indicator"] == "blink" then local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40)) sprite.Color = Color(1, 1, 1, 1, c/repDiv, c/repDiv, c/repDiv) @@ -409,6 +433,11 @@ function EID:renderIndicator(entity) end ArrowSprite:Render(Isaac.WorldToScreen(entity.Position + ArrowOffset), nullVector, nullVector) end + if REPENTANCE then + if isMirrorRoom then + sprite.FlipX = false + end + end end function EID:renderHUDLocationIndicators() diff --git a/metadata.xml b/metadata.xml index 6f76f461..69e0c032 100644 --- a/metadata.xml +++ b/metadata.xml @@ -90,7 +90,7 @@ https://moddingofisaac.com/mod/1079/external-item-descriptions - Jake for the sweet [b]German[/b] language pack - [url=https://steamcommunity.com/id/whytefang/]adc[/url] for creating an awesome new Languagepack and providing ideas for new functionalities - 3.62 + 3.64 Public