Skip to content

Commit cefee34

Browse files
refactor: Reuse already computed values on CataclysmicMap
1 parent 33f99f8 commit cefee34

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/cataclysmicmap/core/CataclysmicMapElement.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ object CataclysmicMapElement : GuiElement(name = "Dungeon Map", x = 0, y = 0) {
166166
if (CataclysmicMapConfig.mapRoomSecrets == 2 && hasSecrets) {
167167
GlStateManager.pushMatrix()
168168
GlStateManager.translate(
169-
xOffsetCheck + (MapUtils.mapRoomSize shr 1).toFloat(),
170-
yOffsetCheck + 2 + (MapUtils.mapRoomSize shr 1).toFloat(),
169+
xOffsetCheck + DungeonMapColorParser.halfRoom.toFloat(),
170+
yOffsetCheck + 2 + DungeonMapColorParser.halfRoom.toFloat(),
171171
0f
172172
)
173173
GlStateManager.scale(2f, 2f, 1f)

src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/cataclysmicmap/handlers/DungeonMapColorParser.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ object DungeonMapColorParser {
8181
val index = arrayY * 11 + arrayX
8282
val cached = cachedTiles.getOrElse(index) { return Unknown(0, 0) }
8383
if (cached == null) {
84-
val xPos = DungeonScanner.startX + arrayX * (DungeonScanner.roomSize shr 1)
85-
val zPos = DungeonScanner.startZ + arrayY * (DungeonScanner.roomSize shr 1)
84+
val xPos = DungeonScanner.startX + arrayX * halfRoom
85+
val zPos = DungeonScanner.startZ + arrayY * halfRoom
8686
cachedTiles[index] = scanTile(arrayX, arrayY, xPos, zPos)
8787
}
8888
return cachedTiles[index] ?: Unknown(0, 0)

src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/cataclysmicmap/handlers/DungeonScanner.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ object DungeonScanner {
5858
for (x in 0..10) {
5959
for (z in 0..10) {
6060
// Translates the grid index into world position.
61-
val xPos = startX + x * (roomSize shr 1)
62-
val zPos = startZ + z * (roomSize shr 1)
61+
val xPos = startX + x * DungeonMapColorParser.halfRoom
62+
val zPos = startZ + z * DungeonMapColorParser.halfRoom
6363

6464
if (!mc.theWorld.getChunkFromChunkCoords(xPos shr 4, zPos shr 4).isLoaded) {
6565
// The room being scanned has not been loaded in.

0 commit comments

Comments
 (0)