示例#1
0
/*
================
repairBotArm_t::Save
================
*/
void repairBotArm_t::Save ( idSaveGame* savefile ) const {
	savefile->WriteInt ( repairTime );
	savefile->WriteBool ( repairing );
	effectRepair.Save ( savefile );
	effectImpact.Save ( savefile );
	
    savefile->WriteInt ( periodicEndTime );
}
示例#2
0
/*
================
repairBotArm_t::Restore
================
*/
void repairBotArm_t::Restore ( idRestoreGame* savefile ) {
	savefile->ReadInt ( repairTime );
	savefile->ReadBool ( repairing );
	effectRepair.Restore ( savefile );
	effectImpact.Restore ( savefile );

    savefile->ReadInt ( periodicEndTime );
}
示例#3
0
/*
================
rvMonsterStroggHover::Restore
================
*/
void rvMonsterStroggHover::Restore ( idRestoreGame *savefile ) {
	savefile->ReadInt ( shots );
	savefile->ReadInt ( strafeTime	);
	savefile->ReadBool ( strafeRight );
	savefile->ReadBool ( circleStrafing );
	savefile->ReadFloat ( deathPitch );
	savefile->ReadFloat ( deathRoll );
	savefile->ReadFloat ( deathPitchRate );
	savefile->ReadFloat ( deathYawRate );
	savefile->ReadFloat ( deathRollRate );
	savefile->ReadFloat ( deathSpeed );
	savefile->ReadFloat ( deathGrav );
	savefile->ReadInt	( markerCheckTime );

	savefile->ReadVec3( attackPosOffset );
	
//	actionRocketAttack.Restore ( savefile );
//	actionBlasterAttack.Restore ( savefile );
	actionMGunAttack.Restore ( savefile );
	actionMissileAttack.Restore ( savefile );
	actionBombAttack.Restore ( savefile );
	actionStrafe.Restore ( savefile );
	actionCircleStrafe.Restore ( savefile );
	
	InitSpawnArgsVariables();
	//NOTE: if the def file changes the the number of numHoverJoints, this will be BAD...
	for ( int i = 0; i < numHoverJoints; i++ ) {
		effectHover[i].Restore ( savefile );
	}
	
	effectDust.Restore ( savefile );
	effectHeadlight.Restore ( savefile );

	marker.Restore( savefile );
	savefile->ReadBool ( inPursuit );
	savefile->ReadInt ( holdPosTime );
	savefile->ReadInt ( nextMGunFireTime );
	savefile->ReadInt ( nextMissileFireTime );
	savefile->ReadInt ( nextBombFireTime );

	savefile->ReadRenderLight ( renderLight );
	savefile->ReadInt ( lightHandle );
	if ( lightHandle != -1 ) {
		//get the handle again as it's out of date after a restore!
		lightHandle = gameRenderWorld->AddLightDef( &renderLight );
	}

	savefile->ReadInt ( evadeDebounce );
}
/*
================
rvWeaponGauntlet::CleanupWeapon
================
*/
void rvWeaponGauntlet::CleanupWeapon( void ) {

	if ( impactEffect ) {
		impactEffect->Stop( );
		impactEffect = NULL;
	}
	impactMaterial = -1;
	PlayLoopSound( LOOP_NONE );
}
示例#5
0
/*
================
rvMonsterStroggHover::Save
================
*/
void rvMonsterStroggHover::Save ( idSaveGame *savefile ) const {
	savefile->WriteInt ( shots );
	savefile->WriteInt ( strafeTime	);
	savefile->WriteBool ( strafeRight );
	savefile->WriteBool ( circleStrafing );
	savefile->WriteFloat ( deathPitch );
	savefile->WriteFloat ( deathRoll );
	savefile->WriteFloat ( deathPitchRate );
	savefile->WriteFloat ( deathYawRate );
	savefile->WriteFloat ( deathRollRate );
	savefile->WriteFloat ( deathSpeed );
	savefile->WriteFloat ( deathGrav );
	savefile->WriteInt	( markerCheckTime );

	savefile->WriteVec3( attackPosOffset );
	
//	actionRocketAttack.Save ( savefile );
//	actionBlasterAttack.Save ( savefile );
	actionMGunAttack.Save ( savefile );
	actionMissileAttack.Save ( savefile );
	actionBombAttack.Save ( savefile );
	actionStrafe.Save ( savefile );
	actionCircleStrafe.Save ( savefile );
	
	for ( int i = 0; i < numHoverJoints; i++ ) {
		effectHover[i].Save ( savefile );
	}
	
	effectDust.Save ( savefile );
	effectHeadlight.Save ( savefile );

	marker.Save( savefile );
	savefile->WriteBool ( inPursuit );
	savefile->WriteInt ( holdPosTime );
	savefile->WriteInt ( nextMGunFireTime );
	savefile->WriteInt ( nextMissileFireTime );
	savefile->WriteInt ( nextBombFireTime );

	savefile->WriteRenderLight ( renderLight );
	savefile->WriteInt ( lightHandle );

	savefile->WriteInt( evadeDebounce );
}
示例#6
0
/*
================
rvMonsterStroggHover::OnDeath
================
*/
void rvMonsterStroggHover::OnDeath ( void ) {
	// Stop the dust effect
	if ( effectDust ) {
		effectDust->Stop ( );
		effectDust = NULL;
	}

	// Stop the hover effect
	for ( int i = 0; i < numHoverJoints; i++ ) {
		if ( effectHover[i] ) {
			effectHover[i]->Stop ( );
			effectHover[i] = NULL;
		}
	}

	idAI::OnDeath ( );
}
/*
================
rvWeaponGauntlet::StopBlade
================
*/
void rvWeaponGauntlet::StopBlade ( void ) {
	if ( viewModel ) {
		viewModel->GetAnimator()->SetJointAngularVelocity ( bladeJoint, bladeSpinSlow, gameLocal.time, bladeAccel ); 
	}
	
	if ( GetWorldModel() ) {
		GetWorldModel()->GetAnimator()->SetJointAngularVelocity ( bladeJoint_world, bladeSpinSlow, gameLocal.time, bladeAccel ); 
	}
	
	StopSound ( SND_CHANNEL_WEAPON, false );
//	StartSound ( "snd_blade_slow", SND_CHANNEL_ITEM, 0, false, NULL );
	
	if ( impactEffect ) {
		impactEffect->Stop ( );
		impactEffect = NULL;
	}
	impactMaterial = -1;
}
示例#8
0
/*
================
rvMonsterStroggHover::Collide
================
*/
bool rvMonsterStroggHover::Collide( const trace_t &collision, const idVec3 &velocity ) {
	if ( aifl.dead ) { 
		StopHeadlight();
		//stop headlight
		if ( effectHeadlight ) {
			effectHeadlight->Stop ( );
			effectHeadlight = NULL;
		}
		// Stop the crash & burn effect
		for ( int i = 0; i < numHoverJoints; i++ ) {
			if ( effectHover[i] ) {
				effectHover[i]->Stop ( );
				effectHover[i] = NULL;
			}
		}
		gameLocal.PlayEffect( spawnArgs, "fx_death", GetPhysics()->GetOrigin(), GetPhysics()->GetAxis() );
		SetState ( "State_Remove" );
		return false;
	}
	return idAI::Collide( collision, velocity );
}
void rvWeaponGauntlet::Attack ( void ) {
	trace_t		tr;	
	idEntity*	ent;
	int			knockback;
	bool		it;
	
	// Cast a ray out to the lock range
// RAVEN BEGIN
// ddynerman: multiple clip worlds
	gameLocal.TracePoint(	owner, tr, 
							playerViewOrigin, 
							playerViewOrigin + playerViewAxis[0] * 100, 
							MASK_SHOT_RENDERMODEL, owner );


// RAVEN END
	owner->WeaponFireFeedback( &weaponDef->dict );

	if ( tr.fraction >= 1.0f ) {
		if ( impactEffect ) {
			impactEffect->Stop ( );
			impactEffect = NULL;
		}
		impactMaterial = -1;
		PlayLoopSound( LOOP_NONE );
 		return;
	}
		
	// Entity we hit?
	ent = gameLocal.entities[tr.c.entityNum];

	// If the impact material changed then stop the impact effect 
	if ( (tr.c.materialType && tr.c.materialType->Index ( ) != impactMaterial) ||
		 (!tr.c.materialType && impactMaterial != -1) ) {
		if ( impactEffect ) {
			impactEffect->Stop ( );
			impactEffect = NULL;
		}
		impactMaterial = -1;
	}
	
	// In singleplayer-- the gauntlet never effects marine AI
	if( !gameLocal.isMultiplayer ) {
		idActor* actor_ent = 0;
		
		//ignore both the body and the head.
		if (ent->IsType( idActor::GetClassType()) )	{
			actor_ent = static_cast<idActor*>(ent);
		} else if (ent->IsType ( idAFAttachment::GetClassType()) )	{
			actor_ent = static_cast<idActor*>(ent->GetBindMaster());
		}
			
		if ( actor_ent && actor_ent->team == gameLocal.GetLocalPlayer()->team )	{
			PlayLoopSound( LOOP_NONE );
			return;
		}
	}

	//multiplayer-- don't gauntlet dead stuff
	if( gameLocal.isMultiplayer )	{
		idPlayer * player;
		if ( ent->IsType( idPlayer::GetClassType() )) {
			player = static_cast< idPlayer* >(ent);
			if (player->health <= 0)	{
				return;
			}
		}

	}
	if ( !impactEffect ) {
		impactMaterial = tr.c.materialType ? tr.c.materialType->Index() : -1;
		impactEffect = gameLocal.PlayEffect ( gameLocal.GetEffect ( spawnArgs, "fx_impact", tr.c.materialType ), tr.endpos, tr.c.normal.ToMat3(), true );
	} else {
		impactEffect->SetOrigin ( tr.endpos );
		impactEffect->SetAxis ( tr.c.normal.ToMat3() );
	}
	
	// Do damage?
	
		if ( gameLocal.time > nextAttackTime ) {					
			if ( ent ) {
				if ( ent->fl.takedamage ) {
					float dmgScale = 20.0f;
					knockback *= 100;
					dmgScale *= owner->PowerUpModifier( PMOD_MELEE_DAMAGE );
					if(ent->IsType( idPlayer::GetClassType() ) && (static_cast < idPlayer * >( ent )->it == false && owner->it == true))//ROCCORICCIARDI
					{
						ent->Damage ( owner, owner, playerViewAxis[0], spawnArgs.GetString ( "def_damage" ), 0.01f, 0 );
						owner->it = false;
						owner->ClearPowerUps();
						static_cast < idPlayer * >( ent )->it = true;
						static_cast < idPlayer * >( ent )->GivePowerUp( POWERUP_QUADDAMAGE, SEC2MS( 30.0f ) );//ROCCORICCIARDI
					}
					StartSound( "snd_hit", SND_CHANNEL_ANY, 0, false, NULL );
					if ( ent->spawnArgs.GetBool( "bleed" ) ) {
						PlayLoopSound( LOOP_FLESH );
					} else {
						PlayLoopSound( LOOP_WALL );
					}
				} else {
					PlayLoopSound( LOOP_WALL );
				}
			} else {
				PlayLoopSound( LOOP_NONE );
			}
			nextAttackTime = gameLocal.time + fireRate;
		
		
		}
		

}    
示例#10
0
/*
================
rvMonsterStroggHover::Think
================
*/
void rvMonsterStroggHover::Think ( void ) {
	idAI::Think ( );
	
	if ( !aifl.dead )
	{
		// If thinking we should play an effect on the ground under us
		if ( !fl.hidden && !fl.isDormant && (thinkFlags & TH_THINK ) && !aifl.dead ) {
			trace_t tr;
			idVec3	origin;
			idMat3	axis;
			
			// Project the effect 80 units down from the bottom of our bbox
			GetJointWorldTransform ( jointDust, gameLocal.time, origin, axis );
			
	// RAVEN BEGIN
	// ddynerman: multiple clip worlds
			gameLocal.TracePoint ( this, tr, origin, origin + axis[0] * (GetPhysics()->GetBounds()[0][2]+80.0f), CONTENTS_SOLID, this );
	// RAVEN END

			// Start the dust effect if not already started
			if ( !effectDust ) {
				effectDust = gameLocal.PlayEffect ( gameLocal.GetEffect ( spawnArgs, "fx_dust" ), tr.endpos, tr.c.normal.ToMat3(), true );
			}
			
			// If the effect is playing we should update its attenuation as well as its origin and axis
			if ( effectDust ) {
				effectDust->Attenuate ( 1.0f - idMath::ClampFloat ( 0.0f, 1.0f, (tr.endpos - origin).LengthFast ( ) / 127.0f ) );
				effectDust->SetOrigin ( tr.endpos );
				effectDust->SetAxis ( tr.c.normal.ToMat3() );
			}
			
			// If the hover effect is playing we can set its end origin to the ground
			/*
			if ( effectHover ) {
				effectHover->SetEndOrigin ( tr.endpos );
			}
			*/
		} else if ( effectDust ) {
			effectDust->Stop ( );
			effectDust = NULL;
		}

		//Try to circle strafe or pursue
		if ( circleStrafing )
		{
			CircleStrafe();
		}
		else if ( !inPursuit )
		{
			if ( !aifl.action && move.fl.done && !aifl.scripted )
			{
				if ( GetEnemy() )
				{
					if ( DistanceTo( GetEnemy() ) > 2000.0f 
						|| (GetEnemy()->GetPhysics()->GetLinearVelocity()*(GetEnemy()->GetPhysics()->GetOrigin()-GetPhysics()->GetOrigin())) > 1000.0f )
					{//enemy is far away or moving away from us at a pretty decent speed
						TryStartPursuit();
					}
				}
			}
		}
		else
		{
			Pursue();
		}

		//Dodge
		if ( !circleStrafing ) {
			if( combat.shotAtTime && gameLocal.GetTime() - combat.shotAtTime < 1000.0f ) {
				if ( nextBombFireTime < gameLocal.GetTime() - 3000 ) {
					if ( gameLocal.random.RandomFloat() > evadeChance ) {
						//40% chance of ignoring it - makes them dodge rockets less often but bullets more often?
						combat.shotAtTime = 0;
					} else if ( evadeDebounce < gameLocal.GetTime() ) {
						//ramps down from 400 to 100 over 1 second
						float speed = evadeSpeed - ((((float)(gameLocal.GetTime()-combat.shotAtTime))/1000.0f)*(evadeSpeed-(evadeSpeed*0.25f)));
						idVec3 evadeVel = viewAxis[1] * ((combat.shotAtAngle >= 0)?-1:1) * speed;
						evadeVel.z *= 0.5f;
						move.addVelocity += evadeVel;
						move.addVelocity.Normalize();
						move.addVelocity *= speed;
						/*
						if ( move.moveCommand < NUM_NONMOVING_COMMANDS ) {
							//just need to do it once?
							combat.shotAtTime = 0;
						}
						*/
						if ( evadeDebounceRate > 1 )
						{
							evadeDebounce = gameLocal.GetTime() + gameLocal.random.RandomInt( evadeDebounceRate ) + (ceil(((float)evadeDebounceRate)/2.0f));
						}
					}
				}
			}
		}

		//If using melee rush to nav to him, stop when we're close enough to attack
		if ( combat.tacticalCurrent == AITACTICAL_MELEE 
			&& move.moveCommand == MOVE_TO_ENEMY
			&& !move.fl.done
			&& nextBombFireTime < gameLocal.GetTime() - 3000
			&& enemy.fl.visible && DistanceTo( GetEnemy() ) < 2000.0f ) {
			StopMove( MOVE_STATUS_DONE );
			ForceTacticalUpdate();
		} else {
			//whenever we're not in the middle of something, force an update of our tactical
			if ( !aifl.action ) {
				if ( !aasFind ) {
					if ( move.fl.done ) {
						if ( !inPursuit && !circleStrafing ) {
							ForceTacticalUpdate();
						}
					}
				}
			}
		}
	}

	//update light
//	if ( lightOn ) {
		UpdateLightDef ( );
//	}
}