- Switched to a genericly extensible representation for userinfo.
- Fixed: The playerinfo CCMD did not range check the player number. SVN r4253 (trunk)
This commit is contained in:
parent
404df07629
commit
2668988870
37 changed files with 744 additions and 429 deletions
|
|
@ -545,11 +545,11 @@ void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
|
|||
li->SetValue(FListMenuItemPlayerDisplay::PDF_ROTATION, 0);
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_MODE, 1);
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_TRANSLATE, 1);
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_CLASS, players[consoleplayer].userinfo.PlayerClass);
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_CLASS, players[consoleplayer].userinfo.GetPlayerClassNum());
|
||||
if (PlayerClass != NULL && !(GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN) &&
|
||||
players[consoleplayer].userinfo.PlayerClass != -1)
|
||||
players[consoleplayer].userinfo.GetPlayerClassNum() != -1)
|
||||
{
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_SKIN, players[consoleplayer].userinfo.skin);
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_SKIN, players[consoleplayer].userinfo.GetSkin());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -570,8 +570,8 @@ void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
|
|||
li->SetValue(0, team == TEAM_NONE? 0 : team + 1);
|
||||
}
|
||||
|
||||
int mycolorset = players[consoleplayer].userinfo.colorset;
|
||||
int color = players[consoleplayer].userinfo.color;
|
||||
int mycolorset = players[consoleplayer].userinfo.GetColorSet();
|
||||
int color = players[consoleplayer].userinfo.GetColor();
|
||||
|
||||
UpdateColorsets();
|
||||
|
||||
|
|
@ -614,7 +614,7 @@ void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
|
|||
const char *cls = GetPrintableDisplayName(PlayerClasses[i].Type);
|
||||
li->SetString(gameinfo.norandomplayerclass ? i : i+1, cls);
|
||||
}
|
||||
int pclass = players[consoleplayer].userinfo.PlayerClass;
|
||||
int pclass = players[consoleplayer].userinfo.GetPlayerClassNum();
|
||||
li->SetValue(0, gameinfo.norandomplayerclass && pclass >= 0 ? pclass : pclass + 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -624,7 +624,7 @@ void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
|
|||
li = GetItem(NAME_Gender);
|
||||
if (li != NULL)
|
||||
{
|
||||
li->SetValue(0, players[consoleplayer].userinfo.gender);
|
||||
li->SetValue(0, players[consoleplayer].userinfo.GetGender());
|
||||
}
|
||||
|
||||
li = GetItem(NAME_Autoaim);
|
||||
|
|
@ -686,9 +686,9 @@ bool DPlayerMenu::Responder (event_t *ev)
|
|||
|
||||
void DPlayerMenu::UpdateTranslation()
|
||||
{
|
||||
int PlayerColor = players[consoleplayer].userinfo.color;
|
||||
int PlayerSkin = players[consoleplayer].userinfo.skin;
|
||||
int PlayerColorset = players[consoleplayer].userinfo.colorset;
|
||||
int PlayerColor = players[consoleplayer].userinfo.GetColor();
|
||||
int PlayerSkin = players[consoleplayer].userinfo.GetSkin();
|
||||
int PlayerColorset = players[consoleplayer].userinfo.GetColorSet();
|
||||
|
||||
if (PlayerClass != NULL)
|
||||
{
|
||||
|
|
@ -722,7 +722,7 @@ void DPlayerMenu::PickPlayerClass()
|
|||
// [GRB] Pick a class from player class list
|
||||
if (PlayerClasses.Size () > 1)
|
||||
{
|
||||
pclass = players[consoleplayer].userinfo.PlayerClass;
|
||||
pclass = players[consoleplayer].userinfo.GetPlayerClassNum();
|
||||
|
||||
if (pclass < 0)
|
||||
{
|
||||
|
|
@ -745,7 +745,7 @@ void DPlayerMenu::SendNewColor (int red, int green, int blue)
|
|||
{
|
||||
char command[24];
|
||||
|
||||
players[consoleplayer].userinfo.color = MAKERGB(red, green, blue);
|
||||
players[consoleplayer].userinfo.ColorChanged(MAKERGB(red,green,blue));
|
||||
mysnprintf (command, countof(command), "color \"%02x %02x %02x\"", red, green, blue);
|
||||
C_DoCommand (command);
|
||||
UpdateTranslation();
|
||||
|
|
@ -770,7 +770,7 @@ void DPlayerMenu::UpdateColorsets()
|
|||
FPlayerColorSet *colorset = P_GetPlayerColorSet(PlayerClass->Type->TypeName, PlayerColorSets[i]);
|
||||
li->SetString(i+1, colorset->Name);
|
||||
}
|
||||
int mycolorset = players[consoleplayer].userinfo.colorset;
|
||||
int mycolorset = players[consoleplayer].userinfo.GetColorSet();
|
||||
if (mycolorset != -1)
|
||||
{
|
||||
for(unsigned i=0;i<PlayerColorSets.Size(); i++)
|
||||
|
|
@ -799,7 +799,7 @@ void DPlayerMenu::UpdateSkins()
|
|||
if (li != NULL)
|
||||
{
|
||||
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
|
||||
players[consoleplayer].userinfo.PlayerClass == -1)
|
||||
players[consoleplayer].userinfo.GetPlayerClassNum() == -1)
|
||||
{
|
||||
li->SetString(0, "Base");
|
||||
li->SetValue(0, 0);
|
||||
|
|
@ -814,7 +814,7 @@ void DPlayerMenu::UpdateSkins()
|
|||
{
|
||||
int j = PlayerSkins.Push(i);
|
||||
li->SetString(j, skins[i].name);
|
||||
if (players[consoleplayer].userinfo.skin == i)
|
||||
if (players[consoleplayer].userinfo.GetSkin() == i)
|
||||
{
|
||||
sel = j;
|
||||
}
|
||||
|
|
@ -886,7 +886,7 @@ void DPlayerMenu::ColorSetChanged (FListMenuItem *li)
|
|||
if (blue != NULL) blue->Enable(mycolorset == -1);
|
||||
|
||||
char command[24];
|
||||
players[consoleplayer].userinfo.colorset = mycolorset;
|
||||
players[consoleplayer].userinfo.ColorSetChanged(mycolorset);
|
||||
mysnprintf(command, countof(command), "colorset %d", mycolorset);
|
||||
C_DoCommand(command);
|
||||
UpdateTranslation();
|
||||
|
|
@ -910,7 +910,7 @@ void DPlayerMenu::ClassChanged (FListMenuItem *li)
|
|||
|
||||
if (li->GetValue(0, &sel))
|
||||
{
|
||||
players[consoleplayer].userinfo.PlayerClass = gameinfo.norandomplayerclass ? sel : sel-1;
|
||||
players[consoleplayer].userinfo.PlayerClassNumChanged(gameinfo.norandomplayerclass ? sel : sel-1);
|
||||
PickPlayerClass();
|
||||
|
||||
cvar_set ("playerclass", sel == 0 && !gameinfo.norandomplayerclass ? "Random" : PlayerClass->Type->Meta.GetMetaString (APMETA_DisplayName));
|
||||
|
|
@ -922,7 +922,7 @@ void DPlayerMenu::ClassChanged (FListMenuItem *li)
|
|||
li = GetItem(NAME_Playerdisplay);
|
||||
if (li != NULL)
|
||||
{
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_CLASS, players[consoleplayer].userinfo.PlayerClass);
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_CLASS, players[consoleplayer].userinfo.GetPlayerClassNum());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -936,7 +936,7 @@ void DPlayerMenu::ClassChanged (FListMenuItem *li)
|
|||
void DPlayerMenu::SkinChanged (FListMenuItem *li)
|
||||
{
|
||||
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
|
||||
players[consoleplayer].userinfo.PlayerClass == -1)
|
||||
players[consoleplayer].userinfo.GetPlayerClassNum() == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -946,7 +946,7 @@ void DPlayerMenu::SkinChanged (FListMenuItem *li)
|
|||
if (li->GetValue(0, &sel))
|
||||
{
|
||||
sel = PlayerSkins[sel];
|
||||
players[consoleplayer].userinfo.skin = sel;
|
||||
players[consoleplayer].userinfo.SkinNumChanged(sel);
|
||||
UpdateTranslation();
|
||||
cvar_set ("skin", skins[sel].name);
|
||||
|
||||
|
|
@ -1013,7 +1013,7 @@ bool DPlayerMenu::MenuEvent (int mkey, bool fromcontroller)
|
|||
case NAME_Red:
|
||||
if (li->GetValue(0, &v))
|
||||
{
|
||||
int color = players[consoleplayer].userinfo.color;
|
||||
uint32 color = players[consoleplayer].userinfo.GetColor();
|
||||
SendNewColor (v, GPART(color), BPART(color));
|
||||
}
|
||||
break;
|
||||
|
|
@ -1021,7 +1021,7 @@ bool DPlayerMenu::MenuEvent (int mkey, bool fromcontroller)
|
|||
case NAME_Green:
|
||||
if (li->GetValue(0, &v))
|
||||
{
|
||||
int color = players[consoleplayer].userinfo.color;
|
||||
uint32 color = players[consoleplayer].userinfo.GetColor();
|
||||
SendNewColor (RPART(color), v, BPART(color));
|
||||
}
|
||||
break;
|
||||
|
|
@ -1029,7 +1029,7 @@ bool DPlayerMenu::MenuEvent (int mkey, bool fromcontroller)
|
|||
case NAME_Blue:
|
||||
if (li->GetValue(0, &v))
|
||||
{
|
||||
int color = players[consoleplayer].userinfo.color;
|
||||
uint32 color = players[consoleplayer].userinfo.GetColor();
|
||||
SendNewColor (RPART(color), GPART(color), v);
|
||||
}
|
||||
break;
|
||||
|
|
@ -1092,7 +1092,7 @@ bool DPlayerMenu::MouseEvent(int type, int x, int y)
|
|||
case NAME_Red:
|
||||
if (li->GetValue(0, &v))
|
||||
{
|
||||
int color = players[consoleplayer].userinfo.color;
|
||||
uint32 color = players[consoleplayer].userinfo.GetColor();
|
||||
SendNewColor (v, GPART(color), BPART(color));
|
||||
}
|
||||
break;
|
||||
|
|
@ -1100,7 +1100,7 @@ bool DPlayerMenu::MouseEvent(int type, int x, int y)
|
|||
case NAME_Green:
|
||||
if (li->GetValue(0, &v))
|
||||
{
|
||||
int color = players[consoleplayer].userinfo.color;
|
||||
uint32 color = players[consoleplayer].userinfo.GetColor();
|
||||
SendNewColor (RPART(color), v, BPART(color));
|
||||
}
|
||||
break;
|
||||
|
|
@ -1108,7 +1108,7 @@ bool DPlayerMenu::MouseEvent(int type, int x, int y)
|
|||
case NAME_Blue:
|
||||
if (li->GetValue(0, &v))
|
||||
{
|
||||
int color = players[consoleplayer].userinfo.color;
|
||||
uint32 color = players[consoleplayer].userinfo.GetColor();
|
||||
SendNewColor (RPART(color), GPART(color), v);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue