Pull in more changes from master.

This commit is contained in:
Mari the Deer 2021-10-03 23:49:20 +02:00
commit 8be723477f
15 changed files with 147 additions and 24 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\chSWWM \czGZ\c- \cw1.2pre r7 \cu(Sun 3 Oct 14:36:51 CEST 2021)\c-";
SWWM_SHORTVER="\cw1.2pre r7 \cu(2021-10-03 14:36:51)\c-";
SWWM_MODVER="\chSWWM \czGZ\c- \cw1.2pre r7 \cu(Sun 3 Oct 23:49:20 CEST 2021)\c-";
SWWM_SHORTVER="\cw1.2pre r7 \cu(2021-10-03 23:49:20)\c-";

View file

@ -18,6 +18,7 @@ extend Class SWWMHandler
String lastmus;
int lastorder;
bool lastloop;
transient ThinkerIterator cti;
private void LangRefresh()
{
@ -94,9 +95,10 @@ extend Class SWWMHandler
}
bool enteredcombat = false;
// add new entries
let ti = ThinkerIterator.Create("Actor");
if ( !cti ) cti = ThinkerIterator.Create("Actor");
else cti.Reinit();
Actor a;
while ( a = Actor(ti.Next()) )
while ( a = Actor(cti.Next()) )
{
if ( !a.player && !a.bISMONSTER ) continue;
// ignore the dead
@ -221,7 +223,7 @@ extend Class SWWMHandler
// "simple" tracking (used by the minimap)
private void SimpleTracking()
{
if ( !swwm_mm_enable )
if ( (gamestate != GS_LEVEL) || !swwm_mm_enable )
{
while ( strackers )
{
@ -283,6 +285,7 @@ extend Class SWWMHandler
continue;
SWWMSimpleTracker.Track(a);
}
bt.Destroy();
if ( swwm_mm_portaloverlay && (psectors.Size() > 1) )
{
// oh boy here we go
@ -291,6 +294,7 @@ extend Class SWWMHandler
{
if ( i == thisgroup ) continue;
Vector2 relpos = players[consoleplayer].Camera.pos.xy+SWWMUtility.PortalDisplacement(level.Sectors[psectors[thisgroup]],level.Sectors[psectors[i]]);
if ( bt ) bt.Destroy();
bt = BlockThingsIterator.CreateFromPos(relpos.x,relpos.y,players[consoleplayer].Camera.pos.z,players[consoleplayer].Camera.pos.z+players[consoleplayer].Camera.height,viewdist,false);
while ( bt.Next() )
{

View file

@ -2490,6 +2490,7 @@ Class SWWMStatusBar : BaseStatusBar
Screen.DrawText(fnt,msg0color,xx,yy+2,l.StringAt(j),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
yy -= h;
}
l.Destroy();
yy -= 6;
}
}
@ -2520,6 +2521,7 @@ Class SWWMStatusBar : BaseStatusBar
Screen.DrawText(fnt,col,int(xx),yy+2,l.StringAt(i),DTA_VirtualWidthF,ss.x*ssp,DTA_VirtualHeightF,ss.y*ssp,DTA_KeepRatio,true,DTA_Alpha,alph);
yy += h;
}
l.Destroy();
}
if ( MainQueue.Size() <= 0 ) return;
int mstart = max(0,MainQueue.Size()-((chatopen>=gametic)?swwm_maxshownbig:swwm_maxshown));
@ -2547,6 +2549,7 @@ Class SWWMStatusBar : BaseStatusBar
Screen.DrawText(fnt,col,xx+4,yy,l.StringAt(j),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
yy += 13;
}
l.Destroy();
}
Screen.DrawTexture(ChatTex[smol?5:2],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,boxalph);
}

View file

