Compare commits

...

1 commit

176 changed files with 42678 additions and 4463 deletions

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>
{{{
}}}
###############################################################################

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

@ -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;
@ -1314,6 +1323,8 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer )
m_pPlayerInfo->gaitframe += pseqdesc->numframes;
}
texture_t red_texture;
/*
====================
StudioDrawPlayer
@ -1503,6 +1514,8 @@ void CStudioModelRenderer::StudioCalcAttachments( void )
}
}
extern int ev_thermal;
/*
====================
StudioRenderModel
@ -1537,6 +1550,12 @@ void CStudioModelRenderer::StudioRenderModel( void )
}
else
{
// no texture / translucent render
if(ev_thermal)
{
IEngineStudio.SetForceFaceFlags( STUDIO_NF_CHROME );
}
StudioRenderFinal( );
}
}

View file

@ -1,6 +1,6 @@
/***
*
* Copyright (c) 1996-2001, 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.
@ -26,7 +26,10 @@
#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
@ -64,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 );
}
@ -86,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;
@ -179,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)
@ -201,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;
@ -219,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;
@ -309,7 +335,6 @@ void CHudAmmo::Reset(void)
gHR.Reset();
// VidInit();
}
int CHudAmmo::VidInit(void)
@ -374,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);
}
}
@ -429,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;
@ -568,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 )
@ -599,13 +628,17 @@ 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_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
{
if ( gHUD.m_iFOV >= 90 )
@ -623,7 +656,7 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255);
}
}
*/
m_fFade = 200.0f; //!!!
m_iFlags |= HUD_ACTIVE;
@ -656,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 );
@ -764,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;
@ -805,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;
@ -832,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);
@ -856,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;
@ -866,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 );
@ -883,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;
@ -895,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
{
@ -916,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)
{
@ -939,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;
}
@ -968,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);
@ -1044,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;
@ -1066,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;
}
@ -1096,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));
@ -1111,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
@ -1138,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++ )
{
@ -1149,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-2001, 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-2001, 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

@ -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-2001, 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

@ -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 );
@ -66,7 +80,7 @@ int DLLEXPORT HUD_ConnectionlessPacket( struct netadr_s *net_from, const char *
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_DirectorEvent(unsigned char command, unsigned int firstObject, unsigned int secondObject, unsigned int flags);
void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf );
}
/*
@ -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,16 +212,19 @@ to a server. Reinitializes all
the hud variables.
==========================
*/
int DLLEXPORT HUD_Init( void )
{
InitInput();
gHUD.Init();
Scheme_Init();
// Not strictly HUD based
// messages, so stick them here ?
HOOK_MESSAGE(LaserInfo);
return 1;
}
/*
==========================
HUD_Redraw
@ -208,7 +241,6 @@ int DLLEXPORT HUD_Redraw( float time, int intermission )
return 1;
}
/*
==========================
HUD_UpdateClientData
@ -274,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_DirectorEvent(unsigned char command, unsigned int firstObject, unsigned int secondObject, unsigned int flags)
void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf )
{
gHUD.m_Spectator.DirectorEvent(command, firstObject, secondObject, flags);
gHUD.m_Spectator.DirectorMessage( iSize, pbuf );
}

View file

@ -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
@ -208,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
@ -232,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
@ -305,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
@ -341,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
@ -349,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
@ -357,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
@ -365,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
@ -393,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
@ -417,11 +409,11 @@ SOURCE=.\vgui_ServerBrowser.cpp
# End Source File
# Begin Source File
SOURCE=.\vgui_TeamFortressViewport.cpp
SOURCE=.\vgui_teammenu.cpp
# End Source File
# Begin Source File
SOURCE=.\vgui_teammenu.cpp
SOURCE=.\vgui_TheWastesViewport.cpp
# End Source File
# Begin Source File
@ -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,7 +637,7 @@ SOURCE=.\vgui_ServerBrowser.h
# End Source File
# Begin Source File
SOURCE=.\vgui_TeamFortressViewport.h
SOURCE=.\vgui_TheWastesViewport.h
# End Source File
# Begin Source File

View file

@ -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

@ -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 20
#define DEATHNOTICE_TOP ScreenHeight - 72
DeathNoticeItem rgDeathNoticeList[ MAX_DEATHNOTICES + 1 ];
@ -83,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;
}
@ -91,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
@ -110,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 = DEATHNOTICE_TOP + (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 )
{
@ -126,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)
@ -145,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);
}
}
@ -158,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_" );
@ -184,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 )
@ -232,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 );
@ -249,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;

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

@ -17,22 +17,24 @@
#include "r_efx.h"
#include "event_api.h"
#include "pm_defs.h"
#include "pmtrace.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 );
@ -159,6 +161,10 @@ void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct
g_iUser2 = src->iuser2;
g_iUser3 = src->iuser3;
// if the movetype is NOCLIP, we are in observer mode.
if(src->movetype == MOVETYPE_NOCLIP)
{
}
}
}
@ -210,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 );
@ -228,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 )
@ -431,152 +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
@ -598,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;
@ -729,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++ )
@ -912,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 )
{
@ -958,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

@ -132,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 );
}
/*
@ -142,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;
@ -155,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 ) )
{
@ -167,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;
}
}
}

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

@ -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

@ -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

@ -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-2001, 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

@ -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)
{
@ -118,6 +115,18 @@ 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)
{
@ -127,15 +136,6 @@ void __CmdFunc_OpenCommandMenu(void)
}
}
// TFC "special" command
void __CmdFunc_InputPlayerSpecial(void)
{
if ( gViewPort )
{
gViewPort->InputPlayerSpecial();
}
}
void __CmdFunc_CloseCommandMenu(void)
{
if ( gViewPort )
@ -152,6 +152,14 @@ void __CmdFunc_ForceCloseCommandMenu( void )
}
}
void __CmdFunc_OpenItemSelectionMenu( void )
{
if( gViewPort )
{
gViewPort->ShowVGUIMenu(MENU_ITEMSELECTION);
}
}
void __CmdFunc_ToggleServerBrowser( void )
{
if ( gViewPort )
@ -175,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)
@ -203,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)
@ -258,11 +259,17 @@ 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 );
@ -272,15 +279,14 @@ void CHud :: Init( void )
// 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 );
@ -290,6 +296,7 @@ void CHud :: Init( void )
HOOK_MESSAGE( Spectator );
HOOK_MESSAGE( AllowSpec );
HOOK_MESSAGE( LmsStart );
// VGUI Menus
HOOK_MESSAGE( VGUIMenu );
@ -297,8 +304,6 @@ 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 );
@ -325,20 +330,23 @@ 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_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();
@ -474,9 +482,9 @@ void CHud :: VidInit( void )
m_Ammo.VidInit();
m_Health.VidInit();
m_Scanlines.VidInit();
m_Geiger.VidInit();
m_Train.VidInit();
m_Battery.VidInit();
m_Flash.VidInit();
m_Message.VidInit();
m_StatusBar.VidInit();
@ -485,19 +493,12 @@ void CHud :: VidInit( void )
m_Menu.VidInit();
m_AmmoSecondary.VidInit();
m_TextMessage.VidInit();
m_Scope.VidInit();
m_StatusIcons.VidInit();
GetClientVoiceMgr()->VidInit();
m_Spectator.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_CrosshairInfo.VidInit();
m_PlayerState.VidInit();
}
float g_lastFOV = 0.0;
@ -601,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;
@ -633,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

@ -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
};
//
@ -375,28 +433,6 @@ public:
void EnsureTextFitsInOneLineAndWrapIfHaveTo( int line );
};
//
//-----------------------------------------------------
//
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
};
//
//-----------------------------------------------------
//
@ -421,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
};
//
@ -493,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);
};
//
//-----------------------------------------------------
//
@ -535,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;
@ -561,7 +608,7 @@ public:
int m_iKeyBits;
int m_iHideHUDDisplay;
int m_iFOV;
int m_Teamplay;
int m_Gamemode;
int m_iRes;
cvar_t *m_pCvarStealMouse;
@ -594,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;
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;
CHudSpectator m_Spectator;
CHudTextMessage m_TextMessage;
CHudScope m_Scope;
CHudStatusIcons m_StatusIcons;
CHudSpectator m_Spectator;
CCrosshairInfo m_CrosshairInfo;
CHudPlayerState m_PlayerState;
void Init( void );
void VidInit( void );
@ -622,7 +672,6 @@ 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 );
int _cdecl MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf);
@ -638,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

@ -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 )
@ -62,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

@ -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
@ -146,26 +148,7 @@ int CHud :: Redraw( float flTime, int intermission )
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 )
@ -189,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

@ -9,8 +9,11 @@
#include "cl_util.h"
#include "cl_entity.h"
#include "triangleapi.h"
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#include "hltv.h"
#include "tw_common.h"
#include "parsemsg.h"
#include "pm_shared.h"
#include "entity_types.h"
@ -242,7 +245,6 @@ int CHudSpectator::Draw(float flTime)
}
// Only draw the icon names only if map mode is in Main Mode
if ( m_iMainMode != MAIN_MAP_FREE )
return 1;
@ -253,7 +255,6 @@ int CHudSpectator::Draw(float flTime)
// make sure we have player info
gViewPort->GetAllPlayersInfo();
// loop through all the players and draw additional infos to their sprites on the map
for (int i = 0; i < MAX_PLAYERS; i++)
{
@ -293,41 +294,142 @@ int CHudSpectator::Draw(float flTime)
return 1;
}
void CHudSpectator::DirectorEvent(unsigned char command, unsigned int firstObject, unsigned int secondObject, unsigned int flags)
void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
{
switch ( command )
{
case HLTV_ACTIVE : // we are connected to a proxy or listening to a multicast stream
// now we have to do some things clientside, since the proxy doesn't know our mod
g_iPlayerClass = 0;
g_iTeamNumber = 0;
iJumpSpectator = 0;
m_iMainMode = m_iInsetMode = 0;
m_iObserverTarget = m_lastPrimaryObject = m_lastSecondaryObject = 0;
m_flNextObserverInput = 0.0f;
memset( &m_OverviewEntities, 0, sizeof(m_OverviewEntities));
SetModes(MAIN_CHASE_FREE, INSET_OFF);
ParseOverviewFile();
LoadMapSprites();
SetSpectatorStartPosition();
break;
BEGIN_READ( pbuf, iSize );
case HLTV_CAMERA : if ( g_iUser1 == OBS_DIRECTED )
{
m_iObserverTarget = g_iUser2 = firstObject;
g_iUser3 = secondObject;
}
int cmd = READ_BYTE(); //read in what type of message it is
m_lastPrimaryObject = firstObject;
m_lastSecondaryObject = secondObject;
uiDirectorFlags = flags;
// gEngfuncs.Con_Printf("Director Camera: %i %i\n", firstObject, secondObject);
break;
switch ( cmd ) // director command byte
{
//sent by proxy
case DRC_CMD_START : // now we have to do some things clientside, since the proxy doesn't know our mod
{
g_iPlayerClass = 0;
g_iTeamNumber = 0;
default : gEngfuncs.Con_DPrintf("CHudSpectator::DirectorEvent: unknown director command.\n");
}
// fake a InitHUD & ResetHUD message
gHUD.MsgFunc_InitHUD(NULL,0, NULL);
gHUD.MsgFunc_ResetHUD(NULL, 0, NULL); // put all init stuff in
}
break;
//sent by client!
case DRC_CMD_EVENT :
{
m_lastPrimaryObject = READ_WORD();
m_lastSecondaryObject = READ_WORD();
// m_iObserverFlags = READ_LONG(); //TODO
//This section below was sent by Martin, but it seems to be a CS bit of code. I commented it out, and director mode works fine.
/* TODO
//this is where the magic happens!
//unfortunately we don't know what m_autoDirector is :/
if ( m_autoDirector->value )
{
if ( (g_iUser2 != m_lastPrimaryObject) || (g_iUser3 != m_lastSecondaryObject) )
V_ResetChaseCam();
g_iUser2 = m_lastPrimaryObject;
g_iUser3 = m_lastSecondaryObject;
}
*/
//I kept these two just in case
g_iUser2 = m_lastPrimaryObject;
g_iUser3 = m_lastSecondaryObject;
//some debug text
gEngfuncs.Con_Printf("Director Camera: %i %i\n", m_lastPrimaryObject,m_lastSecondaryObject);
}
break;
case DRC_CMD_TIMESCALE :
{
float scale = READ_FLOAT(); // if timescale was changed by slow motion effect
gEngfuncs.Con_Printf("HLTV Timescale: %f\n", scale );
}
break;
case DRC_CMD_STATUS:
{
int slots = READ_LONG(); // total number of spectator slots
int numspecs = READ_LONG(); // total number of spectator
int relays = READ_WORD(); // total number of relay proxies
// gViewPort->UpdateSpectatorPanel(); TODO //if you wanted to update a VGUI showing the number of spectators, do something here
gEngfuncs.Con_Printf("HLTV Status: %i / %i spectators, %i relays \n", numspecs, slots, relays );
}
break;
case DRC_CMD_MESSAGE:
{
//This message is from the "msg" command on the HLTV console, along with random "You are watching HLTV..." messages that I kept getting.
//The first 4 bytes are color, and 29 and on are the string. The rest I was too lazy to figure out.
char data[64];
memset( data, 0, 64 );
int i = 4;
int color = READ_LONG();
while( i < 29 ) // we dont know yet what the format of this data is. it represents duration, x and y positions on the screen
{
data[i] = READ_BYTE();
i++;
}
//29++ is the string
char *str = READ_STRING();
gEngfuncs.Con_Printf( "HLTV Message: %s \n", str );
}
break;
//below are some other messages that don't seem to be implemented. ( at least not by me )
case DRC_CMD_SOUND:
{
gEngfuncs.Con_Printf( "HLTV Sound: \n" );
}
break;
case DRC_CMD_FADE:
{
gEngfuncs.Con_Printf( "HLTV Fade: \n" );
}
break;
case DRC_CMD_SHAKE:
{
gEngfuncs.Con_Printf( "HLTV Shake!: \n" );
}
break;
case DRC_CMD_BANNER:
{
// gEngfuncs.Con_DPrintf("GUI: Banner %s\n",READ_STRING() );
// name of banner tga eg gfx/temp/7454562234563475.tga
//not yet supported
//gViewPort->m_pSpectatorPanel->m_TopBanner->LoadImage( READ_STRING() );
//gViewPort->UpdateSpectatorPanel();
}
break;
default:
gEngfuncs.Con_DPrintf("CHudSpectator::DirectorMessage: unknown command %i.\n", cmd );
break;
}
}
void CHudSpectator::FindNextPlayer(bool bReverse)
@ -472,6 +574,7 @@ void CHudSpectator::HandleButtonsUp( int ButtonPressed )
if ( ButtonPressed & (IN_MOVELEFT | IN_MOVERIGHT) )
m_moveDelta = 0.0f;
}
void CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode)
{
char string[32];
@ -576,7 +679,6 @@ void CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode)
SetModes( m_iMainMode, INSET_OFF );
}
gViewPort->UpdateSpectatorMenu();
}
bool CHudSpectator::IsActivePlayer(cl_entity_t * ent)
@ -617,6 +719,8 @@ bool CHudSpectator::ParseOverviewFile( )
sprintf(filename, "overviews/%s.txt", levelname );
strcpy( m_OverviewData.map, levelname );
pfile = (char *)gEngfuncs.COM_LoadFile( filename, 5, NULL);
if (!pfile)
@ -918,7 +1022,7 @@ void CHudSpectator::DrawOverviewEntities()
z = m_OverviewData.layersHeights[0] * zScale;
// get yellow/brown HUD color
UnpackRGB(ir,ig,ib, RGB_YELLOWISH);
UnpackRGB(ir,ig,ib, RGB_WHITE);
r = (float)ir/255.0f;
g = (float)ig/255.0f;
b = (float)ib/255.0f;
@ -1181,3 +1285,51 @@ bool CHudSpectator::AddOverviewEntityToList(HSPRITE sprite, cl_entity_t *ent, do
return false; // maximum overview entities reached
}
void CHudSpectator::Reset()
{
// Reset HUD
if ( strcmp( m_OverviewData.map, gEngfuncs.pfnGetLevelName() ) )
{
// update level overview if level changed
ParseOverviewFile();
LoadMapSprites();
}
memset( &m_OverviewEntities, 0, sizeof(m_OverviewEntities));
SetSpectatorStartPosition();
}
void CHudSpectator::InitHUDData()
{
m_lastPrimaryObject = m_lastSecondaryObject = 0;
m_flNextObserverInput = 0.0f;
// m_lastHudMessage = 0; //?
// m_iSpectatorNumber = 0; //?
iJumpSpectator = 0;
g_iUser1 = g_iUser2 = 0;
memset( &m_OverviewData, 0, sizeof(m_OverviewData));
memset( &m_OverviewEntities, 0, sizeof(m_OverviewEntities));
/* // this block was in martin's code - not clear what m_autoDirector is.
if ( gEngfuncs.IsSpectateOnly() || gEngfuncs.pDemoAPI->IsPlayingback() )
m_autoDirector->value = 1.0f;
else
m_autoDirector->value = 0.0f;
*/
Reset();
SetModes( OBS_CHASE_FREE, INSET_OFF );
CenterPrint(""); // Prevent stupid "Free Chase-Camera" on startup - gage
g_iUser2 = 0; // fake not target until first camera command
// reset HUD FOV
gHUD.m_iFOV = CVAR_GET_FLOAT("default_fov");
}

View file

@ -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 {
@ -72,7 +73,9 @@ public:
void HandleButtonsDown(int ButtonPressed);
void HandleButtonsUp(int ButtonPressed);
void FindNextPlayer( bool bReverse );
void DirectorEvent(unsigned char command, unsigned int firstObject, unsigned int secondObject, unsigned int flags);
void DirectorMessage( int iSize, void *pbuf );
void InitHUDData( void );
void Reset( void );
void SetSpectatorStartPosition();
int Init();
int VidInit();

View file

@ -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;

View file

@ -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,13 +457,9 @@ 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);
__CmdFunc_InputPlayerSpecial();
gHUD.m_Spectator.HandleButtonsDown( IN_ATTACK2 );
}
@ -484,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);}
@ -501,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)
{
@ -788,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;
@ -853,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;
@ -871,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;
@ -883,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;
}
@ -951,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);
@ -966,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);
@ -989,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

@ -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

@ -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

@ -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"

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

@ -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 );

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

@ -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

@ -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
@ -284,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
@ -309,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
@ -357,9 +346,6 @@ enum
// Yet MORE Admin Commands
#define TF_ADMIN_LISTIPS 198
// Silent Spy Feign
#define TF_SPY_SILENTDIE 199
/*==================================================*/
/* Colors */
@ -455,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
@ -480,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)
@ -512,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
@ -687,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 4
#define PC_DEMOMAN_GRENADE_INIT_2 4
#define PC_DEMOMAN_TF_ITEMS 0
// Class Details for COMBAT MEDIC
#define PC_MEDIC_SKIN 3
#define PC_MEDIC_MAXHEALTH 90
@ -891,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
@ -1046,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
@ -1107,24 +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_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
@ -1142,8 +1075,6 @@ 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
@ -1285,7 +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 weaponstay, flashlight, aimcrosshair, teamplay;
/*==========================================================================*/
class CTFFlame : public CBaseMonster

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

@ -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

@ -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

@ -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

@ -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

@ -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;
}
@ -194,13 +205,12 @@ void CommandButton::paintBackground()
{
if ( isArmed() )
{
// Orange highlight background
drawSetColor( Scheme::sc_primary2 );
drawSetColor(TW_COMMANDBUTTON_ACTIVE_RGBA);
drawFilledRect(0,0,_size[0],_size[1]);
}
// Orange Border
drawSetColor( Scheme::sc_secondary1 );
// Border
drawSetColor(TW_COMMANDBUTTON_BORDER_RGBA);
drawOutlinedRect(0,0,_size[0],_size[1]);
}
@ -306,6 +316,23 @@ 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 )
@ -389,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;
}
}

View file

@ -29,7 +29,8 @@
#include "const.h"
#include "vgui_int.h"
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#include "vgui_ServerBrowser.h"
#define MOTD_TITLE_X XRES(16)
@ -46,26 +47,25 @@
class CMessageWindowPanel : public CMenuPanel
{
public:
CMessageWindowPanel( const char *szMOTD, const char *szTitle, int iShadeFullScreen, int iRemoveMe, int x, int y, int wide, int tall );
CMessageWindowPanel( const char *szMOTD, const char *szTitle, int iShadeFullScreen, int iRemoveMe, int iTextType, int x, int y, int wide, int tall );
void paintBackground();
private:
CTransparentPanel *m_pBackgroundPanel;
};
//-----------------------------------------------------------------------------
// Purpose: Creates a new CMessageWindowPanel
// Output : CMenuPanel - interface to the panel
//-----------------------------------------------------------------------------
CMenuPanel *CMessageWindowPanel_Create( const char *szMOTD, const char *szTitle, int iShadeFullscreen, int iRemoveMe, int x, int y, int wide, int tall )
CMenuPanel *CMessageWindowPanel_Create( const char *szMOTD, const char *szTitle, int iShadeFullscreen, int iRemoveMe, int iTextType, int x, int y, int wide, int tall )
{
return new CMessageWindowPanel( szMOTD, szTitle, iShadeFullscreen, iRemoveMe, x, y, wide, tall );
return new CMessageWindowPanel( szMOTD, szTitle, iShadeFullscreen, iRemoveMe, iTextType, x, y, wide, tall );
}
//-----------------------------------------------------------------------------
// Purpose: Constructs a message panel
//-----------------------------------------------------------------------------
CMessageWindowPanel::CMessageWindowPanel( const char *szMOTD, const char *szTitle, int iShadeFullscreen, int iRemoveMe, int x, int y, int wide, int tall ) : CMenuPanel( iShadeFullscreen ? 100 : 255, iRemoveMe, x, y, wide, tall )
CMessageWindowPanel::CMessageWindowPanel( const char *szMOTD, const char *szTitle, int iShadeFullscreen, int iRemoveMe, int iTextType, int x, int y, int wide, int tall ) : CMenuPanel( iShadeFullscreen ? 100 : 255, iRemoveMe, x, y, wide, tall )
{
// Get the scheme used for the Titles
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
@ -80,7 +80,7 @@ CMessageWindowPanel::CMessageWindowPanel( const char *szMOTD, const char *szTitl
// Create the window
m_pBackgroundPanel = new CTransparentPanel( iShadeFullscreen ? 255 : 100, MOTD_WINDOW_X, MOTD_WINDOW_Y, MOTD_WINDOW_SIZE_X, MOTD_WINDOW_SIZE_Y );
m_pBackgroundPanel->setParent( this );
m_pBackgroundPanel->setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0)) );
// m_pBackgroundPanel->setBorder(new LineBorder(Color(TW_PANEL_BORDER_RGBA)));
m_pBackgroundPanel->setVisible( true );
int iXSize,iYSize,iXPos,iYPos;
@ -142,13 +142,29 @@ CMessageWindowPanel::CMessageWindowPanel( const char *szMOTD, const char *szTitl
pScrollPanel->validate();
CommandButton *pButton = new CommandButton( CHudTextMessage::BufferedLocaliseTextString( "#Menu_OK" ), iXPos + XRES(16), iYPos + iYSize - YRES(16) - BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y);
pButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
pButton->setParent(this);
switch(iTextType)
{
case SHOW_MOTD:
pButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
pButton->addActionSignal(new CMenuHandler_TextWindow(MENU_MAPBRIEFING));
break;
case SHOW_MAPBRIEFING:
pButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
pButton->addActionSignal(new CMenuHandler_TextWindow(MENU_ITEMSELECTION));
break;
}
pButton->setParent(this);
}
void CMessageWindowPanel::paintBackground()
{
drawSetColor(TW_PANEL_BORDER_RGBA);
drawOutlinedRect(0,0,_size[0],_size[1]);
}

View file

@ -166,7 +166,7 @@ CSchemeManager::CSchemeManager( int xRes, int yRes )
// find the closest matching scheme file to our resolution
char token[1024];
char *pFile = (char*)LoadFileByResolution( "", xRes, "_textscheme.txt" );
char *pFile = (char*)LoadFileByResolution( "gfx/vgui/", xRes, "_textscheme.txt" );
m_xRes = xRes;
char *pFileStart = pFile;

View file

@ -24,10 +24,11 @@
#include "const.h"
#include "entity_state.h"
#include "cl_entity.h"
#include "vgui_TeamFortressViewport.h"
#include "vgui_ScorePanel.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#include "..\game_shared\vgui_helpers.h"
#include "..\game_shared\vgui_loadtga.h"
#include "vgui_ScorePanel.h"
hud_player_info_t g_PlayerInfoList[MAX_PLAYERS+1]; // player info from the engine
extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; // additional player info sent directly to the client dll
@ -35,7 +36,6 @@ team_info_t g_TeamInfo[MAX_TEAMS+1];
int g_IsSpectator[MAX_PLAYERS+1];
int HUD_IsGame( const char *game );
int EV_TFC_IsAllyTeam( int iTeam1, int iTeam2 );
// Scoreboard dimensions
#define SBOARD_TITLE_SIZE_Y YRES(22)
@ -57,7 +57,6 @@ SBColumnInfo g_ColumnInfo[NUM_COLUMNS] =
{
{NULL, 24, Label::a_east},
{NULL, 140, Label::a_east}, // name
{NULL, 56, Label::a_east}, // class
{"#SCORE", 40, Label::a_east},
{"#DEATHS", 46, Label::a_east},
{"#LATENCY", 46, Label::a_east},
@ -71,7 +70,6 @@ SBColumnInfo g_ColumnInfo[NUM_COLUMNS] =
#define TEAM_SPECTATORS 2
#define TEAM_BLANK 3
//-----------------------------------------------------------------------------
// ScorePanel::HitTestPanel.
//-----------------------------------------------------------------------------
@ -84,8 +82,6 @@ void ScorePanel::HitTestPanel::internalMousePressed(MouseCode code)
}
}
//-----------------------------------------------------------------------------
// Purpose: Create the ScoreBoard panel
//-----------------------------------------------------------------------------
@ -97,7 +93,12 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
Font *tfont = pSchemes->getFont(hTitleScheme);
Font *smallfont = pSchemes->getFont(hSmallScheme);
setBgColor(0, 0, 0, 96);
setBgColor(TW_PANEL_BG_RGBA);
LineBorder *border = new LineBorder(Color(TW_PANEL_BORDER_RGBA));
setBorder(border);
setPaintBorderEnabled(true);
m_pCurrentHighlightLabel = NULL;
m_iHighlightRow = -1;
@ -108,10 +109,6 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
m_TitleLabel.setFgColor( Scheme::sc_primary1 );
m_TitleLabel.setContentAlignment( vgui::Label::a_west );
LineBorder *border = new LineBorder(Color(60, 60, 60, 128));
setBorder(border);
setPaintBorderEnabled(true);
int xpos = g_ColumnInfo[0].m_Width + 3;
if (ScreenWidth >= 640)
{
@ -262,7 +259,7 @@ void ScorePanel::Update()
}
// If it's not teamplay, sort all the players. Otherwise, sort the teams.
if ( !gHUD.m_Teamplay )
if ( gHUD.m_Gamemode != 2 )
SortPlayers( 0, NULL );
else
SortTeams();
@ -628,11 +625,11 @@ void ScorePanel::FillGrid()
if ( pl_info->thisplayer ) // if it is their name, draw it a different color
{
// Highlight this player
pLabel->setFgColor(Scheme::sc_white);
pLabel->setFgColor(TW_SCOREPANEL_HIGHLIGHT_TEXT_RGBA);
pLabel->setBgColor( iTeamColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][0],
iTeamColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][1],
iTeamColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][2],
196 );
TW_SCOREPANEL_HIGHLIGHT_COLOR_A );
}
else if ( m_iSortedRows[row] == m_iLastKilledBy && m_fLastKillTime && m_fLastKillTime > gHUD.m_flTime )
{
@ -642,7 +639,7 @@ void ScorePanel::FillGrid()
}
// Align
if (col == COLUMN_NAME || col == COLUMN_CLASS)
if (col == COLUMN_NAME)
{
pLabel->setContentAlignment( vgui::Label::a_west );
}
@ -693,8 +690,6 @@ void ScorePanel::FillGrid()
break;
case COLUMN_VOICE:
break;
case COLUMN_CLASS:
break;
case COLUMN_KILLS:
if ( m_iIsATeam[row] == TEAM_YES )
sprintf(sz, "%d", team_info->frags );
@ -728,35 +723,6 @@ void ScorePanel::FillGrid()
GetClientVoiceMgr()->UpdateSpeakerImage(pLabel, m_iSortedRows[row]);
}
break;
case COLUMN_CLASS:
// No class for other team's members (unless allied or spectator)
if ( gViewPort && EV_TFC_IsAllyTeam( g_iTeamNumber, g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber ) )
bShowClass = true;
// Don't show classes if this client hasnt picked a team yet
if ( g_iTeamNumber == 0 )
bShowClass = false;
if (bShowClass)
{
// Only print Civilian if this team are all civilians
bool bNoClass = false;
if ( g_PlayerExtraInfo[ m_iSortedRows[row] ].playerclass == 0 )
{
if ( gViewPort->GetValidClasses( g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber ) != -1 )
bNoClass = true;
}
if (bNoClass)
sprintf(sz, "");
else
sprintf( sz, "%s", CHudTextMessage::BufferedLocaliseTextString( sLocalisedClasses[ g_PlayerExtraInfo[ m_iSortedRows[row] ].playerclass ] ) );
}
else
{
strcpy(sz, "");
}
break;
case COLUMN_TRACKER:
break;
case COLUMN_KILLS:
@ -955,7 +921,7 @@ void CLabelHeader::paint()
if (gViewPort->GetScoreBoard()->m_iHighlightRow == _row)
{
setFgColor(255, 255, 255, 0);
setFgColor(255,255, 255, 0);
}
// draw text

