本文整理汇总了C++中MS2SEC函数的典型用法代码示例。如果您正苦于以下问题:C++ MS2SEC函数的具体用法?C++ MS2SEC怎么用?C++ MS2SEC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MS2SEC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResetShaderParms
/*
================
idEntityFx::ResetShaderParms
================
*/
void idEntityFx::ResetShaderParms( void ) {
if ( !fxEffect ) {
return;
}
for( int i = 0; i < fxEffect->events.Num(); i++ ) {
const idFXSingleAction& fxaction = fxEffect->events[i];
idFXLocalAction& laction = actions[i];
if ( laction.lightDefHandle != -1 && fxaction.sibling == -1 && fxaction.type != FX_ATTACHLIGHT ) {
laction.renderLight.shaderParms[ SHADERPARM_RED ] = fxaction.lightColor.x;
laction.renderLight.shaderParms[ SHADERPARM_GREEN ] = fxaction.lightColor.y;
laction.renderLight.shaderParms[ SHADERPARM_BLUE ] = fxaction.lightColor.z;
laction.renderLight.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( gameLocal.time );
}
if ( laction.modelDefHandle != -1 && fxaction.sibling == -1 && fxaction.type != FX_ATTACHENTITY ) {
laction.renderEntity.shaderParms[ SHADERPARM_RED ] = 1.0f;
laction.renderEntity.shaderParms[ SHADERPARM_GREEN ] = 1.0f;
laction.renderEntity.shaderParms[ SHADERPARM_BLUE ] = 1.0f;
if( manualFadeIsOn ){ //no need to reset it if we are not fading - this would make the particle to change position instantly
laction.renderEntity.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( gameLocal.time );
}
laction.renderEntity.shaderParms[ SHADERPARM_PARTICLE_STOPTIME ] = 0; //make particles to appear
}
}
}
示例2: assert
/*
================
rvClientEffect::Play
================
*/
bool rvClientEffect::Play ( int _startTime, bool _loop, const idVec3& endOrigin ) {
if ( !renderEffect.declEffect ) {
return false;
}
// Initialize the render entity
if ( bindMaster ) {
renderEntity_t* renderEnt = bindMaster->GetRenderEntity ( );
assert( renderEnt );
// Copy suppress values from parent entity
renderEffect.allowSurfaceInViewID = renderEnt->allowSurfaceInViewID;
renderEffect.suppressSurfaceInViewID = renderEnt->suppressSurfaceInViewID;
renderEffect.weaponDepthHackInViewID = renderEnt->weaponDepthHackInViewID;
}
renderEffect.shaderParms[SHADERPARM_RED] = 1.0f;
renderEffect.shaderParms[SHADERPARM_GREEN] = 1.0f;
renderEffect.shaderParms[SHADERPARM_BLUE] = 1.0f;
renderEffect.shaderParms[SHADERPARM_ALPHA] = 1.0f;
renderEffect.shaderParms[SHADERPARM_BRIGHTNESS] = 1.0f;
renderEffect.shaderParms[SHADERPARM_TIMEOFFSET] = MS2SEC( gameLocal.time );
renderEffect.hasEndOrigin = ( endOrigin != vec3_origin );
renderEffect.endOrigin = endOrigin;
renderEffect.loop = _loop;
assert( effectDefHandle < 0 );
renderEffect.startTime = MS2SEC( _startTime );
return true;
}
示例3: SetModel
/*
================
idLight::BecomeBroken
================
*/
void idLight::BecomeBroken( idEntity *activator ) {
const char *damageDefName;
fl.takedamage = false;
if ( brokenModel.Length() ) {
SetModel( brokenModel );
if ( !spawnArgs.GetBool( "nonsolid" ) ) {
GetPhysics()->SetClipModel( new idClipModel( brokenModel.c_str() ), 1.0f );
GetPhysics()->SetContents( CONTENTS_SOLID );
}
} else if ( spawnArgs.GetBool( "hideModelOnBreak" ) ) {
SetModel( "" );
GetPhysics()->SetContents( 0 );
}
if ( gameLocal.isServer ) {
ServerSendEvent( EVENT_BECOMEBROKEN, NULL, true, -1 );
if ( spawnArgs.GetString( "def_damage", "", &damageDefName ) ) {
idVec3 origin = renderEntity.origin + renderEntity.bounds.GetCenter() * renderEntity.axis;
gameLocal.RadiusDamage( origin, activator, activator, this, this, damageDefName );
}
}
ActivateTargets( activator );
// offset the start time of the shader to sync it to the game time
renderEntity.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( gameLocal.time );
renderLight.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( gameLocal.time );
// set the state parm
renderEntity.shaderParms[ SHADERPARM_MODE ] = 1;
renderLight.shaderParms[ SHADERPARM_MODE ] = 1;
// if the light has a sound, either start the alternate (broken) sound, or stop the sound
const char *parm = spawnArgs.GetString( "snd_broken" );
if ( refSound.shader || ( parm && *parm ) ) {
StopSound( SND_CHANNEL_ANY, false );
const idSoundShader *alternate = refSound.shader ? refSound.shader->GetAltSound() : declManager->FindSound( parm );
if ( alternate ) {
// start it with no diversity, so the leadin break sound plays
refSound.referenceSound->StartSound( alternate, SND_CHANNEL_ANY, 0.0, 0 );
}
}
parm = spawnArgs.GetString( "mtr_broken" );
if ( parm && *parm ) {
SetShader( parm );
}
UpdateVisuals();
}
示例4: 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();
}
示例5: RAD2DEG
/*
================
idForce_Drag::Evaluate
================
*/
void idForce_Drag::Evaluate( int time ) {
float l1, l2, mass;
idVec3 dragOrigin, dir1, dir2, velocity, centerOfMass;
idMat3 inertiaTensor;
idRotation rotation;
idClipModel *clipModel;
if ( !physics ) {
return;
}
clipModel = physics->GetClipModel( id );
if ( clipModel != NULL && clipModel->IsTraceModel() ) {
clipModel->GetMassProperties( 1.0f, mass, centerOfMass, inertiaTensor );
} else {
centerOfMass.Zero();
}
centerOfMass = physics->GetOrigin( id ) + centerOfMass * physics->GetAxis( id );
dragOrigin = physics->GetOrigin( id ) + p * physics->GetAxis( id );
dir1 = dragPosition - centerOfMass;
dir2 = dragOrigin - centerOfMass;
l1 = dir1.Normalize();
l2 = dir2.Normalize();
rotation.Set( centerOfMass, dir2.Cross( dir1 ), RAD2DEG( idMath::ACos( dir1 * dir2 ) ) );
physics->SetAngularVelocity( rotation.ToAngularVelocity() / MS2SEC( USERCMD_MSEC ), id );
velocity = physics->GetLinearVelocity( id ) * damping + dir1 * ( ( l1 - l2 ) * ( 1.0f - damping ) / MS2SEC( USERCMD_MSEC ) );
physics->SetLinearVelocity( velocity, id );
}
示例6: Event_Activate
END_CLASS
/*
================
idTarget_SetShaderTime::Event_Activate
================
*/
void idTarget_SetShaderTime::Event_Activate( idEntity *activator )
{
int i;
idEntity *ent;
float time;
time = -MS2SEC( gameLocal.time );
for( i = 0; i < targets.Num(); i++ )
{
ent = targets[ i ].GetEntity();
if( ent )
{
ent->SetShaderParm( SHADERPARM_TIMEOFFSET, time );
if( ent->IsType( idLight::Type ) )
{
static_cast<idLight *>( ent )->SetLightParm( SHADERPARM_TIMEOFFSET, time );
}
}
}
}
示例7: memset
/*
================
idExplodingBarrel::AddParticles
================
*/
void idExplodingBarrel::AddParticles( const char *name, bool burn ) {
if ( name && *name ) {
if ( particleModelDefHandle >= 0 ){
gameRenderWorld->FreeEntityDef( particleModelDefHandle );
}
memset( &particleRenderEntity, 0, sizeof ( particleRenderEntity ) );
const idDeclModelDef *modelDef = static_cast<const idDeclModelDef *>( declManager->FindType( DECL_MODELDEF, name ) );
if ( modelDef ) {
particleRenderEntity.origin = physicsObj.GetAbsBounds().GetCenter();
particleRenderEntity.axis = mat3_identity;
particleRenderEntity.hModel = modelDef->ModelHandle();
float rgb = ( burn ) ? 0.0f : 1.0f;
particleRenderEntity.shaderParms[ SHADERPARM_RED ] = rgb;
particleRenderEntity.shaderParms[ SHADERPARM_GREEN ] = rgb;
particleRenderEntity.shaderParms[ SHADERPARM_BLUE ] = rgb;
particleRenderEntity.shaderParms[ SHADERPARM_ALPHA ] = rgb;
particleRenderEntity.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( gameLocal.realClientTime );
particleRenderEntity.shaderParms[ SHADERPARM_DIVERSITY ] = ( burn ) ? 1.0f : gameLocal.random.RandomInt( 90 );
particleRenderEntity.suppressSurfaceInViewID = -8; // sikk - Depth Render
if ( !particleRenderEntity.hModel ) {
particleRenderEntity.hModel = renderModelManager->FindModel( name );
}
particleModelDefHandle = gameRenderWorld->AddEntityDef( &particleRenderEntity );
if ( burn ) {
BecomeActive( TH_THINK );
}
particleTime = gameLocal.realClientTime;
}
}
}
示例8: GetAxis
END_CLASS
void hhShuttleTransport::Spawn() {
dockingBeam = NULL;
dockedShuttle = NULL;
shuttleCount = 0;
bLocked = false;
amountHealth = spawnArgs.GetInt("amounthealth");
amountPower = spawnArgs.GetInt("amountpower");
bCanExitLocked = spawnArgs.GetBool("canExitLocked");
bLockOnEntry = spawnArgs.GetBool("lockOnEntry");
bAllowFiring = spawnArgs.GetBool("allowFiring");
offsetNozzle = spawnArgs.GetVector("offset_nozzle1");
// offsetNozzle2 = spawnArgs.GetVector("offset_nozzle2");
offsetShuttlePoint = spawnArgs.GetVector("offset_shuttlepoint");
// dockingBeam = SpawnDockingBeam(offsetNozzle);
dockingForce.SetRestoreFactor(spawnArgs.GetFloat("dockingforce"));
dockingForce.SetTarget(GetOrigin() + offsetShuttlePoint * GetAxis());
// Fade in
SetShaderParm(SHADERPARM_TIMEOFFSET, -MS2SEC(gameLocal.time)); // Growth start time
SetShaderParm(5, 1.0f); // Growth direction (in)
SetShaderParm(6, 1.0f); // Make Beam opaque
StartSound("snd_fadein", SND_CHANNEL_ANY);
}
示例9: if
/*
================
idEntityFx::SetupFade
================
*/
void idEntityFx::SetupFade( void ) {
int ieff;
if ( !fxEffect ) {
return;
}
for( ieff = 0; ieff < fxEffect->events.Num(); ieff++ ) {
const idFXSingleAction& fxaction = fxEffect->events[ieff];
idFXLocalAction& laction = actions[ieff];
// turn on the waiting ones
if ( laction.delay < 0 ) {
laction.start = gameLocal.time;
}
// turn off the ones which are not endless
else if( fxaction.duration != 0 ){ //duration = 0 means endless. Turn off -1 ones too!
laction.start = -1;
}
//turn off particles
if ( laction.modelDefHandle != -1 && fxaction.sibling == -1 && fxaction.type != FX_ATTACHENTITY ) {
laction.renderEntity.shaderParms[ SHADERPARM_PARTICLE_STOPTIME ] = MS2SEC( gameLocal.time );
}
}
}
示例10: explicitTS
/*
================
idExplodingBarrel::AddParticles
================
*/
void idExplodingBarrel::AddParticles( const char* name, bool burn )
{
if( name && *name )
{
int explicitTimeGroup = timeGroup;
SetTimeState explicitTS( explicitTimeGroup );
if( particleModelDefHandle >= 0 )
{
gameRenderWorld->FreeEntityDef( particleModelDefHandle );
}
memset( &particleRenderEntity, 0, sizeof( particleRenderEntity ) );
idRenderModel* modelDef = renderModelManager->FindModel( name );
if( modelDef )
{
particleRenderEntity.origin = physicsObj.GetAbsBounds().GetCenter();
particleRenderEntity.axis = mat3_identity;
particleRenderEntity.hModel = modelDef;
float rgb = ( burn ) ? 0.0f : 1.0f;
particleRenderEntity.shaderParms[ SHADERPARM_RED ] = rgb;
particleRenderEntity.shaderParms[ SHADERPARM_GREEN ] = rgb;
particleRenderEntity.shaderParms[ SHADERPARM_BLUE ] = rgb;
particleRenderEntity.shaderParms[ SHADERPARM_ALPHA ] = rgb;
particleRenderEntity.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( gameLocal.realClientTime );
particleRenderEntity.shaderParms[ SHADERPARM_DIVERSITY ] = ( burn ) ? 1.0f : gameLocal.random.RandomInt( 90 );
particleRenderEntity.timeGroup = explicitTimeGroup;
particleModelDefHandle = gameRenderWorld->AddEntityDef( &particleRenderEntity );
if( burn )
{
BecomeActive( TH_THINK );
}
particleTime = gameLocal.realClientTime;
}
}
}
示例11: va
/*
=================
idTestModel::TestModel_f
Creates a static modelDef in front of the current position, which
can then be moved around
=================
*/
void idTestModel::TestModel_f( const idCmdArgs &args ) {
idVec3 offset;
idStr name;
idPlayer * player;
const idDict * entityDef;
idDict dict;
player = gameLocal.GetLocalPlayer();
if ( !player || !gameLocal.CheatsOk() ) {
return;
}
// delete the testModel if active
if ( gameLocal.testmodel ) {
delete gameLocal.testmodel;
gameLocal.testmodel = NULL;
}
if ( args.Argc() < 2 ) {
return;
}
name = args.Argv( 1 );
entityDef = gameLocal.FindEntityDefDict( name, false );
if ( entityDef ) {
dict = *entityDef;
} else {
if ( declManager->FindType( DECL_MODELDEF, name, false ) ) {
dict.Set( "model", name );
} else {
// allow map models with underscore prefixes to be tested during development
// without appending an ase
if ( name[ 0 ] != '_' ) {
name.DefaultFileExtension( ".ase" );
}
if ( strstr( name, ".ma" ) || strstr( name, ".mb" ) ) {
idModelExport exporter;
exporter.ExportModel( name );
name.SetFileExtension( MD5_MESH_EXT );
}
if ( !renderModelManager->CheckModel( name ) ) {
gameLocal.Printf( "Can't register model\n" );
return;
}
dict.Set( "model", name );
}
}
offset = player->GetPhysics()->GetOrigin() + player->viewAngles.ToForward() * 100.0f;
dict.Set( "origin", offset.ToString() );
dict.Set( "angle", va( "%f", player->viewAngles.yaw + 180.0f ) );
dict.Set( "def_head", g_testModelHead.GetString());
gameLocal.testmodel = ( idTestModel * )gameLocal.SpawnEntityType( idTestModel::Type, &dict );
gameLocal.testmodel->renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] = -MS2SEC( gameLocal.time );
}
示例12: SetShaderParm
void hhShuttleTransport::Event_FadeOut() {
// Fade out
SetShaderParm(SHADERPARM_TIMEOFFSET, -MS2SEC(gameLocal.time)); // Growth start time
SetShaderParm(5, -1.0f); // Growth direction (out)
SetShaderParm(6, 0.0f); // Make Beam translucent
StartSound("snd_fadeout", SND_CHANNEL_ANY);
PostEventMS(&EV_Remove, 1000);
}
示例13: MS2SEC
void hhFuncEmitter::Hide() {
idStaticEntity::Hide();
renderEntity.shaderParms[SHADERPARM_PARTICLE_STOPTIME] = MS2SEC( gameLocal.time );
particleStartTime = -1;
BecomeInactive( TH_TICKER );
}
示例14: MS2SEC
/*
=====================
idTestModel::TestParticleStopTime_f
=====================
*/
void idTestModel::TestParticleStopTime_f( const idCmdArgs &args ) {
if ( !gameLocal.testmodel ) {
gameLocal.Printf( "No testModel active.\n" );
return;
}
gameLocal.testmodel->renderEntity.shaderParms[SHADERPARM_PARTICLE_STOPTIME] = MS2SEC( gameLocal.time );
gameLocal.testmodel->UpdateVisuals();
}
示例15: Show
void hhFuncEmitter::Show() {
idStaticEntity::Show();
renderEntity.shaderParms[SHADERPARM_PARTICLE_STOPTIME] = 0;
renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] = -MS2SEC( gameLocal.GetTime() );
particleStartTime = gameLocal.GetTime();
BecomeActive( TH_TICKER );
}