Some stuff for custom map support (store/revive toggling, documentation for various functions, etc.).

A couple tiny fixes here and there for issues I didn't notice until I loaded the mod into UDB.
This commit is contained in:
Mari the Deer 2022-09-11 12:00:20 +02:00
commit 5243d533b1
13 changed files with 215 additions and 18 deletions

View file

@ -3,6 +3,7 @@
Class DemolitionistStoreTab : DemolitionistMenuTab
{
DemolitionistMenuList invlist[2];
bool bDisabled;
bool bSell;
int ofs, maxofs, maxw;
double smofs;
@ -70,7 +71,7 @@ Class DemolitionistStoreTab : DemolitionistMenuTab
override DemolitionistMenuTab Init( DemolitionistMenu master )
{
title = StringTable.Localize("$SWWM_STORETAB");
bHidden = (deathmatch||(G_SkillPropertyInt(SKILLP_ACSReturn)>=4));
bDisabled = (deathmatch||(G_SkillPropertyInt(SKILLP_ACSReturn)>=4)||players[consoleplayer].mo.FindInventory("SWWMStoreDisabler"));
return Super.Init(master);
}
override void OnDestroy()
@ -148,6 +149,7 @@ Class DemolitionistStoreTab : DemolitionistMenuTab
override void Ticker()
{
if ( bDisabled ) return; // do nothing
bool mustsort = false;
bool skipsel = false;
// only update active list to reduce perf hit
@ -278,6 +280,7 @@ Class DemolitionistStoreTab : DemolitionistMenuTab
override void MenuInput( int key )
{
if ( bDisabled ) return; // do nothing
if ( key == MK_BACK )
{
bSell = !bSell;
@ -330,6 +333,7 @@ Class DemolitionistStoreTab : DemolitionistMenuTab
}
override void MouseInput( Vector2 pos, int btn )
{
if ( bDisabled ) return; // do nothing
if ( btn == MB_RIGHT )
{
// just toggle buy/sell
@ -377,9 +381,17 @@ Class DemolitionistStoreTab : DemolitionistMenuTab
override void Drawer( double fractic )
{
if ( bDisabled )
{
String str = StringTable.Localize("$SWWM_NOSTORE");
double xx = int(master.ws.x-master.mSmallFont.StringWidth(str))/2;
double yy = int(master.ws.y-master.mSmallFont.GetHeight())/2;
Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
return;
}
if ( !invlist[bSell] || (invlist[bSell].items.Size() <= 0) )
{
String str = StringTable.Localize(bSell?"$SWWM_NOSTORESELL":"$SWWM_NOSTORE");
String str = StringTable.Localize(bSell?"$SWWM_NOSTORESELL":"$SWWM_NOSTOREBUY");
double xx = int(master.ws.x-master.mSmallFont.StringWidth(str))/2;
double yy = int(master.ws.y-master.mSmallFont.GetHeight())/2;
Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);