Merge branch 'master' of https://github.com/raa-eruanna/qzdoom into qzdoom

This commit is contained in:
Magnus Norddahl 2017-02-18 09:18:40 +01:00
commit 4fc352a50d
28 changed files with 962 additions and 708 deletions

View file

@ -729,7 +729,7 @@ void D_WriteUserInfoStrings (int pnum, BYTE **stream, bool compact)
break;
case NAME_Skin:
*stream += sprintf(*((char **)stream), "\\%s", D_EscapeUserInfo(skins[info->GetSkin()].name).GetChars());
*stream += sprintf(*((char **)stream), "\\%s", D_EscapeUserInfo(Skins[info->GetSkin()].Name).GetChars());
break;
default:
@ -828,7 +828,7 @@ void D_ReadUserInfoStrings (int pnum, BYTE **stream, bool update)
players[pnum].mo->state->sprite ==
GetDefaultByType (players[pnum].cls)->SpawnState->sprite)
{ // Only change the sprite if the player is using a standard one
players[pnum].mo->sprite = skins[info->GetSkin()].sprite;
players[pnum].mo->sprite = Skins[info->GetSkin()].sprite;
}
}
// Rebuild translation in case the new skin uses a different range
@ -898,7 +898,7 @@ void WriteUserInfo(FSerializer &arc, userinfo_t &info)
switch (pair->Key.GetIndex())
{
case NAME_Skin:
string = skins[info.GetSkin()].name;
string = Skins[info.GetSkin()].Name;
break;
case NAME_PlayerClass:
@ -986,7 +986,7 @@ CCMD (playerinfo)
// Print special info
Printf("%20s: %s\n", "Name", ui->GetName());
Printf("%20s: %s (%d)\n", "Team", ui->GetTeam() == TEAM_NONE ? "None" : Teams[ui->GetTeam()].GetName(), ui->GetTeam());
Printf("%20s: %s (%d)\n", "Skin", skins[ui->GetSkin()].name, ui->GetSkin());
Printf("%20s: %s (%d)\n", "Skin", Skins[ui->GetSkin()].Name.GetChars(), ui->GetSkin());
Printf("%20s: %s (%d)\n", "Gender", GenderNames[ui->GetGender()], ui->GetGender());
Printf("%20s: %s (%d)\n", "PlayerClass",
ui->GetPlayerClassNum() == -1 ? "Random" : ui->GetPlayerClassType()->DisplayName.GetChars(),

View file

@ -297,6 +297,11 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
return aim;
}
}
// Same but unfiltered.
double GetAutoaim() const
{
return *static_cast<FFloatCVar *>(*CheckKey(NAME_Autoaim));
}
const char *GetName() const
{
return *static_cast<FStringCVar *>(*CheckKey(NAME_Name));

View file

@ -1695,7 +1695,7 @@ static void G_QueueBody (AActor *body)
{
// Apply skin's scale to actor's scale, it will be lost otherwise
const AActor *const defaultActor = body->GetDefault();
const FPlayerSkin &skin = skins[skinidx];
const FPlayerSkin &skin = Skins[skinidx];
body->Scale.X *= skin.Scale.X / defaultActor->Scale.X;
body->Scale.Y *= skin.Scale.Y / defaultActor->Scale.Y;

View file

@ -298,7 +298,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
// If a custom skin was in use, then reload it
// or else the base skin for the player class.
if ((unsigned int)player->userinfo.GetSkin() >= PlayerClasses.Size () &&
(size_t)player->userinfo.GetSkin() < numskins)
(unsigned)player->userinfo.GetSkin() < Skins.Size())
{
skinindex = player->userinfo.GetSkin();

View file

@ -489,7 +489,7 @@ FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accu
if (CurrentState != NULL)
{
int skin = player->userinfo.GetSkin();
const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->morphTics ? ((APlayerPawn*)GetDefaultByType(player->MorphedPlayerClass))->Face.GetChars() : skins[skin].face);
const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->morphTics ? ((APlayerPawn*)GetDefaultByType(player->MorphedPlayerClass))->Face.GetChars() : Skins[skin].Face.GetChars());
return CurrentState->GetCurrentFrameTexture(default_face, skin_face, level, angle);
}
return NULL;

View file

@ -50,6 +50,7 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, Armor2Percent)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, ArmorIcon1)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, ArmorIcon2)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gametype)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, norandomplayerclass)
const char *GameNames[17] =

View file

@ -593,7 +593,7 @@ void DIntermissionScreenCast::Drawer ()
if (!(mDefaults->flags4 & MF4_NOSKIN) &&
mDefaults->SpawnState != NULL && caststate->sprite == mDefaults->SpawnState->sprite &&
mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn)) &&
skins != NULL)
Skins.Size() > 0)
{
// Only use the skin sprite if this class has not been removed from the
// PlayerClasses list.
@ -601,7 +601,7 @@ void DIntermissionScreenCast::Drawer ()
{
if (PlayerClasses[i].Type == mClass)
{
FPlayerSkin *skin = &skins[players[consoleplayer].userinfo.GetSkin()];
FPlayerSkin *skin = &Skins[players[consoleplayer].userinfo.GetSkin()];
castsprite = skin->sprite;
if (!(mDefaults->flags4 & MF4_NOSKIN))

View file

@ -630,7 +630,11 @@ void M_SetMenu(FName menu, int param)
if (cls == nullptr) cls = PClass::FindClass("ListMenu");
DListMenu *newmenu = (DListMenu *)cls->CreateNew();
newmenu->Init(DMenu::CurrentMenu, ld);
IFVIRTUALPTRNAME(newmenu, "OptionMenu", Init)
{
VMValue params[3] = { newmenu, DMenu::CurrentMenu, ld };
GlobalVMStack.Call(func, params, 3, nullptr, 0);
}
M_ActivateMenu(newmenu);
}
}

View file

@ -48,12 +48,10 @@
#include "r_data/r_translate.h"
#include "v_text.h"
EXTERN_CVAR (String, playerclass)
EXTERN_CVAR (String, name)
EXTERN_CVAR (Int, team)
EXTERN_CVAR (Float, autoaim)
EXTERN_CVAR(Int, team)
EXTERN_CVAR(Float, autoaim)
EXTERN_CVAR(Bool, neverswitchonpickup)
EXTERN_CVAR (Bool, cl_run)
EXTERN_CVAR(Bool, cl_run)
//=============================================================================
//
@ -61,365 +59,42 @@ EXTERN_CVAR (Bool, cl_run)
//
//=============================================================================
class DPlayerMenu : public DListMenu
DEFINE_ACTION_FUNCTION(DPlayerMenu, ColorChanged)
{
DECLARE_CLASS(DPlayerMenu, DListMenu)
int PlayerClassIndex;
FPlayerClass *PlayerClass;
TArray<int> PlayerColorSets;
TArray<int> PlayerSkins;
int mRotation;
void PickPlayerClass ();
void UpdateColorsets();
void UpdateSkins();
void UpdateTranslation();
void SendNewColor (int red, int green, int blue);
void PlayerNameChanged(DMenuItemBase *li);
void ColorSetChanged (DMenuItemBase *li);
void ClassChanged (DMenuItemBase *li);
void AutoaimChanged (DMenuItemBase *li);
void SkinChanged (DMenuItemBase *li);
public:
DPlayerMenu() {}
void Init(DMenu *parent, DListMenuDescriptor *desc);
bool Responder (event_t *ev);
bool MenuEvent (int mkey, bool fromcontroller);
bool MouseEvent(int type, int x, int y);
void Ticker ();
void Drawer ();
};
IMPLEMENT_CLASS(DPlayerMenu, false, false)
//=============================================================================
//
//
//
//=============================================================================
enum EPDFlags
{
ListMenuItemPlayerDisplay_PDF_ROTATION = 0x10001,
ListMenuItemPlayerDisplay_PDF_SKIN = 0x10002,
ListMenuItemPlayerDisplay_PDF_CLASS = 0x10003,
ListMenuItemPlayerDisplay_PDF_MODE = 0x10004,
ListMenuItemPlayerDisplay_PDF_TRANSLATE = 0x10005,
};
void DPlayerMenu::Init(DMenu *parent, DListMenuDescriptor *desc)
{
DMenuItemBase *li;
Super::Init(parent, desc);
PickPlayerClass();
mRotation = 0;
li = GetItem(NAME_Playerdisplay);
if (li != NULL)
PARAM_SELF_PROLOGUE(DListMenu);
PARAM_INT(r);
PARAM_INT(g);
PARAM_INT(b);
// only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu)
{
li->SetValue(ListMenuItemPlayerDisplay_PDF_ROTATION, 0);
li->SetValue(ListMenuItemPlayerDisplay_PDF_MODE, 1);
li->SetValue(ListMenuItemPlayerDisplay_PDF_TRANSLATE, 1);
li->SetValue(ListMenuItemPlayerDisplay_PDF_CLASS, players[consoleplayer].userinfo.GetPlayerClassNum());
if (PlayerClass != NULL && !(GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN) &&
players[consoleplayer].userinfo.GetPlayerClassNum() != -1)
{
li->SetValue(ListMenuItemPlayerDisplay_PDF_SKIN, players[consoleplayer].userinfo.GetSkin());
}
char command[24];
players[consoleplayer].userinfo.ColorChanged(MAKERGB(r, g, b));
mysnprintf(command, countof(command), "color \"%02x %02x %02x\"", r, g, b);
C_DoCommand(command);
}
li = GetItem(NAME_Playerbox);
if (li != NULL)
{
li->SetString(0, name);
}
li = GetItem(NAME_Team);
if (li != NULL)
{
li->SetString(0, "None");
for(unsigned i=0;i<Teams.Size(); i++)
{
li->SetString(i+1, Teams[i].GetName());
}
li->SetValue(0, team == TEAM_NONE? 0 : team + 1);
}
int mycolorset = players[consoleplayer].userinfo.GetColorSet();
int color = players[consoleplayer].userinfo.GetColor();
UpdateColorsets();
li = GetItem(NAME_Red);
if (li != NULL)
{
li->Enable(mycolorset == -1);
li->SetValue(0, RPART(color));
}
li = GetItem(NAME_Green);
if (li != NULL)
{
li->Enable(mycolorset == -1);
li->SetValue(0, GPART(color));
}
li = GetItem(NAME_Blue);
if (li != NULL)
{
li->Enable(mycolorset == -1);
li->SetValue(0, BPART(color));
}
li = GetItem(NAME_Class);
if (li != NULL)
{
if (PlayerClasses.Size() == 1)
{
li->SetString(0, GetPrintableDisplayName(PlayerClasses[0].Type));
li->SetValue(0, 0);
}
else
{
// [XA] Remove the "Random" option if the relevant gameinfo flag is set.
if(!gameinfo.norandomplayerclass)
li->SetString(0, "Random");
for(unsigned i=0; i< PlayerClasses.Size(); i++)
{
const char *cls = GetPrintableDisplayName(PlayerClasses[i].Type);
li->SetString(gameinfo.norandomplayerclass ? i : i+1, cls);
}
int pclass = players[consoleplayer].userinfo.GetPlayerClassNum();
li->SetValue(0, gameinfo.norandomplayerclass && pclass >= 0 ? pclass : pclass + 1);
}
}
UpdateSkins();
li = GetItem(NAME_Gender);
if (li != NULL)
{
li->SetValue(0, players[consoleplayer].userinfo.GetGender());
}
li = GetItem(NAME_Autoaim);
if (li != NULL)
{
li->SetValue(0, (int)autoaim);
}
li = GetItem(NAME_Switch);
if (li != NULL)
{
li->SetValue(0, neverswitchonpickup);
}
li = GetItem(NAME_AlwaysRun);
if (li != NULL)
{
li->SetValue(0, cl_run);
}
if (mDesc->mSelectedItem < 0) mDesc->mSelectedItem = 1;
return 0;
}
//=============================================================================
//
//
// access to the player config is done natively, so that broader access
// functions do not need to be exported.
//
//=============================================================================
bool DPlayerMenu::Responder (event_t *ev)
DEFINE_ACTION_FUNCTION(DPlayerMenu, PlayerNameChanged)
{
if (ev->type == EV_GUI_Event && ev->subtype == EV_GUI_Char && ev->data1 == ' ')
PARAM_SELF_PROLOGUE(DListMenu);
PARAM_STRING(s);
const char *pp = s;
FString command("name \"");
if (self == DMenu::CurrentMenu)
{
// turn the player sprite around
mRotation = 8 - mRotation;
DMenuItemBase *li = GetItem(NAME_Playerdisplay);
if (li != NULL)
{
li->SetValue(ListMenuItemPlayerDisplay_PDF_ROTATION, mRotation);
}
return true;
}
return Super::Responder(ev);
}
//=============================================================================
//
//
//
//=============================================================================
void DPlayerMenu::UpdateTranslation()
{
int PlayerColor = players[consoleplayer].userinfo.GetColor();
int PlayerSkin = players[consoleplayer].userinfo.GetSkin();
int PlayerColorset = players[consoleplayer].userinfo.GetColorSet();
if (PlayerClass != NULL)
{
PlayerSkin = R_FindSkin (skins[PlayerSkin].name, int(PlayerClass - &PlayerClasses[0]));
R_GetPlayerTranslation(PlayerColor, GetColorSet(PlayerClass->Type, PlayerColorset),
&skins[PlayerSkin], translationtables[TRANSLATION_Players][MAXPLAYERS]);
}
}
//=============================================================================
//
//
//
//=============================================================================
void DPlayerMenu::PickPlayerClass()
{
/*
// What's the point of this? Aren't we supposed to edit the
// userinfo?
if (players[consoleplayer].mo != NULL)
{
PlayerClassIndex = players[consoleplayer].CurrentPlayerClass;
}
else
*/
{
int pclass = 0;
// [GRB] Pick a class from player class list
if (PlayerClasses.Size () > 1)
{
pclass = players[consoleplayer].userinfo.GetPlayerClassNum();
if (pclass < 0)
{
pclass = (MenuTime>>7) % PlayerClasses.Size ();
}
}
PlayerClassIndex = pclass;
}
PlayerClass = &PlayerClasses[PlayerClassIndex];
UpdateTranslation();
}
//=============================================================================
//
//
//
//=============================================================================
void DPlayerMenu::SendNewColor (int red, int green, int blue)
{
char command[24];
players[consoleplayer].userinfo.ColorChanged(MAKERGB(red,green,blue));
mysnprintf (command, countof(command), "color \"%02x %02x %02x\"", red, green, blue);
C_DoCommand (command);
UpdateTranslation();
}
//=============================================================================
//
//
//
//=============================================================================
void DPlayerMenu::UpdateColorsets()
{
DMenuItemBase *li = GetItem(NAME_Color);
if (li != NULL)
{
int sel = 0;
EnumColorSets(PlayerClass->Type, &PlayerColorSets);
li->SetString(0, "Custom");
for(unsigned i=0;i<PlayerColorSets.Size(); i++)
{
FPlayerColorSet *colorset = GetColorSet(PlayerClass->Type, PlayerColorSets[i]);
li->SetString(i+1, colorset->Name);
}
int mycolorset = players[consoleplayer].userinfo.GetColorSet();
if (mycolorset != -1)
{
for(unsigned i=0;i<PlayerColorSets.Size(); i++)
{
if (PlayerColorSets[i] == mycolorset)
{
sel = i+1;
}
}
}
li->SetValue(0, sel);
}
}
//=============================================================================
//
//
//
//=============================================================================
void DPlayerMenu::UpdateSkins()
{
int sel = 0;
int skin;
DMenuItemBase *li = GetItem(NAME_Skin);
if (li != NULL)
{
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
players[consoleplayer].userinfo.GetPlayerClassNum() == -1)
{
li->SetString(0, "Base");
li->SetValue(0, 0);
skin = 0;
}
else
{
PlayerSkins.Clear();
for(int i=0;i<(int)numskins; i++)
{
if (PlayerClass->CheckSkin(i))
{
int j = PlayerSkins.Push(i);
li->SetString(j, skins[i].name);
if (players[consoleplayer].userinfo.GetSkin() == i)
{
sel = j;
}
}
}
li->SetValue(0, sel);
skin = PlayerSkins[sel];
}
li = GetItem(NAME_Playerdisplay);
if (li != NULL)
{
li->SetValue(ListMenuItemPlayerDisplay_PDF_SKIN, skin);
}
}
UpdateTranslation();
}
//=============================================================================
//
//
//
//=============================================================================
void DPlayerMenu::PlayerNameChanged(DMenuItemBase *li)
{
char pp[MAXPLAYERNAME+1];
const char *p;
if (li->GetString(0, pp, MAXPLAYERNAME))
{
FString command("name \"");
// Escape any backslashes or quotation marks before sending the name to the console.
for (p = pp; *p != '\0'; ++p)
for (auto p = pp; *p != '\0'; ++p)
{
if (*p == '"' || *p == '\\')
{
@ -428,41 +103,9 @@ void DPlayerMenu::PlayerNameChanged(DMenuItemBase *li)
command << *p;
}
command << '"';
C_DoCommand (command);
}
}
//=============================================================================
//
//
//
//=============================================================================
void DPlayerMenu::ColorSetChanged (DMenuItemBase *li)
{
int sel;
if (li->GetValue(0, &sel))
{
int mycolorset = -1;
if (sel > 0) mycolorset = PlayerColorSets[sel-1];
DMenuItemBase *red = GetItem(NAME_Red);
DMenuItemBase *green = GetItem(NAME_Green);
DMenuItemBase *blue = GetItem(NAME_Blue);
// disable the sliders if a valid colorset is selected
if (red != NULL) red->Enable(mycolorset == -1);
if (green != NULL) green->Enable(mycolorset == -1);
if (blue != NULL) blue->Enable(mycolorset == -1);
char command[24];
players[consoleplayer].userinfo.ColorSetChanged(mycolorset);
mysnprintf(command, countof(command), "colorset %d", mycolorset);
C_DoCommand(command);
UpdateTranslation();
}
return 0;
}
//=============================================================================
@ -471,32 +114,18 @@ void DPlayerMenu::ColorSetChanged (DMenuItemBase *li)
//
//=============================================================================
void DPlayerMenu::ClassChanged (DMenuItemBase *li)
DEFINE_ACTION_FUNCTION(DPlayerMenu, ColorSetChanged)
{
if (PlayerClasses.Size () == 1)
PARAM_SELF_PROLOGUE(DListMenu);
PARAM_INT(sel);
if (self == DMenu::CurrentMenu)
{
return;
}
int sel;
if (li->GetValue(0, &sel))
{
players[consoleplayer].userinfo.PlayerClassNumChanged(gameinfo.norandomplayerclass ? sel : sel-1);
PickPlayerClass();
cvar_set ("playerclass", sel == 0 && !gameinfo.norandomplayerclass ? "Random" : GetPrintableDisplayName(PlayerClass->Type).GetChars());
UpdateSkins();
UpdateColorsets();
UpdateTranslation();
li = GetItem(NAME_Playerdisplay);
if (li != NULL)
{
li->SetValue(ListMenuItemPlayerDisplay_PDF_CLASS, players[consoleplayer].userinfo.GetPlayerClassNum());
}
players[consoleplayer].userinfo.ColorSetChanged(sel);
char command[24];
mysnprintf(command, countof(command), "colorset %d", sel);
C_DoCommand(command);
}
return 0;
}
//=============================================================================
@ -505,29 +134,36 @@ void DPlayerMenu::ClassChanged (DMenuItemBase *li)
//
//=============================================================================
void DPlayerMenu::SkinChanged (DMenuItemBase *li)
DEFINE_ACTION_FUNCTION(DPlayerMenu, ClassChanged)
{
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
players[consoleplayer].userinfo.GetPlayerClassNum() == -1)
PARAM_SELF_PROLOGUE(DListMenu);
PARAM_INT(sel);
PARAM_POINTER(cls, FPlayerClass);
if (self == DMenu::CurrentMenu)
{
return;
players[consoleplayer].userinfo.PlayerClassNumChanged(gameinfo.norandomplayerclass ? sel : sel - 1);
cvar_set("playerclass", sel == 0 && !gameinfo.norandomplayerclass ? "Random" : GetPrintableDisplayName(cls->Type).GetChars());
}
return 0;
}
int sel;
if (li->GetValue(0, &sel))
//=============================================================================
//
//
//
//=============================================================================
DEFINE_ACTION_FUNCTION(DPlayerMenu, SkinChanged)
{
PARAM_SELF_PROLOGUE(DListMenu);
PARAM_INT(sel);
if (self == DMenu::CurrentMenu)
{
sel = PlayerSkins[sel];
players[consoleplayer].userinfo.SkinNumChanged(sel);
UpdateTranslation();
cvar_set ("skin", skins[sel].name);
li = GetItem(NAME_Playerdisplay);
if (li != NULL)
{
li->SetValue(ListMenuItemPlayerDisplay_PDF_SKIN, sel);
}
cvar_set("skin", Skins[sel].Name);
}
return 0;
}
//=============================================================================
@ -536,14 +172,16 @@ void DPlayerMenu::SkinChanged (DMenuItemBase *li)
//
//=============================================================================
void DPlayerMenu::AutoaimChanged (DMenuItemBase *li)
DEFINE_ACTION_FUNCTION(DPlayerMenu, AutoaimChanged)
{
int sel;
if (li->GetValue(0, &sel))
PARAM_SELF_PROLOGUE(DListMenu);
PARAM_FLOAT(val);
// only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu)
{
autoaim = (float)sel;
autoaim = float(val);
}
return 0;
}
//=============================================================================
@ -552,145 +190,34 @@ void DPlayerMenu::AutoaimChanged (DMenuItemBase *li)
//
//=============================================================================
bool DPlayerMenu::MenuEvent (int mkey, bool fromcontroller)
DEFINE_ACTION_FUNCTION(DPlayerMenu, TeamChanged)
{
int v;
if (mDesc->mSelectedItem >= 0)
PARAM_SELF_PROLOGUE(DListMenu);
PARAM_INT(val);
// only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu)
{
DMenuItemBase *li = mDesc->mItems[mDesc->mSelectedItem];
if (li->MenuEvent(mkey, fromcontroller))
{
FName current = li->GetAction(NULL);
switch(current)
{
// item specific handling comes here
case NAME_Playerbox:
if (mkey == MKEY_Input)
{
PlayerNameChanged(li);
}
break;
case NAME_Team:
if (li->GetValue(0, &v))
{
team = v==0? TEAM_NONE : v-1;
}
break;
case NAME_Color:
ColorSetChanged(li);
break;
case NAME_Red:
if (li->GetValue(0, &v))
{
uint32 color = players[consoleplayer].userinfo.GetColor();
SendNewColor (v, GPART(color), BPART(color));
}
break;
case NAME_Green:
if (li->GetValue(0, &v))
{
uint32 color = players[consoleplayer].userinfo.GetColor();
SendNewColor (RPART(color), v, BPART(color));
}
break;
case NAME_Blue:
if (li->GetValue(0, &v))
{
uint32 color = players[consoleplayer].userinfo.GetColor();
SendNewColor (RPART(color), GPART(color), v);
}
break;
case NAME_Class:
ClassChanged(li);
break;
case NAME_Skin:
SkinChanged(li);
break;
case NAME_Gender:
if (li->GetValue(0, &v))
{
cvar_set ("gender", v==0? "male" : v==1? "female" : "other");
}
break;
case NAME_Autoaim:
AutoaimChanged(li);
break;
case NAME_Switch:
if (li->GetValue(0, &v))
{
neverswitchonpickup = !!v;
}
break;
case NAME_AlwaysRun:
if (li->GetValue(0, &v))
{
cl_run = !!v;
}
break;
default:
break;
}
return true;
}
team = val == 0 ? TEAM_NONE : val - 1;
}
return Super::MenuEvent(mkey, fromcontroller);
return 0;
}
//=============================================================================
//
//
//
//=============================================================================
bool DPlayerMenu::MouseEvent(int type, int x, int y)
DEFINE_ACTION_FUNCTION(DPlayerMenu, GenderChanged)
{
int v;
DMenuItemBase *li = mFocusControl;
bool res = Super::MouseEvent(type, x, y);
if (li == NULL) li = mFocusControl;
if (li != NULL)
PARAM_SELF_PROLOGUE(DListMenu);
PARAM_INT(v);
// only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu)
{
// Check if the colors have changed
FName current = li->GetAction(NULL);
switch(current)
{
case NAME_Red:
if (li->GetValue(0, &v))
{
uint32 color = players[consoleplayer].userinfo.GetColor();
SendNewColor (v, GPART(color), BPART(color));
}
break;
case NAME_Green:
if (li->GetValue(0, &v))
{
uint32 color = players[consoleplayer].userinfo.GetColor();
SendNewColor (RPART(color), v, BPART(color));
}
break;
case NAME_Blue:
if (li->GetValue(0, &v))
{
uint32 color = players[consoleplayer].userinfo.GetColor();
SendNewColor (RPART(color), GPART(color), v);
}
break;
case NAME_Autoaim:
AutoaimChanged(li);
break;
}
cvar_set("gender", v == 0 ? "male" : v == 1 ? "female" : "other");
}
return res;
return 0;
}
//=============================================================================
@ -699,10 +226,16 @@ bool DPlayerMenu::MouseEvent(int type, int x, int y)
//
//=============================================================================
void DPlayerMenu::Ticker ()
DEFINE_ACTION_FUNCTION(DPlayerMenu, SwitchOnPickupChanged)
{
Super::Ticker();
PARAM_SELF_PROLOGUE(DListMenu);
PARAM_INT(v);
// only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu)
{
neverswitchonpickup = !!v;
}
return 0;
}
//=============================================================================
@ -711,20 +244,14 @@ void DPlayerMenu::Ticker ()
//
//=============================================================================
void DPlayerMenu::Drawer ()
DEFINE_ACTION_FUNCTION(DPlayerMenu, AlwaysRunChanged)
{
Super::Drawer();
const char *str = "PRESS " TEXTCOLOR_WHITE "SPACE";
screen->DrawText (SmallFont, CR_GOLD, 320 - 32 - 32 -
SmallFont->StringWidth (str)/2,
50 + 48 + 70, str,
DTA_Clean, true, TAG_DONE);
str = mRotation ? "TO SEE FRONT" : "TO SEE BACK";
screen->DrawText (SmallFont, CR_GOLD, 320 - 32 - 32 -
SmallFont->StringWidth (str)/2,
50 + 48 + 70 + SmallFont->GetHeight (), str,
DTA_Clean, true, TAG_DONE);
PARAM_SELF_PROLOGUE(DListMenu);
PARAM_INT(v);
// only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu)
{
cl_run = !!v;
}
return 0;
}

