Compare commits

..

1 commit

559 changed files with 32662 additions and 41071 deletions

View file

@ -61,14 +61,15 @@ clientdata_t none
DEFINE_DELTA( vuser4[2], DT_SIGNED | DT_FLOAT, 10, 1.0 ),
DEFINE_DELTA( fuser1, DT_SIGNED | DT_FLOAT, 22, 128.0 ),
DEFINE_DELTA( fuser2, DT_SIGNED | DT_FLOAT, 10, 128.0 ),
DEFINE_DELTA( fuser3, DT_SIGNED | DT_FLOAT, 10, 128.0 ),
DEFINE_DELTA( fuser2, DT_SIGNED | DT_FLOAT, 2, 128.0 ),
DEFINE_DELTA( fuser3, DT_SIGNED | DT_FLOAT, 2, 128.0 ),
DEFINE_DELTA( fuser4, DT_SIGNED | DT_FLOAT, 2, 128.0 )
}
entity_state_t gamedll Entity_Encode
{
DEFINE_DELTA( animtime, DT_TIMEWINDOW_8, 8, 1.0 ),
// DEFINE_DELTA( animtime, DT_TIMEWINDOW_8, 8, 1.0 ),
DEFINE_DELTA( animtime, DT_TIMEWINDOW_BIG, 8, 100.0 ),
DEFINE_DELTA( frame, DT_FLOAT, 10, 4.0 ),
DEFINE_DELTA( origin[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
DEFINE_DELTA( angles[0], DT_ANGLE, 16, 1.0 ),
@ -129,7 +130,8 @@ entity_state_t gamedll Entity_Encode
entity_state_player_t gamedll Player_Encode
{
DEFINE_DELTA( animtime, DT_TIMEWINDOW_8, 8, 1.0 ),
// DEFINE_DELTA( animtime, DT_TIMEWINDOW_8, 8, 1.0 ),
DEFINE_DELTA( animtime, DT_TIMEWINDOW_BIG, 8, 100.0 ),
DEFINE_DELTA( frame, DT_FLOAT, 8, 1.0 ),
DEFINE_DELTA( origin[0], DT_SIGNED | DT_FLOAT, 18, 32.0 ),
DEFINE_DELTA( angles[0], DT_ANGLE, 16, 1.0 ),

44
TheWastes/TheWastes.dsw Normal file
View file

@ -0,0 +1,44 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "cl_dll"="..\cl_dll\cl_dll.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "hl"="..\dlls\hl.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name cl_dll
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

34
cl_dll/ParseBsp.h Normal file
View file

@ -0,0 +1,34 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#ifndef __PARSEBSP_H_
#define __PARSEBSP_H_
class CParseBsp
{
public:
CParseBsp();
int CheckMap();
private:
char *ParseEntity( char *pBuf, int &error, CBspEntity *pEnt );
void LumpPass( char *pBuf, char *pszClassname, CBspEntity *pEnt );
char *LoadEntityLump( char *pszFilename );
void ParseBsp( char *pszClassname, CBspEntity *pEnt );
char m_szCurrentLevel[256];
};
extern CParseBsp g_ParseBsp;
#endif

234
cl_dll/ParseBspEnt.cpp Normal file
View file

@ -0,0 +1,234 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#include "extdll.h"
#include "entity_state.h"
#include "pm_defs.h"
#include "pm_movevars.h"
#include "hud_iface.h"
#include "com_model.h"
#include "event_api.h"
#include "com_weapons.h"
#include "event_flags.h"
#include "dmc_bspfile.h"
#include "cl_util.h"
#include "ParseBspEnt.h"
#include "ParticleBase.h"
#include <vector>
using namespace std;
CBspWorldspawn g_Worldspawn;
extern vector<CBspEnvFog> g_EnvFogList;
//
// CBspEntity
//
CBspEntity::CBspEntity()
{
ResetVars();
}
void CBspEntity::ResetVars()
{
memset(szClassname,0,sizeof(szClassname));
memset(flOrigin,0,sizeof(flOrigin));
}
void CBspEntity::SetKeyValue( const char *pszKey, const char *pszValue )
{
float x,y,z;
if( stricmp( pszKey, "classname" ) == 0 )
{
strcpy( szClassname, pszValue );
}
else if( stricmp( pszKey, "origin" ) == 0 )
{
if( sscanf( pszValue, "%f %f %f", &x, &y, &z ) == 3 )
{
flOrigin[0] = x;
flOrigin[1] = y;
flOrigin[2] = z;
}
}
}
//
// CBspWorldspawn
//
void CBspWorldspawn::AddEntity()
{
g_Worldspawn.flFogcolor_b = this->flFogcolor_b;
g_Worldspawn.flFogcolor_end = this->flFogcolor_end;
g_Worldspawn.flFogcolor_g = this->flFogcolor_g;
g_Worldspawn.flFogcolor_r = this->flFogcolor_r;
g_Worldspawn.flFogcolor_start = this->flFogcolor_start;
memcpy( g_Worldspawn.flOrigin, this->flOrigin, sizeof( flOrigin ) );
g_Worldspawn.iEnableFog = this->iEnableFog;
strcpy( g_Worldspawn.szClassname, this->szClassname );
}
void CBspWorldspawn::ResetVars()
{
CBspEntity::ResetVars();
iEnableFog = 0;
flFogcolor_r = 0.0f;
flFogcolor_g = 0.0f;
flFogcolor_b = 0.0f;
flFogcolor_start = 0.0f;
flFogcolor_end = 0.0f;
}
void CBspWorldspawn::SetKeyValue( const char *pszKey, const char *pszValue )
{
int i;
float x;
if(stricmp(pszKey,"enablefog") == 0)
{
if(sscanf(pszValue,"%i",&i) == 1)
iEnableFog = i;
}
else if(stricmp(pszKey,"fogcolor_r") == 0)
{
if(sscanf(pszValue,"%f",&x) == 1)
flFogcolor_r = x;
}
else if(stricmp(pszKey,"fogcolor_g") == 0)
{
if(sscanf(pszValue,"%f",&x) == 1)
flFogcolor_g = x;
}
else if(stricmp(pszKey,"fogcolor_b") == 0)
{
if(sscanf(pszValue,"%f",&x) == 1)
flFogcolor_b = x;
}
else if(stricmp(pszKey,"fogcolor_start") == 0)
{
if(sscanf(pszValue,"%f",&x) == 1)
flFogcolor_start = x;
}
else if(stricmp(pszKey,"fogcolor_end") == 0)
{
if(sscanf(pszValue,"%f",&x) == 1)
flFogcolor_end = x;
}
else
CBspEntity::SetKeyValue( pszKey, pszValue );
}
//
// CBspEnvFog
//
void CBspEnvFog::AddEntity()
{
g_EnvFogList.push_back( *this );
}
void CBspEnvFog::ResetVars()
{
CBspEntity::ResetVars();
iRadius = 0;
iFogState = 0;
flFogcolor_r = 0.0f;
flFogcolor_g = 0.0f;
flFogcolor_b = 0.0f;
flFog_start = 0.0f;
flFog_end = 0.0f;
}
void CBspEnvFog::SetKeyValue( const char *pszKey, const char *pszValue )
{
int i;
float x;
if( stricmp( pszKey, "radius" ) == 0 )
{
if( sscanf( pszValue, "%i", &i ) == 1 )
iRadius = i;
}
else if( stricmp( pszKey, "fogstate" ) == 0 )
{
if( sscanf( pszValue, "%i", &i ) == 1 )
iFogState = i;
}
else if( stricmp( pszKey, "fogcolor_r" ) == 0 )
{
if( sscanf( pszValue, "%f", &x ) == 1 )
flFogcolor_r = x;
}
else if( stricmp( pszKey, "fogcolor_g" ) == 0 )
{
if( sscanf( pszValue, "%f", &x ) == 1 )
flFogcolor_g = x;
}
else if( stricmp( pszKey, "fogcolor_b" ) == 0 )
{
if( sscanf( pszValue, "%f", &x ) == 1 )
flFogcolor_b = x;
}
else if( stricmp( pszKey, "fog_start" ) == 0 )
{
if( sscanf( pszValue, "%f", &x ) == 1 )
flFog_start = x;
}
else if( stricmp( pszKey, "fog_end" ) == 0 )
{
if( sscanf( pszValue, "%f", &x ) == 1 )
flFog_end = x;
}
else
CBspEntity::SetKeyValue( pszKey, pszValue );
}
//
// CBspEnvParticleSystem
//
void CBspEnvParticleSystem::AddEntity()
{
if( iClientSide )
{
g_ParticleSystemManager.AddParticleSystem( szParticleSystem, flOrigin );
}
}
void CBspEnvParticleSystem::ResetVars()
{
CBspEntity::ResetVars();
iClientSide = 0;
memset( szParticleSystem, 0, sizeof( szParticleSystem ) );
}
void CBspEnvParticleSystem::SetKeyValue( const char *pszKey, const char *pszValue )
{
int i;
if( stricmp( pszKey, "client_side" ) == 0 )
{
if( sscanf( pszValue, "%i", &i ) == 1 )
iClientSide = i;
}
else if( stricmp( pszKey, "particle_system" ) == 0 )
{
strcpy( szParticleSystem, pszValue );
}
else
CBspEntity::SetKeyValue( pszKey, pszValue );
}

76
cl_dll/ParseBspEnt.h Normal file
View file

@ -0,0 +1,76 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#if !defined( __PARSEBSPENT_H_ )
#define __PARSEBSPENT_H_
class CBspEntity
{
public:
CBspEntity();
virtual void AddEntity() = 0;
virtual void ResetVars();
virtual void SetKeyValue( const char *pszKey, const char *pszValue );
char szClassname[32];
float flOrigin[3];
};
class CBspWorldspawn : public CBspEntity
{
public:
void AddEntity();
void ResetVars();
void SetKeyValue( const char *pszKey, const char *pszValue );
// Fog info
int iEnableFog;
float flFogcolor_r;
float flFogcolor_g;
float flFogcolor_b;
float flFogcolor_start;
float flFogcolor_end;
};
class CBspEnvFog : public CBspEntity
{
public:
void AddEntity();
void ResetVars();
void SetKeyValue( const char *pszKey, const char *pszValue );
int iRadius;
int iFogState;
float flFogcolor_r;
float flFogcolor_g;
float flFogcolor_b;
float flFog_start;
float flFog_end;
};
class CBspEnvParticleSystem : public CBspEntity
{
public:
void AddEntity();
void ResetVars();
void SetKeyValue( const char *pszKey, const char *pszValue );
int iClientSide;
char szParticleSystem[64];
};
extern CBspWorldspawn g_Worldspawn;
#endif

525
cl_dll/ParticleBase.cpp Normal file
View file

@ -0,0 +1,525 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#include <string.h>
#include "hud.h"
#include "wrect.h"
#include "cl_util.h"
#include "tri.h"
#include "pm_defs.h"
#include "event_api.h"
#include "ParticleBase.h"
CParticleSystemManager g_ParticleSystemManager;
void HUD_GetLastOrg( float *org );
//==================================================
// CSpriteEmitter
//==================================================
CSpriteEmitter::CSpriteEmitter()
{
memset( m_szName, 0, sizeof( m_szName ) );
memset( m_Origin, 0, sizeof( m_Origin ) );
memset( m_Acceleration, 0, sizeof( m_Acceleration ) );
memset( m_StartOriginOffset, 0, sizeof( m_StartOriginOffset ) );
memset( m_StartOriginRange, 0, sizeof( m_StartOriginRange ) );
memset( m_StartVelocity, 0, sizeof( m_StartVelocity ) );
memset( m_MinVelocity, 0, sizeof( m_MinVelocity ) );
memset( m_MaxVelocity, 0, sizeof( m_MaxVelocity ) );
memset( m_flParticleLifetime, 0, sizeof( m_flParticleLifetime ) );
memset( m_flStartScaleRange, 0, sizeof( m_flStartScaleRange ) );
memset( m_flGrowScaleRange, 0, sizeof( m_flGrowScaleRange ) );
m_iNumSprites = 0;
memset( m_iSpriteHandles, 0, sizeof( m_iSpriteHandles ) );
m_iMaxParticles = 1;
m_flParticlesPerSecond = 0.0f;
m_iRenderMode = PRM_Normal;
m_iCoordSystem = PCS_Standard;
m_flInactiveTime = 0.0f;
m_flLastParticleTime = 0.0f;
m_pParticles = 0;
m_iNumParticles = 0;
m_flInactiveStart = -1.0f;
}
CSpriteEmitter::CSpriteEmitter( const CSpriteEmitter &Cpy )
{
strcpy( m_szName, Cpy.m_szName );
VectorCopy( Cpy.m_Origin, m_Origin );
VectorCopy( Cpy.m_Acceleration, m_Acceleration );
VectorCopy( Cpy.m_StartOriginOffset, m_StartOriginOffset );
VectorCopy( Cpy.m_StartOriginRange[0], m_StartOriginRange[0] );
VectorCopy( Cpy.m_StartOriginRange[1], m_StartOriginRange[1] );
VectorCopy( Cpy.m_StartVelocity[0], m_StartVelocity[0] );
VectorCopy( Cpy.m_StartVelocity[1], m_StartVelocity[1] );
VectorCopy( Cpy.m_MinVelocity, m_MinVelocity );
VectorCopy( Cpy.m_MaxVelocity, m_MaxVelocity );
memcpy( m_flParticleLifetime, Cpy.m_flParticleLifetime, sizeof( m_flParticleLifetime ) );
memcpy( m_flStartScaleRange, Cpy.m_flStartScaleRange, sizeof( m_flStartScaleRange ) );
memcpy( m_flGrowScaleRange, Cpy.m_flGrowScaleRange, sizeof( m_flGrowScaleRange ) );
m_iNumSprites = Cpy.m_iNumSprites;
memcpy( m_iSpriteHandles, Cpy.m_iSpriteHandles, sizeof( m_iSpriteHandles ) );
m_iMaxParticles = Cpy.m_iMaxParticles;
m_flParticlesPerSecond = Cpy.m_flParticlesPerSecond;
m_iRenderMode = Cpy.m_iRenderMode;
m_iCoordSystem = Cpy.m_iCoordSystem;
m_flInactiveTime = Cpy.m_flInactiveTime;
// These are unique to each emitter
m_flLastParticleTime = 0.0f;
m_pParticles = 0;
m_iNumParticles = 0;
m_flInactiveStart = -1.0f;
}
CSpriteEmitter::~CSpriteEmitter()
{
ClearList( m_pParticles );
}
void CSpriteEmitter::Render()
{
if( m_flInactiveTime > 0.0f )
{
psvec3_t origin, angles, forward, right, up;
int idx = gEngfuncs.GetLocalPlayer()->index;
pmtrace_t tr;
// See if we shouldn't render the emitter
gEngfuncs.GetViewAngles((float*)&angles);
HUD_GetLastOrg((float*)&origin);
AngleVectors(angles,forward,right,up);
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, false );
gEngfuncs.pEventAPI->EV_PushPMStates();
gEngfuncs.pEventAPI->EV_SetSolidPlayers( idx - 1 );
gEngfuncs.pEventAPI->EV_SetTraceHull( 1 );
gEngfuncs.pEventAPI->EV_PlayerTrace( origin, m_Origin, PM_WORLD_ONLY|PM_GLASS_IGNORE, -1, &tr );
gEngfuncs.pEventAPI->EV_PopPMStates();
if( tr.fraction != 1.0f )
{
if( m_flInactiveStart == -1.0f )
m_flInactiveStart = gHUD.m_flTime;
else if( gHUD.m_flTime >= m_flInactiveStart + m_flInactiveTime )
return;
}
else
m_flInactiveStart = -1.0f;
}
CParticle *pCurPcl = m_pParticles;
while( pCurPcl )
{
const struct model_s *spritemodel;
psvec3_t angles,forward,right,up;
psvec3_t origin;
spritemodel = gEngfuncs.GetSpritePointer( m_iSpriteHandles[ pCurPcl->m_iModelIndex ] );
gEngfuncs.GetViewAngles( angles );
AngleVectors( angles, forward, right, up );
if( m_iCoordSystem == PCS_Relative )
{
VectorAdd( m_Origin, pCurPcl->m_Origin, origin );
}
else
{
VectorCopy( pCurPcl->m_Origin, origin );
}
R_Billboard( spritemodel, 0, m_iRenderMode,
1.0f, 1.0f, 1.0f, 1.0f,
origin, up, right, pCurPcl->m_flScale );
pCurPcl = pCurPcl->m_pNext;
}
if( gHUD.m_flTime - m_flLastParticleTime >= 1/m_flParticlesPerSecond )
{
m_flLastParticleTime = gHUD.m_flTime;
AddParticle();
}
}
void CSpriteEmitter::Update( double flFrametime )
{
// Dont update if we dont have to
// if( m_flInactiveStart != -1.0f && gHUD.m_flTime >= m_flInactiveStart + m_flInactiveTime )
// return;
CParticle *pCurPcl = m_pParticles;
while( pCurPcl )
{
VectorMA( pCurPcl->m_Origin, flFrametime, pCurPcl->m_Velocity, pCurPcl->m_Origin );
VectorAdd( pCurPcl->m_Velocity, m_Acceleration, pCurPcl->m_Velocity );
for( int i = 0;i < 3;i++ )
{
if( m_MinVelocity[i] != 0 && pCurPcl->m_Velocity[i] < m_MinVelocity[i])
pCurPcl->m_Velocity[i] = m_MinVelocity[i];
else if( m_MaxVelocity[i] != 0 && pCurPcl->m_Velocity[i] > m_MaxVelocity[i] )
pCurPcl->m_Velocity[i] = m_MaxVelocity[i];
}
pCurPcl->m_flScale += flFrametime * pCurPcl->m_flGrowScale;
pCurPcl = pCurPcl->m_pNext;
}
// See if we should delete any particles
// TODO: Clean this shit up will ya ? :)
pCurPcl = m_pParticles;
while( pCurPcl != NULL )
{
if( pCurPcl->m_flLifetime - gHUD.m_flTime <= 0.0f )
{
CParticle *pPrevPcl = m_pParticles;
if( pPrevPcl == pCurPcl )
{
m_pParticles = pCurPcl->m_pNext;
delete pCurPcl;
pCurPcl = m_pParticles;
}
else
{
while( pPrevPcl->m_pNext != NULL )
{
if( pPrevPcl->m_pNext == pCurPcl )
{
pPrevPcl->m_pNext = pCurPcl->m_pNext;
delete pCurPcl;
m_iNumParticles--;
break;
}
pPrevPcl = pPrevPcl->m_pNext;
}
pCurPcl = pPrevPcl->m_pNext;
}
}
else
pCurPcl = pCurPcl->m_pNext;
}
}
void CSpriteEmitter::AddParticle()
{
// Delete oldest particle if we are at max
if( m_iNumParticles >= m_iMaxParticles && m_pParticles )
{
CParticle *pDel = m_pParticles;
m_pParticles = m_pParticles->m_pNext;
delete pDel;
}
CParticle *pNewPcl = new CParticle;
// Origin
psvec3_t RangedOrigin;
RangedOrigin[0] = gEngfuncs.pfnRandomFloat( m_StartOriginRange[0][0], m_StartOriginRange[1][0] );
RangedOrigin[1] = gEngfuncs.pfnRandomFloat( m_StartOriginRange[0][1], m_StartOriginRange[1][1] );
RangedOrigin[2] = gEngfuncs.pfnRandomFloat( m_StartOriginRange[0][2], m_StartOriginRange[1][2] );
if( m_iCoordSystem == PCS_Relative )
{
VectorCopy( RangedOrigin, pNewPcl->m_Origin );
}
else
{
VectorAdd( m_Origin, RangedOrigin, pNewPcl->m_Origin );
}
VectorAdd( pNewPcl->m_Origin, m_StartOriginOffset, pNewPcl->m_Origin );
// Velocity
VectorSet( pNewPcl->m_Velocity,
gEngfuncs.pfnRandomFloat( m_StartVelocity[0][0], m_StartVelocity[1][0] ),
gEngfuncs.pfnRandomFloat( m_StartVelocity[0][1], m_StartVelocity[1][1] ),
gEngfuncs.pfnRandomFloat( m_StartVelocity[0][2], m_StartVelocity[1][2] ) );
pNewPcl->m_flLifetime = gHUD.m_flTime + gEngfuncs.pfnRandomFloat( m_flParticleLifetime[0], m_flParticleLifetime[1] );
pNewPcl->m_flScale = gEngfuncs.pfnRandomFloat( m_flStartScaleRange[0], m_flStartScaleRange[1] );
pNewPcl->m_flGrowScale = gEngfuncs.pfnRandomFloat( m_flGrowScaleRange[0], m_flGrowScaleRange[1] );
pNewPcl->m_iModelIndex = gEngfuncs.pfnRandomLong( 0, m_iNumSprites-1 );
if( m_pParticles )
m_pParticles->AddParticle( pNewPcl );
else
m_pParticles = pNewPcl;
m_iNumParticles++;
}
void CSpriteEmitter::ClearList( CParticle *pList )
{
CParticle *pCurPcl = pList;
while( pCurPcl )
{
CParticle *pNextPcl = pCurPcl->m_pNext;
delete pCurPcl;
pCurPcl = pNextPcl;
}
}
//==================================================
// CParticleSystem
//==================================================
CParticleSystem::CParticleSystem()
{
memset( m_szName, 0, sizeof( m_szName ) );
memset( m_Origin, 0, sizeof( m_Origin ) );
}
CParticleSystem::CParticleSystem( const CParticleSystem &Cpy )
{
strcpy( m_szName, Cpy.m_szName );
VectorCopy( Cpy.m_Origin, m_Origin );
}
CParticleSystem::~CParticleSystem()
{
}
void CParticleSystem::Render( int Transparent )
{
if( m_Emitters.size() )
{
list<CSpriteEmitter>::iterator iter;
for( iter = m_Emitters.begin(); iter != m_Emitters.end(); iter++ )
{
if( Transparent && iter->IsTransparent() )
iter->Render();
else if( !Transparent && !iter->IsTransparent() )
iter->Render();
}
}
}
void CParticleSystem::Update( double flFrametime )
{
if( m_Emitters.size() )
{
list<CSpriteEmitter>::iterator iter;
for( iter = m_Emitters.begin(); iter != m_Emitters.end(); iter++ )
{
VectorCopy( m_Origin, iter->m_Origin );
iter->Update( flFrametime );
}
}
}
//==================================================
// CParticleSystemManager
//==================================================
CParticleSystemManager::CParticleSystemManager()
{
memset( m_szCurrentLevel, 0, sizeof( m_szCurrentLevel ) );
}
CParticleSystemManager::~CParticleSystemManager()
{
}
void CParticleSystemManager::RenderNormal()
{
if( m_ActiveSystems.size() )
{
list<CParticleSystem>::iterator iter;
for( iter = m_ActiveSystems.begin(); iter != m_ActiveSystems.end(); iter++ )
iter->Render( 0 );
}
}
void CParticleSystemManager::RenderTransparent()
{
if( m_ActiveSystems.size() )
{
list<CParticleSystem>::iterator iter;
for( iter = m_ActiveSystems.begin(); iter != m_ActiveSystems.end(); iter++ )
iter->Render( 1 );
}
}
void CParticleSystemManager::Update( double flFrametime )
{
if( m_ActiveSystems.size() )
{
list<CParticleSystem>::iterator iter;
for( iter = m_ActiveSystems.begin(); iter != m_ActiveSystems.end(); iter++ )
iter->Update( flFrametime );
}
}
void CParticleSystemManager::AddParticleSystem( char *pszName, psvec3_t Origin )
{
gEngfuncs.Con_Printf( "Adding particle system \"%s\" at %f %f %f\n", pszName, Origin[0],
Origin[1], Origin[2] );
const CParticleSystem *pNewPclSystem = GetParticleSystem( pszName );
if( pNewPclSystem != NULL )
{
m_ActiveSystems.push_back( *pNewPclSystem );
return;
}
gEngfuncs.Con_Printf( "Particle system \"%s\" not found!\n", pszName );
}
const CParticleSystem *CParticleSystemManager::GetParticleSystem( char *pszName )
{
if( m_ReferenceSystems.size() )
{
list<CParticleSystem>::iterator iter;
for( iter = m_ReferenceSystems.begin(); iter != m_ReferenceSystems.end(); iter++ )
{
if( stricmp( iter->m_szName, pszName ) == 0 )
return &*iter;
}
}
return NULL;
}
const CSpriteEmitter *CParticleSystemManager::GetEmitter( char *pszName )
{
if( m_ReferenceEmitters.size() )
{
list<CSpriteEmitter>::iterator iter;
for( iter = m_ReferenceEmitters.begin(); iter != m_ReferenceEmitters.end(); iter++ )
{
if( stricmp( iter->m_szName, pszName ) == 0 )
return &*iter;
}
}
return NULL;
}
void CParticleSystemManager::CheckMap()
{
// Maps dont match, time to reinitialize emitters!
if( stricmp( m_szCurrentLevel, gEngfuncs.pfnGetLevelName() ) != 0 )
{
strcpy( m_szCurrentLevel, gEngfuncs.pfnGetLevelName() );
m_ActiveSystems.clear();
m_ReferenceEmitters.clear();
m_ReferenceSystems.clear();
// Test values
#if 1
CSpriteEmitter newEmitter;
strcpy( newEmitter.m_szName, "test.sewer_ventsmoke_emitter" );
VectorSet( newEmitter.m_StartVelocity[0], 50, 0, -50.0f );
VectorSet( newEmitter.m_StartVelocity[1], 100, 0, -100.0f );
newEmitter.m_flParticlesPerSecond = 10.0f;
newEmitter.m_flParticleLifetime[0] = 5.0f;
newEmitter.m_flParticleLifetime[1] = 6.0f;
VectorSet( newEmitter.m_StartOriginOffset, 0, 0, 0 );
VectorSet( newEmitter.m_StartOriginRange[0], -10, -10, -10 );
VectorSet( newEmitter.m_StartOriginRange[1], 10, 10, 10 );
newEmitter.m_flStartScaleRange[0] = 10.0f;
newEmitter.m_flStartScaleRange[1] = 15.0f;
newEmitter.m_flGrowScaleRange[0] = 1.0f;
newEmitter.m_flGrowScaleRange[1] = 2.0f;
newEmitter.m_iRenderMode = PRM_TransAdd;
newEmitter.m_iCoordSystem = PCS_Standard;
newEmitter.m_iMaxParticles = 256;
newEmitter.m_iNumSprites = 1;
newEmitter.m_iSpriteHandles[0] = gEngfuncs.pfnSPR_Load( "sprites/circle.spr" );
newEmitter.m_flInactiveTime = 0.5f;
m_ReferenceEmitters.push_back( newEmitter );
CParticleSystem newSystem;
strcpy( newSystem.m_szName, "test.sewer_ventsmoke" );
newSystem.m_Emitters.push_back( newEmitter );
m_ReferenceSystems.push_back( newSystem );
// test.sewer_lightsmoke
// test.sewer_ventsmoke
/* CSpriteEmitter newEmitter;
strcpy( newEmitter.m_szName, "test.testemitter" );
VectorSet( newEmitter.m_Origin, 0, 0, 50.0f );
newEmitter.m_Origin[2] -= 25.0f;
VectorSet( newEmitter.m_StartVelocity[0], 0, 0, -500.0f );
VectorSet( newEmitter.m_StartVelocity[1], 0, 0, -750.0f );
newEmitter.m_flParticlesPerSecond = 100.0f;
newEmitter.m_flParticleLifetime[0] = 4.0f;
newEmitter.m_flParticleLifetime[1] = 5.0f;
VectorSet( newEmitter.m_StartOriginOffset, 0, 0, 480 );
VectorSet( newEmitter.m_StartOriginRange[0], -500.0f, -500.0f, 0 );
VectorSet( newEmitter.m_StartOriginRange[1], 500.0f, 500.0f, 0 );
VectorSet( newEmitter.m_MinVelocity, 0, 0, 0 );
VectorSet( newEmitter.m_MaxVelocity, 0, 0, 0 );
newEmitter.m_flStartScaleRange[0] = 10.0;
newEmitter.m_flStartScaleRange[1] = 15.0;
newEmitter.m_flGrowScaleRange[0] = 0.0;
newEmitter.m_flGrowScaleRange[1] = 0.0;
newEmitter.m_iRenderMode = PRM_TransAdd;
newEmitter.m_iCoordSystem = PCS_Standard;
newEmitter.m_iMaxParticles = 1024;
newEmitter.m_iNumSprites = 1;
newEmitter.m_iSpriteHandles[0] = gEngfuncs.pfnSPR_Load( "sprites/circle.spr" );
newEmitter.m_flInactiveTime = 1.0f;
m_ReferenceEmitters.push_back( newEmitter );
CParticleSystem newSystem;
strcpy( newSystem.m_szName, "test.testsystem" );
VectorCopy( newEmitter.m_Origin, newSystem.m_Origin );
// newSystem.m_pEmitters.push_back( new CSpriteEmitter( g_ParticleSystemManager.GetEmitter( "test.testemitter" ) ) );
m_ActiveSystems.push_back( newSystem );
m_ReferenceSystems.push_back( newSystem );*/
#endif
}
}

158
cl_dll/ParticleBase.h Normal file
View file

@ -0,0 +1,158 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#if !defined( __PARTICLEBASE_H_ )
#define __PARTICLEBASE_H_
#include <list>
using namespace std;
//
// Data types
//
// Identical to vec3_t only it wont convert to Vector
typedef vec_t psvec3_t[3];
enum PclRenderMode_e {
PRM_Normal = kRenderNormal,
PRM_TransColor = kRenderTransColor,
PRM_TransTexture = kRenderTransTexture,
PRM_TransGlow = kRenderGlow,
PRM_TransAlpha = kRenderTransAlpha,
PRM_TransAdd = kRenderTransAdd,
};
enum PclCoordSystem_e {
PCS_Standard, // Particles spawn based off emitter location then use world coordinates
PCS_Relative, // Particles spawn based off emitter location, and stays relative to emitter location
};
// singly-linked particle
struct CParticle
{
CParticle() :
m_flLifetime( 0 ), m_iModelIndex( 0 ), m_pNext( 0 )
{
memset( m_Origin, 0, sizeof( m_Origin ) );
memset( m_Velocity, 0, sizeof( m_Velocity ) );
}
void AddParticle( CParticle *pPcl )
{
if( m_pNext )
m_pNext->AddParticle( pPcl );
else
{
m_pNext = pPcl;
}
}
psvec3_t m_Origin;
psvec3_t m_Velocity;
float m_flLifetime;
float m_flScale;
float m_flGrowScale;
int m_iModelIndex;
CParticle *m_pNext;
};
//
// CSpriteEmitter
//
class CSpriteEmitter
{
public:
CSpriteEmitter();
CSpriteEmitter( const CSpriteEmitter &Cpy );
~CSpriteEmitter();
bool IsTransparent(){ return ( m_iRenderMode != PRM_Normal ) ? true : false; }
void Render();
void Update( double flFrametime );
char m_szName[64]; // Emitter name
int m_iNumSprites; // How many sprites does this emitter use?
int m_iSpriteHandles[10]; // Handles to sprites to utilize
psvec3_t m_Origin; // Location of this emitter
psvec3_t m_Acceleration; // Acceleration to apply to each particle
psvec3_t m_StartOriginOffset; // Offset to apply to each newly created particle
psvec3_t m_StartOriginRange[2]; // Location min/max range to apply to each particle randomly
psvec3_t m_StartVelocity[2]; // Starting velocity range for each particle
psvec3_t m_MinVelocity; // Min particle velocity
psvec3_t m_MaxVelocity; // Max particle velocity
int m_iMaxParticles; // Maximum number of particles.
float m_flParticlesPerSecond; // Particles to generate each second
float m_flParticleLifetime[2]; // Particle lifetime range
float m_flStartScaleRange[2]; // Particle starting scale range
float m_flGrowScaleRange[2]; // Particle grow rate, rate per sec
int m_iRenderMode; // Rendering mode of the particles
int m_iCoordSystem; // Coordinate system for particles
float m_flInactiveTime; // If the particle emitter can't be seen for this time, it wont be rendered.
private:
void AddParticle();
void ClearList( CParticle *pList );
CParticle *m_pParticles;
float m_flLastParticleTime;
float m_flNextPpsChange;
int m_iNumParticles;
float m_flInactiveStart;
};
class CParticleSystem
{
public:
CParticleSystem();
CParticleSystem( const CParticleSystem &Cpy );
~CParticleSystem();
void Render( int Transparent );
void Update( double flFrametime );
char m_szName[64]; // Particle system name
psvec3_t m_Origin; // Particle system origin
list<CSpriteEmitter> m_Emitters;
};
// Stores definitions of all particle systems read from disk
// Also maintains currently active particle systems
class CParticleSystemManager
{
public:
CParticleSystemManager();
~CParticleSystemManager();
void RenderNormal();
void RenderTransparent();
void Update( double flFrametime );
void AddParticleSystem( char *pszName, psvec3_t Origin );
const CParticleSystem *GetParticleSystem( char *pszName );
const CSpriteEmitter *GetEmitter( char *pszName );
void CheckMap();
private:
list<CParticleSystem> m_ActiveSystems; // Currently active particle systems
list<CSpriteEmitter> m_ReferenceEmitters; // Emitters loaded from disk
list<CParticleSystem> m_ReferenceSystems; // Particle Systems loaded from disk
char m_szCurrentLevel[1024];
};
extern CParticleSystemManager g_ParticleSystemManager;
#endif

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -29,6 +29,15 @@
#include "StudioModelRenderer.h"
#include "GameStudioModelRenderer.h"
//#include "entity_types.h"
//#include "usercmd.h"
//#include "eventscripts.h"
//#include "ev_hldm.h"
//#include "r_efx.h"
#include "event_api.h"
#include "event_args.h"
//#include "in_defs.h"
// Global engine <-> studio model rendering code interface
engine_studio_api_t IEngineStudio;
@ -885,11 +894,6 @@ void CStudioModelRenderer::StudioSetupBones ( void )
// calc gait animation
if (m_pPlayerInfo && m_pPlayerInfo->gaitsequence != 0)
{
if (m_pPlayerInfo->gaitsequence >= m_pStudioHeader->numseq)
{
m_pPlayerInfo->gaitsequence = 0;
}
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pPlayerInfo->gaitsequence;
panim = StudioGetAnim( m_pRenderModel, pseqdesc );
@ -918,10 +922,7 @@ void CStudioModelRenderer::StudioSetupBones ( void )
if ( IEngineStudio.IsHardware() )
{
ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_pbonetransform)[i]);
// MatrixCopy should be faster...
//ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]);
MatrixCopy( (*m_pbonetransform)[i], (*m_plighttransform)[i] );
ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]);
}
else
{
@ -1029,10 +1030,7 @@ void CStudioModelRenderer::StudioMergeBones ( model_t *m_pSubModel )
if ( IEngineStudio.IsHardware() )
{
ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_pbonetransform)[i]);
// MatrixCopy should be faster...
//ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]);
MatrixCopy( (*m_pbonetransform)[i], (*m_plighttransform)[i] );
ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]);
}
else
{
@ -1250,11 +1248,6 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer )
int iBlend;
float flYaw; // view direction relative to movement
if (m_pCurrentEntity->curstate.sequence >= m_pStudioHeader->numseq)
{
m_pCurrentEntity->curstate.sequence = 0;
}
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence;
StudioPlayerBlend( pseqdesc, &iBlend, &m_pCurrentEntity->angles[PITCH] );
@ -1312,11 +1305,6 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer )
m_pCurrentEntity->angles[YAW] += 360;
m_pCurrentEntity->latched.prevangles[YAW] = m_pCurrentEntity->angles[YAW];
if (pplayer->gaitsequence >= m_pStudioHeader->numseq)
{
pplayer->gaitsequence = 0;
}
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + pplayer->gaitsequence;
// calc gait frame
@ -1335,6 +1323,8 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer )
m_pPlayerInfo->gaitframe += pseqdesc->numframes;
}
texture_t red_texture;
/*
====================
StudioDrawPlayer
@ -1460,11 +1450,11 @@ int CStudioModelRenderer::StudioDrawPlayer( int flags, entity_state_t *pplayer )
// get remap colors
m_nTopColor = m_pPlayerInfo->topcolor;
m_nBottomColor = m_pPlayerInfo->bottomcolor;
if (m_nTopColor < 0)
m_nTopColor = 0;
if (m_nTopColor > 360)
m_nTopColor = 360;
m_nBottomColor = m_pPlayerInfo->bottomcolor;
if (m_nBottomColor < 0)
m_nBottomColor = 0;
if (m_nBottomColor > 360)
@ -1524,6 +1514,8 @@ void CStudioModelRenderer::StudioCalcAttachments( void )
}
}
extern int ev_thermal;
/*
====================
StudioRenderModel
@ -1558,6 +1550,12 @@ void CStudioModelRenderer::StudioRenderModel( void )
}
else
{
// no texture / translucent render
if(ev_thermal)
{
IEngineStudio.SetForceFaceFlags( STUDIO_NF_CHROME );
}
StudioRenderFinal( );
}
}

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -21,13 +21,15 @@
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include "pm_shared.h"
#include <string.h>
#include <stdio.h>
#include "ammohistory.h"
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
int HUD_CanChangeWeapon(int iId);
WEAPON *gpActiveSel; // NULL means off, 1 means just the menu bar, otherwise
// this points to the active weapon menu item
@ -65,7 +67,7 @@ int WeaponsResource :: HasAmmo( WEAPON *p )
if ( p->iMax1 == -1 )
return TRUE;
return (p->iAmmoType == -1) || p->iClip > 0 || CountAmmo(p->iAmmoType)
return (p->iAmmoType == -1) || p->iClip > 0 || CountAmmo(p->iAmmoType) || p->iClip2 > 0
|| CountAmmo(p->iAmmo2Type) || ( p->iFlags & WEAPON_FLAGS_SELECTONEMPTY );
}
@ -87,6 +89,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
memset( &pWeapon->rcActive, 0, sizeof(wrect_t) );
memset( &pWeapon->rcInactive, 0, sizeof(wrect_t) );
memset( &pWeapon->rcAmmo, 0, sizeof(wrect_t) );
memset( &pWeapon->rcAmmobullet, 0, sizeof(wrect_t) );
memset( &pWeapon->rcAmmo2, 0, sizeof(wrect_t) );
pWeapon->hInactive = 0;
pWeapon->hActive = 0;
@ -180,6 +183,28 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
}
else
pWeapon->hAmmo = 0;
p = GetSpriteList(pList, "ammobullet", iRes, i);
if (p)
{
sprintf(sz, "sprites/%s.spr", p->szSprite);
pWeapon->hAmmobullet = SPR_Load(sz);
pWeapon->rcAmmobullet = p->rc;
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
}
else
pWeapon->hAmmobullet2 = 0;
p = GetSpriteList(pList, "ammobullet2", iRes, i);
if (p)
{
sprintf(sz, "sprites/%s.spr", p->szSprite);
pWeapon->hAmmobullet2 = SPR_Load(sz);
pWeapon->rcAmmobullet2 = p->rc;
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
}
else
pWeapon->hAmmobullet2 = 0;
p = GetSpriteList(pList, "ammo2", iRes, i);
if (p)
@ -202,7 +227,7 @@ WEAPON *WeaponsResource :: GetFirstPos( int iSlot )
for (int i = 0; i < MAX_WEAPON_POSITIONS; i++)
{
if ( rgSlots[iSlot][i] && HasAmmo( rgSlots[iSlot][i] ) )
if ( rgSlots[iSlot][i] /*&& HasAmmo( rgSlots[iSlot][i] )*/ )
{
pret = rgSlots[iSlot][i];
break;
@ -220,7 +245,7 @@ WEAPON* WeaponsResource :: GetNextActivePos( int iSlot, int iSlotPos )
WEAPON *p = gWR.rgSlots[ iSlot ][ iSlotPos+1 ];
if ( !p || !gWR.HasAmmo(p) )
if ( !p /*|| !gWR.HasAmmo(p)*/ )
return GetNextActivePos( iSlot, iSlotPos + 1 );
return p;
@ -310,7 +335,6 @@ void CHudAmmo::Reset(void)
gHR.Reset();
// VidInit();
}
int CHudAmmo::VidInit(void)
@ -375,17 +399,20 @@ void CHudAmmo::Think(void)
// has the player selected one?
if (gHUD.m_iKeyBits & IN_ATTACK)
{
if (gpActiveSel != (WEAPON *)1)
// if(HUD_CanChangeWeapon(gpActiveSel->iId))
{
ServerCmd(gpActiveSel->szName);
g_weaponselect = gpActiveSel->iId;
if (gpActiveSel != (WEAPON *)1)
{
ServerCmd(gpActiveSel->szName);
g_weaponselect = gpActiveSel->iId;
}
gpLastSel = gpActiveSel;
gpActiveSel = NULL;
gHUD.m_iKeyBits &= ~IN_ATTACK;
PlaySound("common/wpn_select.wav", 1);
}
gpLastSel = gpActiveSel;
gpActiveSel = NULL;
gHUD.m_iKeyBits &= ~IN_ATTACK;
PlaySound("common/wpn_select.wav", 1);
}
}
@ -430,12 +457,12 @@ void WeaponsResource :: SelectSlot( int iSlot, int fAdvance, int iDirection )
if ( gHUD.m_fPlayerDead || gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) )
return;
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
/* if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return;
if ( ! ( gHUD.m_iWeaponBits & ~(1<<(WEAPON_SUIT)) ))
return;
*/
WEAPON *p = NULL;
bool fastSwitch = CVAR_GET_FLOAT( "hud_fastswitch" ) != 0;
@ -539,9 +566,6 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
gHUD.m_iHideHUDDisplay = READ_BYTE();
if (gEngfuncs.IsSpectateOnly())
return 1;
if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) )
{
static wrect_t nullrc;
@ -572,6 +596,7 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
int iState = READ_BYTE();
int iId = READ_CHAR();
int iClip = READ_CHAR();
int iClip2 = READ_CHAR();
// detect if we're also on target
if ( iState > 1 )
@ -585,17 +610,14 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
return 0;
}
if ( g_iUser1 != OBS_IN_EYE )
// Is player dead???
if ((iId == -1) && (iClip == -1))
{
// Is player dead???
if ((iId == -1) && (iClip == -1))
{
gHUD.m_fPlayerDead = TRUE;
gpActiveSel = NULL;
return 1;
}
gHUD.m_fPlayerDead = FALSE;
gHUD.m_fPlayerDead = TRUE;
gpActiveSel = NULL;
return 1;
}
gHUD.m_fPlayerDead = FALSE;
WEAPON *pWeapon = gWR.GetWeapon( iId );
@ -606,29 +628,35 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
pWeapon->iClip = abs(iClip);
else
pWeapon->iClip = iClip;
if ( iClip2 < -1 )
pWeapon->iClip2 = abs(iClip2);
else
pWeapon->iClip2 = iClip2;
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
if (fOnTarget && m_pWeapon->hAutoaim)
SetCrosshair(m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255);
/*
if ( !(gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
{
if ( gHUD.m_iFOV >= 90 )
{ // 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
SetCrosshair(m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255);
{ // zoomed crosshairs
if (fOnTarget && m_pWeapon->hZoomedAutoaim)
SetCrosshair(m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255);
else
SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255);
}
}
else
{ // zoomed crosshairs
if (fOnTarget && m_pWeapon->hZoomedAutoaim)
SetCrosshair(m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255);
else
SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255);
}
*/
m_fFade = 200.0f; //!!!
m_iFlags |= HUD_ACTIVE;
@ -661,6 +689,7 @@ int CHudAmmo::MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf )
Weapon.iId = READ_CHAR();
Weapon.iFlags = READ_BYTE();
Weapon.iClip = 0;
Weapon.iClip2 = 0;
gWR.AddWeapon( &Weapon );
@ -769,7 +798,7 @@ void CHudAmmo::UserCmd_NextWeapon(void)
{
WEAPON *wsp = gWR.GetWeaponSlot( slot, pos );
if ( wsp && gWR.HasAmmo(wsp) )
if ( wsp/* && gWR.HasAmmo(wsp)*/ )
{
gpActiveSel = wsp;
return;
@ -810,7 +839,7 @@ void CHudAmmo::UserCmd_PrevWeapon(void)
{
WEAPON *wsp = gWR.GetWeaponSlot( slot, pos );
if ( wsp && gWR.HasAmmo(wsp) )
if ( wsp /*&& gWR.HasAmmo(wsp)*/ )
{
gpActiveSel = wsp;
return;
@ -837,12 +866,18 @@ int CHudAmmo::Draw(float flTime)
int a, x, y, r, g, b;
int AmmoWidth;
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return 1;
if ( (gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
return 1;
// If you want to reenable autoaim crosshair, feel free to try. :P
if (m_pWeapon && gHUD.m_Health.m_iHealth)
{
if ( gHUD.m_iFOV >= 90 ) // normal crosshairs
SetCrosshair(m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255);
else // zoomed crosshairs
SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255);
}
// Draw Weapon Menu
DrawWList(flTime);
@ -861,7 +896,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;
@ -871,7 +905,7 @@ int CHudAmmo::Draw(float flTime)
if (m_fFade > 0)
m_fFade -= (gHUD.m_flTimeDelta * 20);
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
ScaleColors(r, g, b, a );
@ -888,8 +922,8 @@ int CHudAmmo::Draw(float flTime)
// 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);
//x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b);
wrect_t rc;
rc.top = 0;
rc.left = 0;
@ -900,18 +934,40 @@ int CHudAmmo::Draw(float flTime)
x += AmmoWidth/2;
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
// draw the | bar
FillRGBA(x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a);
x += iBarWidth + AmmoWidth/2;;
//FillRGBA(x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a);
m_iAmmocount = 0;
// 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);
SPR_Set(m_pWeapon->hAmmobullet, r, g, b);
x = ScreenWidth - (gHUD.GetSpriteRect(m_pWeapon->hAmmobullet).right - gHUD.GetSpriteRect(m_pWeapon->hAmmobullet).left);
if( m_iAmmocount <= pw->iClip )
{
while(m_iAmmocount < pw->iClip )
{
int iOffset = (m_pWeapon->rcAmmobullet.bottom - m_pWeapon->rcAmmobullet.top);
SPR_DrawHoles(0, x - 21, y, &m_pWeapon->rcAmmobullet);
y-= iOffset;
m_iAmmocount++;
}
}
/* else if(m_iAmmocount > gWR.CountAmmo(pw->iAmmoType) )
{
while(m_iAmmocount > gWR.CountAmmo(pw->iAmmoType) )
{
iOffset = (m_pWeapon->rcAmmobullet.bottom - m_pWeapon->rcAmmobullet.top);
SPR_DrawHoles(1, x, y, &m_pWeapon->rcAmmobullet);
y+= iOffset;
m_iAmmocount--;
}
}
*/
}
else
{
@ -921,11 +977,14 @@ int CHudAmmo::Draw(float flTime)
}
// Draw the ammo Icon
int iOffset = (m_pWeapon->rcAmmo.bottom - m_pWeapon->rcAmmo.top)/8;
SPR_Set(m_pWeapon->hAmmo, r, g, b);
SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo);
//int iOffset = (m_pWeapon->rcAmmo.bottom - m_pWeapon->rcAmmo.top)/8;
// SPR_Set(m_pWeapon->hAmmo, r, g, b);
// SPR_DrawAdditive(0, x, y -= 12, &m_pWeapon->rcAmmo);
}
/*
// Does weapon have seconday ammo?
if (pw->iAmmo2Type > 0)
{
@ -944,6 +1003,71 @@ int CHudAmmo::Draw(float flTime)
SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo2);
}
}
*/
// ADS - 2nd clip
// Does weapon have any secondary ammo at all?
if (m_pWeapon->iAmmo2Type > 0 && (gWR.CountAmmo(pw->iAmmo2Type) || pw->iClip2 >= 0))
{
int iIconWidth = m_pWeapon->rcAmmo2.right - m_pWeapon->rcAmmo2.left;
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight/2;
y -= gHUD.m_iFontHeight + gHUD.m_iFontHeight/4;
if (pw->iClip2 >= 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->iClip2, r, g, b);
wrect_t rc;
rc.top = 0;
rc.left = 0;
rc.right = AmmoWidth;
rc.bottom = 100;
int iBarWidth = AmmoWidth/10;
x += AmmoWidth/2;
UnpackRGB(r,g,b, RGB_WHITE);
// draw the | bar
// FillRGBA(x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a);
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->iAmmo2Type), r, g, b);
m_iAmmocount = 0;
SPR_Set(m_pWeapon->hAmmobullet2, r, g, b);
x = ScreenWidth - ((gHUD.GetSpriteRect(m_pWeapon->hAmmobullet2).right - gHUD.GetSpriteRect(m_pWeapon->hAmmobullet2).left)+(gHUD.GetSpriteRect(m_pWeapon->hAmmobullet2).right - gHUD.GetSpriteRect(m_pWeapon->hAmmobullet2).left));
if( m_iAmmocount < pw->iClip2 )
{
while(m_iAmmocount < pw->iClip2 )
{
int iOffset = (m_pWeapon->rcAmmobullet2.bottom - m_pWeapon->rcAmmobullet2.top);
SPR_DrawHoles(0, x-21, y, &m_pWeapon->rcAmmobullet2);
y-= iOffset;
m_iAmmocount++;
}
}
}
else
{
// SPR_Draw a bullets only line
x = ScreenWidth - 4 * AmmoWidth - iIconWidth;
x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmo2Type), r, g, b);
}
// Draw the ammo Icon
// int iOffset = (m_pWeapon->rcAmmo2.bottom - m_pWeapon->rcAmmo2.top)/8;
// SPR_Set(m_pWeapon->hAmmo2, r, g, b);
// SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo2);
}
//
return 1;
}
@ -973,7 +1097,7 @@ int DrawBar(int x, int y, int width, int height, float f)
width -= w;
}
UnpackRGB(r, g, b, RGB_YELLOWISH);
UnpackRGB(r, g, b, RGB_WHITE);
FillRGBA(x, y, width, height, r, g, b, 128);
@ -1049,7 +1173,7 @@ int CHudAmmo::DrawWList(float flTime)
{
int iWidth;
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
if ( iActiveSlot == i )
a = 255;
@ -1071,7 +1195,7 @@ int CHudAmmo::DrawWList(float flTime)
else
iWidth = giBucketWidth;
SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_bucket0 + i));
SPR_DrawHoles(0, x, y, &gHUD.GetSpriteRect(m_HUD_bucket0 + i));
x += iWidth + 5;
}
@ -1101,14 +1225,21 @@ int CHudAmmo::DrawWList(float flTime)
if ( !p || !p->iId )
continue;
UnpackRGB( r,g,b, RGB_YELLOWISH );
UnpackRGB( r,g,b, RGB_WHITE );
// if active, then we must have ammo.
// LIES -> Gage :)
if ( gpActiveSel == p )
{
if ( !gWR.HasAmmo(p) )
{
UnpackRGB(r,g,b, RGB_REDISH);
ScaleColors(r, g, b, 128);
}
SPR_Set(p->hActive, r, g, b );
SPR_DrawAdditive(0, x, y, &p->rcActive);
SPR_DrawHoles(0, x, y, &p->rcActive);
SPR_Set(gHUD.GetSprite(m_HUD_selection), r, g, b );
SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_selection));
@ -1116,7 +1247,6 @@ int CHudAmmo::DrawWList(float flTime)
else
{
// Draw Weapon if Red if no ammo
if ( gWR.HasAmmo(p) )
ScaleColors(r, g, b, 192);
else
@ -1143,7 +1273,7 @@ int CHudAmmo::DrawWList(float flTime)
{
// Draw Row of weapons.
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
for ( int iPos = 0; iPos < MAX_WEAPON_POSITIONS; iPos++ )
{
@ -1154,7 +1284,7 @@ int CHudAmmo::DrawWList(float flTime)
if ( gWR.HasAmmo(p) )
{
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
a = 128;
}
else

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -35,7 +35,7 @@ struct WEAPON
int iFlags;
int iId;
int iClip;
int iClip2;
int iCount; // # of itesm in plist
HSPRITE hActive;
@ -44,6 +44,10 @@ struct WEAPON
wrect_t rcInactive;
HSPRITE hAmmo;
wrect_t rcAmmo;
HSPRITE hAmmobullet;
wrect_t rcAmmobullet;
HSPRITE hAmmobullet2;
wrect_t rcAmmobullet2;
HSPRITE hAmmo2;
wrect_t rcAmmo2;
HSPRITE hCrosshair;

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -60,7 +60,7 @@ int CHudAmmoSecondary :: Draw(float flTime)
// draw secondary ammo icons above normal ammo readout
int a, x, y, r, g, b, AmmoWidth;
UnpackRGB( r, g, b, RGB_YELLOWISH );
UnpackRGB( r, g, b, RGB_WHITE );
a = (int) max( MIN_ALPHA, m_fFade );
if (m_fFade > 0)
m_fFade -= (gHUD.m_flTimeDelta * 20); // slowly lower alpha to fade out icons

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -124,7 +124,7 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
HSPRITE *spr = gWR.GetAmmoPicFromWeapon( rgAmmoHistory[i].iId, rcPic );
int r, g, b;
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) );
@ -148,7 +148,7 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
return 1; // we don't know about the weapon yet, so don't draw anything
int r, g, b;
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
if ( !gWR.HasAmmo( weap ) )
UnpackRGB(r,g,b, RGB_REDISH); // if the weapon doesn't have ammo, display it as red
@ -170,7 +170,7 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
wrect_t rect = gHUD.GetSpriteRect( rgAmmoHistory[i].iId );
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) );

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -17,7 +17,7 @@
//
// this is the max number of items in each bucket
#define MAX_WEAPON_POSITIONS MAX_WEAPON_SLOTS
#define MAX_WEAPON_POSITIONS 8//MAX_WEAPON_SLOTS
class WeaponsResource
{
@ -28,7 +28,6 @@ private:
// counts of weapons * ammo
WEAPON* rgSlots[MAX_WEAPON_SLOTS+1][MAX_WEAPON_POSITIONS+1]; // The slots currently in use by weapons. The value is a pointer to the weapon; if it's NULL, no weapon is there
int riAmmo[MAX_AMMO_TYPES]; // count of each ammo type
public:
void Init( void )
{

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -32,13 +32,27 @@ extern "C"
#include "hud_servers.h"
#include "vgui_int.h"
#include "interface.h"
#include "ParseBspEnt.h"
#include "ParseBsp.h"
#include "twm.h"
#include "twmmanager.h"
#define DLLEXPORT __declspec( dllexport )
cl_enginefunc_t gEngfuncs;
CHud gHUD;
TeamFortressViewport *gViewPort = NULL;
TheWastesViewport *gViewPort = NULL;
extern int ev_thermal;
extern int g_iClientLasersEnabled[32];
cvar_t *cl_shellcase_lifetime = NULL;
cvar_t *cl_shellcase_quality = NULL;
cvar_t *cl_enablefog = NULL;
cvar_t *cl_efx_frequency = NULL;
// Msg definitions
int __MsgFunc_LaserInfo(const char *pszName, int iSize, void *pbuf );
void InitInput (void);
void EV_HookEvents( void );
@ -55,18 +69,18 @@ extern "C"
{
int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion );
int DLLEXPORT HUD_VidInit( void );
void DLLEXPORT HUD_Init( void );
int DLLEXPORT HUD_Init( void );
int DLLEXPORT HUD_Redraw( float flTime, int intermission );
int DLLEXPORT HUD_UpdateClientData( client_data_t *cdata, float flTime );
void DLLEXPORT HUD_Reset ( void );
int DLLEXPORT HUD_Reset ( void );
void DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server );
void DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove );
char DLLEXPORT HUD_PlayerMoveTexture( char *name );
int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
int DLLEXPORT HUD_ConnectionlessPacket( struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs );
void DLLEXPORT HUD_Frame( double time );
void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking);
void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf );
void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf );
}
/*
@ -110,7 +124,7 @@ HUD_ConnectionlessPacket
size of the response_buffer, so you must zero it out if you choose not to respond.
================================
*/
int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size )
int DLLEXPORT HUD_ConnectionlessPacket( struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size )
{
// Parse stuff from args
int max_buffer_size = *response_buffer_size;
@ -150,10 +164,15 @@ int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
EV_HookEvents();
// Client side cvars
cl_shellcase_lifetime = gEngfuncs.pfnRegisterVariable("cl_shellcase_lifetime","5.0",FCVAR_ARCHIVE); // How long shellcases stay on ground
cl_shellcase_quality = gEngfuncs.pfnRegisterVariable("cl_shellcase_quality","0",FCVAR_ARCHIVE); // Hi/Lo Quality casings
cl_enablefog = gEngfuncs.pfnRegisterVariable("cl_enablefog","0",FCVAR_ARCHIVE); // Fog
cl_efx_frequency = gEngfuncs.pfnRegisterVariable("cl_efx_frequency","0.5",FCVAR_ARCHIVE); // How often special efx should be enabled
return 1;
}
/*
==========================
HUD_VidInit
@ -163,13 +182,24 @@ and whenever the vid_mode is changed
so the HUD can reinitialize itself.
==========================
*/
int DLLEXPORT HUD_VidInit( void )
{
gHUD.VidInit();
VGui_Startup();
ev_thermal = 0; // Make sure thermal is off
// No clients have lasersights enabled
memset(g_iClientLasersEnabled,0,sizeof(int)*32);
// Reset .TWM data
memset(g_MuzzleflashModels,0,sizeof(g_MuzzleflashModels));
g_iNumMuzzleflashModels = 0;
// Precache .TWM's
g_TwmManager.BeginPrecache();
return 1;
}
@ -182,14 +212,18 @@ to a server. Reinitializes all
the hud variables.
==========================
*/
void DLLEXPORT HUD_Init( void )
int DLLEXPORT HUD_Init( void )
{
InitInput();
gHUD.Init();
Scheme_Init();
}
// Not strictly HUD based
// messages, so stick them here ?
HOOK_MESSAGE(LaserInfo);
return 1;
}
/*
==========================
@ -207,7 +241,6 @@ int DLLEXPORT HUD_Redraw( float time, int intermission )
return 1;
}
/*
==========================
HUD_UpdateClientData
@ -236,9 +269,10 @@ Called at start and end of demos to restore to "non"HUD state.
==========================
*/
void DLLEXPORT HUD_Reset( void )
int DLLEXPORT HUD_Reset( void )
{
gHUD.VidInit();
return 1;
}
/*
@ -272,15 +306,14 @@ void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking)
/*
==========================
HUD_DirectorEvent
HUD_DirectorMessage
Called when a director event message was received
==========================
*/
void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf )
{
gHUD.m_Spectator.DirectorMessage( iSize, pbuf );
gHUD.m_Spectator.DirectorMessage( iSize, pbuf );
}