View file

@ -24,13 +24,12 @@
// Scoreboard cells
#define COLUMN_TRACKER 0
#define COLUMN_NAME 1
#define COLUMN_CLASS 2
#define COLUMN_KILLS 3
#define COLUMN_DEATHS 4
#define COLUMN_LATENCY 5
#define COLUMN_VOICE 6
#define COLUMN_BLANK 7
#define NUM_COLUMNS 8
#define COLUMN_KILLS 2
#define COLUMN_DEATHS 3
#define COLUMN_LATENCY 4
#define COLUMN_VOICE 5
#define COLUMN_BLANK 6
#define NUM_COLUMNS 7
#define NUM_ROWS (MAX_PLAYERS + (MAX_SCOREBOARD_TEAMS * 2))
using namespace vgui;
@ -259,6 +258,8 @@ private:
vgui::CListBox m_PlayerList;
CGrid m_PlayerGrids[NUM_ROWS]; // The grid with player and team info.
CLabelHeader m_PlayerEntries[NUM_COLUMNS][NUM_ROWS]; // Labels for the grid entries.
// WastesBitmapTGA *m_pBackground;
Label *m_pBackgroundLabel;
ScorePanel::HitTestPanel m_HitTestPanel;
@ -277,10 +278,18 @@ public:
int m_iLastKilledBy;
int m_fLastKillTime;
public:
ScorePanel(int x,int y,int wide,int tall);
~ScorePanel()
{
// if(m_pBackground != NULL)
// delete m_pBackground;
// if(m_pBackgroundLabel != NULL)
// delete m_pBackgroundLabel;
Panel::~Panel();
}
void Update( void );

View file

@ -17,7 +17,8 @@
#include "hud_servers.h"
#include "net_api.h"
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#include "vgui_ServerBrowser.h"
using namespace vgui;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -22,7 +22,8 @@
#include "const.h"
#include "camera.h"
#include "in_defs.h"
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
#include "vgui_ControlConfigPanel.h"
namespace
@ -87,9 +88,8 @@ void VGui_Startup()
Panel* root=(Panel*)VGui_GetPanel();
root->setBgColor(128,128,0,0);
//root->setNonPainted(false);
//root->setBorder(new LineBorder());
//root->setBorder(new LineBorder(Color(TW_PANEL_BORDER_RGBA)));
root->setLayout(new BorderLayout(0));
//root->getSurfaceBase()->setEmulatedCursorVisible(true);
@ -105,7 +105,7 @@ void VGui_Startup()
}
else
{
gViewPort = new TeamFortressViewport(0,0,root->getWide(),root->getTall());
gViewPort = new TheWastesViewport(0,0,root->getWide(),root->getTall());
gViewPort->setParent(root);
}
@ -113,7 +113,6 @@ void VGui_Startup()
TexturePanel* texturePanel=new TexturePanel();
texturePanel->setParent(gViewPort);
*/
}
void VGui_Shutdown()

View file

@ -23,7 +23,8 @@
#include "hud.h"
#include "cl_util.h"
#include "vgui_TeamFortressViewport.h"
#include "tw_vgui.h"
#include "vgui_TheWastesViewport.h"
// Team Menu Dimensions
#define TEAMMENU_TITLE_X XRES(40)
@ -74,7 +75,7 @@ CTeamMenuPanel::CTeamMenuPanel(int iTrans, int iRemoveMe, int x,int y,int wide,i
// Create the Info Window
m_pTeamWindow = new CTransparentPanel( 255, TEAMMENU_WINDOW_X, TEAMMENU_WINDOW_Y, TEAMMENU_WINDOW_SIZE_X, TEAMMENU_WINDOW_SIZE_Y );
m_pTeamWindow->setParent( this );
m_pTeamWindow->setBorder( new LineBorder( Color(255*0.7,170*0.7,0,0 )) );
// m_pTeamWindow->setBorder( new LineBorder( Color(255*0.7,170*0.7,0,0 )) );
// Create the Map Name Label
m_pMapTitle = new Label( "", TEAMMENU_WINDOW_TITLE_X, TEAMMENU_WINDOW_TITLE_Y );

View file

@ -23,6 +23,7 @@
#include "screenfade.h"
#include "shake.h"
ref_params_t *g_pparams; // pointer from V_CalcRefDef
// Spectator Mode
extern "C"
@ -49,10 +50,12 @@ extern "C"
int PM_GetInfo( int ent );
void InterpolateAngles( float *start, float *end, float *output, float frac );
float AngleBetweenVectors( float * v1, float * v2 );
}
void V_DropPunchAngle ( float frametime, float *ev_punchangle );
void V_Sway(struct ref_params_s *pparams);
void V_StopSway();
void V_DisableFade();
void VectorAngles( const float *forward, float *angles );
/*
@ -71,6 +74,16 @@ vec3_t v_origin, v_angles;
vec3_t ev_punchangle;
extern float g_lastFOV; // If this is set we dont render a view mdl
// Thermal
int ev_thermal = 0;
// Swaying
float ev_swayscale = 0;
float ev_scaleclamp;
int ev_swayenabled = 0;
cvar_t *scr_ofsx;
cvar_t *scr_ofsy;
cvar_t *scr_ofsz;
@ -497,7 +510,6 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
scr_ofsz->value = 0.0;
}
V_DriftPitch ( pparams );
// ent is the player model ( visible when out of body )
@ -747,6 +759,13 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
V_DropPunchAngle ( pparams->frametime, (float *)&ev_punchangle );
// Client side sway, if any
// Clear sway if player is dead
if(ev_swayenabled && pparams->health)
V_Sway(pparams);
else
V_StopSway(); // reset swayangle
// smooth out stair step ups
#if 1
if ( !pparams->smoothing && pparams->onground && pparams->simorg[2] - oldz > 0)
@ -884,6 +903,20 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
v_origin = pparams->vieworg;
// There is a bug with removing
// the view model, being it plays
// The current animation over again.
// So instead we just move the viewmodel
// so far away that the player will never see it.
// TODO: Do this without letting the player see his vmdl.
if(g_lastFOV)
{
view->model = NULL;
// view->origin[2] = v_origin[2] - 64;
// view->origin[1] = v_origin[1] - 64;
// view->origin[0] = v_origin[0];
}
}
void V_GetInEyePos(int entity, float * origin, float * angles )
@ -1166,6 +1199,8 @@ void V_CalcSpectatorRefdef ( struct ref_params_s *pparams )
void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
{
g_pparams = pparams; // set global pointer
// intermission / finale rendering
if ( pparams->intermission )
{
@ -1180,24 +1215,20 @@ void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
V_CalcNormalRefdef ( pparams );
}
/*
// Example of how to overlay the whole screen with red at 50 % alpha
#define SF_TEST
#if defined SF_TEST
// H&K G11 Thermal Scope
if(ev_thermal)
{
screenfade_t sf;
gEngfuncs.pfnGetScreenFade( &sf );
gEngfuncs.pfnGetScreenFade(&sf);
sf.fader = 255;
sf.fadeg = 0;
sf.fadeb = 0;
sf.fadealpha = 128;
sf.fadeFlags = FFADE_STAYOUT | FFADE_OUT;
sf.fadealpha = 225;
sf.fadeFlags = FFADE_MODULATE|FFADE_STAYOUT|FFADE_OUT;
gEngfuncs.pfnSetScreenFade( &sf );
gEngfuncs.pfnSetScreenFade(&sf);
}
#endif
*/
}
/*
@ -1228,6 +1259,72 @@ void V_PunchAxis( int axis, float punch )
ev_punchangle[ axis ] = punch;
}
void V_DisableFade()
{
screenfade_t sf;
gEngfuncs.pfnGetScreenFade(&sf);
sf.fader = 0;
sf.fadeg = 0;
sf.fadeb = 0;
sf.fadealpha = 0;
sf.fadeFlags = FFADE_IN;
gEngfuncs.pfnSetScreenFade(&sf);
ev_thermal = 0;
}
/*
=============
V_SetSway
Client side crosshair sway
=============
*/
void V_SetSway(float scale)
{
// Settings
ev_swayscale = scale;
ev_scaleclamp = scale * 0.1; // 1/10th of the original scale
// Tell view logic to sway
ev_swayenabled = 1;
}
/*
=============
V_StopSway
Kill the sway
=============
*/
void V_StopSway()
{
// No more sway
ev_swayenabled = 0;
}
/*
=============
V_Sway
Portray sway on clients screen
=============
*/
void V_Sway(struct ref_params_s *pparams)
{
pparams->viewangles[ROLL] += ev_swayscale * sin(pparams->time*v_iroll_cycle.value) * v_iroll_level.value;
pparams->viewangles[PITCH] += ev_swayscale * sin(pparams->time*v_ipitch_cycle.value) * v_ipitch_level.value;
pparams->viewangles[YAW] += ev_swayscale * sin(pparams->time*v_iyaw_cycle.value) * v_iyaw_level.value;
// start to reduce sway
ev_swayscale -= 0.35*pparams->frametime;
if(ev_swayscale < ev_scaleclamp)
ev_swayscale = ev_scaleclamp;
}
/*
=============
V_Init
@ -1250,7 +1347,6 @@ void V_Init (void)
cl_waterdist = gEngfuncs.pfnRegisterVariable( "cl_waterdist","4", 0 );
}
//#define TRACE_TEST
#if defined( TRACE_TEST )

View file

@ -292,7 +292,6 @@ typedef struct model_s
// additional model data
//
cache_user_t cache; // only access through Mod_Extradata
} model_t;
typedef vec_t vec4_t[4];

View file

@ -639,7 +639,6 @@
#endif
// Break Model Defines
#define BREAK_TYPEMASK 0x4F
#define BREAK_GLASS 0x01
#define BREAK_METAL 0x02

View file

@ -32,7 +32,7 @@
#define IN_ATTACK2 (1 << 11)
#define IN_RUN (1 << 12)
#define IN_RELOAD (1 << 13)
#define IN_ALT1 (1 << 14)
#define IN_SPECIAL (1 << 14)
#define IN_SCORE (1 << 15) // Used by client.dll for when scoreboard is held down
#endif // IN_BUTTONS_H

View file

@ -72,4 +72,6 @@ typedef struct ref_params_s
int onlyClientDraw; // if !=0 nothing is drawn by the engine except clientDraw functions
} ref_params_t;
extern ref_params_t *g_pparams; // pointer to g_pparams from CalcRefdef
#endif // !REF_PARAMSH

1361
common/thewastes.h Normal file

File diff suppressed because it is too large Load diff

454
common/tw_common.h Normal file
View file

@ -0,0 +1,454 @@
/***
*
* 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_COMMON_H_
#define __TW_COMMON_H_
//
// This Header contains generic client /
// server module shared information
//
#ifdef TW_BETA
#define TW_BANNER "The Wastes RC 2 (Build 200) %s NOT FOR DISTRIBUTION"
#endif
// Bleeding / Composure / Willpower settings
#define PLAYER_BLEED_LIMIT 20
#define PLAYER_COMPOSURE_LIMIT 80
#define PLAYER_WILLPOWER_LIMIT_LO 40
#define PLAYER_WILLPOWER_LIMIT_HI 60
// Animation enums
enum single_pistol_anim_e {
SPISTOL_IDLE = 0,
SPISTOL_RELOAD,
SPISTOL_RELOAD_EMPTY,
SPISTOL_RELOAD2,
SPISTOL_RELOAD2_EMPTY,
SPISTOL_DRAW,
SPISTOL_DRAW_EMPTY,
SPISTOL_SHOOT,
SPISTOL_SHOOT_LAST,
SPISTOL_SHOOT_EMPTY,
SPISTOL_WHIP1,
SPISTOL_WHIP1_EMPTY,
SPISTOL_WHIP2,
SPISTOL_WHIP2_EMPTY,
SPISTOL_AIM_IDLE,
SPISTOL_AIM_SHOOT,
SPISTOL_AIM_SHOOT_LAST,
SPISTOL_AIM_SHOOT_EMPTY,
SPISTOL_GOTO_AIM,
SPISTOL_GOTO_AIM_EMPTY,
SPISTOL_END_AIM,
SPISTOL_END_AIM_EMPTY,
};
enum single_ruger_anim_e {
RUGER_IDLE = 0,
RUGER_IDLE2,
RUGER_RELOAD,
RUGER_DRAW,
RUGER_SHOOT,
RUGER_SHOOT_EMPTY,
RUGER_AIM_IDLE,
RUGER_AIM_SHOOT,
RUGER_GOTO_AIM,
RUGER_END_AIM
};
enum handcannon_anim_e {
HC_IDLE = 0,
HC_SHOOT,
HC_SHOOT_LAST,
HC_SHOOT_EMPTY,
HC_RELOAD_EMPTY,
HC_RELOAD,
HC_DRAW,
HC_DRAW_EMPTY
};
enum single_sawedoff_anim_e {
SAWED_IDLE = 0,
SAWED_SHOOT_L,
SAWED_SHOOT_R,
SAWED_SHOOT_BOTH,
SAWED_SHOOT_EMPTY,
SAWED_RELOAD,
SAWED_DRAW,
};
enum mossberg_anim_e {
MOSSBERG_IDLE = 0,
MOSSBERG_IDLE2,
MOSSBERG_IDLE3,
MOSSBERG_GOTO_RELOAD,
MOSSBERG_RELOAD,
MOSSBERG_END_RELOAD,
MOSSBERG_DRAW,
MOSSBERG_SHOOT,
MOSSBERG_SHOOT2,
MOSSBERG_SHOOT_EMPTY,
MOSSBERG_WHIP,
};
enum winchester_anim_e {
WINNY_IDLE = 0,
WINNY_SHOOT,
WINNY_SHOOT2,
WINNY_RELOAD_MIDDLE,
WINNY_RELOAD_END,
WINNY_RELOAD_START,
WINNY_DRAW,
};
enum smg9_anim_e {
SMG9_IDLE = 0,
SMG9_RELOAD,
SMG9_RELOAD_EMPTY,
SMG9_DRAW,
SMG9_SHOOT,
SMG9_SHOOT_EMPTY,
SMG9_SECONDARY_IDLE,
SMG9_SECONDARY_SHOOT,
SMG9_SECONDARY_SHOOT_EMPTY,
SMG9_SECONDARY_RELOAD,
SMG9_GOTO_SECONDARY,
SMG9_END_SECONDARY,
SMG9_SECONDARY_DRAW,
};
enum fnfal_anim_e {
FNFAL_IDLE1 = 0,
FNFAL_IDLE2,
FNFAL_RELOAD,
FNFAL_DRAW,
FNFAL_SHOOT,
FNFAL_SHOOT_EMPTY,
FNFAL_AIM_IDLE,
FNFAL_AIM_SHOOT,
FNFAL_AIM_SHOOT_EMPTY,
FNFAL_GOTO_AIM,
FNFAL_END_AIM,
};
enum tommygun_anim_e {
TOMMYGUN_IDLE = 0,
TOMMYGUN_IDLE1,
TOMMYGUN_IDLE2,
TOMMYGUN_RELOAD,
TOMMYGUN_DRAW,
TOMMYGUN_SHOOT,
TOMMYGUN_SHOOT_EMPTY,
};
enum jackhammer_anim_e {
JACKHAMMER_IDLE = 0,
JACKHAMMER_RELOAD,
JACKHAMMER_DRAW,
JACKHAMMER_SHOOT,
};
enum g11_anim_e {
G11_IDLE = 0,
G11_SHOOT,
G11_BURST,
G11_SHOOT_EMPTY,
G11_DRAW,
G11_RELOAD,
G11_ACTIVATE_SCOPE,
G11_DEACTIVATE_SCOPE,
};
enum boltrifle_anim_e {
BOLTRIFLE_IDLE1 = 0,
BOLTRIFLE_RELOAD_EMPTY,
BOLTRIFLE_RELOAD,
BOLTRIFLE_DRAW,
BOLTRIFLE_SHOOT,
BOLTRIFLE_SHOOT_LAST,
BOLTRIFLE_STRIKE,
};
enum ak_pistols_anim_e {
AKPISTOLS_IDLE = 0,
AKPISTOLS_RSHOOT_LFULL,
AKPISTOLS_RSHOOTLAST_LFULL,
AKPISTOLS_RSHOOT_LEMPTY,
AKPISTOLS_RSHOOTLAST_LEMPTY,
AKPISTOLS_LSHOOT_RFULL,
AKPISTOLS_LSHOOTLAST_RFULL,
AKPISTOLS_LSHOOT_REMPTY,
AKPISTOLS_LSHOOTLAST_REMPTY,
AKPISTOLS_RELOAD_EMPTY,
AKPISTOLS_RELOAD2_EMPTY,
AKPISTOLS_RELOAD,
AKPISTOLS_DRAW,
};
enum sten_anim_e {
STEN_IDLE = 0,
STEN_IDLE_SILENCED,
STEN_RELOAD,
STEN_RELOAD_SILENCED,
STEN_ADDSILENCER,
STEN_REMSILENCER,
STEN_DRAW,
STEN_DRAW_SILENCED,
STEN_SHOOT,
STEN_SHOOT_SILENCED,
STEN_SHOOT_EMPTY,
STEN_SHOOT_EMPTY_SILENCED,
};
enum anim_molotov_e {
MOLOTOV_IDLE = 0,
MOLOTOV_LIGHT,
MOLOTOV_THROW,
MOLOTOV_HOLSTER,
MOLOTOV_DRAW,
};
enum anim_frag_e {
FRAG_IDLE = 0,
FRAG_DRAW,
FRAG_GOTOTHROW,
FRAG_GOTOTHROW2,
FRAG_THROW,
};
enum anim_pipebomb_e {
PIPEBOMB_IDLE = 0,
PIPEBOMB_DRAW,
PIPEBOMB_GOTOTHROW,
PIPEBOMB_THROW,
};
enum anim_combatknife_e {
COMBATKNIFE_IDLE1 = 0,
COMBATKNIFE_DRAW,
COMBATKNIFE_HOLSTER,
COMBATKNIFE_ATTACK1,
COMBATKNIFE_ATTACK1MISS,
COMBATKNIFE_ATTACK2,
COMBATKNIFE_ATTACK2HIT,
COMBATKNIFE_ATTACK3,
COMBATKNIFE_ATTACK3HIT,
COMBATKNIFE_IDLE2,
COMBATKNIFE_IDLE3,
};
enum anim_throwingknife_e {
TKNIFE_IDLE1 = 0,
TKNIFE_IDLE2,
TKNIFE_DRAW,
TKNIFE_GOTOTHROW,
TKNIFE_THROW,
};
enum anim_baseballbat_e {
BAT_IDLE = 0,
BAT_DRAW,
BAT_ATTACK1,
BAT_ATTACK1_MISS,
BAT_ATTACK2,
BAT_ATTACK2_MISS,
BAT_ATTACK3,
BAT_ATTACK3_MISS,
};
enum anim_sledgehammer_e {
SLEDGE_IDLE = 0,
SLEDGE_DRAW,
SLEDGE_ATTACK1,
SLEDGE_ATTACK1_MISS,
SLEDGE_ATTACK2,
SLEDGE_ATTACK2_MISS,
};
enum anim_katana_e {
KATANA_ST1_IDLE = 0,
KATANA_ST2_IDLE,
KATANA_ST1_ATTACK1,
KATANA_ST2_ATTACK1,
KATANA_ST2_ATTACK2,
KATANA_ST1_GOTO_ST2,
KATANA_ST2_GOTO_ST1,
KATANA_DRAW,
};
enum anim_spear_e {
SPEAR_IDLE1 = 0,
SPEAR_IDLE2,
SPEAR_DRAW,
SPEAR_ATTACK1,
SPEAR_ATTACK2,
SPEAR_GOTO_THROW,
SPEAR_THROW,
SPEAR_GOTO_STAB,
};
enum anim_cattleprod_e {
PROD_IDLE1 = 0,
PROD_DRAW,
PROD_ATTACK1,
PROD_ATTACK1MISS,
PROD_ATTACK2,
PROD_ATTACK2MISS,
};
enum anim_akimbo_e {
AKIMBO_IDLE1 = 0,
AKIMBO_RSHOOT,
AKIMBO_RSHOOTLAST,
AKIMBO_RSHOOT_LEMPTY,
AKIMBO_RSHOOTLAST_LEMPTY,
AKIMBO_LSHOOT,
AKIMBO_LSHOOTLAST,
AKIMBO_LSHOOT_REMPTY,
AKIMBO_LSHOOTLAST_REMPTY,
AKIMBO_LSHOOTEMPTY,
AKIMBO_RSHOOTEMPTY,
AKIMBO_RELOAD_EMPTY,
AKIMBO_RELOAD2_EMPTY,
AKIMBO_RELOAD,
AKIMBO_DRAW,
};
enum anim_akimbosawedoffs_e {
AKIMBOSS_IDLE1,
AKIMBOSS_RELOAD,
AKIMBOSS_DRAW,
AKIMBOSS_RSHOOT,
AKIMBOSS_LSHOOT,
AKIMBOSS_BSHOOT,
};
// Used by akimbo weapons
enum akimbo_hand_e { AH_LEFT, AH_RIGHT };
// This is a list of all the wasteland weapons, as well
// as their categories. Used mainly by the client, but
// used a few places serverside as well.
enum e_weapcategory {
CAT_NONE = 0,
CAT_MELEE,
CAT_SIDEARM,
CAT_PRIMARY,
CAT_UNIQUE,
CAT_ITEM,
};
typedef struct playeritem_s
{
char *weapon_classname;
char *ammo_classname;
int num_ammospawns;
int category;
} playeritem_t;
typedef struct playeritemlist_s
{
playeritem_t *array;
int size;
} playeritemlist_t;
extern playeritemlist_t g_MeleeItems;
extern playeritemlist_t g_SidearmItems;
extern playeritemlist_t g_PrimaryItems;
extern playeritemlist_t g_UniqueItems;
extern playeritemlist_t g_OtherItems;
// Wall Penetration macros to sync between client / server
enum penetration_types_e
{
P_NONE = 0,
P_BERETTA,
P_COLT,
P_RUGER,
P_DEAGLE,
P_HANDCANNON,
P_WINCHESTER,
P_SMG9,
P_FNFAL,
P_TOMMYGUN,
P_G11,
P_BOLTRIFLE,
P_STEN,
};
#define MAX_WALLCOUNT 8 // max number of walls we can penetrate
#define MAX_THICKNESS_BERETTA 9.0
#define MAX_THICKNESS_COLT 17.0
#define MAX_THICKNESS_RUGER 55.0
#define MAX_THICKNESS_DEAGLE 52.5
#define MAX_THICKNESS_HANDCANNON 45.0
#define MAX_THICKNESS_WINCHESTER 30.0
#define MAX_THICKNESS_SMG9 7.0
#define MAX_THICKNESS_FNFAL 59.0
#define MAX_THICKNESS_TOMMYGUN 14.0
#define MAX_THICKNESS_G11 55.0
#define MAX_THICKNESS_BOLTRIFLE 59.0
#define MAX_THICKNESS_STEN 9.0
// Must be >1, how weak the round
// gets as it goes through walls.
#define FALLOFF_BERETTA 3.0
#define FALLOFF_COLT 2.5
#define FALLOFF_RUGER 2.0
#define FALLOFF_DEAGLE 2.1
#define FALLOFF_HANDCANNON 1.75
#define FALLOFF_WINCHESTER 2.5
#define FALLOFF_SMG9 3.0
#define FALLOFF_FNFAL 1.25
#define FALLOFF_TOMMYGUN 3.0
#define FALLOFF_G11 2.25
#define FALLOFF_BOLTRIFLE 1.25
#define FALLOFF_STEN 3.0
// prxoy director stuff
#define DRC_EVENT 3 // informs the dircetor about ann important game event
//#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
//#define DRC_FLAG_DRAMATIC (1<<5)
// sub commands of svc_director:
#define DRC_CMD_NONE 0 // NULL director command
#define DRC_CMD_START 1 // start director mode
#define DRC_CMD_EVENT 2 // informs about director event
#define DRC_CMD_MODE 3 // switches camera modes
#define DRC_CMD_CAMERA 4 // sets camera registers
#define DRC_CMD_TIMESCALE 5 // sets time scale
#define DRC_CMD_MESSAGE 6 // send HUD centerprint
#define DRC_CMD_SOUND 7 // plays a particular sound
#define DRC_CMD_STATUS 8 // status info about broadcast
#define DRC_CMD_BANNER 9 // banner file name for HLTV gui
#define DRC_CMD_FADE 10 // send screen fade command
#define DRC_CMD_SHAKE 11 // send screen shake command
#define DRC_CMD_STUFFTEXT 12 // like the normal svc_stufftext but as director command
#define DRC_CMD_LAST 13
// HLTV_EVENT event flags
#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
#define DRC_FLAG_SIDE (1<<4) //I assume this draws the action from the side - Mugsy
#define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene
#define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo
#define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc)
#define DRC_FLAG_INTRO (1<<8) // is a introduction scene
#define DRC_FLAG_FINAL (1<<9) // is a final scene
#define DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data
#endif

97
common/twm.h Normal file
View file

@ -0,0 +1,97 @@
/***
*
* 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.
*
***/
//
// The Wastes Model format description
//
#ifndef __TWM_H_
#define __TWM_H_
#define TWM_ID (('1'<<24)+('M'<<16)+('W'<<8)+'T') // little-endian "TWM1" -> bitwise shifts rock
#define TWM_MAJOR_VERSION 2
#define TWM_MINOR_VERSION 0
typedef float twm_vert_t[3];
typedef struct twm_triangle_s
{
short vert_indices[3]; // index into vertex_lump
// Texture info
float u[3];
float v[3];
} twm_triangle_t;
typedef struct twm_materialgroup_s
{
#ifdef CLIENT_DLL
int sprite_handle; // Used for rendering
#endif
char texturename[64];
// Triangle list
short num_triangles;
short *tris_indices; // indices into triangle_lump
} twm_materialgroup_t;
typedef struct twm_info_s
{
// Header stuff
int header_id;
short major_version;
short minor_version;
// Vertices
short num_vertices;
twm_vert_t *vertex_lump;
// Tris
short num_tris;
twm_triangle_t *triangle_lump;
// Material groups
short num_materialgroups;
twm_materialgroup_t *materialgroup_lump;
} twm_info_t;
#ifdef CLIENT_DLL
// Extra data support for client.dll
typedef struct twm_clientinfo_s
{
// origin info
cl_entity_t *attached_ent;
int attachment_num; // which attachment to draw from
// update info
float fadetime;
int dead; // if true we need to remove this ent
// triAPI info
int render_mode;
int sprite_frame;
float brightness;
float color[4];
// We grab a pointer to twm_info
// LEAVE AS READ ONLY!
// if we change data in here we
// would change in all models
// that use this information!
const twm_info_t *twm_info;
} twm_clientinfo_t;
#endif // CLIENT_DLL
#endif // __TWM_H_

View file

@ -142,7 +142,7 @@ Engine is erroring out, display error in message box
void Sys_ErrorMessage( int level, const char *msg )
{
#ifdef _WIN32
MessageBox( NULL, msg, "Half-Life", MB_OK );
MessageBox( NULL, msg, "The Wastes", MB_OK );
PostQuitMessage(0);
#else
printf( "%s\n", msg );
@ -358,7 +358,7 @@ int CheckExeChecksum( void )
const char *pmsg = "Your Half-Life executable appears to have been modified. Please check your system for viruses and then re-install Half-Life.";
#ifdef _WIN32
MessageBox( NULL, pmsg, "Half-Life Dedicated Server", MB_OK );
MessageBox( NULL, pmsg, "The Wastes Dedicated Server", MB_OK );
#else
printf( "%s\n", pmsg );
#endif

View file

@ -58,10 +58,10 @@ typedef enum {
ACT_DIEBACKWARD,
ACT_DIEFORWARD,
ACT_DIEVIOLENT,
ACT_BARNACLE_HIT, // barnacle tongue hits a monster
/* ACT_BARNACLE_HIT, // barnacle tongue hits a monster
ACT_BARNACLE_PULL, // barnacle is lifting the monster ( loop )
ACT_BARNACLE_CHOMP, // barnacle latches on to the monster
ACT_BARNACLE_CHEW, // barnacle is holding the monster in its mouth ( loop )
ACT_BARNACLE_CHEW, // barnacle is holding the monster in its mouth ( loop )*/
ACT_SLEEP,
ACT_INSPECT_FLOOR, // for active idles, look at something on or near the floor
ACT_INSPECT_WALL, // for active idles, look at something directly ahead of you ( doesn't HAVE to be a wall or on a wall )

View file

@ -56,10 +56,10 @@ _A( ACT_DIESIMPLE ),
_A( ACT_DIEBACKWARD ),
_A( ACT_DIEFORWARD ),
_A( ACT_DIEVIOLENT ),
_A( ACT_BARNACLE_HIT ),
/*_A( ACT_BARNACLE_HIT ),
_A( ACT_BARNACLE_PULL ),
_A( ACT_BARNACLE_CHOMP ),
_A( ACT_BARNACLE_CHEW ),
_A( ACT_BARNACLE_CHEW ),*/
_A( ACT_SLEEP ),
_A( ACT_INSPECT_FLOOR ),
_A( ACT_INSPECT_WALL ),

View file

@ -6,89 +6,326 @@
* 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 source code contains proprietary and confidential information of
* Valve LLC and its suppliers. Access to this code is restricted to
* persons who have executed a written SDK license with Valve. Any access,
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/
#ifndef BASEMONSTER_H
#define BASEMONSTER_H
//
// generic Monster
//
class CBaseMonster : public CBaseToggle
{
private:
int m_afConditions;
public:
Activity m_Activity;// what the monster is doing (animation)
Activity m_IdealActivity;// monster should switch to this activity
int m_LastHitGroup; // the last body region that took damage
int m_bitsDamageType; // what types of damage has monster (player) taken
BYTE m_rgbTimeBasedDamage[CDMG_TIMEBASED];
MONSTERSTATE m_MonsterState;// monster's current state
MONSTERSTATE m_IdealMonsterState;// monster should change to this state
int m_afConditions;
int m_afMemory;
float m_flNextAttack; // cannot attack again until this time
EHANDLE m_hEnemy; // the entity that the monster is fighting.
EHANDLE m_hTargetEnt; // the entity that the monster is trying to reach
float m_flFieldOfView;// width of monster's field of view ( dot product )
int m_bloodColor; // color of blood particless
Vector m_HackedGunPos; // HACK until we can query end of gun
typedef enum
{
SCRIPT_PLAYING = 0, // Playing the sequence
SCRIPT_WAIT, // Waiting on everyone in the script to be ready
SCRIPT_CLEANUP, // Cancelling the script / cleaning up
SCRIPT_WALK_TO_MARK,
SCRIPT_RUN_TO_MARK,
} SCRIPTSTATE;
// these fields have been added in the process of reworking the state machine. (sjb)
EHANDLE m_hEnemy; // the entity that the monster is fighting.
EHANDLE m_hTargetEnt; // the entity that the monster is trying to reach
EHANDLE m_hOldEnemy[ MAX_OLD_ENEMIES ];
Vector m_vecOldEnemy[ MAX_OLD_ENEMIES ];
float m_flFieldOfView;// width of monster's field of view ( dot product )
float m_flWaitFinished;// if we're told to wait, this is the time that the wait will be over.
float m_flMoveWaitFinished;
Activity m_Activity;// what the monster is doing (animation)
Activity m_IdealActivity;// monster should switch to this activity
int m_LastHitGroup; // the last body region that took damage
MONSTERSTATE m_MonsterState;// monster's current state
MONSTERSTATE m_IdealMonsterState;// monster should change to this state
int m_iTaskStatus;
Schedule_t *m_pSchedule;
int m_iScheduleIndex;
WayPoint_t m_Route[ ROUTE_SIZE ]; // Positions of movement
int m_movementGoal; // Goal that defines route
int m_iRouteIndex; // index into m_Route[]
float m_moveWaitTime; // How long I should wait for something to move
Vector m_vecMoveGoal; // kept around for node graph moves, so we know our ultimate goal
Activity m_movementActivity; // When moving, set this activity
int m_iAudibleList; // first index of a linked list of sounds that the monster can hear.
int m_afSoundTypes;
Vector m_vecLastPosition;// monster sometimes wants to return to where it started after an operation.
int m_iHintNode; // this is the hint node that the monster is moving towards or performing active idle on.
int m_afMemory;
int m_iMaxHealth;// keeps track of monster's maximum health value (for re-healing, etc)
Vector m_vecEnemyLKP;// last known position of enemy. (enemy's origin)
int m_cAmmoLoaded; // how much ammo is in the weapon (used to trigger reload anim sequences)
int m_afCapability;// tells us what a monster can/can't do.
float m_flNextAttack; // cannot attack again until this time
int m_bitsDamageType; // what types of damage has monster (player) taken
BYTE m_rgbTimeBasedDamage[CDMG_TIMEBASED];
int m_lastDamageAmount;// how much damage did monster (player) last take
// time based damage counters, decr. 1 per 2 seconds
int m_bloodColor; // color of blood particless
int m_failSchedule; // Schedule type to choose if current schedule fails
float m_flHungryTime;// set this is a future time to stop the monster from eating for a while.
float m_flDistTooFar; // if enemy farther away than this, bits_COND_ENEMY_TOOFAR set in CheckEnemy
float m_flDistLook; // distance monster sees (Default 2048)
int m_iTriggerCondition;// for scripted AI, this is the condition that will cause the activation of the monster's TriggerTarget
string_t m_iszTriggerTarget;// name of target that should be fired.
Vector m_HackedGunPos; // HACK until we can query end of gun
// Scripted sequence Info
SCRIPTSTATE m_scriptState; // internal cinematic state
CCineMonster *m_pCine;
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
void KeyValue( KeyValueData *pkvd );
void MakeIdealYaw( Vector vecTarget );
// monster use function
void EXPORT MonsterUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT CorpseUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
// overrideable Monster member functions
virtual int BloodColor( void ) { return m_bloodColor; }
virtual CBaseMonster *MyMonsterPointer( void ) { return this; }
virtual void Look ( int iDistance );// basic sight function for monsters
void Listen ( void );
virtual BOOL IsAlive( void ) { return (pev->deadflag != DEAD_DEAD); }
virtual BOOL ShouldFadeOnDeath( void );
// Basic Monster AI functions
virtual float ChangeYaw ( int speed );
virtual BOOL HasHumanGibs( void );
virtual BOOL HasAlienGibs( void );
virtual void FadeMonster( void ); // Called instead of GibMonster() when gibs are disabled
virtual void GibMonster( void );
float VecToYaw( Vector vecDir );
float FlYawDiff ( void );
float DamageForce( float damage );
// stuff written for new state machine
virtual void MonsterThink( void );
void EXPORT CallMonsterThink( void ) { this->MonsterThink(); }
virtual int IRelationship ( CBaseEntity *pTarget );
virtual void MonsterInit ( void );
virtual void MonsterInitDead( void ); // Call after animation/pose is set up
virtual void BecomeDead( void );
void EXPORT CorpseFallThink( void );
void EXPORT MonsterInitThink ( void );
virtual void StartMonster ( void );
virtual CBaseEntity* BestVisibleEnemy ( void );// finds best visible enemy for attack
virtual BOOL FInViewCone ( CBaseEntity *pEntity );// see if pEntity is in monster's view cone
virtual BOOL FInViewCone ( Vector *pOrigin );// see if given location is in monster's view cone
virtual void HandleAnimEvent( MonsterEvent_t *pEvent );
virtual int CheckLocalMove ( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist );// check validity of a straight move through space
virtual void Move( float flInterval = 0.1 );
virtual void MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flInterval );
virtual BOOL ShouldAdvanceRoute( float flWaypointDist );
virtual Activity GetStoppedActivity( void ) { return ACT_IDLE; }
virtual void Stop( void ) { m_IdealActivity = GetStoppedActivity(); }
// This will stop animation until you call ResetSequenceInfo() at some point in the future
inline void StopAnimation( void ) { pev->framerate = 0; }
// these functions will survey conditions and set appropriate conditions bits for attack types.
virtual BOOL CheckRangeAttack1( float flDot, float flDist );
virtual BOOL CheckRangeAttack2( float flDot, float flDist );
virtual BOOL CheckMeleeAttack1( float flDot, float flDist );
virtual BOOL CheckMeleeAttack2( float flDot, float flDist );
BOOL FHaveSchedule( void );
BOOL FScheduleValid ( void );
void ClearSchedule( void );
BOOL FScheduleDone ( void );
void ChangeSchedule ( Schedule_t *pNewSchedule );
void NextScheduledTask ( void );
Schedule_t *ScheduleInList( const char *pName, Schedule_t **pList, int listCount );
static Schedule_t *m_scheduleList[];
void MaintainSchedule ( void );
virtual void StartTask ( Task_t *pTask );
virtual void RunTask ( Task_t *pTask );
virtual void ScheduleChange( void ) {}
// virtual int CanPlaySequence( void ) { return ((m_pCine == NULL) && (m_MonsterState == MONSTERSTATE_NONE || m_MonsterState == MONSTERSTATE_IDLE || m_IdealMonsterState == MONSTERSTATE_IDLE)); }
virtual int CanPlaySequence( BOOL fDisregardState, int interruptLevel );
virtual int CanPlaySentence( BOOL fDisregardState ) { return IsAlive(); }
virtual void PlaySentence( const char *pszSentence, float duration, float volume, float attenuation );
virtual void PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener );
virtual void SentenceStop( void );
Task_t *GetTask ( void );
virtual void SetActivity ( Activity NewActivity );
void SetSequenceByName ( char *szSequence );
virtual void ReportAIState( void );
void CheckAttacks ( CBaseEntity *pTarget, float flDist );
virtual int CheckEnemy ( CBaseEntity *pEnemy );
void PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos );
BOOL PopEnemy( void );
BOOL FGetNodeRoute ( Vector vecDest );
inline void TaskComplete( void ) { if ( !HasConditions(bits_COND_TASK_FAILED) ) m_iTaskStatus = TASKSTATUS_COMPLETE; }
void MovementComplete( void );
inline void TaskFail( void ) { SetConditions(bits_COND_TASK_FAILED); }
inline void TaskBegin( void ) { m_iTaskStatus = TASKSTATUS_RUNNING; }
int TaskIsRunning( void );
inline int TaskIsComplete( void ) { return (m_iTaskStatus == TASKSTATUS_COMPLETE); }
inline int MovementIsComplete( void ) { return (m_movementGoal == MOVEGOAL_NONE); }
int IScheduleFlags ( void );
BOOL FRefreshRoute( void );
BOOL FRouteClear ( void );
void RouteSimplify( CBaseEntity *pTargetEnt );
void AdvanceRoute ( float distance );
virtual BOOL FTriangulate ( const Vector &vecStart , const Vector &vecEnd, float flDist, CBaseEntity *pTargetEnt, Vector *pApex );
void MakeIdealYaw( Vector vecTarget );
virtual void SetYawSpeed ( void ) { return; };// allows different yaw_speeds for each activity
BOOL BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEntity *pTarget );
virtual BOOL BuildNearestRoute ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist );
int RouteClassify( int iMoveFlag );
void InsertWaypoint ( Vector vecLocation, int afMoveFlags );
BOOL FindLateralCover ( const Vector &vecThreat, const Vector &vecViewOffset );
virtual BOOL FindCover ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist );
virtual BOOL FValidateCover ( const Vector &vecCoverLocation ) { return TRUE; };
virtual float CoverRadius( void ) { return 784; } // Default cover radius
virtual BOOL FCanCheckAttacks ( void );
virtual void CheckAmmo( void ) { return; };
virtual int IgnoreConditions ( void );
inline void SetConditions( int iConditions ) { m_afConditions |= iConditions; }
inline void ClearConditions( int iConditions ) { m_afConditions &= ~iConditions; }
inline BOOL HasConditions( int iConditions ) { if ( m_afConditions & iConditions ) return TRUE; return FALSE; }
inline BOOL HasAllConditions( int iConditions ) { if ( (m_afConditions & iConditions) == iConditions ) return TRUE; return FALSE; }
virtual BOOL FValidateHintType( short sHint );
int FindHintNode ( void );
virtual BOOL FCanActiveIdle ( void );
void SetTurnActivity ( void );
float FLSoundVolume ( CSound *pSound );
BOOL MoveToNode( Activity movementAct, float waitTime, const Vector &goal );
BOOL MoveToTarget( Activity movementAct, float waitTime );
BOOL MoveToLocation( Activity movementAct, float waitTime, const Vector &goal );
BOOL MoveToEnemy( Activity movementAct, float waitTime );
// Returns the time when the door will be open
float OpenDoorAndWait( entvars_t *pevDoor );
virtual int ISoundMask( void );
virtual CSound* PBestSound ( void );
virtual CSound* PBestScent ( void );
virtual float HearingSensitivity( void ) { return 1.0; };
BOOL FBecomeProne ( void );
void SetEyePosition ( void );
BOOL FShouldEat( void );// see if a monster is 'hungry'
void Eat ( float flFullDuration );// make the monster 'full' for a while.
CBaseEntity *CheckTraceHullAttack( float flDist, int iDamage, int iDmgType );
BOOL FacingIdeal( void );
BOOL FCheckAITrigger( void );// checks and, if necessary, fires the monster's trigger target.
BOOL NoFriendlyFire( void );
BOOL BBoxFlat( void );
// PrescheduleThink
virtual void PrescheduleThink( void ) { return; };
BOOL GetEnemy ( void );
void MakeDamageBloodDecal ( int cCount, float flNoise, TraceResult *ptr, const Vector &vecDir );
virtual void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType,int PenetrationValue = 0);
// combat functions
float UpdateTarget ( entvars_t *pevTarget );
virtual Activity GetDeathActivity ( void );
Activity GetSmallFlinchActivity( void );
virtual void BecomeDead( void );
virtual void Killed( entvars_t *pevAttacker, int iGib);
virtual void GibMonster( void );
BOOL ShouldGibMonster( int iGib );
void CallGibMonster( void );
virtual BOOL ShouldFadeOnDeath( void );
BOOL FCheckAITrigger( void );// checks and, if necessary, fires the monster's trigger target.
virtual int IRelationship ( CBaseEntity *pTarget );
virtual BOOL HasHumanGibs( void );
virtual BOOL HasAlienGibs( void );
virtual void FadeMonster( void ); // Called instead of GibMonster() when gibs are disabled
Vector ShootAtEnemy( const Vector &shootOrigin );
virtual Vector BodyTarget( const Vector &posSrc ) { return Center( ) * 0.75 + EyePosition() * 0.25; }; // position to shoot at
virtual Vector GetGunPosition( void );
virtual int TakeHealth( float flHealth, int bitsDamageType );
virtual int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType);
int DeadTakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
float DamageForce( float damage );
virtual void Killed( entvars_t *pevAttacker, int iGib );
virtual void PainSound ( void ) { return; };
void RadiusDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType );
void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType );
virtual int IsMoving( void ) { return m_movementGoal != MOVEGOAL_NONE; }
inline void SetConditions( int iConditions ) { m_afConditions |= iConditions; }
inline void ClearConditions( int iConditions ) { m_afConditions &= ~iConditions; }
inline BOOL HasConditions( int iConditions ) { if ( m_afConditions & iConditions ) return TRUE; return FALSE; }
inline BOOL HasAllConditions( int iConditions ) { if ( (m_afConditions & iConditions) == iConditions ) return TRUE; return FALSE; }
void RouteClear( void );
void RouteNew( void );
virtual void DeathSound ( void ) { return; };
virtual void AlertSound ( void ) { return; };
virtual void IdleSound ( void ) { return; };
virtual void PainSound ( void ) { return; };
virtual void StopFollowing( BOOL clearSchedule ) {}
inline void Remember( int iMemory ) { m_afMemory |= iMemory; }
inline void Forget( int iMemory ) { m_afMemory &= ~iMemory; }
inline BOOL HasMemory( int iMemory ) { if ( m_afMemory & iMemory ) return TRUE; return FALSE; }
inline BOOL HasAllMemories( int iMemory ) { if ( (m_afMemory & iMemory) == iMemory ) return TRUE; return FALSE; }
// This will stop animation until you call ResetSequenceInfo() at some point in the future
inline void StopAnimation( void ) { pev->framerate = 0; }
virtual void ReportAIState( void );
virtual void MonsterInitDead( void ); // Call after animation/pose is set up
void EXPORT CorpseFallThink( void );
virtual void Look ( int iDistance );// basic sight function for monsters
virtual CBaseEntity* BestVisibleEnemy ( void );// finds best visible enemy for attack
CBaseEntity *CheckTraceHullAttack( float flDist, int iDamage, int iDmgType );
virtual BOOL FInViewCone ( CBaseEntity *pEntity );// see if pEntity is in monster's view cone
virtual BOOL FInViewCone ( Vector *pOrigin );// see if given location is in monster's view cone
void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
void MakeDamageBloodDecal ( int cCount, float flNoise, TraceResult *ptr, const Vector &vecDir );
virtual BOOL IsAlive( void ) { return (pev->deadflag != DEAD_DEAD); }
BOOL ExitScriptedSequence( );
BOOL CineCleanup( );
CBaseEntity* DropItem ( char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item.
};
#endif
#endif // BASEMONSTER_H

View file

@ -98,7 +98,6 @@ typedef void (CBaseEntity::*USEPTR)( CBaseEntity *pActivator, CBaseEntity *pCall
#define CLASS_PLAYER_ALLY 11
#define CLASS_PLAYER_BIOWEAPON 12 // hornets and snarks.launched by players
#define CLASS_ALIEN_BIOWEAPON 13 // hornets and snarks.launched by the alien menace
#define CLASS_BARNACLE 99 // special because no one pays attention to it, and it eats a wide cross-section of creatures.
class CBaseEntity;
class CBaseMonster;
@ -163,7 +162,7 @@ public:
static TYPEDESCRIPTION m_SaveData[];
virtual void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
virtual void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType,int PenetrationValue = 0);
virtual int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
virtual int TakeHealth( float flHealth, int bitsDamageType );
virtual void Killed( entvars_t *pevAttacker, int iGib );
@ -240,7 +239,7 @@ public:
void EXPORT SUB_CallUseToggle( void ) { this->Use( this, this, USE_TOGGLE, 0 ); }
int ShouldToggle( USE_TYPE useType, BOOL currentState );
void FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq = 4, int iDamage = 0, entvars_t *pevAttacker = NULL );
Vector FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq = 4, int iDamage = 0, entvars_t *pevAttacker = NULL, int shared_rand = 0 );
Vector FireBulletsPlayer( CBaseEntity *pPlayerItem,ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq = 4, int iDamage = 0, entvars_t *pevAttacker = NULL, int shared_rand = 0,int penetration_type = 0 );
virtual CBaseEntity *Respawn( void ) { return NULL; }
@ -277,7 +276,6 @@ public:
return NULL;
}
// Ugly code to lookup all functions to make sure they are exported when set.
#ifdef _DEBUG
void FunctionCheck( void *pFunction, char *name )
@ -349,16 +347,9 @@ public:
int ammo_argrens;
//Special stuff for grenades and satchels.
float m_flStartThrow;
float m_flReleaseThrow;
int m_chargeReady;
int m_fInAttack;
enum EGON_FIRESTATE { FIRE_OFF, FIRE_CHARGE };
int m_fireState;
float m_flReleaseThrow; int m_fInAttack;
};
// Ugly technique to override base member functions
// Normally it's illegal to cast a pointer to a member function of a derived class to a pointer to a
// member function of a base class. static_cast is a sleezy way around that problem.
@ -581,8 +572,6 @@ public:
#define bits_CAP_DOORS_GROUP (bits_CAP_USE | bits_CAP_AUTO_DOORS | bits_CAP_OPEN_DOORS)
// used by suit voice to indicate damage sustained and repaired type to player
// instant damage
#define DMG_GENERIC 0 // generic damage was done
@ -613,6 +602,11 @@ public:
#define DMG_SLOWFREEZE (1 << 22) // in a subzero freezer
#define DMG_MORTAR (1 << 23) // Hit by air raid (done to distinguish grenade from mortar)
// The Wastes
#define DMG_BULLET_CONC (1 << 25) // Screw up victim if their shot
#define DMG_BUCKSHOT (1 << 26) // Shotgun no locational damage
#define DMG_BLEEDING (1 << 27) // Bleeding to death
// these are the damage types that are allowed to gib corpses
#define DMG_GIB_CORPSE ( DMG_CRUSH | DMG_FALL | DMG_BLAST | DMG_SONIC | DMG_CLUB )
@ -642,7 +636,6 @@ public:
#define SLOWFREEZE_DURATION 2
#define SLOWFREEZE_DAMAGE 1.0
#define itbd_Paralyze 0
#define itbd_NerveGas 1
#define itbd_Poison 2

View file

@ -22,15 +22,15 @@
#define MAX_WEAPONS 32 // ???
#define MAX_WEAPON_SLOTS 5 // hud item selection slots
#define MAX_ITEM_TYPES 6 // hud item selection slots
#define MAX_WEAPON_SLOTS 6 // hud item selection slots
#define MAX_ITEM_TYPES 8 // hud item selection slots
#define MAX_ITEMS 5 // hard coded item types
#define MAX_ITEMS 6 // hard coded item types
#define HIDEHUD_WEAPONS ( 1<<0 )
#define HIDEHUD_FLASHLIGHT ( 1<<1 )
#define HIDEHUD_ALL ( 1<<2 )
#define HIDEHUD_HEALTH ( 1<<3 )
#define HIDEHUD_HEALTH ( 1<<3 )
#define MAX_AMMO_TYPES 32 // ???
#define MAX_AMMO_SLOTS 32 // not really slots
@ -40,7 +40,4 @@
#define HUD_PRINTTALK 3
#define HUD_PRINTCENTER 4
#define WEAPON_SUIT 31
#endif

View file

@ -38,6 +38,8 @@
#include "weaponinfo.h"
#include "usercmd.h"
#include "netadr.h"
#include "game.h"
#include "thewastes.h"
extern DLL_GLOBAL ULONG g_ulModelIndexPlayer;
extern DLL_GLOBAL BOOL g_fGameOver;
@ -45,10 +47,12 @@ extern DLL_GLOBAL int g_iSkillLevel;
extern DLL_GLOBAL ULONG g_ulFrameCount;
extern void CopyToBodyQue(entvars_t* pev);
edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer );
extern int giPrecacheGrunt;
extern int gmsgSayText;
extern int g_teamplay;
extern int g_gametype;
void LinkUserMessages( void );
@ -68,7 +72,6 @@ void set_suicide_frame(entvars_t* pev)
pev->nextthink = -1;
}
/*
===========
ClientConnect
@ -78,12 +81,21 @@ called when a player connects to a server
*/
BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] )
{
// See if this person is in the hardcode ban list
if(
strcmp( GETPLAYERAUTHID( pEntity ), "2678967" ) == 0 // Porta bella mushroom
// || strcmp( GETPLAYERAUTHID( pEntity ), "762057" ) == 0 // gage
)
{
strcpy( szRejectReason, "You are not authorized to join this server\n" );
return FALSE;
}
return g_pGameRules->ClientConnected( pEntity, pszName, pszAddress, szRejectReason );
// a client connecting during an intermission can cause problems
// if (intermission_running)
// ExitIntermission ();
}
@ -139,7 +151,10 @@ void respawn(entvars_t* pev, BOOL fCopyCorpse)
}
// respawn player
GetClassPtr( (CBasePlayer *)pev)->Spawn( );
CBasePlayer *pPlayer = GetClassPtr((CBasePlayer*)pev);
pPlayer->StopObserver();
pPlayer->Spawn( );
}
else
{ // restart the entire server
@ -160,6 +175,10 @@ void ClientKill( edict_t *pEntity )
{
entvars_t *pev = &pEntity->v;
// if a spectator, you cant suicide
if(pev->iuser3)
return;
CBasePlayer *pl = (CBasePlayer*) CBasePlayer::Instance( pev );
if ( pl->m_fNextSuicideTime > gpGlobals->time )
@ -186,12 +205,15 @@ called each time a player is spawned
void ClientPutInServer( edict_t *pEntity )
{
CBasePlayer *pPlayer;
entvars_t *pev = &pEntity->v;
pPlayer = GetClassPtr((CBasePlayer *)pev);
pPlayer = GetClassPtr((CBasePlayer*)pev);
pPlayer->SetCustomDecalFrames(-1); // Assume none;
// Start off spectating
pPlayer->m_bCanSpawn = FALSE;
pPlayer->m_bObserver = FALSE; // But no HLTV :(
// Allocate a CBasePlayer for pev, and call spawn
pPlayer->Spawn() ;
@ -199,6 +221,31 @@ void ClientPutInServer( edict_t *pEntity )
pPlayer->pev->effects |= EF_NOINTERP;
}
void SendMsgTo(CBasePlayer *client,edict_t *pEntity, int teamonly,char text[128],char *classname)
{
client = NULL;
while (((client = (CBasePlayer*)UTIL_FindEntityByClassname( client, classname )) != NULL) && (!FNullEnt(client->edict())))
{
if ( !client->pev )
continue;
if ( client->edict() == pEntity )
continue;
if ( !(client->IsNetClient()) ) // Not a client ? (should never be true)
continue;
if ( teamonly && g_pGameRules->PlayerRelationship(client, CBaseEntity::Instance(pEntity)) != GR_TEAMMATE )
continue;
MESSAGE_BEGIN( MSG_ONE, gmsgSayText, NULL, client->pev );
WRITE_BYTE( ENTINDEX(pEntity) );
WRITE_STRING( text );
MESSAGE_END();
}
}
//// HOST_SAY
// String comes in as
// say blah blah blah
@ -207,7 +254,7 @@ void ClientPutInServer( edict_t *pEntity )
//
void Host_Say( edict_t *pEntity, int teamonly )
{
CBasePlayer *client;
CBasePlayer *client = NULL;
int j;
char *p;
char text[128];
@ -265,11 +312,24 @@ void Host_Say( edict_t *pEntity, int teamonly )
if ( pc != NULL )
return; // no character found, so say nothing
// Do we want a [DEAD] symbol ?
int use_dead = (strcmp(STRING(pEntity->v.classname),"observer") == 0) ? 1 : 0;
// turn on color set 2 (color on, no sound)
if ( teamonly )
sprintf( text, "%c(TEAM) %s: ", 2, STRING( pEntity->v.netname ) );
{
if( use_dead )
sprintf( text, "%c(TEAM)[DEAD] %s: ", 2, STRING(pEntity->v.netname) );
else
sprintf( text, "%c(TEAM)%s: ", 2, STRING(pEntity->v.netname) );
}
else
sprintf( text, "%c%s: ", 2, STRING( pEntity->v.netname ) );
{
if( use_dead )
sprintf( text, "%c[DEAD] %s: ", 2, STRING(pEntity->v.netname) );
else
sprintf( text, "%c%s: ", 2, STRING(pEntity->v.netname) );
}
j = sizeof(text) - 2 - strlen(text); // -2 for /n and null terminator
if ( (int)strlen(p) > j )
@ -283,27 +343,13 @@ void Host_Say( edict_t *pEntity, int teamonly )
// This may return the world in single player if the client types something between levels or during spawn
// so check it, or it will infinite loop
client = NULL;
while ( ((client = (CBasePlayer*)UTIL_FindEntityByClassname( client, "player" )) != NULL) && (!FNullEnt(client->edict())) )
{
if ( !client->pev )
continue;
if ( client->edict() == pEntity )
continue;
// send to all "players"
if ( !(client->IsNetClient()) ) // Not a client ? (should never be true)
continue;
CBaseEntity *pInstance = CBaseEntity::Instance(pEntity);
if ( teamonly && g_pGameRules->PlayerRelationship(client, CBaseEntity::Instance(pEntity)) != GR_TEAMMATE )
continue;
MESSAGE_BEGIN( MSG_ONE, gmsgSayText, NULL, client->pev );
WRITE_BYTE( ENTINDEX(pEntity) );
WRITE_STRING( text );
MESSAGE_END();
}
// if(pInstance->pev->classname = STRING(ALLOC_STRING("player")))
SendMsgTo(client,pEntity,teamonly,text,"player");
SendMsgTo(client,pEntity,teamonly,text,"observer");
// print to the sending client
MESSAGE_BEGIN( MSG_ONE, gmsgSayText, NULL, &pEntity->v );
@ -321,7 +367,7 @@ void Host_Say( edict_t *pEntity, int teamonly )
temp = "say";
// team match?
if ( g_teamplay )
if ( g_gametype == 2 )
{
UTIL_LogPrintf( "\"%s<%i><%u><%s>\" %s \"%s\"\n",
STRING( pEntity->v.netname ),
@ -352,6 +398,8 @@ called each time a player uses a "cmd" command
*/
extern float g_flWeaponCheat;
#include "shake.h"
// Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command.
void ClientCommand( edict_t *pEntity )
{
@ -380,7 +428,6 @@ void ClientCommand( edict_t *pEntity )
GetClassPtr((CBasePlayer *)pev)->GiveNamedItem( STRING(iszItem) );
}
}
else if ( FStrEq(pcmd, "drop" ) )
{
// player is dropping an item.
@ -471,7 +518,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
MESSAGE_END();
// team match?
if ( g_teamplay )
if ( g_gametype )
{
UTIL_LogPrintf( "\"%s<%i><%u><%s>\" changed name to \"%s\"\n",
STRING( pEntity->v.netname ),
@ -606,11 +653,10 @@ void StartFrame( void )
if ( g_fGameOver )
return;
gpGlobals->teamplay = teamplay.value;
gpGlobals->gametype = gametype.value;
g_ulFrameCount++;
}
void ClientPrecache( void )
{
// setup precaches always needed
@ -618,6 +664,8 @@ void ClientPrecache( void )
// PRECACHE_SOUND("player/pl_jumpland2.wav"); // UNDONE: play 2x step sound
PRECACHE_SOUND("player/aaaggghhh.wav"); // AAAGGGGHHH !!!
PRECACHE_SOUND("player/pl_fallpain2.wav");
PRECACHE_SOUND("player/pl_fallpain3.wav");
@ -677,23 +725,77 @@ void ClientPrecache( void )
PRECACHE_SOUND("player/pl_wade3.wav");
PRECACHE_SOUND("player/pl_wade4.wav");
PRECACHE_SOUND("player/pl_sand1.wav");
PRECACHE_SOUND("player/pl_sand2.wav");
PRECACHE_SOUND("player/pl_sand3.wav");
PRECACHE_SOUND("player/pl_sand4.wav");
PRECACHE_SOUND("player/pl_snow1.wav");
PRECACHE_SOUND("player/pl_snow2.wav");
PRECACHE_SOUND("player/pl_snow3.wav");
PRECACHE_SOUND("player/pl_snow4.wav");
PRECACHE_SOUND("player/pl_rust1.wav");
PRECACHE_SOUND("player/pl_rust2.wav");
PRECACHE_SOUND("player/pl_rust3.wav");
PRECACHE_SOUND("player/pl_rust4.wav");
PRECACHE_SOUND("player/pl_wood1.wav");
PRECACHE_SOUND("player/pl_wood2.wav");
PRECACHE_SOUND("player/pl_wood3.wav");
PRECACHE_SOUND("player/pl_wood4.wav");
PRECACHE_SOUND("debris/wood1.wav"); // hit wood texture
PRECACHE_SOUND("debris/wood2.wav");
PRECACHE_SOUND("debris/wood3.wav");
PRECACHE_SOUND("debris/ric1.wav");
PRECACHE_SOUND("debris/ric2.wav");
PRECACHE_SOUND("debris/ric3.wav");
PRECACHE_SOUND("debris/ric4.wav");
PRECACHE_SOUND("debris/ric5.wav");
PRECACHE_SOUND("debris/ric_con1.wav");
PRECACHE_SOUND("debris/ric_con2.wav");
PRECACHE_SOUND("debris/ric_con3.wav");
PRECACHE_SOUND("debris/ric_tinroof1.wav");
PRECACHE_SOUND("debris/ric_tinroof2.wav");
PRECACHE_SOUND("debris/ric_tinroof3.wav");
PRECACHE_SOUND("debris/ric_barrel1.wav");
PRECACHE_SOUND("debris/ric_barrel2.wav");
PRECACHE_SOUND("debris/ric_barrel3.wav");
PRECACHE_SOUND("debris/ric_barrel4.wav");
PRECACHE_SOUND("debris/ric_drywall1.wav");
PRECACHE_SOUND("debris/ric_drywall2.wav");
PRECACHE_SOUND("debris/ric_metalwall1.wav");
PRECACHE_SOUND("debris/ric_metalwall2.wav");
PRECACHE_SOUND("debris/ric_wood1.wav");
PRECACHE_SOUND("debris/ric_wood2.wav");
PRECACHE_SOUND("debris/ric_wood3.wav");
PRECACHE_SOUND("debris/ric_wood4.wav");
PRECACHE_SOUND("debris/ric_wood5.wav");
PRECACHE_SOUND("plats/train_use1.wav"); // use a train
PRECACHE_SOUND("buttons/spark5.wav"); // hit computer texture
PRECACHE_SOUND("buttons/spark6.wav");
PRECACHE_SOUND("debris/glass1.wav");
PRECACHE_SOUND("debris/glass2.wav");
PRECACHE_SOUND("debris/glass3.wav");
PRECACHE_SOUND("debris/ric_glass1.wav");
PRECACHE_SOUND("debris/ric_glass2.wav");
PRECACHE_SOUND("debris/ric_glass3.wav");
PRECACHE_SOUND( SOUND_FLASHLIGHT_ON );
PRECACHE_SOUND( SOUND_FLASHLIGHT_OFF );
// player gib sounds
PRECACHE_SOUND("common/bodysplat.wav");
PRECACHE_SOUND("common/bodysplat.wav");
PRECACHE_SOUND("player/pl_crushed.wav");
PRECACHE_SOUND("player/pl_drowned.wav");
// player pain sounds
PRECACHE_SOUND("player/pl_pain2.wav");
@ -704,16 +806,33 @@ void ClientPrecache( void )
PRECACHE_MODEL("models/player.mdl");
// hud sounds
//Particles
// PRECACHE_MODEL("sprites/particle.spr");
// PRECACHE_MODEL("sprites/psmoke.spr");
PRECACHE_SOUND("common/wpn_hudoff.wav");
PRECACHE_SOUND("common/wpn_hudon.wav");
PRECACHE_SOUND("common/wpn_moveselect.wav");
PRECACHE_SOUND("common/wpn_select.wav");
PRECACHE_SOUND("common/wpn_denyselect.wav");
// Smoke Puffs
PRECACHE_MODEL("sprites/smoke1.spr");
PRECACHE_MODEL("sprites/smoke2.spr");
PRECACHE_MODEL("models/shrapnel.mdl");
// geiger sounds
PRECACHE_SOUND("player/headshot1.wav");
PRECACHE_SOUND("player/headshot2.wav");
PRECACHE_SOUND("player/headshot3.wav");
PRECACHE_SOUND("player/leg_hit1.wav");
PRECACHE_SOUND("player/arm_hit1.wav");
PRECACHE_SOUND("player/chest_hit1.wav");
PRECACHE_SOUND("player/blood_drip1.wav");
PRECACHE_SOUND("player/blood_drip2.wav");
PRECACHE_SOUND("player/blood_drip3.wav");
PRECACHE_SOUND("player/equip_kevlar.wav");
PRECACHE_SOUND("player/kevlar_hit1.wav");
PRECACHE_SOUND("player/pl_die1.wav");
PRECACHE_SOUND("player/pl_die2.wav");
PRECACHE_SOUND("player/pl_die3.wav");
PRECACHE_SOUND("player/breathe1.wav");
PRECACHE_SOUND("player/breathe2.wav");
PRECACHE_SOUND("player/geiger6.wav");
PRECACHE_SOUND("player/geiger5.wav");
@ -738,7 +857,7 @@ const char *GetGameDescription()
if ( g_pGameRules ) // this function may be called before the world has spawned, and the game rules initialized
return g_pGameRules->GetGameDescription();
else
return "Half-Life";
return "The Wastes";
}
/*
@ -872,6 +991,13 @@ void SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pv
pView = pViewEntity;
}
// Tracking Spectators use the visibility of their target
CBasePlayer *pPlayer = (CBasePlayer *)CBaseEntity::Instance( pClient );
if ( (pPlayer->pev->iuser2 != 0) && (pPlayer->m_hObserverTarget != NULL) )
{
pView = pPlayer->m_hObserverTarget->edict();
}
if ( pClient->v.flags & FL_PROXY )
{
*pvs = NULL; // the spectator proxy sees
@ -933,7 +1059,6 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
}
}
// Don't send entity to local client if the client says it's predicting the entity itself.
if ( ent->v.flags & FL_SKIPLOCALHOST )
{
@ -1401,7 +1526,7 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
weapon_data_t *item;
entvars_t *pev = &player->v;
CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev );
CBasePlayerWeapon *gun;
CWasteWeapon *gun;
ItemInfo II;
@ -1420,7 +1545,7 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
while ( pPlayerItem )
{
gun = (CBasePlayerWeapon *)pPlayerItem->GetWeaponPtr();
gun = (CWasteWeapon *)pPlayerItem->GetWeaponPtr();
if ( gun && gun->UseDecrement() )
{
// Get The ID.
@ -1430,6 +1555,9 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
if ( II.iId >= 0 && II.iId < 32 )
{
item = &info[ II.iId ];
// Pack weapon specific data here.
gun->PackWeapon(item);
item->m_iId = II.iId;
item->m_iClip = gun->m_iClip;
@ -1442,12 +1570,7 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
item->fuser1 = max( gun->pev->fuser1, -0.001 );
item->fuser2 = gun->m_flStartThrow;
item->fuser3 = gun->m_flReleaseThrow;
item->iuser1 = gun->m_chargeReady;
item->iuser2 = gun->m_fInAttack;
item->iuser3 = gun->m_fireState;
// item->m_flPumpTime = max( gun->m_flPumpTime, -0.001 );
item->iuser2 = gun->m_fInAttack;
}
}
pPlayerItem = pPlayerItem->m_pNext;
@ -1497,7 +1620,11 @@ void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clien
cd->fov = ent->v.fov;
cd->weaponanim = ent->v.weaponanim;
cd->pushmsec = ent->v.pushmsec;
cd->pushmsec = ent->v.pushmsec;
// Spectator
cd->iuser1 = ent->v.iuser1;
cd->iuser2 = ent->v.iuser2;
#if defined( CLIENT_WEAPONS )
if ( sendweapons )
@ -1508,8 +1635,6 @@ void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clien
if ( pl )
{
cd->m_flNextAttack = pl->m_flNextAttack;
cd->fuser2 = pl->m_flNextAmmoBurn;
cd->fuser3 = pl->m_flAmmoStartCharge;
cd->vuser1.x = pl->ammo_9mm;
cd->vuser1.y = pl->ammo_357;
cd->vuser1.z = pl->ammo_argrens;
@ -1518,7 +1643,6 @@ void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clien
cd->ammo_rockets = pl->ammo_rockets;
cd->ammo_cells = pl->ammo_uranium;
cd->vuser2.x = pl->ammo_hornets;
if ( pl->m_pActiveItem )
{
@ -1536,12 +1660,6 @@ void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clien
cd->vuser4.x = gun->m_iPrimaryAmmoType;
cd->vuser4.y = pl->m_rgAmmo[gun->m_iPrimaryAmmoType];
cd->vuser4.z = pl->m_rgAmmo[gun->m_iSecondaryAmmoType];
if ( pl->m_pActiveItem->m_iId == WEAPON_RPG )
{
cd->vuser2.y = ( ( CRpg * )pl->m_pActiveItem)->m_fSpotActive;
cd->vuser2.z = ( ( CRpg * )pl->m_pActiveItem)->m_cActiveRockets;
}
}
}
}

View file

@ -29,6 +29,9 @@
#include "animation.h"
#include "weapons.h"
#include "func_break.h"
#include "player.h"
#include "gamerules.h"
#include "thewastes.h"
extern DLL_GLOBAL Vector g_vecAttackDir;
extern DLL_GLOBAL int g_iSkillLevel;
@ -830,8 +833,6 @@ bitsDamageType indicates the type of damage sustained, ie: DMG_SHOCK
Time-based damage: only occurs while the monster is within the trigger_hurt.
When a monster is poisoned via an arrow etc it takes all the poison damage at once.
GLOBALS ASSUMED SET: g_iSkillLevel
============
*/
@ -862,9 +863,10 @@ int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,
// grab the vector of the incoming attack. ( pretend that the inflictor is a little lower than it really is, so the body will tend to fly upward a bit).
vecDir = Vector( 0, 0, 0 );
if (!FNullEnt( pevInflictor ))
if (!FNullEnt( pevInflictor ) && !(bitsDamageType & (DMG_CLUB|DMG_SHOCK)))
{
CBaseEntity *pInflictor = CBaseEntity :: Instance( pevInflictor );
CBasePlayer *pInflictor = (CBasePlayer*)CBasePlayer :: Instance( pevInflictor );
if (pInflictor)
{
vecDir = ( pInflictor->Center() - Vector ( 0, 0, 10 ) - Center() ).Normalize();
@ -884,9 +886,7 @@ int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,
// check for godmode or invincibility
if ( pev->flags & FL_GODMODE )
{
return 0;
}
}
// if this is a player, move him around!
@ -897,7 +897,6 @@ int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,
// do the damage
pev->health -= flTake;
// HACKHACK Don't kill monsters in a script. Let them break their scripts first
if ( m_MonsterState == MONSTERSTATE_SCRIPT )
@ -923,8 +922,7 @@ int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,
Killed( pevAttacker, GIB_NORMAL );
}
g_pevLastInflictor = NULL;
g_pevLastInflictor = NULL;
return 0;
}
@ -1276,7 +1274,7 @@ BOOL CBaseEntity :: FVisible ( const Vector &vecOrigin )
TraceAttack
================
*/
void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType,int PenetrationValue)
{
Vector vecOrigin = ptr->vecEndPos - vecDir * 4;
@ -1323,7 +1321,7 @@ void CBaseMonster::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector ve
//=========================================================
// TraceAttack
//=========================================================
void CBaseMonster :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
void CBaseMonster :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType,int PenetrationValue)
{
if ( pev->takedamage )
{
@ -1334,21 +1332,16 @@ void CBaseMonster :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector
case HITGROUP_GENERIC:
break;
case HITGROUP_HEAD:
flDamage *= gSkillData.monHead;
break;
case HITGROUP_CHEST:
flDamage *= gSkillData.monChest;
break;
case HITGROUP_STOMACH:
flDamage *= gSkillData.monStomach;
break;
case HITGROUP_LEFTARM:
case HITGROUP_RIGHTARM:
flDamage *= gSkillData.monArm;
break;
case HITGROUP_LEFTLEG:
case HITGROUP_RIGHTLEG:
flDamage *= gSkillData.monLeg;
break;
default:
break;
@ -1417,23 +1410,6 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
if ( iTracerFreq != 1 ) // guns that always trace also always decal
tracer = 1;
switch( iBulletType )
{
case BULLET_MONSTER_MP5:
case BULLET_MONSTER_9MM:
case BULLET_MONSTER_12MM:
default:
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, vecTracerSrc );
WRITE_BYTE( TE_TRACER );
WRITE_COORD( vecTracerSrc.x );
WRITE_COORD( vecTracerSrc.y );
WRITE_COORD( vecTracerSrc.z );
WRITE_COORD( tr.vecEndPos.x );
WRITE_COORD( tr.vecEndPos.y );
WRITE_COORD( tr.vecEndPos.z );
MESSAGE_END();
break;
}
}
// do damage, paint decals
if (tr.flFraction != 1.0)
@ -1450,30 +1426,6 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
else switch(iBulletType)
{
default:
case BULLET_MONSTER_9MM:
pEntity->TraceAttack(pevAttacker, gSkillData.monDmg9MM, vecDir, &tr, DMG_BULLET);
TEXTURETYPE_PlaySound(&tr, vecSrc, vecEnd, iBulletType);
DecalGunshot( &tr, iBulletType );
break;
case BULLET_MONSTER_MP5:
pEntity->TraceAttack(pevAttacker, gSkillData.monDmgMP5, vecDir, &tr, DMG_BULLET);
TEXTURETYPE_PlaySound(&tr, vecSrc, vecEnd, iBulletType);
DecalGunshot( &tr, iBulletType );
break;
case BULLET_MONSTER_12MM:
pEntity->TraceAttack(pevAttacker, gSkillData.monDmg12MM, vecDir, &tr, DMG_BULLET);
if ( !tracer )
{
TEXTURETYPE_PlaySound(&tr, vecSrc, vecEnd, iBulletType);
DecalGunshot( &tr, iBulletType );
}
break;
case BULLET_NONE: // FIX
pEntity->TraceAttack(pevAttacker, 50, vecDir, &tr, DMG_CLUB);
@ -1493,7 +1445,6 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
ApplyMultiDamage(pev, pevAttacker);
}
/*
================
FireBullets
@ -1503,8 +1454,9 @@ Go to the trouble of combining multiple pellets into a single damage call.
This version is used by Players, uses the random seed generator to sync client and server side shots.
================
*/
Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker, int shared_rand )
Vector CBaseEntity::FireBulletsPlayer ( CBaseEntity *pPlayerItem,ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker, int shared_rand, int penetration_type )
{
CWasteWeapon *pWeapon = (CWasteWeapon*)pPlayerItem;
static int tracerCount;
TraceResult tr;
Vector vecRight = gpGlobals->v_right;
@ -1517,70 +1469,211 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
ClearMultiDamage();
gMultiDamage.type = DMG_BULLET | DMG_NEVERGIB;
for ( ULONG iShot = 1; iShot <= cShots; iShot++ )
int iWallThickness = 0;
int iMaxThickness = 0;
float fFalloffRate = 0;
int iWallLimit = MAX_WALLCOUNT;
// Penetration values
switch(penetration_type)
{
//Use player's random seed.
// get circular gaussian spread
x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5, 0.5 );
y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5, 0.5 );
z = x * x + y * y;
case P_BERETTA:
iWallThickness = MAX_THICKNESS_BERETTA;
fFalloffRate = FALLOFF_BERETTA;
break;
case P_COLT:
iWallThickness = MAX_THICKNESS_COLT;
fFalloffRate = FALLOFF_COLT;
break;
case P_RUGER:
iWallThickness = MAX_THICKNESS_RUGER;
fFalloffRate = FALLOFF_RUGER;
break;
case P_DEAGLE:
iWallThickness = MAX_THICKNESS_DEAGLE;
fFalloffRate = FALLOFF_DEAGLE;
break;
case P_HANDCANNON:
iWallThickness = MAX_THICKNESS_HANDCANNON;
fFalloffRate = FALLOFF_HANDCANNON;
break;
case P_WINCHESTER:
iWallThickness = MAX_THICKNESS_WINCHESTER;
fFalloffRate = FALLOFF_WINCHESTER;
break;
case P_SMG9:
iWallThickness = MAX_THICKNESS_SMG9;
fFalloffRate = FALLOFF_SMG9;
break;
case P_FNFAL:
iWallThickness = MAX_THICKNESS_FNFAL;
fFalloffRate = FALLOFF_FNFAL;
break;
case P_TOMMYGUN:
iWallThickness = MAX_THICKNESS_TOMMYGUN;
fFalloffRate = FALLOFF_TOMMYGUN;
break;
case P_G11:
iWallThickness = MAX_THICKNESS_G11;
fFalloffRate = FALLOFF_G11;
break;
case P_BOLTRIFLE:
iWallThickness = MAX_THICKNESS_BOLTRIFLE;
fFalloffRate = FALLOFF_BOLTRIFLE;
break;
case P_STEN:
iWallThickness = MAX_THICKNESS_STEN;
fFalloffRate = FALLOFF_STEN;
break;
}
Vector vecDir = vecDirShooting +
x * vecSpread.x * vecRight +
y * vecSpread.y * vecUp;
Vector vecEnd;
iMaxThickness = iWallThickness;
vecEnd = vecSrc + vecDir * flDistance;
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, ENT(pev)/*pentIgnore*/, &tr);
// do damage, paint decals
if (tr.flFraction != 1.0)
// Prevent divide by zero
if( iMaxThickness == 0 )
iMaxThickness = 1;
do
{
for ( ULONG iShot = 1; iShot <= cShots; iShot++ )
{
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
//Use player's random seed.
// get circular gaussian spread
x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5, 0.5 );
y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5, 0.5 );
z = x * x + y * y;
if ( iDamage )
Vector vecDir = vecDirShooting +
x * vecSpread.x * vecRight +
y * vecSpread.y * vecUp;
Vector vecEnd;
vecEnd = vecSrc + vecDir * flDistance;
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, ENT(pev)/*pentIgnore*/, &tr);
// do damage, paint decals
if (tr.flFraction != 1.0)
{
pEntity->TraceAttack(pevAttacker, iDamage, vecDir, &tr, DMG_BULLET | ((iDamage > 16) ? DMG_ALWAYSGIB : DMG_NEVERGIB) );
TEXTURETYPE_PlaySound(&tr, vecSrc, vecEnd, iBulletType);
DecalGunshot( &tr, iBulletType );
}
else switch(iBulletType)
{
default:
case BULLET_PLAYER_9MM:
pEntity->TraceAttack(pevAttacker, gSkillData.plrDmg9MM, vecDir, &tr, DMG_BULLET);
break;
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
case BULLET_PLAYER_MP5:
pEntity->TraceAttack(pevAttacker, gSkillData.plrDmgMP5, vecDir, &tr, DMG_BULLET);
break;
case BULLET_PLAYER_BUCKSHOT:
// make distance based!
pEntity->TraceAttack(pevAttacker, gSkillData.plrDmgBuckshot, vecDir, &tr, DMG_BULLET);
break;
case BULLET_PLAYER_357:
pEntity->TraceAttack(pevAttacker, gSkillData.plrDmg357, vecDir, &tr, DMG_BULLET);
break;
case BULLET_NONE: // FIX
pEntity->TraceAttack(pevAttacker, 50, vecDir, &tr, DMG_CLUB);
TEXTURETYPE_PlaySound(&tr, vecSrc, vecEnd, iBulletType);
// only decal glass
if ( !FNullEnt(tr.pHit) && VARS(tr.pHit)->rendermode != 0)
// reset vuser2
pEntity->pev->vuser2.y = 0;
if ( iDamage )
{
UTIL_DecalTrace( &tr, DECAL_GLASSBREAK1 + RANDOM_LONG(0,2) );
pEntity->TraceAttack(pevAttacker, iDamage, vecDir, &tr, DMG_BULLET | ((iDamage > 16) ? DMG_ALWAYSGIB : DMG_NEVERGIB) );
TEXTURETYPE_PlaySound(&tr, vecSrc, vecEnd, iBulletType);
DecalGunshot( &tr, iBulletType );
}
else switch(iBulletType)
{
// Standard
default:
case BULLET_9MMP:
case BULLET_10MM:
case BULLET_SLUG:
case BULLET_9MM:
case BULLET_45ACP:
pEntity->TraceAttack(pevAttacker, g_pGameRules->ModifyTiltedDamage(this,pEntity,pWeapon->flGetTiltedDamage(),DMG_BULLET), vecDir, &tr, DMG_BULLET,iWallThickness/iMaxThickness);
break;
// Concussive
case BULLET_50AE:
case BULLET_454CASULL:
case BULLET_556MM:
pEntity->TraceAttack(pevAttacker, g_pGameRules->ModifyTiltedDamage(this,pEntity,pWeapon->flGetTiltedDamage(),DMG_BULLET_CONC), vecDir, &tr, DMG_BULLET_CONC,iWallThickness/iMaxThickness);
break;
// Buckshot
case BULLET_20GAUGE:
case BULLET_12GAUGE:
pEntity->TraceAttack(pevAttacker, g_pGameRules->ModifyTiltedDamage(this,pEntity,pWeapon->flGetTiltedDamage(),DMG_BUCKSHOT), vecDir, &tr, DMG_BUCKSHOT);
break;
// Standard but no distance drop off
case BULLET_762MM:
case BULLET_47MM:
pEntity->TraceAttack(pevAttacker, g_pGameRules->ModifyTiltedDamage(this,pEntity,pWeapon->flGetTiltedDamage(),DMG_BULLET_CONC), vecDir, &tr, DMG_BULLET,iWallThickness/iMaxThickness);
break;
case BULLET_10GAUGE:
pEntity->TraceAttack(pevAttacker, g_pGameRules->ModifyTiltedDamage(this,pEntity,pWeapon->flGetTiltedDamage(),DMG_BULLET_CONC), vecDir, &tr, DMG_BUCKSHOT,iWallThickness/iMaxThickness);
break;
case BULLET_NONE: // FIX
pEntity->TraceAttack(pevAttacker, 50, vecDir, &tr, DMG_CLUB);
TEXTURETYPE_PlaySound(&tr, vecSrc, vecEnd, iBulletType);
// only decal glass
if ( !FNullEnt(tr.pHit) && VARS(tr.pHit)->rendermode != 0)
{
UTIL_DecalTrace( &tr, DECAL_GLASSBREAK1 + RANDOM_LONG(0,2) );
}
break;
break;
}
}
// make bullet trails
UTIL_BubbleTrail( vecSrc, tr.vecEndPos, (flDistance * tr.flFraction) / 64.0 );
#if 0
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMPOINTS );
WRITE_COORD( vecSrc.x );
WRITE_COORD( vecSrc.y );
WRITE_COORD( vecSrc.z );
WRITE_COORD( tr.vecEndPos.x );
WRITE_COORD( tr.vecEndPos.y );
WRITE_COORD( tr.vecEndPos.z );
WRITE_SHORT( g_sModelIndexLaser );
WRITE_BYTE( 0 );
WRITE_BYTE( 10 );
WRITE_BYTE( 128 );
WRITE_BYTE( 5 );
WRITE_BYTE( 0 );
WRITE_BYTE( 255 );
WRITE_BYTE( 255 );
WRITE_BYTE( 0 );
WRITE_BYTE( 255 );
WRITE_BYTE( 10 );
MESSAGE_END();
#endif
// If we have wall penetration, use it.
if(iWallThickness)
{
TraceResult new_tr;
TraceResult backtrack_tr; // For exit decals
Vector wall_begin = tr.vecEndPos;
Vector wall_end;
UTIL_TraceLine(tr.vecEndPos + vecDir * iWallThickness,vecEnd,ignore_monsters,ENT(pev),&new_tr);
if(new_tr.flFraction == 1.0)
iWallThickness = 0;
else
{
// Get exit hole
UTIL_TraceLine(new_tr.vecEndPos,tr.vecEndPos,ignore_monsters,ENT(pev),&backtrack_tr);
if(backtrack_tr.flFraction != 1.0)
{
TEXTURETYPE_PlaySound(&backtrack_tr,vecSrc,backtrack_tr.vecEndPos,iBulletType);
// Only subtract from wall if it is from BSP (hard target)
if(backtrack_tr.pHit != NULL && VARS(backtrack_tr.pHit)->solid == SOLID_BSP)
{
wall_end = wall_begin - backtrack_tr.vecEndPos;
iWallThickness -= (int)(wall_end.Length() * fFalloffRate);
}
// Trace ahead to get next wall.
vecSrc = backtrack_tr.vecEndPos;
}
else
iWallThickness = 0; // No more place to go!
}
}
}
// make bullet trails
UTIL_BubbleTrail( vecSrc, tr.vecEndPos, (flDistance * tr.flFraction) / 64.0 );
}
ApplyMultiDamage(pev, pevAttacker);
ApplyMultiDamage(pev, pevAttacker);
}while(iWallThickness && iWallLimit--);
return Vector( x * vecSpread.x, y * vecSpread.y, 0.0 );
}

View file

