This repository has been archived on 2022-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
Xash3DArchive/client/global/r_tempents.h

89 lines
4.2 KiB
C++

//=======================================================================
// Copyright XashXT Group 2010 ©
// r_tempents.h - tempentities management
//=======================================================================
#ifndef R_TEMPENTS_H
#define R_TEMPENTS_H
//-----------------------------------------------------------------------------
// Purpose: implementation for temp entities
//-----------------------------------------------------------------------------
#include "tmpent_def.h"
#include "effects_api.h"
#define MAX_TEMP_ENTITIES 500
#define TENT_WIND_ACCEL 50
#define MAX_MUZZLEFLASH 4
#define SHARD_VOLUME 12.0 // on shard ever n^3 units
class CTempEnts
{
public:
CTempEnts( void );
virtual ~CTempEnts( void );
void Update( void );
void Clear( void );
void TE_Prepare( TEMPENTITY *pTemp, int modelIndex );
int TE_Active( TEMPENTITY *pTemp );
int TE_Update( TEMPENTITY *pTemp ); // return false for instantly die
void BloodSprite( const Vector &org, int colorIndex, int modelIndex, int modelIndex2, float size );
void RicochetSprite( const Vector &pos, int modelIndex, float scale );
void MuzzleFlash( cl_entity_t *pEnt, int iAttachment, int type );
void TempModel( const Vector &pos, const Vector &dir, const Vector &ang, float life, int modelIndex, int soundtype );
void BreakModel( const Vector &pos, const Vector &size, const Vector &dir, float random, float life, int count, int modelIndex, char flags );
void Bubbles( const Vector &mins, const Vector &maxs, float height, int modelIndex, int count, float speed );
void BubbleTrail( const Vector &start, const Vector &end, float height, int modelIndex, int count, float speed );
void Sprite_Explode( TEMPENTITY *pTemp, float scale, int flags );
void FizzEffect( cl_entity_t *pent, int modelIndex, int density );
TEMPENTITY *DefaultSprite( const Vector &pos, int spriteIndex, float framerate );
void Sprite_Smoke( TEMPENTITY *pTemp, float scale );
TEMPENTITY *TempSprite( const Vector &pos, const Vector &dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags );
void AttachTentToPlayer( int client, int modelIndex, float zoffset, float life );
void KillAttachedTents( int client );
void Sprite_Spray( const Vector &pos, const Vector &dir, int modelIndex, int count, int speed, int iRand, int renderMode = kRenderTransAlpha );
void Sprite_Trail( int type, const Vector &vecStart, const Vector &vecEnd, int modelIndex, int nCount, float flLife, float flSize, float flAmplitude, int nRenderamt, float flSpeed );
void RocketFlare( const Vector& pos );
void PlaySound( TEMPENTITY *pTemp, float damp );
void TracerEffect( const Vector &start, const Vector &end );
void WeaponFlash( cl_entity_t *pEnt, int iAttachment );
void PlaceDecal( Vector pos, int entityIndex, int decalIndex );
void PlaceDecal( Vector pos, int entityIndex, const char *decalname );
void AllocDLight( Vector pos, byte r, byte g, byte b, float radius, float time, float decay = 0.0f );
void AllocDLight( Vector pos, float radius, float time, float decay = 0.0f );
void RocketTrail( Vector start, Vector end, int type );
void Large_Funnel( Vector pos, int spriteIndex, int flags );
void DoSparks( const Vector& pos );
void StreakSplash( const Vector &pos, const Vector &dir, int color, int count, int speed, int velMin, int velMax );
// Data
private:
int m_iTempEntFrame; // used for keyed dlights only
// Global temp entity pool
TEMPENTITY m_TempEnts[MAX_TEMP_ENTITIES];
// Free and active temp entity lists
TEMPENTITY *m_pFreeTempEnts;
TEMPENTITY *m_pActiveTempEnts;
// muzzle flash sprites
int m_iMuzzleFlash[MAX_MUZZLEFLASH];
void TempEntFree( TEMPENTITY *pTemp, TEMPENTITY *pPrev );
bool FreeLowPriorityTempEnt( void );
public:
TEMPENTITY *TempEntAllocNoModel( const Vector& org );
TEMPENTITY *TempEntAlloc( const Vector& org, int modelindex );
TEMPENTITY *TempEntAllocHigh( const Vector& org, int modelIndex );
TEMPENTITY *TempEntAllocCustom( const Vector& org, int modelIndex, int high, ENTCALLBACK pfnCallback );
// misc utility shaders
HSPRITE hSprGlowShell; // glowshell shader
};
extern CTempEnts *g_pTempEnts;
#endif//R_TEMPENTS_H