View file

@ -23,8 +23,8 @@ CFG=cl_dll - Win32 Release
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
# PROP Scc_ProjName ""$/GoldSrc/cl_dll", HGEBAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
@ -38,8 +38,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Output_Dir "..\obj\ReleaseClient"
# PROP Intermediate_Dir "..\obj\ReleaseClient"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib winmm.lib ../utils/vgui/lib/win32_vc6/vgui.lib wsock32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:".\Release\client.dll"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib winmm.lib ../utils/vgui/lib/win32_vc6/vgui.lib wsock32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"../../cl_dlls/client.dll"
!ELSEIF "$(CFG)" == "cl_dll - Win32 Debug"
@ -64,8 +64,8 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Output_Dir "..\obj\DebugClient"
# PROP Intermediate_Dir "..\obj\DebugClient"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
@ -79,7 +79,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib winmm.lib ../utils/vgui/lib/win32_vc6/vgui.lib wsock32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug\client.dll"
# ADD LINK32 oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib winmm.lib ../utils/vgui/lib/win32_vc6/vgui.lib wsock32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"../../cl_dlls/client.dll"
!ENDIF
@ -95,51 +95,23 @@ LINK32=link.exe
# PROP Default_Filter "*.CPP"
# Begin Source File
SOURCE=..\dlls\crossbow.cpp
SOURCE=.\ev_thewastes.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\crowbar.cpp
SOURCE=.\thewastes\hl_baseentity.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\egon.cpp
SOURCE=.\thewastes\hl_events.cpp
# End Source File
# Begin Source File
SOURCE=.\ev_hldm.cpp
SOURCE=.\thewastes\hl_objects.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\gauss.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\handgrenade.cpp
# End Source File
# Begin Source File
SOURCE=.\hl\hl_baseentity.cpp
# End Source File
# Begin Source File
SOURCE=.\hl\hl_events.cpp
# End Source File
# Begin Source File
SOURCE=.\hl\hl_objects.cpp
# End Source File
# Begin Source File
SOURCE=.\hl\hl_weapons.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\wpn_shared\hl_wpn_glock.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\hornetgun.cpp
SOURCE=.\thewastes\hl_weapons.cpp
# End Source File
# Begin Source File
@ -147,31 +119,31 @@ SOURCE=..\common\interface.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\mp5.cpp
SOURCE=..\dlls\thewastes.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\python.cpp
SOURCE=..\dlls\wpn_shared\tw_akimbos.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\rpg.cpp
SOURCE=..\dlls\wpn_shared\tw_automatics.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\satchel.cpp
SOURCE=..\dlls\wpn_shared\tw_explosives.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\shotgun.cpp
SOURCE=..\dlls\wpn_shared\tw_melee.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\squeakgrenade.cpp
SOURCE=..\dlls\wpn_shared\tw_shotguns.cpp
# End Source File
# Begin Source File
SOURCE=..\dlls\tripmine.cpp
SOURCE=..\dlls\wpn_shared\tw_sidearms.cpp
# End Source File
# Begin Source File
@ -189,6 +161,10 @@ SOURCE=..\game_shared\voice_banmgr.cpp
SOURCE=..\game_shared\voice_status.cpp
# End Source File
# Begin Source File
SOURCE=..\game_shared\voice_vgui_tweakdlg.cpp
# End Source File
# End Group
# Begin Source File
@ -204,10 +180,6 @@ SOURCE=.\ammohistory.cpp
# End Source File
# Begin Source File
SOURCE=.\battery.cpp
# End Source File
# Begin Source File
SOURCE=.\cdll_int.cpp
# End Source File
# Begin Source File
@ -228,6 +200,10 @@ SOURCE=.\entity.cpp
# End Source File
# Begin Source File
SOURCE=.\env_fog.cpp
# End Source File
# Begin Source File
SOURCE=.\ev_common.cpp
# End Source File
# Begin Source File
@ -301,11 +277,19 @@ SOURCE=.\overview.cpp
# End Source File
# Begin Source File
SOURCE=.\parsebsp.cpp
# End Source File
# Begin Source File
SOURCE=.\ParseBspEnt.cpp
# End Source File
# Begin Source File
SOURCE=.\parsemsg.cpp
# End Source File
# Begin Source File
SOURCE=.\parsemsg.h
SOURCE=.\ParticleBase.cpp
# End Source File
# Begin Source File
@ -337,6 +321,10 @@ SOURCE=.\studio_util.cpp
# End Source File
# Begin Source File
SOURCE=.\studioevent.cpp
# End Source File
# Begin Source File
SOURCE=.\StudioModelRenderer.cpp
# End Source File
# Begin Source File
@ -345,6 +333,10 @@ SOURCE=.\text_message.cpp
# End Source File
# Begin Source File
SOURCE=.\thewastes_hud.cpp
# End Source File
# Begin Source File
SOURCE=.\train.cpp
# End Source File
# Begin Source File
@ -353,6 +345,10 @@ SOURCE=.\tri.cpp
# End Source File
# Begin Source File
SOURCE=.\twm.cpp
# End Source File
# Begin Source File
SOURCE=.\util.cpp
# End Source File
# Begin Source File
@ -361,10 +357,6 @@ SOURCE=..\game_shared\vgui_checkbutton2.cpp
# End Source File
# Begin Source File
SOURCE=.\vgui_ClassMenu.cpp
# End Source File
# Begin Source File
SOURCE=.\vgui_ConsolePanel.cpp
# End Source File
# Begin Source File
@ -389,6 +381,10 @@ SOURCE=.\vgui_int.cpp
# End Source File
# Begin Source File
SOURCE=.\vgui_ItemSelection.cpp
# End Source File
# Begin Source File
SOURCE=..\game_shared\vgui_listbox.cpp
# End Source File
# Begin Source File
@ -413,18 +409,14 @@ SOURCE=.\vgui_ServerBrowser.cpp
# End Source File
# Begin Source File
SOURCE=.\vgui_SpectatorPanel.cpp
# End Source File
# Begin Source File
SOURCE=.\vgui_TeamFortressViewport.cpp
# End Source File
# Begin Source File
SOURCE=.\vgui_teammenu.cpp
# End Source File
# Begin Source File
SOURCE=.\vgui_TheWastesViewport.cpp
# End Source File
# Begin Source File
SOURCE=.\view.cpp
# End Source File
# End Group
@ -449,6 +441,14 @@ SOURCE=.\cl_dll.h
# End Source File
# Begin Source File
SOURCE=..\common\cl_entity.h
# End Source File
# Begin Source File
SOURCE=.\cl_util.h
# End Source File
# Begin Source File
SOURCE=.\com_weapons.h
# End Source File
# Begin Source File
@ -457,7 +457,15 @@ SOURCE=.\demo.h
# End Source File
# Begin Source File
SOURCE=.\ev_hldm.h
SOURCE=..\common\entity_state.h
# End Source File
# Begin Source File
SOURCE=.\ev_thewastes.h
# End Source File
# Begin Source File
SOURCE=..\common\event_args.h
# End Source File
# Begin Source File
@ -497,10 +505,6 @@ SOURCE=.\in_defs.h
# End Source File
# Begin Source File
SOURCE=..\common\itrackeruser.h
# End Source File
# Begin Source File
SOURCE=.\kbutton.h
# End Source File
# Begin Source File
@ -509,6 +513,22 @@ SOURCE=.\overview.h
# End Source File
# Begin Source File
SOURCE=.\parsebsp.h
# End Source File
# Begin Source File
SOURCE=.\ParseBspEnt.h
# End Source File
# Begin Source File
SOURCE=.\parsemsg.h
# End Source File
# Begin Source File
SOURCE=.\ParticleBase.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_debug.h
# End Source File
# Begin Source File
@ -533,6 +553,22 @@ SOURCE=..\pm_shared\pm_shared.h
# End Source File
# Begin Source File
SOURCE=..\common\pmtrace.h
# End Source File
# Begin Source File
SOURCE=..\common\r_efx.h
# End Source File
# Begin Source File
SOURCE=.\r_studioint.h
# End Source File
# Begin Source File
SOURCE=..\common\ref_params.h
# End Source File
# Begin Source File
SOURCE=.\studio_util.h
# End Source File
# Begin Source File
@ -541,7 +577,35 @@ SOURCE=.\StudioModelRenderer.h
# End Source File
# Begin Source File
SOURCE=.\util.h
SOURCE=.\tf_defs.h
# End Source File
# Begin Source File
SOURCE=.\tri.h
# End Source File
# Begin Source File
SOURCE=..\common\triangleapi.h
# End Source File
# Begin Source File
SOURCE=..\common\tw_common.h
# End Source File
# Begin Source File
SOURCE=.\tw_vgui.h
# End Source File
# Begin Source File
SOURCE=..\common\twm.h
# End Source File
# Begin Source File
SOURCE=.\twmmanager.h
# End Source File
# Begin Source File
SOURCE=..\dlls\util.h
# End Source File
# Begin Source File
@ -573,11 +637,7 @@ SOURCE=.\vgui_ServerBrowser.h
# End Source File
# Begin Source File
SOURCE=.\vgui_SpectatorPanel.h
# End Source File
# Begin Source File
SOURCE=.\vgui_TeamFortressViewport.h
SOURCE=.\vgui_TheWastesViewport.h
# End Source File
# Begin Source File

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -68,8 +68,8 @@ inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int fl
#define ScreenWidth (gHUD.m_scrinfo.iWidth)
// Use this to set any co-ords in 640x480 space
#define XRES(x) ((int)(float(x) * ((float)ScreenWidth / 640.0f) + 0.5f))
#define YRES(y) ((int)(float(y) * ((float)ScreenHeight / 480.0f) + 0.5f))
#define XRES(x) ((x) * ((float)ScreenWidth / 640))
#define YRES(y) ((y) * ((float)ScreenHeight / 480))
// use this to project world coordinates to screen coordinates
#define XPROJECT(x) ( (1.0f+(x))*ScreenWidth*0.5f )
@ -114,10 +114,7 @@ inline void ConsolePrint( const char *string )
gEngfuncs.pfnConsolePrint( string );
}
inline void CenterPrint( const char *string )
{
gEngfuncs.pfnCenterPrint( string );
}
void CenterPrint(const char*);
// returns the players name of entity no.
#define GetPlayerInfo (*gEngfuncs.pfnGetPlayerInfo)
@ -136,6 +133,7 @@ void ScaleColors( int &r, int &g, int &b, int a );
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
#define VectorSet(v,x,y,z) {(v)[0]=(x);(v)[1]=(y);(v)[2]=(z);}
inline void VectorClear(float *a) { a[0]=0.0;a[1]=0.0;a[2]=0.0;}
float Length(const float *v);
void VectorMA (const float *veca, float scale, const float *vecb, float *vecc);
@ -158,3 +156,6 @@ inline void UnpackRGB(int &r, int &g, int &b, unsigned long ulRGB)\
}
HSPRITE LoadSprite(const char *pszName);
// This code is used for jerking around a persons view
#define RECOIL_VIEW(amountx,amounty) { vec3_t ViewAngle; gEngfuncs.GetViewAngles((float*)ViewAngle); ViewAngle.x -= amountx; ViewAngle.y -= amounty; gEngfuncs.SetViewAngles((float*)ViewAngle); }

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -22,17 +22,20 @@
#include <string.h>
#include <stdio.h>
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
DECLARE_MESSAGE( m_DeathNotice, DeathMsg );
struct DeathNoticeItem {
char szKiller[MAX_PLAYER_NAME_LENGTH*2];
char szVictim[MAX_PLAYER_NAME_LENGTH*2];
char szDeathMessage[128];
int iId; // the index number of the associated sprite
int iSuicide;
int iTeamKill;
int iNonPlayerKill;
int iSpecialDeath;
float flDisplayTime;
float *KillerColor;
float *VictimColor;
@ -41,7 +44,7 @@ struct DeathNoticeItem {
#define MAX_DEATHNOTICES 4
static int DEATHNOTICE_DISPLAY_TIME = 6;
#define DEATHNOTICE_TOP 32
#define DEATHNOTICE_TOP ScreenHeight - 72
DeathNoticeItem rgDeathNoticeList[ MAX_DEATHNOTICES + 1 ];
@ -49,7 +52,6 @@ float g_ColorBlue[3] = { 0.6, 0.8, 1.0 };
float g_ColorRed[3] = { 1.0, 0.25, 0.25 };
float g_ColorGreen[3] = { 0.6, 1.0, 0.6 };
float g_ColorYellow[3] = { 1.0, 0.7, 0.0 };
float g_ColorGrey[3] = { 0.8, 0.8, 0.8 };
float *GetClientColor( int clientIndex )
{
@ -59,9 +61,6 @@ float *GetClientColor( int clientIndex )
case 2: return g_ColorRed;
case 3: return g_ColorYellow;
case 4: return g_ColorGreen;
case 0: return g_ColorYellow;
default : return g_ColorGrey;
}
return NULL;
@ -87,7 +86,9 @@ void CHudDeathNotice :: InitHUDData( void )
int CHudDeathNotice :: VidInit( void )
{
m_HUD_d_skull = gHUD.GetSpriteIndex( "d_skull" );
m_HUD_d_skull = gHUD.GetSpriteIndex( "d_skull" );
m_HUD_d_headshot = gHUD.GetSpriteIndex( "d_headshot" );
m_HUD_d_bleeding = gHUD.GetSpriteIndex( "d_bleed" );
return 1;
}
@ -95,8 +96,19 @@ int CHudDeathNotice :: VidInit( void )
int CHudDeathNotice :: Draw( float flTime )
{
int x, y, r, g, b;
int text_y;
int deathcount = 0;
for ( int i = 0; i < MAX_DEATHNOTICES; i++ )
// How many death messages are there.
for( int i = 0;i < MAX_DEATHNOTICES; i++)
{
if(rgDeathNoticeList[i].iId == 0)
break;
deathcount++;
}
for ( i = 0; i < MAX_DEATHNOTICES; i++ )
{
if ( rgDeathNoticeList[i].iId == 0 )
break; // we've gone through them all
@ -114,11 +126,41 @@ int CHudDeathNotice :: Draw( float flTime )
// Only draw if the viewport will let me
if ( gViewPort && gViewPort->AllowedToPrintText() )
{
// Draw the death notice
y = YRES(DEATHNOTICE_TOP) + 2 + (20 * i); //!!!
// Get the initial offset.
int offset = (20 * deathcount );
int id = (rgDeathNoticeList[i].iId == -1) ? m_HUD_d_skull : rgDeathNoticeList[i].iId;
x = ScreenWidth - ConsoleStringLen(rgDeathNoticeList[i].szVictim) - (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left);
// Draw the death notice
y = DEATHNOTICE_TOP + (20 * i) - offset; //!!!
int id,special_id = 0;
switch(rgDeathNoticeList[i].iSpecialDeath)
{
default:
case 0:
break;
case 1:
special_id = m_HUD_d_headshot;
break;
case 2:
special_id = m_HUD_d_bleeding;
break;
}
id = (rgDeathNoticeList[i].iId == -1) ? m_HUD_d_skull : rgDeathNoticeList[i].iId;
int id_length;
if(rgDeathNoticeList[i].iSpecialDeath == 2 && !rgDeathNoticeList[i].iSuicide)
id_length = 0;
else
id_length = (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left);
int special_id_length = (rgDeathNoticeList[i].iSpecialDeath && !rgDeathNoticeList[i].iSuicide) ? (gHUD.GetSpriteRect(special_id).right - gHUD.GetSpriteRect(special_id).left) : 0;
// Put in center
x = (ScreenWidth/2) -
(ConsoleStringLen(rgDeathNoticeList[i].szVictim) - id_length - special_id_length)/2;
if ( !rgDeathNoticeList[i].iSuicide )
{
@ -130,17 +172,29 @@ int CHudDeathNotice :: Draw( float flTime )
x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller );
}
r = 255; g = 80; b = 0;
// r = 255; g = 80; b = 0;
r = g = b = 255; // WHITE - Gage
if ( rgDeathNoticeList[i].iTeamKill )
{
r = 10; g = 240; b = 10; // display it in sickly green
}
// Draw death weapon
SPR_Set( gHUD.GetSprite(id), r, g, b );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(id) );
// Draw death weapon if needed
if(!(special_id_length && rgDeathNoticeList[i].iSuicide) && id_length)
{
SPR_Set( gHUD.GetSprite(id), r, g, b );
SPR_DrawHoles( 0, x, y, &gHUD.GetSpriteRect(id) );
x += (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left);
x += (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left);
}
if(special_id_length)
{
SPR_Set(gHUD.GetSprite(special_id),r,g,b);
SPR_DrawHoles(0,x,y,&gHUD.GetSpriteRect(special_id));
x += (gHUD.GetSpriteRect(special_id).right - gHUD.GetSpriteRect(special_id).left);
}
// Draw victims name (if it was a player that was killed)
if (rgDeathNoticeList[i].iNonPlayerKill == FALSE)
@ -149,6 +203,13 @@ int CHudDeathNotice :: Draw( float flTime )
gEngfuncs.pfnDrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] );
x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim );
}
int text_w,text_h;
GetConsoleStringSize(rgDeathNoticeList[i].szDeathMessage,&text_w,&text_h);
text_y = text_h*i;
DrawConsoleString(ScreenWidth-text_w,text_y,rgDeathNoticeList[i].szDeathMessage);
}
}
@ -162,8 +223,9 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
BEGIN_READ( pbuf, iSize );
int killer = READ_BYTE();
int victim = READ_BYTE();
int killer = READ_BYTE();
int victim = READ_BYTE();
int special = READ_BYTE();
char killedwith[32];
strcpy( killedwith, "d_" );
@ -188,6 +250,9 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
if (gViewPort)
gViewPort->GetAllPlayersInfo();
// Set special death
rgDeathNoticeList[i].iSpecialDeath = special;
// Get the Killer's name
char *killer_name = g_PlayerInfoList[ killer ].name;
if ( !killer_name )
@ -236,6 +301,14 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
rgDeathNoticeList[i].iTeamKill = TRUE;
}
char *szDeathMessage = READ_STRING();
// fill deathmessage string
if(killer == victim || killer == 0)
sprintf(rgDeathNoticeList[i].szDeathMessage,"%s commited suicide",victim_name);
else
sprintf(rgDeathNoticeList[i].szDeathMessage,szDeathMessage,killer_name,victim_name);
// Find the sprite in the list
int spr = gHUD.GetSpriteIndex( killedwith );
@ -253,47 +326,9 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
}
else
{
// record the death notice in the console
if ( rgDeathNoticeList[i].iSuicide )
{
ConsolePrint( rgDeathNoticeList[i].szVictim );
if ( !strcmp( killedwith, "d_world" ) )
{
ConsolePrint( " died" );
}
else
{
ConsolePrint( " killed self" );
}
}
else if ( rgDeathNoticeList[i].iTeamKill )
{
ConsolePrint( rgDeathNoticeList[i].szKiller );
ConsolePrint( " killed his teammate " );
ConsolePrint( rgDeathNoticeList[i].szVictim );
}
else
{
ConsolePrint( rgDeathNoticeList[i].szKiller );
ConsolePrint( " killed " );
ConsolePrint( rgDeathNoticeList[i].szVictim );
}
if ( killedwith && *killedwith && (*killedwith > 13 ) && strcmp( killedwith, "d_world" ) && !rgDeathNoticeList[i].iTeamKill )
{
ConsolePrint( " with " );
// replace the code names with the 'real' names
if ( !strcmp( killedwith+2, "egon" ) )
strcpy( killedwith, "d_gluon gun" );
if ( !strcmp( killedwith+2, "gauss" ) )
strcpy( killedwith, "d_tau cannon" );
ConsolePrint( killedwith+2 ); // skip over the "d_" part
}
ConsolePrint( "\n" );
// record new death notices
ConsolePrint(rgDeathNoticeList[i].szDeathMessage);
ConsolePrint("\n");
}
return 1;

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