@ -68,6 +68,7 @@ extern enginefuncs_t g_engfuncs;
#define RANDOM_LONG (*g_engfuncs.pfnRandomLong)
#define RANDOM_FLOAT (*g_engfuncs.pfnRandomFloat)
#define GETPLAYERWONID (*g_engfuncs.pfnGetPlayerWONId)
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin = NULL, edict_t *ed = NULL ) {
(*g_engfuncs.pfnMessageBegin)(msg_dest, msg_type, pOrigin, ed);

View file

@ -26,7 +26,6 @@
extern DLL_GLOBAL short g_sModelIndexFireball;
extern DLL_GLOBAL short g_sModelIndexSmoke;
extern void ExplosionCreate( const Vector &center, const Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage );
#endif //EXPLODE_H

View file

@ -37,7 +37,6 @@ extern DLL_GLOBAL Vector g_vecAttackDir;
const char *CBreakable::pSpawnObjects[] =
{
NULL, // 0
"item_battery", // 1
"item_healthkit", // 2
"weapon_9mmhandgun",// 3
"ammo_9mmclip", // 4
@ -145,6 +144,8 @@ void CBreakable::Spawn( void )
{
Precache( );
pev->classname = MAKE_STRING("func_breakable");
if ( FBitSet( pev->spawnflags, SF_BREAK_TRIGGER_ONLY ) )
pev->takedamage = DAMAGE_NO;
else
@ -314,6 +315,7 @@ void CBreakable::Precache( void )
PRECACHE_SOUND("debris/bustglass1.wav");
PRECACHE_SOUND("debris/bustglass2.wav");
PRECACHE_SOUND("debris/bustglass3.wav");
break;
case matMetal:
pGibName = "models/metalplategibs.mdl";
@ -492,7 +494,7 @@ void CBreakable::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
}
void CBreakable::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType )
void CBreakable::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ,int PenetrationValue)
{
// random spark if this is a 'computer' object
if (RANDOM_LONG(0,1) )
@ -518,7 +520,7 @@ void CBreakable::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec
}
}
CBaseDelay::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType );
CBaseDelay::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType,PenetrationValue );
}
//=========================================================
@ -605,11 +607,13 @@ void CBreakable::Die( void )
switch (m_Material)
{
case matGlass:
switch ( RANDOM_LONG(0,1) )
switch ( RANDOM_LONG(0,2) )
{
case 0: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustglass1.wav", fvol, ATTN_NORM, 0, pitch);
break;
case 1: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustglass2.wav", fvol, ATTN_NORM, 0, pitch);
case 1: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustglass2.wav", fvol, ATTN_NORM, 0, pitch);
break;
case 2: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustglass3.wav", fvol, ATTN_NORM, 0, pitch);
break;
}
cFlag = BREAK_GLASS;

View file

@ -34,7 +34,7 @@ public:
// breakables use an overridden takedamage
virtual int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
// To spark when hit
void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType );
void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType,int PenetrationValue = 0 );
BOOL IsBreakable( void );
BOOL SparkWhenHit( void );

View file

@ -733,7 +733,7 @@ void CFuncTankGun::Fire( const Vector &barrelEnd, const Vector &forward, entvars
{
for ( i = 0; i < bulletCount; i++ )
{
switch( m_bulletType )
/* switch( m_bulletType )
{
case TANK_BULLET_9MM:
FireBullets( 1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_MONSTER_9MM, 1, m_iBulletDamage, pevAttacker );
@ -750,7 +750,8 @@ void CFuncTankGun::Fire( const Vector &barrelEnd, const Vector &forward, entvars
default:
case TANK_BULLET_NONE:
break;
}
}*/
FireBullets( 1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_762MM, 1, m_iBulletDamage, pevAttacker );
}
CFuncTank::Fire( barrelEnd, forward, pevAttacker );
}

View file

@ -20,431 +20,34 @@
cvar_t displaysoundlist = {"displaysoundlist","0"};
// multiplayer server rules
cvar_t fragsleft = {"mp_fragsleft","0", FCVAR_SERVER | FCVAR_UNLOGGED }; // Don't spam console/log files/users with this changing
cvar_t timeleft = {"mp_timeleft","0" , FCVAR_SERVER | FCVAR_UNLOGGED }; // " "
cvar_t fragsleft = {"mp_fragsleft","0", FCVAR_SERVER | FCVAR_UNLOGGED }; // Don't spam console/log files/users with this changing
cvar_t timeleft = {"mp_timeleft","0" , FCVAR_SERVER | FCVAR_UNLOGGED }; // " "
// multiplayer server rules
cvar_t teamplay = {"mp_teamplay","0", FCVAR_SERVER };
cvar_t gametype = {"mp_gametype","0", FCVAR_SERVER };
cvar_t fraglimit = {"mp_fraglimit","0", FCVAR_SERVER };
cvar_t roundtimelimit = {"mp_roundtimelimit","3",FCVAR_SERVER };
cvar_t timelimit = {"mp_timelimit","0", FCVAR_SERVER };
cvar_t friendlyfire= {"mp_friendlyfire","0", FCVAR_SERVER };
cvar_t falldamage = {"mp_falldamage","0", FCVAR_SERVER };
cvar_t weaponstay = {"mp_weaponstay","0", FCVAR_SERVER };
cvar_t forcerespawn= {"mp_forcerespawn","1", FCVAR_SERVER };
cvar_t flashlight = {"mp_flashlight","0", FCVAR_SERVER };
cvar_t aimcrosshair= {"mp_autocrosshair","1", FCVAR_SERVER };
cvar_t decalfrequency = {"decalfrequency","30", FCVAR_SERVER };
cvar_t teamlist = {"mp_teamlist","hgrunt;scientist", FCVAR_SERVER };
cvar_t teamoverride = {"mp_teamoverride","1" };
cvar_t defaultteam = {"mp_defaultteam","0" };
cvar_t allowmonsters={"mp_allowmonsters","0", FCVAR_SERVER };
cvar_t maxlives={"mp_maxlives","1",FCVAR_SERVER };
cvar_t allowsidearms = {"mp_allowsidearms","1",FCVAR_SERVER|FCVAR_UNLOGGED};
cvar_t allowsecondary = {"mp_allowprimary","1",FCVAR_SERVER|FCVAR_UNLOGGED};
cvar_t allowunique = {"mp_allowunique","1",FCVAR_SERVER|FCVAR_UNLOGGED};
cvar_t allowexplosives = {"mp_allowexplosives","1",FCVAR_SERVER|FCVAR_UNLOGGED};
cvar_t mp_chattime = {"mp_chattime","10", FCVAR_SERVER };
// Engine Cvars
cvar_t *g_psv_gravity = NULL;
cvar_t *g_psv_aim = NULL;
cvar_t *g_footsteps = NULL;
//CVARS FOR SKILL LEVEL SETTINGS
// Agrunt
cvar_t sk_agrunt_health1 = {"sk_agrunt_health1","0"};
cvar_t sk_agrunt_health2 = {"sk_agrunt_health2","0"};
cvar_t sk_agrunt_health3 = {"sk_agrunt_health3","0"};
cvar_t sk_agrunt_dmg_punch1 = {"sk_agrunt_dmg_punch1","0"};
cvar_t sk_agrunt_dmg_punch2 = {"sk_agrunt_dmg_punch2","0"};
cvar_t sk_agrunt_dmg_punch3 = {"sk_agrunt_dmg_punch3","0"};
// Apache
cvar_t sk_apache_health1 = {"sk_apache_health1","0"};
cvar_t sk_apache_health2 = {"sk_apache_health2","0"};
cvar_t sk_apache_health3 = {"sk_apache_health3","0"};
// Barney
cvar_t sk_barney_health1 = {"sk_barney_health1","0"};
cvar_t sk_barney_health2 = {"sk_barney_health2","0"};
cvar_t sk_barney_health3 = {"sk_barney_health3","0"};
// Bullsquid
cvar_t sk_bullsquid_health1 = {"sk_bullsquid_health1","0"};
cvar_t sk_bullsquid_health2 = {"sk_bullsquid_health2","0"};
cvar_t sk_bullsquid_health3 = {"sk_bullsquid_health3","0"};
cvar_t sk_bullsquid_dmg_bite1 = {"sk_bullsquid_dmg_bite1","0"};
cvar_t sk_bullsquid_dmg_bite2 = {"sk_bullsquid_dmg_bite2","0"};
cvar_t sk_bullsquid_dmg_bite3 = {"sk_bullsquid_dmg_bite3","0"};
cvar_t sk_bullsquid_dmg_whip1 = {"sk_bullsquid_dmg_whip1","0"};
cvar_t sk_bullsquid_dmg_whip2 = {"sk_bullsquid_dmg_whip2","0"};
cvar_t sk_bullsquid_dmg_whip3 = {"sk_bullsquid_dmg_whip3","0"};
cvar_t sk_bullsquid_dmg_spit1 = {"sk_bullsquid_dmg_spit1","0"};
cvar_t sk_bullsquid_dmg_spit2 = {"sk_bullsquid_dmg_spit2","0"};
cvar_t sk_bullsquid_dmg_spit3 = {"sk_bullsquid_dmg_spit3","0"};
// Big Momma
cvar_t sk_bigmomma_health_factor1 = {"sk_bigmomma_health_factor1","1.0"};
cvar_t sk_bigmomma_health_factor2 = {"sk_bigmomma_health_factor2","1.0"};
cvar_t sk_bigmomma_health_factor3 = {"sk_bigmomma_health_factor3","1.0"};
cvar_t sk_bigmomma_dmg_slash1 = {"sk_bigmomma_dmg_slash1","50"};
cvar_t sk_bigmomma_dmg_slash2 = {"sk_bigmomma_dmg_slash2","50"};
cvar_t sk_bigmomma_dmg_slash3 = {"sk_bigmomma_dmg_slash3","50"};
cvar_t sk_bigmomma_dmg_blast1 = {"sk_bigmomma_dmg_blast1","100"};
cvar_t sk_bigmomma_dmg_blast2 = {"sk_bigmomma_dmg_blast2","100"};
cvar_t sk_bigmomma_dmg_blast3 = {"sk_bigmomma_dmg_blast3","100"};
cvar_t sk_bigmomma_radius_blast1 = {"sk_bigmomma_radius_blast1","250"};
cvar_t sk_bigmomma_radius_blast2 = {"sk_bigmomma_radius_blast2","250"};
cvar_t sk_bigmomma_radius_blast3 = {"sk_bigmomma_radius_blast3","250"};
// Gargantua
cvar_t sk_gargantua_health1 = {"sk_gargantua_health1","0"};
cvar_t sk_gargantua_health2 = {"sk_gargantua_health2","0"};
cvar_t sk_gargantua_health3 = {"sk_gargantua_health3","0"};
cvar_t sk_gargantua_dmg_slash1 = {"sk_gargantua_dmg_slash1","0"};
cvar_t sk_gargantua_dmg_slash2 = {"sk_gargantua_dmg_slash2","0"};
cvar_t sk_gargantua_dmg_slash3 = {"sk_gargantua_dmg_slash3","0"};
cvar_t sk_gargantua_dmg_fire1 = {"sk_gargantua_dmg_fire1","0"};
cvar_t sk_gargantua_dmg_fire2 = {"sk_gargantua_dmg_fire2","0"};
cvar_t sk_gargantua_dmg_fire3 = {"sk_gargantua_dmg_fire3","0"};
cvar_t sk_gargantua_dmg_stomp1 = {"sk_gargantua_dmg_stomp1","0"};
cvar_t sk_gargantua_dmg_stomp2 = {"sk_gargantua_dmg_stomp2","0"};
cvar_t sk_gargantua_dmg_stomp3 = {"sk_gargantua_dmg_stomp3","0"};
// Hassassin
cvar_t sk_hassassin_health1 = {"sk_hassassin_health1","0"};
cvar_t sk_hassassin_health2 = {"sk_hassassin_health2","0"};
cvar_t sk_hassassin_health3 = {"sk_hassassin_health3","0"};
// Headcrab
cvar_t sk_headcrab_health1 = {"sk_headcrab_health1","0"};
cvar_t sk_headcrab_health2 = {"sk_headcrab_health2","0"};
cvar_t sk_headcrab_health3 = {"sk_headcrab_health3","0"};
cvar_t sk_headcrab_dmg_bite1 = {"sk_headcrab_dmg_bite1","0"};
cvar_t sk_headcrab_dmg_bite2 = {"sk_headcrab_dmg_bite2","0"};
cvar_t sk_headcrab_dmg_bite3 = {"sk_headcrab_dmg_bite3","0"};
// Hgrunt
cvar_t sk_hgrunt_health1 = {"sk_hgrunt_health1","0"};
cvar_t sk_hgrunt_health2 = {"sk_hgrunt_health2","0"};
cvar_t sk_hgrunt_health3 = {"sk_hgrunt_health3","0"};
cvar_t sk_hgrunt_kick1 = {"sk_hgrunt_kick1","0"};
cvar_t sk_hgrunt_kick2 = {"sk_hgrunt_kick2","0"};
cvar_t sk_hgrunt_kick3 = {"sk_hgrunt_kick3","0"};
cvar_t sk_hgrunt_pellets1 = {"sk_hgrunt_pellets1","0"};
cvar_t sk_hgrunt_pellets2 = {"sk_hgrunt_pellets2","0"};
cvar_t sk_hgrunt_pellets3 = {"sk_hgrunt_pellets3","0"};
cvar_t sk_hgrunt_gspeed1 = {"sk_hgrunt_gspeed1","0"};
cvar_t sk_hgrunt_gspeed2 = {"sk_hgrunt_gspeed2","0"};
cvar_t sk_hgrunt_gspeed3 = {"sk_hgrunt_gspeed3","0"};
// Houndeye
cvar_t sk_houndeye_health1 = {"sk_houndeye_health1","0"};
cvar_t sk_houndeye_health2 = {"sk_houndeye_health2","0"};
cvar_t sk_houndeye_health3 = {"sk_houndeye_health3","0"};
cvar_t sk_houndeye_dmg_blast1 = {"sk_houndeye_dmg_blast1","0"};
cvar_t sk_houndeye_dmg_blast2 = {"sk_houndeye_dmg_blast2","0"};
cvar_t sk_houndeye_dmg_blast3 = {"sk_houndeye_dmg_blast3","0"};
// ISlave
cvar_t sk_islave_health1 = {"sk_islave_health1","0"};
cvar_t sk_islave_health2 = {"sk_islave_health2","0"};
cvar_t sk_islave_health3 = {"sk_islave_health3","0"};
cvar_t sk_islave_dmg_claw1 = {"sk_islave_dmg_claw1","0"};
cvar_t sk_islave_dmg_claw2 = {"sk_islave_dmg_claw2","0"};
cvar_t sk_islave_dmg_claw3 = {"sk_islave_dmg_claw3","0"};
cvar_t sk_islave_dmg_clawrake1 = {"sk_islave_dmg_clawrake1","0"};
cvar_t sk_islave_dmg_clawrake2 = {"sk_islave_dmg_clawrake2","0"};
cvar_t sk_islave_dmg_clawrake3 = {"sk_islave_dmg_clawrake3","0"};
cvar_t sk_islave_dmg_zap1 = {"sk_islave_dmg_zap1","0"};
cvar_t sk_islave_dmg_zap2 = {"sk_islave_dmg_zap2","0"};
cvar_t sk_islave_dmg_zap3 = {"sk_islave_dmg_zap3","0"};
// Icthyosaur
cvar_t sk_ichthyosaur_health1 = {"sk_ichthyosaur_health1","0"};
cvar_t sk_ichthyosaur_health2 = {"sk_ichthyosaur_health2","0"};
cvar_t sk_ichthyosaur_health3 = {"sk_ichthyosaur_health3","0"};
cvar_t sk_ichthyosaur_shake1 = {"sk_ichthyosaur_shake1","0"};
cvar_t sk_ichthyosaur_shake2 = {"sk_ichthyosaur_shake2","0"};
cvar_t sk_ichthyosaur_shake3 = {"sk_ichthyosaur_shake3","0"};
// Leech
cvar_t sk_leech_health1 = {"sk_leech_health1","0"};
cvar_t sk_leech_health2 = {"sk_leech_health2","0"};
cvar_t sk_leech_health3 = {"sk_leech_health3","0"};
cvar_t sk_leech_dmg_bite1 = {"sk_leech_dmg_bite1","0"};
cvar_t sk_leech_dmg_bite2 = {"sk_leech_dmg_bite2","0"};
cvar_t sk_leech_dmg_bite3 = {"sk_leech_dmg_bite3","0"};
// Controller
cvar_t sk_controller_health1 = {"sk_controller_health1","0"};
cvar_t sk_controller_health2 = {"sk_controller_health2","0"};
cvar_t sk_controller_health3 = {"sk_controller_health3","0"};
cvar_t sk_controller_dmgzap1 = {"sk_controller_dmgzap1","0"};
cvar_t sk_controller_dmgzap2 = {"sk_controller_dmgzap2","0"};
cvar_t sk_controller_dmgzap3 = {"sk_controller_dmgzap3","0"};
cvar_t sk_controller_speedball1 = {"sk_controller_speedball1","0"};
cvar_t sk_controller_speedball2 = {"sk_controller_speedball2","0"};
cvar_t sk_controller_speedball3 = {"sk_controller_speedball3","0"};
cvar_t sk_controller_dmgball1 = {"sk_controller_dmgball1","0"};
cvar_t sk_controller_dmgball2 = {"sk_controller_dmgball2","0"};
cvar_t sk_controller_dmgball3 = {"sk_controller_dmgball3","0"};
// Nihilanth
cvar_t sk_nihilanth_health1 = {"sk_nihilanth_health1","0"};
cvar_t sk_nihilanth_health2 = {"sk_nihilanth_health2","0"};
cvar_t sk_nihilanth_health3 = {"sk_nihilanth_health3","0"};
cvar_t sk_nihilanth_zap1 = {"sk_nihilanth_zap1","0"};
cvar_t sk_nihilanth_zap2 = {"sk_nihilanth_zap2","0"};
cvar_t sk_nihilanth_zap3 = {"sk_nihilanth_zap3","0"};
// Scientist
cvar_t sk_scientist_health1 = {"sk_scientist_health1","0"};
cvar_t sk_scientist_health2 = {"sk_scientist_health2","0"};
cvar_t sk_scientist_health3 = {"sk_scientist_health3","0"};
// Snark
cvar_t sk_snark_health1 = {"sk_snark_health1","0"};
cvar_t sk_snark_health2 = {"sk_snark_health2","0"};
cvar_t sk_snark_health3 = {"sk_snark_health3","0"};
cvar_t sk_snark_dmg_bite1 = {"sk_snark_dmg_bite1","0"};
cvar_t sk_snark_dmg_bite2 = {"sk_snark_dmg_bite2","0"};
cvar_t sk_snark_dmg_bite3 = {"sk_snark_dmg_bite3","0"};
cvar_t sk_snark_dmg_pop1 = {"sk_snark_dmg_pop1","0"};
cvar_t sk_snark_dmg_pop2 = {"sk_snark_dmg_pop2","0"};
cvar_t sk_snark_dmg_pop3 = {"sk_snark_dmg_pop3","0"};
// Zombie
cvar_t sk_zombie_health1 = {"sk_zombie_health1","0"};
cvar_t sk_zombie_health2 = {"sk_zombie_health2","0"};
cvar_t sk_zombie_health3 = {"sk_zombie_health3","0"};
cvar_t sk_zombie_dmg_one_slash1 = {"sk_zombie_dmg_one_slash1","0"};
cvar_t sk_zombie_dmg_one_slash2 = {"sk_zombie_dmg_one_slash2","0"};
cvar_t sk_zombie_dmg_one_slash3 = {"sk_zombie_dmg_one_slash3","0"};
cvar_t sk_zombie_dmg_both_slash1 = {"sk_zombie_dmg_both_slash1","0"};
cvar_t sk_zombie_dmg_both_slash2 = {"sk_zombie_dmg_both_slash2","0"};
cvar_t sk_zombie_dmg_both_slash3 = {"sk_zombie_dmg_both_slash3","0"};
//Turret
cvar_t sk_turret_health1 = {"sk_turret_health1","0"};
cvar_t sk_turret_health2 = {"sk_turret_health2","0"};
cvar_t sk_turret_health3 = {"sk_turret_health3","0"};
// MiniTurret
cvar_t sk_miniturret_health1 = {"sk_miniturret_health1","0"};
cvar_t sk_miniturret_health2 = {"sk_miniturret_health2","0"};
cvar_t sk_miniturret_health3 = {"sk_miniturret_health3","0"};
// Sentry Turret
cvar_t sk_sentry_health1 = {"sk_sentry_health1","0"};
cvar_t sk_sentry_health2 = {"sk_sentry_health2","0"};
cvar_t sk_sentry_health3 = {"sk_sentry_health3","0"};
// PLAYER WEAPONS
// Crowbar whack
cvar_t sk_plr_crowbar1 = {"sk_plr_crowbar1","0"};
cvar_t sk_plr_crowbar2 = {"sk_plr_crowbar2","0"};
cvar_t sk_plr_crowbar3 = {"sk_plr_crowbar3","0"};
// Glock Round
cvar_t sk_plr_9mm_bullet1 = {"sk_plr_9mm_bullet1","0"};
cvar_t sk_plr_9mm_bullet2 = {"sk_plr_9mm_bullet2","0"};
cvar_t sk_plr_9mm_bullet3 = {"sk_plr_9mm_bullet3","0"};
// 357 Round
cvar_t sk_plr_357_bullet1 = {"sk_plr_357_bullet1","0"};
cvar_t sk_plr_357_bullet2 = {"sk_plr_357_bullet2","0"};
cvar_t sk_plr_357_bullet3 = {"sk_plr_357_bullet3","0"};
// MP5 Round
cvar_t sk_plr_9mmAR_bullet1 = {"sk_plr_9mmAR_bullet1","0"};
cvar_t sk_plr_9mmAR_bullet2 = {"sk_plr_9mmAR_bullet2","0"};
cvar_t sk_plr_9mmAR_bullet3 = {"sk_plr_9mmAR_bullet3","0"};
// M203 grenade
cvar_t sk_plr_9mmAR_grenade1 = {"sk_plr_9mmAR_grenade1","0"};
cvar_t sk_plr_9mmAR_grenade2 = {"sk_plr_9mmAR_grenade2","0"};
cvar_t sk_plr_9mmAR_grenade3 = {"sk_plr_9mmAR_grenade3","0"};
// Shotgun buckshot
cvar_t sk_plr_buckshot1 = {"sk_plr_buckshot1","0"};
cvar_t sk_plr_buckshot2 = {"sk_plr_buckshot2","0"};
cvar_t sk_plr_buckshot3 = {"sk_plr_buckshot3","0"};
// Crossbow
cvar_t sk_plr_xbow_bolt_client1 = {"sk_plr_xbow_bolt_client1","0"};
cvar_t sk_plr_xbow_bolt_client2 = {"sk_plr_xbow_bolt_client2","0"};
cvar_t sk_plr_xbow_bolt_client3 = {"sk_plr_xbow_bolt_client3","0"};
cvar_t sk_plr_xbow_bolt_monster1 = {"sk_plr_xbow_bolt_monster1","0"};
cvar_t sk_plr_xbow_bolt_monster2 = {"sk_plr_xbow_bolt_monster2","0"};
cvar_t sk_plr_xbow_bolt_monster3 = {"sk_plr_xbow_bolt_monster3","0"};
// RPG
cvar_t sk_plr_rpg1 = {"sk_plr_rpg1","0"};
cvar_t sk_plr_rpg2 = {"sk_plr_rpg2","0"};
cvar_t sk_plr_rpg3 = {"sk_plr_rpg3","0"};
// Zero Point Generator
cvar_t sk_plr_gauss1 = {"sk_plr_gauss1","0"};
cvar_t sk_plr_gauss2 = {"sk_plr_gauss2","0"};
cvar_t sk_plr_gauss3 = {"sk_plr_gauss3","0"};
// Tau Cannon
cvar_t sk_plr_egon_narrow1 = {"sk_plr_egon_narrow1","0"};
cvar_t sk_plr_egon_narrow2 = {"sk_plr_egon_narrow2","0"};
cvar_t sk_plr_egon_narrow3 = {"sk_plr_egon_narrow3","0"};
cvar_t sk_plr_egon_wide1 = {"sk_plr_egon_wide1","0"};
cvar_t sk_plr_egon_wide2 = {"sk_plr_egon_wide2","0"};
cvar_t sk_plr_egon_wide3 = {"sk_plr_egon_wide3","0"};
// Hand Grendade
cvar_t sk_plr_hand_grenade1 = {"sk_plr_hand_grenade1","0"};
cvar_t sk_plr_hand_grenade2 = {"sk_plr_hand_grenade2","0"};
cvar_t sk_plr_hand_grenade3 = {"sk_plr_hand_grenade3","0"};
// Satchel Charge
cvar_t sk_plr_satchel1 = {"sk_plr_satchel1","0"};
cvar_t sk_plr_satchel2 = {"sk_plr_satchel2","0"};
cvar_t sk_plr_satchel3 = {"sk_plr_satchel3","0"};
// Tripmine
cvar_t sk_plr_tripmine1 = {"sk_plr_tripmine1","0"};
cvar_t sk_plr_tripmine2 = {"sk_plr_tripmine2","0"};
cvar_t sk_plr_tripmine3 = {"sk_plr_tripmine3","0"};
// WORLD WEAPONS
cvar_t sk_12mm_bullet1 = {"sk_12mm_bullet1","0"};
cvar_t sk_12mm_bullet2 = {"sk_12mm_bullet2","0"};
cvar_t sk_12mm_bullet3 = {"sk_12mm_bullet3","0"};
cvar_t sk_9mmAR_bullet1 = {"sk_9mmAR_bullet1","0"};
cvar_t sk_9mmAR_bullet2 = {"sk_9mmAR_bullet2","0"};
cvar_t sk_9mmAR_bullet3 = {"sk_9mmAR_bullet3","0"};
cvar_t sk_9mm_bullet1 = {"sk_9mm_bullet1","0"};
cvar_t sk_9mm_bullet2 = {"sk_9mm_bullet2","0"};
cvar_t sk_9mm_bullet3 = {"sk_9mm_bullet3","0"};
// HORNET
cvar_t sk_hornet_dmg1 = {"sk_hornet_dmg1","0"};
cvar_t sk_hornet_dmg2 = {"sk_hornet_dmg2","0"};
cvar_t sk_hornet_dmg3 = {"sk_hornet_dmg3","0"};
// HEALTH/CHARGE
cvar_t sk_suitcharger1 = { "sk_suitcharger1","0" };
cvar_t sk_suitcharger2 = { "sk_suitcharger2","0" };
cvar_t sk_suitcharger3 = { "sk_suitcharger3","0" };
cvar_t sk_battery1 = { "sk_battery1","0" };
cvar_t sk_battery2 = { "sk_battery2","0" };
cvar_t sk_battery3 = { "sk_battery3","0" };
cvar_t sk_healthcharger1 = { "sk_healthcharger1","0" };
cvar_t sk_healthcharger2 = { "sk_healthcharger2","0" };
cvar_t sk_healthcharger3 = { "sk_healthcharger3","0" };
cvar_t sk_healthkit1 = { "sk_healthkit1","0" };
cvar_t sk_healthkit2 = { "sk_healthkit2","0" };
cvar_t sk_healthkit3 = { "sk_healthkit3","0" };
cvar_t sk_scientist_heal1 = { "sk_scientist_heal1","0" };
cvar_t sk_scientist_heal2 = { "sk_scientist_heal2","0" };
cvar_t sk_scientist_heal3 = { "sk_scientist_heal3","0" };
// monster damage adjusters
cvar_t sk_monster_head1 = { "sk_monster_head1","2" };
cvar_t sk_monster_head2 = { "sk_monster_head2","2" };
cvar_t sk_monster_head3 = { "sk_monster_head3","2" };
cvar_t sk_monster_chest1 = { "sk_monster_chest1","1" };
cvar_t sk_monster_chest2 = { "sk_monster_chest2","1" };
cvar_t sk_monster_chest3 = { "sk_monster_chest3","1" };
cvar_t sk_monster_stomach1 = { "sk_monster_stomach1","1" };
cvar_t sk_monster_stomach2 = { "sk_monster_stomach2","1" };
cvar_t sk_monster_stomach3 = { "sk_monster_stomach3","1" };
cvar_t sk_monster_arm1 = { "sk_monster_arm1","1" };
cvar_t sk_monster_arm2 = { "sk_monster_arm2","1" };
cvar_t sk_monster_arm3 = { "sk_monster_arm3","1" };
cvar_t sk_monster_leg1 = { "sk_monster_leg1","1" };
cvar_t sk_monster_leg2 = { "sk_monster_leg2","1" };
cvar_t sk_monster_leg3 = { "sk_monster_leg3","1" };
// player damage adjusters
cvar_t sk_player_head1 = { "sk_player_head1","2" };
cvar_t sk_player_head2 = { "sk_player_head2","2" };
cvar_t sk_player_head3 = { "sk_player_head3","2" };
cvar_t sk_player_chest1 = { "sk_player_chest1","1" };
cvar_t sk_player_chest2 = { "sk_player_chest2","1" };
cvar_t sk_player_chest3 = { "sk_player_chest3","1" };
cvar_t sk_player_stomach1 = { "sk_player_stomach1","1" };
cvar_t sk_player_stomach2 = { "sk_player_stomach2","1" };
cvar_t sk_player_stomach3 = { "sk_player_stomach3","1" };
cvar_t sk_player_arm1 = { "sk_player_arm1","1" };
cvar_t sk_player_arm2 = { "sk_player_arm2","1" };
cvar_t sk_player_arm3 = { "sk_player_arm3","1" };
cvar_t sk_player_leg1 = { "sk_player_leg1","1" };
cvar_t sk_player_leg2 = { "sk_player_leg2","1" };
cvar_t sk_player_leg3 = { "sk_player_leg3","1" };
// END Cvars for Skill Level settings
@ -453,433 +56,36 @@ cvar_t sk_player_leg3 = { "sk_player_leg3","1" };
void GameDLLInit( void )
{
// Register cvars here:
g_psv_gravity = CVAR_GET_POINTER( "sv_gravity" );
g_psv_aim = CVAR_GET_POINTER( "sv_aim" );
g_footsteps = CVAR_GET_POINTER( "mp_footsteps" );
CVAR_REGISTER (&displaysoundlist);
CVAR_REGISTER (&teamplay);
CVAR_REGISTER (&gametype);
CVAR_REGISTER (&fraglimit);
CVAR_REGISTER (&roundtimelimit);
CVAR_REGISTER (&timelimit);
CVAR_REGISTER (&fragsleft);
CVAR_REGISTER (&timeleft);
CVAR_REGISTER (&friendlyfire);
CVAR_REGISTER (&falldamage);
CVAR_REGISTER (&weaponstay);
CVAR_REGISTER (&forcerespawn);
CVAR_REGISTER (&flashlight);
CVAR_REGISTER (&aimcrosshair);
CVAR_REGISTER (&decalfrequency);
CVAR_REGISTER (&teamlist);
CVAR_REGISTER (&teamoverride);
CVAR_REGISTER (&defaultteam);
CVAR_REGISTER (&allowmonsters);
CVAR_REGISTER (&maxlives);
CVAR_REGISTER (&allowsidearms);
CVAR_REGISTER (&allowsecondary);
CVAR_REGISTER (&allowunique);
CVAR_REGISTER (&allowexplosives);
CVAR_REGISTER (&mp_chattime);
// REGISTER CVARS FOR SKILL LEVEL STUFF
// Agrunt
CVAR_REGISTER ( &sk_agrunt_health1 );// {"sk_agrunt_health1","0"};
CVAR_REGISTER ( &sk_agrunt_health2 );// {"sk_agrunt_health2","0"};
CVAR_REGISTER ( &sk_agrunt_health3 );// {"sk_agrunt_health3","0"};
CVAR_REGISTER ( &sk_agrunt_dmg_punch1 );// {"sk_agrunt_dmg_punch1","0"};
CVAR_REGISTER ( &sk_agrunt_dmg_punch2 );// {"sk_agrunt_dmg_punch2","0"};
CVAR_REGISTER ( &sk_agrunt_dmg_punch3 );// {"sk_agrunt_dmg_punch3","0"};
// Apache
CVAR_REGISTER ( &sk_apache_health1 );// {"sk_apache_health1","0"};
CVAR_REGISTER ( &sk_apache_health2 );// {"sk_apache_health2","0"};
CVAR_REGISTER ( &sk_apache_health3 );// {"sk_apache_health3","0"};
// Barney
CVAR_REGISTER ( &sk_barney_health1 );// {"sk_barney_health1","0"};
CVAR_REGISTER ( &sk_barney_health2 );// {"sk_barney_health2","0"};
CVAR_REGISTER ( &sk_barney_health3 );// {"sk_barney_health3","0"};
// Bullsquid
CVAR_REGISTER ( &sk_bullsquid_health1 );// {"sk_bullsquid_health1","0"};
CVAR_REGISTER ( &sk_bullsquid_health2 );// {"sk_bullsquid_health2","0"};
CVAR_REGISTER ( &sk_bullsquid_health3 );// {"sk_bullsquid_health3","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_bite1 );// {"sk_bullsquid_dmg_bite1","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_bite2 );// {"sk_bullsquid_dmg_bite2","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_bite3 );// {"sk_bullsquid_dmg_bite3","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_whip1 );// {"sk_bullsquid_dmg_whip1","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_whip2 );// {"sk_bullsquid_dmg_whip2","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_whip3 );// {"sk_bullsquid_dmg_whip3","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_spit1 );// {"sk_bullsquid_dmg_spit1","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_spit2 );// {"sk_bullsquid_dmg_spit2","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_spit3 );// {"sk_bullsquid_dmg_spit3","0"};
CVAR_REGISTER ( &sk_bigmomma_health_factor1 );// {"sk_bigmomma_health_factor1","1.0"};
CVAR_REGISTER ( &sk_bigmomma_health_factor2 );// {"sk_bigmomma_health_factor2","1.0"};
CVAR_REGISTER ( &sk_bigmomma_health_factor3 );// {"sk_bigmomma_health_factor3","1.0"};
CVAR_REGISTER ( &sk_bigmomma_dmg_slash1 );// {"sk_bigmomma_dmg_slash1","50"};
CVAR_REGISTER ( &sk_bigmomma_dmg_slash2 );// {"sk_bigmomma_dmg_slash2","50"};
CVAR_REGISTER ( &sk_bigmomma_dmg_slash3 );// {"sk_bigmomma_dmg_slash3","50"};
CVAR_REGISTER ( &sk_bigmomma_dmg_blast1 );// {"sk_bigmomma_dmg_blast1","100"};
CVAR_REGISTER ( &sk_bigmomma_dmg_blast2 );// {"sk_bigmomma_dmg_blast2","100"};
CVAR_REGISTER ( &sk_bigmomma_dmg_blast3 );// {"sk_bigmomma_dmg_blast3","100"};
CVAR_REGISTER ( &sk_bigmomma_radius_blast1 );// {"sk_bigmomma_radius_blast1","250"};
CVAR_REGISTER ( &sk_bigmomma_radius_blast2 );// {"sk_bigmomma_radius_blast2","250"};
CVAR_REGISTER ( &sk_bigmomma_radius_blast3 );// {"sk_bigmomma_radius_blast3","250"};
// Gargantua
CVAR_REGISTER ( &sk_gargantua_health1 );// {"sk_gargantua_health1","0"};
CVAR_REGISTER ( &sk_gargantua_health2 );// {"sk_gargantua_health2","0"};
CVAR_REGISTER ( &sk_gargantua_health3 );// {"sk_gargantua_health3","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_slash1 );// {"sk_gargantua_dmg_slash1","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_slash2 );// {"sk_gargantua_dmg_slash2","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_slash3 );// {"sk_gargantua_dmg_slash3","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_fire1 );// {"sk_gargantua_dmg_fire1","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_fire2 );// {"sk_gargantua_dmg_fire2","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_fire3 );// {"sk_gargantua_dmg_fire3","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_stomp1 );// {"sk_gargantua_dmg_stomp1","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_stomp2 );// {"sk_gargantua_dmg_stomp2","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_stomp3 );// {"sk_gargantua_dmg_stomp3","0"};
// Hassassin
CVAR_REGISTER ( &sk_hassassin_health1 );// {"sk_hassassin_health1","0"};
CVAR_REGISTER ( &sk_hassassin_health2 );// {"sk_hassassin_health2","0"};
CVAR_REGISTER ( &sk_hassassin_health3 );// {"sk_hassassin_health3","0"};
// Headcrab
CVAR_REGISTER ( &sk_headcrab_health1 );// {"sk_headcrab_health1","0"};
CVAR_REGISTER ( &sk_headcrab_health2 );// {"sk_headcrab_health2","0"};
CVAR_REGISTER ( &sk_headcrab_health3 );// {"sk_headcrab_health3","0"};
CVAR_REGISTER ( &sk_headcrab_dmg_bite1 );// {"sk_headcrab_dmg_bite1","0"};
CVAR_REGISTER ( &sk_headcrab_dmg_bite2 );// {"sk_headcrab_dmg_bite2","0"};
CVAR_REGISTER ( &sk_headcrab_dmg_bite3 );// {"sk_headcrab_dmg_bite3","0"};
// Hgrunt
CVAR_REGISTER ( &sk_hgrunt_health1 );// {"sk_hgrunt_health1","0"};
CVAR_REGISTER ( &sk_hgrunt_health2 );// {"sk_hgrunt_health2","0"};
CVAR_REGISTER ( &sk_hgrunt_health3 );// {"sk_hgrunt_health3","0"};
CVAR_REGISTER ( &sk_hgrunt_kick1 );// {"sk_hgrunt_kick1","0"};
CVAR_REGISTER ( &sk_hgrunt_kick2 );// {"sk_hgrunt_kick2","0"};
CVAR_REGISTER ( &sk_hgrunt_kick3 );// {"sk_hgrunt_kick3","0"};
CVAR_REGISTER ( &sk_hgrunt_pellets1 );
CVAR_REGISTER ( &sk_hgrunt_pellets2 );
CVAR_REGISTER ( &sk_hgrunt_pellets3 );
CVAR_REGISTER ( &sk_hgrunt_gspeed1 );
CVAR_REGISTER ( &sk_hgrunt_gspeed2 );
CVAR_REGISTER ( &sk_hgrunt_gspeed3 );
// Houndeye
CVAR_REGISTER ( &sk_houndeye_health1 );// {"sk_houndeye_health1","0"};
CVAR_REGISTER ( &sk_houndeye_health2 );// {"sk_houndeye_health2","0"};
CVAR_REGISTER ( &sk_houndeye_health3 );// {"sk_houndeye_health3","0"};
CVAR_REGISTER ( &sk_houndeye_dmg_blast1 );// {"sk_houndeye_dmg_blast1","0"};
CVAR_REGISTER ( &sk_houndeye_dmg_blast2 );// {"sk_houndeye_dmg_blast2","0"};
CVAR_REGISTER ( &sk_houndeye_dmg_blast3 );// {"sk_houndeye_dmg_blast3","0"};
// ISlave
CVAR_REGISTER ( &sk_islave_health1 );// {"sk_islave_health1","0"};
CVAR_REGISTER ( &sk_islave_health2 );// {"sk_islave_health2","0"};
CVAR_REGISTER ( &sk_islave_health3 );// {"sk_islave_health3","0"};
CVAR_REGISTER ( &sk_islave_dmg_claw1 );// {"sk_islave_dmg_claw1","0"};
CVAR_REGISTER ( &sk_islave_dmg_claw2 );// {"sk_islave_dmg_claw2","0"};
CVAR_REGISTER ( &sk_islave_dmg_claw3 );// {"sk_islave_dmg_claw3","0"};
CVAR_REGISTER ( &sk_islave_dmg_clawrake1 );// {"sk_islave_dmg_clawrake1","0"};
CVAR_REGISTER ( &sk_islave_dmg_clawrake2 );// {"sk_islave_dmg_clawrake2","0"};
CVAR_REGISTER ( &sk_islave_dmg_clawrake3 );// {"sk_islave_dmg_clawrake3","0"};
CVAR_REGISTER ( &sk_islave_dmg_zap1 );// {"sk_islave_dmg_zap1","0"};
CVAR_REGISTER ( &sk_islave_dmg_zap2 );// {"sk_islave_dmg_zap2","0"};
CVAR_REGISTER ( &sk_islave_dmg_zap3 );// {"sk_islave_dmg_zap3","0"};
// Icthyosaur
CVAR_REGISTER ( &sk_ichthyosaur_health1 );// {"sk_ichthyosaur_health1","0"};
CVAR_REGISTER ( &sk_ichthyosaur_health2 );// {"sk_ichthyosaur_health2","0"};
CVAR_REGISTER ( &sk_ichthyosaur_health3 );// {"sk_ichthyosaur_health3","0"};
CVAR_REGISTER ( &sk_ichthyosaur_shake1 );// {"sk_ichthyosaur_health3","0"};
CVAR_REGISTER ( &sk_ichthyosaur_shake2 );// {"sk_ichthyosaur_health3","0"};
CVAR_REGISTER ( &sk_ichthyosaur_shake3 );// {"sk_ichthyosaur_health3","0"};
// Leech
CVAR_REGISTER ( &sk_leech_health1 );// {"sk_leech_health1","0"};
CVAR_REGISTER ( &sk_leech_health2 );// {"sk_leech_health2","0"};
CVAR_REGISTER ( &sk_leech_health3 );// {"sk_leech_health3","0"};
CVAR_REGISTER ( &sk_leech_dmg_bite1 );// {"sk_leech_dmg_bite1","0"};
CVAR_REGISTER ( &sk_leech_dmg_bite2 );// {"sk_leech_dmg_bite2","0"};
CVAR_REGISTER ( &sk_leech_dmg_bite3 );// {"sk_leech_dmg_bite3","0"};
// Controller
CVAR_REGISTER ( &sk_controller_health1 );
CVAR_REGISTER ( &sk_controller_health2 );
CVAR_REGISTER ( &sk_controller_health3 );
CVAR_REGISTER ( &sk_controller_dmgzap1 );
CVAR_REGISTER ( &sk_controller_dmgzap2 );
CVAR_REGISTER ( &sk_controller_dmgzap3 );
CVAR_REGISTER ( &sk_controller_speedball1 );
CVAR_REGISTER ( &sk_controller_speedball2 );
CVAR_REGISTER ( &sk_controller_speedball3 );
CVAR_REGISTER ( &sk_controller_dmgball1 );
CVAR_REGISTER ( &sk_controller_dmgball2 );
CVAR_REGISTER ( &sk_controller_dmgball3 );
// Nihilanth
CVAR_REGISTER ( &sk_nihilanth_health1 );// {"sk_nihilanth_health1","0"};
CVAR_REGISTER ( &sk_nihilanth_health2 );// {"sk_nihilanth_health2","0"};
CVAR_REGISTER ( &sk_nihilanth_health3 );// {"sk_nihilanth_health3","0"};
CVAR_REGISTER ( &sk_nihilanth_zap1 );
CVAR_REGISTER ( &sk_nihilanth_zap2 );
CVAR_REGISTER ( &sk_nihilanth_zap3 );
// Scientist
CVAR_REGISTER ( &sk_scientist_health1 );// {"sk_scientist_health1","0"};
CVAR_REGISTER ( &sk_scientist_health2 );// {"sk_scientist_health2","0"};
CVAR_REGISTER ( &sk_scientist_health3 );// {"sk_scientist_health3","0"};
// Snark
CVAR_REGISTER ( &sk_snark_health1 );// {"sk_snark_health1","0"};
CVAR_REGISTER ( &sk_snark_health2 );// {"sk_snark_health2","0"};
CVAR_REGISTER ( &sk_snark_health3 );// {"sk_snark_health3","0"};
CVAR_REGISTER ( &sk_snark_dmg_bite1 );// {"sk_snark_dmg_bite1","0"};
CVAR_REGISTER ( &sk_snark_dmg_bite2 );// {"sk_snark_dmg_bite2","0"};
CVAR_REGISTER ( &sk_snark_dmg_bite3 );// {"sk_snark_dmg_bite3","0"};
CVAR_REGISTER ( &sk_snark_dmg_pop1 );// {"sk_snark_dmg_pop1","0"};
CVAR_REGISTER ( &sk_snark_dmg_pop2 );// {"sk_snark_dmg_pop2","0"};
CVAR_REGISTER ( &sk_snark_dmg_pop3 );// {"sk_snark_dmg_pop3","0"};
// Zombie
CVAR_REGISTER ( &sk_zombie_health1 );// {"sk_zombie_health1","0"};
CVAR_REGISTER ( &sk_zombie_health2 );// {"sk_zombie_health3","0"};
CVAR_REGISTER ( &sk_zombie_health3 );// {"sk_zombie_health3","0"};
CVAR_REGISTER ( &sk_zombie_dmg_one_slash1 );// {"sk_zombie_dmg_one_slash1","0"};
CVAR_REGISTER ( &sk_zombie_dmg_one_slash2 );// {"sk_zombie_dmg_one_slash2","0"};
CVAR_REGISTER ( &sk_zombie_dmg_one_slash3 );// {"sk_zombie_dmg_one_slash3","0"};
CVAR_REGISTER ( &sk_zombie_dmg_both_slash1 );// {"sk_zombie_dmg_both_slash1","0"};
CVAR_REGISTER ( &sk_zombie_dmg_both_slash2 );// {"sk_zombie_dmg_both_slash2","0"};
CVAR_REGISTER ( &sk_zombie_dmg_both_slash3 );// {"sk_zombie_dmg_both_slash3","0"};
//Turret
CVAR_REGISTER ( &sk_turret_health1 );// {"sk_turret_health1","0"};
CVAR_REGISTER ( &sk_turret_health2 );// {"sk_turret_health2","0"};
CVAR_REGISTER ( &sk_turret_health3 );// {"sk_turret_health3","0"};
// MiniTurret
CVAR_REGISTER ( &sk_miniturret_health1 );// {"sk_miniturret_health1","0"};
CVAR_REGISTER ( &sk_miniturret_health2 );// {"sk_miniturret_health2","0"};
CVAR_REGISTER ( &sk_miniturret_health3 );// {"sk_miniturret_health3","0"};
// Sentry Turret
CVAR_REGISTER ( &sk_sentry_health1 );// {"sk_sentry_health1","0"};
CVAR_REGISTER ( &sk_sentry_health2 );// {"sk_sentry_health2","0"};
CVAR_REGISTER ( &sk_sentry_health3 );// {"sk_sentry_health3","0"};
// PLAYER WEAPONS
// Crowbar whack
CVAR_REGISTER ( &sk_plr_crowbar1 );// {"sk_plr_crowbar1","0"};
CVAR_REGISTER ( &sk_plr_crowbar2 );// {"sk_plr_crowbar2","0"};
CVAR_REGISTER ( &sk_plr_crowbar3 );// {"sk_plr_crowbar3","0"};
// Glock Round
CVAR_REGISTER ( &sk_plr_9mm_bullet1 );// {"sk_plr_9mm_bullet1","0"};
CVAR_REGISTER ( &sk_plr_9mm_bullet2 );// {"sk_plr_9mm_bullet2","0"};
CVAR_REGISTER ( &sk_plr_9mm_bullet3 );// {"sk_plr_9mm_bullet3","0"};
// 357 Round
CVAR_REGISTER ( &sk_plr_357_bullet1 );// {"sk_plr_357_bullet1","0"};
CVAR_REGISTER ( &sk_plr_357_bullet2 );// {"sk_plr_357_bullet2","0"};
CVAR_REGISTER ( &sk_plr_357_bullet3 );// {"sk_plr_357_bullet3","0"};
// MP5 Round
CVAR_REGISTER ( &sk_plr_9mmAR_bullet1 );// {"sk_plr_9mmAR_bullet1","0"};
CVAR_REGISTER ( &sk_plr_9mmAR_bullet2 );// {"sk_plr_9mmAR_bullet2","0"};
CVAR_REGISTER ( &sk_plr_9mmAR_bullet3 );// {"sk_plr_9mmAR_bullet3","0"};
// M203 grenade
CVAR_REGISTER ( &sk_plr_9mmAR_grenade1 );// {"sk_plr_9mmAR_grenade1","0"};
CVAR_REGISTER ( &sk_plr_9mmAR_grenade2 );// {"sk_plr_9mmAR_grenade2","0"};
CVAR_REGISTER ( &sk_plr_9mmAR_grenade3 );// {"sk_plr_9mmAR_grenade3","0"};
// Shotgun buckshot
CVAR_REGISTER ( &sk_plr_buckshot1 );// {"sk_plr_buckshot1","0"};
CVAR_REGISTER ( &sk_plr_buckshot2 );// {"sk_plr_buckshot2","0"};
CVAR_REGISTER ( &sk_plr_buckshot3 );// {"sk_plr_buckshot3","0"};
// Crossbow
CVAR_REGISTER ( &sk_plr_xbow_bolt_monster1 );// {"sk_plr_xbow_bolt1","0"};
CVAR_REGISTER ( &sk_plr_xbow_bolt_monster2 );// {"sk_plr_xbow_bolt2","0"};
CVAR_REGISTER ( &sk_plr_xbow_bolt_monster3 );// {"sk_plr_xbow_bolt3","0"};
CVAR_REGISTER ( &sk_plr_xbow_bolt_client1 );// {"sk_plr_xbow_bolt1","0"};
CVAR_REGISTER ( &sk_plr_xbow_bolt_client2 );// {"sk_plr_xbow_bolt2","0"};
CVAR_REGISTER ( &sk_plr_xbow_bolt_client3 );// {"sk_plr_xbow_bolt3","0"};
// RPG
CVAR_REGISTER ( &sk_plr_rpg1 );// {"sk_plr_rpg1","0"};
CVAR_REGISTER ( &sk_plr_rpg2 );// {"sk_plr_rpg2","0"};
CVAR_REGISTER ( &sk_plr_rpg3 );// {"sk_plr_rpg3","0"};
// Gauss Gun
CVAR_REGISTER ( &sk_plr_gauss1 );// {"sk_plr_gauss1","0"};
CVAR_REGISTER ( &sk_plr_gauss2 );// {"sk_plr_gauss2","0"};
CVAR_REGISTER ( &sk_plr_gauss3 );// {"sk_plr_gauss3","0"};
// Egon Gun
CVAR_REGISTER ( &sk_plr_egon_narrow1 );// {"sk_plr_egon_narrow1","0"};
CVAR_REGISTER ( &sk_plr_egon_narrow2 );// {"sk_plr_egon_narrow2","0"};
CVAR_REGISTER ( &sk_plr_egon_narrow3 );// {"sk_plr_egon_narrow3","0"};
CVAR_REGISTER ( &sk_plr_egon_wide1 );// {"sk_plr_egon_wide1","0"};
CVAR_REGISTER ( &sk_plr_egon_wide2 );// {"sk_plr_egon_wide2","0"};
CVAR_REGISTER ( &sk_plr_egon_wide3 );// {"sk_plr_egon_wide3","0"};
// Hand Grendade
CVAR_REGISTER ( &sk_plr_hand_grenade1 );// {"sk_plr_hand_grenade1","0"};
CVAR_REGISTER ( &sk_plr_hand_grenade2 );// {"sk_plr_hand_grenade2","0"};
CVAR_REGISTER ( &sk_plr_hand_grenade3 );// {"sk_plr_hand_grenade3","0"};
// Satchel Charge
CVAR_REGISTER ( &sk_plr_satchel1 );// {"sk_plr_satchel1","0"};
CVAR_REGISTER ( &sk_plr_satchel2 );// {"sk_plr_satchel2","0"};
CVAR_REGISTER ( &sk_plr_satchel3 );// {"sk_plr_satchel3","0"};
// Tripmine
CVAR_REGISTER ( &sk_plr_tripmine1 );// {"sk_plr_tripmine1","0"};
CVAR_REGISTER ( &sk_plr_tripmine2 );// {"sk_plr_tripmine2","0"};
CVAR_REGISTER ( &sk_plr_tripmine3 );// {"sk_plr_tripmine3","0"};
// WORLD WEAPONS
CVAR_REGISTER ( &sk_12mm_bullet1 );// {"sk_12mm_bullet1","0"};
CVAR_REGISTER ( &sk_12mm_bullet2 );// {"sk_12mm_bullet2","0"};
CVAR_REGISTER ( &sk_12mm_bullet3 );// {"sk_12mm_bullet3","0"};
CVAR_REGISTER ( &sk_9mmAR_bullet1 );// {"sk_9mm_bullet1","0"};
CVAR_REGISTER ( &sk_9mmAR_bullet2 );// {"sk_9mm_bullet1","0"};
CVAR_REGISTER ( &sk_9mmAR_bullet3 );// {"sk_9mm_bullet1","0"};
CVAR_REGISTER ( &sk_9mm_bullet1 );// {"sk_9mm_bullet1","0"};
CVAR_REGISTER ( &sk_9mm_bullet2 );// {"sk_9mm_bullet2","0"};
CVAR_REGISTER ( &sk_9mm_bullet3 );// {"sk_9mm_bullet3","0"};
// HORNET
CVAR_REGISTER ( &sk_hornet_dmg1 );// {"sk_hornet_dmg1","0"};
CVAR_REGISTER ( &sk_hornet_dmg2 );// {"sk_hornet_dmg2","0"};
CVAR_REGISTER ( &sk_hornet_dmg3 );// {"sk_hornet_dmg3","0"};
// HEALTH/SUIT CHARGE DISTRIBUTION
CVAR_REGISTER ( &sk_suitcharger1 );
CVAR_REGISTER ( &sk_suitcharger2 );
CVAR_REGISTER ( &sk_suitcharger3 );
CVAR_REGISTER ( &sk_battery1 );
CVAR_REGISTER ( &sk_battery2 );
CVAR_REGISTER ( &sk_battery3 );
CVAR_REGISTER ( &sk_healthcharger1 );
CVAR_REGISTER ( &sk_healthcharger2 );
CVAR_REGISTER ( &sk_healthcharger3 );
CVAR_REGISTER ( &sk_healthkit1 );
CVAR_REGISTER ( &sk_healthkit2 );
CVAR_REGISTER ( &sk_healthkit3 );
CVAR_REGISTER ( &sk_scientist_heal1 );
CVAR_REGISTER ( &sk_scientist_heal2 );
CVAR_REGISTER ( &sk_scientist_heal3 );
// monster damage adjusters
CVAR_REGISTER ( &sk_monster_head1 );
CVAR_REGISTER ( &sk_monster_head2 );
CVAR_REGISTER ( &sk_monster_head3 );
CVAR_REGISTER ( &sk_monster_chest1 );
CVAR_REGISTER ( &sk_monster_chest2 );
CVAR_REGISTER ( &sk_monster_chest3 );
CVAR_REGISTER ( &sk_monster_stomach1 );
CVAR_REGISTER ( &sk_monster_stomach2 );
CVAR_REGISTER ( &sk_monster_stomach3 );
CVAR_REGISTER ( &sk_monster_arm1 );
CVAR_REGISTER ( &sk_monster_arm2 );
CVAR_REGISTER ( &sk_monster_arm3 );
CVAR_REGISTER ( &sk_monster_leg1 );
CVAR_REGISTER ( &sk_monster_leg2 );
CVAR_REGISTER ( &sk_monster_leg3 );
// player damage adjusters
CVAR_REGISTER ( &sk_player_head1 );
CVAR_REGISTER ( &sk_player_head2 );
CVAR_REGISTER ( &sk_player_head3 );
CVAR_REGISTER ( &sk_player_chest1 );
CVAR_REGISTER ( &sk_player_chest2 );
CVAR_REGISTER ( &sk_player_chest3 );
CVAR_REGISTER ( &sk_player_stomach1 );
CVAR_REGISTER ( &sk_player_stomach2 );
CVAR_REGISTER ( &sk_player_stomach3 );
CVAR_REGISTER ( &sk_player_arm1 );
CVAR_REGISTER ( &sk_player_arm2 );
CVAR_REGISTER ( &sk_player_arm3 );
CVAR_REGISTER ( &sk_player_leg1 );
CVAR_REGISTER ( &sk_player_leg2 );
CVAR_REGISTER ( &sk_player_leg3 );
// END REGISTER CVARS FOR SKILL LEVEL STUFF
SERVER_COMMAND( "exec skill.cfg\n" );

View file

@ -18,28 +18,30 @@
extern void GameDLLInit( void );
extern cvar_t displaysoundlist;
// multiplayer server rules
extern cvar_t teamplay;
extern cvar_t gametype;
extern cvar_t fraglimit;
extern cvar_t roundtimelimit;
extern cvar_t timelimit;
extern cvar_t friendlyfire;
extern cvar_t falldamage;
extern cvar_t weaponstay;
extern cvar_t forcerespawn;
extern cvar_t flashlight;
extern cvar_t aimcrosshair;
extern cvar_t decalfrequency;
extern cvar_t teamlist;
extern cvar_t teamoverride;
extern cvar_t defaultteam;
extern cvar_t allowmonsters;
extern cvar_t maxlives;
extern cvar_t allowsidearms;
extern cvar_t allowsecondary;
extern cvar_t allowunique;
extern cvar_t allowexplosives;
// Engine Cvars
extern cvar_t *g_psv_gravity;
extern cvar_t *g_psv_aim;
extern cvar_t *g_footsteps;
#endif // GAME_H

1938
dlls/game_deathmatch.cpp Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,253 @@
/***
*
* 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.
*
***/
//
// lastmanstanding_gamerules.cpp
//
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "shake.h"
#include "player.h"
#include "weapons.h"
#include "gamerules.h"
#include "game.h"
#include "items.h"
#include "voice_gamemgr.h"
#include "thewastes.h"
extern int gmsgScoreInfo;
extern int gmsgLmsStart;
extern void respawn(entvars_t *pev, BOOL fCopyCorpse);
extern DLL_GLOBAL BOOL g_fGameOver;
#define RESTART_TIME_LONG 10.0f
#define RESTART_TIME_SHORT 5.0f
#define DELAY_TIME 5.0f
enum lms_state_e {
RS_CHECKING,
RS_BEGIN_MATCH,
RS_MATCH_IN_PROGRESS,
RS_END_MATCH,
};
CWastesLMS::CWastesLMS() : CHalfLifeMultiplay()
{
m_bRoundInProgress = FALSE;
m_iRoundState = RS_CHECKING;
m_flNextStateCheck = gpGlobals->time + 30.0f;
m_flRoundDelay = 0.0f;
// Validate cvars
if( CVAR_GET_FLOAT( "mp_lives" ) < 1.0f )
CVAR_SET_FLOAT( "mp_lives", 1.0f );
}
void CWastesLMS::Think()
{
CHalfLifeMultiplay::Think();
if( g_fGameOver )
return;
switch( m_iRoundState )
{
case RS_CHECKING:
break;
case RS_BEGIN_MATCH:
break;
case RS_MATCH_IN_PROGRESS:
break;
case RS_END_MATCH:
break;
}
/* // Round Delay Timer
if(m_flRoundDelay && gpGlobals->time >= m_flRoundDelay)
m_flRoundDelay = 0.0f;
// Round is over; do not run code if game is doing a restart round check
// Do not run if no round is in progress.
#if 0
if(m_bRoundInProgress && m_flRoundTimeLimit && !m_flNextStateCheck && gpGlobals->time >= m_flRoundTimeLimit)
{
UTIL_SayText("ROUND IS OVER O NO",UTIL_FindEntityByClassname(NULL,"player"));
m_flRoundTimeLimit = 0.0;
StartRound();
}
#endif
// Game Timer, check it
if(m_flNextStateCheck && gpGlobals->time >= m_flNextStateCheck)
{
m_flNextStateCheck = gpGlobals->time + RESTART_TIME_SHORT;
// Round in progress
if(m_bRoundInProgress)
{
int iPlayersLeft = GetActivePlayers();
// Should round be over?
if(iPlayersLeft < 2)
{
// Go through active players list, find the one left alive.
if(iPlayersLeft)
{
for(int i = 1;i <= gpGlobals->maxClients;i++)
{
CBasePlayer *pPlayer = (CBasePlayer*)UTIL_PlayerByIndex(i);
if(pPlayer != NULL && pPlayer->IsAlive())
{
pPlayer->pev->frags += pPlayer->m_iTempFrags;
pPlayer->m_iTempFrags = 0;
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
WRITE_BYTE( ENTINDEX(pPlayer->edict()) );
WRITE_SHORT( pPlayer->pev->frags );
WRITE_SHORT( pPlayer->m_iDeaths );
WRITE_SHORT( 0 );
WRITE_SHORT( GetTeamIndex( pPlayer->m_szTeamName ) + 1 );
MESSAGE_END();
break;
}
}
UTIL_SayTextAll("ROUND OVER, HERE IS YOUR MONEY KTHX",UTIL_FindEntityByClassname(NULL,"player"));
}
else
UTIL_SayTextAll("NO ONE ALIVE WTS",UTIL_FindEntityByClassname(NULL,"observer"));
StartRound();
}
}
else if( GetActivePlayers() > 1 )
StartRound();
}
CHalfLifeMultiplay::Think();*/
}
BOOL CWastesLMS::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker )
{
if(gpGlobals->time >= m_flRoundDelay && m_bRoundInProgress)
return CHalfLifeMultiplay::FPlayerCanTakeDamage(pPlayer,pAttacker);
return FALSE;
}
void CWastesLMS::PlayerSpawn(CBasePlayer *pPlayer)
{
if(!ShouldSpectate())
{
CHalfLifeMultiplay::PlayerSpawn(pPlayer);
}
else
{
pPlayer->pev->health = 0;
pPlayer->StartObserver(pPlayer->pev->origin,Vector(0,0,0));
}
}
void CWastesLMS::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor)
{
if(m_bRoundInProgress)
{
CHalfLifeMultiplay::PlayerKilled(pVictim,pKiller,pInflictor);
}
}
BOOL CWastesLMS::ShouldSpectate()
{
if(m_bRoundInProgress)
return TRUE;
return FALSE;
}
void CWastesLMS::EndMultiplayerGame()
{
// Quit
m_bRoundInProgress = FALSE;
m_iRoundState = RS_CHECKING;
m_flNextStateCheck = 0.0;
CHalfLifeMultiplay::EndMultiplayerGame();
}
int CWastesLMS::GetActivePlayers()
{
int iRet = 0;
for(int i = 1;i <= gpGlobals->maxClients;i++)
{
CBasePlayer *pPlayer = (CBasePlayer*)UTIL_PlayerByIndex(i);
if(pPlayer == NULL )
continue;
if(pPlayer->IsAlive())
iRet++;
}
// char szText[1024];
// sprintf( szText, "Active Players: %i", iRet );
// UTIL_SayTextAll( szText, UTIL_FindEntityByClassname( NULL, "player" ) );
return iRet;
}
void CWastesLMS::StartRound()
{
int lives = (int)CVAR_GET_FLOAT( "mp_lives" );
ClearLevel();
for( int i = 1;i <= gpGlobals->maxClients;i++ )
{
CBaseEntity *pEnt = UTIL_PlayerByIndex( i );
if( pEnt == NULL )
continue;
if( pEnt->IsPlayer() )
{
CBasePlayer *pPlayer = (CBasePlayer*)pEnt;
pPlayer->m_iLivesLeft = lives;
}
}
#if 0
m_bRoundInProgress = FALSE;
ClearLevel();
// Go through each player, let them respawn,
// And start the round! :D
for(int i = 1;i <= gpGlobals->maxClients;i++)
{
CBasePlayer *pEnt = (CBasePlayer*)UTIL_PlayerByIndex(i);
if(pEnt == NULL || !pEnt->IsPlayer() || !pEnt->pev->netname)
continue;
pEnt->RemoveAllItems();
respawn(pEnt->pev,FALSE);
}
m_flRoundDelay = gpGlobals->time + DELAY_TIME; // 3 seconds after round starts we can start inflicting pain on our enemies
m_bRoundInProgress = TRUE;
MESSAGE_BEGIN( MSG_ALL, gmsgLmsStart );
WRITE_COORD( DELAY_TIME );
MESSAGE_END();
#endif
}

