Testing changes for GZDoom 4.11/5.0.

This commit is contained in:
Mari the Deer 2023-01-08 14:58:06 +01:00
commit d0fddbf8a3
24 changed files with 104 additions and 331 deletions

View file

@ -274,7 +274,7 @@ Class SWWMHandler : EventHandler
{
if ( !lastlock || (gametic > lastlock+20) )
{
if ( SWWMUtility.IsValidLockNum(locknum) )
if ( Key.IsLockDefined(locknum) )
lastlock = AddOneliner("locked",2);
else lastlock = AddOneliner("jammed",2);
}

View file

@ -146,70 +146,6 @@ extend Class SWWMHandler
SWWMUtility.MarkAchievement("hurry",players[consoleplayer]);
}
private void SetupLockdefsCache( SWWMCachedLockInfo cli )
{
for ( int i=0; i<Wads.GetNumLumps(); i++ )
{
String lname = Wads.GetLumpName(i);
if ( !(lname ~== "LOCKDEFS") ) continue;
String data = Wads.ReadLump(i);
Array<String> lines;
lines.Clear();
data.Split(lines,"\n");
bool valid = false;
for ( int j=0; j<lines.Size(); j++ )
{
// strip leading whitespace
while ( (lines[j].Left(1) == " ") || (lines[j].Left(1) == "\t") )
lines[j] = lines[j].Mid(1);
if ( lines[j].Left(10) ~== "CLEARLOCKS" )
{
for ( int k=0; k<cli.ent.Size(); k++ )
cli.ent[k].Destroy();
cli.ent.Clear();
}
else if ( Lines[j].Left(5) ~== "LOCK " )
{
Array<String> spl;
spl.Clear();
lines[j].Split(spl," ",TOK_SKIPEMPTY);
// check game string (if any)
if ( spl.Size() > 2 )
{
if ( (spl[2] ~== "DOOM") && !(gameinfo.gametype&GAME_Doom) ) continue;
else if ( (spl[2] ~== "HERETIC") && !(gameinfo.gametype&GAME_Heretic) ) continue;
else if ( (spl[2] ~== "HEXEN") && !(gameinfo.gametype&GAME_Hexen) ) continue;
else if ( (spl[2] ~== "STRIFE") && !(gameinfo.gametype&GAME_Strife) ) continue;
else if ( (spl[2] ~== "CHEX") && !(gameinfo.gametype&GAME_Chex) ) continue;
}
// valid lock, prepare it
let li = new("LIEntry");
li.locknumber = spl[1].ToInt();
li.hascolor = false;
// see if there's a Mapcolor defined
int k = j+1;
for ( int k=j+2; k<lines.Size(); k++ )
{
// strip leading whitespace
while ( (lines[k].Left(1) == " ") || (lines[k].Left(1) == "\t") )
lines[k] = lines[k].Mid(1);
if ( lines[k].Left(5) ~== "LOCK " )
break; // we reached the next lock
if ( !(lines[k].Left(9) ~== "MAPCOLOR ") )
continue;
// here it is
spl.Clear();
lines[k].Split(spl," ",TOK_SKIPEMPTY);
if ( spl.Size() < 4 ) break;
li.hascolor = true;
li.mapcolor = Color(spl[1].ToInt(),spl[2].ToInt(),spl[3].ToInt());
}
cli.ent.Push(li);
}
}
}
}
private void MapStartDialogues()
{
int whichboss = WhichVanillaBossMap();
@ -388,9 +324,6 @@ extend Class SWWMHandler
}
break;
}
// setup cached lockdefs data
let cli = SWWMCachedLockInfo.GetInstance();
if ( cli.ent.Size() == 0 ) SetupLockdefsCache(cli);
// for skipping over merged exit lines (sharing vertices)
Array<Line> skipme;
skipme.Clear();

View file

