mirror of https://github.com/FWGS/hlsdk-xash3d
Merge changes from HLSDK 2.4.
This commit is contained in:
parent
f19aa23771
commit
787d52611b
|
@ -29,6 +29,12 @@
|
||||||
#include "StudioModelRenderer.h"
|
#include "StudioModelRenderer.h"
|
||||||
#include "GameStudioModelRenderer.h"
|
#include "GameStudioModelRenderer.h"
|
||||||
|
|
||||||
|
// team colors for old TFC models
|
||||||
|
#define TEAM1_COLOR 150
|
||||||
|
#define TEAM2_COLOR 250
|
||||||
|
#define TEAM3_COLOR 45
|
||||||
|
#define TEAM4_COLOR 100
|
||||||
|
|
||||||
// Global engine <-> studio model rendering code interface
|
// Global engine <-> studio model rendering code interface
|
||||||
engine_studio_api_t IEngineStudio;
|
engine_studio_api_t IEngineStudio;
|
||||||
|
|
||||||
|
@ -1063,6 +1069,46 @@ void CStudioModelRenderer::StudioMergeBones( model_t *m_pSubModel )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "pm_shared.h"
|
||||||
|
const Vector& GetTeamColor( int team_no );
|
||||||
|
#define IS_FIRSTPERSON_SPEC ( g_iUser1 == OBS_IN_EYE || (g_iUser1 && (gHUD.m_Spectator.m_pip->value == INSET_IN_EYE)) )
|
||||||
|
|
||||||
|
int GetRemapColor( int iTeam, bool bTopColor )
|
||||||
|
{
|
||||||
|
int retVal = 0;
|
||||||
|
|
||||||
|
switch( iTeam )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case 1:
|
||||||
|
if( bTopColor )
|
||||||
|
retVal = TEAM1_COLOR;
|
||||||
|
else
|
||||||
|
retVal = TEAM1_COLOR - 10;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if( bTopColor )
|
||||||
|
retVal = TEAM2_COLOR;
|
||||||
|
else
|
||||||
|
retVal = TEAM2_COLOR - 10;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if( bTopColor )
|
||||||
|
retVal = TEAM3_COLOR;
|
||||||
|
else
|
||||||
|
retVal = TEAM3_COLOR - 10;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if( bTopColor )
|
||||||
|
retVal = TEAM4_COLOR;
|
||||||
|
else
|
||||||
|
retVal = TEAM4_COLOR - 10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
StudioDrawModel
|
StudioDrawModel
|
||||||
|
@ -1165,8 +1211,77 @@ int CStudioModelRenderer::StudioDrawModel( int flags )
|
||||||
IEngineStudio.StudioSetupLighting( &lighting );
|
IEngineStudio.StudioSetupLighting( &lighting );
|
||||||
|
|
||||||
// get remap colors
|
// get remap colors
|
||||||
m_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF;
|
m_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF;
|
||||||
m_nBottomColor = ( m_pCurrentEntity->curstate.colormap & 0xFF00 ) >> 8;
|
m_nBottomColor = (m_pCurrentEntity->curstate.colormap & 0xFF00) >> 8;
|
||||||
|
|
||||||
|
// use the old tfc colors for the models (view models)
|
||||||
|
// team 1
|
||||||
|
if( ( m_nTopColor < 155 ) && ( m_nTopColor > 135 ) )
|
||||||
|
{
|
||||||
|
m_nTopColor = TEAM1_COLOR;
|
||||||
|
m_nBottomColor = TEAM1_COLOR - 10;
|
||||||
|
}
|
||||||
|
// team 2
|
||||||
|
else if( ( m_nTopColor < 260 ) && ( ( m_nTopColor > 240 ) || ( m_nTopColor == 5 ) ) )
|
||||||
|
{
|
||||||
|
m_nTopColor = TEAM2_COLOR;
|
||||||
|
m_nBottomColor = TEAM2_COLOR - 10;
|
||||||
|
}
|
||||||
|
// team 3
|
||||||
|
else if( ( m_nTopColor < 50 ) && ( m_nTopColor > 40 ) )
|
||||||
|
{
|
||||||
|
m_nTopColor = TEAM3_COLOR;
|
||||||
|
m_nBottomColor = TEAM3_COLOR - 10;
|
||||||
|
}
|
||||||
|
// team 4
|
||||||
|
else if( ( m_nTopColor < 110 ) && ( m_nTopColor > 75 ) )
|
||||||
|
{
|
||||||
|
m_nTopColor = TEAM4_COLOR;
|
||||||
|
m_nBottomColor = TEAM4_COLOR - 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// is this our view model and should it be glowing? we also fix a remap colors
|
||||||
|
// problem if we're spectating in first-person mode
|
||||||
|
if( m_pCurrentEntity == gEngfuncs.GetViewModel() )
|
||||||
|
{
|
||||||
|
cl_entity_t *pTarget = NULL;
|
||||||
|
|
||||||
|
// we're spectating someone via first-person mode
|
||||||
|
if( IS_FIRSTPERSON_SPEC )
|
||||||
|
{
|
||||||
|
pTarget = gEngfuncs.GetEntityByIndex( g_iUser2 );
|
||||||
|
|
||||||
|
if( pTarget )
|
||||||
|
{
|
||||||
|
// we also need to correct the m_nTopColor and m_nBottomColor for the
|
||||||
|
// view model here. this is separate from the glowshell stuff, but
|
||||||
|
// the same conditions need to be met (this is the view model and we're
|
||||||
|
// in first-person spectator mode)
|
||||||
|
m_nTopColor = GetRemapColor( g_PlayerExtraInfo[pTarget->index].teamnumber, true );
|
||||||
|
m_nBottomColor = GetRemapColor( g_PlayerExtraInfo[pTarget->index].teamnumber, false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// we're not spectating, this is OUR view model
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pTarget = gEngfuncs.GetLocalPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( pTarget && pTarget->curstate.renderfx == kRenderFxGlowShell )
|
||||||
|
{
|
||||||
|
m_pCurrentEntity->curstate.renderfx = kRenderFxGlowShell;
|
||||||
|
m_pCurrentEntity->curstate.rendercolor.r = pTarget->curstate.rendercolor.r;
|
||||||
|
m_pCurrentEntity->curstate.rendercolor.g = pTarget->curstate.rendercolor.g;
|
||||||
|
m_pCurrentEntity->curstate.rendercolor.b = pTarget->curstate.rendercolor.b;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pCurrentEntity->curstate.renderfx = kRenderFxNone;
|
||||||
|
m_pCurrentEntity->curstate.rendercolor.r = 0;
|
||||||
|
m_pCurrentEntity->curstate.rendercolor.g = 0;
|
||||||
|
m_pCurrentEntity->curstate.rendercolor.b = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IEngineStudio.StudioSetRemapColors( m_nTopColor, m_nBottomColor );
|
IEngineStudio.StudioSetRemapColors( m_nTopColor, m_nBottomColor );
|
||||||
|
|
||||||
|
@ -1345,6 +1460,142 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer )
|
||||||
m_pPlayerInfo->gaitframe += pseqdesc->numframes;
|
m_pPlayerInfo->gaitframe += pseqdesc->numframes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define PC_UNDEFINED 0
|
||||||
|
|
||||||
|
#define PC_SCOUT 1
|
||||||
|
#define PC_SNIPER 2
|
||||||
|
#define PC_SOLDIER 3
|
||||||
|
#define PC_DEMOMAN 4
|
||||||
|
#define PC_MEDIC 5
|
||||||
|
#define PC_HVYWEAP 6
|
||||||
|
#define PC_PYRO 7
|
||||||
|
#define PC_SPY 8
|
||||||
|
#define PC_ENGINEER 9
|
||||||
|
#define PC_RANDOM 10
|
||||||
|
#define PC_CIVILIAN 11
|
||||||
|
|
||||||
|
#define PC_LASTCLASS 12
|
||||||
|
|
||||||
|
#define TFC_MODELS_OLD 0
|
||||||
|
|
||||||
|
extern cvar_t *tfc_newmodels;
|
||||||
|
|
||||||
|
const char *sNewClassModelFiles[] =
|
||||||
|
{
|
||||||
|
NULL,
|
||||||
|
"models/player/scout/scout.mdl",
|
||||||
|
"models/player/sniper/sniper.mdl",
|
||||||
|
"models/player/soldier/soldier.mdl",
|
||||||
|
"models/player/demo/demo.mdl",
|
||||||
|
"models/player/medic/medic.mdl",
|
||||||
|
"models/player/hvyweapon/hvyweapon.mdl",
|
||||||
|
"models/player/pyro/pyro.mdl",
|
||||||
|
"models/player/spy/spy.mdl",
|
||||||
|
"models/player/engineer/engineer.mdl",
|
||||||
|
"models/player/scout/scout.mdl", // PC_RANDOM
|
||||||
|
"models/player/civilian/civilian.mdl",
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *sOldClassModelFiles[] =
|
||||||
|
{
|
||||||
|
NULL,
|
||||||
|
"models/player/scout/scout2.mdl",
|
||||||
|
"models/player/sniper/sniper2.mdl",
|
||||||
|
"models/player/soldier/soldier2.mdl",
|
||||||
|
"models/player/demo/demo2.mdl",
|
||||||
|
"models/player/medic/medic2.mdl",
|
||||||
|
"models/player/hvyweapon/hvyweapon2.mdl",
|
||||||
|
"models/player/pyro/pyro2.mdl",
|
||||||
|
"models/player/spy/spy2.mdl",
|
||||||
|
"models/player/engineer/engineer2.mdl",
|
||||||
|
"models/player/scout/scout2.mdl", // PC_RANDOM
|
||||||
|
"models/player/civilian/civilian.mdl",
|
||||||
|
};
|
||||||
|
|
||||||
|
#define NUM_WEAPON_PMODELS 18
|
||||||
|
|
||||||
|
const char *sNewWeaponPModels[] =
|
||||||
|
{
|
||||||
|
"models/p_9mmhandgun.mdl",
|
||||||
|
"models/p_crowbar.mdl",
|
||||||
|
"models/p_egon.mdl",
|
||||||
|
"models/p_glauncher.mdl",
|
||||||
|
"models/p_grenade.mdl",
|
||||||
|
"models/p_knife.mdl",
|
||||||
|
"models/p_medkit.mdl",
|
||||||
|
"models/p_mini.mdl",
|
||||||
|
"models/p_nailgun.mdl",
|
||||||
|
"models/p_srpg.mdl",
|
||||||
|
"models/p_shotgun.mdl",
|
||||||
|
"models/p_snailgun.mdl",
|
||||||
|
"models/p_sniper.mdl",
|
||||||
|
"models/p_spanner.mdl",
|
||||||
|
"models/p_umbrella.mdl",
|
||||||
|
"models/p_rpg.mdl",
|
||||||
|
"models/p_spygun.mdl",
|
||||||
|
"models/p_smallshotgun.mdl"
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *sOldWeaponPModels[] =
|
||||||
|
{
|
||||||
|
"models/p_9mmhandgun2.mdl",
|
||||||
|
"models/p_crowbar2.mdl",
|
||||||
|
"models/p_egon2.mdl",
|
||||||
|
"models/p_glauncher2.mdl",
|
||||||
|
"models/p_grenade2.mdl",
|
||||||
|
"models/p_knife2.mdl",
|
||||||
|
"models/p_medkit2.mdl",
|
||||||
|
"models/p_mini2.mdl",
|
||||||
|
"models/p_nailgun2.mdl",
|
||||||
|
"models/p_rpg2.mdl",
|
||||||
|
"models/p_shotgun2.mdl",
|
||||||
|
"models/p_snailgun2.mdl",
|
||||||
|
"models/p_sniper2.mdl",
|
||||||
|
"models/p_spanner2.mdl",
|
||||||
|
"models/p_umbrella.mdl",
|
||||||
|
"models/p_rpg2.mdl",
|
||||||
|
"models/p_9mmhandgun2.mdl",
|
||||||
|
"models/p_shotgun2.mdl"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int CStudioModelRenderer::ReturnDiguisedClass( int iPlayerIndex )
|
||||||
|
{
|
||||||
|
m_pRenderModel = IEngineStudio.SetupPlayerModel( iPlayerIndex );
|
||||||
|
|
||||||
|
if( !m_pRenderModel )
|
||||||
|
return PC_SCOUT;
|
||||||
|
|
||||||
|
for( int i = PC_SCOUT; i < PC_LASTCLASS; i++ )
|
||||||
|
{
|
||||||
|
if( !strcmp( m_pRenderModel->name, sNewClassModelFiles[i] ) )
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PC_SCOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *ReturnCorrectedModelString( int iSwitchClass )
|
||||||
|
{
|
||||||
|
if( tfc_newmodels->value == TFC_MODELS_OLD )
|
||||||
|
{
|
||||||
|
if( sOldClassModelFiles[iSwitchClass] )
|
||||||
|
return sOldClassModelFiles[iSwitchClass];
|
||||||
|
else
|
||||||
|
return sOldClassModelFiles[PC_SCOUT];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( sNewClassModelFiles[iSwitchClass] )
|
||||||
|
return sNewClassModelFiles[iSwitchClass];
|
||||||
|
else
|
||||||
|
return sNewClassModelFiles[PC_SCOUT];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float g_flSpinUpTime[33];
|
||||||
|
float g_flSpinDownTime[33];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
StudioDrawPlayer
|
StudioDrawPlayer
|
||||||
|
@ -1372,7 +1623,23 @@ int CStudioModelRenderer::StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
||||||
if( m_nPlayerIndex < 0 || m_nPlayerIndex >= gEngfuncs.GetMaxClients() )
|
if( m_nPlayerIndex < 0 || m_nPlayerIndex >= gEngfuncs.GetMaxClients() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
m_pRenderModel = IEngineStudio.SetupPlayerModel( m_nPlayerIndex );
|
int modelindex;
|
||||||
|
int iSwitchClass = pplayer->playerclass;
|
||||||
|
|
||||||
|
if( iSwitchClass == PC_SPY )
|
||||||
|
iSwitchClass = ReturnDiguisedClass( m_nPlayerIndex );
|
||||||
|
|
||||||
|
// do we have a "replacement_model" for this player?
|
||||||
|
if( pplayer->fuser1 )
|
||||||
|
{
|
||||||
|
m_pRenderModel = IEngineStudio.SetupPlayerModel( m_nPlayerIndex );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get the model pointer using a "corrected" model string based on tfc_newmodels
|
||||||
|
m_pRenderModel = gEngfuncs.CL_LoadModel( ReturnCorrectedModelString( iSwitchClass ), &modelindex );
|
||||||
|
}
|
||||||
|
|
||||||
if( m_pRenderModel == NULL )
|
if( m_pRenderModel == NULL )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1469,8 +1736,39 @@ int CStudioModelRenderer::StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
||||||
m_pPlayerInfo = IEngineStudio.PlayerInfo( m_nPlayerIndex );
|
m_pPlayerInfo = IEngineStudio.PlayerInfo( m_nPlayerIndex );
|
||||||
|
|
||||||
// get remap colors
|
// get remap colors
|
||||||
m_nTopColor = m_pPlayerInfo->topcolor;
|
m_nTopColor = m_pPlayerInfo->topcolor;
|
||||||
m_nBottomColor = m_pPlayerInfo->bottomcolor;
|
m_nBottomColor = m_pPlayerInfo->bottomcolor;
|
||||||
|
|
||||||
|
// get old remap colors
|
||||||
|
if( tfc_newmodels->value == TFC_MODELS_OLD )
|
||||||
|
{
|
||||||
|
// team 1
|
||||||
|
if( ( m_nTopColor < 155 ) && ( m_nTopColor > 135 ) )
|
||||||
|
{
|
||||||
|
m_nTopColor = TEAM1_COLOR;
|
||||||
|
m_nBottomColor = TEAM1_COLOR - 10;
|
||||||
|
}
|
||||||
|
// team 2
|
||||||
|
else if( ( m_nTopColor < 260 ) && ( ( m_nTopColor > 240 ) || ( m_nTopColor == 5 ) ) )
|
||||||
|
{
|
||||||
|
m_nTopColor = TEAM2_COLOR;
|
||||||
|
m_nBottomColor = TEAM2_COLOR - 10;
|
||||||
|
}
|
||||||
|
// team 3
|
||||||
|
else if( ( m_nTopColor < 50 ) && ( m_nTopColor > 40 ) )
|
||||||
|
{
|
||||||
|
m_nTopColor = TEAM3_COLOR;
|
||||||
|
m_nBottomColor = TEAM3_COLOR - 10;
|
||||||
|
}
|
||||||
|
// team 4
|
||||||
|
else if( ( m_nTopColor < 110 ) && ( m_nTopColor > 75 ) )
|
||||||
|
{
|
||||||
|
m_nTopColor = TEAM4_COLOR;
|
||||||
|
m_nBottomColor = TEAM4_COLOR - 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// bounds check
|
||||||
if( m_nTopColor < 0 )
|
if( m_nTopColor < 0 )
|
||||||
m_nTopColor = 0;
|
m_nTopColor = 0;
|
||||||
if( m_nTopColor > 360 )
|
if( m_nTopColor > 360 )
|
||||||
|
@ -1491,9 +1789,71 @@ int CStudioModelRenderer::StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
||||||
|
|
||||||
model_t *pweaponmodel = IEngineStudio.GetModelByIndex( pplayer->weaponmodel );
|
model_t *pweaponmodel = IEngineStudio.GetModelByIndex( pplayer->weaponmodel );
|
||||||
|
|
||||||
|
if( pweaponmodel )
|
||||||
|
{
|
||||||
|
// if we want to see the old p_models
|
||||||
|
if( tfc_newmodels->value == TFC_MODELS_OLD )
|
||||||
|
{
|
||||||
|
for( int i = 0; i < NUM_WEAPON_PMODELS; ++i )
|
||||||
|
{
|
||||||
|
if( !stricmp( pweaponmodel->name, sNewWeaponPModels[i] ) )
|
||||||
|
{
|
||||||
|
gEngfuncs.CL_LoadModel( sOldWeaponPModels[i], &modelindex );
|
||||||
|
pweaponmodel = IEngineStudio.GetModelByIndex( modelindex );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata( pweaponmodel );
|
m_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata( pweaponmodel );
|
||||||
IEngineStudio.StudioSetHeader( m_pStudioHeader );
|
IEngineStudio.StudioSetHeader( m_pStudioHeader );
|
||||||
|
|
||||||
|
// Do spinning stuff for the HWGuy minigun
|
||||||
|
if( strstr( m_pStudioHeader->name, "p_mini.mdl" ) )
|
||||||
|
{
|
||||||
|
if( g_flSpinUpTime[m_nPlayerIndex] && g_flSpinUpTime[m_nPlayerIndex] > gEngfuncs.GetClientTime() )
|
||||||
|
{
|
||||||
|
float flmod = ( g_flSpinUpTime[m_nPlayerIndex] - ( gEngfuncs.GetClientTime() + 3.5 ) );
|
||||||
|
flmod *= -30;
|
||||||
|
|
||||||
|
m_pCurrentEntity->curstate.frame = flmod;
|
||||||
|
m_pCurrentEntity->curstate.sequence = 2;
|
||||||
|
}
|
||||||
|
else if( g_flSpinUpTime[m_nPlayerIndex] && g_flSpinUpTime[m_nPlayerIndex] <= gEngfuncs.GetClientTime() )
|
||||||
|
{
|
||||||
|
g_flSpinUpTime[m_nPlayerIndex] = 0.0;
|
||||||
|
}
|
||||||
|
else if( g_flSpinDownTime[m_nPlayerIndex] && g_flSpinDownTime[m_nPlayerIndex] > gEngfuncs.GetClientTime() && !g_flSpinUpTime[m_nPlayerIndex] )
|
||||||
|
{
|
||||||
|
float flmod = ( g_flSpinDownTime[m_nPlayerIndex] - ( gEngfuncs.GetClientTime() + 3.5 ) );
|
||||||
|
flmod *= -30;
|
||||||
|
|
||||||
|
m_pCurrentEntity->curstate.frame = flmod;
|
||||||
|
m_pCurrentEntity->curstate.sequence = 3;
|
||||||
|
}
|
||||||
|
else if( g_flSpinDownTime[m_nPlayerIndex] && g_flSpinDownTime[m_nPlayerIndex] <= gEngfuncs.GetClientTime() && !g_flSpinUpTime[m_nPlayerIndex] )
|
||||||
|
g_flSpinDownTime[m_nPlayerIndex] = 0.0;
|
||||||
|
|
||||||
|
if( m_pCurrentEntity->curstate.sequence == 70 || m_pCurrentEntity->curstate.sequence == 72 )
|
||||||
|
{
|
||||||
|
if( g_flSpinUpTime[m_nPlayerIndex] )
|
||||||
|
g_flSpinUpTime[m_nPlayerIndex] = 0.0;
|
||||||
|
|
||||||
|
m_pCurrentEntity->curstate.sequence = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
StudioSetupBones();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( g_flSpinUpTime[m_nPlayerIndex] || g_flSpinDownTime[m_nPlayerIndex] )
|
||||||
|
{
|
||||||
|
g_flSpinUpTime[m_nPlayerIndex] = 0.0;
|
||||||
|
g_flSpinDownTime[m_nPlayerIndex] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StudioMergeBones( pweaponmodel );
|
StudioMergeBones( pweaponmodel );
|
||||||
|
|
||||||
IEngineStudio.StudioSetupLighting( &lighting );
|
IEngineStudio.StudioSetupLighting( &lighting );
|
||||||
|
|
|
@ -59,11 +59,13 @@ int CHudBattery::MsgFunc_Battery( const char *pszName, int iSize, void *pbuf )
|
||||||
|
|
||||||
BEGIN_READ( pbuf, iSize );
|
BEGIN_READ( pbuf, iSize );
|
||||||
int x = READ_SHORT();
|
int x = READ_SHORT();
|
||||||
|
int y = READ_SHORT();
|
||||||
|
|
||||||
if( x != m_iBat )
|
if( x != m_iBat || y != m_iBatMax )
|
||||||
{
|
{
|
||||||
m_fFade = FADE_TIME;
|
m_fFade = FADE_TIME;
|
||||||
m_iBat = x;
|
m_iBat = x;
|
||||||
|
m_iBatMax = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -78,7 +80,12 @@ int CHudBattery::Draw( float flTime )
|
||||||
wrect_t rc;
|
wrect_t rc;
|
||||||
|
|
||||||
rc = *m_prc2;
|
rc = *m_prc2;
|
||||||
rc.top += m_iHeight * ( (float)( 100 - ( min( 100,m_iBat ) ) ) * 0.01 ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
|
float fScale = 0.0;
|
||||||
|
|
||||||
|
if( m_iBatMax > 0 )
|
||||||
|
fScale = 1.0 / (float)m_iBatMax;
|
||||||
|
|
||||||
|
rc.top += m_iHeight * ((float)(m_iBatMax-(min(m_iBatMax,m_iBat))) * fScale); // battery can go from 0 to m_iBatMax so * fScale goes from 0 to 1
|
||||||
|
|
||||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,8 @@ void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct
|
||||||
dst->team = src->team;
|
dst->team = src->team;
|
||||||
dst->colormap = src->colormap;
|
dst->colormap = src->colormap;
|
||||||
|
|
||||||
|
dst->fuser1 = src->fuser1;
|
||||||
|
|
||||||
// Save off some data so other areas of the Client DLL can get to it
|
// Save off some data so other areas of the Client DLL can get to it
|
||||||
cl_entity_t *player = gEngfuncs.GetLocalPlayer(); // Get the local player's index
|
cl_entity_t *player = gEngfuncs.GetLocalPlayer(); // Get the local player's index
|
||||||
if( dst->number == player->index )
|
if( dst->number == player->index )
|
||||||
|
@ -530,6 +532,8 @@ void DLLEXPORT HUD_CreateEntities( void )
|
||||||
Game_AddObjects();
|
Game_AddObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int g_bACSpinning[33];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=========================
|
=========================
|
||||||
HUD_StudioEvent
|
HUD_StudioEvent
|
||||||
|
@ -540,19 +544,28 @@ 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 )
|
void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity )
|
||||||
{
|
{
|
||||||
|
int iMuzzleFlash = 1;
|
||||||
|
|
||||||
|
if( g_bACSpinning[ entity->index - 1 ] )
|
||||||
|
iMuzzleFlash = 0;
|
||||||
|
|
||||||
switch( event->event )
|
switch( event->event )
|
||||||
{
|
{
|
||||||
case 5001:
|
case 5001:
|
||||||
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[0], atoi( event->options ) );
|
if( iMuzzleFlash )
|
||||||
|
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[0], atoi( event->options ) );
|
||||||
break;
|
break;
|
||||||
case 5011:
|
case 5011:
|
||||||
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[1], atoi( event->options ) );
|
if( iMuzzleFlash )
|
||||||
|
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[1], atoi( event->options ) );
|
||||||
break;
|
break;
|
||||||
case 5021:
|
case 5021:
|
||||||
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[2], atoi( event->options ) );
|
if( iMuzzleFlash )
|
||||||
|
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[2], atoi( event->options ) );
|
||||||
break;
|
break;
|
||||||
case 5031:
|
case 5031:
|
||||||
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[3], atoi( event->options ) );
|
if( iMuzzleFlash )
|
||||||
|
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[3], atoi( event->options ) );
|
||||||
break;
|
break;
|
||||||
case 5002:
|
case 5002:
|
||||||
gEngfuncs.pEfxAPI->R_SparkEffect( (float *)&entity->attachment[0], atoi( event->options ), -100, 100 );
|
gEngfuncs.pEfxAPI->R_SparkEffect( (float *)&entity->attachment[0], atoi( event->options ), -100, 100 );
|
||||||
|
|
|
@ -39,7 +39,7 @@ extern client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz,
|
||||||
extern cvar_t *sensitivity;
|
extern cvar_t *sensitivity;
|
||||||
cvar_t *cl_lw = NULL;
|
cvar_t *cl_lw = NULL;
|
||||||
cvar_t *cl_viewbob = NULL;
|
cvar_t *cl_viewbob = NULL;
|
||||||
|
cvar_t *tfc_newmodels;
|
||||||
void ShutdownInput( void );
|
void ShutdownInput( void );
|
||||||
|
|
||||||
//DECLARE_MESSAGE( m_Logo, Logo )
|
//DECLARE_MESSAGE( m_Logo, Logo )
|
||||||
|
@ -188,6 +188,7 @@ 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_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
|
CVAR_CREATE( "hud_takesshots", "0", FCVAR_ARCHIVE ); // controls whether or not to automatically take screenshots at the end of a round
|
||||||
|
tfc_newmodels = CVAR_CREATE( "tfc_newmodels", "1", FCVAR_ARCHIVE | FCVAR_CLIENTDLL );
|
||||||
hud_textmode = CVAR_CREATE ( "hud_textmode", "0", FCVAR_ARCHIVE );
|
hud_textmode = CVAR_CREATE ( "hud_textmode", "0", FCVAR_ARCHIVE );
|
||||||
|
|
||||||
m_iLogo = 0;
|
m_iLogo = 0;
|
||||||
|
@ -199,7 +200,6 @@ void CHud::Init( void )
|
||||||
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
||||||
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
|
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
|
||||||
cl_viewbob = CVAR_CREATE( "cl_viewbob", "0", FCVAR_ARCHIVE );
|
cl_viewbob = CVAR_CREATE( "cl_viewbob", "0", FCVAR_ARCHIVE );
|
||||||
|
|
||||||
m_pSpriteList = NULL;
|
m_pSpriteList = NULL;
|
||||||
|
|
||||||
// Clear any old HUD list
|
// Clear any old HUD list
|
||||||
|
|
|
@ -23,9 +23,7 @@
|
||||||
|
|
||||||
#define MAX_CLIENTS 32
|
#define MAX_CLIENTS 32
|
||||||
|
|
||||||
extern BEAM *pBeam;
|
void ClearEventList( void );
|
||||||
extern BEAM *pBeam2;
|
|
||||||
//extern TEMPENTITY *pFlare; // Vit_amiN
|
|
||||||
|
|
||||||
extern float g_lastFOV; // Vit_amiN
|
extern float g_lastFOV; // Vit_amiN
|
||||||
|
|
||||||
|
@ -77,9 +75,10 @@ void CHud::MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
|
||||||
pList = pList->pNext;
|
pList = pList->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Probably not a good place to put this.
|
ClearEventList();
|
||||||
pBeam = pBeam2 = NULL;
|
|
||||||
//pFlare = NULL; // Vit_amiN: clear egon's beam flare
|
// catch up on any building events that are going on
|
||||||
|
gEngfuncs.pfnServerCmd("sendevents");
|
||||||
}
|
}
|
||||||
|
|
||||||
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
|
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
|
||||||
|
|
|
@ -550,6 +550,8 @@ void IN_Attack2Down( void )
|
||||||
{
|
{
|
||||||
KeyDown( &in_attack2 );
|
KeyDown( &in_attack2 );
|
||||||
|
|
||||||
|
// __CmdFunc_InputPlayerSpecial();
|
||||||
|
|
||||||
gHUD.m_Spectator.HandleButtonsDown( IN_ATTACK2 );
|
gHUD.m_Spectator.HandleButtonsDown( IN_ATTACK2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1128,7 +1130,11 @@ void ShutdownInput( void )
|
||||||
KB_Shutdown();
|
KB_Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearEventList( void );
|
||||||
|
|
||||||
void DLLEXPORT HUD_Shutdown( void )
|
void DLLEXPORT HUD_Shutdown( void )
|
||||||
{
|
{
|
||||||
ShutdownInput();
|
ShutdownInput();
|
||||||
|
|
||||||
|
ClearEventList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
DECLARE_MESSAGE( m_StatusBar, StatusText )
|
DECLARE_MESSAGE( m_StatusBar, StatusText )
|
||||||
DECLARE_MESSAGE( m_StatusBar, StatusValue )
|
DECLARE_MESSAGE( m_StatusBar, StatusValue )
|
||||||
|
|
||||||
#define STATUSBAR_ID_LINE 1
|
#define STATUSBAR_ID_LINE 2
|
||||||
|
|
||||||
float *GetClientColor( int clientIndex );
|
float *GetClientColor( int clientIndex );
|
||||||
extern float g_ColorYellow[3];
|
extern float g_ColorYellow[3];
|
||||||
|
|
|
@ -2223,3 +2223,11 @@ int EV_TFC_Medkit(int idx, float *origin, float *forward, float *right, int enti
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearEventList()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunEventList()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -103,6 +103,7 @@ void DLLEXPORT HUD_DrawNormalTriangles( void )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunEventList( void );
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
HUD_DrawTransparentTriangles
|
HUD_DrawTransparentTriangles
|
||||||
|
@ -115,4 +116,6 @@ void DLLEXPORT HUD_DrawTransparentTriangles( void )
|
||||||
#if defined( TEST_IT )
|
#if defined( TEST_IT )
|
||||||
// Draw_Triangles();
|
// Draw_Triangles();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
RunEventList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1326,8 +1326,10 @@ int V_FindViewModelByWeaponModel( int weaponindex )
|
||||||
{ "models/p_nailgun.mdl", "models/v_tfc_nailgun.mdl" },
|
{ "models/p_nailgun.mdl", "models/v_tfc_nailgun.mdl" },
|
||||||
{ "models/p_snailgun.mdl", "models/v_tfc_supernailgun.mdl" },
|
{ "models/p_snailgun.mdl", "models/v_tfc_supernailgun.mdl" },
|
||||||
{ "models/p_9mmhandgun.mdl", "models/v_tfc_railgun.mdl" },
|
{ "models/p_9mmhandgun.mdl", "models/v_tfc_railgun.mdl" },
|
||||||
{ "models/p_srpg.mdl", "models/v_tfc_rpg.mdl" },
|
{ "models/p_srpg.mdl", "models/v_tfc_rpg.mdl" },
|
||||||
{ "models/p_smallshotgun.mdl", "models/v_tfc_12gauge.mdl" },
|
{ "models/p_smallshotgun.mdl", "models/v_tfc_12gauge.mdl" },
|
||||||
|
{ "models/p_shotgun.mdl", "models/v_tfc_shotgun.mdl" },
|
||||||
|
{ "models/p_spygun.mdl", "models/v_tfc_pistol.mdl" },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1397,7 +1399,7 @@ void V_CalcSpectatorRefdef( struct ref_params_s * pparams )
|
||||||
}
|
}
|
||||||
|
|
||||||
// predict missing client data and set weapon model ( in HLTV mode or inset in eye mode )
|
// predict missing client data and set weapon model ( in HLTV mode or inset in eye mode )
|
||||||
if( gEngfuncs.IsSpectateOnly() )
|
if( gEngfuncs.IsSpectateOnly() || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE )
|
||||||
{
|
{
|
||||||
V_GetInEyePos( g_iUser2, pparams->simorg, pparams->cl_viewangles );
|
V_GetInEyePos( g_iUser2, pparams->simorg, pparams->cl_viewangles );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue