SetSkin and GetSkinCount added to PlayerInfo class

This commit is contained in:
Jon Heard 2024-04-28 19:39:45 -04:00 committed by Rachael Alexanderson
parent 9b8c79d182
commit 4c27b55eb9
2 changed files with 25 additions and 0 deletions

View file

@ -520,6 +520,23 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, SetFOV)
return 0;
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, SetSkin)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
PARAM_INT(skinIndex);
if (skinIndex >= 0 && skinIndex < Skins.size())
{
// commented code - cvar_set calls this automatically, along with saving the skin selection.
//self->userinfo.SkinNumChanged(skinIndex);
cvar_set("skin", Skins[skinIndex].Name.GetChars());
ACTION_RETURN_INT(self->userinfo.GetSkin());
}
else
{
ACTION_RETURN_INT(-1);
}
}
//===========================================================================
//
// EnumColorsets
@ -773,6 +790,12 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, GetSkin)
ACTION_RETURN_INT(self->userinfo.GetSkin());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetSkinCount)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_INT(Skins.size());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetGender)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);

View file

@ -2867,6 +2867,7 @@ struct PlayerInfo native play // self is what internally is known as player_t
native clearscope int GetColorSet() const;
native clearscope int GetPlayerClassNum() const;
native clearscope int GetSkin() const;
native clearscope int GetSkinCount() const;
native clearscope bool GetNeverSwitch() const;
native clearscope int GetGender() const;
native clearscope int GetTeam() const;
@ -2878,6 +2879,7 @@ struct PlayerInfo native play // self is what internally is known as player_t
native bool GetFViewBob() const;
native double GetStillBob() const;
native void SetFOV(float fov);
native int SetSkin(int skinIndex);
native clearscope bool GetClassicFlight() const;
native void SendPitchLimits();
native clearscope bool HasWeaponsInSlot(int slot) const;