Beginnings of F1 menu replacement.

This commit is contained in:
Mari the Deer 2020-06-21 03:22:55 +02:00
commit 8b5ecd1954
10 changed files with 307 additions and 8 deletions

View file

@ -59,3 +59,4 @@ server bool swwm_crouchjump = false; // allows crouch-jumping (which looks weir
user noarchive int swwm_cbtlast = 0; // last selected ammo for the wallbuster
server bool swwm_cbtall = true; // wallbuster breaks any wall, not just movable ones
server bool swwm_doomfall = false; // monsters take fall damage outside of hexen
user noarchive int swwm_lasthelp = 0; // last selected page in the help menu

View file

@ -656,6 +656,8 @@ D_FROGGY1 = "\cjA small price to pay...\c-";
D_FROGGY2 = "\cj... for \cdFroggy Chair\cj.\c-";
D_BARRIER = "The Elemental Coating wore off.";
SWWM_YNYKRONREADY = "Ynykron Artifact ready for firing.";
SWWM_TITLEPRESENTS = "presents";
SWWM_TITLEMODBY = "a mod by \cxMarisa Kirisame";
// boss tags
BT_BRUISERS = "Super Bruiser Bros";
BT_CYBIE = "Shoot It Until It Dies";

View file

@ -331,3 +331,48 @@ SWWM_BUSTERKEYS =
"\cfEnter:\c- Initiate Reload\n"
"\cfEnter (if empty):\c- Full Reload\n"
"\cfEsc:\c- Cancel Reload\n";
// Help menu
SWWM_HELP_STORY = "The Story So Far";
SWWM_HELP_STORYDOOM =
"It is the year 2148. Shortly after the incident on the \cfUAC\c- bases of \cfPhobos\c- and \cfDeimos\c-, a full-scale demonic invasion of \cfEarth\c- began. The situation is grim, and many believe this to be the end, but there is still hope. Hope that the \cfDoom Marine\c-, lone survivor of the attacks on the moon bases, will defeat the invaders.\n"
"\n"
"In response to this, \cfSaya Miyamoto\c-, head of \cfAkari Labs\c- stated: \cf\"That's totally not going to happen. I mean, he's just one guy, and they're hundreds, thousands, maybe more. Is ONE guy seriously going to fix everything? Ha! As if.\"\c-\n"
"\n"
"That's where you come in, \cfDemolitionist\c-. You are the crowning achievement of \cfAkari Labs\c-, the culmination of weeks of hasty planning and thorough training, but you're still good. You can do this, you can kick demon ass like there's no tomorrow, and send those bastards back to \cfHell\c- where they belong.\n"
"\n"
"So go, \cfDemolitionist\c-, show them all what you're capable of.\n";
SWWM_HELP_STORYHERETIC =
"It is the year 2171. It's been decades since the \cfHell\c- invasion had happened, and things have calmed down. However, something's brewing at \cfAkari Labs\c-.\n"
"\n"
"\cfSaya Miyamoto\c-, not happy with only witnessing the fall of the \cfUAC\c-, wishes to kick them while they're down. The \cfAkari Project\c-, the greatest thing since sliced bread, is here, and you, the \cfDemolitionist\c-, will be the first to test this \cf\"demon-free\" interdimensional portal technology\c-.\n"
"\n"
"Of many worlds discovered during the initial stages, one stood out in particular. A certain medieval fantasy wonderland by the name of \cfParthoris\c-, which appears to have been ravaged by war.\n"
"\n"
"Once again, it is your duty to play the part of the hero. Go forth and kick ass!";
SWWM_HELP_STORYHEXEN =
"It is the year 2171. After the initial success of the \cfAkari Project\c-, and the first exploration of the world of \cfParthoris\c-, it is time once again for the \cfDemolitionist\c- to go on more interdimensional travel adventures.\n"
"\n"
"Welcome to \cfCronos\c-, a land of darkness and conflict, dominated by the vile \cfKorax\c-, another of the \cfSerpent Riders\c-, and a much more powerful sibling of \cfD'Sparil\c-.\n"
"\n"
"But that does not matter, you will definitely kick his ass no problem, provided you can get past the many obnoxious puzzles and contraptions that await along the way.\n"
"\n"
"These people sure do love their god damn puzzles, huh?";
SWWM_HELP_STORYSTRIFE =
"It is the year 2173. After a long period of rest from their last adventure, the \cfDemolitionist\c- is once again ready to go out there and save another world.\n"
"\n"
"This time, you find yourself in an oddly anachronistic setting, medieval architecture intermixed with modern technology. However, not all seems to be well in here, a powerful group, known as \cfThe Order\c-, dominates the land and controls all of this cool tech. They are very clearly evil, so you know what to do.\n"
"\n"
"Your mission is to contact the main resistance force, \cfThe Front\c-. Once you've done so, you must join them in defeating the enemy, and bring peace to this land.\n"
"\n"
"Now, the problem is, your arrival seems to draw a lot of attention, and you're quickly seized by a bunch of \cfOrder\c- acolytes, who take you to a shady corner out of view for some \"questioning\".\n"
"\n"
"Yeah, now you're stuck in this room with two guys who clearly want to kill you. Boy, that sure is a situation you totally can't solve with your eyes closed, huh?";
SWWM_HELP_DEMO = "Who Is The Demolitionist";
SWWM_HELP_DEMOTXT =
"The \cfAkari Labs First Generation Autonomous Combat Unit\c-, codenamed \cfDemolitionist\c-, is the latest and greatest in AI-driven combat robots. Designed to be swift on the field, being equipped with all sorts of mobility enhancements, and also trained extensively for the efficient usage of all sorts of weaponry.\n"
"\n"
"Each unit has more potential strength than an entire army, making them perfect for defending \cfEarth\c- from major threats. Such as, for example, a demonic invasion from the depths of \cfHell\c-.\n"
"\n"
"You are the first unit ever made, lovingly designated by your creator with the nickname of \cfDemo-chan\c-. Your sense of justice is quite notable, and you're quick to step up against any threat, no matter how strong the opponent may be.\n"
"\n"
"Go forth, \cfDemolitionist\c-, be the hero this world needs.";

