Thread: Prioritized player drawing

Page 1 of 3 123 LastLast
Results 1 to 10 of 26
  1. #1 Prioritized player drawing 
    Registered Member

    Join Date
    Jun 2016
    Posts
    309
    Thanks given
    205
    Thanks received
    168
    Rep Power
    201
    I saw someone who [Only registered and activated users can see links. ] and decided to add it myself since it's a cool feature.

    The RS client will always draw your own player first.
    What this does is basically draw the player you're interacting with (following, fighting, etc) after yours.
    This will make it "prioritized" and shown on the top in a stack of players.

    What you're adding:
    Players you are fighting/following/interacting with will always be drawn on top when multiple players are standing in the same tile.


    Locate this piece of code:
    (showOtherPlayers is probably called method47 if your client isn't refactored)


    And change it to the following:

    Code:
    	private void moveCameraWithPlayer() {
    		anInt1265++;
    		showPrioritizedPlayers();
    		showNPCs(true);
    		showOtherPlayers();

    And then add the following methods:

    Code:
    private void showPrioritizedPlayers() {
    		showPlayer(localPlayer, internalLocalPlayerIndex << 14, true);
    		
    		//Draw the player we're interacting with
    		//Interacting includes combat, following, etc.
    		int interact = localPlayer.interactingEntity - 32768;
    		if(interact > 0) {
    			Player player = players[interact];			
    			showPlayer(player, interact << 14, false);
    		}
    	}
    	
    	private void showOtherPlayers() {
    		for (int l = 0; l < playerCount; l++) {
    			Player player = players[playerList[l]];
    			int index = playerList[l] << 14;
    			
    			//Don't draw interacting player as we've already drawn it on top
    			int interact_index = (localPlayer.interactingEntity - 32768);
    			if(interact_index > 0 && index == interact_index << 14) {
    				continue;
    			}
    			
    			if(!showPlayer(player, index, false)) {
    				continue;
    			}
    		}
    	}
    
    	private boolean showPlayer(Player player, int i1, boolean flag) {
    		if (player == null || !player.isVisible()) {
    			return false;
    		}
    		player.aBoolean1699 = (lowMemory && playerCount > 50 || playerCount > 200) && !flag && player.movementAnimation == player.idleAnimation;
    		int j1 = player.x >> 7;
    		int k1 = player.y >> 7;
    		if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) {
    			return false;
    		}
    		if (player.playerModel != null && tick >= player.objectModelStart && tick < player.objectModelStop) {
    			player.aBoolean1699 = false;
    			player.anInt1709 = getCenterHeight(plane, player.y, player.x);
    			scene.addToScenePlayerAsObject(plane, player.y, player, player.orientation, player.objectAnInt1722GreaterYLoc, player.x, player.anInt1709, player.objectAnInt1719LesserXLoc, player.objectAnInt1721GreaterXLoc, i1, player.objectAnInt1720LesserYLoc);
    			return false;
    		}
    		if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
    			if (anIntArrayArray929[j1][k1] == anInt1265) {
    				return false;
    			}
    			anIntArrayArray929[j1][k1] = anInt1265;
    		}
    		player.anInt1709 = getCenterHeight(plane, player.y, player.x);
    		scene.addAnimableA(plane, player.orientation, player.anInt1709, i1, player.y, 60, player.x, player, player.animationStretches);
    		return true;
    	}
    Note: The showPlayer method is a slightly modified version of method47 (showOtherPlayers). If you receive errors, simply look at method47 (showOtherPlayers) and copy the fields from there.
    You can remove method47 (showOtherPlayers) after adding this.
    Reply With Quote  
     


  2. #2  
    Registered Member
    Vippy's Avatar
    Join Date
    Oct 2014
    Age
    18
    Posts
    1,728
    Thanks given
    639
    Thanks received
    549
    Rep Power
    4640
    very nice not seen this before.
    Reply With Quote  
     

  3. #3  
    Sponjebobu
    Idiot Bird's Avatar
    Join Date
    Mar 2009
    Posts
    6,504
    Thanks given
    1,543
    Thanks received
    2,205
    Rep Power
    4339
    I'm not sure how the client draws entities, but wouldn't it be possible to do this equally with NPC's within the same method, I'm sure a entity system is in place to draw players & NPCs.

    Other than that, really good job at this.

    Kandarin's Website: [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
    The greatest upcoming OSRS PK server
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Jun 2016
    Posts
    309
    Thanks given
    205
    Thanks received
    168
    Rep Power
    201
    Quote Originally Posted by Vippy View Post
    very nice not seen this before.
    It can probably be done in a better way but I'm not really good with clients haha.
    Reply With Quote  
     

  5. #5  
    Sponjebobu
    Idiot Bird's Avatar
    Join Date
    Mar 2009
    Posts
    6,504
    Thanks given
    1,543
    Thanks received
    2,205
    Rep Power
    4339
    Quote Originally Posted by Professor Oak View Post
    It can probably be done in a better way but I'm not really good with clients haha.
    Me neither haha

    Kandarin's Website: [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
    The greatest upcoming OSRS PK server
    Reply With Quote  
     

  6. #6  
    Retired

    Leanbow's Avatar
    Join Date
    Feb 2008
    Posts
    5,868
    Thanks given
    1,539
    Thanks received
    2,507
    Rep Power
    5000
    Now add that for hit, hpbar and options. There's a lot more to it than just player model

    [Only registered and activated users can see links. ] - Latest update 07/19
    Reply With Quote  
     

  7. Thankful users:


  8. #7  
    Registered Member

    Join Date
    Jun 2016
    Posts
    309
    Thanks given
    205
    Thanks received
    168
    Rep Power
    201
    Quote Originally Posted by Idiot Bird View Post
    I'm not sure how the client draws entities, but wouldn't it be possible to do this equally with NPC's within the same method, I'm sure a entity system is in place to draw players & NPCs.

    Other than that, really good job at this.
    Thanks pal.
    Yeah it's possible, it pretty much draws npcs the exact same way.

    Quote Originally Posted by Leanbow View Post
    Now add that for hit, hpbar and options. There's a lot more to it than just player model
    I've tested this quite a lot and it doesn't seem to mess up anything, options and hp bars are updated accordingly.
    I too thought that it would mess up options such as right clicks. But it works perfectly haha. I'm surprised myself.
    Reply With Quote  
     

  9. Thankful user:


  10. #8  
    Retired

    Leanbow's Avatar
    Join Date
    Feb 2008
    Posts
    5,868
    Thanks given
    1,539
    Thanks received
    2,507
    Rep Power
    5000
    Quote Originally Posted by Professor Oak View Post
    Thanks pal.
    Yeah it's possible, it pretty much draws npcs the exact same way.



    I've tested this quite a lot and it doesn't seem to mess up anything, options and hp bars are updated accordingly.
    I too thought that it would mess up options such as right clicks. But it works perfectly haha. I'm surprised myself.
    That's not what I mean, go inside wilderness and test the left click attack option. It should change according to which player is rendered first

    [Only registered and activated users can see links. ] - Latest update 07/19
    Reply With Quote  
     

  11. #9  
    Registered Member

    Join Date
    Jun 2016
    Posts
    309
    Thanks given
    205
    Thanks received
    168
    Rep Power
    201
    Quote Originally Posted by Leanbow View Post
    That's not what I mean, go inside wilderness and test the left click attack option. It should change according to which player is rendered first
    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.


    Quote Originally Posted by Idiot Bird View Post
    I'm not sure how the client draws entities, but wouldn't it be possible to do this equally with NPC's within the same method, I'm sure a entity system is in place to draw players & NPCs.

    Other than that, really good job at this.
    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.
    Reply With Quote  
     

  12. Thankful user:


  13. #10  
    Dawntained makes it rain.

    Mgt Madness's Avatar
    Join Date
    Oct 2011
    Age
    21
    Posts
    2,740
    Thanks given
    1,217
    Thanks received
    681
    Rep Power
    280
    So good, gj man



    Reply With Quote  
     

  14. Thankful user:


Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Drawing player minimap dot
    By blood rush20 in forum Help
    Replies: 2
    Last Post: 07-16-2013, 02:42 AM
  2. Drawing Player Head
    By Ey Cuzzo in forum Help
    Replies: 2
    Last Post: 01-06-2013, 09:49 PM
  3. Drawing player model.
    By Creedance in forum Requests
    Replies: 1
    Last Post: 08-11-2009, 11:40 PM
  4. Packet 101 - Draw your player model on interface
    By veer in forum RS 503+ Client & Server
    Replies: 0
    Last Post: 09-01-2008, 08:11 PM
  5. Packet 64 - Draw Player model onto widget/interface [508]
    By veer in forum RS 503+ Client & Server
    Replies: 1
    Last Post: 09-01-2008, 08:02 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •