- turned all menu items into actual objects.
This is needed for script export.
This commit is contained in:
parent
c6e42d6fa0
commit
d5962b290c
12 changed files with 499 additions and 372 deletions
|
|
@ -60,9 +60,10 @@ EXTERN_CVAR (Bool, cl_run)
|
|||
// Player's name
|
||||
//
|
||||
//=============================================================================
|
||||
IMPLEMENT_CLASS(DPlayerNameBox, false, false)
|
||||
|
||||
FPlayerNameBox::FPlayerNameBox(int x, int y, int height, int frameofs, const char *text, FFont *font, EColorRange color, FName action)
|
||||
: FListMenuItemSelectable(x, y, height, action)
|
||||
DPlayerNameBox::DPlayerNameBox(int x, int y, int height, int frameofs, const char *text, FFont *font, EColorRange color, FName action)
|
||||
: DListMenuItemSelectable(x, y, height, action)
|
||||
{
|
||||
mText = text;
|
||||
mFont = font;
|
||||
|
|
@ -72,17 +73,13 @@ FPlayerNameBox::FPlayerNameBox(int x, int y, int height, int frameofs, const cha
|
|||
mEntering = false;
|
||||
}
|
||||
|
||||
FPlayerNameBox::~FPlayerNameBox()
|
||||
{
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
bool FPlayerNameBox::SetString(int i, const char *s)
|
||||
bool DPlayerNameBox::SetString(int i, const char *s)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
|
|
@ -93,7 +90,7 @@ bool FPlayerNameBox::SetString(int i, const char *s)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool FPlayerNameBox::GetString(int i, char *s, int len)
|
||||
bool DPlayerNameBox::GetString(int i, char *s, int len)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
|
|
@ -110,7 +107,7 @@ bool FPlayerNameBox::GetString(int i, char *s, int len)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void FPlayerNameBox::DrawBorder (int x, int y, int len)
|
||||
void DPlayerNameBox::DrawBorder (int x, int y, int len)
|
||||
{
|
||||
FTexture *left = TexMan[TexMan.CheckForTexture("M_LSLEFT", FTexture::TEX_MiscPatch)];
|
||||
FTexture *mid = TexMan[TexMan.CheckForTexture("M_LSCNTR", FTexture::TEX_MiscPatch)];
|
||||
|
|
@ -149,7 +146,7 @@ void FPlayerNameBox::DrawBorder (int x, int y, int len)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void FPlayerNameBox::Drawer(bool selected)
|
||||
void DPlayerNameBox::Drawer(bool selected)
|
||||
{
|
||||
const char *text = mText;
|
||||
if (text != NULL)
|
||||
|
|
@ -185,7 +182,7 @@ void FPlayerNameBox::Drawer(bool selected)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
bool FPlayerNameBox::MenuEvent(int mkey, bool fromcontroller)
|
||||
bool DPlayerNameBox::MenuEvent(int mkey, bool fromcontroller)
|
||||
{
|
||||
if (mkey == MKEY_Enter)
|
||||
{
|
||||
|
|
@ -215,9 +212,10 @@ bool FPlayerNameBox::MenuEvent(int mkey, bool fromcontroller)
|
|||
// items for the player menu
|
||||
//
|
||||
//=============================================================================
|
||||
IMPLEMENT_CLASS(DValueTextItem, false, false)
|
||||
|
||||
FValueTextItem::FValueTextItem(int x, int y, int height, const char *text, FFont *font, EColorRange color, EColorRange valuecolor, FName action, FName values)
|
||||
: FListMenuItemSelectable(x, y, height, action)
|
||||
DValueTextItem::DValueTextItem(int x, int y, int height, const char *text, FFont *font, EColorRange color, EColorRange valuecolor, FName action, FName values)
|
||||
: DListMenuItemSelectable(x, y, height, action)
|
||||
{
|
||||
mText = text;
|
||||
mFont = font;
|
||||
|
|
@ -237,17 +235,13 @@ FValueTextItem::FValueTextItem(int x, int y, int height, const char *text, FFont
|
|||
}
|
||||
}
|
||||
|
||||
FValueTextItem::~FValueTextItem()
|
||||
{
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
bool FValueTextItem::SetString(int i, const char *s)
|
||||
bool DValueTextItem::SetString(int i, const char *s)
|
||||
{
|
||||
// should actually use the index...
|
||||
FString str = s;
|
||||
|
|
@ -262,7 +256,7 @@ bool FValueTextItem::SetString(int i, const char *s)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
bool FValueTextItem::SetValue(int i, int value)
|
||||
bool DValueTextItem::SetValue(int i, int value)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
|
|
@ -272,7 +266,7 @@ bool FValueTextItem::SetValue(int i, int value)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool FValueTextItem::GetValue(int i, int *pvalue)
|
||||
bool DValueTextItem::GetValue(int i, int *pvalue)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
|
|
@ -288,7 +282,7 @@ bool FValueTextItem::GetValue(int i, int *pvalue)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
bool FValueTextItem::MenuEvent (int mkey, bool fromcontroller)
|
||||
bool DValueTextItem::MenuEvent (int mkey, bool fromcontroller)
|
||||
{
|
||||
if (mSelections.Size() > 1)
|
||||
{
|
||||
|
|
@ -314,7 +308,7 @@ bool FValueTextItem::MenuEvent (int mkey, bool fromcontroller)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void FValueTextItem::Drawer(bool selected)
|
||||
void DValueTextItem::Drawer(bool selected)
|
||||
{
|
||||
const char *text = mText;
|
||||
|
||||
|
|
@ -335,9 +329,10 @@ void FValueTextItem::Drawer(bool selected)
|
|||
// items for the player menu
|
||||
//
|
||||
//=============================================================================
|
||||
IMPLEMENT_CLASS(DSliderItem, false, false)
|
||||
|
||||
FSliderItem::FSliderItem(int x, int y, int height, const char *text, FFont *font, EColorRange color, FName action, int min, int max, int step)
|
||||
: FListMenuItemSelectable(x, y, height, action)
|
||||
DSliderItem::DSliderItem(int x, int y, int height, const char *text, FFont *font, EColorRange color, FName action, int min, int max, int step)
|
||||
: DListMenuItemSelectable(x, y, height, action)
|
||||
{
|
||||
mText = text;
|
||||
mFont = font;
|
||||
|
|
@ -348,17 +343,13 @@ FSliderItem::FSliderItem(int x, int y, int height, const char *text, FFont *font
|
|||
mStep = step;
|
||||
}
|
||||
|
||||
FSliderItem::~FSliderItem()
|
||||
{
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
bool FSliderItem::SetValue(int i, int value)
|
||||
bool DSliderItem::SetValue(int i, int value)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
|
|
@ -368,7 +359,7 @@ bool FSliderItem::SetValue(int i, int value)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool FSliderItem::GetValue(int i, int *pvalue)
|
||||
bool DSliderItem::GetValue(int i, int *pvalue)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
|
|
@ -384,7 +375,7 @@ bool FSliderItem::GetValue(int i, int *pvalue)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
bool FSliderItem::MenuEvent (int mkey, bool fromcontroller)
|
||||
bool DSliderItem::MenuEvent (int mkey, bool fromcontroller)
|
||||
{
|
||||
if (mkey == MKEY_Left)
|
||||
{
|
||||
|
|
@ -407,7 +398,7 @@ bool FSliderItem::MenuEvent (int mkey, bool fromcontroller)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
bool FSliderItem::MouseEvent(int type, int x, int y)
|
||||
bool DSliderItem::MouseEvent(int type, int x, int y)
|
||||
{
|
||||
DListMenu *lm = static_cast<DListMenu*>(DMenu::CurrentMenu);
|
||||
if (type != DMenu::MOUSE_Click)
|
||||
|
|
@ -447,7 +438,7 @@ bool FSliderItem::MouseEvent(int type, int x, int y)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void FSliderItem::DrawSlider (int x, int y)
|
||||
void DSliderItem::DrawSlider (int x, int y)
|
||||
{
|
||||
int range = mMaxrange - mMinrange;
|
||||
int cur = mSelection - mMinrange;
|
||||
|
|
@ -473,7 +464,7 @@ void FSliderItem::DrawSlider (int x, int y)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void FSliderItem::Drawer(bool selected)
|
||||
void DSliderItem::Drawer(bool selected)
|
||||
{
|
||||
const char *text = mText;
|
||||
|
||||
|
|
@ -508,11 +499,11 @@ class DPlayerMenu : public DListMenu
|
|||
void UpdateTranslation();
|
||||
void SendNewColor (int red, int green, int blue);
|
||||
|
||||
void PlayerNameChanged(FListMenuItem *li);
|
||||
void ColorSetChanged (FListMenuItem *li);
|
||||
void ClassChanged (FListMenuItem *li);
|
||||
void AutoaimChanged (FListMenuItem *li);
|
||||
void SkinChanged (FListMenuItem *li);
|
||||
void PlayerNameChanged(DListMenuItem *li);
|
||||
void ColorSetChanged (DListMenuItem *li);
|
||||
void ClassChanged (DListMenuItem *li);
|
||||
void AutoaimChanged (DListMenuItem *li);
|
||||
void SkinChanged (DListMenuItem *li);
|
||||
|
||||
|
||||
public:
|
||||
|
|
@ -536,7 +527,7 @@ IMPLEMENT_CLASS(DPlayerMenu, false, false)
|
|||
|
||||
void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
|
||||
{
|
||||
FListMenuItem *li;
|
||||
DListMenuItem *li;
|
||||
|
||||
Super::Init(parent, desc);
|
||||
PickPlayerClass();
|
||||
|
|
@ -545,14 +536,14 @@ void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
|
|||
li = GetItem(NAME_Playerdisplay);
|
||||
if (li != NULL)
|
||||
{
|
||||
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.GetPlayerClassNum());
|
||||
li->SetValue(DListMenuItemPlayerDisplay::PDF_ROTATION, 0);
|
||||
li->SetValue(DListMenuItemPlayerDisplay::PDF_MODE, 1);
|
||||
li->SetValue(DListMenuItemPlayerDisplay::PDF_TRANSLATE, 1);
|
||||
li->SetValue(DListMenuItemPlayerDisplay::PDF_CLASS, players[consoleplayer].userinfo.GetPlayerClassNum());
|
||||
if (PlayerClass != NULL && !(GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN) &&
|
||||
players[consoleplayer].userinfo.GetPlayerClassNum() != -1)
|
||||
{
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_SKIN, players[consoleplayer].userinfo.GetSkin());
|
||||
li->SetValue(DListMenuItemPlayerDisplay::PDF_SKIN, players[consoleplayer].userinfo.GetSkin());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -664,10 +655,10 @@ bool DPlayerMenu::Responder (event_t *ev)
|
|||
{
|
||||
// turn the player sprite around
|
||||
mRotation = 8 - mRotation;
|
||||
FListMenuItem *li = GetItem(NAME_Playerdisplay);
|
||||
DListMenuItem *li = GetItem(NAME_Playerdisplay);
|
||||
if (li != NULL)
|
||||
{
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_ROTATION, mRotation);
|
||||
li->SetValue(DListMenuItemPlayerDisplay::PDF_ROTATION, mRotation);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -754,7 +745,7 @@ void DPlayerMenu::SendNewColor (int red, int green, int blue)
|
|||
|
||||
void DPlayerMenu::UpdateColorsets()
|
||||
{
|
||||
FListMenuItem *li = GetItem(NAME_Color);
|
||||
DListMenuItem *li = GetItem(NAME_Color);
|
||||
if (li != NULL)
|
||||
{
|
||||
int sel = 0;
|
||||
|
|
@ -790,7 +781,7 @@ void DPlayerMenu::UpdateSkins()
|
|||
{
|
||||
int sel = 0;
|
||||
int skin;
|
||||
FListMenuItem *li = GetItem(NAME_Skin);
|
||||
DListMenuItem *li = GetItem(NAME_Skin);
|
||||
if (li != NULL)
|
||||
{
|
||||
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
|
||||
|
|
@ -821,7 +812,7 @@ void DPlayerMenu::UpdateSkins()
|
|||
li = GetItem(NAME_Playerdisplay);
|
||||
if (li != NULL)
|
||||
{
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_SKIN, skin);
|
||||
li->SetValue(DListMenuItemPlayerDisplay::PDF_SKIN, skin);
|
||||
}
|
||||
}
|
||||
UpdateTranslation();
|
||||
|
|
@ -833,7 +824,7 @@ void DPlayerMenu::UpdateSkins()
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void DPlayerMenu::PlayerNameChanged(FListMenuItem *li)
|
||||
void DPlayerMenu::PlayerNameChanged(DListMenuItem *li)
|
||||
{
|
||||
char pp[MAXPLAYERNAME+1];
|
||||
const char *p;
|
||||
|
|
@ -861,7 +852,7 @@ void DPlayerMenu::PlayerNameChanged(FListMenuItem *li)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void DPlayerMenu::ColorSetChanged (FListMenuItem *li)
|
||||
void DPlayerMenu::ColorSetChanged (DListMenuItem *li)
|
||||
{
|
||||
int sel;
|
||||
|
||||
|
|
@ -871,9 +862,9 @@ void DPlayerMenu::ColorSetChanged (FListMenuItem *li)
|
|||
|
||||
if (sel > 0) mycolorset = PlayerColorSets[sel-1];
|
||||
|
||||
FListMenuItem *red = GetItem(NAME_Red);
|
||||
FListMenuItem *green = GetItem(NAME_Green);
|
||||
FListMenuItem *blue = GetItem(NAME_Blue);
|
||||
DListMenuItem *red = GetItem(NAME_Red);
|
||||
DListMenuItem *green = GetItem(NAME_Green);
|
||||
DListMenuItem *blue = GetItem(NAME_Blue);
|
||||
|
||||
// disable the sliders if a valid colorset is selected
|
||||
if (red != NULL) red->Enable(mycolorset == -1);
|
||||
|
|
@ -894,7 +885,7 @@ void DPlayerMenu::ColorSetChanged (FListMenuItem *li)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void DPlayerMenu::ClassChanged (FListMenuItem *li)
|
||||
void DPlayerMenu::ClassChanged (DListMenuItem *li)
|
||||
{
|
||||
if (PlayerClasses.Size () == 1)
|
||||
{
|
||||
|
|
@ -917,7 +908,7 @@ void DPlayerMenu::ClassChanged (FListMenuItem *li)
|
|||
li = GetItem(NAME_Playerdisplay);
|
||||
if (li != NULL)
|
||||
{
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_CLASS, players[consoleplayer].userinfo.GetPlayerClassNum());
|
||||
li->SetValue(DListMenuItemPlayerDisplay::PDF_CLASS, players[consoleplayer].userinfo.GetPlayerClassNum());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -928,7 +919,7 @@ void DPlayerMenu::ClassChanged (FListMenuItem *li)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void DPlayerMenu::SkinChanged (FListMenuItem *li)
|
||||
void DPlayerMenu::SkinChanged (DListMenuItem *li)
|
||||
{
|
||||
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
|
||||
players[consoleplayer].userinfo.GetPlayerClassNum() == -1)
|
||||
|
|
@ -948,7 +939,7 @@ void DPlayerMenu::SkinChanged (FListMenuItem *li)
|
|||
li = GetItem(NAME_Playerdisplay);
|
||||
if (li != NULL)
|
||||
{
|
||||
li->SetValue(FListMenuItemPlayerDisplay::PDF_SKIN, sel);
|
||||
li->SetValue(DListMenuItemPlayerDisplay::PDF_SKIN, sel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -959,7 +950,7 @@ void DPlayerMenu::SkinChanged (FListMenuItem *li)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void DPlayerMenu::AutoaimChanged (FListMenuItem *li)
|
||||
void DPlayerMenu::AutoaimChanged (DListMenuItem *li)
|
||||
{
|
||||
int sel;
|
||||
|
||||
|
|
@ -980,7 +971,7 @@ bool DPlayerMenu::MenuEvent (int mkey, bool fromcontroller)
|
|||
int v;
|
||||
if (mDesc->mSelectedItem >= 0)
|
||||
{
|
||||
FListMenuItem *li = mDesc->mItems[mDesc->mSelectedItem];
|
||||
DListMenuItem *li = mDesc->mItems[mDesc->mSelectedItem];
|
||||
if (li->MenuEvent(mkey, fromcontroller))
|
||||
{
|
||||
FName current = li->GetAction(NULL);
|
||||
|
|
@ -1076,7 +1067,7 @@ bool DPlayerMenu::MenuEvent (int mkey, bool fromcontroller)
|
|||
bool DPlayerMenu::MouseEvent(int type, int x, int y)
|
||||
{
|
||||
int v;
|
||||
FListMenuItem *li = mFocusControl;
|
||||
DListMenuItem *li = mFocusControl;
|
||||
bool res = Super::MouseEvent(type, x, y);
|
||||
if (li == NULL) li = mFocusControl;
|
||||
if (li != NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue