Somewhat less hacky menu code.
This commit is contained in:
parent
03dc2d8c7d
commit
75ffce1627
4 changed files with 35 additions and 52 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r722 \cu(Fri 30 Dec 23:30:52 CET 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r722 \cu(2022-12-30 23:30:52)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r723 \cu(Sat 31 Dec 13:08:09 CET 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r723 \cu(2022-12-31 13:08:09)\c-";
|
||||
|
|
|
|||
19
menudef.txt
19
menudef.txt
|
|
@ -252,6 +252,7 @@ ListMenu "MainMenu"
|
|||
{
|
||||
Class "SWWMMainMenu"
|
||||
Size Clean
|
||||
Animated
|
||||
Font "TewiFontOutline", "White", "Sapphire"
|
||||
Selector "graphics/DemoIcon.png", -24, 0
|
||||
LineSpacing 32
|
||||
|
|
@ -267,6 +268,7 @@ ListMenu "MainMenuTextOnly"
|
|||
{
|
||||
Class "SWWMMainMenu"
|
||||
Size Clean
|
||||
Animated
|
||||
Font "TewiFontOutline", "White", "Sapphire"
|
||||
Selector "graphics/DemoIcon.png", -24, 0
|
||||
LineSpacing 32
|
||||
|
|
@ -282,6 +284,7 @@ ListMenu "GameFilesMenu"
|
|||
{
|
||||
Class "SWWMCleanMenu"
|
||||
Size Clean
|
||||
Animated
|
||||
Font "TewiFontOutline", "White", "Sapphire"
|
||||
Selector "graphics/DemoIcon.png", -24, 0
|
||||
LineSpacing 32
|
||||
|
|
@ -291,8 +294,10 @@ ListMenu "GameFilesMenu"
|
|||
}
|
||||
ListMenu "EpisodeMenu"
|
||||
{
|
||||
Class "SWWMBigMenuHack"
|
||||
Class "SWWMScrollMenu"
|
||||
Size Clean
|
||||
Animated
|
||||
ForceList
|
||||
IfGame(Doom, Heretic, Hexen, Strife)
|
||||
{
|
||||
NetgameMessage "$NEWGAME"
|
||||
|
|
@ -303,18 +308,20 @@ ListMenu "EpisodeMenu"
|
|||
}
|
||||
Font "TewiFontOutline", "White", "Sapphire"
|
||||
Selector "graphics/DemoIcon.png", -24, 0
|
||||
LineSpacing 0
|
||||
LineSpacing 32
|
||||
SWWMStaticTextM 0, 0, "$MNU_EPISODE", "Blue"
|
||||
Position 0, 0
|
||||
Position 0, 56
|
||||
}
|
||||
|
||||
ListMenu "SkillMenu"
|
||||
{
|
||||
Class "SWWMBigMenuHack"
|
||||
Class "SWWMScrollMenu"
|
||||
Size Clean
|
||||
Animated
|
||||
ForceList
|
||||
Font "TewiFontOutline", "White", "Sapphire"
|
||||
Selector "graphics/DemoIcon.png", -24, 0
|
||||
LineSpacing 0
|
||||
LineSpacing 32
|
||||
SWWMStaticTextM 0, 0, "$MNU_CHOOSESKILL", "Blue"
|
||||
Position 0, 0
|
||||
Position 0, 56
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ GameInfo
|
|||
NoMergePickupMsg = true
|
||||
CursorPic = "graphics/swwmcurs.png"
|
||||
DimColor = "Black"
|
||||
DimAmount = 0.5
|
||||
DimAmount = 0.75
|
||||
BlurAmount = 0
|
||||
Endoom = "ENDSWWM"
|
||||
PickupColor = "Gold"
|
||||
|
|
|
|||
|
|
@ -244,12 +244,6 @@ Class SWWMOptionMenu : OptionMenu
|
|||
|
||||
Class SWWMCleanMenu : ListMenu
|
||||
{
|
||||
override void Init( Menu parent, ListMenuDescriptor desc )
|
||||
{
|
||||
Super.Init(parent,desc);
|
||||
Animated = true;
|
||||
}
|
||||
|
||||
override bool MouseEvent( int type, int x, int y )
|
||||
{
|
||||
if ( mDesc.DisplayWidth() != ListMenuDescriptor.CleanScale )
|
||||
|
|
@ -284,8 +278,7 @@ Class SWWMCleanMenu : ListMenu
|
|||
Class SWWMMainMenu : SWWMCleanMenu
|
||||
{
|
||||
TextureID demotex, gradtex;
|
||||
double demopos;
|
||||
double prevms;
|
||||
int fadetime;
|
||||
Font mSmallFont;
|
||||
|
||||
private TextureID GetDemoTex()
|
||||
|
|
@ -322,15 +315,13 @@ Class SWWMMainMenu : SWWMCleanMenu
|
|||
Super.Init(parent,desc);
|
||||
mSmallFont = Font.GetFont('TewiFont');
|
||||
demotex = GetDemoTex();
|
||||
demopos = 120;
|
||||
prevms = MSTimeF();
|
||||
fadetime = MenuTime()+1;
|
||||
}
|
||||
|
||||
override void OnReturn()
|
||||
{
|
||||
demotex = GetDemoTex();
|
||||
demopos = 120;
|
||||
prevms = MSTimeF();
|
||||
fadetime = MenuTime()+1;
|
||||
}
|
||||
|
||||
private int GetMenuYOffset()
|
||||
|
|
@ -341,12 +332,7 @@ Class SWWMMainMenu : SWWMCleanMenu
|
|||
|
||||
override void Drawer()
|
||||
{
|
||||
double frametime = (MSTimeF()-prevms)/1000.;
|
||||
double theta;
|
||||
// naive, but whatever
|
||||
theta = clamp(4.*frametime,0.,1.);
|
||||
if ( prevms ) demopos = SWWMUtility.Lerp(demopos,-40,theta);
|
||||
double alph = clamp(1.-(demopos/100),0.,1.);
|
||||
double alph = clamp(((MenuTime()+System.GetTimeFrac())-fadetime)/(GameTicRate/3.),0.,1.);
|
||||
if ( !gradtex ) gradtex = TexMan.CheckForTexture("graphics/M_GRAD.png");
|
||||
double scl = Screen.GetHeight()/960.;
|
||||
Screen.DrawTexture(gradtex,false,0,Screen.GetHeight(),DTA_DestWidth,Screen.GetWidth(),DTA_DestHeight,256*CleanYFac_1,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_TopOffset,256,DTA_Alpha,.35);
|
||||
|
|
@ -368,7 +354,6 @@ Class SWWMMainMenu : SWWMCleanMenu
|
|||
yy = CleanHeight_1-height;
|
||||
Screen.Dim("Black",.75,int(xx*CleanXFac_1),int(yy*CleanYFac_1),int(width*CleanXFac_1),int(height*CleanYFac_1));
|
||||
Screen.DrawText(mSmallFont,Font.CR_GOLD,(xx+4)*CleanXFac_1,(yy+2)*CleanYFac_1,str,DTA_CleanNoMove_1,true);
|
||||
prevms = MSTimeF();
|
||||
}
|
||||
|
||||
override bool MouseEvent( int type, int x, int y )
|
||||
|
|
@ -382,11 +367,9 @@ Class SWWMMainMenu : SWWMCleanMenu
|
|||
}
|
||||
}
|
||||
|
||||
// skill/episode menu hack
|
||||
Class SWWMBigMenuHack : SWWMCleanMenu
|
||||
// skill/episode menu, featuring scrolling
|
||||
Class SWWMScrollMenu : SWWMCleanMenu
|
||||
{
|
||||
const BIGMENUSPACING = 32;
|
||||
|
||||
bool longlist; // more than 10 entries, scrolls
|
||||
int ofs;
|
||||
|
||||
|
|
@ -412,7 +395,7 @@ Class SWWMBigMenuHack : SWWMCleanMenu
|
|||
Name c;
|
||||
int p;
|
||||
[c, p] = ti.GetAction();
|
||||
rep.InitDirect(ti.GetX(),ti.GetY(),BIGMENUSPACING,ti.mHotkey,ti.mText,ti.mFont,ti.mColor,ti.mColorSelected,c,p);
|
||||
rep.InitDirect(ti.GetX(),ti.GetY(),mDesc.mLineSpacing,ti.mHotkey,ti.mText,ti.mFont,ti.mColor,ti.mColorSelected,c,p);
|
||||
if ( (ti.mText == "$M_EPITNT") || (tntfix && (tntfix < 5)) )
|
||||
rep.mText = tutnt_ep[tntfix++];
|
||||
mDesc.mItems[i] = rep;
|
||||
|
|
@ -425,7 +408,7 @@ Class SWWMBigMenuHack : SWWMCleanMenu
|
|||
Name c;
|
||||
int p;
|
||||
[c, p] = pi.GetAction();
|
||||
rep.InitDirect(pi.GetX(),pi.GetY(),BIGMENUSPACING,pi.mHotkey,pi.mTexture,c,p);
|
||||
rep.InitDirect(pi.GetX(),pi.GetY(),mDesc.mLineSpacing,pi.mHotkey,pi.mTexture,c,p);
|
||||
mDesc.mItems[i] = rep;
|
||||
pi.Destroy();
|
||||
}
|
||||
|
|
@ -442,7 +425,9 @@ Class SWWMBigMenuHack : SWWMCleanMenu
|
|||
longlist = true;
|
||||
ntext = 7;
|
||||
}
|
||||
double theight = ntext*BIGMENUSPACING+56;
|
||||
double theight = ntext*mDesc.mLineSpacing;
|
||||
if ( mDesc.mItems[0] is 'ListMenuItemSWWMStaticTextM' )
|
||||
theight += 56; // we take into account the static text as well for centering
|
||||
int h = mDesc.DisplayHeight();
|
||||
if ( h == -1 ) h = 200;
|
||||
double oy = int((h-theight)/2);
|
||||
|
|
@ -450,19 +435,10 @@ Class SWWMBigMenuHack : SWWMCleanMenu
|
|||
int j = 0;
|
||||
foreach ( itm:mDesc.mItems )
|
||||
{
|
||||
if ( (itm.GetClass() == 'ListMenuItemSWWMTextItemM') || (itm.GetClass() == 'ListMenuItemSWWMPatchItemM') )
|
||||
{
|
||||
itm.OffsetPositionY(oy+56); // offset from static text header
|
||||
itm.OffsetPositionY(BIGMENUSPACING*(j++)); // offset from other entries
|
||||
ListMenuItemSelectable(itm).mHeight = BIGMENUSPACING; // also need to set the height so mouse selection works
|
||||
}
|
||||
else
|
||||
{
|
||||
// GROSS HACK statictext will for whatever reason INCREASE in offset every time Init is called
|
||||
if ( itm.GetClass() == 'ListMenuItemSWWMStaticTextM' )
|
||||
itm.OffsetPositionY(-itm.GetY());
|
||||
itm.OffsetPositionY(oy);
|
||||
}
|
||||
// GROSS HACK statictext will for whatever reason INCREASE in offset every time Init is called
|
||||
if ( itm.GetClass() == 'ListMenuItemSWWMStaticTextM' )
|
||||
itm.OffsetPositionY(-itm.GetY());
|
||||
itm.OffsetPositionY(oy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -515,10 +491,10 @@ Class SWWMBigMenuHack : SWWMCleanMenu
|
|||
continue;
|
||||
offsetme = true;
|
||||
}
|
||||
if ( offsetme ) mDesc.mItems[i].OffsetPositionY(-ofs*BIGMENUSPACING);
|
||||
if ( offsetme ) mDesc.mItems[i].OffsetPositionY(-ofs*mDesc.mLineSpacing);
|
||||
mDesc.mItems[i].Draw((mDesc.mSelectedItem==i),mDesc);
|
||||
if ( mDesc.mSelectedItem == i ) mDesc.mItems[i].DrawSelector(mDesc.mSelectOfsX,mDesc.mSelectOfsY,mDesc.mSelector,mDesc);
|
||||
if ( offsetme ) mDesc.mItems[i].OffsetPositionY(ofs*BIGMENUSPACING);
|
||||
if ( offsetme ) mDesc.mItems[i].OffsetPositionY(ofs*mDesc.mLineSpacing);
|
||||
}
|
||||
Menu.Drawer();
|
||||
}
|
||||
|
|
@ -537,7 +513,7 @@ Class SWWMBigMenuHack : SWWMCleanMenu
|
|||
continue;
|
||||
offsetme = true;
|
||||
}
|
||||
if ( offsetme ) mDesc.mItems[i].OffsetPositionY(-ofs*BIGMENUSPACING);
|
||||
if ( offsetme ) mDesc.mItems[i].OffsetPositionY(-ofs*mDesc.mLineSpacing);
|
||||
else mDesc.mItems[i].OffsetPositionY(-65536);
|
||||
}
|
||||
bool res = Super.MouseEvent(type,x,y);
|
||||
|
|
@ -552,7 +528,7 @@ Class SWWMBigMenuHack : SWWMCleanMenu
|
|||
continue;
|
||||
offsetme = true;
|
||||
}
|
||||
if ( offsetme ) mDesc.mItems[i].OffsetPositionY(ofs*BIGMENUSPACING);
|
||||
if ( offsetme ) mDesc.mItems[i].OffsetPositionY(ofs*mDesc.mLineSpacing);
|
||||
else mDesc.mItems[i].OffsetPositionY(65536);
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue