Skip to content

Commit d2bf085

Browse files
committed
refactor: rename and move drawMinimapIcon to Minimap
1 parent e87aa94 commit d2bf085

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

src/main/java/org/runejs/client/MovedStatics.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -901,27 +901,6 @@ public static int method614(int arg1, int arg2, int arg3) {
901901
return (arg3 * (0xff00 & arg2) + i_7_ * (0xff00 & arg1) & 0xff0000) + (~0xff00ff & (0xff00ff & arg1) * i_7_ + arg3 * (0xff00ff & arg2)) >> 8;
902902
}
903903

904-
public static void drawMinimapMark(ImageRGB sprite, int mapX, int mapY) {
905-
int len = mapX * mapX + mapY * mapY;
906-
if (len > 4225 && len < 90000) {
907-
int theta = 0x7ff & Main.playerCamera.getYaw();
908-
int sine = Model.SINE[theta];
909-
int cosine = Model.COSINE[theta];
910-
int zoom = 0;
911-
912-
sine = sine * 256 / (zoom + 256);
913-
cosine = cosine * 256 / (zoom + 256);
914-
int y = cosine * mapY - sine * mapX >> 16;
915-
int x = mapX * cosine + mapY * sine >> 16;
916-
double angle = Math.atan2(x, y);
917-
int drawX = (int) (Math.sin(angle) * 63.0);
918-
int drawY = (int) (57.0 * Math.cos(angle));
919-
minimapEdge.drawRotated(-10 + 94 + drawX + 4, 83 + -drawY + -20, 15, 15, 20, 20, 256, angle);
920-
} else {
921-
Minimap.drawOnMinimap(mapY, mapX, sprite);
922-
}
923-
}
924-
925904
/**
926905
* Processes a new status code
927906
* @param statusCode Can be one of these values:

src/main/java/org/runejs/client/frame/Minimap.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,20 +150,20 @@ else if(isTeammate)
150150
if(npc != null) {
151151
int npcX = -(Player.localPlayer.worldX / 32) + npc.worldX / 32;
152152
int npcY = npc.worldY / 32 - Player.localPlayer.worldY / 32;
153-
MovedStatics.drawMinimapMark(minimapMarkers[1], npcX, npcY);
153+
drawMinimapIcon(minimapMarkers[1], npcX, npcY);
154154
}
155155
}
156156
if(Player.headIconDrawType == 2) {
157157
int hintX = -(Player.localPlayer.worldY / 32) + 2 + 4 * (-Class26.baseY + MovedStatics.hintIconPosY);
158158
int hintY = 4 * (ProducingGraphicsBuffer.hintIconPosX - MovedStatics.baseX) - (-2 + Player.localPlayer.worldX / 32);
159-
MovedStatics.drawMinimapMark(minimapMarkers[1], hintY, hintX);
159+
drawMinimapIcon(minimapMarkers[1], hintY, hintX);
160160
}
161161
if(Player.headIconDrawType == 10 && ProducingGraphicsBuffer.anInt1623 >= 0 && Player.trackedPlayers.length > ProducingGraphicsBuffer.anInt1623) {
162162
Player player = Player.trackedPlayers[ProducingGraphicsBuffer.anInt1623];
163163
if(player != null) {
164164
int playerX = -(Player.localPlayer.worldY / 32) + player.worldY / 32;
165165
int playerY = player.worldX / 32 - Player.localPlayer.worldX / 32;
166-
MovedStatics.drawMinimapMark(minimapMarkers[1], playerY, playerX);
166+
drawMinimapIcon(minimapMarkers[1], playerY, playerX);
167167
}
168168
}
169169
}
@@ -187,6 +187,27 @@ public static void createMinimapRaster() {
187187
mapbackProducingGraphicsBuffer.prepareRasterizer();
188188
}
189189

190+
private static void drawMinimapIcon(ImageRGB sprite, int mapX, int mapY) {
191+
int len = mapX * mapX + mapY * mapY;
192+
if (len > 4225 && len < 90000) {
193+
int theta = 0x7ff & Main.playerCamera.getYaw();
194+
int sine = Model.SINE[theta];
195+
int cosine = Model.COSINE[theta];
196+
int zoom = 0;
197+
198+
sine = sine * 256 / (zoom + 256);
199+
cosine = cosine * 256 / (zoom + 256);
200+
int y = cosine * mapY - sine * mapX >> 16;
201+
int x = mapX * cosine + mapY * sine >> 16;
202+
double angle = Math.atan2(x, y);
203+
int drawX = (int) (Math.sin(angle) * 63.0);
204+
int drawY = (int) (57.0 * Math.cos(angle));
205+
MovedStatics.minimapEdge.drawRotated(-10 + 94 + drawX + 4, 83 + -drawY + -20, 15, 15, 20, 20, 256, angle);
206+
} else {
207+
drawOnMinimap(mapY, mapX, sprite);
208+
}
209+
}
210+
190211
public void drawResizableMiniMapArea(int x, int y) {
191212
ScreenController.drawFramePiece(resizableMiniMapimage, x, y);
192213
}

0 commit comments

Comments
 (0)