swwmgz_m/zscript/player/swwm_player_anim.zsc
Marisa the Magician 80db58b0d0 Bump zscript ver to 4.14.1, plus a whole lot of stuff.
- Try to get rid of all implicit casts from string to name, color or class.
 - Use FindClass where needed.
 - Used a map in a case where a dictionary was unneeded.
 - Use new bounce flags where needed.
 - Replace Legacy of Rust weapons/ammo.
2025-03-13 14:50:58 +01:00

944 lines
29 KiB
Text

// animations and states
extend Class Demolitionist
{
override void PlayIdle()
{
if ( !player )
{
if ( !InStateSequence(CurState,FindState('Spawn')) )
SetStateLabel('Spawn');
return;
}
if ( player.health <= 0 ) return;
if ( !bNoGravity && player.onground )
{
// Ground
if ( player.crouchdir == -1 )
{
// Crouching
if ( InStateSequence(CurState,FindState('CrouchMove'))
|| InStateSequence(CurState,FindState('CrouchMoveRun'))
|| InStateSequence(CurState,FindState('CrouchMoveFast')) )
SetStateLabel('Crouch');
else if ( InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Turn'))
|| InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))
|| InStateSequence(CurState,FindState('SeeFast'))
|| InStateSequence(CurState,FindState('SeeFastLoop'))
|| InStateSequence(CurState,FindState('SeeFastEnd'))
|| InStateSequence(CurState,FindState('Float'))
|| InStateSequence(CurState,FindState('Swim'))
|| InStateSequence(CurState,FindState('SwimLoop'))
|| InStateSequence(CurState,FindState('SwimLoopRun'))
|| InStateSequence(CurState,FindState('SwimLoopFast')) )
SetStateLabel('StartCrouch');
}
else
{
if ( InStateSequence(CurState,FindState('Crouch'))
|| InStateSequence(CurState,FindState('CrouchMove'))
|| InStateSequence(CurState,FindState('CrouchMoveRun'))
|| InStateSequence(CurState,FindState('CrouchMoveFast')) )
SetStateLabel('EndCrouch');
else if ( InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))
|| InStateSequence(CurState,FindState('Float')) )
{
SetStateLabel('Spawn');
A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP,.2);
}
else if ( InStateSequence(CurState,FindState('SeeFast'))
|| InStateSequence(CurState,FindState('SeeFastLoop')) )
SetStateLabel('SeeFastEnd');
else if ( InStateSequence(CurState,FindState('Swim'))
|| InStateSequence(CurState,FindState('SwimLoop'))
|| InStateSequence(CurState,FindState('SwimLoopRun'))
|| InStateSequence(CurState,FindState('SwimLoopFast')) )
SetStateLabel('SwimEnd');
}
}
else if ( !bNoGravity )
{
// Falling
if ( player.crouchdir == -1 )
{
if ( InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Turn'))
|| InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))
|| InStateSequence(CurState,FindState('SeeFast'))
|| InStateSequence(CurState,FindState('SeeFastLoop'))
|| InStateSequence(CurState,FindState('SeeFastEnd'))
|| InStateSequence(CurState,FindState('Jump'))
|| InStateSequence(CurState,FindState('Float'))
|| InStateSequence(CurState,FindState('Fall'))
|| InStateSequence(CurState,FindState('FallLoop'))
|| InStateSequence(CurState,FindState('Swim'))
|| InStateSequence(CurState,FindState('SwimLoop'))
|| InStateSequence(CurState,FindState('SwimLoopRun'))
|| InStateSequence(CurState,FindState('SwimLoopFast')) )
SetStateLabel('StartCrouch');
}
else
{
if ( (InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Turn'))
|| InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))
|| InStateSequence(CurState,FindState('SeeFast'))
|| InStateSequence(CurState,FindState('SeeFastLoop'))
|| InStateSequence(CurState,FindState('SeeFastEnd'))
|| InStateSequence(CurState,FindState('Float')))
&& (abs(pos.z-floorz) > maxstepheight) )
SetStateLabel('Fall');
else if ( InStateSequence(CurState,FindState('Crouch'))
|| InStateSequence(CurState,FindState('CrouchMove'))
|| InStateSequence(CurState,FindState('CrouchMoveRun'))
|| InStateSequence(CurState,FindState('CrouchMoveFast')) )
SetStateLabel('EndCrouch');
else if ( InStateSequence(CurState,FindState('Swim'))
|| InStateSequence(CurState,FindState('SwimLoop'))
|| InStateSequence(CurState,FindState('SwimLoopRun'))
|| InStateSequence(CurState,FindState('SwimLoopFast')) )
SetStateLabel('SwimEnd');
}
}
else
{
// Swimming
if ( player.crouchdir == -1 )
{
// Crouching
if ( InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Turn'))
|| InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))
|| InStateSequence(CurState,FindState('SeeFast'))
|| InStateSequence(CurState,FindState('SeeFastLoop'))
|| InStateSequence(CurState,FindState('SeeFastEnd'))
|| InStateSequence(CurState,FindState('Jump'))
|| InStateSequence(CurState,FindState('Float'))
|| InStateSequence(CurState,FindState('Fall'))
|| InStateSequence(CurState,FindState('FallLoop'))
|| InStateSequence(CurState,FindState('Swim'))
|| InStateSequence(CurState,FindState('SwimLoop'))
|| InStateSequence(CurState,FindState('SwimLoopRun'))
|| InStateSequence(CurState,FindState('SwimLoopFast')) )
SetStateLabel('StartCrouch');
}
else
{
if ( InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Turn'))
|| InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))
|| InStateSequence(CurState,FindState('SeeFast'))
|| InStateSequence(CurState,FindState('SeeFastLoop'))
|| InStateSequence(CurState,FindState('SeeFastEnd'))
|| InStateSequence(CurState,FindState('Jump'))
|| InStateSequence(CurState,FindState('Fall'))
|| InStateSequence(CurState,FindState('FallLoop')) )
SetStateLabel('Float');
else if ( InStateSequence(CurState,FindState('Swim'))
|| InStateSequence(CurState,FindState('SwimLoop'))
|| InStateSequence(CurState,FindState('SwimLoopRun'))
|| InStateSequence(CurState,FindState('SwimLoopFast')) )
SetStateLabel('SwimEnd');
else if ( InStateSequence(CurState,FindState('Crouch'))
|| InStateSequence(CurState,FindState('CrouchMove'))
|| InStateSequence(CurState,FindState('CrouchMoveRun'))
|| InStateSequence(CurState,FindState('CrouchMoveFast')) )
SetStateLabel('EndCrouch');
}
}
}
override void PlayRunning()
{
if ( !player )
{
if ( !InStateSequence(CurState,FindState('SeeRun')) )
SetStateLabel('SeeRun');
return;
}
if ( player.health <= 0 ) return;
if ( !bNoGravity && player.onground )
{
// Ground
if ( player.crouchdir == -1 )
{
// Crouching
if ( InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Turn'))
|| InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))
|| InStateSequence(CurState,FindState('SeeFast'))
|| InStateSequence(CurState,FindState('SeeFastLoop'))
|| InStateSequence(CurState,FindState('SeeFastEnd'))
|| InStateSequence(CurState,FindState('Fall'))
|| InStateSequence(CurState,FindState('FallLoop'))
|| InStateSequence(CurState,FindState('Float'))
|| InStateSequence(CurState,FindState('Swim'))
|| InStateSequence(CurState,FindState('SwimLoop'))
|| InStateSequence(CurState,FindState('SwimLoopRun'))
|| InStateSequence(CurState,FindState('SwimLoopFast')) )
SetStateLabel('StartCrouch');
else if ( InStateSequence(CurState,FindState('Crouch')) )
{
switch( FastCheck() )
{
case 2:
SetStateLabel('CrouchMoveFast');
break;
case 1:
SetStateLabel('CrouchMoveRun');
break;
default:
SetStateLabel('CrouchMove');
break;
}
}
}
else
{
if ( InStateSequence(CurState,FindState('Crouch'))
|| InStateSequence(CurState,FindState('CrouchMove'))
|| InStateSequence(CurState,FindState('CrouchMoveRun'))
|| InStateSequence(CurState,FindState('CrouchMoveFast')) )
SetStateLabel('EndCrouch');
else if ( InStateSequence(CurState,FindState('Swim'))
|| InStateSequence(CurState,FindState('SwimLoop'))
|| InStateSequence(CurState,FindState('SwimLoopRun'))
|| InStateSequence(CurState,FindState('SwimLoopFast')) )
SetStateLabel('SwimEnd');
else if ( (FastCheck() == 2)
&& (InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Turn'))
|| InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))) )
SetStateLabel('SeeFast');
else if ( InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Float'))
|| InStateSequence(CurState,FindState('Turn')) )
{
if ( FastCheck() == 1 ) SetStateLabel('SeeRun');
else SetStateLabel('See');
A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.2);
}
}
}
else if ( !bNoGravity )
{
// Falling
PlayIdle();
}
else
{
// Swimming
if ( player.crouchdir == -1 )
{
// Crouching
if ( InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Turn'))
|| InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))
|| InStateSequence(CurState,FindState('SeeFast'))
|| InStateSequence(CurState,FindState('SeeFastLoop'))
|| InStateSequence(CurState,FindState('SeeFastEnd'))
|| InStateSequence(CurState,FindState('Jump'))
|| InStateSequence(CurState,FindState('Fall'))
|| InStateSequence(CurState,FindState('FallLoop'))
|| InStateSequence(CurState,FindState('Float'))
|| InStateSequence(CurState,FindState('Swim'))
|| InStateSequence(CurState,FindState('SwimLoop'))
|| InStateSequence(CurState,FindState('SwimLoopRun'))
|| InStateSequence(CurState,FindState('SwimLoopFast')) )
SetStateLabel('StartCrouch');
else if ( InStateSequence(CurState,FindState('Crouch')) )
{
switch( FastCheck() )
{
case 2:
SetStateLabel('CrouchMoveFast');
break;
case 1:
SetStateLabel('CrouchMoveRun');
break;
default:
SetStateLabel('CrouchMove');
break;
}
}
}
else if ( bFlyCheat || (player.cheats&CF_NOCLIP2) )
{
// Special case, fly cheats don't play a swim animation, only float
// (this fixes Demo 'swimming' on the library ladder in Spooktober, for example)
if ( InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Turn'))
|| InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))
|| InStateSequence(CurState,FindState('SeeFast'))
|| InStateSequence(CurState,FindState('SeeFastLoop'))
|| InStateSequence(CurState,FindState('SeeFastEnd'))
|| InStateSequence(CurState,FindState('Jump'))
|| InStateSequence(CurState,FindState('Fall'))
|| InStateSequence(CurState,FindState('FallLoop'))
|| InStateSequence(CurState,FindState('Swim'))
|| InStateSequence(CurState,FindState('SwimLoop'))
|| InStateSequence(CurState,FindState('SwimLoopRun'))
|| InStateSequence(CurState,FindState('SwimLoopFast')) )
SetStateLabel('Float');
else if ( InStateSequence(CurState,FindState('Crouch'))
|| InStateSequence(CurState,FindState('CrouchMove'))
|| InStateSequence(CurState,FindState('CrouchMoveRun'))
|| InStateSequence(CurState,FindState('CrouchMoveFast')) )
SetStateLabel('EndCrouch');
}
else
{
if ( InStateSequence(CurState,FindState('Spawn'))
|| InStateSequence(CurState,FindState('Turn'))
|| InStateSequence(CurState,FindState('See'))
|| InStateSequence(CurState,FindState('SeeRun'))
|| InStateSequence(CurState,FindState('SeeFast'))
|| InStateSequence(CurState,FindState('SeeFastLoop'))
|| InStateSequence(CurState,FindState('SeeFastEnd'))
|| InStateSequence(CurState,FindState('Jump'))
|| InStateSequence(CurState,FindState('Fall'))
|| InStateSequence(CurState,FindState('FallLoop'))
|| InStateSequence(CurState,FindState('Float')) )
SetStateLabel('Swim');
else if ( InStateSequence(CurState,FindState('Crouch'))
|| InStateSequence(CurState,FindState('CrouchMoveRun'))
|| InStateSequence(CurState,FindState('CrouchMoveFast')) )
SetStateLabel('EndCrouch');
}
}
}
override void PlayAttacking()
{
// Do nothing if it's a SWWM weapon, since those do things themselves
if ( player && (player.ReadyWeapon is 'SWWMWeapon') )
return;
if ( InStateSequence(CurState,FindState('Dash'))
|| InStateSequence(CurState,FindState('Boost')) )
return; // don't cancel dash/boost
if ( player && (player.crouchdir == -1) ) SetStateLabel('CrouchMissile');
else SetStateLabel('Missile');
}
override void PlayAttacking2()
{
PlayAttacking();
}
void PlayFire()
{
if ( InStateSequence(CurState,FindState('Dash'))
|| InStateSequence(CurState,FindState('Boost')) )
return; // don't cancel dash/boost
if ( player && (player.crouchdir == -1) ) SetStateLabel('CrouchMissile');
else SetStateLabel('Missile');
}
void PlayMelee()
{
if ( InStateSequence(CurState,FindState('Dash'))
|| InStateSequence(CurState,FindState('Boost')) )
return; // don't cancel dash/boost
if ( player && (player.crouchdir == -1) ) SetStateLabel('CrouchMelee');
else SetStateLabel('Melee');
}
void PlayFastMelee()
{
if ( InStateSequence(CurState,FindState('Dash'))
|| InStateSequence(CurState,FindState('Boost')) )
return; // don't cancel dash/boost
if ( player && (player.crouchdir == -1) ) SetStateLabel('CrouchFastMelee');
else SetStateLabel('FastMelee');
}
void PlayReload()
{
if ( InStateSequence(CurState,FindState('Dash'))
|| InStateSequence(CurState,FindState('Boost')) )
return; // don't cancel dash/boost
if ( player && (player.crouchdir == -1) ) SetStateLabel('CrouchReload');
else SetStateLabel('Reload');
}
void PlayFastReload()
{
if ( InStateSequence(CurState,FindState('Dash'))
|| InStateSequence(CurState,FindState('Boost')) )
return; // don't cancel dash/boost
if ( player && (player.crouchdir == -1) ) SetStateLabel('CrouchFastReload');
else SetStateLabel('FastReload');
}
void PlayCheckGun()
{
if ( InStateSequence(CurState,FindState('Dash'))
|| InStateSequence(CurState,FindState('Boost')) )
return; // don't cancel dash/boost
if ( player && (player.crouchdir == -1) ) SetStateLabel('CrouchCheckGun');
else SetStateLabel('CheckGun');
}
void A_DMFade()
{
if ( player ) return;
Spawn('TeleportFog',pos,ALLOW_REPLACE);
Destroy();
}
void A_DemoPain()
{
if ( IsActorPlayingSound(CHAN_JETPACK,"demolitionist/jet") )
A_StartSound("demolitionist/jetstop",CHAN_JETPACK);
String myvoice = CVar.GetCVar('swwm_voicetype',player).GetString();
int loudlv = swwm_voiceamp;
if ( lastdamage > 70 )
{
A_QuakeEx(3.2,3.2,3.2,9,0,8,"",QF_RELATIVE|QF_SCALEDOWN|QF_3D);
A_StartSound("demolitionist/hipain",CHAN_VOICE);
lastbump *= 1.04;
if ( swwm_mutevoice < 4 )
{
int maxpain = StringTable.Localize("$SWWM_"..myvoice.."_NHIPAIN").ToInt();
int idx = (maxpain<=1)?1:Random[DemoLines](1,maxpain);
A_StartSound(String.Format("voice/%s/hipain%d",myvoice,idx),CHAN_DEMOVOICE,CHANF_OVERLAP);
if ( loudlv > 1 ) A_StartSound(String.Format("voice/%s/hipain%d",myvoice,idx),CHAN_DEMOVOICEAUX,CHANF_OVERLAP);
if ( loudlv > 2 ) A_StartSound(String.Format("voice/%s/hipain%d",myvoice,idx),CHAN_DEMOVOICEAUX2,CHANF_OVERLAP);
if ( loudlv > 3 ) A_StartSound(String.Format("voice/%s/hipain%d",myvoice,idx),CHAN_DEMOVOICEAUX3,CHANF_OVERLAP);
}
}
else if ( lastdamage > 30 )
{
A_QuakeEx(1.6,1.6,1.6,6,0,8,"",QF_RELATIVE|QF_SCALEDOWN|QF_3D);
A_StartSound("demolitionist/pain",CHAN_VOICE);
lastbump *= 1.02;
if ( swwm_mutevoice < 4 )
{
int maxpain = StringTable.Localize("$SWWM_"..myvoice.."_NPAIN").ToInt();
int idx = (maxpain<=1)?1:Random[DemoLines](1,maxpain);
A_StartSound(String.Format("voice/%s/pain%d",myvoice,idx),CHAN_DEMOVOICE,CHANF_OVERLAP);
if ( loudlv > 1 ) A_StartSound(String.Format("voice/%s/pain%d",myvoice,idx),CHAN_DEMOVOICEAUX,CHANF_OVERLAP);
if ( loudlv > 2 ) A_StartSound(String.Format("voice/%s/pain%d",myvoice,idx),CHAN_DEMOVOICEAUX2,CHANF_OVERLAP);
if ( loudlv > 3 ) A_StartSound(String.Format("voice/%s/pain%d",myvoice,idx),CHAN_DEMOVOICEAUX3,CHANF_OVERLAP);
}
}
else if ( lastdamage > 0 )
{
A_QuakeEx(.4,.4,.4,3,0,8,"",QF_RELATIVE|QF_SCALEDOWN|QF_3D);
A_StartSound("demolitionist/lopain",CHAN_VOICE);
lastbump *= 1.01;
if ( swwm_mutevoice < 4 )
{
int maxpain = StringTable.Localize("$SWWM_"..myvoice.."_NLOPAIN").ToInt();
int idx = (maxpain<=1)?1:Random[DemoLines](1,maxpain);
A_StartSound(String.Format("voice/%s/lopain%d",myvoice,idx),CHAN_DEMOVOICE,CHANF_OVERLAP);
if ( loudlv > 1 ) A_StartSound(String.Format("voice/%s/lopain%d",myvoice,idx),CHAN_DEMOVOICEAUX,CHANF_OVERLAP);
if ( loudlv > 2 ) A_StartSound(String.Format("voice/%s/lopain%d",myvoice,idx),CHAN_DEMOVOICEAUX2,CHANF_OVERLAP);
if ( loudlv > 3 ) A_StartSound(String.Format("voice/%s/lopain%d",myvoice,idx),CHAN_DEMOVOICEAUX3,CHANF_OVERLAP);
}
}
}
void A_DemoScream()
{
if ( IsActorPlayingSound(CHAN_JETPACK,"demolitionist/jet") )
A_StartSound("demolitionist/jetstop",CHAN_JETPACK);
A_StopSound(CHAN_DEMOVOICE);
A_StopSound(CHAN_DEMOVOICEAUX);
A_StopSound(CHAN_DEMOVOICEAUX2);
A_StopSound(CHAN_DEMOVOICEAUX3);
String myvoice = CVar.GetCVar('swwm_voicetype',player).GetString();
int loudlv = swwm_voiceamp;
Sound snd = "demolitionist/death";
if ( special1 < 10 )
snd = "demolitionist/wdeath";
if ( health < -50 )
snd = "demolitionist/xdeath";
A_StartSound(snd,CHAN_VOICE);
if ( swwm_mutevoice < 4 )
{
int maxdeath = StringTable.Localize("$SWWM_"..myvoice.."_NDEATH").ToInt();
int idx = (maxdeath<=1)?1:Random[DemoLines](1,maxdeath);
A_StartSound(String.Format("voice/%s/death%d",myvoice,idx),CHAN_DEMOVOICE,CHANF_OVERLAP);
if ( loudlv > 1 ) A_StartSound(String.Format("voice/%s/death%d",myvoice,idx),CHAN_DEMOVOICEAUX,CHANF_OVERLAP);
if ( loudlv > 2 ) A_StartSound(String.Format("voice/%s/death%d",myvoice,idx),CHAN_DEMOVOICEAUX2,CHANF_OVERLAP);
if ( loudlv > 3 ) A_StartSound(String.Format("voice/%s/death%d",myvoice,idx),CHAN_DEMOVOICEAUX3,CHANF_OVERLAP);
}
}
void A_Dash()
{
vel += dashdir*dashboost*clamp(dashfuel/20.,0.,1.);
player.vel *= 0.;
if ( dashboost < .2 ) dashboost = 0.;
else if ( !(player.cmd.buttons&BT_USER2) ) dashboost *= .1;
double fueluse = (dashfuel-max(0.,dashfuel-dashboost))/60.;
SWWMUtility.AchievementProgressIncDouble("fuel",fueluse,player);
mystats.fuelusage += fueluse;
if ( !swwm_superfuel ) dashfuel = max(0.,dashfuel-dashboost);
dashcooldown = min(40,max(10,int(dashcooldown*1.4)));
dashlockst = clamp(dashcooldown/3,2,10);
fuelcooldown = max(30,fuelcooldown);
if ( (dashfuel <= 0.) && fullfuel )
SWWMUtility.AchievementProgressInc("brake",1,player);
if ( (dashfuel <= 0.) || (dashboost <= 0.) )
SetStateLabel('DashEnd');
}
void A_BoostUp( bool initial = false )
{
vel.z += .25*dashboost*clamp(dashfuel/20.,0,1.);
player.vel *= 0.;
if ( dashboost < .2 ) dashboost = 0.;
else
{
if ( player.cmd.buttons&BT_JUMP ) dashboost = min(5.,dashboost*1.01);
else dashboost *= .4;
last_boost = level.maptime+1;
}
double fueluse = (dashfuel-max(0.,dashfuel-dashboost))/60.;
SWWMUtility.AchievementProgressIncDouble("fuel",fueluse,player);
mystats.fuelusage += fueluse;
if ( !swwm_superfuel ) dashfuel = max(0.,dashfuel-dashboost);
if ( ((dashfuel <= 0.) || (dashboost <= 0.)) )
{
if ( !initial )
{
if ( player.onground ) SetStateLabel('JumpEnd');
else SetStateLabel("Fall");
}
return;
}
fuelcooldown = max(20,fuelcooldown);
}
void A_Footstep( double yofs, int run = 0, double vol = .3, bool nosplash = false )
{
if ( !multiplayer && !(player.cheats&CF_CHASECAM) )
return;
PlayFootstep(yofs,run,vol,nosplash);
}
void A_Crawl( double vol = .1, bool bAlt = false )
{
A_StartSound(bAlt?"demolitionist/runstop":"demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,vol);
}
int FastCheck()
{
if ( !player ) return 1;
if ( isAnalogMoving )
{
double mscale = NormalizedMove().length();
if ( mscale < (gameinfo.normforwardmove[0]*256.) ) return 0; // walking
if ( mscale < (gameinfo.normforwardmove[1]*256.) ) return 1; // running
return 2; // sprinting
}
if ( bWalking ) return 0; // walking
if ( IsRunning() ) return 2; // sprinting
return 1; // running
}
State A_FastJump( StateLabel walk = null, StateLabel run = null, StateLabel sprint = null )
{
int fc = FastCheck();
if ( (fc == 2) && sprint ) return ResolveState(sprint);
if ( (fc == 1) && run ) return ResolveState(run);
if ( (fc == 0) && walk ) return ResolveState(walk);
return ResolveState(null);
}
States
{
Spawn:
// normal idle
#### # 2;
XZW1 A 1 A_JumpIf(player&&(player.mo==self)&&(abs(player.cmd.yaw|player.cmd.pitch)>128),'Turn');
Wait;
See:
// normal walking
#### # 2;
XZW1 BCD 2 A_FastJump(null,'SeeRun','SeeFast');
XZW1 E 0 A_Footstep(1);
XZW1 EFGHIJKL 2 A_FastJump(null,'SeeRun','SeeFast');
XZW1 M 0 A_Footstep(-1);
XZW1 MNOPA 2 A_FastJump(null,'SeeRun','SeeFast');
Goto See+1;
Turn:
#### # 8 A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.1);
XZW1 C 1 A_JumpIf(!player||!(player.cmd.yaw|player.cmd.pitch),1);
Wait;
XZW1 C 3 A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP,.1);
Goto Spawn+1;
SeeRun:
#### # 2;
XZWI PQR 2 A_FastJump('See',null,'SeeFast');
XZWI S 0 A_Footstep(1,1);
XZWI STUVWX 2 A_FastJump('See',null,'SeeFast');
XZWI Y 0 A_Footstep(-1,1);
XZWI YZ 2 A_FastJump('See',null,'SeeFast');
XZW1 A 2 A_FastJump('See',null,'SeeFast');
Goto SeeRun+1;
SeeFast:
// sprinting
#### # 2 A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.3);
XZW1 QRS 2;
Goto SeeFastLoop;
SeeFastLoop:
// keep sprinting
XZW1 T 1 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW1 U 1 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW1 V 0 A_Footstep(1,2);
XZW1 V 1 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW1 W 2 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW1 X 2 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW1 Y 2 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW1 Z 2 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW2 A 1 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW2 B 1 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW2 C 0 A_Footstep(-1,2);
XZW2 C 1 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW2 D 2 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW2 E 2 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW2 F 2 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
XZW2 G 2 A_JumpIf(FastCheck()!=2,'SeeFastEnd');
Goto SeeFastLoop;
SeeFastEnd:
// brake
#### # 2 A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP,.3);
XZW2 HIJKL 2;
Goto Spawn+1;
Pain:
// ouchy
XZW1 A 1 A_JumpIf(player&&(player.mo==self)&&(player.crouchdir==-1),'CrouchPain');
XZW2 M 1 A_DemoPain();
XZW2 NOPQ 1;
Goto Spawn+1;
Death:
XDeath:
// ded
XZW1 A 0 A_JumpIf(player&&(player.mo==self)&&(player.crouchdir==-1),'CrouchDeath');
XZW1 A 2
{
A_DemoScream();
bSOLID = true; // we need this to avoid clipping into things
}
XZW2 RSTUVWXYZ 2;
XZW3 ABCDEFG 2;
XZW3 H 1 A_DMFade();
Wait;
Boost:
// start boost
#### # 2;
XZW3 IJKLMNO 2
{
if ( player.onground||bNoGravity )
return ResolveState('BoostEnd');
A_BoostUp(true);
return ResolveState(null);
}
// keep boost
XZW3 P 1
{
if ( player.onground||bNoGravity )
return ResolveState('BoostEnd');
A_BoostUp(false);
return ResolveState(null);
}
XZW3 P 1 A_JumpIf((vel.z<-10)&&(pos.z>(floorz+80)),'Fall');
Goto Boost+8;
BoostEnd:
// stop boost
#### # 2;
XZW3 PQRSTUVW 2;
Goto Spawn+1;
Jump:
#### # 2;
XZWJ ABCDEF 2 A_JumpIf(player.onground&&!bNoGravity,'FallEnd');
Goto FallLoop;
Fall:
// start fall
#### # 4;
XZW3 XYZ 2 A_JumpIf(player.onground&&!bNoGravity,'FallEnd');
XZW4 AB 2 A_JumpIf(player.onground&&!bNoGravity,'FallEnd');
Goto FallLoop;
FallLoop:
// falling
XZW4 CDEFGH 3 A_JumpIf(player.onground&&!bNoGravity,'FallEnd');
Goto FallLoop;
FallEnd:
// landing
XZW4 CIJKLMN 2;
Goto Spawn+1;
Dash:
#### # 2;
XZW4 O 2 A_Dash();
XZW4 PQRS 2 A_Dash();
Goto Dash+2;
DashEnd:
XZW4 TUVWX 2;
Goto Spawn+1;
Wave:
#### # 3;
XZW4 YZ 3;
XZW5 ABCDEFGHIJKLM 3;
Goto Spawn+1;
Approve:
#### # 3;
XZW5 NOPQR 3;
XZW5 S 3 { facegrin = true; }
XZW5 TUVWXYZ 3;
XZW6 ABCD 3;
Goto Spawn+1;
Victory:
#### # 3;
XZW6 EFGH 3;
XZW6 I 3 { facegrin = true; }
XZW6 JKLMNOPQRSTUVW 3;
Goto Spawn+1;
BlowKiss:
#### # 3;
XZWD EFGH 3;
XZWD I 3 { faceblink = true; }
XZWD JKLMNO 3;
XZWD P 3 { facewink = true; }
XZWD QRSTUVW 3;
Goto Spawn+1;
Headpat:
#### # 3;
XZWH ST 3;
XZWH U 2;
XZWH V 2 { facegrin = true; }
XZWH W 2;
XZWH XYZ 1;
XZWI A 1;
XZWI B 2;
XZWI C 2 { facegrin = true; }
XZWI DE 2;
XZWI FG 1;
HeadpatLoop:
XZWI H 1;
XZWH XYZ 1;
XZWI A 1;
XZWI B 2;
XZWI C 2 { facegrin = true; }
XZWI DE 2;
XZWI FGH 1;
XZWI IJK 2;
XZWI LMNO 3;
Goto Spawn+1;
Ragepat:
#### # 3;
XZWH ST 2;
XZWH UVW 1;
XZWH XZ 1;
XZWI BCDE 1;
XZWI FH 1;
XZWH XZ 1;
XZWI BCDE 1;
XZWI FH 1;
XZWH XZ 1;
XZWI BCDE 1;
XZWI F 1;
RagepatLoop:
XZWI H 1;
XZWH XZ 1;
XZWI BCDE 1;
XZWI FH 1;
XZWI IJK 1;
XZWI LMNO 2;
Goto Spawn+1;
Missile:
// attacking
#### # 2;
XZW6 XYZ 2;
XZW7 ABC 2;
Goto Spawn+1;
Melee:
// ponch
#### # 2;
XZW8 TUVWXYZ 2;
XZW9 ABCDEF 2;
Goto Spawn+1;
FastMelee:
// ponch (fast)
#### # 2;
XZW8 TUVWXYZ 1;
XZW9 ABCDE 1;
XZW9 F 2;
Goto Spawn+1;
Reload:
// reload
#### # 2;
XZW9 GHIJKLMNOPQRSTUVWXYZ 2;
XZWA ABCDE 2;
Goto Spawn+1;
FastReload:
// reload (fast)
#### # 2;
XZW9 GHIJKLMNOPQRSTUVWXYZ 1;
XZWA ABCDE 1;
Goto Spawn+1;
CheckGun:
// speen
#### # 2;
XZWA FGHIJKLMNOPQRSTUVWXY 2;
Goto Spawn+1;
StartCrouch:
// go crouching
#### # 2 A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.45);
XZW7 DEFGH 1;
XZW7 IJKL 2;
Goto Crouch+1;
Crouch:
#### # 4;
XZW7 M -1;
Stop;
CrouchMove:
#### # 4;
XZW7 MN 4 A_FastJump(null,'CrouchMoveRun','CrouchMoveFast');
XZW7 O 0 A_Crawl(.1,false);
XZW7 OPQRS 4 A_FastJump(null,'CrouchMoveRun','CrouchMoveFast');
XZW7 T 0 A_Crawl(.1,true);
XZW7 TUV 4 A_FastJump(null,'CrouchMoveRun','CrouchMoveFast');
Goto CrouchMove+1;
CrouchMoveRun:
#### # 3;
XZW7 MN 3 A_FastJump('CrouchMove',null,'CrouchMoveFast');
XZW7 O 0 A_Crawl(.2,false);
XZW7 OPQRS 3 A_FastJump('CrouchMove',null,'CrouchMoveFast');
XZW7 T 0 A_Crawl(.2,true);
XZW7 TUV 3 A_FastJump('CrouchMove',null,'CrouchMoveFast');
Goto CrouchMoveRun+1;
CrouchMoveFast:
#### # 2;
XZW7 MN 2 A_FastJump('CrouchMove','CrouchMoveRun',null);
XZW7 O 0 A_Crawl(.4,false);
XZW7 OPQRS 2 A_FastJump('CrouchMove','CrouchMoveRun',null);
XZW7 T 0 A_Crawl(.4,true);
XZW7 TUV 2 A_FastJump('CrouchMove','CrouchMoveRun',null);
Goto CrouchMoveFast+2;
CrouchWave:
#### # 3;
XZWF ABCDEFGHIJKLMNO 3;
Goto Crouch+1;
CrouchApprove:
#### # 3;
XZWF PQRST 3;
XZWF U 3 { facegrin = true; }
XZWF VWXYZ 3;
XZWG ABCDEF 3;
Goto Crouch+1;
CrouchVictory:
#### # 3;
XZWG GHIJ 3;
XZWG K 3 { facegrin = true; }
XZWG LMNOPQRSTUVWXY 3;
Goto Crouch+1;
CrouchBlowKiss:
#### # 3;
XZWG Z 3;
XZWH ABC 3;
XZWH D 3 { faceblink = true; }
XZWH EFGHIJ 3;
XZWH K 3 { facewink = true; }
XZWH LMNOPQR 3;
Goto Crouch+1;
CrouchMissile:
XZW7 M 2;
XZW7 WXYZ 2;
XZW8 AB 2;
Goto Crouch+1;
CrouchMelee:
XZW7 M 2;
XZWA Z 2;
XZWB ABCDEFGHIJKL 2;
Goto Crouch+1;
CrouchFastMelee:
XZW7 M 2;
XZWA Z 1;
XZWB ABCDEFGHIJK 1;
XZWB L 2;
Goto Crouch+1;
CrouchReload:
XZW7 M 2;
XZWB MNOPQRSTUVWXYZ 2;
XZWC ABCDEFGHIJ 2;
Goto Crouch+1;
CrouchFastReload:
XZW7 M 2;
XZWB MNOPQRSTUVWXYZ 1;
XZWC ABCDEFGHIJ 1;
Goto Crouch+1;
CrouchCheckGun:
XZW7 M 2;
XZWC LMNOPQRSTUVWXYZ 2;
XZWD ABCD 2;
Goto Crouch+1;
CrouchPain:
XZW7 M 1;
XZW8 C 1 A_DemoPain();
XZW8 DEF 1;
Goto Crouch+1;
CrouchDeath:
XZW7 M 2
{
A_DemoScream();
bSOLID = true; // we need this to avoid clipping into things
}
XZW8 GHIJK 2;
XZW8 L 1 A_DMFade();
Wait;
EndCrouch:
#### # 2 A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP,.45);
XZW8 MNOPQRS 2;
Goto Spawn+1;
Float:
#### # 3;
XZWD XYZ 3;
XZWE ABCDEFGHI 3;
Goto Float+1;
Swim:
#### # 2;
XZWE JKL 2;
Goto SwimLoop;
SwimLoop:
#### # 5;
XZWE MNO 5 A_FastJump(null,'SwimLoopRun','SwimLoopFast');
XZWE P 0 A_Crawl(.1,false);
XZWE PQRSTU 5 A_FastJump(null,'SwimLoopRun','SwimLoopFast');
XZWE V 0 A_Crawl(.1,true);
XZWE VWX 5 A_FastJump(null,'SwimLoopRun','SwimLoopFast');
Goto SwimLoop+1;
SwimLoopRun:
#### # 3;
XZWE MNO 3 A_FastJump('SwimLoop',null,'SwimLoopFast');
XZWE P 0 A_Crawl(.2,false);
XZWE PQRSTU 3 A_FastJump('SwimLoop',null,'SwimLoopFast');
XZWE V 0 A_Crawl(.2,true);
XZWE VWX 3 A_FastJump('SwimLoop',null,'SwimLoopFast');
Goto SwimLoopRun+1;
SwimLoopFast:
#### # 2;
XZWE MNO 2 A_FastJump('SwimLoop','SwimLoopRun',null);
XZWE P 0 A_Crawl(.4,false);
XZWE PQRSTU 2 A_FastJump('SwimLoop','SwimLoopRun',null);
XZWE V 0 A_Crawl(.4,true);
XZWE VWX 2 A_FastJump('SwimLoop','SwimLoopRun',null);
Goto SwimLoopFast+1;
SwimEnd:
#### # 2;
XZWE MYZ 2;
Goto Float+1;
}
}