@ -89,7 +89,8 @@ Class SWWMStaticHandler : StaticEventHandler
for ( int i=0; i<MAXPLAYERS; i++ )
{
if ( !playeringame[i] || !(players[i].mo is 'Demolitionist') ) continue;
Demolitionist(players[i].mo).CheckUnderwaterAmb(true);
let demo = Demolitionist(players[i].mo);
demo.CheckUnderwaterAmb(true);
}
}
SWWMHandler.ClearAllShaders();
@ -210,7 +211,7 @@ Class SWWMStaticHandler : StaticEventHandler
if ( (gamestate != GS_LEVEL) || !swwm_showmaptitle ) return;
StatusBar.AttachMessage(new("DSMapTitle").Init(),-7777);
}
else if ( e.Name ~== "swwmflushud" )
else if ( e.Name ~== "swwmflushhud" )
{
if ( !(StatusBar is 'SWWMStatusBar') ) return;
SWWMStatusBar(StatusBar).Flush();

View file

@ -517,7 +517,7 @@ extend Class SWWMStatusBar
else if ( mm_displaylocks
&& (lock > 0) && (lock < 256) )
{
let lcol = SWWMUtility.GetLockColor(lock);
let lcol = Key.GetMapColorForLock(lock);
if ( !lcol )
{
// "all keys" locks lack a color

View file

@ -704,7 +704,7 @@ Class ChanceboxSpawner : Actor
if ( tbox[3] < l.bbox[2] ) continue;
if ( tbox[0] < l.bbox[1] ) continue;
if ( tbox[1] > l.bbox[0] ) continue;
if ( SWWMUtility.BoxOnLineSide(tbox[0],tbox[1],tbox[2],tbox[3],l) != -1 ) continue;
if ( Level.BoxOnLineSide(pos.xy,32,l) != -1 ) continue;
// there isn't enough space to spawn a box here
let b = Spawn("HealthNuggetItem",pos);
SWWMUtility.TransferItemProp(self,b);
@ -1032,7 +1032,7 @@ Class Chancebox : Actor
if ( tbox[3] < l.bbox[2] ) continue;
if ( tbox[0] < l.bbox[1] ) continue;
if ( tbox[1] > l.bbox[0] ) continue;
if ( SWWMUtility.BoxOnLineSide(tbox[0],tbox[1],tbox[2],tbox[3],l) != -1 ) continue;
if ( Level.BoxOnLineSide(testpos.xy,32,l) != -1 ) continue;
blocked = true;
break;
}

View file

@ -457,7 +457,7 @@ Class CompanionLamp : Actor
{
// push away from wall
Vector3 normal = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();
if ( !SWWMUtility.PointOnLineSide(pos.xy,BlockingLine) ) normal *= -1;
if ( !Level.PointOnLineSide(pos.xy,BlockingLine) ) normal *= -1;
vel += 4.*normal;
blocked = true;
}

View file

@ -42,13 +42,14 @@ Class Demolitionist : PlayerPawn
double guideangle, guidepitch, guideroll;
// for weapon bobbing stuff
// for weapon bobbing and stuff
double bumpvelz, bumpangle, bumppitch, bumproll;
double oldangle, oldpitch, oldroll;
double oldlagangle, oldlagpitch, oldlagroll, oldlagready;
Vector3 oldlagvel;
double lagangle, lagpitch, lagroll, lagready;
Vector3 lagvel;
Vector3 oldangles;
Vector3 oldlagangles, lagangles;
Vector3 oldlagdangles, lagdangles;
Vector3 oldlagvel, lagvel;
double oldlagready, lagready;
enum EUnderType
{
@ -143,6 +144,8 @@ Class Demolitionist : PlayerPawn
Player.ForwardMove 1., 1.;
Player.SideMove 1., 1.;
Player.SoundClass "demolitionist";
Player.FlyBob 0.;
Player.WaterClimbSpeed 0.;
DamageFactor "Drowning", 0.;
DamageFactor "Poison", 0.;
DamageFactor "PoisonCloud", 0.;
@ -180,6 +183,8 @@ Class Demolitionist : PlayerPawn
Super.PostBeginPlay();
lastground = true; // prevent sudden landing sound on map start
blinktime = 30;
// prevent jumpy weapon bob on game start
oldangles = (angle,pitch,roll);
// swap ourselves for a voodoo doll
if ( !player || (player.mo != self) )
{
@ -327,7 +332,7 @@ Class Demolitionist : PlayerPawn
if ( tbox[3] < l.bbox[2] ) continue;
if ( tbox[0] < l.bbox[1] ) continue;
if ( tbox[1] > l.bbox[0] ) continue;
if ( SWWMUtility.BoxOnLineSide(tbox[0],tbox[1],tbox[2],tbox[3],l) != -1 ) continue;
if ( Level.BoxOnLineSide(pos.xy,radius+8,l) != -1 ) continue;
touching.Push(l);
}
let pi = swwm_PolyobjectIterator.Create();
@ -441,8 +446,8 @@ Class Demolitionist : PlayerPawn
return SWWMUtility.LerpVector2(prevbob,bob,ticfrac)*bobstr*clamp(viewbob,0.,1.5);
}
// [4.11] proper 3D/2D weapon bob separation
/*override Vector3, Vector3 BobWeapon3D( double ticfrac )
// proper 3D weapon bob
override Vector3, Vector3 BobWeapon3D( double ticfrac )
{
if ( !player || !player.ReadyWeapon || player.ReadyWeapon.bDontBob )
return (0,0,0), (0,0,0);
@ -450,33 +455,26 @@ Class Demolitionist : PlayerPawn
player.WeaponState |= WF_WEAPONBOBBING; // always bob
Vector2 cur = BobWeaponAngle(ticfrac);
if ( !oldbob ) player.WeaponState &= ~WF_WEAPONBOBBING;
double fangle = SWWMUtility.Lerp(oldangle,angle,ticfrac);
double fpitch = SWWMUtility.Lerp(oldpitch,pitch,ticfrac);
double froll = SWWMUtility.Lerp(oldroll,roll,ticfrac);
double flagangle = SWWMUtility.Lerp(oldlagangle,lagangle,ticfrac);
double flagpitch = SWWMUtility.Lerp(oldlagpitch,lagpitch,ticfrac);
double flagroll = SWWMUtility.Lerp(oldlagroll,lagroll,ticfrac);
double diffang = fangle-flagangle;
double diffpitch = fpitch-flagpitch;
double diffroll = froll-flagroll;
if ( abs(diffang) > 1. )
Vector3 angles = SWWMUtility.LerpVector3(oldlagangles,lagangles,ticfrac);
Vector3 dangles = SWWMUtility.LerpVector3(oldlagdangles,lagdangles,ticfrac);
if ( abs(dangles.x) > 1. )
{
int sgn = (diffang>0)?1:-1;
diffang = abs(diffang)**.7*sgn;
int sgn = (dangles.x>0)?1:-1;
dangles.x = abs(dangles.x)**.75*sgn;
}
if ( abs(diffpitch) > 1. )
if ( abs(dangles.y) > 1. )
{
int sgn = (diffpitch>0)?1:-1;
diffpitch = abs(diffpitch)**.7*sgn;
int sgn = (dangles.y>0)?1:-1;
dangles.y = abs(dangles.y)**.75*sgn;
}
if ( abs(diffroll) > 1. )
if ( abs(dangles.z) > 1. )
{
int sgn = (diffroll>0)?1:-1;
diffroll = abs(diffroll)**.7*sgn;
int sgn = (dangles.z>0)?1:-1;
dangles.z = abs(dangles.z)**.75*sgn;
}
Vector3 flagvel = SWWMUtility.LerpVector3(oldlagvel,lagvel,ticfrac);
let [x, y, z] = SWWMUtility.GetAxes(flagangle,flagpitch,flagroll);
let [x2, y2, z2] = SWWMUtility.GetAxes(flagangle,0,flagroll);
let [x, y, z] = SWWMUtility.GetAxes(angles.x,angles.y,angles.z);
let [x2, y2, z2] = SWWMUtility.GetAxes(angles.x,0,angles.z);
double diffx = flagvel dot x;
double diffy = flagvel dot y;
double diffz = flagvel dot z;
@ -485,35 +483,35 @@ Class Demolitionist : PlayerPawn
if ( abs(diffx) > 1. )
{
int sgn = (diffx>0)?1:-1;
diffx = abs(diffx)**.5*sgn;
diffx = abs(diffx)**.75*sgn;
}
if ( abs(diffy) > 1. )
{
int sgn = (diffy>0)?1:-1;
diffy = abs(diffy)**.5*sgn;
diffy = abs(diffy)**.75*sgn;
}
if ( abs(diffz) > 1. )
{
int sgn = (diffz>0)?1:-1;
diffz = abs(diffz)**.5*sgn;
diffz = abs(diffz)**.75*sgn;
}
if ( abs(diffy2) > 1. )
{
int sgn = (diffy2>0)?1:-1;
diffy2 = abs(diffy2)**.5*sgn;
diffy2 = abs(diffy2)**.75*sgn;
}
if ( abs(diffz2) > 1. )
{
int sgn = (diffz2>0)?1:-1;
diffz2 = abs(diffz2)**.5*sgn;
diffz2 = abs(diffz2)**.75*sgn;
}
Vector3 bobvec = (diffy,-diffz,diffx)*20. + (cur.x,-cur.y,0)*10.;
Vector3 bobang = (diffang,diffpitch,diffroll)*.1 - (cur.x,cur.y,0)*.04 - (diffy2,diffz2,0)*.2;
Vector3 bobvec = (diffy,-diffz,diffx)*20. + (cur.x,-cur.y,cur.y)*15.;
Vector3 bobang = (dangles.x,dangles.y,dangles.z)*.15 - (cur.x,cur.y,-cur.x*2.)*.05 - (diffy2,diffz2,0)*.02;
double fready = SWWMUtility.Lerp(oldlagready,lagready,ticfrac);
return bobvec*fready, bobang*fready;
}
// compatibility with 2D weapons
// compatibility with 2D weapons (may cause sprite cutoff)
override Vector2 BobWeapon( double ticfrac )
{
if ( !player || !player.ReadyWeapon || player.ReadyWeapon.bDontBob )
@ -522,88 +520,36 @@ Class Demolitionist : PlayerPawn
player.WeaponState |= WF_WEAPONBOBBING; // always bob
Vector2 cur = BobWeaponAngle(ticfrac);
if ( !oldbob ) player.WeaponState &= ~WF_WEAPONBOBBING;
double fangle = SWWMUtility.Lerp(oldangle,angle,ticfrac);
double fpitch = SWWMUtility.Lerp(oldpitch,pitch,ticfrac);
double flagangle = SWWMUtility.Lerp(oldlagangle,lagangle,ticfrac);
double flagpitch = SWWMUtility.Lerp(oldlagpitch,lagpitch,ticfrac);
double diffang = fangle-flagangle;
double diffpitch = fpitch-flagpitch;
if ( abs(diffang) > 1. )
Vector3 angles = SWWMUtility.LerpVector3(oldlagangles,lagangles,ticfrac);
Vector3 dangles = SWWMUtility.LerpVector3(oldlagdangles,lagdangles,ticfrac);
if ( abs(dangles.x) > 1. )
{
int sgn = (diffang>0)?1:-1;
diffang = abs(diffang)**.7*sgn;
int sgn = (dangles.x>0)?1:-1;
dangles.x = abs(dangles.x)**.75*sgn;
}
if ( abs(diffpitch) > 1. )
if ( abs(dangles.y) > 1. )
{
int sgn = (diffpitch>0)?1:-1;
diffpitch = abs(diffpitch)**.7*sgn;
int sgn = (dangles.y>0)?1:-1;
dangles.y = abs(dangles.y)**.75*sgn;
}
cur.x += diffang*.4;
cur.y -= diffpitch*.4;
cur.x += dangles.x*.4;
cur.y -= dangles.y*.4;
Vector3 flagvel = SWWMUtility.LerpVector3(oldlagvel,lagvel,ticfrac);
double flagroll = SWWMUtility.Lerp(oldlagroll,lagroll,ticfrac);
let [x, y, z] = SWWMUtility.GetAxes(flagangle,0,flagroll);
let [x, y, z] = SWWMUtility.GetAxes(angles.x,0,angles.z);
double diffy = flagvel dot y;
double diffz = flagvel dot z;
if ( abs(diffy) > 1. )
{
int sgn = (diffy>0)?1:-1;
diffy = abs(diffy)**.5*sgn;
diffy = abs(diffy)**.75*sgn;
}
if ( abs(diffz) > 1. )
{
int sgn = (diffz>0)?1:-1;
diffz = abs(diffz)**.5*sgn;
diffz = abs(diffz)**.75*sgn;
}
cur.x -= diffy*.8;
cur.y += diffz*.8;
return cur*SWWMUtility.Lerp(oldlagready,lagready,ticfrac);
}*/
override Vector2 BobWeapon( double ticfrac )
{
if ( !player || !player.ReadyWeapon || player.ReadyWeapon.bDontBob )
return (0,0);
bool oldbob = !!(player.WeaponState&WF_WEAPONBOBBING);
player.WeaponState |= WF_WEAPONBOBBING; // always bob
Vector2 cur = BobWeaponAngle(ticfrac);
if ( !oldbob ) player.WeaponState &= ~WF_WEAPONBOBBING;
double fangle = SWWMUtility.Lerp(oldangle,angle,ticfrac);
double fpitch = SWWMUtility.Lerp(oldpitch,pitch,ticfrac);
double flagangle = SWWMUtility.Lerp(oldlagangle,lagangle,ticfrac);
double flagpitch = SWWMUtility.Lerp(oldlagpitch,lagpitch,ticfrac);
double diffang = fangle-flagangle;
double diffpitch = fpitch-flagpitch;
if ( abs(diffang) > 1. )
{
int sgn = (diffang>0)?1:-1;
diffang = abs(diffang)**.7*sgn;
}
if ( abs(diffpitch) > 1. )
{
int sgn = (diffpitch>0)?1:-1;
diffpitch = abs(diffpitch)**.7*sgn;
}
cur.x += diffang*.4;
cur.y -= diffpitch*.4;
Vector3 flagvel = SWWMUtility.LerpVector3(oldlagvel,lagvel,ticfrac);
double flagroll = SWWMUtility.Lerp(oldlagroll,lagroll,ticfrac);
Vector3 x, y, z;
[x, y, z] = SWWMUtility.GetAxes(flagangle,0,flagroll);
double diffy = flagvel dot y;
double diffz = flagvel dot z;
if ( abs(diffy) > 1. )
{
int sgn = (diffy>0)?1:-1;
diffy = abs(diffy)**.5*sgn;
}
if ( abs(diffz) > 1. )
{
int sgn = (diffz>0)?1:-1;
diffz = abs(diffz)**.5*sgn;
}
cur.x -= diffy*.8;
cur.y += diffz*.8;
cur.x -= diffy*.4;
cur.y += diffz*.4;
return cur*SWWMUtility.Lerp(oldlagready,lagready,ticfrac);
}
@ -752,6 +698,13 @@ Class Demolitionist : PlayerPawn
dashboost = 0.;
// prevent sudden stomping if we were previously falling
lastvelz = vel.z;
// clear bob data
oldlagangles = lagangles = oldangles = (angle,pitch,roll);
oldlagdangles = lagdangles = (0.,0.,0.);
oldlagvel = lagvel = vel;
bumpvelz = bumpangle = bumppitch = bumproll = 0.;
ViewAngle = ViewPitch = ViewRoll = 0.;
SetViewPos((0.,0.,0.));
// early cancel gestures
if ( player )
{
@ -783,14 +736,15 @@ Class Demolitionist : PlayerPawn
// reset all smooth bob variables if angles/velocity aren't carried over
if ( !(flags&TELF_KEEPORIENTATION) )
{
oldlagangle = lagangle = oldangle = angle;
oldlagpitch = lagpitch = oldpitch = pitch;
oldlagroll = lagroll = oldroll = roll;
oldlagangles = lagangles = oldangles = (angle,pitch,roll);
oldlagdangles = lagdangles = (0.,0.,0.);
bumpangle = bumppitch = bumproll = 0.;
}
if ( !(flags&TELF_KEEPVELOCITY) )
{
oldlagvel = lagvel = vel;
lastvelz = vel.z;
bumpvelz = 0.;
}
// notify carried lamp that we just moved
let l = SWWMLamp(FindInventory("SWWMLamp"));

View file

@ -185,9 +185,7 @@ extend Class Demolitionist
override void PlayerThink()
{
oldangle = angle;
oldpitch = pitch;
oldroll = roll;
oldangles = (angle,pitch,roll);
if ( player && (player.mo == self) && (player.playerstate != PST_DEAD) && (player.cmd.buttons&BT_USE) )
{
if ( !player.usedown ) lastuse = gametic;
@ -219,12 +217,10 @@ extend Class Demolitionist
}
}
else if ( gametic > lastuse+50 ) failcounter = 0;
oldlagangle = lagangle;
oldlagpitch = lagpitch;
oldlagroll = lagroll;
lagangle = lagangle*.8+angle*.2;
lagpitch = lagpitch*.8+pitch*.2;
lagroll = lagroll*.8+roll*.2;
oldlagangles = lagangles;
lagangles = lagangles*.8+(angle,pitch,roll)*.2;
oldlagdangles = lagdangles;
lagdangles = lagdangles*.8+(deltaangle(oldangles.x,angle),deltaangle(oldangles.y,pitch),deltaangle(oldangles.z,roll))*.2;
if ( !player || (player.mo != self) ) return;
if ( (player.playerstate != PST_DEAD) && (player.jumptics != 0) )
{
@ -246,6 +242,7 @@ extend Class Demolitionist
override void DeathThink()
{
oldangles = (angle,pitch,roll);
player.Uncrouch();
TickPSprites();
player.onground = (pos.Z<=floorz);
@ -261,6 +258,11 @@ extend Class Demolitionist
double droll = clamp(deltaangle(roll,50)*.5,-5,5);
if ( abs(droll) < 2. ) roll = 50.;
else A_SetRoll(roll+droll,SPF_INTERPOLATE);
// bob interpolation still active
oldlagangles = lagangles;
lagangles = lagangles*.8+(angle,pitch,roll)*.2;
oldlagdangles = lagdangles;
lagdangles = lagdangles*.8+(deltaangle(oldangles.x,angle),deltaangle(oldangles.y,pitch),deltaangle(oldangles.z,roll))*.2;
player.mo.CalcHeight();
if ( player.damagecount ) player.damagecount--;
if ( player.poisoncount ) player.poisoncount--;

View file

@ -427,7 +427,7 @@ extend Class Demolitionist
}
if ( abs(bumpvelz) > double.epsilon )
{
lagvel.z += bumpvelz*.2;
lagvel.z += bumpvelz*.5;
bumpvelz *= .8;
}
Vector3 temp = (ViewAngle,ViewPitch,ViewRoll);
@ -712,7 +712,7 @@ extend Class Demolitionist
{
Vector3 wallnorm = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();
int lside = 1;
if ( !BlockingLine.sidedef[1] || !SWWMUtility.PointOnLineSide(pos.xy,BlockingLine) )
if ( !BlockingLine.sidedef[1] || !Level.PointOnLineSide(pos.xy,BlockingLine) )
{
lside = 0;
wallnorm *= -1;

View file

@ -216,7 +216,7 @@ Class LoveHeart : Actor
{
HitLine = BlockingLine;
// which side and part we hit?
LineSide = SWWMUtility.PointOnLineSide(pos.xy,BlockingLine);
LineSide = Level.PointOnLineSide(pos.xy,BlockingLine);
double fl, cl;
if ( BlockingLine.sidedef[1] )
{
@ -433,7 +433,7 @@ Class LoveHeart : Actor
// use line
if ( BlockingLine )
{
int s = SWWMUtility.PointOnLineSide(pos.xy,BlockingLine);
int s = Level.PointOnLineSide(pos.xy,BlockingLine);
int locknum = SWWMUtility.GetLineLock(BlockingLine);
if ( !locknum || (target && target.CheckKeys(locknum,false,true)) )
BlockingLine.RemoteActivate(target,s,SPAC_Use,pos);

View file

@ -169,58 +169,6 @@ Class SWWMCrusherBroken : Thinker
}
}
// cache data for manual lockdefs parsing nonsense
Class LIEntry
{
int locknumber;
bool hascolor;
Color mapcolor;
}
Class SWWMCachedLockInfo : SWWMStaticThinker
{
Array<LIEntry> ent;
static clearscope bool IsValidLock( int l )
{
let ti = ThinkerIterator.Create("SWWMCachedLockInfo",STAT_STATIC);
SWWMCachedLockInfo cli = SWWMCachedLockInfo(ti.Next());
if ( !cli ) return false;
foreach ( e:cli.ent )
{
if ( e.locknumber == l )
return true;
}
return false;
}
static clearscope Color GetLockColor( int l )
{
let ti = ThinkerIterator.Create("SWWMCachedLockInfo",STAT_STATIC);
SWWMCachedLockInfo cli = SWWMCachedLockInfo(ti.Next());
if ( !cli ) return -1;
foreach ( e:cli.ent )
{
if ( e.locknumber == l )
{
if ( e.hascolor ) return e.mapcolor;
return 0;
}
}
return -1;
}
static SWWMCachedLockInfo GetInstance()
{
let ti = ThinkerIterator.Create("SWWMCachedLockInfo",STAT_STATIC);
SWWMCachedLockInfo cli = SWWMCachedLockInfo(ti.Next());
if ( cli ) return cli;
cli = new("SWWMCachedLockInfo");
cli.ChangeStatNum(STAT_STATIC);
return cli;
}
}
Class SWWMCorpseCleaner : Thinker
{
transient ThinkerIterator ti;

View file

@ -9,68 +9,6 @@ enum EExitType
extend Class SWWMUtility
{
// how the fuck is this not available to ZScript?
// copied from P_PointOnLineSidePrecise()
deprecated("4.11", "Use Level.PointOnLineSide() instead") static int PointOnLineSide( Vector2 p, Line l )
{
if ( !l ) return 0;
return (((p.y-l.v1.p.y)*l.delta.x+(l.v1.p.x-p.x)*l.delta.y) > double.epsilon);
}
// haha another one
// copied from BoxOnLineSide()
deprecated("4.11", "Use Level.BoxOnLineSide() instead") static int BoxOnLineSide( double top, double bottom, double left, double right, Line l )
{
if ( !l ) return 0;
int p1, p2;
if ( l.delta.x == 0 )
{
// ST_VERTICAL:
p1 = (right < l.v1.p.x);
p2 = (left < l.v1.p.x);
if ( l.delta.y < 0 )
{
p1 ^= 1;
p2 ^= 1;
}
}
else if ( l.delta.y == 0 )
{
// ST_HORIZONTAL:
p1 = (top > l.v1.p.y);
p2 = (bottom > l.v1.p.y);
if ( l.delta.x < 0 )
{
p1 ^= 1;
p2 ^= 1;
}
}
else if ( (l.delta.x*l.delta.y) >= 0 )
{
// ST_POSITIVE:
p1 = PointOnLineSide((left,top),l);
p2 = PointOnLineSide((right,bottom),l);
}
else
{
// ST_NEGATIVE:
p1 = PointOnLineSide((right,top),l);
p2 = PointOnLineSide((left,bottom),l);
}
return (p1==p2)?p1:-1;
}
// wrapper
deprecated("4.11", "Use Level.ActorOnLineSide() instead") static int ActorOnLineSide( Actor a, Line l )
{
double box[4];
box[0] = a.pos.y+a.radius;
box[1] = a.pos.y-a.radius;
box[2] = a.pos.x-a.radius;
box[3] = a.pos.x+a.radius;
return BoxOnLineSide(box[0],box[1],box[2],box[3],l);
}
// Thanks to ZZYZX and Nash
static play void SetToSlopeSpecific( Actor a, double dang, SecPlane plane, bool flipnorm )
{
@ -208,17 +146,6 @@ extend Class SWWMUtility
return false;
}
deprecated("4.11","Use Key.IsLockDefined() instead") static bool IsValidLockNum( int l )
{
if ( (l < 1) || (l > 255) ) return true;
return SWWMCachedLockInfo.IsValidLock(l);
}
deprecated("4.11","Use Key.GetMapColorForLock() instead") static Color GetLockColor( int l )
{
return SWWMCachedLockInfo.GetLockColor(l);
}
static bool IsDoorSector( Sector s, int part )
{
// super-easy mode: check for boss special sectors
@ -586,7 +513,7 @@ extend Class SWWMUtility
else if ( a.BlockingLine && BlockingLineIsBlocking(a,Line.ML_BLOCKEVERYTHING|Line.ML_BLOCKPROJECTILE,a.BlockingLine) )
{
HitNormal = (-a.BlockingLine.delta.y,a.BlockingLine.delta.x,0).unit();
if ( !SWWMUtility.PointOnLineSide(a.pos.xy,a.BlockingLine) )
if ( !Level.PointOnLineSide(a.pos.xy,a.BlockingLine) )
HitNormal *= -1;
}
else
@ -747,6 +674,6 @@ extend Class SWWMUtility
}
}
// is the point behind both lines?
return (PointOnLineSide(p,a) && PointOnLineSide(p,b));
return (Level.PointOnLineSide(p,a) && Level.PointOnLineSide(p,b));
}
}

View file

@ -223,7 +223,7 @@ Class BusterWall : Thinker
else if ( a.BlockingLine && SWWMUtility.BlockingLineIsBlocking(a,Line.ML_BLOCKEVERYTHING|Line.ML_BLOCKPROJECTILE,a.BlockingLine) )
{
HitNormal = (-a.BlockingLine.delta.y,a.BlockingLine.delta.x,0).unit();
int wside = SWWMUtility.PointOnLineSide(a.pos.xy,a.BlockingLine);
int wside = Level.PointOnLineSide(a.pos.xy,a.BlockingLine);
if ( !wside ) HitNormal *= -1;
faketracer.Results.HitType = TRACE_HitWall;
faketracer.Results.HitLine = a.BlockingLine;

View file

@ -440,7 +440,7 @@ Class EvisceratorProj : Actor
else if ( BlockingLine )
{
spawnofs = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit()*4;
if ( !SWWMUtility.PointOnLineSide(pos.xy,BlockingLine) )
if ( !Level.PointOnLineSide(pos.xy,BlockingLine) )
spawnofs *= -1;
}
int trail = 0;

View file

@ -393,7 +393,7 @@ Class ExplodiumMagAttach : ExplodiumMagProj
{
atline = BlockingLine;
normal = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();
atside = SWWMUtility.PointOnLineSide(pos.xy,BlockingLine);
atside = Level.PointOnLineSide(pos.xy,BlockingLine);
if ( !atside ) normal *= -1;
Vector3 orig = (BlockingLine.v1.p.x,BlockingLine.v1.p.y,0);
Vector3 onwall = pos-(normal dot (pos-orig))*normal;