Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 377 headicon parsing #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions src/Rs317.Library.Client/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ public int GetInterfaceSettings(int index)
private int[] menuActionId;
private int[] menuActionData1;
protected Sprite[] headIcons;
protected Sprite[] skullIcons;
private int anInt1098;
private int anInt1099;
private int anInt1100;
Expand Down Expand Up @@ -661,6 +662,7 @@ public Client(ClientConfiguration config, IBufferFactory bufferFactory, IRunnabl
menuActionId = new int[500];
menuActionData1 = new int[500];
headIcons = new Sprite[20];
skullIcons = new Sprite[20];
drawTabIcons = false;
chatboxInputNeededString = "";
playerActionText = new String[5];
Expand Down Expand Up @@ -2112,6 +2114,7 @@ protected override void cleanUpForQuit()
minimapCompassImage = null;
hitMarkImage = null;
headIcons = null;
skullIcons = null;
crosses = null;
mapDotItem = null;
mapDotNPC = null;
Expand Down Expand Up @@ -12729,9 +12732,14 @@ protected void InitializeUnpackedMedia(Archive archiveMedia)

try
{
for (int i = 0; i < 20; i++)
for (int i = 0; i < 8; i++)
{
headIcons[i] = new Sprite(archiveMedia, "headicons_prayer", i, metadataBuffer);
}

for (int i = 0; i < 3; i++)
{
headIcons[i] = new Sprite(archiveMedia, "headicons", i, metadataBuffer);
skullIcons[i] = new Sprite(archiveMedia, "headicons_pk", i, metadataBuffer);
}
}
catch (Exception _ex)
Expand Down Expand Up @@ -12860,15 +12868,19 @@ private void updateEntities()
if(player.headIcon != 0)
{
calculateEntityScreenPosition(((target)), target.height + 15);
if(spriteDrawX > -1)
if (spriteDrawX > -1)
{
for(int icon = 0; icon < 8; icon++)
if((player.headIcon & 1 << icon) != 0)
{
headIcons[icon].drawImage(spriteDrawX - 12, spriteDrawY - height);
height -= 25;
}
if (player.skullIcon < 2)
{
skullIcons[player.skullIcon].drawImage(spriteDrawX - 12, spriteDrawY - height);
height += 25;
}

if (player.headIcon < 7)
{
headIcons[player.headIcon].drawImage(spriteDrawX - 12, spriteDrawY - height);
height -= 25;
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/Rs317.Library.Client/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public sealed class Player : Entity
public static Cache mruNodes = new Cache(260);
public int combatLevel;
public int headIcon;
public int skullIcon;
public int modifiedAppearanceStartTime;
public int modifiedAppearanceEndTime { get; set; }
public int drawHeight2 { get; set; }
Expand Down Expand Up @@ -322,6 +323,8 @@ public void updatePlayerAppearance(Default317Buffer stream)
stream.position = 0;
gender = stream.getUnsignedByte();
headIcon = stream.getUnsignedByte();
skullIcon = stream.getUnsignedByte();

npcAppearance = null;
this.team = 0;
for (int slot = 0; slot < 12; slot++)
Expand Down