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); }
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); }
END_CLASS /* =========== hhForceField::Spawn =========== */ void hhForceField::Spawn(void) { fl.takedamage = true; SetShaderParm( SHADERPARM_TIMEOFFSET, 1.0f ); SetShaderParm( SHADERPARM_MODE, 0.0f ); fade = 0.0f; activationRate = spawnArgs.GetFloat( "activationRate" ); deactivationRate = spawnArgs.GetFloat( "deactivationRate" ); undamageFadeRate = spawnArgs.GetFloat( "undamageFadeRate" ); // BecomeActive( TH_THINK|TH_TICKER ); cachedContents = CONTENTS_FORCEFIELD | CONTENTS_BLOCK_RADIUSDAMAGE | CONTENTS_SHOOTABLE; physicsObj.SetSelf( this ); if (spawnArgs.GetBool("isSimpleBox")) { // Simple boxes are cheaper and can be bound to other objects physicsObj.SetClipModel( new idClipModel(idTraceModel(GetPhysics()->GetBounds())), 1.0f ); physicsObj.SetContents( cachedContents ); physicsObj.SetOrigin( GetOrigin() ); physicsObj.SetAxis( GetAxis() ); SetPhysics( &physicsObj ); } else { // Non-simple has real per-poly collision with it's model, uses default static physics because we don't have a tracemodel. // This loses the activation of contacts on the object (so some things may not fall through when disabled), but in my tests, // the spirit proxy falls through fine. NOTE: To fix the movables, etc. not falling when these are turned off, I'm manually // Activating appropriate physics that overlap the bounds when Turned off. // physicsObj.SetClipModel( new idClipModel(GetPhysics()->GetClipModel()), 1.0f ); // physicsObj.SetContents( cachedContents ); // physicsObj.SetOrigin( GetOrigin() ); // physicsObj.SetAxis( GetAxis() ); // SetPhysics( &physicsObj ); // Apparently the flags need to be on the material to make projectiles hit these. GetPhysics()->SetContents(cachedContents); } EnterOnState(); damagedState = false; nextCollideFxTime = gameLocal.time; fl.networkSync = true; //always want to sync over the net }
//-------------------------------- // hhProxDoor::Lock //-------------------------------- void hhProxDoor::Lock( int f ) { doorLocked = f > 0 ? true : false; //HUMANHEAD PCF mdl 04/27/06 - Changed PROXSTATE_Inactive to PROXSTATE_GoingInactive SetDoorState( doorLocked ? PROXSTATE_GoingInactive : PROXSTATE_Active ); SetShaderParm( SHADERPARM_MODE, GetDoorShaderParm( doorLocked, false ) ); // 2=locked, 1=unlocked, 0=never locked StopSound( SND_CHANNEL_ANY ); }
END_CLASS void hhShuttleForceField::Spawn() { nextCollideFxTime = gameLocal.time; GetPhysics()->SetContents(CONTENTS_SOLID|CONTENTS_PLAYERCLIP); // Start in the on state fieldState = StateOn; fade.Init(gameLocal.time, 0, 1.0f, 1.0f); SetShaderParm(SHADERPARM_TIMEOFFSET, fade.GetCurrentValue(gameLocal.time)); fl.networkSync = true; //rww }
void hhWallWalkable::Think() { idEntity::Think(); if (thinkFlags & TH_THINK) { SetShaderParm(4, alphaOn.GetCurrentValue(gameLocal.time)); if (alphaOn.IsDone(gameLocal.time)) { BecomeInactive(TH_THINK); if (wallwalkOn) { } else { SetSkin( offSkin ); } } } }
/* ================ hhWeaponAutoCannon::Ticker ================ */ void hhWeaponAutoCannon::Ticker() { idVec3 boneOriginL, boneOriginR; idMat3 boneAxisL, boneAxisR; if( beamSystem.IsValid() ) { GetJointWorldTransform( sparkBoneL, boneOriginL, boneAxisL ); GetJointWorldTransform( sparkBoneR, boneOriginR, boneAxisR ); if( (boneOriginL - boneOriginR).Length() > sparkGapSize ) { if( !beamSystem->IsHidden() ) { beamSystem->Hide(); SetShaderParm( SHADERPARM_MODE, 0.0f ); } } else if ( owner->CanShowWeaponViewmodel() ) { if( beamSystem->IsHidden() ) { beamSystem->Show(); SetShaderParm( SHADERPARM_MODE, 1.0f ); } } beamSystem->SetOrigin( boneOriginL ); beamSystem->SetTargetLocation( boneOriginR ); } }
void hhShuttleForceField::Ticker() { SetShaderParm(SHADERPARM_TIMEOFFSET, fade.GetCurrentValue(gameLocal.time)); if (fade.IsDone(gameLocal.time)) { if (fieldState == StateTurningOn) { // Entering On state fieldState = StateOn; GetPhysics()->SetContents(CONTENTS_SOLID|CONTENTS_PLAYERCLIP); } else if (fieldState == StateTurningOff) { // Entering Off state fieldState = StateOff; GetPhysics()->SetContents(0); } BecomeInactive(TH_TICKER); } }
//-------------------------------- // hhProxDoor::Spawn //-------------------------------- void hhProxDoor::Spawn() { proxState = PROXSTATE_Inactive; doorSndState = PDOORSND_Closed; spawnArgs.GetBool( "startlocked", "0", doorLocked ); SetShaderParm( SHADERPARM_MODE, GetDoorShaderParm( doorLocked, true ) ); // 2=locked, 1=unlocked, 0=never locked if( !spawnArgs.GetFloat("trigger_distance", "0.0", maxDistance) ) { common->Warning( "No 'trigger_distance' specified for entityDef '%s'", this->GetEntityDefName() ); } if( !spawnArgs.GetFloat("movement_distance", "0.0", movementDistance) ) { common->Warning( "No 'movement_distance' specified for entityDef '%s'", this->GetEntityDefName() ); } lastDistance = movementDistance + 1.0f; // Safe default -mdl if( !spawnArgs.GetFloat("stop_distance", "0.0", stopDistance) ) { common->Warning( "No 'stop_distance' specificed for entityDef '%s'", this->GetEntityDefName() ); } spawnArgs.GetBool( "openForMonsters", "1", openForMonsters ); spawnArgs.GetFloat( "damage", "1", damage ); //Find any portal boundary we are on areaPortal = gameRenderWorld->FindPortal( GetPhysics()->GetAbsBounds() ); if (gameLocal.isMultiplayer) { fl.networkSync = true; if (gameLocal.isClient) { doorTrigger = new idClipModel( idTraceModel(idBounds(vec3_origin).Expand(maxDistance)) ); doorTrigger->Link( gameLocal.clip, this, 255, GetOrigin(), GetAxis() ); doorTrigger->SetContents( CONTENTS_TRIGGER ); SetAASAreaState( doorLocked ); //close the area state if we are locked... SetDoorState( PROXSTATE_Inactive ); } else { PostEventMS( &EV_PostSpawn, 50 ); //rww - this must be delayed or it will happen on the first server frame and we DON'T want that. } } else { //just call it now. some sp maps might target a door piece in the spawn function of an entity or something crazy like that. Event_PostSpawn(); } }
/* ================ rvMonsterGrunt::RageStart ================ */ void rvMonsterGrunt::RageStart ( void ) { SetShaderParm ( 6, 1 ); // Disable non-rage actions actionEvadeLeft.fl.disabled = true; actionEvadeRight.fl.disabled = true; // Speed up animations animator.SetPlaybackRate ( 1.25f ); // Disable pain pain.threshold = 0; // Start over with health when enraged health = spawnArgs.GetInt ( "health" ); // No more going to rage rageThreshold = 0; }
void hhShuttleTransport::DetachShuttle(hhShuttle *shuttle) { assert (shuttle==dockedShuttle); if (dockedShuttle != NULL) { dockingForce.SetEntity(NULL); if (dockingBeam) { dockingBeam->SetTargetEntity(NULL); dockingBeam->Activate( false ); } dockedShuttle->SetDock(NULL); dockedShuttle->FinishRecharging(); dockedShuttle = NULL; StartSound("snd_getout", SND_CHANNEL_ANY); StopSound(SND_CHANNEL_DOCKED); Unlock(); // Shouldn't get in here when locked except when a shuttle dies within BecomeInactive(TH_THINK); // Keep thinking so the restore position is updated SetShaderParm(6, 1.0f); // Make beam opaque } }
void hhShuttleTransport::AttachShuttle(hhShuttle *shuttle) { if (dockedShuttle == NULL) { dockedShuttle = shuttle; dockingForce.SetEntity(dockedShuttle); if (dockingBeam) { dockingBeam->SetTargetEntity(dockedShuttle, 0, dockedShuttle->spawnArgs.GetVector("offset_dockingpoint")); dockingBeam->Activate( true ); } dockedShuttle->SetDock(this); dockedShuttle->InitiateRecharging(); StartSound("snd_getin", SND_CHANNEL_ANY); StartSound("snd_looper", SND_CHANNEL_DOCKED); if (bLockOnEntry) { Lock(); } ActivateTargets( shuttle ); // Fire triggers BecomeActive(TH_THINK); SetShaderParm(6, 0.0f); // Make beam transparent } }
END_CLASS void hhWallWalkable::Spawn( void ) { wallwalkOn = spawnArgs.GetBool("active"); flicker = spawnArgs.GetBool("flicker"); // Get skin references (already precached) onSkin = declManager->FindSkin( spawnArgs.GetString("skinOn") ); offSkin = declManager->FindSkin( spawnArgs.GetString("skinOff") ); if (wallwalkOn) { SetSkin( onSkin ); alphaOn.Init(gameLocal.time, 0, 1.0f, 1.0f); } else { SetSkin( offSkin ); alphaOn.Init(gameLocal.time, 0, 0.0f, 0.0f); } alphaOn.SetHermiteParms(WALLWALK_HERM_S1, WALLWALK_HERM_S2); SetShaderParm(4, alphaOn.GetCurrentValue(gameLocal.time)); UpdateVisuals(); fl.networkSync = true; }
/* =========== hhForceField::EnterDamagedState =========== */ void hhForceField::EnterDamagedState() { damagedState = true; fade = 1.0f; SetShaderParm( SHADERPARM_MODE, fade ); // Instantly change to the new shader BecomeActive( TH_TICKER ); }
/* =========== hhForceField::Ticker =========== */ void hhForceField::Ticker( void ) { if( fieldState == StatePreTurningOn ) { idEntity* entityList[MAX_GENTITIES]; idEntity* entity = NULL; idPhysics* physics = NULL; int numEntities = 0; int numEntitiesImpulseAppliedTo = 0; idVec3 force = DetermineForce() * GetAxis(); numEntities = gameLocal.clip.EntitiesTouchingBounds( GetPhysics()->GetAbsBounds(), MASK_SOLID, entityList, MAX_GENTITIES ); for( int ix = 0; ix < numEntities; ++ix ) { entity = entityList[ix]; if( !entity ) { continue; } if( entity == this ) { continue; } //Removing mass from any calculations regarding impulse entity->ApplyImpulse( this, 0, entity->GetOrigin(), force * entity->GetPhysics()->GetMass() ); numEntitiesImpulseAppliedTo++; } --applyImpulseAttempts; if( !numEntitiesImpulseAppliedTo || !applyImpulseAttempts ) { fieldState = StateTurningOn; GetPhysics()->SetContents( cachedContents ); SetSkin( NULL ); StartSound( "snd_start", SND_CHANNEL_ANY ); Show(); EnterTurningOnState(); } } else if( fieldState == StateTurningOn ) { float deltaTime = MS2SEC( gameLocal.msec ); renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] += activationRate * deltaTime; if( renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] >= 1.0f ) { EnterOnState(); } UpdateVisuals(); } else if( fieldState == StateTurningOff ) { float deltaTime = MS2SEC( gameLocal.msec ); renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] -= deactivationRate * deltaTime; if( renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] <= 0.0f ) { EnterOffState(); } UpdateVisuals(); } if( damagedState ) { float deltaTime = MS2SEC( gameLocal.msec ); // Fade parm back to normal fade -= undamageFadeRate * deltaTime; if ( fade <= 0.0f ) { // Finished fading fade = 0; damagedState = false; } SetShaderParm( SHADERPARM_MODE, fade ); } if (!damagedState && (fieldState==StateOn || fieldState==StateOff)) { BecomeInactive( TH_TICKER ); } }
void hhControlHand::PutAway( void ) { hhHand::PutAway(); SetShaderParm(4, -MS2SEC(gameLocal.time)); // time SetShaderParm(5, -1.0f); // Dir }
void hhControlHand::Raise( void ) { hhHand::Raise(); SetShaderParm(4, -MS2SEC(gameLocal.time)); // time SetShaderParm(5, 1.0f); // Dir }
/* ================ rvMonsterGrunt::RageStop ================ */ void rvMonsterGrunt::RageStop ( void ) { SetShaderParm ( 6, 0 ); }
/* ================ hhWeaponAutoCannon::SetHeatLevel ================ */ void hhWeaponAutoCannon::SetHeatLevel( const float heatLevel ) { this->heatLevel = heatLevel; SetShaderParm( SHADERPARM_MISC, heatLevel ); }