//------------------------------------------------------------
// rvMonsterBossBuddy::State_Torso_SlashAttack
//------------------------------------------------------------
stateResult_t rvMonsterBossBuddy::State_Torso_SlashAttack( const stateParms_t& parms ) 
{
	enum 
	{ 
		STAGE_INIT,
		STAGE_WAIT_FIRST_SWIPE,
		STAGE_WAIT_FINISH
	};
	switch ( parms.stage ) 
	{
		case STAGE_INIT:
			DisableAnimState( ANIMCHANNEL_LEGS );
			PlayAnim( ANIMCHANNEL_TORSO, "melee_move_attack", parms.blendFrames );
			return SRESULT_STAGE( STAGE_WAIT_FIRST_SWIPE );
			
		case STAGE_WAIT_FIRST_SWIPE:
			if ( AnimDone( ANIMCHANNEL_TORSO, 0 )) 
			{
				PlayAnim( ANIMCHANNEL_TORSO, "melee_move_attack", parms.blendFrames );
				return SRESULT_STAGE( STAGE_WAIT_FINISH );
			}
			return SRESULT_WAIT;

		case STAGE_WAIT_FINISH:
			if ( AnimDone( ANIMCHANNEL_TORSO, 0 )) 
			{
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR; 
}
END_CLASS_STATES

/*
================
rvMonsterStroggMarine::State_Torso_RollAttack 
================
*/
stateResult_t rvMonsterStroggMarine::State_Torso_RollAttack ( const stateParms_t& parms ) {
	enum { 
		TORSO_ROLLATTACK_ROLL,
		TORSO_ROLLATTACK_FACE,
		TORSO_ROLLATTACK_FIRE,
		TORSO_ROLLATTACK_FINISH
	};

	TurnToward(enemy.lastKnownPosition);

	switch ( parms.stage ) {
		// Start the roll attack animation
		case TORSO_ROLLATTACK_ROLL:			
			// Full body animations
			DisableAnimState ( ANIMCHANNEL_LEGS );

			// Play the roll
			PlayAnim ( ANIMCHANNEL_TORSO, "dive_turn", parms.blendFrames );	
			move.fl.noTurn = false;
			//FaceEnemy();
			return SRESULT_STAGE ( TORSO_ROLLATTACK_FACE );
			
		// Wait for roll animation to finish
		case TORSO_ROLLATTACK_FACE:
			if ( AnimDone ( ANIMCHANNEL_LEGS, 6 ) ) {
				return SRESULT_STAGE ( TORSO_ROLLATTACK_FIRE );
			}
			return SRESULT_WAIT;
	
		// Play fire animation
		case TORSO_ROLLATTACK_FIRE:
			if ( !enemy.ent || !enemy.fl.visible )
			{//whoops! rolled out of LOS
				return SRESULT_DONE;			
			}
			if ( enemy.fl.inFov )
			{
				PlayAnim ( ANIMCHANNEL_TORSO, "shotgun_range_attack", parms.blendFrames );
				return SRESULT_STAGE ( TORSO_ROLLATTACK_FINISH );
			}
			return SRESULT_WAIT;

		// Wait for fire animation to finish
		case TORSO_ROLLATTACK_FINISH:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 2 ) ) {
				return SRESULT_DONE;			
			}
			return SRESULT_WAIT;
	}	
	return SRESULT_ERROR;
}
END_CLASS_STATES

//------------------------------------------------------------
// rvMonsterBossBuddy::State_Torso_RocketAttack
//------------------------------------------------------------
stateResult_t rvMonsterBossBuddy::State_Torso_RocketAttack( const stateParms_t& parms ) 
{
	enum 
	{ 
		STAGE_INIT,
		STAGE_WAITSTART,
		STAGE_LOOP,
		STAGE_WAITLOOP,
		STAGE_WAITEND
	};
	switch ( parms.stage ) 
	{
		case STAGE_INIT:
			DisableAnimState( ANIMCHANNEL_LEGS );
			PlayAnim( ANIMCHANNEL_TORSO, "attack_rocket2start", parms.blendFrames );
			mShots = (gameLocal.random.RandomInt( 3 ) + 2) * combat.aggressiveScale;
			return SRESULT_STAGE( STAGE_WAITSTART );
			
		case STAGE_WAITSTART:
			if ( AnimDone( ANIMCHANNEL_TORSO, 0 )) 
			{
				return SRESULT_STAGE( STAGE_LOOP );
			}
			return SRESULT_WAIT;
		
		case STAGE_LOOP:
			PlayAnim( ANIMCHANNEL_TORSO, "attack_rocket2loop2", 0 );
			return SRESULT_STAGE( STAGE_WAITLOOP );
		
		case STAGE_WAITLOOP:
			if ( AnimDone( ANIMCHANNEL_TORSO, 0 )) 
			{
				if ( --mShots <= 0 ||										// exhausted mShots? .. or
						(!IsEnemyVisible() && rvRandom::irand(0,10)>=8 ) ||	// ... player is no longer visible .. or
						( enemy.ent && DistanceTo(enemy.ent)<256 ) ) 		// ... player is so close, we prolly want to do a melee attack
				{
					PlayAnim( ANIMCHANNEL_TORSO, "attack_rocket2end", 0 );
					return SRESULT_STAGE( STAGE_WAITEND );
				}
				return SRESULT_STAGE( STAGE_LOOP );
			}
			return SRESULT_WAIT;
		
		case STAGE_WAITEND:
			if ( AnimDone( ANIMCHANNEL_TORSO, 4 )) 
			{
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;				
	}
	return SRESULT_ERROR; 
}
/*
================
rvWeaponGauntlet::State_Fire
================
*/
stateResult_t rvWeaponGauntlet::State_Fire( const stateParms_t& parms ) {
	enum {
		STAGE_START,
		STAGE_START_WAIT,
		STAGE_LOOP,
		STAGE_LOOP_WAIT,
		STAGE_END,
		STAGE_END_WAIT
	};	
	switch ( parms.stage ) {
		case STAGE_START:	
			PlayAnim( ANIMCHANNEL_ALL, "attack_start", parms.blendFrames );
			StartBlade();
			loopSound = LOOP_NONE;
			// #32 - no gauntlet spin up
			//return SRESULT_STAGE( STAGE_START_WAIT );
			return SRESULT_STAGE( STAGE_LOOP );
		
		case STAGE_START_WAIT:
			if ( !wsfl.attack ) {
				return SRESULT_STAGE( STAGE_END );
			}
			if ( AnimDone( ANIMCHANNEL_ALL, parms.blendFrames ) ) {
				return SRESULT_STAGE( STAGE_LOOP );
			}
			return SRESULT_WAIT;
			
		case STAGE_LOOP:
			PlayCycle( ANIMCHANNEL_ALL, "attack_loop", parms.blendFrames );
			StartSound( "snd_spin_loop", SND_CHANNEL_WEAPON, 0, false, 0 );
			return SRESULT_STAGE(STAGE_LOOP_WAIT);
			
		case STAGE_LOOP_WAIT:
			if ( !wsfl.attack || wsfl.lowerWeapon ) {
				return SRESULT_STAGE( STAGE_END );
			}
			Attack();
			return SRESULT_WAIT;
		
		case STAGE_END:
			PlayAnim( ANIMCHANNEL_ALL, "attack_end", parms.blendFrames );
			StopBlade();
			StartSound( "snd_spin_down", SND_CHANNEL_WEAPON, 0, false, 0 );
			return SRESULT_STAGE( STAGE_END_WAIT );
		
		case STAGE_END_WAIT:
			if ( wsfl.attack || AnimDone( ANIMCHANNEL_ALL, parms.blendFrames ) ) {
				PostState( "Idle", parms.blendFrames );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}			
	return SRESULT_ERROR;
}
Esempio n. 5
0
END_CLASS_STATES

/*
================
rvMonsterRepairBot::State_Legs_Move
================
*/
stateResult_t rvMonsterRepairBot::State_Legs_Move ( const stateParms_t& parms ) {
	enum {
		STAGE_START,
		STAGE_START_WAIT,
		STAGE_MOVE,
		STAGE_MOVE_WAIT,
		STAGE_STOP,
		STAGE_STOP_WAIT
	};
	switch ( parms.stage ) {
		case STAGE_START:
			PlayAnim ( ANIMCHANNEL_LEGS, "idle_to_run", 4 );
			return SRESULT_STAGE ( STAGE_START_WAIT );
		
		case STAGE_START_WAIT:
			if ( AnimDone ( ANIMCHANNEL_LEGS, 4 ) ) {
				return SRESULT_STAGE ( STAGE_MOVE );
			}
			return SRESULT_WAIT;
			
		case STAGE_MOVE:
			PlayCycle (  ANIMCHANNEL_LEGS, "run", 4 );
			return SRESULT_STAGE ( STAGE_MOVE_WAIT );
		
		case STAGE_MOVE_WAIT:
			if ( !move.fl.moving || !CanMove() ) {
				return SRESULT_STAGE ( STAGE_STOP );
			}
			return SRESULT_WAIT;
				
		case STAGE_STOP:
			PlayAnim ( ANIMCHANNEL_LEGS, "run_to_idle", 4 );
			return SRESULT_STAGE ( STAGE_STOP_WAIT );
		
		case STAGE_STOP_WAIT:
			if ( AnimDone ( ANIMCHANNEL_LEGS, 4 ) ) {
				PostAnimState ( ANIMCHANNEL_LEGS, "Legs_Idle", 4 );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
Esempio n. 6
0
/*
================
rvVehicleDropPod::State_ScriptedAnim
================
*/
stateResult_t rvVehicleDropPod::State_ScriptedAnim ( const stateParms_t& parms ) {
	if ( !AnimDone ( ANIMCHANNEL_LEGS, parms.blendFrames ) ) {
		return SRESULT_WAIT;
	}
	Event_ScriptedStop();
	return SRESULT_DONE;
}
Esempio n. 7
0
/*
================
rvWeaponGrenadeLauncher::State_Reload
================
*/
stateResult_t WeaponNapalmGun::State_EmptyReload( const stateParms_t& parms ) {
	enum {
		STAGE_INIT,
		STAGE_WAIT,
	};	
	switch ( parms.stage ) {
		case STAGE_INIT:
			if ( wsfl.netReload ) {
				wsfl.netReload = false;
			} else {
				NetReload ( );
			}
			
			SetStatus ( WP_RELOAD );
			PlayAnim ( ANIMCHANNEL_ALL, "reload_empty", parms.blendFrames );
			return SRESULT_STAGE ( STAGE_WAIT );
			
		case STAGE_WAIT:
			if ( AnimDone ( ANIMCHANNEL_ALL, 0 ) ) {
				AddToClip ( ClipSize() );

				cylinderState = CYLINDER_MOVE_POSITION;

				SetState ( "Idle", 4 );
				return SRESULT_DONE;
			}
			if ( wsfl.lowerWeapon ) {
				SetState ( "Lower", 4 );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
Esempio n. 8
0
END_CLASS_STATES



stateResult_t WeaponNapalmGun::State_Reload( const stateParms_t& parms) {
	enum {
		STAGE_INIT,
		STAGE_WAIT,
	};	
	switch ( parms.stage ) {
		case STAGE_INIT:
			PlayAnim ( ANIMCHANNEL_ALL, "reload", parms.blendFrames );
			return SRESULT_STAGE ( STAGE_WAIT );

		case STAGE_WAIT:
			if ( AnimDone ( ANIMCHANNEL_ALL, 0 ) ) {
				SetState ( "Idle", 4 );
				return SRESULT_DONE;
			}
			if ( wsfl.lowerWeapon ) {
				SetState ( "Lower", 4 );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
Esempio n. 9
0
/*
================
rvWeaponShotgun::State_Fire
================
*/
stateResult_t rvWeaponShotgun::State_Fire( const stateParms_t& parms ) {
	enum {
		STAGE_INIT,
		STAGE_WAIT,
	};	
	switch ( parms.stage ) {
		case STAGE_INIT:
			nextAttackTime = gameLocal.time + (fireRate * owner->PowerUpModifier ( PMOD_FIRERATE ));
			Attack( false, hitscans, spread, 0, 1.0f );
			PlayAnim( ANIMCHANNEL_ALL, "fire", 0 );	
			return SRESULT_STAGE( STAGE_WAIT );
	
		case STAGE_WAIT:
			if ( (!gameLocal.isMultiplayer && (wsfl.lowerWeapon || AnimDone( ANIMCHANNEL_ALL, 0 )) ) || AnimDone( ANIMCHANNEL_ALL, 0 ) ) {
				SetState( "Idle", 0 );
				return SRESULT_DONE;
			}									
			if ( wsfl.attack && gameLocal.time >= nextAttackTime && AmmoInClip() ) {
				SetState( "Fire", 0 );
				return SRESULT_DONE;
			}
			if ( clipSize ) {
				if ( (wsfl.netReload || (wsfl.reload && AmmoInClip() < ClipSize() && AmmoAvailable()>AmmoInClip())) ) {
					SetState( "Reload", 4 );
					return SRESULT_DONE;			
				}				
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
Esempio n. 10
0
/*
================
rvWeaponGauntlet::State_Lower
================
*/
stateResult_t rvWeaponGauntlet::State_Lower( const stateParms_t& parms ) {
	enum {
		LOWER_INIT,
		LOWER_WAIT,
		LOWER_WAITRAISE
	};	
	switch ( parms.stage ) {
		case LOWER_INIT:
			SetStatus ( WP_LOWERING );
			PlayAnim( ANIMCHANNEL_ALL, "lower", parms.blendFrames );
			return SRESULT_STAGE(LOWER_WAIT);
			
		case LOWER_WAIT:
			if ( AnimDone ( ANIMCHANNEL_ALL, 0 ) ) {
				SetStatus ( WP_HOLSTERED );
				return SRESULT_STAGE(LOWER_WAITRAISE);
			}
			return SRESULT_WAIT;
	
		case LOWER_WAITRAISE:
			if ( wsfl.raiseWeapon ) {
				SetState ( "Raise", 0 );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
Esempio n. 11
0
/*
================
rvMonsterTurret::State_Torso_BlasterAttack
================
*/
stateResult_t rvMonsterTurret::State_Torso_BlasterAttack ( const stateParms_t& parms ) {
	enum { 
		STAGE_INIT,
		STAGE_FIRE,
		STAGE_WAIT,
	};
	switch ( parms.stage ) {
		case STAGE_INIT:
			DisableAnimState ( ANIMCHANNEL_LEGS );
			shots = (minShots + gameLocal.random.RandomInt(maxShots-minShots+1)) * combat.aggressiveScale;
			return SRESULT_STAGE ( STAGE_FIRE );
			
		case STAGE_FIRE:
			PlayAnim ( ANIMCHANNEL_TORSO, "range_attack", 2 );
			return SRESULT_STAGE ( STAGE_WAIT );

		case STAGE_WAIT:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 2 ) ) {
				if ( --shots <= 0 ) {
					return SRESULT_DONE;
				}
				return SRESULT_STAGE ( STAGE_FIRE );
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR; 
}
/*
================
rvMonsterConvoyGround::State_Torso_Pain
================
*/
stateResult_t rvMonsterConvoyGround::State_Torso_Pain ( const stateParms_t& parms ) {
	enum {
		STAGE_START,
		STAGE_END
	};
	
	switch ( parms.stage ) {
		case STAGE_START:
			// Force the orientation to the direction we got hit from so the animation looks correct		
			OverrideFlag ( AIFLAGOVERRIDE_NOTURN, true );
			TurnToward ( physicsObj.GetOrigin() - lastPainDir * 128.0f );
			move.current_yaw = move.ideal_yaw;
			
			// Just in case the pain anim wasnt set before we got here.
			if ( !painAnim.Length ( ) ) {
				painAnim = "pain";
			}
			
			DisableAnimState ( ANIMCHANNEL_LEGS );
			PlayAnim ( ANIMCHANNEL_TORSO, painAnim, parms.blendFrames );
			return SRESULT_STAGE ( STAGE_END );
	
		case STAGE_END:
			if ( AnimDone ( ANIMCHANNEL_TORSO, parms.blendFrames ) ) {
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
Esempio n. 13
0
/*
================
rvWeaponMachinegun::State_Reload
================
*/
stateResult_t rvWeaponMachinegun::State_Reload ( const stateParms_t& parms ) {
	enum {
		STAGE_INIT,
		STAGE_WAIT,
	};	
	switch ( parms.stage ) {
		case STAGE_INIT:
			if ( wsfl.netReload ) {
				wsfl.netReload = false;
			} else {
				NetReload ( );
			}
			
			SetStatus ( WP_RELOAD );
			PlayAnim ( ANIMCHANNEL_ALL, "reload", parms.blendFrames );
			return SRESULT_STAGE ( STAGE_WAIT );
			
		case STAGE_WAIT:
			if ( AnimDone ( ANIMCHANNEL_ALL, 4 ) ) {
				AddToClip ( ClipSize() );
				SetState ( "Idle", 4 );
				return SRESULT_DONE;
			}
			if ( wsfl.lowerWeapon ) {
				SetState ( "Lower", 4 );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
Esempio n. 14
0
/*
================
rvWeaponMachinegun::State_Flashlight
================
*/
stateResult_t rvWeaponMachinegun::State_Flashlight ( const stateParms_t& parms ) {
	enum {
		FLASHLIGHT_INIT,
		FLASHLIGHT_WAIT,
	};	
	switch ( parms.stage ) {
		case FLASHLIGHT_INIT:			
			SetStatus ( WP_FLASHLIGHT );
			// Wait for the flashlight anim to play		
			PlayAnim( ANIMCHANNEL_ALL, "flashlight", 0 );
			return SRESULT_STAGE ( FLASHLIGHT_WAIT );
			
		case FLASHLIGHT_WAIT:
			if ( !AnimDone ( ANIMCHANNEL_ALL, 4 ) ) {
				return SRESULT_WAIT;
			}
			
			if ( owner->IsFlashlightOn() ) {
				Flashlight ( false );
			} else {
				Flashlight ( true );
			}
			
			SetState ( "Idle", 4 );
			return SRESULT_DONE;
	}
	return SRESULT_ERROR;
}
Esempio n. 15
0
/*
================
rvMonsterGrunt::State_Torso_LeapAttack
================
*/
stateResult_t rvMonsterGrunt::State_Torso_LeapAttack ( const stateParms_t& parms ) {
	enum {
		STAGE_ANIM,
		STAGE_ANIM_WAIT,
	};
	switch ( parms.stage ) {
		case STAGE_ANIM:
			DisableAnimState ( ANIMCHANNEL_LEGS );
			lastAttackTime = 0;
			// Play the action animation
			PlayAnim ( ANIMCHANNEL_TORSO, animator.GetAnim ( actionAnimNum )->FullName ( ), parms.blendFrames );
			return SRESULT_STAGE ( STAGE_ANIM_WAIT );
		
		case STAGE_ANIM_WAIT:
			if ( AnimDone ( ANIMCHANNEL_TORSO, parms.blendFrames ) ) {
				// If we missed our leap attack get angry
				if ( !lastAttackTime && rageThreshold ) {
					PostAnimState ( ANIMCHANNEL_TORSO, "Torso_Enrage", parms.blendFrames );
				}
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
Esempio n. 16
0
/*
================
rvWeaponMachinegun::State_Fire
================
*/
stateResult_t rvWeaponMachinegun::State_Fire ( const stateParms_t& parms ) {
	enum {
		STAGE_INIT,
		STAGE_WAIT,
	};	

	switch ( parms.stage ) {
		case STAGE_INIT:
			if ( wsfl.zoom ) {
				nextAttackTime = gameLocal.time + (altFireRate * owner->PowerUpModifier ( PMOD_FIRERATE ));
				Attack ( true, 1, spreadZoom, 0, 1.0f );
				fireHeld = true;
			} else {
				nextAttackTime = gameLocal.time + (fireRate * owner->PowerUpModifier ( PMOD_FIRERATE ));
				Attack ( false, 1, spread, 0, 1.0f );
			}
			PlayAnim ( ANIMCHANNEL_ALL, "fire", 0 );	
			return SRESULT_STAGE ( STAGE_WAIT );
	
		case STAGE_WAIT:		
			if ( !fireHeld && wsfl.attack && gameLocal.time >= nextAttackTime && AmmoInClip() && !wsfl.lowerWeapon ) {
				SetState ( "Fire", 0 );
				return SRESULT_DONE;
			}
			if ( AnimDone ( ANIMCHANNEL_ALL, 0 ) ) {
				SetState ( "Idle", 0 );
				return SRESULT_DONE;
			}		
			if ( UpdateFlashlight ( ) ) {
				return SRESULT_DONE;
			}			
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
Esempio n. 17
0
END_CLASS_STATES

/*
================
rvWeaponGauntlet::State_Raise
================
*/
stateResult_t rvWeaponGauntlet::State_Raise( const stateParms_t& parms ) {
	enum {
		RAISE_INIT,
		RAISE_WAIT,
	};	
	switch ( parms.stage ) {
		case RAISE_INIT:
			SetStatus( WP_RISING );
			PlayAnim( ANIMCHANNEL_ALL, "raise", parms.blendFrames );
			return SRESULT_STAGE( RAISE_WAIT );			
		case RAISE_WAIT:
			if ( AnimDone( ANIMCHANNEL_ALL, 4 ) ) {
				SetState( "Idle", 4 );
				return SRESULT_DONE;
			}
			if ( wsfl.lowerWeapon ) {
				SetState( "Lower", 4 );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;	
}
Esempio n. 18
0
//------------------------------------------------------------
// rvMonsterBossBuddy::State_Torso_TurnLeft90
//------------------------------------------------------------
stateResult_t rvMonsterBossBuddy::State_Torso_TurnLeft90( const stateParms_t& parms ) 
{	
	enum 
	{ 
		STAGE_INIT,
		STAGE_WAIT
	};
	switch ( parms.stage ) 
	{
		case STAGE_INIT:
			DisableAnimState( ANIMCHANNEL_LEGS );
			PlayAnim( ANIMCHANNEL_TORSO, "turn_left", parms.blendFrames );
			AnimTurn( 90.0f, true );
			return SRESULT_STAGE( STAGE_WAIT );
			
		case STAGE_WAIT:
			if ( move.fl.moving || AnimDone( ANIMCHANNEL_TORSO, 0 )) 
			{
				AnimTurn( 0, true );
				combat.investigateTime = gameLocal.time + 250;
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR; 
}
/*
================
rvMonsterConvoyGround::State_Torso_BlasterAttack
================
*/
stateResult_t rvMonsterConvoyGround::State_Torso_BlasterAttack ( const stateParms_t& parms ) {
	enum { 
		STAGE_INIT,
		STAGE_ATTACK,
		STAGE_WAIT
	};
	switch ( parms.stage ) {
		case STAGE_INIT:
			shots = (gameLocal.random.RandomInt ( maxShots - minShots ) + minShots) * combat.aggressiveScale;
			return SRESULT_STAGE ( STAGE_ATTACK );

		case STAGE_ATTACK:			
			PlayAnim ( ANIMCHANNEL_TORSO, "range_attack", parms.blendFrames );
			shots--;
			return SRESULT_STAGE ( STAGE_WAIT );
			
		case STAGE_WAIT:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 0 ) ) {
				if ( --shots <= 0 || (IsEnemyVisible() && !enemy.fl.inFov)  ) {
					return SRESULT_DONE;
				}
				return SRESULT_STAGE ( STAGE_ATTACK );
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR; 
}
Esempio n. 20
0
END_CLASS_STATES

/*
================
rvMonsterBerserker::State_Torso_ChargeAttack
================
*/
stateResult_t rvMonsterBerserker::State_Torso_ChargeAttack ( const stateParms_t& parms ) {
	enum { 
		TORSO_CHARGEATTACK_INIT,
		TORSO_CHARGEATTACK_WAIT,
		TORSO_CHARGEATTACK_RECOVER,
		TORSO_CHARGEATTACK_RECOVERWAIT
	};

	switch ( parms.stage ) {
		// Start the charge attack animation
		case TORSO_CHARGEATTACK_INIT:			
			// Full body animations
			DisableAnimState ( ANIMCHANNEL_LEGS );

			// Play the ground strike
			PlayAnim ( ANIMCHANNEL_TORSO, "ground_strike", parms.blendFrames );	
			return SRESULT_STAGE ( TORSO_CHARGEATTACK_WAIT );
			
		// Wait for charge attack animation to finish
		case TORSO_CHARGEATTACK_WAIT:
			if ( AnimDone ( ANIMCHANNEL_LEGS, 0 ) ) {
				return SRESULT_STAGE ( TORSO_CHARGEATTACK_RECOVER );
			}
			return SRESULT_WAIT;
	
		// Play recover animation
		case TORSO_CHARGEATTACK_RECOVER:
			PlayAnim ( ANIMCHANNEL_TORSO, "ground_strike_recover", parms.blendFrames );
			return SRESULT_STAGE ( TORSO_CHARGEATTACK_RECOVERWAIT );

		// Wait for recover animation to finish
		case TORSO_CHARGEATTACK_RECOVERWAIT:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 2 ) ) {
				return SRESULT_DONE;			
			}
			return SRESULT_WAIT;
	}	
	return SRESULT_ERROR;
}
END_CLASS_STATES

/*
================
rvMonsterConvoyGround::State_Fall
================
*/
stateResult_t rvMonsterConvoyGround::State_Fall ( const stateParms_t& parms ) {
	enum {
		STAGE_INIT,			// Initialize fall stage
		STAGE_WAITIMPACT,	// Wait for the drop turret to hit the ground
		STAGE_IMPACT,		// Handle drop turret impact, switch to combat state
		STAGE_WAITDONE,
		STAGE_DONE
	};
	switch ( parms.stage ) {
		case STAGE_INIT:
			StopMove ( MOVE_STATUS_DONE );
			StopAnimState ( ANIMCHANNEL_LEGS );
			StopAnimState ( ANIMCHANNEL_TORSO );
			StartSound ( "snd_falling", SND_CHANNEL_VOICE, 0, false, NULL );
			PlayEffect ( "fx_droptrail", animator.GetJointHandle ( "origin" ), true );
			DisableAnimState ( ANIMCHANNEL_LEGS );
			PlayCycle ( ANIMCHANNEL_TORSO, "idle", 0 );
			oldOrigin = physicsObj.GetOrigin ( );
			return SRESULT_STAGE(STAGE_WAITIMPACT);
			
		case STAGE_WAITIMPACT:
			if ( physicsObj.HasGroundContacts ( ) ) {
				return SRESULT_STAGE(STAGE_IMPACT);
			}
			return SRESULT_WAIT;
			
		case STAGE_IMPACT:
			StopSound ( SND_CHANNEL_VOICE, false );
			StopEffect ( "fx_droptrail" );
			PlayEffect ( "fx_landing", GetPhysics()->GetOrigin(), (-GetPhysics()->GetGravityNormal()).ToMat3() );
			
			if ( (physicsObj.GetOrigin ( ) - oldOrigin).LengthSqr() > Square(128.0f) ) {
				PlayAnim ( ANIMCHANNEL_TORSO, "land", 0 );
				return SRESULT_STAGE ( STAGE_WAITDONE );
			}
			return SRESULT_STAGE ( STAGE_DONE );
			
		case STAGE_WAITDONE:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 4 ) ) {
				return SRESULT_STAGE ( STAGE_DONE );
			}
			return SRESULT_WAIT;
		
		case STAGE_DONE:
			onGround = true;
			SetAnimState ( ANIMCHANNEL_LEGS, "Legs_Idle" );
			SetAnimState ( ANIMCHANNEL_TORSO, "Torso_Idle" );
			return SRESULT_DONE;
	}
	return SRESULT_ERROR;
}
/*
================
rvMonsterStreamProtector::State_Torso_LightningAttack
================
*/
stateResult_t rvMonsterStreamProtector::State_Torso_LightningAttack ( const stateParms_t& parms ) {
	enum { 
		STAGE_START,
		STAGE_WAITSTART,
		STAGE_LOOP,
		STAGE_WAITLOOP,
		STAGE_WAITEND
	};
	switch ( parms.stage ) {
		case STAGE_START:
			DisableAnimState ( ANIMCHANNEL_LEGS );
			attackEndTime = gameLocal.time + 5000;
			PlayAnim ( ANIMCHANNEL_TORSO, "range_attack_lightning_start", parms.blendFrames );
			return SRESULT_STAGE ( STAGE_WAITSTART );
			
		case STAGE_WAITSTART:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 0 ) ) {
				return SRESULT_STAGE ( STAGE_LOOP );
			}
			return SRESULT_WAIT;
		
		case STAGE_LOOP:
			PlayAnim ( ANIMCHANNEL_TORSO, "range_attack_lightning_fire", 0 );
			return SRESULT_STAGE ( STAGE_WAITLOOP );
		
		case STAGE_WAITLOOP:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 0 ) ) {
				if ( gameLocal.time > attackEndTime || (IsEnemyVisible() && !enemy.fl.inFov)  ) {
					PlayAnim ( ANIMCHANNEL_TORSO, "range_attack_lightning_end", 0 );
					return SRESULT_STAGE ( STAGE_WAITEND );
				}
				PlayAnim ( ANIMCHANNEL_TORSO, "range_attack_lightning_fire", 0 );
				return SRESULT_STAGE ( STAGE_LOOP );
			}
			return SRESULT_WAIT;
		
		case STAGE_WAITEND:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 4 ) ) {
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;				
	}
	return SRESULT_ERROR; 
}
/*
================
rvMonsterStreamProtector::State_Torso_BlasterAttack
================
*/
stateResult_t rvMonsterStreamProtector::State_Torso_BlasterAttack ( const stateParms_t& parms ) {
	enum { 
		STAGE_INIT,
		STAGE_WAITSTART,
		STAGE_LOOP,
		STAGE_WAITLOOP,
		STAGE_WAITEND
	};
	switch ( parms.stage ) {
		case STAGE_INIT:
			DisableAnimState ( ANIMCHANNEL_LEGS );
			PlayAnim ( ANIMCHANNEL_TORSO, "range_blaster_start", parms.blendFrames );
			shots = (gameLocal.random.RandomInt ( 8 ) + 4) * combat.aggressiveScale;
			return SRESULT_STAGE ( STAGE_WAITSTART );
			
		case STAGE_WAITSTART:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 0 ) ) {
				return SRESULT_STAGE ( STAGE_LOOP );
			}
			return SRESULT_WAIT;
		
		case STAGE_LOOP:
			PlayAnim ( ANIMCHANNEL_TORSO, "range_blaster_fire", 0 );
			return SRESULT_STAGE ( STAGE_WAITLOOP );
		
		case STAGE_WAITLOOP:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 0 ) ) {
				if ( --shots <= 0 || (IsEnemyVisible() && !enemy.fl.inFov)  ) {
					PlayAnim ( ANIMCHANNEL_TORSO, "range_blaster_end", 0 );
					return SRESULT_STAGE ( STAGE_WAITEND );
				}
				return SRESULT_STAGE ( STAGE_LOOP );
			}
			return SRESULT_WAIT;
		
		case STAGE_WAITEND:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 4 ) ) {
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;				
	}
	return SRESULT_ERROR; 
}
Esempio n. 24
0
/*
=====================
idAnimState::GetAnimFlags
=====================
*/
animFlags_t idAnimState::GetAnimFlags( void ) const {
	animFlags_t flags;

	memset( &flags, 0, sizeof( flags ) );
	if ( !disabled && !AnimDone( 0 ) ) {
		flags = animator->GetAnimFlags( animator->CurrentAnim( channel )->AnimNum() );
	}

	return flags;
}
Esempio n. 25
0
/*
================
rvMonsterGrunt::State_Torso_Enrage
================
*/
stateResult_t rvMonsterGrunt::State_Torso_Enrage ( const stateParms_t& parms ) {
	enum {
		STAGE_ANIM,
		STAGE_ANIM_WAIT,
	};
	switch ( parms.stage ) {
		case STAGE_ANIM:
			DisableAnimState ( ANIMCHANNEL_LEGS );
			PlayAnim ( ANIMCHANNEL_TORSO, "anger", parms.blendFrames );
			return SRESULT_STAGE ( STAGE_ANIM_WAIT );
		
		case STAGE_ANIM_WAIT:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 4 ) ) {
				RageStart ( );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
Esempio n. 26
0
/*
================
WeaponNapalmGun::State_Fire
================
*/
stateResult_t WeaponNapalmGun::State_Fire( const stateParms_t& parms ) {
	enum {
		STAGE_INIT,
		STAGE_WAIT,
	};	
	switch ( parms.stage ) {
		case STAGE_INIT:
			if ( wsfl.zoom ) {
				nextAttackTime = gameLocal.time + (altFireRate * owner->PowerUpModifier ( PMOD_FIRERATE ));
				Attack ( true, 1, spread, 0, 1.0f );
				PlayAnim ( ANIMCHANNEL_ALL, "idle", parms.blendFrames );
				//fireHeld = true;
			} else {
				nextAttackTime = gameLocal.time + (fireRate * owner->PowerUpModifier ( PMOD_FIRERATE ));
				Attack ( false, 1, spread, 0, 1.0f );

				int animNum = viewModel->GetAnimator()->GetAnim ( "fire" );
				if ( animNum ) {
					idAnim* anim;
					anim = (idAnim*)viewModel->GetAnimator()->GetAnim ( animNum );				
					anim->SetPlaybackRate ( (float)anim->Length() / (fireRate * owner->PowerUpModifier ( PMOD_FIRERATE )) );
				}

				PlayAnim ( ANIMCHANNEL_ALL, "fire", parms.blendFrames );
			}

			previousAmmo = AmmoInClip();
			return SRESULT_STAGE ( STAGE_WAIT );
	
		case STAGE_WAIT:			
			if ( AnimDone ( ANIMCHANNEL_ALL, 0 ) ) {
				if ( !wsfl.zoom ) 
					SetState ( "Reload", 4 );
				else
					SetState ( "Idle", 4 );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
END_CLASS_STATES

/*
================
rvMonsterSlimyTransfer::State_Torso_VomitAttack
================
*/
stateResult_t rvMonsterSlimyTransfer::State_Torso_VomitAttack ( const stateParms_t& parms ) {	
	enum {
		STAGE_INIT,
		STAGE_WAIT,
	};	
	switch ( parms.stage ) {
		case STAGE_INIT:
			DisableAnimState ( ANIMCHANNEL_LEGS );

			vomitNextAttackTime = 0;

			// Loop the flame animation
			PlayAnim( ANIMCHANNEL_TORSO, "vomit_attack", parms.blendFrames );

			// Make sure we clean up some things when this state is finished (effects for one)			
			PostAnimState ( ANIMCHANNEL_TORSO, "Torso_FinishVomitAttack", 0, 0, SFLAG_ONCLEAR );
			
			return SRESULT_STAGE ( STAGE_WAIT );
		
		case STAGE_WAIT:
			if ( AnimDone ( ANIMCHANNEL_TORSO, parms.blendFrames ) ) {
				return SRESULT_DONE;
			}
			
			if ( vomitNextAttackTime && gameLocal.time >= vomitNextAttackTime ) {
				Attack ( "vomit", jointVomitMuzzle, enemy.ent );
				vomitNextAttackTime = gameLocal.time + vomitAttackRate;
			}
			
			return SRESULT_WAIT;			
	}

	return SRESULT_ERROR;
}
/*
================
rvMonsterConvoyGround::State_Torso_Open
================
*/
stateResult_t rvMonsterConvoyGround::State_Torso_Open ( const stateParms_t& parms ) {
	enum { 
		STAGE_INIT,
		STAGE_WAIT,
	};

	switch ( parms.stage ) {
		case STAGE_INIT:
			DisableAnimState ( ANIMCHANNEL_LEGS );
			PlayAnim ( ANIMCHANNEL_TORSO, "extend_legs", parms.blendFrames );
			isOpen = true;
			aifl.disableLook = false;
			return SRESULT_STAGE ( STAGE_WAIT );

		case STAGE_WAIT:
			if ( AnimDone ( ANIMCHANNEL_TORSO, parms.blendFrames ) ) {
				return SRESULT_DONE; 
			}
			return SRESULT_WAIT;
	}			
	return SRESULT_ERROR; 
}
/*
================
rvMonsterStreamProtector::State_Torso_PlasmaAttack
================
*/
stateResult_t rvMonsterStreamProtector::State_Torso_PlasmaAttack ( const stateParms_t& parms ) {	
	enum {
		STAGE_START,
		STAGE_START_WAIT,
		STAGE_FIRE,
		STAGE_INITIALFIRE_WAIT,
		STAGE_FIRE_WAIT,
		STAGE_END,
		STAGE_END_WAIT,
	};	
	switch ( parms.stage ) {
		case STAGE_START:
			DisableAnimState ( ANIMCHANNEL_LEGS );

			// Loop the flame animation
			PlayAnim( ANIMCHANNEL_TORSO, "range_plasma_start", parms.blendFrames );

			// Make sure we clean up some things when this state is finished (effects for one)			
			PostAnimState ( ANIMCHANNEL_TORSO, "Torso_FinishPlasmaAttack", 0, 0, SFLAG_ONCLEAR );
			
			return SRESULT_STAGE ( STAGE_START_WAIT );
		
		case STAGE_START_WAIT:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 0 ) ) {
				return SRESULT_STAGE ( STAGE_FIRE );
			}
			return SRESULT_WAIT;

		case STAGE_FIRE:
			attackEndTime = gameLocal.time + 500;
			attackNextTime = gameLocal.time;
			
			// Flame effect
			PlayEffect ( "fx_plasma_muzzle", jointPlasmaMuzzle, true );
			
			PlayCycle ( ANIMCHANNEL_TORSO, "range_plasma_fire", 0 );
			
			return SRESULT_STAGE ( STAGE_INITIALFIRE_WAIT );

		case STAGE_INITIALFIRE_WAIT:
			if ( gameLocal.time > attackEndTime ) {
				attackEndTime = gameLocal.time + SEC2MS ( 1.0f + gameLocal.random.RandomFloat ( ) * 4.0f );
				return SRESULT_STAGE ( STAGE_FIRE_WAIT );
			}
			// Launch another attack?
			if ( gameLocal.time >= attackNextTime ) {
				Attack ( "plasma", jointPlasmaMuzzle, enemy.ent );
				attackNextTime = gameLocal.time + plasmaAttackRate;
			}
			return SRESULT_WAIT;
			
		case STAGE_FIRE_WAIT:
			// If we have been using plasma too long or havent seen our enemy for at least half a second then
			// stop now.
			if ( gameLocal.time > attackEndTime || gameLocal.time - enemy.lastVisibleTime > 500 || (IsEnemyVisible() && !enemy.fl.inFov) ) {
				StopEffect ( "fx_plasma_muzzle" );
				return SRESULT_STAGE ( STAGE_END );
			}
			// Launch another attack?
			if ( gameLocal.time >= attackNextTime  ) {
				Attack ( "plasma", jointPlasmaMuzzle, enemy.ent );
				attackNextTime = gameLocal.time + plasmaAttackRate;
			}
			return SRESULT_WAIT;
				
		case STAGE_END:
			// End animations
			PlayAnim( ANIMCHANNEL_TORSO, "range_plasma_end", parms.blendFrames );			
			return SRESULT_STAGE ( STAGE_END_WAIT );
		
		case STAGE_END_WAIT:
			if ( AnimDone ( ANIMCHANNEL_TORSO, 0 ) ) {
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;						
	}

	return SRESULT_ERROR;
}
/*
================
rvMonsterStreamProtector::State_Dead
================
*/
stateResult_t rvMonsterStreamProtector::State_Dead ( const stateParms_t& parms ) {
	if ( !AnimDone ( ANIMCHANNEL_TORSO, 0 ) ) {
		return SRESULT_WAIT;
	}
	return idAI::State_Dead ( parms );
}