2008-12-25 22:00:00 +01:00
|
|
|
|
//=======================================================================
|
|
|
|
|
// Copyright XashXT Group 2008 <20>
|
|
|
|
|
// dll_int.cpp - dll entry points
|
|
|
|
|
//=======================================================================
|
|
|
|
|
|
|
|
|
|
#include "extdll.h"
|
2009-01-22 22:00:00 +01:00
|
|
|
|
#include "utils.h"
|
2009-08-22 22:00:00 +02:00
|
|
|
|
#include "ref_params.h"
|
2010-07-08 22:00:00 +02:00
|
|
|
|
#include "studio.h"
|
2008-12-25 22:00:00 +01:00
|
|
|
|
#include "hud.h"
|
2010-03-15 22:00:00 +01:00
|
|
|
|
#include "aurora.h"
|
2010-08-20 22:00:00 +02:00
|
|
|
|
#include "r_efx.h"
|
2009-10-20 22:00:00 +02:00
|
|
|
|
#include "r_particle.h"
|
2010-03-14 22:00:00 +01:00
|
|
|
|
#include "r_tempents.h"
|
2010-03-06 22:00:00 +01:00
|
|
|
|
#include "r_beams.h"
|
2009-12-02 22:00:00 +01:00
|
|
|
|
#include "ev_hldm.h"
|
2009-12-08 22:00:00 +01:00
|
|
|
|
#include "r_weather.h"
|
2010-08-12 22:00:00 +02:00
|
|
|
|
#include "pm_shared.h"
|
2010-08-15 22:00:00 +02:00
|
|
|
|
#include "pm_movevars.h"
|
|
|
|
|
#include "entity_types.h"
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
2010-08-19 22:00:00 +02:00
|
|
|
|
cl_enginefuncs_t gEngfuncs;
|
2010-02-23 22:00:00 +01:00
|
|
|
|
movevars_t *gpMovevars = NULL;
|
2010-08-12 22:00:00 +02:00
|
|
|
|
int g_iPlayerClass;
|
|
|
|
|
int g_iTeamNumber;
|
|
|
|
|
int g_iUser1;
|
|
|
|
|
int g_iUser2;
|
|
|
|
|
int g_iUser3;
|
2008-12-25 22:00:00 +01:00
|
|
|
|
CHud gHUD;
|
|
|
|
|
|
|
|
|
|
// main DLL entry point
|
|
|
|
|
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
|
|
|
|
|
{
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static HUD_FUNCTIONS gFunctionTable =
|
|
|
|
|
{
|
|
|
|
|
HUD_VidInit,
|
|
|
|
|
HUD_Init,
|
|
|
|
|
HUD_Redraw,
|
2010-08-07 22:00:00 +02:00
|
|
|
|
HUD_UpdateClientData,
|
2010-08-12 22:00:00 +02:00
|
|
|
|
HUD_GetHullBounds,
|
2010-08-07 22:00:00 +02:00
|
|
|
|
HUD_TxferLocalOverrides,
|
2010-08-12 22:00:00 +02:00
|
|
|
|
HUD_ProcessPlayerState,
|
2010-03-10 22:00:00 +01:00
|
|
|
|
HUD_UpdateOnRemove,
|
2008-12-25 22:00:00 +01:00
|
|
|
|
HUD_Reset,
|
2010-03-09 22:00:00 +01:00
|
|
|
|
HUD_StartFrame,
|
2008-12-25 22:00:00 +01:00
|
|
|
|
HUD_Frame,
|
|
|
|
|
HUD_Shutdown,
|
2009-12-07 22:00:00 +01:00
|
|
|
|
HUD_RenderCallback,
|
2008-12-25 22:00:00 +01:00
|
|
|
|
HUD_CreateEntities,
|
2010-03-14 22:00:00 +01:00
|
|
|
|
HUD_AddVisibleEntity,
|
2008-12-25 22:00:00 +01:00
|
|
|
|
HUD_StudioEvent,
|
2009-09-17 22:00:00 +02:00
|
|
|
|
HUD_StudioFxTransform,
|
2008-12-25 22:00:00 +01:00
|
|
|
|
V_CalcRefdef,
|
2009-12-05 22:00:00 +01:00
|
|
|
|
PM_Move, // pfnPM_Move
|
|
|
|
|
PM_Init, // pfnPM_Init
|
|
|
|
|
PM_FindTextureType, // pfnPM_FindTextureType
|
|
|
|
|
HUD_CmdStart,
|
|
|
|
|
HUD_CmdEnd,
|
|
|
|
|
IN_CreateMove,
|
|
|
|
|
IN_MouseEvent,
|
|
|
|
|
IN_KeyEvent,
|
|
|
|
|
VGui_ConsolePrint,
|
2010-08-16 22:00:00 +02:00
|
|
|
|
HUD_ParticleEffect,
|
|
|
|
|
HUD_TempEntityMessage,
|
|
|
|
|
HUD_DirectorMessage,
|
2008-12-25 22:00:00 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
|
// GetApi
|
|
|
|
|
//=======================================================================
|
2010-08-20 22:00:00 +02:00
|
|
|
|
int CreateAPI( HUD_FUNCTIONS *pFunctionTable, cl_enginefuncs_t* pEngfuncsFromEngine )
|
2008-12-25 22:00:00 +01:00
|
|
|
|
{
|
2009-01-11 22:00:00 +01:00
|
|
|
|
if( !pFunctionTable || !pEngfuncsFromEngine )
|
2008-12-25 22:00:00 +01:00
|
|
|
|
{
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// copy HUD_FUNCTIONS table to engine, copy engfuncs table from engine
|
|
|
|
|
memcpy( pFunctionTable, &gFunctionTable, sizeof( HUD_FUNCTIONS ));
|
2010-08-19 22:00:00 +02:00
|
|
|
|
memcpy( &gEngfuncs, pEngfuncsFromEngine, sizeof( cl_enginefuncs_t ));
|
2010-03-07 22:00:00 +01:00
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int HUD_VidInit( void )
|
|
|
|
|
{
|
2010-08-20 22:00:00 +02:00
|
|
|
|
// always keep movevars an actual
|
|
|
|
|
gpMovevars = gEngfuncs.pfnGetMovementVariables();
|
|
|
|
|
|
2010-03-15 22:00:00 +01:00
|
|
|
|
if ( g_pParticleSystems )
|
2009-10-20 22:00:00 +02:00
|
|
|
|
g_pParticleSystems->ClearSystems();
|
2009-12-08 22:00:00 +01:00
|
|
|
|
|
2010-03-15 22:00:00 +01:00
|
|
|
|
if ( g_pViewRenderBeams )
|
2010-03-06 22:00:00 +01:00
|
|
|
|
g_pViewRenderBeams->ClearBeams();
|
|
|
|
|
|
2010-03-15 22:00:00 +01:00
|
|
|
|
if ( g_pParticles )
|
|
|
|
|
g_pParticles->Clear();
|
|
|
|
|
|
2010-03-14 22:00:00 +01:00
|
|
|
|
if ( g_pTempEnts )
|
|
|
|
|
g_pTempEnts->Clear();
|
|
|
|
|
|
2009-12-08 22:00:00 +01:00
|
|
|
|
ResetRain ();
|
2009-10-20 22:00:00 +02:00
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
gHUD.VidInit();
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-14 22:00:00 +01:00
|
|
|
|
void HUD_ShutdownEffects( void )
|
2008-12-25 22:00:00 +01:00
|
|
|
|
{
|
2009-10-20 22:00:00 +02:00
|
|
|
|
if ( g_pParticleSystems )
|
|
|
|
|
{
|
|
|
|
|
// init partsystem
|
|
|
|
|
delete g_pParticleSystems;
|
|
|
|
|
g_pParticleSystems = NULL;
|
|
|
|
|
}
|
2009-12-08 22:00:00 +01:00
|
|
|
|
|
2010-03-06 22:00:00 +01:00
|
|
|
|
if ( g_pViewRenderBeams )
|
|
|
|
|
{
|
|
|
|
|
// init render beams
|
|
|
|
|
delete g_pViewRenderBeams;
|
|
|
|
|
g_pViewRenderBeams = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-15 22:00:00 +01:00
|
|
|
|
if ( g_pParticles )
|
|
|
|
|
{
|
|
|
|
|
// init particles
|
|
|
|
|
delete g_pParticles;
|
|
|
|
|
g_pParticles = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-14 22:00:00 +01:00
|
|
|
|
if ( g_pTempEnts )
|
|
|
|
|
{
|
|
|
|
|
// init client tempents
|
|
|
|
|
delete g_pTempEnts;
|
|
|
|
|
g_pTempEnts = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HUD_Init( void )
|
|
|
|
|
{
|
2010-08-19 22:00:00 +02:00
|
|
|
|
gEngfuncs.pfnAddCommand ("noclip", NULL, "enable or disable no clipping mode" );
|
|
|
|
|
gEngfuncs.pfnAddCommand ("notarget", NULL, "notarget mode (monsters do not see you)" );
|
|
|
|
|
gEngfuncs.pfnAddCommand ("fullupdate", NULL, "re-init HUD on start demo recording" );
|
|
|
|
|
gEngfuncs.pfnAddCommand ("give", NULL, "give specified item or weapon" );
|
|
|
|
|
gEngfuncs.pfnAddCommand ("drop", NULL, "drop current/specified item or weapon" );
|
|
|
|
|
gEngfuncs.pfnAddCommand ("intermission", NULL, "go to intermission" );
|
|
|
|
|
gEngfuncs.pfnAddCommand ("spectate", NULL, "enable spectator mode" );
|
|
|
|
|
gEngfuncs.pfnAddCommand ("gametitle", NULL, "show game logo" );
|
|
|
|
|
gEngfuncs.pfnAddCommand ("god", NULL, "classic cheat" );
|
|
|
|
|
gEngfuncs.pfnAddCommand ("fov", NULL, "set client field of view" );
|
2010-03-14 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
HUD_ShutdownEffects ();
|
|
|
|
|
|
2009-10-20 22:00:00 +02:00
|
|
|
|
g_pParticleSystems = new ParticleSystemManager();
|
2010-03-06 22:00:00 +01:00
|
|
|
|
g_pViewRenderBeams = new CViewRenderBeams();
|
2010-03-15 22:00:00 +01:00
|
|
|
|
g_pParticles = new CParticleSystem();
|
2010-03-14 22:00:00 +01:00
|
|
|
|
g_pTempEnts = new CTempEnts();
|
2010-03-06 22:00:00 +01:00
|
|
|
|
|
2009-12-08 22:00:00 +01:00
|
|
|
|
InitRain(); // init weather system
|
2009-10-20 22:00:00 +02:00
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
gHUD.Init();
|
2009-01-22 22:00:00 +01:00
|
|
|
|
|
2009-12-05 22:00:00 +01:00
|
|
|
|
IN_Init ();
|
2009-12-02 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
// link all events
|
|
|
|
|
EV_HookEvents ();
|
2008-12-25 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-12 22:00:00 +02:00
|
|
|
|
/*
|
|
|
|
|
================================
|
|
|
|
|
HUD_GetHullBounds
|
|
|
|
|
|
|
|
|
|
Engine calls this to enumerate player collision hulls, for prediction.
|
|
|
|
|
Return 0 if the hullnumber doesn't exist.
|
|
|
|
|
================================
|
|
|
|
|
*/
|
|
|
|
|
int HUD_GetHullBounds( int hullnumber, float *mins, float *maxs )
|
|
|
|
|
{
|
|
|
|
|
int iret = 0;
|
|
|
|
|
|
|
|
|
|
switch( hullnumber )
|
|
|
|
|
{
|
|
|
|
|
case 0: // Normal player
|
2010-08-16 22:00:00 +02:00
|
|
|
|
VEC_HULL_MIN.CopyToArray( mins );
|
|
|
|
|
VEC_HULL_MAX.CopyToArray( maxs );
|
2010-08-12 22:00:00 +02:00
|
|
|
|
iret = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 1: // Crouched player
|
2010-08-16 22:00:00 +02:00
|
|
|
|
VEC_DUCK_HULL_MIN.CopyToArray( mins );
|
|
|
|
|
VEC_DUCK_HULL_MAX.CopyToArray( maxs );
|
2010-08-12 22:00:00 +02:00
|
|
|
|
iret = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 2: // Point based hull
|
2010-08-16 22:00:00 +02:00
|
|
|
|
g_vecZero.CopyToArray( mins );
|
|
|
|
|
g_vecZero.CopyToArray( maxs );
|
2010-08-12 22:00:00 +02:00
|
|
|
|
iret = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return iret;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-07 22:00:00 +02:00
|
|
|
|
/*
|
|
|
|
|
==========================
|
|
|
|
|
HUD_UpdateClientData
|
|
|
|
|
|
|
|
|
|
called every time shared client
|
|
|
|
|
dll/engine data gets changed,
|
|
|
|
|
and gives the cdll a chance
|
|
|
|
|
to modify the data.
|
|
|
|
|
|
|
|
|
|
returns 1 if anything has been changed, 0 otherwise.
|
|
|
|
|
==========================
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int HUD_UpdateClientData( client_data_t *pcldata, float flTime )
|
|
|
|
|
{
|
|
|
|
|
return gHUD.UpdateClientData( pcldata, flTime );
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-15 22:00:00 +02:00
|
|
|
|
int HUD_Redraw( float flTime, int intermission )
|
2008-12-25 22:00:00 +01:00
|
|
|
|
{
|
2010-08-15 22:00:00 +02:00
|
|
|
|
gHUD.Redraw( flTime );
|
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-28 22:00:00 +02:00
|
|
|
|
/*
|
|
|
|
|
=========================
|
|
|
|
|
HUD_UpdateClientVars
|
|
|
|
|
|
|
|
|
|
The server sends us our origin with extra precision as part of the clientdata structure, not during the normal
|
|
|
|
|
playerstate update in entity_state_t. In order for these overrides to eventually get to the appropriate playerstate
|
|
|
|
|
structure, we need to copy them into the state structure at this point.
|
|
|
|
|
=========================
|
|
|
|
|
*/
|
2010-08-07 22:00:00 +02:00
|
|
|
|
void HUD_TxferLocalOverrides( entity_state_t *state, const clientdata_t *client )
|
2010-06-28 22:00:00 +02:00
|
|
|
|
{
|
2010-08-07 22:00:00 +02:00
|
|
|
|
state->origin = client->origin;
|
2010-08-04 22:00:00 +02:00
|
|
|
|
|
2010-06-28 22:00:00 +02:00
|
|
|
|
// Spectator
|
2010-08-07 22:00:00 +02:00
|
|
|
|
state->iuser1 = client->iuser1;
|
|
|
|
|
state->iuser2 = client->iuser2;
|
2010-06-28 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
// Duck prevention
|
2010-08-07 22:00:00 +02:00
|
|
|
|
state->iuser3 = client->iuser3;
|
2010-06-28 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
// Fire prevention
|
2010-08-07 22:00:00 +02:00
|
|
|
|
state->iuser4 = client->iuser4;
|
|
|
|
|
|
|
|
|
|
// FIXME: move this stuff into TxferPredictionData when it will be done
|
|
|
|
|
|
|
|
|
|
// Spectating or not dead == get control over view angles.
|
|
|
|
|
g_iAlive = ( client->iuser1 || ( client->deadflag == DEAD_NO ) ) ? 1 : 0;
|
2010-08-15 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
// FIXME: temporary hack so gaitsequence it's works properly
|
|
|
|
|
state->velocity = client->velocity;
|
2010-06-28 22:00:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-12 22:00:00 +02:00
|
|
|
|
/*
|
|
|
|
|
=========================
|
|
|
|
|
HUD_ProcessPlayerState
|
|
|
|
|
|
|
|
|
|
We have received entity_state_t for this player over the network. We need to copy appropriate fields to the
|
|
|
|
|
playerstate structure
|
|
|
|
|
=========================
|
|
|
|
|
*/
|
|
|
|
|
void HUD_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src )
|
|
|
|
|
{
|
|
|
|
|
// Copy in network data
|
|
|
|
|
dst->origin = src->origin;
|
|
|
|
|
dst->angles = src->angles;
|
|
|
|
|
|
|
|
|
|
dst->velocity = src->velocity;
|
|
|
|
|
|
|
|
|
|
dst->frame = src->frame;
|
|
|
|
|
dst->modelindex = src->modelindex;
|
|
|
|
|
dst->skin = src->skin;
|
|
|
|
|
dst->effects = src->effects;
|
|
|
|
|
dst->weaponmodel = src->weaponmodel;
|
|
|
|
|
dst->movetype = src->movetype;
|
|
|
|
|
dst->sequence = src->sequence;
|
|
|
|
|
dst->animtime = src->animtime;
|
|
|
|
|
|
|
|
|
|
dst->solid = src->solid;
|
|
|
|
|
|
|
|
|
|
dst->rendermode = src->rendermode;
|
|
|
|
|
dst->renderamt = src->renderamt;
|
|
|
|
|
dst->rendercolor.r = src->rendercolor.r;
|
|
|
|
|
dst->rendercolor.g = src->rendercolor.g;
|
|
|
|
|
dst->rendercolor.b = src->rendercolor.b;
|
|
|
|
|
dst->renderfx = src->renderfx;
|
|
|
|
|
|
|
|
|
|
dst->framerate = src->framerate;
|
|
|
|
|
dst->body = src->body;
|
|
|
|
|
|
|
|
|
|
memcpy( &dst->controller[0], &src->controller[0], 4 * sizeof( byte ) );
|
|
|
|
|
memcpy( &dst->blending[0], &src->blending[0], 2 * sizeof( byte ) );
|
|
|
|
|
|
|
|
|
|
dst->basevelocity = src->basevelocity;
|
|
|
|
|
|
|
|
|
|
dst->friction = src->friction;
|
|
|
|
|
dst->gravity = src->gravity;
|
|
|
|
|
dst->gaitsequence = src->gaitsequence;
|
|
|
|
|
dst->spectator = src->spectator;
|
|
|
|
|
dst->usehull = src->usehull;
|
|
|
|
|
dst->playerclass = src->playerclass;
|
|
|
|
|
dst->team = src->team;
|
|
|
|
|
dst->colormap = src->colormap;
|
|
|
|
|
|
|
|
|
|
// Save off some data so other areas of the Client DLL can get to it
|
|
|
|
|
cl_entity_t *player = GetLocalPlayer(); // Get the local player's index
|
|
|
|
|
if ( dst->number == player->index )
|
|
|
|
|
{
|
|
|
|
|
g_iPlayerClass = dst->playerclass;
|
|
|
|
|
g_iTeamNumber = dst->team;
|
|
|
|
|
|
|
|
|
|
g_iUser1 = src->iuser1;
|
|
|
|
|
g_iUser2 = src->iuser2;
|
|
|
|
|
g_iUser3 = src->iuser3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-15 22:00:00 +02:00
|
|
|
|
int HUD_AddVisibleEntity( cl_entity_t *pEnt, int entityType )
|
2010-03-14 22:00:00 +01:00
|
|
|
|
{
|
|
|
|
|
float oldScale, oldRenderAmt;
|
|
|
|
|
float shellScale = 1.0f;
|
|
|
|
|
int result;
|
|
|
|
|
|
2010-08-16 22:00:00 +02:00
|
|
|
|
// if entity is beam add it here
|
|
|
|
|
// because render doesn't know how to draw beams
|
|
|
|
|
if ( entityType == ET_BEAM )
|
|
|
|
|
{
|
|
|
|
|
g_pViewRenderBeams->AddServerBeam( pEnt );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-07 22:00:00 +02:00
|
|
|
|
if ( pEnt->curstate.renderfx == kRenderFxGlowShell )
|
2010-03-14 22:00:00 +01:00
|
|
|
|
{
|
2010-08-07 22:00:00 +02:00
|
|
|
|
oldRenderAmt = pEnt->curstate.renderamt;
|
|
|
|
|
oldScale = pEnt->curstate.scale;
|
2010-03-14 22:00:00 +01:00
|
|
|
|
|
2010-08-07 22:00:00 +02:00
|
|
|
|
pEnt->curstate.renderamt = 255; // clear amount
|
2010-03-14 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
result = gEngfuncs.CL_CreateVisibleEntity( entityType, pEnt, -1 );
|
2010-03-14 22:00:00 +01:00
|
|
|
|
|
2010-08-07 22:00:00 +02:00
|
|
|
|
if ( pEnt->curstate.renderfx == kRenderFxGlowShell )
|
2010-03-14 22:00:00 +01:00
|
|
|
|
{
|
|
|
|
|
shellScale = (oldRenderAmt * 0.0015f); // shellOffset
|
2010-08-07 22:00:00 +02:00
|
|
|
|
pEnt->curstate.scale = oldScale + shellScale; // sets new scale
|
|
|
|
|
pEnt->curstate.renderamt = 128;
|
2010-03-14 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
// render glowshell
|
2010-08-20 22:00:00 +02:00
|
|
|
|
result |= gEngfuncs.CL_CreateVisibleEntity( entityType, pEnt, g_pTempEnts->hSprGlowShell );
|
2010-03-14 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
// restore parms
|
2010-08-07 22:00:00 +02:00
|
|
|
|
pEnt->curstate.scale = oldScale;
|
|
|
|
|
pEnt->curstate.renderamt = oldRenderAmt;
|
2010-03-14 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-07 22:00:00 +02:00
|
|
|
|
if ( pEnt->curstate.effects & EF_BRIGHTFIELD )
|
2010-03-16 22:00:00 +01:00
|
|
|
|
{
|
2010-07-13 22:00:00 +02:00
|
|
|
|
g_pParticles->EntityParticles( pEnt );
|
2010-03-16 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2010-03-14 22:00:00 +01:00
|
|
|
|
// add in muzzleflash effect
|
2010-08-07 22:00:00 +02:00
|
|
|
|
if ( pEnt->curstate.effects & EF_MUZZLEFLASH )
|
2010-03-14 22:00:00 +01:00
|
|
|
|
{
|
2010-08-15 22:00:00 +02:00
|
|
|
|
if( entityType == ET_VIEWENTITY )
|
2010-08-07 22:00:00 +02:00
|
|
|
|
pEnt->curstate.effects &= ~EF_MUZZLEFLASH;
|
2010-03-14 22:00:00 +01:00
|
|
|
|
g_pTempEnts->WeaponFlash( pEnt, 1 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add light effect
|
2010-08-07 22:00:00 +02:00
|
|
|
|
if ( pEnt->curstate.effects & EF_LIGHT )
|
2010-03-14 22:00:00 +01:00
|
|
|
|
{
|
2010-08-07 22:00:00 +02:00
|
|
|
|
g_pTempEnts->AllocDLight( pEnt->curstate.origin, 100, 100, 100, 200, 0.001f );
|
|
|
|
|
g_pTempEnts->RocketFlare( pEnt->curstate.origin );
|
2010-03-14 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2010-03-15 22:00:00 +01:00
|
|
|
|
// add dimlight
|
2010-08-07 22:00:00 +02:00
|
|
|
|
if ( pEnt->curstate.effects & EF_DIMLIGHT )
|
2010-03-15 22:00:00 +01:00
|
|
|
|
{
|
2010-08-15 22:00:00 +02:00
|
|
|
|
if ( entityType == ET_PLAYER )
|
2010-03-15 22:00:00 +01:00
|
|
|
|
{
|
|
|
|
|
EV_UpadteFlashlight( pEnt );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-08-07 22:00:00 +02:00
|
|
|
|
g_pTempEnts->AllocDLight( pEnt->curstate.origin, RANDOM_LONG( 200, 230 ), 0.001f );
|
2010-03-15 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-17 22:00:00 +02:00
|
|
|
|
// NOTE: Xash3D sent entities to client even if it has EF_NODRAW flags
|
|
|
|
|
// run simple check here to prevent lighting invisible entity
|
2010-08-07 22:00:00 +02:00
|
|
|
|
if ( pEnt->curstate.effects & EF_BRIGHTLIGHT && !( pEnt->curstate.effects & EF_NODRAW ))
|
2010-03-15 22:00:00 +01:00
|
|
|
|
{
|
2010-08-07 22:00:00 +02:00
|
|
|
|
Vector pos( pEnt->curstate.origin.x, pEnt->curstate.origin.y, pEnt->curstate.origin.z + 16 );
|
2010-06-28 22:00:00 +02:00
|
|
|
|
g_pTempEnts->AllocDLight( pos, RANDOM_LONG( 400, 430 ), 0.001f );
|
2010-03-15 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2010-03-14 22:00:00 +01:00
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HUD_CreateEntities( void )
|
|
|
|
|
{
|
|
|
|
|
EV_UpdateBeams (); // egon use this
|
|
|
|
|
EV_UpdateLaserSpot (); // predictable laserspot
|
|
|
|
|
|
|
|
|
|
// add in any game specific objects here
|
|
|
|
|
g_pViewRenderBeams->UpdateTempEntBeams( );
|
|
|
|
|
|
|
|
|
|
g_pTempEnts->Update();
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-07 22:00:00 +02:00
|
|
|
|
void HUD_UpdateOnRemove( cl_entity_t *pEdict )
|
2010-03-10 22:00:00 +01:00
|
|
|
|
{
|
|
|
|
|
// move TE_BEAMTRAIL, kill other beams
|
|
|
|
|
g_pViewRenderBeams->KillDeadBeams( pEdict );
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void HUD_Reset( void )
|
|
|
|
|
{
|
2010-03-14 22:00:00 +01:00
|
|
|
|
HUD_VidInit ();
|
2008-12-25 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2010-03-09 22:00:00 +01:00
|
|
|
|
void HUD_StartFrame( void )
|
|
|
|
|
{
|
|
|
|
|
// clear list of server beams after each frame
|
|
|
|
|
g_pViewRenderBeams->ClearServerBeams( );
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-13 22:00:00 +02:00
|
|
|
|
void HUD_ParticleEffect( const float *org, const float *dir, int color, int count )
|
|
|
|
|
{
|
|
|
|
|
g_pParticles->ParticleEffect( org, dir, color, count );
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-16 22:00:00 +02:00
|
|
|
|
void HUD_TempEntityMessage( int iSize, void *pbuf )
|
|
|
|
|
{
|
|
|
|
|
BEGIN_READ( "TempEntity", iSize, pbuf );
|
|
|
|
|
HUD_ParseTempEntity();
|
|
|
|
|
END_READ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HUD_DirectorMessage( int iSize, void *pbuf )
|
|
|
|
|
{
|
|
|
|
|
// FIXME: implement
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void HUD_Frame( double time )
|
|
|
|
|
{
|
|
|
|
|
// place to call vgui_frame
|
2009-12-05 22:00:00 +01:00
|
|
|
|
// VGUI not implemented, wait for version 0.75
|
2008-12-25 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HUD_Shutdown( void )
|
|
|
|
|
{
|
2010-03-14 22:00:00 +01:00
|
|
|
|
HUD_ShutdownEffects ();
|
|
|
|
|
|
2009-12-05 22:00:00 +01:00
|
|
|
|
IN_Shutdown ();
|
2010-08-20 22:00:00 +02:00
|
|
|
|
}
|