View file

@ -3919,7 +3919,7 @@ DEFINE_ACTION_FUNCTION(AActor, PlayerSkinCheck)
PARAM_SELF_PROLOGUE(AActor);
ACTION_RETURN_BOOL(self->player != NULL &&
skins[self->player->userinfo.GetSkin()].othergame);
Skins[self->player->userinfo.GetSkin()].othergame);
}
// [KS] *** Start of my modifications ***

View file

@ -522,7 +522,7 @@ void AActor::PostSerialize()
!(flags4 & MF4_NOSKIN) &&
state->sprite == GetDefaultByType(player->cls)->SpawnState->sprite)
{ // Give player back the skin
sprite = skins[player->userinfo.GetSkin()].sprite;
sprite = Skins[player->userinfo.GetSkin()].sprite;
}
if (Speed == 0)
{
@ -666,9 +666,9 @@ bool AActor::SetState (FState *newstate, bool nofunction)
// for Dehacked, I would move sprite changing out of the states
// altogether, since actors rarely change their sprites after
// spawning.
if (player != NULL && skins != NULL)
if (player != NULL && Skins.Size() > 0)
{
sprite = skins[player->userinfo.GetSkin()].sprite;
sprite = Skins[player->userinfo.GetSkin()].sprite;
}
else if (newsprite != prevsprite)
{
@ -5398,7 +5398,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
}
// [GRB] Reset skin
p->userinfo.SkinNumChanged(R_FindSkin (skins[p->userinfo.GetSkin()].name, p->CurrentPlayerClass));
p->userinfo.SkinNumChanged(R_FindSkin (Skins[p->userinfo.GetSkin()].Name, p->CurrentPlayerClass));
if (!(mobj->flags2 & MF2_DONTTRANSLATE))
{
@ -5416,7 +5416,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
// [RH] Set player sprite based on skin
if (!(mobj->flags4 & MF4_NOSKIN))
{
mobj->sprite = skins[p->userinfo.GetSkin()].sprite;
mobj->sprite = Skins[p->userinfo.GetSkin()].sprite;
}
p->DesiredFOV = p->FOV = 90.f;

View file

@ -837,7 +837,7 @@ void CopyPlayer(player_t *dst, player_t *src, const char *name)
}
// Validate the skin
dst->userinfo.SkinNumChanged(R_FindSkin(skins[dst->userinfo.GetSkin()].name, dst->CurrentPlayerClass));
dst->userinfo.SkinNumChanged(R_FindSkin(Skins[dst->userinfo.GetSkin()].Name, dst->CurrentPlayerClass));
// Make sure the player pawn points to the proper player struct.
if (dst->mo != nullptr)

View file

@ -4203,7 +4203,6 @@ static void P_Shutdown ()
{
// [ZZ] delete global event handlers
E_Shutdown(false);
R_DeinitSpriteData ();
P_DeinitKeyMessages ();
P_FreeLevelData ();
P_FreeExtraLevelData ();

View file

@ -74,9 +74,9 @@ DEFINE_ACTION_FUNCTION(FState, GetSpriteTexture)
}
else
{
sprframe = &SpriteFrames[sprites[skins[skin].sprite].spriteframes + self->GetFrame()];
scalex = skins[skin].Scale.X;
scaley = skins[skin].Scale.Y;
sprframe = &SpriteFrames[sprites[Skins[skin].sprite].spriteframes + self->GetFrame()];
scalex = Skins[skin].Scale.X;
scaley = Skins[skin].Scale.Y;
}
if (numret > 0) ret[0].SetInt(sprframe->Texture[rotation].GetIndex());
if (numret > 1) ret[1].SetInt(!!(sprframe->Flip & (1 << rotation)));

View file

@ -163,6 +163,13 @@ FString GetPrintableDisplayName(PClassActor *cls)
return cls->DisplayName;
}
DEFINE_ACTION_FUNCTION(APlayerPawn, GetPrintableDisplayName)
{
PARAM_PROLOGUE;
PARAM_CLASS(type, AActor);
ACTION_RETURN_STRING(type->DisplayName);
}
bool ValidatePlayerClass(PClassActor *ti, const char *name)
{
if (ti == NULL)
@ -577,6 +584,14 @@ void EnumColorSets(PClassActor *cls, TArray<int> *out)
qsort(&(*out)[0], out->Size(), sizeof(int), intcmp);
}
DEFINE_ACTION_FUNCTION(FPlayerClass, EnumColorSets)
{
PARAM_SELF_STRUCT_PROLOGUE(FPlayerClass);
PARAM_POINTER(out, TArray<int>);
EnumColorSets(self->Type, out);
return 0;
}
//==========================================================================
//
//
@ -596,6 +611,14 @@ FPlayerColorSet *GetColorSet(PClassActor *cls, int setnum)
return nullptr;
}
DEFINE_ACTION_FUNCTION(FPlayerClass, GetColorSetName)
{
PARAM_SELF_STRUCT_PROLOGUE(FPlayerClass);
PARAM_INT(setnum);
auto p = GetColorSet(self->Type, setnum);
ACTION_RETURN_INT(p ? p->Name.GetIndex() : 0);
}
//==========================================================================
//
//
@ -654,6 +677,49 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, GetNeverSwitch)
ACTION_RETURN_BOOL(self->userinfo.GetNeverSwitch());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetColor)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_INT(self->userinfo.GetColor());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetColorSet)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_INT(self->userinfo.GetColorSet());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetPlayerClassNum)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_INT(self->userinfo.GetPlayerClassNum());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetSkin)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_INT(self->userinfo.GetSkin());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetGender)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_INT(self->userinfo.GetGender());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetAutoaim)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_FLOAT(self->userinfo.GetAutoaim());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetTeam)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_INT(self->userinfo.GetTeam());
}
//===========================================================================
//
// APlayerPawn
@ -1227,9 +1293,9 @@ const char *APlayerPawn::GetSoundClass() const
if (player != NULL &&
(player->mo == NULL || !(player->mo->flags4 &MF4_NOSKIN)) &&
(unsigned int)player->userinfo.GetSkin() >= PlayerClasses.Size () &&
(size_t)player->userinfo.GetSkin() < numskins)
(unsigned)player->userinfo.GetSkin() < Skins.Size())
{
return skins[player->userinfo.GetSkin()].name;
return Skins[player->userinfo.GetSkin()].Name.GetChars();
}
return SoundClass != NAME_None? SoundClass.GetChars() : "player";
@ -1781,8 +1847,8 @@ void P_CheckPlayerSprite(AActor *actor, int &spritenum, DVector2 &scale)
{
// Convert from default scale to skin scale.
DVector2 defscale = actor->GetDefault()->Scale;
scale.X *= skins[player->userinfo.GetSkin()].Scale.X / defscale.X;
scale.Y *= skins[player->userinfo.GetSkin()].Scale.Y / defscale.Y;
scale.X *= Skins[player->userinfo.GetSkin()].Scale.X / defscale.X;
scale.Y *= Skins[player->userinfo.GetSkin()].Scale.Y / defscale.Y;
}
// Set the crouch sprite?
@ -1793,10 +1859,10 @@ void P_CheckPlayerSprite(AActor *actor, int &spritenum, DVector2 &scale)
crouchspriteno = player->mo->crouchsprite;
}
else if (!(actor->flags4 & MF4_NOSKIN) &&
(spritenum == skins[player->userinfo.GetSkin()].sprite ||
spritenum == skins[player->userinfo.GetSkin()].crouchsprite))
(spritenum == Skins[player->userinfo.GetSkin()].sprite ||
spritenum == Skins[player->userinfo.GetSkin()].crouchsprite))
{
crouchspriteno = skins[player->userinfo.GetSkin()].crouchsprite;
crouchspriteno = Skins[player->userinfo.GetSkin()].crouchsprite;
}
else
{ // no sprite -> squash the existing one

View file

@ -62,6 +62,10 @@ CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI
{
Printf("This won't take effect until " GAMENAME " is restarted.\n");
}
CUSTOM_CVAR(Bool, vid_glswfb, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
Printf("This won't take effect until " GAMENAME " is restarted.\n");
}
#ifdef __arm__
CUSTOM_CVAR(Bool, gl_es, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
@ -211,6 +215,10 @@ DFrameBuffer *SDLGLVideo::CreateFrameBuffer (int width, int height, bool bgra, b
{
fb = new OpenGLFrameBuffer(0, width, height, 32, 60, fullscreen);
}
else if (vid_glswfb == 0)
{
fb = new SDLFB(width, height, bgra, fullscreen, nullptr);
}
else
{
fb = (SDLBaseFB*)CreateGLSWFrameBuffer(width, height, bgra, fullscreen);

View file

@ -1171,7 +1171,7 @@ void R_BuildPlayerTranslation (int player)
D_GetPlayerColor (player, &h, &s, &v, &colorset);
R_CreatePlayerTranslation (h, s, v, colorset,
&skins[players[player].userinfo.GetSkin()],
&Skins[players[player].userinfo.GetSkin()],
translationtables[TRANSLATION_Players][player],
translationtables[TRANSLATION_PlayersExtra][player],
translationtables[TRANSLATION_RainPillar][player]
@ -1218,9 +1218,9 @@ DEFINE_ACTION_FUNCTION(_Translation, SetPlayerTranslation)
if (cls != nullptr)
{
PlayerSkin = R_FindSkin(skins[PlayerSkin].name, int(cls - &PlayerClasses[0]));
PlayerSkin = R_FindSkin(Skins[PlayerSkin].Name, int(cls - &PlayerClasses[0]));
R_GetPlayerTranslation(PlayerColor, GetColorSet(cls->Type, PlayerColorset),
&skins[PlayerSkin], translationtables[tgroup][tnum]);
&Skins[PlayerSkin], translationtables[tgroup][tnum]);
}
ACTION_RETURN_BOOL(true);
}

View file

@ -30,8 +30,7 @@ struct spriteframewithrotate : public spriteframe_t
// [RH] skin globals
FPlayerSkin *skins;
size_t numskins;
TArray<FPlayerSkin> Skins;
BYTE OtherGameSkinRemap[256];
PalEntry OtherGameSkinPalette[256];
@ -512,7 +511,7 @@ void R_InitSkins (void)
int sndlumps[NUMSKINSOUNDS];
char key[65];
DWORD intname, crouchname;
size_t i;
unsigned i;
int j, k, base;
int lastlump;
int aliasid;
@ -538,7 +537,7 @@ void R_InitSkins (void)
i++;
for (j = 0; j < NUMSKINSOUNDS; j++)
sndlumps[j] = -1;
skins[i].namespc = Wads.GetLumpNamespace (base);
Skins[i].namespc = Wads.GetLumpNamespace (base);
FScanner sc(base);
intname = 0;
@ -560,14 +559,13 @@ void R_InitSkins (void)
sc.GetString ();
if (0 == stricmp (key, "name"))
{
strncpy (skins[i].name, sc.String, 16);
for (j = 0; (size_t)j < i; j++)
Skins[i].Name = sc.String;
for (j = 0; (unsigned)j < i; j++)
{
if (stricmp (skins[i].name, skins[j].name) == 0)
if (Skins[i].Name.CompareNoCase(Skins[j].Name) == 0)
{
mysnprintf (skins[i].name, countof(skins[i].name), "skin%d", (int)i);
Printf (PRINT_BOLD, "Skin %s duplicated as %s\n",
skins[j].name, skins[i].name);
Skins[i].Name.Format("skin%u", i);
Printf (PRINT_BOLD, "Skin %s duplicated as %s\n", Skins[j].Name.GetChars(), Skins[i].Name.GetChars());
break;
}
}
@ -586,18 +584,16 @@ void R_InitSkins (void)
}
else if (0 == stricmp (key, "face"))
{
for (j = 2; j >= 0; j--)
skins[i].face[j] = toupper (sc.String[j]);
skins[i].face[3] = '\0';
Skins[i].Face = FString(sc.String, 3);
}
else if (0 == stricmp (key, "gender"))
{
skins[i].gender = D_GenderToInt (sc.String);
Skins[i].gender = D_GenderToInt (sc.String);
}
else if (0 == stricmp (key, "scale"))
{
skins[i].Scale.X = clamp(atof (sc.String), 1./65536, 256.);
skins[i].Scale.Y = skins[i].Scale.X;
Skins[i].Scale.X = clamp(atof (sc.String), 1./65536, 256.);
Skins[i].Scale.Y = Skins[i].Scale.X;
}
else if (0 == stricmp (key, "game"))
{
@ -615,7 +611,7 @@ void R_InitSkins (void)
if (gameinfo.gametype & GAME_DoomChex)
{
transtype = PClass::FindActor(NAME_HereticPlayer);
skins[i].othergame = true;
Skins[i].othergame = true;
}
else if (gameinfo.gametype != GAME_Heretic)
{
@ -634,7 +630,7 @@ void R_InitSkins (void)
if (gameinfo.gametype == GAME_Heretic)
{
transtype = PClass::FindActor(NAME_DoomPlayer);
skins[i].othergame = true;
Skins[i].othergame = true;
}
else if (!(gameinfo.gametype & GAME_DoomChex))
{
@ -659,7 +655,7 @@ void R_InitSkins (void)
}
else if (key[0] == '*')
{ // Player sound replacment (ZDoom extension)
int lump = Wads.CheckNumForName (sc.String, skins[i].namespc);
int lump = Wads.CheckNumForName (sc.String, Skins[i].namespc);
if (lump == -1)
{
lump = Wads.CheckNumForFullName (sc.String, true, ns_sounds);
@ -668,11 +664,11 @@ void R_InitSkins (void)
{
if (stricmp (key, "*pain") == 0)
{ // Replace all pain sounds in one go
aliasid = S_AddPlayerSound (skins[i].name, skins[i].gender,
aliasid = S_AddPlayerSound (Skins[i].Name, Skins[i].gender,
playersoundrefs[0], lump, true);
for (int l = 3; l > 0; --l)
{
S_AddPlayerSoundExisting (skins[i].name, skins[i].gender,
S_AddPlayerSoundExisting (Skins[i].Name, Skins[i].gender,
playersoundrefs[l], aliasid, true);
}
}
@ -681,7 +677,7 @@ void R_InitSkins (void)
int sndref = S_FindSoundNoHash (key);
if (sndref != 0)
{
S_AddPlayerSound (skins[i].name, skins[i].gender, sndref, lump, true);
S_AddPlayerSound (Skins[i].Name, Skins[i].gender, sndref, lump, true);
}
}
}
@ -692,7 +688,7 @@ void R_InitSkins (void)
{
if (stricmp (key, skinsoundnames[j][0]) == 0)
{
sndlumps[j] = Wads.CheckNumForName (sc.String, skins[i].namespc);
sndlumps[j] = Wads.CheckNumForName (sc.String, Skins[i].namespc);
if (sndlumps[j] == -1)
{ // Replacement not found, try finding it in the global namespace
sndlumps[j] = Wads.CheckNumForFullName (sc.String, true, ns_sounds);
@ -715,7 +711,7 @@ void R_InitSkins (void)
{
basetype = PClass::FindActor(NAME_HereticPlayer);
transtype = PClass::FindActor(NAME_DoomPlayer);
skins[i].othergame = true;
Skins[i].othergame = true;
}
else
{
@ -728,8 +724,8 @@ void R_InitSkins (void)
auto transdef = ((APlayerPawn*)GetDefaultByType(transtype));
auto basedef = ((APlayerPawn*)GetDefaultByType(basetype));
skins[i].range0start = transdef->ColorRangeStart;
skins[i].range0end = transdef->ColorRangeEnd;
Skins[i].range0start = transdef->ColorRangeStart;
Skins[i].range0end = transdef->ColorRangeEnd;
remove = true;
for (j = 0; j < (int)PlayerClasses.Size (); j++)
@ -750,8 +746,8 @@ void R_InitSkins (void)
if (!remove)
{
if (skins[i].name[0] == 0)
mysnprintf (skins[i].name, countof(skins[i].name), "skin%d", (int)i);
if (Skins[i].Name.IsEmpty())
Skins[i].Name.Format("skin%u", i);
// Now collect the sprite frames for this skin. If the sprite name was not
// specified, use whatever immediately follows the specifier lump.
@ -783,7 +779,7 @@ void R_InitSkins (void)
}
else
{
skins[i].crouchsprite = -1;
Skins[i].crouchsprite = -1;
break;
}
}
@ -806,7 +802,7 @@ void R_InitSkins (void)
if (spr == 0 && maxframe <= 0)
{
Printf (PRINT_BOLD, "Skin %s (#%d) has no frames. Removing.\n", skins[i].name, (int)i);
Printf (PRINT_BOLD, "Skin %s (#%u) has no frames. Removing.\n", Skins[i].Name, i);
remove = true;
break;
}
@ -814,16 +810,18 @@ void R_InitSkins (void)
Wads.GetLumpName (temp.name, base+1);
temp.name[4] = 0;
int sprno = (int)sprites.Push (temp);
if (spr==0) skins[i].sprite = sprno;
else skins[i].crouchsprite = sprno;
if (spr==0) Skins[i].sprite = sprno;
else Skins[i].crouchsprite = sprno;
R_InstallSprite (sprno, sprtemp, maxframe);
}
}
if (remove)
{
if (i < numskins-1)
memmove (&skins[i], &skins[i+1], sizeof(skins[0])*(numskins-i-1));
if (i < Skins.Size() - 1)
{
Skins.Delete(i);
}
i--;
continue;
}
@ -836,25 +834,25 @@ void R_InitSkins (void)
{
if (j == 0 || sndlumps[j] != sndlumps[j-1])
{
aliasid = S_AddPlayerSound (skins[i].name, skins[i].gender,
aliasid = S_AddPlayerSound (Skins[i].Name, Skins[i].gender,
playersoundrefs[j], sndlumps[j], true);
}
else
{
S_AddPlayerSoundExisting (skins[i].name, skins[i].gender,
S_AddPlayerSoundExisting (Skins[i].Name, Skins[i].gender,
playersoundrefs[j], aliasid, true);
}
}
}
// Make sure face prefix is a full 3 chars
if (skins[i].face[1] == 0 || skins[i].face[2] == 0)
if (Skins[i].Face.Len() < 3)
{
skins[i].face[0] = 0;
Skins[i].Face = "";
}
}
if (numskins > PlayerClasses.Size ())
if (Skins.Size() > PlayerClasses.Size ())
{ // The sound table may have changed, so rehash it.
S_HashSounds ();
S_ShrinkPlayerSoundLists ();
@ -869,9 +867,9 @@ int R_FindSkin (const char *name, int pclass)
return pclass;
}
for (unsigned i = PlayerClasses.Size(); i < numskins; i++)
for (unsigned i = PlayerClasses.Size(); i < Skins.Size(); i++)
{
if (strnicmp (skins[i].name, name, 16) == 0)
if (Skins[i].Name.CompareNoCase(name) == 0)
{
if (PlayerClasses[pclass].CheckSkin (i))
return i;
@ -887,8 +885,8 @@ CCMD (skins)
{
int i;
for (i = PlayerClasses.Size ()-1; i < (int)numskins; i++)
Printf ("% 3d %s\n", i-PlayerClasses.Size ()+1, skins[i].name);
for (i = PlayerClasses.Size() - 1; i < (int)Skins.Size(); i++)
Printf("% 3d %s\n", i - PlayerClasses.Size() + 1, Skins[i].Name.GetChars());
}
@ -914,6 +912,7 @@ void R_InitSprites ()
{
int lump, lastlump;
unsigned int i, j;
unsigned numskins;
// [RH] Create a standard translation to map skins between Heretic and Doom
if (gameinfo.gametype == GAME_DoomChex)
@ -934,15 +933,15 @@ void R_InitSprites ()
}
// [RH] Do some preliminary setup
if (skins != NULL) delete [] skins;
skins = new FPlayerSkin[numskins];
memset (skins, 0, sizeof(*skins) * numskins);
Skins.Clear();
Skins.Resize(numskins);
for (i = 0; i < numskins; i++)
{ // Assume Doom skin by default
auto type = ((APlayerPawn*)GetDefaultByType(PlayerClasses[0].Type));
skins[i].range0start = type->ColorRangeStart;
skins[i].range0end = type->ColorRangeEnd;
skins[i].Scale = type->Scale;
Skins[i].range0start = type->ColorRangeStart;
Skins[i].range0end = type->ColorRangeEnd;
Skins[i].Scale = type->Scale;
}
R_InitSpriteDefs ();
@ -956,33 +955,30 @@ void R_InitSprites ()
{
auto basetype = ((APlayerPawn*)GetDefaultByType(PlayerClasses[i].Type));
strcpy (skins[i].name, "Base");
Skins[i].Name = "Base";
if (basetype->Face == NAME_None)
{
skins[i].face[0] = 'S';
skins[i].face[1] = 'T';
skins[i].face[2] = 'F';
skins[i].face[3] = '\0';
Skins[i].Face = "STF";
}
else
{
strcpy(skins[i].face, basetype->Face);
Skins[i].Face = basetype->Face;
}
skins[i].range0start = basetype->ColorRangeStart;
skins[i].range0end = basetype->ColorRangeEnd;
skins[i].Scale = basetype->Scale;
skins[i].sprite = basetype->SpawnState->sprite;
skins[i].namespc = ns_global;
Skins[i].range0start = basetype->ColorRangeStart;
Skins[i].range0end = basetype->ColorRangeEnd;
Skins[i].Scale = basetype->Scale;
Skins[i].sprite = basetype->SpawnState->sprite;
Skins[i].namespc = ns_global;
PlayerClasses[i].Skins.Push (i);
if (memcmp (sprites[skins[i].sprite].name, "PLAY", 4) == 0)
if (memcmp (sprites[Skins[i].sprite].name, "PLAY", 4) == 0)
{
for (j = 0; j < sprites.Size (); j++)
{
if (memcmp (sprites[j].name, deh.PlayerSprite, 4) == 0)
{
skins[i].sprite = (int)j;
Skins[i].sprite = (int)j;
break;
}
}
@ -995,12 +991,14 @@ void R_InitSprites ()
gl_InitModels();
}
void R_DeinitSpriteData()
{
// Free skins
if (skins != NULL)
{
delete[] skins;
skins = NULL;
}
}
DEFINE_FIELD_NAMED(FPlayerSkin, Name, SkinName);
DEFINE_FIELD(FPlayerSkin, Face);
DEFINE_FIELD(FPlayerSkin, gender);
DEFINE_FIELD(FPlayerSkin, range0start);
DEFINE_FIELD(FPlayerSkin, range0end);
DEFINE_FIELD(FPlayerSkin, othergame);
DEFINE_FIELD(FPlayerSkin, Scale);
DEFINE_FIELD(FPlayerSkin, sprite);
DEFINE_FIELD(FPlayerSkin, crouchsprite);
DEFINE_FIELD(FPlayerSkin, namespc);

View file

@ -47,25 +47,23 @@ extern TArray<spriteframe_t> SpriteFrames;
class FPlayerSkin
{
public:
char name[17]; // 16 chars + NULL
char face[4]; // 3 chars ([MH] + NULL so can use as a C string)
BYTE gender; // This skin's gender (not really used)
BYTE range0start;
BYTE range0end;
bool othergame; // [GRB]
DVector2 Scale;
int sprite;
int crouchsprite;
int namespc; // namespace for this skin
FString Name;
FString Face;
BYTE gender = 0; // This skin's gender (not really used)
BYTE range0start = 0;
BYTE range0end = 0;
bool othergame = 0; // [GRB]
DVector2 Scale = { 1, 1 };
int sprite = 0;
int crouchsprite = 0;
int namespc = 0; // namespace for this skin
};
extern size_t numskins; // [RH]
extern FPlayerSkin * skins; // [RH]
extern TArray<FPlayerSkin> Skins;
extern BYTE OtherGameSkinRemap[256];
extern PalEntry OtherGameSkinPalette[256];
void R_InitSprites ();
void R_DeinitSpriteData ();
#endif

View file

@ -57,6 +57,8 @@
#include "v_video.h"
#include "c_bind.h"
#include "menu/menu.h"
#include "teaminfo.h"
#include "r_data/sprites.h"
static TArray<FPropertyInfo*> properties;
static TArray<AFuncDesc> AFTable;
@ -759,6 +761,14 @@ void InitThingdef()
playerclassstruct->Size = sizeof(FPlayerClass);
playerclassstruct->Align = alignof(FPlayerClass);
auto playerskinstruct = NewNativeStruct("PlayerSkin", nullptr);
playerskinstruct->Size = sizeof(FPlayerSkin);
playerskinstruct->Align = alignof(FPlayerSkin);
auto teamstruct = NewNativeStruct("Team", nullptr);
teamstruct->Size = sizeof(FTeam);
teamstruct->Align = alignof(FTeam);
// set up the lines array in the sector struct. This is a bit messy because the type system is not prepared to handle a pointer to an array of pointers to a native struct even remotely well...
// As a result, the size has to be set to something large and arbritrary because it can change between maps. This will need some serious improvement when things get cleaned up.
sectorstruct->AddNativeField("lines", NewPointer(NewResizableArray(NewPointer(linestruct, false)), false), myoffsetof(sector_t, Lines), VARF_Native);
@ -798,6 +808,14 @@ void InitThingdef()
PField *plrclsf = new PField("PlayerClasses", plrcls, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&PlayerClasses);
Namespaces.GlobalNamespace->Symbols.AddSymbol(plrclsf);
auto plrskn = NewPointer(NewResizableArray(playerskinstruct), false);
PField *plrsknf = new PField("PlayerSkins", plrskn, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&Skins);
Namespaces.GlobalNamespace->Symbols.AddSymbol(plrsknf);
auto teamst = NewPointer(NewResizableArray(teamstruct), false);
PField *teamf = new PField("Teams", teamst, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&Teams);
Namespaces.GlobalNamespace->Symbols.AddSymbol(teamf);
auto bindcls = NewNativeStruct("KeyBindings", nullptr);
PField *binding = new PField("Bindings", bindcls, VARF_Native | VARF_Static, (intptr_t)&Bindings);
Namespaces.GlobalNamespace->Symbols.AddSymbol(binding);

View file

@ -1361,22 +1361,19 @@ PType *ZCCCompiler::DetermineType(PType *outertype, ZCC_TreeNode *field, FName n
break;
case AST_DynArrayType:
if (allowarraytypes)
{
auto atype = static_cast<ZCC_DynArrayType *>(ztype);
auto ftype = DetermineType(outertype, field, name, atype->ElementType, false, true);
if (ftype->GetRegType() == REGT_NIL || ftype->GetRegCount() > 1)
{
auto atype = static_cast<ZCC_DynArrayType *>(ztype);
auto ftype = DetermineType(outertype, field, name, atype->ElementType, false, true);
if (ftype->GetRegType() == REGT_NIL || ftype->GetRegCount() > 1)
{
Error(field, "%s: Base type for dynamic array types nust be integral, but got %s", name.GetChars(), ftype->DescriptiveName());
}
else
{
retval = NewDynArray(ftype);
}
break;
Error(field, "%s: Base type for dynamic array types nust be integral, but got %s", name.GetChars(), ftype->DescriptiveName());
}
else
{
retval = NewDynArray(ftype);
}
break;
}
case AST_ClassType:
{
auto ctype = static_cast<ZCC_ClassType *>(ztype);
@ -2135,7 +2132,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
{
auto type = DetermineType(c->Type(), p, f->Name, p->Type, false, false);
int flags = 0;
if (type->IsA(RUNTIME_CLASS(PStruct)) && type != TypeVector2 && type != TypeVector3)
if ((type->IsA(RUNTIME_CLASS(PStruct)) && type != TypeVector2 && type != TypeVector3) || type->IsA(RUNTIME_CLASS(PDynArray)))
{
// Structs are being passed by pointer, but unless marked 'out' that pointer must be readonly.
type = NewPointer(type /*, !(p->Flags & ZCC_Out)*/);

View file

@ -333,3 +333,6 @@ CCMD (teamlist)
Printf ("End of team list.\n");
}
DEFINE_FIELD_NAMED(FTeam, m_Name, mName)

View file

@ -63,7 +63,9 @@ private:
void ParseTeamDefinition (FScanner &Scan);
void ClearTeams ();
public: // needed for script access.
FString m_Name;
private:
int m_iPlayerColor;
FString m_TextColor;
FString m_Logo;

View file

@ -15,6 +15,7 @@
#include "zscript/menu/optionmenuitems.txt"
#include "zscript/menu/colorpickermenu.txt"
#include "zscript/menu/joystickmenu.txt"
#include "zscript/menu/playermenu.txt"
#include "zscript/menu/playerdisplay.txt"
#include "zscript/menu/playercontrols.txt"
#include "zscript/menu/textentermenu.txt"

View file

@ -309,6 +309,7 @@ struct GameInfoStruct native
native String ArmorIcon1;
native String ArmorIcon2;
native int gametype;
native bool norandomplayerclass;
}
class Object native

View file

@ -388,7 +388,7 @@ class EnterKey : Menu
let parent = OptionMenu(mParentMenu);
if (parent != null)
{
let it = parent.GetItem('Controlmessage');
let it = parent.mDesc.GetItem('Controlmessage');
if (it != null)
{
it.SetValue(0, which);

View file

@ -0,0 +1,595 @@
/*
** playermenu.cpp
** The player setup menu
**
**---------------------------------------------------------------------------
** Copyright 2001-2010 Randy Heit
** Copyright 2010-2017 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
class PlayerMenu : ListMenu
{
int mRotation;
int PlayerClassIndex;
PlayerClass mPlayerClass;
Array<int> PlayerColorSets;
Array<int> mPlayerSkins;
// All write function for the player config are native to prevent abuse.
protected native void AutoaimChanged(float val);
protected native void TeamChanged(int val);
protected native void AlwaysRunChanged(int val);
protected native void GenderChanged(int val);
protected native void SwitchOnPickupChanged(int val);
protected native void ColorChanged(int red, int green, int blue);
protected native void ColorSetChanged(int red);
protected native void PlayerNameChanged(String name);
protected native void SkinChanged (int val);
protected native void ClassChanged(int sel, PlayerClass cls);
//=============================================================================
//
//
//
//=============================================================================
protected void UpdateTranslation()
{
Translation.SetPlayerTranslation(TRANSLATION_Players, MAXPLAYERS, consoleplayer, mPlayerClass);
}
protected void SendNewColor (int red, int green, int blue)
{
ColorChanged(red, green, blue);
UpdateTranslation();
}
//=============================================================================
//
//
//
//=============================================================================
override void Init(Menu parent, ListMenuDescriptor desc)
{
MenuItemBase li;
PlayerInfo p = players[consoleplayer];
Super.Init(parent, desc);
PickPlayerClass();
mRotation = 0;
li = GetItem('Playerdisplay');
if (li != NULL)
{
li.SetValue(ListMenuItemPlayerDisplay.PDF_ROTATION, 0);
li.SetValue(ListMenuItemPlayerDisplay.PDF_MODE, 1);
li.SetValue(ListMenuItemPlayerDisplay.PDF_TRANSLATE, 1);
li.SetValue(ListMenuItemPlayerDisplay.PDF_CLASS, p.GetPlayerClassNum());
if (mPlayerClass != NULL && !(GetDefaultByType (mPlayerClass.Type).bNoSkin) &&
p.GetPlayerClassNum() != -1)
{
li.SetValue(ListMenuItemPlayerDisplay.PDF_SKIN, p.GetSkin());
}
}
li = GetItem('Playerbox');
if (li != NULL)
{
li.SetString(0, p.GetUserName());
}
li = GetItem('Team');
if (li != NULL)
{
li.SetString(0, "None");
for(int i=0;i<Teams.Size(); i++)
{
li.SetString(i+1, Teams[i].mName);
}
int myteam = players[consoleplayer].GetTeam();
li.SetValue(0, myteam == Team.NoTeam? 0 : myteam + 1);
}
int mycolorset = p.GetColorSet();
Color colr = p.GetColor();
UpdateColorsets();
li = GetItem('Red');
if (li != NULL)
{
li.Enable(mycolorset == -1);
li.SetValue(0, colr.r);
}
li = GetItem('Green');
if (li != NULL)
{
li.Enable(mycolorset == -1);
li.SetValue(0, colr.g);
}
li = GetItem('Blue');
if (li != NULL)
{
li.Enable(mycolorset == -1);
li.SetValue(0, colr.b);
}
li = GetItem('Class');
if (li != NULL)
{
if (PlayerClasses.Size() == 1)
{
li.SetString(0, PlayerPawn.GetPrintableDisplayName(PlayerClasses[0].Type));
li.SetValue(0, 0);
}
else
{
// [XA] Remove the "Random" option if the relevant gameinfo flag is set.
if(!gameinfo.norandomplayerclass)
li.SetString(0, "Random");
for(int i=0; i< PlayerClasses.Size(); i++)
{
let cls = PlayerPawn.GetPrintableDisplayName(PlayerClasses[i].Type);
li.SetString(gameinfo.norandomplayerclass ? i : i+1, cls);
}
int pclass = p.GetPlayerClassNum();
li.SetValue(0, gameinfo.norandomplayerclass && pclass >= 0 ? pclass : pclass + 1);
}
}
UpdateSkins();
li = GetItem('Gender');
if (li != NULL)
{
li.SetValue(0, p.GetGender());
}
li = GetItem('Autoaim');
if (li != NULL)
{
li.SetValue(0, int(p.GetAutoaim()));
}
li = GetItem('Switch');
if (li != NULL)
{
li.SetValue(0, p.GetNeverSwitch());
}
li = GetItem('AlwaysRun');
if (li != NULL)
{
li.SetValue(0, cl_run);
}
if (mDesc.mSelectedItem < 0) mDesc.mSelectedItem = 1;
}
//=============================================================================
//
//
//
//=============================================================================
protected void PickPlayerClass(int pick = -100)
{
int pclass = 0;
// [GRB] Pick a class from player class list
if (PlayerClasses.Size () > 1)
{
pclass = pick == -100? players[consoleplayer].GetPlayerClassNum() : pick;
if (pclass < 0)
{
pclass = (MenuTime() >> 7) % PlayerClasses.Size ();
}
}
PlayerClassIndex = pclass;
mPlayerClass = PlayerClasses[PlayerClassIndex];
UpdateTranslation();
}
//=============================================================================
//
//
//
//=============================================================================
protected void UpdateColorsets()
{
let li = GetItem('Color');
if (li != NULL)
{
int sel = 0;
mPlayerClass.EnumColorSets(PlayerColorSets);
li.SetString(0, "Custom");
for(int i = 0; i < PlayerColorSets.Size(); i++)
{
let cname = mPlayerClass.GetColorSetName(PlayerColorSets[i]);
li.SetString(i+1, cname);
}
int mycolorset = players[consoleplayer].GetColorSet();
if (mycolorset != -1)
{
for(int i = 0; i < PlayerColorSets.Size(); i++)
{
if (PlayerColorSets[i] == mycolorset)
{
sel = i + 1;
}
}
}
li.SetValue(0, sel);
}
}
//=============================================================================
//
//
//
//=============================================================================
protected void UpdateSkins()
{
int sel = 0;
int skin;
let li = GetItem('Skin');
if (li != NULL)
{
if (GetDefaultByType (mPlayerClass.Type).bNoSkin || players[consoleplayer].GetPlayerClassNum() == -1)
{
li.SetString(0, "Base");
li.SetValue(0, 0);
skin = 0;
}
else
{
mPlayerSkins.Clear();
for (int i = 0; i < PlayerSkins.Size(); i++)
{
if (mPlayerClass.CheckSkin(i))
{
int j = mPlayerSkins.Push(i);
li.SetString(j, PlayerSkins[i].SkinName);
if (players[consoleplayer].GetSkin() == i)
{
sel = j;
}
}
}
li.SetValue(0, sel);
skin = mPlayerSkins[sel];
}
li = GetItem('Playerdisplay');
if (li != NULL)
{
li.SetValue(ListMenuItemPlayerDisplay.PDF_SKIN, skin);
}
}
UpdateTranslation();
}
//=============================================================================
//
//
//
//=============================================================================
void ChangeClass (MenuItemBase li)
{
if (PlayerClasses.Size () == 1)
{
return;
}
bool res;
int sel;
[res, sel] = li.GetValue(0);
if (res)
{
PickPlayerClass(gameinfo.norandomplayerclass ? sel : sel-1);
ClassChanged(sel, mPlayerClass);
UpdateSkins();
UpdateColorsets();
UpdateTranslation();
li = GetItem('Playerdisplay');
if (li != NULL)
{
li.SetValue(ListMenuItemPlayerDisplay.PDF_CLASS, players[consoleplayer].GetPlayerClassNum());
}
}
}
//=============================================================================
//
//
//
//=============================================================================
protected void ChangeSkin (MenuItemBase li)
{
if (GetDefaultByType (mPlayerClass.Type).bNoSkin || players[consoleplayer].GetPlayerClassNum() == -1)
{
return;
}
bool res;
int sel;
[res, sel] = li.GetValue(0);
if (res)
{
sel = mPlayerSkins[sel];
SkinChanged(sel);
UpdateTranslation();
li = GetItem('Playerdisplay');
if (li != NULL)
{
li.SetValue(ListMenuItemPlayerDisplay.PDF_SKIN, sel);
}
}
}
//=============================================================================
//
//
//
//=============================================================================
override bool Responder (InputEventData ev)
{
if (ev.type == InputEventData.GUI_Event && ev.subtype == InputEventData.GUI_Char && ev.data1 == 32)
{
// turn the player sprite around
mRotation = 8 - mRotation;
MenuItemBase li = GetItem('Playerdisplay');
if (li != NULL)
{
li.SetValue(ListMenuItemPlayerDisplay.PDF_ROTATION, mRotation);
}
return true;
}
return Super.Responder(ev);
}
//=============================================================================
//
//
//
//=============================================================================
override bool MenuEvent (int mkey, bool fromcontroller)
{
int v;
bool res;
String s;
if (mDesc.mSelectedItem >= 0)
{
let li = mDesc.mItems[mDesc.mSelectedItem];
if (li.MenuEvent(mkey, fromcontroller))
{
Name ctrl = li.GetAction();
switch(ctrl)
{
// item specific handling comes here
case 'Playerbox':
if (mkey == MKEY_Input)
{
[res, s] = li.GetString(0);
if (res) PlayerNameChanged(s);
}
break;
case 'Team':
[res, v] = li.GetValue(0);
if (res) TeamChanged(v);
break;
case 'Color':
[res, v] = li.GetValue(0);
if (res)
{
int mycolorset = -1;
if (v > 0) mycolorset = PlayerColorSets[v - 1];
let red = GetItem('Red');
let green = GetItem('Green');
let blue = GetItem('Blue');
// disable the sliders if a valid colorset is selected
if (red != NULL) red.Enable(mycolorset == -1);
if (green != NULL) green.Enable(mycolorset == -1);
if (blue != NULL) blue.Enable(mycolorset == -1);
ColorSetChanged(v - 1);
UpdateTranslation();
}
break;
case 'Red':
[res, v] = li.GetValue(0);
if (res)
{
Color colr = players[consoleplayer].GetColor();
SendNewColor (v, colr.g, colr.b);
}
break;
case 'Green':
[res, v] = li.GetValue(0);
if (res)
{
Color colr = players[consoleplayer].GetColor();
SendNewColor (colr.r, v, colr.b);
}
break;
case 'Blue':
[res, v] = li.GetValue(0);
if (res)
{
Color colr = players[consoleplayer].GetColor();
SendNewColor (colr.r, colr.g, v);
}
break;
case 'Class':
[res, v] = li.GetValue(0);
if (res)
{
ChangeClass(li);
}
break;
case 'Skin':
ChangeSkin(li);
break;
case 'Gender':
[res, v] = li.GetValue(0);
if (res)
{
GenderChanged(v);
}
break;
case 'Autoaim':
[res, v] = li.GetValue(0);
if (res)
{
AutoaimChanged(v);
}
break;
case 'Switch':
[res, v] = li.GetValue(0);
if (res)
{
SwitchOnPickupChanged(v);
}
break;
case 'AlwaysRun':
[res, v] = li.GetValue(0);
if (res)
{
AlwaysRunChanged(v);
}
break;
default:
break;
}
return true;
}
}
return Super.MenuEvent(mkey, fromcontroller);
}
//=============================================================================
//
//
//
//=============================================================================
override bool MouseEvent(int type, int x, int y)
{
let li = mFocusControl;
bool res = Super.MouseEvent(type, x, y);
if (li == NULL) li = mFocusControl;
if (li != NULL)
{
// Check if the colors have changed
Name ctrl = li.GetAction();
bool resv;
int v;
[resv, v]= li.GetValue(0);
switch(ctrl)
{
case 'Red':
if (resv)
{
Color colr = players[consoleplayer].GetColor();
SendNewColor (v, colr.g, colr.b);
}
break;
case 'Green':
if (resv)
{
Color colr = players[consoleplayer].GetColor();
SendNewColor (colr.r, v, colr.b);
}
break;
case 'Blue':
if (resv)
{
Color colr = players[consoleplayer].GetColor();
SendNewColor (colr.r, colr.g, v);
}
break;
case 'Autoaim':
AutoaimChanged(v);
break;
}
}
return res;
}
//=============================================================================
//
//
//
//=============================================================================
override void Drawer ()
{
Super.Drawer();
String str = "PRESS " .. TEXTCOLOR_WHITE .. "SPACE";
screen.DrawText (SmallFont, Font.CR_GOLD, 320 - 32 - 32 - SmallFont.StringWidth (str)/2, 50 + 48 + 70, str, DTA_Clean, true);
str = mRotation ? "TO SEE FRONT" : "TO SEE BACK";
screen.DrawText (SmallFont, Font.CR_GOLD, 320 - 32 - 32 - SmallFont.StringWidth (str)/2, 50 + 48 + 70 + SmallFont.GetHeight (), str, DTA_Clean, true);
}
}

View file

@ -136,6 +136,8 @@ class PlayerPawn : Actor native
native int GetMaxHealth();
native bool ResetAirSupply (bool playgasp = false);
native void CheckWeaponSwitch(class<Inventory> item);
native static String GetPrintableDisplayName(Class<Actor> cls);
}
class PlayerChunk : PlayerPawn
@ -295,7 +297,6 @@ struct PlayerInfo native // this is what internally is known as player_t
/* these are not doable yet
ticcmd_t cmd;
usercmd_t original_cmd;
userinfo_t userinfo;
*/
@ -309,11 +310,18 @@ userinfo_t userinfo;
native PSprite FindPSprite(int id);
native void SetLogNumber (int text);
native void SetLogText (String text);
native String GetUserName();
native bool GetNeverSwitch();
native void DropWeapon();
native void BringUpWeapon();
native String GetUserName();
native Color GetColor();
native int GetColorSet();
native int GetPlayerClassNum();
native int GetSkin();
native bool GetNeverSwitch();
native int GetGender();
native int GetTeam();
native float GetAutoaim();
}
struct PlayerClass native
@ -323,4 +331,27 @@ struct PlayerClass native
native Array<int> Skins;
native bool CheckSkin(int skin);
native void EnumColorsets(out Array<int> data);
native Name GetColorsetName(int setnum);
}
struct PlayerSkin native
{
native readonly String SkinName;
native readonly String Face;
native readonly uint8 gender;
native readonly uint8 range0start;
native readonly uint8 range0end;
native readonly bool othergame;
native readonly Vector2 Scale;
native readonly int sprite;
native readonly int crouchsprite;
native readonly int namespc;
};
struct Team native
{
const NoTeam = 255;
const Max = 16;
native String mName;
}