Thread: Prioritized player drawing

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36
  1. #1 Prioritized player drawing 
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    I saw someone who requested this 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.
    Attached image

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

    And change it to the following:
    Attached image
    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
    25
    Posts
    2,572
    Thanks given
    984
    Thanks received
    1,933
    Rep Power
    5000
    very nice not seen this before.
    Reply With Quote  
     

  3. #3  
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    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.
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  4. #4  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    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  
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    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
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  6. #6  
    Номер 1


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

  7. Thankful users:


  8. #7  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    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.
    Attached image
    Reply With Quote  
     

  9. Thankful user:


  10. #8  
    Номер 1


    Leanbow's Avatar
    Join Date
    Feb 2008
    Posts
    5,895
    Thanks given
    1,564
    Thanks received
    2,624
    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.
    Attached image
    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
    Reply With Quote  
     

  11. #9  
    Owner of Dawntained

    Mgt Madness's Avatar
    Join Date
    Oct 2011
    Age
    28
    Posts
    3,380
    Thanks given
    1,429
    Thanks received
    958
    Rep Power
    2168
    So good, gj man
    Attached image
    Reply With Quote  
     

  12. Thankful user:


  13. #10  
    Donator

    Arithium's Avatar
    Join Date
    May 2010
    Age
    31
    Posts
    4,721
    Thanks given
    199
    Thanks received
    1,256
    Rep Power
    1114
    Never really thought about this, nice job on adding it.
    Reply With Quote  
     

  14. Thankful user:


Page 1 of 4 123 ... LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

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
  •