Client format.

This commit is contained in:
Night Owl 2016-07-03 18:39:55 +05:00
parent fad7aa53d7
commit 9e7debbb34
65 changed files with 4946 additions and 5045 deletions

View File

@ -68,7 +68,6 @@ int WeaponsResource :: HasAmmo( WEAPON *p )
|| CountAmmo( p->iAmmo2Type ) || ( p->iFlags & WEAPON_FLAGS_SELECTONEMPTY );
}
void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
{
int i, iRes;
@ -191,7 +190,6 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
}
else
pWeapon->hAmmo2 = 0;
}
// Returns the first weapon for a given slot.
@ -211,7 +209,6 @@ WEAPON *WeaponsResource :: GetFirstPos( int iSlot )
return pret;
}
WEAPON* WeaponsResource::GetNextActivePos( int iSlot, int iSlotPos )
{
if ( iSlotPos >= MAX_WEAPON_POSITIONS || iSlot >= MAX_WEAPON_SLOTS )
@ -225,7 +222,6 @@ WEAPON* WeaponsResource :: GetNextActivePos( int iSlot, int iSlotPos )
return p;
}
int giBucketHeight, giBucketWidth, giABHeight, giABWidth; // Ammo Bar width and height
HSPRITE ghsprBuckets; // Sprite for top row of weapons menu
@ -309,7 +305,6 @@ void CHudAmmo::Reset(void)
gHR.Reset();
//VidInit();
}
int CHudAmmo::VidInit( void )
@ -392,7 +387,6 @@ void CHudAmmo::Think(void)
//
// Helper function to return a Ammo pointer from id
//
HSPRITE* WeaponsResource::GetAmmoPicFromWeapon( int iAmmoId, wrect_t& rect )
{
for( int i = 0; i < MAX_WEAPONS; i++ )
@ -412,13 +406,12 @@ HSPRITE* WeaponsResource :: GetAmmoPicFromWeapon( int iAmmoId, wrect_t& rect )
return NULL;
}
// Menu Selection Code
void WeaponsResource::SelectSlot( int iSlot, int fAdvance, int iDirection )
{
if( gHUD.m_Menu.m_fMenuDisplayed && ( fAdvance == FALSE ) && ( iDirection == 1 ) )
{ // menu is overriding slot use commands
{
// menu is overriding slot use commands
gHUD.m_Menu.SelectMenuItem( iSlot + 1 ); // slots are one off the key numbers
return;
}
@ -449,7 +442,8 @@ void WeaponsResource :: SelectSlot( int iSlot, int fAdvance, int iDirection )
// but only if there is only one item in the bucket
WEAPON *p2 = GetNextActivePos( p->iSlot, p->iSlotPos );
if ( !p2 )
{ // only one active item in bucket, so change directly to weapon
{
// only one active item in bucket, so change directly to weapon
ServerCmd( p->szName );
g_weaponselect = p->iId;
return;
@ -531,7 +525,6 @@ int CHudAmmo::MsgFunc_ItemPickup( const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -606,21 +599,22 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
else
pWeapon->iClip = iClip;
if( iState == 0 ) // we're not the current weapon, so update no more
return 1;
m_pWeapon = pWeapon;
if( gHUD.m_iFOV >= 90 )
{ // normal crosshairs
{
// normal crosshairs
if( fOnTarget && m_pWeapon->hAutoaim )
SetCrosshair( m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255 );
else
SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 );
}
else
{ // zoomed crosshairs
{
// zoomed crosshairs
if( fOnTarget && m_pWeapon->hZoomedAutoaim )
SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 );
else
@ -664,7 +658,6 @@ int CHudAmmo::MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf )
gWR.AddWeapon( &Weapon );
return 1;
}
//------------------------------------------------------------------------
@ -825,12 +818,9 @@ void CHudAmmo::UserCmd_PrevWeapon(void)
gpActiveSel = NULL;
}
//-------------------------------------------------------------------------
// Drawing code
//-------------------------------------------------------------------------
int CHudAmmo::Draw( float flTime )
{
int a, x, y, r, g, b;
@ -860,7 +850,6 @@ int CHudAmmo::Draw(float flTime)
if( ( pw->iAmmoType < 0 ) && ( pw->iAmmo2Type < 0 ) )
return 0;
int iFlags = DHN_DRAWZERO; // draw 0 values
AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
@ -885,7 +874,6 @@ int CHudAmmo::Draw(float flTime)
if( pw->iClip >= 0 )
{
// room for the number and the '|' and the current ammo
x = ScreenWidth - ( 8 * AmmoWidth ) - iIconWidth;
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b );
@ -904,13 +892,11 @@ int CHudAmmo::Draw(float flTime)
// draw the | bar
FillRGBA( x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a );
x += iBarWidth + AmmoWidth/2;;
x += iBarWidth + AmmoWidth / 2;
// GL Seems to need this
ScaleColors( r, g, b, a );
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo( pw->iAmmoType ), r, g, b );
}
else
{
@ -946,7 +932,6 @@ int CHudAmmo::Draw(float flTime)
return 1;
}
//
// Draws the ammo bar on the hud
//
@ -979,8 +964,6 @@ int DrawBar(int x, int y, int width, int height, float f)
return ( x + width );
}
void DrawAmmoBar( WEAPON *p, int x, int y, int width, int height )
{
if( !p )
@ -995,9 +978,7 @@ void DrawAmmoBar(WEAPON *p, int x, int y, int width, int height)
x = DrawBar( x, y, width, height, f );
// Do we have secondary ammo too?
if( p->iAmmo2Type != -1 )
{
f = (float)gWR.CountAmmo( p->iAmmo2Type ) / (float)p->iMax2;
@ -1009,9 +990,6 @@ void DrawAmmoBar(WEAPON *p, int x, int y, int width, int height)
}
}
//
// Draw Weapon Menu
//
@ -1032,7 +1010,6 @@ int CHudAmmo::DrawWList(float flTime)
x = 10; //!!!
y = 10; //!!!
// Ensure that there are available choices in the active slot
if( iActiveSlot > 0 )
{
@ -1075,7 +1052,6 @@ int CHudAmmo::DrawWList(float flTime)
x += iWidth + 5;
}
a = 128; //!!!
x = 10;
@ -1103,7 +1079,6 @@ int CHudAmmo::DrawWList(float flTime)
UnpackRGB( r, g, b, RGB_YELLOWISH );
// if active, then we must have ammo.
if( gpActiveSel == p )
{
SPR_Set( p->hActive, r, g, b );
@ -1115,7 +1090,6 @@ int CHudAmmo::DrawWList(float flTime)
else
{
// Draw Weapon if Red if no ammo
if( gWR.HasAmmo( p ) )
ScaleColors( r, g, b, 192 );
else
@ -1129,19 +1103,16 @@ int CHudAmmo::DrawWList(float flTime)
}
// Draw Ammo Bar
DrawAmmoBar( p, x + giABWidth / 2, y, giABWidth, giABHeight );
y += p->rcActive.bottom - p->rcActive.top + 5;
}
x += iWidth + 5;
}
else
{
// Draw Row of weapons.
UnpackRGB( r, g, b, RGB_YELLOWISH );
for( int iPos = 0; iPos < MAX_WEAPON_POSITIONS; iPos++ )
@ -1172,10 +1143,8 @@ int CHudAmmo::DrawWList(float flTime)
}
return 1;
}
/* =================================
GetSpriteList

View File

@ -18,7 +18,6 @@
#define MAX_WEAPON_NAME 128
#define WEAPON_FLAGS_SELECTONEMPTY 1
#define WEAPON_IS_ONTARGET 0x40
@ -57,6 +56,4 @@ struct WEAPON
};
typedef int AMMO;
#endif

View File

@ -81,7 +81,8 @@ int CHudAmmoSecondary :: Draw(float flTime)
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( m_HUD_ammoicon ) );
}
else
{ // move the cursor by the '0' char instead, since we don't have an icon to work with
{
// move the cursor by the '0' char instead, since we don't have an icon to work with
x -= AmmoWidth;
y -= ( gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).top - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).bottom );
}
@ -145,7 +146,8 @@ int CHudAmmoSecondary :: MsgFunc_SecAmmoVal( const char *pszName, int iSize, voi
}
if( count == 0 )
{ // the ammo fields are all empty, so turn off this hud area
{
// the ammo fields are all empty, so turn off this hud area
m_iFlags &= ~HUD_ACTIVE;
return 1;
}
@ -155,5 +157,3 @@ int CHudAmmoSecondary :: MsgFunc_SecAmmoVal( const char *pszName, int iSize, voi
return 1;
}

View File

@ -49,7 +49,8 @@ void HistoryResource :: AddToHistory( int iType, int iId, int iCount )
return; // no amount, so don't add
if( ( ( ( AMMO_PICKUP_GAP * iCurrentHistorySlot ) + AMMO_PICKUP_PICK_HEIGHT ) > AMMO_PICKUP_HEIGHT_MAX ) || ( iCurrentHistorySlot >= MAX_HISTORY ) )
{ // the pic would have to be drawn too high
{
// the pic would have to be drawn too high
// so start from the bottom
iCurrentHistorySlot = 0;
}
@ -69,7 +70,8 @@ void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount
return;
if( ( ( ( AMMO_PICKUP_GAP * iCurrentHistorySlot ) + AMMO_PICKUP_PICK_HEIGHT ) > AMMO_PICKUP_HEIGHT_MAX ) || ( iCurrentHistorySlot >= MAX_HISTORY ) )
{ // the pic would have to be drawn too high
{
// the pic would have to be drawn too high
// so start from the bottom
iCurrentHistorySlot = 0;
}
@ -77,7 +79,6 @@ void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount
HIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++]; // default to just writing to the first slot
// I am really unhappy with all the code in this file
int i = gHUD.GetSpriteIndex( szName );
if( i == -1 )
return; // unknown sprite name, don't add it to history
@ -90,7 +91,6 @@ void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount
freeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME;
}
void HistoryResource::CheckClearHistory( void )
{
for( int i = 0; i < MAX_HISTORY; i++ )
@ -114,7 +114,8 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME );
if( rgAmmoHistory[i].DisplayTime <= flTime )
{ // pic drawing time has expired
{
// pic drawing time has expired
memset( &rgAmmoHistory[i], 0, sizeof(HIST_ITEM) );
CheckClearHistory();
}
@ -132,7 +133,8 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
int xpos = ScreenWidth - 24;
if( spr && *spr ) // weapon isn't loaded yet so just don't draw the pic
{ // the dll has to make sure it has sent info the weapons you need
{
// the dll has to make sure it has sent info the weapons you need
SPR_Set( *spr, r, g, b );
SPR_DrawAdditive( 0, xpos, ypos, &rcPic );
}
@ -185,8 +187,5 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
}
}
return 1;
}

View File

@ -94,7 +94,6 @@ public:
extern WeaponsResource gWR;
#define MAX_HISTORY 12
enum {
HISTSLOT_EMPTY,
@ -138,6 +137,3 @@ public:
};
extern HistoryResource gHR;

View File

@ -40,7 +40,6 @@ int CHudBattery::Init(void)
return 1;
}
int CHudBattery::VidInit( void )
{
int HUD_suit_empty = gHUD.GetSpriteIndex( "suit_empty" );
@ -58,7 +57,6 @@ int CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf )
{
m_iFlags |= HUD_ACTIVE;
BEGIN_READ( pbuf, iSize );
int x = READ_SHORT();
@ -71,7 +69,6 @@ int CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHudBattery::Draw( float flTime )
{
if( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH )
@ -102,9 +99,7 @@ int CHudBattery::Draw(float flTime)
}
// Fade the health number back to dim
a = MIN_ALPHA + ( m_fFade / FADE_TIME ) * 128;
}
else
a = MIN_ALPHA;

View File

@ -20,5 +20,4 @@ void CAM_Init( void );
void CAM_ClearStates( void );
void CAM_StartMouseMove( void );
void CAM_EndMouseMove( void );
#endif // _CAMERA_H_

View File

@ -146,7 +146,6 @@ int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
return 1;
}
/*
==========================
HUD_VidInit
@ -180,7 +179,6 @@ void DLLEXPORT HUD_Init( void )
gHUD.Init();
}
/*
==========================
HUD_Redraw
@ -197,7 +195,6 @@ int DLLEXPORT HUD_Redraw( float time, int intermission )
return 1;
}
/*
==========================
HUD_UpdateClientData
@ -243,7 +240,6 @@ void DLLEXPORT HUD_Frame( double time )
{
}
/*
==========================
HUD_VoiceStatus

View File

@ -15,6 +15,7 @@
//
// cl_util.h
//
#include "exportdef.h"
#include "cvardef.h"
@ -32,14 +33,12 @@
return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \
}
#define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y );
#define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \
{ \
gHUD.y.UserCmd_##x( ); \
}
inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); }
inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( (char*)x ); }
inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int flags ) { return gEngfuncs.pfnRegisterVariable( (char*)cv, (char*)val, flags ); }
@ -63,7 +62,6 @@ inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int fl
//
#define FillRGBA( *gEngfuncs.pfnFillRGBA )
// ScreenHeight returns the height of the screen, in pixels
#define ScreenHeight( gHUD.m_scrinfo.iHeight )
// ScreenWidth returns the width of the screen, in pixels
@ -91,6 +89,7 @@ inline void DrawSetTextColor(float r, float g, float b)
else
gEngfuncs.pfnDrawSetTextColor( r, g, b );
}
// Gets the height & width of a sprite, at the specified frame
inline int SPR_Height( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Height(x, f); }
inline int SPR_Width( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Width(x, f); }

View File

@ -151,7 +151,6 @@ void HUD_SetMaxSpeed( const edict_t *ed, float speed )
{
}
/*
=====================
UTIL_WeaponTimeBase
@ -236,7 +235,6 @@ UTIL_SharedRandomFloat
*/
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high )
{
//
unsigned int range;
U_Srand( (int)seed + *(int *)&low + *(int *)&high );

View File

@ -37,12 +37,10 @@ unsigned short stub_PrecacheEvent( int type, const char *s );
const char *stub_NameForFunction( unsigned long function );
void stub_SetModel( struct edict_s *e, const char *m );
extern cvar_t *cl_lw;
extern int g_runfuncs;
extern vec3_t v_angles;
extern float g_lastFOV;
extern struct local_state_s *g_finalstate;
#endif

View File

@ -15,6 +15,7 @@
//
// death notice
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
@ -58,7 +59,6 @@ float *GetClientColor( int clientIndex )
case 3: return g_ColorYellow;
case 4: return g_ColorGreen;
case 0: return g_ColorYellow;
default: return g_ColorGrey;
}
@ -76,13 +76,11 @@ int CHudDeathNotice :: Init( void )
return 1;
}
void CHudDeathNotice::InitHUDData( void )
{
memset( rgDeathNoticeList, 0, sizeof(rgDeathNoticeList) );
}
int CHudDeathNotice::VidInit( void )
{
m_HUD_d_skull = gHUD.GetSpriteIndex( "d_skull" );
@ -100,7 +98,8 @@ int CHudDeathNotice :: Draw( float flTime )
break; // we've gone through them all
if( rgDeathNoticeList[i].flDisplayTime < flTime )
{ // display time has expired
{
// display time has expired
// remove the current item from the list
memmove( &rgDeathNoticeList[i], &rgDeathNoticeList[i + 1], sizeof(DeathNoticeItem) * ( MAX_DEATHNOTICES - i ) );
i--; // continue on the next item; stop the counter getting incremented
@ -177,7 +176,8 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
break;
}
if( i == MAX_DEATHNOTICES )
{ // move the rest of the list forward to make room for this item
{
// move the rest of the list forward to make room for this item
memmove( rgDeathNoticeList, rgDeathNoticeList + 1, sizeof(DeathNoticeItem) * MAX_DEATHNOTICES );
i = MAX_DEATHNOTICES - 1;
}
@ -186,7 +186,6 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
// gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo();
// Get the Killer's name
char *killer_name = g_PlayerInfoList[killer].name;
if( !killer_name )
@ -297,7 +296,3 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
return 1;
}

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "hud.h"
#include "cl_util.h"
#include "demo.h"

View File

@ -23,5 +23,4 @@ extern int g_demosniperdamage;
extern float g_demosniperorg[3];
extern float g_demosniperangles[3];
extern float g_demozoom;
#endif

View File

@ -20,7 +20,6 @@
#include "pmtrace.h"
#include "pm_shared.h"
void Game_AddObjects( void );
extern vec3_t v_origin;
@ -69,7 +68,6 @@ int DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *mode
if( ( g_iUser1 == OBS_IN_EYE || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE ) &&
ent->index == g_iUser2 )
return 0; // don't draw the player we are following in eye
}
return 1;
@ -211,7 +209,6 @@ void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct
pcd->iuser1 = g_iUser1; // observer mode
pcd->iuser2 = g_iUser2; // first target
pcd->iuser3 = g_iUser3; // second target
}
// Fire prevention
@ -269,9 +266,7 @@ void MoveModel( void )
gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &mymodel[i * 3 + j] );
}
}
}
#endif
//#define TRACE_TEST
@ -302,7 +297,6 @@ void TraceModel( void )
gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &hit );
}
#endif
*/
@ -348,7 +342,7 @@ void Particles( void )
for( j = 0; j < 3; j++ )
{
p->org[ j ] = v_origin[ j ] + gEngfuncs.pfnRandomFloat( -32.0, 32.0 );;
p->org[j] = v_origin[j] + gEngfuncs.pfnRandomFloat( -32.0, 32.0 );
p->vel[j] = gEngfuncs.pfnRandomFloat( -100.0, 100.0 );
}
@ -519,7 +513,6 @@ void DLLEXPORT HUD_CreateEntities( void )
#if defined( TEST_IT )
MoveModel();
#endif
#if defined( TRACE_TEST )
TraceModel();
#endif
@ -530,11 +523,9 @@ void DLLEXPORT HUD_CreateEntities( void )
/*
TempEnts();
*/
#if defined( BEAM_TEST )
Beams();
#endif
// Add in any game specific objects
Game_AddObjects();
}
@ -654,7 +645,6 @@ void DLLEXPORT HUD_TempEntUpdate (
pTemp->entity.curstate.renderamt = pTemp->entity.baseline.renderamt * ( 1 + life * pTemp->fadeSpeed );
if( pTemp->entity.curstate.renderamt <= 0 )
active = 0;
}
else
active = 0;
@ -727,7 +717,6 @@ void DLLEXPORT HUD_TempEntUpdate (
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (int)(size_t)pTemp );
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;
}
else
{
for( i = 0; i < 3; i++ )
@ -787,7 +776,6 @@ void DLLEXPORT HUD_TempEntUpdate (
gEngfuncs.pEventAPI->EV_PlayerTrace( pTemp->entity.prevstate.origin, pTemp->entity.origin, PM_STUDIO_BOX, -1, &pmtrace );
if( pmtrace.fraction != 1 )
{
pe = gEngfuncs.pEventAPI->EV_GetPhysent( pmtrace.ent );
@ -892,7 +880,6 @@ void DLLEXPORT HUD_TempEntUpdate (
}
}
if( ( pTemp->flags & FTENT_FLICKER ) && gTempEntFrame == pTemp->entity.curstate.effects )
{
dlight_t *dl = gEngfuncs.pEfxAPI->CL_AllocDlight(0);
@ -937,7 +924,6 @@ void DLLEXPORT HUD_TempEntUpdate (
}
pTemp = pnext;
}
finish:
// Restore state info
gEngfuncs.pEventAPI->EV_PopPMStates();
@ -971,4 +957,3 @@ cl_entity_t DLLEXPORT *HUD_GetUserEntity( int index )
return NULL;
#endif
}

View File

@ -13,6 +13,7 @@
*
****/
// shared event functions
#include "hud.h"
#include "cl_util.h"
#include "const.h"

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "hud.h"
#include "cl_util.h"
#include "const.h"
@ -48,7 +49,6 @@ extern cvar_t *cl_lw;
extern "C"
{
// HLDM
void EV_FireGlock1( struct event_args_s *args );
void EV_FireGlock2( struct event_args_s *args );
@ -69,7 +69,6 @@ void EV_HornetGunFire( struct event_args_s *args );
void EV_TripmineFire( struct event_args_s *args );
void EV_SnarkFire( struct event_args_s *args );
void EV_TrainPitchAdjust( struct event_args_s *args );
}
@ -107,7 +106,6 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
// FIXME check if playtexture sounds movevar is set
//
chTextureType = 0;
// Player
@ -149,47 +147,63 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
switch (chTextureType)
{
default:
case CHAR_TEX_CONCRETE: fvol = 0.9; fvolbar = 0.6;
case CHAR_TEX_CONCRETE:
fvol = 0.9;
fvolbar = 0.6;
rgsz[0] = "player/pl_step1.wav";
rgsz[1] = "player/pl_step2.wav";
cnt = 2;
break;
case CHAR_TEX_METAL: fvol = 0.9; fvolbar = 0.3;
case CHAR_TEX_METAL:
fvol = 0.9;
fvolbar = 0.3;
rgsz[0] = "player/pl_metal1.wav";
rgsz[1] = "player/pl_metal2.wav";
cnt = 2;
break;
case CHAR_TEX_DIRT: fvol = 0.9; fvolbar = 0.1;
case CHAR_TEX_DIRT:
fvol = 0.9;
fvolbar = 0.1;
rgsz[0] = "player/pl_dirt1.wav";
rgsz[1] = "player/pl_dirt2.wav";
rgsz[2] = "player/pl_dirt3.wav";
cnt = 3;
break;
case CHAR_TEX_VENT: fvol = 0.5; fvolbar = 0.3;
case CHAR_TEX_VENT:
fvol = 0.5;
fvolbar = 0.3;
rgsz[0] = "player/pl_duct1.wav";
rgsz[1] = "player/pl_duct1.wav";
cnt = 2;
break;
case CHAR_TEX_GRATE: fvol = 0.9; fvolbar = 0.5;
case CHAR_TEX_GRATE:
fvol = 0.9;
fvolbar = 0.5;
rgsz[0] = "player/pl_grate1.wav";
rgsz[1] = "player/pl_grate4.wav";
cnt = 2;
break;
case CHAR_TEX_TILE: fvol = 0.8; fvolbar = 0.2;
case CHAR_TEX_TILE:
fvol = 0.8;
fvolbar = 0.2;
rgsz[0] = "player/pl_tile1.wav";
rgsz[1] = "player/pl_tile3.wav";
rgsz[2] = "player/pl_tile2.wav";
rgsz[3] = "player/pl_tile4.wav";
cnt = 4;
break;
case CHAR_TEX_SLOSH: fvol = 0.9; fvolbar = 0.0;
case CHAR_TEX_SLOSH:
fvol = 0.9;
fvolbar = 0.0;
rgsz[0] = "player/pl_slosh1.wav";
rgsz[1] = "player/pl_slosh3.wav";
rgsz[2] = "player/pl_slosh2.wav";
rgsz[3] = "player/pl_slosh4.wav";
cnt = 4;
break;
case CHAR_TEX_WOOD: fvol = 0.9; fvolbar = 0.2;
case CHAR_TEX_WOOD:
fvol = 0.9;
fvolbar = 0.2;
rgsz[0] = "debris/wood1.wav";
rgsz[1] = "debris/wood2.wav";
rgsz[2] = "debris/wood3.wav";
@ -197,7 +211,8 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
break;
case CHAR_TEX_GLASS:
case CHAR_TEX_COMPUTER:
fvol = 0.8; fvolbar = 0.2;
fvol = 0.8;
fvolbar = 0.2;
rgsz[0] = "debris/glass1.wav";
rgsz[1] = "debris/glass2.wav";
rgsz[2] = "debris/glass3.wav";
@ -206,7 +221,8 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
case CHAR_TEX_FLESH:
if( iBulletType == BULLET_PLAYER_CROWBAR )
return 0.0; // crowbar already makes this sound
fvol = 1.0; fvolbar = 0.2;
fvol = 1.0;
fvolbar = 0.2;
rgsz[0] = "weapons/bullet_hit1.wav";
rgsz[1] = "weapons/bullet_hit2.wav";
fattn = 1.0;
@ -253,11 +269,21 @@ void EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName )
{
switch( iRand % 5 )
{
case 0: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
case 1: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
case 2: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
case 3: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric4.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
case 4: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric5.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
case 0:
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
break;
case 1:
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
break;
case 2:
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
break;
case 3:
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric4.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
break;
case 4:
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric5.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
break;
}
}
@ -342,7 +368,6 @@ int EV_HLDM_CheckTracer( int idx, float *vecSrc, float *end, float *forward, flo
return tracer;
}
/*
================
FireBullets
@ -360,8 +385,8 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
for( iShot = 1; iShot <= cShots; iShot++ )
{
vec3_t vecDir, vecEnd;
float x, y, z;
//We randomize for the Shotgun.
if( iBulletType == BULLET_PLAYER_BUCKSHOT )
{
@ -379,7 +404,6 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
}//But other guns already have their spread randomized in the synched spread.
else
{
for( i = 0 ; i < 3; i++ )
{
vecDir[i] = vecDirShooting[i] + flSpreadX * right[i] + flSpreadY * up [i];
@ -407,13 +431,10 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
{
default:
case BULLET_PLAYER_9MM:
EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );
EV_HLDM_DecalGunshot( &tr, iBulletType );
break;
case BULLET_PLAYER_MP5:
if( !tracer )
{
EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );
@ -421,17 +442,12 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
}
break;
case BULLET_PLAYER_BUCKSHOT:
EV_HLDM_DecalGunshot( &tr, iBulletType );
break;
case BULLET_PLAYER_357:
EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );
EV_HLDM_DecalGunshot( &tr, iBulletType );
break;
}
}
@ -530,7 +546,6 @@ void EV_FireGlock2( event_args_t *args )
VectorCopy( forward, vecAiming );
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, &tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
//======================
// GLOCK END
@ -890,7 +905,6 @@ void EV_FireGauss( event_args_t *args )
if( m_fPrimaryFire == false )
g_flApplyVel = flDamage;
}
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/gauss2.wav", 0.5 + flDamage * ( 1.0 / 400.0 ), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );
@ -1000,7 +1014,6 @@ void EV_FireGauss( event_args_t *args )
}
flDamage = flDamage * ( 1 - n );
}
else
{
@ -1038,7 +1051,6 @@ void EV_FireGauss( event_args_t *args )
float n;
// trace backwards to find exit point
gEngfuncs.pEventAPI->EV_PlayerTrace( beam_tr.endpos, tr.endpos, PM_STUDIO_BOX, -1, &beam_tr );
VectorSubtract( beam_tr.endpos, tr.endpos, delta );
@ -1091,7 +1103,6 @@ void EV_FireGauss( event_args_t *args )
// slug doesn't punch through ever with primary
// fire, so leave a little glowy bit and make some balls
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, 200.0 / 255.0, 0.3, FTENT_FADEOUT );
{
vec3_t fwd;
VectorAdd( tr.endpos, tr.plane.normal, fwd );
@ -1117,8 +1128,8 @@ void EV_FireGauss( event_args_t *args )
//======================
// CROWBAR START
//======================
enum crowbar_e {
enum crowbar_e
{
CROWBAR_IDLE = 0,
CROWBAR_DRAW,
CROWBAR_HOLSTER,
@ -1154,11 +1165,14 @@ void EV_Crowbar( event_args_t *args )
switch( (g_iSwing++) % 3 )
{
case 0:
gEngfuncs.pEventAPI->EV_WeaponAnimation ( CROWBAR_ATTACK1MISS, 1 ); break;
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 1 );
break;
case 1:
gEngfuncs.pEventAPI->EV_WeaponAnimation ( CROWBAR_ATTACK2MISS, 1 ); break;
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK2MISS, 1 );
break;
case 2:
gEngfuncs.pEventAPI->EV_WeaponAnimation ( CROWBAR_ATTACK3MISS, 1 ); break;
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK3MISS, 1 );
break;
}
}
}
@ -1169,7 +1183,8 @@ void EV_Crowbar( event_args_t *args )
//======================
// CROSSBOW START
//======================
enum crossbow_e {
enum crossbow_e
{
CROSSBOW_IDLE1 = 0, // full
CROSSBOW_IDLE2, // empty
CROSSBOW_FIDGET1, // full
@ -1248,9 +1263,11 @@ void EV_FireCrossbow2( event_args_t *args )
switch( gEngfuncs.pfnRandomLong( 0, 1 ) )
{
case 0:
gEngfuncs.pEventAPI->EV_PlaySound( idx, tr.endpos, CHAN_BODY, "weapons/xbow_hitbod1.wav", 1, ATTN_NORM, 0, PITCH_NORM ); break;
gEngfuncs.pEventAPI->EV_PlaySound( idx, tr.endpos, CHAN_BODY, "weapons/xbow_hitbod1.wav", 1, ATTN_NORM, 0, PITCH_NORM );
break;
case 1:
gEngfuncs.pEventAPI->EV_PlaySound( idx, tr.endpos, CHAN_BODY, "weapons/xbow_hitbod2.wav", 1, ATTN_NORM, 0, PITCH_NORM ); break;
gEngfuncs.pEventAPI->EV_PlaySound( idx, tr.endpos, CHAN_BODY, "weapons/xbow_hitbod2.wav", 1, ATTN_NORM, 0, PITCH_NORM );
break;
}
}
//Stick to world but don't stick to glass, it might break and leave the bolt floating. It can still stick to other non-transparent breakables though.
@ -1312,7 +1329,8 @@ void EV_FireCrossbow( event_args_t *args )
//======================
// RPG START
//======================
enum rpg_e {
enum rpg_e
{
RPG_IDLE = 0,
RPG_FIDGET,
RPG_RELOAD, // to reload
@ -1351,7 +1369,8 @@ void EV_FireRpg( event_args_t *args )
//======================
// EGON END
//======================
enum egon_e {
enum egon_e
{
EGON_IDLE1 = 0,
EGON_FIDGET1,
EGON_ALTFIREON,
@ -1368,8 +1387,17 @@ enum egon_e {
int g_fireAnims1[] = { EGON_FIRE1, EGON_FIRE2, EGON_FIRE3, EGON_FIRE4 };
int g_fireAnims2[] = { EGON_ALTFIRECYCLE };
enum EGON_FIRESTATE { FIRE_OFF, FIRE_CHARGE };
enum EGON_FIREMODE { FIRE_NARROW, FIRE_WIDE};
enum EGON_FIRESTATE
{
FIRE_OFF,
FIRE_CHARGE
};
enum EGON_FIREMODE
{
FIRE_NARROW,
FIRE_WIDE
};
#define EGON_PRIMARY_VOLUME 450
#define EGON_BEAM_SPRITE "sprites/xbeam1.spr"
@ -1394,7 +1422,6 @@ void EV_EgonFire( event_args_t *args )
iFireMode = args->iparam2;
int iStartup = args->bparam1;
if( iStartup )
{
if( iFireMode == FIRE_WIDE )
@ -1456,7 +1483,6 @@ void EV_EgonFire( event_args_t *args )
g /= 100.0f;
}
pBeam = gEngfuncs.pEfxAPI->R_BeamEntPoint( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 3.5, 0.2, 0.7, 55, 0, 0, r, g, b );
if( pBeam )
@ -1488,7 +1514,6 @@ void EV_EgonStop( event_args_t *args )
pBeam = NULL;
}
if( pBeam2 )
{
pBeam2->die = 0.0;
@ -1503,7 +1528,8 @@ void EV_EgonStop( event_args_t *args )
//======================
// HORNET START
//======================
enum hgun_e {
enum hgun_e
{
HGUN_IDLE1 = 0,
HGUN_FIDGETSWAY,
HGUN_FIDGETSHAKE,
@ -1531,9 +1557,15 @@ void EV_HornetGunFire( event_args_t *args )
switch( gEngfuncs.pfnRandomLong( 0 , 2 ) )
{
case 0: gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire1.wav", 1, ATTN_NORM, 0, 100 ); break;
case 1: gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire2.wav", 1, ATTN_NORM, 0, 100 ); break;
case 2: gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire3.wav", 1, ATTN_NORM, 0, 100 ); break;
case 0:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire1.wav", 1, ATTN_NORM, 0, 100 );
break;
case 1:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire2.wav", 1, ATTN_NORM, 0, 100 );
break;
case 2:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire3.wav", 1, ATTN_NORM, 0, 100 );
break;
}
}
//======================
@ -1543,7 +1575,8 @@ void EV_HornetGunFire( event_args_t *args )
//======================
// TRIPMINE START
//======================
enum tripmine_e {
enum tripmine_e
{
TRIPMINE_IDLE1 = 0,
TRIPMINE_IDLE2,
TRIPMINE_ARM1,
@ -1598,7 +1631,8 @@ void EV_TripmineFire( event_args_t *args )
//======================
// SQUEAK START
//======================
enum squeak_e {
enum squeak_e
{
SQUEAK_IDLE1 = 0,
SQUEAK_FIDGETFIT,
SQUEAK_FIDGETNIP,
@ -1672,12 +1706,24 @@ void EV_TrainPitchAdjust( event_args_t *args )
switch( noise )
{
case 1: strcpy( sz, "plats/ttrain1.wav"); break;
case 2: strcpy( sz, "plats/ttrain2.wav"); break;
case 3: strcpy( sz, "plats/ttrain3.wav"); break;
case 4: strcpy( sz, "plats/ttrain4.wav"); break;
case 5: strcpy( sz, "plats/ttrain6.wav"); break;
case 6: strcpy( sz, "plats/ttrain7.wav"); break;
case 1:
strcpy( sz, "plats/ttrain1.wav" );
break;
case 2:
strcpy( sz, "plats/ttrain2.wav" );
break;
case 3:
strcpy( sz, "plats/ttrain3.wav" );
break;
case 4:
strcpy( sz, "plats/ttrain4.wav");
break;
case 5:
strcpy( sz, "plats/ttrain6.wav");
break;
case 6:
strcpy( sz, "plats/ttrain7.wav");
break;
default:
// no sound
strcpy( sz, "" );

View File

@ -23,7 +23,8 @@ typedef enum
BULLET_MONSTER_12MM
}Bullet;
enum glock_e {
enum glock_e
{
GLOCK_IDLE1 = 0,
GLOCK_IDLE2,
GLOCK_IDLE3,
@ -36,7 +37,8 @@ enum glock_e {
GLOCK_ADD_SILENCER
};
enum shotgun_e {
enum shotgun_e
{
SHOTGUN_IDLE = 0,
SHOTGUN_FIRE,
SHOTGUN_FIRE2,
@ -61,7 +63,8 @@ enum mp5_e
MP5_FIRE3
};
enum python_e {
enum python_e
{
PYTHON_IDLE1 = 0,
PYTHON_FIDGET,
PYTHON_FIRE1,
@ -75,7 +78,8 @@ enum python_e {
#define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging
#define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged
enum gauss_e {
enum gauss_e
{
GAUSS_IDLE = 0,
GAUSS_IDLE2,
GAUSS_FIDGET,
@ -91,5 +95,4 @@ void EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName );
void EV_HLDM_DecalGunshot( pmtrace_t *pTrace, int iBulletType );
int EV_HLDM_CheckTracer( int idx, float *vecSrc, float *end, float *forward, float *right, int iBulletType, int iTracerFreq, int *tracerCount );
void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int cShots, float *vecSrc, float *vecDirShooting, float flDistance, int iBulletType, int iTracerFreq, int *tracerCount, float flSpreadX, float flSpreadY );
#endif // EV_HLDMH

View File

@ -25,8 +25,6 @@
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE( m_Flash, FlashBat )
DECLARE_MESSAGE( m_Flash, Flashlight )
@ -72,8 +70,6 @@ int CHudFlashlight::VidInit(void)
int CHudFlashlight::MsgFunc_FlashBat( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
int x = READ_BYTE();
m_iBat = x;
@ -84,7 +80,6 @@ int CHudFlashlight:: MsgFunc_FlashBat(const char *pszName, int iSize, void *pbu
int CHudFlashlight::MsgFunc_Flashlight( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_fOn = READ_BYTE();
int x = READ_BYTE();
@ -134,7 +129,8 @@ int CHudFlashlight::Draw(float flTime)
SPR_DrawAdditive( 0, x, y, m_prc1 );
if( m_fOn )
{ // draw the flashlight beam
{
// draw the flashlight beam
x = ScreenWidth - m_iWidth / 2;
SPR_Set( m_hBeam, r, g, b );
@ -153,6 +149,5 @@ int CHudFlashlight::Draw(float flTime)
SPR_DrawAdditive( 0, x + iOffset, y, &rc );
}
return 1;
}

View File

@ -176,7 +176,6 @@ int CHudGeiger::Draw (float flTime)
sprintf( sz, "player/geiger%d.wav", j + 1 );
PlaySound( sz, flvol );
}
}

View File

@ -67,7 +67,6 @@ int CHudHealth::Init(void)
memset( m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES );
gHUD.AddHudElem( this );
return 1;
}
@ -77,7 +76,6 @@ void CHudHealth::Reset( void )
// make sure the pain compass is cleared when the player respawns
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
// force all the flashing damage icons to expire
m_bitsDamage = 0;
for( int i = 0; i < NUM_DMG_TYPES; i++ )
@ -95,6 +93,7 @@ int CHudHealth::VidInit(void)
giDmgHeight = gHUD.GetSpriteRect( m_HUD_dmg_bio ).right - gHUD.GetSpriteRect( m_HUD_dmg_bio ).left;
giDmgWidth = gHUD.GetSpriteRect( m_HUD_dmg_bio ).bottom - gHUD.GetSpriteRect( m_HUD_dmg_bio ).top;
return 1;
}
@ -116,7 +115,6 @@ int CHudHealth:: MsgFunc_Health(const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHudHealth::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -141,7 +139,8 @@ int CHudHealth:: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
{
float time = damageTaken * 4.0f;
if( time > 200.0f ) time = 200.0f;
if( time > 200.0f )
time = 200.0f;
gMobileEngfuncs->pfnVibrate( time, 0 );
}
}
@ -149,7 +148,6 @@ int CHudHealth:: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
return 1;
}
// Returns back a color from the
// Green <-> Yellow <-> Red ramp
void CHudHealth::GetPainColor( int &r, int &g, int &b )
@ -201,9 +199,7 @@ int CHudHealth::Draw(float flTime)
}
// Fade the health number back to dim
a = MIN_ALPHA + ( m_fFade / FADE_TIME ) * 128;
}
else
a = MIN_ALPHA;
@ -254,11 +250,9 @@ void CHudHealth::CalcDamageDirection(vec3_t vecFrom)
return;
}
memcpy( vecOrigin, gHUD.m_vecOrigin, sizeof(vec3_t) );
memcpy( vecAngles, gHUD.m_vecAngles, sizeof(vec3_t) );
VectorSubtract( vecFrom, vecOrigin, vecFrom );
float flDistToTarget = vecFrom.Length();
@ -340,7 +334,8 @@ int CHudHealth::DrawPain(float flTime)
y = ScreenHeight / 2 - SPR_Height( m_hSprite,1 ) / 2;
SPR_DrawAdditive( 1, x, y, NULL );
m_fAttackRight = max( 0, m_fAttackRight - fFade );
} else
}
else
m_fAttackRight = 0;
if( m_fAttackRear > 0.4 )
@ -354,7 +349,8 @@ int CHudHealth::DrawPain(float flTime)
y = ScreenHeight / 2 + SPR_Height( m_hSprite, 2 ) * 2;
SPR_DrawAdditive( 2, x, y, NULL );
m_fAttackRear = max( 0, m_fAttackRear - fFade );
} else
}
else
m_fAttackRear = 0;
if( m_fAttackLeft > 0.4 )
@ -400,14 +396,13 @@ int CHudHealth::DrawDamage(float flTime)
}
}
// check for bits that should be expired
for( i = 0; i < NUM_DMG_TYPES; i++ )
{
pdmg = &m_dmg[i];
if( m_bitsDamage & giDmgFlags[i] )
{
pdmg = &m_dmg[i];
pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire );
if( pdmg->fExpire <= flTime // when the time has expired
@ -435,7 +430,6 @@ int CHudHealth::DrawDamage(float flTime)
return 1;
}
void CHudHealth::UpdateTiles( float flTime, long bitsDamage )
{
DAMAGE_IMAGE *pdmg;
@ -472,7 +466,6 @@ void CHudHealth::UpdateTiles(float flTime, long bitsDamage)
pdmg = &m_dmg[j];
if( pdmg->y )
pdmg->y -= giDmgHeight;
}
pdmg = &m_dmg[i];
}

View File

@ -23,6 +23,7 @@
#define DMG_IMAGE_NERVE 5
#define DMG_IMAGE_RAD 6
#define DMG_IMAGE_SHOCK 7
//tf defines
#define DMG_IMAGE_CALTROP 8
#define DMG_IMAGE_TRANQ 9
@ -46,12 +47,10 @@
#define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death.
// time-based damage
//mask off TF-specific stuff too
#define DMG_TIMEBASED (~(0xff003fff)) // mask for time-based damage
#define DMG_DROWN (1 << 14) // Drowning
#define DMG_FIRSTTIMEBASED DMG_DROWN
@ -78,16 +77,14 @@
// TF Healing Additions for TakeHealth
#define DMG_IGNORE_MAXHEALTH DMG_IGNITE
// TF Redefines since we never use the originals
#define DMG_NAIL DMG_SLASH
#define DMG_NOT_SELF DMG_FREEZE
#define DMG_TRANQ DMG_MORTAR
#define DMG_CONCUSS DMG_SONIC
typedef struct
{
float fExpire;

View File

@ -21,6 +21,7 @@ This file contains "stubs" of class member implementations so that we can predic
add in the functionality you need.
==========================
*/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -108,7 +109,6 @@ void CBeam::PointEntInit( const Vector &start, int endIndex ) { }
CBeam *CBeam::BeamCreate( const char *pSpriteName, int width ) { return NULL; }
void CSprite::Expand( float scaleSpeed, float fadeSpeed ) { }
CBaseEntity* CBaseMonster::CheckTraceHullAttack( float flDist, int iDamage, int iDmgType ) { return NULL; }
void CBaseMonster::Eat( float flFullDuration ) { }
BOOL CBaseMonster::FShouldEat( void ) { return TRUE; }

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "../hud.h"
#include "../cl_util.h"
#include "event_api.h"
@ -38,8 +39,6 @@ void EV_HornetGunFire( struct event_args_s *args );
void EV_TripmineFire( struct event_args_s *args );
void EV_SnarkFire( struct event_args_s *args );
void EV_TrainPitchAdjust( struct event_args_s *args );
}

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "../hud.h"
#include "../cl_util.h"
#include "../demo.h"

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -67,7 +68,6 @@ CSatchel g_Satchel;
CTripmine g_Tripmine;
CSqueak g_Snark;
/*
======================
AlertMessage
@ -94,6 +94,7 @@ bool bIsMultiplayer ( void )
{
return gEngfuncs.GetMaxClients() == 1 ? 0 : 1;
}
//Just loads a v_ model.
void LoadVModel( char *szViewModel, CBasePlayer *m_pPlayer )
{
@ -147,7 +148,6 @@ CBasePlayerWeapon :: DefaultReload
*/
BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, int body )
{
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
return FALSE;
@ -309,7 +309,6 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5, 0.5 );
z = x * x + y * y;
}
}
return Vector( x * vecSpread.x, y * vecSpread.y, 0.0 );
@ -366,7 +365,6 @@ void CBasePlayerWeapon::ItemPostFrame( void )
else if( !( m_pPlayer->pev->button & ( IN_ATTACK | IN_ATTACK2 ) ) )
{
// no fire buttons down
m_fFireOnEmpty = FALSE;
// weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
@ -404,7 +402,6 @@ void CBasePlayer::SelectItem(const char *pstr)
if( !pItem )
return;
if( pItem == m_pActiveItem )
return;
@ -584,7 +581,6 @@ int RandomLong( int a, int b )
return gEngfuncs.pfnRandomLong( a, b );
}
/*
=====================
HUD_InitClientWeapons
@ -709,55 +705,42 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
case WEAPON_CROWBAR:
pWeapon = &g_Crowbar;
break;
case WEAPON_GLOCK:
pWeapon = &g_Glock;
break;
case WEAPON_PYTHON:
pWeapon = &g_Python;
break;
case WEAPON_MP5:
pWeapon = &g_Mp5;
break;
case WEAPON_CROSSBOW:
pWeapon = &g_Crossbow;
break;
case WEAPON_SHOTGUN:
pWeapon = &g_Shotgun;
break;
case WEAPON_RPG:
pWeapon = &g_Rpg;
break;
case WEAPON_GAUSS:
pWeapon = &g_Gauss;
break;
case WEAPON_EGON:
pWeapon = &g_Egon;
break;
case WEAPON_HORNETGUN:
pWeapon = &g_HGun;
break;
case WEAPON_HANDGRENADE:
pWeapon = &g_HandGren;
break;
case WEAPON_SATCHEL:
pWeapon = &g_Satchel;
break;
case WEAPON_TRIPMINE:
pWeapon = &g_Tripmine;
break;
case WEAPON_SNARK:
pWeapon = &g_Snark;
break;
@ -775,7 +758,6 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
if( to->client.health <= 0 && lasthealth > 0 )
{
player.Killed( NULL, 0 );
}
else if( to->client.health > 0 && lasthealth <= 0 )
{
@ -860,7 +842,6 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
player.ammo_hornets = (int)from->client.vuser2[0];
player.ammo_rockets = (int)from->client.ammo_rockets;
// Point to current weapon object
if( from->client.m_iId )
{

View File

@ -25,14 +25,12 @@
#include "parsemsg.h"
#include "hud_servers.h"
#include "demo.h"
#include "demo_api.h"
cvar_t *hud_textmode;
float g_hud_text_color[3];
extern client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz, int iRes, int iCount );
extern cvar_t *sensitivity;
@ -142,7 +140,6 @@ int __MsgFunc_ServerName(const char *pszName, int iSize, void *pbuf)
return 0;
}
int __MsgFunc_Spectator( const char *pszName, int iSize, void *pbuf )
{
return 0;
@ -235,7 +232,6 @@ void CHud :: Init( void )
m_Menu.Init();
MsgFunc_ResetHUD( 0, 0, NULL );
}
@ -258,8 +254,6 @@ CHud :: ~CHud()
}
m_pHudList = NULL;
}
}
// GetSpriteIndex()
@ -404,7 +398,6 @@ void CHud :: VidInit( void )
m_StatusIcons.VidInit();
m_Scoreboard.VidInit();
m_MOTD.VidInit();
}
int CHud::MsgFunc_Logo( const char *pszName, int iSize, void *pbuf )
@ -441,7 +434,6 @@ void COM_FileBase ( const char *in, char *out)
else
end--; // Found ',', copy to left of '.'
// Scan backward for '/'
start = len - 1;
while( start >= 0 && in[start] != '/' && in[start] != '\\' )
@ -457,6 +449,7 @@ void COM_FileBase ( const char *in, char *out)
// Copy partial string
strncpy( out, &in[start], len );
// Terminate it
out[len] = 0;
}
@ -550,7 +543,6 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
return 1;
}
void CHud::AddHudElem( CHudBase *phudelem )
{
HUDLIST *pdl, *ptemp;
@ -585,5 +577,3 @@ float CHud::GetSensitivity( void )
{
return m_flMouseSensitivity;
}

View File

@ -20,7 +20,6 @@
// CHud handles the message, calculation, and drawing the HUD
//
#define RGB_YELLOWISH 0x00FFA000 //255,160,0
#define RGB_REDISH 0x00FF1010 //255,160,0
#define RGB_GREENISH 0x0000A000 //0,160,0
@ -36,7 +35,8 @@
#define HUDELEM_ACTIVE 1
typedef struct {
typedef struct
{
int x, y;
} POSITION;
@ -47,13 +47,13 @@ enum
MAX_TEAM_NAME = 16
};
typedef struct {
typedef struct
{
unsigned char r, g, b, a;
} RGBA;
typedef struct cvar_s cvar_t;
#define HUD_ACTIVE 1
#define HUD_INTERMISSION 2
@ -77,21 +77,18 @@ public:
virtual void Think( void ) { return; }
virtual void Reset( void ) { return; }
virtual void InitHUDData( void ) {} // called every time a server is connected to
};
struct HUDLIST {
struct HUDLIST
{
CHudBase *p;
HUDLIST *pNext;
};
//
//-----------------------------------------------------
#include "hud_spectator.h"
//
//-----------------------------------------------------
//
@ -133,13 +130,11 @@ private:
WEAPON *m_pWeapon;
int m_HUD_bucket0;
int m_HUD_selection;
};
//
//-----------------------------------------------------
//
class CHudAmmoSecondary : public CHudBase
{
public:
@ -181,7 +176,6 @@ public:
private:
int m_iGeigerRange;
};
//
@ -198,7 +192,6 @@ public:
private:
HSPRITE m_hSprite;
int m_iPos;
};
//
@ -206,7 +199,6 @@ private:
//
// REMOVED: Vgui has replaced this.
//
class CHudMOTD : public CHudBase
{
public:
@ -229,7 +221,6 @@ protected:
int m_iMaxLength;
};
class CHudScoreboard : public CHudBase
{
public:
@ -257,7 +248,6 @@ public:
void GetAllPlayersInfo( void );
};
//
//-----------------------------------------------------
//
@ -274,7 +264,8 @@ public:
int MsgFunc_StatusValue( const char *pszName, int iSize, void *pbuf );
protected:
enum {
enum
{
MAX_STATUSTEXT_LENGTH = 128,
MAX_STATUSBAR_VALUES = 8,
MAX_STATUSBAR_LINES = 2
@ -319,9 +310,9 @@ public:
int m_iShowscoresHeld;
void GetAllPlayersInfo( void );
private:
struct cvar_s *cl_showpacketloss;
};
*/
@ -353,7 +344,6 @@ extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; // additional pl
extern team_info_t g_TeamInfo[MAX_TEAMS + 1];
extern int g_IsSpectator[MAX_PLAYERS + 1];
//
//-----------------------------------------------------
//
@ -407,7 +397,6 @@ public:
friend class CHudSpectator;
private:
struct cvar_s * m_HUD_saytext;
struct cvar_s * m_HUD_saytext_time;
};
@ -433,7 +422,6 @@ private:
int m_iHeight; // width of the battery innards
};
//
//-----------------------------------------------------
//
@ -545,7 +533,8 @@ public:
int Draw( float flTime );
int MsgFunc_StatusIcon( const char *pszName, int iSize, void *pbuf );
enum {
enum
{
MAX_ICONSPRITENAME_LENGTH = MAX_SPRITE_NAME_LENGTH,
MAX_ICONSPRITES = 4
};
@ -556,7 +545,6 @@ public:
void DisableIcon( char *pszIconName );
private:
typedef struct
{
char szSpriteName[MAX_ICONSPRITENAME_LENGTH];
@ -566,13 +554,11 @@ private:
} icon_sprite_t;
icon_sprite_t m_IconList[MAX_ICONSPRITES];
};
//
//-----------------------------------------------------
//
class CHud
{
private:
@ -586,7 +572,6 @@ private:
int m_iConcussionEffect;
public:
HSPRITE m_hsprCursor;
float m_flTime; // the current client time
float m_fOldTime; // the time at which the HUD was last redrawn
@ -683,7 +668,6 @@ public:
void AddHudElem( CHudBase *p );
float GetSensitivity();
};
extern CHud gHUD;
@ -693,4 +677,3 @@ extern int g_iTeamNumber;
extern int g_iUser1;
extern int g_iUser2;
extern int g_iUser3;

View File

@ -15,5 +15,4 @@ typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);
#include "wrect.h"
#include "../engine/cdll_int.h"
extern cl_enginefunc_t gEngfuncs;
#endif

View File

@ -74,7 +74,6 @@ void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
pBeam = pBeam2 = NULL;
}
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -83,7 +82,6 @@ int CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHud::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
{
int armor, blood;
@ -104,7 +102,6 @@ int CHud :: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
count = 10;
// TODO: kick viewangles, show damage visually
return 1;
}

View File

@ -20,7 +20,6 @@
#include "cl_util.h"
//#include "triangleapi.h"
#define MAX_LOGO_FRAMES 56
int grgLogoFrame[MAX_LOGO_FRAMES] =
@ -30,7 +29,6 @@ int grgLogoFrame[MAX_LOGO_FRAMES] =
29, 29, 29, 29, 29, 28, 27, 26, 25, 24, 30, 31
};
extern int g_iVisibleMouse;
float HUD_GetFOV( void );
@ -61,7 +59,6 @@ void CHud::Think(void)
}
// the clients fov is actually set in the client data update section of the hud
// Set a new sensitivity
if( m_iFOV == default_fov->value )
{
@ -76,7 +73,8 @@ void CHud::Think(void)
// think about default fov
if( m_iFOV == 0 )
{ // only let players adjust up in fov, and only if they are not overriden by something else
{
// only let players adjust up in fov, and only if they are not overriden by something else
m_iFOV = max( default_fov->value, 90 );
}
}
@ -95,7 +93,6 @@ int CHud :: Redraw( float flTime, int intermission )
if( m_flTimeDelta < 0 )
m_flTimeDelta = 0;
if( m_flShotTime && m_flShotTime < flTime )
{
gEngfuncs.pfnClientCmd( "snapshot\n" );
@ -119,7 +116,8 @@ int CHud :: Redraw( float flTime, int intermission )
pList->p->Draw( flTime );
}
else
{ // it's an intermission, so only draw hud elements that are set to draw during intermissions
{
// it's an intermission, so only draw hud elements that are set to draw during intermissions
if( pList->p->m_iFlags & HUD_INTERMISSION )
pList->p->Draw( flTime );
}
@ -238,13 +236,11 @@ int CHud :: DrawHudStringLen( char *szIt )
return l;
}
int CHud::DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b )
{
char szString[32];
sprintf( szString, "%d", iNumber );
return DrawHudStringReverse( xpos, ypos, iMinX, szString, r, g, b );
}
// draws a string from right to left (right-aligned)
@ -318,7 +314,6 @@ int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g,
}
// SPR_Draw ones
SPR_DrawAdditive( 0, x, y, &GetSpriteRect( m_HUD_number_0 ) );
x += iWidth;
}
@ -326,7 +321,6 @@ int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g,
return x;
}
int CHud::GetNumWidth( int iNumber, int iFlags )
{
if( iFlags & ( DHN_3DIGITS ) )
@ -350,10 +344,8 @@ int CHud::GetNumWidth( int iNumber, int iFlags )
return 2;
return 3;
}
void CHud::DrawDarkRectangle( int x, int y, int wide, int tall )
{
//gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );

View File

@ -89,6 +89,7 @@ void NET_CALLBACK RulesResponse( struct net_response_s *response )
g_pServers->RulesResponse( response );
}
}
/*
===================
PlayersResponse
@ -103,6 +104,7 @@ void NET_CALLBACK PlayersResponse( struct net_response_s *response )
g_pServers->PlayersResponse( response );
}
}
/*
===================
ListResponse
@ -846,7 +848,6 @@ int CHudServers::LoadMasterAddresses( int maxservers, int *count, netadr_t *padr
}
}
}
finish_master:
if( !nCount )
{
@ -855,7 +856,6 @@ finish_master:
// Convert to netadr_t
if( NET_API->StringToAdr( szMaster, &adr ) )
{
padr[nCount++] = adr;
}
}
@ -999,7 +999,6 @@ int CHudServers::isQuerying()
return m_nRequesting ? 1 : 0;
}
/*
===================
GetServerCount
@ -1031,7 +1030,6 @@ CHudServers::CHudServers( void )
m_fElapsed = 0.0;
m_pPingRequest = NULL;
m_pRulesRequest = NULL;
m_pPlayersRequest = NULL;
@ -1055,7 +1053,6 @@ CHudServers::~CHudServers( void )
{
delete m_pPingRequest;
m_pPingRequest = NULL;
}
if( m_pRulesRequest )

View File

@ -37,5 +37,4 @@ int ServersGetCount( void );
const char *ServersGetInfo( int server );
int ServersIsQuerying( void );
void SortServers( const char *fieldname );
#endif // HUD_SERVERSH

View File

@ -94,5 +94,4 @@ private:
request_t *m_pRulesRequest;
request_t *m_pPlayersRequest;
};
#endif // HUD_SERVERS_PRIVH

View File

@ -24,14 +24,12 @@
#include "studio_util.h"
#include "screenfade.h"
#pragma warning(disable: 4244)
extern "C" int iJumpSpectator;
extern "C" float vJumpOrigin[3];
extern "C" float vJumpAngles[3];
extern void V_GetInEyePos( int entity, float * origin, float * angles );
extern void V_ResetChaseCam();
extern void V_GetChasePos( int target, float * cl_angles, float * origin, float * angles );
@ -46,8 +44,6 @@ extern vec3_t v_sim_org; // last sim origin
void SpectatorMode( void )
{
if( gEngfuncs.Cmd_Argc() <= 1 )
{
gEngfuncs.Con_Printf( "usage: spec_mode <Main Mode> [<Inset Mode>]\n" );
@ -79,7 +75,6 @@ void SpectatorSpray(void)
trace->endpos[0], trace->endpos[1], trace->endpos[2], trace->ent );
gEngfuncs.pfnServerCmd( string );
}
}
void SpectatorHelp( void )
{
@ -105,7 +100,6 @@ void SpectatorMenu( void )
gEngfuncs.Con_Printf( "usage: spec_menu <0|1>\n" );
return;
}
}
void ToggleScores( void )
@ -151,11 +145,9 @@ int CHudSpectator::Init()
return 1;
}
//-----------------------------------------------------------------------------
// UTIL_StringToVector originally from ..\dlls\util.cpp, slightly changed
//-----------------------------------------------------------------------------
void UTIL_StringToVector( float * pVector, const char *pString )
{
char *pstr, *pfront, tempString[128];
@ -170,7 +162,7 @@ void UTIL_StringToVector( float * pVector, const char *pString )
while( *pstr && *pstr != ' ' )
pstr++;
if (!*pstr)
if( !( *pstr ) )
break;
pstr++;
pfront = pstr;
@ -191,9 +183,11 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
cl_entity_t * pEnt = gEngfuncs.GetEntityByIndex( 0 ); // get world model
if ( !pEnt ) return 0;
if( !pEnt )
return 0;
if ( !pEnt->model ) return 0;
if( !pEnt->model )
return 0;
char * data = pEnt->model->entities;
@ -217,7 +211,6 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
}
// we parse the first { now parse entities properties
while( 1 )
{
// parse key
@ -229,7 +222,7 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
{
gEngfuncs.Con_DPrintf( "UTIL_FindEntityInMap: EOF without closing brace\n" );
return 0;
};
}
strcpy( keyname, token );
@ -247,7 +240,7 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
{
gEngfuncs.Con_DPrintf( "UTIL_FindEntityInMap: EOF without closing brace\n" );
return 0;
};
}
if( token[0] == '}' )
{
@ -261,7 +254,7 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
{
found = 1; // thats our entity
}
};
}
if( !strcmp( keyname, "angle" ) )
{
@ -294,25 +287,20 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
if( !strcmp( keyname, "origin" ) )
{
UTIL_StringToVector( origin, token );
};
}
} // while (1)
if( found )
return 1;
}
return 0; // we search all entities, but didn't found the correct
}
//-----------------------------------------------------------------------------
// SetSpectatorStartPosition():
// Get valid map position and 'beam' spectator to this position
//-----------------------------------------------------------------------------
void CHudSpectator::SetSpectatorStartPosition()
{
// search for info_player start
@ -394,7 +382,6 @@ int CHudSpectator::Draw(float flTime)
VectorScale( right, m_moveDelta, right );
VectorAdd( m_mapOrigin, right, m_mapOrigin )
}
// Only draw the icon names only if map mode is in Main Mode
@ -408,12 +395,9 @@ int CHudSpectator::Draw(float flTime)
//gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo();
// loop through all the players and draw additional infos to their sprites on the map
for( int i = 0; i < MAX_PLAYERS; i++ )
{
if( m_vPlayerPos[i][2] < 0 ) // marked as invisible ?
continue;
@ -423,8 +407,8 @@ int CHudSpectator::Draw(float flTime)
if( m_vPlayerPos[i][0] > XRES( m_OverviewData.insetWindowX ) &&
m_vPlayerPos[i][1] > YRES( m_OverviewData.insetWindowY ) &&
m_vPlayerPos[i][0] < XRES( m_OverviewData.insetWindowX + m_OverviewData.insetWindowWidth ) &&
m_vPlayerPos[i][1] < YRES( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight)
) continue;
m_vPlayerPos[i][1] < YRES( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight) )
continue;
}
color = GetClientColor( i + 1 );
@ -436,13 +420,11 @@ int CHudSpectator::Draw(float flTime)
DrawSetTextColor( color[0], color[1], color[2] );
DrawConsoleString( m_vPlayerPos[i][0] - lx,m_vPlayerPos[i][1], string );
}
return 1;
}
void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
{
float value;
@ -462,9 +444,7 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
// fake a InitHUD & ResetHUD message
gHUD.MsgFunc_InitHUD( NULL, 0, NULL );
gHUD.MsgFunc_ResetHUD( NULL, 0, NULL );
break;
case DRC_CMD_EVENT:
m_lastPrimaryObject = READ_WORD();
m_lastSecondaryObject = READ_WORD();
@ -481,14 +461,12 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
// gEngfuncs.Con_Printf( "Director Camera: %i %i\n", firstObject, secondObject );
break;
case DRC_CMD_MODE:
if( m_autoDirector->value )
{
SetModes( READ_BYTE(), -1 );
}
break;
case DRC_CMD_CAMERA:
if( m_autoDirector->value )
{
@ -505,7 +483,6 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
iJumpSpectator = 1;
}
break;
case DRC_CMD_MESSAGE:
{
client_textmessage_t * msg = &m_HUDMessages[m_lastHudMessage];
@ -536,45 +513,33 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
m_lastHudMessage++;
m_lastHudMessage %= MAX_SPEC_HUD_MESSAGES;
}
break;
case DRC_CMD_SOUND:
string = READ_STRING();
value = READ_FLOAT();
// gEngfuncs.Con_Printf("DRC_CMD_FX_SOUND: %s %.2f\n", string, value );
gEngfuncs.pEventAPI->EV_PlaySound( 0, v_origin, CHAN_BODY, string, value, ATTN_NORM, 0, PITCH_NORM );
break;
case DRC_CMD_TIMESCALE:
value = READ_FLOAT();
break;
case DRC_CMD_STATUS:
READ_LONG(); // total number of spectator slots
m_iSpectatorNumber = READ_LONG(); // total number of spectator
READ_WORD(); // total number of relay proxies
break;
case DRC_CMD_BANNER:
// gEngfuncs.Con_DPrintf( "GUI: Banner %s\n",READ_STRING() ); // name of banner tga eg gfx/temp/7454562234563475.tga
break;
case DRC_CMD_FADE:
break;
case DRC_CMD_STUFFTEXT:
ClientCmd( READ_STRING() );
break;
default : gEngfuncs.Con_DPrintf("CHudSpectator::DirectorMessage: unknown command %i.\n", cmd );
default:
gEngfuncs.Con_DPrintf( "CHudSpectator::DirectorMessage: unknown command %i.\n", cmd );
}
}
@ -611,8 +576,6 @@ void CHudSpectator::FindNextPlayer(bool bReverse)
//gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo();
do
{
iCurrent += iDir;
@ -629,10 +592,8 @@ void CHudSpectator::FindNextPlayer(bool bReverse)
continue;
// MOD AUTHORS: Add checks on target here.
g_iUser2 = iCurrent;
break;
} while( iCurrent != iStart );
// Did we find a target?
@ -695,19 +656,14 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
{
if( g_iUser1 == OBS_CHASE_LOCKED )
newMainMode = OBS_CHASE_FREE;
else if( g_iUser1 == OBS_CHASE_FREE )
newMainMode = OBS_IN_EYE;
else if( g_iUser1 == OBS_IN_EYE )
newMainMode = OBS_ROAMING;
else if( g_iUser1 == OBS_ROAMING )
newMainMode = OBS_MAP_FREE;
else if( g_iUser1 == OBS_MAP_FREE )
newMainMode = OBS_MAP_CHASE;
else
newMainMode = OBS_CHASE_FREE; // don't use OBS_CHASE_LOCKED anymore
}
@ -721,7 +677,6 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
{
gEngfuncs.SetViewAngles( vJumpAngles );
iJumpSpectator = 1;
}
// lease directed mode if player want to see another player
m_autoDirector->value = 0.0f;
@ -750,7 +705,6 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
void CHudSpectator::HandleButtonsUp( int ButtonPressed )
{
if( ButtonPressed & ( IN_FORWARD | IN_BACK ) )
m_zoomDelta = 0.0f;
@ -799,12 +753,12 @@ void CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode)
switch( iNewMainMode )
{
case OBS_CHASE_LOCKED: g_iUser1 = OBS_CHASE_LOCKED;
case OBS_CHASE_LOCKED:
g_iUser1 = OBS_CHASE_LOCKED;
break;
case OBS_CHASE_FREE : g_iUser1 = OBS_CHASE_FREE;
case OBS_CHASE_FREE:
g_iUser1 = OBS_CHASE_FREE;
break;
case OBS_ROAMING: // jump to current vJumpOrigin/angle
g_iUser1 = OBS_ROAMING;
if( g_iUser2 )
@ -814,17 +768,17 @@ void CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode)
iJumpSpectator = 1;
}
break;
case OBS_IN_EYE : g_iUser1 = OBS_IN_EYE;
case OBS_IN_EYE:
g_iUser1 = OBS_IN_EYE;
break;
case OBS_MAP_FREE : g_iUser1 = OBS_MAP_FREE;
case OBS_MAP_FREE:
g_iUser1 = OBS_MAP_FREE;
// reset user values
m_mapZoom = m_OverviewData.zoom;
m_mapOrigin = m_OverviewData.origin;
break;
case OBS_MAP_CHASE : g_iUser1 = OBS_MAP_CHASE;
case OBS_MAP_CHASE:
g_iUser1 = OBS_MAP_CHASE;
// reset user values
m_mapZoom = m_OverviewData.zoom;
m_mapOrigin = m_OverviewData.origin;
@ -864,7 +818,6 @@ bool CHudSpectator::IsActivePlayer(cl_entity_t * ent)
);
}
bool CHudSpectator::ParseOverviewFile()
{
char filename[255] = { 0 };
@ -905,7 +858,6 @@ bool CHudSpectator::ParseOverviewFile( )
return false;
}
while( true )
{
pfile = gEngfuncs.COM_ParseFile( pfile, token );
@ -956,7 +908,6 @@ bool CHudSpectator::ParseOverviewFile( )
m_OverviewData.insetWindowWidth = atof( token );
pfile = gEngfuncs.COM_ParseFile( pfile, token );
m_OverviewData.insetWindowHeight = atof( token );
}
else
{
@ -965,13 +916,11 @@ bool CHudSpectator::ParseOverviewFile( )
}
pfile = gEngfuncs.COM_ParseFile( pfile, token ); // parse next token
}
}
else if( !stricmp( token, "layer" ) )
{
// parse a layer data
if( m_OverviewData.layers == OVERVIEW_MAX_LAYERS )
{
gEngfuncs.Con_Printf( "Error parsing overview file %s. ( too many layers )\n", filename );
@ -980,7 +929,6 @@ bool CHudSpectator::ParseOverviewFile( )
pfile = gEngfuncs.COM_ParseFile( pfile, token );
if( stricmp( token, "{" ) )
{
gEngfuncs.Con_Printf( "Error parsing overview file %s. (expected { )\n", filename );
@ -995,8 +943,6 @@ bool CHudSpectator::ParseOverviewFile( )
{
pfile = gEngfuncs.COM_ParseFile( pfile, token );
strcpy( m_OverviewData.layersImages[m_OverviewData.layers], token );
}
else if ( !stricmp( token, "height" ) )
{
@ -1014,7 +960,6 @@ bool CHudSpectator::ParseOverviewFile( )
}
m_OverviewData.layers++;
}
}
@ -1024,7 +969,6 @@ bool CHudSpectator::ParseOverviewFile( )
m_mapOrigin = m_OverviewData.origin;
return true;
}
void CHudSpectator::LoadMapSprites()
@ -1059,10 +1003,8 @@ void CHudSpectator::DrawOverviewLayer()
yTiles = 6;
}
screenaspect = 4.0f / 3.0f;
xs = m_OverviewData.origin[0];
ys = m_OverviewData.origin[1];
z = ( 90.0f - v_angles[0] ) / 90.0f;
@ -1076,7 +1018,6 @@ void CHudSpectator::DrawOverviewLayer()
frame = 0;
// rotated view ?
if( m_OverviewData.rotated )
{
@ -1122,14 +1063,10 @@ void CHudSpectator::DrawOverviewLayer()
xStep = -( 2 * 4096.0f / m_OverviewData.zoom ) / xTiles;
yStep = -( 2 * 4096.0f / ( m_OverviewData.zoom* screenaspect ) ) / yTiles;
x = xs + ( 4096.0f / ( m_OverviewData.zoom * screenaspect ) );
for( ix = 0; ix < yTiles; ix++ )
{
y = ys + ( 4096.0f / ( m_OverviewData.zoom ) );
for( iy = 0; iy < xTiles; iy++ )
@ -1159,7 +1096,6 @@ void CHudSpectator::DrawOverviewLayer()
}
x += xStep;
}
}
}
@ -1175,7 +1111,6 @@ void CHudSpectator::DrawOverviewEntities()
float zScale = ( 90.0f - v_angles[0] ) / 90.0f;
z = m_OverviewData.layersHeights[0] * zScale;
// get yellow/brown HUD color
UnpackRGB( ir, ig, ib, RGB_YELLOWISH );
@ -1202,7 +1137,6 @@ void CHudSpectator::DrawOverviewEntities()
// see R_DrawSpriteModel
// draws players sprite
AngleVectors( ent->angles, right, up, NULL );
VectorCopy( ent->origin,origin );
@ -1238,9 +1172,9 @@ void CHudSpectator::DrawOverviewEntities()
gEngfuncs.pTriAPI->End();
if( !ent->player )
continue;
// draw line under player icons
origin[2] *= zScale;
@ -1304,7 +1238,6 @@ void CHudSpectator::DrawOverviewEntities()
return;
// get current camera position and angle
if( m_pip->value == INSET_IN_EYE || g_iUser1 == OBS_IN_EYE )
{
V_GetInEyePos( g_iUser2, origin, angles );
@ -1321,9 +1254,7 @@ void CHudSpectator::DrawOverviewEntities()
else
V_GetChasePos( g_iUser2, NULL, origin, angles );
// draw camera sprite
x = origin[0];
y = origin[1];
z = origin[2];
@ -1334,7 +1265,6 @@ void CHudSpectator::DrawOverviewEntities()
gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );
gEngfuncs.pTriAPI->SpriteTexture( hSpriteModel, 0 );
gEngfuncs.pTriAPI->Color4f( r, g, b, 1.0 );
AngleVectors( angles, forward, NULL, NULL );
@ -1361,11 +1291,8 @@ void CHudSpectator::DrawOverviewEntities()
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->Vertex3f( x + left[0], y + left[1], ( z + left[2] ) * zScale );
gEngfuncs.pTriAPI->End ();
}
void CHudSpectator::DrawOverview()
{
// draw only in sepctator mode
@ -1383,6 +1310,7 @@ void CHudSpectator::DrawOverview()
DrawOverviewEntities();
CheckOverviewEntities();
}
void CHudSpectator::CheckOverviewEntities()
{
double time = gEngfuncs.GetClientTime();
@ -1413,9 +1341,15 @@ bool CHudSpectator::AddOverviewEntity( int type, struct cl_entity_s *ent, const
switch ( g_PlayerExtraInfo[ent->index].teamnumber )
{
// blue and red teams are swapped in CS and TFC
case 1 : hSprite = m_hsprPlayerBlue; break;
case 2 : hSprite = m_hsprPlayerRed; break;
default : hSprite = m_hsprPlayer; break;
case 1:
hSprite = m_hsprPlayerBlue;
break;
case 2:
hSprite = m_hsprPlayerRed;
break;
default:
hSprite = m_hsprPlayer;
break;
}
}
else
@ -1456,10 +1390,10 @@ bool CHudSpectator::AddOverviewEntityToList(HSPRITE sprite, cl_entity_t *ent, do
return false; // maximum overview entities reached
}
void CHudSpectator::CheckSettings()
{
// disallow same inset mode as main mode:
m_pip->value = (int)m_pip->value;
if( ( g_iUser1 < OBS_MAP_FREE ) && ( m_pip->value == INSET_CHASE_FREE || m_pip->value == INSET_IN_EYE ) )
@ -1509,8 +1443,6 @@ void CHudSpectator::CheckSettings()
SetCrosshair( 0, m_crosshairRect, 0, 0, 0 );
}
// if we are a real player on server don't allow inset window
// in First Person mode since this is our resticted forcecamera mode 2
// team number 3 = SPECTATOR see player.h
@ -1551,6 +1483,7 @@ int CHudSpectator::ToggleInset(bool allowOff)
return newInsetMode;
}
void CHudSpectator::Reset()
{
// Reset HUD
@ -1592,4 +1525,3 @@ void CHudSpectator::InitHUDData()
// reset HUD FOV
gHUD.m_iFOV = CVAR_GET_FLOAT( "default_fov" );
}

View File

@ -11,8 +11,6 @@
#include "cl_entity.h"
#define INSET_OFF 0
#define INSET_CHASE_FREE 1
#define INSET_IN_EYE 2
@ -21,8 +19,6 @@
#define MAX_SPEC_HUD_MESSAGES 8
#define OVERVIEW_TILE_SIZE 128 // don't change this
#define OVERVIEW_MAX_LAYERS 1
@ -30,7 +26,8 @@
// Purpose: Handles the drawing of the spectator stuff (camera & top-down map and all the things on it )
//-----------------------------------------------------------------------------
typedef struct overviewInfo_s {
typedef struct overviewInfo_s
{
char map[64]; // cl.levelname or empty
vec3_t origin; // center of map
float zoom; // zoom of map images
@ -45,8 +42,8 @@ typedef struct overviewInfo_s {
int insetWindowWidth;
} overviewInfo_t;
typedef struct overviewEntity_s {
typedef struct overviewEntity_s
{
HSPRITE hSprite;
struct cl_entity_s * entity;
double killTime;
@ -100,13 +97,11 @@ public:
cvar_t *m_autoDirector;
cvar_t *m_pip;
qboolean m_chatEnabled;
vec3_t m_cameraOrigin; // a help camera
vec3_t m_cameraAngles; // and it's angles
private:
vec3_t m_vPlayerPos[MAX_PLAYERS];
HSPRITE m_hsprPlayerBlue;
@ -128,5 +123,4 @@ private:
int m_lastPrimaryObject;
int m_lastSecondaryObject;
};
#endif // SPECTATOR_H

View File

@ -50,5 +50,3 @@ int CHud::UpdateClientData(client_data_t *cdata, float time)
// return 1 if in anything in the client_data struct has been changed, 0 otherwise
return 1;
}

View File

@ -15,7 +15,6 @@
#include "camera.h"
#include "in_defs.h"
float CL_KeyState( kbutton_t *key );
extern "C"
@ -66,7 +65,6 @@ cvar_t *c_mindistance;
// pitch, yaw, dist
vec3_t cam_ofs;
// In third person
int cam_thirdperson;
int cam_mousemove; //true if we are moving the cam with the mouse, False if not
@ -87,7 +85,6 @@ void CAM_ToFirstPerson(void);
void CAM_StartDistance(void);
void CAM_EndDistance(void);
//-------------------------------------------------- Local Functions
float MoveToward( float cur, float goal, float maxspeed )
@ -118,7 +115,6 @@ float MoveToward( float cur, float goal, float maxspeed )
}
}
// bring cur back into range
if( cur < 0 )
cur += 360.0;
@ -128,7 +124,6 @@ float MoveToward( float cur, float goal, float maxspeed )
return cur;
}
//-------------------------------------------------- Gobal Functions
typedef struct
@ -163,11 +158,9 @@ void DLLEXPORT CAM_Think( void )
case CAM_COMMAND_TOTHIRDPERSON:
CAM_ToThirdPerson();
break;
case CAM_COMMAND_TOFIRSTPERSON:
CAM_ToFirstPerson();
break;
case CAM_COMMAND_NONE:
default:
break;
@ -175,7 +168,6 @@ void DLLEXPORT CAM_Think( void )
if( !cam_thirdperson )
return;
#ifdef LATER
if( cam_contain->value )
{
@ -183,10 +175,10 @@ void DLLEXPORT CAM_Think( void )
ext[0] = ext[1] = ext[2] = 0.0;
}
#endif
camAngles[PITCH] = cam_idealpitch->value;
camAngles[YAW] = cam_idealyaw->value;
dist = cam_idealdist->value;
//
//movement of the camera with the mouse
//
@ -194,23 +186,22 @@ void DLLEXPORT CAM_Think( void )
{
//get windows cursor position
GetCursorPos( &cam_mouse );
//check for X delta values and adjust accordingly
//eventually adjust YAW based on amount of movement
//don't do any movement of the cam using YAW/PITCH if we are zooming in/out the camera
if( !cam_distancemove )
{
//keep the camera within certain limits around the player (ie avoid certain bad viewing angles)
if( cam_mouse.x>gEngfuncs.GetWindowCenterX() )
{
//if( ( camAngles[YAW] >= 225.0 ) || ( camAngles[YAW] < 135.0 ) )
if( camAngles[YAW] < c_maxyaw->value )
{
camAngles[ YAW ] += (CAM_ANGLE_MOVE)*((cam_mouse.x-gEngfuncs.GetWindowCenterX())/2);
camAngles[YAW] += CAM_ANGLE_MOVE * ( ( cam_mouse.x - gEngfuncs.GetWindowCenterX() ) / 2 );
}
if( camAngles[YAW] > c_maxyaw->value )
{
camAngles[YAW] = c_maxyaw->value;
}
}
@ -219,13 +210,11 @@ void DLLEXPORT CAM_Think( void )
//if( ( camAngles[YAW] <= 135.0 ) || ( camAngles[YAW] > 225.0 ) )
if( camAngles[YAW] > c_minyaw->value )
{
camAngles[ YAW ] -= (CAM_ANGLE_MOVE)* ((gEngfuncs.GetWindowCenterX()-cam_mouse.x)/2);
camAngles[YAW] -= CAM_ANGLE_MOVE * ( ( gEngfuncs.GetWindowCenterX() - cam_mouse.x ) / 2 );
}
if( camAngles[YAW] < c_minyaw->value )
{
camAngles[YAW] = c_minyaw->value;
}
}
@ -236,7 +225,7 @@ void DLLEXPORT CAM_Think( void )
{
if( camAngles[PITCH] < c_maxpitch->value )
{
camAngles[PITCH] +=(CAM_ANGLE_MOVE)* ((cam_mouse.y-gEngfuncs.GetWindowCenterY())/2);
camAngles[PITCH] += CAM_ANGLE_MOVE * ( ( cam_mouse.y - gEngfuncs.GetWindowCenterY() ) / 2 );
}
if( camAngles[PITCH] > c_maxpitch->value )
{
@ -247,7 +236,7 @@ void DLLEXPORT CAM_Think( void )
{
if( camAngles[PITCH] > c_minpitch->value )
{
camAngles[PITCH] -= (CAM_ANGLE_MOVE)*((gEngfuncs.GetWindowCenterY()-cam_mouse.y)/2);
camAngles[PITCH] -= CAM_ANGLE_MOVE * ( ( gEngfuncs.GetWindowCenterY() - cam_mouse.y ) / 2 );
}
if( camAngles[PITCH] < c_minpitch->value )
{
@ -257,7 +246,6 @@ void DLLEXPORT CAM_Think( void )
//set old mouse coordinates to current mouse coordinates
//since we are done with the mouse
if( ( flSensitivity = gHUD.GetSensitivity() ) != 0 )
{
cam_old_mouse_x = cam_mouse.x * flSensitivity;
@ -293,7 +281,6 @@ void DLLEXPORT CAM_Think( void )
camAngles[YAW] = 0;
dist = CAM_MIN_DIST;
}
}
else if( CL_KeyState( &cam_out ) )
dist += CAM_DIST_DELTA;
@ -315,7 +302,7 @@ void DLLEXPORT CAM_Think( void )
{
if( dist > c_mindistance->value )
{
dist -= (CAM_DIST_DELTA)*((gEngfuncs.GetWindowCenterY()-cam_mouse.y)/2);
dist -= CAM_DIST_DELTA * ( ( gEngfuncs.GetWindowCenterY() - cam_mouse.y ) / 2 );
}
if ( dist < c_mindistance->value )
{
@ -409,23 +396,69 @@ void DLLEXPORT CAM_Think( void )
extern void KeyDown( kbutton_t *b ); // HACK
extern void KeyUp( kbutton_t *b ); // HACK
void CAM_PitchUpDown(void) { KeyDown( &cam_pitchup ); }
void CAM_PitchUpUp(void) { KeyUp( &cam_pitchup ); }
void CAM_PitchDownDown(void) { KeyDown( &cam_pitchdown ); }
void CAM_PitchDownUp(void) { KeyUp( &cam_pitchdown ); }
void CAM_YawLeftDown(void) { KeyDown( &cam_yawleft ); }
void CAM_YawLeftUp(void) { KeyUp( &cam_yawleft ); }
void CAM_YawRightDown(void) { KeyDown( &cam_yawright ); }
void CAM_YawRightUp(void) { KeyUp( &cam_yawright ); }
void CAM_InDown(void) { KeyDown( &cam_in ); }
void CAM_InUp(void) { KeyUp( &cam_in ); }
void CAM_OutDown(void) { KeyDown( &cam_out ); }
void CAM_OutUp(void) { KeyUp( &cam_out ); }
void CAM_PitchUpDown( void )
{
KeyDown( &cam_pitchup );
}
void CAM_PitchUpUp( void )
{
KeyUp( &cam_pitchup );
}
void CAM_PitchDownDown( void )
{
KeyDown( &cam_pitchdown );
}
void CAM_PitchDownUp( void )
{
KeyUp( &cam_pitchdown );
}
void CAM_YawLeftDown( void )
{
KeyDown( &cam_yawleft );
}
void CAM_YawLeftUp( void )
{
KeyUp( &cam_yawleft );
}
void CAM_YawRightDown( void )
{
KeyDown( &cam_yawright );
}
void CAM_YawRightUp( void )
{
KeyUp( &cam_yawright );
}
void CAM_InDown( void )
{
KeyDown( &cam_in );
}
void CAM_InUp( void )
{
KeyUp( &cam_in );
}
void CAM_OutDown( void )
{
KeyDown( &cam_out );
}
void CAM_OutUp( void )
{
KeyUp( &cam_out );
}
void CAM_ToThirdPerson( void )
{
vec3_t viewangles;
#if !defined( _DEBUG )
if( gEngfuncs.GetMaxClients() > 1 )
{
@ -433,7 +466,6 @@ void CAM_ToThirdPerson(void)
return;
}
#endif
gEngfuncs.GetViewAngles( (float *)viewangles );
if( !cam_thirdperson )
@ -569,7 +601,6 @@ void CAM_EndMouseMove(void)
iMouseInUse = 0;
}
//----------------------------------------------------------
//routines to start the process of moving the cam in or out
//using the mouse

View File

@ -19,12 +19,12 @@
#ifdef _WIN32
#include <windows.h>
#else
typedef struct point_s{
typedef struct point_s
{
int x;
int y;
} POINT;
#define GetCursorPos(x)
#define SetCursorPos(x,y)
#endif
#endif

View File

@ -11,6 +11,7 @@
// Quake is a trademark of Id Software, Inc., (c) 1996 Id Software, Inc. All
// rights reserved.
#include "hud.h"
#include "cl_util.h"
#include "camera.h"
@ -74,6 +75,7 @@ cvar_t *cl_yawspeed;
cvar_t *cl_pitchspeed;
cvar_t *cl_anglespeedkey;
cvar_t *cl_vsmoothing;
/*
===============================================================================
@ -95,7 +97,6 @@ state bit 2 is edge triggered on the down to up transition
===============================================================================
*/
kbutton_t in_mlook;
kbutton_t in_klook;
kbutton_t in_jlook;
@ -341,7 +342,8 @@ void KeyUp (kbutton_t *b)
if( c[0] )
k = atoi(c);
else
{ // typed manually at the console, assume for unsticking, so clear all
{
// typed manually at the console, assume for unsticking, so clear all
b->down[0] = b->down[1] = 0;
b->state = 4; // impulse up
return;
@ -375,25 +377,83 @@ Return 1 to allow engine to process the key, otherwise, act on it as needed
*/
int DLLEXPORT HUD_Key_Event( int down, int keynum, const char *pszCurrentBinding )
{
return 1;
}
void IN_BreakDown( void ) { KeyDown( &in_break ); }
void IN_BreakUp( void ) { KeyUp( &in_break ); }
void IN_KLookDown (void) {KeyDown(&in_klook);}
void IN_KLookUp (void) {KeyUp(&in_klook);}
void IN_JLookDown (void) {KeyDown(&in_jlook);}
void IN_JLookUp (void) {KeyUp(&in_jlook);}
void IN_MLookDown (void) {KeyDown(&in_mlook);}
void IN_UpDown(void) {KeyDown(&in_up);}
void IN_UpUp(void) {KeyUp(&in_up);}
void IN_DownDown(void) {KeyDown(&in_down);}
void IN_DownUp(void) {KeyUp(&in_down);}
void IN_LeftDown(void) {KeyDown(&in_left);}
void IN_LeftUp(void) {KeyUp(&in_left);}
void IN_RightDown(void) {KeyDown(&in_right);}
void IN_RightUp(void) {KeyUp(&in_right);}
void IN_BreakDown( void )
{
KeyDown( &in_break );
}
void IN_BreakUp( void )
{
KeyUp( &in_break );
}
void IN_KLookDown( void )
{
KeyDown( &in_klook );
}
void IN_KLookUp( void )
{
KeyUp( &in_klook );
}
void IN_JLookDown( void )
{
KeyDown( &in_jlook );
}
void IN_JLookUp( void )
{
KeyUp( &in_jlook );
}
void IN_MLookDown( void )
{
KeyDown( &in_mlook );
}
void IN_UpDown( void )
{
KeyDown( &in_up );
}
void IN_UpUp( void )
{
KeyUp( &in_up );
}
void IN_DownDown( void )
{
KeyDown( &in_down );
}
void IN_DownUp( void )
{
KeyUp( &in_down );
}
void IN_LeftDown( void )
{
KeyDown( &in_left );
}
void IN_LeftUp( void )
{
KeyUp( &in_left );
}
void IN_RightDown( void )
{
KeyDown( &in_right );
}
void IN_RightUp( void )
{
KeyUp( &in_right );
}
void IN_ForwardDown( void )
{
@ -418,10 +478,27 @@ void IN_BackUp(void)
KeyUp( &in_back );
gHUD.m_Spectator.HandleButtonsUp( IN_BACK );
}
void IN_LookupDown(void) {KeyDown(&in_lookup);}
void IN_LookupUp(void) {KeyUp(&in_lookup);}
void IN_LookdownDown(void) {KeyDown(&in_lookdown);}
void IN_LookdownUp(void) {KeyUp(&in_lookdown);}
void IN_LookupDown( void )
{
KeyDown( &in_lookup );
}
void IN_LookupUp( void )
{
KeyUp( &in_lookup );
}
void IN_LookdownDown( void )
{
KeyDown( &in_lookdown );
}
void IN_LookdownUp( void )
{
KeyUp( &in_lookdown );
}
void IN_MoveleftDown( void )
{
KeyDown( &in_moveleft );
@ -445,10 +522,26 @@ void IN_MoverightUp(void)
KeyUp( &in_moveright );
gHUD.m_Spectator.HandleButtonsUp( IN_MOVERIGHT );
}
void IN_SpeedDown(void) {KeyDown(&in_speed);}
void IN_SpeedUp(void) {KeyUp(&in_speed);}
void IN_StrafeDown(void) {KeyDown(&in_strafe);}
void IN_StrafeUp(void) {KeyUp(&in_strafe);}
void IN_SpeedDown( void )
{
KeyDown( &in_speed );
}
void IN_SpeedUp( void )
{
KeyUp( &in_speed );
}
void IN_StrafeDown( void )
{
KeyDown( &in_strafe );
}
void IN_StrafeUp( void )
{
KeyUp( &in_strafe );
}
// needs capture by hud/vgui also
extern void __CmdFunc_InputPlayerSpecial( void );
@ -460,33 +553,71 @@ void IN_Attack2Down(void)
gHUD.m_Spectator.HandleButtonsDown( IN_ATTACK2 );
}
void IN_Attack2Up(void) {KeyUp(&in_attack2);}
void IN_Attack2Up( void )
{
KeyUp( &in_attack2 );
}
void IN_UseDown( void )
{
KeyDown( &in_use );
gHUD.m_Spectator.HandleButtonsDown( IN_USE );
}
void IN_UseUp (void) {KeyUp(&in_use);}
void IN_UseUp( void )
{
KeyUp( &in_use );
}
void IN_JumpDown( void )
{
KeyDown( &in_jump );
gHUD.m_Spectator.HandleButtonsDown( IN_JUMP );
}
void IN_JumpUp (void) {KeyUp(&in_jump);}
void IN_JumpUp( void )
{
KeyUp( &in_jump );
}
void IN_DuckDown( void )
{
KeyDown( &in_duck );
gHUD.m_Spectator.HandleButtonsDown( IN_DUCK );
}
void IN_DuckUp(void) {KeyUp(&in_duck);}
void IN_ReloadDown(void) {KeyDown(&in_reload);}
void IN_ReloadUp(void) {KeyUp(&in_reload);}
void IN_Alt1Down(void) {KeyDown(&in_alt1);}
void IN_Alt1Up(void) {KeyUp(&in_alt1);}
void IN_GraphDown(void) {KeyDown(&in_graph);}
void IN_GraphUp(void) {KeyUp(&in_graph);}
void IN_DuckUp( void )
{
KeyUp( &in_duck );
}
void IN_ReloadDown( void )
{
KeyDown( &in_reload );
}
void IN_ReloadUp( void )
{
KeyUp( &in_reload );
}
void IN_Alt1Down( void )
{
KeyDown( &in_alt1 );
}
void IN_Alt1Up( void )
{
KeyUp( &in_alt1 );
}
void IN_GraphDown( void )
{
KeyDown( &in_graph );
}
void IN_GraphUp( void )
{
KeyUp( &in_graph );
}
void IN_AttackDown( void )
{
@ -609,6 +740,7 @@ void CL_AdjustAngles ( float frametime, float *viewangles )
viewangles[YAW] += speed * cl_yawspeed->value * CL_KeyState( &in_left );
viewangles[YAW] = anglemod( viewangles[YAW] );
}
if( in_klook.state & 1 )
{
viewangles[PITCH] -= speed * cl_pitchspeed->value * CL_KeyState( &in_forward );
@ -715,7 +847,6 @@ void DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int activ
//
cmd->buttons = CL_ButtonBits( 1 );
// Using joystick?
if( in_joystick->value )
{
@ -776,7 +907,6 @@ int CL_ButtonBits( int bResetState )
bits |= IN_ATTACK;
}
if( in_duck.state & 3 )
{
bits |= IN_DUCK;

View File

@ -131,7 +131,6 @@ void IN_ToggleButtons( float forwardmove, float sidemove )
moveflags &= ~L;
in_moveleft.state &= ~BUTTON_DOWN;
}
}
void IN_ClientMoveEvent( float forwardmove, float sidemove )
@ -148,13 +147,15 @@ void IN_ClientLookEvent( float relyaw, float relpitch )
rel_yaw += relyaw;
rel_pitch += relpitch;
}
// Rotate camera and add move values to usercmd
void IN_Move( float frametime, usercmd_t *cmd )
{
Vector viewangles;
gEngfuncs.GetViewAngles( viewangles );
bool fLadder = false;
if( cl_laddermode->value !=2 ) fLadder = gEngfuncs.GetLocalPlayer()->curstate.movetype == MOVETYPE_FLY;
if( cl_laddermode->value != 2 )
fLadder = gEngfuncs.GetLocalPlayer()->curstate.movetype == MOVETYPE_FLY;
//if( ac_forwardmove || ac_sidemove )
//gEngfuncs.Con_Printf( "Move: %f %f %f %f\n", ac_forwardmove, ac_sidemove, rel_pitch, rel_yaw );
#if 0
@ -199,14 +200,15 @@ void IN_Move( float frametime, usercmd_t *cmd )
if( ac_movecount )
{
IN_ToggleButtons( ac_forwardmove / ac_movecount, ac_sidemove / ac_movecount );
if( ac_forwardmove ) cmd->forwardmove = ac_forwardmove * cl_forwardspeed->value / ac_movecount;
if( ac_sidemove ) cmd->sidemove = ac_sidemove * cl_sidespeed->value / ac_movecount;
if( ac_forwardmove )
cmd->forwardmove = ac_forwardmove * cl_forwardspeed->value / ac_movecount;
if( ac_sidemove )
cmd->sidemove = ac_sidemove * cl_sidespeed->value / ac_movecount;
if(in_speed.state & 1)
{
cmd->forwardmove *= cl_movespeedkey->value;
cmd->sidemove *= cl_movespeedkey->value;
}
}
ac_sidemove = ac_forwardmove = rel_pitch = rel_yaw = 0;
@ -263,6 +265,7 @@ void IN_Commands ( void )
void IN_Shutdown( void )
{
}
// Register cvars and reset data
void IN_Init( void )
{

View File

@ -187,7 +187,6 @@ void DLLEXPORT IN_DeactivateMouse (void)
{
if( restore_spi )
SystemParametersInfo( SPI_SETMOUSE, 0, originalmouseparms, 0 );
mouseactive = 0;
}
}
@ -410,7 +409,6 @@ void DLLEXPORT IN_Accumulate (void)
IN_ResetMouse();
}
}
}
/*
@ -494,7 +492,6 @@ void IN_StartupJoystick (void)
joy_advancedinit = 0;
}
/*
===========
RawValuePointer
@ -521,7 +518,6 @@ PDWORD RawValuePointer (int axis)
return &ji.dwXpos;
}
/*
===========
Joy_AdvancedUpdate_f
@ -529,7 +525,6 @@ Joy_AdvancedUpdate_f
*/
void Joy_AdvancedUpdate_f( void )
{
// called once by IN_ReadJoystick and by user whenever an update is needed
// cvars are now available
int i;
@ -593,7 +588,6 @@ void Joy_AdvancedUpdate_f (void)
}
}
/*
===========
IN_Commands
@ -609,7 +603,6 @@ void IN_Commands (void)
return;
}
// loop through the joystick buttons
// key a joystick event or auxillary event for higher number buttons for each state change
buttonstate = ji.dwButtons;
@ -663,7 +656,6 @@ void IN_Commands (void)
}
}
/*
===============
IN_ReadJoystick
@ -671,7 +663,6 @@ IN_ReadJoystick
*/
int IN_ReadJoystick( void )
{
memset( &ji, 0, sizeof(ji) );
ji.dwSize = sizeof(ji);
ji.dwFlags = joy_flags;
@ -698,7 +689,6 @@ int IN_ReadJoystick (void)
}
}
/*
===========
IN_JoyMove
@ -713,7 +703,6 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
gEngfuncs.GetViewAngles( (float *)viewangles );
// complete initialization if first time in
// this is needed as cvars are not available at initialization time
if( joy_advancedinit != 1 )
@ -797,14 +786,12 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
}
}
break;
case AxisSide:
if( fabs( fAxisValue ) > joy_sidethreshold->value )
{
cmd->sidemove += ( fAxisValue * joy_sidesensitivity->value ) * speed * cl_sidespeed->value;
}
break;
case AxisTurn:
if( ( in_strafe.state & 1 ) || ( lookstrafe->value && ( in_jlook.state & 1 ) ) )
{
@ -830,7 +817,6 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
}
}
break;
case AxisLook:
if( in_jlook.state & 1 )
{
@ -848,7 +834,6 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
}
}
break;
default:
break;
}
@ -861,7 +846,6 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
viewangles[PITCH] = -cl_pitchup->value;
gEngfuncs.SetViewAngles( (float *)viewangles );
}
/*

View File

@ -14,5 +14,4 @@ typedef struct kbutton_s
int down[2]; // key nums holding it down
int state; // low bit is down state
} kbutton_t;
#endif // !KBUTTONH

View File

@ -17,6 +17,7 @@
//
// generic menu handler
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
@ -68,7 +69,8 @@ int CHudMenu :: Draw( float flTime )
if( m_flShutoffTime > 0 )
{
if( m_flShutoffTime <= gHUD.m_flTime )
{ // times up, shutoff
{
// times up, shutoff
m_fMenuDisplayed = 0;
m_iFlags &= ~HUD_ACTIVE;
return 1;
@ -76,11 +78,7 @@ int CHudMenu :: Draw( float flTime )
}
// don't draw the menu if the scoreboard is being shown
// draw the menu, along the left-hand side of the screen
// count the number of newlines
int nlc = 0;
for( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
@ -124,7 +122,6 @@ void CHudMenu :: SelectMenuItem( int menu_item )
}
}
// Message handler for ShowMenu message
// takes four values:
// short: a bitfield of keys that are valid input
@ -154,13 +151,15 @@ int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING );
}
else
{ // append to the current menu string
{
// append to the current menu string
strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - strlen( g_szPrelocalisedMenuString ) );
}
g_szPrelocalisedMenuString[MAX_MENU_STRING - 1] = 0; // ensure null termination (strncat/strncpy does not)
if( !NeedMore )
{ // we have the whole string, so we can localise it now
{
// we have the whole string, so we can localise it now
strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ) );
// Swap in characters

View File

@ -52,7 +52,6 @@ int CHudMessage::VidInit( void )
return 1;
}
void CHudMessage::Reset( void )
{
memset( m_pMessages, 0, sizeof(m_pMessages[0]) * maxHUDMessages );
@ -62,7 +61,6 @@ void CHudMessage::Reset( void )
m_pGameTitle = NULL;
}
float CHudMessage::FadeBlend( float fadein, float fadeout, float hold, float localTime )
{
float fadeTime = fadein + hold;
@ -113,7 +111,6 @@ int CHudMessage::XPosition( float x, int width, int totalWidth )
return xPos;
}
int CHudMessage::YPosition( float y, int height )
{
int yPos;
@ -137,7 +134,6 @@ int CHudMessage::YPosition( float y, int height )
return yPos;
}
void CHudMessage::MessageScanNextChar( void )
{
int srcRed, srcGreen, srcBlue, destRed = 0, destGreen = 0, destBlue = 0;
@ -156,7 +152,6 @@ void CHudMessage::MessageScanNextChar( void )
destRed = destGreen = destBlue = 0;
blend = m_parms.fadeBlend;
break;
case 2:
m_parms.charTime += m_parms.pMessage->fadein;
if( m_parms.charTime > m_parms.time )
@ -201,7 +196,6 @@ void CHudMessage::MessageScanNextChar( void )
}
}
void CHudMessage::MessageScanStart( void )
{
switch( m_parms.pMessage->effect )
@ -230,7 +224,6 @@ void CHudMessage::MessageScanStart( void )
if( m_parms.pMessage->effect == 1 && ( rand() % 100 ) < 10 )
m_parms.charTime = 1;
break;
case 2:
m_parms.fadeTime = (m_parms.pMessage->fadein * m_parms.length) + m_parms.pMessage->holdtime;
@ -274,7 +267,6 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
m_parms.length = length;
m_parms.totalHeight = ( m_parms.lines * gHUD.m_scrinfo.iCharHeight );
m_parms.y = YPosition( pMessage->y, m_parms.totalHeight );
pText = pMessage->pMessage;
@ -314,7 +306,6 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
}
}
int CHudMessage::Draw( float fTime )
{
int i, drawn;
@ -345,7 +336,6 @@ int CHudMessage::Draw( float fTime )
int x = XPosition( m_pGameTitle->x, fullWidth, fullWidth );
int y = YPosition( m_pGameTitle->y, fullHeight );
SPR_Set( gHUD.GetSprite( m_HUD_title_half ), brightness * m_pGameTitle->r1, brightness * m_pGameTitle->g1, brightness * m_pGameTitle->b1 );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( m_HUD_title_half ) );
@ -416,7 +406,6 @@ int CHudMessage::Draw( float fTime )
return 1;
}
void CHudMessage::MessageAdd( const char *pName, float time )
{
int i, j;
@ -481,7 +470,6 @@ void CHudMessage::MessageAdd( const char *pName, float time )
}
}
int CHudMessage::MsgFunc_HudText( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -489,6 +477,7 @@ int CHudMessage::MsgFunc_HudText( const char *pszName, int iSize, void *pbuf )
char *pString = READ_STRING();
MessageAdd( pString, gHUD.m_flTime );
// Remember the time -- to fix up level transitions
m_parms.time = gHUD.m_flTime;
@ -499,7 +488,6 @@ int CHudMessage::MsgFunc_HudText( const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHudMessage::MsgFunc_GameTitle( const char *pszName, int iSize, void *pbuf )
{
m_pGameTitle = TextMessageGet( "GAMETITLE" );
@ -532,5 +520,4 @@ void CHudMessage::MessageAdd(client_textmessage_t * newMessage )
return;
}
}
}

View File

@ -58,7 +58,7 @@ int CHudOverview::Draw(float flTime)
// calculate player size on the overview
int x1, y1, x2, y2;
float v0[3]={0,0,0}, v1[3]={64,64,0};
float v0[3] = { 0.0f }, v1[3] = { 64.0f, 64.0f };
gEngfuncs.Overview_WorldToScreen( v0, &x1, &y1 );
gEngfuncs.Overview_WorldToScreen( v1, &x2, &y2 );
float scale = abs( x2 - x1 );
@ -146,7 +146,6 @@ int CHudOverview::Draw(float flTime)
DrawConsoleString( x, y + ( 1.1 * scale ), string );
}
}
#endif
return 1;
}
@ -160,4 +159,3 @@ void CHudOverview::InitHUDData()
//gEngfuncs.Overview_SetDrawOverview( 1 );
//gEngfuncs.Overview_SetDrawInset( 0 );
}

View File

@ -9,7 +9,6 @@
#define OVERVIEW_H
#pragma once
//-----------------------------------------------------------------------------
// Purpose: Handles the drawing of the top-down map and all the things on it
//-----------------------------------------------------------------------------
@ -26,6 +25,4 @@ private:
HSPRITE m_hsprPlayer;
HSPRITE m_hsprViewcone;
};
#endif // OVERVIEW_H

View File

@ -15,6 +15,7 @@
//
// parsemsg.cpp
//
typedef unsigned char byte;
#define true 1
@ -31,7 +32,6 @@ void BEGIN_READ( void *buf, int size )
gpBuf = (byte*)buf;
}
int READ_CHAR( void )
{
int c;
@ -86,7 +86,6 @@ int READ_WORD( void )
return READ_SHORT();
}
int READ_LONG( void )
{
int c;
@ -163,4 +162,3 @@ float READ_HIRESANGLE( void )
{
return (float)( READ_SHORT() * ( 360.0 / 65536 ) );
}

View File

@ -25,7 +25,6 @@
#include <string.h>
#include <stdio.h>
extern float *GetClientColor( int clientIndex );
#define MAX_LINES 5
@ -62,7 +61,6 @@ int CHudSayText :: Init( void )
return 1;
}
void CHudSayText::InitHUDData( void )
{
memset( g_szLineBuffer, 0, sizeof g_szLineBuffer );
@ -75,7 +73,6 @@ int CHudSayText :: VidInit( void )
return 1;
}
int ScrollTextUp( void )
{
ConsolePrint( g_szLineBuffer[0] ); // move the first line into the console buffer
@ -113,7 +110,8 @@ int CHudSayText :: Draw( float flTime )
ScrollTextUp();
}
else
{ // buffer is empty, just disable drawing of this section
{
// buffer is empty, just disable drawing of this section
m_iFlags &= ~HUD_ACTIVE;
}
}
@ -146,7 +144,6 @@ int CHudSayText :: Draw( float flTime )
y += line_height;
}
return 1;
}
@ -168,7 +165,7 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn
// find an empty string slot
for( i = 0; i < MAX_LINES; i++ )
{
if ( ! *g_szLineBuffer[i] )
if( !( *g_szLineBuffer[i] ) )
break;
}
if( i == MAX_LINES )
@ -218,7 +215,6 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn
else
Y_START = ScreenHeight - 45;
Y_START -= ( line_height * ( MAX_LINES + 1 ) );
}
void CHudSayText::EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
@ -227,7 +223,8 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
GetConsoleStringSize( g_szLineBuffer[line], &line_width, &line_height );
if( ( line_width + LINE_START ) > MAX_LINE_WIDTH )
{ // string is too long to fit on line
{
// string is too long to fit on line
// scan the string until we find what word is too long, and wrap the end of the sentence after the word
int length = LINE_START;
int tmp_len = 0;
@ -260,7 +257,8 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
length += tmp_len;
if( length > MAX_LINE_WIDTH )
{ // needs to be broken up
{
// needs to be broken up
if( !last_break )
last_break = x - 1;
@ -272,7 +270,7 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
{
for( j = 0; j < MAX_LINES; j++ )
{
if ( ! *g_szLineBuffer[j] )
if( !( *g_szLineBuffer[j] ) )
break;
}
if( j == MAX_LINES )

View File

@ -64,7 +64,6 @@ int CHudScoreboard :: Init( void )
return 1;
}
int CHudScoreboard::VidInit( void )
{
// Load sprites here
@ -105,7 +104,6 @@ We have a minimum width of 1-320 - we could have the field widths scale with it?
int SCOREBOARD_WIDTH = 320;
// Y positions
#define ROW_GAP 13
#define ROW_RANGE_MIN 15
@ -162,7 +160,6 @@ int CHudScoreboard :: Draw( float fTime )
gHUD.DrawHudString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
}
list_slot += 1.2;
ypos = ROW_RANGE_MIN + ( list_slot * ROW_GAP );
xpos = NAME_RANGE_MIN + xpos_rel;
@ -319,7 +316,9 @@ int CHudScoreboard :: Draw( float fTime )
return 1;
}
extern float *GetClientColor( int client );
// returns the ypos where it finishes drawing
int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, char *team )
{
@ -344,7 +343,8 @@ int CHudScoreboard :: DrawPlayers( int xpos_rel, float list_slot, int nameoffset
while( 1 )
{
// Find the top ranking player
int highest_frags = -99999; int lowest_deaths = 99999;
int highest_frags = -99999;
int lowest_deaths = 99999;
int best_player = 0;
for( int i = 1; i < MAX_PLAYERS; i++ )
@ -383,11 +383,13 @@ int CHudScoreboard :: DrawPlayers( int xpos_rel, float list_slot, int nameoffset
if( best_player == m_iLastKilledBy && m_fLastKillTime && m_fLastKillTime > gHUD.m_flTime )
{
if( pl_info->thisplayer )
{ // green is the suicide color? i wish this could do grey...
{
// green is the suicide color? i wish this could do grey...
FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 80, 155, 0, 70 );
}
else
{ // Highlight the killers name - overlay the background in red, then draw the score text over it
{
// Highlight the killers name - overlay the background in red, then draw the score text over it
FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 255, 0, 0, ( (float)15 * (float)( m_fLastKillTime - gHUD.m_flTime ) ) );
}
}
@ -443,7 +445,6 @@ int CHudScoreboard :: DrawPlayers( int xpos_rel, float list_slot, int nameoffset
return list_slot;
}
void CHudScoreboard::GetAllPlayersInfo( void )
{
for( int i = 1; i < MAX_PLAYERS; i++ )
@ -490,12 +491,12 @@ int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pb
short cl = READ_BYTE();
if( cl > 0 && cl <= MAX_PLAYERS )
{ // set the players team
{
// set the players team
strncpy( g_PlayerExtraInfo[cl].teamname, READ_STRING(), MAX_TEAM_NAME );
}
// rebuild the list of teams
// clear out player counts from teams
for( i = 1; i <= m_iNumTeams; i++ )
{
@ -524,7 +525,8 @@ int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pb
}
if( j > m_iNumTeams )
{ // they aren't in a listed team, so make a new one
{
// they aren't in a listed team, so make a new one
// search through for an empty team slot
for( j = 1; j <= m_iNumTeams; j++ )
{
@ -592,8 +594,6 @@ void CHudScoreboard :: DeathMsg( int killer, int victim )
}
}
void CHudScoreboard::UserCmd_ShowScores( void )
{
m_iShowscoresHeld = TRUE;

View File

@ -15,6 +15,7 @@
//
// $NoKeywords: $
//=============================================================================
#include <windows.h>
#include <dsound.h>
#include <mmsystem.h>

View File

@ -15,6 +15,7 @@
//
// status_icons.cpp
//
#include "hud.h"
#include "cl_util.h"
#include "const.h"
@ -40,7 +41,6 @@ int CHudStatusIcons::Init( void )
int CHudStatusIcons::VidInit( void )
{
return 1;
}

View File

@ -51,7 +51,6 @@ int CHudStatusBar :: Init( void )
int CHudStatusBar::VidInit( void )
{
// Load sprites here
return 1;
}
@ -96,7 +95,8 @@ void CHudStatusBar :: ParseStatusString( int line_num )
int index = atoi( src );
// should we draw this line?
if( ( index >= 0 && index < MAX_STATUSBAR_VALUES ) && ( m_iStatusValues[index] != 0 ) )
{ // parse this line and append result to the status bar
{
// parse this line and append result to the status bar
while ( *src >= '0' && *src <= '9' )
src++;
@ -107,7 +107,8 @@ void CHudStatusBar :: ParseStatusString( int line_num )
while( *src != '\n' && *src != 0 )
{
if( *src != '%' )
{ // just copy the character
{
// just copy the character
*dst = *src;
dst++, src++;
}
@ -148,7 +149,6 @@ void CHudStatusBar :: ParseStatusString( int line_num )
{
strcpy( szRepString, "******" );
}
break;
case 'i': // number
sprintf( szRepString, "%d", indexval );

View File

@ -199,7 +199,8 @@ void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt )
sclp = 1.0 - t;
sclq = t;
}
for (i = 0; i < 4; i++) {
for( i = 0; i < 4; i++ )
{
qt[i] = sclp * p[i] + sclq * q[i];
}
}

View File

@ -36,5 +36,4 @@ void MatrixCopy( float in[3][4], float out[3][4] );
void QuaternionMatrix( vec4_t quaternion, float (*matrix)[4] );
void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt );
void AngleQuaternion( float *angles, vec4_t quaternion );
#endif // STUDIO_UTIL_H

View File

@ -26,7 +26,6 @@
#include <stdio.h>
#include "parsemsg.h"
DECLARE_MESSAGE( m_TextMessage, TextMsg )
int CHudTextMessage::Init( void )
@ -122,7 +121,8 @@ char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
return (char*)clmsg->pMessage;
}
else
{ // nothing special about this message, so just return the same string
{
// nothing special about this message, so just return the same string
return (char*)msg;
}
}
@ -187,18 +187,15 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
CenterPrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTNOTIFY:
psz[0] = 1; // mark this message to go into the notify buffer
sprintf( psz + 1, msg_text, sstr1, sstr2, sstr3, sstr4 );
ConsolePrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTTALK:
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
break;
case HUD_PRINTCONSOLE:
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
ConsolePrint( ConvertCRtoNL( psz ) );

View File

@ -362,7 +362,6 @@ enum
// Silent Spy Feign
#define TF_SPY_SILENTDIE 199
/*==================================================*/
/* Defines for the ENGINEER's Building ability */
/*==================================================*/
@ -1382,8 +1381,5 @@ public:
void Spawn( void );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
};
#endif // TF_DEFS_ONLY
#endif // __TF_DEFS_H

