本文整理汇总了C++中CancelEvents函数的典型用法代码示例。如果您正苦于以下问题:C++ CancelEvents函数的具体用法?C++ CancelEvents怎么用?C++ CancelEvents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CancelEvents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
//--------------------------------
// hhProxDoor::SetDoorState
//--------------------------------
void hhProxDoor::SetDoorState( EProxState doorState ) {
int i;
//HUMANHEAD PCF mdl 04/27/06 - Don't allow locked doors to become active
if ( doorLocked && doorState == PROXSTATE_Active ) {
return;
}
switch( doorState ) {
case PROXSTATE_Active:
BecomeActive( TH_TICKER );
CancelEvents( &EV_PollForExit );
PostEventMS( &EV_PollForExit, 500 );
OpenPortal();
break;
case PROXSTATE_GoingInactive:
break;
case PROXSTATE_Inactive:
// Guarantee the door is closed
for( i = 0; i < doorPieces.Num(); i++ ) {
if (doorPieces[i].IsValid()) {
doorPieces[ i ]->SetProximity( 0.0 );
}
}
ClosePortal();
CancelEvents( &EV_PollForExit );
BecomeInactive( TH_TICKER );
break;
}
proxState = doorState;
}
示例2: CancelEvents
/*
================
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 );
}
示例3: DrawFov
/*
================
idSecurityCamera::Think
================
*/
void idSecurityCamera::Think( void ) {
float pct;
float travel;
if( thinkFlags & TH_THINK ) {
if( g_showEntityInfo.GetBool() ) {
DrawFov();
}
if( health <= 0 ) {
BecomeInactive( TH_THINK );
return;
}
}
// run physics
RunPhysics();
if( thinkFlags & TH_THINK ) {
if( CanSeePlayer() ) {
if( alertMode == SCANNING ) {
float sightTime;
SetAlertMode( ALERT );
stopSweeping = gameLocal.time;
if( sweeping ) {
CancelEvents( &EV_SecurityCam_Pause );
} else {
CancelEvents( &EV_SecurityCam_ReverseSweep );
}
sweeping = false;
StopSound( SND_CHANNEL_ANY, false );
StartSound( "snd_sight", SND_CHANNEL_BODY, 0, false, NULL );
sightTime = spawnArgs.GetFloat( "sightTime", "5" );
PostEventSec( &EV_SecurityCam_Alert, sightTime );
}
} else {
if( alertMode == ALERT ) {
float sightResume;
SetAlertMode( LOSINGINTEREST );
CancelEvents( &EV_SecurityCam_Alert );
sightResume = spawnArgs.GetFloat( "sightResume", "1.5" );
PostEventSec( &EV_SecurityCam_ContinueSweep, sightResume );
}
if( sweeping ) {
idAngles a = GetPhysics()->GetAxis().ToAngles();
pct = ( gameLocal.time - sweepStart ) / ( sweepEnd - sweepStart );
travel = pct * sweepAngle;
if( negativeSweep ) {
a.yaw = angle + travel;
} else {
a.yaw = angle - travel;
}
SetAngles( a );
}
}
}
Present();
}
示例4: CancelEvents
/*
================
idSound::Event_Off
================
*/
void idSound::Event_Off( void ) {
if ( timerOn ) {
timerOn = false;
CancelEvents( &EV_Speaker_Timer );
}
DoSound( false );
}
示例5: CancelEvents
/*
================
idTrigger_Timer::Disable
================
*/
void idTrigger_Timer::Disable( void ) {
// if on, turn it off
if ( on ) {
on = false;
CancelEvents( &EV_Timer );
}
}
示例6: clipBounds
/*
=================
hhProjectileCrawlerGrenade::Event_ApplyExpandWound
=================
*/
void hhProjectileCrawlerGrenade::Event_ApplyExpandWound() {
trace_t trace;
if( !modelProxy.IsValid() || !modelProxy->GetCombatModel() ) {
return;
}
idBounds clipBounds( modelProxy->GetRenderEntity()->bounds );
idVec3 traceEnd = GetOrigin();
idVec3 traceStart = traceEnd + hhUtils::RandomPointInShell( clipBounds.Expand(1.0f).GetRadius(), clipBounds.Expand(2.0f).GetRadius() );
idVec3 jointOrigin, localOrigin, localNormal;
idMat3 jointAxis, axisTranspose;
jointHandle_t jointHandle = INVALID_JOINT;
CancelEvents( &EV_ApplyExpandWound );
PostEventSec( &EV_ApplyExpandWound, spawnArgs.GetFloat("expandWoundDelay") );
if( !gameLocal.clip.TracePoint(trace, traceStart, traceEnd, modelProxy->GetCombatModel()->GetContents(), NULL) ) {
return;
}
if( trace.c.entityNum != entityNumber ) {//Make sure we hit ourselves
return;
}
modelProxy->AddDamageEffect( trace, vec3_zero, spawnArgs.GetString("def_expandDamage"), (!fl.networkSync || netSyncPhysics) );
}
示例7: Step
/// Single forward execution step
void spec::Step()
{
Event *ev;
POSE_TimeType lastGVT = localPVT->getGVT();
int iter = 0;
if (!parent->cancels.IsEmpty()) CancelUnexecutedEvents();
if (eq->RBevent) Rollback();
if (!parent->cancels.IsEmpty()) CancelEvents();
parent->Status();
// Shorten the leash as we near POSE_endtime
if ((POSE_endtime > POSE_UnsetTS) && (lastGVT + timeLeash > POSE_endtime))
timeLeash = POSE_endtime - lastGVT + 1;
// Prepare to execute an event
ev = eq->currentPtr;
while ((ev->timestamp > POSE_UnsetTS) &&
(ev->timestamp <= lastGVT + timeLeash)) {
// do all events within the speculative window
iter++;
currentEvent = ev;
ev->done = 2;
parent->ResolveFn(ev->fnIdx, ev->msg); // execute it
ev->done = 1; // complete the event execution
eq->mem_usage++;
eq->ShiftEvent(); // shift to next event
ev = eq->currentPtr; // reset ev
}
#if !CMK_TRACE_DISABLED
if(pose_config.stats)
if (iter > 0) localStats->Loop();
#endif
}
示例8: ZeroPendingCount
//---------------------------------------------------------------------------
void TJS_INTF_METHOD tTJSNI_Timer::Invalidate()
{
tTVPTimerThread::Remove(this);
ZeroPendingCount();
CancelEvents();
inherited::Invalidate(); // this sets Owner = NULL
}
示例9: SetDoorState
//--------------------------------
// hhProxDoor::Event_PollForExit
//--------------------------------
void hhProxDoor::Event_PollForExit() {
if( PollClosestEntity() == -1.f ) {
SetDoorState( PROXSTATE_GoingInactive );
return;
}
CancelEvents( &EV_PollForExit );
PostEventMS( &EV_PollForExit, proxDoorRefreshMS );
}
示例10: SetAlertMode
/*
================
idSecurityCamera::Event_Alert
================
*/
void idSecurityCamera::Event_Alert( void ) {
float wait;
SetAlertMode( ACTIVATED );
StopSound( SND_CHANNEL_ANY, false );
StartSound( "snd_activate", SND_CHANNEL_BODY, 0, false, NULL );
ActivateTargets( this );
CancelEvents( &EV_SecurityCam_ContinueSweep );
wait = spawnArgs.GetFloat( "wait", "20" );
PostEventSec( &EV_SecurityCam_ContinueSweep, wait );
}
示例11: BecomeActive
/*
================
idItem::Event_Respawn
================
*/
void idItem::Event_Respawn( void ) {
BecomeActive( TH_THINK );
Show();
inViewTime = -1000;
lastCycle = -1;
GetPhysics()->SetContents( CONTENTS_TRIGGER );
SetOrigin( orgOrigin );
StartSound( "snd_respawn", SND_CHANNEL_ITEM, 0, false, NULL );
CancelEvents( &EV_RespawnItem ); // don't double respawn
}
示例12: SetupFade
/*
================
idEntityFx::FadeOutFx
================
*/
void idEntityFx::FadeOutFx( void ) {
if( started < 0 || manualFadeIsOn ){ //if not active or already fading
return;
}
manualFadeIsOn = true;
SetupFade();
if( endlessSounds ){
FadeSound( SND_CHANNEL_ANY, -60, 1 ); //fade out sounds
//gameLocal.Printf("fading sounds!");
}
if( manualRemove ){
CancelEvents( &EV_Activate ); // make sure it's not going to re-activate itself
CancelEvents( &EV_Fx_KillFx ); // make sure it's not going to kill or re-activate itself too soon
PostEventMS( &EV_Fx_KillFx, FadeDuration() );
}
}
示例13: CancelEvents
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);
}
}
示例14: ServerSendEvent
/*
================
idItem::Event_Respawn
================
*/
void idItem::Event_Respawn( void ) {
if ( gameLocal.isServer ) {
ServerSendEvent( EVENT_RESPAWN, NULL, false, -1 );
}
BecomeActive( TH_THINK );
Show();
inViewTime = -1000;
lastCycle = -1;
GetPhysics()->SetContents( CONTENTS_TRIGGER );
SetOrigin( orgOrigin );
StartSound( "snd_respawn", SND_CHANNEL_ITEM, 0, false, NULL );
CancelEvents( &EV_RespawnItem ); // don't double respawn
}
示例15: FreeSoundEmitter
/*
===============
idSound::UpdateChangableSpawnArgs
===============
*/
void idSound::UpdateChangeableSpawnArgs( const idDict *source )
{
idEntity::UpdateChangeableSpawnArgs( source );
if( source )
{
FreeSoundEmitter( true );
spawnArgs.Copy( *source );
idSoundEmitter *saveRef = refSound.referenceSound;
gameEdit->ParseSpawnArgsToRefSound( &spawnArgs, &refSound );
refSound.referenceSound = saveRef;
idVec3 origin;
idMat3 axis;
if( GetPhysicsToSoundTransform( origin, axis ) )
{
refSound.origin = GetPhysics()->GetOrigin() + origin * axis;
}
else
{
refSound.origin = GetPhysics()->GetOrigin();
}
spawnArgs.GetFloat( "random", "0", random );
spawnArgs.GetFloat( "wait", "0", wait );
if( ( wait > 0.0f ) && ( random >= wait ) )
{
random = wait - 0.001;
gameLocal.DWarning( "speaker '%s' at (%s) has random >= wait", name.c_str(), GetPhysics()->GetOrigin().ToString( 0 ) );
}
if( !refSound.waitfortrigger && ( wait > 0.0f ) )
{
timerOn = true;
DoSound( false );
CancelEvents( &EV_Speaker_Timer );
PostEventSec( &EV_Speaker_Timer, wait + gameLocal.random.CRandomFloat() * random );
}
else if( !refSound.waitfortrigger && !( refSound.referenceSound && refSound.referenceSound->CurrentlyPlaying() ) )
{
// start it if it isn't already playing, and we aren't waitForTrigger
DoSound( true );
timerOn = false;
}
}
}