Enable radar, messages fixes, events
This commit is contained in:
parent
e555173b7d
commit
c0c70311c2
@ -40,4 +40,6 @@ typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);
|
||||
#endif
|
||||
#include "../engine/cdll_int.h"
|
||||
#include "../dlls/cdll_dll.h"
|
||||
#include "render_api.h"
|
||||
extern cl_enginefunc_t gEngfuncs;
|
||||
extern render_api_t gRenderAPI;
|
||||
|
@ -71,15 +71,18 @@ void EV_HLDM_SmokeGrenade( float x, float y, float z )
|
||||
{
|
||||
static bool init = false;
|
||||
|
||||
for( int i = 1; i <= 10; i++ )
|
||||
/*for( int i = 1; i <= 10; i++ )
|
||||
{
|
||||
int iSmokeSprite = SPR_Load( "sprites/gas_puff_01.spr" );
|
||||
TEMPENTITY *pTemp = gEngfuncs.pEfxAPI->R_TempSprite( Vector( x, y, z ),
|
||||
Vector( (int)gEngfuncs.pfnRandomLong( -10, 10 ), (int)gEngfuncs.pfnRandomLong( -10, 10 ), (int)gEngfuncs.pfnRandomLong( -10, 10 ) ),
|
||||
10,iSmokeSprite, kRenderGlow, kRenderFxNone, 1.0, 0.5, FTENT_PERSIST | FTENT_COLLIDEWORLD | FTENT_FADEOUT );
|
||||
int iSmokeSprite = SPR_Load( "sprites/ballsmoke.spr" );
|
||||
vec3_t origin;
|
||||
origin[0] = x;
|
||||
origin[1] = y;
|
||||
origin[2] = z;
|
||||
TEMPENTITY *pTemp = gEngfuncs.pEfxAPI->R_TempSprite( origin,
|
||||
Vector( 0, 0, 0 ),
|
||||
10,iSmokeSprite, kRenderNormal, kRenderFxNone, 1.0, 10000, FTENT_PERSIST | FTENT_COLLIDEWORLD | FTENT_FADEOUT );
|
||||
|
||||
gEngfuncs.pEfxAPI->R_RunParticleEffect( Vector( x, y, z), Vector( (int)gEngfuncs.pfnRandomLong( -10, 10 ), (int)gEngfuncs.pfnRandomLong( -10, 10 ), (int)gEngfuncs.pfnRandomLong( -10, 10 ) )
|
||||
, 0xFFFFFF, 50);
|
||||
gEngfuncs.pEfxAPI->R_RunParticleEffect( origin, Vector( 0, 0, 0 ), 0xFFFFFF, 50);
|
||||
|
||||
/*if(pTemp)
|
||||
{
|
||||
@ -90,8 +93,10 @@ void EV_HLDM_SmokeGrenade( float x, float y, float z )
|
||||
pTemp->entity.curstate.rendercolor.r = 255;
|
||||
pTemp->entity.curstate.rendercolor.g = 255;
|
||||
pTemp->entity.curstate.rendercolor.b = 255;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// TODO: Find a way to draw smoke0
|
||||
}
|
||||
|
||||
void EV_HLDM_NewExplode( float x, float y, float z, float ScaleExplode1 )
|
||||
@ -489,15 +494,15 @@ void EV_Dummy( struct event_args_s *args )
|
||||
|
||||
void RemoveBody(TEMPENTITY *te, float frametime, float current_time)
|
||||
{
|
||||
// go underground...
|
||||
if ( current_time >= 2 * te->entity.curstate.fuser2 + 5.0 )
|
||||
te->entity.origin.z -= 5.0 * frametime;
|
||||
// go underground...
|
||||
if ( current_time >= 2 * te->entity.curstate.fuser2 + 5.0 )
|
||||
te->entity.origin.z -= 5.0 * frametime;
|
||||
}
|
||||
|
||||
void HitBody(TEMPENTITY *ent, pmtrace_s *ptr)
|
||||
{
|
||||
/*if ( ptr->plane.normal.z > 0.0 )
|
||||
ent->flags |= FTENT_IGNOREGRAVITY;*/
|
||||
if ( ptr->plane.normal.z > 0.0 )
|
||||
ent->flags |= FTENT_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -508,7 +513,7 @@ void CreateCorpse(Vector *p_vOrigin, Vector *p_vAngles, const char *pModel, floa
|
||||
TEMPENTITY *model = gEngfuncs.pEfxAPI->R_TempModel( (float*)p_vOrigin,
|
||||
null,
|
||||
(float*)p_vAngles,
|
||||
6000000,
|
||||
gEngfuncs.pfnGetCvarFloat("cl_corpsestay"),
|
||||
modelIdx,
|
||||
0 );
|
||||
|
||||
@ -521,7 +526,7 @@ void CreateCorpse(Vector *p_vOrigin, Vector *p_vAngles, const char *pModel, floa
|
||||
model->entity.curstate.sequence = iSequence;
|
||||
model->entity.curstate.body = iBody;
|
||||
model->entity.curstate.fuser1 = gHUD.m_flTime + 1.0;
|
||||
model->entity.curstate.fuser2 = 600 + gHUD.m_flTime;
|
||||
model->entity.curstate.fuser2 = gEngfuncs.pfnGetCvarFloat("cl_corpsestay") + gHUD.m_flTime;
|
||||
model->hitcallback = HitBody;
|
||||
model->callback = RemoveBody;
|
||||
}
|
||||
|
@ -77,14 +77,13 @@ int CHudHealth::Init(void)
|
||||
m_iFlags = 0;
|
||||
m_bitsDamage = 0;
|
||||
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
|
||||
m_bDrawRadar = true;
|
||||
giDmgHeight = 0;
|
||||
giDmgWidth = 0;
|
||||
|
||||
memset(m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES);
|
||||
|
||||
cl_radartype = CVAR_CREATE( "cl_radartype", "0", FCVAR_ARCHIVE );
|
||||
|
||||
CVAR_CREATE("cl_corpsestay", "600", FCVAR_ARCHIVE);
|
||||
gHUD.AddHudElem(this);
|
||||
return 1;
|
||||
}
|
||||
@ -117,7 +116,7 @@ int CHudHealth::VidInit(void)
|
||||
m_hRadaropaque = gHUD.GetSprite( gHUD.GetSpriteIndex( "radaropaque" ));
|
||||
m_hrad = gHUD.GetSpriteRect( gHUD.GetSpriteIndex( "radar" ));
|
||||
m_hradopaque = gHUD.GetSpriteRect( gHUD.GetSpriteIndex( "radaropaque" ));
|
||||
m_bDrawRadar = false;
|
||||
m_bDrawRadar = true;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -532,6 +531,12 @@ void CHudHealth :: DrawRadarDot(int x, int y, int size, int r, int g, int b, int
|
||||
|
||||
void CHudHealth :: DrawRadar( float flTime )
|
||||
{
|
||||
char szTeamName[16];
|
||||
int localPlayer = gHUD.m_Scoreboard.m_iPlayerNum;
|
||||
vec3_t localPlayerOrigin = gHUD.m_vecOrigin;
|
||||
|
||||
strncpy(szTeamName, g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamname, sizeof(szTeamName) );
|
||||
|
||||
if( cl_radartype->value )
|
||||
{
|
||||
SPR_Set(m_hRadaropaque, 200, 200, 200);
|
||||
@ -542,6 +547,24 @@ void CHudHealth :: DrawRadar( float flTime )
|
||||
SPR_Set( m_hRadar, 25, 75, 25 );
|
||||
SPR_DrawAdditive( 0, 0, 0, &m_hrad );
|
||||
}
|
||||
|
||||
// players + bomb
|
||||
for( int i = 0; i < 34; i++ )
|
||||
{
|
||||
// skip other players and local client
|
||||
if( strcmp(g_PlayerExtraInfo[i].teamname, szTeamName) || gHUD.m_Scoreboard.m_iPlayerNum == i )
|
||||
continue;
|
||||
|
||||
vec3_t pOrigin = g_PlayerExtraInfo[i].origin;
|
||||
Vector2D delta( pOrigin.x - gHUD.m_vecOrigin.x, pOrigin.y - gHUD.m_vecOrigin.y );
|
||||
float rotateangle = atan(-delta.y / delta.x) * 180.0f / M_PI;
|
||||
|
||||
rotateangle += gHUD.m_vecAngles.y;
|
||||
double x, y;
|
||||
sincos( rotateangle * M_PI / 180.0f, &x, &y );
|
||||
|
||||
DrawRadarDot( (m_hrad.right - m_hrad.left) / 2 + delta.x * x, (m_hrad.bottom - m_hrad.top) / 2 + delta.y * y, 10, 255, 255, 255, 120);
|
||||
}
|
||||
}
|
||||
|
||||
int CHudHealth :: MsgFunc_ClCorpse(const char *pszName, int iSize, void *pbuf)
|
||||
@ -559,7 +582,7 @@ int CHudHealth :: MsgFunc_ClCorpse(const char *pszName, int iSize, void *pbuf)
|
||||
angles.x = READ_COORD();
|
||||
angles.y = READ_COORD();
|
||||
angles.z = READ_COORD();
|
||||
float delay = angles[2] * READ_LONG() / 100.0f;
|
||||
float delay = READ_LONG() / 100.0f;
|
||||
int sequence = READ_BYTE();
|
||||
int classID = READ_BYTE();
|
||||
int teamID = READ_BYTE();
|
||||
|
@ -56,12 +56,13 @@ int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
|
||||
|
||||
void CAM_ToFirstPerson(void);
|
||||
|
||||
void CHud :: MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )
|
||||
int CHud :: MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
CAM_ToFirstPerson();
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
|
||||
int CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
// prepare all hud data
|
||||
HUDLIST *pList = m_pHudList;
|
||||
@ -75,6 +76,8 @@ void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
|
||||
|
||||
//Probably not a good place to put this.
|
||||
pBeam = pBeam2 = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -208,4 +211,3 @@ int CHud::MsgFunc_HostageK(const char *pszName, int iSize, void *pbuf)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user