diff --git a/src/main/kotlin/Rs2MapEditor.kt b/src/main/kotlin/Rs2MapEditor.kt index 9e0a156..12d88eb 100644 --- a/src/main/kotlin/Rs2MapEditor.kt +++ b/src/main/kotlin/Rs2MapEditor.kt @@ -154,9 +154,7 @@ object Rs2MapEditor { val fluDef = underlayMap[underlayID] val floDef = overlayMap[overlayID] - if (underlayID == 0) { - mapCell.background = Color(overlayMap[overlayID + 1]!!.color) - } else if (overlayID == 0) { + if (overlayID == 0) { mapCell.background = fluDef!!.getRGB() } else if (floDef!!.blendColor != -1) { mapCell.background = Color(floDef.blendColor) @@ -380,20 +378,60 @@ object Rs2MapEditor { override fun paintComponent(g: Graphics) { super.paintComponent(g) + var pointX1 = 0 + var pointY1 = 0 + var pointX2 = 0 + var pointY2 = 0 + val color = g.color + val rotationOdd = scenery.rotation % 2 != 0 when(scenery.type){ 10 -> g.drawOval(5,5,this.width - 10, this.height - 10) + 4 ->{ + val offSetX = if(!rotationOdd) (scenery.rotation * 0.375 * width).toInt() else (0.35 * width).toInt() + val offSetY = if(!rotationOdd) (0.65 * height).toInt() else (scenery.rotation * 0.375 * height).toInt() + g.drawString("=", offSetX, offSetY) + } 11 -> { - val color = g.color g.color = Color(255,255,255,75) g.drawString("⛝",(0.25 * width).toInt(),(0.75 * height).toInt()) g.color = color } 22 -> { - val color = g.color g.color = Color(255,255,255,55) g.drawString("⛆",(0.15 * width).toInt(),(0.65 * height).toInt()) g.color = color } + 0,5 -> { + if(scenery.id == 85) return + when(scenery.rotation){ + 0 -> {pointX1 = 2; pointY1 = this.height; pointX2 = 2; pointY2 = 0} + 1 -> {pointX1 = 0; pointY1 = 2; pointX2 = this.width; pointY2 = 2} + 2 -> {pointX1 = this.width - 2; pointY1 = 0; pointX2 = this.width - 2; pointY2 = this.height} + 3 -> {pointX1 = 0; pointY1 = this.height - 2; pointX2 = this.width; pointY2 = this.height - 2} + } + if(scenery.definition.interactive == 1){ + g.color = Color.RED + } + g.drawLine(pointX1, pointY1, pointX2, pointY2) + g.color = color + } + + 2 -> { + val nPoints = 4 + var xArray: IntArray = intArrayOf(0,0,0,0) + var yArray: IntArray = intArrayOf(0,0,0,0) + when(scenery.rotation){ + 0 -> {xArray = intArrayOf(2,2,2,this.width); yArray = intArrayOf(2,this.height,2,2)} + 1 -> {xArray = intArrayOf(0, this.width, this.width - 2, this.width - 2); yArray = intArrayOf(2, 2, 2, this.height)} + 2 -> {xArray = intArrayOf(0, this.width, this.width, this.width); yArray = intArrayOf(this.height - 2, this.height - 2, 0, this.height - 2)} + 3 -> {xArray = intArrayOf(0, 0, 0, this.width); intArrayOf(0, this.height - 2, this.height - 2, this.height - 2)} + } + if(scenery.definition.interactive == 1){ + g.color = Color.RED + } + g.drawPolyline(xArray, yArray, nPoints) + g.color = color + } } } } diff --git a/src/main/kotlin/cacheops/cache/definition/data/ObjectDefinition.kt b/src/main/kotlin/cacheops/cache/definition/data/ObjectDefinition.kt index 73509c4..c237620 100644 --- a/src/main/kotlin/cacheops/cache/definition/data/ObjectDefinition.kt +++ b/src/main/kotlin/cacheops/cache/definition/data/ObjectDefinition.kt @@ -59,7 +59,7 @@ data class ObjectDefinition( var anInt3008: Int = -1, var anInt3038: Int = -1, var anInt3013: Int = -1, - var anInt2958: Int = 0, + var mapSceneRotation: Int = 0, var mapscene: Int = -1, var culling: Int = -1, var anInt3024: Int = 255, @@ -171,7 +171,7 @@ data class ObjectDefinition( if (anInt3008 != other.anInt3008) return false if (anInt3038 != other.anInt3038) return false if (anInt3013 != other.anInt3013) return false - if (anInt2958 != other.anInt2958) return false + if (mapSceneRotation != other.mapSceneRotation) return false if (mapscene != other.mapscene) return false if (culling != other.culling) return false if (anInt3024 != other.anInt3024) return false @@ -263,7 +263,7 @@ data class ObjectDefinition( result = 31 * result + anInt3008 result = 31 * result + anInt3038 result = 31 * result + anInt3013 - result = 31 * result + anInt2958 + result = 31 * result + mapSceneRotation result = 31 * result + mapscene result = 31 * result + culling result = 31 * result + anInt3024 diff --git a/src/main/kotlin/cacheops/cache/definition/decoder/ObjectDecoder.kt b/src/main/kotlin/cacheops/cache/definition/decoder/ObjectDecoder.kt index 7fceb6b..b24536d 100644 --- a/src/main/kotlin/cacheops/cache/definition/decoder/ObjectDecoder.kt +++ b/src/main/kotlin/cacheops/cache/definition/decoder/ObjectDecoder.kt @@ -3,7 +3,6 @@ package cacheops.cache.definition.decoder import cacheops.cache.Cache import cacheops.cache.DefinitionDecoder import cacheops.cache.buffer.read.Reader -import cacheops.cache.definition.data.NPCDefinition import cacheops.cache.definition.data.ObjectDefinition import const.Indices @@ -185,7 +184,7 @@ open class ObjectDecoder(cache: Cache, val member: Boolean, val configReplace: B anInt3038 = buffer.readUnsignedByte() anInt3013 = buffer.readUnsignedShort() } - 101 -> anInt2958 = buffer.readUnsignedByte() + 101 -> mapSceneRotation = buffer.readUnsignedByte() 102 -> mapscene = buffer.readUnsignedShort() 103 -> culling = 0 104 -> anInt3024 = buffer.readUnsignedByte()