327
dlls/game_singleplay.cpp Normal file
View file

@ -0,0 +1,327 @@
/***
*
* 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.
*
****/
//
// singleplay_gamerules.cpp
//
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "player.h"
#include "weapons.h"
#include "gamerules.h"
#include "items.h"
#include "thewastes.h"
extern DLL_GLOBAL CGameRules *g_pGameRules;
extern DLL_GLOBAL BOOL g_fGameOver;
extern int gmsgDeathMsg; // client dll messages
extern int gmsgScoreInfo;
extern int gmsgMOTD;
//=========================================================
//=========================================================
CHalfLifeRules::CHalfLifeRules( void )
{
RefreshSkillData();
}
//=========================================================
//=========================================================
void CHalfLifeRules::Think ( void )
{
}
//=========================================================
//=========================================================
BOOL CHalfLifeRules::IsMultiplayer( void )
{
return FALSE;
}
//=========================================================
//=========================================================
BOOL CHalfLifeRules::IsDeathmatch ( void )
{
return FALSE;
}
//=========================================================
//=========================================================
BOOL CHalfLifeRules::IsCoOp( void )
{
return FALSE;
}
//=========================================================
//=========================================================
BOOL CHalfLifeRules::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon )
{
if ( !pPlayer->m_pActiveItem )
{
// player doesn't have an active item!
return TRUE;
}
if ( !pPlayer->m_pActiveItem->CanHolster() )
{
return FALSE;
}
return TRUE;
}
//=========================================================
//=========================================================
BOOL CHalfLifeRules :: GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon )
{
return FALSE;
}
//=========================================================
//=========================================================
BOOL CHalfLifeRules :: ClientConnected( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] )
{
return TRUE;
}
void CHalfLifeRules :: InitHUD( CBasePlayer *pl )
{
}
//=========================================================
//=========================================================
void CHalfLifeRules :: ClientDisconnected( edict_t *pClient )
{
}
//=========================================================
//=========================================================
float CHalfLifeRules::FlPlayerFallDamage( CBasePlayer *pPlayer )
{
// subtract off the speed at which a player is allowed to fall without being hurt,
// so damage will be based on speed beyond that, not the entire fall
pPlayer->m_flFallVelocity -= PLAYER_MAX_SAFE_FALL_SPEED;
return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED;
}
//=========================================================
//=========================================================
void CHalfLifeRules :: PlayerSpawn( CBasePlayer *pPlayer )
{
}
//=========================================================
//=========================================================
BOOL CHalfLifeRules :: AllowAutoTargetCrosshair( void )
{
return 0;
}
//=========================================================
//=========================================================
void CHalfLifeRules :: PlayerThink( CBasePlayer *pPlayer )
{
}
//=========================================================
//=========================================================
BOOL CHalfLifeRules :: FPlayerCanRespawn( CBasePlayer *pPlayer )
{
return TRUE;
}
//=========================================================
//=========================================================
float CHalfLifeRules :: FlPlayerSpawnTime( CBasePlayer *pPlayer )
{
return gpGlobals->time;//now!
}
//=========================================================
// IPointsForKill - how many points awarded to anyone
// that kills this player?
//=========================================================
int CHalfLifeRules :: IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled )
{
return 1;
}
//=========================================================
// PlayerKilled - someone/something killed this player
//=========================================================
void CHalfLifeRules :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
{
}
//=========================================================
// Deathnotice
//=========================================================
void CHalfLifeRules::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
{
}
//=========================================================
// PlayerGotWeapon - player has grabbed a weapon that was
// sitting in the world
//=========================================================
void CHalfLifeRules :: PlayerGotWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon )
{
}
//=========================================================
// FlWeaponRespawnTime - what is the time in the future
// at which this weapon may spawn?
//=========================================================
float CHalfLifeRules :: FlWeaponRespawnTime( CBasePlayerItem *pWeapon )
{
return -1;
}
//=========================================================
// FlWeaponRespawnTime - Returns 0 if the weapon can respawn
// now, otherwise it returns the time at which it can try
// to spawn again.
//=========================================================
float CHalfLifeRules :: FlWeaponTryRespawn( CBasePlayerItem *pWeapon )
{
return 0;
}
//=========================================================
// VecWeaponRespawnSpot - where should this weapon spawn?
// Some game variations may choose to randomize spawn locations
//=========================================================
Vector CHalfLifeRules :: VecWeaponRespawnSpot( CBasePlayerItem *pWeapon )
{
return pWeapon->pev->origin;
}
//=========================================================
// WeaponShouldRespawn - any conditions inhibiting the
// respawning of this weapon?
//=========================================================
int CHalfLifeRules :: WeaponShouldRespawn( CBasePlayerItem *pWeapon )
{
return GR_WEAPON_RESPAWN_NO;
}
//=========================================================
//=========================================================
BOOL CHalfLifeRules::CanHaveItem( CBasePlayer *pPlayer, CItem *pItem )
{
return TRUE;
}
//=========================================================
//=========================================================
void CHalfLifeRules::PlayerGotItem( CBasePlayer *pPlayer, CItem *pItem )
{
}
//=========================================================
//=========================================================
int CHalfLifeRules::ItemShouldRespawn( CItem *pItem )
{
return GR_ITEM_RESPAWN_NO;
}
//=========================================================
// At what time in the future may this Item respawn?
//=========================================================
float CHalfLifeRules::FlItemRespawnTime( CItem *pItem )
{
return -1;
}
//=========================================================
// Where should this item respawn?
// Some game variations may choose to randomize spawn locations
//=========================================================
Vector CHalfLifeRules::VecItemRespawnSpot( CItem *pItem )
{
return pItem->pev->origin;
}
//=========================================================
//=========================================================
BOOL CHalfLifeRules::IsAllowedToSpawn( CBaseEntity *pEntity )
{
return TRUE;
}
//=========================================================
//=========================================================
void CHalfLifeRules::PlayerGotAmmo( CBasePlayer *pPlayer, char *szName, int iCount )
{
}
//=========================================================
//=========================================================
int CHalfLifeRules::AmmoShouldRespawn( CBasePlayerAmmo *pAmmo )
{
return GR_AMMO_RESPAWN_NO;
}
//=========================================================
//=========================================================
float CHalfLifeRules::FlAmmoRespawnTime( CBasePlayerAmmo *pAmmo )
{
return -1;
}
//=========================================================
//=========================================================
Vector CHalfLifeRules::VecAmmoRespawnSpot( CBasePlayerAmmo *pAmmo )
{
return pAmmo->pev->origin;
}
//=========================================================
//=========================================================
float CHalfLifeRules::FlHealthChargerRechargeTime( void )
{
return 0;// don't recharge
}
//=========================================================
//=========================================================
int CHalfLifeRules::DeadPlayerWeapons( CBasePlayer *pPlayer )
{
return GR_PLR_DROP_GUN_NO;
}
//=========================================================
//=========================================================
int CHalfLifeRules::DeadPlayerAmmo( CBasePlayer *pPlayer )
{
return GR_PLR_DROP_AMMO_NO;
}
//=========================================================
//=========================================================
int CHalfLifeRules::PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget )
{
// why would a single player in half life need this?
return GR_NOTTEAMMATE;
}
BOOL CHalfLifeRules :: FAllowMonsters( void )
{
return TRUE;
}

657
dlls/game_teamplay.cpp Normal file
View file

@ -0,0 +1,657 @@
/***
*
* 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.
*
****/
//
// teamplay_gamerules.cpp
//
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "player.h"
#include "weapons.h"
#include "gamerules.h"
#include "teamplay_gamerules.h"
#include "game.h"
#include "thewastes.h"
static char team_names[MAX_TEAMS][MAX_TEAMNAME_LENGTH];
static int team_scores[MAX_TEAMS];
static int num_teams = 0;
extern DLL_GLOBAL BOOL g_fGameOver;
CHalfLifeTeamplay :: CHalfLifeTeamplay()
{
m_DisableDeathMessages = FALSE;
m_DisableDeathPenalty = FALSE;
memset( team_names, 0, sizeof(team_names) );
memset( team_scores, 0, sizeof(team_scores) );
num_teams = 0;
// Copy over the team from the server config
m_szTeamList[0] = 0;
// Cache this because the team code doesn't want to deal with changing this in the middle of a game
strncpy( m_szTeamList, teamlist.string, TEAMPLAY_TEAMLISTLENGTH );
edict_t *pWorld = INDEXENT(0);
if ( pWorld && pWorld->v.team )
{
if ( teamoverride.value )
{
const char *pTeamList = STRING(pWorld->v.team);
if ( pTeamList && strlen(pTeamList) )
{
strncpy( m_szTeamList, pTeamList, TEAMPLAY_TEAMLISTLENGTH );
}
}
}
// Has the server set teams
if ( strlen( m_szTeamList ) )
m_teamLimit = TRUE;
else
m_teamLimit = FALSE;
RecountTeams();
}
extern cvar_t timeleft, fragsleft;
#include "voice_gamemgr.h"
extern CVoiceGameMgr g_VoiceGameMgr;
void CHalfLifeTeamplay :: Think ( void )
{
///// Check game rules /////
static int last_frags;
static int last_time;
int frags_remaining = 0;
int time_remaining = 0;
g_VoiceGameMgr.Update(gpGlobals->frametime);
if ( g_fGameOver ) // someone else quit the game already
{
CHalfLifeMultiplay::Think();
return;
}
float flTimeLimit = CVAR_GET_FLOAT("mp_timelimit") * 60;
time_remaining = (int)(flTimeLimit ? ( flTimeLimit - gpGlobals->time ) : 0);
if ( flTimeLimit != 0 && gpGlobals->time >= flTimeLimit )
{
GoToIntermission();
return;
}
float flFragLimit = fraglimit.value;
if ( flFragLimit )
{
int bestfrags = 9999;
int remain;
// check if any team is over the frag limit
for ( int i = 0; i < num_teams; i++ )
{
if ( team_scores[i] >= flFragLimit )
{
GoToIntermission();
return;
}
remain = flFragLimit - team_scores[i];
if ( remain < bestfrags )
{
bestfrags = remain;
}
}
frags_remaining = bestfrags;
}
// Updates when frags change
if ( frags_remaining != last_frags )
{
g_engfuncs.pfnCvar_DirectSet( &fragsleft, UTIL_VarArgs( "%i", frags_remaining ) );
}
// Updates once per second
if ( timeleft.value != last_time )
{
g_engfuncs.pfnCvar_DirectSet( &timeleft, UTIL_VarArgs( "%i", time_remaining ) );
}
last_frags = frags_remaining;
last_time = time_remaining;
}
//=========================================================
// ClientCommand
// the user has typed a command which is unrecognized by everything else;
// this check to see if the gamerules knows anything about the command
//=========================================================
BOOL CHalfLifeTeamplay :: ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
{
if(g_VoiceGameMgr.ClientCommand(pPlayer, pcmd))
return TRUE;
if ( FStrEq( pcmd, "menuselect" ) )
{
if ( CMD_ARGC() < 2 )
return TRUE;
int slot = atoi( CMD_ARGV(1) );
// select the item from the current menu
return TRUE;
}
return FALSE;
}
extern int gmsgGameMode;
extern int gmsgSayText;
extern int gmsgTeamInfo;
extern int gmsgTeamNames;
extern int gmsgScoreInfo;
void CHalfLifeTeamplay :: UpdateGameMode( CBasePlayer *pPlayer )
{
MESSAGE_BEGIN( MSG_ONE, gmsgGameMode, NULL, pPlayer->edict() );
WRITE_BYTE( 2 ); // game mode teamplay
MESSAGE_END();
}
const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer )
{
// copy out the team name from the model
char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" );
strncpy( pPlayer->m_szTeamName, mdls, TEAM_NAME_LENGTH );
RecountTeams();
// update the current player of the team he is joining
if ( pPlayer->m_szTeamName[0] == '\0' || !IsValidTeam( pPlayer->m_szTeamName ) || defaultteam.value )
{
const char *pTeamName = NULL;
if ( defaultteam.value )
{
pTeamName = team_names[0];
}
else
{
pTeamName = TeamWithFewestPlayers();
}
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH );
}
return pPlayer->m_szTeamName;
}
//=========================================================
// InitHUD
//=========================================================
void CHalfLifeTeamplay::InitHUD( CBasePlayer *pPlayer )
{
int i;
SetDefaultPlayerTeam( pPlayer );
CHalfLifeMultiplay::InitHUD( pPlayer );
// Send down the team names
MESSAGE_BEGIN( MSG_ONE, gmsgTeamNames, NULL, pPlayer->edict() );
WRITE_BYTE( num_teams );
for ( i = 0; i < num_teams; i++ )
{
WRITE_STRING( team_names[ i ] );
}
MESSAGE_END();
RecountTeams();
char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" );
// update the current player of the team he is joining
char text[1024];
if ( !strcmp( mdls, pPlayer->m_szTeamName ) )
{
sprintf( text, "* you are on team \'%s\'\n", pPlayer->m_szTeamName );
}
else
{
sprintf( text, "* assigned to team %s\n", pPlayer->m_szTeamName );
}
ChangePlayerTeam( pPlayer, pPlayer->m_szTeamName, FALSE, FALSE );
UTIL_SayText( text, pPlayer );
int clientIndex = pPlayer->entindex();
RecountTeams();
// update this player with all the other players team info
// loop through all active players and send their team info to the new client
for ( i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseEntity *plr = UTIL_PlayerByIndex( i );
if ( plr && IsValidTeam( plr->TeamID() ) )
{
MESSAGE_BEGIN( MSG_ONE, gmsgTeamInfo, NULL, pPlayer->edict() );
WRITE_BYTE( plr->entindex() );
WRITE_STRING( plr->TeamID() );
MESSAGE_END();
}
}
}
void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib )
{
int damageFlags = DMG_GENERIC;
int clientIndex = pPlayer->entindex();
if ( !bGib )
{
damageFlags |= DMG_NEVERGIB;
}
else
{
damageFlags |= DMG_ALWAYSGIB;
}
if ( bKill )
{
// kill the player, remove a death, and let them start on the new team
m_DisableDeathMessages = TRUE;
m_DisableDeathPenalty = TRUE;
entvars_t *pevWorld = VARS( INDEXENT(0) );
pPlayer->TakeDamage( pevWorld, pevWorld, 900, damageFlags );
m_DisableDeathMessages = FALSE;
m_DisableDeathPenalty = FALSE;
}
// copy out the team name from the model
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH );
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName );
// notify everyone's HUD of the team change
MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo );
WRITE_BYTE( clientIndex );
WRITE_STRING( pPlayer->m_szTeamName );
MESSAGE_END();
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
WRITE_BYTE( clientIndex );
WRITE_SHORT( pPlayer->pev->frags );
WRITE_SHORT( pPlayer->m_iDeaths );
WRITE_SHORT( 0 );
WRITE_SHORT( g_pGameRules->GetTeamIndex( pPlayer->m_szTeamName ) + 1 );
MESSAGE_END();
}
//=========================================================
// ClientUserInfoChanged
//=========================================================
void CHalfLifeTeamplay::ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer )
{
char text[1024];
// prevent skin/color/model changes
char *mdls = g_engfuncs.pfnInfoKeyValue( infobuffer, "model" );
if ( !stricmp( mdls, pPlayer->m_szTeamName ) )
return;
if ( defaultteam.value )
{
int clientIndex = pPlayer->entindex();
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName );
sprintf( text, "* Not allowed to change teams in this game!\n" );
UTIL_SayText( text, pPlayer );
return;
}
if ( defaultteam.value || !IsValidTeam( mdls ) )
{
int clientIndex = pPlayer->entindex();
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
sprintf( text, "* Can't change team to \'%s\'\n", mdls );
UTIL_SayText( text, pPlayer );
sprintf( text, "* Server limits teams to \'%s\'\n", m_szTeamList );
UTIL_SayText( text, pPlayer );
return;
}
// notify everyone of the team change
sprintf( text, "* %s has changed to team \'%s\'\n", STRING(pPlayer->pev->netname), mdls );
UTIL_SayTextAll( text, pPlayer );
UTIL_LogPrintf( "\"%s<%i><%u><%s>\" joined team \"%s\"\n",
STRING(pPlayer->pev->netname),
GETPLAYERUSERID( pPlayer->edict() ),
GETPLAYERWONID( pPlayer->edict() ),
pPlayer->m_szTeamName,
mdls );
ChangePlayerTeam( pPlayer, mdls, TRUE, TRUE );
// recound stuff
RecountTeams( TRUE );
}
extern int gmsgDeathMsg;
//=========================================================
// Deathnotice.
//=========================================================
void CHalfLifeTeamplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor)
{
if ( m_DisableDeathMessages )
return;
if ( pVictim && pKiller && pKiller->flags & FL_CLIENT )
{
CBasePlayer *pk = (CBasePlayer*) CBaseEntity::Instance( pKiller );
CWasteWeapon *pWeapon = (CWasteWeapon*)pk->m_pActiveItem;
if ( pk )
{
if ( (pk != pVictim) && (PlayerRelationship( pVictim, pk ) == GR_TEAMMATE) )
{
MESSAGE_BEGIN( MSG_ALL, gmsgDeathMsg );
WRITE_BYTE( ENTINDEX(ENT(pKiller)) ); // the killer
WRITE_BYTE( ENTINDEX(pVictim->edict()) ); // the victim
WRITE_BYTE( pVictim->pev->vuser2.y ); // head shot ?
WRITE_STRING( "teammate" ); // flag this as a teammate kill
if(pk != NULL)
{
if(pVictim->pev->vuser2.y == 2)
{
char szBledString[128];
switch(RANDOM_LONG(0,1))
{
case 0:
strcpy(szBledString,"%s bled %s, real slow");
break;
case 1:
strcpy(szBledString,"%s opened up %s like a leaky faucet");
break;
}
WRITE_STRING( szBledString );
}
else if(pk->HasWeapons() && pWeapon != NULL)
WRITE_STRING( pWeapon->szGetDeathNoticeString() );
else
WRITE_STRING( "%s killed %s with... nothing :(" );
}
MESSAGE_END();
return;
}
}
}
CHalfLifeMultiplay::DeathNotice( pVictim, pKiller, pevInflictor );
}
//=========================================================
//=========================================================
void CHalfLifeTeamplay :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor)
{
if ( !m_DisableDeathPenalty )
{
CHalfLifeMultiplay::PlayerKilled( pVictim, pKiller, pInflictor);
RecountTeams();
}
}
//=========================================================
// IsTeamplay
//=========================================================
BOOL CHalfLifeTeamplay::IsTeamplay( void )
{
return TRUE;
}
BOOL CHalfLifeTeamplay::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker )
{
if ( pAttacker && PlayerRelationship( pPlayer, pAttacker ) == GR_TEAMMATE )
{
// my teammate hit me.
if ( (friendlyfire.value == 0) && (pAttacker != pPlayer) )
{
// friendly fire is off, and this hit came from someone other than myself, then don't get hurt
return FALSE;
}
}
return CHalfLifeMultiplay::FPlayerCanTakeDamage( pPlayer, pAttacker );
}
//=========================================================
//=========================================================
int CHalfLifeTeamplay::PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget )
{
// half life multiplay has a simple concept of Player Relationships.
// you are either on another player's team, or you are not.
if ( !pPlayer || !pTarget || !pTarget->IsPlayer() )
return GR_NOTTEAMMATE;
if ( (*GetTeamID(pPlayer) != '\0') && (*GetTeamID(pTarget) != '\0') && !stricmp( GetTeamID(pPlayer), GetTeamID(pTarget) ) )
{
return GR_TEAMMATE;
}
return GR_NOTTEAMMATE;
}
//=========================================================
//=========================================================
BOOL CHalfLifeTeamplay::ShouldAutoAim( CBasePlayer *pPlayer, edict_t *target )
{
// always autoaim, unless target is a teammate
CBaseEntity *pTgt = CBaseEntity::Instance( target );
if ( pTgt && pTgt->IsPlayer() )
{
if ( PlayerRelationship( pPlayer, pTgt ) == GR_TEAMMATE )
return FALSE; // don't autoaim at teammates
}
return CHalfLifeMultiplay::ShouldAutoAim( pPlayer, target );
}
//=========================================================
//=========================================================
int CHalfLifeTeamplay::IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled )
{
if ( !pKilled )
return 0;
if ( !pAttacker )
return 1;
if ( pAttacker != pKilled && PlayerRelationship( pAttacker, pKilled ) == GR_TEAMMATE )
return -1;
return 1;
}
//=========================================================
//=========================================================
const char *CHalfLifeTeamplay::GetTeamID( CBaseEntity *pEntity )
{
if ( pEntity == NULL || pEntity->pev == NULL )
return "";
// return their team name
return pEntity->TeamID();
}
int CHalfLifeTeamplay::GetTeamIndex( const char *pTeamName )
{
if ( pTeamName && *pTeamName != 0 )
{
// try to find existing team
for ( int tm = 0; tm < num_teams; tm++ )
{
if ( !stricmp( team_names[tm], pTeamName ) )
return tm;
}
}
return -1; // No match
}
const char *CHalfLifeTeamplay::GetIndexedTeamName( int teamIndex )
{
if ( teamIndex < 0 || teamIndex >= num_teams )
return "";
return team_names[ teamIndex ];
}
BOOL CHalfLifeTeamplay::IsValidTeam( const char *pTeamName )
{
if ( !m_teamLimit ) // Any team is valid if the teamlist isn't set
return TRUE;
return ( GetTeamIndex( pTeamName ) != -1 ) ? TRUE : FALSE;
}
const char *CHalfLifeTeamplay::TeamWithFewestPlayers( void )
{
int i;
int minPlayers = MAX_TEAMS;
int teamCount[ MAX_TEAMS ];
char *pTeamName = NULL;
memset( teamCount, 0, MAX_TEAMS * sizeof(int) );
// loop through all clients, count number of players on each team
for ( i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseEntity *plr = UTIL_PlayerByIndex( i );
if ( plr )
{
int team = GetTeamIndex( plr->TeamID() );
if ( team >= 0 )
teamCount[team] ++;
}
}
// Find team with least players
for ( i = 0; i < num_teams; i++ )
{
if ( teamCount[i] < minPlayers )
{
minPlayers = teamCount[i];
pTeamName = team_names[i];
}
}
return pTeamName;
}
//=========================================================
//=========================================================
void CHalfLifeTeamplay::RecountTeams( bool bResendInfo )
{
char *pName;
char teamlist[TEAMPLAY_TEAMLISTLENGTH];
// loop through all teams, recounting everything
num_teams = 0;
// Copy all of the teams from the teamlist
// make a copy because strtok is destructive
strcpy( teamlist, m_szTeamList );
pName = teamlist;
pName = strtok( pName, ";" );
while ( pName != NULL && *pName )
{
if ( GetTeamIndex( pName ) < 0 )
{
strcpy( team_names[num_teams], pName );
num_teams++;
}
pName = strtok( NULL, ";" );
}
if ( num_teams < 2 )
{
num_teams = 0;
m_teamLimit = FALSE;
}
// Sanity check
memset( team_scores, 0, sizeof(team_scores) );
// loop through all clients
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseEntity *plr = UTIL_PlayerByIndex( i );
if ( plr )
{
const char *pTeamName = plr->TeamID();
// try add to existing team
int tm = GetTeamIndex( pTeamName );
if ( tm < 0 ) // no team match found
{
if ( !m_teamLimit )
{
// add to new team
tm = num_teams;
num_teams++;
team_scores[tm] = 0;
strncpy( team_names[tm], pTeamName, MAX_TEAMNAME_LENGTH );
}
}
if ( tm >= 0 )
{
team_scores[tm] += plr->pev->frags;
}
if ( bResendInfo ) //Someone's info changed, let's send the team info again.
{
if ( plr && IsValidTeam( plr->TeamID() ) )
{
MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo, NULL );
WRITE_BYTE( plr->entindex() );
WRITE_STRING( plr->TeamID() );
MESSAGE_END();
}
}
}
}
}

