BobWeapon3D implemented (but commented out for now).
This commit is contained in:
parent
116bca4b0b
commit
9135f594f1
4 changed files with 141 additions and 14 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r704 \cu(Fri 23 Dec 18:26:13 CET 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r704 \cu(2022-12-23 18:26:13)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r705 \cu(Sat 24 Dec 15:16:13 CET 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r705 \cu(2022-12-24 15:16:13)\c-";
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ Class Demolitionist : PlayerPawn
|
|||
|
||||
// for weapon bobbing stuff
|
||||
double bumpvelz, bumpangle, bumppitch, bumproll;
|
||||
double oldangle, oldpitch;
|
||||
double oldlagangle, oldlagpitch, oldlagready;
|
||||
double oldangle, oldpitch, oldroll;
|
||||
double oldlagangle, oldlagpitch, oldlagroll, oldlagready;
|
||||
Vector3 oldlagvel;
|
||||
double lagangle, lagpitch, lagready;
|
||||
double lagangle, lagpitch, lagroll, lagready;
|
||||
Vector3 lagvel;
|
||||
|
||||
enum EUnderType
|
||||
|
|
@ -446,6 +446,125 @@ 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 )
|
||||
{
|
||||
if ( !player || !player.ReadyWeapon || player.ReadyWeapon.bDontBob )
|
||||
return (0,0,0), (0,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 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. )
|
||||
{
|
||||
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;
|
||||
}
|
||||
if ( abs(diffroll) > 1. )
|
||||
{
|
||||
int sgn = (diffroll>0)?1:-1;
|
||||
diffroll = abs(diffroll)**.7*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);
|
||||
double diffx = flagvel dot x;
|
||||
double diffy = flagvel dot y;
|
||||
double diffz = flagvel dot z;
|
||||
double diffy2 = flagvel dot y2;
|
||||
double diffz2 = flagvel dot z2;
|
||||
if ( abs(diffx) > 1. )
|
||||
{
|
||||
int sgn = (diffx>0)?1:-1;
|
||||
diffx = abs(diffx)**.5*sgn;
|
||||
}
|
||||
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;
|
||||
}
|
||||
if ( abs(diffy2) > 1. )
|
||||
{
|
||||
int sgn = (diffy2>0)?1:-1;
|
||||
diffy2 = abs(diffy2)**.5*sgn;
|
||||
}
|
||||
if ( abs(diffz2) > 1. )
|
||||
{
|
||||
int sgn = (diffz2>0)?1:-1;
|
||||
diffz2 = abs(diffz2)**.5*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;
|
||||
double fready = SWWMUtility.Lerp(oldlagready,lagready,ticfrac);
|
||||
return bobvec*fready, bobang*fready;
|
||||
}
|
||||
|
||||
// compatibility with 2D weapons
|
||||
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);
|
||||
let [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;
|
||||
return cur*SWWMUtility.Lerp(oldlagready,lagready,ticfrac);
|
||||
}*/
|
||||
|
||||
override Vector2 BobWeapon( double ticfrac )
|
||||
{
|
||||
// non-mod weapons bob normally
|
||||
|
|
@ -471,23 +590,26 @@ Class Demolitionist : PlayerPawn
|
|||
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 diffx = flagvel dot SWWMUtility.AngleToVector3(flagangle+90);
|
||||
double diffy = flagvel dot (0,0,1);
|
||||
if ( abs(diffx) > 1. )
|
||||
{
|
||||
int sgn = (diffx>0)?1:-1;
|
||||
diffx = abs(diffx)**.5*sgn;
|
||||
}
|
||||
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;
|
||||
}
|
||||
cur.x += diffang*.4;
|
||||
cur.y -= diffpitch*.4;
|
||||
cur.x += diffx*.8;
|
||||
cur.y += diffy*.8;
|
||||
if ( abs(diffz) > 1. )
|
||||
{
|
||||
int sgn = (diffz>0)?1:-1;
|
||||
diffz = abs(diffz)**.5*sgn;
|
||||
}
|
||||
cur.x -= diffy*.8;
|
||||
cur.y += diffz*.8;
|
||||
return cur*SWWMUtility.Lerp(oldlagready,lagready,ticfrac);
|
||||
}
|
||||
|
||||
|
|
@ -669,6 +791,7 @@ Class Demolitionist : PlayerPawn
|
|||
{
|
||||
oldlagangle = lagangle = oldangle = angle;
|
||||
oldlagpitch = lagpitch = oldpitch = pitch;
|
||||
oldlagroll = lagroll = oldroll = roll;
|
||||
}
|
||||
if ( !(flags&TELF_KEEPVELOCITY) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ extend Class Demolitionist
|
|||
{
|
||||
oldangle = angle;
|
||||
oldpitch = pitch;
|
||||
oldroll = roll;
|
||||
if ( player && (player.mo == self) && (player.playerstate != PST_DEAD) && (player.cmd.buttons&BT_USE) )
|
||||
{
|
||||
if ( !player.usedown ) lastuse = gametic;
|
||||
|
|
@ -219,8 +220,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;
|
||||
if ( !player || (player.mo != self) ) return;
|
||||
if ( (player.playerstate != PST_DEAD) && (player.jumptics != 0) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -261,7 +261,8 @@ extend Class Demolitionist
|
|||
oldlagready = lagready;
|
||||
if ( player.weaponstate&WF_WEAPONBOBBING ) lagready = lagready*.9+.1;
|
||||
else lagready = lagready*.4;
|
||||
lagvel = lagvel*.8+vel*.2;
|
||||
if ( vel dot vel > lagvel dot lagvel ) lagvel = lagvel*.8+vel*.2;
|
||||
else lagvel = lagvel*.4+vel*.6;
|
||||
double traveldist = level.Vec3Diff(oldpos,pos).length();
|
||||
if ( !player.onground || bNoGravity )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue