12
12
import org .runejs .client .media .renderable .actor .Npc ;
13
13
import org .runejs .client .media .renderable .actor .Player ;
14
14
import org .runejs .client .media .renderable .actor .PlayerAppearance ;
15
- import org .runejs .client .net . ISAAC ;
15
+ import org .runejs .client .scene . Point2d ;
16
16
import org .runejs .client .scene .SceneCluster ;
17
17
import org .runejs .client .scene .tile .FloorDecoration ;
18
18
@@ -33,53 +33,58 @@ else if(i < Player.localPlayerCount)
33
33
actor = Player .npcs [Player .npcIds [i + -Player .localPlayerCount ]];
34
34
if (actor != null && actor .isInitialized ()) {
35
35
if (actor instanceof Npc ) {
36
- ActorDefinition actorDefinition = ((Npc ) actor ).actorDefinition ;
37
- if (actorDefinition .childIds != null )
38
- actorDefinition = actorDefinition .getChildDefinition ();
39
- if (actorDefinition == null )
36
+ ActorDefinition npcDefinition = ((Npc ) actor ).actorDefinition ;
37
+ if (npcDefinition .childIds != null )
38
+ npcDefinition = npcDefinition .getChildDefinition ();
39
+ if (npcDefinition == null )
40
40
continue ;
41
41
}
42
42
if (Player .localPlayerCount <= i ) {
43
- ActorDefinition class40_sub5_sub5 = ((Npc ) actor ).actorDefinition ;
44
- if (class40_sub5_sub5 .headIcon >= 0 && class40_sub5_sub5 .headIcon < ProducingGraphicsBuffer_Sub1 .headIconSprites .length ) {
45
- FloorDecoration .method342 (actor .anInt3117 + 15 , actor );
46
- if (ISAAC .anInt522 > -1 )
47
- ProducingGraphicsBuffer_Sub1 .headIconSprites [class40_sub5_sub5 .headIcon ].drawImage (-12 + ISAAC .anInt522 , Class44 .anInt1048 + -30 );
43
+ ActorDefinition npcDefinition = ((Npc ) actor ).actorDefinition ;
44
+ if (npcDefinition .headIcon >= 0 && npcDefinition .headIcon < ProducingGraphicsBuffer_Sub1 .headIconSprites .length ) {
45
+ Point2d screenPos = MovedStatics .getProjectedScreenPosition (actor .anInt3117 + 15 , actor .worldY , actor .worldX );
46
+
47
+ if (screenPos != null )
48
+ ProducingGraphicsBuffer_Sub1 .headIconSprites [npcDefinition .headIcon ].drawImage (-12 + screenPos .x , screenPos .y + -30 );
48
49
}
49
50
if (Player .headIconDrawType == 1 && HuffmanEncoding .anInt1545 == Player .npcIds [-Player .localPlayerCount + i ] && MovedStatics .pulseCycle % 20 < 10 ) {
50
- FloorDecoration . method342 ( 15 + actor .anInt3117 , actor );
51
- if (ISAAC . anInt522 > - 1 )
52
- MovedStatics .hintIconSprites [0 ].drawImage (ISAAC . anInt522 + -12 , Class44 . anInt1048 + -28 );
51
+ Point2d screenPos = MovedStatics . getProjectedScreenPosition ( actor . anInt3117 + 15 , actor .worldY , actor . worldX );
52
+ if (screenPos != null )
53
+ MovedStatics .hintIconSprites [0 ].drawImage (screenPos . x + -12 , screenPos . y + -28 );
53
54
}
54
55
} else {
55
- Player class40_sub5_sub17_sub4_sub1 = (Player ) actor ;
56
- int i_0_ = 30 ;
57
- if (class40_sub5_sub17_sub4_sub1 .isSkulled != -1 || class40_sub5_sub17_sub4_sub1 .headIcon != -1 ) {
58
- FloorDecoration .method342 (15 + actor .anInt3117 , actor );
59
- if (ISAAC .anInt522 > -1 ) {
60
- if (class40_sub5_sub17_sub4_sub1 .isSkulled != -1 ) {
61
- FloorDecoration .aClass40_Sub5_Sub14_Sub4Array603 [class40_sub5_sub17_sub4_sub1 .isSkulled ].drawImage (ISAAC .anInt522 - 12 , Class44 .anInt1048 - i_0_ );
62
- i_0_ += 25 ;
56
+ Player targetPlayer = (Player ) actor ;
57
+ int drawHeight = 30 ;
58
+ if (targetPlayer .isSkulled != -1 || targetPlayer .headIcon != -1 ) {
59
+ Point2d screenPos = MovedStatics .getProjectedScreenPosition (actor .anInt3117 + 15 , actor .worldY , actor .worldX );
60
+
61
+ if (screenPos != null ) {
62
+ if (targetPlayer .isSkulled != -1 ) {
63
+ FloorDecoration .aClass40_Sub5_Sub14_Sub4Array603 [targetPlayer .isSkulled ].drawImage (screenPos .x - 12 , screenPos .y - drawHeight );
64
+ drawHeight += 25 ;
63
65
}
64
- if (class40_sub5_sub17_sub4_sub1 .headIcon != -1 ) {
65
- ProducingGraphicsBuffer_Sub1 .headIconSprites [class40_sub5_sub17_sub4_sub1 .headIcon ].drawImage (- 12 + ISAAC . anInt522 , Class44 . anInt1048 + - i_0_ );
66
- i_0_ += 25 ;
66
+ if (targetPlayer .headIcon != -1 ) {
67
+ ProducingGraphicsBuffer_Sub1 .headIconSprites [targetPlayer .headIcon ].drawImage (screenPos . x - 12 , screenPos . y - drawHeight );
68
+ drawHeight += 25 ;
67
69
}
68
70
}
69
71
}
70
72
if (i >= 0 && Player .headIconDrawType == 10 && ProducingGraphicsBuffer .anInt1623 == Player .trackedPlayerIndices [i ]) {
71
- FloorDecoration .method342 (actor .anInt3117 + 15 , actor );
72
- if (ISAAC .anInt522 > -1 )
73
- MovedStatics .hintIconSprites [1 ].drawImage (-12 + ISAAC .anInt522 , Class44 .anInt1048 + -i_0_ );
73
+ Point2d screenPos = MovedStatics .getProjectedScreenPosition (actor .anInt3117 + 15 , actor .worldY , actor .worldX );
74
+
75
+ if (screenPos != null ) {
76
+ MovedStatics .hintIconSprites [1 ].drawImage (screenPos .x - 12 , screenPos .y - drawHeight );
77
+ }
74
78
}
75
79
}
76
80
if (actor .forcedChatMessage != null && (i >= Player .localPlayerCount || ChatBox .publicChatMode == 0 || ChatBox .publicChatMode == 3 || ChatBox .publicChatMode == 1 && Player .hasFriend (((Player ) actor ).playerName ))) {
77
- FloorDecoration .method342 (actor .anInt3117 , actor );
78
- if (ISAAC .anInt522 > -1 && 50 > SceneCluster .anInt770 ) {
81
+ Point2d screenPos = MovedStatics .getProjectedScreenPosition (actor .anInt3117 , actor .worldY , actor .worldX );
82
+
83
+ if (screenPos != null && 50 > SceneCluster .anInt770 ) {
79
84
PlayerAppearance .anIntArray680 [SceneCluster .anInt770 ] = TypeFace .fontBold .getStringWidth (actor .forcedChatMessage ) / 2 ;
80
85
PlayerAppearance .anIntArray688 [SceneCluster .anInt770 ] = TypeFace .fontBold .characterDefaultHeight ;
81
- PlayerAppearance .anIntArray715 [SceneCluster .anInt770 ] = ISAAC . anInt522 ;
82
- PlayerAppearance .anIntArray685 [SceneCluster .anInt770 ] = Class44 . anInt1048 ;
86
+ PlayerAppearance .anIntArray715 [SceneCluster .anInt770 ] = screenPos . x ;
87
+ PlayerAppearance .anIntArray685 [SceneCluster .anInt770 ] = screenPos . y ;
83
88
PlayerAppearance .overheadChatColor [SceneCluster .anInt770 ] = actor .chatcolor ;
84
89
PlayerAppearance .overheadChatShape [SceneCluster .anInt770 ] = actor .chatEffects ;
85
90
PlayerAppearance .anIntArray684 [SceneCluster .anInt770 ] = actor .anInt3078 ;
@@ -88,32 +93,32 @@ else if(i < Player.localPlayerCount)
88
93
}
89
94
}
90
95
if (MovedStatics .pulseCycle < actor .anInt3139 ) {
91
- FloorDecoration .method342 (actor .anInt3117 + 15 , actor );
92
- if (ISAAC .anInt522 > -1 ) {
96
+ Point2d screenPos = MovedStatics .getProjectedScreenPosition (actor .anInt3117 + 15 , actor .worldY , actor .worldX );
97
+
98
+ if (screenPos != null ) {
93
99
int i_1_ = 30 * actor .remainingHitpoints / actor .maximumHitpoints ;
94
100
if (i_1_ > 30 )
95
101
i_1_ = 30 ;
96
- Rasterizer .drawFilledRectangle (-15 + ISAAC . anInt522 , Class44 . anInt1048 + -3 , i_1_ , 5 , 65280 );
97
- Rasterizer .drawFilledRectangle (-15 + ISAAC . anInt522 + i_1_ , Class44 . anInt1048 + -3 , 30 + -i_1_ , 5 , 16711680 );
102
+ Rasterizer .drawFilledRectangle (-15 + screenPos . x , screenPos . y + -3 , i_1_ , 5 , 65280 );
103
+ Rasterizer .drawFilledRectangle (-15 + screenPos . x + i_1_ , screenPos . y + -3 , 30 + -i_1_ , 5 , 16711680 );
98
104
}
99
105
}
100
106
for (int i_2_ = 0 ; i_2_ < 4 ; i_2_ ++) {
101
107
if (MovedStatics .pulseCycle < actor .anIntArray3136 [i_2_ ]) {
102
- FloorDecoration .method342 (actor .anInt3117 / 2 , actor );
103
- if (ISAAC .anInt522 > -1 ) {
104
- if (i_2_ == 1 )
105
- Class44 .anInt1048 -= 20 ;
108
+ Point2d screenPos = MovedStatics .getProjectedScreenPosition (actor .anInt3117 / 2 , actor .worldY , actor .worldX );
109
+ if (screenPos != null ) {
110
+ if (i_2_ == 1 ) {
111
+ screenPos = screenPos .addY (-20 );
112
+ }
106
113
if (i_2_ == 2 ) {
107
- ISAAC .anInt522 -= 15 ;
108
- Class44 .anInt1048 -= 10 ;
114
+ screenPos = screenPos .add (new Point2d (-15 , -10 ));
109
115
}
110
116
if (i_2_ == 3 ) {
111
- ISAAC .anInt522 += 15 ;
112
- Class44 .anInt1048 -= 10 ;
117
+ screenPos = screenPos .add (new Point2d (15 , -10 ));
113
118
}
114
- AnimationSequence .aClass40_Sub5_Sub14_Sub4Array2474 [actor .anIntArray3086 [i_2_ ]].drawImage (ISAAC . anInt522 + -12 , -12 + Class44 . anInt1048 );
115
- TypeFace .fontSmall .drawStringLeft (Integer .toString (actor .anIntArray3087 [i_2_ ]), ISAAC . anInt522 , 4 + Class44 . anInt1048 , 0 );
116
- TypeFace .fontSmall .drawStringLeft (Integer .toString (actor .anIntArray3087 [i_2_ ]), ISAAC . anInt522 - 1 , Class44 . anInt1048 + 3 , 16777215 );
119
+ AnimationSequence .aClass40_Sub5_Sub14_Sub4Array2474 [actor .anIntArray3086 [i_2_ ]].drawImage (screenPos . x + -12 , -12 + screenPos . y );
120
+ TypeFace .fontSmall .drawStringLeft (Integer .toString (actor .anIntArray3087 [i_2_ ]), screenPos . x , 4 + screenPos . y , 0 );
121
+ TypeFace .fontSmall .drawStringLeft (Integer .toString (actor .anIntArray3087 [i_2_ ]), screenPos . x - 1 , screenPos . y + 3 , 16777215 );
117
122
}
118
123
}
119
124
}
@@ -134,8 +139,9 @@ else if(i < Player.localPlayerCount)
134
139
}
135
140
}
136
141
}
137
- ISAAC .anInt522 = PlayerAppearance .anIntArray715 [i ];
138
- Class44 .anInt1048 = PlayerAppearance .anIntArray685 [i ] = i_4_ ;
142
+ PlayerAppearance .anIntArray685 [i ] = i_4_ ;
143
+
144
+ Point2d screenPos = new Point2d (PlayerAppearance .anIntArray715 [i ], PlayerAppearance .anIntArray685 [i ]);
139
145
String message = PlayerAppearance .overheadChatMessage [i ];
140
146
if (MovedStatics .chatEffectsDisabled == 0 ) {
141
147
int textColor = MovedStatics .OVERHEAD_CHAT_COLORS [0 ];
@@ -181,45 +187,45 @@ else if(i_11_ < 150)
181
187
textColor = -(327685 * i_11_ ) + MovedStatics .OVERHEAD_CHAT_COLORS [5 ];
182
188
}
183
189
if (PlayerAppearance .overheadChatShape [i ] == ChatShapeEffect .NONE .getNetworkCode ()) {
184
- TypeFace .fontBold .drawStringLeft (message , ISAAC . anInt522 , Class44 . anInt1048 + 1 , 0 );
185
- TypeFace .fontBold .drawStringLeft (message , ISAAC . anInt522 , Class44 . anInt1048 , textColor );
190
+ TypeFace .fontBold .drawStringLeft (message , screenPos . x , screenPos . y + 1 , 0 );
191
+ TypeFace .fontBold .drawStringLeft (message , screenPos . x , screenPos . y , textColor );
186
192
}
187
193
if (PlayerAppearance .overheadChatShape [i ] == ChatShapeEffect .WAVE .getNetworkCode ()) {
188
- TypeFace .fontBold .drawCenteredStringWaveY (message , ISAAC . anInt522 , Class44 . anInt1048 + 1 , MovedStatics .anInt2628 , 0 );
189
- TypeFace .fontBold .drawCenteredStringWaveY (message , ISAAC . anInt522 , Class44 . anInt1048 , MovedStatics .anInt2628 , textColor );
194
+ TypeFace .fontBold .drawCenteredStringWaveY (message , screenPos . x , screenPos . y + 1 , MovedStatics .anInt2628 , 0 );
195
+ TypeFace .fontBold .drawCenteredStringWaveY (message , screenPos . x , screenPos . y , MovedStatics .anInt2628 , textColor );
190
196
}
191
197
if (PlayerAppearance .overheadChatShape [i ] == ChatShapeEffect .WAVE2 .getNetworkCode ()) {
192
- TypeFace .fontBold .drawCenteredStringWaveXY (message , ISAAC . anInt522 , 1 + Class44 . anInt1048 , MovedStatics .anInt2628 , 0 );
193
- TypeFace .fontBold .drawCenteredStringWaveXY (message , ISAAC . anInt522 , Class44 . anInt1048 , MovedStatics .anInt2628 , textColor );
198
+ TypeFace .fontBold .drawCenteredStringWaveXY (message , screenPos . x , 1 + screenPos . y , MovedStatics .anInt2628 , 0 );
199
+ TypeFace .fontBold .drawCenteredStringWaveXY (message , screenPos . x , screenPos . y , MovedStatics .anInt2628 , textColor );
194
200
}
195
201
if (PlayerAppearance .overheadChatShape [i ] == ChatShapeEffect .SHAKE .getNetworkCode ()) {
196
- TypeFace .fontBold .drawCenteredStringWaveXYMove (message , ISAAC . anInt522 , Class44 . anInt1048 + 1 , MovedStatics .anInt2628 , -PlayerAppearance .anIntArray684 [i ] + 150 , 0 );
197
- TypeFace .fontBold .drawCenteredStringWaveXYMove (message , ISAAC . anInt522 , Class44 . anInt1048 , MovedStatics .anInt2628 , -PlayerAppearance .anIntArray684 [i ] + 150 , textColor );
202
+ TypeFace .fontBold .drawCenteredStringWaveXYMove (message , screenPos . x , screenPos . y + 1 , MovedStatics .anInt2628 , -PlayerAppearance .anIntArray684 [i ] + 150 , 0 );
203
+ TypeFace .fontBold .drawCenteredStringWaveXYMove (message , screenPos . x , screenPos . y , MovedStatics .anInt2628 , -PlayerAppearance .anIntArray684 [i ] + 150 , textColor );
198
204
}
199
205
if (PlayerAppearance .overheadChatShape [i ] == ChatShapeEffect .SCROLL .getNetworkCode ()) {
200
206
int i_12_ = TypeFace .fontBold .getStringWidth (message );
201
207
int i_13_ = (i_12_ + 100 ) * (150 + -PlayerAppearance .anIntArray684 [i ]) / 150 ;
202
- Rasterizer .setBounds (ISAAC . anInt522 + -50 , 0 , 50 + ISAAC . anInt522 , 334 );
203
- TypeFace .fontBold .drawString (message , -i_13_ + ISAAC . anInt522 + 50 , Class44 . anInt1048 + 1 , 0 );
204
- TypeFace .fontBold .drawString (message , 50 + ISAAC . anInt522 + -i_13_ , Class44 . anInt1048 , textColor );
208
+ Rasterizer .setBounds (screenPos . x + -50 , 0 , 50 + screenPos . x , 334 );
209
+ TypeFace .fontBold .drawString (message , -i_13_ + screenPos . x + 50 , screenPos . y + 1 , 0 );
210
+ TypeFace .fontBold .drawString (message , 50 + screenPos . x + -i_13_ , screenPos . y , textColor );
205
211
Rasterizer .resetBounds ();
206
212
}
207
213
if (PlayerAppearance .overheadChatShape [i ] == ChatShapeEffect .SLIDE .getNetworkCode ()) {
208
214
int i_14_ = 0 ;
209
215
int i_15_ = 150 + -PlayerAppearance .anIntArray684 [i ];
210
- Rasterizer .setBounds (0 , -1 + -TypeFace .fontBold .characterDefaultHeight + Class44 . anInt1048 , 512 , 5 + Class44 . anInt1048 );
216
+ Rasterizer .setBounds (0 , -1 + -TypeFace .fontBold .characterDefaultHeight + screenPos . y , 512 , 5 + screenPos . y );
211
217
if (i_15_ >= 25 ) {
212
218
if (i_15_ > 125 )
213
219
i_14_ = i_15_ + -125 ;
214
220
} else
215
221
i_14_ = i_15_ + -25 ;
216
- TypeFace .fontBold .drawStringLeft (message , ISAAC . anInt522 , i_14_ + Class44 . anInt1048 + 1 , 0 );
217
- TypeFace .fontBold .drawStringLeft (message , ISAAC . anInt522 , i_14_ + Class44 . anInt1048 , textColor );
222
+ TypeFace .fontBold .drawStringLeft (message , screenPos . x , i_14_ + screenPos . y + 1 , 0 );
223
+ TypeFace .fontBold .drawStringLeft (message , screenPos . x , i_14_ + screenPos . y , textColor );
218
224
Rasterizer .resetBounds ();
219
225
}
220
226
} else {
221
- TypeFace .fontBold .drawStringLeft (message , ISAAC . anInt522 , Class44 . anInt1048 + 1 , 0 );
222
- TypeFace .fontBold .drawStringLeft (message , ISAAC . anInt522 , Class44 . anInt1048 , MovedStatics .OVERHEAD_CHAT_COLORS [0 ]);
227
+ TypeFace .fontBold .drawStringLeft (message , screenPos . x , screenPos . y + 1 , 0 );
228
+ TypeFace .fontBold .drawStringLeft (message , screenPos . x , screenPos . y , MovedStatics .OVERHEAD_CHAT_COLORS [0 ]);
223
229
}
224
230
}
225
231
}
0 commit comments