View File

@ -26,7 +26,6 @@
DECLARE_MESSAGE( m_Train, Train )
int CHudTrain::Init( void )
{
HOOK_MESSAGE( Train );
@ -62,13 +61,11 @@ int CHudTrain::Draw(float fTime)
x = ScreenWidth / 3 + SPR_Width( m_hSprite, 0 ) / 4;
SPR_DrawAdditive( m_iPos - 1, x, y, NULL );
}
return 1;
}
int CHudTrain::MsgFunc_Train( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );

View File

@ -86,7 +86,6 @@ void Draw_Triangles( void )
gEngfuncs.pTriAPI->End();
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
}
#endif
/*
@ -98,9 +97,7 @@ Non-transparent triangles-- add them here
*/
void DLLEXPORT HUD_DrawNormalTriangles( void )
{
gHUD.m_Spectator.DrawOverview();
#if defined( TEST_IT )
// Draw_Triangles();
#endif
@ -115,7 +112,6 @@ Render any triangles with transparent rendermode needs here
*/
void DLLEXPORT HUD_DrawTransparentTriangles( void )
{
#if defined( TEST_IT )
// Draw_Triangles();
#endif

View File

@ -92,7 +92,6 @@ float VectorNormalize (float *v)
}
return length;
}
void VectorInverse( float *v )
@ -130,4 +129,3 @@ HSPRITE LoadSprite(const char *pszName)
return SPR_Load( sz );
}

View File

@ -109,11 +109,16 @@ public:
return Vec2;
}
inline float Length2D(void) const { return (float)sqrt(x*x + y*y); }
inline float Length2D( void ) const
{
return (float)sqrt( x * x + y * y );
}
// Members
vec_t x, y, z;
};
inline Vector operator*( float fl, const Vector& v ) { return v * fl; }
inline float DotProduct( const Vector& a, const Vector& b) { return( a.x * b.x + a.y * b.y + a.z * b.z ); }
inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x ); }

View File

@ -120,6 +120,7 @@ float v_idlescale; // used by TFC for concussion grenade effect
void V_NormalizeAngles( float *angles )
{
int i;
// Normalize angles
for( i = 0; i < 3; i++ )
{
@ -134,7 +135,6 @@ void V_NormalizeAngles( float *angles )
}
}
===================
V_InterpolateAngles
@ -182,7 +182,6 @@ float V_CalcBob ( struct ref_params_s *pparams )
static float lasttime;
vec3_t vel;
if( pparams->onground == -1 ||
pparams->time == lasttime )
{
@ -215,7 +214,6 @@ float V_CalcBob ( struct ref_params_s *pparams )
bob = min( bob, 4 );
bob = max( bob, -7 );
return bob;
}
/*
@ -259,7 +257,6 @@ typedef struct pitchdrift_s
static pitchdrift_t pd;
/*
===============
V_DriftPitch
@ -316,7 +313,6 @@ void V_AddIdle ( struct ref_params_s *pparams )
pparams->viewangles[YAW] += v_idlescale * sin( pparams->time * v_iyaw_cycle.value ) * v_iyaw_level.value;
}
/*
==============
V_CalcViewRoll
@ -346,7 +342,6 @@ void V_CalcViewRoll ( struct ref_params_s *pparams )
}
}
/*
==================
V_CalcIntermissionRefdef
@ -443,7 +438,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
// refresh position
VectorCopy( pparams->simorg, pparams->vieworg );
pparams->vieworg[2] += ( bob );
pparams->vieworg[2] += bob ;
VectorAdd( pparams->vieworg, pparams->viewheight, pparams->vieworg );
VectorCopy( pparams->cl_viewangles, pparams->viewangles );
@ -455,7 +450,6 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
// dissapear when viewed with the eye exactly on it.
// FIXME, we send origin at 1/128 now, change this?
// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
pparams->vieworg[0] += 1.0 / 32;
pparams->vieworg[1] += 1.0 / 32;
pparams->vieworg[2] += 1.0 / 32;
@ -566,7 +560,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
// Use predicted origin as view origin.
VectorCopy( pparams->simorg, view->origin );
view->origin[2] += ( waterOffset );
view->origin[2] += waterOffset;
VectorAdd( view->origin, pparams->viewheight, view->origin );
// Let the viewmodel shake at about 10% of the amplitude
@ -639,7 +633,6 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
oldz = pparams->simorg[2];
}
#endif
{
static float lastorg[3];
vec3_t delta;
@ -701,7 +694,6 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
VectorAdd( pparams->simorg, delta, pparams->simorg );
VectorAdd( pparams->vieworg, delta, pparams->vieworg );
VectorAdd( view->origin, delta, view->origin );
}
}
}
@ -803,7 +795,6 @@ void V_SmoothInterpolateAngles( float * startAngle, float * endAngle, float * fi
{
finalAngle[i] = endAngle[i];
}
}
NormalizeAngles( finalAngle );
@ -948,7 +939,6 @@ void V_GetSingleTargetCam(cl_entity_t * ent1, float * angle, float * origin)
newOrigin[2] += 2; //laying on ground
else
newOrigin[2] += 17; // head level of living player
}
else
newOrigin[2]+= 8; // object, tricky, must be above bomb in CS
@ -961,7 +951,6 @@ void V_GetSingleTargetCam(cl_entity_t * ent1, float * angle, float * origin)
if( flags & DRC_FLAG_FACEPLAYER )
newAngle[1] += 180.0f;
newAngle[0] += 12.5f * dfactor; // lower angle if dramatic
// if final scene (bomb), show from real high pos
@ -1010,7 +999,7 @@ float MaxAngleBetweenAngles( float * a1, float * a2 )
void V_GetDoubleTargetsCam( cl_entity_t *ent1, cl_entity_t *ent2, float *angle, float *origin )
{
float newAngle[3]; float newOrigin[3]; float tempVec[3];
float newAngle[3], newOrigin[3], tempVec[3];
int flags = gHUD.m_Spectator.m_iObserverFlags;
@ -1090,14 +1079,10 @@ void V_GetDoubleTargetsCam(cl_entity_t * ent1, cl_entity_t * ent2,float * angle
/* take middle between two viewangles
InterpolateAngles( newAngle, tempVec, newAngle, 0.5f ); */
}
void V_GetDirectedChasePosition(cl_entity_t *ent1, cl_entity_t *ent2,float *angle, float *origin)
{
if( v_resetCamera )
{
v_lastDistance = 4096.0f;
@ -1157,7 +1142,7 @@ void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles
if( target )
{
ent = gEngfuncs.GetEntityByIndex( target );
};
}
if( !ent )
{
@ -1167,8 +1152,6 @@ void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles
return;
}
if( gHUD.m_Spectator.m_autoDirector->value )
{
if( g_iUser3 )
@ -1188,7 +1171,6 @@ void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles
else
VectorCopy( cl_angles, angles );
VectorCopy( ent->origin, origin );
origin[2] += 28; // DEFAULT_VIEWHEIGHT - some offset
@ -1204,7 +1186,6 @@ void V_ResetChaseCam()
v_resetCamera = true;
}
void V_GetInEyePos( int target, float *origin, float *angles )
{
if( !target )
@ -1215,7 +1196,6 @@ void V_GetInEyePos(int target, float * origin, float * angles )
return;
};
cl_entity_t *ent = gEngfuncs.GetEntityByIndex( target );
if( !ent )
@ -1253,7 +1233,6 @@ void V_GetMapFreePosition( float * cl_angles, float * origin, float * angles )
zScaledTarget[1] = gHUD.m_Spectator.m_mapOrigin[1];
zScaledTarget[2] = gHUD.m_Spectator.m_mapOrigin[2] * ( ( 90.0f - angles[0] ) / 90.0f );
AngleVectors( angles, forward, NULL, NULL );
VectorNormalize( forward );
@ -1306,8 +1285,8 @@ void V_GetMapChasePosition(int target, float * cl_angles, float * origin, float
int V_FindViewModelByWeaponModel( int weaponindex )
{
static char * modelmap[][2] = {
static char *modelmap[][2] =
{
{ "models/p_crossbow.mdl", "models/v_crossbow.mdl" },
{ "models/p_crowbar.mdl", "models/v_crowbar.mdl" },
{ "models/p_egon.mdl", "models/v_egon.mdl" },
@ -1323,7 +1302,8 @@ int V_FindViewModelByWeaponModel(int weaponindex)
{ "models/p_tripmine.mdl", "models/v_tripmine.mdl" },
{ "models/p_satchel_radio.mdl", "models/v_satchel_radio.mdl" },
{ "models/p_satchel.mdl", "models/v_satchel.mdl" },
{ NULL, NULL } };
{ NULL, NULL }
};
struct model_s * weaponModel = IEngineStudio.GetModelByIndex( weaponindex );
@ -1345,10 +1325,8 @@ int V_FindViewModelByWeaponModel(int weaponindex)
}
else
return 0;
}
/*
==================
V_CalcSpectatorRefdef
@ -1404,7 +1382,6 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
if( lastWeaponModelIndex != ent->curstate.weaponmodel )
{
// weapon model changed
lastWeaponModelIndex = ent->curstate.weaponmodel;
lastViewModelIndex = V_FindViewModelByWeaponModel( lastWeaponModelIndex );
if( lastViewModelIndex )
@ -1445,27 +1422,27 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
if( pparams->nextView == 0 )
{
// first renderer cycle, full screen
switch( g_iUser1 )
{
case OBS_CHASE_LOCKED: V_GetChasePos( g_iUser2, NULL, v_origin, v_angles );
case OBS_CHASE_LOCKED:
V_GetChasePos( g_iUser2, NULL, v_origin, v_angles );
break;
case OBS_CHASE_FREE: V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
case OBS_CHASE_FREE:
V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
break;
case OBS_ROAMING : VectorCopy (v_cl_angles, v_angles);
case OBS_ROAMING:
VectorCopy( v_cl_angles, v_angles );
VectorCopy( v_sim_org, v_origin );
break;
case OBS_IN_EYE : V_CalcNormalRefdef ( pparams );
case OBS_IN_EYE:
V_CalcNormalRefdef( pparams );
break;
case OBS_MAP_FREE : pparams->onlyClientDraw = true;
case OBS_MAP_FREE:
pparams->onlyClientDraw = true;
V_GetMapFreePosition( v_cl_angles, v_origin, v_angles );
break;
case OBS_MAP_CHASE : pparams->onlyClientDraw = true;
case OBS_MAP_CHASE:
pparams->onlyClientDraw = true;
V_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );
break;
}
@ -1474,12 +1451,10 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
pparams->nextView = 1; // force a second renderer view
gHUD.m_Spectator.m_iDrawCycle = 0;
}
else
{
// second renderer cycle, inset window
// set inset parameters
pparams->viewport[0] = XRES( gHUD.m_Spectator.m_OverviewData.insetWindowX ); // change viewport to inset window
pparams->viewport[1] = YRES( gHUD.m_Spectator.m_OverviewData.insetWindowY );
@ -1490,23 +1465,22 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
// override some settings in certain modes
switch( (int)gHUD.m_Spectator.m_pip->value )
{
case INSET_CHASE_FREE : V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
case INSET_CHASE_FREE:
V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
break;
case INSET_IN_EYE : V_CalcNormalRefdef ( pparams );
case INSET_IN_EYE:
V_CalcNormalRefdef( pparams );
break;
case INSET_MAP_FREE : pparams->onlyClientDraw = true;
case INSET_MAP_FREE:
pparams->onlyClientDraw = true;
V_GetMapFreePosition( v_cl_angles, v_origin, v_angles );
break;
case INSET_MAP_CHASE : pparams->onlyClientDraw = true;
case INSET_MAP_CHASE:
pparams->onlyClientDraw = true;
if( g_iUser1 == OBS_ROAMING )
V_GetMapChasePosition( 0, v_cl_angles, v_origin, v_angles );
else
V_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );
break;
}
@ -1517,11 +1491,8 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
VectorCopy( v_cl_angles, pparams->cl_viewangles );
VectorCopy( v_angles, pparams->viewangles )
VectorCopy( v_origin, pparams->vieworg );
}
void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
{
// intermission / finale rendering
@ -1537,7 +1508,6 @@ void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
{
V_CalcNormalRefdef( pparams );
}
/*
// Example of how to overlay the whole screen with red at 50 % alpha
#define SF_TEST
@ -1593,7 +1563,6 @@ V_Init
*/
void V_Init( void )
{
scr_ofsx = gEngfuncs.pfnRegisterVariable( "scr_ofsx","0", 0 );
scr_ofsy = gEngfuncs.pfnRegisterVariable( "scr_ofsy","0", 0 );
scr_ofsz = gEngfuncs.pfnRegisterVariable( "scr_ofsz","0", 0 );
@ -1608,7 +1577,6 @@ void V_Init (void)
cl_chasedist = gEngfuncs.pfnRegisterVariable( "cl_chasedist","112", 0 );
}
//#define TRACE_TEST
#if defined( TRACE_TEST )
@ -1688,5 +1656,4 @@ void V_Move( int mx, int my )
hitent = -1;
}
}
#endif

View File

@ -11,5 +11,4 @@
void V_StartPitchDrift( void );
void V_StopPitchDrift( void );
#endif // !VIEWH