2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 18:05:23 +01:00
hlsdk-xash3d/cl_dll/hud_msg.cpp

130 lines
2.6 KiB
C++
Raw Normal View History

2016-06-04 15:24:23 +02:00
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
//
// hud_msg.cpp
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include "r_efx.h"
#define MAX_CLIENTS 32
extern BEAM *pBeam;
extern BEAM *pBeam2;
extern TEMPENTITY *pFlare; // Vit_amiN
extern float g_lastFOV; // Vit_amiN
2016-06-04 15:24:23 +02:00
/// USER-DEFINED SERVER MESSAGE HANDLERS
2016-07-03 15:39:55 +02:00
int CHud::MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf )
2016-06-04 15:24:23 +02:00
{
ASSERT( iSize == 0 );
// clear all hud data
HUDLIST *pList = m_pHudList;
2016-07-03 15:39:55 +02:00
while( pList )
2016-06-04 15:24:23 +02:00
{
2016-07-03 15:39:55 +02:00
if( pList->p )
2016-06-04 15:24:23 +02:00
pList->p->Reset();
pList = pList->pNext;
}
// reset sensitivity
m_flMouseSensitivity = 0;
// reset concussion effect
m_iConcussionEffect = 0;
// Vit_amiN: reset the FOV
m_iFOV = 0; // default_fov
g_lastFOV = 0.0f;
2016-06-04 15:24:23 +02:00
return 1;
}
2016-07-03 15:39:55 +02:00
void CAM_ToFirstPerson( void );
2016-06-04 15:24:23 +02:00
2016-07-03 15:39:55 +02:00
void CHud::MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )
2016-06-04 15:24:23 +02:00
{
CAM_ToFirstPerson();
}
2016-07-03 15:39:55 +02:00
void CHud::MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
2016-06-04 15:24:23 +02:00
{
// prepare all hud data
HUDLIST *pList = m_pHudList;
2016-07-03 15:39:55 +02:00
while( pList )
2016-06-04 15:24:23 +02:00
{
2016-07-03 15:39:55 +02:00
if( pList->p )
2016-06-04 15:24:23 +02:00
pList->p->InitHUDData();
pList = pList->pNext;
}
//Probably not a good place to put this.
pBeam = pBeam2 = NULL;
pFlare = NULL; // Vit_amiN: clear egon's beam flare
2016-06-04 15:24:23 +02:00
}
2016-07-03 15:39:55 +02:00
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
2016-06-04 15:24:23 +02:00
{
BEGIN_READ( pbuf, iSize );
m_Teamplay = READ_BYTE();
return 1;
}
2016-07-03 15:39:55 +02:00
int CHud::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
2016-06-04 15:24:23 +02:00
{
int armor, blood;
Vector from;
int i;
float count;
2016-07-03 15:39:55 +02:00
2016-06-04 15:24:23 +02:00
BEGIN_READ( pbuf, iSize );
armor = READ_BYTE();
blood = READ_BYTE();
2016-07-03 15:39:55 +02:00
for( i = 0; i < 3; i++)
2016-06-04 15:24:23 +02:00
from[i] = READ_COORD();
2016-07-03 15:39:55 +02:00
count = ( blood * 0.5 ) + ( armor * 0.5 );
2016-06-04 15:24:23 +02:00
2016-07-03 15:39:55 +02:00
if( count < 10 )
2016-06-04 15:24:23 +02:00
count = 10;
// TODO: kick viewangles, show damage visually
return 1;
}
2016-07-03 15:39:55 +02:00
int CHud::MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
2016-06-04 15:24:23 +02:00
{
int r, g, b;
2016-06-04 15:24:23 +02:00
BEGIN_READ( pbuf, iSize );
m_iConcussionEffect = READ_BYTE();
2016-07-03 15:39:55 +02:00
if( m_iConcussionEffect )
{
UnpackRGB( r, g, b, RGB_YELLOWISH ); // Vit_amiN: fixed
this->m_StatusIcons.EnableIcon( "dmg_concuss", r, g, b );
}
2016-06-04 15:24:23 +02:00
else
2016-07-03 15:39:55 +02:00
this->m_StatusIcons.DisableIcon( "dmg_concuss" );
2016-06-04 15:24:23 +02:00
return 1;
}