Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.

118 lines
2.3 KiB

9 years ago
/***
*
* 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;
/// USER-DEFINED SERVER MESSAGE HANDLERS
9 years ago
int CHud::MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf )
9 years ago
{
ASSERT( iSize == 0 );
// clear all hud data
HUDLIST *pList = m_pHudList;
9 years ago
while( pList )
9 years ago
{
9 years ago
if( pList->p )
9 years ago
pList->p->Reset();
pList = pList->pNext;
}
// reset sensitivity
m_flMouseSensitivity = 0;
// reset concussion effect
m_iConcussionEffect = 0;
return 1;
}
9 years ago
void CAM_ToFirstPerson( void );
9 years ago
9 years ago
void CHud::MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )
9 years ago
{
CAM_ToFirstPerson();
}
9 years ago
void CHud::MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
9 years ago
{
// prepare all hud data
HUDLIST *pList = m_pHudList;
9 years ago
while( pList )
9 years ago
{
9 years ago
if( pList->p )
9 years ago
pList->p->InitHUDData();
pList = pList->pNext;
}
//Probably not a good place to put this.
pBeam = pBeam2 = NULL;
}
9 years ago
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
9 years ago
{
BEGIN_READ( pbuf, iSize );
m_Teamplay = READ_BYTE();
return 1;
}
9 years ago
int CHud::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
9 years ago
{
int armor, blood;
Vector from;
int i;
float count;
9 years ago
9 years ago
BEGIN_READ( pbuf, iSize );
armor = READ_BYTE();
blood = READ_BYTE();
9 years ago
for( i = 0; i < 3; i++)
9 years ago
from[i] = READ_COORD();
9 years ago
count = ( blood * 0.5 ) + ( armor * 0.5 );
9 years ago
9 years ago
if( count < 10 )
9 years ago
count = 10;
// TODO: kick viewangles, show damage visually
return 1;
}
9 years ago
int CHud::MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
9 years ago
{
BEGIN_READ( pbuf, iSize );
m_iConcussionEffect = READ_BYTE();
9 years ago
if( m_iConcussionEffect )
this->m_StatusIcons.EnableIcon( "dmg_concuss", 255, 160, 0 );
9 years ago
else
9 years ago
this->m_StatusIcons.DisableIcon( "dmg_concuss" );
9 years ago
return 1;
}