当前位置: 首页>>代码示例>>C++>>正文


C++ PostEventMS函数代码示例

本文整理汇总了C++中PostEventMS函数的典型用法代码示例。如果您正苦于以下问题:C++ PostEventMS函数的具体用法?C++ PostEventMS怎么用?C++ PostEventMS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PostEventMS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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 );
}
开发者ID:alepulver,项目名称:dhewm3,代码行数:16,代码来源:Fx.cpp

示例2: PostEventSec

/*
================
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 );
	}
}
开发者ID:alepulver,项目名称:dhewm3,代码行数:16,代码来源:Target.cpp

示例3: PostEventMS

/*
================
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 );
		}
	}
}
开发者ID:nbohr1more,项目名称:Revelation,代码行数:16,代码来源:Target.cpp

示例4: SEC2MS

/*
================
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 );
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:16,代码来源:SecurityCamera.cpp

示例5: RemoveShard

/*
================
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();
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:59,代码来源:BrittleFracture.cpp

示例6: GetAnimator

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 );
	}
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:12,代码来源:game_podspawner.cpp

示例7: PostEventMS

/*
================
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 );
	}
}
开发者ID:nbohr1more,项目名称:Revelation,代码行数:17,代码来源:Moveable.cpp

示例8: PostEventMS

END_CLASS

/*
================
idTarget_Give::Spawn
================
*/
void idTarget_Give::Spawn( void ) {
	if ( spawnArgs.GetBool( "onSpawn" ) ) {
		PostEventMS( &EV_Activate, 50 );
	}
}
开发者ID:alepulver,项目名称:dhewm3,代码行数:12,代码来源:Target.cpp

示例9: ActivateTargets

/*
================
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 );
	}
}
开发者ID:nbohr1more,项目名称:Revelation,代码行数:17,代码来源:Trigger.cpp

示例10: PostEventMS

/*
=====================
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);
}
开发者ID:chegestar,项目名称:omni-bot,代码行数:17,代码来源:Camera.cpp

示例11: GetPhysics

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);
    }
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:53,代码来源:game_animatedgui.cpp

示例12: ServerSendEvent

/*
================
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;
}
开发者ID:angjminer,项目名称:deamos,代码行数:58,代码来源:Item.cpp

示例13: SetOrigin

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();
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:53,代码来源:game_misc.cpp

示例14: MS2SEC

/*
================
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;
}
开发者ID:nbohr1more,项目名称:Revelation,代码行数:17,代码来源:SecurityCamera.cpp

示例15: 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);
	}
}
开发者ID:nbohr1more,项目名称:TheDarkMod_SVN_Unofficial-1,代码行数:40,代码来源:FrobLock.cpp


注:本文中的PostEventMS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。