View file

@ -645,6 +645,8 @@ D_FROGGY1 = "\cjUn pequeño precio a pagar...\c-";
D_FROGGY2 = "\cj... por una \cdSilla Rana\cj.\c-";
D_BARRIER = "El Revestimiento Elemental se ha desvanecido.";
SWWM_YNYKRONREADY = "Artefacto Ynykron listo para disparar.";
SWWM_TITLEPRESENTS = "presenta";
SWWM_TITLEMODBY = "un mod de \cxMarisa Kirisame";
// boss tags
BT_CYBIE = "Dispara Hasta Que Muera";
BT_SPIDER = "Cerebrito Idiota";

View file

@ -1,2 +1,2 @@
[default]
SWWM_MODVER="\chSWWM \cwGZ\c- r367 (Sat 20 Jun 22:20:44 CEST 2020)";
SWWM_MODVER="\chSWWM \cwGZ\c- r368 (Sun 21 Jun 03:22:55 CEST 2020)";

View file

@ -1,6 +1,6 @@
GameInfo
{
AddEventHandlers = "SWWMCrashHandler", "SWWMBrutalHandler", "SWWMHDoomHandler", "SWWMVanillaBossHandler", "SWWMHandler", "SWWMGoreHandler", "CBTHandler", "SWWMPreloader", "SWWMExcuseMeWhatTheFuckHandler"
AddEventHandlers = "SWWMCrashHandler", "SWWMBrutalHandler", "SWWMHDoomHandler", "SWWMVanillaBossHandler", "SWWMHandler", "SWWMGoreHandler", "CBTHandler", "SWWMPreloader", "SWWMExcuseMeWhatTheFuckHandler", "SWWMReadThisHijacker"
PlayerClasses = "Demolitionist"
StatusBarClass = "SWWMStatusBar"
BackpackType = "HammerspaceEmbiggener"

View file

@ -27,6 +27,7 @@ version "4.4"
#include "zscript/swwm_strife.zsc"
#include "zscript/swwm_vanillaboss.zsc"
#include "zscript/swwm_blod.zsc"
#include "zscript/swwm_help.zsc"
// items
#include "zscript/swwm_health.zsc"
#include "zscript/swwm_armor.zsc"

235
zscript/swwm_help.zsc Normal file
View file

@ -0,0 +1,235 @@
// Hey Graf how about you let us replace the class used for the "Read This!"
// menu in mapinfo/gameinfo or something so I don't have to do this hack here?
Class SWWMReadThisHijacker : StaticEventHandler
{
override void UiTick()
{
Menu cur = Menu.GetCurrentMenu();
if ( cur is 'ReadThisMenu' )
{
cur.Close();
Menu.SetMenu('SWWMHelpMenu');
}
}
}
Class SWWMHelpMenu : GenericMenu
{
int curpage, prevpage;
int fadetic;
TextureID bgtex;
transient Font TewiFont, MPlusFont;
transient CVar lang;
bool isrclick;
int pagedir;
enum EHelpPage
{
PAGE_STORY,
PAGE_DEMO,
PAGE_ARSENAL1,
PAGE_ARSENAL2,
PAGE_ARSENAL3,
PAGE_KBASE,
PAGE_TECH,
PAGE_CREDITS,
NUM_HELP_PAGES
};
// returns MPlus if we're playing in Japanese, otherwise returns the requested font
Font LangFont( Font req )
{
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( lang.GetString() ~== "jp" ) return MPlusFont;
return req;
}
override void Init( Menu parent )
{
curpage = CVar.GetCVar('swwm_lasthelp',players[consoleplayer]).GetInt();
prevpage = -1;
fadetic = gametic;
pagedir = 0;
bgtex = TexMan.CheckForTexture("graphics/tempbg.png",TexMan.Type_Any);
}
override bool MenuEvent( int mkey, bool fromcontroller )
{
double alph = clamp((gametic-fadetic)*(5./Thinker.TICRATE),0.,1.);
switch ( mkey )
{
case MKEY_Enter:
case MKEY_Right:
case MKEY_Down:
case MKEY_PageDown:
if ( (curpage < NUM_HELP_PAGES-1) && ((prevpage == -1) || (alph >= 1.)) )
{
MenuSound("menu/choose");
prevpage = curpage;
curpage++;
CVar.GetCVar('swwm_lasthelp',players[consoleplayer]).SetInt(curpage);
pagedir = 1;
fadetic = gametic;
}
return true;
break;
case MKEY_Clear:
case MKEY_Left:
case MKEY_Up:
case MKEY_PageUp:
if ( (curpage > 0) && ((prevpage == -1) || (alph >= 1.)) )
{
MenuSound("menu/choose");
prevpage = curpage;
curpage--;
CVar.GetCVar('swwm_lasthelp',players[consoleplayer]).SetInt(curpage);
pagedir = -1;
fadetic = gametic;
}
return true;
break;
}
return Super.MenuEvent(mkey,fromcontroller);
}
override bool MouseEvent( int type, int x, int y )
{
if ( (type == MOUSE_Click) && (y != -1) )
return MenuEvent(isrclick?MKEY_Clear:MKEY_Enter,true);
return false;
}
override bool OnUiEvent( UIEvent ev )
{
int y;
bool res;
switch ( ev.type )
{
case UIEvent.Type_WheelDown:
return MenuEvent(MKEY_Enter,true);
break;
case UIEvent.Type_WheelUp:
return MenuEvent(MKEY_Clear,true);
break;
case UIEvent.Type_LButtonDown:
isrclick = false;
return Super.OnUIEvent(ev);
break;
case UIEvent.Type_RButtonDown:
isrclick = true;
// copy over what base menus do for L click
y = ev.MouseY;
res = MouseEventBack(MOUSE_Click,ev.MouseX,y);
if ( res ) y = -1;
res |= MouseEvent(MOUSE_Click,ev.MouseX,y);
if ( res ) SetCapture(true);
return false;
break;
case UIEvent.Type_RButtonUp:
// copy over what base menus do for L release
if ( mMouseCapture )
{
SetCapture(false);
y = ev.MouseY;
res = MouseEventBack(MOUSE_Release,ev.MouseX,y);
if ( res ) y = -1;
res |= MouseEvent(MOUSE_Release,ev.MouseX,y);
}
return false;
break;
}
return Super.OnUIEvent(ev);
}
// big bulk of code
private void DrawPage( int page, Vector2 ss, Vector2 origin, double alpha = 1. )
{
Font fnt = LangFont(TewiFont);
int h = fnt.GetHeight();
String str;
BrokenLines l;
int maxlen = 0, lh;
double y = 0;
switch ( page )
{
case PAGE_STORY:
if ( gameinfo.gametype&GAME_Heretic ) str = StringTable.Localize("$SWWM_HELP_STORYHERETIC");
else if ( gameinfo.gametype&GAME_Hexen ) str = StringTable.Localize("$SWWM_HELP_STORYHEXEN");
else if ( gameinfo.gametype&GAME_Strife ) str = StringTable.Localize("$SWWM_HELP_STORYSTRIFE");
else str = StringTable.Localize("$SWWM_HELP_STORYDOOM");
l = fnt.BreakLines(str,600);
lh = l.Count()*h;
for ( int i=0; i<l.Count(); i++ )
{
int len = l.StringWidth(i);
if ( len > maxlen ) maxlen = len;
}
for ( int i=0; i<l.Count(); i++ )
{
Screen.DrawText(fnt,Font.CR_WHITE,origin.x+320-maxlen/2,origin.y+200-lh/2+y,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha);
y += h;
}
str = StringTable.Localize("$SWWM_HELP_STORY");
Screen.DrawText(fnt,Font.CR_FIRE,origin.x+320-fnt.StringWidth(str)/2,origin.y+200-(h*4+lh)/2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha);
break;
case PAGE_DEMO:
str = StringTable.Localize("$SWWM_HELP_DEMOTXT");
l = fnt.BreakLines(str,600);
lh = l.Count()*h;
for ( int i=0; i<l.Count(); i++ )
{
int len = l.StringWidth(i);
if ( len > maxlen ) maxlen = len;
}
for ( int i=0; i<l.Count(); i++ )
{
Screen.DrawText(fnt,Font.CR_WHITE,origin.x+320-maxlen/2,origin.y+200-lh/2+y,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha);
y += h;
}
str = StringTable.Localize("$SWWM_HELP_DEMO");
Screen.DrawText(fnt,Font.CR_FIRE,origin.x+320-fnt.StringWidth(str)/2,origin.y+200-(h*4+lh)/2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha);
break;
default:
str = String.Format("(Unimplemented help page #%d)",page);
Screen.DrawText(fnt,Font.CR_GOLD,origin.x+320-fnt.StringWidth(str)/2,origin.y+200-h/2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha);
break;
}
}
override void Drawer()
{
if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded');
if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShaded');
double ar = Screen.GetAspectRatio();
Vector2 tsize = TexMan.GetScaledSize(bgtex);
double sar = tsize.x/tsize.y;
Vector2 vsize;
if ( sar < ar ) vsize = (tsize.x,tsize.x/ar);
else if ( sar > ar ) vsize = (tsize.y*ar,tsize.y);
else vsize = tsize;
Screen.DrawTexture(bgtex,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_ColorOverlay,Color(192,0,0,0),DTA_Alpha,.8);
double hs;
if ( (Screen.GetWidth() < 640) || (Screen.GetHeight() < 400) ) hs = max(min(floor(Screen.GetWidth()/320.),floor(Screen.GetHeight()/200.)),1.)/2.;
else hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/400.)),1.);
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs;
Vector2 origin = (ss.x-640,ss.y-400)/2.;
double alph = clamp((gametic-fadetic)*(5./Thinker.TICRATE),0.,1.);
if ( (prevpage == -1) || (alph >= 1.) ) DrawPage(curpage,ss,origin);
else
{
DrawPage(prevpage,ss,origin-(pagedir*alph*32,0),(1.-alph)**3);
DrawPage(curpage,ss,origin+(pagedir*(1.-alph)*32,0),alph**3);
}
int h = TewiFont.GetHeight();
double y = ss.y/2-(h*2);
for ( int i=0; i<4; i++ )
{
if ( curpage > 0 )
Screen.DrawText(TewiFont,Font.CR_GOLD,12,y,"<",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( curpage < NUM_HELP_PAGES-1 )
Screen.DrawText(TewiFont,Font.CR_GOLD,ss.x-18,y,">",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
y += h;
}
Super.Drawer();
}
}

