Originally Posted by
Professor Oak
Yes exactly... That's the main point of this?
Since the one which you're fighting is rendered first, it works just fine.
It makes it so that other players cannot be "annoying" and walk into the player you're fighting and make you click on them instead.
Just added it for npcs aswell. It will draw the one you're interacting with on top.
edit: When modifying npc priority drawing, for proper menu drawing modify the calls for buildNpcMenu/buildPlayerMenu.
Whats the purpose of the boolean in showNpc?
Code:
private void showOtherNpcs(){
for(int index = 0; index < this.npcCount; index++) {
NPC npc = this.npcArray[this.npcIndices[index]];
if(myPlayer.interactingEntity != -1 && myPlayer.interactingEntity < 32768){
if(npc.index == myPlayer.interactingEntity){
continue;
}
}
showNpc(npc, index, true);
}
}
private boolean prioritizedNpc(NPC npc) {
if(myPlayer.interactingEntity != -1 && myPlayer.interactingEntity < 32768){
if(npc.index == myPlayer.interactingEntity){
return true;
}
}
return false;
}
private void showPrioritizedNpcs(){
for(int index = 0; index < this.npcCount; index++) {
NPC npc = this.npcArray[this.npcIndices[index]];
if(prioritizedNpc(npc)){
showNpc(npc, index, true);
}
}
}
private boolean showNpc(NPC npc, int index, boolean flag) {
if (npc == null || !npc.isVisible() && npc.desc.aBoolean93 == flag) {
return false;
}
int l = npc.x >> 7;
int i1 = npc.y >> 7;
if(l < 0 || l >= 104 || i1 < 0 || i1 >= 104) {
return false;
}
if(npc.anInt1540 == 1 && (npc.x & 127) == 64 && (npc.y & 127) == 64) {
if(this.anIntArrayArray929[l][i1] == this.anInt1265) {
return false;
}
this.anIntArrayArray929[l][i1] = this.anInt1265;
}
int k = 536870912 + (index << 14);
if(!npc.desc.aBoolean84) {
k -= Integer.MIN_VALUE;
}
this.worldController.method285(this.plane, npc.anInt1552, this.method42(this.plane, npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60, npc.x, npc, npc.aBoolean1541);
return true;
}