48
cl_dll/dmc_bspfile.h Normal file
View file

@ -0,0 +1,48 @@
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( DMC_BSPFILE_H )
#define DMC_BSPFILE_H
#ifdef _WIN32
#pragma once
#endif
// MINI-version of BSPFILE.H to support DeathMatch Classic's entity lump extraction stuff.
#define BSPVERSION 30
typedef struct
{
int fileofs, filelen;
} lump_t;
#define LUMP_ENTITIES 0
#define LUMP_PLANES 1
#define LUMP_TEXTURES 2
#define LUMP_VERTEXES 3
#define LUMP_VISIBILITY 4
#define LUMP_NODES 5
#define LUMP_TEXINFO 6
#define LUMP_FACES 7
#define LUMP_LIGHTING 8
#define LUMP_CLIPNODES 9
#define LUMP_LEAFS 10
#define LUMP_MARKSURFACES 11
#define LUMP_EDGES 12
#define LUMP_SURFEDGES 13
#define LUMP_MODELS 14
#define HEADER_LUMPS 15
typedef struct
{
int version;
lump_t lumps[HEADER_LUMPS];
} dheader_t;
#endif // DMC_BSPFILE_H

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -17,22 +17,24 @@
#include "r_efx.h"
#include "event_api.h"
#include "pm_defs.h"
#include "pmtrace.h"
#include "pm_shared.h"
#include "pmtrace.h"
#include "in_defs.h"
#define DLLEXPORT __declspec( dllexport )
void Game_AddObjects( void );
void Game_UpdateObjects(double frametime);
extern vec3_t v_origin;
int g_iAlive = 1;
double g_iFrametime = 0;
extern "C"
{
int DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *modelname );
void DLLEXPORT HUD_CreateEntities( void );
void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity );
void DLLEXPORT HUD_TxferLocalOverrides( struct entity_state_s *state, const struct clientdata_s *client );
void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src );
void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd );
@ -59,16 +61,13 @@ int DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *mode
break;
}
// each frame every entity passes this function, so the overview hooks it to filter the overview entities
// in spectator mode:
// each frame every entity passes this function, so the overview hooks
// it to filter the overview entities
if ( g_iUser1 )
if (gEngfuncs.IsSpectateOnly())
{
gHUD.m_Spectator.AddOverviewEntity( type, ent, modelname );
if ( ( g_iUser1 == OBS_IN_EYE || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE ) &&
ent->index == g_iUser2 )
if ( ( gHUD.m_Spectator.m_iMainMode == MAIN_IN_EYE ||
gHUD.m_Spectator.m_iInsetMode == INSET_IN_EYE ) &&
ent->index == gHUD.m_Spectator.m_iObserverTarget )
return 0; // don't draw the player we are following in eye
}
@ -161,6 +160,11 @@ void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct
g_iUser1 = src->iuser1;
g_iUser2 = src->iuser2;
g_iUser3 = src->iuser3;
// if the movetype is NOCLIP, we are in observer mode.
if(src->movetype == MOVETYPE_NOCLIP)
{
}
}
}
@ -212,15 +216,11 @@ 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
pcd->iuser4 = ppcd->iuser4;
pcd->fuser2 = ppcd->fuser2;
pcd->fuser3 = ppcd->fuser3;
VectorCopy( ppcd->vuser1, pcd->vuser1 );
VectorCopy( ppcd->vuser2, pcd->vuser2 );
VectorCopy( ppcd->vuser3, pcd->vuser3 );
@ -230,82 +230,26 @@ void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct
}
/*
//#define TEST_IT
#if defined( TEST_IT )
cl_entity_t mymodel[9];
void MoveModel( void )
{
cl_entity_t *player;
int i, j;
int modelindex;
struct model_s *mod;
// Load it up with some bogus data
player = gEngfuncs.GetLocalPlayer();
if ( !player )
return;
mod = gEngfuncs.CL_LoadModel( "models/sentry3.mdl", &modelindex );
for ( i = 0; i < 3; i++ )
{
for ( j = 0; j < 3; j++ )
{
// Don't draw over ourself...
if ( ( i == 1 ) && ( j == 1 ) )
continue;
mymodel[ i * 3 + j ] = *player;
mymodel[ i * 3 + j ].player = 0;
mymodel[ i * 3 + j ].model = mod;
mymodel[ i * 3 + j ].curstate.modelindex = modelindex;
// Move it out a bit
mymodel[ i * 3 + j ].origin[0] = player->origin[0] + 50 * ( 1 - i );
mymodel[ i * 3 + j ].origin[1] = player->origin[1] + 50 * ( 1 - j );
gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &mymodel[i*3+j] );
}
}
}
#endif
//#define TRACE_TEST
#if defined( TRACE_TEST )
extern int hitent;
cl_entity_t hit;
void TraceModel( void )
{
cl_entity_t *ent;
if ( hitent <= 0 )
return;
// Load it up with some bogus data
ent = gEngfuncs.GetEntityByIndex( hitent );
if ( !ent )
return;
hit = *ent;
//hit.curstate.rendermode = kRenderTransTexture;
//hit.curstate.renderfx = kRenderFxGlowShell;
//hit.curstate.renderamt = 100;
hit.origin[2] += 40;
gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &hit );
}
#endif
=========================
HUD_CreateEntities
Gives us a chance to add additional entities to the render this frame
=========================
*/
void DLLEXPORT HUD_CreateEntities( void )
{
// e.g., create a persistent cl_entity_t somewhere.
// Load an appropriate model into it ( gEngfuncs.CL_LoadModel )
// Call gEngfuncs.CL_CreateVisibleEntity to add it to the visedicts list
// Add in any game specific objects
Game_AddObjects();
// Update any game specific objects
Game_UpdateObjects(g_iFrametime);
GetClientVoiceMgr()->CreateEntities();
}
/*
void ParticleCallback( struct particle_s *particle, float frametime )
@ -433,151 +377,6 @@ void TempEnts( void )
}
*/
#if defined( BEAM_TEST )
// Note can't index beam[ 0 ] in Beam callback, so don't use that index
// Room for 1 beam ( 0 can't be used )
static cl_entity_t beams[ 2 ];
void BeamEndModel( void )
{
cl_entity_t *player, *model;
int modelindex;
struct model_s *mod;
// Load it up with some bogus data
player = gEngfuncs.GetLocalPlayer();
if ( !player )
return;
mod = gEngfuncs.CL_LoadModel( "models/sentry3.mdl", &modelindex );
if ( !mod )
return;
// Slot 1
model = &beams[ 1 ];
*model = *player;
model->player = 0;
model->model = mod;
model->curstate.modelindex = modelindex;
// Move it out a bit
model->origin[0] = player->origin[0] - 100;
model->origin[1] = player->origin[1];
model->attachment[0] = model->origin;
model->attachment[1] = model->origin;
model->attachment[2] = model->origin;
model->attachment[3] = model->origin;
gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, model );
}
void Beams( void )
{
static float lasttime;
float curtime;
struct model_s *mod;
int index;
BeamEndModel();
curtime = gEngfuncs.GetClientTime();
float end[ 3 ];
if ( ( curtime - lasttime ) < 10.0 )
return;
mod = gEngfuncs.CL_LoadModel( "sprites/laserbeam.spr", &index );
if ( !mod )
return;
lasttime = curtime;
end [ 0 ] = v_origin.x + 100;
end [ 1 ] = v_origin.y + 100;
end [ 2 ] = v_origin.z;
BEAM *p1;
p1 = gEngfuncs.pEfxAPI->R_BeamEntPoint( -1, end, index,
10.0, 2.0, 0.3, 1.0, 5.0, 0.0, 1.0, 1.0, 1.0, 1.0 );
}
#endif
/*
=========================
HUD_CreateEntities
Gives us a chance to add additional entities to the render this frame
=========================
*/
void DLLEXPORT HUD_CreateEntities( void )
{
// e.g., create a persistent cl_entity_t somewhere.
// Load an appropriate model into it ( gEngfuncs.CL_LoadModel )
// Call gEngfuncs.CL_CreateVisibleEntity to add it to the visedicts list
/*
#if defined( TEST_IT )
MoveModel();
#endif
#if defined( TRACE_TEST )
TraceModel();
#endif
*/
/*
Particles();
*/
/*
TempEnts();
*/
#if defined( BEAM_TEST )
Beams();
#endif
// Add in any game specific objects
Game_AddObjects();
GetClientVoiceMgr()->CreateEntities();
}
/*
=========================
HUD_StudioEvent
The entity's studio model description indicated an event was
fired during this frame, handle the event by it's tag ( e.g., muzzleflash, sound )
=========================
*/
void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity )
{
switch( event->event )
{
case 5001:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[0], atoi( event->options) );
break;
case 5011:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[1], atoi( event->options) );
break;
case 5021:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[2], atoi( event->options) );
break;
case 5031:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[3], atoi( event->options) );
break;
case 5002:
gEngfuncs.pEfxAPI->R_SparkEffect( (float *)&entity->attachment[0], atoi( event->options), -100, 100 );
break;
// Client side sound
case 5004:
gEngfuncs.pfnPlaySoundByNameAtLocation( (char *)event->options, 1.0, (float *)&entity->attachment[0] );
break;
default:
break;
}
}
/*
=================
CL_UpdateTEnts
@ -599,6 +398,8 @@ void DLLEXPORT HUD_TempEntUpdate (
TEMPENTITY *pTemp, *pnext, *pprev;
float freq, gravity, gravitySlow, life, fastFreq;
g_iFrametime = frametime;
// Nothing to simulate
if ( !*ppTempEntActive )
return;
@ -730,7 +531,6 @@ void DLLEXPORT HUD_TempEntUpdate (
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (int)pTemp );
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;
}
else
{
for ( i = 0; i < 3; i++ )
@ -913,9 +713,13 @@ void DLLEXPORT HUD_TempEntUpdate (
}
if ( pTemp->flags & FTENT_GRAVITY )
{
pTemp->entity.baseline.origin[2] += gravity;
}
else if ( pTemp->flags & FTENT_SLOWGRAVITY )
{
pTemp->entity.baseline.origin[2] += gravitySlow;
}
if ( pTemp->flags & FTENT_CLIENTCUSTOM )
{
@ -959,19 +763,13 @@ Indices must start at 1, not zero.
*/
cl_entity_t DLLEXPORT *HUD_GetUserEntity( int index )
{
#if defined( BEAM_TEST )
// None by default, you would return a valic pointer if you create a client side
// beam and attach it to a client side entity.
if ( index > 0 && index <= 1 )
{
return &beams[ index ];
}
// Do we need this? - Gage
#if 0
if(index > 0 && index <= 1)
return &laser_beams[index];
else
{
return NULL;
}
#else
return NULL;
#endif
}

119
cl_dll/env_fog.cpp Normal file
View file

@ -0,0 +1,119 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
//
// env_fog.cpp -> env_fog's are client side entities useful in manipulating
// the fog code in HL for more useful purposes
//
#include "hud.h"
#include "cl_util.h"
#include "ParseBspEnt.h"
#include "ParseBsp.h"
#include "tri.h"
#include <vector>
using namespace std;
#define VectorLength(a) sqrt((double) ((double)((a)[0] * (a)[0]) + (double)( (a)[1] * (a)[1]) + (double)( (a)[2] * (a)[2])) )
enum bsp_fogstate_e {
FOGSTATE_OFF = 0,
FOGSTATE_ON,
FOGSTATE_MAPDEFAULT,
};
vector<CBspEnvFog> g_EnvFogList;
CBspEnvFog *g_pActiveEnvFog = NULL;
extern cvar_t *cl_enablefog;
/*
==============================
EnvFog_RenderFog
Return 0 to use worldspawn fog
==============================
*/
int EnvFog_RenderFog(CBspEnvFog *pActive)
{
if(pActive == NULL)
return 0;
if(pActive->iFogState == FOGSTATE_MAPDEFAULT)
return 0;
R_SetFog(pActive->flFogcolor_r,
pActive->flFogcolor_g,
pActive->flFogcolor_b,
pActive->flFog_start,
pActive->flFog_end,
(cl_enablefog->value && pActive->iFogState == FOGSTATE_ON) ? 1 : 0);
return 1;
}
/*
==============================
EnvFog_SetFog
==============================
*/
int EnvFog_SetFog()
{
// Find the nearest valid env_fog
for( int i = 0;i < g_EnvFogList.size();i++ )
{
CBspEnvFog *pCurNode = &g_EnvFogList[i];
vec3_t location = pCurNode->flOrigin;
int radius = pCurNode->iRadius;
double dist = VectorLength(location - gEngfuncs.GetLocalPlayer()->origin);
// The player is inside this env_fog,
// So compare against the current active
// env_fog to fight for priority
if(radius && dist <= radius)
{
if(g_pActiveEnvFog == NULL)
{
g_pActiveEnvFog = pCurNode;
return EnvFog_RenderFog(g_pActiveEnvFog);
}
else
{
vec3_t activeloc = g_pActiveEnvFog->flOrigin;
double activedist = VectorLength(activeloc - gEngfuncs.GetLocalPlayer()->origin);
// See if this env_fog is better than the current
// active fog entity.
if(activedist <= radius)
{
if(dist < activedist)
{
g_pActiveEnvFog = pCurNode;
return EnvFog_RenderFog(g_pActiveEnvFog);
}
}
else
{
g_pActiveEnvFog = pCurNode;
return EnvFog_RenderFog(g_pActiveEnvFog);
}
}
}
}
return EnvFog_RenderFog(g_pActiveEnvFog);
}

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -23,9 +23,7 @@
#include "eventscripts.h"
#include "event_api.h"
#include "pm_shared.h"
#define IS_FIRSTPERSON_SPEC ( g_iUser1 == OBS_IN_EYE || (g_iUser1 && (gHUD.m_Spectator.m_pip->value == INSET_IN_EYE)) )
/*
=================
GetEntity
@ -86,11 +84,7 @@ Is the entity == the local player
*/
qboolean EV_IsLocal( int idx )
{
// check if we are in some way in first person spec mode
if ( IS_FIRSTPERSON_SPEC )
return (g_iUser2 == idx);
else
return gEngfuncs.pEventAPI->EV_IsLocal( idx - 1 ) ? true : false;
return gEngfuncs.pEventAPI->EV_IsLocal( idx - 1 ) ? true : false;
}
/*
@ -112,8 +106,7 @@ void EV_GetGunPosition( event_args_t *args, float *pos, float *origin )
if ( EV_IsPlayer( idx ) )
{
// in spec mode use entity viewheigh, not own
if ( EV_IsLocal( idx ) && !IS_FIRSTPERSON_SPEC )
if ( EV_IsLocal( idx ) )
{
// Grab predicted result for local player
gEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs );
@ -139,7 +132,8 @@ void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, i
vec3_t endpos;
VectorClear( endpos );
endpos[1] = rotation;
gEngfuncs.pEfxAPI->R_TempModel( origin, velocity, endpos, 2.5, model, soundtype );
gEngfuncs.pEfxAPI->R_TempModel( origin, velocity, endpos, CVAR_GET_FLOAT("cl_shellcase_lifetime"), model, soundtype );
}
/*
@ -149,7 +143,7 @@ EV_GetDefaultShellInfo
Determine where to eject shells from
=================
*/
void EV_GetDefaultShellInfo( event_args_t *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale )
void EV_GetDefaultShellInfo( int iWeaponType, event_args_t *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale )
{
int i;
vec3_t view_ofs;
@ -162,7 +156,7 @@ void EV_GetDefaultShellInfo( event_args_t *args, float *origin, float *velocity,
VectorClear( view_ofs );
view_ofs[2] = DEFAULT_VIEWHEIGHT;
if ( EV_IsPlayer( idx ) )
if(EV_IsPlayer(idx))
{
if ( EV_IsLocal( idx ) )
{
@ -174,13 +168,38 @@ void EV_GetDefaultShellInfo( event_args_t *args, float *origin, float *velocity,
}
}
fR = gEngfuncs.pfnRandomFloat( 50, 70 );
fU = gEngfuncs.pfnRandomFloat( 100, 150 );
switch(iWeaponType)
{
case 2:
// Automatics dont have an "upward" ejection motion
fU = gEngfuncs.pfnRandomFloat( 5, 15 );
fR = gEngfuncs.pfnRandomFloat( 120, 140 );
break;
case 1:
default:
fR = gEngfuncs.pfnRandomFloat( 50, 70 );
fU = gEngfuncs.pfnRandomFloat( 100, 150 );
break;
}
for ( i = 0; i < 3; i++ )
{
ShellVelocity[i] = velocity[i] + right[i] * fR + up[i] * fU + forward[i] * 25;
ShellOrigin[i] = origin[i] + view_ofs[i] + up[i] * upScale + forward[i] * forwardScale + right[i] * rightScale;
switch(iWeaponType)
{
case 1:
// Aiming pistols if needed
if(!args->bparam2)
ShellOrigin[i] = origin[i] + view_ofs[i] + up[i] * upScale + forward[i] * forwardScale + right[i] * rightScale;
else
ShellOrigin[i] = origin[i] + view_ofs[i] + up[i] * upScale + forward[i] * forwardScale;
break;
default:
// Everything else
ShellOrigin[i] = origin[i] + view_ofs[i] + up[i] * upScale + forward[i] * forwardScale + right[i] * rightScale;
break;
}
}
}

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -32,11 +32,6 @@
#include <string.h>
#include "r_studioint.h"
#include "com_model.h"
extern engine_studio_api_t IEngineStudio;
static int tracerCount[ 32 ];
extern "C" char PM_FindTextureType( char *name );
@ -836,8 +831,6 @@ void EV_StopPreviousGauss( int idx )
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_WEAPON, "ambience/pulsemachine.wav" );
}
extern float g_flApplyVel;
void EV_FireGauss( event_args_t *args )
{
int idx;
@ -887,10 +880,6 @@ void EV_FireGauss( event_args_t *args )
{
V_PunchAxis( 0, -2.0 );
gEngfuncs.pEventAPI->EV_WeaponAnimation( GAUSS_FIRE2, 2 );
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 ) );
@ -1445,24 +1434,13 @@ void EV_EgonFire( event_args_t *args )
gEngfuncs.pEventAPI->EV_PopPMStates();
int iBeamModelIndex = gEngfuncs.pEventAPI->EV_FindModelIndex( EGON_BEAM_SPRITE );
float r = 50.0f;
float g = 50.0f;
float b = 125.0f;
if ( IEngineStudio.IsHardware() )
{
r /= 100.0f;
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 );
pBeam = gEngfuncs.pEfxAPI->R_BeamEntPoint ( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 3.5, 0.2, 0.075, 5, 0, 0.15, 5, 5, 25.5 );
if ( pBeam )
pBeam->flags |= ( FBEAM_SINENOISE );
pBeam->flags |= FBEAM_SINENOISE;
pBeam2 = gEngfuncs.pEfxAPI->R_BeamEntPoint ( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 5.0, 0.08, 0.7, 25, 0, 0, r, g, b );
pBeam2 = gEngfuncs.pEfxAPI->R_BeamEntPoint ( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 5.0, 0.08, 0.1, 2.5, 0, 0.15, 5, 5, 25.5 );
}
}
}

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

2252
cl_dll/ev_thewastes.cpp Normal file

File diff suppressed because it is too large Load diff

39
cl_dll/ev_thewastes.h Normal file
View file