View file

@ -1832,7 +1832,9 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
Super.Drawer();
Font fnt = LangFont(TewiFont);
String str;
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/400.)),1.);
double hs;
if ( (Screen.GetWidth() < 640) || (Screen.GetHeight() < 400) ) hs = max(min(floor(Screen.GetWidth()/320.),floor(Screen.GetHeight()/200.)),1.)/2.;
else hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/400.)),1.);
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs;
Vector2 origin = (ss.x-640,ss.y-400)/2.;
if ( !fuzz ) fuzz = CVar.GetCvar('swwm_fuzz',players[consoleplayer]);

View file

@ -3,7 +3,16 @@
Class SWWMTitleStuff : EventHandler
{
transient ui TextureID tex[3];
transient ui Font TewiFont;
transient ui Font TewiFont, MPlusFont;
transient ui CVar lang;
// returns MPlus if we're playing in Japanese, otherwise returns the requested font
private ui Font LangFont( Font req )
{
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( lang.GetString() ~== "jp" ) return MPlusFont;
return req;
}
override void WorldTick()
{
@ -17,6 +26,8 @@ Class SWWMTitleStuff : EventHandler
if ( !tex[1] ) tex[1] = TexMan.CheckForTexture("graphics/SWWMGZLogo.png",TexMan.Type_Any);
if ( !tex[2] ) tex[2] = TexMan.CheckForTexture("graphics/tempbg.png",TexMan.Type_Any);
if ( !TewiFont ) TewiFont = Font.GetFont('TewiShadedInverse');
if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShadedInverse');
Font fnt = LangFont(TewiFont);
double ar = Screen.GetAspectRatio();
Vector2 tsize = TexMan.GetScaledSize(tex[2]);
double sar = tsize.x/tsize.y;
@ -34,14 +45,14 @@ Class SWWMTitleStuff : EventHandler
double alf = clamp(((level.maptime+e.FracTic)/Thinker.TICRATE)-2,0.,1.);
alf *= 1.-clamp(((level.maptime+e.FracTic)/Thinker.TICRATE)-8,0.,1.);
Screen.DrawTexture(tex[0],false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,alf);
String str = "presents";
String str = StringTable.Localize("$SWWM_TITLEPRESENTS");
alf = clamp(((level.maptime+e.FracTic)/Thinker.TICRATE)-10,0.,1.);
alf *= 1.-clamp(((level.maptime+e.FracTic)/Thinker.TICRATE)-16,0.,1.);
Screen.DrawText(TewiFont,Font.CR_WHITE,(320-TewiFont.StringWidth(str))/2,(200-TewiFont.GetHeight())/2,str,DTA_VirtualWidth,320,DTA_VirtualHeight,200,DTA_KeepRatio,true,DTA_Alpha,alf);
str = "a mod by \cxMarisa Kirisame";
Screen.DrawText(fnt,Font.CR_WHITE,(320-fnt.StringWidth(str))/2,(200-fnt.GetHeight())/2,str,DTA_VirtualWidth,320,DTA_VirtualHeight,200,DTA_KeepRatio,true,DTA_Alpha,alf);
str = StringTable.Localize("$SWWM_TITLEMODBY");
alf = clamp(((level.maptime+e.FracTic)/Thinker.TICRATE)-18,0.,1.);
alf *= 1.-clamp(((level.maptime+e.FracTic)/Thinker.TICRATE)-24,0.,1.);
Screen.DrawText(TewiFont,Font.CR_WHITE,(320-TewiFont.StringWidth(str))/2,(200-TewiFont.GetHeight())/2,str,DTA_VirtualWidth,320,DTA_VirtualHeight,200,DTA_KeepRatio,true,DTA_Alpha,alf);
Screen.DrawText(fnt,Font.CR_WHITE,(320-fnt.StringWidth(str))/2,(200-fnt.GetHeight())/2,str,DTA_VirtualWidth,320,DTA_VirtualHeight,200,DTA_KeepRatio,true,DTA_Alpha,alf);
tsize = TexMan.GetScaledSize(tex[1]);
sar = tsize.x/tsize.y;
if ( sar > ar ) vsize = (tsize.x,tsize.x/ar);