@ -111,6 +111,7 @@ Class SWWMOneLiner : HUDMessageBase
Screen.DrawText(fnt,Font.CR_FIRE,int((ss.x-len)/2.),(bottom/hs.y)-yy,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
yy -= h;
}
l.Destroy();
}
}
@ -214,6 +215,7 @@ Class SWWMAchievementNotification : HUDMessageBase
Screen.DrawText(fnt2,Font.CR_WHITE,pos.x+44,pos.y+yy,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha);
yy += 9;
}
l.Destroy();
}
}
@ -379,6 +381,7 @@ Class SWWMDirectMessage : HUDMessageBase
txt = String.Format(StringTable.Localize("$SWWM_"..seqname..seqnum),nyears);
}
else txt = StringTable.Localize("$SWWM_"..seqname..seqnum);
if ( l ) l.Destroy();
l = fnt.BreakLines(txt,220);
// append to the player's chat log (if it's valid)
if ( (seqnum < 1) || (seqnum > seqcnt) ) return;

View file

@ -516,12 +516,17 @@ Class DemolitionistMenu : GenericMenu
else kstr = self.mkey[0];
String str = String.Format(StringTable.Localize("$SWWM_HELPTXT"),kstr);
BrokenLines l = fnt.BreakLines(str,629);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,620);
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,620);
}
if ( (l.Count() > 28) && (sel0 < l.Count()-28) )
{
MenuSound("menu/demoscroll");
sel0++;
}
l.Destroy();
}
else if ( tabs[curtab] == TAB_MISSION )
{
@ -529,12 +534,17 @@ Class DemolitionistMenu : GenericMenu
if ( sel1 == 0 ) str = StringTable.Localize(missionstr);
else str = StringTable.Localize(missionbacklog[sel1-1]);
BrokenLines l = fnt.BreakLines(str,629);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,620);
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,620);
}
if ( (l.Count() > 28) && (sel0 < l.Count()-28) )
{
MenuSound("menu/demoscroll");
ofs0 = ++sel0;
}
l.Destroy();
}
else if ( (tabs[curtab] == TAB_CHAT) && (StatusBar is 'SWWMStatusBar') && (sel0 > 0) )
{
@ -549,12 +559,17 @@ Class DemolitionistMenu : GenericMenu
int ofs = (language~=="jp")?212:132;
if ( lorelist.Size() > 26 ) ofs += 8;
BrokenLines l = fnt.BreakLines(str,635-ofs);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,626-ofs);
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,626-ofs);
}
if ( (l.Count() > 28) && (sel2 < l.Count()-28) )
{
MenuSound("menu/demoscroll");
ofs2 = ++sel2;
}
l.Destroy();
}
else
{
@ -1069,10 +1084,19 @@ Class DemolitionistMenu : GenericMenu
if ( sel1 == 0 ) str = StringTable.Localize(missionstr);
else str = StringTable.Localize(missionbacklog[sel1-1]);
BrokenLines l = fnt.BreakLines(str,629);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,620);
else return res; // no scrollbar
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,620);
}
else
{
l.Destroy();
return res; // no scrollbar
}
// calculate offset
int szr = l.Count()-28;
l.Destroy();
int step = clamp(rnd((mpos.y-24.)/(353./szr)),0,szr);
if ( step != sel0 ) MenuSound("menu/demoscroll");
ofs0 = sel0 = step;
@ -1451,10 +1475,19 @@ Class DemolitionistMenu : GenericMenu
int ofs = (language~=="jp")?212:132;
if ( lorelist.Size() > 26 ) ofs += 8;
BrokenLines l = fnt.BreakLines(str,635-ofs);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,626-ofs);
else return res; // no scrollbar
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,626-ofs);
}
else
{
l.Destroy();
return res; // no scrollbar
}
// calculate offset
int szr = l.Count()-28;
l.Destroy();
int step = clamp(rnd((mpos.y-24.)/(353./szr)),0,szr);
if ( step != sel2 ) MenuSound("menu/demoscroll");
ofs2 = sel2 = step;
@ -1566,10 +1599,19 @@ Class DemolitionistMenu : GenericMenu
else kstr = mkey[0];
str = String.Format(StringTable.Localize("$SWWM_HELPTXT"),kstr);
BrokenLines l = fnt.BreakLines(str,629);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,620);
else return res; // no scrollbar
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,620);
}
else
{
l.Destroy();
return res; // no scrollbar
}
// calculate offset
int szr = l.Count()-28;
l.Destroy();
int step = clamp(rnd((mpos.y-24.)/(353./szr)),0,szr);
if ( step != sel0 ) MenuSound("menu/demoscroll");
ofs0 = sel0 = step;
@ -1629,10 +1671,19 @@ Class DemolitionistMenu : GenericMenu
if ( sel1 == 0 ) str = StringTable.Localize(missionstr);
else str = StringTable.Localize(missionbacklog[sel1-1]);
BrokenLines l = fnt.BreakLines(str,629);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,620);
else return res; // no scrollbar
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,620);
}
else
{
l.Destroy();
return res; // no scrollbar
}
// calculate offset
int szr = l.Count()-28;
l.Destroy();
int step = clamp(rnd((mpos.y-24.)/(353./szr)),0,szr);
if ( step != sel0 ) MenuSound("menu/demoscroll");
ofs0 = sel0 = step;
@ -1740,10 +1791,19 @@ Class DemolitionistMenu : GenericMenu
int ofs = (language~=="jp")?212:132;
if ( lorelist.Size() > 26 ) ofs += 8;
BrokenLines l = fnt.BreakLines(str,635-ofs);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,626-ofs);
else return res; // no scrollbar
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,626-ofs);
}
else
{
l.Destroy();
return res; // no scrollbar
}
// calculate offset
int szr = l.Count()-28;
l.Destroy();
int step = clamp(rnd((mpos.y-24.)/(353./szr)),0,szr);
if ( step != sel2 ) MenuSound("menu/demoscroll");
ofs2 = sel2 = step;
@ -1800,10 +1860,19 @@ Class DemolitionistMenu : GenericMenu
String kstr = bindings.NameKeys(k1,k2);
str = String.Format(StringTable.Localize("$SWWM_HELPTXT"),kstr);
BrokenLines l = fnt.BreakLines(str,629);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,620);
else return res; // no scrollbar
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,620);
}
else
{
l.Destroy();
return res; // no scrollbar
}
// calculate offset
int szr = l.Count()-28;
l.Destroy();
int step = clamp(rnd((mpos.y-24.)/(353./szr)),0,szr);
if ( step != sel0 ) MenuSound("menu/demoscroll");
ofs0 = sel0 = step;
@ -2942,7 +3011,11 @@ Class DemolitionistMenu : GenericMenu
if ( sel1 == 0 ) str = StringTable.Localize(missionstr);
else str = StringTable.Localize(missionbacklog[sel1-1]);
BrokenLines l = fnt.BreakLines(str,629);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,620);
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,620);
}
xx = 6;
yy = 17;
int ofs = clamp(sel0,0,max(0,l.Count()-28));
@ -2973,6 +3046,7 @@ Class DemolitionistMenu : GenericMenu
str = String.Format("%d \cf/\c- %d",sel1+1,csiz+1);
Screen.DrawText(MiniwiFont,Font.CR_FIRE,(origin.x+637)-MiniwiFont.StringWidth(str),origin.y+375,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
l.Destroy();
}
else if ( tabs[curtab] == TAB_STATS )
{
@ -3172,6 +3246,7 @@ Class DemolitionistMenu : GenericMenu
Screen.DrawText(fnt,completed?Font.CR_GREEN:Font.CR_DARKGRAY,origin.x+xx+36,origin.y+yy+oy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int j=0; j<l.Count(); j++ )
Screen.DrawText(fnt2,completed?Font.CR_WHITE:Font.CR_BLACK,origin.x+xx+40,origin.y+yy+oy+14+j*9,l.StringAt(j),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
l.Destroy();
yy += 50;
}
// scrollbar
@ -3420,7 +3495,11 @@ Class DemolitionistMenu : GenericMenu
}
str = StringTable.Localize(lorelist[sel0].text);
BrokenLines l = fnt.BreakLines(str,int(635-xx));
if ( l.Count() > 28 ) l = fnt.BreakLines(str,int(626-xx));
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,int(626-xx));
}
yy = 17;
ofs = clamp(sel2,0,max(0,l.Count()-28));
for ( int i=ofs; i<l.Count(); i++ )
@ -3438,6 +3517,7 @@ Class DemolitionistMenu : GenericMenu
yy = floor(ofs*(353./szr))+17;
Screen.DrawText(TewiFont,Font.CR_FIRE,origin.x+xx,origin.y+yy,"▮",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
l.Destroy();
}
else if ( tabs[curtab] == TAB_STORE )
{
@ -3650,10 +3730,15 @@ Class DemolitionistMenu : GenericMenu
str = String.Format("\cu[\c-%02d\cu:\c-%02d\cu:\c-%02d\cu]\c- ",thour,tmin,tsec);
BrokenLines l = fnt.BreakLines(bar.FullHistory[i].str,626-margin);
double by = yy-13*l.Count();
if ( by < 17 ) break;
if ( by < 17 )
{
l.Destroy();
break;
}
Screen.DrawText(TewiFont,Font.CR_WHITE,origin.x+xx,origin.y+by,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int j=0; j<l.Count(); j++ )
Screen.DrawText(fnt,col,origin.x+xx+margin,origin.y+by+j*13,l.StringAt(j),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
l.Destroy();
yy = by;
}
// scrollbar
@ -3680,6 +3765,7 @@ Class DemolitionistMenu : GenericMenu
xx = (i<l.Count()-1)?350:(350+mxlen-l.StringWidth(i));
Screen.DrawText(fnt,Font.CR_GOLD,origin.x+xx,origin.y+43+i*14,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
l.Destroy();
str = StringTable.Localize("$SWWM_FROMKIRIN");
Screen.DrawText(fnt,Font.CR_WHITE,origin.x+(640-fnt.StringWidth(str))/2,origin.y+350,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
@ -3704,7 +3790,11 @@ Class DemolitionistMenu : GenericMenu
else kstr = mkey[0];
str = String.Format(StringTable.Localize("$SWWM_HELPTXT"),kstr);
BrokenLines l = fnt.BreakLines(str,629);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,620);
if ( l.Count() > 28 )
{
l.Destroy();
l = fnt.BreakLines(str,620);
}
xx = 6;
yy = 17;
int ofs = clamp(sel0,0,max(0,l.Count()-28));
@ -3723,6 +3813,7 @@ Class DemolitionistMenu : GenericMenu
yy = floor(ofs*(353./szr))+17;
Screen.DrawText(TewiFont,Font.CR_FIRE,origin.x+xx,origin.y+yy,"▮",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
l.Destroy();
}
}
}