@ -0,0 +1,39 @@
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined ( EV_HLDMH )
#define EV_HLDMH
// bullet types
typedef enum
{
BULLET_NONE = 0,
// Wasteland Bullet Types
BULLET_9MMP,
BULLET_10MM,
BULLET_50AE,
BULLET_454CASULL,
BULLET_556MM,
BULLET_20GAUGE,
BULLET_10GAUGE,
BULLET_12GAUGE,
BULLET_SLUG,
BULLET_9MM,
BULLET_762MM,
BULLET_45ACP,
BULLET_47MM,
} Bullet;
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 );
//BLONDE - Bulletsmoke is for weapon effects and texture specific bulletholes
float EV_HLDM_BulletSmoke ( int idx, pmtrace_t *ptr, float *vecSrc, float *vecEnd, int iBulletType, int glowy );
//&BLONDE
#endif // EV_HLDMH

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -48,20 +48,18 @@
#define DMG_MORTAR (1 << 23) // Hit by air raid (done to distinguish grenade from mortar)
//TF ADDITIONS
#define DMG_IGNITE (1 << 24) // Players hit by this begin to burn
/*#define DMG_IGNITE (1 << 24) // Players hit by this begin to burn
#define DMG_RADIUS_MAX (1 << 25) // Radius damage with this flag doesn't decrease over distance
#define DMG_RADIUS_QUAKE (1 << 26) // Radius damage is done like Quake. 1/2 damage at 1/2 radius.
#define DMG_IGNOREARMOR (1 << 27) // Damage ignores target's armor
#define DMG_AIMED (1 << 28) // Does Hit location damage
#define DMG_WALLPIERCING (1 << 29) // Blast Damages ents through walls
#define DMG_CALTROP (1<<30)
#define DMG_HALLUC (1<<31)
*/
// Some of these are HL/TFC specific?
void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, int soundtype );
void EV_GetGunPosition( struct event_args_s *args, float *pos, float *origin );
void EV_GetDefaultShellInfo( struct event_args_s *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale );
void EV_GetDefaultShellInfo( int iWeaponType,struct event_args_s *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale );
qboolean EV_IsLocal( int idx );
qboolean EV_IsPlayer( int idx );
void EV_CreateTracer( float *start, float *end );

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -25,8 +25,6 @@
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE(m_Flash, FlashBat)
DECLARE_MESSAGE(m_Flash, Flashlight)
@ -102,9 +100,6 @@ int CHudFlashlight::Draw(float flTime)
int r, g, b, x, y, a;
wrect_t rc;
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return 1;
if (m_fOn)
a = 225;
else
@ -113,7 +108,7 @@ int CHudFlashlight::Draw(float flTime)
if (m_flBat < 0.20)
UnpackRGB(r,g,b, RGB_REDISH);
else
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
ScaleColors(r, g, b, a);

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -27,7 +27,6 @@
#include "parsemsg.h"
#include <string.h>
DECLARE_MESSAGE(m_Health, Health )
DECLARE_MESSAGE(m_Health, Damage )
@ -46,19 +45,18 @@ int giDmgFlags[NUM_DMG_TYPES] =
DMG_NERVEGAS,
DMG_RADIATION,
DMG_SHOCK,
DMG_CALTROP,
DMG_TRANQ,
DMG_CONCUSS,
DMG_HALLUC
};
int CHudHealth::Init(void)
{
HOOK_MESSAGE(Health);
HOOK_MESSAGE(Damage);
m_iHealth = 100;
m_fFade = 0;
m_iFlags = 0;
m_iFlags = HUD_ACTIVE;
m_iHealth = m_iOldHealth = 100;
m_bitsDamage = 0;
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
giDmgHeight = 0;
@ -66,7 +64,6 @@ int CHudHealth::Init(void)
memset(m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES);
gHUD.AddHudElem(this);
return 1;
}
@ -76,7 +73,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++ )
@ -87,35 +83,29 @@ void CHudHealth::Reset( void )
int CHudHealth::VidInit(void)
{
m_hSprite = 0;
m_hDamageSprite = 0;
m_HUD_dmg_bio = gHUD.GetSpriteIndex( "dmg_bio" ) + 1;
m_HUD_cross = gHUD.GetSpriteIndex( "cross" );
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;
m_HUD_healthbar = gHUD.GetSpriteIndex("healthbar");
m_HUD_healthbg = gHUD.GetSpriteIndex("healthbg");
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;
}
int CHudHealth:: MsgFunc_Health(const char *pszName, int iSize, void *pbuf )
{
// TODO: update local health data
BEGIN_READ( pbuf, iSize );
int x = READ_BYTE();
m_iFlags |= HUD_ACTIVE;
// Only update the fade if we've changed health
if (x != m_iHealth)
{
m_fFade = FADE_TIME;
m_iHealth = x;
}
m_iHealth = x;
return 1;
}
int CHudHealth:: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -133,12 +123,13 @@ int CHudHealth:: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
// Actually took damage?
if ( damageTaken > 0 || armor > 0 )
{
CalcDamageDirection(vecFrom);
}
return 1;
}
// Returns back a color from the
// Green <-> Yellow <-> Red ramp
void CHudHealth::GetPainColor( int &r, int &g, int &b )
@ -156,7 +147,7 @@ void CHudHealth::GetPainColor( int &r, int &g, int &b )
#else
if (m_iHealth > 25)
{
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
}
else
{
@ -169,66 +160,83 @@ void CHudHealth::GetPainColor( int &r, int &g, int &b )
int CHudHealth::Draw(float flTime)
{
int r, g, b;
int a = 0, x, y;
int HealthWidth;
if ( (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) || gEngfuncs.IsSpectateOnly() )
if(gHUD.m_iHideHUDDisplay & (HIDEHUD_ALL|HIDEHUD_HEALTH))
return 1;
if ( !m_hSprite )
m_hSprite = LoadSprite(PAIN_NAME);
// Has health changed? Flash the health #
if (m_fFade)
int x,y,r,g,b,a;
wrect_t *prc;
// Draw background
a = 255;
UnpackRGB(r,g,b,RGB_WHITE);
ScaleColors(r,g,b,a);
prc = &gHUD.GetSpriteRect(m_HUD_healthbg);
x = (ScreenWidth / 2) - (prc->right - prc->left) / 2;
y = ScreenHeight - (prc->bottom - prc->top);
SPR_Set(gHUD.GetSprite(m_HUD_healthbg),r,g,b);
SPR_DrawHoles(0,x,y,prc);
if(gHUD.m_PlayerState.ActiveState() == PS_BLEEDING && gHUD.m_Health.m_iHealth > 0 && gHUD.m_Health.m_iHealth < 100)
UnpackRGB(r,g,b,RGB_REDISH);
else
UnpackRGB(r,g,b,RGB_GREENISH);
ScaleColors(r,g,b,a);
// Center of health bar
x += (prc->right - prc->left) / 2;
y += (prc->bottom - prc->top) / 2;
prc = &gHUD.GetSpriteRect(m_HUD_healthbar);
// Get new coordinates
x -= (prc->right - prc->left) / 2;
y -= (prc->bottom - prc->top) / 2;
int iHealthWidth = (prc->right - prc->left) * m_iHealth / 100;
// Draw old health
if(m_iOldHealth > m_iHealth)
{
m_fFade -= (gHUD.m_flTimeDelta * 20);
if (m_fFade <= 0)
{
a = MIN_ALPHA;
m_fFade = 0;
}
int or,og,ob,oa;
int iScissorX,iScissorWidth;
// Fade the health number back to dim
oa = 225;
a = MIN_ALPHA + (m_fFade/FADE_TIME) * 128;
UnpackRGB(or,og,ob,RGB_YELLOWISH);
ScaleColors(or,og,ob,oa);
iScissorX = x + iHealthWidth;
iScissorWidth = ((prc->right-prc->left) * m_iOldHealth / 100) - iHealthWidth;
SPR_EnableScissor(iScissorX,0,iScissorWidth,ScreenHeight);
SPR_Set(gHUD.GetSprite(m_HUD_healthbar),or,og,ob);
SPR_DrawAdditive(0,x,y,prc);
SPR_DisableScissor();
// Reduce old health value
m_iOldHealth -= gHUD.m_flTimeDelta * 1.5;
}
else
a = MIN_ALPHA;
m_iOldHealth = m_iHealth;
// If health is getting low, make it bright red
if (m_iHealth <= 15)
a = 255;
GetPainColor( r, g, b );
ScaleColors(r, g, b, a );
// Draw current health
SPR_EnableScissor(x,0,iHealthWidth,ScreenHeight);
// Only draw health if we have the suit.
if (gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)))
{
HealthWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left;
int CrossWidth = gHUD.GetSpriteRect(m_HUD_cross).right - gHUD.GetSpriteRect(m_HUD_cross).left;
SPR_Set(gHUD.GetSprite(m_HUD_healthbar),r,g,b);
SPR_DrawAdditive(0,x,y,prc);
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
x = CrossWidth /2;
SPR_Set(gHUD.GetSprite(m_HUD_cross), r, g, b);
SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_cross));
x = CrossWidth + HealthWidth / 2;
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b);
x += HealthWidth/2;
int iHeight = gHUD.m_iFontHeight;
int iWidth = HealthWidth/10;
FillRGBA(x, y, iWidth, iHeight, 255, 160, 0, a);
}
SPR_DisableScissor();
DrawDamage(flTime);
return DrawPain(flTime);
// return DrawPain(flTime);
return 1;
}
void CHudHealth::CalcDamageDirection(vec3_t vecFrom)
@ -243,11 +251,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();
@ -309,10 +315,10 @@ int CHudHealth::DrawPain(float flTime)
GetPainColor(r,g,b);
shade = a * max( m_fAttackFront, 0.5 );
ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b );
SPR_Set(m_hDamageSprite, r, g, b );
x = ScreenWidth/2 - SPR_Width(m_hSprite, 0)/2;
y = ScreenHeight/2 - SPR_Height(m_hSprite,0) * 3;
x = ScreenWidth/2 - SPR_Width(m_hDamageSprite, 0)/2;
y = ScreenHeight/2 - SPR_Height(m_hDamageSprite,0) * 3;
SPR_DrawAdditive(0, x, y, NULL);
m_fAttackFront = max( 0, m_fAttackFront - fFade );
} else
@ -323,10 +329,10 @@ int CHudHealth::DrawPain(float flTime)
GetPainColor(r,g,b);
shade = a * max( m_fAttackRight, 0.5 );
ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b );
SPR_Set(m_hDamageSprite, r, g, b );
x = ScreenWidth/2 + SPR_Width(m_hSprite, 1) * 2;
y = ScreenHeight/2 - SPR_Height(m_hSprite,1)/2;
x = ScreenWidth/2 + SPR_Width(m_hDamageSprite, 1) * 2;
y = ScreenHeight/2 - SPR_Height(m_hDamageSprite,1)/2;
SPR_DrawAdditive(1, x, y, NULL);
m_fAttackRight = max( 0, m_fAttackRight - fFade );
} else
@ -337,10 +343,10 @@ int CHudHealth::DrawPain(float flTime)
GetPainColor(r,g,b);
shade = a * max( m_fAttackRear, 0.5 );
ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b );
SPR_Set(m_hDamageSprite, r, g, b );
x = ScreenWidth/2 - SPR_Width(m_hSprite, 2)/2;
y = ScreenHeight/2 + SPR_Height(m_hSprite,2) * 2;
x = ScreenWidth/2 - SPR_Width(m_hDamageSprite, 2)/2;
y = ScreenHeight/2 + SPR_Height(m_hDamageSprite,2) * 2;
SPR_DrawAdditive(2, x, y, NULL);
m_fAttackRear = max( 0, m_fAttackRear - fFade );
} else
@ -351,10 +357,10 @@ int CHudHealth::DrawPain(float flTime)
GetPainColor(r,g,b);
shade = a * max( m_fAttackLeft, 0.5 );
ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b );
SPR_Set(m_hDamageSprite, r, g, b );
x = ScreenWidth/2 - SPR_Width(m_hSprite, 3) * 3;
y = ScreenHeight/2 - SPR_Height(m_hSprite,3)/2;
x = ScreenWidth/2 - SPR_Width(m_hDamageSprite, 3) * 3;
y = ScreenHeight/2 - SPR_Height(m_hDamageSprite,3)/2;
SPR_DrawAdditive(3, x, y, NULL);
m_fAttackLeft = max( 0, m_fAttackLeft - fFade );
@ -372,7 +378,7 @@ int CHudHealth::DrawDamage(float flTime)
if (!m_bitsDamage)
return 1;
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
a = (int)( fabs(sin(flTime*2)) * 256.0);
@ -389,7 +395,6 @@ int CHudHealth::DrawDamage(float flTime)
}
}
// check for bits that should be expired
for ( i = 0; i < NUM_DMG_TYPES; i++ )
{
@ -424,7 +429,6 @@ int CHudHealth::DrawDamage(float flTime)
return 1;
}
void CHudHealth::UpdateTiles(float flTime, long bitsDamage)
{
DAMAGE_IMAGE *pdmg;
@ -448,7 +452,7 @@ void CHudHealth::UpdateTiles(float flTime, long bitsDamage)
if (bitsOn & giDmgFlags[i])
{
// put this one at the bottom
pdmg->x = giDmgWidth/8;
pdmg->x = giDmgWidth/8 + ScreenWidth/4;
pdmg->y = ScreenHeight - giDmgHeight * 2;
pdmg->fExpire=flTime + DMG_IMAGE_LIFE;

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -46,7 +46,6 @@
#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
@ -73,21 +72,15 @@
#define DMG_AIMED (1 << 28) // Does Hit location damage
#define DMG_WALLPIERCING (1 << 29) // Blast Damages ents through walls
#define DMG_CALTROP (1<<30)
#define DMG_HALLUC (1<<31)
// 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;
@ -105,21 +98,27 @@ public:
virtual int VidInit( void );
virtual int Draw(float fTime);
virtual void Reset( void );
int MsgFunc_Health(const char *pszName, int iSize, void *pbuf);
int MsgFunc_Damage(const char *pszName, int iSize, void *pbuf);
int m_iHealth;
int m_HUD_dmg_bio;
int m_HUD_cross;
float m_fAttackFront, m_fAttackRear, m_fAttackLeft, m_fAttackRight;
void GetPainColor( int &r, int &g, int &b );
float m_fFade;
// Made public so other parts of the HUD can read it
int m_iHealth;
private:
HSPRITE m_hSprite;
HSPRITE m_hDamage;
int m_HUD_dmg_bio;
int m_HUD_healthbar;
int m_HUD_healthbg;
DAMAGE_IMAGE m_dmg[NUM_DMG_TYPES];
int m_bitsDamage;
HSPRITE m_hDamageSprite;
float m_fAttackFront, m_fAttackRear, m_fAttackLeft, m_fAttackRight;
int m_iOldHealth;
// Support functions
void GetPainColor( int &r, int &g, int &b );
int DrawPain(float fTime);
int DrawDamage(float fTime);
void CalcDamageDirection(vec3_t vecFrom);

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -110,78 +110,22 @@ 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; }
void CBaseMonster :: BarnacleVictimBitten ( entvars_t *pevBarnacle ) { }
void CBaseMonster :: BarnacleVictimReleased ( void ) { }
void CBaseMonster :: Listen ( void ) { }
float CBaseMonster :: FLSoundVolume ( CSound *pSound ) { return 0.0; }
BOOL CBaseMonster :: FValidateHintType ( short sHint ) { return FALSE; }
void CBaseMonster :: Look ( int iDistance ) { }
int CBaseMonster :: ISoundMask ( void ) { return 0; }
CSound* CBaseMonster :: PBestSound ( void ) { return NULL; }
CSound* CBaseMonster :: PBestScent ( void ) { return NULL; }
float CBaseAnimating :: StudioFrameAdvance ( float flInterval ) { return 0.0; }
void CBaseMonster :: MonsterThink ( void ) { }
void CBaseMonster :: MonsterUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { }
int CBaseMonster :: IgnoreConditions ( void ) { return 0; }
void CBaseMonster :: RouteClear ( void ) { }
void CBaseMonster :: RouteNew ( void ) { }
BOOL CBaseMonster :: FRouteClear ( void ) { return FALSE; }
BOOL CBaseMonster :: FRefreshRoute ( void ) { return 0; }
BOOL CBaseMonster::MoveToEnemy( Activity movementAct, float waitTime ) { return FALSE; }
BOOL CBaseMonster::MoveToLocation( Activity movementAct, float waitTime, const Vector &goal ) { return FALSE; }
BOOL CBaseMonster::MoveToTarget( Activity movementAct, float waitTime ) { return FALSE; }
BOOL CBaseMonster::MoveToNode( Activity movementAct, float waitTime, const Vector &goal ) { return FALSE; }
int ShouldSimplify( int routeType ) { return TRUE; }
void CBaseMonster :: RouteSimplify( CBaseEntity *pTargetEnt ) { }
BOOL CBaseMonster :: FBecomeProne ( void ) { return TRUE; }
BOOL CBaseMonster :: CheckRangeAttack1 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckRangeAttack2 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckMeleeAttack1 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckMeleeAttack2 ( float flDot, float flDist ) { return FALSE; }
void CBaseMonster :: CheckAttacks ( CBaseEntity *pTarget, float flDist ) { }
BOOL CBaseMonster :: FCanCheckAttacks ( void ) { return FALSE; }
int CBaseMonster :: CheckEnemy ( CBaseEntity *pEnemy ) { return 0; }
void CBaseMonster :: PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos ) { }
BOOL CBaseMonster :: PopEnemy( ) { return FALSE; }
void CBaseMonster :: SetActivity ( Activity NewActivity ) { }
void CBaseMonster :: SetSequenceByName ( char *szSequence ) { }
int CBaseMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist ) { return 0; }
float CBaseMonster :: OpenDoorAndWait( entvars_t *pevDoor ) { return 0.0; }
void CBaseMonster :: AdvanceRoute ( float distance ) { }
int CBaseMonster :: RouteClassify( int iMoveFlag ) { return 0; }
BOOL CBaseMonster :: BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEntity *pTarget ) { return FALSE; }
void CBaseMonster :: InsertWaypoint ( Vector vecLocation, int afMoveFlags ) { }
BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEnd, float flDist, CBaseEntity *pTargetEnt, Vector *pApex ) { return FALSE; }
void CBaseMonster :: Move ( float flInterval ) { }
BOOL CBaseMonster:: ShouldAdvanceRoute( float flWaypointDist ) { return FALSE; }
void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flInterval ) { }
void CBaseMonster :: MonsterInit ( void ) { }
void CBaseMonster :: MonsterInitThink ( void ) { }
void CBaseMonster :: StartMonster ( void ) { }
void CBaseMonster :: MovementComplete( void ) { }
int CBaseMonster::TaskIsRunning( void ) { return 0; }
int CBaseMonster::IRelationship ( CBaseEntity *pTarget ) { return 0; }
BOOL CBaseMonster :: FindCover ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; }
BOOL CBaseMonster :: BuildNearestRoute ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; }
CBaseEntity *CBaseMonster :: BestVisibleEnemy ( void ) { return NULL; }
BOOL CBaseMonster :: FInViewCone ( CBaseEntity *pEntity ) { return FALSE; }
BOOL CBaseMonster :: FInViewCone ( Vector *pOrigin ) { return FALSE; }
BOOL CBaseEntity :: FVisible ( CBaseEntity *pEntity ) { return FALSE; }
BOOL CBaseEntity :: FVisible ( const Vector &vecOrigin ) { return FALSE; }
void CBaseMonster :: MakeIdealYaw( Vector vecTarget ) { }
float CBaseMonster::FlYawDiff ( void ) { return 0.0; }
float CBaseMonster::ChangeYaw ( int yawSpeed ) { return 0; }
float CBaseMonster::VecToYaw ( Vector vecDir ) { return 0.0; }
int CBaseAnimating :: LookupActivity ( int activity ) { return 0; }
int CBaseAnimating :: LookupActivityHeaviest ( int activity ) { return 0; }
void CBaseMonster :: SetEyePosition ( void ) { }
int CBaseAnimating :: LookupSequence ( const char *label ) { return 0; }
void CBaseAnimating :: ResetSequenceInfo ( ) { }
BOOL CBaseAnimating :: GetSequenceFlags( ) { return FALSE; }
void CBaseAnimating :: DispatchAnimEvents ( float flInterval ) { }
void CBaseMonster :: HandleAnimEvent( MonsterEvent_t *pEvent ) { }
float CBaseAnimating :: SetBoneController ( int iController, float flValue ) { return 0.0; }
void CBaseAnimating :: InitBoneControllers ( void ) { }
float CBaseAnimating :: SetBlending ( int iBlender, float flValue ) { return 0; }
@ -191,30 +135,16 @@ int CBaseAnimating :: FindTransition( int iEndingSequence, int iGoalSequence, in
void CBaseAnimating :: GetAutomovement( Vector &origin, Vector &angles, float flInterval ) { }
void CBaseAnimating :: SetBodygroup( int iGroup, int iValue ) { }
int CBaseAnimating :: GetBodygroup( int iGroup ) { return 0; }
Vector CBaseMonster :: GetGunPosition( void ) { return g_vecZero; }
void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker ) { }
void CBaseEntity :: TraceBleed( float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ) { }
void CBaseMonster :: MakeDamageBloodDecal ( int cCount, float flNoise, TraceResult *ptr, const Vector &vecDir ) { }
BOOL CBaseMonster :: FGetNodeRoute ( Vector vecDest ) { return TRUE; }
int CBaseMonster :: FindHintNode ( void ) { return NO_NODE; }
void CBaseMonster::ReportAIState( void ) { }
void CBaseMonster :: KeyValue( KeyValueData *pkvd ) { }
BOOL CBaseMonster :: FCheckAITrigger ( void ) { return FALSE; }
int CBaseMonster :: CanPlaySequence( BOOL fDisregardMonsterState, int interruptLevel ) { return FALSE; }
BOOL CBaseMonster :: FindLateralCover ( const Vector &vecThreat, const Vector &vecViewOffset ) { return FALSE; }
Vector CBaseMonster :: ShootAtEnemy( const Vector &shootOrigin ) { return g_vecZero; }
BOOL CBaseMonster :: FacingIdeal( void ) { return FALSE; }
BOOL CBaseMonster :: FCanActiveIdle ( void ) { return FALSE; }
void CBaseMonster::PlaySentence( const char *pszSentence, float duration, float volume, float attenuation ) { }
void CBaseMonster::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener ) { }
void CBaseMonster::SentenceStop( void ) { }
void CBaseMonster::CorpseFallThink( void ) { }
void CBaseMonster :: MonsterInitDead( void ) { }
BOOL CBaseMonster :: BBoxFlat ( void ) { return TRUE; }
BOOL CBaseMonster :: GetEnemy ( void ) { return FALSE; }
void CBaseMonster :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
CBaseEntity* CBaseMonster :: DropItem ( char *pszItemName, const Vector &vecPos, const Vector &vecAng ) { return NULL; }
BOOL CBaseMonster :: ShouldFadeOnDeath( void ) { return FALSE; }
void CBaseMonster :: RadiusDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
void CBaseMonster :: RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
@ -223,26 +153,16 @@ void CBaseMonster :: GibMonster( void ) { }
BOOL CBaseMonster :: HasHumanGibs( void ) { return FALSE; }
BOOL CBaseMonster :: HasAlienGibs( void ) { return FALSE; }
Activity CBaseMonster :: GetDeathActivity ( void ) { return ACT_DIE_HEADSHOT; }
MONSTERSTATE CBaseMonster :: GetIdealState ( void ) { return MONSTERSTATE_ALERT; }
Schedule_t* CBaseMonster :: GetScheduleOfType ( int Type ) { return NULL; }
Schedule_t *CBaseMonster :: GetSchedule ( void ) { return NULL; }
void CBaseMonster :: RunTask ( Task_t *pTask ) { }
void CBaseMonster :: StartTask ( Task_t *pTask ) { }
Schedule_t *CBaseMonster::ScheduleFromName( const char *pName ) { return NULL;}
void CBaseMonster::BecomeDead( void ) {}
void CBaseMonster :: RunAI ( void ) {}
void CBaseMonster :: Killed( entvars_t *pevAttacker, int iGib ) {}
int CBaseMonster :: TakeHealth (float flHealth, int bitsDamageType) { return 0; }
int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
int CBaseMonster::Restore( class CRestore & ) { return 1; }
int CBaseMonster::Save( class CSave & ) { return 1; }
int TrainSpeed(int iSpeed, int iMax) { return 0; }
void CBasePlayer :: DeathSound( void ) { }
int CBasePlayer :: TakeHealth( float flHealth, int bitsDamageType ) { return 0; }
void CBasePlayer :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
int CBasePlayer :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
void CBasePlayer::PackDeadPlayerItems( void ) { }
void CBasePlayer::RemoveAllItems( BOOL removeSuit ) { }
void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim ) { }
void CBasePlayer::WaterMove() { }

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -32,7 +32,6 @@
#include "../demo.h"
extern globalvars_t *gpGlobals;
extern int g_iUser1;
// Pool of client side entities/entvars_t
static entvars_t ev[ 32 ];
@ -46,9 +45,6 @@ static globalvars_t Globals;
static CBasePlayerWeapon *g_pWpns[ 32 ];
float g_flApplyVel = 0.0;
int g_irunninggausspred = 0;
vec3_t previousorigin;
// HLDM Weapon placeholder entities.
@ -217,7 +213,6 @@ BOOL CBasePlayerWeapon :: DefaultDeploy( char *szViewModel, char *szWeaponModel,
SendWeaponAnim( iAnim, skiplocal, body );
g_irunninggausspred = false;
m_pPlayer->m_flNextAttack = 0.5;
m_flTimeWeaponIdle = 1.0;
return TRUE;
@ -261,7 +256,6 @@ Put away weapon
void CBasePlayerWeapon::Holster( int skiplocal /* = 0 */ )
{
m_fInReload = FALSE; // cancel any reload in progress.
g_irunninggausspred = false;
m_pPlayer->pev->viewmodel = 0;
}
@ -458,8 +452,6 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )
// Holster weapon immediately, to allow it to cleanup
if ( m_pActiveItem )
m_pActiveItem->Holster( );
g_irunninggausspred = false;
}
/*
@ -472,8 +464,6 @@ void CBasePlayer::Spawn( void )
{
if (m_pActiveItem)
m_pActiveItem->Deploy( );
g_irunninggausspred = false;
}
/*
@ -869,8 +859,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
// Don't go firing anything if we have died.
// Or if we don't have a weapon model deployed
if ( ( player.pev->deadflag != ( DEAD_DISCARDBODY + 1 ) ) &&
!CL_IsDead() && player.pev->viewmodel && !g_iUser1 )
if ( ( player.pev->deadflag != ( DEAD_DISCARDBODY + 1 ) ) && !CL_IsDead() && player.pev->viewmodel )
{
if ( player.m_flNextAttack <= 0 )
{
@ -1056,6 +1045,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
g_finalstate = NULL;
}
/*
=====================
HUD_PostRunCmd
@ -1082,14 +1072,6 @@ void _DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s
to->client.fov = g_lastFOV;
}
if ( g_irunninggausspred == 1 )
{
Vector forward;
gEngfuncs.pfnAngleVectors( v_angles, forward, NULL, NULL );
to->client.velocity = to->client.velocity - forward * g_flApplyVel * 5;
g_irunninggausspred = false;
}
// All games can use FOV state
g_lastFOV = to->client.fov;
}

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -25,13 +25,16 @@
#include "parsemsg.h"
#include "hud_servers.h"
#include "vgui_int.h"
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#include "demo.h"
#include "demo_api.h"
#include "tw_vgui.h"
#include "vgui_scorepanel.h"
#include "tw_common.h"
extern int g_iClientLasersEnabled[32];
class CHLVoiceStatusHelper : public IVoiceStatusHelper
{
@ -85,12 +88,6 @@ cvar_t *cl_lw = NULL;
void ShutdownInput (void);
//DECLARE_MESSAGE(m_Logo, Logo)
int __MsgFunc_Logo(const char *pszName, int iSize, void *pbuf)
{
return gHUD.MsgFunc_Logo(pszName, iSize, pbuf );
}
//DECLARE_MESSAGE(m_Logo, Logo)
int __MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf)
{
@ -103,12 +100,6 @@ int __MsgFunc_InitHUD(const char *pszName, int iSize, void *pbuf)
return 1;
}
int __MsgFunc_ViewMode(const char *pszName, int iSize, void *pbuf)
{
gHUD.MsgFunc_ViewMode( pszName, iSize, pbuf );
return 1;
}
int __MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
{
return gHUD.MsgFunc_SetFOV( pszName, iSize, pbuf );
@ -124,21 +115,24 @@ int __MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf )
return gHUD.MsgFunc_GameMode( pszName, iSize, pbuf );
}
int __MsgFunc_LaserInfo(const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
int index = READ_BYTE();
int setting = READ_BYTE();
g_iClientLasersEnabled[index] = setting;
return 1;
}
// TFFree Command Menu
void __CmdFunc_OpenCommandMenu(void)
{
if ( gViewPort )
{
gViewPort->ShowCommandMenu( gViewPort->m_StandardMenu );
}
}
// TFC "special" command
void __CmdFunc_InputPlayerSpecial(void)
{
if ( gViewPort )
{
gViewPort->InputPlayerSpecial();
gViewPort->ShowCommandMenu();
}
}
@ -158,6 +152,14 @@ void __CmdFunc_ForceCloseCommandMenu( void )
}
}
void __CmdFunc_OpenItemSelectionMenu( void )
{
if( gViewPort )
{
gViewPort->ShowVGUIMenu(MENU_ITEMSELECTION);
}
}
void __CmdFunc_ToggleServerBrowser( void )
{
if ( gViewPort )
@ -181,20 +183,6 @@ int __MsgFunc_TeamNames(const char *pszName, int iSize, void *pbuf)
return 0;
}
int __MsgFunc_Feign(const char *pszName, int iSize, void *pbuf)
{
if (gViewPort)
return gViewPort->MsgFunc_Feign( pszName, iSize, pbuf );
return 0;
}
int __MsgFunc_Detpack(const char *pszName, int iSize, void *pbuf)
{
if (gViewPort)
return gViewPort->MsgFunc_Detpack( pszName, iSize, pbuf );
return 0;
}
int __MsgFunc_VGUIMenu(const char *pszName, int iSize, void *pbuf)
{
if (gViewPort)
@ -209,6 +197,13 @@ int __MsgFunc_MOTD(const char *pszName, int iSize, void *pbuf)
return 0;
}
int __MsgFunc_Briefing(const char *pszName,int iSize,void *pbuf)
{
if(gViewPort)
return gViewPort->MsgFunc_Briefing(pszName,iSize,pbuf);
return 0;
}
int __MsgFunc_BuildSt(const char *pszName, int iSize, void *pbuf)
{
if (gViewPort)
@ -264,30 +259,34 @@ int __MsgFunc_AllowSpec(const char *pszName, int iSize, void *pbuf)
return gViewPort->MsgFunc_AllowSpec( pszName, iSize, pbuf );
return 0;
}
int __MsgFunc_LmsStart( const char *pszName, int iSize, void *pbuf )
{
if( gViewPort )
return gViewPort->MsgFunc_LmsStart( pszName, iSize, pbuf );
return 0;
}
// This is called every time the DLL is loaded
void CHud :: Init( void )
{
HOOK_MESSAGE( Logo );
HOOK_MESSAGE( ResetHUD );
HOOK_MESSAGE( GameMode );
HOOK_MESSAGE( InitHUD );
HOOK_MESSAGE( ViewMode );
HOOK_MESSAGE( SetFOV );
HOOK_MESSAGE( Concuss );
// TFFree CommandMenu
HOOK_COMMAND( "+commandmenu", OpenCommandMenu );
HOOK_COMMAND( "-commandmenu", CloseCommandMenu );
HOOK_COMMAND( "itemmenu", OpenItemSelectionMenu );
HOOK_COMMAND( "ForceCloseCommandMenu", ForceCloseCommandMenu );
HOOK_COMMAND( "special", InputPlayerSpecial );
HOOK_COMMAND( "togglebrowser", ToggleServerBrowser );
HOOK_MESSAGE( ValClass );
HOOK_MESSAGE( TeamNames );
HOOK_MESSAGE( Feign );
HOOK_MESSAGE( Detpack );
HOOK_MESSAGE( MOTD );
HOOK_MESSAGE( Briefing );
HOOK_MESSAGE( BuildSt );
HOOK_MESSAGE( RandomPC );
HOOK_MESSAGE( ServerName );
@ -297,6 +296,7 @@ void CHud :: Init( void )
HOOK_MESSAGE( Spectator );
HOOK_MESSAGE( AllowSpec );
HOOK_MESSAGE( LmsStart );
// VGUI Menus
HOOK_MESSAGE( VGUIMenu );
@ -304,14 +304,12 @@ void CHud :: Init( void )
CVAR_CREATE( "hud_classautokill", "1", FCVAR_ARCHIVE | FCVAR_USERINFO ); // controls whether or not to suicide immediately on TF class switch
CVAR_CREATE( "hud_takesshots", "0", FCVAR_ARCHIVE ); // controls whether or not to automatically take screenshots at the end of a round
m_iLogo = 0;
m_iFOV = 0;
CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", 0 );
default_fov = CVAR_CREATE( "default_fov", "90", 0 );
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
m_pSpriteList = NULL;
@ -332,22 +330,25 @@ void CHud :: Init( void )
// In case we get messages before the first update -- time will be valid
m_flTime = 1.0;
m_Ammo.Init();
m_Scanlines.Init();
m_Health.Init();
m_SayText.Init();
m_Spectator.Init();
m_Geiger.Init();
m_Train.Init();
m_Battery.Init();
m_Flash.Init();
m_Message.Init();
m_StatusBar.Init();
m_DeathNotice.Init();
m_Scope.Init();
m_Ammo.Init();
m_AmmoSecondary.Init();
m_TextMessage.Init();
m_StatusIcons.Init();
GetClientVoiceMgr()->Init(&g_VoiceStatusHelper, (vgui::Panel**)&gViewPort);
m_Spectator.Init();
m_CrosshairInfo.Init();
m_PlayerState.Init();
m_SayText.Init();
m_Menu.Init();
ServersInit();
@ -481,10 +482,9 @@ void CHud :: VidInit( void )
m_Ammo.VidInit();
m_Health.VidInit();
m_Spectator.VidInit();
m_Scanlines.VidInit();
m_Geiger.VidInit();
m_Train.VidInit();
m_Battery.VidInit();
m_Flash.VidInit();
m_Message.VidInit();
m_StatusBar.VidInit();
@ -493,18 +493,12 @@ void CHud :: VidInit( void )
m_Menu.VidInit();
m_AmmoSecondary.VidInit();
m_TextMessage.VidInit();
m_Scope.VidInit();
m_StatusIcons.VidInit();
GetClientVoiceMgr()->VidInit();
}
int CHud::MsgFunc_Logo(const char *pszName, int iSize, void *pbuf)
{
BEGIN_READ( pbuf, iSize );
// update Train data
m_iLogo = READ_BYTE();
return 1;
m_Spectator.VidInit();
m_CrosshairInfo.VidInit();
m_PlayerState.VidInit();
}
float g_lastFOV = 0.0;
@ -608,7 +602,7 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
int newfov = READ_BYTE();
int def_fov = CVAR_GET_FLOAT( "default_fov" );
//Weapon prediction already takes care of changing the fog. ( g_lastFOV ).
//Weapon prediction already takes care of changing the fov. ( g_lastFOV ).
if ( cl_lw && cl_lw->value )
return 1;
@ -640,7 +634,6 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
return 1;
}
void CHud::AddHudElem(CHudBase *phudelem)
{
HUDLIST *pdl, *ptemp;

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -21,9 +21,11 @@
//
#define RGB_WHITE 0x00FFFFFF //255,255,255
#define RGB_YELLOWISH 0x00FFA000 //255,160,0
#define RGB_REDISH 0x00FF1010 //255,160,0
#define RGB_GREENISH 0x0000A000 //0,160,0
#define RGB_REDISH 0x00FF1010 //255,160,0
#define RGB_GREENISH 0x0000A000 //0,160,0
#define RGB_BLUISH 0x000080FF //0,128,255
#include "wrect.h"
#include "cl_dll.h"
@ -77,7 +79,6 @@ 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 {
@ -129,12 +130,15 @@ public:
void _cdecl UserCmd_NextWeapon( void );
void _cdecl UserCmd_PrevWeapon( void );
const WEAPON *GetCurWeapon(){ return m_pWeapon; }
private:
float m_fFade;
RGBA m_rgba;
WEAPON *m_pWeapon;
int m_HUD_bucket0;
int m_HUD_selection;
int m_iAmmocount;
};
@ -259,6 +263,58 @@ protected:
float *m_pflNameColors[MAX_STATUSBAR_LINES];
};
class CHudScanlines : public CHudBase
{
public:
int Init( void );
int VidInit( void );
int Draw(float fTime);
void Reset( void );
private:
int m_iScanlines;
int m_iScrolllines;
float m_flScrollY;
};
class CCrosshairInfo : public CHudBase
{
public:
int Init();
int VidInit();
int Draw(float fTime);
void UpdateInfo(int index);
private:
float m_flCenterTime;
char m_szCenterName[64];
};
enum enum_playerstate_e {
PS_NORMAL = 0,
PS_COMPOSURE,
PS_BLEEDING,
PS_WILLPOWER,
};
class CHudPlayerState : public CHudBase
{
public:
int Init();
int VidInit();
int Draw(float fTime);
int _cdecl MsgFunc_PlayerState(const char *pszName,int iSize,void *pbuf);
int ActiveState();
private:
int m_iActiveSprite;
int m_HUD_bleeding;
int m_HUD_composure;
int m_HUD_willpower;
};
//
//-----------------------------------------------------
//
@ -298,7 +354,7 @@ struct extra_player_info_t
{
short frags;
short deaths;
short playerclass;
short alive;
short teamnumber;
char teamname[MAX_TEAM_NAME];
};
@ -336,7 +392,9 @@ public:
int MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbuf );
private:
int m_HUD_d_skull; // sprite index of skull icon
int m_HUD_d_skull; // sprite index of skull icon
int m_HUD_d_headshot; // sprite index of headshot icon
int m_HUD_d_bleeding; // sprite index of bleeding icon
};
//
@ -373,36 +431,8 @@ public:
int MsgFunc_SayText( const char *pszName, int iSize, void *pbuf );
void SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex = -1 );
void EnsureTextFitsInOneLineAndWrapIfHaveTo( int line );
friend class CHudSpectator;
private:
struct cvar_s * m_HUD_saytext;
struct cvar_s * m_HUD_saytext_time;
};
//
//-----------------------------------------------------
//
class CHudBattery: public CHudBase
{
public:
int Init( void );
int VidInit( void );
int Draw(float flTime);
int MsgFunc_Battery(const char *pszName, int iSize, void *pbuf );
private:
HSPRITE m_hSprite1;
HSPRITE m_hSprite2;
wrect_t *m_prc1;
wrect_t *m_prc2;
int m_iBat;
float m_fFade;
int m_iHeight; // width of the battery innards
};
//
//-----------------------------------------------------
//
@ -427,7 +457,7 @@ private:
int m_iBat;
int m_fOn;
float m_fFade;
int m_iWidth; // width of the battery innards
int m_iWidth; // width of the innards
};
//
@ -483,7 +513,6 @@ public:
int YPosition( float y, int height );
void MessageAdd( const char *pName, float time );
void MessageAdd(client_textmessage_t * newMessage );
void MessageDrawScan( client_textmessage_t *pMessage, float time );
void MessageScanStart( void );
void MessageScanNextChar( void );
@ -500,6 +529,22 @@ private:
int m_HUD_title_half;
};
//
//-----------------------------------------------------
//
class CHudScope : public CHudBase
{
private:
HSPRITE m_h320Scope;
HSPRITE m_h640Scope;
HSPRITE m_h1280Scope;
public:
int Init();
int VidInit();
void DrawScopePart(int frame,int x,int y,HSPRITE hSprite,wrect_t *rect);
int Draw(float flTime);
};
//
//-----------------------------------------------------
//
@ -542,21 +587,16 @@ private:
//
//-----------------------------------------------------
//
class CHud
{
private:
HUDLIST *m_pHudList;
HSPRITE m_hsprLogo;
int m_iLogo;
client_sprite_t *m_pSpriteList;
int m_iSpriteCount;
int m_iSpriteCountAllRes;
float m_flMouseSensitivity;
int m_iConcussionEffect;
public:
HSPRITE m_hsprCursor;
@ -568,10 +608,9 @@ public:
int m_iKeyBits;
int m_iHideHUDDisplay;
int m_iFOV;
int m_Teamplay;
int m_Gamemode;
int m_iRes;
cvar_t *m_pCvarStealMouse;
cvar_t *m_pCvarDraw;
int m_iFontHeight;
int DrawHudNumber(int x, int y, int iFlags, int iNumber, int r, int g, int b );
@ -602,21 +641,24 @@ public:
int GetSpriteIndex( const char *SpriteName ); // gets a sprite index, for use in the m_rghSprites[] array
CHudAmmo m_Ammo;
CHudHealth m_Health;
CHudSpectator m_Spectator;
CHudGeiger m_Geiger;
CHudBattery m_Battery;
CHudTrain m_Train;
CHudFlashlight m_Flash;
CHudMessage m_Message;
CHudStatusBar m_StatusBar;
CHudDeathNotice m_DeathNotice;
CHudSayText m_SayText;
CHudMenu m_Menu;
CHudScanlines m_Scanlines;
CHudAmmo m_Ammo;
CHudHealth m_Health;
CHudGeiger m_Geiger;
CHudTrain m_Train;
CHudFlashlight m_Flash;
CHudMessage m_Message;
CHudStatusBar m_StatusBar;
CHudDeathNotice m_DeathNotice;
CHudSayText m_SayText;
CHudMenu m_Menu;
CHudAmmoSecondary m_AmmoSecondary;
CHudTextMessage m_TextMessage;
CHudStatusIcons m_StatusIcons;
CHudTextMessage m_TextMessage;
CHudScope m_Scope;
CHudStatusIcons m_StatusIcons;
CHudSpectator m_Spectator;
CCrosshairInfo m_CrosshairInfo;
CHudPlayerState m_PlayerState;
void Init( void );
void VidInit( void );
@ -630,10 +672,8 @@ public:
// user messages
int _cdecl MsgFunc_Damage(const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_Logo(const char *pszName, int iSize, void *pbuf);
int _cdecl MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf);
void _cdecl MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf );
void _cdecl MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf);
int _cdecl MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf );
@ -647,17 +687,15 @@ public:
// sprite indexes
int m_HUD_number_0;
void AddHudElem(CHudBase *p);
float GetSensitivity();
};
class TeamFortressViewport;
class TheWastesViewport;
extern CHud gHUD;
extern TeamFortressViewport *gViewPort;
extern TheWastesViewport *gViewPort;
extern int g_iPlayerClass;
extern int g_iTeamNumber;

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -23,9 +23,6 @@
#define MAX_CLIENTS 32
extern BEAM *pBeam;
extern BEAM *pBeam2;
/// USER-DEFINED SERVER MESSAGE HANDLERS
int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
@ -51,13 +48,6 @@ int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
return 1;
}
void CAM_ToFirstPerson(void);
void CHud :: MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )
{
CAM_ToFirstPerson();
}
void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
{
// prepare all hud data
@ -69,16 +59,13 @@ void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
pList->p->InitHUDData();
pList = pList->pNext;
}
//Probably not a good place to put this.
pBeam = pBeam2 = NULL;
}
int CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_Teamplay = READ_BYTE();
m_Gamemode = READ_BYTE();
return 1;
}

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -18,8 +18,10 @@
#include <math.h>
#include "hud.h"
#include "cl_util.h"
#include "tw_common.h"
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#define MAX_LOGO_FRAMES 56
@ -104,15 +106,12 @@ int CHud :: Redraw( float flTime, int intermission )
m_iIntermission = intermission;
gViewPort->HideCommandMenu();
gViewPort->HideScoreBoard();
gViewPort->UpdateSpectatorPanel();
}
else if ( !m_iIntermission && intermission )
{
m_iIntermission = intermission;
gViewPort->HideCommandMenu();
gViewPort->HideVGUIMenu();
gViewPort->ShowScoreBoard();
gViewPort->UpdateSpectatorPanel();
// Take a screenshot if the client's got the cvar set
if ( CVAR_GET_FLOAT( "hud_takesshots" ) != 0 )
@ -131,47 +130,25 @@ int CHud :: Redraw( float flTime, int intermission )
// if no redrawing is necessary
// return 0;
if ( m_pCvarDraw->value )
{
HUDLIST *pList = m_pHudList;
HUDLIST *pList = m_pHudList;
while (pList)
while (pList)
{
if ( !intermission )
{
if ( !intermission )
{
if ( (pList->p->m_iFlags & HUD_ACTIVE) && !(m_iHideHUDDisplay & HIDEHUD_ALL) )
pList->p->Draw(flTime);
}
else
{ // 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 );
}
pList = pList->pNext;
if ( (pList->p->m_iFlags & HUD_ACTIVE) && !(m_iHideHUDDisplay & HIDEHUD_ALL) )
pList->p->Draw(flTime);
}
else
{ // 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 );
}
pList = pList->pNext;
}
// are we in demo mode? do we need to draw the logo in the top corner?
if (m_iLogo)
{
int x, y, i;
if (m_hsprLogo == 0)
m_hsprLogo = LoadSprite("sprites/%d_logo.spr");
SPR_Set(m_hsprLogo, 250, 250, 250 );
x = SPR_Width(m_hsprLogo, 0);
x = ScreenWidth - x;
y = SPR_Height(m_hsprLogo, 0)/2;
// Draw the logo at 20 fps
int iFrame = (int)(flTime * 20) % MAX_LOGO_FRAMES;
i = grgLogoFrame[iFrame] - 1;
SPR_DrawAdditive(i, x, y, NULL);
}
// m_Scope.Draw(flTime);
/*
if ( g_iVisibleMouse )
@ -195,6 +172,15 @@ int CHud :: Redraw( float flTime, int intermission )
}
*/
#ifdef TW_BETA
char szBanner[256];
sprintf(szBanner,TW_BANNER,__DATE__);
gEngfuncs.pfnDrawSetTextColor(255,0,0);
DrawConsoleString((ScreenWidth/2)-(ConsoleStringLen(szBanner)/2),0,szBanner);
#endif
return 1;
}

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -11,16 +11,17 @@
#include "cl_entity.h"
#define MAIN_CHASE_LOCKED 1
#define MAIN_CHASE_FREE 2
#define MAIN_ROAMING 3
#define MAIN_IN_EYE 4
#define MAIN_MAP_FREE 5
#define INSET_OFF 0
#define INSET_CHASE_FREE 1
#define INSET_IN_EYE 2
#define INSET_MAP_FREE 3
#define INSET_MAP_CHASE 4
#define MAX_SPEC_HUD_MESSAGES 8
#define OVERVIEW_TILE_SIZE 128 // don't change this
@ -31,7 +32,6 @@
//-----------------------------------------------------------------------------
typedef struct overviewInfo_s {
char map[64]; // cl.levelname or empty
vec3_t origin; // center of map
float zoom; // zoom of map images
int layers; // how may layers do we have
@ -43,6 +43,7 @@ typedef struct overviewInfo_s {
int insetWindowY;
int insetWindowHeight;
int insetWindowWidth;
char map[255]; // holds the name of the map we're on
} overviewInfo_t;
typedef struct overviewEntity_s {
@ -57,10 +58,6 @@ typedef struct overviewEntity_s {
class CHudSpectator : public CHudBase
{
public:
void Reset();
int ToggleInset(bool allowOff);
void CheckSettings();
void InitHUDData( void );
bool AddOverviewEntityToList( HSPRITE sprite, cl_entity_t * ent, double killTime);
void DeathMessage(int victim);
bool AddOverviewEntity( int type, struct cl_entity_s *ent, const char *modelname );
@ -77,37 +74,27 @@ public:
void HandleButtonsUp(int ButtonPressed);
void FindNextPlayer( bool bReverse );
void DirectorMessage( int iSize, void *pbuf );
void InitHUDData( void );
void Reset( void );
void SetSpectatorStartPosition();
int Init();
int VidInit();
int Draw(float flTime);
int m_iMainMode;
int m_iInsetMode;
int m_iDrawCycle;
client_textmessage_t m_HUDMessages[MAX_SPEC_HUD_MESSAGES];
char m_HUDMessageText[MAX_SPEC_HUD_MESSAGES][128];
int m_lastHudMessage;
overviewInfo_t m_OverviewData;
overviewEntity_t m_OverviewEntities[MAX_OVERVIEW_ENTITIES];
int m_iObserverFlags;
int m_iSpectatorNumber;
int m_iObserverTarget;
float m_mapZoom; // zoom the user currently uses
vec3_t m_mapOrigin; // origin where user rotates around
cvar_t * m_drawnames;
cvar_t * m_drawcone;
cvar_t * m_drawstatus;
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
vec3_t m_mapAngles; // cuurent map view angles
private:
cvar_t * m_drawnames;
vec3_t m_vPlayerPos[MAX_PLAYERS];
HSPRITE m_hsprPlayerBlue;
HSPRITE m_hsprPlayerRed;
@ -118,9 +105,6 @@ private:
HSPRITE m_hsprUnkownMap;
HSPRITE m_hsprBeam;
HSPRITE m_hCrosshair;
wrect_t m_crosshairRect;
struct model_s * m_MapSprite; // each layer image is saved in one sprite, where each tile is a sprite frame
float m_flNextObserverInput;
float m_zoomDelta;

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -428,7 +428,7 @@ void CAM_ToThirdPerson(void)
vec3_t viewangles;
#if !defined( _DEBUG )
if ( gEngfuncs.GetMaxClients() > 1 )
if ( gEngfuncs.GetMaxClients() > 1 && !CVAR_GET_FLOAT("sv_cheats"))
{
// no thirdperson in multiplayer.
return;
@ -612,7 +612,7 @@ void CAM_EndDistance(void)
int DLLEXPORT CL_IsThirdPerson( void )
{
return (cam_thirdperson ? 1 : 0) || (g_iUser1 && (g_iUser2 == gEngfuncs.GetLocalPlayer()->index) );
return cam_thirdperson ? 1 : 0;
}
void DLLEXPORT CL_CameraOffset( float *ofs )

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -27,7 +27,8 @@ extern "C"
#include <string.h>
#include <ctype.h>
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
extern "C"
@ -77,6 +78,7 @@ cvar_t *cl_yawspeed;
cvar_t *cl_pitchspeed;
cvar_t *cl_anglespeedkey;
cvar_t *cl_vsmoothing;
/*
===============================================================================
@ -116,11 +118,11 @@ kbutton_t in_use;
kbutton_t in_jump;
kbutton_t in_attack;
kbutton_t in_attack2;
kbutton_t in_special;
kbutton_t in_up;
kbutton_t in_down;
kbutton_t in_duck;
kbutton_t in_reload;
kbutton_t in_alt1;
kbutton_t in_score;
kbutton_t in_break;
kbutton_t in_graph; // Display the netgraph
@ -455,22 +457,14 @@ 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);
void IN_Attack2Down(void)
{
KeyDown(&in_attack2);
gHUD.m_Spectator.HandleButtonsDown( IN_ATTACK2 );
}
void IN_Attack2Up(void) {KeyUp(&in_attack2);}
void IN_UseDown (void)
{
KeyDown(&in_use);
gHUD.m_Spectator.HandleButtonsDown( IN_USE );
}
void IN_UseDown (void) {KeyDown(&in_use);}
void IN_UseUp (void) {KeyUp(&in_use);}
void IN_JumpDown (void)
{
@ -488,8 +482,6 @@ void IN_DuckDown(void)
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);}
@ -505,6 +497,16 @@ void IN_AttackUp(void)
in_cancel = 0;
}
void IN_SpecialDown( void )
{
KeyDown( &in_special );
}
void IN_SpecialUp( void )
{
KeyUp( &in_special );
}
// Special handling
void IN_Cancel(void)
{
@ -792,6 +794,11 @@ int CL_ButtonBits( int bResetState )
{
int bits = 0;
if( in_special.state & 3 )
{
bits |= IN_SPECIAL;
}
if ( in_attack.state & 3 )
{
bits |= IN_ATTACK;
@ -857,11 +864,6 @@ int CL_ButtonBits( int bResetState )
bits |= IN_RELOAD;
}
if (in_alt1.state & 3)
{
bits |= IN_ALT1;
}
if ( in_score.state & 3 )
{
bits |= IN_SCORE;
@ -875,6 +877,7 @@ int CL_ButtonBits( int bResetState )
if ( bResetState )
{
in_special.state &= ~2;
in_attack.state &= ~2;
in_duck.state &= ~2;
in_jump.state &= ~2;
@ -887,7 +890,6 @@ int CL_ButtonBits( int bResetState )
in_moveright.state &= ~2;
in_attack2.state &= ~2;
in_reload.state &= ~2;
in_alt1.state &= ~2;
in_score.state &= ~2;
}
@ -955,6 +957,8 @@ void InitInput (void)
gEngfuncs.pfnAddCommand ("-attack", IN_AttackUp);
gEngfuncs.pfnAddCommand ("+attack2", IN_Attack2Down);
gEngfuncs.pfnAddCommand ("-attack2", IN_Attack2Up);
gEngfuncs.pfnAddCommand ("+special", IN_SpecialDown );
gEngfuncs.pfnAddCommand ("-special", IN_SpecialUp );
gEngfuncs.pfnAddCommand ("+use", IN_UseDown);
gEngfuncs.pfnAddCommand ("-use", IN_UseUp);
gEngfuncs.pfnAddCommand ("+jump", IN_JumpDown);
@ -970,8 +974,6 @@ void InitInput (void)
gEngfuncs.pfnAddCommand ("-duck", IN_DuckUp);
gEngfuncs.pfnAddCommand ("+reload", IN_ReloadDown);
gEngfuncs.pfnAddCommand ("-reload", IN_ReloadUp);
gEngfuncs.pfnAddCommand ("+alt1", IN_Alt1Down);
gEngfuncs.pfnAddCommand ("-alt1", IN_Alt1Up);
gEngfuncs.pfnAddCommand ("+score", IN_ScoreDown);
gEngfuncs.pfnAddCommand ("-score", IN_ScoreUp);
gEngfuncs.pfnAddCommand ("+showscores", IN_ScoreDown);
@ -993,7 +995,6 @@ void InitInput (void)
cl_movespeedkey = gEngfuncs.pfnRegisterVariable ( "cl_movespeedkey", "0.3", 0 );
cl_pitchup = gEngfuncs.pfnRegisterVariable ( "cl_pitchup", "89", 0 );
cl_pitchdown = gEngfuncs.pfnRegisterVariable ( "cl_pitchdown", "89", 0 );
cl_vsmoothing = gEngfuncs.pfnRegisterVariable ( "cl_vsmoothing", "0.05", FCVAR_ARCHIVE );
m_pitch = gEngfuncs.pfnRegisterVariable ( "m_pitch","0.022", FCVAR_ARCHIVE );

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -311,7 +311,8 @@ void IN_MouseMove ( float frametime, usercmd_t *cmd)
//jjb - this disbles normal mouse control if the user is trying to
// move the camera, or if the mouse cursor is visible or if we're in intermission
if ( !iMouseInUse && !g_iVisibleMouse && !gHUD.m_iIntermission )
// GAGE -> if your dead you cant move your head dumbass :)
if ( !iMouseInUse && !g_iVisibleMouse && !gHUD.m_iIntermission)
{
GetCursorPos (&current_pos);
@ -321,54 +322,57 @@ void IN_MouseMove ( float frametime, usercmd_t *cmd)
mx_accum = 0;
my_accum = 0;
if (m_filter->value)
if(gHUD.m_Health.m_iHealth)
{
mouse_x = (mx + old_mouse_x) * 0.5;
mouse_y = (my + old_mouse_y) * 0.5;
}
else
{
mouse_x = mx;
mouse_y = my;
}
old_mouse_x = mx;
old_mouse_y = my;
if ( gHUD.GetSensitivity() != 0 )
{
mouse_x *= gHUD.GetSensitivity();
mouse_y *= gHUD.GetSensitivity();
}
else
{
mouse_x *= sensitivity->value;
mouse_y *= sensitivity->value;
}
// add mouse X/Y movement to cmd
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
cmd->sidemove += m_side->value * mouse_x;
else
viewangles[YAW] -= m_yaw->value * mouse_x;
if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
{
viewangles[PITCH] += m_pitch->value * mouse_y;
if (viewangles[PITCH] > cl_pitchdown->value)
viewangles[PITCH] = cl_pitchdown->value;
if (viewangles[PITCH] < -cl_pitchup->value)
viewangles[PITCH] = -cl_pitchup->value;
}
else
{
if ((in_strafe.state & 1) && gEngfuncs.IsNoClipping() )
if (m_filter->value)
{
cmd->upmove -= m_forward->value * mouse_y;
mouse_x = (mx + old_mouse_x) * 0.5;
mouse_y = (my + old_mouse_y) * 0.5;
}
else
{
cmd->forwardmove -= m_forward->value * mouse_y;
mouse_x = mx;
mouse_y = my;
}
old_mouse_x = mx;
old_mouse_y = my;
if ( gHUD.GetSensitivity() != 0 )
{
mouse_x *= gHUD.GetSensitivity();
mouse_y *= gHUD.GetSensitivity();
}
else
{
mouse_x *= sensitivity->value;
mouse_y *= sensitivity->value;
}
// add mouse X/Y movement to cmd
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
cmd->sidemove += m_side->value * mouse_x;
else
viewangles[YAW] -= m_yaw->value * mouse_x;
if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
{
viewangles[PITCH] += m_pitch->value * mouse_y;
if (viewangles[PITCH] > cl_pitchdown->value)
viewangles[PITCH] = cl_pitchdown->value;
if (viewangles[PITCH] < -cl_pitchup->value)
viewangles[PITCH] = -cl_pitchup->value;
}
else
{
if ((in_strafe.state & 1) && gEngfuncs.IsNoClipping() )
{
cmd->upmove -= m_forward->value * mouse_y;
}
else
{
cmd->forwardmove -= m_forward->value * mouse_y;
}
}
}

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -24,7 +24,8 @@
#include <string.h>
#include <stdio.h>
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#define MAX_MENU_STRING 512
char g_szMenuString[MAX_MENU_STRING];

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -514,23 +514,3 @@ int CHudMessage::MsgFunc_GameTitle( const char *pszName, int iSize, void *pbuf
return 1;
}
void CHudMessage::MessageAdd(client_textmessage_t * newMessage )
{
m_parms.time = gHUD.m_flTime;
// Turn on drawing
if ( !(m_iFlags & HUD_ACTIVE) )
m_iFlags |= HUD_ACTIVE;
for ( int i = 0; i < maxHUDMessages; i++ )
{
if ( !m_pMessages[i] )
{
m_pMessages[i] = newMessage;
m_startTime[i] = gHUD.m_flTime;
return;
}
}
}

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -9,7 +9,7 @@
#include "cl_util.h"
#include "cl_entity.h"
#include "triangleapi.h"
#include "vgui_TeamFortressViewport.h"
#include "vgui_TheWastesViewport.h"
// these are included for the math functions
#include "com_model.h"

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

228
cl_dll/parsebsp.cpp Normal file
View file

@ -0,0 +1,228 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
//
// parsebsp.cpp -> parse bsp entity information client side
// some of this code was graciously accepted from DMC_Teleporters.cpp
//
#include "extdll.h"
#include "entity_state.h"
#include "pm_defs.h"
#include "pm_movevars.h"
#include "hud_iface.h"
#include "com_model.h"
#include "event_api.h"
#include "com_weapons.h"
#include "event_flags.h"
#include "dmc_bspfile.h"
#include "cl_util.h"
#include "ParseBspEnt.h"
#include "ParseBsp.h"
#include <vector>
using namespace std;
CParseBsp g_ParseBsp;
CParseBsp::CParseBsp()
{
memset( m_szCurrentLevel, 0, sizeof( m_szCurrentLevel ) );
}
int CParseBsp::CheckMap()
{
if( stricmp( m_szCurrentLevel, gEngfuncs.pfnGetLevelName() ) != 0 )
{
strcpy( m_szCurrentLevel, gEngfuncs.pfnGetLevelName() );
// Right now this is kind of a strong approach to read entities
// The entire .bsp must be read for each new entity we wish to read.
ParseBsp( "worldspawn", new CBspWorldspawn() );
ParseBsp( "env_fog", new CBspEnvFog() );
ParseBsp( "env_particlesystem", new CBspEnvParticleSystem() );
return 1;
}
return 0;
}
char *CParseBsp::ParseEntity( char *pBuf, int &error, CBspEntity *pEnt )
{
char key[256];
char token[ 1024 ];
int n;
while (1)
{
// Parse key
pBuf = gEngfuncs.COM_ParseFile ( pBuf, token );
if ( token[0] == '}' )
break;
// Ran out of input buffer?
if ( !pBuf )
{
error = 1;
break;
}
// Store off the key
strcpy ( key, token );
// Fix heynames with trailing spaces
n = strlen( key );
while (n && key[n-1] == ' ')
{
key[n-1] = 0;
n--;
}
// Parse value
pBuf = gEngfuncs.COM_ParseFile ( pBuf, token );
// Ran out of buffer?
if (!pBuf)
{
error = 1;
break;
}
// Hit the end instead of a value?
if ( token[0] == '}' )
{
error = 1;
break;
}
if ( token[0] == '}' && token[1] == '(' )
int k = 0;
// Assign k/v pair
pEnt->SetKeyValue( key, token );
}
// Return what's left in the stream
return pBuf;
}
char *CParseBsp::LoadEntityLump( char *pszFilename )
{
FILE *fp;
int i;
dheader_t header;
int size;
lump_t *curLump;
char *buffer = NULL;
fp = fopen( pszFilename, "rb" );
if( !fp )
return NULL;
// Read in the .bsp header
if ( fread(&header, sizeof(dheader_t), 1, fp) != 1 )
{
gEngfuncs.Con_Printf("Dmc_LoadEntityLump: Could not read BSP header for map [%s].\n", pszFilename);
fclose(fp);
return NULL;
}
// Check the version
i = header.version;
if ( i != 29 && i != 30)
{
fclose(fp);
gEngfuncs.Con_Printf("Dmc_LoadEntityLump: Map [%s] has incorrect BSP version (%i should be %i).\n", pszFilename, i, BSPVERSION);
return NULL;
}
// Get entity lump
curLump = &header.lumps[ LUMP_ENTITIES ];
// and entity lump size
size = curLump->filelen;
// Jump to it
fseek( fp, curLump->fileofs, SEEK_SET );
// Allocate sufficient memmory
buffer = new char[ size + 1 ];
if ( buffer == NULL )
{
fclose(fp);
gEngfuncs.Con_Printf("Dmc_LoadEntityLump: Couldn't allocate %i bytes\n", size + 1 );
return NULL;
}
// Read in the entity lump
fread( buffer, size, 1, fp );
// Terminate the string
buffer[ size ] = '\0';
if ( fp )
{
fclose(fp);
}
return buffer;
}
void CParseBsp::LumpPass( char *pBuf, char *pszClassname, CBspEntity *pEnt )
{
char szToken[ 1024 ];
int error = 0;
while( 1 )
{
pBuf = gEngfuncs.COM_ParseFile( pBuf, szToken );
if( pBuf == NULL )
break;
// Didn't find opening brace?
if( szToken[0] != '{' )
{
gEngfuncs.Con_Printf( "CParseBsp::ParseBsp: found %s when expecting {\n", szToken[0] );
break;
}
pBuf = ParseEntity( pBuf, error, pEnt );
if( stricmp( pszClassname, pEnt->szClassname ) == 0 )
pEnt->AddEntity();
if( error )
{
gEngfuncs.Con_Printf( "CParseBsp::ParseBsp: error parsing entities\n" );
break;
}
}
delete pEnt;
}
void CParseBsp::ParseBsp( char *pszClassname, CBspEntity *pEnt )
{
char szFilename[256];
char *pBuf;
sprintf( szFilename, "%s/%s", gEngfuncs.pfnGetGameDirectory(), m_szCurrentLevel );
pBuf = LoadEntityLump( szFilename );
if( pBuf != NULL )
{
LumpPass( pBuf, pszClassname, pEnt );
delete[] pBuf;
}
}

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -103,20 +103,6 @@ typedef struct engine_studio_api_s
void ( *GL_SetRenderMode ) ( int mode );
} engine_studio_api_t;
typedef struct server_studio_api_s
{
// Allocate number*size bytes and zero it
void *( *Mem_Calloc ) ( int number, size_t size );
// Check to see if pointer is in the cache
void *( *Cache_Check ) ( struct cache_user_s *c );
// Load file into cache ( can be swapped out on demand )
void ( *LoadCacheFile ) ( char *path, struct cache_user_s *cu );
// Retrieve pointer to studio model data block from a model
void *( *Mod_Extradata ) ( struct model_s *mod );
} server_studio_api_t;
// client blending
typedef struct r_studio_interface_s
{
int version;
@ -126,22 +112,4 @@ typedef struct r_studio_interface_s
extern r_studio_interface_t *pStudioAPI;
// server blending
#define SV_BLENDING_INTERFACE_VERSION 1
typedef struct sv_blending_interface_s
{
int version;
void ( *SV_StudioSetupBones )( struct model_s *pModel,
float frame,
int sequence,
const vec3_t angles,
const vec3_t origin,
const byte *pcontroller,
const byte *pblending,
int iBone,
const edict_t *pEdict );
} sv_blending_interface_t;
#endif // R_STUDIOINT_H

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -25,7 +25,8 @@
#include <string.h>
#include <stdio.h>
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
extern float *GetClientColor( int clientIndex );
@ -55,8 +56,7 @@ int CHudSayText :: Init( void )
InitHUDData();
m_HUD_saytext = gEngfuncs.pfnRegisterVariable( "hud_saytext", "1", 0 );
m_HUD_saytext_time = gEngfuncs.pfnRegisterVariable( "hud_saytext_time", "5", 0 );
CVAR_CREATE( "hud_saytext_time", "5", 0 );
m_iFlags |= HUD_INTERMISSION; // is always drawn during an intermission
@ -99,20 +99,20 @@ int CHudSayText :: Draw( float flTime )
{
int y = Y_START;
if ( ( gViewPort && gViewPort->AllowedToPrintText() == FALSE) || !m_HUD_saytext->value )
if ( gViewPort && gViewPort->AllowedToPrintText() == FALSE )
return 1;
// make sure the scrolltime is within reasonable bounds, to guard against the clock being reset
flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value );
flScrollTime = min( flScrollTime, flTime + SCROLL_SPEED );
// make sure the scrolltime is within reasonable bounds, to guard against the clock being reset
flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value );
flScrollTime = min( flScrollTime, flTime + SCROLL_SPEED );
if ( flScrollTime <= flTime )
{
if ( *g_szLineBuffer[0] )
{
flScrollTime = flTime + m_HUD_saytext_time->value;
flScrollTime = flTime + SCROLL_SPEED;
// push the console up
ScrollTextUp();
}
@ -215,7 +215,8 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn
// Set scroll time
if ( i == 0 )
{
flScrollTime = gHUD.m_flTime + m_HUD_saytext_time->value;
SCROLL_SPEED = CVAR_GET_FLOAT( "hud_saytext_time" );
flScrollTime = gHUD.m_flTime + SCROLL_SPEED;
}
m_iFlags |= HUD_ACTIVE;

View file

@ -1,4 +1,4 @@
//======== (C) Copyright 1996-2002 Valve, L.L.C. All rights reserved. ========
//======== (C) Copyright 1996-2001 Valve, L.L.C. All rights reserved. ========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -53,8 +53,6 @@ void CHudStatusIcons::Reset( void )
// Draw status icons along the left-hand side of the screen
int CHudStatusIcons::Draw( float flTime )
{
if (gEngfuncs.IsSpectateOnly())
return 1;
// find starting position to draw from, along right-hand side of screen
int x = 5;
int y = ScreenHeight / 2;

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -184,16 +184,20 @@ int CHudStatusBar :: Draw( float fTime )
m_bReparseString = FALSE;
}
int Y_START = ScreenHeight - YRES(32 + 4);
// Draw the status bar lines
for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ )
{
int TextHeight, TextWidth;
GetConsoleStringSize( m_szStatusBar[i], &TextWidth, &TextHeight );
int x = 4;
int y = Y_START - ( 4 + TextHeight * i ); // draw along bottom of screen
int Y_START;
if ( ScreenHeight >= 480 )
Y_START = ScreenHeight - 55;
else
Y_START = ScreenHeight - 45;
int x = 5;
int y = Y_START - ( TextHeight * i ); // draw along bottom of screen
// let user set status ID bar centering
if ( (i == STATUSBAR_ID_LINE) && CVAR_GET_FLOAT("hud_centerid") )

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

321
cl_dll/studioevent.cpp Normal file
View file

@ -0,0 +1,321 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
//
// studioevent.cpp -> Model Event code
//
#include <memory.h>
#include "hud.h"
#include "cl_util.h"
#include "const.h"
#include "entity_types.h"
#include "studio_event.h" // def. of mstudioevent_t
#include "r_efx.h"
#include "event_api.h"
#include "pm_defs.h"
#include "pmtrace.h"
#include "twm.h"
#include "twmmanager.h"
#define DLLEXPORT __declspec( dllexport )
extern "C"
{
#if 0
// THE ORIGINAL HUD_StudioEvent declaration is
void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity );
// But we want to modify the cl_entity_s* parameter. Since C doesnt have the concept of const,
// and to the best of my knowledge the HL code is still c, i Figured i'd remove it... if we
// have problems with studio events dont hesitate to point at this.
// Gage - July 02, 2002
#else
void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, struct cl_entity_s *entity );
#endif
}
void HUD_GetCurrentAmmoInfo(int &cur_ammo,int &max_ammo);
extern int cam_thirdperson;
extern vec3_t v_origin,v_angles;
/*
=========================
STUDIO_SmokePuff
=========================
*/
void STUDIO_SmokePuff(float *vecSrc,float scale,cl_entity_t *entity)
{
// create the puff
TEMPENTITY *pTent = gEngfuncs.pEfxAPI->R_TempSprite(vecSrc,
Vector(0,0,5),
scale,
gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/smoke1.spr"),
kRenderTransAlpha,
0,
25,
5,
FTENT_SPRANIMATE);
// state settings
if(pTent != NULL)
{
pTent->clientIndex = entity->index;
//pTent->entity.curstate.rendercolor = Color;
pTent->entity.curstate.framerate = 10;
pTent->entity.curstate.renderamt = 128;
}
}
/*
=========================
STUDIO_EjectModel
=========================
*/
void STUDIO_EjectModel(int iEventId,const char *szEventOptions,struct cl_entity_s *entity,int count)
{
char szShellname[64];
int shell_index;
int attachment_num,velocity_type,sound_type,quality_check;
float scaleR,scaleU;
vec3_t shell_velocity;
vec3_t shell_origin;
vec3_t angles,forward,right,up;
vec3_t endpos;
// Read options from event parameters
sscanf(szEventOptions,"%i,%i,%i,%i,%s",&attachment_num,&velocity_type,&sound_type,&quality_check,szShellname);
// Finalize shellcase parameter (set high or low quality)
if(quality_check)
sprintf(szShellname,"%s%s",szShellname,CVAR_GET_FLOAT("cl_shellcase_quality") ? "_hi.mdl" : "_lo.mdl");
#if 0
gEngfuncs.pfnCenterPrint(szShellname);
#endif
// set up shell properties
shell_index = gEngfuncs.pEventAPI->EV_FindModelIndex(szShellname);
if(shell_index == 0)
gEngfuncs.Con_DPrintf("STUDIO_EjectModel: invalid model %s\n",szShellname);
// Get needed angles
VectorCopy(entity->angles,angles);
AngleVectors(angles,forward,right,up);
for(int i = 0;i < count;i++)
{
switch(velocity_type)
{
case 1:
// Pistols, Small arms ejection
scaleR = gEngfuncs.pfnRandomFloat( 50, 70 );
scaleU = gEngfuncs.pfnRandomFloat( 100, 150 );
VectorClear(shell_origin);
break;
case 2:
// No velocity, magazine dropping
scaleR = gEngfuncs.pfnRandomFloat(0.0,0.0);
scaleU = gEngfuncs.pfnRandomFloat(0.0,0.0);
// Randomize the location a bit,
// so events that call multiple times
// (such as ruger reload) have shellcases
// going everywhere
VectorClear(shell_origin);
shell_origin[0] = gEngfuncs.pfnRandomFloat(-1.0f,6.0f);
shell_origin[1] = gEngfuncs.pfnRandomFloat(-1.0f,6.0f);
shell_origin[2] = gEngfuncs.pfnRandomFloat(-1.0f,6.0f);
break;
}
for(int i = 0;i< 3;i++)
{
shell_velocity[i] = right[i] * scaleR + up[i] * scaleU + forward[i] * 25;
// go by ent origin, not attachment
if(attachment_num == -1)
{
shell_origin[i] += entity->origin[i];
// Spawn a bit lower
if(i == 2)
shell_origin[i] -= 16;
}
else
shell_origin[i] += entity->attachment[attachment_num][i];
}
// Eject the shell
VectorClear( endpos );
endpos[1] = angles[1];
// sound type, we do a
// switch in the unlikely event
// that these macros change on us
switch(sound_type)
{
case 0: sound_type = TE_BOUNCE_NULL; break;
case 1: sound_type = TE_BOUNCE_SHELL; break;
case 2: sound_type = TE_BOUNCE_SHOTSHELL; break;
}
gEngfuncs.pEfxAPI->R_TempModel(shell_origin,shell_velocity,endpos,CVAR_GET_FLOAT("cl_shellcase_lifetime"),shell_index,sound_type);
}
}
void STUDIO_TwmMuzzleFlash(int iEventId,const char *szEventOptions,struct cl_entity_s *entity)
{
CTwmModel *pTwm;
twm_clientinfo_t *clientinfo = NULL;
int attachment_num;
float fadetime;
// sanity check
if(g_iNumMuzzleflashModels > 64)
{
gEngfuncs.Con_Printf("STUDIO_TwmMuzzleFlash: too many muzzle flashes!\n");
return;
}
g_iNumMuzzleflashModels++;
// TODO: use szEventOptions for this stuff
pTwm = g_TwmManager.GetModelByName("models/muz_test.twm");
attachment_num = 0;
fadetime = 2.5f;
// end of array
clientinfo = &g_MuzzleflashModels[g_iNumMuzzleflashModels - 1];
// We go through the current muzzleflash
// array, if this entity has a
// muzzleflash for it, put in our new data
for(int i = 0;i < g_iNumMuzzleflashModels;i++)
{
twm_clientinfo_t *cur_info = &g_MuzzleflashModels[i];
if(cur_info->attached_ent == entity)
{
clientinfo = &g_MuzzleflashModels[i];
g_iNumMuzzleflashModels--; // reset value
break;
}
}
clientinfo->twm_info = &pTwm->twminfo;
clientinfo->attached_ent = entity;
clientinfo->attachment_num = attachment_num;
clientinfo->fadetime = fadetime;
// triAPI information
clientinfo->render_mode = kRenderTransAdd;
clientinfo->sprite_frame = 0; // TODO: make a random frame
clientinfo->brightness = gEngfuncs.pfnRandomFloat(0.8f,1.0f);
// RGBA
clientinfo->color[0] = 1.0f;
clientinfo->color[1] = 1.0f;
clientinfo->color[2] = 1.0f;
clientinfo->color[3] = gEngfuncs.pfnRandomFloat(0.5f,1.0f);
}
/*
=========================
HUD_StudioEvent
The entity's studio model description indicated an event was
fired during this frame, handle the event by it's tag ( e.g., muzzleflash, sound )
=========================
*/
void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, struct cl_entity_s *entity )
{
switch( event->event )
{
/*******************
* muzzle flashes *
*******************/
case 5001:
// STUDIO_TwmMuzzleFlash(event->event,event->options,entity);
gEngfuncs.pEfxAPI->R_MuzzleFlash((float *)&entity->attachment[0], atoi( event->options) );
break;
case 5011:
// STUDIO_TwmMuzzleFlash(event->event,event->options,entity);
gEngfuncs.pEfxAPI->R_MuzzleFlash((float *)&entity->attachment[1], atoi( event->options) );
break;
case 5021:
// STUDIO_TwmMuzzleFlash(event->event,event->options,entity);
gEngfuncs.pEfxAPI->R_MuzzleFlash((float *)&entity->attachment[2], atoi( event->options) );
break;
case 5031:
// STUDIO_TwmMuzzleFlash(event->event,event->options,entity);
gEngfuncs.pEfxAPI->R_MuzzleFlash((float *)&entity->attachment[3], atoi( event->options) );
break;
/*******************
* smoke puffs *
*******************/
case 5041:
STUDIO_SmokePuff((float *)&entity->attachment[1],0.5f,entity);
break;
/*******************
* sparks *
*******************/
case 5002:
gEngfuncs.pEfxAPI->R_SparkEffect((float *)&entity->attachment[0], atoi( event->options), -100, 100 );
break;
/*******************
* sound *
*******************/
case 5004:
gEngfuncs.pfnPlaySoundByNameAtLocation((char*)event->options,1.0,(float*)&entity->attachment[0]);
break;
/*******************
* skin change *
*******************/
case 5005:
entity->curstate.skin = atoi(event->options);
break;
/*******************
* model ejection *
*******************/
case 5006:
STUDIO_EjectModel(event->event,event->options,entity,1);
break;
// Ruger reload
case 5007:
STUDIO_EjectModel(event->event,event->options,entity,5 - gHUD.m_Ammo.GetCurWeapon()->iClip);
break;
// Sawed off reload
case 5008:
STUDIO_EjectModel(event->event,event->options,entity,2 - gHUD.m_Ammo.GetCurWeapon()->iClip);
break;
default:
break;
}
}

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -26,7 +26,8 @@
#include <stdio.h>
#include "parsemsg.h"
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
DECLARE_MESSAGE( m_TextMessage, TextMsg );

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -82,7 +82,6 @@
#define IT_INVISIBILITY 524288
#define IT_INVULNERABILITY 1048576
#define IT_SUIT 2097152
#define IT_QUAD 4194304
#define IT_HOOK 8388608
@ -101,7 +100,6 @@
#define TFSTATE_INVINCIBLE 32 // Player has permanent Invincibility (Usually by GoalItem)
#define TFSTATE_INVISIBLE 64 // Player has permanent Invisibility (Usually by GoalItem)
#define TFSTATE_QUAD 128 // Player has permanent Quad Damage (Usually by GoalItem)
#define TFSTATE_RADSUIT 256 // Player has permanent Radsuit (Usually by GoalItem)
#define TFSTATE_BURNING 512 // Is on fire
#define TFSTATE_GRENTHROWING 1024 // is throwing a grenade
#define TFSTATE_AIMING 2048 // is using the laser sight
@ -177,8 +175,6 @@
#define PC_LASTCLASS 12 // Use this as the high-boundary for any loops
// through the playerclass.
#define SENTRY_COLOR 10 // will be in the PC_RANDOM slot for team colors
// These are just for the scanner
#define SCAN_SENTRY 13
#define SCAN_GOALITEM 14
@ -286,11 +282,6 @@ enum
#define TF_SCAN_SOUND 162 // Scanner sounds on/off
#define TF_SCAN_30 163 // Scan using 30 energy (2 cells)
#define TF_SCAN_100 164 // Scan using 100 energy (5 cells)
#define TF_DETPACK_5 165 // Detpack set to 5 seconds
#define TF_DETPACK_20 166 // Detpack set to 20 seconds
#define TF_DETPACK_50 167 // Detpack set to 50 seconds
#define TF_DETPACK 168 // Detpack Pre-Impulse
#define TF_DETPACK_STOP 169 // Impulse to stop setting detpack
#define TF_PB_DETONATE 170 // Detonate Pipebombs
// Special skill
@ -311,10 +302,6 @@ enum
// Select Medikit
#define TF_MEDIKIT 176
// Spy Impulses
#define TF_SPY_SPY 177 // On net, go invisible, on LAN, change skin/color
#define TF_SPY_DIE 178 // Feign Death
// Engineer Impulses
#define TF_ENGINEER_BUILD 179
#define TF_ENGINEER_SANDBAG 180
@ -359,9 +346,14 @@ enum
// Yet MORE Admin Commands
#define TF_ADMIN_LISTIPS 198
// Silent Spy Feign
#define TF_SPY_SILENTDIE 199
/*==================================================*/
/* Colors */
/*==================================================*/
#define TEAM1_COLOR 150
#define TEAM2_COLOR 250
#define TEAM3_COLOR 45
#define TEAM4_COLOR 100
/*==================================================*/
/* Defines for the ENGINEER's Building ability */
@ -449,7 +441,6 @@ enum
#define WEAP_INCENDIARY 16384
#define WEAP_ASSAULT_CANNON 32768
#define WEAP_LIGHTNING 65536
#define WEAP_DETPACK 131072
#define WEAP_TRANQ 262144
#define WEAP_LASER 524288
// still room for 12 more weapons
@ -474,7 +465,6 @@ enum
#define WEAPON_INCENDIARY (WEAPON_HOOK+14)
#define WEAPON_ASSAULT_CANNON (WEAPON_HOOK+16)
#define WEAPON_LIGHTNING (WEAPON_HOOK+17)
#define WEAPON_DETPACK (WEAPON_HOOK+18)
#define WEAPON_TRANQ (WEAPON_HOOK+19)
#define WEAPON_LASER (WEAPON_HOOK+20)
#define WEAPON_PIPEBOMB_LAUNCHER (WEAPON_HOOK+21)
@ -506,13 +496,6 @@ enum
// Spanner
#define WEAP_SPANNER_REPAIR 10
// Detpack
#define WEAP_DETPACK_DISARMTIME 3 // Time it takes to disarm a Detpack
#define WEAP_DETPACK_SETTIME 3 // Time it takes to set a Detpack
#define WEAP_DETPACK_SIZE 700 // Explosion Size
#define WEAP_DETPACK_GOAL_SIZE 1500 // Explosion Size for goal triggering
#define WEAP_DETPACK_BITS_NO 12 // Bits that detpack explodes into
// Tranquiliser Gun
#define TRANQ_TIME 15
@ -670,7 +653,7 @@ enum
#define PC_SOLDIER_INITAMMO_ROCKET 10
#define PC_SOLDIER_GRENADE_TYPE_1 GR_TYPE_NORMAL
#define PC_SOLDIER_GRENADE_TYPE_2 GR_TYPE_NAIL
#define PC_SOLDIER_GRENADE_INIT_1 2
#define PC_SOLDIER_GRENADE_INIT_1 4
#define PC_SOLDIER_GRENADE_INIT_2 1
#define PC_SOLDIER_TF_ITEMS 0
@ -681,34 +664,6 @@ enum
#define MAX_CONCUSSION_GRENS 3
#define MAX_CALTROP_CANS 3
// Class Details for DEMOLITION MAN
#define PC_DEMOMAN_SKIN 1
#define PC_DEMOMAN_MAXHEALTH 90
#define PC_DEMOMAN_MAXSPEED 280
#define PC_DEMOMAN_MAXSTRAFESPEED 280
#define PC_DEMOMAN_MAXARMOR 120
#define PC_DEMOMAN_INITARMOR 50
#define PC_DEMOMAN_MAXARMORTYPE 0.6
#define PC_DEMOMAN_INITARMORTYPE 0.6
#define PC_DEMOMAN_ARMORCLASSES 31 // ALL
#define PC_DEMOMAN_INITARMORCLASS 0
#define PC_DEMOMAN_WEAPONS WEAP_AXE | WEAP_SHOTGUN | WEAP_GRENADE_LAUNCHER | WEAP_DETPACK
#define PC_DEMOMAN_MAXAMMO_SHOT 75
#define PC_DEMOMAN_MAXAMMO_NAIL 50
#define PC_DEMOMAN_MAXAMMO_CELL 50
#define PC_DEMOMAN_MAXAMMO_ROCKET 50
#define PC_DEMOMAN_MAXAMMO_DETPACK 1
#define PC_DEMOMAN_INITAMMO_SHOT 30
#define PC_DEMOMAN_INITAMMO_NAIL 0
#define PC_DEMOMAN_INITAMMO_CELL 0
#define PC_DEMOMAN_INITAMMO_ROCKET 20
#define PC_DEMOMAN_INITAMMO_DETPACK 1
#define PC_DEMOMAN_GRENADE_TYPE_1 GR_TYPE_NORMAL
#define PC_DEMOMAN_GRENADE_TYPE_2 GR_TYPE_MIRV
#define PC_DEMOMAN_GRENADE_INIT_1 2
#define PC_DEMOMAN_GRENADE_INIT_2 2
#define PC_DEMOMAN_TF_ITEMS 0
// Class Details for COMBAT MEDIC
#define PC_MEDIC_SKIN 3
#define PC_MEDIC_MAXHEALTH 90
@ -733,7 +688,7 @@ enum
#define PC_MEDIC_INITAMMO_MEDIKIT 50
#define PC_MEDIC_GRENADE_TYPE_1 GR_TYPE_NORMAL
#define PC_MEDIC_GRENADE_TYPE_2 GR_TYPE_CONCUSSION
#define PC_MEDIC_GRENADE_INIT_1 2
#define PC_MEDIC_GRENADE_INIT_1 3
#define PC_MEDIC_GRENADE_INIT_2 2
#define PC_MEDIC_TF_ITEMS 0
#define PC_MEDIC_REGEN_TIME 3 // Number of seconds between each regen.
@ -761,7 +716,7 @@ enum
#define PC_HVYWEAP_INITAMMO_ROCKET 0
#define PC_HVYWEAP_GRENADE_TYPE_1 GR_TYPE_NORMAL
#define PC_HVYWEAP_GRENADE_TYPE_2 GR_TYPE_MIRV
#define PC_HVYWEAP_GRENADE_INIT_1 2
#define PC_HVYWEAP_GRENADE_INIT_1 4
#define PC_HVYWEAP_GRENADE_INIT_2 1
#define PC_HVYWEAP_TF_ITEMS 0
#define PC_HVYWEAP_CELL_USAGE 7 // Amount of cells spent to power up assault cannon
@ -790,7 +745,7 @@ enum
#define PC_PYRO_INITAMMO_ROCKET 5
#define PC_PYRO_GRENADE_TYPE_1 GR_TYPE_NORMAL
#define PC_PYRO_GRENADE_TYPE_2 GR_TYPE_NAPALM
#define PC_PYRO_GRENADE_INIT_1 2
#define PC_PYRO_GRENADE_INIT_1 1
#define PC_PYRO_GRENADE_INIT_2 4
#define PC_PYRO_TF_ITEMS 0
#define PC_PYRO_ROCKET_USAGE 3 // Number of rockets per incendiary cannon shot
@ -885,7 +840,6 @@ enum
// for complete descriptions.
// Defines for Goal Activation types : goal_activation (in goals)
#define TFGA_TOUCH 1 // Activated when touched
#define TFGA_TOUCH_DETPACK 2 // Activated when touched by a detpack explosion
#define TFGA_REVERSE_AP 4 // Activated when AP details are _not_ met
#define TFGA_SPANNER 8 // Activated when hit by an engineer's spanner
#define TFGA_DROPTOGROUND 2048 // Drop to Ground when spawning
@ -974,7 +928,7 @@ enum
/*==========================================================================*/
/* Flamethrower */
/*==========================================================================*/
#define FLAME_PLYRMAXTIME 5.0 // lifetime in seconds of a flame on a player
#define FLAME_PLYRMAXTIME 4.5 // lifetime in seconds of a flame on a player
#define FLAME_MAXBURNTIME 8 // lifetime in seconds of a flame on the world (big ones)
#define NAPALM_MAXBURNTIME 20 // lifetime in seconds of flame from a napalm grenade
#define FLAME_MAXPLYRFLAMES 4 // maximum number of flames on a player
@ -984,7 +938,6 @@ enum
#define FLAME_DAMAGE_TIME 1 // Interval between damage burns from flames
#define FLAME_EFFECT_TIME 0.2 // frequency at which we display flame effects.
#define FLAME_THINK_TIME 0.1 // Seconds between times the flame checks burn
#define PER_FLAME_DAMAGE 2 // Damage taken per second per flame by burning players
/*==================================================*/
/* CTF Support defines */
@ -1041,11 +994,9 @@ float already_chosen_map;
#define DMSG_GREN_NAIL 9
#define DMSG_GREN_MIRV 10
#define DMSG_GREN_PIPE 11
#define DMSG_DETPACK 12
#define DMSG_BIOWEAPON 13
#define DMSG_BIOWEAPON_ATT 14
#define DMSG_FLAME 15
#define DMSG_DETPACK_DIS 16
#define DMSG_AXE 17
#define DMSG_SNIPERRIFLE 18
#define DMSG_AUTORIFLE 19
@ -1102,25 +1053,11 @@ float already_chosen_map;
#define MENU_DEFAULT 1
#define MENU_TEAM 2
#define MENU_CLASS 3
#define MENU_MAPBRIEFING 4
#define MENU_INTRO 5
#define MENU_CLASSHELP 6
#define MENU_CLASSHELP2 7
#define MENU_REPEATHELP 8
#define MENU_ITEMSELECTION 9
#define MENU_SPECHELP 9
#define MENU_SPY 12
#define MENU_SPY_SKIN 13
#define MENU_SPY_COLOR 14
#define MENU_ENGINEER 15
#define MENU_ENGINEER_FIX_DISPENSER 16
#define MENU_ENGINEER_FIX_SENTRYGUN 17
#define MENU_ENGINEER_FIX_MORTAR 18
#define MENU_DISPENSER 19
#define MENU_CLASS_CHANGE 20
#define MENU_TEAM_CHANGE 21
#define MENU_REFRESH_RATE 25
@ -1138,17 +1075,13 @@ float already_chosen_map;
#define TF_TIMER_REGENERATION 6
#define TF_TIMER_GRENPRIME 7
#define TF_TIMER_CELLREGENERATION 8
#define TF_TIMER_DETPACKSET 9
#define TF_TIMER_DETPACKDISARM 10
#define TF_TIMER_BUILD 11
#define TF_TIMER_CHECKBUILDDISTANCE 12
#define TF_TIMER_DISGUISE 13
#define TF_TIMER_DISPENSERREFILL 14
// Non Player timers
#define TF_TIMER_RETURNITEM 100
#define TF_TIMER_DELAYEDGOAL 101
#define TF_TIMER_ENDROUND 102
//============================
// Teamscore printing
@ -1157,14 +1090,6 @@ float already_chosen_map;
#define TS_PRINT_LONG_TO_ALL 3
#ifndef TF_DEFS_ONLY
typedef struct
{
int topColor;
int bottomColor;
} team_color_t;
/*==================================================*/
/* GLOBAL VARIABLES */
/*==================================================*/
@ -1173,9 +1098,7 @@ extern float number_of_teams; // number of teams supported by the map
extern int illegalclasses[5]; // Illegal playerclasses for all teams
extern int civilianteams; // Bitfield holding Civilian teams
extern Vector rgbcolors[5]; // RGB colors for each of the 4 teams
extern team_color_t teamcolors[5][PC_LASTCLASS]; // Colors for each of the 4 teams
extern int teamcolors[5]; // Colours for each of the 4 teams
extern int teamscores[5]; // Goal Score of each team
extern int g_iOrderedTeams[5]; // Teams ordered into order of winners->losers
extern int teamfrags[5]; // Total Frags for each team
@ -1204,7 +1127,6 @@ extern float old_grens;
extern float flagem_checked;
extern float flNextEqualisationCalc;
extern BOOL cease_fire;
extern BOOL no_cease_fire_text;
extern BOOL initial_cease_fire;
extern BOOL last_cease_fire;
// Autokick stuff
@ -1215,8 +1137,7 @@ extern float deathmsg; // Global, which is set before every T_Damage, to indica
extern char *sTeamSpawnNames[];
extern char *sClassNames[];
extern char *sNewClassModelFiles[];
extern char *sOldClassModelFiles[];
extern char *sClassModelFiles[];
extern char *sClassModels[];
extern char *sClassCfgs[];
extern char *sGrenadeNames[];
@ -1295,8 +1216,7 @@ extern cvar_t tfc_spam_penalty2;// incremental gag penalty (seconds) for each ti
extern cvar_t tfc_spam_limit; // at this many points, gag the spammer
extern cvar_t tfc_clanbattle, tfc_clanbattle_prematch, tfc_prematch, tfc_clanbattle_ceasefire, tfc_balance_teams, tfc_balance_scores;
extern cvar_t tfc_clanbattle_locked, tfc_birthday, tfc_autokick_kills, tfc_fragscoring, tfc_autokick_time, tfc_adminpwd;
extern cvar_t weaponstay, footsteps, flashlight, aimcrosshair, falldamage, teamplay;
extern cvar_t allow_spectators;
extern cvar_t weaponstay, flashlight, aimcrosshair, teamplay;
/*==========================================================================*/
class CTFFlame : public CBaseMonster
@ -1347,11 +1267,7 @@ class CTFSpawn : public CBaseEntity
{
public:
void Spawn( void );
void Activate( void );
int Classify ( void ) { return CLASS_TFSPAWN; }
BOOL CheckTeam( int iTeamNo );
EHANDLE m_pTeamCheck;
};
class CTFDetect : public CBaseEntity
@ -1368,21 +1284,6 @@ public:
void EXPORT DeathTouch( CBaseEntity *pOther );
};
class CTeamCheck : public CBaseDelay
{
public:
void Spawn( void );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
BOOL TeamMatches( int iTeam );
};
class CTeamSet : public CBaseDelay
{
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

@ -0,0 +1,340 @@
/***
*
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
/*
==========================
This file contains "stubs" of class member implementations so that we can predict certain
weapons client side. From time to time you might find that you need to implement part of the
these functions. If so, cut it from here, paste it in hl_weapons.cpp or somewhere else and
add in the functionality you need.
==========================
*/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "player.h"
#include "weapons.h"
#include "nodes.h"
#include "soundent.h"
// Globals used by game logic
const Vector g_vecZero = Vector( 0, 0, 0 );
int gmsgWeapPickup = 0;
enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals;
ItemInfo CBasePlayerItem::ItemInfoArray[MAX_WEAPONS];
void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch) { }
// CBaseEntity Stubs
int CBaseEntity :: TakeHealth( float flHealth, int bitsDamageType ) { return 1; }
int CBaseEntity :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType ) { return 1; }
CBaseEntity *CBaseEntity::GetNextTarget( void ) { return NULL; }
int CBaseEntity::Save( CSave &save ) { return 1; }
int CBaseEntity::Restore( CRestore &restore ) { return 1; }
void CBaseEntity::SetObjectCollisionBox( void ) { }
int CBaseEntity :: Intersects( CBaseEntity *pOther ) { return 0; }
void CBaseEntity :: MakeDormant( void ) { }
int CBaseEntity :: IsDormant( void ) { return 0; }
BOOL CBaseEntity :: IsInWorld( void ) { return TRUE; }
int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState ) { return 0; }
int CBaseEntity :: DamageDecal( int bitsDamageType ) { return -1; }
CBaseEntity * CBaseEntity::Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { return NULL; }
void CBaseEntity::SUB_Remove( void ) { }
// CBaseDelay Stubs
void CBaseDelay :: KeyValue( struct KeyValueData_s * ) { }
int CBaseDelay::Restore( class CRestore & ) { return 1; }
int CBaseDelay::Save( class CSave & ) { return 1; }
// CBaseAnimating Stubs
int CBaseAnimating::Restore( class CRestore & ) { return 1; }
int CBaseAnimating::Save( class CSave & ) { return 1; }
// DEBUG Stubs
edict_t *DBG_EntOfVars( const entvars_t *pev ) { return NULL; }
void DBG_AssertFunction(BOOL fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage) { }
// UTIL_* Stubs
void UTIL_PrecacheOther( const char *szClassname ) { }
void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) { }
void UTIL_DecalTrace( TraceResult *pTrace, int decalNumber ) { }
void UTIL_GunshotDecalTrace( TraceResult *pTrace, int decalNumber ) { }
void UTIL_MakeVectors( const Vector &vecAngles ) { }
BOOL UTIL_IsValidEntity( edict_t *pent ) { return TRUE; }
void UTIL_SetOrigin( entvars_t *, const Vector &org ) { }
BOOL UTIL_GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon ) { return TRUE; }
void UTIL_LogPrintf(char *,...) { }
void UTIL_ClientPrintAll( int,char const *,char const *,char const *,char const *,char const *) { }
void ClientPrint( entvars_t *client, int msg_dest, const char *msg_name, const char *param1, const char *param2, const char *param3, const char *param4 ) { }
// CBaseToggle Stubs
int CBaseToggle::Restore( class CRestore & ) { return 1; }
int CBaseToggle::Save( class CSave & ) { return 1; }
void CBaseToggle :: KeyValue( struct KeyValueData_s * ) { }
// CGrenade Stubs
void CGrenade::BounceSound( void ) { }
void CGrenade::Explode( Vector, Vector ) { }
void CGrenade::Explode( TraceResult *, int ) { }
void CGrenade::Killed( entvars_t *, int ) { }
void CGrenade::Spawn( void ) { }
CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time ){ return 0; }
CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ){ return 0; }
void CGrenade::DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ){ }
void UTIL_Remove( CBaseEntity *pEntity ){ }
void UTIL_SetSize( entvars_t *pev, const Vector &vecMin, const Vector &vecMax ){ }
CBaseEntity *UTIL_FindEntityInSphere( CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius ){ return 0;}
Vector UTIL_VecToAngles( const Vector &vec ){ return 0; }
CSprite *CSprite::SpriteCreate( const char *pSpriteName, const Vector &origin, BOOL animate ) { return 0; }
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; }
void CBaseMonster :: Listen ( void ) { }
float CBaseMonster :: FLSoundVolume ( CSound *pSound ) { return 0.0; }
BOOL CBaseMonster :: FValidateHintType ( short sHint ) { return FALSE; }
void CBaseMonster :: Look ( int iDistance ) { }
int CBaseMonster :: ISoundMask ( void ) { return 0; }
CSound* CBaseMonster :: PBestSound ( void ) { return NULL; }
CSound* CBaseMonster :: PBestScent ( void ) { return NULL; }
float CBaseAnimating :: StudioFrameAdvance ( float flInterval ) { return 0.0; }
void CBaseMonster :: MonsterThink ( void ) { }
void CBaseMonster :: MonsterUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { }
int CBaseMonster :: IgnoreConditions ( void ) { return 0; }
void CBaseMonster :: RouteClear ( void ) { }
void CBaseMonster :: RouteNew ( void ) { }
BOOL CBaseMonster :: FRouteClear ( void ) { return FALSE; }
BOOL CBaseMonster :: FRefreshRoute ( void ) { return 0; }
BOOL CBaseMonster::MoveToEnemy( Activity movementAct, float waitTime ) { return FALSE; }
BOOL CBaseMonster::MoveToLocation( Activity movementAct, float waitTime, const Vector &goal ) { return FALSE; }
BOOL CBaseMonster::MoveToTarget( Activity movementAct, float waitTime ) { return FALSE; }
BOOL CBaseMonster::MoveToNode( Activity movementAct, float waitTime, const Vector &goal ) { return FALSE; }
int ShouldSimplify( int routeType ) { return TRUE; }
void CBaseMonster :: RouteSimplify( CBaseEntity *pTargetEnt ) { }
BOOL CBaseMonster :: FBecomeProne ( void ) { return TRUE; }
BOOL CBaseMonster :: CheckRangeAttack1 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckRangeAttack2 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckMeleeAttack1 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckMeleeAttack2 ( float flDot, float flDist ) { return FALSE; }
void CBaseMonster :: CheckAttacks ( CBaseEntity *pTarget, float flDist ) { }
BOOL CBaseMonster :: FCanCheckAttacks ( void ) { return FALSE; }
int CBaseMonster :: CheckEnemy ( CBaseEntity *pEnemy ) { return 0; }
void CBaseMonster :: PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos ) { }
BOOL CBaseMonster :: PopEnemy( ) { return FALSE; }
void CBaseMonster :: SetActivity ( Activity NewActivity ) { }
void CBaseMonster :: SetSequenceByName ( char *szSequence ) { }
int CBaseMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist ) { return 0; }
float CBaseMonster :: OpenDoorAndWait( entvars_t *pevDoor ) { return 0.0; }
void CBaseMonster :: AdvanceRoute ( float distance ) { }
int CBaseMonster :: RouteClassify( int iMoveFlag ) { return 0; }
BOOL CBaseMonster :: BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEntity *pTarget ) { return FALSE; }
void CBaseMonster :: InsertWaypoint ( Vector vecLocation, int afMoveFlags ) { }
BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEnd, float flDist, CBaseEntity *pTargetEnt, Vector *pApex ) { return FALSE; }
void CBaseMonster :: Move ( float flInterval ) { }
BOOL CBaseMonster:: ShouldAdvanceRoute( float flWaypointDist ) { return FALSE; }
void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flInterval ) { }
void CBaseMonster :: MonsterInit ( void ) { }
void CBaseMonster :: MonsterInitThink ( void ) { }
void CBaseMonster :: StartMonster ( void ) { }
void CBaseMonster :: MovementComplete( void ) { }
int CBaseMonster::TaskIsRunning( void ) { return 0; }
int CBaseMonster::IRelationship ( CBaseEntity *pTarget ) { return 0; }
BOOL CBaseMonster :: FindCover ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; }
BOOL CBaseMonster :: BuildNearestRoute ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; }
CBaseEntity *CBaseMonster :: BestVisibleEnemy ( void ) { return NULL; }
BOOL CBaseMonster :: FInViewCone ( CBaseEntity *pEntity ) { return FALSE; }
BOOL CBaseMonster :: FInViewCone ( Vector *pOrigin ) { return FALSE; }
BOOL CBaseEntity :: FVisible ( CBaseEntity *pEntity ) { return FALSE; }
BOOL CBaseEntity :: FVisible ( const Vector &vecOrigin ) { return FALSE; }
void CBaseMonster :: MakeIdealYaw( Vector vecTarget ) { }
float CBaseMonster::FlYawDiff ( void ) { return 0.0; }
float CBaseMonster::ChangeYaw ( int yawSpeed ) { return 0; }
float CBaseMonster::VecToYaw ( Vector vecDir ) { return 0.0; }
int CBaseAnimating :: LookupActivity ( int activity ) { return 0; }
int CBaseAnimating :: LookupActivityHeaviest ( int activity ) { return 0; }
void CBaseMonster :: SetEyePosition ( void ) { }
int CBaseAnimating :: LookupSequence ( const char *label ) { return 0; }
void CBaseAnimating :: ResetSequenceInfo ( ) { }
BOOL CBaseAnimating :: GetSequenceFlags( ) { return FALSE; }
void CBaseAnimating :: DispatchAnimEvents ( float flInterval ) { }
void CBaseMonster :: HandleAnimEvent( MonsterEvent_t *pEvent ) { }
float CBaseAnimating :: SetBoneController ( int iController, float flValue ) { return 0.0; }
void CBaseAnimating :: InitBoneControllers ( void ) { }
float CBaseAnimating :: SetBlending ( int iBlender, float flValue ) { return 0; }
void CBaseAnimating :: GetBonePosition ( int iBone, Vector &origin, Vector &angles ) { }
void CBaseAnimating :: GetAttachment ( int iAttachment, Vector &origin, Vector &angles ) { }
int CBaseAnimating :: FindTransition( int iEndingSequence, int iGoalSequence, int *piDir ) { return -1; }
void CBaseAnimating :: GetAutomovement( Vector &origin, Vector &angles, float flInterval ) { }
void CBaseAnimating :: SetBodygroup( int iGroup, int iValue ) { }
int CBaseAnimating :: GetBodygroup( int iGroup ) { return 0; }
Vector CBaseMonster :: GetGunPosition( void ) { return g_vecZero; }
void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType,int PenetrationValue) {}
void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker ) { }
void CBaseEntity :: TraceBleed( float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ) { }
void CBaseMonster :: MakeDamageBloodDecal ( int cCount, float flNoise, TraceResult *ptr, const Vector &vecDir ) { }
BOOL CBaseMonster :: FGetNodeRoute ( Vector vecDest ) { return TRUE; }
int CBaseMonster :: FindHintNode ( void ) { return NO_NODE; }
void CBaseMonster::ReportAIState( void ) { }
void CBaseMonster :: KeyValue( KeyValueData *pkvd ) { }
BOOL CBaseMonster :: FCheckAITrigger ( void ) { return FALSE; }
int CBaseMonster :: CanPlaySequence( BOOL fDisregardMonsterState, int interruptLevel ) { return FALSE; }
BOOL CBaseMonster :: FindLateralCover ( const Vector &vecThreat, const Vector &vecViewOffset ) { return FALSE; }
Vector CBaseMonster :: ShootAtEnemy( const Vector &shootOrigin ) { return g_vecZero; }
BOOL CBaseMonster :: FacingIdeal( void ) { return FALSE; }
BOOL CBaseMonster :: FCanActiveIdle ( void ) { return FALSE; }
void CBaseMonster::PlaySentence( const char *pszSentence, float duration, float volume, float attenuation ) { }
void CBaseMonster::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener ) { }
void CBaseMonster::SentenceStop( void ) { }
void CBaseMonster::CorpseFallThink( void ) { }
void CBaseMonster :: MonsterInitDead( void ) { }
BOOL CBaseMonster :: BBoxFlat ( void ) { return TRUE; }
BOOL CBaseMonster :: GetEnemy ( void ) { return FALSE; }
void CBaseMonster :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType,int PenetrationValue) { }
CBaseEntity* CBaseMonster :: DropItem ( char *pszItemName, const Vector &vecPos, const Vector &vecAng ) { return NULL; }
BOOL CBaseMonster :: ShouldFadeOnDeath( void ) { return FALSE; }
void CBaseMonster :: RadiusDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
void CBaseMonster :: RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
void CBaseMonster::FadeMonster( void ) { }
void CBaseMonster :: GibMonster( void ) { }
BOOL CBaseMonster :: HasHumanGibs( void ) { return FALSE; }
BOOL CBaseMonster :: HasAlienGibs( void ) { return FALSE; }
Activity CBaseMonster :: GetDeathActivity ( void ) { return ACT_DIE_HEADSHOT; }
void CBaseMonster :: RunTask ( Task_t *pTask ) { }
void CBaseMonster :: StartTask ( Task_t *pTask ) { }
void CBaseMonster::BecomeDead( void ) {}
void CBaseMonster :: Killed( entvars_t *pevAttacker, int iGib) {}
int CBaseMonster :: TakeHealth (float flHealth, int bitsDamageType) { return 0; }
int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
int CBaseMonster::Restore( class CRestore & ) { return 1; }
int CBaseMonster::Save( class CSave & ) { return 1; }
int TrainSpeed(int iSpeed, int iMax) { return 0; }
CPlayerInventory::CPlayerInventory(){}
BOOL CPlayerInventory::SetInventory(int Slot,int Index){ return FALSE; }
void CPlayerInventory::SpawnInventory(CBasePlayer *pPlayer){}
void CPlayerInventory::SetRandom( BOOL b ){}
playeritemlist_t *CPlayerInventory::GetListForSlot( int Slot ){ return NULL; }
void CBasePlayer :: DeathSound( void ) { }
int CBasePlayer :: TakeHealth( float flHealth, int bitsDamageType ) { return 0; }
void CBasePlayer :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType,int PenetrationValue) {}
int CBasePlayer :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
void CBasePlayer::PackDeadPlayerItems( void ) { }
void CBasePlayer::RemoveAllItems( void ) { }
void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim ) { }
void CBasePlayer::WaterMove() { }
BOOL CBasePlayer::IsOnLadder( void ) { return FALSE; }
void CBasePlayer::PlayerDeathThink(void) { }
void CBasePlayer::StartDeathCam( void ) { }
void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) { }
void CBasePlayer::PlayerUse ( void ) { }
void CBasePlayer::Jump() { }
void CBasePlayer::Duck( ) { }
int CBasePlayer::Classify ( void ) { return 0; }
void CBasePlayer::PreThink(void) { }
void CBasePlayer::CheckTimeBasedDamage() { }
void CBasePlayer :: UpdatePlayerSound ( void ) { }
void CBasePlayer :: Precache( void ) { }
int CBasePlayer::Save( CSave &save ) { return 0; }
void CBasePlayer::RenewItems(void) { }
int CBasePlayer::Restore( CRestore &restore ) { return 0; }
void CBasePlayer::SelectNextItem( int iItem ) { }
BOOL CBasePlayer::HasWeapons( void ) { return FALSE; }
void CBasePlayer::SelectPrevItem( int iItem ) { }
CBaseEntity *FindEntityForward( CBaseEntity *pMe ) { return NULL; }
BOOL CBasePlayer :: FlashlightIsOn( void ) { return FALSE; }
void CBasePlayer :: FlashlightTurnOn( void ) { }
void CBasePlayer :: FlashlightTurnOff( void ) { }
void CBasePlayer :: ForceClientDllUpdate( void ) { }
void CBasePlayer::ImpulseCommands( ) { }
void CBasePlayer::CheatImpulseCommands( int iImpulse ) { }
int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
void CBasePlayer::ItemPreFrame() { }
void CBasePlayer::ItemPostFrame() { }
void CBasePlayer::PostThink(){ }
float CBasePlayer::flCalculateInventoryWeight(){ return 1; }
int CBasePlayer::AmmoInventory( int iAmmoIndex ) { return -1; }
int CBasePlayer::GetAmmoIndex(const char *psz) { return -1; }
void CBasePlayer::SendAmmoUpdate(void) { }
void CBasePlayer :: UpdateClientData( void ) { }
BOOL CBasePlayer :: FBecomeProne ( void ) { return TRUE; }
int CBasePlayer :: Illumination( void ) { return 0; }
void CBasePlayer :: EnableControl(BOOL fControl) { }
Vector CBasePlayer :: GetAutoaimVector( float flDelta ) { return g_vecZero; }
Vector CBasePlayer :: AutoaimDeflection( Vector &vecSrc, float flDist, float flDelta ) { return g_vecZero; }
void CBasePlayer :: ResetAutoaim( ) { }
void CBasePlayer :: SetCustomDecalFrames( int nFrames ) { }
int CBasePlayer :: GetCustomDecalFrames( void ) { return -1; }
void CBasePlayer::DropPlayerItem ( char *pszItemName ) { }
BOOL CBasePlayer::HasPlayerItem( CBasePlayerItem *pCheckItem ) { return FALSE; }
BOOL CBasePlayer :: SwitchWeapon( CBasePlayerItem *pWeapon ) { return FALSE; }
Vector CBasePlayer :: GetGunPosition( void ) { return g_vecZero; }
const char *CBasePlayer::TeamID( void ) { return ""; }
int CBasePlayer :: GiveAmmo( int iCount, char *szName, int iMax ) { return 0; }
void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore ) { }
void CBasePlayer::AddPointsToTeam( int score, BOOL bAllowNegativeScore ) { }
void ClearMultiDamage(void) { }
void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker ) { }
void AddMultiDamage( entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType) { }
void SpawnBlood(Vector vecSpot, int bloodColor, float flDamage) { }
int DamageDecal( CBaseEntity *pEntity, int bitsDamageType ) { return 0; }
void DecalGunshot( TraceResult *pTrace, int iBulletType ) { }
void EjectBrass ( const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype ) { }
void AddAmmoNameToAmmoRegistry( const char *szAmmoname ) { }
int CBasePlayerItem::Restore( class CRestore & ) { return 1; }
int CBasePlayerItem::Save( class CSave & ) { return 1; }
int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; }
int CBasePlayerWeapon::Save( class CSave & ) { return 1; }
void CBasePlayerItem :: SetObjectCollisionBox( void ) { }
void CBasePlayerItem :: FallInit( void ) { }
void CBasePlayerItem::FallThink ( void ) { }
void CBasePlayerItem::Materialize( void ) { }
void CBasePlayerItem::AttemptToMaterialize( void ) { }
void CBasePlayerItem :: CheckRespawn ( void ) { }
CBaseEntity* CBasePlayerItem::Respawn( void ) { return NULL; }
void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther ) { }
void CBasePlayerItem::DestroyItem( void ) { }
int CBasePlayerItem::AddToPlayer( CBasePlayer *pPlayer ) { return TRUE; }
void CBasePlayerItem::Drop( void ) { }
void CBasePlayerItem::Kill( void ) { }
void CBasePlayerItem::Holster( int skiplocal ) { }
void CBasePlayerItem::AttachToPlayer ( CBasePlayer *pPlayer ) { }
int CBasePlayerWeapon::AddDuplicate( CBasePlayerItem *pOriginal ) { return 0; }
int CBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer ) { return FALSE; }
int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer ) { return 0; }
BOOL CBasePlayerWeapon :: AddPrimaryAmmo( int iCount, char *szName, int iMaxClip, int iMaxCarry ) { return TRUE; }
BOOL CBasePlayerWeapon :: AddSecondaryAmmo( int iCount, char *szName, int iMax ) { return TRUE; }
BOOL CBasePlayerWeapon :: IsUseable( void ) { return TRUE; }
int CBasePlayerWeapon::PrimaryAmmoIndex( void ) { return -1; }
int CBasePlayerWeapon::SecondaryAmmoIndex( void ) { return -1; }
void CBasePlayerAmmo::Spawn( void ) { }
CBaseEntity* CBasePlayerAmmo::Respawn( void ) { return this; }
void CBasePlayerAmmo::Materialize( void ) { }
void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther ) { }
int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon ) { return 0; }
int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0; }
void CBasePlayerWeapon::RetireWeapon( void ) { }
void CSoundEnt::InsertSound ( int iType, const Vector &vecOrigin, int iVolume, float flDuration ) {}
void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType ){}

