1.2 update w/ GZDoom 4.9 features:

- Changeable player skins.
 - Ammo LEDs are now 1:1 with UT by using canvas textures.
 - Integrate some add-ons, including reskins.
 - Various fixes (some backported from Demolitionist).
 - Migrated from libeye to Gutamatics.
This commit is contained in:
Marisa the Magician 2022-11-05 23:59:16 +01:00
commit 602a89cc68
1761 changed files with 4461 additions and 1597 deletions

View file

@ -51,6 +51,209 @@ Class OptionMenuItemUTHudPreview : OptionMenuItem
}
}
Class OptionMenuItemUTFacePreview : OptionMenuItem
{
String texpath[4];
TextureID talkface[4];
CVar mCVar[8];
OptionMenuItemUTFacePreview Init( String dummy )
{
Super.Init(dummy,'None',true);
mCVar[0] = CVar.FindCVar('flak_cmdoskin');
mCVar[1] = CVar.FindCVar('flak_fcmdskin');
mCVar[2] = CVar.FindCVar('flak_sldrskin');
mCVar[3] = CVar.FindCVar('flak_armyskin');
mCVar[4] = CVar.FindCVar('flak_cmdoface');
mCVar[5] = CVar.FindCVar('flak_fcmdface');
mCVar[6] = CVar.FindCVar('flak_sldrface');
mCVar[7] = CVar.FindCVar('flak_armyface');
return self;
}
override int Draw( OptionMenuDescriptor desc, int y, int indent, bool selected )
{
int x = Screen.GetWidth()/2-140*CleanXFac_1;
for ( int i=0; i<4; i++ )
{
String path;
switch ( i )
{
default:
case 0:
path = "models/Commando/"..mCVar[0].GetString().."5"..mCVar[4].GetString()..".png";
break;
case 1:
path = "models/FCommando/"..mCVar[1].GetString().."5"..mCVar[5].GetString()..".png";
break;
case 2:
path = "models/Soldier/"..mCVar[2].GetString().."5"..mCVar[6].GetString()..".png";
break;
case 3:
path = "models/SGirl/"..mCVar[3].GetString().."5"..mCVar[7].GetString()..".png";
break;
}
if ( (texpath[i] != path) || talkface[i].IsNull() )
{
texpath[i] = path;
talkface[i] = TexMan.CheckForTexture(path,TexMan.Type_Any);
}
Screen.DrawTexture(talkface[i],false,x,y-8*CleanYFac_1,DTA_CleanNoMove_1,true);
x += 72*CleanXFac_1;
}
return -1;
}
override bool Selectable()
{
return false;
}
}
Class OptionMenuItemUTFaceOption : OptionMenuItemOptionBase
{
CVar mCVar, mCVar2;
int type;
Array<String> faces;
void InitFaces()
{
faces.Clear();
String path;
switch ( type )
{
default:
case 0:
path = "models/Commando/"..mCVar2.GetString().."2";
break;
case 1:
path = "models/FCommando/"..mCVar2.GetString().."4";
break;
case 2:
path = "models/Soldier/"..mCVar2.GetString().."4";
break;
case 3:
path = "models/SGirl/"..mCVar2.GetString().."4";
break;
}
for ( int l=0; l<Wads.GetNumLumps(); l++ )
{
String fn = Wads.GetLumpFullName(l);
if ( !(fn.Left(path.Length()) ~== path) ) continue;
fn = fn.Mid(path.length());
int ext = fn.IndexOf(".");
if ( ext == -1 ) continue;
fn = fn.Left(ext);
if ( (fn == "") || (fn ~== "ice") ) continue; // empty face + special name
faces.Push(fn);
}
if ( GetSelection() == -1 ) SetSelection(0);
}
OptionMenuItemUTFaceOption Init( String label, Name command, Name command2, int type, CVar graycheck = null, int center = 0 )
{
Super.Init(label,command,'',graycheck,center);
mCVar = CVar.FindCVar(mAction);
mCVar2 = Cvar.FindCvar(command2);
self.type = type;
InitFaces();
return self;
}
override bool SetString( int i, String newtext )
{
if ( i == OP_VALUES )
{
int cnt = faces.Size();
if ( cnt >= 0 )
{
mValues = newtext;
int s = GetSelection();
if ( (s >= cnt) || (s < 0) ) s = 0;
SetSelection(s);
return true;
}
}
return false;
}
override int GetSelection()
{
int Selection = -1;
int cnt = faces.Size();
if ( (cnt > 0) && mCVar )
{
String cv = mCVar.GetString();
for( int i=0; i<cnt; i++ )
{
if ( cv ~== faces[i] )
{
Selection = i;
break;
}
}
}
return Selection;
}
override void SetSelection( int Selection )
{
int cnt = faces.Size();
if ( (cnt > 0) && mCVar )
mCVar.SetString(faces[Selection]);
}
override int Draw( OptionMenuDescriptor desc, int y, int indent, bool selected )
{
if ( mCenter ) indent = (screen.GetWidth()/2);
drawLabel(indent,y,selected?OptionMenuSettings.mFontColorSelection:OptionMenuSettings.mFontColor,isGrayed());
int Selection = GetSelection();
String text = (Selection!=-1)?faces[Selection]:"unknown";
// capitalize first letter
text = text.Left(1).MakeUpper()..text.Mid(1);
drawValue(indent,y,OptionMenuSettings.mFontColorValue,text,isGrayed());
return indent;
}
override bool MenuEvent( int mkey, bool fromcontroller )
{
int cnt = faces.Size();
if ( cnt > 0 )
{
int Selection = GetSelection();
if ( mkey == Menu.MKEY_Left )
{
if ( Selection == -1 ) Selection = 0;
else if ( --Selection < 0 ) Selection = cnt-1;
}
else if ( (mkey == Menu.MKEY_Right) || (mkey == Menu.MKEY_Enter) )
{
if ( ++Selection >= cnt ) Selection = 0;
}
else return OptionMenuItem.MenuEvent(mkey,fromcontroller);
SetSelection(Selection);
Menu.MenuSound("menu/change");
}
else return OptionMenuItem.MenuEvent(mkey,fromcontroller);
return true;
}
}
Class OptionMenuItemUTSkinOption : OptionMenuItemOption
{
OptionMenuItemUTFaceOption linked;
override void SetSelection( int Selection )
{
int oldsel = GetSelection();
Super.SetSelection(Selection);
int newsel = GetSelection();
if ( oldsel == newsel ) return;
// force face to update
linked.InitFaces();
}
}
// changes to Tahoma
Class UTMessageBox : MessageBoxMenu
{
@ -90,6 +293,20 @@ Class UTOptionMenu : OptionMenu
{
private String ttip;
override void Init( Menu parent, OptionMenuDescriptor desc )
{
Super.Init(parent,desc);
// link skins and faces
for ( int i=0; i<mDesc.mItems.Size(); i++ )
{
if ( !(mDesc.mItems[i] is 'OptionMenuItemUTSkinOption') )
continue;
// next element should be the face
if ( !(mDesc.mItems[i+1] is 'OptionMenuItemUTFaceOption') )
ThrowAbortException("UTSkinOption without UTFaceOption in menu.");
OptionMenuItemUTSkinOption(mDesc.mItems[i]).linked = OptionMenuItemUTFaceOption(mDesc.mItems[i+1]);
}
}
override void Ticker()
{
Super.Ticker();
@ -147,4 +364,4 @@ Class UTOptionMenu : OptionMenu
ypos += fnt.GetHeight()*CleanYFac_1;
}
}
}
}