View file

@ -23,8 +23,8 @@
#include "weapons.h"
#include "gamerules.h"
#include "teamplay_gamerules.h"
#include "skill.h"
#include "game.h"
#include "pm_shared.h"
extern edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer );
@ -33,7 +33,7 @@ extern DLL_GLOBAL BOOL g_fGameOver;
extern int gmsgDeathMsg; // client dll messages
extern int gmsgMOTD;
int g_teamplay = 0;
int g_gametype = 0;
//=========================================================
//=========================================================
@ -112,196 +112,6 @@ BOOL CGameRules::CanHavePlayerItem( CBasePlayer *pPlayer, CBasePlayerItem *pWeap
//=========================================================
void CGameRules::RefreshSkillData ( void )
{
int iSkill;
iSkill = (int)CVAR_GET_FLOAT("skill");
g_iSkillLevel = iSkill;
if ( iSkill < 1 )
{
iSkill = 1;
}
else if ( iSkill > 3 )
{
iSkill = 3;
}
gSkillData.iSkillLevel = iSkill;
ALERT ( at_console, "\nGAME SKILL LEVEL:%d\n",iSkill );
//Agrunt
gSkillData.agruntHealth = GetSkillCvar( "sk_agrunt_health" );
gSkillData.agruntDmgPunch = GetSkillCvar( "sk_agrunt_dmg_punch");
// Apache
gSkillData.apacheHealth = GetSkillCvar( "sk_apache_health");
// Barney
gSkillData.barneyHealth = GetSkillCvar( "sk_barney_health");
// Big Momma
gSkillData.bigmommaHealthFactor = GetSkillCvar( "sk_bigmomma_health_factor" );
gSkillData.bigmommaDmgSlash = GetSkillCvar( "sk_bigmomma_dmg_slash" );
gSkillData.bigmommaDmgBlast = GetSkillCvar( "sk_bigmomma_dmg_blast" );
gSkillData.bigmommaRadiusBlast = GetSkillCvar( "sk_bigmomma_radius_blast" );
// Bullsquid
gSkillData.bullsquidHealth = GetSkillCvar( "sk_bullsquid_health");
gSkillData.bullsquidDmgBite = GetSkillCvar( "sk_bullsquid_dmg_bite");
gSkillData.bullsquidDmgWhip = GetSkillCvar( "sk_bullsquid_dmg_whip");
gSkillData.bullsquidDmgSpit = GetSkillCvar( "sk_bullsquid_dmg_spit");
// Gargantua
gSkillData.gargantuaHealth = GetSkillCvar( "sk_gargantua_health");
gSkillData.gargantuaDmgSlash = GetSkillCvar( "sk_gargantua_dmg_slash");
gSkillData.gargantuaDmgFire = GetSkillCvar( "sk_gargantua_dmg_fire");
gSkillData.gargantuaDmgStomp = GetSkillCvar( "sk_gargantua_dmg_stomp");
// Hassassin
gSkillData.hassassinHealth = GetSkillCvar( "sk_hassassin_health");
// Headcrab
gSkillData.headcrabHealth = GetSkillCvar( "sk_headcrab_health");
gSkillData.headcrabDmgBite = GetSkillCvar( "sk_headcrab_dmg_bite");
// Hgrunt
gSkillData.hgruntHealth = GetSkillCvar( "sk_hgrunt_health");
gSkillData.hgruntDmgKick = GetSkillCvar( "sk_hgrunt_kick");
gSkillData.hgruntShotgunPellets = GetSkillCvar( "sk_hgrunt_pellets");
gSkillData.hgruntGrenadeSpeed = GetSkillCvar( "sk_hgrunt_gspeed");
// Houndeye
gSkillData.houndeyeHealth = GetSkillCvar( "sk_houndeye_health");
gSkillData.houndeyeDmgBlast = GetSkillCvar( "sk_houndeye_dmg_blast");
// ISlave
gSkillData.slaveHealth = GetSkillCvar( "sk_islave_health");
gSkillData.slaveDmgClaw = GetSkillCvar( "sk_islave_dmg_claw");
gSkillData.slaveDmgClawrake = GetSkillCvar( "sk_islave_dmg_clawrake");
gSkillData.slaveDmgZap = GetSkillCvar( "sk_islave_dmg_zap");
// Icthyosaur
gSkillData.ichthyosaurHealth = GetSkillCvar( "sk_ichthyosaur_health");
gSkillData.ichthyosaurDmgShake = GetSkillCvar( "sk_ichthyosaur_shake");
// Leech
gSkillData.leechHealth = GetSkillCvar( "sk_leech_health");
gSkillData.leechDmgBite = GetSkillCvar( "sk_leech_dmg_bite");
// Controller
gSkillData.controllerHealth = GetSkillCvar( "sk_controller_health");
gSkillData.controllerDmgZap = GetSkillCvar( "sk_controller_dmgzap");
gSkillData.controllerSpeedBall = GetSkillCvar( "sk_controller_speedball");
gSkillData.controllerDmgBall = GetSkillCvar( "sk_controller_dmgball");
// Nihilanth
gSkillData.nihilanthHealth = GetSkillCvar( "sk_nihilanth_health");
gSkillData.nihilanthZap = GetSkillCvar( "sk_nihilanth_zap");
// Scientist
gSkillData.scientistHealth = GetSkillCvar( "sk_scientist_health");
// Snark
gSkillData.snarkHealth = GetSkillCvar( "sk_snark_health");
gSkillData.snarkDmgBite = GetSkillCvar( "sk_snark_dmg_bite");
gSkillData.snarkDmgPop = GetSkillCvar( "sk_snark_dmg_pop");
// Zombie
gSkillData.zombieHealth = GetSkillCvar( "sk_zombie_health");
gSkillData.zombieDmgOneSlash = GetSkillCvar( "sk_zombie_dmg_one_slash");
gSkillData.zombieDmgBothSlash = GetSkillCvar( "sk_zombie_dmg_both_slash");
//Turret
gSkillData.turretHealth = GetSkillCvar( "sk_turret_health");
// MiniTurret
gSkillData.miniturretHealth = GetSkillCvar( "sk_miniturret_health");
// Sentry Turret
gSkillData.sentryHealth = GetSkillCvar( "sk_sentry_health");
// PLAYER WEAPONS
// Crowbar whack
gSkillData.plrDmgCrowbar = GetSkillCvar( "sk_plr_crowbar");
// Glock Round
gSkillData.plrDmg9MM = GetSkillCvar( "sk_plr_9mm_bullet");
// 357 Round
gSkillData.plrDmg357 = GetSkillCvar( "sk_plr_357_bullet");
// MP5 Round
gSkillData.plrDmgMP5 = GetSkillCvar( "sk_plr_9mmAR_bullet");
// M203 grenade
gSkillData.plrDmgM203Grenade = GetSkillCvar( "sk_plr_9mmAR_grenade");
// Shotgun buckshot
gSkillData.plrDmgBuckshot = GetSkillCvar( "sk_plr_buckshot");
// Crossbow
gSkillData.plrDmgCrossbowClient = GetSkillCvar( "sk_plr_xbow_bolt_client");
gSkillData.plrDmgCrossbowMonster = GetSkillCvar( "sk_plr_xbow_bolt_monster");
// RPG
gSkillData.plrDmgRPG = GetSkillCvar( "sk_plr_rpg");
// Gauss gun
gSkillData.plrDmgGauss = GetSkillCvar( "sk_plr_gauss");
// Egon Gun
gSkillData.plrDmgEgonNarrow = GetSkillCvar( "sk_plr_egon_narrow");
gSkillData.plrDmgEgonWide = GetSkillCvar( "sk_plr_egon_wide");
// Hand Grendade
gSkillData.plrDmgHandGrenade = GetSkillCvar( "sk_plr_hand_grenade");
// Satchel Charge
gSkillData.plrDmgSatchel = GetSkillCvar( "sk_plr_satchel");
// Tripmine
gSkillData.plrDmgTripmine = GetSkillCvar( "sk_plr_tripmine");
// MONSTER WEAPONS
gSkillData.monDmg12MM = GetSkillCvar( "sk_12mm_bullet");
gSkillData.monDmgMP5 = GetSkillCvar ("sk_9mmAR_bullet" );
gSkillData.monDmg9MM = GetSkillCvar( "sk_9mm_bullet");
// MONSTER HORNET
gSkillData.monDmgHornet = GetSkillCvar( "sk_hornet_dmg");
// PLAYER HORNET
// Up to this point, player hornet damage and monster hornet damage were both using
// monDmgHornet to determine how much damage to do. In tuning the hivehand, we now need
// to separate player damage and monster hivehand damage. Since it's so late in the project, we've
// added plrDmgHornet to the SKILLDATA struct, but not to the engine CVar list, so it's inaccesible
// via SKILLS.CFG. Any player hivehand tuning must take place in the code. (sjb)
gSkillData.plrDmgHornet = 7;
// HEALTH/CHARGE
gSkillData.suitchargerCapacity = GetSkillCvar( "sk_suitcharger" );
gSkillData.batteryCapacity = GetSkillCvar( "sk_battery" );
gSkillData.healthchargerCapacity = GetSkillCvar ( "sk_healthcharger" );
gSkillData.healthkitCapacity = GetSkillCvar ( "sk_healthkit" );
gSkillData.scientistHeal = GetSkillCvar ( "sk_scientist_heal" );
// monster damage adj
gSkillData.monHead = GetSkillCvar( "sk_monster_head" );
gSkillData.monChest = GetSkillCvar( "sk_monster_chest" );
gSkillData.monStomach = GetSkillCvar( "sk_monster_stomach" );
gSkillData.monLeg = GetSkillCvar( "sk_monster_leg" );
gSkillData.monArm = GetSkillCvar( "sk_monster_arm" );
// player damage adj
gSkillData.plrHead = GetSkillCvar( "sk_player_head" );
gSkillData.plrChest = GetSkillCvar( "sk_player_chest" );
gSkillData.plrStomach = GetSkillCvar( "sk_player_stomach" );
gSkillData.plrLeg = GetSkillCvar( "sk_player_leg" );
gSkillData.plrArm = GetSkillCvar( "sk_player_arm" );
}
//=========================================================
@ -316,29 +126,24 @@ CGameRules *InstallGameRules( void )
if ( !gpGlobals->deathmatch )
{
// generic half-life
g_teamplay = 0;
g_gametype = 0;
return new CHalfLifeRules;
}
else
{
if ( teamplay.value > 0 )
switch((int)CVAR_GET_FLOAT("mp_gametype"))
{
// teamplay
g_teamplay = 1;
return new CHalfLifeTeamplay;
}
if ((int)gpGlobals->deathmatch == 1)
{
// vanilla deathmatch
g_teamplay = 0;
return new CHalfLifeMultiplay;
}
else
{
// vanilla deathmatch??
g_teamplay = 0;
default:
case 0:
g_gametype = 0;
return new CHalfLifeMultiplay;
// TODO: Change this out later :)
/* case 1:
g_gametype = 1;
return new CWastesLMS;
case 2:
g_gametype = 2;
return new CHalfLifeTeamplay;*/
}
}
}

View file

@ -15,6 +15,7 @@
//=========================================================
// GameRules
//=========================================================
#include "tw_common.h"
//#include "weapons.h"
//#include "items.h"
@ -72,7 +73,7 @@ public:
virtual BOOL IsDeathmatch( void ) = 0;//is this a deathmatch game?
virtual BOOL IsTeamplay( void ) { return FALSE; };// is this deathmatch game being played with team rules?
virtual BOOL IsCoOp( void ) = 0;// is this a coop game?
virtual const char *GetGameDescription( void ) { return "Half-Life"; } // this is the game name that gets seen in the server browser
virtual const char *GetGameDescription( void ) { return "The Wastes"; } // this is the game name that gets seen in the server browser
// Client connection/disconnection
virtual BOOL ClientConnected( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ) = 0;// a client just connected to the server (player hasn't spawned yet)
@ -84,6 +85,7 @@ public:
virtual float FlPlayerFallDamage( CBasePlayer *pPlayer ) = 0;// this client just hit the ground after a fall. How much damage?
virtual BOOL FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker ) {return TRUE;};// can this player take damage from this attacker?
virtual BOOL ShouldAutoAim( CBasePlayer *pPlayer, edict_t *target ) { return TRUE; }
virtual float ModifyTiltedDamage(CBaseEntity *pAttacker,CBaseEntity *pVictim,float flCurDamage,int iDamageType){ return flCurDamage; }
// Client spawn/respawn control
virtual void PlayerSpawn( CBasePlayer *pPlayer ) = 0;// called by CBasePlayer::Spawn just before releasing player into the game
@ -98,7 +100,7 @@ public:
// Client kills/scoring
virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled ) = 0;// how many points do I award whoever kills this player?
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor ) = 0;// Called each time a player dies
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;// Called each time a player dies
virtual void DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )= 0;// Call this from within a GameRules class to report an obituary.
// Weapon retrieval
virtual BOOL CanHavePlayerItem( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon );// The player is touching an CBasePlayerItem, do I give it to him?
@ -112,7 +114,7 @@ public:
// Item retrieval
virtual BOOL CanHaveItem( CBasePlayer *pPlayer, CItem *pItem ) = 0;// is this player allowed to take this item?
virtual void PlayerGotItem( CBasePlayer *pPlayer, CItem *pItem ) = 0;// call each time a player picks up an item (battery, healthkit, longjump)
virtual void PlayerGotItem( CBasePlayer *pPlayer, CItem *pItem ) = 0;// call each time a player picks up an item (healthkit, longjump)
// Item spawn/respawn control
virtual int ItemShouldRespawn( CItem *pItem ) = 0;// Should this item respawn?
@ -157,6 +159,20 @@ public:
// Immediately end a multiplayer game
virtual void EndMultiplayerGame( void ) {}
// Spectator mode
virtual BOOL ShouldSpectate(){ return FALSE; }
// Inventory rules
virtual BOOL AcceptInventory( playeritem_t *item )
{
if( item->category != CAT_UNIQUE )
return TRUE;
return FALSE;
}
// Laser beam
virtual void SetLaserBeam( int entindex, BOOL value ){}
};
extern CGameRules *InstallGameRules( void );
@ -282,6 +298,7 @@ public:
// Client damage rules
virtual float FlPlayerFallDamage( CBasePlayer *pPlayer );
virtual float ModifyTiltedDamage(CBaseEntity *pAttacker,CBaseEntity *pVictim,float flCurDamage,int iDamageType);
virtual BOOL FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker );
// Client spawn/respawn control
@ -291,13 +308,13 @@ public:
virtual float FlPlayerSpawnTime( CBasePlayer *pPlayer );
virtual edict_t *GetPlayerSpawnSpot( CBasePlayer *pPlayer );
virtual BOOL AllowAutoTargetCrosshair( void );
virtual BOOL AllowAutoTargetCrosshair( void ){ return FALSE; }
virtual BOOL ClientCommand( CBasePlayer *pPlayer, const char *pcmd );
// Client kills/scoring
virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled );
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
virtual void DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
virtual void DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor);
// Weapon retrieval
virtual void PlayerGotWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon );
@ -349,12 +366,61 @@ public:
// Immediately end a multiplayer game
virtual void EndMultiplayerGame( void ) { GoToIntermission(); }
virtual const char *GetGameDescription( void ) { return "Anarchy"; }
virtual void ClearLevel( void );
// Laserbeam
virtual void SetLaserBeam( int entindex, BOOL value );
virtual void SendLaserInfo();
protected:
virtual void ChangeLevel( void );
virtual void GoToIntermission( void );
float m_flIntermissionEndTime;
float m_flWeaponAllowCheck;
BOOL m_iEndIntermissionButtonHit;
void SendMOTDToClient( edict_t *client );
unsigned int m_iLaserOn;
unsigned int m_iLaserOff;
};
//=========================================================
// CWastesLMS - Last Man Standing
//=========================================================
class CWastesLMS : public CHalfLifeMultiplay
{
private:
BOOL m_bRoundInProgress;
int m_iRoundState;
float m_flNextStateCheck;
float m_flRoundDelay; // While this is active, do not inflict damage ;|
float m_flRoundEndTime;
int GetActivePlayers();
void StartRound();
public:
CWastesLMS();
void Think( void );
// Functions to verify the single/multiplayer status of a game
const char *GetGameDescription( void ) { return "Survival"; }
// Client spawn/respawn control
void PlayerSpawn(CBasePlayer *pPlayer);
// Client damage rules
BOOL FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker );
// Client kills/scoring
void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor);
// Spectator mode
BOOL ShouldSpectate();
// Immediately end a multiplayer game
void EndMultiplayerGame( void );
};
extern DLL_GLOBAL CGameRules* g_pGameRules;

View file

@ -340,7 +340,6 @@ void CGrenade :: TumbleThink( void )
}
}
void CGrenade:: Spawn( void )
{
pev->movetype = MOVETYPE_BOUNCE;
@ -355,7 +354,6 @@ void CGrenade:: Spawn( void )
m_fRegisteredSound = FALSE;
}
CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity )
{
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
@ -377,7 +375,7 @@ CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector v
// Explode on contact
pGrenade->SetTouch( ExplodeTouch );
pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade;
pGrenade->pev->dmg = 50;
return pGrenade;
}

View file

@ -67,7 +67,10 @@ IMPLEMENT_SAVERESTORE( CCycler, CBaseMonster );
class CGenericCycler : public CCycler
{
public:
void Spawn( void ) { GenericCyclerSpawn( (char *)STRING(pev->model), Vector(-16, -16, 0), Vector(16, 16, 72) ); }
void Spawn( void )
{
GenericCyclerSpawn( (char *)STRING(pev->model), Vector(-16, -16, 0), Vector(16, 16, 72) );
}
};
LINK_ENTITY_TO_CLASS( cycler, CGenericCycler );
@ -111,13 +114,13 @@ void CCycler :: GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
UTIL_SetSize(pev, vecMin, vecMax);
}
void CCycler :: Spawn( )
{
InitBoneControllers();
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_NONE;
pev->takedamage = DAMAGE_YES;
// pev->takedamage = DAMAGE_YES;
pev->takedamage = DAMAGE_NO;
pev->effects = 0;
pev->health = 80000;// no cycler should die
pev->yaw_speed = 5;

View file

@ -29,7 +29,6 @@
enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals;
#ifdef _WIN32
// Required DLL entry point

583
dlls/hl.dsp Normal file
View file

@ -0,0 +1,583 @@
# Microsoft Developer Studio Project File - Name="hl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=hl - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "hl.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "hl.mak" CFG="hl - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "hl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "hl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "hl - Win32 Profile" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "hl - Win32 Release Crippled" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/GoldSrc/dlls", ELEBAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "hl - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\obj\Releasehl"
# PROP Intermediate_Dir "..\obj\Releasehl"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /G5 /MT /W3 /Zi /O2 /I "..\dlls" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\game_shared" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /Fr /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /def:".\thewastes.def" /out:"../../dlls/thewastes.dll"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "hl - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\hl___Win"
# PROP BASE Intermediate_Dir ".\hl___Win"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\obj\debughl"
# PROP Intermediate_Dir "..\obj\debughl"
# 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
# ADD CPP /nologo /G5 /MTd /W3 /Gm /ZI /Od /I "..\dlls" /I "..\engine" /I "..\common" /I "..\game_shared" /I "..\pm_shared" /I "..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /i "..\engine" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /def:".\thewastes.def" /out:"../../dlls/thewastes.dll" /implib:".\Debug\hl.lib"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "hl - Win32 Profile"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\hl___Win"
# PROP BASE Intermediate_Dir ".\hl___Win"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Profilehl"
# PROP Intermediate_Dir ".\Profilehl"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MT /W3 /GX /Zi /O2 /I "..\engine" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /YX /c
# SUBTRACT BASE CPP /Fr
# ADD CPP /nologo /G5 /MT /W3 /Zi /O2 /I "..\dlls" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\game_shared" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /YX /FD /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 /nologo /subsystem:windows /dll /debug /machine:I386 /def:".\hl.def"
# SUBTRACT BASE LINK32 /profile
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /profile /debug /machine:I386 /def:".\thewastes.def"
!ELSEIF "$(CFG)" == "hl - Win32 Release Crippled"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "hl___Win32_Release_Crippled"
# PROP BASE Intermediate_Dir "hl___Win32_Release_Crippled"
# PROP BASE Ignore_Export_Lib 1
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\obj\Releasehl_Crippled"
# PROP Intermediate_Dir "..\obj\Releasehl_Crippled"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MT /W3 /Zi /O2 /I "..\dlls" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\game_shared" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /D "TW_BETA" /Fr /YX /FD /c
# ADD CPP /nologo /G5 /MT /W3 /Zi /O2 /I "..\dlls" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\game_shared" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /D "TW_BETA" /D "TW_CRIPPLED" /Fr /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 /nologo /subsystem:windows /dll /map /debug /machine:I386 /def:".\thewastes.def" /out:"../../dlls/thewastes.dll"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /def:".\thewastes.def" /out:"../../dlls/thewastes.dll"
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "hl - Win32 Release"
# Name "hl - Win32 Debug"
# Name "hl - Win32 Profile"
# Name "hl - Win32 Release Crippled"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\animating.cpp
# End Source File
# Begin Source File
SOURCE=.\animation.cpp
# End Source File
# Begin Source File
SOURCE=.\bmodels.cpp
# End Source File
# Begin Source File
SOURCE=.\buttons.cpp
# End Source File
# Begin Source File
SOURCE=.\cbase.cpp
# End Source File
# Begin Source File
SOURCE=.\client.cpp
# End Source File
# Begin Source File
SOURCE=.\combat.cpp
# End Source File
# Begin Source File
SOURCE=.\doors.cpp
# End Source File
# Begin Source File
SOURCE=.\effects.cpp
# End Source File
# Begin Source File
SOURCE=.\explode.cpp
# End Source File
# Begin Source File
SOURCE=.\func_break.cpp
# End Source File
# Begin Source File
SOURCE=.\func_tank.cpp
# End Source File
# Begin Source File
SOURCE=.\game.cpp
# End Source File
# Begin Source File
SOURCE=.\game_deathmatch.cpp
# End Source File
# Begin Source File
SOURCE=.\game_lastmanstanding.cpp
# End Source File
# Begin Source File
SOURCE=.\game_singleplay.cpp
# End Source File
# Begin Source File
SOURCE=.\game_teamplay.cpp
# End Source File
# Begin Source File
SOURCE=.\gamerules.cpp
# End Source File
# Begin Source File
SOURCE=.\ggrenade.cpp
# End Source File
# Begin Source File
SOURCE=.\globals.cpp
# End Source File
# Begin Source File
SOURCE=.\h_ai.cpp
# End Source File
# Begin Source File
SOURCE=.\h_cycler.cpp
# End Source File
# Begin Source File
SOURCE=.\h_export.cpp
# End Source File
# Begin Source File
SOURCE=.\items.cpp
# End Source File
# Begin Source File
SOURCE=.\lights.cpp
# End Source File
# Begin Source File
SOURCE=.\maprules.cpp
# End Source File
# Begin Source File
SOURCE=.\monsters.cpp
# End Source File
# Begin Source File
SOURCE=.\mortar.cpp
# End Source File
# Begin Source File
SOURCE=.\nodes.cpp
# End Source File
# Begin Source File
SOURCE=.\observer.cpp
# End Source File
# Begin Source File
SOURCE=.\pathcorner.cpp
# End Source File
# Begin Source File
SOURCE=.\plane.cpp
# End Source File
# Begin Source File
SOURCE=.\plats.cpp
# End Source File
# Begin Source File
SOURCE=.\player.cpp
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_debug.c
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_math.c
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_shared.c
# End Source File
# Begin Source File
SOURCE=.\schedule.cpp
# End Source File
# Begin Source File
SOURCE=.\scripted.cpp
# End Source File
# Begin Source File
SOURCE=.\skill.cpp
# End Source File
# Begin Source File
SOURCE=.\sound.cpp
# End Source File
# Begin Source File
SOURCE=.\soundent.cpp
# End Source File
# Begin Source File
SOURCE=.\spectator.cpp
# End Source File
# Begin Source File
SOURCE=.\subs.cpp
# End Source File
# Begin Source File
SOURCE=.\thewastes.cpp
# End Source File
# Begin Source File
SOURCE=.\triggers.cpp
# End Source File
# Begin Source File
SOURCE=.\turret.cpp
# End Source File
# Begin Source File
SOURCE=.\wpn_shared\tw_akimbos.cpp
# End Source File
# Begin Source File
SOURCE=.\wpn_shared\tw_automatics.cpp
# End Source File
# Begin Source File
SOURCE=.\wpn_shared\tw_explosives.cpp
# End Source File
# Begin Source File
SOURCE=.\wpn_shared\tw_melee.cpp
# End Source File
# Begin Source File
SOURCE=.\wpn_shared\tw_shotguns.cpp
# End Source File
# Begin Source File
SOURCE=.\wpn_shared\tw_sidearms.cpp
# End Source File
# Begin Source File
SOURCE=.\util.cpp
# End Source File
# Begin Source File
SOURCE=..\game_shared\voice_gamemgr.cpp
# End Source File
# Begin Source File
SOURCE=.\weapons.cpp
# End Source File
# Begin Source File
SOURCE=.\world.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\activity.h
# End Source File
# Begin Source File
SOURCE=.\activitymap.h
# End Source File
# Begin Source File
SOURCE=.\animation.h
# End Source File
# Begin Source File
SOURCE=.\basemonster.h
# End Source File
# Begin Source File
SOURCE=.\cbase.h
# End Source File
# Begin Source File
SOURCE=.\cdll_dll.h
# End Source File
# Begin Source File
SOURCE=.\client.h
# End Source File
# Begin Source File
SOURCE=.\decals.h
# End Source File
# Begin Source File
SOURCE=.\doors.h
# End Source File
# Begin Source File
SOURCE=.\effects.h
# End Source File
# Begin Source File
SOURCE=..\engine\eiface.h
# End Source File
# Begin Source File
SOURCE=.\enginecallback.h
# End Source File
# Begin Source File
SOURCE=.\explode.h
# End Source File
# Begin Source File
SOURCE=.\extdll.h
# End Source File
# Begin Source File
SOURCE=.\func_break.h
# End Source File
# Begin Source File
SOURCE=.\game.h
# End Source File
# Begin Source File
SOURCE=.\gamerules.h
# End Source File
# Begin Source File
SOURCE=.\items.h
# End Source File
# Begin Source File
SOURCE=.\maprules.h
# End Source File
# Begin Source File
SOURCE=.\monsterevent.h
# End Source File
# Begin Source File
SOURCE=.\monsters.h
# End Source File
# Begin Source File
SOURCE=.\nodes.h
# End Source File
# Begin Source File
SOURCE=.\plane.h
# End Source File
# Begin Source File
SOURCE=.\player.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_debug.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_defs.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_info.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_materials.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_movevars.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_shared.h
# End Source File
# Begin Source File
SOURCE=..\engine\progdefs.h
# End Source File
# Begin Source File
SOURCE=.\saverestore.h
# End Source File
# Begin Source File
SOURCE=.\schedule.h
# End Source File
# Begin Source File
SOURCE=..\common\screenfade.h
# End Source File
# Begin Source File
SOURCE=.\scripted.h
# End Source File
# Begin Source File
SOURCE=.\scriptevent.h
# End Source File
# Begin Source File
SOURCE=..\engine\shake.h
# End Source File
# Begin Source File
SOURCE=.\skill.h
# End Source File
# Begin Source File
SOURCE=.\soundent.h
# End Source File
# Begin Source File
SOURCE=.\spectator.h
# End Source File
# Begin Source File
SOURCE=.\teamplay_gamerules.h
# End Source File
# Begin Source File
SOURCE=..\common\thewastes.h
# End Source File
# Begin Source File
SOURCE=.\trains.h
# End Source File
# Begin Source File
SOURCE=..\common\tw_common.h
# End Source File
# Begin Source File
SOURCE=.\util.h
# End Source File
# Begin Source File
SOURCE=.\vector.h
# End Source File
# Begin Source File
SOURCE=.\weapons.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

15
dlls/hlgl.def Normal file
View file

@ -0,0 +1,15 @@
LIBRARY hlgl
EXPORTS
GiveFnptrsToDll @1
GetEntityInterfaces @2
SetChangeParms @3
SetNewParms @4
ClientKill @5
PutClientInServer @6
PlayerPreThink @7
PlayerPostThink @8
ClientConnect @9
ClientDisconnect @10
StartFrame @11
SECTIONS
.data READ WRITE

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