View file

@ -0,0 +1,95 @@
/***
*
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#include "../hud.h"
#include "../cl_util.h"
#include "event_api.h"
extern "C"
{
// Events
void EV_BerettaShoot (struct event_args_s *args);
void EV_ColtShoot (struct event_args_s *args);
void EV_DeagleShoot (struct event_args_s *args);
void EV_RugerShoot (struct event_args_s *args);
void EV_HandcannonShoot(struct event_args_s *args);
void EV_SawedOffShoot (struct event_args_s *args);
void EV_MossbergShoot (struct event_args_s *args);
void EV_WinchesterShoot(struct event_args_s *args);
void EV_Smg9Shoot (struct event_args_s *args);
void EV_FnFalShoot (struct event_args_s *args);
void EV_TommyGunShoot (struct event_args_s *args);
void EV_JackHammerShoot(struct event_args_s *args);
void EV_G11Shoot (struct event_args_s *args);
void EV_BoltRifleShoot (struct event_args_s *args);
void EV_StenShoot (struct event_args_s *args);
void EV_MolotovCocktail(struct event_args_s *args);
void EV_FragGrenade (struct event_args_s *args);
void EV_Pipebomb (struct event_args_s *args);
void EV_CombatKnife (struct event_args_s *args);
void EV_BaseballBat (struct event_args_s *args);
void EV_SledgeHammer (struct event_args_s *args);
void EV_Katana (struct event_args_s *args);
void EV_Spear (struct event_args_s *args);
void EV_CattleProd (struct event_args_s *args);
void EV_AkimboBerettas (struct event_args_s *args);
void EV_AkimboColts (struct event_args_s *args);
void EV_AkimboDeagles (struct event_args_s *args);
void EV_AkimboSawedOffs(struct event_args_s *args);
}
/*
======================
Game_HookEvents
Associate script file name with callback functions. Callback's must be extern "C" so
the engine doesn't get confused about name mangling stuff. Note that the format is
always the same. Of course, a clever mod team could actually embed parameters, behavior
into the actual .sc files and create a .sc file parser and hook their functionality through
that.. i.e., a scripting system.
That was what we were going to do, but we ran out of time...oh well.
======================
*/
void Game_HookEvents( void )
{
gEngfuncs.pfnHookEvent( "events/beretta.sc", EV_BerettaShoot );
gEngfuncs.pfnHookEvent( "events/colt.sc", EV_ColtShoot );
gEngfuncs.pfnHookEvent( "events/deagle.sc", EV_DeagleShoot );
gEngfuncs.pfnHookEvent( "events/ruger.sc", EV_RugerShoot );
gEngfuncs.pfnHookEvent( "events/handcannon.sc", EV_HandcannonShoot );
gEngfuncs.pfnHookEvent( "events/sawedoff.sc", EV_SawedOffShoot );
gEngfuncs.pfnHookEvent( "events/mossberg.sc", EV_MossbergShoot );
gEngfuncs.pfnHookEvent( "events/winchester.sc", EV_WinchesterShoot );
gEngfuncs.pfnHookEvent( "events/smg9.sc", EV_Smg9Shoot );
gEngfuncs.pfnHookEvent( "events/fnfal.sc", EV_FnFalShoot );
gEngfuncs.pfnHookEvent( "events/tommygun.sc", EV_TommyGunShoot );
gEngfuncs.pfnHookEvent( "events/jackhammer.sc", EV_JackHammerShoot );
gEngfuncs.pfnHookEvent( "events/g11.sc", EV_G11Shoot );
gEngfuncs.pfnHookEvent( "events/boltrifle.sc", EV_BoltRifleShoot );
gEngfuncs.pfnHookEvent( "events/sten.sc", EV_StenShoot );
gEngfuncs.pfnHookEvent( "events/molotovcocktail.sc", EV_MolotovCocktail );
gEngfuncs.pfnHookEvent( "events/fraggrenade.sc", EV_FragGrenade );
gEngfuncs.pfnHookEvent( "events/pipebomb.sc", EV_Pipebomb );
gEngfuncs.pfnHookEvent( "events/combatknife.sc", EV_CombatKnife );
gEngfuncs.pfnHookEvent( "events/baseballbat.sc", EV_BaseballBat );
gEngfuncs.pfnHookEvent( "events/sledgehammer.sc", EV_SledgeHammer );
gEngfuncs.pfnHookEvent( "events/katana.sc", EV_Katana );
gEngfuncs.pfnHookEvent( "events/spear.sc", EV_Spear );
gEngfuncs.pfnHookEvent( "events/cattleprod.sc", EV_CattleProd );
gEngfuncs.pfnHookEvent( "events/akimboberettas.sc", EV_AkimboBerettas );
gEngfuncs.pfnHookEvent( "events/akimbocolts.sc", EV_AkimboColts );
gEngfuncs.pfnHookEvent( "events/akimbodeagles.sc", EV_AkimboDeagles );
gEngfuncs.pfnHookEvent( "events/akimbosawedoffs.sc", EV_AkimboSawedOffs );
}

