0.9.9b release:

- Fix lore library being empty (oops! put '!=' where I should have put '==')
 - Lore library entries are now alphabetically sorted in post, to prevent weird nonsense with localization
 - Adjust various CheckSight() calls to prevent potential rare desyncs
 - Adjust how FlashPlayer() calls work to potentially prevent desyncs too
 - Fix player saying combat start lines when enemies aren't even visible
This commit is contained in:
Mari the Deer 2020-09-24 21:14:06 +02:00
commit 1daf12138f
13 changed files with 106 additions and 129 deletions

View file

@ -1,2 +1,2 @@
[default]
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.8b r557 \cu(Thu 24 Sep 14:05:04 CEST 2020)";
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.9b r558 \cu(Thu 24 Sep 21:14:06 CEST 2020)";

View file

@ -329,20 +329,12 @@ Class YnykronImpact : Actor
void FlashPlayer( int str, double rad )
{
double vfov = CVar.GetCVar('fov',players[consoleplayer]).GetFloat()*0.5;
double hfov = atan(Screen.GetAspectRatio()*tan(vfov));
let mo = players[consoleplayer].camera;
Vector3 pp;
if ( !CheckSight(mo) ) return;
if ( mo is 'PlayerPawn' ) pp = mo.Vec2OffsetZ(0,0,PlayerPawn(mo).player.viewz);
else pp = mo.Vec3Offset(0,0,mo.CameraHeight);
Vector3 sc = level.SphericalCoords(pp,pos,(mo.angle,mo.pitch));
if ( (abs(sc.x) < hfov) && (abs(sc.y) < vfov) && (sc.z < rad) )
{
str = int(str*(1.-(sc.z/rad)));
SWWMHandler.DoFlash(mo,Color(str,255,255,255),2);
SWWMHandler.DoFlash(mo,Color(str/2,255,255,255),10);
}
if ( !SWWMUtility.InPlayerFOV(players[consoleplayer],self,rad) ) return;
let mo = players[consoleplayer].Camera;
double dist = Distance3D(mo);
str = int(str*(1.-(dist/rad)));
SWWMHandler.DoFlash(mo,Color(str,255,255,255),2);
SWWMHandler.DoFlash(mo,Color(str/2,255,255,255),10);
}
override void PostBeginPlay()
{
@ -997,20 +989,12 @@ Class YnykronShot : Actor
}
void FlashPlayer( int str, double rad )
{
double vfov = CVar.GetCVar('fov',players[consoleplayer]).GetFloat()*0.5;
double hfov = atan(Screen.GetAspectRatio()*tan(vfov));
let mo = players[consoleplayer].camera;
Vector3 pp;
if ( !CheckSight(mo) ) return;
if ( mo is 'PlayerPawn' ) pp = mo.Vec2OffsetZ(0,0,PlayerPawn(mo).player.viewz);
else pp = mo.Vec3Offset(0,0,mo.CameraHeight);
Vector3 sc = level.SphericalCoords(pp,pos,(mo.angle,mo.pitch));
if ( (abs(sc.x) < hfov) && (abs(sc.y) < vfov) && (sc.z < rad) )
{
str = int(str*(1.-(sc.z/rad)));
SWWMHandler.DoFlash(mo,Color(str,255,255,255),3);
SWWMHandler.DoFlash(mo,Color(str/2,255,255,255),30);
}
if ( !SWWMUtility.InPlayerFOV(players[consoleplayer],self,rad) ) return;
let mo = players[consoleplayer].Camera;
double dist = Distance3D(mo);
str = int(str*(1.-(dist/rad)));
SWWMHandler.DoFlash(mo,Color(str,255,255,255),3);
SWWMHandler.DoFlash(mo,Color(str/2,255,255,255),30);
}
override void PostBeginPlay()
{
@ -1731,20 +1715,12 @@ Class YnykronCloud : Actor
void FlashPlayer( int str, double rad )
{
double vfov = CVar.GetCVar('fov',players[consoleplayer]).GetFloat()*0.5;
double hfov = atan(Screen.GetAspectRatio()*tan(vfov));
let mo = players[consoleplayer].camera;
Vector3 pp;
if ( !CheckSight(mo) ) return;
if ( mo is 'PlayerPawn' ) pp = mo.Vec2OffsetZ(0,0,PlayerPawn(mo).player.viewz);
else pp = mo.Vec3Offset(0,0,mo.CameraHeight);
Vector3 sc = level.SphericalCoords(pp,pos,(mo.angle,mo.pitch));
if ( (abs(sc.x) < hfov) && (abs(sc.y) < vfov) && (sc.z < rad) )
{
str = int(str*(1.-(sc.z/rad)));
SWWMHandler.DoFlash(mo,Color(str,255,255,255),1);
SWWMHandler.DoFlash(mo,Color(str/2,240,224,255),10);
}
if ( !SWWMUtility.InPlayerFOV(players[consoleplayer],self,rad) ) return;
let mo = players[consoleplayer].Camera;
double dist = Distance3D(mo);
str = int(str*(1.-(dist/rad)));
SWWMHandler.DoFlash(mo,Color(str,255,255,255),1);
SWWMHandler.DoFlash(mo,Color(str/2,240,224,255),10);
}
override void PostBeginPlay()
@ -2386,20 +2362,12 @@ Class YnykronSingularity : Actor
void FlashPlayer( int str, double rad )
{
double vfov = CVar.GetCVar('fov',players[consoleplayer]).GetFloat()*0.5;
double hfov = atan(Screen.GetAspectRatio()*tan(vfov));
let mo = players[consoleplayer].camera;
Vector3 pp;
if ( !CheckSight(mo) ) return;
if ( mo is 'PlayerPawn' ) pp = mo.Vec2OffsetZ(0,0,PlayerPawn(mo).player.viewz);
else pp = mo.Vec3Offset(0,0,mo.CameraHeight);
Vector3 sc = level.SphericalCoords(pp,pos,(mo.angle,mo.pitch));
if ( (abs(sc.x) < hfov) && (abs(sc.y) < vfov) && (sc.z < rad) )
{
str = int(str*(1.-(sc.z/rad)));
SWWMHandler.DoFlash(mo,Color(str,255,255,255),3);
SWWMHandler.DoFlash(mo,Color(str/2,240,224,255),30);
}
if ( !SWWMUtility.InPlayerFOV(players[consoleplayer],self,rad) ) return;
let mo = players[consoleplayer].Camera;
double dist = Distance3D(mo);
str = int(str*(1.-(dist/rad)));
SWWMHandler.DoFlash(mo,Color(str,255,255,255),3);
SWWMHandler.DoFlash(mo,Color(str/2,240,224,255),30);
}
void A_SingularityBlast()
{
@ -2441,7 +2409,7 @@ Class YnykronSingularity : Actor
double factor = (60-special1)/60.;
double invfct = 1.-factor;
SWWMUtility.DoExplosion(self,0,-50000*factor,4000*invfct);
FlashPlayer(int(100*factor),10000);
FlashPlayer(int(min(100*factor,250)),10000);
FLineTraceData d;
Vector3 HitNormal;
Vector3 origin;
@ -2706,20 +2674,12 @@ Class YnykronAltShot : Actor
}
void FlashPlayer( int str, double rad )
{
double vfov = CVar.GetCVar('fov',players[consoleplayer]).GetFloat()*0.5;
double hfov = atan(Screen.GetAspectRatio()*tan(vfov));
let mo = players[consoleplayer].camera;
Vector3 pp;
if ( !CheckSight(mo) ) return;
if ( mo is 'PlayerPawn' ) pp = mo.Vec2OffsetZ(0,0,PlayerPawn(mo).player.viewz);
else pp = mo.Vec3Offset(0,0,mo.CameraHeight);
Vector3 sc = level.SphericalCoords(pp,pos,(mo.angle,mo.pitch));
if ( (abs(sc.x) < hfov) && (abs(sc.y) < vfov) && (sc.z < rad) )
{
str = int(str*(1.-(sc.z/rad)));
SWWMHandler.DoFlash(mo,Color(str,255,255,255),5);
SWWMHandler.DoFlash(mo,Color(str/2,0,0,0),15);
}
if ( !SWWMUtility.InPlayerFOV(players[consoleplayer],self,rad) ) return;
let mo = players[consoleplayer].Camera;
double dist = Distance3D(mo);
str = int(str*(1.-(dist/rad)));
SWWMHandler.DoFlash(mo,Color(str,255,255,255),5);
SWWMHandler.DoFlash(mo,Color(str/2,0,0,0),15);
}
override void PostBeginPlay()
{

View file

@ -800,10 +800,9 @@ Class SWWMHandler : EventHandler
if ( (a is 'RatBuddy') || (a is 'Peasant') || (a is 'Beggar') ) continue;
// [Strife] ignore Oracle's spectre while it's inactive
if ( (a is 'AlienSpectre3') && a.InStateSequence(a.CurState,a.FindState("Spawn")) ) continue;
// ignore if not targetted or either actor can't see the other
// ignore if not targetted or player can't see it
if ( (a.target != players[consoleplayer].mo)
|| !a.CheckSight(players[consoleplayer].mo)
|| !players[consoleplayer].mo.CheckSight(a) ) continue;
|| !SWWMUtility.InPlayerFOV(players[consoleplayer],a) ) continue;
// is it already in?
bool addme = true;
for ( int i=0; i<combatactors.Size(); i++ )

View file

@ -466,8 +466,8 @@ Class SWWMStatusBar : BaseStatusBar
int i = 0;
for ( SWWMCombatTracker trk=hnd.trackers; trk; trk=trk.next )
{
// ignore dormant targets
if ( !trk.mytarget || trk.mytarget.bDORMANT ) continue;
// ignore dormant/invisible targets
if ( !trk.mytarget || trk.mytarget.bDORMANT || trk.mytarget.bINVISIBLE ) continue;
// ignore player unless chasecamming
if ( (trk.mytarget == players[consoleplayer].mo) && (players[consoleplayer].Camera == players[consoleplayer].mo) && !(players[consoleplayer].cheats&CF_CHASECAM) ) continue;
if ( trk.myplayer && deathmatch ) continue; // no players in dm

View file

@ -1636,6 +1636,33 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
qsort_mstats(a,p+1,h);
}
private int partition_lore( Array<SWWMLore> a, int l, int h )
{
SWWMLore pv = a[h];
int i = (l-1);
for ( int j=l; j<=(h-1); j++ )
{
if ( StringTable.Localize(pv.tag) > StringTable.Localize(a[j].tag) )
{
i++;
SWWMLore tmp = a[j];
a[j] = a[i];
a[i] = tmp;
}
}
SWWMLore tmp = a[h];
a[h] = a[i+1];
a[i+1] = tmp;
return i+1;
}
private void qsort_lore( Array<SWWMLore> a, int l, int h )
{
if ( l >= h ) return;
int p = partition_lore(a,l,h);
qsort_lore(a,l,p-1);
qsort_lore(a,p+1,h);
}
override void Ticker()
{
Super.Ticker();
@ -1808,6 +1835,8 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
if ( lorelib.ent[i].tab != sel1 ) continue;
lorelist.Push(lorelib.ent[i]);
}
// sort
qsort_lore(lorelist,0,lorelist.Size()-1);
// readjust
if ( oldone && (lorelist.Size() != oldsiz) )
{

View file

@ -357,7 +357,7 @@ Class Demolitionist : PlayerPawn
{
let i = Inventory(bt.Thing);
if ( !i || i.bINVISIBLE || !i.bSPECIAL || i.Owner || !SWWMUtility.SphereIntersect(i,pos,800) ) continue;
if ( !thesight && !CheckSight(i) ) continue;
if ( !thesight && !CheckSight(i,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
SWWMItemSense.Spawn(self,i);
}
}

View file

@ -746,8 +746,8 @@ Class RageSnd : Actor
Class RagekitPower : Powerup
{
Actor l, snd;
int lasteffect, lastrage;
transient int lastpulse;
int lasteffect;
transient int lastpulse, lastrage;
override double GetSpeedFactor()
{
@ -1030,7 +1030,7 @@ Class LampMoth : Actor
if ( !bi.Thing || !(bi.Thing is 'CompanionLamp') ) continue;
Actor a = bi.Thing;
double dist = Distance3D(a);
if ( (a.frame == 0) || (dist > mindist) && !CheckSight(a) ) continue;
if ( (a.frame == 0) || (dist > mindist) && !CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
mindist = dist;
lamp = a;
master = a.target;
@ -1040,7 +1040,7 @@ Class LampMoth : Actor
else bFRIENDLY = false;
}
}
if ( !lamp || (lamp.frame == 0) || (Distance3D(lamp) > 250) || !CheckSight(lamp) ) return false;
if ( !lamp || (lamp.frame == 0) || (Distance3D(lamp) > 250) || !CheckSight(lamp,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) return false;
return true;
}
void A_SmoothWander()

View file

@ -917,7 +917,7 @@ Class OnFire : Actor
while ( bt.Next() )
{
let t = bt.Thing;
if ( !t || !t.bSHOOTABLE || (t.Health <= 0) || (t == victim) || ((t == instigator) && (delay > 0)) || (victim.Distance3D(t) > victim.radius+t.radius+40) || !victim.CheckSight(t) ) continue;
if ( !t || !t.bSHOOTABLE || (t.Health <= 0) || (t == victim) || ((t == instigator) && (delay > 0)) || (victim.Distance3D(t) > victim.radius+t.radius+40) || !victim.CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
int amt = max(1,amount/10);
OnFire of = IsOnFire(t);
if ( of )

View file

@ -888,22 +888,14 @@ Class BiosparkComboImpact : Actor
}
void FlashPlayer( int str, double rad )
{
double vfov = CVar.GetCVar('fov',players[consoleplayer]).GetFloat()*0.5;
double hfov = atan(Screen.GetAspectRatio()*tan(vfov));
let mo = players[consoleplayer].camera;
Vector3 pp;
if ( !CheckSight(mo,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) return;
if ( mo is 'PlayerPawn' ) pp = mo.Vec2OffsetZ(0,0,PlayerPawn(mo).player.viewz);
else pp = mo.Vec3Offset(0,0,mo.CameraHeight);
Vector3 sc = level.SphericalCoords(pp,pos,(mo.angle,mo.pitch));
if ( (abs(sc.x) < hfov) && (abs(sc.y) < vfov) && (sc.z < rad) )
{
str = min(int(str*(1.-(sc.z/rad))),255);
SWWMHandler.DoFlash(mo,Color(str,248,255,240),10);
SWWMHandler.DoFlash(mo,Color(str,248,255,240),20);
SWWMHandler.DoFlash(mo,Color(str/2,192,255,160),30);
SWWMHandler.DoFlash(mo,Color(str/2,192,255,160),50);
}
if ( !SWWMUtility.InPlayerFOV(players[consoleplayer],self,rad) ) return;
let mo = players[consoleplayer].Camera;
double dist = Distance3D(mo);
str = min(int(str*(1.-(dist/rad))),255);
SWWMHandler.DoFlash(mo,Color(str,248,255,240),10);
SWWMHandler.DoFlash(mo,Color(str,248,255,240),20);
SWWMHandler.DoFlash(mo,Color(str/2,192,255,160),30);
SWWMHandler.DoFlash(mo,Color(str/2,192,255,160),50);
}
override void PostBeginPlay()
{

View file

@ -230,20 +230,12 @@ Class CandyPop : Actor
}
void FlashPlayer( int str, double rad )
{
double vfov = CVar.GetCVar('fov',players[consoleplayer]).GetFloat()*0.5;
double hfov = atan(Screen.GetAspectRatio()*tan(vfov));
let mo = players[consoleplayer].camera;
Vector3 pp;
if ( !CheckSight(mo) ) return;
if ( mo is 'PlayerPawn' ) pp = mo.Vec2OffsetZ(0,0,PlayerPawn(mo).player.viewz);
else pp = mo.Vec3Offset(0,0,mo.CameraHeight);
Vector3 sc = level.SphericalCoords(pp,pos,(mo.angle,mo.pitch));
if ( (abs(sc.x) < hfov) && (abs(sc.y) < vfov) && (sc.z < rad) )
{
str = int(str*(1.-(sc.z/rad)));
SWWMHandler.DoFlash(mo,Color(str,250,240,255),1);
SWWMHandler.DoFlash(mo,Color(str,224,0,255),3);
}
if ( !SWWMUtility.InPlayerFOV(players[consoleplayer],self,rad) ) return;
let mo = players[consoleplayer].Camera;
double dist = Distance3D(mo);
str = int(str*(1.-(dist/rad)));
SWWMHandler.DoFlash(mo,Color(str,250,240,255),1);
SWWMHandler.DoFlash(mo,Color(str,224,0,255),3);
}
override void Tick()
{

View file

@ -348,7 +348,8 @@ Class SWWMLoreLibrary : Thinker
if ( !c || (c == 'SWWMCollectable') ) continue;
let def = GetDefaultByType(c);
// skip if we match and it's not for this game
if ( (c.GetClassName() != ref) && !(gameinfo.gametype&def.avail) ) return true;
if ( (c.GetClassName() == ref) && !(gameinfo.gametype&def.avail) )
return true;
}
ref = ref.MakeUpper();
String tag = String.Format("SWWM_LORETAG_%s",ref);
@ -449,17 +450,6 @@ Class SWWMLoreLibrary : Thinker
if ( (level.maptime > 0) && (gametic > lastaddtic) && (myplayer == players[consoleplayer]) && (!menuactive || (menuactive == Menu.OnNoPause)) && (myplayer.mo is 'Demolitionist') )
Console.Printf(StringTable.Localize("$SWWM_NEWLORE"));
lastaddtic = gametic;
// sorted add
String loca = StringTable.Localize(e.tag), locb;
int cpa, cpb;
for ( int i=0; i<ent.Size(); i++ )
{
locb = StringTable.Localize(ent[i].tag);
if ( locb < loca ) continue;
ent.Insert(i,e);
return true;
}
// append otherwise
ent.Push(e);
return true;
}
@ -895,16 +885,16 @@ Class SWWMCombatTracker : Thinker
if ( (gameinfo.gametype&GAME_Strife) && (!mytarget.bINCOMBAT && !mytarget.bJUSTATTACKED) || (mytarget is 'Beggar') || (mytarget is 'Peasant') )
straifu = true;
// enemies within 2000mu that have us as target
if ( !straifu && mytarget.target && (mytarget.target.Health > 0) && (mytarget.target.player == players[consoleplayer]) && (mytarget.Vec3To(mytarget.target).length() < 2000) && mytarget.CheckSight(mytarget.target) ) updated = level.maptime+70;
if ( !straifu && mytarget.target && (mytarget.target.Health > 0) && (mytarget.target.player == players[consoleplayer]) && (mytarget.Vec3To(mytarget.target).length() < 2000) && mytarget.CheckSight(mytarget.target,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) updated = level.maptime+70;
// players (but not voodoo dolls), always visible in sp/coop
if ( !deathmatch && mytarget.player && (mytarget.player.mo == mytarget) ) updated = level.maptime+35;
// any visible enemies within 600mu
if ( (mytarget.Vec3To(players[consoleplayer].mo).length() < 600) && players[consoleplayer].mo.CheckSight(mytarget) ) updated = level.maptime;
if ( (mytarget.Vec3To(players[consoleplayer].mo).length() < 600) && players[consoleplayer].mo.CheckSight(mytarget,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) updated = level.maptime;
}
else if ( mytarget is 'BossBrain' )
{
// teh romero, only if visible
if ( (mytarget.Vec3To(players[consoleplayer].mo).length() < 600) && players[consoleplayer].mo.CheckSight(mytarget) ) updated = level.maptime;
if ( (mytarget.Vec3To(players[consoleplayer].mo).length() < 600) && players[consoleplayer].mo.CheckSight(mytarget,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) updated = level.maptime;
}
}
}

View file

@ -677,6 +677,21 @@ Class SWWMUtility
}
// TODO destructible geometry support
}
static play bool InPlayerFOV( PlayerInfo p, Actor a, double maxdist = 0. )
{
double vfov = CVar.GetCVar('fov',p).GetFloat()*0.5;
double hfov = atan(Screen.GetAspectRatio()*tan(vfov));
let mo = p.camera;
Vector3 pp;
if ( !mo.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) return false;
if ( mo is 'PlayerPawn' ) pp = mo.Vec2OffsetZ(0,0,PlayerPawn(mo).player.viewz);
else pp = mo.Vec3Offset(0,0,mo.CameraHeight);
Vector3 sc = level.SphericalCoords(pp,a.pos,(mo.angle,mo.pitch));
if ( (abs(sc.x) > hfov) && (abs(sc.y) > vfov) ) return false;
if ( (maxdist > 0.) && (sc.z < maxdist) ) return false;
return true;
}
}
Class RadiusDebugSphere : Actor

View file

@ -257,7 +257,7 @@ Class SWWMVanillaBossHandler : EventHandler
for ( int i=0; i<bossactors.Size(); i++ )
{
if ( !bossactors[i] ) continue;
if ( (!bossactors[i].target || !bossactors[i].CheckSight(bossactors[i].target))
if ( (!bossactors[i].target || !bossactors[i].CheckSight(bossactors[i].target,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY))
&& (!bossviewactor || (bossviewactor && !bossviewactor.target)) ) continue;
initialized = true;
break;