- initial layout for new player setup menu.

This commit is contained in:
Christoph Oelckers 2019-03-31 13:34:55 +02:00
parent 4b40e266f1
commit 1567bc5911
3 changed files with 159 additions and 3 deletions

View File

@ -369,7 +369,7 @@ OptionMenu "OptionsMenu" protected
Submenu "$OPTMNU_MOUSE", "MouseOptions" Submenu "$OPTMNU_MOUSE", "MouseOptions"
Submenu "$OPTMNU_JOYSTICK", "JoystickOptions" Submenu "$OPTMNU_JOYSTICK", "JoystickOptions"
StaticText " " StaticText " "
Submenu "$OPTMNU_PLAYER", "PlayerMenu" Submenu "$OPTMNU_PLAYER", "NewPlayerMenu"
Submenu "$OPTMNU_GAMEPLAY", "GameplayOptions" Submenu "$OPTMNU_GAMEPLAY", "GameplayOptions"
Submenu "$OPTMNU_COMPATIBILITY", "CompatibilityOptions" Submenu "$OPTMNU_COMPATIBILITY", "CompatibilityOptions"
Submenu "$OPTMNU_AUTOMAP", "AutomapOptions" Submenu "$OPTMNU_AUTOMAP", "AutomapOptions"
@ -401,6 +401,49 @@ OptionValue "Gender"
3, "$OPTVAL_OTHER" 3, "$OPTVAL_OTHER"
} }
OptionValue "PlayerColor"
{}
OptionValue "PlayerClass"
{}
OptionValue "PlayerTeam"
{}
OptionValue "PlayerSkin"
{}
/*
IfGame(Doom, Heretic, Strife, Chex)
{
MouseWindow 0, 220
PlayerDisplay 220, 48, "20 00 00", "80 00 40", 1, "PlayerDisplay"
}
IfGame(Hexen)
{
MouseWindow 0, 220
PlayerDisplay 220, 48, "00 07 00", "40 53 40", 1, "PlayerDisplay"
}
*/
OptionMenu "NewPlayerMenu"
{
Title "$MNU_PLAYERSETUP"
TextField "$PLYRMNU_NAME", menu_playername
Option "$PLYRMNU_TEAM", menu_playerteam, "PlayerTeam"
Option "$PLYRMNU_PLAYERCOLOR", menu_playercolorset, "PlayerColor"
Slider "$PLYRMNU_RED", menu_playercolor_red, 0, 255, 16
Slider "$PLYRMNU_GREEN", menu_playercolor_green, 0, 255, 16
Slider "$PLYRMNU_BLUE", menu_playercolor_blue, 0, 255, 16
Option "$PLYRMNU_PLAYERCLASS", menu_playerclass, "PlayerClass"
Option "$PLYRMNU_PLAYERSKIN", menu_playerskin, "PlayerSkin"
Option "$PLYRMNU_PLAYERGENDER", menu_playergender, "Gender"
Slider "$PLYRMNU_AUTOAIM", menu_playerautoaim, 0, 35, 1
Option "$PLYRMNU_SWITCHONPICKUP", menu_playerswitch, "OffOn"
Option "$PLYRMNU_ALWAYSRUN", cl_run, "OnOff"
Class "NewPlayerMenu"
}
ListMenu "PlayerMenu" ListMenu "PlayerMenu"
{ {
StaticTextCentered 160, 6, "$MNU_PLAYERSETUP" StaticTextCentered 160, 6, "$MNU_PLAYERSETUP"

View File

@ -410,6 +410,12 @@ class OptionMenu : Menu
// //
//============================================================================= //=============================================================================
virtual int GetIndent()
{
int indent = max(0, (mDesc.mIndent + 40) - CleanWidth_1 / 2);
return screen.GetWidth() / 2 + indent * CleanXfac_1;
}
override void Drawer () override void Drawer ()
{ {
int y = mDesc.mPosition; int y = mDesc.mPosition;
@ -433,8 +439,7 @@ class OptionMenu : Menu
int fontheight = OptionMenuSettings.mLinespacing * CleanYfac_1; int fontheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
y *= CleanYfac_1; y *= CleanYfac_1;
int indent = max(0, (mDesc.mIndent + 40) - CleanWidth_1 / 2); int indent = GetIndent();
indent = screen.GetWidth() / 2 + indent * CleanXfac_1;
int ytop = y + mDesc.mScrollTop * 8 * CleanYfac_1; int ytop = y + mDesc.mScrollTop * 8 * CleanYfac_1;
int lastrow = screen.GetHeight() - OptionHeight() * CleanYfac_1; int lastrow = screen.GetHeight() - OptionHeight() * CleanYfac_1;

View File

@ -593,3 +593,111 @@ class PlayerMenu : ListMenu
} }
} }
class NewPlayerMenu : OptionMenu
{
TextureID mBackdrop;
PlayerClass mPlayerClass;
State mPlayerState;
int mPlayerTics;
bool mNoportrait;
int8 mRotation;
int8 mMode; // 0: automatic (used by class selection), 1: manual (used by player setup)
int8 mTranslate;
int mSkin;
int mClassNum;
Color mBaseColor;
Color mAddColor;
const PLAYERDISPLAY_X = 220;
const PLAYERDISPLAY_Y = 60;
const PLAYERDISPLAY_W = 144;
const PLAYERDISPLAY_H = 160;
const PLAYERDISPLAY_SPACE = 180;
override void Init(Menu parent, OptionMenuDescriptor desc)
{
Super.Init(parent, desc);
mBackdrop = TexMan.CheckForTexture("B@CKDROP", TexMan.Type_MiscPatch); // The weird name is to avoid clashes with mods.
mBaseColor = gameinfo.gametype == GAME_Hexen? 0x200000 : 0x000700;
mAddColor = gameinfo.gametype == GAME_Hexen? 0x800040 : 0x405340;
}
override int GetIndent()
{
return Super.GetIndent() - 45*CleanXfac_1;
}
override void Drawer()
{
Super.Drawer();
DrawPlayerDisplay();
int x = screen.GetWidth()/(CleanXfac_1*2) + PLAYERDISPLAY_X + PLAYERDISPLAY_W/2;
int y = PLAYERDISPLAY_Y + PLAYERDISPLAY_H + 5;
String str = Stringtable.Localize("$PLYRMNU_PRESSSPACE");
screen.DrawText (NewSmallFont, Font.CR_GOLD, x - NewSmallFont.StringWidth(str)/2, y, str, DTA_VirtualWidth, CleanWidth_1, DTA_VirtualHeight, CleanHeight_1, DTA_KeepRatio, true);
str = Stringtable.Localize(mRotation ? "$PLYRMNU_SEEFRONT" : "$PLYRMNU_SEEBACK");
y += NewSmallFont.GetHeight();
screen.DrawText (NewSmallFont, Font.CR_GOLD,x - NewSmallFont.StringWidth(str)/2, y, str, DTA_VirtualWidth, CleanWidth_1, DTA_VirtualHeight, CleanHeight_1, DTA_KeepRatio, true);
}
//=============================================================================
//
//
//
//=============================================================================
void DrawPlayerDisplay()
{
int x = screen.GetWidth()/2 + PLAYERDISPLAY_X * CleanXfac_1;
int y = PLAYERDISPLAY_Y * CleanYfac_1;
int r = mBaseColor.r + mAddColor.r;
int g = mBaseColor.g + mAddColor.g;
int b = mBaseColor.b + mAddColor.b;
int m = max(r, g, b);
r = r * 255 / m;
g = g * 255 / m;
b = b * 255 / m;
Color c = Color(255, r, g, b);
screen.DrawTexture(mBackdrop, false, x, y - 1,
DTA_DestWidth, PLAYERDISPLAY_W * CleanXfac_1,
DTA_DestHeight, PLAYERDISPLAY_H * CleanYfac_1,
DTA_Color, c,
DTA_KeepRatio, mNoPortrait,
DTA_Masked, true);
Screen.DrawFrame (x, y, PLAYERDISPLAY_W*CleanXfac_1, PLAYERDISPLAY_H*CleanYfac_1-1);
if (mPlayerState != NULL && mPlayerState != NULL)
{
Vector2 Scale;
TextureID sprite;
bool flip;
let playdef = GetDefaultByType((class<PlayerPawn>)(mPlayerClass.Type));
[sprite, flip, Scale] = mPlayerState.GetSpriteTexture(mRotation, mSkin, playdef.Scale);
if (sprite.IsValid())
{
int trans = mTranslate? Translation.MakeID(TRANSLATION_Players, MAXPLAYERS) : 0;
let tscale = TexMan.GetScaledSize(sprite);
Scale.X *= CleanXfac_1 * tscale.X;
Scale.Y *= CleanYfac_1 * tscale.Y;
screen.DrawTexture (sprite, false,
x + (PLAYERDISPLAY_X/2) * CleanXfac_1, y + (PLAYERDISPLAY_H-8) * CleanYfac_1,
DTA_DestWidthF, Scale.X, DTA_DestHeightF, Scale.Y,
DTA_TranslationIndex, trans,
DTA_KeepRatio, mNoPortrait,
DTA_FlipX, flip);
}
}
}
}