/* ================ idDamagingFx::Restart ================ */ void idDamagingFx::Restart( void ) { //gameLocal.Printf("idDamagingFx::Restart\n"); CancelEvents( &EV_Activate ); CancelEvents( &EV_Fx_KillFx ); ResetShaderParms(); //gameLocal.Printf("Restart\n"); nextTriggerTime = 0; //make sure the event is accepted PostEventMS( &EV_Activate, 0, this ); }
/* ================ idThread::DelayedStart ================ */ void idThread::DelayedStart( int delay ) { CancelEvents( &EV_Thread_Execute ); if ( gameLocal.time <= 0 ) { delay++; } if ( guiThread ) { PostGUIEventMS( &EV_Thread_Execute, delay ); } else { PostEventMS( &EV_Thread_Execute, delay ); } }
/* ================ idTarget_Tip::Event_Activate ================ */ void idTarget_Tip::Event_Activate( idEntity *activator ) { idPlayer *player = gameLocal.GetLocalPlayer(); if ( player ) { if ( player->IsTipVisible() ) { PostEventSec( &EV_Activate, 5.1f, activator ); return; } player->ShowTip( spawnArgs.GetString( "text_title" ), spawnArgs.GetString( "text_tip" ), false ); PostEventMS( &EV_GetPlayerPos, 2000 ); } }
/* ================ idTarget_Tip::Event_TipOff ================ */ void idTarget_Tip::Event_TipOff( void ) { idPlayer *player = gameLocal.GetLocalPlayer(); if( player ) { idVec3 v = player->GetPhysics()->GetOrigin() - playerPos; if( v.Length() > 96.0f ) { player->HideTip(); } else { PostEventMS( &EV_TipOff, 100 ); } } }
/* ================ idSecurityCamera::StartSweep ================ */ void idSecurityCamera::StartSweep() { int speed; sweeping = true; sweepStart = gameLocal.time; speed = SEC2MS( SweepSpeed() ); sweepEnd = sweepStart + speed; PostEventMS( &EV_SecurityCam_Pause, speed ); StartSound( "snd_moving", SND_CHANNEL_BODY, 0, false, NULL ); }
/* ================ idBrittleFracture::Think ================ */ void idBrittleFracture::Think( void ) { int i, startTime, endTime, droppedTime; shard_t *shard; bool atRest = true, fading = false; // remove overdue shards for( i = 0; i < shards.Num(); i++ ) { droppedTime = shards[i]->droppedTime; if( droppedTime != -1 ) { if( gameLocal.time - droppedTime > SHARD_ALIVE_TIME ) { RemoveShard( i ); i--; } fading = true; } } // remove the entity when nothing is visible if( !shards.Num() ) { PostEventMS( &EV_Remove, 0 ); return; } if( thinkFlags & TH_PHYSICS ) { startTime = gameLocal.previousTime; endTime = gameLocal.time; // run physics on shards for( i = 0; i < shards.Num(); i++ ) { shard = shards[i]; if( shard->droppedTime == -1 ) { continue; } shard->physicsObj.Evaluate( endTime - startTime, endTime ); if( !shard->physicsObj.IsAtRest() ) { atRest = false; } } if( atRest ) { BecomeInactive( TH_PHYSICS ); } else { BecomeActive( TH_PHYSICS ); } } if( !atRest || bounds.IsCleared() ) { bounds.Clear(); for( i = 0; i < shards.Num(); i++ ) { bounds.AddBounds( shards[i]->clipModel->GetAbsBounds() ); } } if( fading ) { BecomeActive( TH_UPDATEVISUALS | TH_THINK ); } else { BecomeInactive( TH_THINK ); } RunPhysics(); Present(); }
void hhPodSpawner::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location ) { // Don't actually take damage, but give feedback // Play pain if (painAnim) { GetAnimator()->ClearAllAnims(gameLocal.time, 0); GetAnimator()->PlayAnim(ANIMCHANNEL_ALL, painAnim, gameLocal.time, 500); int opentime = GetAnimator()->GetAnim( painAnim )->Length(); PostEventMS( &EV_PlayIdle, opentime ); StartSound( "snd_pain", SND_CHANNEL_ANY ); } }
/* ================ idExplodingBarrel::Damage ================ */ void idExplodingBarrel::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location ) { const idDict *damageDef = gameLocal.FindEntityDefDict( damageDefName ); if( !damageDef ) { gameLocal.Error( "Unknown damageDef '%s'\n", damageDefName ); } if( damageDef->FindKey( "radius" ) && GetPhysics()->GetContents() != 0 && GetBindMaster() == NULL ) { PostEventMS( &EV_Explode, 400 ); } else { idEntity::Damage( inflictor, attacker, dir, damageDefName, damageScale, location ); } }
END_CLASS /* ================ idTarget_Give::Spawn ================ */ void idTarget_Give::Spawn( void ) { if ( spawnArgs.GetBool( "onSpawn" ) ) { PostEventMS( &EV_Activate, 50 ); } }
/* ================ idTrigger_EntityName::TriggerAction ================ */ void idTrigger_EntityName::TriggerAction( idEntity *activator ) { ActivateTargets( activator ); CallScript(); if( wait >= 0 ) { nextTriggerTime = gameLocal.time + SEC2MS( wait + random * gameLocal.random.CRandomFloat() ); } else { // we can't just remove (this) here, because this is a touch function // called while looping through area links... nextTriggerTime = gameLocal.time + 1; PostEventMS( &EV_Remove, 0 ); } }
/* ===================== idCameraView::Spawn ===================== */ void idCameraView::Spawn( void ) { // if no target specified use ourself const char *cam = spawnArgs.GetString("cameraTarget"); if ( strlen ( cam ) == 0) { spawnArgs.Set("cameraTarget", spawnArgs.GetString("name")); } fov = spawnArgs.GetFloat("fov", "90"); PostEventMS( &EV_Camera_SetAttachments, 0 ); UpdateChangeableSpawnArgs(NULL); }
END_CLASS //========================================================================== // // hhAnimatedGui::Spawn // //========================================================================== void hhAnimatedGui::Spawn(void) { idDict args; GetPhysics()->SetContents( CONTENTS_BODY ); idleOpenAnim = GetAnimator()->GetAnim("idleopen"); idleCloseAnim = GetAnimator()->GetAnim("idleclose"); openAnim = GetAnimator()->GetAnim("open"); closeAnim = GetAnimator()->GetAnim("close"); bOpen = false; guiScale.Init(gameLocal.time, 0, AG_SMALL_SCALE, AG_SMALL_SCALE); // Spawn and bind the console on const char *consoleName = spawnArgs.GetString("def_gui"); if (consoleName && *consoleName) { args.Clear(); args.Set("gui", spawnArgs.GetString("gui_topass")); args.Set("origin", GetOrigin().ToString()); // need the joint position args.Set("rotation", GetAxis().ToString()); attachedConsole = gameLocal.SpawnObject(consoleName, &args); assert(attachedConsole); attachedConsole->SetOrigin(GetOrigin() + GetAxis()[0]*10); attachedConsole->Bind(this, true); attachedConsole->Hide(); } // Spawn the trigger const char *triggerName = spawnArgs.GetString("def_trigger"); if (triggerName && *triggerName) { args.Clear(); args.Set( "target", name.c_str() ); args.Set( "mins", spawnArgs.GetString("triggerMins") ); args.Set( "maxs", spawnArgs.GetString("triggerMaxs") ); args.Set( "bind", name.c_str() ); args.SetVector( "origin", GetOrigin() ); args.SetMatrix( "rotation", GetAxis() ); idEntity *trigger = gameLocal.SpawnObject( triggerName, &args ); } if (idleOpenAnim && idleCloseAnim) { PostEventMS(&EV_PlayIdle, 0); } }
/* ================ idItem::Pickup ================ */ bool idItem::Pickup( idPlayer *player ) { if ( !GiveToPlayer( player ) ) { return false; } if ( gameLocal.isServer ) { ServerSendEvent( EVENT_PICKUP, NULL, false, -1 ); } // play pickup sound StartSound( "snd_acquire", SND_CHANNEL_ITEM, 0, false, NULL ); // trigger our targets ActivateTargets( player ); // clear our contents so the object isn't picked up twice GetPhysics()->SetContents( 0 ); // hide the model Hide(); // add the highlight shell if ( itemShellHandle != -1 ) { gameRenderWorld->FreeEntityDef( itemShellHandle ); itemShellHandle = -1; } float respawn = spawnArgs.GetFloat( "respawn" ); bool dropped = spawnArgs.GetBool( "dropped" ); bool no_respawn = spawnArgs.GetBool( "no_respawn" ); if ( gameLocal.isMultiplayer && respawn == 0.0f ) { respawn = 20.0f; } if ( respawn && !dropped && !no_respawn ) { const char *sfx = spawnArgs.GetString( "fxRespawn" ); if ( sfx && *sfx ) { PostEventSec( &EV_RespawnFx, respawn - 0.5f ); } PostEventSec( &EV_RespawnItem, respawn ); } else if ( !spawnArgs.GetBool( "inv_objective" ) && !no_respawn ) { // give some time for the pickup sound to play // FIXME: Play on the owner if ( !spawnArgs.GetBool( "inv_carry" ) ) { PostEventMS( &EV_Remove, 5000 ); } } BecomeInactive( TH_THINK ); return true; }
void hhDeathWraithEnergy::Ticker() { float theta; float radius; float z; if (!thePlayer.IsValid()) { return; } float alpha = (MS2SEC(gameLocal.time) - startTime) / duration; if (alpha < 1.0f) { if (thePlayer->DeathWalkStage2()) { SetOrigin( spline.GetValue(alpha) ); } else { radius = startRadius + alpha*(endRadius-startRadius); theta = startTheta + alpha*(endTheta-startTheta); z = startZ + alpha * (endZ - startZ); idVec3 locationRelativeToCenter = CylindricalToCartesian(radius, theta, z); idEntity *destEntity = thePlayer->GetDeathwalkEnergyDestination(); if (destEntity) { centerPosition = destEntity->GetOrigin(); } SetOrigin(centerPosition + locationRelativeToCenter); } } else if (!IsHidden()) { Hide(); StopSound(SND_CHANNEL_BODY); bool energyHealth = spawnArgs.GetBool("healthEnergy"); idEntity *dwProxy = thePlayer->GetDeathwalkEnergyDestination(); if (dwProxy) { // Spawn arrival effect StartSound("snd_arrival", SND_CHANNEL_ANY); dwProxy->SetShaderParm(SHADERPARM_TIMEOFFSET, -MS2SEC(gameLocal.time) ); dwProxy->SetShaderParm(SHADERPARM_MODE, energyHealth ? 2 : 1 ); } // Notify the player thePlayer->DeathWraithEnergyArived(energyHealth); PostEventMS(&EV_Remove, 5000); } hhPathEmitter::Ticker(); }
/* ================ idSecurityCamera::Event_ContinueSweep ================ */ void idSecurityCamera::Event_ContinueSweep( void ) { float pct = ( stopSweeping - sweepStart ) / ( sweepEnd - sweepStart ); float f = gameLocal.time - ( sweepEnd - sweepStart ) * pct; int speed; sweepStart = f; speed = MS2SEC( SweepSpeed() ); sweepEnd = sweepStart + speed; PostEventMS( &EV_SecurityCam_Pause, speed * ( 1.0 - pct ) ); StartSound( "snd_moving", SND_CHANNEL_BODY, 0, false, NULL ); SetAlertMode( SCANNING ); sweeping = true; }
/* ================ idTarget_SetInfluence::Spawn ================ */ void idTarget_SetInfluence::Spawn() { PostEventMS( &EV_GatherEntities, 0 ); flashIn = spawnArgs.GetFloat( "flashIn", "0" ); flashOut = spawnArgs.GetFloat( "flashOut", "0" ); flashInSound = spawnArgs.GetString( "snd_flashin" ); flashOutSound = spawnArgs.GetString( "snd_flashout" ); delay = spawnArgs.GetFloat( "delay" ); soundFaded = false; restoreOnTrigger = false; // always allow during cinematics cinematic = true; }
void CFrobLock::Event_Lock_OnLockStatusChange(int locked) { // Cancel any pending events CancelEvents(&EV_TDM_FrobLock_TriggerLockTargets); CancelEvents(&EV_TDM_FrobLock_TriggerUnlockTargets); CancelEvents(&EV_TDM_FrobLock_TriggerTargets); if (locked == 0) { // Unlocked UnlockTargets(); FrobLockStartSound("snd_unlock"); if (spawnArgs.GetBool("trigger_targets_on_unlock", "1")) { // Get the delay for triggering the event int delay = spawnArgs.GetInt("unlock_trigger_delay", "0"); PostEventMS(&EV_TDM_FrobLock_TriggerUnlockTargets, delay); } } else { // We're locked now CloseAndLockTargets(); FrobLockStartSound("snd_lock"); if (spawnArgs.GetBool("trigger_targets_on_lock", "1")) { int delay = spawnArgs.GetInt("lock_trigger_delay", "0"); PostEventMS(&EV_TDM_FrobLock_TriggerLockTargets, delay); } } // Fire ordinary targets in any case if (spawnArgs.GetBool("trigger_targets", "0")) { int delay = spawnArgs.GetInt("trigger_delay", "0"); PostEventMS(&EV_TDM_FrobLock_TriggerTargets, delay); } }
/* ================ idThread::Execute ================ */ bool idThread::Execute( void ) { idThread *oldThread; bool done; if ( manualControl && ( waitingUntil > gameLocal.time ) ) { return false; } oldThread = currentThread; currentThread = this; lastExecuteTime = gameLocal.time; ClearWaitFor(); done = interpreter.Execute(); if ( done ) { End(); if ( interpreter.terminateOnExit ) { PostEventMS( &EV_Remove, 0 ); } } else if ( !manualControl ) { if ( waitingUntil > lastExecuteTime ) { PostEventMS( &EV_Thread_Execute, waitingUntil - lastExecuteTime ); } else if ( interpreter.MultiFrameEventInProgress() ) { PostEventMS( &EV_Thread_Execute, gameLocal.msec ); } } currentThread = oldThread; return done; }
void CFrobLock::Spawn() { m_Lock = static_cast<PickableLock*>(PickableLock::CreateInstance()); m_Lock->SetOwner(this); m_Lock->SetLocked(false); // Load the lock spawnargs m_Lock->InitFromSpawnargs(spawnArgs); // Schedule a post-spawn event to parse the rest of the spawnargs // greebo: Be sure to use 16 ms as delay to allow the SpawnBind event to execute before this one. PostEventMS(&EV_PostSpawn, 16); }
/* ============ idMoveableItem::Gib ============ */ void idMoveableItem::Gib(const idVec3 &dir, const char *damageDefName) { // spawn smoke puff const char *smokeName = spawnArgs.GetString("smoke_gib"); if (*smokeName != '\0') { const idDeclParticle *smoke = static_cast<const idDeclParticle *>(declManager->FindType(DECL_PARTICLE, smokeName)); gameLocal.smokeParticles->EmitSmoke(smoke, gameLocal.time, gameLocal.random.CRandomFloat(), renderEntity.origin, renderEntity.axis); } // remove the entity PostEventMS(&EV_Remove, 0); }
// // Event_AnimDone() // void hhAISpawnCase::Event_AnimDone( int animIndex ) { // Call back first hhAnimated::Event_AnimDone(animIndex); const char *n = NULL; // Door is OPEN, now we queue up the CLOSE anim if(triggerToggle) { n = spawnArgs.GetString("anim_retrigger"); // Should we automatically retrigger? (ie. close the door after it was opened?) if(spawnArgs.GetFloat("auto_retrigger_delay", "-1") >= 0.0f ) { int delay = SEC2MS(spawnArgs.GetFloat("auto_retrigger_delay", "-1")); waitingForAutoTrigger = TRUE; PostEventMS(&EV_AutoTrigger, delay); } } // Door is CLOSED, now we queue up the OPEN anim else { // If we have queued triggers saved up - then lets fire one now since we are now closed if(triggerQueue > 0) { triggerQueue--; PostEventMS(&EV_Activate, 0, this); //gameLocal.Printf("\nQUEUED TRIGGERS: %i", triggerQueue); } n = spawnArgs.GetString("anim"); int maxMonsters = spawnArgs.GetInt("max_monsters", "1"); if(maxMonsters < 0 || aiSpawnCount < maxMonsters) { Event_CreateAI(); } else { //gameLocal.Printf("\nMax monsters reached."); } } anim = GetAnimator()->GetAnim( n ); HH_ASSERT( anim ); }
/* ===================== idCameraView::Spawn ===================== */ void idCameraView::Spawn( void ) { // if no target specified use ourself const char *cam = spawnArgs.GetString("cameraTarget"); if ( strlen ( cam ) == 0) { spawnArgs.Set("cameraTarget", spawnArgs.GetString("name")); } fov.Init( gameLocal.time, 0.f, 0.f, 0.f, 90.f, spawnArgs.GetFloat("fov", "90") ); PostEventMS( &EV_Camera_SetAttachments, 0 ); bPlayerBoundCamera = spawnArgs.GetBool("playerBoundCamera"); // HUMANHEAD pdm UpdateChangeableSpawnArgs(NULL); }
/* ================ idBrittleFracture::Spawn ================ */ void idBrittleFracture::Spawn( void ) { // get shard properties decalMaterial = declManager->FindMaterial( spawnArgs.GetString( "mtr_decal" ) ); decalSize = spawnArgs.GetFloat( "decalSize", "40" ); maxShardArea = spawnArgs.GetFloat( "maxShardArea", "200" ); maxShardArea = idMath::ClampFloat( 100, 10000, maxShardArea ); maxShatterRadius = spawnArgs.GetFloat( "maxShatterRadius", "40" ); minShatterRadius = spawnArgs.GetFloat( "minShatterRadius", "10" ); linearVelocityScale = spawnArgs.GetFloat( "linearVelocityScale", "0.1" ); angularVelocityScale = spawnArgs.GetFloat( "angularVelocityScale", "40" ); fxFracture = spawnArgs.GetString( "fx" ); // get rigid body properties shardMass = spawnArgs.GetFloat( "shardMass", "20" ); shardMass = idMath::ClampFloat( 0.001f, 1000.0f, shardMass ); spawnArgs.GetFloat( "density", "0.1", density ); density = idMath::ClampFloat( 0.001f, 1000.0f, density ); spawnArgs.GetFloat( "friction", "0.4", friction ); friction = idMath::ClampFloat( 0.0f, 1.0f, friction ); spawnArgs.GetFloat( "bouncyness", "0.01", bouncyness ); bouncyness = idMath::ClampFloat( 0.0f, 1.0f, bouncyness ); disableFracture = spawnArgs.GetBool( "disableFracture", "0" ); health = spawnArgs.GetInt( "health", "40" ); fl.takedamage = true; // FIXME: set "bleed" so idProjectile calls AddDamageEffect spawnArgs.SetBool( "bleed", 1 ); CreateFractures( renderEntity.hModel ); FindNeighbours(); renderEntity.hModel = renderModelManager->AllocModel(); renderEntity.hModel->InitEmpty( brittleFracture_SnapshotName ); renderEntity.callback = idBrittleFracture::ModelCallback; renderEntity.noShadow = true; renderEntity.noSelfShadow = true; renderEntity.noDynamicInteractions = false; // Dark Mod: see if we are on a visportal m_AreaPortal = gameRenderWorld->FindPortal( GetPhysics()->GetAbsBounds() ); // schedule updating the sound loss for after soundprop gameplay has initialized PostEventMS( &EV_UpdateSoundLoss, 20 ); // grayman #3042 - wait for 20ms instead of 0, // to give portal entities time to spawn and // run their post-spawn }
/* ================ idTrigger_Multi::TriggerAction ================ */ void idTrigger_Multi::TriggerAction( idEntity *activator ) { ActivateTargets( triggerWithSelf ? this : activator ); CallScript(); if ( wait >= 0 ) { nextTriggerTime = gameLocal.time + SEC2MS( wait + random * gameLocal.random.CRandomFloat() ); } else { // we can't just remove (this) here, because this is a touch function // called while looping through area links... // If the player spawned inside the trigger, the player Spawn function called Think directly, // allowing for multiple triggers on a trigger_once. Increasing the nextTriggerTime prevents it. nextTriggerTime = gameLocal.time + 99999; PostEventMS( &EV_Remove, 0 ); } }
END_CLASS void hhPodSpawner::Spawn(void) { fl.takedamage = false; GetPhysics()->SetContents( CONTENTS_BODY ); pod = NULL; spawning = false; idleAnim = GetAnimator()->GetAnim("idle"); painAnim = GetAnimator()->GetAnim("pain"); spawnAnim = GetAnimator()->GetAnim("spawn"); PostEventMS(&EV_PlayIdle, 0); }
/* ================ idObjective::Event_HideObjective ================ */ void idObjective::Event_HideObjective(idEntity *e) { // Nicemice: added if ( gameLocal.isServer ) { ServerSendEvent( EVENT_HIDEOBJECTIVE, NULL, false, -1); } idPlayer *player = gameLocal.GetLocalPlayer(); if ( !gameLocal.isMultiplayer ) { if ( !player ) { PostEventMS( &EV_Remove, 0 ); return; } idVec3 v = player->GetPhysics()->GetOrigin() - playerPos; if ( v.Length() > 64.0f ) { player->HideObjective(); PostEventMS( &EV_Remove, 0 ); } else { PostEventMS( &EV_HideObjective, 100, player ); } } else { // Nicemice: here we differ between multiplayer and singleplayer. // In singleplayer the objective will be hidden when the player // moves 64 units away from its origin. // Since we don't want to calculate the distance to each player // we just hide the objective after a timelimit if ( player ) { player->HideObjective(); } PostEventMS( &EV_Remove, 100 ); } }
/* ================ idExplodingBarrel::Damage ================ */ void idExplodingBarrel::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location, trace_t *tr ) { const idDict *damageDef = gameLocal.FindEntityDefDict( damageDefName, true ); // grayman #3391 - don't create a default 'damageDef' // We want 'false' here, but FindEntityDefDict() // will print its own warning, so let's not // clutter the console with a redundant message if( !damageDef ) { gameLocal.Error( "Unknown damageDef '%s'\n", damageDefName ); } if( damageDef->FindKey( "radius" ) && GetPhysics()->GetContents() != 0 && GetBindMaster() == NULL ) { PostEventMS( &EV_Explode, 400 ); } else { idEntity::Damage( inflictor, attacker, dir, damageDefName, damageScale, location, tr ); } }
/* ================ idItem::Pickup ================ */ bool idItem::Pickup( idPlayer *player ) { if ( !GiveToPlayer( player ) ) { return false; } // play pickup sound StartSound( "snd_acquire", SND_CHANNEL_ITEM, 0, false, NULL ); // sikk - play the sounds through the player //player->StartSoundShader( declManager->FindSound( spawnArgs.GetString( "snd_acquire" ) ), SND_CHANNEL_ITEM, SSF_PRIVATE_SOUND, false, NULL ); // trigger our targets ActivateTargets( player ); // clear our contents so the object isn't picked up twice GetPhysics()->SetContents( 0 ); // hide the model Hide(); FreeLightDef(); // sikk - Crumb Light // add the highlight shell if ( itemShellHandle != -1 ) { gameRenderWorld->FreeEntityDef( itemShellHandle ); itemShellHandle = -1; } float respawn = spawnArgs.GetFloat( "respawn" ); bool dropped = spawnArgs.GetBool( "dropped" ); bool no_respawn = spawnArgs.GetBool( "no_respawn" ); if ( respawn && !dropped && !no_respawn ) { const char *sfx = spawnArgs.GetString( "fxRespawn" ); if ( sfx && *sfx ) { PostEventSec( &EV_RespawnFx, respawn - 0.5f ); } PostEventSec( &EV_RespawnItem, respawn ); } else if ( !spawnArgs.GetBool( "inv_objective" ) && !no_respawn ) { // give some time for the pickup sound to play // FIXME: Play on the owner if ( !spawnArgs.GetBool( "inv_carry" ) ) { PostEventMS( &EV_Remove, 5000 ); } } BecomeInactive( TH_THINK ); return true; }
/* ================ idTrigger_EntityName::TriggerAction ================ */ void idTrigger_EntityName::TriggerAction( idEntity *activator ) { // RAVEN BEGIN // abahr: want same functionality as trigger_multi. Need to move this code into these two function calls idEntity* scriptEntity = spawnArgs.GetBool("triggerWithSelf") ? this : activator; ActivateTargets( scriptEntity ); CallScript( scriptEntity ); // RAVEN END if ( wait >= 0 ) { nextTriggerTime = gameLocal.time + SEC2MS( wait + random * gameLocal.random.CRandomFloat() ); } else { // we can't just remove (this) here, because this is a touch function // called while looping through area links... nextTriggerTime = gameLocal.time + 1; PostEventMS( &EV_Remove, 0 ); } }
void idTrembler::Reset( void ) { StopSound( SND_CHANNEL_ANY, false ); renderEntity.shaderParms[ SHADERPARM_RED ] = 0; renderEntity.shaderParms[ SHADERPARM_GREEN ] = 0.7f; renderEntity.shaderParms[ SHADERPARM_BLUE ] = 1; UpdateVisuals(); state = -1; int resettime = spawnArgs.GetInt("armtime"); Event_PlayAnim("idle", 1); PostEventMS( &EV_TremblerArm, resettime ); //give a little delay to let physics settle the objects down. }