1999-04-07 00:00:00 +00:00
|
|
|
/***
|
|
|
|
*
|
2002-12-23 00:00:00 +00:00
|
|
|
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
1999-04-07 00:00:00 +00:00
|
|
|
*
|
|
|
|
* 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"
|
2000-06-05 00:00:00 +00:00
|
|
|
#include "cl_util.h"
|
1999-04-07 00:00:00 +00:00
|
|
|
#include "parsemsg.h"
|
2001-08-29 00:00:00 +00:00
|
|
|
#include "r_efx.h"
|
1999-04-07 00:00:00 +00:00
|
|
|
|
2001-08-29 00:00:00 +00:00
|
|
|
#define MAX_CLIENTS 32
|
|
|
|
|
|
|
|
extern BEAM *pBeam;
|
|
|
|
extern BEAM *pBeam2;
|
2001-11-08 00:00:00 +00:00
|
|
|
|
1999-04-07 00:00:00 +00:00
|
|
|
/// USER-DEFINED SERVER MESSAGE HANDLERS
|
|
|
|
|
|
|
|
int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
|
|
|
|
{
|
|
|
|
ASSERT( iSize == 0 );
|
|
|
|
|
|
|
|
// clear all hud data
|
|
|
|
HUDLIST *pList = m_pHudList;
|
|
|
|
|
|
|
|
while ( pList )
|
|
|
|
{
|
|
|
|
if ( pList->p )
|
|
|
|
pList->p->Reset();
|
|
|
|
pList = pList->pNext;
|
|
|
|
}
|
|
|
|
|
|
|
|
// reset sensitivity
|
|
|
|
m_flMouseSensitivity = 0;
|
|
|
|
|
|
|
|
// reset concussion effect
|
|
|
|
m_iConcussionEffect = 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2002-12-23 00:00:00 +00:00
|
|
|
void CAM_ToFirstPerson(void);
|
|
|
|
|
|
|
|
void CHud :: MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )
|
|
|
|
{
|
|
|
|
CAM_ToFirstPerson();
|
|
|
|
}
|
|
|
|
|
1999-04-07 00:00:00 +00:00
|
|
|
void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
|
|
|
|
{
|
|
|
|
// prepare all hud data
|
|
|
|
HUDLIST *pList = m_pHudList;
|
|
|
|
|
|
|
|
while (pList)
|
|
|
|
{
|
|
|
|
if ( pList->p )
|
|
|
|
pList->p->InitHUDData();
|
|
|
|
pList = pList->pNext;
|
|
|
|
}
|
2001-11-08 00:00:00 +00:00
|
|
|
|
2001-08-29 00:00:00 +00:00
|
|
|
//Probably not a good place to put this.
|
|
|
|
pBeam = pBeam2 = NULL;
|
1999-04-07 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf )
|
|
|
|
{
|
|
|
|
BEGIN_READ( pbuf, iSize );
|
|
|
|
m_Teamplay = READ_BYTE();
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CHud :: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
|
|
|
|
{
|
|
|
|
int armor, blood;
|
|
|
|
Vector from;
|
|
|
|
int i;
|
|
|
|
float count;
|
|
|
|
|
|
|
|
BEGIN_READ( pbuf, iSize );
|
|
|
|
armor = READ_BYTE();
|
|
|
|
blood = READ_BYTE();
|
|
|
|
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
from[i] = READ_COORD();
|
|
|
|
|
|
|
|
count = (blood * 0.5) + (armor * 0.5);
|
|
|
|
|
|
|
|
if (count < 10)
|
|
|
|
count = 10;
|
|
|
|
|
|
|
|
// TODO: kick viewangles, show damage visually
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int CHud :: MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
|
|
|
|
{
|
|
|
|
BEGIN_READ( pbuf, iSize );
|
|
|
|
m_iConcussionEffect = READ_BYTE();
|
|
|
|
if (m_iConcussionEffect)
|
|
|
|
this->m_StatusIcons.EnableIcon("dmg_concuss",255,160,0);
|
|
|
|
else
|
|
|
|
this->m_StatusIcons.DisableIcon("dmg_concuss");
|
|
|
|
return 1;
|
|
|
|
}
|