View file

@ -0,0 +1,151 @@
/***
*
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#include "../hud.h"
#include "../cl_util.h"
#include "../demo.h"
#include "demo_api.h"
#include "const.h"
#include "entity_state.h"
#include "cl_entity.h"
#include "pm_defs.h"
#include "event_api.h"
#include "entity_types.h"
#include "r_efx.h"
#include "twm.h"
#include "../twmmanager.h"
#include "../ParseBspEnt.h"
#include "../ParseBsp.h"
#include "../tri.h"
#include "../ParticleBase.h"
extern cvar_t *cl_enablefog;
int EnvFog_SetFog();
void HUD_GetLastOrg( float *org );
void UpdateBeams ( void )
{
vec3_t forward, vecSrc, vecEnd, origin, angles, right, up;
vec3_t view_ofs;
pmtrace_t tr;
cl_entity_t *pthisplayer = gEngfuncs.GetLocalPlayer();
int idx = pthisplayer->index;
// Get our exact viewangles from engine
gEngfuncs.GetViewAngles( (float *)angles );
// Determine our last predicted origin
HUD_GetLastOrg( (float *)&origin );
AngleVectors( angles, forward, right, up );
VectorCopy( origin, vecSrc );
VectorMA( vecSrc, 2048, forward, vecEnd );
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );
// Store off the old count
gEngfuncs.pEventAPI->EV_PushPMStates();
// Now add in all of the players.
gEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );
gEngfuncs.pEventAPI->EV_PopPMStates();
}
void Game_CrosshairInfo()
{
vec3_t angles,origin,forward,right,up,src,dest;
pmtrace_t tr;
cl_entity_t *pLocalPlayer = gEngfuncs.GetLocalPlayer();
int idx = pLocalPlayer->index;
// Get player's origin and angle
gEngfuncs.GetViewAngles((float*)&angles);
HUD_GetLastOrg((float*)&origin);
AngleVectors(angles,forward,right,up);
// Set up source and dest vectors
VectorCopy(origin,src);
VectorMA(src,128,forward,dest);
// Trace ahead to find a player
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction(false,true);
// Store off the old count
gEngfuncs.pEventAPI->EV_PushPMStates();
// Now add in all of the players.
gEngfuncs.pEventAPI->EV_SetSolidPlayers(idx - 1);
gEngfuncs.pEventAPI->EV_SetTraceHull(2);
gEngfuncs.pEventAPI->EV_PlayerTrace(src,dest,PM_STUDIO_BOX,-1,&tr);
gEngfuncs.pEventAPI->EV_PopPMStates();
// We hit something
if(tr.fraction != 1.0f)
gHUD.m_CrosshairInfo.UpdateInfo(tr.ent);
}
/*
=====================
Game_AddObjects
Add game specific, client-side objects here
=====================
*/
void Game_AddObjects( void )
{
}
/*
=====================
Game_UpdateObjects
Update info needed
=====================
*/
void Game_UpdateObjects(double frametime)
{
// Update particles
g_ParticleSystemManager.Update( frametime );
// Update crosshair
Game_CrosshairInfo();
// Update 3d muzzleflashes
TWM_UPDATE_ARRAY(g_MuzzleflashModels,g_iNumMuzzleflashModels,frametime);
// Update fog
if(!EnvFog_SetFog())
{
R_SetFog(g_Worldspawn.flFogcolor_r,
g_Worldspawn.flFogcolor_g,
g_Worldspawn.flFogcolor_b,
g_Worldspawn.flFogcolor_start,
g_Worldspawn.flFogcolor_end,
cl_enablefog->value ? g_Worldspawn.iEnableFog : 0);
}
}

