A RuneTek3 client (377) that is deobfuscated, converted to Kotlin, and includes QoL improvements.
0

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'worktree-kotlin-data-holders' into 'master'

Convert scene/tile, renderable, and media data holders to Kotlin (Phase 4)

See merge request high-level-alchemy/client!4

+679 -787
-12
src/main/java/com/jagex/runescape/media/VertexNormal.java
··· 1 - package com.jagex.runescape.media; 2 - 3 - public class VertexNormal { 4 - 5 - public VertexNormal() { 6 - } 7 - 8 - public int x; 9 - public int y; 10 - public int z; 11 - public int magnitude; 12 - }
+8
src/main/java/com/jagex/runescape/media/VertexNormal.kt
··· 1 + package com.jagex.runescape.media 2 + 3 + class VertexNormal { 4 + @JvmField var x: Int = 0 5 + @JvmField var y: Int = 0 6 + @JvmField var z: Int = 0 7 + @JvmField var magnitude: Int = 0 8 + }
-79
src/main/java/com/jagex/runescape/media/renderable/GameAnimableObject.java
··· 1 - package com.jagex.runescape.media.renderable; 2 - 3 - import com.jagex.runescape.cache.media.SpotAnimation; 4 - import com.jagex.runescape.media.Animation; 5 - 6 - public class GameAnimableObject extends Renderable { 7 - 8 - public int plane; 9 - public int x; 10 - public int y; 11 - public int z; 12 - public boolean transformCompleted = false; 13 - public int eclapsedFrames; 14 - public int duration; 15 - public SpotAnimation animation; 16 - public int loopCycle; 17 - 18 - 19 - public GameAnimableObject(int plane, int loopCycle, int loopCycleOffset, int animationIndex, int z, int y, int x) { 20 - this.animation = SpotAnimation.cache[animationIndex]; 21 - this.plane = plane; 22 - this.x = x; 23 - this.y = y; 24 - this.z = z; 25 - this.loopCycle = loopCycle + loopCycleOffset; 26 - this.transformCompleted = false; 27 - } 28 - 29 - public void nextFrame(int frame) { 30 - duration += frame; 31 - while (duration > animation.sequences.getFrameLength(eclapsedFrames)) { 32 - duration -= animation.sequences.getFrameLength(eclapsedFrames); 33 - eclapsedFrames++; 34 - if (eclapsedFrames >= animation.sequences.frameCount 35 - && (eclapsedFrames < 0 || eclapsedFrames >= animation.sequences.frameCount)) { 36 - eclapsedFrames = 0; 37 - transformCompleted = true; 38 - } 39 - } 40 - } 41 - 42 - 43 - @Override 44 - public Model getRotatedModel() { 45 - Model model = animation.getModel(); 46 - if (model == null) 47 - return null; 48 - int frame = animation.sequences.getPrimaryFrame[eclapsedFrames]; 49 - Model animatedModel = new Model(true, 50 - model, Animation.exists(frame)); 51 - if (!transformCompleted) { 52 - animatedModel.createBones(); 53 - animatedModel.applyTransform(frame); 54 - animatedModel.triangleSkin = null; 55 - animatedModel.vectorSkin = null; 56 - } 57 - if (animation.resizeXY != 128 || animation.resizeZ != 128) 58 - animatedModel.scaleT(animation.resizeZ, animation.resizeXY, 9, 59 - animation.resizeXY); 60 - if (animation.rotation != 0) { 61 - if (animation.rotation == 90) 62 - animatedModel.rotate90Degrees(); 63 - if (animation.rotation == 180) { 64 - animatedModel.rotate90Degrees(); 65 - animatedModel.rotate90Degrees(); 66 - } 67 - if (animation.rotation == 270) { 68 - animatedModel.rotate90Degrees(); 69 - animatedModel.rotate90Degrees(); 70 - animatedModel.rotate90Degrees(); 71 - } 72 - } 73 - animatedModel.applyLighting(64 + animation.modelLightFalloff, 850 + animation.modelLightAmbient, -30, -50, -30, 74 - true); 75 - return animatedModel; 76 - } 77 - 78 - 79 - }
+64
src/main/java/com/jagex/runescape/media/renderable/GameAnimableObject.kt
··· 1 + package com.jagex.runescape.media.renderable 2 + 3 + import com.jagex.runescape.cache.media.SpotAnimation 4 + import com.jagex.runescape.media.Animation 5 + 6 + class GameAnimableObject( 7 + @JvmField var plane: Int, 8 + loopCycle: Int, 9 + loopCycleOffset: Int, 10 + animationIndex: Int, 11 + @JvmField var z: Int, 12 + @JvmField var y: Int, 13 + @JvmField var x: Int 14 + ) : Renderable() { 15 + @JvmField var transformCompleted: Boolean = false 16 + @JvmField var eclapsedFrames: Int = 0 17 + @JvmField var duration: Int = 0 18 + @JvmField var animation: SpotAnimation = SpotAnimation.cache!![animationIndex]!! 19 + @JvmField var loopCycle: Int = loopCycle + loopCycleOffset 20 + 21 + fun nextFrame(frame: Int) { 22 + val seq = animation.sequences!! 23 + duration += frame 24 + while (duration > seq.getFrameLength(eclapsedFrames)) { 25 + duration -= seq.getFrameLength(eclapsedFrames) 26 + eclapsedFrames++ 27 + if (eclapsedFrames >= seq.frameCount 28 + && (eclapsedFrames < 0 || eclapsedFrames >= seq.frameCount) 29 + ) { 30 + eclapsedFrames = 0 31 + transformCompleted = true 32 + } 33 + } 34 + } 35 + 36 + override fun getRotatedModel(): Model? { 37 + val model = animation.getModel() ?: return null 38 + val seq = animation.sequences!! 39 + val frame = seq.getPrimaryFrame!![eclapsedFrames] 40 + val animatedModel = Model(true, model, Animation.exists(frame)) 41 + if (!transformCompleted) { 42 + animatedModel.createBones() 43 + animatedModel.applyTransform(frame) 44 + animatedModel.triangleSkin = null 45 + animatedModel.vectorSkin = null 46 + } 47 + if (animation.resizeXY != 128 || animation.resizeZ != 128) 48 + animatedModel.scaleT(animation.resizeZ, animation.resizeXY, 9, animation.resizeXY) 49 + if (animation.rotation != 0) { 50 + if (animation.rotation == 90) animatedModel.rotate90Degrees() 51 + if (animation.rotation == 180) { 52 + animatedModel.rotate90Degrees() 53 + animatedModel.rotate90Degrees() 54 + } 55 + if (animation.rotation == 270) { 56 + animatedModel.rotate90Degrees() 57 + animatedModel.rotate90Degrees() 58 + animatedModel.rotate90Degrees() 59 + } 60 + } 61 + animatedModel.applyLighting(64 + animation.modelLightFalloff, 850 + animation.modelLightAmbient, -30, -50, -30, true) 62 + return animatedModel 63 + } 64 + }
-103
src/main/java/com/jagex/runescape/media/renderable/GameObject.java
··· 1 - package com.jagex.runescape.media.renderable; 2 - 3 - import com.jagex.runescape.*; 4 - import com.jagex.runescape.cache.cfg.Varbit; 5 - import com.jagex.runescape.cache.def.GameObjectDefinition; 6 - import com.jagex.runescape.cache.media.AnimationSequence; 7 - 8 - public class GameObject extends Renderable { 9 - public int vertexHeight; 10 - public int vertexHeightRight; 11 - public int vertexHeightTopRight; 12 - public int vertexHeightTop; 13 - public int id; 14 - public int clickType; 15 - public int face; 16 - public static Game client; 17 - public AnimationSequence animationSequence; 18 - public int varbitId; 19 - public int configId; 20 - public int[] childrenIds; 21 - public int animationCycleDelay; 22 - public int animationFrame; 23 - 24 - public GameObject(int id, int face, int clickType, int vertexHeightRight, int vertexHeightTopRight, int vertexHeight, int vertexHeightTop, int animationId, boolean flag) { 25 - this.id = id; 26 - this.clickType = clickType; 27 - this.face = face; 28 - this.vertexHeight = vertexHeight; 29 - this.vertexHeightRight = vertexHeightRight; 30 - this.vertexHeightTopRight = vertexHeightTopRight; 31 - this.vertexHeightTop = vertexHeightTop; 32 - if (animationId != -1) { 33 - animationSequence = AnimationSequence.animations[animationId]; 34 - animationFrame = 0; 35 - animationCycleDelay = client.pulseCycle - 1; 36 - if (flag && animationSequence.frameStep != -1) { 37 - animationFrame = (int) (Math.random() * animationSequence.frameCount); 38 - animationCycleDelay -= (int) (Math.random() * animationSequence.getFrameLength(animationFrame)); 39 - } 40 - } 41 - GameObjectDefinition gameObjectDefinition = GameObjectDefinition.getDefinition(this.id); 42 - varbitId = gameObjectDefinition.varbitId; 43 - configId = gameObjectDefinition.configId; 44 - childrenIds = gameObjectDefinition.childrenIds; 45 - } 46 - 47 - public GameObjectDefinition getChildDefinition() { 48 - int child = -1; 49 - if (varbitId != -1) { 50 - Varbit varbit = Varbit.cache[varbitId]; 51 - int configId = varbit.configId; 52 - int leastSignificantBit = varbit.leastSignificantBit; 53 - int mostSignificantBit = varbit.mostSignificantBit; 54 - int bit = client.BITFIELD_MAX_VALUE[mostSignificantBit - leastSignificantBit]; 55 - child = client.widgetSettings[configId] >> leastSignificantBit & bit; 56 - } else if (configId != -1) 57 - child = client.widgetSettings[configId]; 58 - if (child < 0 || child >= childrenIds.length || childrenIds[child] == -1) 59 - return null; 60 - else 61 - return GameObjectDefinition.getDefinition(childrenIds[child]); 62 - } 63 - 64 - 65 - 66 - @Override 67 - public Model getRotatedModel() { 68 - int animation = -1; 69 - if (animationSequence != null) { 70 - int step = client.pulseCycle - animationCycleDelay; 71 - if (step > 100 && animationSequence.frameStep > 0) 72 - step = 100; 73 - while (step > animationSequence.getFrameLength(animationFrame)) { 74 - step -= animationSequence.getFrameLength(animationFrame); 75 - animationFrame++; 76 - if (animationFrame < animationSequence.frameCount) 77 - continue; 78 - animationFrame -= animationSequence.frameStep; 79 - if (animationFrame >= 0 && animationFrame < animationSequence.frameCount) 80 - continue; 81 - animationSequence = null; 82 - break; 83 - } 84 - animationCycleDelay = client.pulseCycle - step; 85 - if (animationSequence != null) 86 - animation = animationSequence.getPrimaryFrame[animationFrame]; 87 - } 88 - GameObjectDefinition gameObjectDefinition; 89 - if (childrenIds != null) 90 - gameObjectDefinition = getChildDefinition(); 91 - else 92 - gameObjectDefinition = GameObjectDefinition.getDefinition(id); 93 - if (gameObjectDefinition == null) { 94 - return null; 95 - } else { 96 - Model model = gameObjectDefinition.getGameObjectModel(clickType, face, vertexHeight, 97 - vertexHeightRight, vertexHeightTopRight, vertexHeightTop, animation); 98 - return model; 99 - } 100 - } 101 - 102 - 103 - }
+89
src/main/java/com/jagex/runescape/media/renderable/GameObject.kt
··· 1 + package com.jagex.runescape.media.renderable 2 + 3 + import com.jagex.runescape.Game 4 + import com.jagex.runescape.cache.cfg.Varbit 5 + import com.jagex.runescape.cache.def.GameObjectDefinition 6 + import com.jagex.runescape.cache.media.AnimationSequence 7 + 8 + class GameObject( 9 + @JvmField var objectId: Int, 10 + @JvmField var face: Int, 11 + @JvmField var clickType: Int, 12 + @JvmField var vertexHeightRight: Int, 13 + @JvmField var vertexHeightTopRight: Int, 14 + @JvmField var vertexHeight: Int, 15 + @JvmField var vertexHeightTop: Int, 16 + animationId: Int, 17 + flag: Boolean 18 + ) : Renderable() { 19 + @JvmField var animationSequence: AnimationSequence? = null 20 + @JvmField var varbitId: Int 21 + @JvmField var configId: Int 22 + @JvmField var childrenIds: IntArray? = null 23 + @JvmField var animationCycleDelay: Int = 0 24 + @JvmField var animationFrame: Int = 0 25 + 26 + init { 27 + if (animationId != -1) { 28 + animationSequence = AnimationSequence.animations!![animationId] 29 + animationFrame = 0 30 + animationCycleDelay = Game.pulseCycle - 1 31 + if (flag && animationSequence!!.frameStep != -1) { 32 + animationFrame = (Math.random() * animationSequence!!.frameCount).toInt() 33 + animationCycleDelay -= (Math.random() * animationSequence!!.getFrameLength(animationFrame)).toInt() 34 + } 35 + } 36 + val gameObjectDefinition = GameObjectDefinition.getDefinition(objectId) 37 + varbitId = gameObjectDefinition.varbitId 38 + configId = gameObjectDefinition.configId 39 + childrenIds = gameObjectDefinition.childrenIds 40 + } 41 + 42 + fun getChildDefinition(): GameObjectDefinition? { 43 + var child = -1 44 + if (varbitId != -1) { 45 + val varbit = Varbit.cache!![varbitId]!! 46 + val configId = varbit.configId 47 + val leastSignificantBit = varbit.leastSignificantBit 48 + val mostSignificantBit = varbit.mostSignificantBit 49 + val bit = Game.BITFIELD_MAX_VALUE[mostSignificantBit - leastSignificantBit] 50 + child = client.widgetSettings[configId] shr leastSignificantBit and bit 51 + } else if (configId != -1) { 52 + child = client.widgetSettings[configId] 53 + } 54 + return if (child < 0 || child >= childrenIds!!.size || childrenIds!![child] == -1) { 55 + null 56 + } else { 57 + GameObjectDefinition.getDefinition(childrenIds!![child]) 58 + } 59 + } 60 + 61 + override fun getRotatedModel(): Model? { 62 + var animation = -1 63 + if (animationSequence != null) { 64 + var step = Game.pulseCycle - animationCycleDelay 65 + if (step > 100 && animationSequence!!.frameStep > 0) 66 + step = 100 67 + while (step > animationSequence!!.getFrameLength(animationFrame)) { 68 + step -= animationSequence!!.getFrameLength(animationFrame) 69 + animationFrame++ 70 + if (animationFrame < animationSequence!!.frameCount) 71 + continue 72 + animationFrame -= animationSequence!!.frameStep 73 + if (animationFrame >= 0 && animationFrame < animationSequence!!.frameCount) 74 + continue 75 + animationSequence = null 76 + break 77 + } 78 + animationCycleDelay = Game.pulseCycle - step 79 + if (animationSequence != null) 80 + animation = animationSequence!!.getPrimaryFrame!![animationFrame] 81 + } 82 + val gameObjectDefinition = if (childrenIds != null) getChildDefinition() else GameObjectDefinition.getDefinition(objectId) 83 + return gameObjectDefinition?.getGameObjectModel(clickType, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, animation) 84 + } 85 + 86 + companion object { 87 + @JvmStatic lateinit var client: Game 88 + } 89 + }
-15
src/main/java/com/jagex/runescape/media/renderable/Item.java
··· 1 - package com.jagex.runescape.media.renderable; 2 - 3 - import com.jagex.runescape.cache.def.ItemDefinition; 4 - 5 - public class Item extends Renderable { 6 - public int itemId; 7 - public int itemCount; 8 - 9 - @Override 10 - public Model getRotatedModel() { 11 - ItemDefinition itemDefinition = ItemDefinition.lookup(itemId); 12 - return itemDefinition.asGroundStack(itemCount); 13 - } 14 - 15 - }
+13
src/main/java/com/jagex/runescape/media/renderable/Item.kt
··· 1 + package com.jagex.runescape.media.renderable 2 + 3 + import com.jagex.runescape.cache.def.ItemDefinition 4 + 5 + class Item : Renderable() { 6 + @JvmField var itemId: Int = 0 7 + @JvmField var itemCount: Int = 0 8 + 9 + override fun getRotatedModel(): Model? { 10 + val itemDefinition = ItemDefinition.lookup(itemId) 11 + return itemDefinition.asGroundStack(itemCount) 12 + } 13 + }
-22
src/main/java/com/jagex/runescape/media/renderable/ModelHeader.java
··· 1 - package com.jagex.runescape.media.renderable; 2 - 3 - public class ModelHeader { 4 - 5 - public byte modelData[]; 6 - public int vertexCount; 7 - public int triangleCount; 8 - public int texturedTriangleCount; 9 - public int vertexDirectionOffset; 10 - public int xDataOffset; 11 - public int yDataOffset; 12 - public int zDataOffset; 13 - public int vertexSkinOffset; 14 - public int triangleDataOffset; 15 - public int triangleTypeOffset; 16 - public int colorDataOffset; 17 - public int texturePointerOffset; 18 - public int trianglePriorityOffset; 19 - public int triangleAlphaOffset; 20 - public int triangleSkinOffset; 21 - public int uvMapTriangleOffset; 22 - }
+21
src/main/java/com/jagex/runescape/media/renderable/ModelHeader.kt
··· 1 + package com.jagex.runescape.media.renderable 2 + 3 + class ModelHeader { 4 + @JvmField var modelData: ByteArray? = null 5 + @JvmField var vertexCount: Int = 0 6 + @JvmField var triangleCount: Int = 0 7 + @JvmField var texturedTriangleCount: Int = 0 8 + @JvmField var vertexDirectionOffset: Int = 0 9 + @JvmField var xDataOffset: Int = 0 10 + @JvmField var yDataOffset: Int = 0 11 + @JvmField var zDataOffset: Int = 0 12 + @JvmField var vertexSkinOffset: Int = 0 13 + @JvmField var triangleDataOffset: Int = 0 14 + @JvmField var triangleTypeOffset: Int = 0 15 + @JvmField var colorDataOffset: Int = 0 16 + @JvmField var texturePointerOffset: Int = 0 17 + @JvmField var trianglePriorityOffset: Int = 0 18 + @JvmField var triangleAlphaOffset: Int = 0 19 + @JvmField var triangleSkinOffset: Int = 0 20 + @JvmField var uvMapTriangleOffset: Int = 0 21 + }
-114
src/main/java/com/jagex/runescape/media/renderable/Projectile.java
··· 1 - package com.jagex.runescape.media.renderable; 2 - 3 - import com.jagex.runescape.cache.media.SpotAnimation; 4 - import com.jagex.runescape.media.Animation; 5 - 6 - public class Projectile extends Renderable { 7 - public SpotAnimation animation; 8 - public int sceneId; 9 - public double currentX; 10 - public double currentY; 11 - public double currentHeight; 12 - public int startSlope; 13 - public int startDistanceFromTarget; 14 - public int targetedEntityId; 15 - public boolean aBoolean1561; 16 - public int anInt1562; 17 - public int anInt1563; 18 - public int delay; 19 - public int endCycle; 20 - public int animationFrame; 21 - public int duration; 22 - public double speedVectorX; 23 - public double speedVectorY; 24 - public double speedVectorScalar; 25 - public double speedVectorZ; 26 - public boolean aBoolean1573; 27 - public double heightOffset; 28 - public boolean moving; 29 - public int startX; 30 - public int startY; 31 - public int startHeight; 32 - public int endHeight; 33 - 34 - public void trackTarget(int targetX, int targetY, int k, int loopCycle) { 35 - if (!moving) { 36 - double distanceX = targetX - startX; 37 - double distanceY = targetY - startY; 38 - double distanceScalar = Math.sqrt(distanceX * distanceX + distanceY * distanceY); 39 - currentX = startX + (distanceX * startDistanceFromTarget) / distanceScalar; 40 - currentY = startY + (distanceY * startDistanceFromTarget) / distanceScalar; 41 - currentHeight = startHeight; 42 - } 43 - double cyclesRemaining = (endCycle + 1) - loopCycle; 44 - speedVectorX = (targetX - currentX) / cyclesRemaining; 45 - speedVectorY = (targetY - currentY) / cyclesRemaining; 46 - speedVectorScalar = Math.sqrt(speedVectorX * speedVectorX + speedVectorY * speedVectorY); 47 - if (!moving) 48 - speedVectorZ = -speedVectorScalar * Math.tan(startSlope * 0.02454369D); 49 - heightOffset = (2D * (k - currentHeight - speedVectorZ * cyclesRemaining)) / (cyclesRemaining * cyclesRemaining); 50 - } 51 - 52 - public void move(int time) { 53 - moving = true; 54 - currentX += speedVectorX * time; 55 - currentY += speedVectorY * time; 56 - currentHeight += speedVectorZ * time + 0.5D * heightOffset * time * time; 57 - speedVectorZ += heightOffset * time; 58 - anInt1562 = (int) (Math.atan2(speedVectorX, speedVectorY) * 325.94900000000001D) + 1024 & 0x7ff; 59 - anInt1563 = (int) (Math.atan2(speedVectorZ, speedVectorScalar) * 325.94900000000001D) & 0x7ff; 60 - if (animation.sequences != null) 61 - for (duration += time; duration > animation.sequences.getFrameLength(animationFrame);) { 62 - duration -= animation.sequences.getFrameLength(animationFrame); 63 - animationFrame++; 64 - if (animationFrame >= animation.sequences.frameCount) 65 - animationFrame = 0; 66 - } 67 - 68 - } 69 - 70 - @Override 71 - public Model getRotatedModel() { 72 - Model model = animation.getModel(); 73 - if (model == null) 74 - return null; 75 - int frameId = -1; 76 - if (animation.sequences != null) 77 - frameId = animation.sequences.getPrimaryFrame[animationFrame]; 78 - Model projectileModel = new Model(true, 79 - model, Animation.exists(frameId)); 80 - if (frameId != -1) { 81 - projectileModel.createBones(); 82 - projectileModel.applyTransform(frameId); 83 - projectileModel.triangleSkin = null; 84 - projectileModel.vectorSkin = null; 85 - } 86 - if (animation.resizeXY != 128 || animation.resizeZ != 128) 87 - projectileModel.scaleT(animation.resizeZ, animation.resizeXY, 9, 88 - animation.resizeXY); 89 - projectileModel.rotateX(anInt1563); 90 - projectileModel.applyLighting(64 + animation.modelLightFalloff, 850 + animation.modelLightAmbient, -30, -50, -30, 91 - true); 92 - return projectileModel; 93 - } 94 - 95 - public Projectile(int sceneId, int endHeight, int startDistanceFromTarget, int projectileY, int graphicsId, int speed, int startSlope, 96 - int targetedEntityIndex, int height, int projectileX, int delay) { 97 - this.aBoolean1561 = false; 98 - this.aBoolean1573 = true; 99 - this.animation = SpotAnimation.cache[graphicsId]; 100 - this.sceneId = sceneId; 101 - this.startX = projectileX; 102 - this.startY = projectileY; 103 - this.startHeight = height; 104 - this.delay = delay; 105 - this.endCycle = speed; 106 - this.startSlope = startSlope; 107 - this.startDistanceFromTarget = startDistanceFromTarget; 108 - this.targetedEntityId = targetedEntityIndex; 109 - this.endHeight = endHeight; 110 - this.moving = false; 111 - } 112 - 113 - 114 - }
+96
src/main/java/com/jagex/runescape/media/renderable/Projectile.kt
··· 1 + package com.jagex.runescape.media.renderable 2 + 3 + import com.jagex.runescape.cache.media.SpotAnimation 4 + import com.jagex.runescape.media.Animation 5 + 6 + class Projectile( 7 + @JvmField var sceneId: Int, 8 + endHeight: Int, 9 + @JvmField var startDistanceFromTarget: Int, 10 + projectileY: Int, 11 + graphicsId: Int, 12 + speed: Int, 13 + @JvmField var startSlope: Int, 14 + targetedEntityIndex: Int, 15 + height: Int, 16 + projectileX: Int, 17 + delay: Int 18 + ) : Renderable() { 19 + @JvmField var animation: SpotAnimation = SpotAnimation.cache!![graphicsId]!! 20 + @JvmField var currentX: Double = 0.0 21 + @JvmField var currentY: Double = 0.0 22 + @JvmField var currentHeight: Double = 0.0 23 + @JvmField var targetedEntityId: Int = targetedEntityIndex 24 + @JvmField var aBoolean1561: Boolean = false 25 + @JvmField var anInt1562: Int = 0 26 + @JvmField var anInt1563: Int = 0 27 + @JvmField var delay: Int = delay 28 + @JvmField var endCycle: Int = speed 29 + @JvmField var animationFrame: Int = 0 30 + @JvmField var duration: Int = 0 31 + @JvmField var speedVectorX: Double = 0.0 32 + @JvmField var speedVectorY: Double = 0.0 33 + @JvmField var speedVectorScalar: Double = 0.0 34 + @JvmField var speedVectorZ: Double = 0.0 35 + @JvmField var aBoolean1573: Boolean = true 36 + @JvmField var heightOffset: Double = 0.0 37 + @JvmField var moving: Boolean = false 38 + @JvmField var startX: Int = projectileX 39 + @JvmField var startY: Int = projectileY 40 + @JvmField var startHeight: Int = height 41 + @JvmField var endHeight: Int = endHeight 42 + 43 + fun trackTarget(targetX: Int, targetY: Int, k: Int, loopCycle: Int) { 44 + if (!moving) { 45 + val distanceX = (targetX - startX).toDouble() 46 + val distanceY = (targetY - startY).toDouble() 47 + val distanceScalar = Math.sqrt(distanceX * distanceX + distanceY * distanceY) 48 + currentX = startX + (distanceX * startDistanceFromTarget) / distanceScalar 49 + currentY = startY + (distanceY * startDistanceFromTarget) / distanceScalar 50 + currentHeight = startHeight.toDouble() 51 + } 52 + val cyclesRemaining = (endCycle + 1) - loopCycle.toDouble() 53 + speedVectorX = (targetX - currentX) / cyclesRemaining 54 + speedVectorY = (targetY - currentY) / cyclesRemaining 55 + speedVectorScalar = Math.sqrt(speedVectorX * speedVectorX + speedVectorY * speedVectorY) 56 + if (!moving) 57 + speedVectorZ = -speedVectorScalar * Math.tan(startSlope * 0.02454369) 58 + heightOffset = (2.0 * (k - currentHeight - speedVectorZ * cyclesRemaining)) / (cyclesRemaining * cyclesRemaining) 59 + } 60 + 61 + fun move(time: Int) { 62 + moving = true 63 + currentX += speedVectorX * time 64 + currentY += speedVectorY * time 65 + currentHeight += speedVectorZ * time + 0.5 * heightOffset * time * time 66 + speedVectorZ += heightOffset * time 67 + anInt1562 = (Math.atan2(speedVectorX, speedVectorY) * 325.949).toInt() + 1024 and 0x7ff 68 + anInt1563 = (Math.atan2(speedVectorZ, speedVectorScalar) * 325.949).toInt() and 0x7ff 69 + val seq = animation.sequences ?: return 70 + duration += time 71 + while (duration > seq.getFrameLength(animationFrame)) { 72 + duration -= seq.getFrameLength(animationFrame) 73 + animationFrame++ 74 + if (animationFrame >= seq.frameCount) 75 + animationFrame = 0 76 + } 77 + } 78 + 79 + override fun getRotatedModel(): Model? { 80 + val model = animation.getModel() ?: return null 81 + val seq = animation.sequences 82 + val frameId = if (seq != null) seq.getPrimaryFrame!![animationFrame] else -1 83 + val projectileModel = Model(true, model, Animation.exists(frameId)) 84 + if (frameId != -1) { 85 + projectileModel.createBones() 86 + projectileModel.applyTransform(frameId) 87 + projectileModel.triangleSkin = null 88 + projectileModel.vectorSkin = null 89 + } 90 + if (animation.resizeXY != 128 || animation.resizeZ != 128) 91 + projectileModel.scaleT(animation.resizeZ, animation.resizeXY, 9, animation.resizeXY) 92 + projectileModel.rotateX(anInt1563) 93 + projectileModel.applyLighting(64 + animation.modelLightFalloff, 850 + animation.modelLightAmbient, -30, -50, -30, true) 94 + return projectileModel 95 + } 96 + }
-24
src/main/java/com/jagex/runescape/media/renderable/Renderable.java
··· 1 - package com.jagex.runescape.media.renderable; 2 - 3 - import com.jagex.runescape.collection.CacheableNode; 4 - import com.jagex.runescape.media.VertexNormal; 5 - 6 - public class Renderable extends CacheableNode { 7 - 8 - public VertexNormal[] verticesNormal; 9 - public int modelHeight = 1000; 10 - 11 - public void renderAtPoint(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2) { 12 - Model model = getRotatedModel(); 13 - if (model != null) { 14 - modelHeight = model.modelHeight; 15 - model.renderAtPoint(i, j, k, l, i1, j1, k1, l1, i2); 16 - } 17 - } 18 - 19 - public Model getRotatedModel() { 20 - return null; 21 - } 22 - 23 - 24 - }
+19
src/main/java/com/jagex/runescape/media/renderable/Renderable.kt
··· 1 + package com.jagex.runescape.media.renderable 2 + 3 + import com.jagex.runescape.collection.CacheableNode 4 + import com.jagex.runescape.media.VertexNormal 5 + 6 + open class Renderable : CacheableNode() { 7 + @JvmField var verticesNormal: Array<VertexNormal>? = null 8 + @JvmField var modelHeight: Int = 1000 9 + 10 + open fun renderAtPoint(i: Int, j: Int, k: Int, l: Int, i1: Int, j1: Int, k1: Int, l1: Int, i2: Int) { 11 + val model = getRotatedModel() 12 + if (model != null) { 13 + modelHeight = model.modelHeight 14 + model.renderAtPoint(i, j, k, l, i1, j1, k1, l1, i2) 15 + } 16 + } 17 + 18 + open fun getRotatedModel(): Model? = null 19 + }
-18
src/main/java/com/jagex/runescape/scene/GroundItemTile.java
··· 1 - package com.jagex.runescape.scene; 2 - 3 - import com.jagex.runescape.media.renderable.Renderable; 4 - 5 - public class GroundItemTile { 6 - 7 - public GroundItemTile() { 8 - } 9 - 10 - public int z; 11 - public int x; 12 - public int y; 13 - public Renderable firstGroundItem; 14 - public Renderable secondGroundItem; 15 - public Renderable thirdGroundItem; 16 - public int uid; 17 - public int anInt180; 18 - }
+14
src/main/java/com/jagex/runescape/scene/GroundItemTile.kt
··· 1 + package com.jagex.runescape.scene 2 + 3 + import com.jagex.runescape.media.renderable.Renderable 4 + 5 + class GroundItemTile { 6 + @JvmField var z: Int = 0 7 + @JvmField var x: Int = 0 8 + @JvmField var y: Int = 0 9 + @JvmField var firstGroundItem: Renderable? = null 10 + @JvmField var secondGroundItem: Renderable? = null 11 + @JvmField var thirdGroundItem: Renderable? = null 12 + @JvmField var uid: Int = 0 13 + @JvmField var anInt180: Int = 0 14 + }
-21
src/main/java/com/jagex/runescape/scene/InteractiveObject.java
··· 1 - package com.jagex.runescape.scene; 2 - 3 - import com.jagex.runescape.media.renderable.Renderable; 4 - 5 - public class InteractiveObject { 6 - 7 - public int z; 8 - public int worldZ; 9 - public int worldX; 10 - public int worldY; 11 - public Renderable renderable; 12 - public int rotation; 13 - public int tileLeft; 14 - public int tileRight; 15 - public int tileTop; 16 - public int tileBottom; 17 - public int anInt123; 18 - public int cycle; 19 - public int uid; 20 - public byte config; 21 - }
+20
src/main/java/com/jagex/runescape/scene/InteractiveObject.kt
··· 1 + package com.jagex.runescape.scene 2 + 3 + import com.jagex.runescape.media.renderable.Renderable 4 + 5 + class InteractiveObject { 6 + @JvmField var z: Int = 0 7 + @JvmField var worldZ: Int = 0 8 + @JvmField var worldX: Int = 0 9 + @JvmField var worldY: Int = 0 10 + @JvmField var renderable: Renderable? = null 11 + @JvmField var rotation: Int = 0 12 + @JvmField var tileLeft: Int = 0 13 + @JvmField var tileRight: Int = 0 14 + @JvmField var tileTop: Int = 0 15 + @JvmField var tileBottom: Int = 0 16 + @JvmField var anInt123: Int = 0 17 + @JvmField var cycle: Int = 0 18 + @JvmField var uid: Int = 0 19 + @JvmField var config: Byte = 0 20 + }
-23
src/main/java/com/jagex/runescape/scene/SceneCluster.java
··· 1 - package com.jagex.runescape.scene; 2 - 3 - public class SceneCluster { 4 - 5 - public int tileStartX; 6 - public int tileEndX; 7 - public int tileStartY; 8 - public int tileEndY; 9 - public int searchMask; 10 - public int worldStartX; 11 - public int worldEndX; 12 - public int worldStartY; 13 - public int worldEndY; 14 - public int worldEndZ; 15 - public int worldStartZ; 16 - public int tileDistanceEnum; 17 - public int worldDistanceFromCameraStartX; 18 - public int worldDistanceFromCameraEndX; 19 - public int worldDistanceFromCameraStartY; 20 - public int worldDistanceFromCameraEndY; 21 - public int worldDistanceFromCameraStartZ; 22 - public int worldDistanceFromCameraEndZ; 23 - }
+22
src/main/java/com/jagex/runescape/scene/SceneCluster.kt
··· 1 + package com.jagex.runescape.scene 2 + 3 + class SceneCluster { 4 + @JvmField var tileStartX: Int = 0 5 + @JvmField var tileEndX: Int = 0 6 + @JvmField var tileStartY: Int = 0 7 + @JvmField var tileEndY: Int = 0 8 + @JvmField var searchMask: Int = 0 9 + @JvmField var worldStartX: Int = 0 10 + @JvmField var worldEndX: Int = 0 11 + @JvmField var worldStartY: Int = 0 12 + @JvmField var worldEndY: Int = 0 13 + @JvmField var worldEndZ: Int = 0 14 + @JvmField var worldStartZ: Int = 0 15 + @JvmField var tileDistanceEnum: Int = 0 16 + @JvmField var worldDistanceFromCameraStartX: Int = 0 17 + @JvmField var worldDistanceFromCameraEndX: Int = 0 18 + @JvmField var worldDistanceFromCameraStartY: Int = 0 19 + @JvmField var worldDistanceFromCameraEndY: Int = 0 20 + @JvmField var worldDistanceFromCameraStartZ: Int = 0 21 + @JvmField var worldDistanceFromCameraEndZ: Int = 0 22 + }
-19
src/main/java/com/jagex/runescape/scene/SpawnObjectNode.java
··· 1 - package com.jagex.runescape.scene; 2 - 3 - import com.jagex.runescape.collection.Node; 4 - 5 - public class SpawnObjectNode extends Node { 6 - 7 - public int locationIndex; 8 - public int locationRotation; 9 - public int locationType; 10 - public int index; 11 - public int rotation; 12 - public int type; 13 - public int cycle = -1; 14 - public int plane; 15 - public int classType; 16 - public int x; 17 - public int y; 18 - public int spawnCycle; 19 - }
+18
src/main/java/com/jagex/runescape/scene/SpawnObjectNode.kt
··· 1 + package com.jagex.runescape.scene 2 + 3 + import com.jagex.runescape.collection.Node 4 + 5 + class SpawnObjectNode : Node() { 6 + @JvmField var locationIndex: Int = 0 7 + @JvmField var locationRotation: Int = 0 8 + @JvmField var locationType: Int = 0 9 + @JvmField var index: Int = 0 10 + @JvmField var rotation: Int = 0 11 + @JvmField var type: Int = 0 12 + @JvmField var cycle: Int = -1 13 + @JvmField var plane: Int = 0 14 + @JvmField var classType: Int = 0 15 + @JvmField var x: Int = 0 16 + @JvmField var y: Int = 0 17 + @JvmField var spawnCycle: Int = 0 18 + }
-232
src/main/java/com/jagex/runescape/scene/tile/ComplexTile.java
··· 1 - package com.jagex.runescape.scene.tile; 2 - 3 - public class ComplexTile { 4 - 5 - public ComplexTile(int tileX, int yA, int yB, int yC, int yD, int tileZ, int rotation, int texture, int shape, int cA, int cAA, int cB, int cBA, int cC, int cCA, int cD, int cDA, int overlayRGB, 6 - int underlayRGB) { 7 - flat = yA == yB && yA == yD && yA == yC; 8 - this.shape = shape; 9 - this.rotation = rotation; 10 - this.underlayRGB = underlayRGB; 11 - this.overlayRGB = overlayRGB; 12 - char c = '\200'; 13 - int i5 = c / 2; 14 - int j5 = c / 4; 15 - int k5 = (c * 3) / 4; 16 - int[] shapedTileMesh = shapedTilePointData[shape]; 17 - int shapedTileMeshLength = shapedTileMesh.length; 18 - originalVertexX = new int[shapedTileMeshLength]; 19 - originalVertexY = new int[shapedTileMeshLength]; 20 - originalVertexZ = new int[shapedTileMeshLength]; 21 - int[] vertexColourOverlay = new int[shapedTileMeshLength]; 22 - int[] vertexColourUnderlay = new int[shapedTileMeshLength]; 23 - int i6 = tileX * c; 24 - int j6 = tileZ * c; 25 - for (int vertex = 0; vertex < shapedTileMeshLength; vertex++) { 26 - int vertexType = shapedTileMesh[vertex]; 27 - if ((vertexType & 1) == 0 && vertexType <= 8) 28 - vertexType = (vertexType - rotation - rotation - 1 & 7) + 1; 29 - if (vertexType > 8 && vertexType <= 12) 30 - vertexType = (vertexType - 9 - rotation & 3) + 9; 31 - if (vertexType > 12 && vertexType <= 16) 32 - vertexType = (vertexType - 13 - rotation & 3) + 13; 33 - int vertexX; 34 - int vertexZ; 35 - int vertexY; 36 - int vertexCOverlay; 37 - int vertexCUnderlay; 38 - if (vertexType == 1) { 39 - vertexX = i6; 40 - vertexZ = j6; 41 - vertexY = yA; 42 - vertexCOverlay = cA; 43 - vertexCUnderlay = cAA; 44 - } else if (vertexType == 2) { 45 - vertexX = i6 + i5; 46 - vertexZ = j6; 47 - vertexY = yA + yB >> 1; 48 - vertexCOverlay = cA + cB >> 1; 49 - vertexCUnderlay = cAA + cBA >> 1; 50 - } else if (vertexType == 3) { 51 - vertexX = i6 + c; 52 - vertexZ = j6; 53 - vertexY = yB; 54 - vertexCOverlay = cB; 55 - vertexCUnderlay = cBA; 56 - } else if (vertexType == 4) { 57 - vertexX = i6 + c; 58 - vertexZ = j6 + i5; 59 - vertexY = yB + yD >> 1; 60 - vertexCOverlay = cB + cD >> 1; 61 - vertexCUnderlay = cBA + cDA >> 1; 62 - } else if (vertexType == 5) { 63 - vertexX = i6 + c; 64 - vertexZ = j6 + c; 65 - vertexY = yD; 66 - vertexCOverlay = cD; 67 - vertexCUnderlay = cDA; 68 - } else if (vertexType == 6) { 69 - vertexX = i6 + i5; 70 - vertexZ = j6 + c; 71 - vertexY = yD + yC >> 1; 72 - vertexCOverlay = cD + cC >> 1; 73 - vertexCUnderlay = cDA + cCA >> 1; 74 - } else if (vertexType == 7) { 75 - vertexX = i6; 76 - vertexZ = j6 + c; 77 - vertexY = yC; 78 - vertexCOverlay = cC; 79 - vertexCUnderlay = cCA; 80 - } else if (vertexType == 8) { 81 - vertexX = i6; 82 - vertexZ = j6 + i5; 83 - vertexY = yC + yA >> 1; 84 - vertexCOverlay = cC + cA >> 1; 85 - vertexCUnderlay = cCA + cAA >> 1; 86 - } else if (vertexType == 9) { 87 - vertexX = i6 + i5; 88 - vertexZ = j6 + j5; 89 - vertexY = yA + yB >> 1; 90 - vertexCOverlay = cA + cB >> 1; 91 - vertexCUnderlay = cAA + cBA >> 1; 92 - } else if (vertexType == 10) { 93 - vertexX = i6 + k5; 94 - vertexZ = j6 + i5; 95 - vertexY = yB + yD >> 1; 96 - vertexCOverlay = cB + cD >> 1; 97 - vertexCUnderlay = cBA + cDA >> 1; 98 - } else if (vertexType == 11) { 99 - vertexX = i6 + i5; 100 - vertexZ = j6 + k5; 101 - vertexY = yD + yC >> 1; 102 - vertexCOverlay = cD + cC >> 1; 103 - vertexCUnderlay = cDA + cCA >> 1; 104 - } else if (vertexType == 12) { 105 - vertexX = i6 + j5; 106 - vertexZ = j6 + i5; 107 - vertexY = yC + yA >> 1; 108 - vertexCOverlay = cC + cA >> 1; 109 - vertexCUnderlay = cCA + cAA >> 1; 110 - } else if (vertexType == 13) { 111 - vertexX = i6 + j5; 112 - vertexZ = j6 + j5; 113 - vertexY = yA; 114 - vertexCOverlay = cA; 115 - vertexCUnderlay = cAA; 116 - } else if (vertexType == 14) { 117 - vertexX = i6 + k5; 118 - vertexZ = j6 + j5; 119 - vertexY = yB; 120 - vertexCOverlay = cB; 121 - vertexCUnderlay = cBA; 122 - } else if (vertexType == 15) { 123 - vertexX = i6 + k5; 124 - vertexZ = j6 + k5; 125 - vertexY = yD; 126 - vertexCOverlay = cD; 127 - vertexCUnderlay = cDA; 128 - } else { 129 - vertexX = i6 + j5; 130 - vertexZ = j6 + k5; 131 - vertexY = yC; 132 - vertexCOverlay = cC; 133 - vertexCUnderlay = cCA; 134 - } 135 - originalVertexX[vertex] = vertexX; 136 - originalVertexY[vertex] = vertexY; 137 - originalVertexZ[vertex] = vertexZ; 138 - vertexColourOverlay[vertex] = vertexCOverlay; 139 - vertexColourUnderlay[vertex] = vertexCUnderlay; 140 - } 141 - 142 - int[] shapedTileElements = shapedTileElementData[shape]; 143 - int vertexCount = shapedTileElements.length / 4; 144 - triangleA = new int[vertexCount]; 145 - triangleB = new int[vertexCount]; 146 - triangleC = new int[vertexCount]; 147 - triangleHSLA = new int[vertexCount]; 148 - triangleHSLB = new int[vertexCount]; 149 - triangleHSLC = new int[vertexCount]; 150 - if (texture != -1) 151 - triangleTexture = new int[vertexCount]; 152 - int offset = 0; 153 - for (int vertex = 0; vertex < vertexCount; vertex++) { 154 - int overlayOrUnderlay = shapedTileElements[offset]; 155 - int idxA = shapedTileElements[offset + 1]; 156 - int idxB = shapedTileElements[offset + 2]; 157 - int idxC = shapedTileElements[offset + 3]; 158 - offset += 4; 159 - if (idxA < 4) 160 - idxA = idxA - rotation & 3; 161 - if (idxB < 4) 162 - idxB = idxB - rotation & 3; 163 - if (idxC < 4) 164 - idxC = idxC - rotation & 3; 165 - triangleA[vertex] = idxA; 166 - triangleB[vertex] = idxB; 167 - triangleC[vertex] = idxC; 168 - if (overlayOrUnderlay == 0) { 169 - triangleHSLA[vertex] = vertexColourOverlay[idxA]; 170 - triangleHSLB[vertex] = vertexColourOverlay[idxB]; 171 - triangleHSLC[vertex] = vertexColourOverlay[idxC]; 172 - if (triangleTexture != null) 173 - triangleTexture[vertex] = -1; 174 - } else { 175 - triangleHSLA[vertex] = vertexColourUnderlay[idxA]; 176 - triangleHSLB[vertex] = vertexColourUnderlay[idxB]; 177 - triangleHSLC[vertex] = vertexColourUnderlay[idxC]; 178 - if (triangleTexture != null) 179 - triangleTexture[vertex] = texture; 180 - } 181 - } 182 - 183 - int i9 = yA; 184 - int l9 = yB; 185 - if (yB < i9) 186 - i9 = yB; 187 - if (yB > l9) 188 - l9 = yB; 189 - if (yD < i9) 190 - i9 = yD; 191 - if (yD > l9) 192 - l9 = yD; 193 - if (yC < i9) 194 - i9 = yC; 195 - if (yC > l9) 196 - l9 = yC; 197 - } 198 - 199 - public int[] originalVertexX; 200 - public int[] originalVertexY; 201 - public int[] originalVertexZ; 202 - public int[] triangleHSLA; 203 - public int[] triangleHSLB; 204 - public int[] triangleHSLC; 205 - public int[] triangleA; 206 - public int[] triangleB; 207 - public int[] triangleC; 208 - public int[] triangleTexture; 209 - public boolean flat; 210 - public int shape; 211 - public int rotation; 212 - public int underlayRGB; 213 - public int overlayRGB; 214 - public static int[] screenX = new int[6]; 215 - public static int[] screenY = new int[6]; 216 - public static int[] viewspaceX = new int[6]; 217 - public static int[] viewspaceY = new int[6]; 218 - public static int[] viewspaceZ = new int[6]; 219 - public static final int[][] shapedTilePointData = {{1, 3, 5, 7}, {1, 3, 5, 7}, {1, 3, 5, 7}, 220 - {1, 3, 5, 7, 6}, {1, 3, 5, 7, 6}, {1, 3, 5, 7, 6}, {1, 3, 5, 7, 6}, {1, 3, 5, 7, 2, 6}, 221 - {1, 3, 5, 7, 2, 8}, {1, 3, 5, 7, 2, 8}, {1, 3, 5, 7, 11, 12}, {1, 3, 5, 7, 11, 12}, 222 - {1, 3, 5, 7, 13, 14}}; 223 - public static final int[][] shapedTileElementData = {{0, 1, 2, 3, 0, 0, 1, 3}, {1, 1, 2, 3, 1, 0, 1, 3}, 224 - {0, 1, 2, 3, 1, 0, 1, 3}, {0, 0, 1, 2, 0, 0, 2, 4, 1, 0, 4, 3}, {0, 0, 1, 4, 0, 0, 4, 3, 1, 1, 2, 4}, 225 - {0, 0, 4, 3, 1, 0, 1, 2, 1, 0, 2, 4}, {0, 1, 2, 4, 1, 0, 1, 4, 1, 0, 4, 3}, 226 - {0, 4, 1, 2, 0, 4, 2, 5, 1, 0, 4, 5, 1, 0, 5, 3}, {0, 4, 1, 2, 0, 4, 2, 3, 0, 4, 3, 5, 1, 0, 4, 5}, 227 - {0, 0, 4, 5, 1, 4, 1, 2, 1, 4, 2, 3, 1, 4, 3, 5}, 228 - {0, 0, 1, 5, 0, 1, 4, 5, 0, 1, 2, 4, 1, 0, 5, 3, 1, 5, 4, 3, 1, 4, 2, 3}, 229 - {1, 0, 1, 5, 1, 1, 4, 5, 1, 1, 2, 4, 0, 0, 5, 3, 0, 5, 4, 3, 0, 4, 2, 3}, 230 - {1, 0, 5, 4, 1, 0, 1, 5, 0, 0, 4, 3, 0, 4, 5, 3, 0, 5, 2, 3, 0, 1, 2, 5}}; 231 - 232 - }
+211
src/main/java/com/jagex/runescape/scene/tile/ComplexTile.kt
··· 1 + package com.jagex.runescape.scene.tile 2 + 3 + class ComplexTile( 4 + tileX: Int, yA: Int, yB: Int, yC: Int, yD: Int, tileZ: Int, rotation: Int, texture: Int, shape: Int, 5 + cA: Int, cAA: Int, cB: Int, cBA: Int, cC: Int, cCA: Int, cD: Int, cDA: Int, overlayRGB: Int, 6 + underlayRGB: Int 7 + ) { 8 + @JvmField var originalVertexX: IntArray 9 + @JvmField var originalVertexY: IntArray 10 + @JvmField var originalVertexZ: IntArray 11 + @JvmField var triangleHSLA: IntArray 12 + @JvmField var triangleHSLB: IntArray 13 + @JvmField var triangleHSLC: IntArray 14 + @JvmField var triangleA: IntArray 15 + @JvmField var triangleB: IntArray 16 + @JvmField var triangleC: IntArray 17 + @JvmField var triangleTexture: IntArray? = null 18 + @JvmField var flat: Boolean 19 + @JvmField var shape: Int = shape 20 + @JvmField var rotation: Int = rotation 21 + @JvmField var underlayRGB: Int = underlayRGB 22 + @JvmField var overlayRGB: Int = overlayRGB 23 + 24 + init { 25 + flat = yA == yB && yA == yD && yA == yC 26 + val c = 128 27 + val i5 = c / 2 28 + val j5 = c / 4 29 + val k5 = (c * 3) / 4 30 + val shapedTileMesh = shapedTilePointData[shape] 31 + val shapedTileMeshLength = shapedTileMesh.size 32 + originalVertexX = IntArray(shapedTileMeshLength) 33 + originalVertexY = IntArray(shapedTileMeshLength) 34 + originalVertexZ = IntArray(shapedTileMeshLength) 35 + val vertexColourOverlay = IntArray(shapedTileMeshLength) 36 + val vertexColourUnderlay = IntArray(shapedTileMeshLength) 37 + val i6 = tileX * c 38 + val j6 = tileZ * c 39 + for (vertex in 0 until shapedTileMeshLength) { 40 + var vertexType = shapedTileMesh[vertex] 41 + if ((vertexType and 1) == 0 && vertexType <= 8) 42 + vertexType = (vertexType - rotation - rotation - 1 and 7) + 1 43 + if (vertexType > 8 && vertexType <= 12) 44 + vertexType = (vertexType - 9 - rotation and 3) + 9 45 + if (vertexType > 12 && vertexType <= 16) 46 + vertexType = (vertexType - 13 - rotation and 3) + 13 47 + val vertexX: Int 48 + val vertexZ: Int 49 + val vertexY: Int 50 + val vertexCOverlay: Int 51 + val vertexCUnderlay: Int 52 + if (vertexType == 1) { 53 + vertexX = i6 54 + vertexZ = j6 55 + vertexY = yA 56 + vertexCOverlay = cA 57 + vertexCUnderlay = cAA 58 + } else if (vertexType == 2) { 59 + vertexX = i6 + i5 60 + vertexZ = j6 61 + vertexY = yA + yB shr 1 62 + vertexCOverlay = cA + cB shr 1 63 + vertexCUnderlay = cAA + cBA shr 1 64 + } else if (vertexType == 3) { 65 + vertexX = i6 + c 66 + vertexZ = j6 67 + vertexY = yB 68 + vertexCOverlay = cB 69 + vertexCUnderlay = cBA 70 + } else if (vertexType == 4) { 71 + vertexX = i6 + c 72 + vertexZ = j6 + i5 73 + vertexY = yB + yD shr 1 74 + vertexCOverlay = cB + cD shr 1 75 + vertexCUnderlay = cBA + cDA shr 1 76 + } else if (vertexType == 5) { 77 + vertexX = i6 + c 78 + vertexZ = j6 + c 79 + vertexY = yD 80 + vertexCOverlay = cD 81 + vertexCUnderlay = cDA 82 + } else if (vertexType == 6) { 83 + vertexX = i6 + i5 84 + vertexZ = j6 + c 85 + vertexY = yD + yC shr 1 86 + vertexCOverlay = cD + cC shr 1 87 + vertexCUnderlay = cDA + cCA shr 1 88 + } else if (vertexType == 7) { 89 + vertexX = i6 90 + vertexZ = j6 + c 91 + vertexY = yC 92 + vertexCOverlay = cC 93 + vertexCUnderlay = cCA 94 + } else if (vertexType == 8) { 95 + vertexX = i6 96 + vertexZ = j6 + i5 97 + vertexY = yC + yA shr 1 98 + vertexCOverlay = cC + cA shr 1 99 + vertexCUnderlay = cCA + cAA shr 1 100 + } else if (vertexType == 9) { 101 + vertexX = i6 + i5 102 + vertexZ = j6 + j5 103 + vertexY = yA + yB shr 1 104 + vertexCOverlay = cA + cB shr 1 105 + vertexCUnderlay = cAA + cBA shr 1 106 + } else if (vertexType == 10) { 107 + vertexX = i6 + k5 108 + vertexZ = j6 + i5 109 + vertexY = yB + yD shr 1 110 + vertexCOverlay = cB + cD shr 1 111 + vertexCUnderlay = cBA + cDA shr 1 112 + } else if (vertexType == 11) { 113 + vertexX = i6 + i5 114 + vertexZ = j6 + k5 115 + vertexY = yD + yC shr 1 116 + vertexCOverlay = cD + cC shr 1 117 + vertexCUnderlay = cDA + cCA shr 1 118 + } else if (vertexType == 12) { 119 + vertexX = i6 + j5 120 + vertexZ = j6 + i5 121 + vertexY = yC + yA shr 1 122 + vertexCOverlay = cC + cA shr 1 123 + vertexCUnderlay = cCA + cAA shr 1 124 + } else if (vertexType == 13) { 125 + vertexX = i6 + j5 126 + vertexZ = j6 + j5 127 + vertexY = yA 128 + vertexCOverlay = cA 129 + vertexCUnderlay = cAA 130 + } else if (vertexType == 14) { 131 + vertexX = i6 + k5 132 + vertexZ = j6 + j5 133 + vertexY = yB 134 + vertexCOverlay = cB 135 + vertexCUnderlay = cBA 136 + } else if (vertexType == 15) { 137 + vertexX = i6 + k5 138 + vertexZ = j6 + k5 139 + vertexY = yD 140 + vertexCOverlay = cD 141 + vertexCUnderlay = cDA 142 + } else { 143 + vertexX = i6 + j5 144 + vertexZ = j6 + k5 145 + vertexY = yC 146 + vertexCOverlay = cC 147 + vertexCUnderlay = cCA 148 + } 149 + originalVertexX[vertex] = vertexX 150 + originalVertexY[vertex] = vertexY 151 + originalVertexZ[vertex] = vertexZ 152 + vertexColourOverlay[vertex] = vertexCOverlay 153 + vertexColourUnderlay[vertex] = vertexCUnderlay 154 + } 155 + 156 + val shapedTileElements = shapedTileElementData[shape] 157 + val vertexCount = shapedTileElements.size / 4 158 + triangleA = IntArray(vertexCount) 159 + triangleB = IntArray(vertexCount) 160 + triangleC = IntArray(vertexCount) 161 + triangleHSLA = IntArray(vertexCount) 162 + triangleHSLB = IntArray(vertexCount) 163 + triangleHSLC = IntArray(vertexCount) 164 + if (texture != -1) triangleTexture = IntArray(vertexCount) 165 + var offset = 0 166 + for (vertex in 0 until vertexCount) { 167 + val overlayOrUnderlay = shapedTileElements[offset] 168 + var idxA = shapedTileElements[offset + 1] 169 + var idxB = shapedTileElements[offset + 2] 170 + var idxC = shapedTileElements[offset + 3] 171 + offset += 4 172 + if (idxA < 4) idxA = idxA - rotation and 3 173 + if (idxB < 4) idxB = idxB - rotation and 3 174 + if (idxC < 4) idxC = idxC - rotation and 3 175 + triangleA[vertex] = idxA 176 + triangleB[vertex] = idxB 177 + triangleC[vertex] = idxC 178 + if (overlayOrUnderlay == 0) { 179 + triangleHSLA[vertex] = vertexColourOverlay[idxA] 180 + triangleHSLB[vertex] = vertexColourOverlay[idxB] 181 + triangleHSLC[vertex] = vertexColourOverlay[idxC] 182 + if (triangleTexture != null) triangleTexture!![vertex] = -1 183 + } else { 184 + triangleHSLA[vertex] = vertexColourUnderlay[idxA] 185 + triangleHSLB[vertex] = vertexColourUnderlay[idxB] 186 + triangleHSLC[vertex] = vertexColourUnderlay[idxC] 187 + if (triangleTexture != null) triangleTexture!![vertex] = texture 188 + } 189 + } 190 + } 191 + 192 + companion object { 193 + @JvmField var screenX: IntArray = IntArray(6) 194 + @JvmField var screenY: IntArray = IntArray(6) 195 + @JvmField var viewspaceX: IntArray = IntArray(6) 196 + @JvmField var viewspaceY: IntArray = IntArray(6) 197 + @JvmField var viewspaceZ: IntArray = IntArray(6) 198 + @JvmField val shapedTilePointData: Array<IntArray> = arrayOf(intArrayOf(1, 3, 5, 7), intArrayOf(1, 3, 5, 7), intArrayOf(1, 3, 5, 7), 199 + intArrayOf(1, 3, 5, 7, 6), intArrayOf(1, 3, 5, 7, 6), intArrayOf(1, 3, 5, 7, 6), intArrayOf(1, 3, 5, 7, 6), intArrayOf(1, 3, 5, 7, 2, 6), 200 + intArrayOf(1, 3, 5, 7, 2, 8), intArrayOf(1, 3, 5, 7, 2, 8), intArrayOf(1, 3, 5, 7, 11, 12), intArrayOf(1, 3, 5, 7, 11, 12), 201 + intArrayOf(1, 3, 5, 7, 13, 14)) 202 + @JvmField val shapedTileElementData: Array<IntArray> = arrayOf(intArrayOf(0, 1, 2, 3, 0, 0, 1, 3), intArrayOf(1, 1, 2, 3, 1, 0, 1, 3), 203 + intArrayOf(0, 1, 2, 3, 1, 0, 1, 3), intArrayOf(0, 0, 1, 2, 0, 0, 2, 4, 1, 0, 4, 3), intArrayOf(0, 0, 1, 4, 0, 0, 4, 3, 1, 1, 2, 4), 204 + intArrayOf(0, 0, 4, 3, 1, 0, 1, 2, 1, 0, 2, 4), intArrayOf(0, 1, 2, 4, 1, 0, 1, 4, 1, 0, 4, 3), 205 + intArrayOf(0, 4, 1, 2, 0, 4, 2, 5, 1, 0, 4, 5, 1, 0, 5, 3), intArrayOf(0, 4, 1, 2, 0, 4, 2, 3, 0, 4, 3, 5, 1, 0, 4, 5), 206 + intArrayOf(0, 0, 4, 5, 1, 4, 1, 2, 1, 4, 2, 3, 1, 4, 3, 5), 207 + intArrayOf(0, 0, 1, 5, 0, 1, 4, 5, 0, 1, 2, 4, 1, 0, 5, 3, 1, 5, 4, 3, 1, 4, 2, 3), 208 + intArrayOf(1, 0, 1, 5, 1, 1, 4, 5, 1, 1, 2, 4, 0, 0, 5, 3, 0, 5, 4, 3, 0, 4, 2, 3), 209 + intArrayOf(1, 0, 5, 4, 1, 0, 1, 5, 0, 0, 4, 3, 0, 4, 5, 3, 0, 5, 2, 3, 0, 1, 2, 5)) 210 + } 211 + }
-12
src/main/java/com/jagex/runescape/scene/tile/FloorDecoration.java
··· 1 - package com.jagex.runescape.scene.tile; 2 - 3 - import com.jagex.runescape.media.renderable.Renderable; 4 - 5 - public class FloorDecoration { 6 - public int z; 7 - public int x; 8 - public int y; 9 - public Renderable renderable; 10 - public int uid; 11 - public byte config; 12 - }
+12
src/main/java/com/jagex/runescape/scene/tile/FloorDecoration.kt
··· 1 + package com.jagex.runescape.scene.tile 2 + 3 + import com.jagex.runescape.media.renderable.Renderable 4 + 5 + class FloorDecoration { 6 + @JvmField var z: Int = 0 7 + @JvmField var x: Int = 0 8 + @JvmField var y: Int = 0 9 + @JvmField var renderable: Renderable? = null 10 + @JvmField var uid: Int = 0 11 + @JvmField var config: Byte = 0 12 + }
-22
src/main/java/com/jagex/runescape/scene/tile/GenericTile.java
··· 1 - package com.jagex.runescape.scene.tile; 2 - 3 - public class GenericTile { 4 - 5 - public GenericTile(int colourA, int colourB, int colourC, int colourD, int texture, int rgbColor, boolean flat) { 6 - this.colourA = colourA; 7 - this.colourB = colourB; 8 - this.colourC = colourC; 9 - this.colourD = colourD; 10 - this.texture = texture; 11 - this.rgbColor = rgbColor; 12 - this.flat = flat; 13 - } 14 - 15 - public int colourA; 16 - public int colourB; 17 - public int colourD; 18 - public int colourC; 19 - public int texture; 20 - public boolean flat; 21 - public int rgbColor; 22 - }
+11
src/main/java/com/jagex/runescape/scene/tile/GenericTile.kt
··· 1 + package com.jagex.runescape.scene.tile 2 + 3 + class GenericTile( 4 + @JvmField var colourA: Int, 5 + @JvmField var colourB: Int, 6 + @JvmField var colourC: Int, 7 + @JvmField var colourD: Int, 8 + @JvmField var texture: Int, 9 + @JvmField var rgbColor: Int, 10 + @JvmField var flat: Boolean 11 + )
-37
src/main/java/com/jagex/runescape/scene/tile/SceneTile.java
··· 1 - package com.jagex.runescape.scene.tile; 2 - import com.jagex.runescape.scene.GroundItemTile; 3 - import com.jagex.runescape.scene.InteractiveObject; 4 - import com.jagex.runescape.collection.Node; 5 - 6 - public class SceneTile extends Node { 7 - 8 - public SceneTile(int x, int y, int z) { 9 - renderLevel = this.z = z; 10 - this.x = x; 11 - this.y = y; 12 - } 13 - 14 - public int z; 15 - public int x; 16 - public int y; 17 - public int renderLevel; 18 - public GenericTile plainTile; 19 - public ComplexTile shapedTile; 20 - public Wall wall; 21 - public WallDecoration wallDecoration; 22 - public FloorDecoration floorDecoration; 23 - public GroundItemTile groundItemTile; 24 - public int entityCount; 25 - public InteractiveObject[] interactiveObjects = new InteractiveObject[5]; 26 - public int[] sceneSpawnRequestsSize = new int[5]; 27 - public int interactiveObjectsSizeOR; 28 - public int logicHeight; 29 - public boolean draw; 30 - public boolean visible; 31 - public boolean drawEntities; 32 - public int wallCullDirection; 33 - public int wallUncullDirection; 34 - public int wallCullOppositeDirection; 35 - public int wallDrawFlags; 36 - public SceneTile tileBelow; 37 - }
+32
src/main/java/com/jagex/runescape/scene/tile/SceneTile.kt
··· 1 + package com.jagex.runescape.scene.tile 2 + 3 + import com.jagex.runescape.collection.Node 4 + import com.jagex.runescape.scene.GroundItemTile 5 + import com.jagex.runescape.scene.InteractiveObject 6 + 7 + class SceneTile( 8 + @JvmField var x: Int, 9 + @JvmField var y: Int, 10 + @JvmField var z: Int 11 + ) : Node() { 12 + @JvmField var renderLevel: Int = z 13 + @JvmField var plainTile: GenericTile? = null 14 + @JvmField var shapedTile: ComplexTile? = null 15 + @JvmField var wall: Wall? = null 16 + @JvmField var wallDecoration: WallDecoration? = null 17 + @JvmField var floorDecoration: FloorDecoration? = null 18 + @JvmField var groundItemTile: GroundItemTile? = null 19 + @JvmField var entityCount: Int = 0 20 + @JvmField var interactiveObjects: Array<InteractiveObject?> = arrayOfNulls(5) 21 + @JvmField var sceneSpawnRequestsSize: IntArray = IntArray(5) 22 + @JvmField var interactiveObjectsSizeOR: Int = 0 23 + @JvmField var logicHeight: Int = 0 24 + @JvmField var draw: Boolean = false 25 + @JvmField var visible: Boolean = false 26 + @JvmField var drawEntities: Boolean = false 27 + @JvmField var wallCullDirection: Int = 0 28 + @JvmField var wallUncullDirection: Int = 0 29 + @JvmField var wallCullOppositeDirection: Int = 0 30 + @JvmField var wallDrawFlags: Int = 0 31 + @JvmField var tileBelow: SceneTile? = null 32 + }
-16
src/main/java/com/jagex/runescape/scene/tile/Wall.java
··· 1 - package com.jagex.runescape.scene.tile; 2 - 3 - import com.jagex.runescape.media.renderable.Renderable; 4 - 5 - public class Wall { 6 - 7 - public int z; 8 - public int x; 9 - public int y; 10 - public int orientation; 11 - public int orientation2; 12 - public Renderable primary; 13 - public Renderable secondary; 14 - public int uid; 15 - public byte config; 16 - }
+15
src/main/java/com/jagex/runescape/scene/tile/Wall.kt
··· 1 + package com.jagex.runescape.scene.tile 2 + 3 + import com.jagex.runescape.media.renderable.Renderable 4 + 5 + class Wall { 6 + @JvmField var z: Int = 0 7 + @JvmField var x: Int = 0 8 + @JvmField var y: Int = 0 9 + @JvmField var orientation: Int = 0 10 + @JvmField var orientation2: Int = 0 11 + @JvmField var primary: Renderable? = null 12 + @JvmField var secondary: Renderable? = null 13 + @JvmField var uid: Int = 0 14 + @JvmField var config: Byte = 0 15 + }
-18
src/main/java/com/jagex/runescape/scene/tile/WallDecoration.java
··· 1 - package com.jagex.runescape.scene.tile; 2 - 3 - import com.jagex.runescape.media.renderable.Renderable; 4 - 5 - public class WallDecoration { 6 - 7 - public WallDecoration() { 8 - } 9 - 10 - public int z; 11 - public int x; 12 - public int y; 13 - public int configBits; 14 - public int face; 15 - public Renderable renderable; 16 - public int uid; 17 - public byte config; 18 - }
+14
src/main/java/com/jagex/runescape/scene/tile/WallDecoration.kt
··· 1 + package com.jagex.runescape.scene.tile 2 + 3 + import com.jagex.runescape.media.renderable.Renderable 4 + 5 + class WallDecoration { 6 + @JvmField var z: Int = 0 7 + @JvmField var x: Int = 0 8 + @JvmField var y: Int = 0 9 + @JvmField var configBits: Int = 0 10 + @JvmField var face: Int = 0 11 + @JvmField var renderable: Renderable? = null 12 + @JvmField var uid: Int = 0 13 + @JvmField var config: Byte = 0 14 + }