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; } }
/* ================ 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 ( ); // } }