diff --git a/src/main/kotlin/funnymap/config/Config.kt b/src/main/kotlin/funnymap/config/Config.kt index b87eacd..334ebd1 100755 --- a/src/main/kotlin/funnymap/config/Config.kt +++ b/src/main/kotlin/funnymap/config/Config.kt @@ -294,7 +294,7 @@ object Config : Vigilant(File("./config/funnymap/config.toml"), "Funny Map", sor description = "Adds room checkmarks based on room state.", category = "Rooms", subcategory = "Checkmarks", - options = ["None", "Default", "NEU"] + options = ["None", "Default", "NEU", "Legacy"] ) var mapCheckmark = 1 diff --git a/src/main/kotlin/funnymap/features/dungeon/MapRender.kt b/src/main/kotlin/funnymap/features/dungeon/MapRender.kt index 0b0680f..74a506d 100755 --- a/src/main/kotlin/funnymap/features/dungeon/MapRender.kt +++ b/src/main/kotlin/funnymap/features/dungeon/MapRender.kt @@ -14,19 +14,10 @@ import funnymap.utils.RenderUtils.grayScale import funnymap.utils.Utils.equalsOneOf import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager -import net.minecraft.util.ResourceLocation import org.lwjgl.opengl.GL11 import java.awt.Color object MapRender { - - private val neuGreen = ResourceLocation("funnymap", "neu/green_check.png") - private val neuWhite = ResourceLocation("funnymap", "neu/white_check.png") - private val neuCross = ResourceLocation("funnymap", "neu/cross.png") - private val defaultGreen = ResourceLocation("funnymap", "default/green_check.png") - private val defaultWhite = ResourceLocation("funnymap", "default/white_check.png") - private val defaultCross = ResourceLocation("funnymap", "default/cross.png") - var dynamicRotation = 0f var legitPeek = false @@ -129,7 +120,7 @@ object MapRender { var color = tile.color - if (tile.state.equalsOneOf(RoomState.UNDISCOVERED, RoomState.UNOPENED)) { + if (tile.state.equalsOneOf(RoomState.UNDISCOVERED, RoomState.UNOPENED) && !legitRender) { if (Config.mapDarkenUndiscovered) { color = color.darken(1 - Config.mapDarkenPercent) } @@ -147,6 +138,10 @@ object MapRender { mapRoomSize, color ) + + if (legitRender && tile.state == RoomState.UNOPENED) { + RenderUtils.drawCheckmark(xOffset.toFloat(), yOffset.toFloat(), tile.state) + } } !xEven && !yEven -> { @@ -173,10 +168,6 @@ object MapRender { GlStateManager.translate(MapUtils.startCorner.first.toFloat(), MapUtils.startCorner.second.toFloat(), 0f) val connectorSize = mapRoomSize shr 2 - val checkmarkSize = when (Config.mapCheckmark) { - 1 -> 8.0 // default - else -> 10.0 // neu - } Dungeon.Info.uniqueRooms.forEach { unique -> val room = unique.mainRoom @@ -189,20 +180,7 @@ object MapRender { val yOffsetName = (namePos.second / 2f) * (mapRoomSize + connectorSize) if (Config.mapCheckmark != 0 && Config.mapRoomSecrets != 2) { - getCheckmark(room.state, Config.mapCheckmark)?.let { - - GlStateManager.enableAlpha() - GlStateManager.color(255f, 255f, 255f, 255f) - mc.textureManager.bindTexture(it) - - RenderUtils.drawTexturedQuad( - xOffsetCheck + (mapRoomSize - checkmarkSize) / 2, - yOffsetCheck + (mapRoomSize - checkmarkSize) / 2, - checkmarkSize, - checkmarkSize - ) - GlStateManager.disableAlpha() - } + RenderUtils.drawCheckmark(xOffsetCheck, yOffsetCheck, room.state) } val color = if (Config.mapColorText) when (room.state) { @@ -246,26 +224,6 @@ object MapRender { GlStateManager.popMatrix() } - private fun getCheckmark(state: RoomState, type: Int): ResourceLocation? { - return when (type) { - 1 -> when (state) { - RoomState.CLEARED -> defaultWhite - RoomState.GREEN -> defaultGreen - RoomState.FAILED -> defaultCross - else -> null - } - - 2 -> when (state) { - RoomState.CLEARED -> neuWhite - RoomState.GREEN -> neuGreen - RoomState.FAILED -> neuCross - else -> null - } - - else -> null - } - } - private fun renderPlayerHeads() { try { if (Dungeon.dungeonTeammates.isEmpty()) { diff --git a/src/main/kotlin/funnymap/utils/CheckmarkSet.kt b/src/main/kotlin/funnymap/utils/CheckmarkSet.kt new file mode 100644 index 0000000..fd4b7a5 --- /dev/null +++ b/src/main/kotlin/funnymap/utils/CheckmarkSet.kt @@ -0,0 +1,22 @@ +package funnymap.utils + +import funnymap.core.map.RoomState +import funnymap.features.dungeon.MapRender +import net.minecraft.util.ResourceLocation + +class CheckmarkSet(val size: Int, location: String) { + private val crossResource = ResourceLocation("funnymap", "$location/cross.png") + private val greenResource = ResourceLocation("funnymap", "$location/green_check.png") + private val questionResource = ResourceLocation("funnymap", "$location/question.png") + private val whiteResource = ResourceLocation("funnymap", "$location/white_check.png") + + fun getCheckmark(state: RoomState): ResourceLocation? { + return when (state) { + RoomState.CLEARED -> whiteResource + RoomState.GREEN -> greenResource + RoomState.FAILED -> crossResource + RoomState.UNOPENED -> if (MapRender.legitRender) questionResource else null + else -> null + } + } +} diff --git a/src/main/kotlin/funnymap/utils/RenderUtils.kt b/src/main/kotlin/funnymap/utils/RenderUtils.kt index 8128f7f..e527832 100644 --- a/src/main/kotlin/funnymap/utils/RenderUtils.kt +++ b/src/main/kotlin/funnymap/utils/RenderUtils.kt @@ -3,6 +3,7 @@ package funnymap.utils import funnymap.FunnyMap.mc import funnymap.config.Config import funnymap.core.DungeonPlayer +import funnymap.core.map.RoomState import funnymap.features.dungeon.DungeonScan import funnymap.features.dungeon.MapRender import funnymap.utils.Utils.equalsOneOf @@ -26,6 +27,9 @@ object RenderUtils { private val tessellator: Tessellator = Tessellator.getInstance() private val worldRenderer: WorldRenderer = tessellator.worldRenderer + private val neuCheckmarks = CheckmarkSet(10, "neu") + private val defaultCheckmarks = CheckmarkSet(16, "default") + private val legacyCheckmarks = CheckmarkSet(8, "legacy") private val mapIcons = ResourceLocation("funnymap", "marker.png") private fun preDraw() { @@ -50,7 +54,7 @@ object RenderUtils { worldRenderer.pos(x, y, 0.0).endVertex() } - fun drawTexturedQuad(x: Double, y: Double, width: Double, height: Double) { + private fun drawTexturedQuad(x: Double, y: Double, width: Double, height: Double) { worldRenderer.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX) worldRenderer.pos(x, y + height, 0.0).tex(0.0, 1.0).endVertex() worldRenderer.pos(x + width, y + height, 0.0).tex(1.0, 1.0).endVertex() @@ -133,6 +137,28 @@ object RenderUtils { GlStateManager.popMatrix() } + fun drawCheckmark(x: Float, y: Float, state: RoomState) { + val (checkmark, size) = when (Config.mapCheckmark) { + 1 -> defaultCheckmarks.getCheckmark(state) to defaultCheckmarks.size.toDouble() + 2 -> neuCheckmarks.getCheckmark(state) to neuCheckmarks.size.toDouble() + 3 -> legacyCheckmarks.getCheckmark(state) to legacyCheckmarks.size.toDouble() + else -> return + } + if (checkmark != null) { + GlStateManager.enableAlpha() + GlStateManager.color(1f, 1f, 1f, 1f) + mc.textureManager.bindTexture(checkmark) + + drawTexturedQuad( + x + (MapUtils.mapRoomSize - size) / 2, + y + (MapUtils.mapRoomSize - size) / 2, + size, + size + ) + GlStateManager.disableAlpha() + } + } + fun drawPlayerHead(name: String, player: DungeonPlayer) { GlStateManager.pushMatrix() try { diff --git a/src/main/resources/assets/funnymap/default/cross.png b/src/main/resources/assets/funnymap/default/cross.png index 9de3c92..5099d32 100644 Binary files a/src/main/resources/assets/funnymap/default/cross.png and b/src/main/resources/assets/funnymap/default/cross.png differ diff --git a/src/main/resources/assets/funnymap/default/green_check.png b/src/main/resources/assets/funnymap/default/green_check.png index e2e2e05..a17ca5a 100644 Binary files a/src/main/resources/assets/funnymap/default/green_check.png and b/src/main/resources/assets/funnymap/default/green_check.png differ diff --git a/src/main/resources/assets/funnymap/default/question.png b/src/main/resources/assets/funnymap/default/question.png new file mode 100644 index 0000000..f9278b0 Binary files /dev/null and b/src/main/resources/assets/funnymap/default/question.png differ diff --git a/src/main/resources/assets/funnymap/default/white_check.png b/src/main/resources/assets/funnymap/default/white_check.png index 8030f92..8aa2f15 100644 Binary files a/src/main/resources/assets/funnymap/default/white_check.png and b/src/main/resources/assets/funnymap/default/white_check.png differ diff --git a/src/main/resources/assets/funnymap/legacy/cross.png b/src/main/resources/assets/funnymap/legacy/cross.png new file mode 100644 index 0000000..9de3c92 Binary files /dev/null and b/src/main/resources/assets/funnymap/legacy/cross.png differ diff --git a/src/main/resources/assets/funnymap/legacy/green_check.png b/src/main/resources/assets/funnymap/legacy/green_check.png new file mode 100644 index 0000000..e2e2e05 Binary files /dev/null and b/src/main/resources/assets/funnymap/legacy/green_check.png differ diff --git a/src/main/resources/assets/funnymap/legacy/question.png b/src/main/resources/assets/funnymap/legacy/question.png new file mode 100644 index 0000000..0d1a4f5 Binary files /dev/null and b/src/main/resources/assets/funnymap/legacy/question.png differ diff --git a/src/main/resources/assets/funnymap/legacy/white_check.png b/src/main/resources/assets/funnymap/legacy/white_check.png new file mode 100644 index 0000000..8030f92 Binary files /dev/null and b/src/main/resources/assets/funnymap/legacy/white_check.png differ diff --git a/src/main/resources/assets/funnymap/neu/question.png b/src/main/resources/assets/funnymap/neu/question.png new file mode 100644 index 0000000..79c4c10 Binary files /dev/null and b/src/main/resources/assets/funnymap/neu/question.png differ