View file

@ -37,6 +37,12 @@ Class SWWMCreditsEntry ui
return self;
}
override void OnDestroy()
{
Super.OnDestroy();
if ( btext ) btext.Destroy();
}
private int CalcWidth()
{
int len = fnt.StringWidth(title);

View file

@ -187,6 +187,7 @@ Class SWWMHelpMenu : GenericMenu
Screen.DrawText(fnt,Font.CR_WHITE,origin.x+320-maxlen/2,origin.y+133-lh/2+y,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha);
y += h;
}
l.Destroy();
return;
}
txt = String.Format("(Unknown help page #%d)",page);

View file

@ -161,6 +161,7 @@ Class SWWMStatScreen : StatusScreen abstract
yy += fnt.GetHeight();
xx = 12;
}
l.Destroy();
}
override int DrawLF()
{

View file

@ -180,6 +180,7 @@ Class SWWMHandler : EventHandler
Screen.DrawText(newsmallfont,Font.CR_UNTRANSLATED,xx,yy,l.StringAt(i),DTA_Clean,true,DTA_Alpha,alph);
yy += newsmallfont.GetHeight();
}
l.Destroy();
}
// weapon underlays
if ( players[consoleplayer].ReadyWeapon is 'SWWMWeapon' )

View file

@ -949,6 +949,7 @@ Class Demolitionist : PlayerPawn
PoisonPeriodReceived = 0;
PoisonDamageReceived = 0;
Super.Tick();
if ( gamestate != GS_LEVEL ) return;
if ( hasteleported )
{
// we just got teleported, don't count the travel distance

View file

@ -364,5 +364,6 @@ Class WallbusterReloadMenu : GenericMenu
Screen.DrawText(fnt,Font.CR_WHITE,x,y,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
y += 9;
}
l.Destroy();
}
}

View file

@ -722,6 +722,7 @@ Class YnykronBeam : Actor
{
// goodbye
nospread = true;
speed = t.Results.Distance; // shortens in minimap
return;
}
if ( t.Results.HitType != TRACE_HitNone )
@ -819,6 +820,7 @@ Class YnykronBeam : Actor
YnykronShot(master).blastcount++;
}
nospread = true;
speed = t.Results.Distance; // shortens in minimap
return;
}
if ( ((special1%256) < speed) && !Random[Ynykron](0,20) )
@ -1646,6 +1648,7 @@ Class YnykronLightningArc : Actor
}
invoker.nextpos = t.Results.HitPos;
bAMBUSH = true;
speed = t.Results.Distance; // shortens in minimap
return;
}
invoker.nextpos = level.Vec3Offset(pos,x*speed);
@ -2729,6 +2732,7 @@ Class YnykronAltBeam : Actor
{
// goodbye
nospread = true;
speed = t.Results.Distance; // shortens in minimap
return;
}
if ( t.Results.HitType != TRACE_HitNone )
@ -2756,6 +2760,7 @@ Class YnykronAltBeam : Actor
b.angle = atan2(norm.y,norm.x);
b.pitch = asin(-norm.z);
nospread = true;
speed = t.Results.Distance; // shortens in minimap
return;
}
if ( special1 >= 25600 )

