Files
DoomRTX/neo/prey/Prey/prey_spiritsecret.cpp
2026-05-05 15:01:01 -07:00

73 lines
2.2 KiB
C++

//**************************************************************************
//**
//** PREY_SPIRITSECRET.CPP
//**
//** Game code for the spirit secret entities
//** Spirit secret entities are entities that are only visible
//** and blockable in normal mode.
//**************************************************************************
// HEADER FILES ------------------------------------------------------------
#include "precompiled.h"
#pragma hdrstop
#include "prey_local.h"
// MACROS ------------------------------------------------------------------
// TYPES -------------------------------------------------------------------
// CLASS DECLARATIONS ------------------------------------------------------
CLASS_DECLARATION( idEntity, hhSpiritSecret )
EVENT( EV_Activate, hhSpiritSecret::Event_Activate )
END_CLASS
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
// PUBLIC DATA DEFINITIONS -------------------------------------------------
// PRIVATE DATA DEFINITIONS ------------------------------------------------
// CODE --------------------------------------------------------------------
//==========================================================================
//
// hhSpiritSecret::Spawn
//
//==========================================================================
void hhSpiritSecret::Spawn(void) {
fl.takedamage = false;
if ( !spawnArgs.GetInt( "start_off" ) ) {
GetPhysics()->SetContents( CONTENTS_FORCEFIELD | CONTENTS_SHOOTABLE );
} else { // Start the secret off
GetPhysics()->SetContents( 0 );
Hide();
}
SetShaderParm( SHADERPARM_MODE, gameLocal.random.CRandomFloat() );
}
//==========================================================================
//
// hhSpiritSecret::Event_Activate
//
//==========================================================================
void hhSpiritSecret::Event_Activate( idEntity *activator ) {
if ( IsHidden() ) {
Show();
GetPhysics()->SetContents( CONTENTS_FORCEFIELD | CONTENTS_SHOOTABLE );
} else {
Hide();
GetPhysics()->SetContents( 0 );
}
}