File diff suppressed because it is too large Load diff

393
cl_dll/thewastes_hud.cpp Normal file
View file

@ -0,0 +1,393 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
//
// thewastes_hud.cpp
//
#include "STDIO.H"
#include "STDLIB.H"
#include "MATH.H"
#include <string.h>
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include "cl_entity.h"
#include "tw_common.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#define MAX_CLIENTS 32
/*
===================
CrosshairInfo
===================
*/
int CCrosshairInfo::Init()
{
m_iFlags |= HUD_ACTIVE;
gHUD.AddHudElem(this);
m_flCenterTime = 0.0f;
strcpy(m_szCenterName,"");
return 1;
}
int CCrosshairInfo::VidInit()
{
return 1;
}
// We do this client side now ;)
int CCrosshairInfo::Draw(float fTime)
{
// print in middle of screen
// TODO: Disabled until i can fix the code from
// flagging the wrong entities
/* if(!gHUD.m_iIntermission && gHUD.m_flTime < m_flCenterTime)
{
int x,y;
int width,height;
GetConsoleStringSize(m_szCenterName,&width,&height);
y = ScreenHeight * 0.55f;
x = ScreenWidth/2 - width/2;
DrawConsoleString(x,y,m_szCenterName);
}
*/
return 1;
}
void CCrosshairInfo::UpdateInfo(int index)
{
cl_entity_t *pEnt = gEngfuncs.GetEntityByIndex(index);
gViewPort->GetAllPlayersInfo();
if(pEnt == NULL)
return;
// Player checks
if(!pEnt->player || pEnt == gEngfuncs.GetLocalPlayer())
return;
sprintf(m_szCenterName,"%s (%i%%)",g_PlayerInfoList[pEnt->index].name,pEnt->curstate.health);
m_flCenterTime = gHUD.m_flTime + 0.25f;
}
/*
===================
PlayerState
===================
*/
DECLARE_MESSAGE(m_PlayerState,PlayerState);
int CHudPlayerState::Init()
{
m_iFlags |= HUD_ACTIVE;
gHUD.AddHudElem(this);
HOOK_MESSAGE(PlayerState);
return 1;
}
int CHudPlayerState::VidInit()
{
m_iActiveSprite = 0;
m_HUD_bleeding = gHUD.GetSpriteIndex("bleeding");
m_HUD_composure = gHUD.GetSpriteIndex("composure");
m_HUD_willpower = gHUD.GetSpriteIndex("willpower");
return 1;
}
int CHudPlayerState::Draw(float fTime)
{
if(gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH)
return 1;
if(gHUD.m_Health.m_iHealth >= 100 || gHUD.m_Health.m_iHealth <= 0)
return 1;
int r,g,b,x,y;
wrect_t *prc;
int cursprite;
switch(m_iActiveSprite)
{
case 0: return 1;
case 1: cursprite = m_HUD_composure; break;
case 2: cursprite = m_HUD_bleeding; break;
case 3: cursprite = m_HUD_willpower; break;
}
UnpackRGB(r,g,b,RGB_WHITE);
ScaleColors(r,g,b,225);
prc = &gHUD.GetSpriteRect(cursprite);
x = 5;
y = ScreenHeight / 2 - (prc->bottom - prc->top) / 2;
// Draw sprite
SPR_Set(gHUD.GetSprite(cursprite),r,g,b);
SPR_DrawHoles(0,x,y,prc);
return 1;
}
int CHudPlayerState::MsgFunc_PlayerState(const char *pszName,int iSize,void *pbuf)
{
BEGIN_READ(pbuf,iSize);
m_iActiveSprite = READ_BYTE();
return 1;
}
int CHudPlayerState::ActiveState()
{
return m_iActiveSprite;
}
/*
===================
Scope
===================
*/
int CHudScope::Init()
{
m_iFlags |= HUD_ACTIVE;
gHUD.AddHudElem(this);
return 1;
}
int CHudScope::VidInit()
{
m_h320Scope = SPR_Load("sprites/320scope.spr");
m_h640Scope = SPR_Load("sprites/640scope.spr");
m_h1280Scope = SPR_Load("sprites/1280scope.spr");
return 1;
}
void CHudScope::DrawScopePart(int frame,int x,int y,HSPRITE hSprite,wrect_t *rect)
{
SPR_Set(hSprite,255,255,255);
SPR_DrawHoles(frame,x,y,rect);
}
int CHudScope::Draw(float flTime)
{
if(gHUD.m_iHideHUDDisplay & HIDEHUD_ALL)
return 1;
// y Yes~
return 1;
int x,y;
int center_x,center_y;
wrect_t rect;
x = y = 0;
center_x = ScreenWidth / 2;
center_y = ScreenHeight / 2;
// We have a few scope sprites to choose from
// To match the best resolution
switch(ScreenWidth)
{
case 320:
// 320x240
rect = gHUD.GetSpriteRect(gHUD.GetSpriteIndex("320scope"));
DrawScopePart(0,0,0,m_h320Scope,&rect);
DrawScopePart(1,160,0,m_h320Scope,&rect);
DrawScopePart(1,0,120,m_h320Scope,&rect);
DrawScopePart(1,160,120,m_h320Scope,&rect);
break;
case 640:
case 800:
// 640x480
// 800x600
rect = gHUD.GetSpriteRect(gHUD.GetSpriteIndex("640scope"));
x = center_x - 160*2;
y = center_y - 240;
DrawScopePart(0,x,y,m_h640Scope,&rect);
x += 160;
DrawScopePart(1,x,y,m_h640Scope,&rect);
x += 160;
DrawScopePart(2,x,y,m_h640Scope,&rect);
x += 160;
DrawScopePart(3,x,y,m_h640Scope,&rect);
y += 240;
x = center_x - 160*2;
DrawScopePart(4,x,y,m_h640Scope,&rect);
x += 160;
DrawScopePart(5,x,y,m_h640Scope,&rect);
x += 160;
DrawScopePart(6,x,y,m_h640Scope,&rect);
x += 160;
DrawScopePart(7,x,y,m_h640Scope,&rect);
// Fill blank areas
{
int r,g,b,a;
r = g = b = 128;
a = 255;
ScaleColors(r, g, b, a );
FillRGBA(0,(ScreenHeight-480)/2,ScreenWidth/2-160*2,480,r,g,b,a);
FillRGBA(ScreenWidth-(ScreenWidth/2-160*2),(ScreenHeight-480)/2,ScreenWidth/2-160*2,480,r,g,b,a);
FillRGBA(0,0,ScreenWidth,(ScreenHeight-480)/2,r,g,b,a);
FillRGBA(0,ScreenHeight-((ScreenHeight-480)/2),ScreenWidth,(ScreenHeight-480)/2,r,g,b,a);
}
break;
case 1280:
case 1600:
// 1280x960
// 1600x1200
rect = gHUD.GetSpriteRect(gHUD.GetSpriteIndex("1280scope"));
x = 0;
DrawScopePart(0,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(1,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(2,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(3,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(4,x,y,m_h1280Scope,&rect);
y += 240;
x = 0;
DrawScopePart(5,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(6,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(7,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(8,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(9,x,y,m_h1280Scope,&rect);
y += 240;
x = 0;
DrawScopePart(10,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(11,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(12,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(13,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(14,x,y,m_h1280Scope,&rect);
y += 240;
x = 0;
DrawScopePart(15,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(16,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(17,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(18,x,y,m_h1280Scope,&rect);
x += 256;
DrawScopePart(19,x,y,m_h1280Scope,&rect);
break;
}
return 1;
}
/*
===================
Scanlines
===================
*/
#define SCROLL_WIDTH ScreenWidth
#include <string.h>
extern int ev_thermal;
int CHudScanlines::Init()
{
m_iFlags |= HUD_ACTIVE;
gHUD.AddHudElem(this);
m_flScrollY = 0;
return 1;
}
int CHudScanlines::VidInit()
{
m_iScanlines = gHUD.GetSpriteIndex("scanlines");
m_iScrolllines = gHUD.GetSpriteIndex("scrolllines");
return 1;
}
int CHudScanlines::Draw(float fTime)
{
m_flScrollY += (150*(ScreenHeight/640)) * gHUD.m_flTimeDelta; // always increment the scroll line
// Dont draw unless we are in thermal vision
if(!ev_thermal || (gHUD.m_iHideHUDDisplay & HIDEHUD_ALL))
return 1;
int r,g,b,a;
wrect_t rect;
int iScanWidth,iScanHeight;
int x,y;
UnpackRGB(r,g,b,RGB_REDISH);
a = 128;
ScaleColors(r,g,b,a);
rect = gHUD.GetSpriteRect(m_iScanlines);
iScanWidth = rect.right - rect.left;
iScanHeight = rect.bottom - rect.top;
SPR_Set(gHUD.GetSprite(m_iScanlines), r, g, b);
// Tile across screen
for(y = 0;y < ScreenHeight;y += iScanHeight)
for(x = 0;x < ScreenWidth;x += iScanWidth)
SPR_DrawAdditive(0,x,y,&rect);
// Sync scroll
if(m_flScrollY > ScreenHeight)
m_flScrollY = -(gHUD.GetSpriteRect(m_iScrolllines).bottom-gHUD.GetSpriteRect(m_iScrolllines).top);
SPR_Set(gHUD.GetSprite(m_iScrolllines),r,g,b);
for(x = 0;x < ScreenWidth;x += gHUD.GetSpriteRect(m_iScrolllines).right-gHUD.GetSpriteRect(m_iScrolllines).left)
SPR_DrawAdditive(0,x,m_flScrollY,&gHUD.GetSpriteRect(m_iScrolllines));
return 1;
}
void CHudScanlines::Reset()
{
}

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -54,7 +54,7 @@ int CHudTrain::Draw(float fTime)
{
int r, g, b, x, y;
UnpackRGB(r,g,b, RGB_YELLOWISH);
UnpackRGB(r,g,b, RGB_WHITE);
SPR_Set(m_hSprite, r, g, b );
// This should show up to the right and part way up the armor number

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -16,6 +16,22 @@
#include "entity_state.h"
#include "cl_entity.h"
#include "triangleapi.h"
#include "ref_params.h"
#include "pm_defs.h"
#include "pmtrace.h"
#include "event_api.h"
#include "r_efx.h"
#include "ParseBspEnt.h"
#include "ParseBsp.h"
#include <time.h>
#include "in_defs.h"
#include "twm.h"
#include "twmmanager.h"
#include "../common/com_model.h"
#include "ParticleBase.h"
#define DLLEXPORT __declspec( dllexport )
@ -25,71 +41,274 @@ extern "C"
void DLLEXPORT HUD_DrawTransparentTriangles( void );
};
//#define TEST_IT
#if defined( TEST_IT )
// This should be all the muzzleflashes we need,
// assuming everyone on the server shoots akimbo weapons at the same time and you see it :)
twm_clientinfo_t g_MuzzleflashModels[64];
int g_iNumMuzzleflashModels;
/*
=================
Draw_Triangles
R_TwmModel
Example routine. Draws a sprite offset from the player origin.
Render a TWM model with
given origin and angles
=================
*/
void Draw_Triangles( void )
void R_TwmModel(twm_clientinfo_t *twm_clientinfo,vec3_t origin,vec3_t angles)
{
cl_entity_t *player;
vec3_t org;
int i,k,j;
const twm_info_t *twm_info = twm_clientinfo->twm_info;
float *color = twm_clientinfo->color;
vec3_t forward,right,up;
// Load it up with some bogus data
player = gEngfuncs.GetLocalPlayer();
if ( !player )
return;
gEngfuncs.pTriAPI->RenderMode(twm_clientinfo->render_mode);
gEngfuncs.pTriAPI->CullFace(TRI_NONE); // TODO: Cull something?
org = player->origin;
org.x += 50;
org.y += 50;
if (gHUD.m_hsprCursor == 0)
// Render model by materialgroup
for(k = 0;k < twm_info->num_materialgroups;k++)
{
char sz[256];
sprintf( sz, "sprites/cursor.spr" );
gHUD.m_hsprCursor = SPR_Load( sz );
twm_materialgroup_t *cur_mat = &twm_info->materialgroup_lump[k];
gEngfuncs.pTriAPI->SpriteTexture((struct model_s*)gEngfuncs.GetSpritePointer(cur_mat->sprite_handle),twm_clientinfo->sprite_frame);
// Render each triangle
for(i = 0;i < cur_mat->num_triangles;i++)
{
twm_triangle_t *cur_tri = &twm_info->triangle_lump[cur_mat->tris_indices[i]];
gEngfuncs.pTriAPI->Begin(TRI_TRIANGLES);
gEngfuncs.pTriAPI->Color4f(color[0],color[1],color[2],color[3]);
// Add vertex information
for(j = 0;j < 3;j++)
{
vec3_t vec;
vec[0] = twm_info->vertex_lump[cur_tri->vert_indices[j]][0];
vec[1] = twm_info->vertex_lump[cur_tri->vert_indices[j]][1];
vec[2] = twm_info->vertex_lump[cur_tri->vert_indices[j]][2];
// Add in angles
VectorMA(vec,1,angles,vec);
// Add in origin
// VectorAdd(origin,vec,vec);
gEngfuncs.pTriAPI->Brightness(twm_clientinfo->brightness);
gEngfuncs.pTriAPI->TexCoord2f(cur_tri->u[j],cur_tri->v[j]);
gEngfuncs.pTriAPI->Vertex3fv(vec);
}
gEngfuncs.pTriAPI->End();
}
}
if ( !gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)gEngfuncs.GetSpritePointer( gHUD.m_hsprCursor ), 0 ))
{
return;
}
// Create a triangle, sigh
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
gEngfuncs.pTriAPI->CullFace( TRI_NONE );
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
// Overload p->color with index into tracer palette, p->packedColor with brightness
gEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, 1.0 );
// UNDONE: This gouraud shading causes tracers to disappear on some cards (permedia2)
gEngfuncs.pTriAPI->Brightness( 1 );
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
gEngfuncs.pTriAPI->Vertex3f( org.x, org.y, org.z );
gEngfuncs.pTriAPI->Brightness( 1 );
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
gEngfuncs.pTriAPI->Vertex3f( org.x, org.y + 50, org.z );
gEngfuncs.pTriAPI->Brightness( 1 );
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->Vertex3f( org.x + 50, org.y + 50, org.z );
gEngfuncs.pTriAPI->Brightness( 1 );
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
gEngfuncs.pTriAPI->Vertex3f( org.x + 50, org.y, org.z );
gEngfuncs.pTriAPI->End();
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
gEngfuncs.pTriAPI->RenderMode(kRenderNormal);
}
#endif
/*
=================
R_Billboard
Render a quad that always faces the camera
=================
*/
void R_Billboard(const struct model_s *sprite,int sprite_frame,int render_mode,float r,float g,float b,float alpha,float *origin,float *v_up,float *v_right,float scale)
{
gEngfuncs.pTriAPI->RenderMode(render_mode);
gEngfuncs.pTriAPI->CullFace(TRI_NONE);
gEngfuncs.pTriAPI->SpriteTexture((struct model_s*)sprite,sprite_frame);
// Render the sprite
gEngfuncs.pTriAPI->Begin(TRI_QUADS);
gEngfuncs.pTriAPI->Color4f(r,g,b,alpha);
gEngfuncs.pTriAPI->Brightness(1);
gEngfuncs.pTriAPI->TexCoord2f(0,1);
gEngfuncs.pTriAPI->Vertex3f(origin[0]+((-v_right[0]+v_up[0])*scale),origin[1]+((-v_right[1]+v_up[1])*scale),origin[2]+((-v_right[2]+v_up[2])*scale));
gEngfuncs.pTriAPI->Brightness(1);
gEngfuncs.pTriAPI->TexCoord2f(0,0);
gEngfuncs.pTriAPI->Vertex3f(origin[0]+((v_right[0]+v_up[0])*scale),origin[1]+((v_right[1]+v_up[1])*scale),origin[2]+((v_right[2]+v_up[2])*scale));
gEngfuncs.pTriAPI->Brightness(1);
gEngfuncs.pTriAPI->TexCoord2f(1,0);
gEngfuncs.pTriAPI->Vertex3f(origin[0]+((v_right[0]-v_up[0])*scale),origin[1]+((v_right[1]-v_up[1])*scale),origin[2]+((v_right[2]-v_up[2])*scale));
gEngfuncs.pTriAPI->Brightness(1);
gEngfuncs.pTriAPI->TexCoord2f(1,1);
gEngfuncs.pTriAPI->Vertex3f(origin[0]+((-v_right[0]-v_up[0])*scale),origin[1]+((-v_right[1]-v_up[1])*scale),origin[2]+((-v_right[2]-v_up[2])*scale));
gEngfuncs.pTriAPI->End();
gEngfuncs.pTriAPI->RenderMode(kRenderNormal);
}
static cl_entity_t laser_beams[2]; // The beams :)
int g_iClientLasersEnabled[32];
extern int cam_thirdperson;
extern vec3_t v_origin,v_angles;
/*
=================
R_LaserBeam
Draw a laser beam
Parts contributed by Stuart Crouch
=================
*/
void R_LaserBeam( cl_entity_t *player )
{
float end[ 3 ], start[ 3 ];
int beamindex;
struct model_s *laserbeam;
vec3_t forward, up, right;
vec3_t origin, vecSrc, vecDest, angles;
pmtrace_t tr;
float dotscale;
int dotindex;
struct model_s *dotmodel;
vec3_t v_forward,v_up,v_right;
float beam_r,beam_g,beam_b;
float dot_r,dot_g,dot_b;
BEAM *pBeam1;
// Load it up with some bogus data
//player = gEngfuncs.GetLocalPlayer();
cl_entity_t *localplayer = gEngfuncs.GetLocalPlayer();
if ( !localplayer )
return; // paranioa
if ( !player )
return;
if ( !player->player )
return; // Player isnt a player.
// we cancel if its intermission time and
// trying to draw the local laserbeam
if(g_pparams->intermission && !cam_thirdperson && gEngfuncs.pEventAPI->EV_IsLocal(player->index-1))
return;
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( true, true );
gEngfuncs.pEventAPI->EV_PushPMStates();
gEngfuncs.pEventAPI->EV_SetSolidPlayers ( player->index -1 );
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
if(!cam_thirdperson && gEngfuncs.pEventAPI->EV_IsLocal(player->index - 1))
{
// First person starting points are
// different so they line up
cl_entity_t *pView = gEngfuncs.GetViewModel();
VectorCopy(pView->attachment[1],vecSrc);
VectorCopy(pView->angles,angles);
// Use Attachment 3 on the view model to get the forward axis
VectorSubtract(pView->attachment[1],pView->attachment[2],forward);
VectorNormalize(forward);
VectorMA(vecSrc,8192,forward,vecDest);
}
else
{
// Third person starting points
VectorCopy( player->origin, vecSrc );
VectorCopy( player->angles, angles );
angles[ PITCH ] *= -3;
vecSrc[2] += 20;
AngleVectors (angles, forward, right, up);
// Draw from player model
for (int i = 0; i < 3; i++ )
vecSrc[ i ] += 20 * forward[ i ];
VectorMA(vecSrc,8192,forward,vecDest);
}
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecDest, PM_GLASS_IGNORE|PM_STUDIO_BOX, -1, &tr );
if(!cam_thirdperson && gEngfuncs.pEventAPI->EV_IsLocal(player->index - 1))
{
// Draw from view models attachment
cl_entity_t *pView = gEngfuncs.GetViewModel();
if(pView != NULL)
{
// Attachment 1
start[0] = pView->attachment[1].x;
start[1] = pView->attachment[1].y;
start[2] = pView->attachment[1].z;
}
}
else
{
// Draw from players attachment point
start [ 0 ] = player->attachment[1].x;
start [ 1 ] = player->attachment[1].y;
start [ 2 ] = player->attachment[1].z;
}
end [ 0 ] = tr.endpos.x;
end [ 1 ] = tr.endpos.y;
end [ 2 ] = tr.endpos.z;
laserbeam = gEngfuncs.CL_LoadModel( "sprites/laserbeam.spr", &beamindex );
if ( !laserbeam )
return;
// Easter Egg ;D
time_t Time;
time(&Time);
// Josh's Birthday, July 9th
if(localtime(&Time)->tm_mday == 9 && localtime(&Time)->tm_mon == 6)
{
beam_r = dot_r = 0.0;
beam_g = dot_g = 1.0;
beam_b = dot_b = 0.0;
}
else
{
// normal :)
beam_r = 1.0;
beam_g = 0.0;
beam_b = 0.0;
dot_r = 1.0;
dot_g = 1.0;
dot_b = 1.0;
}
pBeam1 = gEngfuncs.pEfxAPI->R_BeamPoints( start, end, beamindex,
0.0001, 0.3, 0.0, 0.14, 5.0, 0.0, 1.0, beam_r,beam_g,beam_b );
gEngfuncs.pEventAPI->EV_PopPMStates();
// Now to render a halo around the light beginning point. :)
dotscale = 4; // TODO: make like a lenticular halo and resize for distance?
AngleVectors (v_angles, v_forward, v_right, v_up);
dotmodel = gEngfuncs.CL_LoadModel( "sprites/hand_laser_dot.spr", &dotindex );
if(dotmodel == NULL)
gEngfuncs.Con_DPrintf("Bogus laser sprite, check R_LaserBeam");
R_Billboard(dotmodel,0,kRenderTransAdd,dot_r,dot_g,dot_b,1.0,start,v_up,v_right,dotscale);
}
/*
=================
R_SetFog
Set current fog state
=================
*/
void R_SetFog(float r,float g,float b,float start,float end,int enable)
{
float color[3];
color[0] = r;
color[1] = g;
color[2] = b;
gEngfuncs.pTriAPI->Fog(color,start,end,enable);
}
/*
=================
@ -100,12 +319,10 @@ Non-transparent triangles-- add them here
*/
void DLLEXPORT HUD_DrawNormalTriangles( void )
{
// Render particle effects
g_ParticleSystemManager.RenderNormal();
gHUD.m_Spectator.DrawOverview();
#if defined( TEST_IT )
// Draw_Triangles();
#endif
}
/*
@ -117,8 +334,31 @@ Render any triangles with transparent rendermode needs here
*/
void DLLEXPORT HUD_DrawTransparentTriangles( void )
{
// Render particle effects
g_ParticleSystemManager.RenderTransparent();
#if defined( TEST_IT )
// Draw_Triangles();
#endif
// Render laser beams
for(int i = 0;i < gEngfuncs.GetMaxClients();i++)
{
cl_entity_t *player = gEngfuncs.GetEntityByIndex(i);
if(player != NULL && g_iClientLasersEnabled[i])
R_LaserBeam(player);
}
// Render 3d muzzleflashes
for(i = 0;i < g_iNumMuzzleflashModels;i++)
{
twm_clientinfo_t *clientinfo = &g_MuzzleflashModels[i];
// TODO: Perhaps relink
// entities at the end of the
// array here, so we dont have
// dead links
if(clientinfo->dead)
continue;
// Render it
cl_entity_t *attached_ent = clientinfo->attached_ent;
R_TwmModel(clientinfo,attached_ent->attachment[clientinfo->attachment_num],attached_ent->angles);
}
}

22
cl_dll/tri.h Normal file
View file

@ -0,0 +1,22 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#ifndef __TRI_H_
#define __TRI_H_
// tri.cpp functions
void R_Billboard(const struct model_s *sprite,int sprite_frame,int render_mode,float r,float g,float b,float alpha,float *origin,float *v_up,float *v_right,float scale);
void R_LaserBeam( cl_entity_t *player );
void R_SetFog(float r,float g,float b,float start,float end,int enable);
#endif

33
cl_dll/tw_vgui.h Normal file
View file

@ -0,0 +1,33 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#ifndef __TW_VGUI_H_
#define __TW_VGUI_H_
// VGUI Color Scheme info
// Panel Scheme
#define TW_PANEL_BG_RGB 64,64,64
#define TW_PANEL_BG_RGBA TW_PANEL_BG_RGB ,128
#define TW_PANEL_BORDER_RGBA 255,255,255,128
// CommandButton Scheme
#define TW_COMMANDBUTTON_BG_RGBA TW_PANEL_BG_RGBA
#define TW_COMMANDBUTTON_BORDER_RGBA TW_PANEL_BORDER_RGBA
#define TW_COMMANDBUTTON_ACTIVE_RGBA TW_PANEL_BORDER_RGBA
// Scorepanel Scheme
#define TW_SCOREPANEL_HIGHLIGHT_TEXT_RGBA TW_PANEL_BG_RGB ,0
#define TW_SCOREPANEL_HIGHLIGHT_COLOR_A 64
#endif

227
cl_dll/twm.cpp Normal file
View file

@ -0,0 +1,227 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
//
// twm.cpp -> .TWM loading code
//
#include "hud.h"
#include "cl_util.h"
#include "const.h"
#include "entity_state.h"
#include "cl_entity.h"
#include "triangleapi.h"
#include "ref_params.h"
#include "event_api.h"
#include "r_efx.h"
#include "twm.h"
#include "twmmanager.h"
CTwmManager g_TwmManager;
/*
CTwmModel methods
*/
CTwmModel::CTwmModel()
{
twminfo.num_vertices = 0;
twminfo.vertex_lump = NULL;
twminfo.num_tris = 0;
twminfo.triangle_lump = NULL;
twminfo.num_materialgroups = 0;
twminfo.materialgroup_lump = NULL;
}
CTwmModel::~CTwmModel()
{
// free all our data used
if(twminfo.num_vertices)
delete[] twminfo.vertex_lump;
if(twminfo.num_tris)
delete[] twminfo.triangle_lump;
if(twminfo.num_materialgroups)
{
for(int i = 0;i < twminfo.num_materialgroups;i++)
delete[] twminfo.materialgroup_lump[i].tris_indices;
delete[] twminfo.materialgroup_lump;
}
}
/*
CTwmManager methods
*/
CTwmManager::CTwmManager()
{
}
CTwmManager::~CTwmManager()
{
// Remove all precached models
for(int i = 0;i < vecModels.size();i++)
delete vecModels[i];
vecModels.clear();
}
void CTwmManager::ParseVertexLump(FILE *pFile,CTwmModel *pTwmModel)
{
// Vertex count
fread((char*)&pTwmModel->twminfo.num_vertices,sizeof(short),1,pFile);
// Allocate and store verts
pTwmModel->twminfo.vertex_lump = new twm_vert_t[pTwmModel->twminfo.num_vertices];
fread((char*)pTwmModel->twminfo.vertex_lump,sizeof(twm_vert_t)*pTwmModel->twminfo.num_vertices,1,pFile);
}
void CTwmManager::ParseTriangleLump(FILE *pFile,CTwmModel *pTwmModel)
{
// Triangle count
fread((char*)&pTwmModel->twminfo.num_tris,sizeof(short),1,pFile);
// allocate and store triangle info
pTwmModel->twminfo.triangle_lump = new twm_triangle_t[pTwmModel->twminfo.num_tris];
for(int i = 0;i < pTwmModel->twminfo.num_tris;i++)
{
twm_triangle_t *cur_tri = &pTwmModel->twminfo.triangle_lump[i];
fread((char*)cur_tri->vert_indices,sizeof(short)*3,1,pFile);
fread((char*)cur_tri->u,sizeof(float)*3,1,pFile);
fread((char*)cur_tri->v,sizeof(float)*3,1,pFile);
}
}
void CTwmManager::ParseMaterialLump(FILE *pFile,CTwmModel *pTwmModel)
{
// Material count
fread((char*)&pTwmModel->twminfo.num_materialgroups,sizeof(short),1,pFile);
// allocate and store material info
pTwmModel->twminfo.materialgroup_lump = new twm_materialgroup_t[pTwmModel->twminfo.num_materialgroups];
for(int i = 0;i < pTwmModel->twminfo.num_materialgroups;i++)
{
twm_materialgroup_t *cur_mat = &pTwmModel->twminfo.materialgroup_lump[i];
fread(cur_mat->texturename,sizeof(char)*64,1,pFile);
// Precache material
cur_mat->sprite_handle = gEngfuncs.pfnSPR_Load(cur_mat->texturename);
// allocate triangle list
fread((char*)&cur_mat->num_triangles,sizeof(short),1,pFile);
cur_mat->tris_indices = new short[cur_mat->num_triangles];
fread((char*)cur_mat->tris_indices,sizeof(short)*cur_mat->num_triangles,1,pFile);
}
}
// just use C style i/o
int CTwmManager::PrecacheModel(string filename)
{
char path[256];
CTwmModel *TwmModel = new CTwmModel;
FILE *pFile;
// store full path
sprintf(path,"%s/%s",gEngfuncs.pfnGetGameDirectory(),filename.c_str());
gEngfuncs.Con_DPrintf("TWM: Loading Model %s\n",filename.c_str());
pFile = fopen(path,"rb");
if(pFile == NULL)
{
gEngfuncs.Con_DPrintf("TWM ERROR: Invalid file %s\n",filename.c_str());
return 0;
}
// Put basic information into twm model
TwmModel->filename = filename;
fread((char*)&TwmModel->twminfo.header_id,sizeof(int),1,pFile);
fread((char*)&TwmModel->twminfo.major_version,sizeof(short),1,pFile);
fread((char*)&TwmModel->twminfo.minor_version,sizeof(short),1,pFile);
if(TwmModel->twminfo.header_id == TWM_ID)
{
if(TwmModel->twminfo.major_version == TWM_MAJOR_VERSION)
{
// Only warning if minor versions differ
if(TwmModel->twminfo.minor_version != TWM_MINOR_VERSION)
gEngfuncs.Con_DPrintf("TWM WARNING: Different minor version for %s, expected %i got %i\n",filename.c_str(),TWM_MINOR_VERSION,TwmModel->twminfo.minor_version);
// Start parsing!
ParseVertexLump(pFile,TwmModel);
ParseTriangleLump(pFile,TwmModel);
ParseMaterialLump(pFile,TwmModel);
// push onto vector for storage
vecModels.push_back(TwmModel);
goto precache_noerror;
}
else
gEngfuncs.Con_DPrintf("TWM ERROR: Invalid version for %s, expected %i got %i\n",filename.c_str(),TWM_MAJOR_VERSION,TwmModel->twminfo.major_version);
}
else
gEngfuncs.Con_DPrintf("TWM ERROR: Invalid header for %s\n",filename.c_str());
fclose(pFile);
return 0;
precache_noerror:
fclose(pFile);
return 1;
}
void CTwmManager::BeginPrecache()
{
// Remove all precached models
for(int i = 0;i < vecModels.size();i++)
delete vecModels[i];
vecModels.clear();
// Start precaching!
GetModelByName("models/muz_test.twm");
}
CTwmModel *CTwmManager::GetModelByName(string filename)
{
for(int i = 0;i < vecModels.size();i++)
if(vecModels[i]->filename == filename)
return vecModels[i];
// Oops! we couldnt find the model, precache and return that
if(PrecacheModel(filename))
return vecModels[vecModels.size()-1];
return NULL;
}
// Update a specific twm object
void CTwmManager::TwmUpdate(twm_clientinfo_t *clientinfo, double frametime)
{
bool bDie = false;
// fade out model
clientinfo->color[3] -= clientinfo->fadetime * frametime;
if(clientinfo->color[3] <= 0.0f)
bDie = true;
// set dead var
clientinfo->dead = bDie;
}

67
cl_dll/twmmanager.h Normal file
View file

@ -0,0 +1,67 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#ifndef __TWMMANAGER_H_
#define __TWMMANAGER_H_
// STL stuff
#include <string>
#include <vector>
using namespace std;
class CTwmModel
{
public:
CTwmModel();
~CTwmModel();
string filename;
twm_info_t twminfo;
};
class CTwmManager
{
private:
// all our precached models
vector<CTwmModel*> vecModels;
// Helper functions for PrecacheModel
void ParseVertexLump(FILE *pFile,CTwmModel *pTwmModel);
void ParseTriangleLump(FILE *pFile,CTwmModel *pTwmModel);
void ParseMaterialLump(FILE *pFile,CTwmModel *pTwmModel);
int PrecacheModel(string filename);
public:
CTwmManager();
~CTwmManager();
// Called when we need to load the base .twm's
void BeginPrecache();
// .TWM retrieval operations
CTwmModel *GetModelByName(string filename);
// Update twm info :o
void TwmUpdate(twm_clientinfo_t *clientinfo,double frametime);
};
extern CTwmManager g_TwmManager;
// 3d muzzleflashes
extern twm_clientinfo_t g_MuzzleflashModels[64];
extern int g_iNumMuzzleflashModels;
#define TWM_UPDATE_ARRAY(array,count,frametime) {for(int i = 0;i < count;i++)g_TwmManager.TwmUpdate(&array[i],frametime);}
#endif

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -131,3 +131,15 @@ HSPRITE LoadSprite(const char *pszName)
return SPR_Load(sz);
}
// Added by gage
int GetLocalPlayerIndex()
{
return gEngfuncs.GetLocalPlayer()->index;
}
// Made this a normal function so weapons code can grab it
void CenterPrint( const char *string )
{
gEngfuncs.pfnCenterPrint( string );
}

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
@ -116,6 +116,6 @@ public:
};
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 ); }
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 ); }\
#define vec3_t Vector

View file

@ -1,4 +1,4 @@
//=========== (C) Copyright 1996-2002 Valve, L.L.C. All rights reserved. ===========
//=========== (C) Copyright 1996-2001 Valve, L.L.C. All rights reserved. ===========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
@ -235,7 +235,6 @@ CClassMenuPanel::CClassMenuPanel(int iTrans, int iRemoveMe, int x,int y,int wide
}
m_pClassInfoPanel[i]->setSize( maxX , maxY );
if (pfile) gEngfuncs.COM_FreeFile( pfile );
//m_pClassInfoPanel[i]->setBorder(new LineBorder());
}

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//

View file

@ -1,4 +1,4 @@
//=========== (C) Copyright 1996-2002 Valve, L.L.C. All rights reserved. ===========
//=========== (C) Copyright 1996-2001 Valve, L.L.C. All rights reserved. ===========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
@ -30,10 +30,13 @@
#include "parsemsg.h"
#include "vgui_int.h"
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#include "vgui_ServerBrowser.h"
#include "..\game_shared\vgui_LoadTGA.h"
#include "tw_vgui.h"
// Arrow filenames
char *sArrowFilenames[] =
{
@ -69,6 +72,14 @@ BitmapTGA *LoadTGAForRes( const char* pImageName )
sprintf(sz, "%%d_%s", pImageName);
pTGA = vgui_LoadTGA(GetTGANameForRes(sz));
if(pTGA == NULL)
{
// Instead of returning a null image (and probably crashing the VGUI) we are
// going to load the NULL texture. if the null textures dont exist this is
// useless anyways D: - JAC
pTGA = vgui_LoadTGA("gfx/vgui/null.tga");
}
return pTGA;
}
@ -78,25 +89,14 @@ CommandButton::CommandButton( const char* text,int x,int y,int wide,int tall, bo
{
m_iPlayerClass = 0;
m_bNoHighlight = bNoHighlight;
m_bFlat = false;
Init();
setText( text );
}
CommandButton::CommandButton( int iPlayerClass, const char* text,int x,int y,int wide,int tall, bool bFlat) : Button("",x,y,wide,tall)
CommandButton::CommandButton( int iPlayerClass, const char* text,int x,int y,int wide,int tall) : Button("",x,y,wide,tall)
{
m_iPlayerClass = iPlayerClass;
m_bNoHighlight = false;
m_bFlat = bFlat;
Init();
setText( text );
}
CommandButton::CommandButton(const char *text, int x, int y, int wide, int tall, bool bNoHighlight, bool bFlat) : Button("",x,y,wide,tall)
{
m_iPlayerClass = 0;
m_bFlat = bFlat;
m_bNoHighlight = bNoHighlight;
Init();
setText( text );
}
@ -131,14 +131,7 @@ void CommandButton::RecalculateText( void )
if ( m_cBoundKey != 0 )
{
if ( m_cBoundKey == (char)255 )
{
strcpy( szBuf, m_sMainText );
}
else
{
sprintf( szBuf, " %c %s", m_cBoundKey, m_sMainText );
}
sprintf( szBuf, " %c %s", m_cBoundKey, m_sMainText );
szBuf[MAX_BUTTON_SIZE-1] = 0;
}
else
@ -210,28 +203,15 @@ void CommandButton::paint()
void CommandButton::paintBackground()
{
if ( m_bFlat )
if ( isArmed() )
{
if ( isArmed() )
{
// Orange Border
drawSetColor( Scheme::sc_secondary1 );
drawOutlinedRect(0,0,_size[0],_size[1]);
}
drawSetColor(TW_COMMANDBUTTON_ACTIVE_RGBA);
drawFilledRect(0,0,_size[0],_size[1]);
}
else
{
if ( isArmed() )
{
// Orange highlight background
drawSetColor( Scheme::sc_primary2 );
drawFilledRect(0,0,_size[0],_size[1]);
}
// Orange Border
drawSetColor( Scheme::sc_secondary1 );
drawOutlinedRect(0,0,_size[0],_size[1]);
}
// Border
drawSetColor(TW_COMMANDBUTTON_BORDER_RGBA);
drawOutlinedRect(0,0,_size[0],_size[1]);
}
//-----------------------------------------------------------------------------
@ -336,65 +316,37 @@ CImageLabel::CImageLabel( const char* pImageName,int x,int y,int wide,int tall )
setImage( m_pTGA );
}
void CImageLabel::NewImage(const char *pImageName)
{
if(m_pTGA != NULL)
{
setImage(NULL);
delete m_pTGA;
}
m_pTGA = LoadTGAForRes(pImageName);
setImage(m_pTGA);
}
void CImageLabel::setImageColor(Color col)
{
m_pTGA->setColor(col);
}
//===========================================================
// Image size
int CImageLabel::getImageWide( void )
{
if( m_pTGA )
{
int iXSize, iYSize;
m_pTGA->getSize( iXSize, iYSize );
return iXSize;
}
else
{
return 1;
}
int iXSize, iYSize;
m_pTGA->getSize( iXSize, iYSize );
return iXSize;
}
int CImageLabel::getImageTall( void )
{
if( m_pTGA )
{
int iXSize, iYSize;
m_pTGA->getSize( iXSize, iYSize );
return iYSize;
}
else
{
return 1;
}
}
void CImageLabel::LoadImage(const char * pImageName)
{
if ( m_pTGA )
delete m_pTGA;
// Load the Image
m_pTGA = LoadTGAForRes(pImageName);
if ( m_pTGA == NULL )
{
// we didn't find a matching image file for this resolution
// try to load file resolution independent
char sz[256];
sprintf(sz, "%s/%s",gEngfuncs.pfnGetGameDirectory(), pImageName );
FileInputStream* fis = new FileInputStream( sz, false );
m_pTGA = new BitmapTGA(fis,true);
fis->close();
}
if ( m_pTGA == NULL )
return; // unable to load image
int w,t;
m_pTGA->getSize( w, t );
setSize( XRES (w),YRES (t) );
setImage( m_pTGA );
int iXSize, iYSize;
m_pTGA->getSize( iXSize, iYSize );
return iYSize;
}
//===========================================================
@ -402,12 +354,7 @@ void CImageLabel::LoadImage(const char * pImageName)
void CCommandMenu::paintBackground()
{
// Transparent black background
if ( m_iSpectCmdMenu )
drawSetColor( 0, 0, 0, 64 );
else
drawSetColor(Scheme::sc_primary3);
drawSetColor(Scheme::sc_primary3);
drawFilledRect(0,0,_size[0],_size[1]);
}
@ -469,7 +416,8 @@ void CTFSlider::paintBackground( void )
getNobPos(nobx,noby);
// Border
drawSetColor( Scheme::sc_secondary1 );
drawSetColor(TW_PANEL_BORDER_RGBA);
drawOutlinedRect( 0,0,wide,tall );
if( isVertical() )

View file

@ -0,0 +1,633 @@
/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#include "VGUI_TextImage.h"
#include "hud.h"
#include "cl_util.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#include "tw_common.h"
#include <vector>
#define INFO_PANEL_X XRES(236)
#define INFO_PANEL_Y YRES(188)
#define INFO_PANEL_SIZE_X XRES(328)
#define INFO_PANEL_SIZE_Y YRES(220)
#define IMAGE_PANEL_X XRES(236)
#define IMAGE_PANEL_Y YRES(34)
#define IMAGE_PANEL_SIZE_X XRES(328)
#define IMAGE_PANEL_SIZE_Y YRES(76)
#define LIST_BUTTON_X XRES(68)
#define LIST_BUTTON_Y YRES(34)
#define MAIN_BUTTON_X XRES(68)
#define MAIN_BUTTON_Y YRES(416)
#define BUTTON_SIZE_X XRES(160)
//#define BUTTON_SIZE_Y YRES(30)
// Important:
// join_game -> join this game
// setweapons -> set weapons command, 5 arguments like setweapons -1 -1 -1 -1 -1
// setrandom -> random weaps
// unsetrandom -> non random weaps
// spectate -> spectate this game
class CItemList;
/*
==========
CInformationPanel
==========
*/
class CInformationPanel : public CTransparentPanel
{
public:
CInformationPanel( int x, int y, int wide, int tall );
void SetInfo( char *pszClassname );
private:
ScrollPanel *m_pScrollPanel;
TextPanel *m_pTextPanel;
CImageLabel *m_pImageLabel;
char m_szClassname[128];
};
/*
==========
CItemSelectionPanel
==========
*/
class CItemSelectionPanel : public CMenuPanel
{
public:
CItemSelectionPanel(int x,int y,int wide,int tall);
~CItemSelectionPanel();
void paintBackground();
void SetInfo(char *pszClassname);
void SetImage( char *pszClassname, int iIndex );
void AddItem( playeritemlist_t *pList, int iSlot, int iIndex );
void SendItems();
private:
CImageLabel *m_pImageLabels[5];
CItemList *m_pItemList;
CInformationPanel *m_pInformationPanel;
int m_iWeaponIndices[5];
};
/*
==========
CItemSelectionPanel_Create
Used by external modules to spawn this item selection code
==========
*/
CMenuPanel *CItemSelectionPanel_Create(int x,int y,int wide,int tall)
{
return new CItemSelectionPanel(x,y,wide,tall);
}
/*
==========
CItemListHandler_NewItemList
==========
*/
enum e_itemcategories {
ITEM_MELEE = 0,
ITEM_SIDEARMS,
ITEM_PRIMARY,
ITEM_UNIQUE,
ITEM_EXPLOSIVES,
ITEM_BACK,
};
class CItemListHandler_NewItemList : public ActionSignal
{
public:
CItemListHandler_NewItemList(int iCategory,CItemList *pItemList);
virtual void actionPerformed(Panel *panel);
private:
int m_iCategory;
CItemList *m_pOldItemList;
};
/*
==========
CHandler_SendChanges
==========
*/
class CHandler_SendChanges : public ActionSignal
{
public:
CHandler_SendChanges(CItemSelectionPanel *pPanel)
{
m_pInfoPanel = pPanel;
}
virtual void actionPerformed(Panel *panel)
{
m_pInfoPanel->SendItems();
}
private:
CItemSelectionPanel *m_pInfoPanel;
};
/*
==========
CItemButtonHandler_SetItem
==========
*/
class CItemButtonHandler_SetItem : public ActionSignal
{
public:
CItemButtonHandler_SetItem( playeritemlist_t *pList, int iSlot, int iIndex, CItemSelectionPanel *pPanel) :
m_pList( pList ), m_iWeaponIndex( iIndex ), m_iWeaponSlot( iSlot ), m_pPanel( pPanel )
{
}
virtual void actionPerformed(Panel *panel)
{
m_pPanel->AddItem( m_pList, m_iWeaponSlot, m_iWeaponIndex );
}
private:
CItemSelectionPanel *m_pPanel;
playeritemlist_t *m_pList;
int m_iWeaponIndex;
int m_iWeaponSlot;
};
/*
==========
CommandButtonShaded
==========
*/
class CommandButtonShaded : public CommandButton
{
public:
CommandButtonShaded(const char *text,int x,int y,int wide,int tall,bool bNoHighlight);
void paint();
};
CommandButtonShaded::CommandButtonShaded(const char *text,int x,int y,int wide,int tall,bool bNoHighlight = 0) : CommandButton(text,x,y,wide,tall,bNoHighlight)
{
}
void CommandButtonShaded::paint()
{
if(!isArmed())
{
drawSetColor(TW_PANEL_BG_RGBA);
drawFilledRect(0,0,_size[0],_size[1]);
}
CommandButton::paint();
}
/*
==========
ItemButtonShaded
==========
*/
class ItemButtonShaded : public CommandButtonShaded
{
public:
ItemButtonShaded(const char *classname,int x,int y,int wide,int tall,bool bNoHighlight);
void setParent(Panel *newParent);
void paint();
private:
char m_szClassname[128];
};
ItemButtonShaded::ItemButtonShaded(const char *classname,int x,int y,int wide,int tall,bool bNoHighlight = 0) : CommandButtonShaded(classname,x,y,wide,tall,bNoHighlight)
{
char szRealText[128];
strcpy(m_szClassname,classname);
// Localize the text on the buttons
sprintf(szRealText,"#ItemList_%s",classname);
setText(CHudTextMessage::BufferedLocaliseTextString(szRealText));
}
void ItemButtonShaded::setParent(Panel *newParent)
{
CommandButtonShaded::setParent(newParent);
}
void ItemButtonShaded::paint()
{
CommandButtonShaded::paint();
if(isArmed())
{
CItemSelectionPanel *pPanel = (CItemSelectionPanel*)getParent();
if(pPanel != NULL)
pPanel->SetInfo(m_szClassname);
}
}
/*
==========
CItemList
Base class to show vgui buttons pertaining to categories of weapons
==========
*/
class CItemList
{
public:
CItemList(CItemSelectionPanel *pPanel, playeritemlist_t *pList, int iSlot, int iNextSlot ) :
m_pParentPanel( pPanel ), m_pItemArray( pList ), m_iSlot( iSlot ), m_iNextSlot( iNextSlot )
{
}
virtual ~CItemList()
{
for( int i = 0;i < m_ItemButtons.size();i++ )
{
m_pParentPanel->removeChild( m_ItemButtons[i] );
}
}
void BuildButtons()
{
int iButtonPosY = LIST_BUTTON_Y;
for( int i = 0;i < m_pItemArray->size; i++ )
{
playeritem_t *pItem = &m_pItemArray->array[i];
ItemButtonShaded *newButton;
newButton = new ItemButtonShaded( pItem->weapon_classname, LIST_BUTTON_X, iButtonPosY, BUTTON_SIZE_X, BUTTON_SIZE_Y );
newButton->setParent( m_pParentPanel );
newButton->addActionSignal( new CItemButtonHandler_SetItem( m_pItemArray, m_iSlot, i, m_pParentPanel ) );
newButton->addActionSignal( new CItemListHandler_NewItemList(m_iNextSlot,this) );
m_ItemButtons.push_back( newButton );
iButtonPosY += BUTTON_SIZE_Y + YRES(8);
}
CommandButtonShaded *backButton;
backButton = new CommandButtonShaded(CHudTextMessage::BufferedLocaliseTextString("#ItemList_Back"),LIST_BUTTON_X,iButtonPosY,BUTTON_SIZE_X,BUTTON_SIZE_Y);
backButton->setParent( m_pParentPanel );
backButton->addActionSignal(new CItemListHandler_NewItemList(ITEM_BACK,this));
m_ItemButtons.push_back( backButton );
m_iNumButtons = ++i;
}
playeritemlist_t *m_pItemArray;
int m_iSlot,m_iNextSlot;
CItemSelectionPanel *m_pParentPanel;
public:
std::vector<CommandButton*> m_ItemButtons;
int m_iNumButtons;
};
class CMainCategories : public CItemList
{
public:
CMainCategories(CItemSelectionPanel *pPanel, playeritemlist_t *pList ) : CItemList(pPanel, pList, -1, -1)
{
int iButtonPosY = LIST_BUTTON_Y;
m_pMeleeButton = new CommandButtonShaded(CHudTextMessage::BufferedLocaliseTextString("#ItemList_Melee"),LIST_BUTTON_X,iButtonPosY,BUTTON_SIZE_X,BUTTON_SIZE_Y);
m_pMeleeButton->setParent(m_pParentPanel);
m_pMeleeButton->addActionSignal(new CItemListHandler_NewItemList(ITEM_MELEE,this));
iButtonPosY += BUTTON_SIZE_Y + YRES(8);
m_pSidearmsButton = new CommandButtonShaded(CHudTextMessage::BufferedLocaliseTextString("#ItemList_Sidearms"),LIST_BUTTON_X,iButtonPosY,BUTTON_SIZE_X,BUTTON_SIZE_Y);
m_pSidearmsButton->setParent(m_pParentPanel);
m_pSidearmsButton->addActionSignal(new CItemListHandler_NewItemList(ITEM_SIDEARMS,this));
iButtonPosY += BUTTON_SIZE_Y + YRES(8);
m_pSecondaryButton = new CommandButtonShaded(CHudTextMessage::BufferedLocaliseTextString("#ItemList_Secondary"),LIST_BUTTON_X,iButtonPosY,BUTTON_SIZE_X,BUTTON_SIZE_Y);
m_pSecondaryButton->setParent(m_pParentPanel);
m_pSecondaryButton->addActionSignal(new CItemListHandler_NewItemList(ITEM_PRIMARY,this));
iButtonPosY += BUTTON_SIZE_Y + YRES(8);
m_pExplosivesButton = new CommandButtonShaded(CHudTextMessage::BufferedLocaliseTextString("#ItemList_Explosives"),LIST_BUTTON_X,iButtonPosY,BUTTON_SIZE_X,BUTTON_SIZE_Y);
m_pExplosivesButton->setParent(m_pParentPanel);
m_pExplosivesButton->addActionSignal(new CItemListHandler_NewItemList(ITEM_EXPLOSIVES,this));
// No uniques for now :|
/* iButtonPosY += BUTTON_SIZE_Y + YRES(8);
m_pUniqueButton = new CommandButtonShaded(CHudTextMessage::BufferedLocaliseTextString("#ItemList_Unique"),LIST_BUTTON_X,iButtonPosY,BUTTON_SIZE_X,BUTTON_SIZE_Y);
m_pUniqueButton->setParent(m_pParentPanel);
m_pUniqueButton->addActionSignal(new CItemListHandler_NewItemList(ITEM_UNIQUE,this));
*/
iButtonPosY += BUTTON_SIZE_Y + YRES(8);
}
~CMainCategories()
{
m_pParentPanel->removeChild(m_pMeleeButton);
m_pParentPanel->removeChild(m_pSidearmsButton);
m_pParentPanel->removeChild(m_pSecondaryButton);
m_pParentPanel->removeChild(m_pExplosivesButton);
// m_pParentPanel->removeChild(m_pUniqueButton);
}
private:
CommandButtonShaded *m_pMeleeButton;
CommandButtonShaded *m_pSidearmsButton;
CommandButtonShaded *m_pSecondaryButton;
CommandButtonShaded *m_pExplosivesButton;
// CommandButtonShaded *m_pUniqueButton;
};
/*
CItemSelectionPanel methods
*/
CItemSelectionPanel::CItemSelectionPanel(int x,int y,int wide,int tall) : CMenuPanel(100,false,x,y,wide,tall)
{
memset( m_iWeaponIndices, -1, sizeof( m_iWeaponIndices ) );
// Start up selection images
for(int i = 0;i < 5;i++)
{
m_pImageLabels[i] = new CImageLabel("",0,0);
m_pImageLabels[i]->setParent(this);
m_pImageLabels[i]->setVisible(false);
}
// Load the item manager
m_pItemList = new CMainCategories(this, NULL );
// Information Panel
m_pInformationPanel = new CInformationPanel(INFO_PANEL_X,INFO_PANEL_Y,INFO_PANEL_SIZE_X,INFO_PANEL_SIZE_Y);
m_pInformationPanel->setParent(this);
m_pInformationPanel->setVisible(true);
int iButtonPosX = MAIN_BUTTON_X;
CommandButtonShaded *pOkButton = new CommandButtonShaded(CHudTextMessage::BufferedLocaliseTextString("#Menu_JoinGame"), iButtonPosX, MAIN_BUTTON_Y, BUTTON_SIZE_X, BUTTON_SIZE_Y );
pOkButton->setParent(this);
// pOkButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
pOkButton->addActionSignal(new CHandler_SendChanges(this));
iButtonPosX += XRES(168);
CommandButtonShaded *pRandomButton = new CommandButtonShaded(CHudTextMessage::BufferedLocaliseTextString("#Menu_Random"), iButtonPosX,MAIN_BUTTON_Y, BUTTON_SIZE_X, BUTTON_SIZE_Y );
pRandomButton->setParent(this);
pRandomButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
pRandomButton->addActionSignal(new CMenuHandler_StringCommand("setrandom"));
pRandomButton->addActionSignal(new CMenuHandler_StringCommand("join_game"));
iButtonPosX += XRES(168);
CommandButtonShaded *pSpectateButton = new CommandButtonShaded(CHudTextMessage::BufferedLocaliseTextString("#Menu_Spectate"), iButtonPosX, MAIN_BUTTON_Y, BUTTON_SIZE_X,BUTTON_SIZE_Y );
pSpectateButton->setParent(this);
pSpectateButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
pSpectateButton->addActionSignal(new CMenuHandler_StringCommand("spectate"));
}
CItemSelectionPanel::~CItemSelectionPanel()
{
delete m_pItemList;
for( int i = 0;i < 5;i++ )
delete m_pImageLabels[i];
}
void CItemSelectionPanel::SetInfo(char *pszClassname)
{
m_pInformationPanel->SetInfo(pszClassname);
}
void CItemSelectionPanel::SetImage(char *pszClassname,int iIndex)
{
// Show image
char szImageName[128];
sprintf(szImageName,"inv_%s",pszClassname);
m_pImageLabels[iIndex]->NewImage(szImageName);
m_pImageLabels[iIndex]->setVisible(true);
m_pImageLabels[iIndex]->setImageColor(Color(255,255,255,160)); // Slightly faded
// Set image bounds
int x, y;
int w,h;
w = m_pImageLabels[iIndex]->getImageWide();
h = m_pImageLabels[iIndex]->getImageTall();
switch( iIndex )
{
case 0:
x = IMAGE_PANEL_X;
y = IMAGE_PANEL_Y;
break;
case 1:
x = IMAGE_PANEL_X;
y = IMAGE_PANEL_Y + h + YRES(8);
break;
case 2:
x = IMAGE_PANEL_X + w + XRES(8);
y = IMAGE_PANEL_Y;
break;
case 3:
case 4:
x = IMAGE_PANEL_X + w + XRES(8);
y = IMAGE_PANEL_Y + h + YRES(8);
break;
}
m_pImageLabels[iIndex]->setPos( x, y );
}
void CItemSelectionPanel::paintBackground()
{
drawSetColor(TW_PANEL_BORDER_RGBA);
drawOutlinedRect(0,0,_size[0],_size[1]);
}
void CItemSelectionPanel::AddItem( playeritemlist_t *pList, int iSlot, int iIndex )
{
m_iWeaponIndices[iSlot] = iIndex;
SetImage( pList->array[iIndex].weapon_classname, iSlot );
}
void CItemSelectionPanel::SendItems()
{
// Must have a melee or backup weapon to spawn.
if( m_iWeaponIndices[0] == -1 )
{
gEngfuncs.pfnCenterPrint( "Must choose a melee weapon" );
return;
}
gViewPort->HideTopMenu();
char szText[64];
sprintf( szText, "setweapons %i %i %i %i %i",
m_iWeaponIndices[0], m_iWeaponIndices[1], m_iWeaponIndices[2],
m_iWeaponIndices[3], m_iWeaponIndices[4] );
gEngfuncs.pfnClientCmd( "unsetrandom" );
gEngfuncs.pfnClientCmd( szText );
gEngfuncs.pfnClientCmd( "join_game" );
}
/*
CInformationPanel methods
*/
CInformationPanel::CInformationPanel(int x,int y,int wide,int tall) : CTransparentPanel(0,x,y,wide,tall)
{
memset( m_szClassname, 0, sizeof( m_szClassname ) );
m_pImageLabel = new CImageLabel("",0,0);
m_pImageLabel->setParent(this);
m_pImageLabel->setVisible(false);
// Get the scheme used for the Titles
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
// schemes
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
SchemeHandle_t hMOTDText = pSchemes->getSchemeHandle( "Briefing Text" );
// color schemes
int r, g, b, a;
m_pScrollPanel = new CTFScrollPanel(XRES(16),YRES(16), wide - XRES(32), tall - YRES(32));
m_pScrollPanel->setParent(this);
// force scrollbars on to set clientClip
m_pScrollPanel->setScrollBarAutoVisible(false, false);
m_pScrollPanel->setScrollBarVisible(true, true);
m_pScrollPanel->validate();
m_pTextPanel = new TextPanel("",0,0,64,64);
m_pTextPanel->setParent(m_pScrollPanel->getClient());
// Set font
m_pTextPanel->setFont(pSchemes->getFont(hMOTDText));
pSchemes->getFgColor(hMOTDText,r,g,b,a);
m_pTextPanel->setFgColor(r,g,b,a);
pSchemes->getBgColor(hMOTDText,r,g,b,a);
m_pTextPanel->setBgColor(r,g,b,a);
}
void CInformationPanel::SetInfo( char *pszClassname )
{
// Dont update if we are already showing info
if( strcmp( pszClassname, m_szClassname ) == 0 )
return;
strcpy( m_szClassname, pszClassname );
// Show image
char szImageName[128];
sprintf(szImageName,"info_%s",pszClassname);
m_pImageLabel->NewImage(szImageName);
m_pImageLabel->setVisible(true);
m_pImageLabel->setImageColor(Color(255,255,255,160)); // Slightly faded
// Set image bounds
int w,h;
getSize(w,h);
m_pImageLabel->setPos(w/2 - m_pImageLabel->getImageWide()/2,h/2 - m_pImageLabel->getImageTall()/2);
// Set text
char szLocalizedClass[128];
sprintf(szLocalizedClass,"#Information_%s",pszClassname);
m_pTextPanel->setText(CHudTextMessage::BufferedLocaliseTextString(szLocalizedClass));
// Get the total size of the MOTD text and resize the text panel
int iScrollSizeX, iScrollSizeY;
// First, set the size so that the client's width is correct at least because the
// width is critical for getting the "wrapped" size right.
// You'll see a horizontal scroll bar if there is a single word that won't wrap in the
// specified width.
m_pTextPanel->getTextImage()->setSize(m_pScrollPanel->getClientClip()->getWide(), m_pScrollPanel->getClientClip()->getTall());
m_pTextPanel->getTextImage()->getTextSizeWrapped( iScrollSizeX, iScrollSizeY );
// Now resize the textpanel to fit the scrolled size
m_pTextPanel->setSize( iScrollSizeX , iScrollSizeY );
//turn the scrollbars back into automode
m_pScrollPanel->setScrollBarAutoVisible(true, true);
m_pScrollPanel->setScrollBarVisible(false, false);
m_pScrollPanel->validate();
}
/*
CItemListHandler_NewItemList methods
*/
CItemListHandler_NewItemList::CItemListHandler_NewItemList(int iCategory,CItemList *pItemList)
{
m_iCategory = iCategory;
m_pOldItemList = pItemList;
}
void CItemListHandler_NewItemList::actionPerformed(Panel *panel)
{
CItemSelectionPanel *pParent = m_pOldItemList->m_pParentPanel;
delete m_pOldItemList;
switch( m_iCategory )
{
case ITEM_MELEE:
m_pOldItemList = new CItemList( pParent, &g_MeleeItems, ITEM_MELEE, ITEM_SIDEARMS );
m_pOldItemList->BuildButtons();
break;
case ITEM_SIDEARMS:
m_pOldItemList = new CItemList( pParent, &g_SidearmItems, ITEM_SIDEARMS, ITEM_PRIMARY );
m_pOldItemList->BuildButtons();
break;
case ITEM_PRIMARY:
m_pOldItemList = new CItemList( pParent, &g_PrimaryItems, ITEM_PRIMARY, ITEM_EXPLOSIVES );
m_pOldItemList->BuildButtons();
break;
/* case ITEM_UNIQUE:
m_pOldItemList = new CItemList( pParent, &g_UniqueItems, 3 );
m_pOldItemList->BuildButtons();
break;*/
case ITEM_EXPLOSIVES:
m_pOldItemList = new CItemList( pParent, &g_OtherItems, ITEM_EXPLOSIVES, ITEM_BACK );
m_pOldItemList->BuildButtons();
break;
case ITEM_BACK:
m_pOldItemList = new CMainCategories( pParent, NULL );
break;
}
}

Some files were not shown because too many files have changed in this diff Show more