View file

@ -535,6 +535,7 @@ Class SaltBeam : Actor
i.special2 = Accuracy;
i.args[0] = args[1];
}
speed = t.Results.Distance; // shortens in minimap
return;
}
else if ( (args[0] > 20) && !Random[Spreadgun](0,800/args[0]) )

View file

@ -1165,6 +1165,7 @@ Class BiosparkBeam : Actor
if ( t.Results.HitType == TRACE_HasHitSky )
{
bAMBUSH = true;
speed = t.Results.Distance; // shortens in minimap
return;
}
if ( t.Results.HitType != TRACE_HitNone )
@ -1175,6 +1176,7 @@ Class BiosparkBeam : Actor
s.pitch = asin(-normal.z);
bAMBUSH = true;
if ( swwm_omnibust ) BusterWall.Bust(t.Results,GetMissileDamage(0,0),target,t.Results.HitVector,t.Results.HitPos.z);
speed = t.Results.Distance; // shortens in minimap
return;
}
double closest = double.infinity;
@ -1506,9 +1508,11 @@ Class BiosparkArc : Actor
normal *= 0;
}
invoker.nextpos = level.Vec3Offset(t.Results.HitPos,normal);
if ( t.Results.HitType != TRACE_HitNone ) speed = t.Results.Distance; // shortens in minimap
if ( t.Results.HitType == TRACE_HasHitSky )
{
bAMBUSH = true;
speed = t.Results.Distance; // shortens in minimap
return;
}
double a = FRandom[Sparkster](0,360), s = FRandom[Sparkster](0.,.8);

View file

@ -136,6 +136,7 @@ Class CandyBeam : Actor
t.Results.HitPos = level.Vec3Offset(pos,x*speed);
normal *= 0;
}
if ( t.Results.HitType != TRACE_HitNone ) speed = t.Results.Distance; // shortens in minimap
double a = FRandom[Candy](0,360), s = FRandom[Candy](0.,.8);
invoker.nextpos = level.Vec3Offset(t.Results.HitPos,normal);
invoker.nextdir = (dir+cos(a)*y*s+sin(a)*z*s).unit();