Updated to Engine 2007

This commit is contained in:
Daniel Brunner
2016-05-21 22:26:15 +02:00
parent 22d670827b
commit 755938894e
3328 changed files with 312128 additions and 193569 deletions

View File

@@ -1 +1 @@
@"C:\Program Files (x86)\Steam\steamapps\common\source sdk base\hl2.exe" -dev -game "C:\Program Files (x86)\Steam\steamapps\SourceMods\ultragame" -allowdebug %1 %2 %3 %4 %5 %6 %7 %8 %9
@"C:\Program Files (x86)\Steam\steamapps\common\source sdk base 2007\hl2.exe" -dev -game "C:\Program Files (x86)\Steam\steamapps\SourceMods\ultragame" -allowdebug %1 %2 %3 %4 %5 %6 %7 %8 %9

File diff suppressed because it is too large Load Diff

View File

@@ -1,728 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "c_prop_vehicle.h"
#include "hud.h"
#include <vgui_controls/Controls.h>
#include <Color.h>
#include "view.h"
#include "engine/IVDebugOverlay.h"
#include "movevars_shared.h"
#include "iviewrender.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
int ScreenTransform( const Vector& point, Vector& screen );
extern ConVar default_fov;
BEGIN_SIMPLE_DATADESC( ViewSmoothingData_t )
DEFINE_FIELD( vecAnglesSaved, FIELD_VECTOR ),
DEFINE_FIELD( vecOriginSaved, FIELD_POSITION_VECTOR ),
DEFINE_FIELD( vecAngleDiffSaved, FIELD_VECTOR ),
DEFINE_FIELD( vecAngleDiffMin, FIELD_VECTOR ),
DEFINE_FIELD( bRunningEnterExit, FIELD_BOOLEAN ),
DEFINE_FIELD( bWasRunningAnim, FIELD_BOOLEAN ),
DEFINE_FIELD( flAnimTimeElapsed, FIELD_FLOAT ),
DEFINE_FIELD( flEnterExitDuration, FIELD_FLOAT ),
// These are filled out in the vehicle's constructor:
//CBaseAnimating *pVehicle;
//bool bClampEyeAngles;
//float flPitchCurveZero;
//float flPitchCurveLinear;
//float flRollCurveZero;
//float flRollCurveLinear;
//ViewLockData_t pitchLockData;
//ViewLockData_t rollLockData;
//bool bDampenEyePosition;
END_DATADESC()
IMPLEMENT_CLIENTCLASS_DT(C_PropVehicleDriveable, DT_PropVehicleDriveable, CPropVehicleDriveable)
RecvPropEHandle( RECVINFO(m_hPlayer) ),
RecvPropInt( RECVINFO( m_nSpeed ) ),
RecvPropInt( RECVINFO( m_nRPM ) ),
RecvPropFloat( RECVINFO( m_flThrottle ) ),
RecvPropInt( RECVINFO( m_nBoostTimeLeft ) ),
RecvPropInt( RECVINFO( m_nHasBoost ) ),
RecvPropInt( RECVINFO( m_nScannerDisabledWeapons ) ),
RecvPropInt( RECVINFO( m_nScannerDisabledVehicle ) ),
RecvPropInt( RECVINFO( m_bEnterAnimOn ) ),
RecvPropInt( RECVINFO( m_bExitAnimOn ) ),
RecvPropInt( RECVINFO( m_bUnableToFire ) ),
RecvPropVector( RECVINFO( m_vecEyeExitEndpoint ) ),
RecvPropBool( RECVINFO( m_bHasGun ) ),
RecvPropVector( RECVINFO( m_vecGunCrosshair ) ),
END_RECV_TABLE()
BEGIN_DATADESC( C_PropVehicleDriveable )
DEFINE_EMBEDDED( m_ViewSmoothingData ),
END_DATADESC()
#define ROLL_CURVE_ZERO 20 // roll less than this is clamped to zero
#define ROLL_CURVE_LINEAR 90 // roll greater than this is copied out
#define PITCH_CURVE_ZERO 10 // pitch less than this is clamped to zero
#define PITCH_CURVE_LINEAR 45 // pitch greater than this is copied out
// spline in between
ConVar r_VehicleViewClamp( "r_VehicleViewClamp", "1", FCVAR_CHEAT );
// remaps an angular variable to a 3 band function:
// 0 <= t < start : f(t) = 0
// start <= t <= end : f(t) = end * spline(( t-start) / (end-start) ) // s curve between clamped and linear
// end < t : f(t) = t
float RemapAngleRange( float startInterval, float endInterval, float value, RemapAngleRange_CurvePart_t *peCurvePart )
{
// Fixup the roll
value = AngleNormalize( value );
float absAngle = fabs(value);
// beneath cutoff?
if ( absAngle < startInterval )
{
if ( peCurvePart )
{
*peCurvePart = RemapAngleRange_CurvePart_Zero;
}
value = 0;
}
// in spline range?
else if ( absAngle <= endInterval )
{
float newAngle = SimpleSpline( (absAngle - startInterval) / (endInterval-startInterval) ) * endInterval;
// grab the sign from the initial value
if ( value < 0 )
{
newAngle *= -1;
}
if ( peCurvePart )
{
*peCurvePart = RemapAngleRange_CurvePart_Spline;
}
value = newAngle;
}
// else leave it alone, in linear range
else if ( peCurvePart )
{
*peCurvePart = RemapAngleRange_CurvePart_Linear;
}
return value;
}
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
C_PropVehicleDriveable::C_PropVehicleDriveable() :
m_iv_vecGunCrosshair( "C_PropVehicleDriveable::m_iv_vecGunCrosshair" )
{
m_hPrevPlayer = NULL;
memset( &m_ViewSmoothingData, 0, sizeof( m_ViewSmoothingData ) );
m_ViewSmoothingData.pVehicle = this;
m_ViewSmoothingData.bClampEyeAngles = true;
m_ViewSmoothingData.bDampenEyePosition = true;
m_ViewSmoothingData.flPitchCurveZero = PITCH_CURVE_ZERO;
m_ViewSmoothingData.flPitchCurveLinear = PITCH_CURVE_LINEAR;
m_ViewSmoothingData.flRollCurveZero = ROLL_CURVE_ZERO;
m_ViewSmoothingData.flRollCurveLinear = ROLL_CURVE_LINEAR;
m_flFOV = 0.0f;
AddVar( &m_vecGunCrosshair, &m_iv_vecGunCrosshair, LATCH_SIMULATION_VAR );
}
//-----------------------------------------------------------------------------
// Purpose: De-constructor
//-----------------------------------------------------------------------------
C_PropVehicleDriveable::~C_PropVehicleDriveable()
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_BaseCombatCharacter *C_PropVehicleDriveable::GetPassenger( int nRole )
{
if ( nRole == VEHICLE_ROLE_DRIVER )
return m_hPlayer.Get();
return NULL;
}
//-----------------------------------------------------------------------------
// Returns the role of the passenger
//-----------------------------------------------------------------------------
int C_PropVehicleDriveable::GetPassengerRole( C_BaseCombatCharacter *pPassenger )
{
if ( m_hPlayer.Get() == pPassenger )
return VEHICLE_ROLE_DRIVER;
return VEHICLE_ROLE_NONE;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : updateType -
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::OnPreDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnPreDataChanged( updateType );
m_hPrevPlayer = m_hPlayer;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::OnDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnDataChanged( updateType );
if ( m_hPlayer && !m_hPrevPlayer )
{
OnEnteredVehicle( m_hPlayer );
SetNextClientThink( CLIENT_THINK_ALWAYS );
}
else if ( !m_hPlayer && m_hPrevPlayer )
{
// They have just exited the vehicle.
// Sometimes we never reach the end of our exit anim, such as if the
// animation doesn't have fadeout 0 specified in the QC, so we fail to
// catch it in VehicleViewSmoothing. Catch it here instead.
m_ViewSmoothingData.bWasRunningAnim = false;
SetNextClientThink( CLIENT_THINK_NEVER );
}
}
//-----------------------------------------------------------------------------
// Should this object cast render-to-texture shadows?
//-----------------------------------------------------------------------------
ShadowType_t C_PropVehicleDriveable::ShadowCastType()
{
CStudioHdr *pStudioHdr = GetModelPtr();
if ( !pStudioHdr )
return SHADOWS_NONE;
if ( IsEffectActive(EF_NODRAW | EF_NOSHADOW) )
return SHADOWS_NONE;
// Always use render-to-texture. We'll always the dirty bits in our think function
return SHADOWS_RENDER_TO_TEXTURE;
}
//-----------------------------------------------------------------------------
// Mark the shadow as dirty while the vehicle is being driven
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::ClientThink( void )
{
// The vehicle is always dirty owing to pose parameters while it's being driven.
g_pClientShadowMgr->MarkRenderToTextureShadowDirty( GetShadowHandle() );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::DampenEyePosition( Vector &vecVehicleEyePos, QAngle &vecVehicleEyeAngles )
{
}
//-----------------------------------------------------------------------------
// Purpose: Modify the player view/camera while in a vehicle
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles )
{
VehicleViewSmoothing( m_hPlayer, pAbsOrigin, pAbsAngles, m_bEnterAnimOn, m_bExitAnimOn, &m_vecEyeExitEndpoint, &m_ViewSmoothingData, &m_flFOV );
}
//-----------------------------------------------------------------------------
// Futzes with the clip planes
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::GetVehicleClipPlanes( float &flZNear, float &flZFar ) const
{
// FIXME: Need something a better long-term, this fixes the buggy.
flZNear = 6;
}
//-----------------------------------------------------------------------------
// Renders hud elements
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Simply used to return intensity value based upon current timer passed in
//-----------------------------------------------------------------------------
int GetFlashColorIntensity( int LowIntensity, int HighIntensity, bool Dimming, int Increment, int Timer )
{
if ( Dimming )
return ( HighIntensity - Timer * Increment );
else
return ( LowIntensity + Timer * Increment );
}
#define TRIANGULATED_CROSSHAIR 1
void C_PropVehicleDriveable::DrawHudElements( )
{
CHudTexture *pIcon;
int iIconX, iIconY;
if (m_bHasGun)
{
// draw crosshairs for vehicle gun
pIcon = gHUD.GetIcon( "gunhair" );
if ( pIcon != NULL )
{
float x, y;
Vector screen;
x = ScreenWidth()/2;
y = ScreenHeight()/2;
#if TRIANGULATED_CROSSHAIR
ScreenTransform( m_vecGunCrosshair, screen );
x += 0.5 * screen[0] * ScreenWidth() + 0.5;
y -= 0.5 * screen[1] * ScreenHeight() + 0.5;
#endif
x -= pIcon->Width() / 2;
y -= pIcon->Height() / 2;
Color clr = ( m_bUnableToFire ) ? gHUD.m_clrCaution : gHUD.m_clrNormal;
pIcon->DrawSelf( x, y, clr );
}
if ( m_nScannerDisabledWeapons )
{
// Draw icons for scanners "weps disabled"
pIcon = gHUD.GetIcon( "dmg_bio" );
if ( pIcon )
{
iIconY = 467 - pIcon->Height() / 2;
iIconX = 385;
if ( !m_bScannerWepIcon )
{
pIcon->DrawSelf( XRES(iIconX), YRES(iIconY), Color( 0, 0, 255, 255 ) );
m_bScannerWepIcon = true;
m_iScannerWepFlashTimer = 0;
m_bScannerWepDim = true;
}
else
{
pIcon->DrawSelf( XRES(iIconX), YRES(iIconY), Color( 0, 0, GetFlashColorIntensity(55, 255, m_bScannerWepDim, 10, m_iScannerWepFlashTimer), 255 ) );
m_iScannerWepFlashTimer++;
m_iScannerWepFlashTimer %= 20;
if(!m_iScannerWepFlashTimer)
m_bScannerWepDim ^= 1;
}
}
}
}
if ( m_nScannerDisabledVehicle )
{
// Draw icons for scanners "vehicle disabled"
pIcon = gHUD.GetIcon( "dmg_bio" );
if ( pIcon )
{
iIconY = 467 - pIcon->Height() / 2;
iIconX = 410;
if ( !m_bScannerVehicleIcon )
{
pIcon->DrawSelf( XRES(iIconX), YRES(iIconY), Color( 0, 0, 255, 255 ) );
m_bScannerVehicleIcon = true;
m_iScannerVehicleFlashTimer = 0;
m_bScannerVehicleDim = true;
}
else
{
pIcon->DrawSelf( XRES(iIconX), YRES(iIconY), Color( 0, 0, GetFlashColorIntensity(55, 255, m_bScannerVehicleDim, 10, m_iScannerVehicleFlashTimer), 255 ) );
m_iScannerVehicleFlashTimer++;
m_iScannerVehicleFlashTimer %= 20;
if(!m_iScannerVehicleFlashTimer)
m_bScannerVehicleDim ^= 1;
}
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::RestrictView( float *pYawBounds, float *pPitchBounds,
float *pRollBounds, QAngle &vecViewAngles )
{
int eyeAttachmentIndex = LookupAttachment( "vehicle_driver_eyes" );
Vector vehicleEyeOrigin;
QAngle vehicleEyeAngles;
GetAttachmentLocal( eyeAttachmentIndex, vehicleEyeOrigin, vehicleEyeAngles );
// Limit the yaw.
if ( pYawBounds )
{
float flAngleDiff = AngleDiff( vecViewAngles.y, vehicleEyeAngles.y );
flAngleDiff = clamp( flAngleDiff, pYawBounds[0], pYawBounds[1] );
vecViewAngles.y = vehicleEyeAngles.y + flAngleDiff;
}
// Limit the pitch.
if ( pPitchBounds )
{
float flAngleDiff = AngleDiff( vecViewAngles.x, vehicleEyeAngles.x );
flAngleDiff = clamp( flAngleDiff, pPitchBounds[0], pPitchBounds[1] );
vecViewAngles.x = vehicleEyeAngles.x + flAngleDiff;
}
// Limit the roll.
if ( pRollBounds )
{
float flAngleDiff = AngleDiff( vecViewAngles.z, vehicleEyeAngles.z );
flAngleDiff = clamp( flAngleDiff, pRollBounds[0], pRollBounds[1] );
vecViewAngles.z = vehicleEyeAngles.z + flAngleDiff;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::UpdateViewAngles( C_BasePlayer *pLocalPlayer, CUserCmd *pCmd )
{
if ( r_VehicleViewClamp.GetInt() )
{
float pitchBounds[2] = { -85.0f, 25.0f };
RestrictView( NULL, pitchBounds, NULL, pCmd->viewangles );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::OnEnteredVehicle( C_BaseCombatCharacter *pPassenger )
{
}
//=============================================================================================
// VEHICLE VIEW SMOOTHING. See iclientvehicle.h for details.
//=============================================================================================
//-----------------------------------------------------------------------------
// Purpose: For a given degree of freedom, blends between the raw and clamped
// view depending on this vehicle's preferences. When vehicles wreck
// catastrophically, it's often better to lock the view for a little
// while until things settle down than to keep trying to clamp/flatten
// the view artificially because we can never really catch up with
// the chaotic flipping.
//-----------------------------------------------------------------------------
float ApplyViewLocking( float flAngleRaw, float flAngleClamped, ViewLockData_t &lockData, RemapAngleRange_CurvePart_t eCurvePart )
{
// If we're set up to never lock this degree of freedom, return the clamped value.
if ( lockData.flLockInterval == 0 )
return flAngleClamped;
float flAngleOut = flAngleClamped;
// Lock the view if we're in the linear part of the curve, and keep it locked
// until some duration after we return to the flat (zero) part of the curve.
if ( ( eCurvePart == RemapAngleRange_CurvePart_Linear ) ||
( lockData.bLocked && ( eCurvePart == RemapAngleRange_CurvePart_Spline ) ) )
{
//Msg( "LOCKED\n" );
lockData.bLocked = true;
lockData.flUnlockTime = gpGlobals->curtime + lockData.flLockInterval;
flAngleOut = flAngleRaw;
}
else
{
if ( ( lockData.bLocked ) && ( gpGlobals->curtime > lockData.flUnlockTime ) )
{
lockData.bLocked = false;
if ( lockData.flUnlockBlendInterval > 0 )
{
lockData.flUnlockTime = gpGlobals->curtime;
}
else
{
lockData.flUnlockTime = 0;
}
}
if ( !lockData.bLocked )
{
if ( lockData.flUnlockTime != 0 )
{
// Blend out from the locked raw view (no remapping) to a remapped view.
float flBlend = RemapValClamped( gpGlobals->curtime - lockData.flUnlockTime, 0, lockData.flUnlockBlendInterval, 0, 1 );
//Msg( "BLEND %f\n", flBlend );
flAngleOut = Lerp( flBlend, flAngleRaw, flAngleClamped );
if ( flBlend >= 1.0f )
{
lockData.flUnlockTime = 0;
}
}
else
{
// Not blending out from a locked view to a remapped view.
//Msg( "CLAMPED\n" );
flAngleOut = flAngleClamped;
}
}
else
{
//Msg( "STILL LOCKED\n" );
flAngleOut = flAngleRaw;
}
}
return flAngleOut;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : pData -
// vehicleEyeAngles -
//-----------------------------------------------------------------------------
void RemapViewAngles( ViewSmoothingData_t *pData, QAngle &vehicleEyeAngles )
{
QAngle vecEyeAnglesRemapped;
// Clamp pitch.
RemapAngleRange_CurvePart_t ePitchCurvePart;
vecEyeAnglesRemapped.x = RemapAngleRange( pData->flPitchCurveZero, pData->flPitchCurveLinear, vehicleEyeAngles.x, &ePitchCurvePart );
vehicleEyeAngles.z = vecEyeAnglesRemapped.z = AngleNormalize( vehicleEyeAngles.z );
// Blend out the roll dampening as our pitch approaches 90 degrees, to avoid gimbal lock problems.
float flBlendRoll = 1.0;
if ( fabs( vehicleEyeAngles.x ) > 60 )
{
flBlendRoll = RemapValClamped( fabs( vecEyeAnglesRemapped.x ), 60, 80, 1, 0);
}
RemapAngleRange_CurvePart_t eRollCurvePart;
float flRollDamped = RemapAngleRange( pData->flRollCurveZero, pData->flRollCurveLinear, vecEyeAnglesRemapped.z, &eRollCurvePart );
vecEyeAnglesRemapped.z = Lerp( flBlendRoll, vecEyeAnglesRemapped.z, flRollDamped );
//Msg("PITCH ");
vehicleEyeAngles.x = ApplyViewLocking( vehicleEyeAngles.x, vecEyeAnglesRemapped.x, pData->pitchLockData, ePitchCurvePart );
//Msg("ROLL ");
vehicleEyeAngles.z = ApplyViewLocking( vehicleEyeAngles.z, vecEyeAnglesRemapped.z, pData->rollLockData, eRollCurvePart );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pAbsOrigin -
// *pAbsAngles -
// bEnterAnimOn -
// bExitAnimOn -
// *vecEyeExitEndpoint -
// *pData -
//-----------------------------------------------------------------------------
void VehicleViewSmoothing( CBasePlayer *pPlayer, Vector *pAbsOrigin, QAngle *pAbsAngles, bool bEnterAnimOn, bool bExitAnimOn, Vector *vecEyeExitEndpoint, ViewSmoothingData_t *pData,
float *pFOV )
{
int eyeAttachmentIndex = pData->pVehicle->LookupAttachment( "vehicle_driver_eyes" );
matrix3x4_t vehicleEyePosToWorld;
Vector vehicleEyeOrigin;
QAngle vehicleEyeAngles;
pData->pVehicle->GetAttachment( eyeAttachmentIndex, vehicleEyeOrigin, vehicleEyeAngles );
AngleMatrix( vehicleEyeAngles, vehicleEyePosToWorld );
// Dampen the eye positional change as we drive around.
*pAbsAngles = pPlayer->EyeAngles();
if ( r_VehicleViewDampen.GetInt() && pData->bDampenEyePosition )
{
C_PropVehicleDriveable *pDriveable = assert_cast<C_PropVehicleDriveable*>(pData->pVehicle);
pDriveable->DampenEyePosition( vehicleEyeOrigin, vehicleEyeAngles );
}
// Started running an entry or exit anim?
bool bRunningAnim = ( bEnterAnimOn || bExitAnimOn );
if ( bRunningAnim && !pData->bWasRunningAnim )
{
pData->bRunningEnterExit = true;
pData->flAnimTimeElapsed = 0.01;
pData->flEnterExitDuration = pData->pVehicle->SequenceDuration( pData->pVehicle->GetSequence() );
pData->vecAnglesSaved = PrevMainViewAngles();
pData->vecOriginSaved = PrevMainViewOrigin();
// Save our initial angular error, which we will blend out over the length of the animation.
pData->vecAngleDiffSaved.x = AngleDiff( vehicleEyeAngles.x, pData->vecAnglesSaved.x );
pData->vecAngleDiffSaved.y = AngleDiff( vehicleEyeAngles.y, pData->vecAnglesSaved.y );
pData->vecAngleDiffSaved.z = AngleDiff( vehicleEyeAngles.z, pData->vecAnglesSaved.z );
pData->vecAngleDiffMin = pData->vecAngleDiffSaved;
}
pData->bWasRunningAnim = bRunningAnim;
float frac = 0;
float flFracFOV = 0;
// If we're in an enter/exit animation, blend the player's eye angles to the attachment's
if ( bRunningAnim || pData->bRunningEnterExit )
{
*pAbsAngles = vehicleEyeAngles;
// Forward integrate to determine the elapsed time in this entry/exit anim.
frac = pData->flAnimTimeElapsed / pData->flEnterExitDuration;
frac = clamp( frac, 0.0f, 1.0f );
flFracFOV = pData->flAnimTimeElapsed / ( pData->flEnterExitDuration * 0.85f );
flFracFOV = clamp( flFracFOV, 0.0f, 1.0f );
//Msg("Frac: %f\n", frac );
if ( frac < 1.0 )
{
// Blend to the desired vehicle eye origin
//Vector vecToView = (vehicleEyeOrigin - PrevMainViewOrigin());
//vehicleEyeOrigin = PrevMainViewOrigin() + (vecToView * SimpleSpline(frac));
//debugoverlay->AddBoxOverlay( vehicleEyeOrigin, -Vector(1,1,1), Vector(1,1,1), vec3_angle, 0,255,255, 64, 10 );
}
else
{
pData->bRunningEnterExit = false;
// Enter animation has finished, align view with the eye attachment point
// so they can start mouselooking around.
if ( !bExitAnimOn )
{
Vector localEyeOrigin;
QAngle localEyeAngles;
pData->pVehicle->GetAttachmentLocal( eyeAttachmentIndex, localEyeOrigin, localEyeAngles );
engine->SetViewAngles( localEyeAngles );
}
}
pData->flAnimTimeElapsed += gpGlobals->frametime;
}
// Compute the relative rotation between the unperturbed eye attachment + the eye angles
matrix3x4_t cameraToWorld;
AngleMatrix( *pAbsAngles, cameraToWorld );
matrix3x4_t worldToEyePos;
MatrixInvert( vehicleEyePosToWorld, worldToEyePos );
matrix3x4_t vehicleCameraToEyePos;
ConcatTransforms( worldToEyePos, cameraToWorld, vehicleCameraToEyePos );
// Damp out some of the vehicle motion (neck/head would do this)
if ( pData->bClampEyeAngles )
{
RemapViewAngles( pData, vehicleEyeAngles );
}
AngleMatrix( vehicleEyeAngles, vehicleEyeOrigin, vehicleEyePosToWorld );
// Now treat the relative eye angles as being relative to this new, perturbed view position...
matrix3x4_t newCameraToWorld;
ConcatTransforms( vehicleEyePosToWorld, vehicleCameraToEyePos, newCameraToWorld );
// output new view abs angles
MatrixAngles( newCameraToWorld, *pAbsAngles );
// UNDONE: *pOrigin would already be correct in single player if the HandleView() on the server ran after vphysics
MatrixGetColumn( newCameraToWorld, 3, *pAbsOrigin );
// If we're playing an extry or exit animation...
if ( bRunningAnim || pData->bRunningEnterExit )
{
float flSplineFrac = clamp( SimpleSpline( frac ), 0, 1 );
// Blend out the error between the player's initial eye angles and the animation's initial
// eye angles over the duration of the animation.
QAngle vecAngleDiffBlend = ( ( 1 - flSplineFrac ) * pData->vecAngleDiffSaved );
// If our current error is less than the error amount that we're blending
// out, use that. This lets the angles converge as quickly as possible.
QAngle vecAngleDiffCur;
vecAngleDiffCur.x = AngleDiff( vehicleEyeAngles.x, pData->vecAnglesSaved.x );
vecAngleDiffCur.y = AngleDiff( vehicleEyeAngles.y, pData->vecAnglesSaved.y );
vecAngleDiffCur.z = AngleDiff( vehicleEyeAngles.z, pData->vecAnglesSaved.z );
// In either case, never increase the error, so track the minimum error and clamp to that.
for (int i = 0; i < 3; i++)
{
if ( fabs(vecAngleDiffCur[i] ) < fabs( pData->vecAngleDiffMin[i] ) )
{
pData->vecAngleDiffMin[i] = vecAngleDiffCur[i];
}
if ( fabs(vecAngleDiffBlend[i] ) < fabs( pData->vecAngleDiffMin[i] ) )
{
pData->vecAngleDiffMin[i] = vecAngleDiffBlend[i];
}
}
// Add the error to the animation's eye angles.
*pAbsAngles -= pData->vecAngleDiffMin;
// Use this as the basis for the next error calculation.
pData->vecAnglesSaved = *pAbsAngles;
//if ( gpGlobals->frametime )
//{
// Msg("Angle : %.2f %.2f %.2f\n", target.x, target.y, target.z );
//}
//Msg("Prev: %.2f %.2f %.2f\n", pData->vecAnglesSaved.x, pData->vecAnglesSaved.y, pData->vecAnglesSaved.z );
Vector vecAbsOrigin = *pAbsOrigin;
// If we're exiting, our desired position is the server-sent exit position
if ( bExitAnimOn )
{
//debugoverlay->AddBoxOverlay( vecEyeExitEndpoint, -Vector(1,1,1), Vector(1,1,1), vec3_angle, 255,255,255, 64, 10 );
// Blend to the exit position
*pAbsOrigin = Lerp( flSplineFrac, vecAbsOrigin, *vecEyeExitEndpoint );
if ( ( pData->flFOV != 0.0f ) && pFOV )
{
*pFOV = Lerp( flFracFOV, pData->flFOV, default_fov.GetFloat() );
}
}
else
{
// Blend from our starting position to the desired origin
*pAbsOrigin = Lerp( flSplineFrac, pData->vecOriginSaved, vecAbsOrigin );
if ( ( pData->flFOV != 0.0f ) && pFOV )
{
*pFOV = Lerp( flFracFOV, default_fov.GetFloat(), pData->flFOV );
}
}
}
else if ( pFOV )
{
// Not running an entry/exit anim. Just use the vehicle's FOV.
*pFOV = pData->flFOV;
}
}

View File

@@ -1,559 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "networkstringtable_clientdll.h"
#include "dt_utlvector_recv.h"
#include "choreoevent.h"
#include "choreoactor.h"
#include "choreochannel.h"
#include "choreoscene.h"
#include "filesystem.h"
#include "ichoreoeventcallback.h"
#include "scenefilecache/ISceneFileCache.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
class C_SceneEntity : public C_BaseEntity, public IChoreoEventCallback
{
friend class CChoreoEventCallback;
public:
DECLARE_CLASS( C_SceneEntity, C_BaseEntity );
DECLARE_CLIENTCLASS();
C_SceneEntity( void );
~C_SceneEntity( void );
// From IChoreoEventCallback
virtual void StartEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event );
virtual void EndEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event );
virtual void ProcessEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event );
virtual bool CheckEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event );
virtual void PostDataUpdate( DataUpdateType_t updateType );
virtual void PreDataUpdate( DataUpdateType_t updateType );
virtual void ClientThink();
void OnResetClientTime();
private:
// Scene load/unload
CChoreoScene *LoadScene( const char *filename );
void LoadSceneFromFile( const char *filename );
void UnloadScene( void );
C_BaseFlex *FindNamedActor( CChoreoActor *pChoreoActor );
virtual void DispatchStartFlexAnimation( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
virtual void DispatchEndFlexAnimation( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
virtual void DispatchStartExpression( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
virtual void DispatchEndExpression( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
char const *GetSceneFileName();
void DoThink( float frametime );
void ClearSceneEvents( CChoreoScene *scene, bool canceled );
private:
void CheckQueuedEvents();
void WipeQueuedEvents();
void QueueStartEvent( float starttime, CChoreoScene *scene, CChoreoEvent *event );
bool m_bIsPlayingBack;
bool m_bPaused;
float m_flCurrentTime;
float m_flForceClientTime;
int m_nSceneStringIndex;
CUtlVector< CHandle< C_BaseFlex > > m_hActorList;
private:
bool m_bWasPlaying;
CChoreoScene *m_pScene;
struct QueuedEvents_t
{
float starttime;
CChoreoScene *scene;
CChoreoEvent *event;
};
CUtlVector< QueuedEvents_t > m_QueuedEvents;
};
//-----------------------------------------------------------------------------
// Purpose: Decodes animtime and notes when it changes
// Input : *pStruct - ( C_BaseEntity * ) used to flag animtime is changine
// *pVarData -
// *pIn -
// objectID -
//-----------------------------------------------------------------------------
void RecvProxy_ForcedClientTime( const CRecvProxyData *pData, void *pStruct, void *pOut )
{
C_SceneEntity *pScene = reinterpret_cast< C_SceneEntity * >( pStruct );
*(float *)pOut = pData->m_Value.m_Float;
pScene->OnResetClientTime();
}
#if defined( CSceneEntity )
#undef CSceneEntity
#endif
IMPLEMENT_CLIENTCLASS_DT(C_SceneEntity, DT_SceneEntity, CSceneEntity)
RecvPropInt(RECVINFO(m_nSceneStringIndex)),
RecvPropBool(RECVINFO(m_bIsPlayingBack)),
RecvPropBool(RECVINFO(m_bPaused)),
RecvPropFloat(RECVINFO(m_flForceClientTime), 0, RecvProxy_ForcedClientTime ),
RecvPropUtlVector(
RECVINFO_UTLVECTOR( m_hActorList ),
MAX_ACTORS_IN_SCENE,
RecvPropEHandle(NULL, 0, 0)),
END_RECV_TABLE()
C_SceneEntity::C_SceneEntity( void )
{
m_pScene = NULL;
}
C_SceneEntity::~C_SceneEntity( void )
{
UnloadScene();
}
void C_SceneEntity::OnResetClientTime()
{
m_flCurrentTime = m_flForceClientTime;
}
char const *C_SceneEntity::GetSceneFileName()
{
return g_pStringTableClientSideChoreoScenes->GetString( m_nSceneStringIndex );
}
void C_SceneEntity::PostDataUpdate( DataUpdateType_t updateType )
{
BaseClass::PostDataUpdate( updateType );
char const *str = GetSceneFileName();
if ( updateType == DATA_UPDATE_CREATED )
{
Assert( str && str[ 0 ] );
if ( str && str[ 0 ] )
{
LoadSceneFromFile( str );
// Kill everything except flex events
Assert( m_pScene );
if ( m_pScene )
{
int types[ 2 ];
types[ 0 ] = CChoreoEvent::FLEXANIMATION;
types[ 1 ] = CChoreoEvent::EXPRESSION;
m_pScene->RemoveEventsExceptTypes( types, 2 );
}
SetNextClientThink( CLIENT_THINK_ALWAYS );
}
}
// Playback state changed...
if ( m_bWasPlaying != m_bIsPlayingBack )
{
for(int i = 0; i < m_hActorList.Count() ; ++i )
{
C_BaseFlex *actor = m_hActorList[ i ].Get();
if ( !actor )
continue;
Assert( m_pScene );
if ( m_pScene )
{
ClearSceneEvents( m_pScene, false );
if ( m_bIsPlayingBack )
{
m_pScene->ResetSimulation();
actor->StartChoreoScene( m_pScene );
}
else
{
m_pScene->ResetSimulation();
actor->RemoveChoreoScene( m_pScene );
}
}
}
}
}
void C_SceneEntity::PreDataUpdate( DataUpdateType_t updateType )
{
BaseClass::PreDataUpdate( updateType );
m_bWasPlaying = m_bIsPlayingBack;
}
//-----------------------------------------------------------------------------
// Purpose: Called every frame that an event is active (Start/EndEvent as also
// called)
// Input : *event -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
void C_SceneEntity::ProcessEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event )
{
return;
}
//-----------------------------------------------------------------------------
// Purpose: Called for events that are part of a pause condition
// Input : *event -
// Output : Returns true on event completed, false on non-completion.
//-----------------------------------------------------------------------------
bool C_SceneEntity::CheckEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event )
{
return true;
}
C_BaseFlex *C_SceneEntity::FindNamedActor( CChoreoActor *pChoreoActor )
{
if ( !m_pScene )
return NULL;
int idx = m_pScene->FindActorIndex( pChoreoActor );
if ( idx < 0 || idx >= m_hActorList.Count() )
return NULL;
return m_hActorList[ idx ].Get();
}
//-----------------------------------------------------------------------------
// Purpose: All events are leading edge triggered
// Input : currenttime -
// *event -
//-----------------------------------------------------------------------------
void C_SceneEntity::StartEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event )
{
Assert( event );
if ( !Q_stricmp( event->GetName(), "NULL" ) )
{
Scene_Printf( "%s : %8.2f: ignored %s\n", GetSceneFileName(), currenttime, event->GetDescription() );
return;
}
C_BaseFlex *pActor = NULL;
CChoreoActor *actor = event->GetActor();
if ( actor )
{
pActor = FindNamedActor( actor );
if ( NULL == pActor )
{
// This can occur if we haven't been networked an actor yet... we need to queue it so that we can
// fire off the start event as soon as we have the actor resident on the client.
QueueStartEvent( currenttime, scene, event );
return;
}
}
Scene_Printf( "%s : %8.2f: start %s\n", GetSceneFileName(), currenttime, event->GetDescription() );
switch ( event->GetType() )
{
case CChoreoEvent::FLEXANIMATION:
{
if ( pActor )
{
DispatchStartFlexAnimation( scene, pActor, event );
}
}
break;
case CChoreoEvent::EXPRESSION:
{
if ( pActor )
{
DispatchStartExpression( scene, pActor, event );
}
}
break;
default:
break;
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : currenttime -
// *event -
//-----------------------------------------------------------------------------
void C_SceneEntity::EndEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event )
{
Assert( event );
if ( !Q_stricmp( event->GetName(), "NULL" ) )
{
return;
}
C_BaseFlex *pActor = NULL;
CChoreoActor *actor = event->GetActor();
if ( actor )
{
pActor = FindNamedActor( actor );
}
Scene_Printf( "%s : %8.2f: finish %s\n", GetSceneFileName(), currenttime, event->GetDescription() );
switch ( event->GetType() )
{
case CChoreoEvent::FLEXANIMATION:
{
if ( pActor )
{
DispatchEndFlexAnimation( scene, pActor, event );
}
}
break;
case CChoreoEvent::EXPRESSION:
{
if ( pActor )
{
DispatchEndExpression( scene, pActor, event );
}
}
break;
default:
break;
}
}
CChoreoScene *C_SceneEntity::LoadScene( const char *filename )
{
char loadfile[ 512 ];
Q_strncpy( loadfile, filename, sizeof( loadfile ) );
Q_SetExtension( loadfile, ".vcd", sizeof( loadfile ) );
Q_FixSlashes( loadfile );
char *buffer = NULL;
size_t bufsize = scenefilecache->GetSceneBufferSize( loadfile );
if ( bufsize <= 0 )
return NULL;
buffer = new char[ bufsize ];
if ( !scenefilecache->GetSceneData( filename, (byte *)buffer, bufsize ) )
{
delete[] buffer;
return NULL;
}
g_TokenProcessor.SetBuffer( buffer );
CChoreoScene *scene = ChoreoLoadScene( loadfile, this, &g_TokenProcessor, Scene_Printf );
delete[] buffer;
return scene;
}
extern "C" void _stdcall Sleep( unsigned long dwMilliseconds );
//-----------------------------------------------------------------------------
// Purpose:
// Input : *filename -
//-----------------------------------------------------------------------------
void C_SceneEntity::LoadSceneFromFile( const char *filename )
{
UnloadScene();
int sleepCount = 0;
while ( scenefilecache->IsStillAsyncLoading( filename ) )
{
::Sleep( 10 );
++sleepCount;
if ( sleepCount > 10 )
{
Assert( 0 );
break;
}
}
m_pScene = LoadScene( filename );
}
void C_SceneEntity::ClearSceneEvents( CChoreoScene *scene, bool canceled )
{
if ( !m_pScene )
return;
Scene_Printf( "%s : %8.2f: clearing events\n", GetSceneFileName(), m_flCurrentTime );
int i;
for ( i = 0 ; i < m_pScene->GetNumActors(); i++ )
{
C_BaseFlex *pActor = FindNamedActor( m_pScene->GetActor( i ) );
if ( !pActor )
continue;
// Clear any existing expressions
pActor->ClearSceneEvents( scene, canceled );
}
WipeQueuedEvents();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_SceneEntity::UnloadScene( void )
{
WipeQueuedEvents();
if ( m_pScene )
{
ClearSceneEvents( m_pScene, false );
for ( int i = 0 ; i < m_pScene->GetNumActors(); i++ )
{
C_BaseFlex *pTestActor = FindNamedActor( m_pScene->GetActor( i ) );
if ( !pTestActor )
continue;
pTestActor->RemoveChoreoScene( m_pScene );
}
}
delete m_pScene;
m_pScene = NULL;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *actor -
// *event -
//-----------------------------------------------------------------------------
void C_SceneEntity::DispatchStartFlexAnimation( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event )
{
actor->AddSceneEvent( scene, event );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *actor -
// *event -
//-----------------------------------------------------------------------------
void C_SceneEntity::DispatchEndFlexAnimation( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event )
{
actor->RemoveSceneEvent( scene, event, false );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *actor -
// *event -
//-----------------------------------------------------------------------------
void C_SceneEntity::DispatchStartExpression( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event )
{
actor->AddSceneEvent( scene, event );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *actor -
// *event -
//-----------------------------------------------------------------------------
void C_SceneEntity::DispatchEndExpression( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event )
{
actor->RemoveSceneEvent( scene, event, false );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_SceneEntity::DoThink( float frametime )
{
if ( !m_pScene )
return;
if ( !m_bIsPlayingBack )
{
WipeQueuedEvents();
return;
}
CheckQueuedEvents();
if ( m_bPaused )
{
return;
}
// Msg( "CL: %d, %f for %s\n", gpGlobals->tickcount, m_flCurrentTime, m_pScene->GetFilename() );
// Tell scene to go
m_pScene->Think( m_flCurrentTime );
// Drive simulation time for scene
m_flCurrentTime += gpGlobals->frametime;
}
void C_SceneEntity::ClientThink()
{
DoThink( gpGlobals->frametime );
}
void C_SceneEntity::CheckQueuedEvents()
{
// Check for duplicates
CUtlVector< QueuedEvents_t > events;
events = m_QueuedEvents;
m_QueuedEvents.RemoveAll();
int c = events.Count();
for ( int i = 0; i < c; ++i )
{
const QueuedEvents_t& check = events[ i ];
// Retry starting this event
StartEvent( check.starttime, check.scene, check.event );
}
}
void C_SceneEntity::WipeQueuedEvents()
{
m_QueuedEvents.Purge();
}
void C_SceneEntity::QueueStartEvent( float starttime, CChoreoScene *scene, CChoreoEvent *event )
{
// Check for duplicates
int c = m_QueuedEvents.Count();
for ( int i = 0; i < c; ++i )
{
const QueuedEvents_t& check = m_QueuedEvents[ i ];
if ( check.scene == scene &&
check.event == event )
return;
}
QueuedEvents_t qe;
qe.scene = scene;
qe.event = event;
qe.starttime = starttime;
m_QueuedEvents.AddToTail( qe );
}
CON_COMMAND( scenefilecache_status, "Print current scene file cache status." )
{
scenefilecache->OutputStatus();
}

View File

@@ -1,46 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#ifndef CDLL_CONVAR_H
#define CDLL_CONVAR_H
#pragma once
// This file implements IConVarAccessor to allow access to console variables.
#include "convar.h"
#include "cdll_util.h"
#include "icvar.h"
class CDLL_ConVarAccessor : public IConCommandBaseAccessor
{
public:
virtual bool RegisterConCommandBase( ConCommandBase *pCommand )
{
// Mark for easy removal
pCommand->AddFlags( FCVAR_CLIENTDLL );
// Unlink from client .dll only list
pCommand->SetNext( 0 );
// Link to engine's list instead
cvar->RegisterConCommandBase( pCommand );
return true;
}
};
#endif // CDLL_CONVAR_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,49 +0,0 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: A base class for all material proxies in the client dll
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
// identifier was truncated to '255' characters in the debug information
//#pragma warning(disable: 4786)
#include "ProxyEntity.h"
#include "materialsystem/IMaterialVar.h"
class CEntityOriginMaterialProxy : public CEntityMaterialProxy
{
public:
CEntityOriginMaterialProxy()
{
m_pMaterial = NULL;
m_pOriginVar = NULL;
}
virtual ~CEntityOriginMaterialProxy()
{
}
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{
m_pMaterial = pMaterial;
bool found;
m_pOriginVar = m_pMaterial->FindVar( "$entityorigin", &found );
if( !found )
{
m_pOriginVar = NULL;
return false;
}
return true;
}
virtual void OnBind( C_BaseEntity *pC_BaseEntity )
{
const Vector &origin = pC_BaseEntity->GetAbsOrigin();
m_pOriginVar->SetVecValue( origin.x, origin.y, origin.z );
}
protected:
IMaterial *m_pMaterial;
IMaterialVar *m_pOriginVar;
};
EXPOSE_INTERFACE( CEntityOriginMaterialProxy, IMaterialProxy, "EntityOrigin" IMATERIAL_PROXY_INTERFACE_VERSION );

View File

@@ -1,305 +0,0 @@
//
// Episodic screen-space effects
//
#include "cbase.h"
#include "screenspaceeffects.h"
#include "rendertexture.h"
#include "materialsystem/imaterialsystemhardwareconfig.h"
#include "materialsystem/imaterialsystem.h"
#include "materialsystem/imaterialvar.h"
#include "cdll_client_int.h"
#include "materialsystem/itexture.h"
#include "keyvalues.h"
#include "ClientEffectPrecacheSystem.h"
#include "episodic_screenspaceeffects.h"
CLIENTEFFECT_REGISTER_BEGIN( PrecacheEffectEpScreenspace )
CLIENTEFFECT_MATERIAL( "effects/stun" )
CLIENTEFFECT_MATERIAL( "effects/introblur" )
CLIENTEFFECT_REGISTER_END()
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CStunEffect::Init( void )
{
m_pStunTexture = NULL;
m_flDuration = 0.0f;
m_flFinishTime = 0.0f;
m_bUpdated = false;
}
//------------------------------------------------------------------------------
// Purpose: Pick up changes in our parameters
//------------------------------------------------------------------------------
void CStunEffect::SetParameters( KeyValues *params )
{
if( params->FindKey( "duration" ) )
{
m_flDuration = params->GetFloat( "duration" );
m_flFinishTime = gpGlobals->curtime + m_flDuration;
m_bUpdated = true;
}
}
//-----------------------------------------------------------------------------
// Purpose: Render the effect
//-----------------------------------------------------------------------------
void CStunEffect::Render( int x, int y, int w, int h )
{
// Make sure we're ready to play this effect
if ( m_flFinishTime < gpGlobals->curtime )
return;
IMaterial *pMaterial = materials->FindMaterial( "effects/stun", TEXTURE_GROUP_CLIENT_EFFECTS, true );
if ( pMaterial == NULL )
return;
bool bResetBaseFrame = m_bUpdated;
// Set ourselves to the proper rendermode
materials->MatrixMode( MATERIAL_VIEW );
materials->PushMatrix();
materials->LoadIdentity();
materials->MatrixMode( MATERIAL_PROJECTION );
materials->PushMatrix();
materials->LoadIdentity();
// Get our current view
if ( m_pStunTexture == NULL )
{
m_pStunTexture = GetPowerOfTwoFrameBufferTexture();
}
// Draw the texture if we're using it
if ( m_pStunTexture != NULL )
{
bool foundVar;
IMaterialVar* pBaseTextureVar = pMaterial->FindVar( "$basetexture", &foundVar, false );
if ( bResetBaseFrame )
{
// Save off this pass
Rect_t srcRect;
srcRect.x = x;
srcRect.y = y;
srcRect.width = w;
srcRect.height = h;
pBaseTextureVar->SetTextureValue( m_pStunTexture );
materials->CopyRenderTargetToTextureEx( m_pStunTexture, 0, &srcRect, NULL );
materials->SetFrameBufferCopyTexture( m_pStunTexture );
m_bUpdated = false;
}
byte overlaycolor[4] = { 255, 255, 255, 0 };
float flEffectPerc = ( m_flFinishTime - gpGlobals->curtime ) / m_flDuration;
overlaycolor[3] = (byte) (150.0f * flEffectPerc);
render->ViewDrawFade( overlaycolor, pMaterial );
float viewOffs = ( flEffectPerc * 32.0f ) * cos( gpGlobals->curtime * 10.0f * cos( gpGlobals->curtime * 2.0f ) );
float vX = x + viewOffs;
float vY = y;
// just do one pass for dxlevel < 80.
if (g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80)
{
materials->DrawScreenSpaceRectangle( pMaterial, vX, vY, w, h,
0, 0, m_pStunTexture->GetActualWidth()-1, m_pStunTexture->GetActualHeight()-1,
m_pStunTexture->GetActualWidth(), m_pStunTexture->GetActualHeight() );
render->ViewDrawFade( overlaycolor, pMaterial );
materials->DrawScreenSpaceRectangle( pMaterial, x, y, w, h,
0, 0, m_pStunTexture->GetActualWidth()-1, m_pStunTexture->GetActualHeight()-1,
m_pStunTexture->GetActualWidth(), m_pStunTexture->GetActualHeight() );
}
// Save off this pass
Rect_t srcRect;
srcRect.x = x;
srcRect.y = y;
srcRect.width = w;
srcRect.height = h;
pBaseTextureVar->SetTextureValue( m_pStunTexture );
materials->CopyRenderTargetToTextureEx( m_pStunTexture, 0, &srcRect, NULL );
}
// Restore our state
materials->MatrixMode( MATERIAL_VIEW );
materials->PopMatrix();
materials->MatrixMode( MATERIAL_PROJECTION );
materials->PopMatrix();
}
// ================================================================================================================
//
// Ep 1. Intro blur
//
// ================================================================================================================
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEP1IntroEffect::Init( void )
{
m_pStunTexture = NULL;
m_flDuration = 0.0f;
m_flFinishTime = 0.0f;
m_bUpdateView = true;
m_bFadeOut = false;
}
//------------------------------------------------------------------------------
// Purpose: Pick up changes in our parameters
//------------------------------------------------------------------------------
void CEP1IntroEffect::SetParameters( KeyValues *params )
{
if( params->FindKey( "duration" ) )
{
m_flDuration = params->GetFloat( "duration" );
m_flFinishTime = gpGlobals->curtime + m_flDuration;
}
if( params->FindKey( "fadeout" ) )
{
m_bFadeOut = ( params->GetInt( "fadeout" ) == 1 );
}
}
//-----------------------------------------------------------------------------
// Purpose: Get the alpha value depending on various factors and time
//-----------------------------------------------------------------------------
inline unsigned char CEP1IntroEffect::GetFadeAlpha( void )
{
// Find our percentage between fully "on" and "off" in the pulse range
float flEffectPerc = ( m_flDuration == 0.0f ) ? 0.0f : ( m_flFinishTime - gpGlobals->curtime ) / m_flDuration;
flEffectPerc = clamp( flEffectPerc, 0.0f, 1.0f );
if ( m_bFadeOut )
{
// HDR requires us to be more subtle, or we get uber-brightening
if ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE )
return (unsigned char) clamp( 50.0f * flEffectPerc, 0.0f, 50.0f );
// Non-HDR
return (unsigned char) clamp( 64.0f * flEffectPerc, 0.0f, 64.0f );
}
else
{
// HDR requires us to be more subtle, or we get uber-brightening
if ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE )
return (unsigned char) clamp( 64.0f * flEffectPerc, 50.0f, 64.0f );
// Non-HDR
return (unsigned char) clamp( 128.0f * flEffectPerc, 64.0f, 128.0f );
}
}
//-----------------------------------------------------------------------------
// Purpose: Render the effect
//-----------------------------------------------------------------------------
void CEP1IntroEffect::Render( int x, int y, int w, int h )
{
if ( ( m_flFinishTime == 0 ) || ( IsEnabled() == false ) )
return;
IMaterial *pMaterial = materials->FindMaterial( "effects/introblur", TEXTURE_GROUP_CLIENT_EFFECTS, true );
if ( pMaterial == NULL )
return;
// Set ourselves to the proper rendermode
materials->MatrixMode( MATERIAL_VIEW );
materials->PushMatrix();
materials->LoadIdentity();
materials->MatrixMode( MATERIAL_PROJECTION );
materials->PushMatrix();
materials->LoadIdentity();
// Get our current view
if ( m_pStunTexture == NULL )
{
m_pStunTexture = GetWaterRefractionTexture();
}
// Draw the texture if we're using it
if ( m_pStunTexture != NULL )
{
bool foundVar;
IMaterialVar* pBaseTextureVar = pMaterial->FindVar( "$basetexture", &foundVar, false );
if ( m_bUpdateView )
{
// Save off this pass
Rect_t srcRect;
srcRect.x = x;
srcRect.y = y;
srcRect.width = w;
srcRect.height = h;
pBaseTextureVar->SetTextureValue( m_pStunTexture );
materials->CopyRenderTargetToTextureEx( m_pStunTexture, 0, &srcRect, NULL );
materials->SetFrameBufferCopyTexture( m_pStunTexture );
m_bUpdateView = false;
}
byte overlaycolor[4] = { 255, 255, 255, 0 };
// Get our fade value depending on our fade duration
overlaycolor[3] = GetFadeAlpha();
// Disable overself if we're done fading out
if ( m_bFadeOut && overlaycolor[3] == 0 )
{
// Takes effect next frame (we don't want to hose our matrix stacks here)
g_pScreenSpaceEffects->DisableScreenSpaceEffect( "episodic_intro" );
m_bUpdateView = true;
}
// Calculate some wavey noise to jitter the view by
float vX = 2.0f * -fabs( cosf( gpGlobals->curtime ) * cosf( gpGlobals->curtime * 6.0 ) );
float vY = 2.0f * cosf( gpGlobals->curtime ) * cosf( gpGlobals->curtime * 5.0 );
// Scale percentage
float flScalePerc = 0.02f + ( 0.01f * cosf( gpGlobals->curtime * 2.0f ) * cosf( gpGlobals->curtime * 0.5f ) );
// Scaled offsets for the UVs (as texels)
float flUOffset = ( m_pStunTexture->GetActualWidth() - 1 ) * flScalePerc * 0.5f;
float flVOffset = ( m_pStunTexture->GetActualHeight() - 1 ) * flScalePerc * 0.5f;
// New UVs with scaling offsets
float flU1 = flUOffset;
float flU2 = ( m_pStunTexture->GetActualWidth() - 1 ) - flUOffset;
float flV1 = flVOffset;
float flV2 = ( m_pStunTexture->GetActualHeight() - 1 ) - flVOffset;
// Draw the "zoomed" overlay
materials->DrawScreenSpaceRectangle( pMaterial, vX, vY, w, h,
flU1, flV1,
flU2, flV2,
m_pStunTexture->GetActualWidth(), m_pStunTexture->GetActualHeight() );
render->ViewDrawFade( overlaycolor, pMaterial );
// Save off this pass
Rect_t srcRect;
srcRect.x = x;
srcRect.y = y;
srcRect.width = w;
srcRect.height = h;
pBaseTextureVar->SetTextureValue( m_pStunTexture );
materials->CopyRenderTargetToTextureEx( m_pStunTexture, 0, &srcRect, NULL );
}
// Restore our state
materials->MatrixMode( MATERIAL_VIEW );
materials->PopMatrix();
materials->MatrixMode( MATERIAL_PROJECTION );
materials->PopMatrix();
}

View File

@@ -1,78 +0,0 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef EPISODIC_SCREENSPACEEFFECTS_H
#define EPISODIC_SCREENSPACEEFFECTS_H
#ifdef _WIN32
#pragma once
#endif
#include "screenspaceeffects.h"
class CStunEffect : public IScreenSpaceEffect
{
public:
CStunEffect( void ) :
m_pStunTexture( NULL ),
m_flDuration( 0.0f ),
m_flFinishTime( 0.0f ),
m_bUpdated( false ) {}
virtual void Init( void );
virtual void Shutdown( void ) {}
virtual void SetParameters( KeyValues *params );
virtual void Enable( bool bEnable ) {};
virtual bool IsEnabled( ) { return true; }
virtual void Render( int x, int y, int w, int h );
private:
ITexture *m_pStunTexture;
float m_flDuration;
float m_flFinishTime;
bool m_bUpdated;
};
ADD_SCREENSPACE_EFFECT( CStunEffect, episodic_stun );
//
// EP1 Intro Blur
//
class CEP1IntroEffect : public IScreenSpaceEffect
{
public:
CEP1IntroEffect( void ) :
m_pStunTexture( NULL ),
m_flDuration( 0.0f ),
m_flFinishTime( 0.0f ),
m_bUpdateView( true ),
m_bEnabled( false ),
m_bFadeOut( false ) {}
virtual void Init( void );
virtual void Shutdown( void ) {}
virtual void SetParameters( KeyValues *params );
virtual void Enable( bool bEnable ) { m_bEnabled = bEnable; }
virtual bool IsEnabled( ) { return m_bEnabled; }
virtual void Render( int x, int y, int w, int h );
private:
inline unsigned char GetFadeAlpha( void );
ITexture *m_pStunTexture;
float m_flDuration;
float m_flFinishTime;
bool m_bUpdateView;
bool m_bEnabled;
bool m_bFadeOut;
};
ADD_SCREENSPACE_EFFECT( CEP1IntroEffect, episodic_intro );
#endif // EPISODIC_SCREENSPACEEFFECTS_H

View File

@@ -1,111 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "FX_Fleck.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//
// CFleckParticles
//
CSmartPtr<CFleckParticles> CFleckParticles::Create( const char *pDebugName, const Vector &vCenter )
{
CFleckParticles *pRet = new CFleckParticles( pDebugName );
if ( pRet )
{
// Set its bbox once so it doesn't update 500 times as the flecks fly outwards.
Vector vDims( 5, 5, 5 );
pRet->GetBinding().SetBBox( vCenter - vDims, vCenter + vDims );
}
return pRet;
}
//-----------------------------------------------------------------------------
// Purpose: Test for surrounding collision surfaces for quick collision testing for the particle system
// Input : &origin - starting position
// *dir - direction of movement (if NULL, will do a point emission test in four directions)
// angularSpread - looseness of the spread
// minSpeed - minimum speed
// maxSpeed - maximum speed
// gravity - particle gravity for the sytem
// dampen - dampening amount on collisions
// flags - extra information
//-----------------------------------------------------------------------------
void CFleckParticles::Setup( const Vector &origin, const Vector *direction, float angularSpread, float minSpeed, float maxSpeed, float gravity, float dampen, int flags )
{
//See if we've specified a direction
m_ParticleCollision.Setup( origin, direction, angularSpread, minSpeed, maxSpeed, gravity, dampen );
}
void CFleckParticles::RenderParticles( CParticleRenderIterator *pIterator )
{
const FleckParticle *pParticle = (const FleckParticle*)pIterator->GetFirst();
while ( pParticle )
{
Vector tPos;
TransformParticle( ParticleMgr()->GetModelView(), pParticle->m_Pos, tPos );
float sortKey = (int) tPos.z;
Vector color;
color[0] = pParticle->m_uchColor[0] / 255.0f;
color[1] = pParticle->m_uchColor[1] / 255.0f;
color[2] = pParticle->m_uchColor[2] / 255.0f;
//Render it
RenderParticle_ColorSizeAngle(
pIterator->GetParticleDraw(),
tPos,
color,
1.0f - (pParticle->m_flLifetime / pParticle->m_flDieTime),
pParticle->m_uchSize,
pParticle->m_flRoll );
pParticle = (const FleckParticle*)pIterator->GetNext( sortKey );
}
}
void CFleckParticles::SimulateParticles( CParticleSimulateIterator *pIterator )
{
FleckParticle *pParticle = (FleckParticle*)pIterator->GetFirst();
while ( pParticle )
{
const float timeDelta = pIterator->GetTimeDelta();
//Should this particle die?
pParticle->m_flLifetime += timeDelta;
if ( pParticle->m_flLifetime >= pParticle->m_flDieTime )
{
pIterator->RemoveParticle( pParticle );
}
else
{
pParticle->m_flRoll += pParticle->m_flRollDelta * timeDelta;
//Simulate the movement with collision
trace_t trace;
m_ParticleCollision.MoveParticle( pParticle->m_Pos, pParticle->m_vecVelocity, &pParticle->m_flRollDelta, timeDelta, &trace );
// If we're in solid, then stop moving
if ( trace.allsolid )
{
pParticle->m_vecVelocity = vec3_origin;
pParticle->m_flRollDelta = 0.0f;
}
}
pParticle = (FleckParticle*)pIterator->GetNext();
}
}

View File

@@ -1,117 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "hudelement.h"
#include "hud_numericdisplay.h"
#include <vgui_controls/Panel.h>
#include "cbase.h"
#include "hud.h"
#include "hud_suitpower.h"
#include "hud_macros.h"
#include "iclientmode.h"
#include <vgui_controls/AnimationController.h>
#include <vgui/ISurface.h>
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Purpose: Shows the flashlight icon
//-----------------------------------------------------------------------------
class CHudFlashlight : public CHudElement, public vgui::Panel
{
DECLARE_CLASS_SIMPLE( CHudFlashlight, vgui::Panel );
public:
CHudFlashlight( const char *pElementName );
virtual void Init( void );
void SetFlashlightState( bool flashlightOn );
protected:
virtual void Paint();
private:
CPanelAnimationVar( vgui::HFont, m_hTextFont, "TextFont", "Default" );
CPanelAnimationVar( Color, m_TextColor, "TextColor", "FgColor" );
CPanelAnimationVarAliasType( float, text_xpos, "text_xpos", "8", "proportional_float" );
CPanelAnimationVarAliasType( float, text_ypos, "text_ypos", "20", "proportional_float" );
bool m_bFlashlightOn;
};
using namespace vgui;
//!! flashlight disabled for now, indicator moved into hud_suitpower
//!! if that is successful this file can be just removed
// DECLARE_HUDELEMENT( CHudFlashlight, HudFlashlight );
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CHudFlashlight::CHudFlashlight( const char *pElementName ) : CHudElement( pElementName ), BaseClass( NULL, "HudFlashlight" )
{
vgui::Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent );
m_bFlashlightOn = true;
SetHiddenBits( HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD | HIDEHUD_NEEDSUIT );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudFlashlight::Init()
{
}
//-----------------------------------------------------------------------------
// Purpose: data accessor
//-----------------------------------------------------------------------------
void CHudFlashlight::SetFlashlightState( bool flashlightOn )
{
if ( m_bFlashlightOn == flashlightOn )
return;
if ( flashlightOn )
{
// flashlight on
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("SuitFlashlightOn");
}
else
{
// flashlight off
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("SuitFlashlightOff");
}
m_bFlashlightOn = flashlightOn;
}
//-----------------------------------------------------------------------------
// Purpose: draws the flashlight icon
//-----------------------------------------------------------------------------
void CHudFlashlight::Paint()
{
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
if ( !pPlayer )
return;
SetFlashlightState( pPlayer->IsEffectActive( EF_DIMLIGHT ) );
// draw our name
wchar_t *text = L"FLASHLIGHT: ON";
if (!m_bFlashlightOn)
{
text = L"FLASHLIGHT: OFF";
}
surface()->DrawSetTextFont(m_hTextFont);
surface()->DrawSetTextColor(m_TextColor);
surface()->DrawSetTextPos(text_xpos, text_ypos);
surface()->DrawUnicodeString( text );
}

View File

@@ -1,459 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "hl2mp_hud_chat.h"
#include "hud_macros.h"
#include "text_message.h"
#include "vguicenterprint.h"
#include "vgui/ILocalize.h"
#include "c_team.h"
#include "c_playerresource.h"
#include "c_hl2mp_player.h"
#include "hl2mp_gamerules.h"
ConVar cl_showtextmsg( "cl_showtextmsg", "1", 0, "Enable/disable text messages printing on the screen." );
float g_ColorBlue[3] = { 153, 204, 255 };
float g_ColorRed[3] = { 255, 63.75, 63.75 };
float g_ColorGreen[3] = { 153, 255, 153 };
float g_ColorYellow[3] = { 255, 178.5, 0.0 };
float g_ColorGrey[3] = { 204, 204, 204 };
float *GetClientColor( int clientIndex )
{
if ( clientIndex == 0 ) // console msg
{
return g_ColorYellow;
}
else if( g_PR )
{
switch ( g_PR->GetTeam( clientIndex ) )
{
case TEAM_COMBINE : return g_ColorBlue;
case TEAM_REBELS : return g_ColorRed;
default : return g_ColorYellow;
}
}
return g_ColorYellow;
}
// converts all '\r' characters to '\n', so that the engine can deal with the properly
// returns a pointer to str
static char* ConvertCRtoNL( char *str )
{
for ( char *ch = str; *ch != 0; ch++ )
if ( *ch == '\r' )
*ch = '\n';
return str;
}
// converts all '\r' characters to '\n', so that the engine can deal with the properly
// returns a pointer to str
static wchar_t* ConvertCRtoNL( wchar_t *str )
{
for ( wchar_t *ch = str; *ch != 0; ch++ )
if ( *ch == L'\r' )
*ch = L'\n';
return str;
}
static void StripEndNewlineFromString( char *str )
{
int s = strlen( str ) - 1;
if ( s >= 0 )
{
if ( str[s] == '\n' || str[s] == '\r' )
str[s] = 0;
}
}
static void StripEndNewlineFromString( wchar_t *str )
{
int s = wcslen( str ) - 1;
if ( s >= 0 )
{
if ( str[s] == L'\n' || str[s] == L'\r' )
str[s] = 0;
}
}
DECLARE_HUDELEMENT( CHudChat );
DECLARE_HUD_MESSAGE( CHudChat, SayText );
DECLARE_HUD_MESSAGE( CHudChat, TextMsg );
//=====================
//CHudChatLine
//=====================
void CHudChatLine::ApplySchemeSettings(vgui::IScheme *pScheme)
{
BaseClass::ApplySchemeSettings( pScheme );
m_hFont = pScheme->GetFont( "ChatFont" );
SetBorder( NULL );
SetBgColor( Color( 0, 0, 0, 0 ) );
SetFgColor( Color( 0, 0, 0, 0 ) );
SetFont( m_hFont );
}
void CHudChatLine::PerformFadeout( void )
{
// Flash + Extra bright when new
float curtime = gpGlobals->curtime;
int lr = m_clrText[0];
int lg = m_clrText[1];
int lb = m_clrText[2];
//CSPort chat only fades out, no blinking.
if ( curtime <= m_flExpireTime && curtime > m_flExpireTime - CHATLINE_FADE_TIME )
{
float frac = ( m_flExpireTime - curtime ) / CHATLINE_FADE_TIME;
int alpha = frac * 255;
alpha = clamp( alpha, 0, 255 );
wchar_t wbuf[4096];
GetText(0, wbuf, sizeof(wbuf));
SetText( "" );
if ( m_iNameLength > 0 )
{
wchar_t wText[4096];
// draw the first x characters in the player color
wcsncpy( wText, wbuf, min( m_iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
wText[ min( m_iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
m_clrNameColor[3] = alpha;
InsertColorChange( m_clrNameColor );
InsertString( wText );
wcsncpy( wText, wbuf + ( m_iNameLength ), wcslen( wbuf + m_iNameLength ) );
wText[ wcslen( wbuf + m_iNameLength ) ] = '\0';
InsertColorChange( Color( g_ColorYellow[0], g_ColorYellow[1], g_ColorYellow[2], alpha ) );
InsertString( wText );
InvalidateLayout( true );
}
else
{
InsertColorChange( Color( lr, lg, lb, alpha ) );
InsertString( wbuf );
}
}
OnThink();
}
//=====================
//CHudChatInputLine
//=====================
void CHudChatInputLine::ApplySchemeSettings(vgui::IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
vgui::HFont hFont = pScheme->GetFont( "ChatFont" );
m_pPrompt->SetFont( hFont );
m_pInput->SetFont( hFont );
m_pInput->SetFgColor( pScheme->GetColor( "Chat.TypingText", pScheme->GetColor( "Panel.FgColor", Color( 255, 255, 255, 255 ) ) ) );
m_pInput->SetBgColor( Color( 255, 255, 255, 0 ) );
}
//=====================
//CHudChat
//=====================
CHudChat::CHudChat( const char *pElementName ) : BaseClass( pElementName )
{
}
void CHudChat::CreateChatInputLine( void )
{
m_pChatInput = new CHudChatInputLine( this, "ChatInputLine" );
m_pChatInput->SetVisible( false );
}
void CHudChat::CreateChatLines( void )
{
for ( int i = 0; i < CHAT_INTERFACE_LINES; i++ )
{
char sz[ 32 ];
Q_snprintf( sz, sizeof( sz ), "ChatLine%02i", i );
m_ChatLines[ i ] = new CHudChatLine( this, sz );
m_ChatLines[ i ]->SetVisible( false );
}
}
void CHudChat::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
SetBgColor( Color( 0, 0, 0, 0 ) );
SetFgColor( Color( 0, 0, 0, 0 ) );
}
void CHudChat::Init( void )
{
BaseClass::Init();
// HOOK_HUD_MESSAGE( CHudChat, RadioText );
HOOK_HUD_MESSAGE( CHudChat, SayText );
HOOK_HUD_MESSAGE( CHudChat, TextMsg );
}
//-----------------------------------------------------------------------------
// Purpose: Overrides base reset to not cancel chat at round restart
//-----------------------------------------------------------------------------
void CHudChat::Reset( void )
{
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pszName -
// iSize -
// *pbuf -
//-----------------------------------------------------------------------------
void CHudChat::MsgFunc_SayText( bf_read &msg )
{
char szString[256];
int client = msg.ReadByte();
msg.ReadString( szString, sizeof(szString) );
bool bWantsToChat = msg.ReadByte();
// flash speaking player dot
// if ( client > 0 )
// Radar_FlashPlayer( client );
if ( bWantsToChat )
{
// print raw chat text
ChatPrintf( client, "%s", szString );
}
else
{
// try to lookup translated string
Printf( "%s", hudtextmessage->LookupString( szString ) );
}
Msg( "%s", szString );
}
// Message handler for text messages
// displays a string, looking them up from the titles.txt file, which can be localised
// parameters:
// byte: message direction ( HUD_PRINTCONSOLE, HUD_PRINTNOTIFY, HUD_PRINTCENTER, HUD_PRINTTALK )
// string: message
// optional parameters:
// string: message parameter 1
// string: message parameter 2
// string: message parameter 3
// string: message parameter 4
// any string that starts with the character '#' is a message name, and is used to look up the real message in titles.txt
// the next (optional) one to four strings are parameters for that string (which can also be message names if they begin with '#')
void CHudChat::MsgFunc_TextMsg( bf_read &msg )
{
char szString[2048];
int msg_dest = msg.ReadByte();
wchar_t szBuf[5][128];
wchar_t outputBuf[256];
for ( int i=0; i<5; ++i )
{
msg.ReadString( szString, sizeof(szString) );
char *tmpStr = hudtextmessage->LookupString( szString, &msg_dest );
const wchar_t *pBuf = vgui::localize()->Find( tmpStr );
if ( pBuf )
{
// Copy pBuf into szBuf[i].
int nMaxChars = sizeof( szBuf[i] ) / sizeof( wchar_t );
wcsncpy( szBuf[i], pBuf, nMaxChars );
szBuf[i][nMaxChars-1] = 0;
}
else
{
if ( i )
{
StripEndNewlineFromString( tmpStr ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
}
vgui::localize()->ConvertANSIToUnicode( tmpStr, szBuf[i], sizeof(szBuf[i]) );
}
}
if ( !cl_showtextmsg.GetInt() )
return;
int len;
switch ( msg_dest )
{
case HUD_PRINTCENTER:
vgui::localize()->ConstructString( outputBuf, sizeof(outputBuf), szBuf[0], 4, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
internalCenterPrint->Print( ConvertCRtoNL( outputBuf ) );
break;
case HUD_PRINTNOTIFY:
szString[0] = 1; // mark this message to go into the notify buffer
vgui::localize()->ConstructString( outputBuf, sizeof(outputBuf), szBuf[0], 4, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
vgui::localize()->ConvertUnicodeToANSI( outputBuf, szString+1, sizeof(szString)-1 );
len = strlen( szString );
if ( len && szString[len-1] != '\n' && szString[len-1] != '\r' )
{
Q_strncat( szString, "\n", sizeof(szString), 1 );
}
Msg( "%s", ConvertCRtoNL( szString ) );
break;
case HUD_PRINTTALK:
vgui::localize()->ConstructString( outputBuf, sizeof(outputBuf), szBuf[0], 4, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
vgui::localize()->ConvertUnicodeToANSI( outputBuf, szString, sizeof(szString) );
len = strlen( szString );
if ( len && szString[len-1] != '\n' && szString[len-1] != '\r' )
{
Q_strncat( szString, "\n", sizeof(szString), 1 );
}
Printf( "%s", ConvertCRtoNL( szString ) );
break;
case HUD_PRINTCONSOLE:
vgui::localize()->ConstructString( outputBuf, sizeof(outputBuf), szBuf[0], 4, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
vgui::localize()->ConvertUnicodeToANSI( outputBuf, szString, sizeof(szString) );
len = strlen( szString );
if ( len && szString[len-1] != '\n' && szString[len-1] != '\r' )
{
Q_strncat( szString, "\n", sizeof(szString), 1 );
}
Msg( "%s", ConvertCRtoNL( szString ) );
break;
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *fmt -
// ... -
//-----------------------------------------------------------------------------
void CHudChat::ChatPrintf( int iPlayerIndex, const char *fmt, ... )
{
va_list marker;
char msg[4096];
va_start(marker, fmt);
Q_vsnprintf(msg, sizeof( msg), fmt, marker);
va_end(marker);
// Strip any trailing '\n'
if ( strlen( msg ) > 0 && msg[ strlen( msg )-1 ] == '\n' )
{
msg[ strlen( msg ) - 1 ] = 0;
}
// Strip leading \n characters ( or notify/color signifiers )
char *pmsg = msg;
while ( *pmsg && ( *pmsg == '\n' || *pmsg == 1 || *pmsg == 2 ) )
{
pmsg++;
}
if ( !*pmsg )
return;
CHudChatLine *line = (CHudChatLine *)FindUnusedChatLine();
if ( !line )
{
ExpireOldest();
line = (CHudChatLine *)FindUnusedChatLine();
}
if ( !line )
{
return;
}
line->SetText( "" );
int iNameLength = 0;
player_info_t sPlayerInfo;
if ( iPlayerIndex == 0 )
{
Q_memset( &sPlayerInfo, 0, sizeof(player_info_t) );
Q_strncpy( sPlayerInfo.name, "Console", sizeof(sPlayerInfo.name) );
}
else
{
engine->GetPlayerInfo( iPlayerIndex, &sPlayerInfo );
}
const char *pName = sPlayerInfo.name;
if ( pName )
{
const char *nameInString = strstr( pmsg, pName );
if ( nameInString )
{
iNameLength = strlen( pName ) + (nameInString - pmsg);
}
}
else
line->InsertColorChange( Color( g_ColorYellow[0], g_ColorYellow[1], g_ColorYellow[2], 255 ) );
char *buf = static_cast<char *>( _alloca( strlen( pmsg ) + 1 ) );
wchar_t *wbuf = static_cast<wchar_t *>( _alloca( (strlen( pmsg ) + 1 ) * sizeof(wchar_t) ) );
if ( buf )
{
float *flColor = GetClientColor( iPlayerIndex );
line->SetExpireTime();
// draw the first x characters in the player color
Q_strncpy( buf, pmsg, min( iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
buf[ min( iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
line->InsertColorChange( Color( flColor[0], flColor[1], flColor[2], 255 ) );
line->InsertString( buf );
Q_strncpy( buf, pmsg + iNameLength, strlen( pmsg ));
buf[ strlen( pmsg + iNameLength ) ] = '\0';
line->InsertColorChange( Color( g_ColorYellow[0], g_ColorYellow[1], g_ColorYellow[2], 255 ) );
vgui::localize()->ConvertANSIToUnicode( buf, wbuf, strlen(pmsg)*sizeof(wchar_t));
line->InsertString( wbuf );
line->SetVisible( true );
line->SetNameLength( iNameLength );
line->SetNameColor( Color( flColor[0], flColor[1], flColor[2], 255 ) );
}
CLocalPlayerFilter filter;
C_BaseEntity::EmitSound( filter, -1 /*SOUND_FROM_LOCAL_PLAYER*/, "HudChat.Message" );
}
int CHudChat::GetChatInputOffset( void )
{
if ( m_pChatInput->IsVisible() )
{
return m_iFontHeight;
}
else
return 0;
}

View File

@@ -1,646 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "hud.h"
#include "hl2mpClientScoreBoard.h"
#include "c_team.h"
#include "c_playerresource.h"
#include "c_hl2mp_player.h"
#include "hl2mp_gamerules.h"
#include <KeyValues.h>
#include <vgui/IScheme.h>
#include <vgui/ILocalize.h>
#include <vgui/ISurface.h>
#include <vgui/IVgui.h>
#include <vgui_controls/SectionedListPanel.h>
#include "voice_status.h"
using namespace vgui;
#define TEAM_MAXCOUNT 5
// id's of sections used in the scoreboard
enum EScoreboardSections
{
SCORESECTION_COMBINE = 1,
SCORESECTION_REBELS = 2,
SCORESECTION_FREEFORALL = 3,
SCORESECTION_SPECTATOR = 4
};
const int NumSegments = 7;
static int coord[NumSegments+1] = {
0,
1,
2,
3,
4,
6,
9,
10
};
//-----------------------------------------------------------------------------
// Purpose: Konstructor
//-----------------------------------------------------------------------------
CHL2MPClientScoreBoardDialog::CHL2MPClientScoreBoardDialog(IViewPort *pViewPort):CClientScoreBoardDialog(pViewPort)
{
}
//-----------------------------------------------------------------------------
// Purpose: Destructor
//-----------------------------------------------------------------------------
CHL2MPClientScoreBoardDialog::~CHL2MPClientScoreBoardDialog()
{
}
//-----------------------------------------------------------------------------
// Purpose: Paint background for rounded corners
//-----------------------------------------------------------------------------
void CHL2MPClientScoreBoardDialog::PaintBackground()
{
m_pPlayerList->SetBgColor( Color(0, 0, 0, 0) );
m_pPlayerList->SetBorder(NULL);
int x1, x2, y1, y2;
surface()->DrawSetColor(m_bgColor);
surface()->DrawSetTextColor(m_bgColor);
int wide, tall;
GetSize( wide, tall );
int i;
// top-left corner --------------------------------------------------------
int xDir = 1;
int yDir = -1;
int xIndex = 0;
int yIndex = NumSegments - 1;
int xMult = 1;
int yMult = 1;
int x = 0;
int y = 0;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = y + coord[NumSegments];
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
}
// top-right corner -------------------------------------------------------
xDir = 1;
yDir = -1;
xIndex = 0;
yIndex = NumSegments - 1;
x = wide;
y = 0;
xMult = -1;
yMult = 1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = y + coord[NumSegments];
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
}
// bottom-right corner ----------------------------------------------------
xDir = 1;
yDir = -1;
xIndex = 0;
yIndex = NumSegments - 1;
x = wide;
y = tall;
xMult = -1;
yMult = -1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = y - coord[NumSegments];
y2 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
}
// bottom-left corner -----------------------------------------------------
xDir = 1;
yDir = -1;
xIndex = 0;
yIndex = NumSegments - 1;
x = 0;
y = tall;
xMult = 1;
yMult = -1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = y - coord[NumSegments];
y2 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
}
// paint between top left and bottom left ---------------------------------
x1 = 0;
x2 = coord[NumSegments];
y1 = coord[NumSegments];
y2 = tall - coord[NumSegments];
surface()->DrawFilledRect( x1, y1, x2, y2 );
// paint between left and right -------------------------------------------
x1 = coord[NumSegments];
x2 = wide - coord[NumSegments];
y1 = 0;
y2 = tall;
surface()->DrawFilledRect( x1, y1, x2, y2 );
// paint between top right and bottom right -------------------------------
x1 = wide - coord[NumSegments];
x2 = wide;
y1 = coord[NumSegments];
y2 = tall - coord[NumSegments];
surface()->DrawFilledRect( x1, y1, x2, y2 );
}
//-----------------------------------------------------------------------------
// Purpose: Paint border for rounded corners
//-----------------------------------------------------------------------------
void CHL2MPClientScoreBoardDialog::PaintBorder()
{
int x1, x2, y1, y2;
surface()->DrawSetColor(m_borderColor);
surface()->DrawSetTextColor(m_borderColor);
int wide, tall;
GetSize( wide, tall );
int i;
// top-left corner --------------------------------------------------------
int xDir = 1;
int yDir = -1;
int xIndex = 0;
int yIndex = NumSegments - 1;
int xMult = 1;
int yMult = 1;
int x = 0;
int y = 0;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
}
// top-right corner -------------------------------------------------------
xDir = 1;
yDir = -1;
xIndex = 0;
yIndex = NumSegments - 1;
x = wide;
y = 0;
xMult = -1;
yMult = 1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
}
// bottom-right corner ----------------------------------------------------
xDir = 1;
yDir = -1;
xIndex = 0;
yIndex = NumSegments - 1;
x = wide;
y = tall;
xMult = -1;
yMult = -1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
}
// bottom-left corner -----------------------------------------------------
xDir = 1;
yDir = -1;
xIndex = 0;
yIndex = NumSegments - 1;
x = 0;
y = tall;
xMult = 1;
yMult = -1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
}
// top --------------------------------------------------------------------
x1 = coord[NumSegments];
x2 = wide - coord[NumSegments];
y1 = 0;
y2 = 1;
surface()->DrawFilledRect( x1, y1, x2, y2 );
// bottom -----------------------------------------------------------------
x1 = coord[NumSegments];
x2 = wide - coord[NumSegments];
y1 = tall - 1;
y2 = tall;
surface()->DrawFilledRect( x1, y1, x2, y2 );
// left -------------------------------------------------------------------
x1 = 0;
x2 = 1;
y1 = coord[NumSegments];
y2 = tall - coord[NumSegments];
surface()->DrawFilledRect( x1, y1, x2, y2 );
// right ------------------------------------------------------------------
x1 = wide - 1;
x2 = wide;
y1 = coord[NumSegments];
y2 = tall - coord[NumSegments];
surface()->DrawFilledRect( x1, y1, x2, y2 );
}
//-----------------------------------------------------------------------------
// Purpose: Apply scheme settings
//-----------------------------------------------------------------------------
void CHL2MPClientScoreBoardDialog::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
m_bgColor = GetSchemeColor("SectionedListPanel.BgColor", GetBgColor(), pScheme);
m_borderColor = pScheme->GetColor( "FgColor", Color( 0, 0, 0, 0 ) );
SetBgColor( Color(0, 0, 0, 0) );
SetBorder( pScheme->GetBorder( "BaseBorder" ) );
}
//-----------------------------------------------------------------------------
// Purpose: sets up base sections
//-----------------------------------------------------------------------------
void CHL2MPClientScoreBoardDialog::InitScoreboardSections()
{
m_pPlayerList->SetBgColor( Color(0, 0, 0, 0) );
m_pPlayerList->SetBorder(NULL);
// fill out the structure of the scoreboard
AddHeader();
if ( HL2MPRules()->IsTeamplay() )
{
// add the team sections
AddSection( TYPE_TEAM, TEAM_COMBINE );
AddSection( TYPE_TEAM, TEAM_REBELS );
}
else
{
AddSection( TYPE_TEAM, TEAM_UNASSIGNED );
}
AddSection( TYPE_TEAM, TEAM_SPECTATOR );
}
//-----------------------------------------------------------------------------
// Purpose: resets the scoreboard team info
//-----------------------------------------------------------------------------
void CHL2MPClientScoreBoardDialog::UpdateTeamInfo()
{
if ( g_PR == NULL )
return;
int iNumPlayersInGame = 0;
for ( int j = 1; j <= gpGlobals->maxClients; j++ )
{
if ( g_PR->IsConnected( j ) )
{
iNumPlayersInGame++;
}
}
// update the team sections in the scoreboard
for ( int i = TEAM_SPECTATOR; i < TEAM_MAXCOUNT; i++ )
{
wchar_t *teamName = NULL;
int sectionID = 0;
C_Team *team = GetGlobalTeam(i);
if ( team )
{
sectionID = GetSectionFromTeamNumber( i );
// update team name
wchar_t name[64];
wchar_t string1[1024];
wchar_t wNumPlayers[6];
if ( HL2MPRules()->IsTeamplay() == false )
{
_snwprintf(wNumPlayers, 6, L"%i", iNumPlayersInGame );
_snwprintf( name, sizeof(name), L"%s", localize()->Find("#ScoreBoard_Deathmatch") );
teamName = name;
if ( iNumPlayersInGame == 1)
{
localize()->ConstructString( string1, sizeof(string1), localize()->Find("#ScoreBoard_Player"), 2, teamName, wNumPlayers );
}
else
{
localize()->ConstructString( string1, sizeof(string1), localize()->Find("#ScoreBoard_Players"), 2, teamName, wNumPlayers );
}
}
else
{
_snwprintf(wNumPlayers, 6, L"%i", team->Get_Number_Players());
if (!teamName && team)
{
localize()->ConvertANSIToUnicode(team->Get_Name(), name, sizeof(name));
teamName = name;
}
if (team->Get_Number_Players() == 1)
{
localize()->ConstructString( string1, sizeof(string1), localize()->Find("#ScoreBoard_Player"), 2, teamName, wNumPlayers );
}
else
{
localize()->ConstructString( string1, sizeof(string1), localize()->Find("#ScoreBoard_Players"), 2, teamName, wNumPlayers );
}
// update stats
wchar_t val[6];
swprintf(val, L"%d", team->Get_Score());
m_pPlayerList->ModifyColumn(sectionID, "frags", val);
if (team->Get_Ping() < 1)
{
m_pPlayerList->ModifyColumn(sectionID, "ping", L"");
}
else
{
swprintf(val, L"%d", team->Get_Ping());
m_pPlayerList->ModifyColumn(sectionID, "ping", val);
}
}
m_pPlayerList->ModifyColumn(sectionID, "name", string1);
}
}
}
//-----------------------------------------------------------------------------
// Purpose: adds the top header of the scoreboars
//-----------------------------------------------------------------------------
void CHL2MPClientScoreBoardDialog::AddHeader()
{
// add the top header
m_pPlayerList->AddSection(0, "");
m_pPlayerList->SetSectionAlwaysVisible(0);
m_pPlayerList->AddColumnToSection(0, "name", "", 0, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_NAME_WIDTH ) );
m_pPlayerList->AddColumnToSection(0, "class", "", 0, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_CLASS_WIDTH ) );
m_pPlayerList->AddColumnToSection(0, "frags", "#PlayerScore", 0 | SectionedListPanel::COLUMN_RIGHT, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_SCORE_WIDTH ) );
m_pPlayerList->AddColumnToSection(0, "deaths", "#PlayerDeath", 0 | SectionedListPanel::COLUMN_RIGHT, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_DEATH_WIDTH ) );
m_pPlayerList->AddColumnToSection(0, "ping", "#PlayerPing", 0 | SectionedListPanel::COLUMN_RIGHT, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_PING_WIDTH ) );
// m_pPlayerList->AddColumnToSection(0, "voice", "#PlayerVoice", SectionedListPanel::COLUMN_IMAGE | SectionedListPanel::HEADER_TEXT| SectionedListPanel::COLUMN_CENTER, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_VOICE_WIDTH ) );
// m_pPlayerList->AddColumnToSection(0, "tracker", "#PlayerTracker", SectionedListPanel::COLUMN_IMAGE | SectionedListPanel::HEADER_TEXT, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_FRIENDS_WIDTH ) );
}
//-----------------------------------------------------------------------------
// Purpose: Adds a new section to the scoreboard (i.e the team header)
//-----------------------------------------------------------------------------
void CHL2MPClientScoreBoardDialog::AddSection(int teamType, int teamNumber)
{
int sectionID = GetSectionFromTeamNumber( teamNumber );
if ( teamType == TYPE_TEAM )
{
m_pPlayerList->AddSection(sectionID, "", StaticPlayerSortFunc);
// setup the columns
m_pPlayerList->AddColumnToSection(sectionID, "name", "", 0, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_NAME_WIDTH ) );
m_pPlayerList->AddColumnToSection(sectionID, "class", "" , 0, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_CLASS_WIDTH ) );
m_pPlayerList->AddColumnToSection(sectionID, "frags", "", SectionedListPanel::COLUMN_RIGHT, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_SCORE_WIDTH ) );
m_pPlayerList->AddColumnToSection(sectionID, "deaths", "", SectionedListPanel::COLUMN_RIGHT, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_DEATH_WIDTH ) );
m_pPlayerList->AddColumnToSection(sectionID, "ping", "", SectionedListPanel::COLUMN_RIGHT, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_PING_WIDTH ) );
// set the section to have the team color
if ( teamNumber )
{
if ( GameResources() )
m_pPlayerList->SetSectionFgColor(sectionID, GameResources()->GetTeamColor(teamNumber));
}
m_pPlayerList->SetSectionAlwaysVisible(sectionID);
}
else if ( teamType == TYPE_SPECTATORS )
{
m_pPlayerList->AddSection(sectionID, "");
m_pPlayerList->AddColumnToSection(sectionID, "name", "#Spectators", 0, scheme()->GetProportionalScaledValueEx( GetScheme(), CSTRIKE_NAME_WIDTH ));
m_pPlayerList->AddColumnToSection(sectionID, "class", "" , 0, scheme()->GetProportionalScaledValueEx( GetScheme(), 100 ) );
}
}
int CHL2MPClientScoreBoardDialog::GetSectionFromTeamNumber( int teamNumber )
{
switch ( teamNumber )
{
case TEAM_COMBINE:
return SCORESECTION_COMBINE;
case TEAM_REBELS:
return SCORESECTION_REBELS;
case TEAM_SPECTATOR:
return SCORESECTION_SPECTATOR;
default:
return SCORESECTION_FREEFORALL;
}
return SCORESECTION_FREEFORALL;
}
//-----------------------------------------------------------------------------
// Purpose: Adds a new row to the scoreboard, from the playerinfo structure
//-----------------------------------------------------------------------------
bool CHL2MPClientScoreBoardDialog::GetPlayerScoreInfo(int playerIndex, KeyValues *kv)
{
kv->SetInt("playerIndex", playerIndex);
kv->SetInt("team", g_PR->GetTeam( playerIndex ) );
kv->SetString("name", g_PR->GetPlayerName(playerIndex) );
kv->SetInt("deaths", g_PR->GetDeaths( playerIndex ));
kv->SetInt("frags", g_PR->GetPlayerScore( playerIndex ));
kv->SetString("class", "");
if (g_PR->GetPing( playerIndex ) < 1)
{
if ( g_PR->IsFakePlayer( playerIndex ) )
{
kv->SetString("ping", "BOT");
}
else
{
kv->SetString("ping", "");
}
}
else
{
kv->SetInt("ping", g_PR->GetPing( playerIndex ));
}
return true;
}
enum {
MAX_PLAYERS_PER_TEAM = 16,
MAX_SCOREBOARD_PLAYERS = 32
};
struct PlayerScoreInfo
{
int index;
int frags;
int deaths;
bool important;
bool alive;
};
int PlayerScoreInfoSort( const PlayerScoreInfo *p1, const PlayerScoreInfo *p2 )
{
// check local
if ( p1->important )
return -1;
if ( p2->important )
return 1;
// check alive
if ( p1->alive && !p2->alive )
return -1;
if ( p2->alive && !p1->alive )
return 1;
// check frags
if ( p1->frags > p2->frags )
return -1;
if ( p2->frags > p1->frags )
return 1;
// check deaths
if ( p1->deaths < p2->deaths )
return -1;
if ( p2->deaths < p1->deaths )
return 1;
// check index
if ( p1->index < p2->index )
return -1;
return 1;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHL2MPClientScoreBoardDialog::UpdatePlayerInfo()
{
m_iSectionId = 0; // 0'th row is a header
int selectedRow = -1;
int i;
CBasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
if ( !pPlayer || !g_PR )
return;
// walk all the players and make sure they're in the scoreboard
for ( i = 1; i <= gpGlobals->maxClients; i++ )
{
bool shouldShow = g_PR->IsConnected( i );
if ( shouldShow )
{
// add the player to the list
KeyValues *playerData = new KeyValues("data");
GetPlayerScoreInfo( i, playerData );
int itemID = FindItemIDForPlayerIndex( i );
int sectionID = GetSectionFromTeamNumber( g_PR->GetTeam( i ) );
if (itemID == -1)
{
// add a new row
itemID = m_pPlayerList->AddItem( sectionID, playerData );
}
else
{
// modify the current row
m_pPlayerList->ModifyItem( itemID, sectionID, playerData );
}
if ( i == pPlayer->entindex() )
{
selectedRow = itemID; // this is the local player, hilight this row
}
// set the row color based on the players team
m_pPlayerList->SetItemFgColor( itemID, g_PR->GetTeamColor( g_PR->GetTeam( i ) ) );
playerData->deleteThis();
}
else
{
// remove the player
int itemID = FindItemIDForPlayerIndex( i );
if (itemID != -1)
{
m_pPlayerList->RemoveItem(itemID);
}
}
}
if ( selectedRow != -1 )
{
m_pPlayerList->SetSelectedItem(selectedRow);
}
}

View File

@@ -1,966 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "hud_basechat.h"
#include <vgui/IScheme.h>
#include <vgui/IVGui.h>
#include "iclientmode.h"
#include "hud_macros.h"
#include "engine/IEngineSound.h"
#include "text_message.h"
#include <vgui/ILocalize.h>
#include "vguicenterprint.h"
#include "vgui/keycode.h"
#include <KeyValues.h>
#include "ienginevgui.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define CHAT_WIDTH_PERCENTAGE 0.6f
#ifndef _XBOX
ConVar hud_saytext_time( "hud_saytext_time", "12", 0 );
//-----------------------------------------------------------------------------
// Purpose:
// Input : *parent -
// *panelName -
//-----------------------------------------------------------------------------
CBaseHudChatLine::CBaseHudChatLine( vgui::Panel *parent, const char *panelName ) :
vgui::RichText( parent, panelName )
{
m_hFont = m_hFontMarlett = 0;
m_flExpireTime = 0.0f;
m_flStartTime = 0.0f;
m_iNameLength = 0;
SetPaintBackgroundEnabled( true );
SetVerticalScrollbar( false );
}
void CBaseHudChatLine::ApplySchemeSettings(vgui::IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
m_hFont = pScheme->GetFont( "Default" );
#ifdef HL1_CLIENT_DLL
SetBgColor( Color( 0, 0, 0, 0 ) );
SetFgColor( Color( 0, 0, 0, 0 ) );
SetBorder( NULL );
#else
SetBgColor( Color( 0, 0, 0, 100 ) );
#endif
m_hFontMarlett = pScheme->GetFont( "Marlett" );
m_clrText = pScheme->GetColor( "FgColor", GetFgColor() );
SetFont( m_hFont );
}
void CBaseHudChatLine::PerformFadeout( void )
{
// Flash + Extra bright when new
float curtime = gpGlobals->curtime;
int lr = m_clrText[0];
int lg = m_clrText[1];
int lb = m_clrText[2];
if ( curtime >= m_flStartTime && curtime < m_flStartTime + CHATLINE_FLASH_TIME )
{
float frac1 = ( curtime - m_flStartTime ) / CHATLINE_FLASH_TIME;
float frac = frac1;
frac *= CHATLINE_NUM_FLASHES;
frac *= 2 * M_PI;
frac = cos( frac );
frac = clamp( frac, 0.0f, 1.0f );
frac *= (1.0f-frac1);
int r = lr, g = lg, b = lb;
r = r + ( 255 - r ) * frac;
g = g + ( 255 - g ) * frac;
b = b + ( 255 - b ) * frac;
// Draw a right facing triangle in red, faded out over time
int alpha = 63 + 192 * (1.0f - frac1 );
alpha = clamp( alpha, 0, 255 );
wchar_t wbuf[4096];
GetText(0, wbuf, sizeof(wbuf));
SetText( "" );
InsertColorChange( Color( r, g, b, 255 ) );
InsertString( wbuf );
}
else if ( curtime <= m_flExpireTime && curtime > m_flExpireTime - CHATLINE_FADE_TIME )
{
float frac = ( m_flExpireTime - curtime ) / CHATLINE_FADE_TIME;
int alpha = frac * 255;
alpha = clamp( alpha, 0, 255 );
wchar_t wbuf[4096];
GetText(0, wbuf, sizeof(wbuf));
SetText( "" );
InsertColorChange( Color( lr * frac, lg * frac, lb * frac, alpha ) );
InsertString( wbuf );
}
else
{
wchar_t wbuf[4096];
GetText(0, wbuf, sizeof(wbuf));
SetText( "" );
InsertColorChange( Color( lr, lg, lb, 255 ) );
InsertString( wbuf );
}
OnThink();
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : time -
//-----------------------------------------------------------------------------
void CBaseHudChatLine::SetExpireTime( void )
{
m_flStartTime = gpGlobals->curtime;
m_flExpireTime = m_flStartTime + hud_saytext_time.GetFloat();
m_nCount = CBaseHudChat::m_nLineCounter++;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int CBaseHudChatLine::GetCount( void )
{
return m_nCount;
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CBaseHudChatLine::IsReadyToExpire( void )
{
// Engine disconnected, expire right away
if ( !engine->IsInGame() && !engine->IsConnected() )
return true;
if ( gpGlobals->curtime >= m_flExpireTime )
return true;
return false;
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : float
//-----------------------------------------------------------------------------
float CBaseHudChatLine::GetStartTime( void )
{
return m_flStartTime;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseHudChatLine::Expire( void )
{
SetVisible( false );
// Spit out label text now
// char text[ 256 ];
// GetText( text, 256 );
// Msg( "%s\n", text );
}
#endif _XBOX
//-----------------------------------------------------------------------------
// Purpose: The prompt and text entry area for chat messages
//-----------------------------------------------------------------------------
#ifndef _XBOX
CBaseHudChatInputLine::CBaseHudChatInputLine( CBaseHudChat *parent, char const *panelName ) :
vgui::Panel( parent, panelName )
{
SetMouseInputEnabled( false );
m_pPrompt = new vgui::Label( this, "ChatInputPrompt", L"Enter text:" );
m_pInput = new CBaseHudChatEntry( this, "ChatInput", parent );
m_pInput->SetMaximumCharCount( 127 );
}
void CBaseHudChatInputLine::ApplySchemeSettings(vgui::IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
// FIXME: Outline
vgui::HFont hFont = pScheme->GetFont( "Trebuchet18" );
m_pPrompt->SetFont( hFont );
m_pInput->SetFont( hFont );
SetPaintBackgroundEnabled( false );
m_pPrompt->SetPaintBackgroundEnabled( false );
m_pPrompt->SetContentAlignment( vgui::Label::a_west );
m_pPrompt->SetTextInset( 2, 0 );
#ifdef HL1_CLIENT_DLL
m_pInput->SetBgColor( Color( 255, 255, 255, 0 ) );
#else
m_pInput->SetFgColor( GetFgColor() );
m_pInput->SetBgColor( GetBgColor() );
#endif
}
void CBaseHudChatInputLine::SetPrompt( const wchar_t *prompt )
{
Assert( m_pPrompt );
m_pPrompt->SetText( prompt );
InvalidateLayout();
}
void CBaseHudChatInputLine::ClearEntry( void )
{
Assert( m_pInput );
SetEntry( L"" );
}
void CBaseHudChatInputLine::SetEntry( const wchar_t *entry )
{
Assert( m_pInput );
Assert( entry );
m_pInput->SetText( entry );
}
void CBaseHudChatInputLine::GetMessageText( wchar_t *buffer, int buffersizebytes )
{
m_pInput->GetText( buffer, buffersizebytes);
}
void CBaseHudChatInputLine::PerformLayout()
{
BaseClass::PerformLayout();
int wide, tall;
GetSize( wide, tall );
int w,h;
m_pPrompt->GetContentSize( w, h);
m_pPrompt->SetBounds( 0, 0, w, tall );
m_pInput->SetBounds( w + 2, 0, wide - w - 2 , tall );
}
vgui::Panel *CBaseHudChatInputLine::GetInputPanel( void )
{
return m_pInput;
}
#endif //_XBOX
int CBaseHudChat::m_nLineCounter = 1;
//-----------------------------------------------------------------------------
// Purpose: Text chat input/output hud element
//-----------------------------------------------------------------------------
CBaseHudChat::CBaseHudChat( const char *pElementName )
: CHudElement( pElementName ), BaseClass( NULL, "HudChat" )
{
vgui::Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent );
vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ClientScheme.res", "ClientScheme");
SetScheme(scheme);
m_nMessageMode = 0;
CBaseHudChatLine *line = m_ChatLines[ 0 ];
if ( line )
{
vgui::HFont font = line->GetFont();
m_iFontHeight = vgui::surface()->GetFontTall( font ) + 2;
// Put input area at bottom
int w, h;
GetSize( w, h );
m_pChatInput->SetBounds( 1, h - m_iFontHeight - 1, w-2, m_iFontHeight );
}
if ( IsPC() )
{
vgui::ivgui()->AddTickSignal( GetVPanel() );
}
// (We don't actually want input until they bring up the chat line).
MakePopup();
SetZPos( -30 );
SetHiddenBits( HIDEHUD_CHAT );
}
CBaseHudChat::~CBaseHudChat()
{
if ( IsXbox() )
return;
gameeventmanager->RemoveListener( this );
}
void CBaseHudChat::CreateChatInputLine( void )
{
#ifndef _XBOX
m_pChatInput = new CBaseHudChatInputLine( this, "ChatInputLine" );
m_pChatInput->SetVisible( false );
#endif
}
void CBaseHudChat::CreateChatLines( void )
{
#ifndef _XBOX
for ( int i = 0; i < CHAT_INTERFACE_LINES; i++ )
{
char sz[ 32 ];
Q_snprintf( sz, sizeof( sz ), "ChatLine%02i", i );
m_ChatLines[ i ] = new CBaseHudChatLine( this, sz );
m_ChatLines[ i ]->SetVisible( false );
}
#endif
}
void CBaseHudChat::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
SetPaintBackgroundEnabled( false );
SetKeyBoardInputEnabled( false );
SetMouseInputEnabled( false );
m_nVisibleHeight = 0;
// Put input area at bottom
if ( m_pChatInput )
{
int w, h;
GetSize( w, h );
m_pChatInput->SetBounds( 1, h - m_iFontHeight - 1, w-2, m_iFontHeight );
}
#ifdef HL1_CLIENT_DLL
SetBgColor( Color( 0, 0, 0, 0 ) );
SetFgColor( Color( 0, 0, 0, 0 ) );
#else
SetBgColor( Color( 0, 0, 0, 100 ) );
#endif
}
void CBaseHudChat::Reset( void )
{
#ifndef HL1_CLIENT_DLL
m_nVisibleHeight = 0;
Clear();
#endif
}
#ifdef _XBOX
bool CBaseHudChat::ShouldDraw()
{
// never think, never draw
return false;
}
#endif
void CBaseHudChat::Paint( void )
{
#ifndef _XBOX
if ( m_nVisibleHeight == 0 )
return;
int w, h;
GetSize( w, h );
vgui::surface()->DrawSetColor( GetBgColor() );
vgui::surface()->DrawFilledRect( 0, h - m_nVisibleHeight, w, h );
vgui::surface()->DrawSetColor( GetFgColor() );
vgui::surface()->DrawOutlinedRect( 0, h - m_nVisibleHeight, w, h );
#endif
}
void CBaseHudChat::Init( void )
{
if ( IsXbox() )
return;
CreateChatInputLine();
CreateChatLines();
gameeventmanager->AddListener( this, "hltv_chat", false );
}
#ifndef _XBOX
static int __cdecl SortLines( void const *line1, void const *line2 )
{
CBaseHudChatLine *l1 = *( CBaseHudChatLine ** )line1;
CBaseHudChatLine *l2 = *( CBaseHudChatLine ** )line2;
// Invisible at bottom
if ( l1->IsVisible() && !l2->IsVisible() )
return -1;
else if ( !l1->IsVisible() && l2->IsVisible() )
return 1;
// Oldest start time at top
if ( l1->GetStartTime() < l2->GetStartTime() )
return -1;
else if ( l1->GetStartTime() > l2->GetStartTime() )
return 1;
// Otherwise, compare counter
if ( l1->GetCount() < l2->GetCount() )
return -1;
else if ( l1->GetCount() > l2->GetCount() )
return 1;
return 0;
}
#endif
//-----------------------------------------------------------------------------
// Purpose: Allow inheriting classes to change this spacing behavior
//-----------------------------------------------------------------------------
int CBaseHudChat::GetChatInputOffset( void )
{
return m_iFontHeight;
}
//-----------------------------------------------------------------------------
// Purpose: Do respositioning here to avoid latency due to repositioning of vgui
// voice manager icon panel
//-----------------------------------------------------------------------------
void CBaseHudChat::OnTick( void )
{
#ifndef _XBOX
int i;
for ( i = 0; i < CHAT_INTERFACE_LINES; i++ )
{
CBaseHudChatLine *line = m_ChatLines[ i ];
if ( !line )
continue;
if ( !line->IsVisible() )
continue;
if ( !line->IsReadyToExpire() )
continue;
line->Expire();
}
int w, h;
GetSize( w, h );
CBaseHudChatLine *line = m_ChatLines[ 0 ];
if ( line )
{
vgui::HFont font = line->GetFont();
if ( font )
{
m_iFontHeight = vgui::surface()->GetFontTall( font ) + 2;
// Put input area at bottom
int w, h;
GetSize( w, h );
m_pChatInput->SetBounds( 1, h - m_iFontHeight - 1, w-2, m_iFontHeight );
}
}
// Sort chat lines
qsort( m_ChatLines, CHAT_INTERFACE_LINES, sizeof( CBaseHudChatLine * ), SortLines );
// Step backward from bottom
int currentY = h - m_iFontHeight - 1;
int startY = currentY;
int ystep = m_iFontHeight;
currentY -= GetChatInputOffset();
// Walk backward
for ( i = CHAT_INTERFACE_LINES - 1; i >= 0 ; i-- )
{
CBaseHudChatLine *line = m_ChatLines[ i ];
if ( !line )
continue;
if ( !line->IsVisible() )
{
line->SetSize( w, m_iFontHeight );
continue;
}
line->PerformFadeout();
line->SetSize( w, m_iFontHeight * line->GetNumLines() );
line->SetPos( 0, ( currentY+m_iFontHeight) - m_iFontHeight * line->GetNumLines() );
currentY -= ystep * line->GetNumLines();
}
if ( currentY != startY )
{
m_nVisibleHeight = startY - currentY + 2;
}
else
{
m_nVisibleHeight = 0;
}
vgui::surface()->MovePopupToBack( GetVPanel() );
#endif
}
// Release build is crashing on long strings...sigh
#pragma optimize( "", off )
//-----------------------------------------------------------------------------
// Purpose:
// Input : width -
// *text -
// textlen -
// Output : int
//-----------------------------------------------------------------------------
int CBaseHudChat::ComputeBreakChar( int width, const char *text, int textlen )
{
#ifndef _XBOX
CBaseHudChatLine *line = m_ChatLines[ 0 ];
vgui::HFont font = line->GetFont();
int currentlen = 0;
int lastbreak = textlen;
for (int i = 0; i < textlen ; i++)
{
char ch = text[i];
if ( ch <= 32 )
{
lastbreak = i;
}
wchar_t wch[2];
vgui::localize()->ConvertANSIToUnicode( &ch, wch, sizeof( wch ) );
int a,b,c;
vgui::surface()->GetCharABCwide(font, wch[0], a, b, c);
currentlen += a + b + c;
if ( currentlen >= width )
{
// If we haven't found a whitespace char to break on before getting
// to the end, but it's still too long, break on the character just before
// this one
if ( lastbreak == textlen )
{
lastbreak = max( 0, i - 1 );
}
break;
}
}
if ( currentlen >= width )
{
return lastbreak;
}
return textlen;
#else
return 0;
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *fmt -
// ... -
//-----------------------------------------------------------------------------
void CBaseHudChat::Printf( const char *fmt, ... )
{
#ifndef _XBOX
// No chat text in single player
if ( gpGlobals->maxClients == 1 )
{
return;
}
va_list marker;
char msg[4096];
const char *pTranslatedFmt = hudtextmessage->LookupString(fmt);
va_start(marker, fmt);
Q_vsnprintf( msg, sizeof( msg ), pTranslatedFmt, marker );
va_end(marker);
// Strip any trailing '\n'
if ( strlen( msg ) > 0 && msg[ strlen( msg )-1 ] == '\n' )
{
msg[ strlen( msg ) - 1 ] = 0;
}
// Strip leading \n characters ( or notify/color signifiers )
char *pmsg = msg;
while ( *pmsg && ( *pmsg == '\n' || *pmsg == 1 || *pmsg == 2 ) )
{
pmsg++;
}
if ( !*pmsg )
return;
// Search for return characters
char *pos = strstr( pmsg, "\n" );
if ( pos )
{
char msgcopy[ 8192 ];
Q_strncpy( msgcopy, pmsg, sizeof( msgcopy ) );
int offset = pos - pmsg;
// Terminate first part
msgcopy[ offset ] = 0;
// Print first part
#if defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo
Printf( "%s", msgcopy );
// Print remainder
Printf( "%s", &msgcopy[ offset ] + 1 );
#else
Printf( msgcopy );
// Print remainder
Printf( &msgcopy[ offset ] + 1 );
#endif
return;
}
CBaseHudChatLine *firstline = m_ChatLines[ 0 ];
int len = strlen( pmsg );
// Check for string too long and split into multiple lines
//
int breakpos = ComputeBreakChar( firstline->GetWide() - 10, pmsg, len );
if ( breakpos > 0 && breakpos < len )
{
char msgcopy[ 8192 ];
Q_strncpy( msgcopy, pmsg, sizeof( msgcopy ) );
int offset = breakpos;
char savechar;
savechar = msgcopy[ offset ];
// Terminate first part
msgcopy[ offset ] = 0;
// Print first part
#if defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo
Printf( "%s", msgcopy );
#else
Printf( msgcopy );
#endif
// Was breakpos a printable char?
if ( savechar > 32 )
{
msgcopy[ offset ] = savechar;
// Print remainder
#if defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo
Printf( "%s", &msgcopy[ offset ] );
#else
Printf( &msgcopy[ offset ] );
#endif
}
else
{
#if defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo
Printf( "%s", &msgcopy[ offset ] + 1 );
#else
Printf( &msgcopy[ offset ] + 1 );
#endif
}
return;
}
CBaseHudChatLine *line = FindUnusedChatLine();
if ( !line )
{
ExpireOldest();
line = FindUnusedChatLine();
}
if ( !line )
{
return;
}
line->SetText( "" );
line->InsertColorChange( line->GetTextColor() );
line->SetExpireTime();
line->InsertString( pmsg );
line->SetVisible( true );
line->SetNameLength( 0 );
CLocalPlayerFilter filter;
C_BaseEntity::EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, "HudChat.Message" );
#endif
}
#pragma optimize( "", on )
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseHudChat::StartMessageMode( int iMessageModeType )
{
#ifndef _XBOX
m_nMessageMode = iMessageModeType;
m_pChatInput->ClearEntry();
if ( m_nMessageMode == MM_SAY )
{
m_pChatInput->SetPrompt( L"Say :" );
}
else
{
m_pChatInput->SetPrompt( L"Say (TEAM) :" );
}
vgui::SETUP_PANEL( this );
SetKeyBoardInputEnabled( true );
m_pChatInput->SetVisible( true );
vgui::surface()->CalculateMouseVisible();
m_pChatInput->RequestFocus();
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseHudChat::StopMessageMode( void )
{
#ifndef _XBOX
SetKeyBoardInputEnabled( false );
m_pChatInput->SetVisible( false );
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : CBaseHudChatLine
//-----------------------------------------------------------------------------
CBaseHudChatLine *CBaseHudChat::FindUnusedChatLine( void )
{
#ifndef _XBOX
for ( int i = 0; i < CHAT_INTERFACE_LINES; i++ )
{
CBaseHudChatLine *line = m_ChatLines[ i ];
if ( !line )
continue;
if ( line->IsVisible() )
continue;
return line;
}
return NULL;
#else
return NULL;
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseHudChat::ExpireOldest( void )
{
#ifndef _XBOX
float oldestTime = 100000000.0f;
CBaseHudChatLine *oldest = NULL;
for ( int i = 0; i < CHAT_INTERFACE_LINES; i++ )
{
CBaseHudChatLine *line = m_ChatLines[ i ];
if ( !line )
continue;
if ( !line->IsVisible() )
continue;
if ( !oldest )
{
oldest = line;
oldestTime = line->GetStartTime();
continue;
}
if ( line->GetStartTime() < oldestTime )
{
oldest = line;
oldestTime = line->GetStartTime();
}
}
if ( !oldest )
{
oldest = m_ChatLines[ 0 ];
}
oldest->Expire();
#endif
}
void CBaseHudChat::Send( void )
{
#ifndef _XBOX
wchar_t szTextbuf[128];
m_pChatInput->GetMessageText( szTextbuf, sizeof( szTextbuf ) );
char ansi[128];
vgui::localize()->ConvertUnicodeToANSI( szTextbuf, ansi, sizeof( ansi ) );
int len = Q_strlen(ansi);
/*
This is a very long string that I am going to attempt to paste into the cs hud chat entry and we will see if it gets cropped or not.
*/
// remove the \n
if ( len > 0 &&
ansi[ len - 1 ] == '\n' )
{
ansi[ len - 1 ] = '\0';
}
if( len > 0 )
{
char szbuf[144]; // more than 128
Q_snprintf( szbuf, sizeof(szbuf), "%s \"%s\"", m_nMessageMode == MM_SAY ? "say" : "say_team", ansi );
engine->ClientCmd(szbuf);
}
m_pChatInput->ClearEntry();
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : vgui::Panel
//-----------------------------------------------------------------------------
vgui::Panel *CBaseHudChat::GetInputPanel( void )
{
#ifndef _XBOX
return m_pChatInput->GetInputPanel();
#else
return NULL;
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseHudChat::Clear( void )
{
#ifndef _XBOX
// Kill input prompt
StopMessageMode();
// Expire all messages
for ( int i = 0; i < CHAT_INTERFACE_LINES; i++ )
{
CBaseHudChatLine *line = m_ChatLines[ i ];
if ( !line )
continue;
if ( !line->IsVisible() )
continue;
line->Expire();
}
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *newmap -
//-----------------------------------------------------------------------------
void CBaseHudChat::LevelInit( const char *newmap )
{
Clear();
}
void CBaseHudChat::LevelShutdown( void )
{
Clear();
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *fmt -
// ... -
//-----------------------------------------------------------------------------
void CBaseHudChat::ChatPrintf( int iPlayerIndex, const char *fmt, ... )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseHudChat::FireGameEvent( IGameEvent *event )
{
#ifndef _XBOX
const char *eventname = event->GetName();
if ( Q_strcmp( "hltv_chat", eventname ) == 0 )
{
C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
if ( !player )
return;
ChatPrintf( player->entindex(), "(SourceTV) %s", event->GetString( "text" ) );
}
#endif
}

View File

@@ -1,384 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "hud.h"
#include "hudelement.h"
#include "hud_macros.h"
#include "iclientmode.h"
#include "vgui_controls/AnimationController.h"
#include "vgui_controls/Label.h"
#include "vgui/ILocalize.h"
#include "vgui/ISurface.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Purpose: Displays current ammunition level
//-----------------------------------------------------------------------------
class CHudHintDisplay : public vgui::Panel, public CHudElement
{
DECLARE_CLASS_SIMPLE( CHudHintDisplay, vgui::Panel );
public:
CHudHintDisplay( const char *pElementName );
void Init();
void Reset();
void MsgFunc_HintText( bf_read &msg );
bool ShouldDraw();
bool SetHintText( const char *text );
protected:
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void OnThink();
private:
CUtlVector<vgui::Label *> m_Labels;
vgui::HFont m_hSmallFont, m_hLargeFont;
char m_szHintText[128];
int m_iBaseY;
CPanelAnimationVarAliasType( float, m_iTextX, "text_xpos", "8", "proportional_float" );
CPanelAnimationVarAliasType( float, m_iTextY, "text_ypos", "8", "proportional_float" );
CPanelAnimationVarAliasType( float, m_iTextGapX, "text_xgap", "8", "proportional_float" );
CPanelAnimationVarAliasType( float, m_iTextGapY, "text_ygap", "8", "proportional_float" );
CPanelAnimationVarAliasType( float, m_iYOffset, "YOffset", "0", "proportional_float" );
};
DECLARE_HUDELEMENT( CHudHintDisplay );
DECLARE_HUD_MESSAGE( CHudHintDisplay, HintText );
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CHudHintDisplay::CHudHintDisplay( const char *pElementName ) : BaseClass(NULL, "HudHintDisplay"), CHudElement( pElementName )
{
vgui::Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent );
SetVisible( false );
m_szHintText[0] = 0;
SetAlpha( 0 );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudHintDisplay::Init()
{
HOOK_HUD_MESSAGE( CHudHintDisplay, HintText );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudHintDisplay::Reset()
{
SetHintText( NULL );
SetAlpha( 0 );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudHintDisplay::ApplySchemeSettings( vgui::IScheme *pScheme )
{
m_hSmallFont = pScheme->GetFont( "HudHintTextSmall", true );
m_hLargeFont = pScheme->GetFont( "HudHintTextLarge", true );
BaseClass::ApplySchemeSettings( pScheme );
}
//-----------------------------------------------------------------------------
// Purpose: Save CPU cycles by letting the HUD system early cull
// costly traversal. Called per frame, return true if thinking and
// painting need to occur.
//-----------------------------------------------------------------------------
bool CHudHintDisplay::ShouldDraw( void )
{
return ( ( GetAlpha() > 0 ) && CHudElement::ShouldDraw() );
}
//-----------------------------------------------------------------------------
// Purpose: Updates the label color each frame
//-----------------------------------------------------------------------------
void CHudHintDisplay::OnThink()
{
for (int i = 0; i < m_Labels.Count(); i++)
{
if ( IsXbox() && 0 != ( i & 1 ) )
{
// Don't change the fg color for buttons (even numbered labels)
m_Labels[i]->SetAlpha( GetFgColor().a() );
}
else
{
m_Labels[i]->SetFgColor(GetFgColor());
}
}
int ox, oy;
GetPos(ox, oy);
SetPos( ox, m_iBaseY + m_iYOffset );
}
//-----------------------------------------------------------------------------
// Purpose: Sets the hint text, replacing variables as necessary
//-----------------------------------------------------------------------------
bool CHudHintDisplay::SetHintText( const char *text )
{
// clear the existing text
for (int i = 0; i < m_Labels.Count(); i++)
{
m_Labels[i]->MarkForDeletion();
}
m_Labels.RemoveAll();
if ( !text )
{
m_szHintText[0] = 0;
return false;
}
strcpy( m_szHintText, text );
// look up the text string
wchar_t *ws = vgui::localize()->Find( text );
if ( !ws || wcslen(ws) <= 0)
return false;
// parse out the text into a label set
while ( *ws )
{
wchar_t token[64];
bool isVar = false;
// check for variables
if ( *ws == '%' )
{
isVar = true;
++ws;
}
// parse out the string
wchar_t *end = wcschr( ws, '%' );
if ( end )
{
wcsncpy( token, ws, end - ws );
token[end - ws] = 0;
}
else
{
wcscpy( token, ws );
}
ws += wcslen( token );
if ( isVar )
{
// move over the end of the variable
++ws;
}
// put it in a label
vgui::Label *label = vgui::SETUP_PANEL(new vgui::Label(this, NULL, token));
bool bIsBitmap = false;
// modify the label if necessary
if ( isVar )
{
label->SetFont( m_hLargeFont );
// lookup key names
char binding[64];
vgui::localize()->ConvertUnicodeToANSI( token, binding, sizeof(binding) );
const char *key = engine->Key_LookupBinding( *binding == '+' ? binding + 1 : binding );
if ( !key )
{
key = "< not bound >";
}
//!! change some key names into better names
char friendlyName[64];
Q_snprintf( friendlyName, sizeof(friendlyName), "#%s", key );
Q_strupr( friendlyName );
// set the variable text - key may need to be localized (button images for example)
wchar_t *locName = vgui::localize()->Find( friendlyName );
if ( !locName || wcslen(locName) <= 0)
{
label->SetText( friendlyName + 1 );
}
else
{
// Assuming localized vars must be using a bitmap image. *May* not be the case, but since
// keyboard bindings have never been locaized in the past, they probably won't in the future either.
bIsBitmap = true;
label->SetText( locName );
}
}
else
{
label->SetFont( m_hSmallFont );
}
label->SetPaintBackgroundEnabled( false );
label->SetPaintBorderEnabled( false );
label->SizeToContents();
label->SetContentAlignment( vgui::Label::a_west );
if ( bIsBitmap && isVar )
{
// Don't change the color of the button art
label->SetFgColor( Color(255,255,255,255) );
}
else
{
label->SetFgColor( GetFgColor() );
}
m_Labels.AddToTail( vgui::SETUP_PANEL(label) );
}
// find the bounds we need to show
int widest1 = 0, widest2 = 0;
for (int i = 0; i < m_Labels.Count(); i++)
{
vgui::Label *label = m_Labels[i];
if (i & 1)
{
// help text
if (label->GetWide() > widest2)
{
widest2 = label->GetWide();
}
}
else
{
// variable
if (label->GetWide() > widest1)
{
widest1 = label->GetWide();
}
}
}
int tallest1 = 0, tallest2 = 0;
for (int i = 0; i < m_Labels.Count(); i++)
{
vgui::Label *label = m_Labels[i];
if (i & 1)
{
// help text
if (label->GetTall() > tallest2)
{
tallest2 = label->GetTall();
}
}
else
{
// variable
if (label->GetTall() > tallest1)
{
tallest1 = label->GetTall();
}
}
}
int tallest = max( tallest1, tallest2 );
// position the labels
int col1_x = m_iTextX;
int col2_x = m_iTextX + widest1 + m_iTextGapX;
int col_y = m_iTextY;
// Difference between the variable and the help text
int col_y_extra = ( (tallest1 - tallest2) / 2 );
if ( col_y_extra < 0 )
{
// text is taller than the variable (multi-line text).
// Push the variable's y down by subtracting the negative value.
col_y -= col_y_extra;
}
for (int i = 0; i < m_Labels.Count(); i++)
{
vgui::Label *label = m_Labels[i];
if (i & 1)
{
label->SetPos( col2_x, col_y + col_y_extra );
col_y += tallest;
col_y += m_iTextGapY;
}
else
{
// variable
label->SetPos( col1_x, col_y );
}
}
// move ourselves relative to our start position
int newWide = col2_x + widest2 + m_iTextX;
int newTall = col_y;
int ox, oy;
GetPos(ox, oy);
if (IsRightAligned())
{
int oldWide = GetWide();
int diff = newWide - oldWide;
ox -= diff;
}
if (IsBottomAligned())
{
int oldTall = GetTall();
int diff = newTall - oldTall;
oy -= diff;
}
// set the size of the hint panel to fit
SetPos( ox, oy );
SetSize( newWide, newTall );
m_iBaseY = oy;
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Activates the hint display
//-----------------------------------------------------------------------------
void CHudHintDisplay::MsgFunc_HintText( bf_read &msg )
{
// how many strings do we receive ?
int count = msg.ReadByte();
// here we expect only one string
if ( count != 1 )
{
DevMsg("CHudHintDisplay::MsgFunc_HintText: string count != 1.\n");
return;
}
// read the string
char szString[2048];
msg.ReadString( szString, sizeof(szString) );
// make it visible
if ( SetHintText( szString ) )
{
SetVisible( true );
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "HintMessageShow" );
}
else
{
// it's being cleared, hide the panel
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "HintMessageHide" );
}
}

View File

@@ -1,720 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "hud.h"
#include "kbutton.h"
#include "input.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-------------------------------------------------- Constants
#define CAM_DIST_DELTA 1.0
#define CAM_ANGLE_DELTA 2.5
#define CAM_ANGLE_SPEED 2.5
#define CAM_MIN_DIST 30.0
#define CAM_ANGLE_MOVE .5
#define MAX_ANGLE_DIFF 10.0
#define PITCH_MAX 90.0
#define PITCH_MIN 0
#define YAW_MAX 135.0
#define YAW_MIN -135.0
//-------------------------------------------------- Global Variables
static ConVar cam_command( "cam_command", "0", FCVAR_CHEAT ); // tells camera to go to thirdperson
static ConVar cam_snapto( "cam_snapto", "0", FCVAR_ARCHIVE ); // snap to thirdperson view
static ConVar cam_idealyaw( "cam_idealyaw", "90", FCVAR_ARCHIVE ); // thirdperson yaw
static ConVar cam_idealpitch( "cam_idealpitch", "0", FCVAR_ARCHIVE ); // thirperson pitch
static ConVar cam_idealdist( "cam_idealdist", "64", FCVAR_ARCHIVE ); // thirdperson distance
static ConVar c_maxpitch( "c_maxpitch", "90", FCVAR_ARCHIVE );
static ConVar c_minpitch( "c_minpitch", "0", FCVAR_ARCHIVE );
static ConVar c_maxyaw( "c_maxyaw", "135", FCVAR_ARCHIVE );
static ConVar c_minyaw( "c_minyaw", "-135", FCVAR_ARCHIVE );
static ConVar c_maxdistance( "c_maxdistance", "200", FCVAR_ARCHIVE );
static ConVar c_mindistance( "c_mindistance", "30", FCVAR_ARCHIVE );
static ConVar c_orthowidth( "c_orthowidth", "100", FCVAR_ARCHIVE );
static ConVar c_orthoheight( "c_orthoheight", "100", FCVAR_ARCHIVE );
static kbutton_t cam_pitchup, cam_pitchdown, cam_yawleft, cam_yawright;
static kbutton_t cam_in, cam_out, cam_move;
extern const ConVar *sv_cheats;
// API Wrappers
/*
==============================
CAM_ToThirdPerson
==============================
*/
void CAM_ToThirdPerson(void)
{
input->CAM_ToThirdPerson();
}
/*
==============================
CAM_ToFirstPerson
==============================
*/
void CAM_ToFirstPerson(void)
{
input->CAM_ToFirstPerson();
}
/*
==============================
CAM_ToOrthographic
==============================
*/
void CAM_ToOrthographic(void)
{
input->CAM_ToOrthographic();
}
/*
==============================
CAM_StartMouseMove
==============================
*/
void CAM_StartMouseMove( void )
{
input->CAM_StartMouseMove();
}
/*
==============================
CAM_EndMouseMove
==============================
*/
void CAM_EndMouseMove( void )
{
input->CAM_EndMouseMove();
}
/*
==============================
CAM_StartDistance
==============================
*/
void CAM_StartDistance( void )
{
input->CAM_StartDistance();
}
/*
==============================
CAM_EndDistance
==============================
*/
void CAM_EndDistance( void )
{
input->CAM_EndDistance();
}
/*
==============================
CAM_ToggleSnapto
==============================
*/
void CAM_ToggleSnapto( void )
{
cam_snapto.SetValue( !cam_snapto.GetInt() );
}
/*
==============================
MoveToward
==============================
*/
float MoveToward( float cur, float goal, float maxspeed )
{
if( cur != goal )
{
if( abs( cur - goal ) > 180.0 )
{
if( cur < goal )
cur += 360.0;
else
cur -= 360.0;
}
if( cur < goal )
{
if( cur < goal - 1.0 )
cur += ( goal - cur ) / 4.0;
else
cur = goal;
}
else
{
if( cur > goal + 1.0 )
cur -= ( cur - goal ) / 4.0;
else
cur = goal;
}
}
// bring cur back into range
if( cur < 0 )
cur += 360.0;
else if( cur >= 360 )
cur -= 360;
return cur;
}
/*
==============================
CAM_Think
==============================
*/
void CInput::CAM_Think( void )
{
Vector origin;
Vector ext, pnt, camForward, camRight, camUp;
float dist;
Vector camAngles;
float flSensitivity;
QAngle viewangles;
switch( cam_command.GetInt() )
{
case CAM_COMMAND_TOTHIRDPERSON:
CAM_ToThirdPerson();
break;
case CAM_COMMAND_TOFIRSTPERSON:
CAM_ToFirstPerson();
break;
case CAM_COMMAND_NONE:
default:
break;
}
if( !m_fCameraInThirdPerson )
return;
if ( !sv_cheats )
{
sv_cheats = cvar->FindVar( "sv_cheats" );
}
// If cheats have been disabled, pull us back out of third-person view.
if ( sv_cheats && !sv_cheats->GetBool() )
{
CAM_ToFirstPerson();
return;
}
camAngles[ PITCH ] = cam_idealpitch.GetFloat();
camAngles[ YAW ] = cam_idealyaw.GetFloat();
dist = cam_idealdist.GetFloat();
//
//movement of the camera with the mouse
//
if (m_fCameraMovingWithMouse)
{
int cpx, cpy;
#ifndef _XBOX
//get windows cursor position
GetMousePos (cpx, cpy);
#else
//xboxfixme
cpx = cpy = 0;
#endif
m_nCameraX = cpx;
m_nCameraY = cpy;
//check for X delta values and adjust accordingly
//eventually adjust YAW based on amount of movement
//don't do any movement of the cam using YAW/PITCH if we are zooming in/out the camera
if (!m_fCameraDistanceMove)
{
int x, y;
GetWindowCenter( x, y );
//keep the camera within certain limits around the player (ie avoid certain bad viewing angles)
if (m_nCameraX>x)
{
//if ((camAngles[YAW]>=225.0)||(camAngles[YAW]<135.0))
if (camAngles[YAW]<c_maxyaw.GetFloat())
{
camAngles[ YAW ] += (CAM_ANGLE_MOVE)*((m_nCameraX-x)/2);
}
if (camAngles[YAW]>c_maxyaw.GetFloat())
{
camAngles[YAW]=c_maxyaw.GetFloat();
}
}
else if (m_nCameraX<x)
{
//if ((camAngles[YAW]<=135.0)||(camAngles[YAW]>225.0))
if (camAngles[YAW]>c_minyaw.GetFloat())
{
camAngles[ YAW ] -= (CAM_ANGLE_MOVE)* ((x-m_nCameraX)/2);
}
if (camAngles[YAW]<c_minyaw.GetFloat())
{
camAngles[YAW]=c_minyaw.GetFloat();
}
}
//check for y delta values and adjust accordingly
//eventually adjust PITCH based on amount of movement
//also make sure camera is within bounds
if (m_nCameraY > y)
{
if(camAngles[PITCH]<c_maxpitch.GetFloat())
{
camAngles[PITCH] +=(CAM_ANGLE_MOVE)* ((m_nCameraY-y)/2);
}
if (camAngles[PITCH]>c_maxpitch.GetFloat())
{
camAngles[PITCH]=c_maxpitch.GetFloat();
}
}
else if (m_nCameraY<y)
{
if (camAngles[PITCH]>c_minpitch.GetFloat())
{
camAngles[PITCH] -= (CAM_ANGLE_MOVE)*((y-m_nCameraY)/2);
}
if (camAngles[PITCH]<c_minpitch.GetFloat())
{
camAngles[PITCH]=c_minpitch.GetFloat();
}
}
//set old mouse coordinates to current mouse coordinates
//since we are done with the mouse
if ( ( flSensitivity = gHUD.GetSensitivity() ) != 0 )
{
m_nCameraOldX=m_nCameraX*flSensitivity;
m_nCameraOldY=m_nCameraY*flSensitivity;
}
else
{
m_nCameraOldX=m_nCameraX;
m_nCameraOldY=m_nCameraY;
}
#ifndef _XBOX
ResetMouse();
#endif
}
}
//Nathan code here
if( input->KeyState( &cam_pitchup ) )
camAngles[ PITCH ] += CAM_ANGLE_DELTA;
else if( input->KeyState( &cam_pitchdown ) )
camAngles[ PITCH ] -= CAM_ANGLE_DELTA;
if( input->KeyState( &cam_yawleft ) )
camAngles[ YAW ] -= CAM_ANGLE_DELTA;
else if( input->KeyState( &cam_yawright ) )
camAngles[ YAW ] += CAM_ANGLE_DELTA;
if( input->KeyState( &cam_in ) )
{
dist -= CAM_DIST_DELTA;
if( dist < CAM_MIN_DIST )
{
// If we go back into first person, reset the angle
camAngles[ PITCH ] = 0;
camAngles[ YAW ] = 0;
dist = CAM_MIN_DIST;
}
}
else if( input->KeyState( &cam_out ) )
dist += CAM_DIST_DELTA;
if (m_fCameraDistanceMove)
{
int x, y;
GetWindowCenter( x, y );
if (m_nCameraY>y)
{
if(dist<c_maxdistance.GetFloat())
{
dist +=CAM_DIST_DELTA * ((m_nCameraY-y)/2);
}
if (dist>c_maxdistance.GetFloat())
{
dist=c_maxdistance.GetFloat();
}
}
else if (m_nCameraY<y)
{
if (dist>c_mindistance.GetFloat())
{
dist -= (CAM_DIST_DELTA)*((y-m_nCameraY)/2);
}
if (dist<c_mindistance.GetFloat())
{
dist=c_mindistance.GetFloat();
}
}
//set old mouse coordinates to current mouse coordinates
//since we are done with the mouse
m_nCameraOldX=m_nCameraX*gHUD.GetSensitivity();
m_nCameraOldY=m_nCameraY*gHUD.GetSensitivity();
#ifndef _XBOX
ResetMouse();
#endif
}
// update ideal
cam_idealpitch.SetValue( camAngles[ PITCH ] );
cam_idealyaw.SetValue( camAngles[ YAW ] );
cam_idealdist.SetValue( dist );
// Move towards ideal
VectorCopy( m_vecCameraOffset, camAngles );
engine->GetViewAngles( viewangles );
if( cam_snapto.GetInt() )
{
camAngles[ YAW ] = cam_idealyaw.GetFloat() + viewangles[ YAW ];
camAngles[ PITCH ] = cam_idealpitch.GetFloat() + viewangles[ PITCH ];
camAngles[ 2 ] = cam_idealdist.GetFloat();
}
else
{
if( camAngles[ YAW ] - viewangles[ YAW ] != cam_idealyaw.GetFloat() )
camAngles[ YAW ] = MoveToward( camAngles[ YAW ], cam_idealyaw.GetFloat() + viewangles[ YAW ], CAM_ANGLE_SPEED );
if( camAngles[ PITCH ] - viewangles[ PITCH ] != cam_idealpitch.GetFloat() )
camAngles[ PITCH ] = MoveToward( camAngles[ PITCH ], cam_idealpitch.GetFloat() + viewangles[ PITCH ], CAM_ANGLE_SPEED );
if( abs( camAngles[ 2 ] - cam_idealdist.GetFloat() ) < 2.0 )
camAngles[ 2 ] = cam_idealdist.GetFloat();
else
camAngles[ 2 ] += ( cam_idealdist.GetFloat() - camAngles[ 2 ] ) / 4.0;
}
m_vecCameraOffset[ 0 ] = camAngles[ 0 ];
m_vecCameraOffset[ 1 ] = camAngles[ 1 ];
m_vecCameraOffset[ 2 ] = dist;
}
void CAM_PitchUpDown(void) { KeyDown( &cam_pitchup ); }
void CAM_PitchUpUp(void) { KeyUp( &cam_pitchup ); }
void CAM_PitchDownDown(void) { KeyDown( &cam_pitchdown ); }
void CAM_PitchDownUp(void) { KeyUp( &cam_pitchdown ); }
void CAM_YawLeftDown(void) { KeyDown( &cam_yawleft ); }
void CAM_YawLeftUp(void) { KeyUp( &cam_yawleft ); }
void CAM_YawRightDown(void) { KeyDown( &cam_yawright ); }
void CAM_YawRightUp(void) { KeyUp( &cam_yawright ); }
void CAM_InDown(void) { KeyDown( &cam_in ); }
void CAM_InUp(void) { KeyUp( &cam_in ); }
void CAM_OutDown(void) { KeyDown( &cam_out ); }
void CAM_OutUp(void) { KeyUp( &cam_out ); }
/*
==============================
CAM_ToThirdPerson
==============================
*/
void CInput::CAM_ToThirdPerson(void)
{
QAngle viewangles;
#if !defined( CSTRIKE_DLL )
#if !defined( _DEBUG )
// Do allow third person in TF for now
#if defined ( TF_CLIENT_DLL )
// This is empty intentionally!
#else
if ( gpGlobals->maxClients > 1 )
{
// no thirdperson in multiplayer.
return;
}
#endif
#endif
#endif
engine->GetViewAngles( viewangles );
if( !m_fCameraInThirdPerson )
{
m_fCameraInThirdPerson = true;
m_vecCameraOffset[ YAW ] = viewangles[ YAW ];
m_vecCameraOffset[ PITCH ] = viewangles[ PITCH ];
m_vecCameraOffset[ 2 ] = CAM_MIN_DIST;
}
cam_command.SetValue( 0 );
}
/*
==============================
CAM_ToFirstPerson
==============================
*/
void CInput::CAM_ToFirstPerson(void)
{
m_fCameraInThirdPerson = false;
cam_command.SetValue( 0 );
}
/*
==============================
CAM_ToFirstPerson
==============================
*/
bool CInput::CAM_IsOrthographic(void) const
{
return m_CameraIsOrthographic;
}
/*
==============================
CAM_ToFirstPerson
==============================
*/
void CInput::CAM_OrthographicSize(float& w, float& h) const
{
w = c_orthowidth.GetFloat(); h = c_orthoheight.GetFloat();
}
/*
==============================
CAM_ToFirstPerson
==============================
*/
void CInput::CAM_ToOrthographic(void)
{
m_fCameraInThirdPerson = false;
m_CameraIsOrthographic = true;
cam_command.SetValue( 0 );
}
/*
==============================
CAM_StartMouseMove
==============================
*/
void CInput::CAM_StartMouseMove(void)
{
float flSensitivity;
//only move the cam with mouse if we are in third person.
if ( m_fCameraInThirdPerson )
{
//set appropriate flags and initialize the old mouse position
//variables for mouse camera movement
if (!m_fCameraMovingWithMouse)
{
int cpx, cpy;
m_fCameraMovingWithMouse=true;
m_fCameraInterceptingMouse=true;
#ifndef _XBOX
GetMousePos(cpx, cpy);
#else
// xboxfixme
cpx = cpy = 0;
#endif
m_nCameraX = cpx;
m_nCameraY = cpy;
if ( ( flSensitivity = gHUD.GetSensitivity() ) != 0 )
{
m_nCameraOldX=m_nCameraX*flSensitivity;
m_nCameraOldY=m_nCameraY*flSensitivity;
}
else
{
m_nCameraOldX=m_nCameraX;
m_nCameraOldY=m_nCameraY;
}
}
}
//we are not in 3rd person view..therefore do not allow camera movement
else
{
m_fCameraMovingWithMouse=false;
m_fCameraInterceptingMouse=false;
}
}
/*
==============================
CAM_EndMouseMove
the key has been released for camera movement
tell the engine that mouse camera movement is off
==============================
*/
void CInput::CAM_EndMouseMove(void)
{
m_fCameraMovingWithMouse=false;
m_fCameraInterceptingMouse=false;
}
/*
==============================
CAM_StartDistance
routines to start the process of moving the cam in or out
using the mouse
==============================
*/
void CInput::CAM_StartDistance(void)
{
//only move the cam with mouse if we are in third person.
if ( m_fCameraInThirdPerson )
{
//set appropriate flags and initialize the old mouse position
//variables for mouse camera movement
if (!m_fCameraDistanceMove)
{
int cpx, cpy;
m_fCameraDistanceMove=true;
m_fCameraMovingWithMouse=true;
m_fCameraInterceptingMouse=true;
#ifndef _XBOX
GetMousePos(cpx, cpy);
#else
// xboxfixme
cpx = cpy = 0;
#endif
m_nCameraX = cpx;
m_nCameraY = cpy;
m_nCameraOldX=m_nCameraX*gHUD.GetSensitivity();
m_nCameraOldY=m_nCameraY*gHUD.GetSensitivity();
}
}
//we are not in 3rd person view..therefore do not allow camera movement
else
{
m_fCameraDistanceMove=false;
m_fCameraMovingWithMouse=false;
m_fCameraInterceptingMouse=false;
}
}
/*
==============================
CAM_EndDistance
the key has been released for camera movement
tell the engine that mouse camera movement is off
==============================
*/
void CInput::CAM_EndDistance(void)
{
m_fCameraDistanceMove=false;
m_fCameraMovingWithMouse=false;
m_fCameraInterceptingMouse=false;
}
/*
==============================
CAM_IsThirdPerson
==============================
*/
int CInput::CAM_IsThirdPerson( void )
{
return m_fCameraInThirdPerson;
}
/*
==============================
CAM_GetCameraOffset
==============================
*/
void CInput::CAM_GetCameraOffset( Vector& ofs )
{
VectorCopy( m_vecCameraOffset, ofs );
}
/*
==============================
CAM_InterceptingMouse
==============================
*/
int CInput::CAM_InterceptingMouse( void )
{
return m_fCameraInterceptingMouse;
}
static ConCommand startpitchup( "+campitchup", CAM_PitchUpDown );
static ConCommand endpitcup( "-campitchup", CAM_PitchUpUp );
static ConCommand startpitchdown( "+campitchdown", CAM_PitchDownDown );
static ConCommand endpitchdown( "-campitchdown", CAM_PitchDownUp );
static ConCommand startcamyawleft( "+camyawleft", CAM_YawLeftDown );
static ConCommand endcamyawleft( "-camyawleft", CAM_YawLeftUp );
static ConCommand startcamyawright( "+camyawright", CAM_YawRightDown );
static ConCommand endcamyawright( "-camyawright", CAM_YawRightUp );
static ConCommand startcamin( "+camin", CAM_InDown );
static ConCommand endcamin( "-camin", CAM_InUp );
static ConCommand startcamout( "+camout", CAM_OutDown );
static ConCommand camout( "-camout", CAM_OutUp );
static ConCommand thirdperson( "thirdperson", ::CAM_ToThirdPerson, "Switch to thirdperson camera.", FCVAR_CHEAT );
static ConCommand firstperson( "firstperson", ::CAM_ToFirstPerson, "Switch to firstperson camera." );
static ConCommand camortho( "camortho", ::CAM_ToOrthographic, "Switch to orthographic camera.", FCVAR_CHEAT );
static ConCommand startcammousemove( "+cammousemove",::CAM_StartMouseMove);
static ConCommand endcammousemove( "-cammousemove",::CAM_EndMouseMove);
static ConCommand startcamdistance( "+camdistance", ::CAM_StartDistance );
static ConCommand endcamdistance( "-camdistance", ::CAM_EndDistance );
static ConCommand snapto( "snapto", CAM_ToggleSnapto );
/*
==============================
Init_Camera
==============================
*/
void CInput::Init_Camera( void )
{
m_CameraIsOrthographic = false;
}

View File

@@ -1,404 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "c_sdk_player.h"
#include "weapon_sdkbase.h"
#include "c_basetempentity.h"
#if defined( CSDKPlayer )
#undef CSDKPlayer
#endif
// -------------------------------------------------------------------------------- //
// Player animation event. Sent to the client when a player fires, jumps, reloads, etc..
// -------------------------------------------------------------------------------- //
class C_TEPlayerAnimEvent : public C_BaseTempEntity
{
public:
DECLARE_CLASS( C_TEPlayerAnimEvent, C_BaseTempEntity );
DECLARE_CLIENTCLASS();
virtual void PostDataUpdate( DataUpdateType_t updateType )
{
// Create the effect.
C_SDKPlayer *pPlayer = dynamic_cast< C_SDKPlayer* >( m_hPlayer.Get() );
if ( pPlayer && !pPlayer->IsDormant() )
{
pPlayer->DoAnimationEvent( (PlayerAnimEvent_t)m_iEvent.Get() );
}
}
public:
CNetworkHandle( CBasePlayer, m_hPlayer );
CNetworkVar( int, m_iEvent );
};
IMPLEMENT_CLIENTCLASS_EVENT( C_TEPlayerAnimEvent, DT_TEPlayerAnimEvent, CTEPlayerAnimEvent );
BEGIN_RECV_TABLE_NOBASE( C_TEPlayerAnimEvent, DT_TEPlayerAnimEvent )
RecvPropEHandle( RECVINFO( m_hPlayer ) ),
RecvPropInt( RECVINFO( m_iEvent ) )
END_RECV_TABLE()
BEGIN_RECV_TABLE_NOBASE( C_SDKPlayer, DT_SDKLocalPlayerExclusive )
RecvPropInt( RECVINFO( m_iShotsFired ) ),
END_RECV_TABLE()
IMPLEMENT_CLIENTCLASS_DT( C_SDKPlayer, DT_SDKPlayer, CSDKPlayer )
RecvPropDataTable( "sdklocaldata", 0, 0, &REFERENCE_RECV_TABLE(DT_SDKLocalPlayerExclusive) ),
RecvPropFloat( RECVINFO( m_angEyeAngles[0] ) ),
RecvPropFloat( RECVINFO( m_angEyeAngles[1] ) ),
RecvPropInt( RECVINFO( m_iThrowGrenadeCounter ) ),
RecvPropEHandle( RECVINFO( m_hRagdoll ) ),
END_RECV_TABLE()
BEGIN_PREDICTION_DATA( C_SDKPlayer )
DEFINE_PRED_FIELD( m_flCycle, FIELD_FLOAT, FTYPEDESC_OVERRIDE | FTYPEDESC_PRIVATE | FTYPEDESC_NOERRORCHECK ),
DEFINE_PRED_FIELD( m_iShotsFired, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ),
END_PREDICTION_DATA()
class C_SDKRagdoll : public C_BaseAnimatingOverlay
{
public:
DECLARE_CLASS( C_SDKRagdoll, C_BaseAnimatingOverlay );
DECLARE_CLIENTCLASS();
C_SDKRagdoll();
~C_SDKRagdoll();
virtual void OnDataChanged( DataUpdateType_t type );
int GetPlayerEntIndex() const;
IRagdoll* GetIRagdoll() const;
void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName );
private:
C_SDKRagdoll( const C_SDKRagdoll & ) {}
void Interp_Copy( C_BaseAnimatingOverlay *pSourceEntity );
void CreateRagdoll();
private:
EHANDLE m_hPlayer;
CNetworkVector( m_vecRagdollVelocity );
CNetworkVector( m_vecRagdollOrigin );
};
IMPLEMENT_CLIENTCLASS_DT_NOBASE( C_SDKRagdoll, DT_SDKRagdoll, CSDKRagdoll )
RecvPropVector( RECVINFO(m_vecRagdollOrigin) ),
RecvPropEHandle( RECVINFO( m_hPlayer ) ),
RecvPropInt( RECVINFO( m_nModelIndex ) ),
RecvPropInt( RECVINFO(m_nForceBone) ),
RecvPropVector( RECVINFO(m_vecForce) ),
RecvPropVector( RECVINFO( m_vecRagdollVelocity ) )
END_RECV_TABLE()
C_SDKRagdoll::C_SDKRagdoll()
{
}
C_SDKRagdoll::~C_SDKRagdoll()
{
PhysCleanupFrictionSounds( this );
}
void C_SDKRagdoll::Interp_Copy( C_BaseAnimatingOverlay *pSourceEntity )
{
if ( !pSourceEntity )
return;
VarMapping_t *pSrc = pSourceEntity->GetVarMapping();
VarMapping_t *pDest = GetVarMapping();
// Find all the VarMapEntry_t's that represent the same variable.
for ( int i = 0; i < pDest->m_Entries.Count(); i++ )
{
VarMapEntry_t *pDestEntry = &pDest->m_Entries[i];
for ( int j=0; j < pSrc->m_Entries.Count(); j++ )
{
VarMapEntry_t *pSrcEntry = &pSrc->m_Entries[j];
if ( !Q_strcmp( pSrcEntry->watcher->GetDebugName(),
pDestEntry->watcher->GetDebugName() ) )
{
pDestEntry->watcher->Copy( pSrcEntry->watcher );
break;
}
}
}
}
void C_SDKRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName )
{
IPhysicsObject *pPhysicsObject = VPhysicsGetObject();
if( !pPhysicsObject )
return;
Vector dir = pTrace->endpos - pTrace->startpos;
if ( iDamageType == DMG_BLAST )
{
dir *= 4000; // adjust impact strenght
// apply force at object mass center
pPhysicsObject->ApplyForceCenter( dir );
}
else
{
Vector hitpos;
VectorMA( pTrace->startpos, pTrace->fraction, dir, hitpos );
VectorNormalize( dir );
dir *= 4000; // adjust impact strenght
// apply force where we hit it
pPhysicsObject->ApplyForceOffset( dir, hitpos );
}
m_pRagdoll->ResetRagdollSleepAfterTime();
}
void C_SDKRagdoll::CreateRagdoll()
{
// First, initialize all our data. If we have the player's entity on our client,
// then we can make ourselves start out exactly where the player is.
C_SDKPlayer *pPlayer = dynamic_cast< C_SDKPlayer* >( m_hPlayer.Get() );
if ( pPlayer && !pPlayer->IsDormant() )
{
// move my current model instance to the ragdoll's so decals are preserved.
pPlayer->SnatchModelInstance( this );
VarMapping_t *varMap = GetVarMapping();
// Copy all the interpolated vars from the player entity.
// The entity uses the interpolated history to get bone velocity.
bool bRemotePlayer = (pPlayer != C_BasePlayer::GetLocalPlayer());
if ( bRemotePlayer )
{
Interp_Copy( pPlayer );
SetAbsAngles( pPlayer->GetRenderAngles() );
GetRotationInterpolator().Reset();
m_flAnimTime = pPlayer->m_flAnimTime;
SetSequence( pPlayer->GetSequence() );
m_flPlaybackRate = pPlayer->GetPlaybackRate();
}
else
{
// This is the local player, so set them in a default
// pose and slam their velocity, angles and origin
SetAbsOrigin( m_vecRagdollOrigin );
SetAbsAngles( pPlayer->GetRenderAngles() );
SetAbsVelocity( m_vecRagdollVelocity );
int iSeq = LookupSequence( "walk_lower" );
if ( iSeq == -1 )
{
Assert( false ); // missing walk_lower?
iSeq = 0;
}
SetSequence( iSeq ); // walk_lower, basic pose
SetCycle( 0.0 );
Interp_Reset( varMap );
}
}
else
{
// overwrite network origin so later interpolation will
// use this position
SetNetworkOrigin( m_vecRagdollOrigin );
SetAbsOrigin( m_vecRagdollOrigin );
SetAbsVelocity( m_vecRagdollVelocity );
Interp_Reset( GetVarMapping() );
}
SetModelIndex( m_nModelIndex );
// Turn it into a ragdoll.
// Make us a ragdoll..
m_nRenderFX = kRenderFxRagdoll;
BecomeRagdollOnClient( false );
}
void C_SDKRagdoll::OnDataChanged( DataUpdateType_t type )
{
BaseClass::OnDataChanged( type );
if ( type == DATA_UPDATE_CREATED )
{
CreateRagdoll();
IPhysicsObject *pPhysicsObject = VPhysicsGetObject();
if( pPhysicsObject )
{
AngularImpulse aVelocity(0,0,0);
Vector vecExaggeratedVelocity = 3 * m_vecRagdollVelocity;
pPhysicsObject->AddVelocity( &vecExaggeratedVelocity, &aVelocity );
}
}
}
IRagdoll* C_SDKRagdoll::GetIRagdoll() const
{
return m_pRagdoll;
}
C_BaseAnimating * C_SDKPlayer::BecomeRagdollOnClient( bool bCopyEntity )
{
// Let the C_CSRagdoll entity do this.
// m_builtRagdoll = true;
return NULL;
}
IRagdoll* C_SDKPlayer::GetRepresentativeRagdoll() const
{
if ( m_hRagdoll.Get() )
{
C_SDKRagdoll *pRagdoll = (C_SDKRagdoll*)m_hRagdoll.Get();
return pRagdoll->GetIRagdoll();
}
else
{
return NULL;
}
}
C_SDKPlayer::C_SDKPlayer() :
m_iv_angEyeAngles( "C_SDKPlayer::m_iv_angEyeAngles" )
{
m_PlayerAnimState = CreatePlayerAnimState( this, this, LEGANIM_9WAY, true );
m_angEyeAngles.Init();
AddVar( &m_angEyeAngles, &m_iv_angEyeAngles, LATCH_SIMULATION_VAR );
}
C_SDKPlayer::~C_SDKPlayer()
{
m_PlayerAnimState->Release();
}
C_SDKPlayer* C_SDKPlayer::GetLocalSDKPlayer()
{
return ToSDKPlayer( C_BasePlayer::GetLocalPlayer() );
}
const QAngle& C_SDKPlayer::GetRenderAngles()
{
if ( IsRagdoll() )
{
return vec3_angle;
}
else
{
return m_PlayerAnimState->GetRenderAngles();
}
}
void C_SDKPlayer::UpdateClientSideAnimation()
{
// Update the animation data. It does the local check here so this works when using
// a third-person camera (and we don't have valid player angles).
if ( this == C_SDKPlayer::GetLocalSDKPlayer() )
m_PlayerAnimState->Update( EyeAngles()[YAW], m_angEyeAngles[PITCH] );
else
m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );
BaseClass::UpdateClientSideAnimation();
}
void C_SDKPlayer::PostDataUpdate( DataUpdateType_t updateType )
{
// C_BaseEntity assumes we're networking the entity's angles, so pretend that it
// networked the same value we already have.
SetNetworkAngles( GetLocalAngles() );
BaseClass::PostDataUpdate( updateType );
}
void C_SDKPlayer::OnDataChanged( DataUpdateType_t type )
{
BaseClass::OnDataChanged( type );
if ( type == DATA_UPDATE_CREATED )
{
SetNextClientThink( CLIENT_THINK_ALWAYS );
}
UpdateVisibility();
}
void C_SDKPlayer::DoAnimationEvent( PlayerAnimEvent_t event )
{
if ( event == PLAYERANIMEVENT_THROW_GRENADE )
{
// Let the server handle this event. It will update m_iThrowGrenadeCounter and the client will
// pick up the event in CCSPlayerAnimState.
}
else
{
m_PlayerAnimState->DoAnimationEvent( event );
}
}
bool C_SDKPlayer::ShouldDraw( void )
{
// If we're dead, our ragdoll will be drawn for us instead.
if ( !IsAlive() )
return false;
if( GetTeamNumber() == TEAM_SPECTATOR )
return false;
if( IsLocalPlayer() && IsRagdoll() )
return true;
return BaseClass::ShouldDraw();
}
CWeaponSDKBase* C_SDKPlayer::GetActiveSDKWeapon() const
{
return dynamic_cast< CWeaponSDKBase* >( GetActiveWeapon() );
}

View File

@@ -1,87 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef C_SDK_PLAYER_H
#define C_SDK_PLAYER_H
#ifdef _WIN32
#pragma once
#endif
#include "sdk_playeranimstate.h"
#include "c_baseplayer.h"
#include "sdk_shareddefs.h"
#include "baseparticleentity.h"
class C_SDKPlayer : public C_BasePlayer, public ISDKPlayerAnimStateHelpers
{
public:
DECLARE_CLASS( C_SDKPlayer, C_BasePlayer );
DECLARE_CLIENTCLASS();
DECLARE_PREDICTABLE();
DECLARE_INTERPOLATION();
C_SDKPlayer();
~C_SDKPlayer();
static C_SDKPlayer* GetLocalSDKPlayer();
virtual const QAngle& GetRenderAngles();
virtual void UpdateClientSideAnimation();
virtual void PostDataUpdate( DataUpdateType_t updateType );
virtual void OnDataChanged( DataUpdateType_t updateType );
// Called by shared code.
public:
// ISDKPlayerAnimState overrides.
virtual CWeaponSDKBase* SDKAnim_GetActiveWeapon();
virtual bool SDKAnim_CanMove();
void DoAnimationEvent( PlayerAnimEvent_t event );
bool ShouldDraw();
ISDKPlayerAnimState *m_PlayerAnimState;
QAngle m_angEyeAngles;
CInterpolatedVar< QAngle > m_iv_angEyeAngles;
CNetworkVar( int, m_iThrowGrenadeCounter ); // used to trigger grenade throw animations.
CNetworkVar( int, m_iShotsFired ); // number of shots fired recently
EHANDLE m_hRagdoll;
CWeaponSDKBase *GetActiveSDKWeapon() const;
C_BaseAnimating *BecomeRagdollOnClient( bool bCopyEntity);
IRagdoll* C_SDKPlayer::GetRepresentativeRagdoll() const;
void FireBullet(
Vector vecSrc,
const QAngle &shootAngles,
float vecSpread,
int iDamage,
int iBulletType,
CBaseEntity *pevAttacker,
bool bDoEffects,
float x,
float y );
private:
C_SDKPlayer( const C_SDKPlayer & );
};
inline C_SDKPlayer* ToSDKPlayer( CBaseEntity *pPlayer )
{
Assert( dynamic_cast< C_SDKPlayer* >( pPlayer ) != NULL );
return static_cast< C_SDKPlayer* >( pPlayer );
}
#endif // C_SDK_PLAYER_H

View File

@@ -1,33 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Client side C_SDKTeam class
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "engine/IEngineSound.h"
#include "hud.h"
#include "recvproxy.h"
#include "c_sdk_team.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
IMPLEMENT_CLIENTCLASS_DT(C_SDKTeam, DT_SDKTeam, CSDKTeam)
END_RECV_TABLE()
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_SDKTeam::C_SDKTeam()
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_SDKTeam::~C_SDKTeam()
{
}

View File

@@ -1,36 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Client side CTFTeam class
//
// $NoKeywords: $
//=============================================================================//
#ifndef C_SDK_TEAM_H
#define C_SDK_TEAM_H
#ifdef _WIN32
#pragma once
#endif
#include "c_team.h"
#include "shareddefs.h"
class C_BaseEntity;
class C_BaseObject;
class CBaseTechnology;
//-----------------------------------------------------------------------------
// Purpose: TF's Team manager
//-----------------------------------------------------------------------------
class C_SDKTeam : public C_Team
{
DECLARE_CLASS( C_SDKTeam, C_Team );
DECLARE_CLIENTCLASS();
public:
C_SDKTeam();
virtual ~C_SDKTeam();
};
#endif // C_SDK_TEAM_H

View File

@@ -1,44 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Game-specific impact effect hooks
//
//=============================================================================//
#include "cbase.h"
#include "fx_impact.h"
#include "engine/IEngineSound.h"
//-----------------------------------------------------------------------------
// Purpose: Handle weapon impacts
//-----------------------------------------------------------------------------
void ImpactCallback( const CEffectData &data )
{
trace_t tr;
Vector vecOrigin, vecStart, vecShotDir;
int iMaterial, iDamageType, iHitbox;
short nSurfaceProp;
C_BaseEntity *pEntity = ParseImpactData( data, &vecOrigin, &vecStart, &vecShotDir, nSurfaceProp, iMaterial, iDamageType, iHitbox );
if ( !pEntity )
return;
// If we hit, perform our custom effects and play the sound
if ( Impact( vecOrigin, vecStart, iMaterial, iDamageType, iHitbox, pEntity, tr ) )
{
// Check for custom effects based on the Decal index
PerformCustomEffects( vecOrigin, tr, vecShotDir, iMaterial, 1.0 );
//Play a ricochet sound some of the time
if( random->RandomInt(1,10) <= 3 && (iDamageType == DMG_BULLET) )
{
CLocalPlayerFilter filter;
C_BaseEntity::EmitSound( filter, SOUND_FROM_WORLD, "Bounce.Shrapnel", &vecOrigin );
}
}
PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp );
}
DECLARE_CLIENT_EFFECT( "Impact", ImpactCallback );

View File

@@ -1,462 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "sdk_hud_chat.h"
//#include "c_sdk_player.h"
//#include "c_sdk_playerresource.h"
#include "hud_macros.h"
#include "text_message.h"
#include "vguicenterprint.h"
#include "vgui/ILocalize.h"
ConVar cl_showtextmsg( "cl_showtextmsg", "1", 0, "Enable/disable text messages printing on the screen." );
float g_ColorGreen[3] = { 153, 255, 153 };
float g_ColorYellow[3] = { 255, 178.5, 0.0 };
float *GetClientColor( int clientIndex )
{
if ( clientIndex == 0 ) // console msg
{
return g_ColorGreen;
}
else
{
return g_ColorYellow;
}
}
// converts all '\r' characters to '\n', so that the engine can deal with the properly
// returns a pointer to str
static char* ConvertCRtoNL( char *str )
{
for ( char *ch = str; *ch != 0; ch++ )
if ( *ch == '\r' )
*ch = '\n';
return str;
}
// converts all '\r' characters to '\n', so that the engine can deal with the properly
// returns a pointer to str
static wchar_t* ConvertCRtoNL( wchar_t *str )
{
for ( wchar_t *ch = str; *ch != 0; ch++ )
if ( *ch == L'\r' )
*ch = L'\n';
return str;
}
static void StripEndNewlineFromString( char *str )
{
int s = strlen( str ) - 1;
if ( s >= 0 )
{
if ( str[s] == '\n' || str[s] == '\r' )
str[s] = 0;
}
}
static void StripEndNewlineFromString( wchar_t *str )
{
int s = wcslen( str ) - 1;
if ( s >= 0 )
{
if ( str[s] == L'\n' || str[s] == L'\r' )
str[s] = 0;
}
}
DECLARE_HUDELEMENT( CHudChat );
DECLARE_HUD_MESSAGE( CHudChat, SayText );
DECLARE_HUD_MESSAGE( CHudChat, TextMsg );
//=====================
//CHudChatLine
//=====================
void CHudChatLine::ApplySchemeSettings(vgui::IScheme *pScheme)
{
BaseClass::ApplySchemeSettings( pScheme );
m_hFont = pScheme->GetFont( "ChatFont" );
SetBorder( NULL );
SetBgColor( Color( 0, 0, 0, 0 ) );
SetFgColor( Color( 0, 0, 0, 0 ) );
SetFont( m_hFont );
}
void CHudChatLine::PerformFadeout( void )
{
// Flash + Extra bright when new
float curtime = gpGlobals->curtime;
int lr = m_clrText[0];
int lg = m_clrText[1];
int lb = m_clrText[2];
//CSPort chat only fades out, no blinking.
if ( curtime <= m_flExpireTime && curtime > m_flExpireTime - CHATLINE_FADE_TIME )
{
float frac = ( m_flExpireTime - curtime ) / CHATLINE_FADE_TIME;
int alpha = frac * 255;
alpha = clamp( alpha, 0, 255 );
wchar_t wbuf[4096];
GetText(0, wbuf, sizeof(wbuf));
SetText( "" );
if ( m_iNameLength > 0 )
{
wchar_t wText[4096];
// draw the first x characters in the player color
wcsncpy( wText, wbuf, min( m_iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
wText[ min( m_iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
m_clrNameColor[3] = alpha;
InsertColorChange( m_clrNameColor );
InsertString( wText );
wcsncpy( wText, wbuf + ( m_iNameLength ), wcslen( wbuf + m_iNameLength ) );
wText[ wcslen( wbuf + m_iNameLength ) ] = '\0';
InsertColorChange( Color( g_ColorYellow[0], g_ColorYellow[1], g_ColorYellow[2], alpha ) );
InsertString( wText );
InvalidateLayout( true );
}
else
{
InsertColorChange( Color( lr, lg, lb, alpha ) );
InsertString( wbuf );
}
}
OnThink();
}
//=====================
//CHudChatInputLine
//=====================
void CHudChatInputLine::ApplySchemeSettings(vgui::IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
vgui::HFont hFont = pScheme->GetFont( "ChatFont" );
m_pPrompt->SetFont( hFont );
m_pInput->SetFont( hFont );
m_pInput->SetFgColor( pScheme->GetColor( "Chat.TypingText", pScheme->GetColor( "Panel.FgColor", Color( 255, 255, 255, 255 ) ) ) );
}
//=====================
//CHudChat
//=====================
CHudChat::CHudChat( const char *pElementName ) : BaseClass( pElementName )
{
}
void CHudChat::CreateChatInputLine( void )
{
m_pChatInput = new CHudChatInputLine( this, "ChatInputLine" );
m_pChatInput->SetVisible( false );
}
void CHudChat::CreateChatLines( void )
{
for ( int i = 0; i < CHAT_INTERFACE_LINES; i++ )
{
char sz[ 32 ];
Q_snprintf( sz, sizeof( sz ), "ChatLine%02i", i );
m_ChatLines[ i ] = new CHudChatLine( this, sz );
m_ChatLines[ i ]->SetVisible( false );
}
}
void CHudChat::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
SetBgColor( Color( 0, 0, 0, 0 ) );
SetFgColor( Color( 0, 0, 0, 0 ) );
}
void CHudChat::Init( void )
{
BaseClass::Init();
HOOK_HUD_MESSAGE( CHudChat, SayText );
HOOK_HUD_MESSAGE( CHudChat, TextMsg );
}
//-----------------------------------------------------------------------------
// Purpose: Overrides base reset to not cancel chat at round restart
//-----------------------------------------------------------------------------
void CHudChat::Reset( void )
{
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pszName -
// iSize -
// *pbuf -
//-----------------------------------------------------------------------------
void CHudChat::MsgFunc_SayText( bf_read &msg )
{
char szString[256];
int client = msg.ReadByte();
msg.ReadString( szString, sizeof(szString) );
bool bWantsToChat = msg.ReadByte();
if ( bWantsToChat )
{
// print raw chat text
ChatPrintf( client, "%s", szString );
}
else
{
// try to lookup translated string
Printf( "%s", hudtextmessage->LookupString( szString ) );
}
Msg( "%s", szString );
}
wchar_t* ReadLocalizedRadioCommandString( bf_read &msg, wchar_t *pOut, int outSize, bool bStripNewline )
{
char szString[2048];
msg.ReadString( szString, sizeof(szString) );
const wchar_t *pBuf = vgui::localize()->Find( szString );
if ( pBuf )
{
wcsncpy( pOut, pBuf, outSize/sizeof(wchar_t) );
pOut[outSize/sizeof(wchar_t)-1] = 0;
}
else
{
vgui::localize()->ConvertANSIToUnicode( szString, pOut, outSize );
}
if ( bStripNewline )
StripEndNewlineFromString( pOut );
return pOut;
}
// Message handler for text messages
// displays a string, looking them up from the titles.txt file, which can be localised
// parameters:
// byte: message direction ( HUD_PRINTCONSOLE, HUD_PRINTNOTIFY, HUD_PRINTCENTER, HUD_PRINTTALK )
// string: message
// optional parameters:
// string: message parameter 1
// string: message parameter 2
// string: message parameter 3
// string: message parameter 4
// any string that starts with the character '#' is a message name, and is used to look up the real message in titles.txt
// the next (optional) one to four strings are parameters for that string (which can also be message names if they begin with '#')
void CHudChat::MsgFunc_TextMsg( bf_read &msg )
{
char szString[2048];
int msg_dest = msg.ReadByte();
wchar_t szBuf[5][128];
wchar_t outputBuf[256];
for ( int i=0; i<5; ++i )
{
msg.ReadString( szString, sizeof(szString) );
char *tmpStr = hudtextmessage->LookupString( szString, &msg_dest );
const wchar_t *pBuf = vgui::localize()->Find( tmpStr );
if ( pBuf )
{
// Copy pBuf into szBuf[i].
int nMaxChars = sizeof( szBuf[i] ) / sizeof( wchar_t );
wcsncpy( szBuf[i], pBuf, nMaxChars );
szBuf[i][nMaxChars-1] = 0;
}
else
{
if ( i )
{
StripEndNewlineFromString( tmpStr ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
}
vgui::localize()->ConvertANSIToUnicode( tmpStr, szBuf[i], sizeof(szBuf[i]) );
}
}
if ( !cl_showtextmsg.GetInt() )
return;
int len;
switch ( msg_dest )
{
case HUD_PRINTCENTER:
vgui::localize()->ConstructString( outputBuf, sizeof(outputBuf), szBuf[0], 4, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
internalCenterPrint->Print( ConvertCRtoNL( outputBuf ) );
break;
case HUD_PRINTNOTIFY:
szString[0] = 1; // mark this message to go into the notify buffer
vgui::localize()->ConstructString( outputBuf, sizeof(outputBuf), szBuf[0], 4, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
vgui::localize()->ConvertUnicodeToANSI( outputBuf, szString+1, sizeof(szString)-1 );
len = strlen( szString );
if ( len && szString[len-1] != '\n' && szString[len-1] != '\r' )
{
Q_strncat( szString, "\n", sizeof(szString), 1 );
}
Msg( "%s", ConvertCRtoNL( szString ) );
break;
case HUD_PRINTTALK:
vgui::localize()->ConstructString( outputBuf, sizeof(outputBuf), szBuf[0], 4, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
vgui::localize()->ConvertUnicodeToANSI( outputBuf, szString, sizeof(szString) );
len = strlen( szString );
if ( len && szString[len-1] != '\n' && szString[len-1] != '\r' )
{
Q_strncat( szString, "\n", sizeof(szString), 1 );
}
Printf( "%s", ConvertCRtoNL( szString ) );
break;
case HUD_PRINTCONSOLE:
vgui::localize()->ConstructString( outputBuf, sizeof(outputBuf), szBuf[0], 4, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
vgui::localize()->ConvertUnicodeToANSI( outputBuf, szString, sizeof(szString) );
len = strlen( szString );
if ( len && szString[len-1] != '\n' && szString[len-1] != '\r' )
{
Q_strncat( szString, "\n", sizeof(szString), 1 );
}
Msg( "%s", ConvertCRtoNL( szString ) );
break;
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *fmt -
// ... -
//-----------------------------------------------------------------------------
void CHudChat::ChatPrintf( int iPlayerIndex, const char *fmt, ... )
{
va_list marker;
char msg[4096];
va_start(marker, fmt);
Q_vsnprintf(msg, sizeof( msg), fmt, marker);
va_end(marker);
// Strip any trailing '\n'
if ( strlen( msg ) > 0 && msg[ strlen( msg )-1 ] == '\n' )
{
msg[ strlen( msg ) - 1 ] = 0;
}
// Strip leading \n characters ( or notify/color signifiers )
char *pmsg = msg;
while ( *pmsg && ( *pmsg == '\n' || *pmsg == 1 || *pmsg == 2 ) )
{
pmsg++;
}
if ( !*pmsg )
return;
CHudChatLine *line = (CHudChatLine *)FindUnusedChatLine();
if ( !line )
{
ExpireOldest();
line = (CHudChatLine *)FindUnusedChatLine();
}
if ( !line )
{
return;
}
line->SetText( "" );
int iNameLength = 0;
player_info_t sPlayerInfo;
if ( iPlayerIndex == 0 )
{
Q_memset( &sPlayerInfo, 0, sizeof(player_info_t) );
Q_strncpy( sPlayerInfo.name, "Console", sizeof(sPlayerInfo.name) );
}
else
{
engine->GetPlayerInfo( iPlayerIndex, &sPlayerInfo );
}
const char *pName = sPlayerInfo.name;
if ( pName )
{
const char *nameInString = strstr( pmsg, pName );
if ( nameInString )
{
iNameLength = strlen( pName ) + (nameInString - pmsg);
}
}
else
line->InsertColorChange( Color( g_ColorYellow[0], g_ColorYellow[1], g_ColorYellow[2], 255 ) );
char *buf = static_cast<char *>( _alloca( strlen( pmsg ) + 1 ) );
wchar_t *wbuf = static_cast<wchar_t *>( _alloca( (strlen( pmsg ) + 1 ) * sizeof(wchar_t) ) );
if ( buf )
{
float *flColor = GetClientColor( iPlayerIndex );
line->SetExpireTime();
// draw the first x characters in the player color
Q_strncpy( buf, pmsg, min( iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
buf[ min( iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
line->InsertColorChange( Color( flColor[0], flColor[1], flColor[2], 255 ) );
line->InsertString( buf );
Q_strncpy( buf, pmsg + iNameLength, strlen( pmsg ));
buf[ strlen( pmsg + iNameLength ) ] = '\0';
line->InsertColorChange( Color( g_ColorYellow[0], g_ColorYellow[1], g_ColorYellow[2], 255 ) );
vgui::localize()->ConvertANSIToUnicode( buf, wbuf, strlen(pmsg)*sizeof(wchar_t));
line->InsertString( wbuf );
line->SetVisible( true );
line->SetNameLength( iNameLength );
line->SetNameColor( Color( flColor[0], flColor[1], flColor[2], 255 ) );
}
CLocalPlayerFilter filter;
C_BaseEntity::EmitSound( filter, -1 /*SOUND_FROM_LOCAL_PLAYER*/, "HudChat.Message" );
}
int CHudChat::GetChatInputOffset( void )
{
if ( m_pChatInput->IsVisible() )
{
return m_iFontHeight;
}
else
return 0;
}

View File

@@ -1,85 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Client DLL VGUI2 Viewport
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#pragma warning( disable : 4800 ) // disable forcing int to bool performance warning
// VGUI panel includes
#include <vgui_controls/Panel.h>
#include <vgui/ISurface.h>
#include <KeyValues.h>
#include <vgui/Cursor.h>
#include <vgui/IScheme.h>
#include <vgui/IVGUI.h>
#include <vgui/ILocalize.h>
#include <vgui/VGUI.h>
// client dll/engine defines
#include "hud.h"
#include <voice_status.h>
// viewport definitions
#include <baseviewport.h>
#include "SDKViewport.h"
#include "vguicenterprint.h"
#include "text_message.h"
void SDKViewport::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
gHUD.InitColors( pScheme );
SetPaintBackgroundEnabled( false );
}
IViewPortPanel* SDKViewport::CreatePanelByName(const char *szPanelName)
{
IViewPortPanel* newpanel = NULL;
// Up here, strcmp against each type of panel we know how to create.
// else if ( Q_strcmp(PANEL_OVERVIEW, szPanelName) == 0 )
// {
// newpanel = new CCSMapOverview( this );
// }
// create a generic base panel, don't add twice
newpanel = BaseClass::CreatePanelByName( szPanelName );
return newpanel;
}
void SDKViewport::CreateDefaultPanels( void )
{
BaseClass::CreateDefaultPanels();
}
int SDKViewport::GetDeathMessageStartHeight( void )
{
int x = YRES(2);
IViewPortPanel *spectator = gViewPortInterface->FindPanelByName( PANEL_SPECGUI );
//TODO: Link to actual height of spectator bar
if ( spectator && spectator->IsVisible() )
{
x += YRES(52);
}
return x;
}

View File

@@ -1,127 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#if !defined( TEMPENT_H )
#define TEMPENT_H
#ifdef _WIN32
#pragma once
#endif
#include "c_baseentity.h"
#include "c_baseanimating.h"
#include "c_sprite.h"
// Temporary entity array
#define TENTPRIORITY_LOW 0
#define TENTPRIORITY_HIGH 1
// TEMPENTITY flags
#define FTENT_NONE 0x00000000
#define FTENT_SINEWAVE 0x00000001
#define FTENT_GRAVITY 0x00000002
#define FTENT_ROTATE 0x00000004
#define FTENT_SLOWGRAVITY 0x00000008
#define FTENT_SMOKETRAIL 0x00000010
#define FTENT_COLLIDEWORLD 0x00000020
#define FTENT_FLICKER 0x00000040
#define FTENT_FADEOUT 0x00000080
#define FTENT_SPRANIMATE 0x00000100
#define FTENT_HITSOUND 0x00000200
#define FTENT_SPIRAL 0x00000400
#define FTENT_SPRCYCLE 0x00000800
#define FTENT_COLLIDEALL 0x00001000 // will collide with world and slideboxes
#define FTENT_PERSIST 0x00002000 // tent is not removed when unable to draw
#define FTENT_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything
#define FTENT_PLYRATTACHMENT 0x00008000 // tent is attached to a player (owner)
#define FTENT_SPRANIMATELOOP 0x00010000 // animating sprite doesn't die when last frame is displayed
#define FTENT_SMOKEGROWANDFADE 0x00020000 // rapid grow and fade. Very specific for gunsmoke
#define FTENT_SPARKSHOWER 0x00040000
#define FTENT_NOMODEL 0x00080000 // Doesn't have a model, never try to draw ( it just triggers other things )
#define FTENT_CLIENTCUSTOM 0x00100000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things )
#define FTENT_WINDBLOWN 0x00200000 // This is set when the temp entity is blown by the wind
#define FTENT_NEVERDIE 0x00400000 // Don't die as long as die != 0
#define FTENT_BEOCCLUDED 0x00800000 // Don't draw if my specified normal's facing away from the view
#define FTENT_CHANGERENDERONCOLLIDE 0x01000000 //when we collide with something, change our rendergroup to RENDER_GROUP_OTHER
#define FTENT_COLLISIONGROUP 0x02000000 // if set, use the C_BaseEntity::GetCollisionGroup when doing collide trace
class C_LocalTempEntity;
typedef int (*pfnDrawHelper)( C_LocalTempEntity *entity, int flags );
//-----------------------------------------------------------------------------
// Purpose: Should this derive from some other class
//-----------------------------------------------------------------------------
class C_LocalTempEntity : public C_BaseAnimating, public C_SpriteRenderer
{
public:
DECLARE_CLASS( C_LocalTempEntity, C_BaseAnimating );
C_LocalTempEntity();
virtual void Prepare( model_t *pmodel, float time );
virtual bool IsActive( void );
virtual bool Frame( float frametime, int framenumber );
// C_BaseAnimating , etc. override
virtual int DrawModel( int flags );
// Sets the velocity
void SetVelocity( const Vector &vecVelocity );
const Vector &GetVelocity() const { return m_vecTempEntVelocity; }
void SetDrawHelper( pfnDrawHelper helper ) { m_pfnDrawHelper = helper; }
void OnRemoveTempEntity();
protected:
pfnDrawHelper m_pfnDrawHelper;
public:
int flags;
float die;
float m_flFrameMax;
float x;
float y;
float fadeSpeed;
float bounceFactor;
int hitSound;
int priority;
// if attached, this is the index of the client to stick to
// if COLLIDEALL, this is the index of the client to ignore
// TENTS with FTENT_PLYRATTACHMENT MUST set the clientindex!
short clientIndex;
// if attached, client origin + tentOffset = tent origin.
Vector tentOffset;
// Used by temp entities.
QAngle m_vecTempEntAngVelocity;
int tempent_renderamt;
Vector m_vecNormal;
float m_flSpriteScale;
int m_nFlickerFrame;
//
float m_flFrameRate;
float m_flFrame;
RenderGroup_t m_RenderGroup;
private:
C_LocalTempEntity( const C_LocalTempEntity & );
Vector m_vecTempEntVelocity;
Vector m_vecPrevLocalOrigin;
// Draw tempent as a studio model
int DrawStudioModel( int flags );
};
#endif // TEMPENTITY_H

View File

@@ -1,186 +0,0 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =====//
//
// Purpose:
//
//===========================================================================//
#include "cbase.h"
#include "toolframework_client.h"
#include "igamesystem.h"
#include "toolframework/iclientenginetools.h"
#include "client_factorylist.h"
class CToolFrameworkClient : public CBaseGameSystemPerFrame
{
public:
// Methods of IGameSystem
virtual bool Init();
virtual void LevelInitPreEntity();
virtual void LevelInitPostEntity();
virtual void LevelShutdownPreEntity();
virtual void LevelShutdownPostEntity();
virtual void PreRender();
virtual void PostRender();
public:
// Other public methods
void PostToolMessage( HTOOLHANDLE hEntity, KeyValues *msg );
void AdjustEngineViewport( int& x, int& y, int& width, int& height );
bool SetupEngineView( Vector &origin, QAngle &angles, float &fov );
bool SetupEngineMicrophone( Vector &origin, QAngle &angles );
bool IsThirdPersonCamera();
private:
IClientEngineTools *m_pTools;
};
//-----------------------------------------------------------------------------
// Singleton
//-----------------------------------------------------------------------------
static CToolFrameworkClient g_ToolFrameworkClient;
IGameSystem *ToolFrameworkClientSystem()
{
return &g_ToolFrameworkClient;
}
bool CToolFrameworkClient::Init()
{
factorylist_t list;
FactoryList_Retrieve( list );
m_pTools = ( IClientEngineTools * )list.appSystemFactory( VCLIENTENGINETOOLS_INTERFACE_VERSION, NULL );
return ( m_pTools != NULL );
}
void CToolFrameworkClient::LevelInitPreEntity()
{
if ( m_pTools )
{
m_pTools->LevelInitPreEntityAllTools();
}
}
void CToolFrameworkClient::LevelInitPostEntity()
{
if ( m_pTools )
{
m_pTools->LevelInitPostEntityAllTools();
}
}
void CToolFrameworkClient::LevelShutdownPreEntity()
{
if ( m_pTools )
{
m_pTools->LevelShutdownPreEntityAllTools();
}
}
void CToolFrameworkClient::LevelShutdownPostEntity()
{
if ( m_pTools )
{
m_pTools->LevelShutdownPostEntityAllTools();
}
}
void CToolFrameworkClient::PreRender()
{
if ( m_pTools )
{
m_pTools->PreRenderAllTools();
}
}
void CToolFrameworkClient::PostRender()
{
if ( m_pTools )
{
m_pTools->PostRenderAllTools();
}
}
//-----------------------------------------------------------------------------
// Should we render with a 3rd person camera?
//-----------------------------------------------------------------------------
bool CToolFrameworkClient::IsThirdPersonCamera()
{
if ( !m_pTools )
return false;
return m_pTools->IsThirdPersonCamera( );
}
bool ToolFramework_IsThirdPersonCamera( )
{
return g_ToolFrameworkClient.IsThirdPersonCamera( );
}
//-----------------------------------------------------------------------------
// Posts a message to all tools
//-----------------------------------------------------------------------------
void CToolFrameworkClient::PostToolMessage( HTOOLHANDLE hEntity, KeyValues *msg )
{
if ( m_pTools )
{
m_pTools->PostToolMessage( hEntity, msg );
}
}
void ToolFramework_PostToolMessage( HTOOLHANDLE hEntity, KeyValues *msg )
{
g_ToolFrameworkClient.PostToolMessage( hEntity, msg );
}
//-----------------------------------------------------------------------------
// View manipulation
//-----------------------------------------------------------------------------
void CToolFrameworkClient::AdjustEngineViewport( int& x, int& y, int& width, int& height )
{
if ( m_pTools )
{
m_pTools->AdjustEngineViewport( x, y, width, height );
}
}
void ToolFramework_AdjustEngineViewport( int& x, int& y, int& width, int& height )
{
g_ToolFrameworkClient.AdjustEngineViewport( x, y, width, height );
}
//-----------------------------------------------------------------------------
// View manipulation
//-----------------------------------------------------------------------------
bool CToolFrameworkClient::SetupEngineView( Vector &origin, QAngle &angles, float &fov )
{
if ( !m_pTools )
return false;
return m_pTools->SetupEngineView( origin, angles, fov );
}
bool ToolFramework_SetupEngineView( Vector &origin, QAngle &angles, float &fov )
{
return g_ToolFrameworkClient.SetupEngineView( origin, angles, fov );
}
//-----------------------------------------------------------------------------
// microphone manipulation
//-----------------------------------------------------------------------------
bool CToolFrameworkClient::SetupEngineMicrophone( Vector &origin, QAngle &angles )
{
if ( !m_pTools )
return false;
return m_pTools->SetupEngineMicrophone( origin, angles );
}
bool ToolFramework_SetupEngineMicrophone( Vector &origin, QAngle &angles )
{
return g_ToolFrameworkClient.SetupEngineMicrophone( origin, angles );
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,103 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Swap a compiled caption file.
//
// $NoKeywords: $
//=============================================================================//
#include "utlbuffer.h"
#include "byteswap.h"
#include "filesystem.h"
#include "tier2/fileutils.h"
#include "captioncompiler.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
BEGIN_BYTESWAP_DATADESC( CompiledCaptionHeader_t )
DEFINE_FIELD( magic, FIELD_INTEGER ),
DEFINE_FIELD( version, FIELD_INTEGER ),
DEFINE_FIELD( numblocks, FIELD_INTEGER ),
DEFINE_FIELD( blocksize, FIELD_INTEGER ),
DEFINE_FIELD( directorysize, FIELD_INTEGER ),
DEFINE_FIELD( dataoffset, FIELD_INTEGER ),
END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( CaptionLookup_t )
DEFINE_FIELD( hash, FIELD_INTEGER ),
DEFINE_FIELD( blockNum, FIELD_INTEGER ),
DEFINE_FIELD( offset, FIELD_SHORT ),
DEFINE_FIELD( length, FIELD_SHORT ),
END_BYTESWAP_DATADESC()
//-----------------------------------------------------------------------------
// Swap a compiled closecaption file
//-----------------------------------------------------------------------------
bool SwapClosecaptionFile( void *pData )
{
CByteswap swap;
swap.ActivateByteSwapping( true );
CompiledCaptionHeader_t *pHdr = (CompiledCaptionHeader_t*)pData;
if ( IsX360() )
{
// pre-swap file header
swap.SwapFieldsToTargetEndian( pHdr );
}
if ( pHdr->magic != COMPILED_CAPTION_FILEID || pHdr->version != COMPILED_CAPTION_VERSION )
{
// bad data
return false;
}
// lookup headers
pData = (byte*)pData + sizeof(CompiledCaptionHeader_t);
swap.SwapFieldsToTargetEndian( (CaptionLookup_t*)pData, pHdr->directorysize );
// unicode data
pData = (byte*)pHdr + pHdr->dataoffset;
swap.SwapBufferToTargetEndian( (wchar_t*)pData, (wchar_t*)pData, pHdr->numblocks * pHdr->blocksize / sizeof(wchar_t) );
if ( IsPC() )
{
// post-swap file header
swap.SwapFieldsToTargetEndian( pHdr );
}
return true;
}
#if defined( CLIENT_DLL )
//-----------------------------------------------------------------------------
// Callback for UpdateOrCreate - generates .360 file
//-----------------------------------------------------------------------------
static bool CaptionCreateCallback( const char *pSourceName, const char *pTargetName, const char *pPathID, void *pExtraData )
{
// Generate the file
CUtlBuffer buf;
bool bOk = g_pFullFileSystem->ReadFile( pSourceName, pPathID, buf );
if ( bOk )
{
bOk = SwapClosecaptionFile( buf.Base() );
if ( bOk )
{
bOk = g_pFullFileSystem->WriteFile( pTargetName, pPathID, buf );
}
else
{
Warning( "Failed to create %s\n", pTargetName );
}
}
return bOk;
}
//-----------------------------------------------------------------------------
// Calls utility function UpdateOrCreate
//-----------------------------------------------------------------------------
int UpdateOrCreateCaptionFile( const char *pSourceName, char *pTargetName, int maxLen, bool bForce )
{
return ::UpdateOrCreate( pSourceName, pTargetName, maxLen, "GAME", CaptionCreateCallback, bForce );
}
#endif

View File

@@ -0,0 +1,113 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef IGAMEUI_H
#define IGAMEUI_H
#ifdef _WIN32
#pragma once
#endif
#include "interface.h"
#include "vgui/IPanel.h"
#if !defined( _X360 )
#include "xbox/xboxstubs.h"
#endif
// reasons why the user can't connect to a game server
enum ESteamLoginFailure
{
STEAMLOGINFAILURE_NONE,
STEAMLOGINFAILURE_BADTICKET,
STEAMLOGINFAILURE_NOSTEAMLOGIN,
STEAMLOGINFAILURE_VACBANNED,
STEAMLOGINFAILURE_LOGGED_IN_ELSEWHERE
};
enum ESystemNotify
{
SYSTEMNOTIFY_STORAGEDEVICES_CHANGED,
SYSTEMNOTIFY_USER_SIGNEDIN,
SYSTEMNOTIFY_USER_SIGNEDOUT,
SYSTEMNOTIFY_XUIOPENING,
SYSTEMNOTIFY_XUICLOSED,
SYSTEMNOTIFY_INVITE_SHUTDOWN, // Cross-game invite is causing us to shutdown
};
//-----------------------------------------------------------------------------
// Purpose: contains all the functions that the GameUI dll exports
//-----------------------------------------------------------------------------
abstract_class IGameUI
{
public:
// initialization/shutdown
virtual void Initialize( CreateInterfaceFn appFactory ) = 0;
virtual void PostInit() = 0;
// connect to other interfaces at the same level (gameui.dll/server.dll/client.dll)
virtual void Connect( CreateInterfaceFn gameFactory ) = 0;
virtual void Start() = 0;
virtual void Shutdown() = 0;
virtual void RunFrame() = 0;
// notifications
virtual void OnGameUIActivated() = 0;
virtual void OnGameUIHidden() = 0;
// OLD: Use OnConnectToServer2
virtual void OLD_OnConnectToServer(const char *game, int IP, int port) = 0;
virtual void OnDisconnectFromServer_OLD( uint8 eSteamLoginFailure, const char *username ) = 0;
virtual void OnLevelLoadingStarted(bool bShowProgressDialog) = 0;
virtual void OnLevelLoadingFinished(bool bError, const char *failureReason, const char *extendedReason) = 0;
// level loading progress, returns true if the screen needs updating
virtual bool UpdateProgressBar(float progress, const char *statusText) = 0;
// Shows progress desc, returns previous setting... (used with custom progress bars )
virtual bool SetShowProgressText( bool show ) = 0;
// !!!!!!!!!members added after "GameUI011" initial release!!!!!!!!!!!!!!!!!!!
virtual void ShowNewGameDialog( int chapter ) = 0;
// Xbox 360
virtual void SessionNotification( const int notification, const int param = 0 ) = 0;
virtual void SystemNotification( const int notification ) = 0;
virtual void ShowMessageDialog( const uint nType, vgui::Panel *pOwner ) = 0;
virtual void UpdatePlayerInfo( uint64 nPlayerId, const char *pName, int nTeam, byte cVoiceState, int nPlayersNeeded, bool bHost ) = 0;
virtual void SessionSearchResult( int searchIdx, void *pHostData, XSESSION_SEARCHRESULT *pResult, int ping ) = 0;
virtual void OnCreditsFinished( void ) = 0;
// inserts specified panel as background for level load dialog
virtual void SetLoadingBackgroundDialog( vgui::VPANEL panel ) = 0;
// Bonus maps interfaces
virtual void BonusMapUnlock( const char *pchFileName = NULL, const char *pchMapName = NULL ) = 0;
virtual void BonusMapComplete( const char *pchFileName = NULL, const char *pchMapName = NULL ) = 0;
virtual void BonusMapChallengeUpdate( const char *pchFileName, const char *pchMapName, const char *pchChallengeName, int iBest ) = 0;
virtual void BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName ) = 0;
virtual void BonusMapChallengeObjectives( int &iBronze, int &iSilver, int &iGold ) = 0;
virtual void BonusMapDatabaseSave( void ) = 0;
virtual int BonusMapNumAdvancedCompleted( void ) = 0;
virtual void BonusMapNumMedals( int piNumMedals[ 3 ] ) = 0;
virtual void OnConnectToServer2(const char *game, int IP, int connectionPort, int queryPort) = 0;
// X360 Storage device validation:
// returns true right away if storage device has been previously selected.
// otherwise returns false and will set the variable pointed by pStorageDeviceValidated to 1
// once the storage device is selected by user.
virtual bool ValidateStorageDevice( int *pStorageDeviceValidated ) = 0;
virtual void SetProgressOnStart() = 0;
virtual void OnDisconnectFromServer( uint8 eSteamLoginFailure ) = 0;
};
#define GAMEUI_INTERFACE_VERSION "GameUI011"
#endif // IGAMEUI_H

View File

@@ -0,0 +1,363 @@
////////////////////////////////////////////////////////////////////
//
// hl2orange.spa.h
//
// Auto-generated on Thursday, 13 September 2007 at 16:59:17
// XLAST project version 1.0.402.0
// SPA Compiler version 2.0.6274.0
//
////////////////////////////////////////////////////////////////////
#ifndef __THE_ORANGE_BOX_SPA_H__
#define __THE_ORANGE_BOX_SPA_H__
#ifdef __cplusplus
extern "C" {
#endif
//
// Title info
//
#define TITLEID_THE_ORANGE_BOX 0x4541080F
//
// Context ids
//
// These values are passed as the dwContextId to XUserSetContext.
//
#define CONTEXT_CHAPTER_HL2 0
#define CONTEXT_SCENARIO 1
#define CONTEXT_GAME 2
#define CONTEXT_CHAPTER_EP1 3
#define CONTEXT_CHAPTER_EP2 4
#define CONTEXT_CHAPTER_PORTAL 5
//
// Context values
//
// These values are passed as the dwContextValue to XUserSetContext.
//
// Values for CONTEXT_CHAPTER_HL2
#define CONTEXT_CHAPTER_HL2_POINT_INSERTION 0
#define CONTEXT_CHAPTER_HL2_A_RED_LETTER_DAY 1
#define CONTEXT_CHAPTER_HL2_ROUTE_KANAL 2
#define CONTEXT_CHAPTER_HL2_WATER_HAZARD 3
#define CONTEXT_CHAPTER_HL2_BLACK_MESA_EAST 4
#define CONTEXT_CHAPTER_HL2_RAVENHOLM 5
#define CONTEXT_CHAPTER_HL2_HIGHWAY_17 6
#define CONTEXT_CHAPTER_HL2_SANDTRAPS 7
#define CONTEXT_CHAPTER_HL2_NOVA_PROSPEKT 8
#define CONTEXT_CHAPTER_HL2_ENTANGLEMENT 9
#define CONTEXT_CHAPTER_HL2_ANTICITIZEN_ONE 10
#define CONTEXT_CHAPTER_HL2_FOLLOW_FREEMAN 11
#define CONTEXT_CHAPTER_HL2_OUR_BENEFACTORS 12
#define CONTEXT_CHAPTER_HL2_DARK_ENERGY 13
// Values for CONTEXT_SCENARIO
#define CONTEXT_SCENARIO_CTF_2FORT 0
#define CONTEXT_SCENARIO_CP_DUSTBOWL 1
#define CONTEXT_SCENARIO_CP_GRANARY 2
#define CONTEXT_SCENARIO_CP_WELL 3
#define CONTEXT_SCENARIO_CP_GRAVELPIT 4
#define CONTEXT_SCENARIO_TC_HYDRO 5
#define CONTEXT_SCENARIO_CTF_CLOAK 6
#define CONTEXT_SCENARIO_CP_CLOAK 7
// Values for CONTEXT_GAME
#define CONTEXT_GAME_GAME_HALF_LIFE_2 0
#define CONTEXT_GAME_GAME_EPISODE_ONE 1
#define CONTEXT_GAME_GAME_EPISODE_TWO 2
#define CONTEXT_GAME_GAME_PORTAL 3
#define CONTEXT_GAME_GAME_TEAM_FORTRESS 4
// Values for CONTEXT_CHAPTER_EP1
#define CONTEXT_CHAPTER_EP1_UNDUE_ALARM 0
#define CONTEXT_CHAPTER_EP1_DIRECT_INTERVENTION 1
#define CONTEXT_CHAPTER_EP1_LOWLIFE 2
#define CONTEXT_CHAPTER_EP1_URBAN_FLIGHT 3
#define CONTEXT_CHAPTER_EP1_EXIT_17 4
// Values for CONTEXT_CHAPTER_EP2
#define CONTEXT_CHAPTER_EP2_TO_THE_WHITE_FOREST 0
#define CONTEXT_CHAPTER_EP2_THIS_VORTAL_COIL 1
#define CONTEXT_CHAPTER_EP2_FREEMAN_PONTIFEX 2
#define CONTEXT_CHAPTER_EP2_RIDING_SHOTGUN 3
#define CONTEXT_CHAPTER_EP2_UNDER_THE_RADAR 4
#define CONTEXT_CHAPTER_EP2_OUR_MUTUAL_FIEND 5
#define CONTEXT_CHAPTER_EP2_T_MINUS_ONE 6
// Values for CONTEXT_CHAPTER_PORTAL
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_00 0
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_04 1
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_08 2
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_10 3
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_13 4
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_14 5
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_15 6
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_16 7
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_17 8
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_18 9
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_19 10
// Values for X_CONTEXT_PRESENCE
#define CONTEXT_PRESENCE_TF_CP 0
#define CONTEXT_PRESENCE_TF_CTF_LOSING 1
#define CONTEXT_PRESENCE_TF_CTF_TIED 2
#define CONTEXT_PRESENCE_TF_CTF_WINNING 3
#define CONTEXT_PRESENCE_APPCHOOSER 4
#define CONTEXT_PRESENCE_MENU 5
#define CONTEXT_PRESENCE_EP1_INGAME 6
#define CONTEXT_PRESENCE_HL2_INGAME 7
#define CONTEXT_PRESENCE_EP2_INGAME 8
#define CONTEXT_PRESENCE_PORTAL_INGAME 9
#define CONTEXT_PRESENCE_COMMENTARY 10
#define CONTEXT_PRESENCE_IDLE 11
// Values for X_CONTEXT_GAME_MODE
#define CONTEXT_GAME_MODE_MULTIPLAYER 0
#define CONTEXT_GAME_MODE_SINGLEPLAYER 1
//
// Property ids
//
// These values are passed as the dwPropertyId value to XUserSetProperty
// and as the dwPropertyId value in the XUSER_PROPERTY structure.
//
#define PROPERTY_CAPS_OWNED 0x10000000
#define PROPERTY_CAPS_TOTAL 0x10000001
#define PROPERTY_PLAYER_TEAM_SCORE 0x10000002
#define PROPERTY_OPPONENT_TEAM_SCORE 0x10000003
#define PROPERTY_FLAG_CAPTURE_LIMIT 0x1000000B
#define PROPERTY_NUMBER_OF_ROUNDS 0x1000000C
#define PROPERTY_GAME_SIZE 0x1000000D
#define PROPERTY_AUTOBALANCE 0x1000000E
#define PROPERTY_PRIVATE_SLOTS 0x1000000F
#define PROPERTY_MAX_GAME_TIME 0x10000010
#define PROPERTY_NUMBER_OF_KILLS 0x10000011
#define PROPERTY_DAMAGE_DEALT 0x10000012
#define PROPERTY_PLAY_TIME 0x10000013
#define PROPERTY_POINT_CAPTURES 0x10000014
#define PROPERTY_POINT_DEFENSES 0x10000015
#define PROPERTY_DOMINATIONS 0x10000016
#define PROPERTY_REVENGE 0x10000017
#define PROPERTY_BUILDINGS_DESTROYED 0x10000019
#define PROPERTY_HEADSHOTS 0x1000001A
#define PROPERTY_HEALTH_POINTS_HEALED 0x1000001B
#define PROPERTY_INVULNS 0x1000001C
#define PROPERTY_KILL_ASSISTS 0x1000001D
#define PROPERTY_BACKSTABS 0x1000001E
#define PROPERTY_HEALTH_POINTS_LEACHED 0x1000001F
#define PROPERTY_BUILDINGS_BUILT 0x10000020
#define PROPERTY_SENTRY_KILLS 0x10000021
#define PROPERTY_TELEPORTS 0x10000022
#define PROPERTY_KILLS 0x10000023
#define PROPERTY_NUMBER_OF_TEAMS 0x10000025
#define PROPERTY_TEAM_RED 0x10000026
#define PROPERTY_TEAM_BLUE 0x10000027
#define PROPERTY_TEAM_SPECTATOR 0x10000028
#define PROPERTY_TEAM 0x10000029
#define PROPERTY_WIN_LIMIT 0x1000002A
#define PROPERTY_RANKING_TEST 0x2000000A
#define PROPERTY_POINTS_SCORED 0x20000018
//
// Achievement ids
//
// These values are used in the dwAchievementId member of the
// XUSER_ACHIEVEMENT structure that is used with
// XUserWriteAchievements and XUserCreateAchievementEnumerator.
//
#define ACHIEVEMENT_HLX_KILL_ENEMIES_WITHPHYSICS 43
#define ACHIEVEMENT_HLX_KILL_ENEMY_WITHHOPPERMINE 44
#define ACHIEVEMENT_HLX_KILL_ENEMIES_WITHMANHACK 45
#define ACHIEVEMENT_HLX_KILL_SOLDIER_WITHHISGRENADE 46
#define ACHIEVEMENT_HLX_KILL_ENEMIES_WITHONEENERGYBALL 47
#define ACHIEVEMENT_HLX_KILL_ELITESOLDIER_WITHHISENERGYBALL 48
#define ACHIEVEMENT_EPX_GET_ZOMBINEGRENADE 50
#define ACHIEVEMENT_EPX_KILL_ZOMBIES_WITHFLARES 51
#define ACHIEVEMENT_HL2_HIT_CANCOP_WITHCAN 52
#define ACHIEVEMENT_HL2_PUT_CANINTRASH 53
#define ACHIEVEMENT_HL2_ESCAPE_APARTMENTRAID 54
#define ACHIEVEMENT_HL2_BREAK_MINITELEPORTER 55
#define ACHIEVEMENT_HL2_GET_CROWBAR 56
#define ACHIEVEMENT_HL2_KILL_BARNACLESWITHBARREL 57
#define ACHIEVEMENT_HL2_GET_AIRBOAT 58
#define ACHIEVEMENT_HL2_GET_AIRBOATGUN 60
#define ACHIEVEMENT_HL2_FIND_VORTIGAUNTCAVE 61
#define ACHIEVEMENT_HL2_KILL_CHOPPER 62
#define ACHIEVEMENT_HL2_FIND_HEVFACEPLATE 63
#define ACHIEVEMENT_HL2_GET_GRAVITYGUN 64
#define ACHIEVEMENT_HL2_MAKEABASKET 65
#define ACHIEVEMENT_HL2_BEAT_RAVENHOLM_NOWEAPONS 66
#define ACHIEVEMENT_HL2_BEAT_CEMETERY 67
#define ACHIEVEMENT_HL2_KILL_ENEMIES_WITHCRANE 68
#define ACHIEVEMENT_HL2_PIN_SOLDIER_TOBILLBOARD 69
#define ACHIEVEMENT_HL2_KILL_ODESSAGUNSHIP 70
#define ACHIEVEMENT_HL2_KILL_THREEGUNSHIPS 71
#define ACHIEVEMENT_HL2_BEAT_DONTTOUCHSAND 72
#define ACHIEVEMENT_HL2_KILL_ENEMIES_WITHANTLIONS 74
#define ACHIEVEMENT_HL2_KILL_ENEMY_WITHTOILET 75
#define ACHIEVEMENT_HL2_BEAT_TURRETSTANDOFF2 76
#define ACHIEVEMENT_HL2_BEAT_TOXICTUNNEL 78
#define ACHIEVEMENT_HL2_BEAT_PLAZASTANDOFF 79
#define ACHIEVEMENT_HL2_KILL_ALLC1709SNIPERS 80
#define ACHIEVEMENT_HL2_BEAT_SUPRESSIONDEVICE 81
#define ACHIEVEMENT_HL2_BEAT_C1713STRIDERSTANDOFF 82
#define ACHIEVEMENT_HL2_BEAT_GAME 84
#define ACHIEVEMENT_HL2_FIND_ALLLAMBDAS 86
#define ACHIEVEMENT_EP1_BEAT_MAINELEVATOR 87
#define ACHIEVEMENT_EP1_BEAT_CITADELCORE 88
#define ACHIEVEMENT_EP1_BEAT_CITADELCORE_NOSTALKERKILLS 89
#define ACHIEVEMENT_EP1_KILL_ANTLIONS_WITHCARS 90
#define ACHIEVEMENT_EP1_BEAT_GARAGEELEVATORSTANDOFF 91
#define ACHIEVEMENT_EP1_KILL_ENEMIES_WITHSNIPERALYX 92
#define ACHIEVEMENT_EP1_BEAT_HOSPITALATTICGUNSHIP 93
#define ACHIEVEMENT_EP1_BEAT_CITIZENESCORT_NOCITIZENDEATHS 94
#define ACHIEVEMENT_EP1_BEAT_GAME 95
#define ACHIEVEMENT_EP1_BEAT_GAME_ONEBULLET 96
#define ACHIEVEMENT_EP2_KILL_POISONANTLION 97
#define ACHIEVEMENT_EP2_KILL_ALLGRUBS 98
#define ACHIEVEMENT_EP2_BREAK_ALLWEBS 99
#define ACHIEVEMENT_EP2_BEAT_ANTLIONINVASION 100
#define ACHIEVEMENT_EP2_BEAT_ANTLIONGUARDS 101
#define ACHIEVEMENT_EP2_KILL_ENEMIES_WITHCAR 102
#define ACHIEVEMENT_EP2_BEAT_HUNTERAMBUSH 103
#define ACHIEVEMENT_EP2_KILL_CHOPPER_NOMISSES 104
#define ACHIEVEMENT_EP2_KILL_COMBINECANNON 105
#define ACHIEVEMENT_EP2_FIND_ALLRADARCACHES 106
#define ACHIEVEMENT_EP2_BEAT_ROCKETCACHEPUZZLE 107
#define ACHIEVEMENT_EP2_BEAT_RACEWITHDOG 108
#define ACHIEVEMENT_EP2_BEAT_WHITEFORESTINN 109
#define ACHIEVEMENT_EP2_PUT_ITEMINROCKET 110
#define ACHIEVEMENT_EP2_BEAT_MISSILESILO2 111
#define ACHIEVEMENT_EP2_BEAT_OUTLAND12_NOBUILDINGSDESTROYED 112
#define ACHIEVEMENT_EP2_BEAT_GAME 113
#define ACHIEVEMENT_EP2_KILL_HUNTER_WITHFLECHETTES 114
#define ACHIEVEMENT_PORTAL_GET_PORTALGUNS 115
#define ACHIEVEMENT_PORTAL_KILL_COMPANIONCUBE 116
#define ACHIEVEMENT_PORTAL_ESCAPE_TESTCHAMBERS 117
#define ACHIEVEMENT_PORTAL_BEAT_GAME 118
#define ACHIEVEMENT_PORTAL_INFINITEFALL 119
#define ACHIEVEMENT_PORTAL_LONGJUMP 120
#define ACHIEVEMENT_PORTAL_BEAT_2ADVANCEDMAPS 121
#define ACHIEVEMENT_PORTAL_BEAT_4ADVANCEDMAPS 122
#define ACHIEVEMENT_PORTAL_BEAT_6ADVANCEDMAPS 123
#define ACHIEVEMENT_PORTAL_GET_ALLBRONZE 124
#define ACHIEVEMENT_PORTAL_GET_ALLSILVER 125
#define ACHIEVEMENT_PORTAL_GET_ALLGOLD 126
#define ACHIEVEMENT_TF_GET_TURRETKILLS 127
#define ACHIEVEMENT_TF_KILL_NEMESIS 128
#define ACHIEVEMENT_TF_GET_CONSECUTIVEKILLS_NODEATHS 129
#define ACHIEVEMENT_TF_GET_HEALED_BYENEMY 130
#define ACHIEVEMENT_TF_PLAY_GAME_FRIENDSONLY 131
#define ACHIEVEMENT_TF_WIN_MULTIPLEGAMES 132
#define ACHIEVEMENT_TF_GET_MULTIPLEKILLS 133
#define ACHIEVEMENT_TF_WIN_2FORT_NOENEMYCAPS 134
#define ACHIEVEMENT_TF_WIN_WELL_MINIMUMTIME 135
#define ACHIEVEMENT_TF_WIN_HYDRO_NOENEMYCAPS 136
#define ACHIEVEMENT_TF_WIN_DUSTBOWL_NOENEMYCAPS 137
#define ACHIEVEMENT_TF_WIN_GRAVELPIT_NOENEMYCAPS 138
#define ACHIEVEMENT_TF_PLAY_GAME_EVERYCLASS 139
#define ACHIEVEMENT_TF_PLAY_GAME_EVERYMAP 140
#define ACHIEVEMENT_TF_GET_HEALPOINTS 141
#define ACHIEVEMENT_TF_BURN_PLAYERSINMINIMIMTIME 142
#define ACHIEVEMENT_HL2_DISINTEGRATE_SOLDIERSINFIELD 143
#define ACHIEVEMENT_HL2_FOLLOW_FREEMAN 144
#define ACHIEVEMENT_TF_GET_HEADSHOTS 145
#define ACHIEVEMENT_PORTAL_DETACH_ALL_CAMERAS 146
#define ACHIEVEMENT_PORTAL_HIT_TURRET_WITH_TURRET 148
//
// Stats view ids
//
// These are used in the dwViewId member of the XUSER_STATS_SPEC structure
// passed to the XUserReadStats* and XUserCreateStatsEnumerator* functions.
//
// Skill leaderboards for ranked game modes
#define STATS_VIEW_SKILL_RANKED_MULTIPLAYER 0xFFFF0000
#define STATS_VIEW_SKILL_RANKED_SINGLEPLAYER 0xFFFF0001
// Skill leaderboards for unranked (standard) game modes
#define STATS_VIEW_SKILL_STANDARD_MULTIPLAYER 0xFFFE0000
#define STATS_VIEW_SKILL_STANDARD_SINGLEPLAYER 0xFFFE0001
// Title defined leaderboards
#define STATS_VIEW_PLAYER_MAX_UNRANKED 1
#define STATS_VIEW_PLAYER_MAX_RANKED 2
//
// Stats view column ids
//
// These ids are used to read columns of stats views. They are specified in
// the rgwColumnIds array of the XUSER_STATS_SPEC structure. Rank, rating
// and gamertag are not retrieved as custom columns and so are not included
// in the following definitions. They can be retrieved from each row's
// header (e.g., pStatsResults->pViews[x].pRows[y].dwRank, etc.).
//
// Column ids for PLAYER_MAX_UNRANKED
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_POINTS_SCORED 2
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_KILLS 3
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_POINTS_CAPPED 1
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_DAMAGE_DEALT 4
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_PLAY_TIME 5
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_POINT_DEFENSES 6
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_DOMINATIONS 7
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_REVENGE 8
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_BUILDINGS_DESTROYED 9
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_HEADSHOTS 10
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_HEALTH_POINTS_HEALED 11
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_INVULNS 12
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_KILL_ASSISTS 13
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_BACKSTABS 14
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_HEALTH_POINTS_LEACHED 15
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_BUILDINGS_BUILT 16
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_SENTRY_KILLS 17
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_TELEPORTS 18
// Column ids for PLAYER_MAX_RANKED
#define STATS_COLUMN_PLAYER_MAX_RANKED_POINTS_SCORED 2
//
// Matchmaking queries
//
// These values are passed as the dwProcedureIndex parameter to
// XSessionSearch to indicate which matchmaking query to run.
//
#define SESSION_MATCH_QUERY_PLAYER_MATCH 0
//
// Gamer pictures
//
// These ids are passed as the dwPictureId parameter to XUserAwardGamerTile.
//
#ifdef __cplusplus
}
#endif
#endif // __THE_ORANGE_BOX_SPA_H__

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
//========= Copyright <20> 1996-2006, Valve LLC, All rights reserved. ============
//
// Purpose: StudioMDL byteswapping functions.
//
// $NoKeywords: $
//=============================================================================
#ifndef STUDIOBYTESWAP_H
#define STUDIOBYTESWAP_H
#if defined(_WIN32)
#pragma once
#endif
#include "byteswap.h"
struct studiohdr_t;
class IPhysicsCollision;
namespace StudioByteSwap
{
typedef bool (*CompressFunc_t)( const void *pInput, int inputSize, void **pOutput, int *pOutputSize );
//void SetTargetBigEndian( bool bigEndian );
void ActivateByteSwapping( bool bActivate );
void SourceIsNative( bool bActivate );
void SetVerbose( bool bVerbose );
void SetCollisionInterface( IPhysicsCollision *pPhysicsCollision );
int ByteswapStudioFile( const char *pFilename, void *pOutBase, const void *pFileBase, int fileSize, studiohdr_t *pHdr, CompressFunc_t pCompressFunc = NULL );
int ByteswapPHY( void *pOutBase, const void *pFileBase, int fileSize );
int ByteswapANI( studiohdr_t* pHdr, void *pOutBase, const void *pFileBase, int filesize );
int ByteswapVVD( void *pOutBase, const void *pFileBase, int fileSize );
int ByteswapVTX( void *pOutBase, const void *pFileBase, int fileSize );
int ByteswapMDL( void *pOutBase, const void *pFileBase, int fileSize );
#define BYTESWAP_ALIGNMENT_PADDING 4096
}
#endif // STUDIOBYTESWAP_H

View File

@@ -1,56 +1,47 @@
//========= Copyright <20> 1996-2004, Valve LLC, All rights reserved. ============
//
// Purpose: Win32 replacements for Xbox code
// Purpose: Win32 replacements for XBox.
//
//=============================================================================
#ifndef XBOXSTUBS_H
#if !defined( XBOXSTUBS_H ) && !defined( _X360 )
#define XBOXSTUBS_H
#ifdef _WIN32
#pragma once
#endif
#include "tier0/platform.h"
#define XDEVICE_TYPE_GAMEPAD 0
#define XDEVICE_TYPE_MEMORY_UNIT 1
#define XDEVICE_TYPE_VOICE_MICROPHONE 2
#define XDEVICE_TYPE_VOICE_HEADPHONE 3
#define XDEVICE_TYPE_HIGHFIDELITY_MICROPHONE 4
// Content creation/open flags
#define XCONTENTFLAG_NONE 0x00
#define XCONTENTFLAG_CREATENEW 0x00
#define XCONTENTFLAG_CREATEALWAYS 0x00
#define XCONTENTFLAG_OPENEXISTING 0x00
#define XCONTENTFLAG_OPENALWAYS 0x00
#define XCONTENTFLAG_TRUNCATEEXISTING 0x00
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
#define XINPUT_GAMEPAD_START 0x0010
#define XINPUT_GAMEPAD_BACK 0x0020
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
#define XINPUT_LIGHTGUN_ONSCREEN 0x2000
#define XINPUT_LIGHTGUN_FRAME_DOUBLER 0x4000
#define XINPUT_LIGHTGUN_LINE_DOUBLER 0x8000
#define XINPUT_GAMEPAD_A 0
#define XINPUT_GAMEPAD_B 1
#define XINPUT_GAMEPAD_X 2
#define XINPUT_GAMEPAD_Y 3
#define XINPUT_GAMEPAD_BLACK 4
#define XINPUT_GAMEPAD_WHITE 5
#define XINPUT_GAMEPAD_LEFT_TRIGGER 6
#define XINPUT_GAMEPAD_RIGHT_TRIGGER 7
// Content attributes
#define XCONTENTFLAG_NOPROFILE_TRANSFER 0x00
#define XCONTENTFLAG_NODEVICE_TRANSFER 0x00
#define XCONTENTFLAG_STRONG_SIGNED 0x00
#define XCONTENTFLAG_ALLOWPROFILE_TRANSFER 0x00
#define XCONTENTFLAG_MOVEONLY_TRANSFER 0x00
// Console device ports
#define XDEVICE_PORT0 0
#define XDEVICE_PORT1 1
#define XDEVICE_PORT2 2
#define XDEVICE_PORT3 3
#define XBX_MAX_DPORTS 4
#define XUSER_MAX_COUNT 4
#define XUSER_INDEX_NONE 0x000000FE
#define XDEVICE_NO_SLOT 0
#define XDEVICE_TOP_SLOT 0
#define XDEVICE_BOTTOM_SLOT 1
#define XBX_CLR_DEFAULT 0xFF000000
#define XBX_CLR_WARNING 0x0000FFFF
#define XBX_CLR_ERROR 0x000000FF
#define CLR_DEFAULT 0xFF000000
#define CLR_WARNING 0x0000FFFF
#define CLR_ERROR 0x000000FF
#define XBOX_MINBORDERSAFE 0
#define XBOX_MAXBORDERSAFE 0
typedef enum
{
@@ -67,8 +58,8 @@ typedef enum
XK_BUTTON_B,
XK_BUTTON_X,
XK_BUTTON_Y,
XK_BUTTON_BLACK,
XK_BUTTON_WHITE,
XK_BUTTON_LEFT_SHOULDER,
XK_BUTTON_RIGHT_SHOULDER,
XK_BUTTON_LTRIGGER,
XK_BUTTON_RTRIGGER,
XK_STICK1_UP,
@@ -82,93 +73,164 @@ typedef enum
XK_MAX_KEYS,
} xKey_t;
typedef enum
{
XVRB_NONE, // off
XVRB_ERROR, // fatal error
XVRB_ALWAYS, // no matter what
XVRB_WARNING, // non-fatal warnings
XVRB_STATUS, // status reports
XVRB_ALL,
} xverbose_e;
//typedef enum
//{
// XVRB_NONE, // off
// XVRB_ERROR, // fatal error
// XVRB_ALWAYS, // no matter what
// XVRB_WARNING, // non-fatal warnings
// XVRB_STATUS, // status reports
// XVRB_ALL,
//} xverbose_e;
typedef unsigned short WORD;
#ifndef _LINUX
typedef unsigned long DWORD;
#endif
typedef void* HANDLE;
typedef DWORD COLORREF;
#endif
typedef struct _XINPUT_RUMBLE
#ifdef _LINUX
typedef int32 COLORREF;
#endif
#ifndef INVALID_HANDLE_VALUE
#define INVALID_HANDLE_VALUE ((HANDLE)-1)
#endif
// typedef struct {
// IN_ADDR ina; // IP address (zero if not static/DHCP)
// IN_ADDR inaOnline; // Online IP address (zero if not online)
// WORD wPortOnline; // Online port
// BYTE abEnet[6]; // Ethernet MAC address
// BYTE abOnline[20]; // Online identification
// } XNADDR;
typedef int XNADDR;
typedef uint64 XUID;
typedef struct {
BYTE ab[8]; // xbox to xbox key identifier
} XNKID;
typedef struct {
BYTE ab[16]; // xbox to xbox key exchange key
} XNKEY;
typedef struct _XSESSION_INFO
{
WORD wLeftMotorSpeed;
WORD wRightMotorSpeed;
} XINPUT_RUMBLE, *PXINPUT_RUMBLE;
XNKID sessionID; // 8 bytes
XNADDR hostAddress; // 36 bytes
XNKEY keyExchangeKey; // 16 bytes
} XSESSION_INFO, *PXSESSION_INFO;
#define XINPUT_FEEDBACK_HEADER_INTERNAL_SIZE 58
typedef struct _XINPUT_FEEDBACK_HEADER
typedef struct _XUSER_DATA
{
DWORD dwStatus;
void* hEvent;
BYTE Reserved[XINPUT_FEEDBACK_HEADER_INTERNAL_SIZE];
} XINPUT_FEEDBACK_HEADER, *PXINPUT_FEEDBACK_HEADER;
BYTE type;
typedef struct _XINPUT_FEEDBACK
union
{
int nData; // XUSER_DATA_TYPE_INT32
int64 i64Data; // XUSER_DATA_TYPE_INT64
double dblData; // XUSER_DATA_TYPE_DOUBLE
struct // XUSER_DATA_TYPE_UNICODE
{
uint cbData; // Includes null-terminator
char * pwszData;
} string;
float fData; // XUSER_DATA_TYPE_FLOAT
struct // XUSER_DATA_TYPE_BINARY
{
uint cbData;
char * pbData;
} binary;
};
} XUSER_DATA, *PXUSER_DATA;
typedef struct _XUSER_PROPERTY
{
XINPUT_FEEDBACK_HEADER Header;
union
{
XINPUT_RUMBLE Rumble;
};
} XINPUT_FEEDBACK, *PXINPUT_FEEDBACK;
DWORD dwPropertyId;
XUSER_DATA value;
} XUSER_PROPERTY, *PXUSER_PROPERTY;
typedef struct _XINPUT_GAMEPAD
typedef struct _XUSER_CONTEXT
{
WORD wButtons;
BYTE bAnalogButtons[8];
short sThumbLX;
short sThumbLY;
short sThumbRX;
short sThumbRY;
} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
DWORD dwContextId;
DWORD dwValue;
} XUSER_CONTEXT, *PXUSER_CONTEXT;
typedef struct _XPP_DEVICE_TYPE
typedef struct _XSESSION_SEARCHRESULT
{
unsigned long Reserved[3];
} XPP_DEVICE_TYPE, *PXPP_DEVICE_TYPE;
XSESSION_INFO info;
DWORD dwOpenPublicSlots;
DWORD dwOpenPrivateSlots;
DWORD dwFilledPublicSlots;
DWORD dwFilledPrivateSlots;
DWORD cProperties;
DWORD cContexts;
PXUSER_PROPERTY pProperties;
PXUSER_CONTEXT pContexts;
} XSESSION_SEARCHRESULT, *PXSESSION_SEARCHRESULT;
typedef struct _XDEVICE_PREALLOC_TYPE
typedef struct _XSESSION_SEARCHRESULT_HEADER
{
PXPP_DEVICE_TYPE DeviceType;
DWORD dwPreallocCount;
} XDEVICE_PREALLOC_TYPE, *PXDEVICE_PREALLOC_TYPE;
DWORD dwSearchResults;
XSESSION_SEARCHRESULT *pResults;
} XSESSION_SEARCHRESULT_HEADER, *PXSESSION_SEARCHRESULT_HEADER;
typedef struct _XINPUT_STATE
typedef struct _XSESSION_REGISTRANT
{
DWORD dwPacketNumber;
XINPUT_GAMEPAD Gamepad;
} XINPUT_STATE, *PXINPUT_STATE;
uint64 qwMachineID;
DWORD bTrustworthiness;
DWORD bNumUsers;
XUID *rgUsers;
typedef struct _XINPUT_POLLING_PARAMETERS
} XSESSION_REGISTRANT;
typedef struct _XSESSION_REGISTRATION_RESULTS
{
BYTE fAutoPoll:1;
BYTE fInterruptOut:1;
BYTE ReservedMBZ1:6;
BYTE bInputInterval;
BYTE bOutputInterval;
BYTE ReservedMBZ2;
} XINPUT_POLLING_PARAMETERS, *PXINPUT_POLLING_PARAMETERS;
DWORD wNumRegistrants;
XSESSION_REGISTRANT *rgRegistrants;
} XSESSION_REGISTRATION_RESULTS, *PXSESSION_REGISTRATION_RESULTS;
void XBX_DebugString(xverbose_e verbose, COLORREF color, const char* format, ...);
void XBX_ProcessEvents(void);
void XInitDevices(DWORD dwPreallocTypeCount, PXDEVICE_PREALLOC_TYPE PreallocTypes);
DWORD XGetDevices(PXPP_DEVICE_TYPE DeviceType);
bool XGetDeviceChanges(PXPP_DEVICE_TYPE DeviceType, DWORD *pdwInsertions, DWORD *pdwRemovals);
HANDLE XInputOpen(PXPP_DEVICE_TYPE DeviceType, DWORD dwPort, DWORD dwSlot, PXINPUT_POLLING_PARAMETERS pPollingParameters);
void XInputClose(HANDLE hDevice);
DWORD XInputSetState(HANDLE hDevice, PXINPUT_FEEDBACK pFeedback);
DWORD XInputGetState(HANDLE hDevice, PXINPUT_STATE pState);
DWORD XInputPoll(HANDLE hDevice);
unsigned int XBX_GetSystemTime(void);
typedef struct {
BYTE bFlags;
BYTE bReserved;
WORD cProbesXmit;
WORD cProbesRecv;
WORD cbData;
BYTE * pbData;
WORD wRttMinInMsecs;
WORD wRttMedInMsecs;
DWORD dwUpBitsPerSec;
DWORD dwDnBitsPerSec;
} XNQOSINFO;
typedef struct {
uint cxnqos;
uint cxnqosPending;
XNQOSINFO axnqosinfo[1];
} XNQOS;
#define XSESSION_CREATE_HOST 0
#define XUSER_DATA_TYPE_INT32 0
#define XSESSION_CREATE_USES_ARBITRATION 0
#define XNET_QOS_LISTEN_ENABLE 0
#define XNET_QOS_LISTEN_DISABLE 0
#define XNET_QOS_LISTEN_SET_DATA 0
FORCEINLINE void XBX_ProcessEvents() {}
FORCEINLINE unsigned int XBX_GetSystemTime() { return 0; }
FORCEINLINE int XBX_GetPrimaryUserId() { return 0; }
FORCEINLINE void XBX_SetPrimaryUserId( DWORD idx ) {}
FORCEINLINE int XBX_GetStorageDeviceId() { return 0; }
FORCEINLINE void XBX_SetStorageDeviceId( DWORD idx ) {}
FORCEINLINE const char *XBX_GetLanguageString() { return ""; }
FORCEINLINE bool XBX_IsLocalized() { return false; }
#define XCONTENT_MAX_DISPLAYNAME_LENGTH 128
#define XCONTENT_MAX_FILENAME_LENGTH 42
#define XBX_INVALID_STORAGE_ID ((DWORD) -1)
#define XBX_STORAGE_DECLINED ((DWORD) -2)
#endif // XBOXSTUBS_H

View File

@@ -0,0 +1,22 @@
use File::DosGlob;
@ARGV = map {
my @g = File::DosGlob::glob($_) if /[*?]/;
@g ? @g : $_;
} @ARGV;
open FILE, ">__tmpshaderlist.txt";
foreach $arg (@ARGV)
{
if( $arg =~ m/\.fxc$/i || $arg =~ m/\.vsh$/i || $arg =~ m/\.psh$/i )
{
print $arg . "\n";
print FILE $arg . "\n";
}
}
close FILE;
system "buildshaders.bat __tmpshaderlist";
unlink "__tmpshaderlist.txt";

View File

@@ -0,0 +1,116 @@
use String::CRC32;
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
sub GetShaderType
{
my $shadername = shift;
my $shadertype;
if( $shadername =~ m/\.vsh/i )
{
$shadertype = "vsh";
}
elsif( $shadername =~ m/\.psh/i )
{
$shadertype = "psh";
}
elsif( $shadername =~ m/\.fxc/i )
{
$shadertype = "fxc";
}
else
{
die;
}
return $shadertype;
}
sub GetShaderSrc
{
my $shadername = shift;
if ( $shadername =~ m/^(.*)-----/i )
{
return $1;
}
else
{
return $shadername;
}
}
sub GetShaderType
{
my $shadername = shift;
my $shadertype;
if( $shadername =~ m/\.vsh/i )
{
$shadertype = "vsh";
}
elsif( $shadername =~ m/\.psh/i )
{
$shadertype = "psh";
}
elsif( $shadername =~ m/\.fxc/i )
{
$shadertype = "fxc";
}
else
{
die;
}
return $shadertype;
}
sub GetShaderBase
{
my $shadername = shift;
if ( $shadername =~ m/-----(.*)$/i )
{
return $1;
}
else
{
my $shadertype = &GetShaderType( $shadername );
$shadername =~ s/\.$shadertype//i;
return $shadername;
}
}
$g_x360 = 0;
$g_vcsext = ".vcs";
while( 1 )
{
$inputbase = shift;
if( $inputbase =~ m/-x360/ )
{
$g_x360 = 1;
$g_vcsext = ".360.vcs";
}
else
{
last;
}
}
# rip the txt off the end if it's there.
$inputbase =~ s/\.txt//i;
my @srcfiles = &LoadShaderListFile( $inputbase );
foreach $srcfile ( @srcfiles )
{
my $shadertype = &GetShaderType( $srcfile );
my $shaderbase = &GetShaderBase( $srcfile );
my $shadersrc = &GetShaderSrc( $srcfile );
my $vcsFileName = "..\\..\\..\\game\\hl2\\shaders\\$shadertype\\$shaderbase" . $g_vcsext;
# print "shadersrc: $shadersrc vcsFileName: $vcsFileName\n";
if( $g_x360 && ( $shaderbase =~ m/_ps20$/i ) )
{
next; # skip _ps20 files for 360
}
&CheckCRCAgainstTarget( $shadersrc, $vcsFileName, 1 );
}

View File

@@ -0,0 +1,75 @@
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
use Cwd;
use String::CRC32;
my $txtfilename = shift;
my $arg = shift;
my $is360 = 0;
my $platformextension = "";
if( $arg =~ m/-x360/i )
{
$is360 = 1;
$platformextension = ".360";
}
open TXTFILE, "<$txtfilename";
my $src;
my $dst;
while( $src = <TXTFILE> )
{
# get rid of comments
$src =~ s,//.*,,g;
# skip blank lines
if( $src =~ m/^\s*$/ )
{
next;
}
# Get rid of newlines.
$src =~ s/\n//g;
# Save off the shader source filename.
my $dst = $src;
$dst =~ s/_tmp//gi;
# Does the dst exist?
my $dstexists = -e $dst;
my $srcexists = -e $src;
# What are the time stamps for the src and dst?
my $srcmodtime = ( stat $src )[9];
my $dstmodtime = ( stat $dst )[9];
# Open for edit or add if different than what is in perforce already.
if( !$dstexists || ( $srcmodtime != $dstmodtime ) )
{
# Make the target writable if it exists
if( $dstexists )
{
MakeFileWritable( $dst );
}
my $dir = $dst;
$dir =~ s,([^/\\]*$),,; # rip the filename off the end
my $filename = $1;
# create the target directory if it doesn't exist
if( !$dstexists )
{
&MakeDirHier( $dir, 0777 );
}
# copy the file to its targets. . . we want to see STDERR here if there is an error.
my $cmd = "copy $src $dst > nul";
# print STDERR "$cmd\n";
system $cmd;
MakeFileReadOnly( $dst );
}
}
close TXTFILE;

View File

@@ -0,0 +1,161 @@
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
use Cwd;
use String::CRC32;
sub ReadInputFileWithIncludes
{
local( $filename ) = shift;
local( *INPUT );
local( $output );
open INPUT, "<$filename" || die;
local( $line );
local( $linenum ) = 1;
while( $line = <INPUT> )
{
if( $line =~ m/\#include\s+\"(.*)\"/i )
{
$output.= ReadInputFileWithIncludes( $1 );
}
else
{
$output .= $line;
}
}
close INPUT;
return $output;
}
sub PatchCRC
{
my $filename = shift;
my $crc = shift;
# print STDERR "PatchCRC( $filename, $crc )\n";
local( *FP );
open FP, "+<$filename" || die;
binmode( FP );
seek FP, 6 * 4, 0;
my $uInt = "I";
if( $filename =~ m/360/ )
{
$uInt = "N";
}
print FP pack $uInt, $crc;
close FP;
}
my $txtfilename = shift;
my $arg = shift;
my $is360 = 0;
my $platformextension = "";
if( $arg =~ m/-x360/i )
{
$is360 = 1;
$platformextension = ".360";
}
open TXTFILE, "<$txtfilename";
my $src;
my $dst;
while( $src = <TXTFILE> )
{
# get rid of comments
$src =~ s,//.*,,g;
# skip blank lines
if( $src =~ m/^\s*$/ )
{
next;
}
# Get rid of newlines.
$src =~ s/\n//g;
# Save off the shader source filename.
my $shadersrcfilename = $src;
$shadersrcfilename =~ s/-----.*$//;
# use only target basename.
$src =~ s/^.*-----//;
# where the binary vcs file is
my $spath = "";
if ( $shadersrcfilename =~ m@\.fxc@i )
{
$spath = "shaders\\fxc\\";
}
if ( $shadersrcfilename =~ m@\.vsh@i )
{
$spath = "shaders\\vsh\\";
}
if ( $shadersrcfilename =~ m@\.psh@i )
{
$spath = "shaders\\psh\\";
}
# make the source have path and extension
$src = $spath . $src . $platformextension . ".vcs";
# build the dest filename.
$dst = $src;
$dst =~ s/shaders\\/..\\..\\..\\game\\hl2\\shaders\\/i;
# Does the dst exist?
my $dstexists = -e $dst;
my $srcexists = -e $src;
# What are the time stamps for the src and dst?
my $srcmodtime = ( stat $src )[9];
my $dstmodtime = ( stat $dst )[9];
# Write $dst to a file so that we can do perforce stuff to it later.
local( *VCSLIST );
open VCSLIST, ">>vcslist.txt" || die;
print VCSLIST $dst . "\n";
close VCSLIST;
# Open for edit or add if different than what is in perforce already.
if( !$dstexists || ( $srcmodtime != $dstmodtime ) )
{
if ( $srcexists && $shadersrcfilename =~ m@\.fxc@i )
{
# Get the CRC for the source file.
my $srccode = ReadInputFileWithIncludes( $shadersrcfilename );
my $crc = crc32( $srccode );
# Patch the source VCS file with the CRC32 of the source code used to build that file.
PatchCRC( $src, $crc );
}
# Make the target vcs writable if it exists
if( $dstexists )
{
MakeFileWritable( $dst );
}
my $dir = $dst;
$dir =~ s,([^/\\]*$),,; # rip the filename off the end
my $filename = $1;
# create the target directory if it doesn't exist
if( !$dstexists )
{
&MakeDirHier( $dir, 0777 );
}
# copy the file to its targets. . . we want to see STDERR here if there is an error.
my $cmd = "copy $src $dst > nul";
# print STDERR "$cmd\n";
system $cmd;
MakeFileReadOnly( $dst );
}
}
close TXTFILE;

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,110 @@
#!perl
use File::Find;
&BuildRemapTable;
find(\&convert, "." );
sub convert
{
return unless (/\.pcf$/i);
return if (/^tmp\.pcf$/i);
return if (/^tmp2\.pcf$/i);
return if (/360\.pcf$/i);
print STDERR "process ", $File::Find::name," ($_) dir=",`cd`," \n";
my $fname=$_;
print `p4 edit $fname`;
print `dmxconvert -i $_ -o tmp.pcf -oe keyvalues2`;
open(TMP, "tmp.pcf" ) || return;
open(OUT, ">tmp2.pcf" ) || die;
while(<TMP>)
{
s/[\n\r]//g;
if ( (/^(\s*\"functionName\"\s*\"string\"\s*\")(.*)\"(.*)$/) &&
length($map{$2}) )
{
$_=$1.$map{$2}.'"'.$3;
}
if ( (/^(\s*\"name\"\s*\"string\"\s*\")(.*)\"(.*)$/) &&
length($map{$2}) )
{
$_=$1.$map{$2}.'"'.$3;
}
print OUT "$_\n";
}
close OUT;
close TMP;
print `dmxconvert -i tmp2.pcf -o $fname -ie keyvalues2 -oe binary`;
unlink "tmp.pcf";
unlink "tmp2.pcf";
}
sub BuildRemapTable
{
$map{"alpha_fade"}= "Alpha Fade and Decay";
$map{"alpha_fade_in_random"}= "Alpha Fade In Random";
$map{"alpha_fade_out_random"}= "Alpha Fade Out Random";
$map{"basic_movement"}= "Movement Basic";
$map{"color_fade"}= "Color Fade";
$map{"controlpoint_light"}= "Color Light From Control Point";
$map{"Dampen Movement Relative to Control Point"}= "Movement Dampen Relative to Control Point";
$map{"Distance Between Control Points Scale"}= "Remap Distance Between Two Control Points to Scalar";
$map{"Distance to Control Points Scale"}= "Remap Distance to Control Point to Scalar";
$map{"lifespan_decay"}= "Lifespan Decay";
$map{"lock to bone"}= "Movement Lock to Bone";
$map{"postion_lock_to_controlpoint"}= "Movement Lock to Control Point";
$map{"maintain position along path"}= "Movement Maintain Position Along Path";
$map{"Match Particle Velocities"}= "Movement Match Particle Velocities";
$map{"Max Velocity"}= "Movement Max Velocity";
$map{"noise"}= "Noise Scalar";
$map{"vector noise"}= "Noise Vector";
$map{"oscillate_scalar"}= "Oscillate Scalar";
$map{"oscillate_vector"}= "Oscillate Vector";
$map{"Orient Rotation to 2D Direction"}= "Rotation Orient to 2D Direction";
$map{"radius_scale"}= "Radius Scale";
$map{"Random Cull"}= "Cull Random";
$map{"remap_scalar"}= "Remap Scalar";
$map{"rotation_movement"}= "Rotation Basic";
$map{"rotation_spin"}= "Rotation Spin Roll";
$map{"rotation_spin yaw"}= "Rotation Spin Yaw";
$map{"alpha_random"}= "Alpha Random";
$map{"color_random"}= "Color Random";
$map{"create from parent particles"}= "Position From Parent Particles";
$map{"Create In Hierarchy"}= "Position In CP Hierarchy";
$map{"random position along path"}= "Position Along Path Random";
$map{"random position on model"}= "Position on Model Random";
$map{"sequential position along path"}= "Position Along Path Sequential";
$map{"position_offset_random"}= "Position Modify Offset Random";
$map{"position_warp_random"}= "Position Modify Warp Random";
$map{"position_within_box"}= "Position Within Box Random";
$map{"position_within_sphere"}= "Position Within Sphere Random";
$map{"Inherit Velocity"}= "Velocity Inherit from Control Point";
$map{"Initial Repulsion Velocity"}= "Velocity Repulse from World";
$map{"Initial Velocity Noise"}= "Velocity Noise";
$map{"Initial Scalar Noise"}= "Remap Noise to Scalar";
$map{"Lifespan from distance to world"}= "Lifetime from Time to Impact";
$map{"Pre-Age Noise"}= "Lifetime Pre-Age Noise";
$map{"lifetime_random"}= "Lifetime Random";
$map{"radius_random"}= "Radius Random";
$map{"random yaw"}= "Rotation Yaw Random";
$map{"Randomly Flip Yaw"}= "Rotation Yaw Flip Random";
$map{"rotation_random"}= "Rotation Random";
$map{"rotation_speed_random"}= "Rotation Speed Random";
$map{"sequence_random"}= "Sequence Random";
$map{"second_sequence_random"}= "Sequence Two Random";
$map{"trail_length_random"}= "Trail Length Random";
$map{"velocity_random"}= "Velocity Random";
}

View File

@@ -1,4 +1,5 @@
$dynamic_compile = defined $ENV{"dynamic_shaders"} && $ENV{"dynamic_shaders"} != 0;
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
sub ReadInputFile
{
@@ -34,21 +35,19 @@ sub ReadInputFile
return @output;
}
$dynamic_compile = defined $ENV{"dynamic_shaders"} && $ENV{"dynamic_shaders"} != 0;
$generateListingFile = 0;
$spewCombos = 0;
@startTimes = times;
$startTime = time;
$g_dx9 = 1;
$g_produceCppClasses = 1;
$g_produceCompiledVcs = 1;
while( 1 )
{
$fxc_filename = shift;
# if( $fxc_filename =~ m/-dx9/i )
# {
# $g_dx9 = 1;
# }
if( $fxc_filename =~ m/-source/ )
{
shift;
@@ -61,14 +60,18 @@ while( 1 )
{
$ps2a = 1;
}
elsif( $fxc_filename =~ m/-xbox/i )
elsif( $fxc_filename =~ m/-x360/i )
{
# enable xbox
$g_xbox = 1;
# enable x360
$g_x360 = 1;
}
elsif( $fxc_filename =~ m/-shaderoutputdir/i )
elsif( $fxc_filename =~ m/-novcs/i )
{
$shaderoutputdir = shift;
$g_produceCompiledVcs = 0;
}
elsif( $fxc_filename =~ m/-nocpp/i )
{
$g_produceCppClasses = 0;
}
else
{
@@ -76,6 +79,10 @@ while( 1 )
}
}
$argstring = $fxc_filename;
$fxc_basename = $fxc_filename;
$fxc_basename =~ s/^.*-----//;
$fxc_filename =~ s/-----.*$//;
$debug = 0;
$forcehalf = 0;
@@ -91,7 +98,7 @@ sub CreateCCodeToSpewDynamicCombo
{
local( $out ) = "";
$out .= "\t\tOutputDebugString( \"$fxc_filename dynamic index\" );\n";
$out .= "\t\tOutputDebugString( \"src:$fxc_filename vcs:$fxc_basename dynamic index\" );\n";
$out .= "\t\tchar tmp[128];\n";
$out .= "\t\tint shaderID = ";
local( $scale ) = 1;
@@ -131,7 +138,7 @@ sub CreateCCodeToSpewStaticCombo
{
local( $out ) = "";
$out .= "\t\tOutputDebugString( \"$fxc_filename static index\" );\n";
$out .= "\t\tOutputDebugString( \"src:$fxc_filename vcs:$fxc_basename static index\" );\n";
$out .= "\t\tchar tmp[128];\n";
$out .= "\t\tint shaderID = ";
@@ -248,8 +255,7 @@ sub WriteDynamicBoolExpression
sub WriteDynamicHelperClasses
{
local( $basename ) = $fxc_filename;
$basename =~ s/\.fxc//i;
local( $basename ) = $fxc_basename;
$basename =~ tr/A-Z/a-z/;
local( $classname ) = $basename . "_Dynamic_Index";
push @outputHeader, "class $classname\n";
@@ -338,10 +344,10 @@ sub WriteDynamicHelperClasses
sub WriteStaticHelperClasses
{
local( $basename ) = $fxc_filename;
$basename =~ s/\.fxc//i;
local( $basename ) = $fxc_basename;
$basename =~ tr/A-Z/a-z/;
local( $classname ) = $basename . "_Static_Index";
push @outputHeader, "#include \"shaderlib/cshader.h\"\n";
push @outputHeader, "class $classname\n";
push @outputHeader, "{\n";
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
@@ -353,17 +359,27 @@ sub WriteStaticHelperClasses
}
push @outputHeader, "public:\n";
# push @outputHeader, "void SetShaderIndex( IShaderShadow *pShaderShadow ) { pShaderShadow->SetPixelShaderIndex( GetIndex() ); }\n";
push @outputHeader, "\t$classname()\n";
push @outputHeader, "\t$classname( )\n";
push @outputHeader, "\t{\n";
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $name ) = @staticDefineNames[$i];
local( $boolname ) = "m_b" . $name;
local( $varname ) = "m_n" . $name;
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = false;\n";
push @outputHeader, "#endif // _DEBUG\n";
push @outputHeader, "\t\t$varname = 0;\n";
if ( length( $staticDefineInit{$name} ) )
{
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = true;\n";
push @outputHeader, "#endif // _DEBUG\n";
push @outputHeader, "\t\t$varname = $staticDefineInit{$name};\n";
}
else
{
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = false;\n";
push @outputHeader, "#endif // _DEBUG\n";
push @outputHeader, "\t\t$varname = 0;\n";
}
}
push @outputHeader, "\t}\n";
push @outputHeader, "\tint GetIndex()\n";
@@ -423,60 +439,11 @@ sub WriteStaticHelperClasses
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $name ) = @staticDefineNames[$i];
push @outputHeader, $prefix . "forgot_to_set_static_" . $name . " + ";
push @outputHeader, $prefix . "forgot_to_set_static_" . $name . " + " unless (length($staticDefineInit{$name} ));
}
push @outputHeader, "0\n";
}
sub BuildDefineOptions
{
local( $output );
local( $combo ) = shift;
local( $i );
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $val ) = ( $combo % ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) ) + $dynamicDefineMin[$i];
$output .= "/D$dynamicDefineNames[$i]=$val ";
$combo = $combo / ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 );
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $val ) = ( $combo % ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) ) + $staticDefineMin[$i];
$output .= "/D$staticDefineNames[$i]=$val ";
$combo = $combo / ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 );
}
return $output;
}
sub CreateFuncToSetPerlVars
{
local( $out ) = "";
$out .= "sub SetPerlVarsFunc\n";
$out .= "{\n";
$out .= " local( \$combo ) = shift;\n";
$out .= " local( \$i );\n";
local( $i );
for( $i = 0; $i < scalar( @dynamicDefineNames ); \$i++ )
{
$out .= " \$$dynamicDefineNames[$i] = \$combo % ";
$out .= ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) + $dynamicDefineMin[$i];
$out .= ";\n";
$out .= " \$combo = \$combo / " . ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) . ";\n";
}
for( $i = 0; $i < scalar( @staticDefineNames ); \$i++ )
{
$out .= " \$$staticDefineNames[$i] = \$combo % ";
$out .= ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) + $staticDefineMin[$i];
$out .= ";\n";
$out .= " \$combo = \$combo / " . ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) . ";\n";
}
$out .= "}\n";
# print $out;
eval $out;
}
sub GetNewMainName
{
local( $shadername ) = shift;
@@ -504,7 +471,8 @@ sub RenameMain
sub GetShaderType
{
local( $shadername ) = shift;
local( $shadername ) = shift; # hack - use global variables
$shadername = $fxc_basename;
if( $shadername =~ m/ps30/i )
{
if( $debug )
@@ -612,7 +580,7 @@ sub CreateCFuncToCreateCompileCommandLine
{
local( $out ) = "";
$out .= "\t\tOutputDebugString( \"compiling $fxc_filename \" );\n";
$out .= "\t\tOutputDebugString( \"compiling src:$fxc_filename vcs:$fxc_basename \" );\n";
$out .= "\t\tchar tmp[128];\n";
$out .= "\t\tsprintf( tmp, \"\%d\\n\", shaderID );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
@@ -752,31 +720,13 @@ sub CreateCFuncToCreateCompileCommandLine
#print "--------\n";
if ( $g_xbox )
if ( $g_x360 )
{
$fxctmp = "fxctmp_xbox";
}
elsif( $g_dx9 )
{
if( $nvidia )
{
if( $ps2a )
{
$fxctmp = "fxctmp9_nv3x";
}
else
{
$fxctmp = "fxctmp9_nv3x_ps20";
}
}
else
{
$fxctmp = "fxctmp9";
}
$fxctmp = "fxctmp9_360_tmp";
}
else
{
$fxctmp = "fxctmp8";
$fxctmp = "fxctmp9_tmp";
}
if( !stat $fxctmp )
@@ -785,23 +735,49 @@ if( !stat $fxctmp )
}
# suck in an input file (using includes)
print "$fxc_filename...";
#print "$fxc_filename...";
@fxc = ReadInputFile( $fxc_filename );
# READ THE TOP OF THE FILE TO FIND SHADER COMBOS
foreach $line ( @fxc )
{
$line="" if ($g_x360 && ($line=~/\[PC\]/)); # line marked as [PC] when building for x360
$line="" if (($g_x360 == 0) && ($line=~/\[XBOX\]/)); # line marked as [XBOX] when building for pc
if ( $fxc_basename =~ m/_ps(\d+\w?)$/i )
{
my $psver = $1;
$line="" if (($line =~/\[ps\d+\w?\]/i) && ($line!~/\[ps$psver\]/i)); # line marked for a version of compiler and not what we build
}
if ( $fxc_basename =~ m/_vs(\d+\w?)$/i )
{
my $vsver = $1;
$line="" if (($line =~/\[vs\d+\w?\]/i) && ($line!~/\[vs$vsver\]/i)); # line marked for a version of compiler and not what we build
}
my $init_expr;
$init_expr = $1 if ( $line=~/\[\=([^\]]+)\]/); # parse default init expression for combos
$line=~s/\[[^\[\]]*\]//; # cut out all occurrences of
# square brackets and whatever is
# inside all these modifications
# to the line are seen later when
# processing skips and centroids
next if( $line =~ m/^\s*$/ );
if( $line =~ m/^\s*\/\/\s*STATIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
{
local( $name, $min, $max );
$name = $1;
$min = $2;
$max = $3;
# print "\"$name\" \"$min..$max\"\n";
# print STDERR "STATIC: \"$name\" \"$min..$max\"\n";
push @staticDefineNames, $name;
push @staticDefineMin, $min;
push @staticDefineMax, $max;
$staticDefineInit{$name}=$init_expr;
}
elsif( $line =~ m/^\s*\/\/\s*DYNAMIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
{
@@ -809,7 +785,7 @@ foreach $line ( @fxc )
$name = $1;
$min = $2;
$max = $3;
# print "\"$name\" \"$min..$max\"\n";
# print STDERR "DYNAMIC: \"$name\" \"$min..$max\"\n";
push @dynamicDefineNames, $name;
push @dynamicDefineMin, $min;
push @dynamicDefineMax, $max;
@@ -818,9 +794,9 @@ foreach $line ( @fxc )
# READ THE WHOLE FILE AND FIND SKIP STATEMENTS
foreach $line ( @fxc )
{
if( $line =~ m/^\s*\/\/\s*SKIP\s*\:\s*(.*)$/ )
if( $line =~ m/^\s*\/\/\s*SKIP\s*\s*\:\s*(.*)$/ )
{
# print $1 . "\n";
# print $1 . "\n";
$perlskipcode .= "(" . $1 . ")||";
push @perlskipcodeindividual, $1;
}
@@ -867,144 +843,89 @@ foreach $centroidRegNum ( keys( %centroidEnable ) )
$numCombos = &CalcNumCombos();
#print "$numCombos combos\n";
# Write out the C++ helper class for picking shader combos
&WriteStaticHelperClasses();
&WriteDynamicHelperClasses();
# Create a subroutine out of $perlskipcode
$perlskipfunc = "sub SkipCombo { return $perlskipcode; }\n";
#print $perlskipfunc;
eval $perlskipfunc;
&CreateFuncToSetPerlVars();
if( !$dynamic_compile )
if( $g_produceCompiledVcs && !$dynamic_compile )
{
open OUTFILELIST, ">>filelist.txt" || die "can't open filelist.txt";
for( $i = 0; $i < $numCombos; $i++ )
open FOUT, ">>filelistgen.txt" || die "can't open filelistgen.txt";
print FOUT "**** generated by fxc_prep.pl ****\n";
print FOUT "#BEGIN " . $fxc_basename . "\n";
print FOUT "$fxc_filename" . "\n";
print FOUT "#DEFINES-D:\n";
for( $i = 0; $i < scalar( @dynamicDefineNames ); \$i++ )
{
&SetPerlVarsFunc( $i );
local( $compileFailed );
# $ret = eval $perlskipcode;
$ret = &SkipCombo;
if( !defined $ret )
{
die "$@\n";
}
if( $ret )
{
# skip this combo!
# print OUTFILELIST "$i/$numCombos: SKIP\n";
$compileFailed = 1;
$numSkipped++;
}
else
{
local( $cmd );
if( $g_xbox )
{
$cmd = "perl fxc_xbox.pl ";
}
else
{
$cmd = "fxc.exe ";
}
$cmd .= "/DSHADERCOMBO=$i ";
$cmd .= "/DTOTALSHADERCOMBOS=$numCombos ";
$cmd .= "/DCENTROIDMASK=$centroidMask ";
$cmd .= "/DNUMDYNAMICCOMBOS=" . &CalcNumDynamicCombos() . " ";
$cmd .= "/DFLAGS=0x0 "; # Nothing here for now.
if( $g_xbox )
{
$cmd .= "/D_XBOX=1 ";
}
$cmd .= &BuildDefineOptions( $i );
$cmd .= &RenameMain( $fxc_filename, $i );
$cmd .= "/T" . &GetShaderType( $fxc_filename ) . " ";
$cmd .= "/DSHADER_MODEL_" . &ToUpper( &GetShaderType( $fxc_filename ) ) . "=1 ";
if( $nvidia )
{
$cmd .= "/DNV3X=1 "; # enable NV3X codepath
}
if( $debug )
{
$cmd .= "/Od "; # disable optimizations
$cmd .= "/Zi "; # enable debug info
}
# $cmd .= "/Zi "; # enable debug info
$cmd .= "/nologo ";
if( $fxc_filename =~ /ps20/i && $forcehalf )
{
$cmd .= "/Gpp "; # use half everywhere
}
else
{
if( $g_xbox )
{
$cmd .= "/Fcshader.asm ";
}
else
{
# $cmd .= "/Fhtmpshader.h ";
$cmd .= "/Foshader.o ";
}
}
$cmd .= "$fxc_filename";
$cmd .= ">output.txt 2>&1";
# print $i . "/" . $numCombos . " " . $cmd . "\n";
print OUTFILELIST $cmd . "\n";
}
print FOUT "$dynamicDefineNames[$i]=";
print FOUT $dynamicDefineMin[$i];
print FOUT "..";
print FOUT $dynamicDefineMax[$i];
print FOUT "\n";
}
close OUTFILELIST;
}
#print "$numSkipped/$numCombos skipped\n";
local( $name ) = $fxc_filename;
$name =~ s/\.fxc//gi;
#printf "writing $fxctmp/$name" . ".inc\n";
# open the existing inc file so that we can see if anything changed
local( *OLDINCFILE );
my $incfilechanged = 1;
# if( open OLDINCFILE, "<$fxctmp/$name" . ".inc" )
# {
# # print "opened old inc file $fxctmp/$name" . ".inc\n";
# # The inc file already exists. . let's see if it's the same as before.
# my @oldincfile;
# @oldincfile = <OLDINCFILE>;
# close OLDINCFILE;
print FOUT "#DEFINES-S:\n";
for( $i = 0; $i < scalar( @staticDefineNames ); \$i++ )
{
print FOUT "$staticDefineNames[$i]=";
print FOUT $staticDefineMin[$i];
print FOUT "..";
print FOUT $staticDefineMax[$i];
print FOUT "\n";
}
print FOUT "#SKIP:\n";
print FOUT "$perlskipcode\n";
print FOUT "#COMMAND:\n";
# first line
print FOUT "fxc.exe ";
print FOUT "/DTOTALSHADERCOMBOS=$numCombos ";
print FOUT "/DCENTROIDMASK=$centroidMask ";
print FOUT "/DNUMDYNAMICCOMBOS=" . &CalcNumDynamicCombos() . " ";
print FOUT "/DFLAGS=0x0 "; # Nothing here for now.
print FOUT "\n";
#defines go here
# second line
print FOUT &RenameMain( $fxc_filename, $i );
print FOUT "/T" . &GetShaderType( $fxc_filename ) . " ";
print FOUT "/DSHADER_MODEL_" . &ToUpper( &GetShaderType( $fxc_filename ) ) . "=1 ";
if( $nvidia )
{
print FOUT "/DNV3X=1 "; # enable NV3X codepath
}
if ( $g_x360 )
{
print FOUT "/D_X360=1 "; # shaders can identify X360 centric code
# print FOUT "/Xbe:2- "; # use the less-broken old back end
}
if( $debug )
{
print FOUT "/Od "; # disable optimizations
print FOUT "/Zi "; # enable debug info
}
# print FOUT "/Zi "; # enable debug info
print FOUT "/nologo ";
# print FOUT "/Fhtmpshader.h ";
print FOUT "/Foshader.o ";
print FOUT "$fxc_filename";
print FOUT ">output.txt 2>&1";
print FOUT "\n";
#end of command line
print FOUT "#END\n";
print FOUT "**** end ****\n";
# if( join( "", @oldincfile ) eq join( "", @outputHeader ) )
# {
# # print "They are the same!\n";
# $incfilechanged = 0;
# }
# }
close FOUT;
}
if( $incfilechanged )
if ( $g_produceCppClasses )
{
print "writing inc\n";
local( *FILE );
if( !open FILE, ">$fxctmp/$name" . ".inc" )
{
die;
}
print FILE @outputHeader;
close FILE;
undef @outputHeader;
}
else
{
print "no inc diffs\n";
# Write out the C++ helper class for picking shader combos
&WriteStaticHelperClasses();
&WriteDynamicHelperClasses();
my $incfilename = "$fxctmp\\$fxc_basename" . ".inc";
&WriteFile( $incfilename, join( "", @outputHeader ) );
}
if( $generateListingFile )
{
my $listFileName = "$fxctmp/$name" . ".lst";
my $listFileName = "$fxctmp/$fxc_basename" . ".lst";
print "writing $listFileName\n";
if( !open FILE, ">$listFileName" )
{

View File

@@ -1,53 +1,6 @@
sub BackToForwardSlash
{
my( $path ) = shift;
$path =~ s,\\,/,g;
return $path;
}
sub RemoveFileName
{
my( $in ) = shift;
$in = &BackToForwardSlash( $in );
$in =~ s,/[^/]*$,,;
return $in;
}
sub RemovePath
{
my( $in ) = shift;
$in = &BackToForwardSlash( $in );
$in =~ s,^(.*)/([^/]*)$,$2,;
return $in;
}
sub MakeDirHier
{
my( $in ) = shift;
# print "MakeDirHier( $in )\n";
$in = &BackToForwardSlash( $in );
my( @path );
while( $in =~ m,/, ) # while $in still has a slash
{
my( $end ) = &RemovePath( $in );
push @path, $end;
# print $in . "\n";
$in = &RemoveFileName( $in );
}
my( $i );
my( $numelems ) = scalar( @path );
my( $curpath );
for( $i = $numelems - 1; $i >= 0; $i-- )
{
$curpath .= "/" . $path[$i];
my( $dir ) = $in . $curpath;
if( !stat $dir )
{
print "mkdir $dir\n";
mkdir $dir, 0777;
}
}
}
use String::CRC32;
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
sub BuildDefineOptions
{
@@ -57,41 +10,13 @@ sub BuildDefineOptions
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $val ) = ( $combo % ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) ) + $dynamicDefineMin[$i];
if ( $g_xbox )
{
# xsasm can only support "ifdef" compilation directive form
# so symbol encodes value and shader uses "ifdef <MySymbol_MyValue>"
# xsasm mandates space for /D argument definitions
$output .= "/D $dynamicDefineNames[$i]_$val ";
}
else
{
# symbol encodes value and shader uses "ifdef <MySymbol_MyValue>"
# psa crashes without the explicit symbol=value format
# encode both flavors for backwards compatibility
$output .= "/D$dynamicDefineNames[$i]_$val=$val ";
$output .= "/D$dynamicDefineNames[$i]=$val ";
}
$output .= "/D$dynamicDefineNames[$i]=$val ";
$combo = $combo / ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 );
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $val ) = ( $combo % ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) ) + $staticDefineMin[$i];
if ( $g_xbox )
{
# xsasm can only support "ifdef" compilation directive form
# so symbol encodes value and shader uses "ifdef <MySymbol_MyValue>"
# xsasm mandates space for /D argument definitions
$output .= "/D $staticDefineNames[$i]_$val ";
}
else
{
# symbol encodes value and shader uses "ifdef <MySymbol_MyValue>"
# psa crashes without the explicit symbol=value format
# encode both flavors for backwards compatibility
$output .= "/D$staticDefineNames[$i]_$val=$val ";
$output .= "/D$staticDefineNames[$i]=$val ";
}
$output .= "/D$staticDefineNames[$i]=$val ";
$combo = $combo / ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 );
}
return $output;
@@ -124,7 +49,6 @@ sub CalcNumDynamicCombos
}
$g_dx9 = 1;
$shaderoutputdir = "shaders";
while( 1 )
{
@@ -134,14 +58,9 @@ while( 1 )
{
$g_SourceDir = shift;
}
elsif( $psh_filename =~ m/-xbox/ )
elsif( $psh_filename =~ m/-x360/ )
{
$g_xbox = 1;
$g_dx9 = 0;
}
elsif( $psh_filename =~ m/-shaderoutputdir/i )
{
$shaderoutputdir = shift;
$g_x360 = 1;
}
else
{
@@ -149,6 +68,8 @@ while( 1 )
}
}
$psh_filename =~ s/-----.*$//;
# Get the shader binary version number from a header file.
open FILE, "<$g_SourceDir\\public\\materialsystem\\shader_vcs_version.h" || die;
@@ -188,6 +109,12 @@ while( <PSH> )
$min = $2;
$max = $3;
# print "\"STATIC: $name\" \"$min..$max\"\n";
if (/\[(.*)\]/)
{
$platforms=$1;
next if ( ($g_x360) && (!($platforms=~/XBOX/i)) );
next if ( (!$g_x360) && (!($platforms=~/PC/i)) );
}
push @staticDefineNames, $name;
push @staticDefineMin, $min;
push @staticDefineMax, $max;
@@ -199,6 +126,12 @@ while( <PSH> )
$min = $2;
$max = $3;
# print "\"DYNAMIC: $name\" \"$min..$max\"\n";
if (/\[(.*)\]/)
{
$platforms=$1;
next if ( ($g_x360) && (!($platforms=~/XBOX/i)) );
next if ( (!$g_x360) && (!($platforms=~/PC/i)) );
}
push @dynamicDefineNames, $name;
push @dynamicDefineMin, $min;
push @dynamicDefineMax, $max;
@@ -212,9 +145,9 @@ print "$psh_filename\n";
#print "$numCombos combos\n";
#print "$numDynamicCombos dynamic combos\n";
if( $g_xbox )
if( $g_x360 )
{
$pshtmp = "pshtmp_xbox";
$pshtmp = "pshtmp9_360";
}
elsif( $g_dx9 )
{
@@ -232,13 +165,13 @@ for( $shaderCombo = 0; $shaderCombo < $numCombos; $shaderCombo++ )
my $tempFilename = "shader$shaderCombo.o";
unlink $tempFilename;
if( $g_xbox )
if( $g_x360 )
{
$cmd = "xsasm /nologo /D _XBOX=1 " . &BuildDefineOptions( $shaderCombo ) . "$psh_filename shader$shaderCombo.o > NIL 2>&1";
$cmd = "$g_SourceDir\\x360xdk\\bin\\win32\\psa /D_X360=1 /Foshader$shaderCombo.o /nologo " . &BuildDefineOptions( $shaderCombo ) . "$psh_filename > NIL";
}
else
{
$cmd = "psa /Foshader$shaderCombo.o /nologo " . &BuildDefineOptions( $shaderCombo ) . "$psh_filename";
$cmd = "$g_SourceDir\\dx9sdk\\utilities\\psa /Foshader$shaderCombo.o /nologo " . &BuildDefineOptions( $shaderCombo ) . "$psh_filename > NIL";
}
if( !stat $pshtmp )
@@ -299,8 +232,19 @@ push @outputHeader, "};\n";
push @outputHeader, "static $basename" . "PixelShader_t $basename" . "_PixelShaderInstance;\n";
&MakeDirHier( "$shaderoutputdir/psh" );
open COMPILEDSHADER, ">$shaderoutputdir/psh/$basename.vcs";
&MakeDirHier( "shaders/psh" );
my $vcsName = "";
if( $g_x360 )
{
$vcsName = $basename . ".360.vcs";
}
else
{
$vcsName = $basename . ".vcs";
}
open COMPILEDSHADER, ">shaders/psh/$vcsName" || die;
binmode( COMPILEDSHADER );
#
@@ -309,18 +253,35 @@ binmode( COMPILEDSHADER );
#print $numCombos . "\n";
# Pack arguments
my $sInt = "i";
my $uInt = "I";
if ( $g_x360 )
{
# Change arguments to "big endian long"
$sInt = "N";
$uInt = "N";
}
open PSH, "<$psh_filename";
my $crc = crc32( *PSH );
close PSH;
#print STDERR "crc for $psh_filename: $crc\n";
# version
print COMPILEDSHADER pack "i", $shaderVersion;
print COMPILEDSHADER pack $sInt, 4;
# totalCombos
print COMPILEDSHADER pack "i", $numCombos;
print COMPILEDSHADER pack $sInt, $numCombos;
# dynamic combos
print COMPILEDSHADER pack "i", $numDynamicCombos;
print COMPILEDSHADER pack $sInt, $numDynamicCombos;
# flags
print COMPILEDSHADER pack "I", 0x0; # nothing here for now.
print COMPILEDSHADER pack $uInt, 0x0; # nothing here for now.
# centroid mask
print COMPILEDSHADER pack "I", 0;
print COMPILEDSHADER pack $uInt, 0;
# reference size for diffs
print COMPILEDSHADER pack "I", 0;
print COMPILEDSHADER pack $uInt, 0;
# crc32 of the source code
print COMPILEDSHADER pack $uInt, $crc;
my $beginningOfDir = tell COMPILEDSHADER;
@@ -328,9 +289,9 @@ my $beginningOfDir = tell COMPILEDSHADER;
for( $i = 0; $i < $numCombos; $i++ )
{
# offset from beginning of file.
print COMPILEDSHADER pack "i", 0;
print COMPILEDSHADER pack $sInt, 0;
# size
print COMPILEDSHADER pack "i", 0;
print COMPILEDSHADER pack $sInt, 0;
}
my $startByteCode = tell COMPILEDSHADER;
@@ -342,20 +303,12 @@ for( $shaderCombo = 0; $shaderCombo < $numCombos; $shaderCombo++ )
{
my $filename = "shader$shaderCombo\.o";
my $filesize = (stat $filename)[7];
if( $g_xbox )
{
# ignore binary signature
$filesize = $filesize - 4;
}
$byteCodeStart[$shaderCombo] = tell COMPILEDSHADER;
$byteCodeSize[$shaderCombo] = $filesize;
open SHADERBYTECODE, "<$filename";
binmode SHADERBYTECODE;
if( $g_xbox )
{
# ignore binary signature
seek SHADERBYTECODE, 4, 0;
}
my $bin;
my $numread = read SHADERBYTECODE, $bin, $filesize;
# print "filename: $filename numread: $numread filesize: $filesize\n";
@@ -370,9 +323,9 @@ seek COMPILEDSHADER, $beginningOfDir, 0;
for( $i = 0; $i < $numCombos; $i++ )
{
# offset from beginning of file.
print COMPILEDSHADER pack "i", $byteCodeStart[$i];
print COMPILEDSHADER pack $sInt, $byteCodeStart[$i];
# size
print COMPILEDSHADER pack "i", $byteCodeSize[$i];
print COMPILEDSHADER pack $sInt, $byteCodeSize[$i];
}
close COMPILEDSHADER;

View File

@@ -0,0 +1,36 @@
#! perl
my $fname=shift || die "format is shaderinfo blah.vcs";
open(SHADER, $fname) || die "can't open $fname";
binmode SHADER;
read(SHADER,$header,20);
($ver,$ntotal,$ndynamic,$flags,$centroidmask)=unpack("LLLLL",$header);
#print "Version $ver total combos=$ntotal, num dynamic combos=$ndynamic,\n flags=$flags, centroid mask=$centroidmask\n";
read(SHADER,$refsize,4);
$refsize=unpack("L",$refsize);
#print "Size of reference shader for diffing=$refsize\n";
seek(SHADER,$refsize,1);
$nskipped_combos=0;
for(1..$ntotal)
{
read(SHADER,$combodata,8);
($ofs,$combosize)=unpack("LL",$combodata);
if ( $ofs == 0xffffffff)
{
$nskipped_combos++;
}
else
{
}
}
#print "$nskipped_combos skipped, for an actual total of ",$ntotal-$nskipped_combos,"\n";
#print "Real to skipped ratio = ",($ntotal-$nskipped_combos)/$ntotal,"\n";
# csv output - name, real combos, virtual combos, dynamic combos
my $real_combos=$ntotal-$nskipped_combos;
print "$fname,$real_combos,$ntotal,$ndynamic\n";

View File

@@ -0,0 +1,54 @@
$infilename = shift;
$outfilename1 = shift;
$outfilename2 = shift;
open INPUT, $infilename || die;
@input = <INPUT>;
close INPUT;
open MERGEDMINE, ">$outfilename1" || die;
open MERGEDTHEIRS, ">$outfilename2" || die;
for( $i = 0; $i < scalar( @input ); $i++ )
{
$line = $input[$i];
if( $line =~ m/^(.*)<<<<<<</ )
{
$first = 1;
$second = 0;
print MERGEDMINE $1;
print MERGEDTHEIRS $1;
next;
}
# Make sure that we are in a split block so that comments with ======= don't mess us up.
if( $line =~ m/^(.*)=======$/ && $first == 1 )
{
$first = 0;
$second = 1;
print MERGEDMINE $1;
next;
}
if( $line =~ m/^(.*)>>>>>>>/ )
{
$first = $second = 0;
print MERGEDTHEIRS $1;
next;
}
if( $first )
{
print MERGEDMINE $line;
}
elsif( $second )
{
print MERGEDTHEIRS $line;
}
else
{
print MERGEDMINE $line;
print MERGEDTHEIRS $line;
}
}
close MERGEDMINE;
close MERGEDTHEIRS;

View File

@@ -1,4 +1,4 @@
while( <> )
foreach $_ (sort <> )
{
next if( defined( $prevline ) && $_ eq $prevline );
$prevline = $_;

View File

@@ -1,10 +1,14 @@
use String::CRC32;
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
$dynamic_compile = defined $ENV{"dynamic_shaders"} && $ENV{"dynamic_shaders"} != 0;
$depnum = 0;
$shaderoutputdir = "shaders";
$baseSourceDir = ".";
my %dep;
sub GetAsmShaderDependencies_R
{
local( $shadername ) = shift;
@@ -15,23 +19,12 @@ sub GetAsmShaderDependencies_R
{
if( m/^\s*\#\s*include\s+\"(.*)\"/ )
{
# print "$shadername depends on $1\n";
# if( !defined( $dep{$shadername} ) )
# make sure it isn't in there already.
if( !defined( $dep{$1} ) )
{
if ( -e "$g_SourceDir\\materialsystem\\stdshaders\\$1" )
{
$dep{$shadername} = "$g_SourceDir\\materialsystem\\stdshaders\\$1";
}
else
{
$dep{$shadername} = ".\\$1";
}
GetAsmShaderDependencies_R( $dep{$shadername} );
$dep{$1} = 1;
GetAsmShaderDependencies_R( $1 );
}
# else
# {
# print "circular dependency in $shadername!\n";
# }
}
}
close SHADER;
@@ -42,12 +35,12 @@ sub GetAsmShaderDependencies
local( $shadername ) = shift;
undef %dep;
GetAsmShaderDependencies_R( $shadername );
local( $i );
foreach $i ( keys( %dep ) )
{
# print "$i depends on $dep{$i}\n";
}
return values( %dep );
# local( $i );
# foreach $i ( keys( %dep ) )
# {
# print "$shadername depends on $i\n";
# }
return keys( %dep );
}
sub GetShaderType
@@ -73,80 +66,104 @@ sub GetShaderType
return $shadertype;
}
sub GetShaderSrc
{
my $shadername = shift;
if ( $shadername =~ m/^(.*)-----/i )
{
return $1;
}
else
{
return $shadername;
}
}
sub GetShaderBase
{
my $shadername = shift;
my $shadertype = &GetShaderType( $shadername );
$shadername =~ s/\.$shadertype//i;
return $shadername;
if ( $shadername =~ m/-----(.*)$/i )
{
return $1;
}
else
{
my $shadertype = &GetShaderType( $shadername );
$shadername =~ s/\.$shadertype//i;
return $shadername;
}
}
sub DoAsmShader
{
local( $shadername ) = shift;
local( $shadertype );
$shadertype = &GetShaderType( $shadername );
@dep = &GetAsmShaderDependencies( $shadername );
my $shaderbase = &GetShaderBase( $shadername );
my $argstring = shift;
my $shadername = &GetShaderSrc( $argstring );
my $shaderbase = &GetShaderBase( $argstring );
my $shadertype = &GetShaderType( $argstring );
my $incfile = "";
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
{
if( $g_xbox )
{
$incfile = $shadertype . "tmp_xbox\\$shaderbase.inc ";
}
else
{
$incfile = $shadertype . "tmp9\\$shaderbase.inc ";
}
$incfile = $shadertype . "tmp9" . $g_tmpfolder . "\\$shaderbase.inc ";
}
if( $dynamic_compile && $shadertype eq "fxc" )
my $vcsfile = $shaderbase . $g_vcsext;
my $bWillCompileVcs = 1;
if( ( $shadertype eq "fxc") && $dynamic_compile )
{
print MAKEFILE $incfile . ": ..\\..\\devtools\\bin\\updateshaders.pl ..\\..\\devtools\\bin\\" . $shadertype . "_prep.pl $shadername @dep\n";
$bWillCompileVcs = 0;
}
if( $shadercrcpass{$argstring} )
{
$bWillCompileVcs = 0;
}
if( $bWillCompileVcs )
{
&output_makefile_line( $incfile . "shaders\\$shadertype\\$vcsfile: $shadername @dep\n") ;
}
else
{
print MAKEFILE $incfile . "$shaderoutputdir\\$shadertype\\$shaderbase.vcs: ..\\..\\devtools\\bin\\updateshaders.pl ..\\..\\devtools\\bin\\" . $shadertype . "_prep.pl $shadername @dep\n";
# psh files don't need a rule at this point since they don't have inc files and we aren't compiling a vcs.
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
{
&output_makefile_line( $incfile . ": $shadername @dep\n") ;
}
}
my $xboxswitch = "";
if( $g_xbox )
my $x360switch = "";
my $moreswitches = "";
if( !$bWillCompileVcs && $shadertype eq "fxc" )
{
$xboxswitch = "-xbox ";
$moreswitches .= "-novcs ";
}
print MAKEFILE "\tperl $g_SourceDir\\devtools\\bin\\" . $shadertype . "_prep.pl $xboxswitch -shaderoutputdir $shaderoutputdir -source \"$g_SourceDir\" $shadername\n";
my $filename;
if( $shadertype eq "fxc" && !$dynamic_compile )
if( $g_x360 )
{
print MAKEFILE "\techo $shadername>> filestocopy.txt\n";
$x360switch = "-x360";
if( $bWillCompileVcs && ( $shaderbase =~ m/_ps20$/i ) )
{
$moreswitches .= "-novcs ";
$bWillCompileVcs = 0;
}
}
# if we are psh and we are compiling the vcs, we don't need this rule.
if( !( $shadertype eq "psh" && !$bWillCompileVcs ) )
{
&output_makefile_line( "\tperl $g_SourceDir\\devtools\\bin\\" . $shadertype . "_prep.pl $moreswitches $x360switch -source \"$g_SourceDir\" $argstring\n") ;
}
if( $bWillCompileVcs )
{
&output_makefile_line( "\techo $shadername>> filestocopy.txt\n") ;
my $dep;
foreach $dep( @dep )
{
print MAKEFILE "\techo $dep>> filestocopy.txt\n";
&output_makefile_line( "\techo $dep>> filestocopy.txt\n") ;
}
}
print MAKEFILE "\n";
}
sub MakeSureFileExists
{
local( $filename ) = shift;
local( $testexists ) = shift;
local( $testwrite ) = shift;
local( @statresult ) = stat $filename;
if( !@statresult && $testexists )
{
die "$filename doesn't exist!\n";
}
local( $mode, $iswritable );
$mode = oct( $statresult[2] );
$iswritable = ( $mode & 2 ) != 0;
if( !$iswritable && $testwrite )
{
die "$filename isn't writable!\n";
}
&output_makefile_line( "\n") ;
}
if( scalar( @ARGV ) == 0 )
@@ -154,6 +171,10 @@ if( scalar( @ARGV ) == 0 )
die "Usage updateshaders.pl shaderprojectbasename\n\tie: updateshaders.pl stdshaders_dx6\n";
}
$g_x360 = 0;
$g_tmpfolder = "_tmp";
$g_vcsext = ".vcs";
while( 1 )
{
$inputbase = shift;
@@ -162,93 +183,123 @@ while( 1 )
{
$g_SourceDir = shift;
}
elsif( $inputbase =~ m/-xbox/ )
elsif( $inputbase =~ m/-x360/ )
{
$g_xbox = 1;
$g_x360 = 1;
$g_tmpfolder = "_360_tmp";
$g_vcsext = ".360.vcs";
}
elsif( $inputbase =~ m/-execute/ )
{
$g_execute = 1;
}
elsif( $inputbase =~ m/-nv3x/ )
{
$nv3x = 1;
}
elsif( $inputbase =~ m/-shaderoutputdir/i )
{
$shaderoutputdir = shift;
}
else
{
last;
}
}
&MakeSureFileExists( "$inputbase.txt", 1, 0 );
open SHADERLISTFILE, "<$inputbase.txt" || die;
while( $line = <SHADERLISTFILE> )
{
$line =~ s/\/\/.*$//;
$line =~ s/^\s*//;
$line =~ s/\s*$//;
next if( $line =~ m/^\s*$/ );
if( $line =~ m/\.fxc/ || $line =~ m/\.vsh/ || $line =~ m/\.psh/ )
{
push @srcfiles, $line;
}
}
close SHADERLISTFILE;
my @srcfiles = &LoadShaderListFile( $inputbase );
open MAKEFILE, ">makefile\.$inputbase";
open COPYFILE, ">makefile\.$inputbase\.copy";
open INCLIST, ">inclist.txt";
open VCSLIST, ">vcslist.txt";
# make a default dependency that depends on all of the shaders.
print MAKEFILE "default: ";
&output_makefile_line( "default: ") ;
foreach $shader ( @srcfiles )
{
my $shadertype = &GetShaderType( $shader );
my $shaderbase = &GetShaderBase( $shader );
my $shadersrc = &GetShaderSrc( $shader );
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
{
# We only generate inc files for fxc and vsh files.
if( $g_xbox )
my $incFileName = "$shadertype" . "tmp9" . $g_tmpfolder . "\\" . $shaderbase . "\.inc";
&output_makefile_line( " $incFileName" );
&output_inclist_line( "$incFileName\n" );
}
my $vcsfile = $shaderbase . $g_vcsext;
my $compilevcs = 1;
if( $shadertype eq "fxc" && $dynamic_compile )
{
$compilevcs = 0;
}
if( $g_x360 && ( $shaderbase =~ m/_ps20$/i ) )
{
$compilevcs = 0;
}
if( $compilevcs )
{
my $vcsFileName = "..\\..\\..\\game\\hl2\\shaders\\$shadertype\\$shaderbase" . $g_vcsext;
# We want to check for perforce operations even if the crc matches in the event that a file has been manually reverted and needs to be checked out again.
&output_vcslist_line( "$vcsFileName\n" );
$shadercrcpass{$shader} = &CheckCRCAgainstTarget( $shadersrc, $vcsFileName, 0 );
if( $shadercrcpass{$shader} )
{
print MAKEFILE " $shadertype" . "tmp_xbox\\" . $shaderbase . "\.inc";
}
else
{
print MAKEFILE " $shadertype" . "tmp9\\" . $shaderbase . "\.inc";
$compilevcs = 0;
}
}
if( !$dynamic_compile || $shadertype ne "fxc" )
if( $compilevcs )
{
print MAKEFILE " $shaderoutputdir\\$shadertype\\$shaderbase\.vcs";
&output_makefile_line( " shaders\\$shadertype\\$vcsfile" );
# emit a list of vcs files to copy to the target since we want to build them.
&output_copyfile_line( GetShaderSrc($shader) . "-----" . GetShaderBase($shader) . "\n" );
}
}
print MAKEFILE "\n\n";
# make a "clean" rule
print MAKEFILE "clean:\n";
foreach $shader ( @srcfiles )
{
my $shadertype = &GetShaderType( $shader );
my $shaderbase = &GetShaderBase( $shader );
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
{
# We only generate inc files for fxc and vsh files.
if( $g_xbox )
{
print MAKEFILE "\tdel /f /q $shadertype" . "tmp_xbox\\" . $shaderbase . "\.inc\n";
}
else
{
print MAKEFILE "\tdel /f /q $shadertype" . "tmp9\\" . $shaderbase . "\.inc\n";
}
}
print MAKEFILE "\tdel /f /q \"$shaderoutputdir\\$shadertype\\$shaderbase\.vcs\"\n";
}
print MAKEFILE "\n";
&output_makefile_line( "\n\n") ;
# Insert all of our vertex shaders and depencencies
$lastshader = "";
foreach $shader ( @srcfiles )
{
my $currentshader = &GetShaderSrc( $shader );
if ( $lastshader ne $currentshader )
{
$lastshader = $currentshader;
@dep = &GetAsmShaderDependencies( $lastshader );
}
&DoAsmShader( $shader );
}
close VCSLIST;
close INCLIST;
close COPYFILE;
close MAKEFILE;
# nuke the copyfile if it is zero length
if( ( stat "makefile\.$inputbase\.copy" )[7] == 0 )
{
unlink "makefile\.$inputbase\.copy";
}
sub output_makefile_line
{
local ($_)=@_;
print MAKEFILE $_;
}
sub output_copyfile_line
{
local ($_)=@_;
print COPYFILE $_;
}
sub output_vcslist_line
{
local ($_)=@_;
print VCSLIST $_;
}
sub output_inclist_line
{
local ($_)=@_;
print INCLIST $_;
}

View File

@@ -0,0 +1,543 @@
sub BackToForwardSlash
{
my( $path ) = shift;
$path =~ s,\\,/,g;
return $path;
}
sub RemoveFileName
{
my( $in ) = shift;
$in = &BackToForwardSlash( $in );
$in =~ s,/[^/]*$,,;
return $in;
}
sub RemovePath
{
my( $in ) = shift;
$in = &BackToForwardSlash( $in );
$in =~ s,^(.*)/([^/]*)$,$2,;
return $in;
}
sub MakeDirHier
{
my( $in ) = shift;
# print "MakeDirHier( $in )\n";
$in = &BackToForwardSlash( $in );
my( @path );
while( $in =~ m,/, ) # while $in still has a slash
{
my( $end ) = &RemovePath( $in );
push @path, $end;
# print $in . "\n";
$in = &RemoveFileName( $in );
}
my( $i );
my( $numelems ) = scalar( @path );
my( $curpath );
for( $i = $numelems - 1; $i >= 0; $i-- )
{
$curpath .= "/" . $path[$i];
my( $dir ) = $in . $curpath;
if( !stat $dir )
{
# print "mkdir $dir\n";
mkdir $dir, 0777;
}
}
}
sub FileExists
{
my $filename = shift;
my @statresult = stat $filename;
my $iswritable = @statresult != 0;
return $iswritable;
}
sub MakeFileWritable
{
my $filename = shift;
if ( &FileExists( $filename ) )
{
chmod 0666, $filename || die;
}
}
sub MakeFileReadOnly
{
my $filename = shift;
chmod 0444, $filename || die;
}
# Run a command and get stdout and stderr to an array
sub RunCommand
{
my $cmd = shift;
# print STDERR "command: $cmd\n";
system "$cmd > cmdout.txt 2>&1" || die;
local( *FILE );
open FILE, "<cmdout.txt" || die;
my @output = <FILE>;
# print STDERR "command output: @output\n";
close FILE;
unlink "cmdout.txt" || die;
return @output;
}
sub PerforceEditOrAdd
{
return;
my $filename = shift;
my $changelistarg = shift;
# Is the file on the client?
my $cmd = "p4 fstat \"$filename\"";
my @p4output = &RunCommand( $cmd );
my $p4output = join "", @p4output;
if( $p4output =~ m/no such file/ )
{
# not on client. . add
my $cmd = "p4 add $changelistarg $filename";
my @p4output = &RunCommand( $cmd );
my $p4output = join "", @p4output;
if( $p4output =~ m/opened for add/ )
{
print $p4output;
return;
}
print "ERROR: $p4output";
return;
}
# The file is known to be on the client at this point.
# Is it open for edit?
if( $p4output =~ m/action edit/ )
{
# Is is open for edit, let's see if it's still different.
# check for opened files that are not different from the revision in the depot.
my $cmd = "p4 diff -sr \"$filename\"";
my @p4output = &RunCommand( $cmd );
my $outputstring = join "", @p4output;
# check for empty string
if( !( $outputstring =~ m/^\s*$/ ) )
{
my $cmd = "p4 revert \"$filename\"";
my @p4output = &RunCommand( $cmd );
my $outputstring = join "", @p4output;
print $outputstring;
return;
}
}
# check for unopened files that are different from the revision in the depot.
my $cmd = "p4 diff -se \"$filename\"";
my @p4output = &RunCommand( $cmd );
my $outputstring = join "", @p4output;
# check for empty string
if( $outputstring =~ m/^\s*$/ )
{
&MakeFileReadOnly( $filename );
return;
}
# We need to edit the file since it is known to be different here.
my $cmd = "p4 edit $changelistarg \"$filename\"";
my @p4output = &RunCommand( $cmd );
my $line;
foreach $line ( @p4output )
{
if( $line =~ m/not on client/ )
{
#print "notonclient...";
print "ERROR: @p4output\n";
return;
}
if( $line =~ m/currently opened for edit/ )
{
return;
}
if( $line =~ m/opened for edit/ )
{
print $line;
}
}
}
sub FileIsWritable
{
local( $filename ) = shift;
local( @statresult ) = stat $filename;
local( $mode, $iswritable );
$mode = oct( $statresult[2] );
$iswritable = ( $mode & 2 ) != 0;
return $iswritable;
}
sub TouchFile
{
my $filename = shift;
if( !&FileExists( $filename ) )
{
if( !open FILE, ">$filename" )
{
die;
}
close FILE;
}
my $now = time;
local( *FILE );
utime $now, $now, $filename;
}
sub FileExistsInPerforce
{
my $filename = shift;
my @output = &RunCommand( "p4 fstat $filename" );
my $line;
foreach $line (@output)
{
if( $line =~ m/no such file/ )
{
return 0;
}
}
return 1;
}
sub PerforceWriteFile
{
my $filename = shift;
my $filecontents = shift;
# Make the target vcs writable if it exists
MakeFileWritable( $filename );
# Write the file.
local( *FP );
open FP, ">$filename";
print FP $filecontents;
close FP;
}
sub WriteFile
{
my $filename = shift;
my $filecontents = shift;
# Make the target vcs writable if it exists
MakeFileWritable( $filename );
# Write the file.
local( *FP );
open FP, ">$filename";
print FP $filecontents;
close FP;
}
sub PrintCleanPerforceOutput
{
my $line;
while( $line = shift )
{
if( $line =~ m/currently opened/i )
{
next;
}
if( $line =~ m/already opened for edit/i )
{
next;
}
if( $line =~ m/also opened/i )
{
next;
}
if( $line =~ m/add of existing file/i )
{
next;
}
print $line;
}
}
# HACK!!!! Need to pass something in to do this rather than hard coding.
sub NormalizePerforceFilename
{
my $line = shift;
# remove newlines.
$line =~ s/\n//;
# downcase.
$line =~ tr/[A-Z]/[a-z]/;
# backslash to forwardslash
$line =~ s,\\,/,g;
# for inc files HACK!
$line =~ s/^.*(fxctmp9.*)/$1/i;
$line =~ s/^.*(vshtmp9.*)/$1/i;
# for vcs files. HACK!
$line =~ s,^.*game/hl2/shaders/,,i;
return $line;
}
sub MakeSureFileExists
{
local( $filename ) = shift;
local( $testexists ) = shift;
local( $testwrite ) = shift;
local( @statresult ) = stat $filename;
if( !@statresult && $testexists )
{
die "$filename doesn't exist!\n";
}
local( $mode, $iswritable );
$mode = oct( $statresult[2] );
$iswritable = ( $mode & 2 ) != 0;
if( !$iswritable && $testwrite )
{
die "$filename isn't writable!\n";
}
}
sub LoadShaderListFile_GetShaderType
{
my $shadername = shift;
my $shadertype;
if( $shadername =~ m/\.vsh/i )
{
$shadertype = "vsh";
}
elsif( $shadername =~ m/\.psh/i )
{
$shadertype = "psh";
}
elsif( $shadername =~ m/\.fxc/i )
{
$shadertype = "fxc";
}
else
{
die;
}
return $shadertype;
}
sub LoadShaderListFile_GetShaderSrc
{
my $shadername = shift;
if ( $shadername =~ m/^(.*)-----/i )
{
return $1;
}
else
{
return $shadername;
}
}
sub LoadShaderListFile_GetShaderBase
{
my $shadername = shift;
if ( $shadername =~ m/-----(.*)$/i )
{
return $1;
}
else
{
my $shadertype = &LoadShaderListFile_GetShaderType( $shadername );
$shadername =~ s/\.$shadertype//i;
return $shadername;
}
}
sub LoadShaderListFile
{
my $inputbase = shift;
my @srcfiles;
&MakeSureFileExists( "$inputbase.txt", 1, 0 );
open SHADERLISTFILE, "<$inputbase.txt" || die;
my $line;
while( $line = <SHADERLISTFILE> )
{
$line =~ s/\/\/.*$//; # remove comments "//..."
$line =~ s/^\s*//; # trim leading whitespace
$line =~ s/\s*$//; # trim trailing whitespace
next if( $line =~ m/^\s*$/ );
if( $line =~ m/\.fxc/ || $line =~ m/\.vsh/ || $line =~ m/\.psh/ )
{
my $shaderbase = &LoadShaderListFile_GetShaderBase( $line );
if( $ENV{"DIRECTX_FORCE_MODEL"} =~ m/^30$/i ) # forcing all shaders to be ver. 30
{
my $targetbase = $shaderbase;
$targetbase =~ s/_ps2x/_ps30/i;
$targetbase =~ s/_ps20b/_ps30/i;
$targetbase =~ s/_ps20/_ps30/i;
$targetbase =~ s/_vs20/_vs30/i;
$targetbase =~ s/_vsxx/_vs30/i;
push @srcfiles, ( $line . "-----" . $targetbase );
}
else
{
if( $shaderbase =~ m/_ps2x/i )
{
my $targetbase = $shaderbase;
$targetbase =~ s/_ps2x/_ps20/i;
push @srcfiles, ( $line . "-----" . $targetbase );
$targetbase = $shaderbase;
$targetbase =~ s/_ps2x/_ps20b/i;
push @srcfiles, ( $line . "-----" . $targetbase );
}
elsif( $shaderbase =~ m/_vsxx/i )
{
my $targetbase = $shaderbase;
$targetbase =~ s/_vsxx/_vs11/i;
push @srcfiles, ( $line . "-----" . $targetbase );
$targetbase = $shaderbase;
$targetbase =~ s/_vsxx/_vs20/i;
push @srcfiles, ( $line . "-----" . $targetbase );
}
else
{
push @srcfiles, ( $line . "-----" . $shaderbase );
}
}
}
}
close SHADERLISTFILE;
return @srcfiles;
}
sub ReadInputFileWithIncludes
{
local( $filename ) = shift;
# print STDERR "ReadInputFileWithIncludes: $filename\n";
local( *INPUT );
local( $output );
# print STDERR "before open\n";
open INPUT, "<$filename" || die;
# print STDERR "after open\n";
local( $line );
while( $line = <INPUT> )
{
# print STDERR $line;
if( $line =~ m/\#include\s+\"(.*)\"/i )
{
$output.= ReadInputFileWithIncludes( $1 );
}
else
{
$output .= $line;
}
}
close INPUT;
return $output;
}
sub GetCRCFromSourceFile
{
my $filename = shift;
my $data = &ReadInputFileWithIncludes( $filename );
# print STDERR $data;
$crc = crc32( $data );
# print STDERR "GetCRCFromSourceFile: $crc\n";
return $crc;
}
sub GetCRCFromVCSFile
{
my $filename = shift;
# print STDERR "GetCRCFromVCSFile $filename\n";
local( *FP );
open FP, "<$filename" || die "GetCRCFromVCSFile: can't open file $filename\n";
binmode( FP );
# unpack arguments
my $sInt = "i";
my $uInt = "I";
if( $filename =~ m/\.360\./ )
{
# Change arguments to "big endian long"
$sInt = "N";
$uInt = "N";
}
my $header;
read FP, $header, 7 * 4 || die "updateshaders.pl:GetCRCFromVCSFile: can't read header for $filename\n";
my $version,$numCombos,$numDynamicCombos,$flags,$centroidMask,$refSize,$crc;
($version,$numCombos,$numDynamicCombos,$flags,$centroidMask,$refSize,$crc) = unpack "$sInt$sInt$sInt$uInt$uInt$uInt$uInt", $header;
unless( $version == 4 || $version == 5 || $version == 6 )
{
print STDERR "ERROR: GetCRCFromVCSFile: $filename is version $version\n";
return 0;
}
# print STDERR "version: $version\n";
# print STDERR "numCombos: $numCombos\n";
# print STDERR "numDynamicCombos: $numDynamicCombos\n";
# print STDERR "flags: $flags\n";
# print STDERR "centroidMask: $centroidMask\n";
# print STDERR "refSize: $refSize\n";
# print STDERR "GetCRCFromVCSFile: $crc\n";
close( FP );
return $crc;
}
sub CheckCRCAgainstTarget
{
my $srcFileName = shift;
my $vcsFileName = shift;
my $warn = shift;
# Make sure both files exist.
# print STDERR "$srcFileName doesn't exist\n" if( !( -e $srcFileName ) );
# print STDERR "$vcsFileName doesn't exist\n" if( !( -e $vcsFileName ) );
if( !( -e $srcFileName ) )
{
if( $warn )
{
print "$srcFileName missing\n";
}
return 0;
}
if( !( -e $vcsFileName ) )
{
if( $warn )
{
print "$vcsFileName missing\n";
}
return 0;
}
# print STDERR "CheckCRCAgainstTarget( $srcFileName, $vcsFileName );\n";
# print STDERR "vcsFileName: $vcsFileName\n";
# print STDERR "vcsFileName: $srcFileName\n";
my $vcsCRC = &GetCRCFromVCSFile( $vcsFileName );
my $srcCRC = &GetCRCFromSourceFile( $srcFileName );
if( $warn && ( $vcsCRC != $srcCRC ) )
{
print "$vcsFileName checksum ($vcsCRC) != $srcFileName checksum: ($srcCRC)\n";
}
# return 0; # use this to skip crc checking.
# if( $vcsCRC == $srcCRC )
# {
# print STDERR "CRC passed for $srcFileName $vcsFileName $vcsCRC\n";
# }
return $vcsCRC == $srcCRC;
}
1;

View File

@@ -1,3 +1,6 @@
use String::CRC32;
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
sub WriteHelperVar
{
@@ -265,57 +268,6 @@ sub CreateFuncToSetPerlVars
eval $out;
}
sub BackToForwardSlash
{
my( $path ) = shift;
$path =~ s,\\,/,g;
return $path;
}
sub RemoveFileName
{
my( $in ) = shift;
$in = &BackToForwardSlash( $in );
$in =~ s,/[^/]*$,,;
return $in;
}
sub RemovePath
{
my( $in ) = shift;
$in = &BackToForwardSlash( $in );
$in =~ s,^(.*)/([^/]*)$,$2,;
return $in;
}
sub MakeDirHier
{
my( $in ) = shift;
# print "MakeDirHier( $in )\n";
$in = &BackToForwardSlash( $in );
my( @path );
while( $in =~ m,/, ) # while $in still has a slash
{
my( $end ) = &RemovePath( $in );
push @path, $end;
# print $in . "\n";
$in = &RemoveFileName( $in );
}
my( $i );
my( $numelems ) = scalar( @path );
my( $curpath );
for( $i = $numelems - 1; $i >= 0; $i-- )
{
$curpath .= "/" . $path[$i];
my( $dir ) = $in . $curpath;
if( !stat $dir )
{
# print "mkdir $dir\n";
mkdir $dir, 0777;
}
}
}
# These sections can be interchanged to enable profiling.
#$ShowTimers = 1;
#use Time::HiRes;
@@ -331,13 +283,13 @@ $total_start_time = SampleTime();
# NOTE: These must match the same values in macros.vsh!
$vPos = "v0";
$vBoneWeights = "v1";
$vBoneIndices = "v2";
$vBoneWeights = "v1";
$vBoneIndices = "v2";
$vNormal = "v3";
if( $g_xbox )
if( $g_x360 )
{
$vPosFlex = "v4";
$vNormalFlex = "v13";
$vNormalFlex = "v13";
}
$vColor = "v5";
$vSpecular = "v6";
@@ -349,7 +301,50 @@ $vTangentS = "v11";
$vTangentT = "v12";
$vUserData = "v14";
sub ReadInputFile
sub ReadInputFileWithLineInfo
{
local( $base_filename ) = shift;
local( *INPUT );
local( @output );
# Look in the stdshaders directory, followed by the current directory.
# (This is for the SDK, since some of its files are under stdshaders).
local( $filename ) = $base_filename;
if ( !-e $filename )
{
$filename = "$g_SourceDir\\materialsystem\\stdshaders\\$base_filename";
if ( !-e $filename )
{
die "\nvsh_prep.pl ERROR: missing include file: $filename.\n\n";
}
}
open INPUT, "<$filename" || die;
local( $line );
local( $linenum ) = 1;
while( $line = <INPUT> )
{
$line =~ s/\n//g;
local( $postfix ) = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
$postfix .= "; LINEINFO($filename)($linenum)\n";
if( $line =~ m/\#include\s+\"(.*)\"/i )
{
push @output, &ReadInputFileWithLineInfo( $1 );
}
else
{
push @output, $line . $postfix;
}
$linenum++;
}
close INPUT;
return @output;
}
sub ReadInputFileWithoutLineInfo
{
local( $base_filename ) = shift;
@@ -371,21 +366,16 @@ sub ReadInputFile
open INPUT, "<$filename" || die;
local( $line );
local( $linenum ) = 1;
while( $line = <INPUT> )
{
$line =~ s/\n//g;
local( $postfix ) = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
$postfix .= "; LINEINFO($filename)($linenum)\n";
if( $line =~ m/\#include\s+\"(.*)\"/i )
{
push @output, &ReadInputFile( $1 );
push @output, &ReadInputFileWithoutLineInfo( $1 );
}
else
{
push @output, $line . $postfix;
push @output, $line;
}
$linenum++;
}
close INPUT;
@@ -550,10 +540,7 @@ sub TranslateDXKeywords
$line =~ s/\bENDIF\b/endif/g;
$line =~ s/\bIF\b/if/g;
$line =~ s/\bELSE\b/else/g;
if ( $g_xbox )
{
$line =~ s/^\s*vs\.1\.[0-9]/xvs.1.1/i;
}
return $line;
}
@@ -571,7 +558,6 @@ sub GetLeadingWhiteSpace
}
$g_dx9 = 1;
$shaderoutputdir = "shaders";
$g_SourceDir = "..\\..";
while( 1 )
@@ -582,14 +568,9 @@ while( 1 )
{
$g_SourceDir = shift;
}
elsif( $filename =~ m/-xbox/i )
elsif( $filename =~ m/-x360/i )
{
$g_xbox = 1;
$g_dx9 = 0;
}
elsif( $filename =~ m/-shaderoutputdir/i )
{
$shaderoutputdir = shift;
$g_x360 = 1;
}
else
{
@@ -597,6 +578,8 @@ while( 1 )
}
}
$filename =~ s/-----.*$//;
#
# Get the shader binary version number from a header file.
@@ -617,13 +600,13 @@ if( !defined $shaderVersion )
close FILE;
if( $g_xbox )
if( $g_x360 )
{
$vshtmp = "vshtmp_xbox";
$vshtmp = "vshtmp9_360_tmp";
}
else
{
$vshtmp = "vshtmp9";
$vshtmp = "vshtmp9_tmp";
}
if( !stat $vshtmp )
@@ -632,7 +615,7 @@ if( !stat $vshtmp )
}
# suck in all files, including $include files.
@input = &ReadInputFile( $filename );
@input = &ReadInputFileWithLineInfo( $filename );
sub CalcNumCombos
{
@@ -676,8 +659,8 @@ foreach $_ ( @input )
if (/\[(.*)\]/)
{
$platforms=$1;
next if ( ($g_xbox) && (!($platforms=~/XBOX/i)) );
next if ( (!$g_xbox) && (!($platforms=~/PC/i)) );
next if ( ($g_x360) && (!($platforms=~/XBOX/i)) );
next if ( (!$g_x360) && (!($platforms=~/PC/i)) );
}
push @staticDefineNames, $name;
push @staticDefineMin, $min;
@@ -692,8 +675,8 @@ foreach $_ ( @input )
if (/\[(.*)\]/)
{
$platforms=$1;
next if ( ($g_xbox) && (!($platforms=~/XBOX/i)) );
next if ( (!$g_xbox) && (!($platforms=~/PC/i)) );
next if ( ($g_x360) && (!($platforms=~/XBOX/i)) );
next if ( (!$g_x360) && (!($platforms=~/PC/i)) );
}
# print "\"$name\" \"$min..$max\"\n";
push @dynamicDefineNames, $name;
@@ -723,11 +706,6 @@ else
#print $perlskipcode . "\n";
if ( $g_xbox )
{
# add mandatory epilogue code
push @outputProgram, "push \@output, \"" . "#pragma screenspace" . "\\n\";\n";
}
# Translate the input into a perl program that'll unroll everything and
# substitute variables.
@@ -756,13 +734,6 @@ while( $inputLine = shift @input )
}
}
if ( $g_xbox )
{
# add mandatory prologue code
push @outputProgram, "push \@output, \"" . "mul oPos.xyz, r12, \$SHADER_VIEWPORT_CONST_SCALE +rcc r1.x, r12.w" . "\\n\";\n";
push @outputProgram, "push \@output, \"" . "mad oPos.xyz, r12, r1.x, \$SHADER_VIEWPORT_CONST_OFFSET" . "\\n\";\n";
}
$outputProgram = join "", @outputProgram;
$filename_base = $filename;
@@ -806,15 +777,10 @@ $perlskipfunc = "sub SkipCombo { return $perlskipcode; }\n";
eval $perlskipfunc;
&CreateFuncToSetPerlVars();
my $incfilename = "$vshtmp/$filename_base" . ".inc";
# Write the inc file that has indexing helpers, etc.
local( *FILE );
if( !open FILE, ">$vshtmp/$filename_base" . ".inc" )
{
die "\n\nUnable to open $vshtmp/$filename_base for writing\n\n";
}
print FILE @outputHeader;
close FILE;
undef @outputHeader;
&WriteFile( $incfilename, join( "", @outputHeader ) );
# Run the output program for all the combinations of bones and lights.
@@ -880,7 +846,7 @@ for( $i = 0; $i < $numCombos; $i++ )
# Have to make another pass through after we know which v registers are used. . yuck.
$g_usesPos = &UsesRegister( $vPos, $strippedStr );
if( $g_xbox )
if( $g_x360 )
{
$g_usesPosFlex = &UsesRegister( $vPosFlex, $strippedStr );
$g_usesNormalFlex = &UsesRegister( $vNormalFlex, $strippedStr );
@@ -949,18 +915,16 @@ for( $i = 0; $i < $numCombos; $i++ )
{
# assemble the vertex shader
unlink "shader$i.o";
if( $g_xbox )
if( $g_x360 )
{
$vsa = "xsasm";
$vsadebug = "$vsa /nologo /D _XBOX=1 $outfilename shader$i.o";
$vsanodebug = "$vsa /nologo /D _XBOX=1 $outfilename shader$i.o";
$vsa = "..\\..\\x360xdk\\bin\\win32\\vsa";
}
else
{
$vsa = "..\\..\\dx9sdk\\utilities\\vsa";
$vsadebug = "$vsa /nologo /Foshader$i.o $outfilename";
$vsanodebug = "$vsa /nologo /Foshader$i.o $outfilename";
}
$vsadebug = "$vsa /nologo /Foshader$i.o $outfilename";
$vsanodebug = "$vsa /nologo /Foshader$i.o $outfilename";
$vsa_start_time = SampleTime();
@@ -1028,27 +992,53 @@ $finalheadername = "$vshtmp\\" . $filename_base . ".inc";
#print FINALHEADER @finalheader;
#close FINALHEADER;
&MakeDirHier( "$shaderoutputdir/vsh" );
open COMPILEDSHADER, ">$shaderoutputdir/vsh/$filename_base.vcs" || die;
binmode( COMPILEDSHADER );
&MakeDirHier( "shaders/vsh" );
my $vcsName = "";
if( $g_x360 )
{
$vcsName = $filename_base . ".360.vcs";
}
else
{
$vcsName = $filename_base . ".vcs";
}
open COMPILEDSHADER, ">shaders/vsh/$vcsName" || die;
binmode( COMPILEDSHADER );
#
# Write out the part of the header that we know. . we'll write the rest after writing the object code.
#
# Pack arguments
my $sInt = "i";
my $uInt = "I";
if ( $g_x360 )
{
# Change arguments to "big endian long"
$sInt = "N";
$uInt = "N";
}
my $undecoratedinput = join "", &ReadInputFileWithoutLineInfo( $filename );
#print STDERR "undecoratedinput: $undecoratedinput\n";
my $crc = crc32( $undecoratedinput );
#print STDERR "crc for $filename: $crc\n";
# version
print COMPILEDSHADER pack "i", $shaderVersion;
print COMPILEDSHADER pack $sInt, 4;
# totalCombos
print COMPILEDSHADER pack "i", $numCombos;
print COMPILEDSHADER pack $sInt, $numCombos;
# dynamic combos
print COMPILEDSHADER pack "i", $numDynamicCombos;
print COMPILEDSHADER pack $sInt, $numDynamicCombos;
# flags
print COMPILEDSHADER pack "I", $flags;
print COMPILEDSHADER pack $uInt, $flags;
# centroid mask
print COMPILEDSHADER pack "I", 0;
print COMPILEDSHADER pack $uInt, 0;
# reference size
print COMPILEDSHADER pack "I", 0;
print COMPILEDSHADER pack $uInt, 0;
# crc32 of the source code
print COMPILEDSHADER pack $uInt, $crc;
my $beginningOfDir = tell COMPILEDSHADER;
@@ -1056,9 +1046,9 @@ my $beginningOfDir = tell COMPILEDSHADER;
for( $i = 0; $i < $numCombos; $i++ )
{
# offset from beginning of file.
print COMPILEDSHADER pack "i", 0;
print COMPILEDSHADER pack $sInt, 0;
# size
print COMPILEDSHADER pack "i", 0;
print COMPILEDSHADER pack $sInt, 0;
}
my $startByteCode = tell COMPILEDSHADER;
@@ -1088,9 +1078,9 @@ seek COMPILEDSHADER, $beginningOfDir, 0;
for( $i = 0; $i < $numCombos; $i++ )
{
# offset from beginning of file.
print COMPILEDSHADER pack "i", $byteCodeStart[$i];
print COMPILEDSHADER pack $sInt, $byteCodeStart[$i];
# size
print COMPILEDSHADER pack "i", $byteCodeSize[$i];
print COMPILEDSHADER pack $sInt, $byteCodeSize[$i];
}
close COMPILEDSHADER;

View File

@@ -1,321 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Arbitrary length bit string
// ** NOTE: This class does NOT override the bitwise operators
// as doing so would require overriding the operators
// to allocate memory for the returned bitstring. This method
// would be prone to memory leaks as the calling party
// would have to remember to delete the memory. Funtions
// are used instead to require the calling party to allocate
// and destroy their own memory
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include <limits.h>
#include "bitstring.h"
#include "utlbuffer.h"
#include "tier0/dbg.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Init static vars
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Purpose: Calculate a mask for the last int in the array
// Input : numBits -
// Output : static int
//-----------------------------------------------------------------------------
unsigned g_BitStringEndMasks[] =
{
0x00000000,
0xfffffffe,
0xfffffffc,
0xfffffff8,
0xfffffff0,
0xffffffe0,
0xffffffc0,
0xffffff80,
0xffffff00,
0xfffffe00,
0xfffffc00,
0xfffff800,
0xfffff000,
0xffffe000,
0xffffc000,
0xffff8000,
0xffff0000,
0xfffe0000,
0xfffc0000,
0xfff80000,
0xfff00000,
0xffe00000,
0xffc00000,
0xff800000,
0xff000000,
0xfe000000,
0xfc000000,
0xf8000000,
0xf0000000,
0xe0000000,
0xc0000000,
0x80000000,
};
//-----------------------------------------------------------------------------
// Purpose: Print bits for debugging purposes
// Input :
// Output :
//-----------------------------------------------------------------------------
void DebugPrintBitStringBits( const int *pInts, int nInts )
{
for (int i=0;i<nInts;i++)
{
for (int j =0; j<BITS_PER_INT;j++)
{
Msg( "%d", (pInts[i] & (1<<j)) ? 1:0);
}
}
Msg( "\n");
}
//-----------------------------------------------------------------------------
// Purpose: Saves a bit string to the given file
// Input :
// Output :
//-----------------------------------------------------------------------------
void SaveBitString(const int *pInts, int nInts, CUtlBuffer& buf)
{
for (int i=0;i<nInts;i++)
{
buf.Printf("%d ", pInts[i]);
}
buf.Printf("\n");
}
//-----------------------------------------------------------------------------
// Purpose: Loads a bit string from the given file
// Input :
// Output :
//-----------------------------------------------------------------------------
void LoadBitString(int *pInts, int nInts, CUtlBuffer& buf)
{
for (int i=0; i<nInts; i++)
{
buf.Scanf("%d", &pInts[i]);
}
}
//-----------------------------------------------------------------------------
void CVariableBitStringBase::ValidateOperand( const CVariableBitStringBase &operand ) const
{
Assert(Size() == operand.Size());
}
//-----------------------------------------------------------------------------
// Purpose: Resizes the bit string to a new number of bits
// Input : resizeNumBits -
//-----------------------------------------------------------------------------
void CVariableBitStringBase::Resize( int resizeNumBits )
{
Assert( resizeNumBits >= 0 && resizeNumBits <= USHRT_MAX );
int newIntCount = CalcNumIntsForBits( resizeNumBits );
if ( newIntCount != GetNumInts() )
{
if ( GetInts() )
{
ReallocInts( newIntCount );
if ( resizeNumBits >= Size() )
{
GetInts()[GetNumInts() - 1] &= ~GetEndMask();
memset( GetInts() + GetNumInts(), 0, (newIntCount - GetNumInts()) * sizeof(int) );
}
}
else
{
// Figure out how many ints are needed
AllocInts( newIntCount );
// Initialize bitstring by clearing all bits
memset( GetInts(), 0, newIntCount * sizeof(int) );
}
m_numInts = newIntCount;
}
else if ( resizeNumBits >= Size() && GetInts() )
GetInts()[GetNumInts() - 1] &= ~GetEndMask();
// store the new size and end mask
m_numBits = resizeNumBits;
}
//-----------------------------------------------------------------------------
// Purpose: Allocate the storage for the ints
// Input : numInts -
//-----------------------------------------------------------------------------
void CVariableBitStringBase::AllocInts( int numInts )
{
Assert( !m_pInt );
if ( numInts == 0 )
return;
if ( numInts == 1 )
{
m_pInt = &m_iBitStringStorage;
return;
}
m_pInt = (int *)malloc( numInts * sizeof(int) );
}
//-----------------------------------------------------------------------------
// Purpose: Reallocate the storage for the ints
// Input : numInts -
//-----------------------------------------------------------------------------
void CVariableBitStringBase::ReallocInts( int numInts )
{
Assert( GetInts() );
if ( numInts == 0)
{
FreeInts();
return;
}
if ( m_pInt == &m_iBitStringStorage )
{
if ( numInts != 1 )
{
m_pInt = ((int *)malloc( numInts * sizeof(int) ));
*m_pInt = m_iBitStringStorage;
}
return;
}
if ( numInts == 1 )
{
m_iBitStringStorage = *m_pInt;
free( m_pInt );
m_pInt = &m_iBitStringStorage;
return;
}
m_pInt = (int *)realloc( m_pInt, numInts * sizeof(int) );
}
//-----------------------------------------------------------------------------
// Purpose: Free storage allocated with AllocInts
//-----------------------------------------------------------------------------
void CVariableBitStringBase::FreeInts( void )
{
if ( m_numInts > 1 )
{
free( m_pInt );
}
m_pInt = NULL;
}
//-----------------------------------------------------------------------------
#ifdef DEBUG
CON_COMMAND(test_bitstring, "Tests the bit string class")
{
// This function is only testing new features (toml 11-10-02)
int i, j;
// Variable sized
CBitString one, two, three;
for ( i = 0; i < 100; i++ )
{
one.Resize( random->RandomInt(1, USHRT_MAX ) );
}
one.Resize( 0 );
one.Resize( 2 );
for ( i = 0; i < 14; i++ )
{
for ( j = 0; j < 64; j++)
{
int bit = random->RandomInt(0, one.Size() - 1 );
Assert(!one.GetBit(bit));
one.SetBit( bit );
Assert(one.GetBit(bit));
one.ClearBit( bit );
Assert(!one.GetBit(bit));
}
one.Resize( one.Size() * 2 );
}
one.Resize( 100 );
one.SetBit( 50 );
one.Resize( 101 );
Assert(one.GetBit(50));
one.Resize( 1010 );
Assert(one.GetBit(50));
one.Resize( 49 );
one.Resize( 100 );
Assert(!one.GetBit(50));
Assert( one.IsAllClear() );
two.Resize( one.Size() );
one.Not( &two );
Assert( !two.IsAllClear() );
Assert( two.IsAllSet() );
// Fixed sized
CFixedBitString<1> fbs1; Assert( fbs1.GetEndMask() == GetEndMask( fbs1.Size() ) );
CFixedBitString<2> fbs2; Assert( fbs2.GetEndMask() == GetEndMask( fbs2.Size() ) );
CFixedBitString<3> fbs3; Assert( fbs3.GetEndMask() == GetEndMask( fbs3.Size() ) );
CFixedBitString<4> fbs4; Assert( fbs4.GetEndMask() == GetEndMask( fbs4.Size() ) );
CFixedBitString<5> fbs5; Assert( fbs5.GetEndMask() == GetEndMask( fbs5.Size() ) );
CFixedBitString<6> fbs6; Assert( fbs6.GetEndMask() == GetEndMask( fbs6.Size() ) );
CFixedBitString<7> fbs7; Assert( fbs7.GetEndMask() == GetEndMask( fbs7.Size() ) );
CFixedBitString<8> fbs8; Assert( fbs8.GetEndMask() == GetEndMask( fbs8.Size() ) );
CFixedBitString<9> fbs9; Assert( fbs9.GetEndMask() == GetEndMask( fbs9.Size() ) );
CFixedBitString<10> fbs10; Assert( fbs10.GetEndMask() == GetEndMask( fbs10.Size() ) );
CFixedBitString<11> fbs11; Assert( fbs11.GetEndMask() == GetEndMask( fbs11.Size() ) );
CFixedBitString<12> fbs12; Assert( fbs12.GetEndMask() == GetEndMask( fbs12.Size() ) );
CFixedBitString<13> fbs13; Assert( fbs13.GetEndMask() == GetEndMask( fbs13.Size() ) );
CFixedBitString<14> fbs14; Assert( fbs14.GetEndMask() == GetEndMask( fbs14.Size() ) );
CFixedBitString<15> fbs15; Assert( fbs15.GetEndMask() == GetEndMask( fbs15.Size() ) );
CFixedBitString<16> fbs16; Assert( fbs16.GetEndMask() == GetEndMask( fbs16.Size() ) );
CFixedBitString<17> fbs17; Assert( fbs17.GetEndMask() == GetEndMask( fbs17.Size() ) );
CFixedBitString<18> fbs18; Assert( fbs18.GetEndMask() == GetEndMask( fbs18.Size() ) );
CFixedBitString<19> fbs19; Assert( fbs19.GetEndMask() == GetEndMask( fbs19.Size() ) );
CFixedBitString<20> fbs20; Assert( fbs20.GetEndMask() == GetEndMask( fbs20.Size() ) );
CFixedBitString<21> fbs21; Assert( fbs21.GetEndMask() == GetEndMask( fbs21.Size() ) );
CFixedBitString<22> fbs22; Assert( fbs22.GetEndMask() == GetEndMask( fbs22.Size() ) );
CFixedBitString<23> fbs23; Assert( fbs23.GetEndMask() == GetEndMask( fbs23.Size() ) );
CFixedBitString<24> fbs24; Assert( fbs24.GetEndMask() == GetEndMask( fbs24.Size() ) );
CFixedBitString<25> fbs25; Assert( fbs25.GetEndMask() == GetEndMask( fbs25.Size() ) );
CFixedBitString<26> fbs26; Assert( fbs26.GetEndMask() == GetEndMask( fbs26.Size() ) );
CFixedBitString<27> fbs27; Assert( fbs27.GetEndMask() == GetEndMask( fbs27.Size() ) );
CFixedBitString<28> fbs28; Assert( fbs28.GetEndMask() == GetEndMask( fbs28.Size() ) );
CFixedBitString<29> fbs29; Assert( fbs29.GetEndMask() == GetEndMask( fbs29.Size() ) );
CFixedBitString<30> fbs30; Assert( fbs30.GetEndMask() == GetEndMask( fbs30.Size() ) );
CFixedBitString<31> fbs31; Assert( fbs31.GetEndMask() == GetEndMask( fbs31.Size() ) );
CFixedBitString<32> fbs32; Assert( fbs32.GetEndMask() == GetEndMask( fbs32.Size() ) );
CFixedBitString<33> fbs33; Assert( fbs33.GetEndMask() == GetEndMask( fbs33.Size() ) );
CFixedBitString<34> fbs34; Assert( fbs34.GetEndMask() == GetEndMask( fbs34.Size() ) );
CFixedBitString<35> fbs35; Assert( fbs35.GetEndMask() == GetEndMask( fbs35.Size() ) );
}
#endif

View File

@@ -1,582 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Arbitrary length bit string
// ** NOTE: This class does NOT override the bitwise operators
// as doing so would require overriding the operators
// to allocate memory for the returned bitstring. This method
// would be prone to memory leaks as the calling party
// would have to remember to delete the memory. Funtions
// are used instead to require the calling party to allocate
// and destroy their own memory
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#ifndef BITSTRING_H
#define BITSTRING_H
#pragma once
class CUtlBuffer;
//-----------------------------------------------------------------------------
// OPTIMIZE: Removed the platform independence for speed
#define LOG2_BITS_PER_INT 5
#define BITS_PER_INT 32
//-------------------------------------
extern unsigned g_BitStringEndMasks[];
inline unsigned GetEndMask( int numBits ) { return g_BitStringEndMasks[numBits % BITS_PER_INT]; }
inline int CalcNumIntsForBits( int numBits ) { return (numBits + (BITS_PER_INT-1)) / BITS_PER_INT; }
void DebugPrintBitStringBits( const int *pInts, int nInts );
void SaveBitString(const int *pInts, int nInts, CUtlBuffer& buf);
void LoadBitString(int *pInts, int nInts, CUtlBuffer& buf);
#define BitString_Bit( bitNum ) ( 1 << ( (bitNum) & (BITS_PER_INT-1) ) )
#define BitString_Int( bitNum ) ( (bitNum) >> LOG2_BITS_PER_INT )
//-----------------------------------------------------------------------------
// template CBitStringT
//
// Defines the operations relevant to any bit array. Simply requires a base
// class that implements Size(), GetInts(), GetNumInts() & ValidateOperand()
//
// CBitString and CFixedBitString<int> are the actual classes generally used
// by clients
//
template <class BASE_OPS>
class CBitStringT : public BASE_OPS
{
public:
CBitStringT();
CBitStringT(int numBits); // Must be initialized with the number of bits
// Do NOT override bitwise operators (see note in header)
void And(const CBitStringT &andStr, CBitStringT *out) const;
void Or(const CBitStringT &orStr, CBitStringT *out) const;
void Xor(const CBitStringT &orStr, CBitStringT *out) const;
void Not(CBitStringT *out) const;
void Copy(CBitStringT *out) const;
bool IsAllClear(void) const; // Are all bits zero?
bool IsAllSet(void) const; // Are all bits one?
bool GetBit( int bitNum ) const;
void SetBit( int bitNum );
void ClearBit(int bitNum);
void SetAllBits(void); // Sets all bits
void ClearAllBits(void); // Clears all bits
void DebugPrintBits(void) const; // For debugging
void SaveBitString(CUtlBuffer& buf) const;
void LoadBitString(CUtlBuffer& buf);
};
//-----------------------------------------------------------------------------
// class CVariableBitStringBase
//
// Defines the operations necessary for a variable sized bit array
class CVariableBitStringBase
{
public:
bool IsFixedSize() const { return false; }
int Size(void) const { return m_numBits; }
void Resize( int numBits ); // resizes bit array
int GetNumInts() const { return m_numInts; }
int * GetInts() { return m_pInt; }
const int * GetInts() const { return m_pInt; }
protected:
CVariableBitStringBase();
CVariableBitStringBase(int numBits);
CVariableBitStringBase( const CVariableBitStringBase &from );
CVariableBitStringBase &operator=( const CVariableBitStringBase &from );
~CVariableBitStringBase(void);
void ValidateOperand( const CVariableBitStringBase &operand ) const;
unsigned GetEndMask() const { return ::GetEndMask( Size() ); }
private:
unsigned short m_numBits; // Number of bits in the bitstring
unsigned short m_numInts; // Number of ints to needed to store bitstring
int m_iBitStringStorage; // If the bit string fits in one int, it goes here
int *m_pInt; // Array of ints containing the bitstring
void AllocInts( int numInts ); // Free the allocated bits
void ReallocInts( int numInts );
void FreeInts( void ); // Free the allocated bits
};
//-----------------------------------------------------------------------------
// class CFixedBitStringBase
//
// Defines the operations necessary for a fixed sized bit array.
//
template <int bits> struct BitCountToEndMask_t { };
template <> struct BitCountToEndMask_t< 0> { enum { MASK = 0x00000000 }; };
template <> struct BitCountToEndMask_t< 1> { enum { MASK = 0xfffffffe }; };
template <> struct BitCountToEndMask_t< 2> { enum { MASK = 0xfffffffc }; };
template <> struct BitCountToEndMask_t< 3> { enum { MASK = 0xfffffff8 }; };
template <> struct BitCountToEndMask_t< 4> { enum { MASK = 0xfffffff0 }; };
template <> struct BitCountToEndMask_t< 5> { enum { MASK = 0xffffffe0 }; };
template <> struct BitCountToEndMask_t< 6> { enum { MASK = 0xffffffc0 }; };
template <> struct BitCountToEndMask_t< 7> { enum { MASK = 0xffffff80 }; };
template <> struct BitCountToEndMask_t< 8> { enum { MASK = 0xffffff00 }; };
template <> struct BitCountToEndMask_t< 9> { enum { MASK = 0xfffffe00 }; };
template <> struct BitCountToEndMask_t<10> { enum { MASK = 0xfffffc00 }; };
template <> struct BitCountToEndMask_t<11> { enum { MASK = 0xfffff800 }; };
template <> struct BitCountToEndMask_t<12> { enum { MASK = 0xfffff000 }; };
template <> struct BitCountToEndMask_t<13> { enum { MASK = 0xffffe000 }; };
template <> struct BitCountToEndMask_t<14> { enum { MASK = 0xffffc000 }; };
template <> struct BitCountToEndMask_t<15> { enum { MASK = 0xffff8000 }; };
template <> struct BitCountToEndMask_t<16> { enum { MASK = 0xffff0000 }; };
template <> struct BitCountToEndMask_t<17> { enum { MASK = 0xfffe0000 }; };
template <> struct BitCountToEndMask_t<18> { enum { MASK = 0xfffc0000 }; };
template <> struct BitCountToEndMask_t<19> { enum { MASK = 0xfff80000 }; };
template <> struct BitCountToEndMask_t<20> { enum { MASK = 0xfff00000 }; };
template <> struct BitCountToEndMask_t<21> { enum { MASK = 0xffe00000 }; };
template <> struct BitCountToEndMask_t<22> { enum { MASK = 0xffc00000 }; };
template <> struct BitCountToEndMask_t<23> { enum { MASK = 0xff800000 }; };
template <> struct BitCountToEndMask_t<24> { enum { MASK = 0xff000000 }; };
template <> struct BitCountToEndMask_t<25> { enum { MASK = 0xfe000000 }; };
template <> struct BitCountToEndMask_t<26> { enum { MASK = 0xfc000000 }; };
template <> struct BitCountToEndMask_t<27> { enum { MASK = 0xf8000000 }; };
template <> struct BitCountToEndMask_t<28> { enum { MASK = 0xf0000000 }; };
template <> struct BitCountToEndMask_t<29> { enum { MASK = 0xe0000000 }; };
template <> struct BitCountToEndMask_t<30> { enum { MASK = 0xc0000000 }; };
template <> struct BitCountToEndMask_t<31> { enum { MASK = 0x80000000 }; };
//-------------------------------------
template <int NUM_BITS>
class CFixedBitStringBase
{
public:
bool IsFixedSize() const { return true; }
int Size(void) const { return NUM_BITS; }
void Resize( int numBits ) { Assert(numBits == NUM_BITS); }// for syntatic consistency (for when using templates)
int GetNumInts() const { return NUM_INTS; }
int * GetInts() { return m_Ints; }
const int * GetInts() const { return m_Ints; }
protected:
CFixedBitStringBase() {}
CFixedBitStringBase(int numBits) { Assert( numBits == NUM_BITS ); } // doesn't make sense, really. Supported to simplify templates & allow easy replacement of variable
void ValidateOperand( const CFixedBitStringBase<NUM_BITS> &operand ) const { } // no need, compiler does so statically
public: // for test code
unsigned GetEndMask() const { return static_cast<unsigned>( BitCountToEndMask_t<NUM_BITS % BITS_PER_INT>::MASK ); }
private:
enum
{
NUM_INTS = (NUM_BITS + (BITS_PER_INT-1)) / BITS_PER_INT
};
int m_Ints[(NUM_BITS + (BITS_PER_INT-1)) / BITS_PER_INT];
};
//-----------------------------------------------------------------------------
//
// The actual classes used
//
// inheritance instead of typedef to allow forward declarations
class CBitString : public CBitStringT<CVariableBitStringBase>
{
public:
CBitString()
{
}
CBitString(int numBits)
: CBitStringT<CVariableBitStringBase>(numBits)
{
}
};
//-----------------------------------------------------------------------------
template < int NUM_BITS >
class CFixedBitString : public CBitStringT< CFixedBitStringBase<NUM_BITS> >
{
public:
CFixedBitString()
{
}
CFixedBitString(int numBits)
: CBitStringT< CFixedBitStringBase<NUM_BITS> >(numBits)
{
}
};
//-----------------------------------------------------------------------------
inline CVariableBitStringBase::CVariableBitStringBase()
{
memset( this, 0, sizeof( *this ) );
}
//-----------------------------------------------------------------------------
inline CVariableBitStringBase::CVariableBitStringBase(int numBits)
{
Assert( numBits );
m_numBits = numBits;
// Figure out how many ints are needed
m_numInts = CalcNumIntsForBits( numBits );
m_pInt = NULL;
AllocInts( m_numInts );
}
//-----------------------------------------------------------------------------
inline CVariableBitStringBase::CVariableBitStringBase( const CVariableBitStringBase &from )
{
if ( from.m_numInts )
{
m_numBits = from.m_numBits;
m_numInts = from.m_numInts;
m_pInt = NULL;
AllocInts( m_numInts );
memcpy( m_pInt, from.m_pInt, m_numInts * sizeof(int) );
}
else
memset( this, 0, sizeof( *this ) );
}
//-----------------------------------------------------------------------------
inline CVariableBitStringBase &CVariableBitStringBase::operator=( const CVariableBitStringBase &from )
{
Resize( from.Size() );
if ( m_pInt )
memcpy( m_pInt, from.m_pInt, m_numInts * sizeof(int) );
return (*this);
}
//-----------------------------------------------------------------------------
// Purpose: Destructor
// Input :
// Output :
//-----------------------------------------------------------------------------
inline CVariableBitStringBase::~CVariableBitStringBase(void)
{
FreeInts();
}
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline CBitStringT<BASE_OPS>::CBitStringT()
{
// undef this is ints are not 4 bytes
// generate a compile error if sizeof(int) is not 4 (HACK: can't use the preprocessor so use the compiler)
COMPILE_TIME_ASSERT( sizeof(int)==4 );
// Initialize bitstring by clearing all bits
ClearAllBits();
}
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline CBitStringT<BASE_OPS>::CBitStringT(int numBits)
: BASE_OPS( numBits )
{
// undef this is ints are not 4 bytes
// generate a compile error if sizeof(int) is not 4 (HACK: can't use the preprocessor so use the compiler)
COMPILE_TIME_ASSERT( sizeof(int)==4 );
// Initialize bitstring by clearing all bits
ClearAllBits();
}
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline bool CBitStringT<BASE_OPS>::GetBit( int bitNum ) const
{
Assert( bitNum >= 0 && bitNum < Size() );
const int *pInt = GetInts() + BitString_Int( bitNum );
return ( ( *pInt & BitString_Bit( bitNum ) ) != 0 );
}
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::SetBit( int bitNum )
{
Assert( bitNum >= 0 && bitNum < Size() );
int *pInt = GetInts() + BitString_Int( bitNum );
*pInt |= BitString_Bit( bitNum );
}
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::ClearBit(int bitNum)
{
Assert( bitNum >= 0 && bitNum < Size() );
int *pInt = GetInts() + BitString_Int( bitNum );
*pInt &= ~BitString_Bit( bitNum );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::And(const CBitStringT &addStr, CBitStringT *out) const
{
ValidateOperand( addStr );
ValidateOperand( *out );
int * pDest = out->GetInts();
const int *pOperand1 = GetInts();
const int *pOperand2 = addStr.GetInts();
for (int i = GetNumInts() - 1; i >= 0 ; --i)
{
pDest[i] = pOperand1[i] & pOperand2[i];
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::Or(const CBitStringT &orStr, CBitStringT *out) const
{
ValidateOperand( orStr );
ValidateOperand( *out );
int * pDest = out->GetInts();
const int *pOperand1 = GetInts();
const int *pOperand2 = orStr.GetInts();
for (int i = GetNumInts() - 1; i >= 0; --i)
{
pDest[i] = pOperand1[i] | pOperand2[i];
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::Xor(const CBitStringT &xorStr, CBitStringT *out) const
{
int * pDest = out->GetInts();
const int *pOperand1 = GetInts();
const int *pOperand2 = xorStr.GetInts();
for (int i = GetNumInts() - 1; i >= 0; --i)
{
pDest[i] = pOperand1[i] ^ pOperand2[i];
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::Not(CBitStringT *out) const
{
ValidateOperand( *out );
int * pDest = out->GetInts();
const int *pOperand = GetInts();
for (int i = GetNumInts() - 1; i >= 0; --i)
{
pDest[i] = ~(pOperand[i]);
}
}
//-----------------------------------------------------------------------------
// Purpose: Copy a bit string
// Input :
// Output :
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::Copy(CBitStringT *out) const
{
ValidateOperand( *out );
Assert( out != this );
memcpy( out->GetInts(), GetInts(), GetNumInts() * sizeof( int ) );
}
//-----------------------------------------------------------------------------
// Purpose: Are all bits zero?
// Input :
// Output :
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline bool CBitStringT<BASE_OPS>::IsAllClear(void) const
{
// Number of available bits may be more than the number
// actually used, so make sure to mask out unused bits
// before testing for zero
(const_cast<CBitStringT *>(this))->GetInts()[GetNumInts()-1] &= ~CBitStringT<BASE_OPS>::GetEndMask(); // external semantics of const retained
for (int i = GetNumInts() - 1; i >= 0; --i)
{
if ( GetInts()[i] !=0 )
{
return false;
}
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Are all bits set?
// Input :
// Output :
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline bool CBitStringT<BASE_OPS>::IsAllSet(void) const
{
// Number of available bits may be more than the number
// actually used, so make sure to mask out unused bits
// before testing for set bits
(const_cast<CBitStringT *>(this))->GetInts()[GetNumInts()-1] |= CBitStringT<BASE_OPS>::GetEndMask(); // external semantics of const retained
for (int i = GetNumInts() - 1; i >= 0; --i)
{
if ( GetInts()[i] != ~0 )
{
return false;
}
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Sets all bits
// Input :
// Output :
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::SetAllBits(void)
{
if ( GetInts() )
memset( GetInts(), 0xff, GetNumInts() * sizeof(int) );
}
//-----------------------------------------------------------------------------
// Purpose: Clears all bits
// Input :
// Output :
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::ClearAllBits(void)
{
if ( GetInts() )
memset( GetInts(), 0, GetNumInts() * sizeof(int) );
}
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::DebugPrintBits(void) const
{
(const_cast<CBitStringT *>(this))->GetInts()[GetNumInts()-1] &= ~CBitStringT<BASE_OPS>::GetEndMask(); // external semantics of const retained
DebugPrintBitStringBits( GetInts(), GetNumInts() );
}
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::SaveBitString(CUtlBuffer& buf) const
{
(const_cast<CBitStringT *>(this))->GetInts()[GetNumInts()-1] &= ~CBitStringT<BASE_OPS>::GetEndMask(); // external semantics of const retained
::SaveBitString( GetInts(), GetNumInts(), buf );
}
//-----------------------------------------------------------------------------
template <class BASE_OPS>
inline void CBitStringT<BASE_OPS>::LoadBitString(CUtlBuffer& buf)
{
(const_cast<CBitStringT *>(this))->GetInts()[GetNumInts()-1] &= ~CBitStringT<BASE_OPS>::GetEndMask();
::LoadBitString( GetInts(), GetNumInts(), buf );
}
//-----------------------------------------------------------------------------
// @Note (toml 11-09-02): these methods are a nod to a heavy user of the
// bit string, AI conditions. This assumes MAX_CONDITIONS == 128
template<>
inline void CBitStringT< CFixedBitStringBase<128> >::And(const CBitStringT &addStr, CBitStringT *out) const
{
int * pDest = out->GetInts();
const int *pOperand1 = GetInts();
const int *pOperand2 = addStr.GetInts();
pDest[0] = pOperand1[0] & pOperand2[0];
pDest[1] = pOperand1[1] & pOperand2[1];
pDest[2] = pOperand1[2] & pOperand2[2];
pDest[3] = pOperand1[3] & pOperand2[3];
}
template<>
inline bool CBitStringT< CFixedBitStringBase<128> >::IsAllClear(void) const
{
const int *pInts = GetInts();
return ( pInts[0] == 0 && pInts[1] == 0 && pInts[2] == 0 && pInts[3] == 0 );
}
template<>
inline void CBitStringT< CFixedBitStringBase<128> >::Copy(CBitStringT *out) const
{
int * pDest = out->GetInts();
const int *pInts = GetInts();
pDest[0] = pInts[0];
pDest[1] = pInts[1];
pDest[2] = pInts[2];
pDest[3] = pInts[3];
}
//=============================================================================
#endif // BITSTRING_H

View File

@@ -1,144 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Color correction entity.
//
// $NoKeywords: $
//=============================================================================//
#include <string.h>
#include "cbase.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//------------------------------------------------------------------------------
// FIXME: This really should inherit from something more lightweight
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Purpose : Shadow control entity
//------------------------------------------------------------------------------
class CColorCorrection : public CBaseEntity
{
DECLARE_CLASS( CColorCorrection, CBaseEntity );
public:
DECLARE_SERVERCLASS();
DECLARE_DATADESC();
CColorCorrection();
void Spawn( void );
int UpdateTransmitState();
void Activate( void );
virtual int ObjectCaps( void ) { return BaseClass::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
// Inputs
void InputEnable( inputdata_t &inputdata );
void InputDisable( inputdata_t &inputdata );
private:
bool m_bStartDisabled;
CNetworkVar( bool, m_bEnabled );
CNetworkVar( float, m_Weight );
CNetworkVar( float, m_MinFalloff );
CNetworkVar( float, m_MaxFalloff );
CNetworkVar( float, m_MaxWeight );
CNetworkString( m_netlookupFilename, MAX_PATH );
string_t m_lookupFilename;
};
LINK_ENTITY_TO_CLASS(color_correction, CColorCorrection);
BEGIN_DATADESC( CColorCorrection )
DEFINE_KEYFIELD( m_Weight, FIELD_FLOAT, "weight" ),
DEFINE_KEYFIELD( m_MinFalloff, FIELD_FLOAT, "minfalloff" ),
DEFINE_KEYFIELD( m_MaxFalloff, FIELD_FLOAT, "maxfalloff" ),
DEFINE_KEYFIELD( m_MaxWeight, FIELD_FLOAT, "maxweight" ),
DEFINE_KEYFIELD( m_lookupFilename, FIELD_STRING, "filename" ),
DEFINE_KEYFIELD( m_bEnabled, FIELD_BOOLEAN, "enabled" ),
DEFINE_KEYFIELD( m_bStartDisabled, FIELD_BOOLEAN, "StartDisabled" ),
DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ),
DEFINE_INPUTFUNC( FIELD_VOID, "Disable", InputDisable ),
END_DATADESC()
IMPLEMENT_SERVERCLASS_ST_NOBASE(CColorCorrection, DT_ColorCorrection)
SendPropVector( SENDINFO(m_vecOrigin), -1, SPROP_NOSCALE, 0.0f, HIGH_DEFAULT, SendProxy_Origin ),
SendPropFloat( SENDINFO(m_MinFalloff) ),
SendPropFloat( SENDINFO(m_MaxFalloff) ),
SendPropFloat( SENDINFO(m_MaxWeight) ),
SendPropString( SENDINFO(m_netlookupFilename) ),
SendPropBool( SENDINFO(m_bEnabled) ),
END_SEND_TABLE()
CColorCorrection::CColorCorrection() : BaseClass()
{
m_bEnabled = true;
m_MinFalloff = 0.0f;
m_MaxFalloff = 1000.0f;
m_MaxWeight = 1.0f;
m_netlookupFilename.GetForModify()[0] = 0;
m_lookupFilename = NULL_STRING;
}
//------------------------------------------------------------------------------
// Purpose : Send even though we don't have a model
//------------------------------------------------------------------------------
int CColorCorrection::UpdateTransmitState()
{
// ALWAYS transmit to all clients.
return SetTransmitState( FL_EDICT_ALWAYS );
}
//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CColorCorrection::Spawn( void )
{
AddEFlags( EFL_FORCE_CHECK_TRANSMIT | EFL_DIRTY_ABSTRANSFORM );
Precache();
SetSolid( SOLID_NONE );
if( m_bStartDisabled )
{
m_bEnabled = false;
}
else
{
m_bEnabled = true;
}
BaseClass::Spawn();
}
void CColorCorrection::Activate( void )
{
BaseClass::Activate();
Q_strncpy( m_netlookupFilename.GetForModify(), STRING( m_lookupFilename ), MAX_PATH );
}
//------------------------------------------------------------------------------
// Purpose : Input handlers
//------------------------------------------------------------------------------
void CColorCorrection::InputEnable( inputdata_t &inputdata )
{
m_bEnabled = true;
}
void CColorCorrection::InputDisable( inputdata_t &inputdata )
{
m_bEnabled = false;
}

View File

@@ -1,224 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#if !defined(IN_XBOX_CODELINE)
#include "baseentity.h"
#include "terrainmodmgr.h"
#include "terrainmodmgr_shared.h"
#include "ndebugoverlay.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define SF_TERRAINMORPH_INSTANT 0x00000001
#define TERRAINMORPH_THINK_FREQUENCY 0.05
//=========================================================
//=========================================================
class CTerrainMorphParams
{
public:
Vector m_vecNormal;
float m_flDeltaZ;
float m_flDieTime;
float m_flRadius;
float m_flDeltaRadius;
float m_flStrength;
float m_flDeltaStrength;
float m_flDuration;
float m_flStartTime;
float m_flStartRadius;
float m_flGoalRadius;
float m_flFraction;
};
//=========================================================
//=========================================================
class CTerrainMorph : public CPointEntity
{
DECLARE_CLASS( CTerrainMorph, CPointEntity );
public:
void Spawn( CTerrainMorphParams &params );
void Start( void );
void MorphThink( void );
// Input handlers
void InputBeginMorph( inputdata_t &inputdata );
DECLARE_DATADESC();
private:
CTerrainMorphParams m_Params;
int m_iIterations;
};
//---------------------------------------------------------
//---------------------------------------------------------
void CTerrainMorph::Spawn( CTerrainMorphParams &params )
{
m_Params = params;
SetThink( NULL );
}
//---------------------------------------------------------
//---------------------------------------------------------
void CTerrainMorph::Start( void )
{
// Set up start time, die time, effect duration.
m_Params.m_flStartTime = gpGlobals->curtime;
m_Params.m_flDieTime = gpGlobals->curtime + m_Params.m_flDuration;
m_Params.m_flDuration = m_Params.m_flDuration;
// NORMAL (direction the effect will 'pull')
GetVectors( &m_Params.m_vecNormal, NULL, NULL );
// RADIUS
m_Params.m_flRadius = m_Params.m_flStartRadius;
// STRENGTH (This is the distance that the effect will pull the displacement)
trace_t tr;
// trace backwards along the normal and find the point under myself that is going to be pulled.
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + m_Params.m_vecNormal * -4096, MASK_OPAQUE, this, COLLISION_GROUP_NONE, &tr );
//NDebugOverlay::Line( tr.startpos, tr.endpos, 0,255,0, true, 30 );
// Get that distance.
float flDist;
flDist = VectorLength( tr.endpos - tr.startpos );
// Set the strength relative to the FRACTION specified by the designer.
m_Params.m_flStrength = flDist * m_Params.m_flFraction;
SetThink( &CTerrainMorph::MorphThink );
SetNextThink( gpGlobals->curtime );
m_iIterations = 0;
//NDebugOverlay::Line( m_Params.m_vecLocation, m_Params.m_vecLocation + m_Params.m_vecNormal * 200, 255,0,0, true, 3 );
}
//---------------------------------------------------------
//---------------------------------------------------------
void CTerrainMorph::MorphThink( void )
{
SetNextThink( gpGlobals->curtime + TERRAINMORPH_THINK_FREQUENCY );
if( m_spawnflags & SF_TERRAINMORPH_INSTANT )
{
// Do the full effect in one whack.
CTerrainModParams params;
TerrainModType type;
params.m_Flags |= CTerrainModParams::TMOD_SUCKTONORMAL;
type = TMod_Suck;
params.m_flRadius = m_Params.m_flRadius;
params.m_flStrength = m_Params.m_flStrength;
params.m_vCenter = GetAbsOrigin();
params.m_vNormal = m_Params.m_vecNormal;
params.m_flRadius = clamp(params.m_flRadius, MIN_TMOD_RADIUS, MAX_TMOD_RADIUS);
TerrainMod_Add( type, params );
UTIL_Remove( this );
return;
}
//----
float flTime;
flTime = ( (gpGlobals->curtime - m_Params.m_flStartTime) / m_Params.m_flDuration );
flTime = 1 - clamp(flTime, 0, 1 );
//----
if( flTime >= 0.0 )
{
//Msg( "time: %f radius:%f strength: %f\n", flTime,params.m_flRadius, params.m_flStrength );
CTerrainModParams params;
TerrainModType type;
params.m_Flags |= CTerrainModParams::TMOD_SUCKTONORMAL;
type = TMod_Suck;
#if 1
float nextIteration = (1-flTime)*m_Params.m_flStrength;
params.m_flStrength = (int)nextIteration - m_iIterations;
if ( params.m_flStrength > 0 )
{
params.m_vCenter = GetAbsOrigin();
params.m_vNormal = m_Params.m_vecNormal;
params.m_flRadius = m_Params.m_flStartRadius * flTime + m_Params.m_flGoalRadius * ( 1 - flTime );
params.m_flRadius = clamp(params.m_flRadius, MIN_TMOD_RADIUS, MAX_TMOD_RADIUS);
//Msg( "Strength: %f - Radius: %f\n", params.m_flStrength, params.m_flRadius );
TerrainMod_Add( type, params );
m_iIterations += params.m_flStrength;
}
#if 0
NDebugOverlay::Line( m_Params.m_vecLocation, m_Params.m_vecLocation + Vector( 200, 200, 0 ), 0,255,0, true, 3 );
NDebugOverlay::Line( m_Params.m_vecLocation + Vector( m_Params.m_flRadius, 0, 0 ), m_Params.m_vecLocation + Vector( m_Params.m_flRadius, 0 , 200 ), 0,255,0, true, 3 );
#endif
#endif
}
if( gpGlobals->curtime > m_Params.m_flDieTime )
{
SetThink( NULL );
UTIL_Remove( this );
}
}
//---------------------------------------------------------
//---------------------------------------------------------
void CTerrainMorph::InputBeginMorph( inputdata_t &inputdata )
{
Start();
}
//---------------------------------------------------------
//---------------------------------------------------------
BEGIN_DATADESC( CTerrainMorph )
// Function Pointers
DEFINE_FUNCTION( MorphThink ),
DEFINE_INPUTFUNC( FIELD_VOID, "BeginMorph", InputBeginMorph ),
// quiet down classcheck
// DEFINE_FIELD( m_Params, CTerrainMorphParams ),
DEFINE_KEYFIELD( m_Params.m_flStartRadius, FIELD_FLOAT, "startradius" ),
DEFINE_KEYFIELD( m_Params.m_flGoalRadius, FIELD_FLOAT, "goalradius" ),
DEFINE_KEYFIELD( m_Params.m_flDuration, FIELD_FLOAT, "duration" ),
DEFINE_KEYFIELD( m_Params.m_flFraction, FIELD_FLOAT, "fraction" ),
DEFINE_FIELD( m_iIterations, FIELD_INTEGER ),
END_DATADESC()
LINK_ENTITY_TO_CLASS(tectonic, CTerrainMorph);
LINK_ENTITY_TO_CLASS(env_terrainmorph, CTerrainMorph);
#endif

View File

@@ -1,160 +0,0 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#include "cbase.h"
#include "const.h"
#include "toolframework/itoolentity.h"
#include "entitylist.h"
#include "toolframework/itoolsystem.h"
#include "KeyValues.h"
#include "icliententity.h"
#include "iserverentity.h"
#include "sceneentity.h"
// Interface from engine to tools for manipulating entities
class CServerTools : public IServerTools
{
public:
virtual IServerEntity *GetIServerEntity( IClientEntity *pClientEntity )
{
if ( pClientEntity == NULL )
return NULL;
CBaseHandle ehandle = pClientEntity->GetRefEHandle();
if ( ehandle.GetEntryIndex() >= MAX_EDICTS )
return NULL; // the first MAX_EDICTS entities are networked, the rest are client or server only
#if 0
// this fails, since the server entities have extra bits in their serial numbers,
// since 20 bits are reserved for serial numbers, except for networked entities, which are restricted to 10
// Brian believes that everything should just restrict itself to 10 to make things simpler,
// so if/when he changes NUM_SERIAL_NUM_BITS to 10, we can switch back to this simpler code
IServerNetworkable *pNet = gEntList.GetServerNetworkable( ehandle );
if ( pNet == NULL )
return NULL;
CBaseEntity *pServerEnt = pNet->GetBaseEntity();
return pServerEnt;
#else
IHandleEntity *pEnt = gEntList.LookupEntityByNetworkIndex( ehandle.GetEntryIndex() );
if ( pEnt == NULL )
return NULL;
CBaseHandle h = gEntList.GetNetworkableHandle( ehandle.GetEntryIndex() );
const int mask = ( 1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS ) - 1;
if ( !h.IsValid() || ( ( h.GetSerialNumber() & mask ) != ( ehandle.GetSerialNumber() & mask ) ) )
return NULL;
IServerUnknown *pUnk = static_cast< IServerUnknown* >( pEnt );
return pUnk->GetBaseEntity();
#endif
}
bool GetPlayerPosition( Vector &org, QAngle &ang, IClientEntity *pClientPlayer = NULL )
{
IServerEntity *pServerPlayer = GetIServerEntity( pClientPlayer );
CBasePlayer *pPlayer = pServerPlayer ? ( CBasePlayer* )pServerPlayer : UTIL_GetLocalPlayer();
if ( pPlayer == NULL )
return false;
org = pPlayer->EyePosition();
ang = pPlayer->EyeAngles();
return true;
}
bool SnapPlayerToPosition( const Vector &org, const QAngle &ang, IClientEntity *pClientPlayer = NULL )
{
IServerEntity *pServerPlayer = GetIServerEntity( pClientPlayer );
CBasePlayer *pPlayer = pServerPlayer ? ( CBasePlayer* )pServerPlayer : UTIL_GetLocalPlayer();
if ( pPlayer == NULL )
return false;
pPlayer->SetAbsOrigin( org - pPlayer->GetViewOffset() );
pPlayer->SnapEyeAngles( ang );
// Disengage from hierarchy
pPlayer->SetParent( NULL );
return true;
}
int GetPlayerFOV( IClientEntity *pClientPlayer = NULL )
{
IServerEntity *pServerPlayer = GetIServerEntity( pClientPlayer );
CBasePlayer *pPlayer = pServerPlayer ? ( CBasePlayer* )pServerPlayer : UTIL_GetLocalPlayer();
if ( pPlayer == NULL )
return 0;
return pPlayer->GetFOV();
}
bool SetPlayerFOV( int fov, IClientEntity *pClientPlayer = NULL )
{
IServerEntity *pServerPlayer = GetIServerEntity( pClientPlayer );
CBasePlayer *pPlayer = pServerPlayer ? ( CBasePlayer* )pServerPlayer : UTIL_GetLocalPlayer();
if ( pPlayer == NULL )
return false;
pPlayer->SetDefaultFOV( fov );
CBaseEntity *pFOVOwner = pPlayer->GetFOVOwner();
return pPlayer->SetFOV( pFOVOwner ? pFOVOwner : pPlayer, fov );
}
};
static CServerTools g_ServerTools;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CServerTools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION, g_ServerTools );
// Interface from engine to tools for manipulating entities
class CServerChoreoTools : public IServerChoreoTools
{
public:
// Iterates through ALL entities (separate list for client vs. server)
virtual EntitySearchResult NextChoreoEntity( EntitySearchResult currentEnt )
{
CBaseEntity *ent = reinterpret_cast< CBaseEntity* >( currentEnt );
ent = gEntList.FindEntityByClassname( ent, "logic_choreographed_scene" );
return reinterpret_cast< EntitySearchResult >( ent );
}
virtual const char *GetSceneFile( EntitySearchResult sr )
{
CBaseEntity *ent = reinterpret_cast< CBaseEntity* >( sr );
if ( !sr )
return "";
if ( Q_stricmp( ent->GetClassname(), "logic_choreographed_scene" ) )
return "";
return GetSceneFilename( ent );
}
// For interactive editing
virtual int GetEntIndex( EntitySearchResult sr )
{
CBaseEntity *ent = reinterpret_cast< CBaseEntity* >( sr );
if ( !ent )
return -1;
return ent->entindex();
}
virtual void ReloadSceneFromDisk( int entindex )
{
CBaseEntity *ent = CBaseEntity::Instance( entindex );
if ( !ent )
return;
::ReloadSceneFromDisk( ent );
}
};
static CServerChoreoTools g_ServerChoreoTools;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CServerChoreoTools, IServerChoreoTools, VSERVERCHOREOTOOLS_INTERFACE_VERSION, g_ServerChoreoTools );

View File

@@ -1,133 +0,0 @@
//====== Copyright <20> 1996-2003, Valve Corporation, All rights reserved. =======
//
// Purpose: Entity to control screen overlays on a player
//
//=============================================================================
#include "cbase.h"
#include "shareddefs.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define ENV_PROJECTEDTEXTURE_STARTON (1<<0)
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CEnvProjectedTexture : public CPointEntity
{
DECLARE_CLASS( CEnvProjectedTexture, CPointEntity );
public:
DECLARE_DATADESC();
DECLARE_SERVERCLASS();
CEnvProjectedTexture();
// Always transmit to clients
virtual int UpdateTransmitState();
virtual void Activate( void );
void InputTurnOn( inputdata_t &inputdata );
void InputTurnOff( inputdata_t &inputdata );
void InputSetFOV( inputdata_t &inputdata );
void InitialThink( void );
CNetworkHandle( CBaseEntity, m_hTargetEntity );
private:
CNetworkVar( bool, m_bState );
CNetworkVar( float, m_flLightFOV );
CNetworkVar( bool, m_bEnableShadows );
CNetworkVar( bool, m_bLightOnlyTarget );
CNetworkVar( bool, m_bLightWorld );
CNetworkVar( bool, m_bCameraSpace );
CNetworkVar( color32, m_cLightColor );
};
LINK_ENTITY_TO_CLASS( env_projectedtexture, CEnvProjectedTexture );
BEGIN_DATADESC( CEnvProjectedTexture )
DEFINE_FIELD( m_hTargetEntity, FIELD_EHANDLE ),
DEFINE_FIELD( m_bState, FIELD_BOOLEAN ),
DEFINE_KEYFIELD( m_flLightFOV, FIELD_FLOAT, "lightfov" ),
DEFINE_KEYFIELD( m_bEnableShadows, FIELD_BOOLEAN, "enableshadows" ),
DEFINE_KEYFIELD( m_bLightOnlyTarget, FIELD_BOOLEAN, "lightonlytarget" ),
DEFINE_KEYFIELD( m_bLightWorld, FIELD_BOOLEAN, "lightworld" ),
DEFINE_KEYFIELD( m_bCameraSpace, FIELD_BOOLEAN, "cameraspace" ),
DEFINE_KEYFIELD( m_cLightColor, FIELD_COLOR32, "lightcolor" ),
DEFINE_INPUTFUNC( FIELD_VOID, "TurnOn", InputTurnOn ),
DEFINE_INPUTFUNC( FIELD_VOID, "TurnOff", InputTurnOff ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetFOV", InputSetFOV ),
DEFINE_THINKFUNC( InitialThink ),
END_DATADESC()
IMPLEMENT_SERVERCLASS_ST( CEnvProjectedTexture, DT_EnvProjectedTexture )
SendPropEHandle( SENDINFO( m_hTargetEntity ) ),
SendPropBool( SENDINFO( m_bState ) ),
SendPropFloat( SENDINFO( m_flLightFOV ) ),
SendPropBool( SENDINFO( m_bEnableShadows ) ),
SendPropBool( SENDINFO( m_bLightOnlyTarget ) ),
SendPropBool( SENDINFO( m_bLightWorld ) ),
SendPropBool( SENDINFO( m_bCameraSpace ) ),
SendPropInt( SENDINFO( m_cLightColor ), 32, SPROP_UNSIGNED ),
END_SEND_TABLE()
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CEnvProjectedTexture::CEnvProjectedTexture( void )
{
m_bState = false;
m_flLightFOV = 45.0f;
m_bEnableShadows = false;
m_bLightOnlyTarget = false;
m_bLightWorld = true;
m_bCameraSpace = true;
color32 color;
color.r = 255;
color.g = 255;
color.b = 255;
color.a = 0;
m_cLightColor.Set( color );
}
void CEnvProjectedTexture::InputTurnOn( inputdata_t &inputdata )
{
m_bState = true;
}
void CEnvProjectedTexture::InputTurnOff( inputdata_t &inputdata )
{
m_bState = false;
}
void CEnvProjectedTexture::InputSetFOV( inputdata_t &inputdata )
{
m_flLightFOV = inputdata.value.Float();
}
void CEnvProjectedTexture::Activate( void )
{
if ( GetSpawnFlags() & ENV_PROJECTEDTEXTURE_STARTON )
{
m_bState = true;
}
SetThink( &CEnvProjectedTexture::InitialThink );
SetNextThink( gpGlobals->curtime + 0.1f );
BaseClass::Activate();
}
void CEnvProjectedTexture::InitialThink( void )
{
m_hTargetEntity = gEntList.FindEntityByName( NULL, m_target );
}
int CEnvProjectedTexture::UpdateTransmitState()
{
return SetTransmitState( FL_EDICT_ALWAYS );
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,274 +0,0 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose: Temp entity for testing physcannon ammo
//
//=============================================================================
#include "cbase.h"
#include "props.h"
#include "vphysics/constraints.h"
#include "physics_saverestore.h"
class CPropStickyBomb : public CPhysicsProp
{
DECLARE_CLASS( CPropStickyBomb, CPhysicsProp );
DECLARE_DATADESC();
public:
CPropStickyBomb( void );
virtual void Precache( void );
virtual void Spawn( void );
virtual void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent );
virtual void UpdateOnRemove( void );
private:
bool StickToWorld( int index, gamevcollisionevent_t *pEvent );
bool StickToEntity( int index, gamevcollisionevent_t *pEvent );
bool CreateConstraintToObject( CBaseEntity *pObject );
bool CreateConstraintToNPC( CAI_BaseNPC *pNPC );
void OnConstraintBroken( void );
IPhysicsConstraint *m_pConstraint;
EHANDLE m_hConstrainedEntity;
};
LINK_ENTITY_TO_CLASS( prop_stickybomb, CPropStickyBomb );
BEGIN_DATADESC( CPropStickyBomb )
DEFINE_FIELD( m_hConstrainedEntity, FIELD_EHANDLE ),
DEFINE_PHYSPTR( m_pConstraint ),
END_DATADESC()
CPropStickyBomb::CPropStickyBomb( void ) : m_pConstraint(NULL)
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropStickyBomb::Precache( void )
{
m_iszBreakableModel = AllocPooledString( "models/props_outland/pumpkin_explosive.mdl" );
PrecacheModel( STRING( m_iszBreakableModel ) );
PrecacheScriptSound( "NPC_AntlionGrub.Squash" );
BaseClass::Precache();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropStickyBomb::Spawn( void )
{
BaseClass::Spawn();
}
//-----------------------------------------------------------------------------
// Purpose: Stick to the world
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPropStickyBomb::StickToWorld( int index, gamevcollisionevent_t *pEvent )
{
Vector vecDir = pEvent->preVelocity[ index ];
float speed = VectorNormalize( vecDir );
// Make sure the object is travelling fast enough to stick.
if( speed > 1000.0f )
{
Vector vecPos;
QAngle angles;
VPhysicsGetObject()->GetPosition( &vecPos, &angles );
Vector vecVelocity = pEvent->preVelocity[0];
VectorNormalize(vecVelocity);
trace_t tr;
UTIL_TraceLine( vecPos, vecPos + (vecVelocity * 64), MASK_SHOT, this, COLLISION_GROUP_NONE, &tr );
// Finally, inhibit sticking in metal, grates, sky, or anything else that doesn't make a sound.
surfacedata_t *psurf= physprops->GetSurfaceData( pEvent->surfaceProps[!index] );
if ( psurf->game.material != 'X' )
{
EmitSound( "NPC_AntlionGrub.Squash" );
Vector savePosition = vecPos;
Vector vecEmbed = pEvent->preVelocity[ index ];
VectorNormalize( vecEmbed );
vecEmbed *= 8;
vecPos += vecEmbed;
Teleport( &vecPos, NULL, NULL );
SetEnableMotionPosition( savePosition, angles ); // this uses hierarchy, so it must be set after teleport
VPhysicsGetObject()->EnableMotion( false );
AddSpawnFlags( SF_PHYSPROP_ENABLE_ON_PHYSCANNON );
SetCollisionGroup( COLLISION_GROUP_DEBRIS );
UTIL_DecalTrace( &tr, "PaintSplatGreen" );
return true;
}
}
return false;
}
//-----------------------------------------------------------------------------
// Purpose: Create a constraint between this object and another
// Input : *pObject - Object to constrain ourselves to
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPropStickyBomb::CreateConstraintToObject( CBaseEntity *pObject )
{
if ( m_pConstraint != NULL )
{
// Should we destroy the constraint and make a new one at this point?
Assert( 0 );
return false;
}
if ( pObject == NULL )
return false;
IPhysicsObject *pPhysObject = pObject->VPhysicsGetObject();
if ( pPhysObject == NULL )
return false;
IPhysicsObject *pMyPhysObject = VPhysicsGetObject();
if ( pPhysObject == NULL )
return false;
// Create the fixed constraint
constraint_fixedparams_t fixedConstraint;
fixedConstraint.Defaults();
fixedConstraint.InitWithCurrentObjectState( pPhysObject, pMyPhysObject );
IPhysicsConstraint *pConstraint = physenv->CreateFixedConstraint( pPhysObject, pMyPhysObject, NULL, fixedConstraint );
if ( pConstraint == NULL )
return false;
// Hold on to us
m_pConstraint = pConstraint;
pConstraint->SetGameData( (void *)this );
m_hConstrainedEntity = pObject;
// Disable collisions between the two ents
PhysDisableObjectCollisions( pPhysObject, pMyPhysObject );
EmitSound( "NPC_AntlionGrub.Squash" );
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropStickyBomb::UpdateOnRemove( void )
{
OnConstraintBroken();
BaseClass::UpdateOnRemove();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropStickyBomb::OnConstraintBroken( void )
{
// Destroy the constraint
if ( m_pConstraint != NULL )
{
physenv->DestroyConstraint( m_pConstraint );
m_pConstraint = NULL;
}
if ( m_hConstrainedEntity != NULL )
{
// Re-enable the collisions between the objects
IPhysicsObject *pPhysObject = m_hConstrainedEntity->VPhysicsGetObject();
IPhysicsObject *pMyPhysObject = VPhysicsGetObject();
PhysEnableEntityCollisions( pPhysObject, pMyPhysObject );
m_hConstrainedEntity = NULL;
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pNPC -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPropStickyBomb::CreateConstraintToNPC( CAI_BaseNPC *pNPC )
{
// Find the nearest bone to our position
return false;
}
//-----------------------------------------------------------------------------
// Purpose: Stick to an entity (using hierarchy if we can)
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPropStickyBomb::StickToEntity( int index, gamevcollisionevent_t *pEvent )
{
// Make sure the object is travelling fast enough to stick
float flSpeedSqr = ( pEvent->preVelocity[ index ] ).LengthSqr();
if ( flSpeedSqr < Square( 1000.0f ) )
return false;
CBaseEntity *pOther = pEvent->pEntities[!index];
// Handle NPCs
CAI_BaseNPC *pNPC = pOther->MyNPCPointer();
if ( pNPC != NULL )
{
// Attach this object to the nearest bone
// TODO: How does this affect the NPC's behavior?
return CreateConstraintToNPC( pNPC );
}
// Handle physics props
CPhysicsProp *pProp = dynamic_cast<CPhysicsProp *>(pOther);
if ( pProp != NULL )
{
// Create a constraint to this object
return CreateConstraintToObject( pProp );
}
return false;
}
//-----------------------------------------------------------------------------
// Purpose: Handle a collision using our special behavior
//-----------------------------------------------------------------------------
void CPropStickyBomb::VPhysicsCollision( int index, gamevcollisionevent_t *pEvent )
{
// Find out what we hit
CBaseEntity *pVictim = pEvent->pEntities[!index];
if ( pVictim == NULL || m_pConstraint != NULL )
{
BaseClass::VPhysicsCollision( index, pEvent );
return;
}
// Attempt to stick to the world
if ( pVictim->IsWorld() )
{
// Done if we succeeded
if ( StickToWorld( index, pEvent ) )
return;
// Just bounce
BaseClass::VPhysicsCollision( index, pEvent );
return;
}
// Attempt to stick to an entity
if ( StickToEntity( index, pEvent ) )
return;
// Just bounce
BaseClass::VPhysicsCollision( index, pEvent );
}

View File

@@ -1,222 +0,0 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#include "cbase.h"
#include "vehicle_jeep_episodic.h"
#include "collisionutils.h"
#include "npc_alyx_episodic.h"
LINK_ENTITY_TO_CLASS( prop_vehicle_jeep, CPropJeepEpisodic );
BEGIN_DATADESC( CPropJeepEpisodic )
DEFINE_FIELD( m_bEntranceLocked, FIELD_BOOLEAN ),
DEFINE_FIELD( m_bExitLocked, FIELD_BOOLEAN ),
DEFINE_OUTPUT( m_OnCompanionEnteredVehicle, "OnCompanionEnteredVehicle" ),
DEFINE_OUTPUT( m_OnCompanionExitedVehicle, "OnCompanionExitedVehicle" ),
DEFINE_OUTPUT( m_OnHostileEnteredVehicle, "OnHostileEnteredVehicle" ),
DEFINE_OUTPUT( m_OnHostileExitedVehicle, "OnHostileExitedVehicle" ),
DEFINE_INPUTFUNC( FIELD_VOID, "LockEntrance", InputLockEntrance ),
DEFINE_INPUTFUNC( FIELD_VOID, "UnlockEntrance", InputUnlockEntrance ),
DEFINE_INPUTFUNC( FIELD_VOID, "LockExit", InputLockExit ),
DEFINE_INPUTFUNC( FIELD_VOID, "UnlockExit", InputUnlockExit ),
END_DATADESC();
//=============================================================================
// Episodic jeep
CPropJeepEpisodic::CPropJeepEpisodic( void ) :
m_bEntranceLocked( false ),
m_bExitLocked( false )
{
m_bHasGun = false;
m_bUnableToFire = true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropJeepEpisodic::Spawn( void )
{
BaseClass::Spawn();
SetBlocksLOS( false );
CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
if ( pPlayer != NULL )
{
pPlayer->m_Local.m_iHideHUD |= HIDEHUD_VEHICLE_CROSSHAIR;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropJeepEpisodic::NPC_FinishedEnterVehicle( CAI_BaseNPC *pPassenger, bool bCompanion )
{
// FIXME: This will be moved to the NPCs entering and exiting
// Fire our outputs
if ( bCompanion )
{
m_OnCompanionEnteredVehicle.FireOutput( this, pPassenger );
}
else
{
m_OnHostileEnteredVehicle.FireOutput( this, pPassenger );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropJeepEpisodic::NPC_FinishedExitVehicle( CAI_BaseNPC *pPassenger, bool bCompanion )
{
// FIXME: This will be moved to the NPCs entering and exiting
// Fire our outputs
if ( bCompanion )
{
m_OnCompanionExitedVehicle.FireOutput( this, pPassenger );
}
else
{
m_OnHostileExitedVehicle.FireOutput( this, pPassenger );
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPassenger -
// bCompanion -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPropJeepEpisodic::NPC_CanEnterVehicle( CAI_BaseNPC *pPassenger, bool bCompanion )
{
// Must be unlocked
if ( bCompanion && m_bEntranceLocked )
return false;
return BaseClass::NPC_CanEnterVehicle( pPassenger, bCompanion );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPassenger -
// bCompanion -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPropJeepEpisodic::NPC_CanExitVehicle( CAI_BaseNPC *pPassenger, bool bCompanion )
{
// Must be unlocked
if ( bCompanion && m_bExitLocked )
return false;
return BaseClass::NPC_CanExitVehicle( pPassenger, bCompanion );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropJeepEpisodic::InputLockEntrance( inputdata_t &data )
{
m_bEntranceLocked = true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropJeepEpisodic::InputUnlockEntrance( inputdata_t &data )
{
m_bEntranceLocked = false;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropJeepEpisodic::InputLockExit( inputdata_t &data )
{
m_bExitLocked = true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropJeepEpisodic::InputUnlockExit( inputdata_t &data )
{
m_bExitLocked = false;
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPropJeepEpisodic::PassengerInTransition( void )
{
// FIXME: Big hack - we need a way to bridge this data better
// TODO: Get a list of passengers we can traverse instead
CBaseEntity *pPassenger = gEntList.FindEntityByClassname( NULL, "npc_alyx" );
if ( pPassenger == NULL )
return false;
CNPC_Alyx *pAlyx = static_cast<CNPC_Alyx *>(pPassenger);
if ( pAlyx->GetPassengerState() == PASSENGER_STATE_ENTERING ||
pAlyx->GetPassengerState() == PASSENGER_STATE_EXITING )
return true;
return false;
}
//-----------------------------------------------------------------------------
// Purpose: Determines whether to override our normal punting behavior
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPropJeepEpisodic::ShouldPuntUseLaunchForces( void )
{
if ( IsOverturned() || PassengerInTransition() )
return true;
return false;
}
//-----------------------------------------------------------------------------
// Purpose: Override velocity if our passenger is transitioning or we're upside-down
//-----------------------------------------------------------------------------
Vector CPropJeepEpisodic::PhysGunLaunchVelocity( const Vector &forward, float flMass )
{
// Disallow
if ( PassengerInTransition() )
return vec3_origin;
return Vector( 0, 0, 500 );
}
//-----------------------------------------------------------------------------
// Purpose: Rolls the vehicle when its trying to upright itself from a punt
//-----------------------------------------------------------------------------
AngularImpulse CPropJeepEpisodic::PhysGunLaunchAngularImpulse( void )
{
// Disallow
if ( PassengerInTransition() )
return Vector( 0, 0, 0 );
// Roll!
return Vector( 0, 300, 0 );
}
//-----------------------------------------------------------------------------
// Purpose: Get the upright strength based on what state we're in
//-----------------------------------------------------------------------------
float CPropJeepEpisodic::GetUprightStrength( void )
{
// Lesser if overturned
if ( IsOverturned() )
return 16.0f;
// Strong if upright already (prevents tipping)
return 64.0f;
}

View File

@@ -1,59 +0,0 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef VEHICLE_JEEP_EPISODIC_H
#define VEHICLE_JEEP_EPISODIC_H
#ifdef _WIN32
#pragma once
#endif
#include "vehicle_jeep.h"
#include "ai_basenpc.h"
//=============================================================================
// Episodic jeep
class CPropJeepEpisodic : public CPropJeep
{
DECLARE_CLASS( CPropJeepEpisodic, CPropJeep );
public:
CPropJeepEpisodic( void );
virtual void Spawn( void );
virtual void NPC_FinishedEnterVehicle( CAI_BaseNPC *pPassenger, bool bCompanion );
virtual void NPC_FinishedExitVehicle( CAI_BaseNPC *pPassenger, bool bCompanion );
virtual bool NPC_CanEnterVehicle( CAI_BaseNPC *pPassenger, bool bCompanion );
virtual bool NPC_CanExitVehicle( CAI_BaseNPC *pPassenger, bool bCompanion );
DECLARE_DATADESC();
protected:
virtual float GetUprightTime( void ) { return 1.0f; }
virtual float GetUprightStrength( void );
virtual bool ShouldPuntUseLaunchForces( void );
virtual AngularImpulse PhysGunLaunchAngularImpulse( void );
virtual Vector PhysGunLaunchVelocity( const Vector &forward, float flMass );
bool PassengerInTransition( void );
private:
void InputLockEntrance( inputdata_t &data );
void InputUnlockEntrance( inputdata_t &data );
void InputLockExit( inputdata_t &data );
void InputUnlockExit( inputdata_t &data );
bool m_bEntranceLocked;
bool m_bExitLocked;
COutputEvent m_OnCompanionEnteredVehicle; // Passenger has completed entering the vehicle
COutputEvent m_OnCompanionExitedVehicle; // Passenger has completed exited the vehicle
COutputEvent m_OnHostileEnteredVehicle; // Passenger has completed entering the vehicle
COutputEvent m_OnHostileExitedVehicle; // Passenger has completed exited the vehicle
};
#endif // VEHICLE_JEEP_EPISODIC_H

View File

@@ -1,20 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef FOGCONTROLLER_H
#define FOGCONTROLLER_H
#ifdef _WIN32
#pragma once
#endif
#include "playernet_vars.h"
bool GetWorldFogParams( fogparams_t &fog );
#endif // FOGCONTROLLER_H

View File

@@ -1,170 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "grenade_spit.h"
#include "soundent.h"
#include "decals.h"
#include "smoke_trail.h"
#include "hl2_shareddefs.h"
#include "vstdlib/random.h"
#include "engine/IEngineSound.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
ConVar sk_dmg_spit_grenade ( "sk_dmg_spit_grenade","0");
ConVar sk_spit_grenade_radius ( "sk_spit_grenade_radius","0");
BEGIN_DATADESC( CGrenadeSpit )
DEFINE_FIELD( m_nSquidSpitSprite, FIELD_INTEGER ),
DEFINE_FIELD( m_fSpitDeathTime, FIELD_FLOAT ),
// Function pointers
DEFINE_FUNCTION( SpitThink ),
DEFINE_FUNCTION( GrenadeSpitTouch ),
END_DATADESC()
LINK_ENTITY_TO_CLASS( grenade_spit, CGrenadeSpit );
void CGrenadeSpit::Spawn( void )
{
Precache( );
SetSolid( SOLID_BBOX );
SetMoveType( MOVETYPE_FLYGRAVITY );
// FIXME, if these is a sprite, then we need a base class derived from CSprite rather than
// CBaseAnimating. pev->scale becomes m_flSpriteScale in that case.
SetModel( "models/spitball_large.mdl" );
UTIL_SetSize(this, Vector(0, 0, 0), Vector(0, 0, 0));
m_nRenderMode = kRenderTransAdd;
SetRenderColor( 255, 255, 255, 255 );
m_nRenderFX = kRenderFxNone;
SetThink( SpitThink );
SetUse( DetonateUse );
SetTouch( GrenadeSpitTouch );
SetNextThink( gpGlobals->curtime + 0.1f );
m_flDamage = sk_dmg_spit_grenade.GetFloat();
m_DmgRadius = sk_spit_grenade_radius.GetFloat();
m_takedamage = DAMAGE_YES;
m_iHealth = 1;
SetGravity( UTIL_ScaleForGravity( SPIT_GRAVITY ) );
SetFriction( 0.8 );
SetSequence( 1 );
SetCollisionGroup( HL2COLLISION_GROUP_SPIT );
}
void CGrenadeSpit::SetSpitSize(int nSize)
{
switch (nSize)
{
case SPIT_LARGE:
{
SetModel( "models/spitball_large.mdl" );
break;
}
case SPIT_MEDIUM:
{
SetModel( "models/spitball_medium.mdl" );
break;
}
case SPIT_SMALL:
{
SetModel( "models/spitball_small.mdl" );
break;
}
}
}
void CGrenadeSpit::Event_Killed( const CTakeDamageInfo &info )
{
Detonate( );
}
void CGrenadeSpit::GrenadeSpitTouch( CBaseEntity *pOther )
{
if (m_fSpitDeathTime != 0)
{
return;
}
if ( pOther->GetCollisionGroup() == HL2COLLISION_GROUP_SPIT)
{
return;
}
if ( !pOther->m_takedamage )
{
// make a splat on the wall
trace_t tr;
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + GetAbsVelocity() * 10, MASK_SOLID, this, COLLISION_GROUP_NONE, &tr );
UTIL_DecalTrace(&tr, "BeerSplash" );
// make some flecks
// CPVSFilter filter( tr.endpos );
//te->SpriteSpray( filter, 0.0,
// tr.endpos, tr.plane.normal, m_nSquidSpitSprite, 30, 0.8, 5 );
}
else
{
RadiusDamage ( CTakeDamageInfo( this, GetThrower(), m_flDamage, DMG_BLAST ), GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL );
}
Detonate();
}
void CGrenadeSpit::SpitThink( void )
{
if (m_fSpitDeathTime != 0 &&
m_fSpitDeathTime < gpGlobals->curtime)
{
UTIL_Remove( this );
}
SetNextThink( gpGlobals->curtime + 0.1f );
}
void CGrenadeSpit::Detonate(void)
{
m_takedamage = DAMAGE_NO;
int iPitch;
// splat sound
iPitch = random->RandomFloat( 90, 110 );
EmitSound( "GrenadeSpit.Acid" );
EmitSound( "GrenadeSpit.Hit" );
UTIL_Remove( this );
}
void CGrenadeSpit::Precache( void )
{
m_nSquidSpitSprite = PrecacheModel("sprites/greenglow1.vmt");// client side spittle.
PrecacheModel("models/spitball_large.mdl");
PrecacheModel("models/spitball_medium.mdl");
PrecacheModel("models/spitball_small.mdl");
PrecacheScriptSound( "GrenadeSpit.Acid" );
PrecacheScriptSound( "GrenadeSpit.Hit" );
}
CGrenadeSpit::CGrenadeSpit(void)
{
}

View File

@@ -1,81 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "player_command.h"
#include "player.h"
#include "igamemovement.h"
#include "hl_movedata.h"
#include "ipredictionsystem.h"
#include "iservervehicle.h"
#include "hl2_player.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
class CHLPlayerMove : public CPlayerMove
{
DECLARE_CLASS( CHLPlayerMove, CPlayerMove );
public:
void SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move );
void FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *move );
};
//
//
// PlayerMove Interface
static CHLPlayerMove g_PlayerMove;
//-----------------------------------------------------------------------------
// Singleton accessor
//-----------------------------------------------------------------------------
CPlayerMove *PlayerMove()
{
return &g_PlayerMove;
}
//
static CHLMoveData g_HLMoveData;
CMoveData *g_pMoveData = &g_HLMoveData;
IPredictionSystem *IPredictionSystem::g_pPredictionSystems = NULL;
void CHLPlayerMove::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move )
{
// Call the default SetupMove code.
BaseClass::SetupMove( player, ucmd, pHelper, move );
// Convert to HL2 data.
CHL2_Player *pHLPlayer = static_cast<CHL2_Player*>( player );
Assert( pHLPlayer );
CHLMoveData *pHLMove = static_cast<CHLMoveData*>( move );
Assert( pHLMove );
player->m_flForwardMove = ucmd->forwardmove;
player->m_flSideMove = ucmd->sidemove;
pHLMove->m_bIsSprinting = pHLPlayer->IsSprinting();
IServerVehicle *pVehicle = player->GetVehicle();
if (pVehicle && gpGlobals->frametime != 0)
{
pVehicle->SetupMove( player, ucmd, pHelper, move );
}
}
void CHLPlayerMove::FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *move )
{
// Call the default FinishMove code.
BaseClass::FinishMove( player, ucmd, move );
IServerVehicle *pVehicle = player->GetVehicle();
if (pVehicle && gpGlobals->frametime != 0)
{
pVehicle->FinishMove( player, ucmd, move );
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,295 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef NPC_COMBINE_H
#define NPC_COMBINE_H
#ifdef _WIN32
#pragma once
#endif
#include "ai_basenpc.h"
#include "ai_basehumanoid.h"
#include "ai_behavior.h"
#include "ai_behavior_assault.h"
#include "ai_behavior_standoff.h"
#include "ai_behavior_follow.h"
#include "ai_behavior_functank.h"
#include "ai_behavior_rappel.h"
#include "ai_behavior_actbusy.h"
#include "ai_sentence.h"
#include "ai_baseactor.h"
// Used when only what combine to react to what the spotlight sees
#define SF_COMBINE_NO_LOOK (1 << 16)
#define SF_COMBINE_NO_GRENADEDROP ( 1 << 17 )
#define SF_COMBINE_NO_AR2DROP ( 1 << 18 )
//=========================================================
// >> CNPC_Combine
//=========================================================
class CNPC_Combine : public CAI_BaseActor
{
DECLARE_DATADESC();
DEFINE_CUSTOM_AI;
DECLARE_CLASS( CNPC_Combine, CAI_BaseActor );
public:
CNPC_Combine();
// Create components
virtual bool CreateComponents();
bool CanThrowGrenade( const Vector &vecTarget );
bool CheckCanThrowGrenade( const Vector &vecTarget );
virtual bool CanGrenadeEnemy( bool bUseFreeKnowledge = true );
virtual bool CanAltFireEnemy( bool bUseFreeKnowledge );
int GetGrenadeConditions( float flDot, float flDist );
int RangeAttack2Conditions( float flDot, float flDist ); // For innate grenade attack
int MeleeAttack1Conditions( float flDot, float flDist ); // For kick/punch
bool FVisible( CBaseEntity *pEntity, int traceMask = MASK_OPAQUE, CBaseEntity **ppBlocker = NULL );
virtual bool IsCurTaskContinuousMove();
virtual float GetJumpGravity() const { return 1.8f; }
virtual Vector GetCrouchEyeOffset( void );
void Event_Killed( const CTakeDamageInfo &info );
void SetActivity( Activity NewActivity );
NPC_STATE SelectIdealState ( void );
// Input handlers.
void InputLookOn( inputdata_t &inputdata );
void InputLookOff( inputdata_t &inputdata );
void InputStartPatrolling( inputdata_t &inputdata );
void InputStopPatrolling( inputdata_t &inputdata );
void InputAssault( inputdata_t &inputdata );
void InputHitByBugbait( inputdata_t &inputdata );
void InputThrowGrenadeAtTarget( inputdata_t &inputdata );
bool UpdateEnemyMemory( CBaseEntity *pEnemy, const Vector &position, CBaseEntity *pInformer = NULL );
void Spawn( void );
void Precache( void );
void Activate();
Class_T Classify( void );
bool IsElite() { return m_fIsElite; }
void DelayAltFireAttack( float flDelay );
void DelaySquadAltFireAttack( float flDelay );
float MaxYawSpeed( void );
bool ShouldMoveAndShoot();
bool OverrideMoveFacing( const AILocalMoveGoal_t &move, float flInterval );;
void HandleAnimEvent( animevent_t *pEvent );
Vector Weapon_ShootPosition( );
Vector EyeOffset( Activity nActivity );
Vector EyePosition( void );
Vector BodyTarget( const Vector &posSrc, bool bNoisy = true );
Vector GetAltFireTarget();
void StartTask( const Task_t *pTask );
void RunTask( const Task_t *pTask );
void PostNPCInit();
void GatherConditions();
virtual void PrescheduleThink();
Activity NPC_TranslateActivity( Activity eNewActivity );
void BuildScheduleTestBits( void );
virtual int SelectSchedule( void );
int SelectScheduleAttack();
bool CreateBehaviors();
bool OnBeginMoveAndShoot();
void OnEndMoveAndShoot();
// Combat
WeaponProficiency_t CalcWeaponProficiency( CBaseCombatWeapon *pWeapon );
bool HasShotgun();
bool ActiveWeaponIsFullyLoaded();
bool HandleInteraction(int interactionType, void *data, CBaseCombatCharacter *sourceEnt);
const char* GetSquadSlotDebugName( int iSquadSlot );
bool IsUsingTacticalVariant( int variant ) { return m_iTacticalVariant == variant; }
bool IsUsingPathfindingVariant( int variant ) { return m_iPathfindingVariant == variant; }
bool IsRunningApproachEnemySchedule();
// -------------
// Sounds
// -------------
void DeathSound( void );
void PainSound( void );
void IdleSound( void );
void AlertSound( void );
void LostEnemySound( void );
void FoundEnemySound( void );
void AnnounceAssault( void );
void AnnounceEnemyType( CBaseEntity *pEnemy );
void AnnounceEnemyKill( CBaseEntity *pEnemy );
void NotifyDeadFriend( CBaseEntity* pFriend );
virtual float HearingSensitivity( void ) { return 1.0; };
int GetSoundInterests( void );
virtual bool QueryHearSound( CSound *pSound );
// Speaking
void SpeakSentence( int sentType );
virtual int TranslateSchedule( int scheduleType );
void OnStartSchedule( int scheduleType );
virtual bool ShouldPickADeathPose( void );
protected:
void SetKickDamage( int nDamage ) { m_nKickDamage = nDamage; }
CAI_Sentence< CNPC_Combine > *GetSentences() { return &m_Sentences; }
private:
//=========================================================
// Combine S schedules
//=========================================================
enum
{
SCHED_COMBINE_SUPPRESS = BaseClass::NEXT_SCHEDULE,
SCHED_COMBINE_COMBAT_FAIL,
SCHED_COMBINE_VICTORY_DANCE,
SCHED_COMBINE_COMBAT_FACE,
SCHED_COMBINE_HIDE_AND_RELOAD,
SCHED_COMBINE_SIGNAL_SUPPRESS,
SCHED_COMBINE_ENTER_OVERWATCH,
SCHED_COMBINE_OVERWATCH,
SCHED_COMBINE_ASSAULT,
SCHED_COMBINE_ESTABLISH_LINE_OF_FIRE,
SCHED_COMBINE_PRESS_ATTACK,
SCHED_COMBINE_WAIT_IN_COVER,
SCHED_COMBINE_RANGE_ATTACK1,
SCHED_COMBINE_RANGE_ATTACK2,
SCHED_COMBINE_TAKE_COVER1,
SCHED_COMBINE_TAKE_COVER_FROM_BEST_SOUND,
SCHED_COMBINE_RUN_AWAY_FROM_BEST_SOUND,
SCHED_COMBINE_GRENADE_COVER1,
SCHED_COMBINE_TOSS_GRENADE_COVER1,
SCHED_COMBINE_TAKECOVER_FAILED,
SCHED_COMBINE_GRENADE_AND_RELOAD,
SCHED_COMBINE_PATROL,
SCHED_COMBINE_BUGBAIT_DISTRACTION,
SCHED_COMBINE_CHARGE_TURRET,
SCHED_COMBINE_DROP_GRENADE,
SCHED_COMBINE_CHARGE_PLAYER,
SCHED_COMBINE_PATROL_ENEMY,
SCHED_COMBINE_BURNING_STAND,
SCHED_COMBINE_AR2_ALTFIRE,
SCHED_COMBINE_FORCED_GRENADE_THROW,
SCHED_COMBINE_MOVE_TO_FORCED_GREN_LOS,
SCHED_COMBINE_FACE_IDEAL_YAW,
NEXT_SCHEDULE,
};
//=========================================================
// Combine Tasks
//=========================================================
enum
{
TASK_COMBINE_FACE_TOSS_DIR = BaseClass::NEXT_TASK,
TASK_COMBINE_IGNORE_ATTACKS,
TASK_COMBINE_SIGNAL_BEST_SOUND,
TASK_COMBINE_DEFER_SQUAD_GRENADES,
TASK_COMBINE_CHASE_ENEMY_CONTINUOUSLY,
TASK_COMBINE_DIE_INSTANTLY,
TASK_COMBINE_PLAY_SEQUENCE_FACE_ALTFIRE_TARGET,
TASK_COMBINE_GET_PATH_TO_FORCED_GREN_LOS,
TASK_COMBINE_SET_STANDING,
NEXT_TASK
};
//=========================================================
// Combine Conditions
//=========================================================
enum Combine_Conds
{
COND_COMBINE_NO_FIRE = BaseClass::NEXT_CONDITION,
COND_COMBINE_DEAD_FRIEND,
COND_COMBINE_SHOULD_PATROL,
COND_COMBINE_HIT_BY_BUGBAIT,
COND_COMBINE_DROP_GRENADE,
COND_COMBINE_ON_FIRE,
COND_COMBINE_ATTACK_SLOT_AVAILABLE,
NEXT_CONDITION
};
private:
// Select the combat schedule
int SelectCombatSchedule();
// Should we charge the player?
bool ShouldChargePlayer();
// Chase the enemy, updating the target position as the player moves
void StartTaskChaseEnemyContinuously( const Task_t *pTask );
void RunTaskChaseEnemyContinuously( const Task_t *pTask );
class CCombineStandoffBehavior : public CAI_ComponentWithOuter<CNPC_Combine, CAI_StandoffBehavior>
{
typedef CAI_ComponentWithOuter<CNPC_Combine, CAI_StandoffBehavior> BaseClass;
virtual int SelectScheduleAttack()
{
int result = GetOuter()->SelectScheduleAttack();
if ( result == SCHED_NONE )
result = BaseClass::SelectScheduleAttack();
return result;
}
};
// Rappel
virtual bool IsWaitingToRappel( void ) { return m_RappelBehavior.IsWaitingToRappel(); }
void BeginRappel() { m_RappelBehavior.BeginRappel(); }
private:
int m_nKickDamage;
Vector m_vecTossVelocity;
EHANDLE m_hForcedGrenadeTarget;
bool m_bShouldPatrol;
bool m_bFirstEncounter;// only put on the handsign show in the squad's first encounter.
// Time Variables
float m_flNextPainSoundTime;
float m_flNextAlertSoundTime;
float m_flNextGrenadeCheck;
float m_flNextLostSoundTime;
float m_flAlertPatrolTime; // When to stop doing alert patrol
float m_flNextAltFireTime; // Elites only. Next time to begin considering alt-fire attack.
int m_nShots;
float m_flShotDelay;
float m_flStopMoveShootTime;
CAI_Sentence< CNPC_Combine > m_Sentences;
int m_iNumGrenades;
CAI_AssaultBehavior m_AssaultBehavior;
CCombineStandoffBehavior m_StandoffBehavior;
CAI_FollowBehavior m_FollowBehavior;
CAI_FuncTankBehavior m_FuncTankBehavior;
CAI_RappelBehavior m_RappelBehavior;
CAI_ActBusyBehavior m_ActBusyBehavior;
public:
int m_iLastAnimEventHandled;
bool m_fIsElite;
Vector m_vecAltFireTarget;
int m_iTacticalVariant;
int m_iPathfindingVariant;
};
#endif // NPC_COMBINE_H

File diff suppressed because it is too large Load Diff

View File

@@ -1,221 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: This is the base version of the vortigaunt
//
// $NoKeywords: $
//=============================================================================//
#ifndef NPC_VORTIGAUNT_H
#define NPC_VORTIGAUNT_H
#ifdef _WIN32
#pragma once
#endif
#include "ai_basenpc.h"
#include "ai_behavior.h"
#include "ai_behavior_lead.h"
#include "ai_behavior_standoff.h"
#include "ai_behavior_assault.h"
#define VORTIGAUNT_MAX_BEAMS 8
class CBeam;
class CSprite;
//=========================================================
// >> CNPC_Vortigaunt
//=========================================================
class CNPC_Vortigaunt : public CNPCSimpleTalker
{
DECLARE_CLASS( CNPC_Vortigaunt, CNPCSimpleTalker );
public:
void Spawn( void );
void Precache( void );
float MaxYawSpeed( void );
int GetSoundInterests( void );
void PrescheduleThink( void );
void BuildScheduleTestBits( void );
int RangeAttack1Conditions( float flDot, float flDist );
int MeleeAttack1Conditions( float flDot, float flDist );
CBaseEntity* Kick( void );
void Claw( int iAttachment );
Vector GetShootEnemyDir( const Vector &shootOrigin, bool bNoisy = true );
virtual void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void AlertSound( void );
Class_T Classify ( void );
void HandleAnimEvent( animevent_t *pEvent );
bool HandleInteraction(int interactionType, void *data, CBaseCombatCharacter* sourceEnt);
Activity NPC_TranslateActivity( Activity eNewActivity );
void UpdateOnRemove( void );
void Event_Killed( const CTakeDamageInfo &info );
bool ShouldGoToIdleState( void );
void RunTask( const Task_t *pTask );
void StartTask( const Task_t *pTask );
int ObjectCaps( void ) { return UsableNPCObjectCaps( BaseClass::ObjectCaps() ); }
int OnTakeDamage_Alive( const CTakeDamageInfo &info );
// Navigation/Locomotion
bool OnObstructionPreSteer( AILocalMoveGoal_t *pMoveGoal, float distClear, AIMoveResult_t *pResult );
void DeclineFollowing( void );
bool CanBeUsedAsAFriend( void );
bool IsPlayerAlly( void ) { return true; }
// Override these to set behavior
virtual int TranslateSchedule( int scheduleType );
virtual int SelectSchedule( void );
bool IsValidEnemy( CBaseEntity *pEnemy );
bool IsLeading( void ) { return ( GetRunningBehavior() == &m_LeadBehavior && m_LeadBehavior.HasGoal() ); }
void DeathSound( const CTakeDamageInfo &info );
void PainSound( const CTakeDamageInfo &info );
void TalkInit( void );
void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr );
void SpeakSentence( int sentType );
void VortigauntThink( void );
bool CreateBehaviors( void );
bool ShouldHealTarget( void );
int SelectHealSchedule( void );
void InputEnableArmorRecharge( inputdata_t &data );
void InputDisableArmorRecharge( inputdata_t &data );
void InputExtractBugbait( inputdata_t &data );
void InputChargeTarget( inputdata_t &data );
private:
//=========================================================
// Vortigaunt schedules
//=========================================================
enum
{
SCHED_VORTIGAUNT_STAND = BaseClass::NEXT_SCHEDULE,
SCHED_VORTIGAUNT_RANGE_ATTACK,
SCHED_VORTIGAUNT_MELEE_ATTACK,
SCHED_VORTIGAUNT_STOMP_ATTACK,
SCHED_VORTIGAUNT_HEAL,
SCHED_VORTIGAUNT_BARNACLE_HIT,
SCHED_VORTIGAUNT_BARNACLE_PULL,
SCHED_VORTIGAUNT_BARNACLE_CHOMP,
SCHED_VORTIGAUNT_BARNACLE_CHEW,
SCHED_VORTIGAUNT_GRENADE_KILL,
SCHED_VORTIGAUNT_EXTRACT_BUGBAIT,
};
//=========================================================
// Vortigaunt Tasks
//=========================================================
enum
{
TASK_VORTIGAUNT_HEAL_WARMUP = BaseClass::NEXT_TASK,
TASK_VORTIGAUNT_HEAL,
TASK_VORTIGAUNT_FACE_STOMP,
TASK_VORTIGAUNT_STOMP_ATTACK,
TASK_VORTIGAUNT_GRENADE_KILL,
TASK_VORTIGAUNT_ZAP_GRENADE_OWNER,
TASK_VORTIGAUNT_EXTRACT_WARMUP,
TASK_VORTIGAUNT_EXTRACT,
TASK_VORTIGAUNT_EXTRACT_COOLDOWN,
TASK_VORTIGAUNT_FIRE_EXTRACT_OUTPUT,
TASK_VORTIGAUNT_WAIT_FOR_PLAYER,
TASK_VORTIGAUNT_GET_HEAL_TARGET,
};
//=========================================================
// Vortigaunt Conditions
//=========================================================
enum
{
COND_VORTIGAUNT_CAN_HEAL = BaseClass::NEXT_CONDITION,
};
float m_flNextNPCThink;
// ------------
// Beams
// ------------
void ClearBeams( );
void ArmBeam( int side , int beamType);
void WackBeam( int side, CBaseEntity *pEntity );
void ZapBeam( int side );
void BeamGlow( void );
void ClawBeam( CBaseEntity* pHurt, int nNoise, int iAttachment );
void DefendBeams( void );
CHandle<CBeam> m_pBeam[VORTIGAUNT_MAX_BEAMS];
int m_iBeams;
int m_nLightningSprite;
// ---------------
// Glow
// ----------------
void ClearHandGlow( );
float m_fGlowAge;
float m_fGlowScale;
float m_fGlowChangeTime;
bool m_bGlowTurningOn;
int m_nCurGlowIndex;
CHandle<CSprite> m_pLeftHandGlow;
CHandle<CSprite> m_pRightHandGlow;
void StartHandGlow( int beamType );
void EndHandGlow( void );
// ----------------
// Healing
// ----------------
float m_flNextHealTime; // Next time allowed to heal player
int m_nCurrentHealAmt; // How much healed this session
int m_nLastArmorAmt; // Player armor at end of last heal
int m_iSuitSound; // 0 = off, 1 = startup, 2 = going
float m_flSuitSoundTime;
EHANDLE m_hHealTarget; // The person that I'm going to heal.
void HealBeam( int side );
bool IsHealPositionValid( void );
bool CheckHealPosition( void );
// -----------------
// Stomping
// -----------------
bool IsStompable(CBaseEntity *pEntity);
float m_painTime;
float m_nextLineFireTime;
bool m_bInBarnacleMouth;
bool m_bArmorRechargeEnabled;
bool m_bForceArmorRecharge;
int m_iCurrentRechargeGoal;
EHANDLE m_hVictim; // Who I'm actively attacking (as opposed to enemy that I'm not necessarily attacking)
bool m_bExtractingBugbait;
COutputEvent m_OnFinishedExtractingBugbait;
COutputEvent m_OnFinishedChargingTarget;
COutputEvent m_OnPlayerUse;
CAI_AssaultBehavior m_AssaultBehavior;
CAI_LeadBehavior m_LeadBehavior;
//Adrian: Let's do it the right way!
int m_iLeftHandAttachment;
int m_iRightHandAttachment;
bool m_bStopLoopingSounds;
public:
DECLARE_DATADESC();
DEFINE_CUSTOM_AI;
};
#endif // NPC_VORTIGAUNT_H

File diff suppressed because it is too large Load Diff

View File

@@ -1,219 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: This is the base version of the vortigaunt
//
//=============================================================================//
#ifndef NPC_VORTIGAUNT_H
#define NPC_VORTIGAUNT_H
#ifdef _WIN32
#pragma once
#endif
#include "ai_basenpc.h"
#include "ai_behavior.h"
#include "ai_behavior_lead.h"
#include "ai_behavior_standoff.h"
#include "ai_behavior_assault.h"
#include "npc_playercompanion.h"
#define VORTIGAUNT_MAX_BEAMS 8
class CBeam;
class CSprite;
enum VortigauntHealState_t
{
HEAL_STATE_NONE,
HEAL_STATE_WARMUP,
HEAL_STATE_HEALING,
HEAL_STATE_COOLDOWN,
};
//=========================================================
// >> CNPC_Vortigaunt
//=========================================================
class CNPC_Vortigaunt : public CNPC_PlayerCompanion
{
DECLARE_CLASS( CNPC_Vortigaunt, CNPC_PlayerCompanion );
public:
virtual void Spawn( void );
virtual void Precache( void );
virtual float MaxYawSpeed( void );
virtual void PrescheduleThink( void );
virtual void BuildScheduleTestBits( void );
virtual int RangeAttack1Conditions( float flDot, float flDist );
virtual void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
virtual void AlertSound( void );
virtual Class_T Classify ( void ) { return CLASS_VORTIGAUNT; }
virtual void HandleAnimEvent( animevent_t *pEvent );
virtual Activity NPC_TranslateActivity( Activity eNewActivity );
virtual void UpdateOnRemove( void );
virtual void Event_Killed( const CTakeDamageInfo &info );
virtual void GatherConditions( void );
virtual void RunTask( const Task_t *pTask );
virtual void StartTask( const Task_t *pTask );
// Navigation/Locomotion
virtual bool OnObstructionPreSteer( AILocalMoveGoal_t *pMoveGoal, float distClear, AIMoveResult_t *pResult );
virtual void DeclineFollowing( void );
virtual bool CanBeUsedAsAFriend( void );
virtual bool IsPlayerAlly( void ) { return true; }
// Override these to set behavior
virtual int TranslateSchedule( int scheduleType );
virtual int SelectSchedule( void );
virtual bool IsValidEnemy( CBaseEntity *pEnemy );
bool IsLeading( void ) { return ( GetRunningBehavior() == &m_LeadBehavior && m_LeadBehavior.HasGoal() ); }
void DeathSound( const CTakeDamageInfo &info );
void PainSound( const CTakeDamageInfo &info );
virtual void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr );
virtual void SpeakSentence( int sentType );
virtual int IRelationPriority( CBaseEntity *pTarget );
virtual bool IsReadinessCapable( void ) { return true; }
virtual float GetReadinessDecay() { return 30.0f; }
virtual bool ShouldRegenerateHealth( void ) { return m_bRegenerateHealth; }
void InputEnableArmorRecharge( inputdata_t &data );
void InputDisableArmorRecharge( inputdata_t &data );
void InputExtractBugbait( inputdata_t &data );
void InputChargeTarget( inputdata_t &data );
// Health regeneration
void InputEnableHealthRegeneration( inputdata_t &data );
void InputDisableHealthRegeneration( inputdata_t &data );
private:
bool HealGestureHasLOS( void );
bool PlayerBelowHealthPercentage( float flPerc );
void StartHealing( void );
void StopHealing( bool bInterrupt = false );
void MaintainHealSchedule( void );
bool ShouldHealTarget( CBaseEntity *pTarget, bool bResetTimer );
int SelectHealSchedule( void );
Vector GetShootEnemyDir( const Vector &shootOrigin, bool bNoisy = true );
void CreateBeamBlast( const Vector &vecOrigin );
private:
//=========================================================
// Vortigaunt schedules
//=========================================================
enum
{
SCHED_VORTIGAUNT_STAND = BaseClass::NEXT_SCHEDULE,
SCHED_VORTIGAUNT_RANGE_ATTACK,
SCHED_VORTIGAUNT_HEAL,
SCHED_VORTIGAUNT_EXTRACT_BUGBAIT,
SCHED_VORTIGAUNT_FACE_PLAYER,
SCHED_VORTIGAUNT_RUN_TO_PLAYER,
};
//=========================================================
// Vortigaunt Tasks
//=========================================================
enum
{
TASK_VORTIGAUNT_HEAL_WARMUP = BaseClass::NEXT_TASK,
TASK_VORTIGAUNT_HEAL,
TASK_VORTIGAUNT_EXTRACT_WARMUP,
TASK_VORTIGAUNT_EXTRACT,
TASK_VORTIGAUNT_EXTRACT_COOLDOWN,
TASK_VORTIGAUNT_FIRE_EXTRACT_OUTPUT,
TASK_VORTIGAUNT_WAIT_FOR_PLAYER,
TASK_VORTIGAUNT_GET_HEAL_TARGET,
};
//=========================================================
// Vortigaunt Conditions
//=========================================================
enum
{
COND_VORTIGAUNT_CAN_HEAL = BaseClass::NEXT_CONDITION,
COND_VORTIGAUNT_HEAL_TARGET_TOO_FAR, // Outside or heal range
COND_VORTIGAUNT_HEAL_TARGET_BLOCKED, // Blocked by an obstruction
COND_VORTIGAUNT_HEAL_TARGET_BEHIND_US, // Not within our "forward" range
COND_VORTIGAUNT_HEAL_VALID, // All conditions satisfied
};
// ------------
// Beams
// ------------
void ClearBeams( void );
void ArmBeam( int side , int beamType);
void ZapBeam( int side );
void BeamGlow( void );
CHandle<CBeam> m_pBeam[VORTIGAUNT_MAX_BEAMS];
int m_iBeams;
int m_nLightningSprite;
bool m_bHealBeamActive;
// ---------------
// Glow
// ----------------
void ClearHandGlow( void );
float m_fGlowAge;
float m_fGlowScale;
float m_fGlowChangeTime;
bool m_bGlowTurningOn;
int m_nCurGlowIndex;
CHandle<CSprite> m_pLeftHandGlow;
CHandle<CSprite> m_pRightHandGlow;
void StartHandGlow( int beamType );
void EndHandGlow( void );
// ----------------
// Healing
// ----------------
bool m_bRegenerateHealth;
float m_flNextHealTime; // Next time allowed to heal player
int m_nCurrentHealAmt; // How much healed this session
int m_nLastArmorAmt; // Player armor at end of last heal
int m_iSuitSound; // 0 = off, 1 = startup, 2 = going
float m_flSuitSoundTime;
EHANDLE m_hHealTarget; // The person that I'm going to heal.
VortigauntHealState_t m_eHealState;
void GatherHealConditions( void );
void HealBeam( int side );
float m_flHealHinderedTime;
float m_flPainTime;
float m_nextLineFireTime;
bool m_bArmorRechargeEnabled;
bool m_bForceArmorRecharge;
int m_iCurrentRechargeGoal;
bool m_bExtractingBugbait;
COutputEvent m_OnFinishedExtractingBugbait;
COutputEvent m_OnFinishedChargingTarget;
COutputEvent m_OnPlayerUse;
CAI_AssaultBehavior m_AssaultBehavior;
CAI_LeadBehavior m_LeadBehavior;
//Adrian: Let's do it the right way!
int m_iLeftHandAttachment;
int m_iRightHandAttachment;
bool m_bStopLoopingSounds;
public:
DECLARE_DATADESC();
DEFINE_CUSTOM_AI;
};
#endif // NPC_VORTIGAUNT_H

View File

@@ -1,266 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "player_control.h"
#include "soundent.h"
#include "func_break.h" // For materials
#include "hl2_player.h"
#include "ai_hull.h"
#include "decals.h"
#include "shake.h"
#include "ndebugoverlay.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
BEGIN_DATADESC( CPlayer_Control )
DEFINE_FIELD( m_bActive, FIELD_BOOLEAN ),
DEFINE_FIELD( m_nSaveFOV, FIELD_INTEGER ),
DEFINE_FIELD( m_vSaveOrigin, FIELD_POSITION_VECTOR ),
DEFINE_FIELD( m_vSaveAngles, FIELD_VECTOR ),
DEFINE_FIELD( m_nSaveMoveType, FIELD_INTEGER ),
DEFINE_FIELD( m_nSaveMoveCollide, FIELD_INTEGER ),
DEFINE_FIELD( m_vSaveViewOffset, FIELD_VECTOR ),
DEFINE_FIELD( m_pSaveWeapon, FIELD_CLASSPTR ),
DEFINE_FIELD( m_nPClipTraceDir, FIELD_INTEGER),
DEFINE_FIELD( m_flCurrMinClipDist, FIELD_FLOAT),
DEFINE_FIELD( m_flLastMinClipDist, FIELD_FLOAT),
// Inputs
DEFINE_INPUTFUNC( FIELD_VOID, "Activate", InputActivate ),
DEFINE_INPUTFUNC( FIELD_VOID, "Deactivate", InputDeactivate ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetThrust", InputSetThrust ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetSideThrust", InputSetSideThrust ),
END_DATADESC()
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPlayer_Control::Precache( void )
{
return;
}
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPlayer_Control::Spawn( void )
{
Precache();
SetFriction( 0.55 ); // deading the bounce a bit
m_bActive = false;
CreateVPhysics();
}
//-----------------------------------------------------------------------------
bool CPlayer_Control::CreateVPhysics( void )
{
// Create the object in the physics system
VPhysicsInitNormal( SOLID_BBOX, 0, false );
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPlayer_Control::ControlActivate( void )
{
m_bActive = true;
AddEffects( EF_NODRAW );
m_nPClipTraceDir = PC_TRACE_LAST;
m_flCurrMinClipDist = PCONTROL_CLIP_DIST;
SetNextThink( gpGlobals->curtime );
CHL2_Player* pPlayer = (CHL2_Player*)UTIL_GetLocalPlayer();
Assert( pPlayer );
// Save Data
m_nSaveFOV = pPlayer->GetFOV();
m_vSaveOrigin = pPlayer->GetLocalOrigin();
m_vSaveAngles = pPlayer->pl.v_angle;
m_nSaveMoveType = pPlayer->GetMoveType();
m_nSaveMoveCollide = pPlayer->GetMoveCollide();
m_vSaveViewOffset = pPlayer->GetViewOffset();
m_pSaveWeapon = pPlayer->GetActiveWeapon();
pPlayer->AddSolidFlags( FSOLID_NOT_SOLID );
pPlayer->SetLocalOrigin( GetLocalOrigin() );
pPlayer->pl.v_angle = GetLocalAngles();
pPlayer->SetViewOffset( vec3_origin );
DispatchUpdateTransmitState();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPlayer_Control::ControlDeactivate( void )
{
m_bActive = false;
RemoveEffects( EF_NODRAW );
SetThink(NULL);
SetTouch(NULL);
CHL2_Player* pPlayer = (CHL2_Player*)UTIL_GetLocalPlayer();
Assert( pPlayer );
// Restore Data
pPlayer->SetFOV( this, m_nSaveFOV );
pPlayer->RemoveSolidFlags( FSOLID_NOT_SOLID );
pPlayer->SetLocalOrigin( m_vSaveOrigin );
pPlayer->SetLocalAngles( m_vSaveAngles ); // Note: Set GetLocalAngles(), not pl->v_angle
pPlayer->SnapEyeAngles( m_vSaveAngles );
pPlayer->StopFollowingEntity();
pPlayer->SetMoveType( m_nSaveMoveType, m_nSaveMoveCollide );
pPlayer->SetViewOffset( m_vSaveViewOffset );
pPlayer->SetControlClass( CLASS_NONE );
DispatchUpdateTransmitState();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPlayer_Control::InputActivate( inputdata_t &inputdata )
{
ControlActivate();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPlayer_Control::InputDeactivate( inputdata_t &inputdata )
{
ControlDeactivate();
}
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPlayer_Control::InputSetThrust( inputdata_t &inputdata )
{
// Should be handles by subclass
return;
}
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPlayer_Control::InputSetSideThrust( inputdata_t &inputdata )
{
// Should be handles by subclass
return;
}
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
float CPlayer_Control::PlayerControlClipDistance(void)
{
// Send out a curb feeler, but not in every direction on every time. Instead
// send out a feeling in one direction each time and keep track of the nearest
// player_control_clip
// Reset if on last trace
if (m_nPClipTraceDir == PC_TRACE_LAST)
{
m_nPClipTraceDir = 0;
m_flLastMinClipDist = m_flCurrMinClipDist;
m_flCurrMinClipDist = PCONTROL_CLIP_DIST;
}
Vector vForward,vRight,vUp;
AngleVectors( GetLocalAngles(), &vForward, &vRight,&vUp);
Vector vTracePos = GetAbsOrigin();
switch (m_nPClipTraceDir)
{
case PC_TRACE_LEFT:
{
vTracePos -= vRight*PCONTROL_CLIP_DIST;
}
case PC_TRACE_RIGHT:
{
vTracePos += vRight*PCONTROL_CLIP_DIST;
}
case PC_TRACE_UP:
{
vTracePos += vUp*PCONTROL_CLIP_DIST;
}
case PC_TRACE_DOWN:
{
vTracePos -= vUp*PCONTROL_CLIP_DIST;
}
case PC_TRACE_FORWARD:
{
vTracePos += 2*vForward*PCONTROL_CLIP_DIST;
}
}
// Trace in a different direction next time
m_nPClipTraceDir++;
trace_t tr;
UTIL_TraceLine(GetAbsOrigin(), vTracePos, CONTENTS_MIST, this, COLLISION_GROUP_NONE, &tr);
if (tr.fraction < 1.0)
{
surfacedata_t* pSurface = physprops->GetSurfaceData( tr.surface.surfaceProps );
char m_chTextureType = pSurface->game.material;
if (m_chTextureType == CHAR_TEX_CLIP)
{
float flClipDist = tr.fraction * (GetAbsOrigin()-vTracePos).Length();
if (flClipDist < m_flCurrMinClipDist)
{
m_flCurrMinClipDist = flClipDist;
}
if (flClipDist < m_flLastMinClipDist)
{
m_flLastMinClipDist = flClipDist;
}
}
}
return m_flLastMinClipDist;
}
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
int CPlayer_Control::UpdateTransmitState()
{
if ( m_bActive )
{
return SetTransmitState( FL_EDICT_ALWAYS );
}
else
{
return BaseClass::UpdateTransmitState();
}
}

View File

@@ -1,68 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef PLAYER_CONTROL_H
#define PLAYER_CONTROL_H
#ifdef _WIN32
#pragma once
#endif
#include "basecombatcharacter.h"
enum PC_TraceDir_t
{
PC_TRACE_LEFT,
PC_TRACE_RIGHT,
PC_TRACE_UP,
PC_TRACE_DOWN,
PC_TRACE_FORWARD,
PC_TRACE_LAST,
};
#define PCONTROL_CLIP_DIST 1600
class CPlayer_Control : public CBaseCombatCharacter
{
public:
DECLARE_CLASS( CPlayer_Control, CBaseCombatCharacter );
void ControlActivate( void );
void ControlDeactivate( void );
void Precache(void);
void Spawn(void);
bool CreateVPhysics( void );
int UpdateTransmitState();
// Inputs
void InputActivate( inputdata_t &inputdata );
void InputDeactivate( inputdata_t &inputdata );
void InputSetThrust( inputdata_t &inputdata );
void InputSetSideThrust( inputdata_t &inputdata );
float PlayerControlClipDistance(void);
bool m_bActive;
// Static
int m_nPClipTraceDir;
float m_flCurrMinClipDist;
float m_flLastMinClipDist;
int m_nSaveFOV;
Vector m_vSaveOrigin;
QAngle m_vSaveAngles;
MoveType_t m_nSaveMoveType;
MoveCollide_t m_nSaveMoveCollide;
Vector m_vSaveViewOffset;
CBaseCombatWeapon* m_pSaveWeapon;
DECLARE_DATADESC();
};
#endif // PLAYER_CONTROL_H

View File

@@ -1,400 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#if 0
#include "ai_basenpc.h"
#include "basecombatweapon.h" // For SpawnBlood
#include "soundent.h"
#include "func_break.h" // For materials
#include "hl2_player.h"
#include "ai_hull.h"
#include "decals.h"
#include "shake.h"
#include "ndebugoverlay.h"
#include "player_control.h"
#include "IEffects.h"
#include "engine/IEngineSound.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define PMANHACK_OFFSET Vector(0,0,-18)
#define PMANHACK_HULL_MINS Vector(-22,-22,-22)
#define PMANHACK_HULL_MAXS Vector(22,22,22)
#define PMANHACK_MAX_SPEED 400
#define PMANHACK_DECAY 6
class CPlayer_Manhack : public CPlayer_Control
{
public:
DECLARE_CLASS( CPlayer_Manhack, CPlayer_Control );
void Precache(void);
void Spawn(void);
bool CreateVPhysics( void );
// Inputs
void InputActivate( inputdata_t &inputdata );
void InputDeactivate( inputdata_t &inputdata );
void InputSetThrust( inputdata_t &inputdata );
void InputSetSideThrust( inputdata_t &inputdata );
void FlyThink(void);
void CheckBladeTrace(trace_t &tr);
DECLARE_DATADESC();
};
BEGIN_DATADESC( CPlayer_Manhack )
// Function Pointers
DEFINE_FUNCTION( FlyThink ),
END_DATADESC()
LINK_ENTITY_TO_CLASS( player_manhack, CPlayer_Manhack );
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CPlayer_Manhack::Precache( void )
{
PrecacheModel("models/manhack.mdl");
PrecacheModel("models/manhack_sphere.mdl");
PrecacheScriptSound( "Player_Manhack.ThrustLow"" );
PrecacheScriptSound( "Player_Manhack.ThrustHigh" );
PrecacheScriptSound( "Player_Manhack.GrindFlesh" );
PrecacheScriptSound( "Player_Manhack.Grind" );
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CPlayer_Manhack::Spawn( void )
{
Precache();
m_flFriction = 0.55; // deading the bounce a bit
SetModel( "models/manhack.mdl" );
UTIL_SetSize(this, PMANHACK_HULL_MINS, PMANHACK_HULL_MAXS);
m_bActive = false;
CreateVPhysics();
}
//-----------------------------------------------------------------------------
bool CPlayer_Manhack::CreateVPhysics( void )
{
// Create the object in the physics system
VPhysicsInitNormal( SOLID_BBOX, 0, false );
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Input handler for turning on the manhack
//-----------------------------------------------------------------------------
void CPlayer_Manhack::InputActivate( inputdata_t &inputdata )
{
BaseClass::InputActivate( inputdata );
SetThink(FlyThink);
// Switch to a bigger model (a sphere) that keeps the player's
// camera outside of walls
VPhysicsDestroyObject();
SetModel("models/manhack_sphere.mdl" );
VPhysicsInitNormal( GetSolid(), GetSolidFlags(), false );
CHL2_Player* pPlayer = (CHL2_Player*)UTIL_GetLocalPlayer();
Assert( pPlayer );
pPlayer->SetFOV( 132 );
pPlayer->FollowEntity( this );
pPlayer->m_nControlClass = CLASS_MANHACK;
pPlayer->GiveNamedItem( "weapon_manhack" );
}
//-----------------------------------------------------------------------------
// Purpose: Input handler for turning off the manhack.
//-----------------------------------------------------------------------------
void CPlayer_Manhack::InputDeactivate( inputdata_t &inputdata )
{
BaseClass::InputDeactivate( inputdata );
CHL2_Player* pPlayer = (CHL2_Player*)UTIL_GetLocalPlayer();
Assert( pPlayer );
StopSound( pPlayer->entindex(), "Player_Manhack.GrindFlesh" );
StopSound( pPlayer->entindex(), "Player_Manhack.Grind");
StopSound( pPlayer->entindex(), "Player_Manhack.ThrustLow" );
StopSound( pPlayer->entindex(), "Player_Manhack.ThrustHigh" );
// Remove manhack blade weapon from player's inventory
CBaseEntity* pBlade = (CBaseEntity*)(pPlayer->GetActiveWeapon());
pPlayer->Weapon_Drop( GetActiveWeapon() );
if (m_pSaveWeapon)
{
pPlayer->Weapon_Switch( m_pSaveWeapon );
}
UTIL_Remove(pBlade);
// Switch back to manhack model
VPhysicsDestroyObject();
SetModel("models/manhack.mdl" );
VPhysicsInitNormal( GetSolid(), GetSolidFlags(), false );
}
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPlayer_Manhack::InputSetThrust( inputdata_t &inputdata )
{
if (!m_bActive)
{
return;
}
CBasePlayer* pPlayer = UTIL_GetLocalPlayer();
Assert( pPlayer );
if (inputdata.value.Float() == 0)
{
CPASAttenuationFilter filter( pPlayer, "Player_Manhack.ThrustLow" );
EmitSound( filter, pPlayer->entindex(), "Player_Manhack.ThrustLow" );
return;
}
CPASAttenuationFilter filter( pPlayer, "Player_Manhack.ThrustHigh" );
EmitSound( filter, pPlayer->entindex(), "Player_Manhack.ThrustHigh" );
Vector vForce;
pPlayer->EyeVectors( &vForce );
vForce = vForce * inputdata.value.Float() * 600;
IPhysicsObject* pPhysObj = VPhysicsGetObject();
pPhysObj->ApplyForceCenter( vForce );
}
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPlayer_Manhack::InputSetSideThrust( inputdata_t &inputdata )
{
if (!m_bActive)
{
return;
}
CBasePlayer* pPlayer = UTIL_GetLocalPlayer();
Assert( pPlayer );
if (inputdata.value.Float() == 0)
{
CPASAttenuationFilter filter( pPlayer, "Player_Manhack.ThrustLow" );
EmitSound( filter, pPlayer->entindex(), "Player_Manhack.ThrustLow" );
return;
}
CPASAttenuationFilter filter( pPlayer, "Player_Manhack.ThrustHigh" );
EmitSound( filter, pPlayer->entindex(), "Player_Manhack.ThrustHigh" );
Vector vForce;
pPlayer->EyeVectors( 0, &vForce, 0 );
vForce = vForce * inputdata.value.Float() * 600;
IPhysicsObject* pPhysObj = VPhysicsGetObject();
pPhysObj->ApplyForceCenter( vForce );
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CPlayer_Manhack::CheckBladeTrace(trace_t &tr)
{
CBaseEntity* pHitEntity = NULL;
CBasePlayer* pPlayer = UTIL_GetLocalPlayer();
Assert( pPlayer );
if (tr.u.ent)
{
pHitEntity = CBaseEntity::Instance( tr.u.ent );
// Did I hit an entity that isn't a player?
if (pHitEntity && pHitEntity->Classify()!=CLASS_PLAYER)
{
CTakeDamageInfo info( this, this, 1, DMG_SLASH );
CalculateMeleeDamageForce( &info, (tr.endpos - tr.endpos), tr.endpos );
pHitEntity->TakeDamage( info );
}
}
if (tr.fraction != 1.0 || tr.startsolid)
{
CBaseCombatCharacter* pBCC = ToBaseCombatCharacter( pHitEntity );
if (pBCC)
{
// Spawn some extra blood in front of player to see
Vector vPlayerFacing;
pPlayer->EyeVectors( &vPlayerFacing );
Vector vBloodPos = pPlayer->Center() + vPlayerFacing*30;
SpawnBlood(vBloodPos, g_vecAttackDir, pBCC->BloodColor(), 1.0);
CPASAttenuationFilter filter( pPlayer, "Player_Manhack.GrindFlesh" );
EmitSound( filter, pPlayer->entindex(), "Player_Manhack.GrindFlesh" );
}
else
{
if (!(m_spawnflags & SF_NPC_GAG))
{
CPASAttenuationFilter filter( pPlayer, "Player_Manhack.Grind" );
EmitSound( filter, pPlayer->entindex(), "Player_Manhack.Grind" );
}
// For decals and sparks we must trace a line in the direction of the surface norm
// that we hit.
Vector vCheck = GetAbsOrigin() - (tr.plane.normal * 24);
UTIL_TraceLine( GetAbsOrigin()+PMANHACK_OFFSET, vCheck+PMANHACK_OFFSET,MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr );
if (tr.fraction != 1.0)
{
g_pEffects->Sparks( tr.endpos );
CBroadcastRecipientFilter filter;
te->DynamicLight( filter, 0.0,
&tr.endpos, 255, 180, 100, 0, 10, 0.1, 0 );
// Leave decal only if colliding horizontally
if ((DotProduct(Vector(0,0,1),tr.plane.normal)<0.5) && (DotProduct(Vector(0,0,-1),tr.plane.normal)<0.5))
{
UTIL_DecalTrace( &tr, "ManhackCut" );
}
}
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Manhack is still dangerous when dead
// Input :
// Output :
//-----------------------------------------------------------------------------
void CPlayer_Manhack::FlyThink()
{
SetNextThink( gpGlobals->curtime );
// Get physics object
IPhysicsObject* pPhysObj = VPhysicsGetObject();
if (!pPhysObj) return;
Vector vPhysPos;
pPhysObj->GetPosition(&vPhysPos,NULL);
// Update the player's origin
CBasePlayer* pPlayer = UTIL_GetLocalPlayer();
Assert( pPlayer );
Vector vPlayerFacing;
pPlayer->EyeVectors( &vPlayerFacing );
UTIL_SetOrigin(pPlayer,vPhysPos);
float flBrightness;
if (random->RandomInt(0,1)==0)
{
flBrightness = 255;
}
else
{
flBrightness = 1;
}
color32 white = {flBrightness,flBrightness,flBrightness,20};
UTIL_ScreenFade( pPlayer, white, 0.01, 0.1, FFADE_MODULATE );
flBrightness = random->RandomInt(0,255);
NDebugOverlay::ScreenText( 0.4, 0.15, "...M A N H A C K A C T I V A T E D...", 255, flBrightness, flBrightness, 255, 0.0);
// ----------------------------------------
// Trace forward to see if I hit anything
// ----------------------------------------
trace_t tr;
Vector vVelocity;
GetVelocity( &vVelocity, NULL );
vVelocity.z = 0;
Vector vCheckPos = GetAbsOrigin() + (vVelocity*gpGlobals->frametime);
// Check in movement direction
UTIL_TraceHull( GetAbsOrigin()+PMANHACK_OFFSET, vCheckPos+PMANHACK_OFFSET,
Vector(-22,-22,-1), Vector(22,22,1),
MASK_SOLID, this, COLLISION_GROUP_NONE, &tr );
CheckBladeTrace(tr);
// Check in facing direction
UTIL_TraceHull( GetAbsOrigin()+PMANHACK_OFFSET, GetAbsOrigin() + vPlayerFacing*14 + PMANHACK_OFFSET,
Vector(-22,-22,-1), Vector(22,22,1),
MASK_SOLID, this, COLLISION_GROUP_NONE, &tr );
CheckBladeTrace(tr);
// ----------
// Add decay
// ----------
Vector vOldVelocity;
pPhysObj->GetVelocity(&vOldVelocity,NULL);
float flDecay = -PMANHACK_DECAY*gpGlobals->frametime;
if (flDecay < -1.0)
{
flDecay = -1.0;
}
pPhysObj->ApplyForceCenter( flDecay*vOldVelocity );
// -----------------------
// Hover noise
// -----------------------
float flNoise1 = 1000*sin(4*gpGlobals->curtime);
float flNoise = 12000+ flNoise1;
Vector vForce = Vector(0,0,flNoise*gpGlobals->frametime);
pPhysObj->ApplyForceCenter( vForce );
// -----------------------
// Limit velocity
// -----------------------
pPhysObj->GetVelocity(&vOldVelocity,NULL);
if (vOldVelocity.Length() > PMANHACK_MAX_SPEED)
{
Vector vNewVelocity = vOldVelocity;
VectorNormalize(vNewVelocity);
vNewVelocity = vNewVelocity *PMANHACK_MAX_SPEED;
Vector vSubtract = vNewVelocity - vOldVelocity;
pPhysObj->AddVelocity(&vSubtract,NULL);
}
}
#endif

View File

@@ -1,543 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "player_control.h"
#include "hl2_player.h"
#include "decals.h"
#include "shake.h"
#include "soundent.h"
#include "ndebugoverlay.h"
#include "smoke_trail.h"
#include "grenade_homer.h"
#include "vstdlib/random.h"
#include "engine/IEngineSound.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define PMISSILE_MISSILE_MODEL "models/weapons/w_missile.mdl"
#define PMISSILE_HULL_MINS Vector(-22,-22,-22)
#define PMISSILE_HULL_MAXS Vector(22,22,22)
#define PMISSILE_SPEED 800
#define PMISSILE_TURN_RATE 100
#define PMISSILE_DIE_TIME 2
#define PMISSILE_TRAIL_LIFE 6
#define PMISSILE_LOSE_CONTROL_DIST 30
#define PMISSILE_DANGER_SOUND_DURATION 0.1
extern short g_sModelIndexFireball;
class CPlayer_Missile : public CPlayer_Control
{
public:
DECLARE_CLASS( CPlayer_Missile, CPlayer_Control );
void Precache(void);
void Spawn(void);
Class_T Classify( void);
void ControlActivate( void );
void ControlDeactivate( void );
// Inputs
void InputActivate( inputdata_t &inputdata );
void InputDeactivate( inputdata_t &inputdata );
void Launch(void);
void FlyThink(void);
void ExplodeThink(void);
void RemoveThink(void);
void FlyTouch( CBaseEntity *pOther );
void BlowUp(void);
void LoseMissileControl(void);
void Event_Killed( const CTakeDamageInfo &info );
int OnTakeDamage_Alive( const CTakeDamageInfo &info );
CPlayer_Missile();
float m_flLaunchDelay;
float m_flDamage;
float m_flDamageRadius;
CHandle<SmokeTrail> m_hSmokeTrail;
Vector m_vSpawnPos;
QAngle m_vSpawnAng;
Vector m_vBounceVel;
bool m_bShake;
float m_flStatic;
float m_flNextDangerTime;
DECLARE_DATADESC();
};
BEGIN_DATADESC( CPlayer_Missile )
DEFINE_KEYFIELD( m_flLaunchDelay, FIELD_FLOAT, "LaunchDelay"),
DEFINE_KEYFIELD( m_flDamage, FIELD_FLOAT, "Damage"),
DEFINE_KEYFIELD( m_flDamageRadius, FIELD_FLOAT, "DamageRadius"),
// Fields
DEFINE_FIELD( m_hSmokeTrail, FIELD_EHANDLE),
DEFINE_FIELD( m_vSpawnPos, FIELD_POSITION_VECTOR ),
DEFINE_FIELD( m_vSpawnAng, FIELD_VECTOR ),
DEFINE_FIELD( m_vBounceVel, FIELD_VECTOR ),
DEFINE_FIELD( m_bShake, FIELD_BOOLEAN ),
DEFINE_FIELD( m_flStatic, FIELD_FLOAT ),
DEFINE_FIELD( m_flNextDangerTime, FIELD_TIME ),
// Function Pointers
DEFINE_FUNCTION( Launch ),
DEFINE_FUNCTION( FlyThink ),
DEFINE_FUNCTION( ExplodeThink ),
DEFINE_FUNCTION( RemoveThink ),
DEFINE_FUNCTION( FlyTouch ),
END_DATADESC()
LINK_ENTITY_TO_CLASS( player_missile, CPlayer_Missile );
//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CPlayer_Missile::Precache( void )
{
PrecacheModel("models/manhack_sphere.mdl");
PrecacheModel( PMISSILE_MISSILE_MODEL );
PrecacheScriptSound( "Player_Manhack.Fly" );
PrecacheScriptSound( "Player_Manhack.Fire" );
PrecacheScriptSound( "Player_Manhack.Damage" );
}
//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CPlayer_Missile::Spawn( void )
{
Precache();
SetMoveType( MOVETYPE_FLY );
SetFriction( 0.55 ); // deading the bounce a bit
SetGravity(0.0);
m_iMaxHealth = m_iHealth;
m_iHealth = 0;
SetSolid( SOLID_BBOX );
AddEffects( EF_NODRAW );
AddFlag( FL_OBJECT ); // So shows up in NPC Look()
SetModel( "models/manhack_sphere.mdl" );
UTIL_SetSize(this, PMISSILE_HULL_MINS, PMISSILE_HULL_MAXS);
m_bActive = false;
m_vSpawnPos = GetLocalOrigin();
m_vSpawnAng = GetLocalAngles();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPlayer_Missile::InputActivate( inputdata_t &inputdata )
{
// Make sure not already active
if (m_bActive)
{
return;
}
BaseClass::InputActivate( inputdata );
Vector origin = GetLocalOrigin();
origin.z += 50;
SetLocalOrigin( origin );
RemoveSolidFlags( FSOLID_NOT_SOLID );
// Using player angles to determine turning. Initailze to 0,0,0
CHL2_Player* pPlayer = (CHL2_Player*)UTIL_GetLocalPlayer();
Assert( pPlayer );
pPlayer->SetLocalAngles( vec3_angle ); // Note: Set GetLocalAngles(), not pl.v_angle
pPlayer->SnapEyeAngles( vec3_angle ); // Force reset
pPlayer->SetFOV( this, 100 );
pPlayer->SetViewEntity( this );
m_flStatic = 0;
SetThink(Launch);
SetNextThink( gpGlobals->curtime + m_flLaunchDelay );
}
//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CPlayer_Missile::Launch(void)
{
m_lifeState = LIFE_ALIVE;
m_takedamage = DAMAGE_YES;
m_iHealth = m_iMaxHealth;
// Shoot forward
Vector vVelocity;
AngleVectors( GetLocalAngles(), &vVelocity);
SetAbsVelocity( vVelocity*PMISSILE_SPEED );
EmitSound( "Player_Manhack.Fly" );
EmitSound( "Player_Manhack.Fire" );
SetThink(FlyThink);
SetTouch(FlyTouch);
SetNextThink( gpGlobals->curtime );
// Start smoke trail
SmokeTrail *pSmokeTrail = SmokeTrail::CreateSmokeTrail();
if(pSmokeTrail)
{
pSmokeTrail->m_SpawnRate = 90;
pSmokeTrail->m_ParticleLifetime = PMISSILE_TRAIL_LIFE;
pSmokeTrail->m_StartColor.Init(0.1, 0.1, 0.1);
pSmokeTrail->m_EndColor.Init(0.5,0.5,0.5);
pSmokeTrail->m_StartSize = 10;
pSmokeTrail->m_EndSize = 50;
pSmokeTrail->m_SpawnRadius = 1;
pSmokeTrail->m_MinSpeed = 15;
pSmokeTrail->m_MaxSpeed = 25;
pSmokeTrail->SetLifetime(120);
pSmokeTrail->FollowEntity(this);
m_hSmokeTrail = pSmokeTrail;
}
}
//-----------------------------------------------------------------------------
// Purpose: Input handler for turning off the steam jet.
//-----------------------------------------------------------------------------
void CPlayer_Missile::InputDeactivate( inputdata_t &inputdata )
{
ControlDeactivate();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPlayer_Missile::ControlDeactivate( void )
{
BaseClass::ControlDeactivate();
CHL2_Player* pPlayer = (CHL2_Player*)UTIL_GetLocalPlayer();
Assert( pPlayer );
pPlayer->SetViewEntity( pPlayer );
if ( pPlayer->GetActiveWeapon() )
{
pPlayer->GetActiveWeapon()->Deploy();
}
pPlayer->m_Local.m_iHideHUD &= ~HIDEHUD_WEAPONSELECTION;
SetAbsVelocity( vec3_origin );
SetLocalAngles( m_vSpawnAng );
SetLocalOrigin( m_vSpawnPos );
AddEffects( EF_NODRAW );
}
//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
int CPlayer_Missile::OnTakeDamage_Alive( const CTakeDamageInfo &info )
{
if ( (info.GetDamageType() & DMG_MISSILEDEFENSE))
{
if (random->RandomInt(0,1)==0)
{
EmitSound( "Player_Manhack.Damage" );
}
m_bShake = true;
}
else
{
// UNDONE: Blow up to anything else for now
BlowUp();
}
return BaseClass::OnTakeDamage_Alive( info );
}
//-----------------------------------------------------------------------------
// Purpose: Blow it up
//-----------------------------------------------------------------------------
void CPlayer_Missile::Event_Killed( const CTakeDamageInfo &info )
{
BlowUp();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPlayer_Missile::FlyTouch(CBaseEntity *pOther)
{
BlowUp();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPlayer_Missile::BlowUp(void)
{
// Don't take damage any more
m_takedamage = DAMAGE_NO;
// Mark as dead so won't be attacked
m_lifeState = LIFE_DEAD;
// Stop fly and launch sounds
StopSound( "Player_Manhack.Fly" );
StopSound( "Player_Manhack.Fire" );
CPASFilter filter( GetAbsOrigin() );
te->Explosion( filter, 0.0,
&GetAbsOrigin(),
g_sModelIndexFireball,
2.0,
15,
TE_EXPLFLAG_NONE,
m_flDamageRadius,
m_flDamage );
Vector vecForward = GetAbsVelocity();
VectorNormalize(vecForward);
trace_t tr;
UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + 60*vecForward, MASK_SOLID_BRUSHONLY,
this, COLLISION_GROUP_NONE, &tr);
UTIL_DecalTrace( &tr, "Scorch" );
UTIL_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START );
CSoundEnt::InsertSound ( SOUND_DANGER, GetAbsOrigin(), 1024, 3.0 );
RadiusDamage ( CTakeDamageInfo( this, this, m_flDamage, DMG_BLAST ), GetAbsOrigin(), m_flDamageRadius, CLASS_NONE, NULL );
SetThink(ExplodeThink);
SetTouch(NULL);
m_vBounceVel = -0.2 * GetAbsVelocity();
AddSolidFlags( FSOLID_NOT_SOLID );
// Stop emitting smoke
if(m_hSmokeTrail)
{
m_hSmokeTrail->SetEmit(false);
}
}
//-----------------------------------------------------------------------------
// Purpose: Manhack is still dangerous when dead
// Input :
// Output :
//-----------------------------------------------------------------------------
void CPlayer_Missile::FlyThink()
{
SetNextThink( gpGlobals->curtime );
// -------------------
// Get the player
// -------------------
CBasePlayer* pPlayer = UTIL_GetLocalPlayer();
if (!pPlayer) return;
// ---------------------------------------------------
// Calulate amount of xturn from player mouse movement
// ---------------------------------------------------
QAngle vecViewAngles = pPlayer->EyeAngles();
float xLev;
if (vecViewAngles.x < 180)
{
xLev = vecViewAngles.x/180;
}
else
{
xLev = (vecViewAngles.x-360)/180;
}
// ---------------------------------------------------
// Calulate amount of xturn from player mouse movement
// ---------------------------------------------------
float yLev;
// Keep yaw in bounds (don't let loop)
if (vecViewAngles.y > 90)
{
if (vecViewAngles.y < 180)
{
pPlayer->SetLocalAngles( QAngle( vecViewAngles.x - 360, 90, 0 ) );
QAngle newViewAngles = vecViewAngles;
newViewAngles.y = 90;
pPlayer->SnapEyeAngles( newViewAngles );
}
else if (vecViewAngles.y < 270)
{
pPlayer->SetLocalAngles( QAngle( vecViewAngles.x, 270, 0 ) );
QAngle newViewAngles = vecViewAngles;
newViewAngles.y = 270;
pPlayer->SnapEyeAngles( newViewAngles );
}
}
if (vecViewAngles.y < 180)
{
yLev = vecViewAngles.y/180;
}
else
{
yLev = (vecViewAngles.y-360)/180;
}
//<<TEMP.>> this is a temp HUD until we create a real one on the client
NDebugOverlay::ScreenText( 0.5, 0.5+0.2*xLev, "|", 255, 0, 0, 255, 0.0);
NDebugOverlay::ScreenText( 0.5-(0.1*yLev), 0.5, "=", 255, 0, 0, 255, 0.0);
NDebugOverlay::ScreenText( 0.5-(0.1*yLev), 0.5+0.2*xLev, "*", 255, 0, 0, 255, 0.0);
NDebugOverlay::ScreenText( 0.45, 0.5, "-----------------------", 0, 255, 0, 255, 0.0);
NDebugOverlay::ScreenText( 0.5, 0.425, "|", 0, 255, 0, 255, 0.0);
NDebugOverlay::ScreenText( 0.5, 0.45, "|", 0, 255, 0, 255, 0.0);
NDebugOverlay::ScreenText( 0.5, 0.475, "|", 0, 255, 0, 255, 0.0);
NDebugOverlay::ScreenText( 0.5, 0.5, "|", 0, 255, 0, 255, 0.0);
NDebugOverlay::ScreenText( 0.5, 0.525, "|", 0, 255, 0, 255, 0.0);
NDebugOverlay::ScreenText( 0.5, 0.55, "|", 0, 255, 0, 255, 0.0);
NDebugOverlay::ScreenText( 0.5, 0.575, "|", 0, 255, 0, 255, 0.0);
// Add in turn
Vector vRight,vUp;
AngleVectors( GetLocalAngles(), 0, &vRight,&vUp);
QAngle angles = GetLocalAngles();
angles.x += PMISSILE_TURN_RATE*xLev*gpGlobals->frametime;
angles.y += PMISSILE_TURN_RATE*yLev*gpGlobals->frametime;
if (m_bShake)
{
angles.x += random->RandomFloat(-3.0,3.0);
angles.y += random->RandomFloat(-3.0,3.0);
m_bShake = false;
}
SetLocalAngles( angles );
// Reset velocity
Vector vVelocity;
AngleVectors( GetLocalAngles(), &vVelocity);
SetAbsVelocity( vVelocity*PMISSILE_SPEED );
// Add some screen noise
float flClipDist = PlayerControlClipDistance();
if (flClipDist < PMISSILE_LOSE_CONTROL_DIST)
{
LoseMissileControl();
}
// Average static over time
float flStatic = 255*(1-flClipDist/PCONTROL_CLIP_DIST);
m_flStatic = 0.9*m_flStatic + 0.1*flStatic;
color32 white = {255,255,255,m_flStatic};
UTIL_ScreenFade( pPlayer, white, 0.01, 0.1, FFADE_MODULATE );
// Insert danger sound so NPCs run away from me
if (gpGlobals->curtime > m_flNextDangerTime)
{
CSoundEnt::InsertSound ( SOUND_DANGER, GetAbsOrigin(), 2000, PMISSILE_DANGER_SOUND_DURATION );
m_flNextDangerTime = gpGlobals->curtime + PMISSILE_DANGER_SOUND_DURATION;
}
}
//-----------------------------------------------------------------------------
// Purpose: Explode
// Input :
// Output :
//-----------------------------------------------------------------------------
void CPlayer_Missile::LoseMissileControl(void)
{
// Create a missile to take the place of this one
CGrenadeHomer *pGrenade = (CGrenadeHomer*)CreateEntityByName( "grenade_homer" );
if ( pGrenade )
{
pGrenade->Spawn();
pGrenade->SetLocalOrigin( GetLocalOrigin() );
pGrenade->SetLocalAngles( GetLocalAngles() );
pGrenade->SetModel( PMISSILE_MISSILE_MODEL );
pGrenade->SetDamage(m_flDamage);
pGrenade->SetDamageRadius(m_flDamageRadius);
pGrenade->Launch(this,NULL,GetAbsVelocity(),0,0,HOMER_SMOKE_TRAIL_OFF);
pGrenade->m_hRocketTrail[0] = m_hSmokeTrail;
m_hSmokeTrail->FollowEntity(pGrenade);
}
m_takedamage = DAMAGE_NO;
m_lifeState = LIFE_DEAD;
StopSound( "Player_Manhack.Fly" );
ControlDeactivate();
}
//-----------------------------------------------------------------------------
// Purpose: Explode
// Input :
// Output :
//-----------------------------------------------------------------------------
void CPlayer_Missile::ExplodeThink()
{
SetAbsVelocity( m_vBounceVel );
color32 black = {0,0,0,255};
CHL2_Player* pPlayer = (CHL2_Player*)UTIL_GetLocalPlayer();
Assert( pPlayer );
UTIL_ScreenFade( pPlayer, black, 2.0, 0.1, FFADE_OUT );
SetThink(RemoveThink);
SetNextThink( gpGlobals->curtime + PMISSILE_DIE_TIME );
}
//-----------------------------------------------------------------------------
// Purpose: Remove me
//-----------------------------------------------------------------------------
void CPlayer_Missile::RemoveThink()
{
ControlDeactivate();
}
//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
Class_T CPlayer_Missile::Classify( void)
{
return CLASS_MISSILE;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CPlayer_Missile::CPlayer_Missile()
{
m_vSpawnPos.Init(0,0,0);
m_vSpawnAng.Init(0,0,0);
m_vBounceVel.Init(0,0,0);
}

View File

@@ -1,20 +0,0 @@
#ifndef HL2MP_GAMEINTERFACE_H
#define HL2MP_GAMEINTERFACE_H
#ifdef _WIN32
#pragma once
#endif
#include "utllinkedlist.h"
// These are created for map entities in order as the map entities are spawned.
class CMapEntityRef
{
public:
int m_iEdict; // Which edict slot this entity got. -1 if CreateEntityByName failed.
int m_iSerialNumber; // The edict serial number. TODO used anywhere ?
};
extern CUtlLinkedList<CMapEntityRef, unsigned short> g_MapEntityRefs;
#endif

View File

@@ -1,134 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: implementation of player info manager
//
//=============================================================================//
#include "cbase.h"
#include "player.h"
#include "playerinfomanager.h"
#include "edict.h"
extern CGlobalVars *gpGlobals;
static CPlayerInfoManager s_PlayerInfoManager;
static CPluginBotManager s_BotManager;
namespace
{
//
// Old version support
//
abstract_class IPlayerInfo_V1
{
public:
// returns the players name (UTF-8 encoded)
virtual const char *GetName() = 0;
// returns the userid (slot number)
virtual int GetUserID() = 0;
// returns the string of their network (i.e Steam) ID
virtual const char *GetNetworkIDString() = 0;
// returns the team the player is on
virtual int GetTeamIndex() = 0;
// changes the player to a new team (if the game dll logic allows it)
virtual void ChangeTeam( int iTeamNum ) = 0;
// returns the number of kills this player has (exact meaning is mod dependent)
virtual int GetFragCount() = 0;
// returns the number of deaths this player has (exact meaning is mod dependent)
virtual int GetDeathCount() = 0;
// returns if this player slot is actually valid
virtual bool IsConnected() = 0;
// returns the armor/health of the player (exact meaning is mod dependent)
virtual int GetArmorValue() = 0;
};
abstract_class IPlayerInfoManager_V1
{
public:
virtual IPlayerInfo_V1 *GetPlayerInfo( edict_t *pEdict ) = 0;
};
class CPlayerInfoManager_V1: public IPlayerInfoManager_V1
{
public:
virtual IPlayerInfo_V1 *GetPlayerInfo( edict_t *pEdict );
};
static CPlayerInfoManager_V1 s_PlayerInfoManager_V1;
IPlayerInfo_V1 *CPlayerInfoManager_V1::GetPlayerInfo( edict_t *pEdict )
{
CBasePlayer *pPlayer = ( ( CBasePlayer * )CBaseEntity::Instance( pEdict ));
if ( pPlayer )
{
return (IPlayerInfo_V1 *)pPlayer->GetPlayerInfo();
}
else
{
return NULL;
}
}
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CPlayerInfoManager, IPlayerInfoManager_V1, "PlayerInfoManager001", s_PlayerInfoManager);
};
IPlayerInfo *CPlayerInfoManager::GetPlayerInfo( edict_t *pEdict )
{
CBasePlayer *pPlayer = ( ( CBasePlayer * )CBaseEntity::Instance( pEdict ));
if ( pPlayer )
{
return pPlayer->GetPlayerInfo();
}
else
{
return NULL;
}
}
CGlobalVars *CPlayerInfoManager::GetGlobalVars()
{
return gpGlobals;
}
IBotController *CPluginBotManager::GetBotController( edict_t *pEdict )
{
CBasePlayer *pPlayer = ( ( CBasePlayer * )CBaseEntity::Instance( pEdict ));
if ( pPlayer && pPlayer->IsBot() )
{
return pPlayer->GetBotController();
}
else
{
return NULL;
}
}
edict_t *CPluginBotManager::CreateBot( const char *botname )
{
edict_t *pEdict = engine->CreateFakeClient( botname );
if (!pEdict)
{
Msg( "Failed to create Bot.\n");
return NULL;
}
// Allocate a player entity for the bot, and call spawn
CBasePlayer *pPlayer = ((CBasePlayer*)CBaseEntity::Instance( pEdict ));
pPlayer->ClearFlags();
pPlayer->AddFlag( FL_CLIENT | FL_FAKECLIENT );
pPlayer->ChangeTeam( TEAM_UNASSIGNED );
pPlayer->RemoveAllItems( true );
pPlayer->Spawn();
return pEdict;
}
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CPlayerInfoManager, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER, s_PlayerInfoManager);
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CPluginBotManager, IBotManager, INTERFACEVERSION_PLAYERBOTMANAGER, s_BotManager);

View File

@@ -1,100 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Teleports a named entity to a given position and restores
// it's physics state
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define SF_TELEPORT_TO_SPAWN_POS 0x00000001
class CPointTeleport : public CBaseEntity
{
DECLARE_CLASS( CPointTeleport, CBaseEntity );
public:
void Activate( void );
void InputTeleport( inputdata_t &inputdata );
Vector m_vSaveOrigin;
QAngle m_vSaveAngles;
DECLARE_DATADESC();
};
LINK_ENTITY_TO_CLASS( point_teleport, CPointTeleport );
BEGIN_DATADESC( CPointTeleport )
DEFINE_FIELD( m_vSaveOrigin, FIELD_VECTOR ),
DEFINE_FIELD( m_vSaveAngles, FIELD_VECTOR ),
DEFINE_INPUTFUNC( FIELD_VOID, "Teleport", InputTeleport ),
END_DATADESC()
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPointTeleport::Activate( void )
{
m_vSaveOrigin = GetAbsOrigin();
m_vSaveAngles = GetAbsAngles();
CBaseEntity *pTarget = GetNextTarget();
if (pTarget)
{
if ( pTarget->GetMoveParent() != NULL )
{
Warning("ERROR: (%s) can't teleport object (%s) as it has a parent!\n",GetDebugName(),pTarget->GetDebugName());
BaseClass::Activate();
return;
}
if (m_spawnflags & SF_TELEPORT_TO_SPAWN_POS)
{
m_vSaveOrigin = pTarget->GetAbsOrigin();
m_vSaveAngles = pTarget->GetAbsAngles();
}
}
else if (m_spawnflags & SF_TELEPORT_TO_SPAWN_POS)
{
Warning("ERROR: (%s) target '%s' not found. Deleting.\n", GetDebugName(), STRING(m_target));
UTIL_Remove(this);
return;
}
BaseClass::Activate();
}
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPointTeleport::InputTeleport( inputdata_t &inputdata )
{
CBaseEntity *pTarget = GetNextTarget();
if (pTarget)
{
// If teleport object is in a movement hierarchy, remove it first
if ( pTarget->GetMoveParent() != NULL )
{
Warning("ERROR: (%s) can't teleport object (%s) as it has a parent (%s)!\n",GetDebugName(),pTarget->GetDebugName(),pTarget->GetMoveParent()->GetDebugName());
return;
}
pTarget->Teleport( &m_vSaveOrigin, &m_vSaveAngles, NULL );
}
}

View File

@@ -1,105 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "baseentity.h"
#include "sendproxy.h"
#include "ragdoll_shared.h"
#include "ai_basenpc.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
class CRagdollManager : public CBaseEntity
{
public:
DECLARE_CLASS( CRagdollManager, CBaseEntity );
DECLARE_SERVERCLASS();
DECLARE_DATADESC();
CRagdollManager();
virtual void Activate();
virtual int UpdateTransmitState();
void InputMaxRagdollCount(inputdata_t &data);
public:
CNetworkVar( int, m_iMaxRagdollCount );
bool m_bSaveImportant;
};
IMPLEMENT_SERVERCLASS_ST_NOBASE( CRagdollManager, DT_RagdollManager )
SendPropInt( SENDINFO( m_iMaxRagdollCount ), 6 ),
END_SEND_TABLE()
LINK_ENTITY_TO_CLASS( game_ragdoll_manager, CRagdollManager );
BEGIN_DATADESC( CRagdollManager )
DEFINE_KEYFIELD( m_iMaxRagdollCount, FIELD_INTEGER, "MaxRagdollCount" ),
DEFINE_KEYFIELD( m_bSaveImportant, FIELD_BOOLEAN, "SaveImportant" ),
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetMaxRagdollCount", InputMaxRagdollCount ),
END_DATADESC()
//-----------------------------------------------------------------------------
// Constructor
//-----------------------------------------------------------------------------
CRagdollManager::CRagdollManager( void )
{
m_iMaxRagdollCount = -1;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pInfo -
// Output : int
//-----------------------------------------------------------------------------
int CRagdollManager::UpdateTransmitState()
{
return SetTransmitState( FL_EDICT_ALWAYS );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CRagdollManager::Activate()
{
BaseClass::Activate();
s_RagdollLRU.SetMaxRagdollCount( m_iMaxRagdollCount );
}
void CRagdollManager::InputMaxRagdollCount(inputdata_t &inputdata)
{
m_iMaxRagdollCount = inputdata.value.Int();
s_RagdollLRU.SetMaxRagdollCount( m_iMaxRagdollCount );
}
bool RagdollManager_SaveImportant( CAI_BaseNPC *pNPC )
{
#ifdef HL2_DLL
CRagdollManager *pEnt = (CRagdollManager *)gEntList.FindEntityByClassname( NULL, "game_ragdoll_manager" );
if ( pEnt == NULL )
return false;
if ( pEnt->m_bSaveImportant )
{
if ( pNPC->Classify() == CLASS_PLAYER_ALLY || pNPC->Classify() == CLASS_PLAYER_ALLY_VITAL )
{
return true;
}
}
#endif
return false;
}

View File

@@ -1,123 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include "cbase.h"
#include "isaverestore.h"
#include "saverestoretypes.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Purpose: iterates through a typedescript data block, so it can insert key/value data into the block
// Input : *pObject - pointer to the struct or class the data is to be insterted into
// *pFields - description of the data
// iNumFields - number of fields contained in pFields
// char *szKeyName - name of the variable to look for
// char *szValue - value to set the variable to
// Output : Returns true if the variable is found and set, false if the key is not found.
//-----------------------------------------------------------------------------
bool ParseKeyvalue( void *pObject, typedescription_t *pFields, int iNumFields, const char *szKeyName, const char *szValue )
{
int i;
typedescription_t *pField;
for ( i = 0; i < iNumFields; i++ )
{
pField = &pFields[i];
int fieldOffset = pField->fieldOffset[ TD_OFFSET_NORMAL ];
// Check the nested classes, but only if they aren't in array form.
if ((pField->fieldType == FIELD_EMBEDDED) && (pField->fieldSize == 1))
{
for ( datamap_t *dmap = pField->td; dmap != NULL; dmap = dmap->baseMap )
{
void *pEmbeddedObject = (void*)((char*)pObject + fieldOffset);
if ( ParseKeyvalue( pEmbeddedObject, dmap->dataDesc, dmap->dataNumFields, szKeyName, szValue) )
return true;
}
}
if ( (pField->flags & FTYPEDESC_KEY) && !stricmp(pField->externalName, szKeyName) )
{
switch( pField->fieldType )
{
case FIELD_MODELNAME:
case FIELD_SOUNDNAME:
case FIELD_STRING:
(*(string_t *)((char *)pObject + fieldOffset)) = AllocPooledString( szValue );
return true;
case FIELD_TIME:
case FIELD_FLOAT:
(*(float *)((char *)pObject + fieldOffset)) = atof( szValue );
return true;
case FIELD_BOOLEAN:
(*(bool *)((char *)pObject + fieldOffset)) = (bool)(atoi( szValue ) != 0);
return true;
case FIELD_CHARACTER:
(*(char *)((char *)pObject + fieldOffset)) = (char)atoi( szValue );
return true;
case FIELD_SHORT:
(*(short *)((char *)pObject + fieldOffset)) = (short)atoi( szValue );
return true;
case FIELD_INTEGER:
case FIELD_TICK:
(*(int *)((char *)pObject + fieldOffset)) = atoi( szValue );
return true;
case FIELD_POSITION_VECTOR:
case FIELD_VECTOR:
UTIL_StringToVector( (float *)((char *)pObject + fieldOffset), szValue );
return true;
case FIELD_VMATRIX:
case FIELD_VMATRIX_WORLDSPACE:
UTIL_StringToFloatArray( (float *)((char *)pObject + fieldOffset), 16, szValue );
return true;
case FIELD_MATRIX3X4_WORLDSPACE:
UTIL_StringToFloatArray( (float *)((char *)pObject + fieldOffset), 12, szValue );
return true;
case FIELD_COLOR32:
UTIL_StringToColor32( (color32 *) ((char *)pObject + fieldOffset), szValue );
return true;
case FIELD_CUSTOM:
{
SaveRestoreFieldInfo_t fieldInfo =
{
(char *)pObject + fieldOffset,
pObject,
pField
};
pField->pSaveRestoreOps->Parse( fieldInfo, szValue );
return true;
}
default:
case FIELD_INTERVAL: // Fixme, could write this if needed
case FIELD_CLASSPTR:
case FIELD_MODELINDEX:
case FIELD_MATERIALINDEX:
case FIELD_EDICT:
Warning( "Bad field in entity!!\n" );
Assert(0);
break;
}
}
}
return false;
}

View File

@@ -1,55 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include "cbase.h"
#include "../EventLog.h"
#include "KeyValues.h"
class CSDKEventLog : public CEventLog
{
private:
typedef CEventLog BaseClass;
public:
virtual ~CSDKEventLog() {};
public:
bool PrintEvent( IGameEvent * event ) // override virtual function
{
if ( BaseClass::PrintEvent( event ) )
{
return true;
}
if ( Q_strcmp(event->GetName(), "sdk_") == 0 )
{
return PrintSDKEvent( event );
}
return false;
}
protected:
bool PrintSDKEvent( IGameEvent * event ) // print Mod specific logs
{
//const char * name = event->GetName() + Q_strlen("sdk_"); // remove prefix
return false;
}
};
CSDKEventLog g_SDKEventLog;
//-----------------------------------------------------------------------------
// Singleton access
//-----------------------------------------------------------------------------
IGameSystem* GameLogSystem()
{
return &g_SDKEventLog;
}

View File

@@ -1,357 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Player for HL1.
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "sdk_player.h"
#include "sdk_gamerules.h"
#include "weapon_sdkbase.h"
#include "predicted_viewmodel.h"
#include "iservervehicle.h"
#include "viewport_panel_names.h"
extern int gEvilImpulse101;
#define SDK_PLAYER_MODEL "models/player/terror.mdl"
// -------------------------------------------------------------------------------- //
// Player animation event. Sent to the client when a player fires, jumps, reloads, etc..
// -------------------------------------------------------------------------------- //
class CTEPlayerAnimEvent : public CBaseTempEntity
{
public:
DECLARE_CLASS( CTEPlayerAnimEvent, CBaseTempEntity );
DECLARE_SERVERCLASS();
CTEPlayerAnimEvent( const char *name ) : CBaseTempEntity( name )
{
}
CNetworkHandle( CBasePlayer, m_hPlayer );
CNetworkVar( int, m_iEvent );
};
#define THROWGRENADE_COUNTER_BITS 3
IMPLEMENT_SERVERCLASS_ST_NOBASE( CTEPlayerAnimEvent, DT_TEPlayerAnimEvent )
SendPropEHandle( SENDINFO( m_hPlayer ) ),
SendPropInt( SENDINFO( m_iEvent ), Q_log2( PLAYERANIMEVENT_COUNT ) + 1, SPROP_UNSIGNED ),
END_SEND_TABLE()
static CTEPlayerAnimEvent g_TEPlayerAnimEvent( "PlayerAnimEvent" );
void TE_PlayerAnimEvent( CBasePlayer *pPlayer, PlayerAnimEvent_t event )
{
CPVSFilter filter( (const Vector&)pPlayer->EyePosition() );
g_TEPlayerAnimEvent.m_hPlayer = pPlayer;
g_TEPlayerAnimEvent.m_iEvent = event;
g_TEPlayerAnimEvent.Create( filter, 0 );
}
// -------------------------------------------------------------------------------- //
// Tables.
// -------------------------------------------------------------------------------- //
LINK_ENTITY_TO_CLASS( player, CSDKPlayer );
PRECACHE_REGISTER(player);
BEGIN_SEND_TABLE_NOBASE( CSDKPlayer, DT_SDKLocalPlayerExclusive )
SendPropInt( SENDINFO( m_iShotsFired ), 8, SPROP_UNSIGNED ),
END_SEND_TABLE()
IMPLEMENT_SERVERCLASS_ST( CSDKPlayer, DT_SDKPlayer )
SendPropExclude( "DT_BaseAnimating", "m_flPoseParameter" ),
SendPropExclude( "DT_BaseAnimating", "m_flPlaybackRate" ),
SendPropExclude( "DT_BaseAnimating", "m_nSequence" ),
SendPropExclude( "DT_BaseEntity", "m_angRotation" ),
SendPropExclude( "DT_BaseAnimatingOverlay", "overlay_vars" ),
// playeranimstate and clientside animation takes care of these on the client
SendPropExclude( "DT_ServerAnimationData" , "m_flCycle" ),
SendPropExclude( "DT_AnimTimeMustBeFirst" , "m_flAnimTime" ),
// Data that only gets sent to the local player.
SendPropDataTable( "sdklocaldata", 0, &REFERENCE_SEND_TABLE(DT_SDKLocalPlayerExclusive), SendProxy_SendLocalDataTable ),
SendPropAngle( SENDINFO_VECTORELEM(m_angEyeAngles, 0), 11 ),
SendPropAngle( SENDINFO_VECTORELEM(m_angEyeAngles, 1), 11 ),
SendPropEHandle( SENDINFO( m_hRagdoll ) ),
SendPropInt( SENDINFO( m_iThrowGrenadeCounter ), THROWGRENADE_COUNTER_BITS, SPROP_UNSIGNED ),
END_SEND_TABLE()
class CSDKRagdoll : public CBaseAnimatingOverlay
{
public:
DECLARE_CLASS( CSDKRagdoll, CBaseAnimatingOverlay );
DECLARE_SERVERCLASS();
// Transmit ragdolls to everyone.
virtual int UpdateTransmitState()
{
return SetTransmitState( FL_EDICT_ALWAYS );
}
public:
// In case the client has the player entity, we transmit the player index.
// In case the client doesn't have it, we transmit the player's model index, origin, and angles
// so they can create a ragdoll in the right place.
CNetworkHandle( CBaseEntity, m_hPlayer ); // networked entity handle
CNetworkVector( m_vecRagdollVelocity );
CNetworkVector( m_vecRagdollOrigin );
};
LINK_ENTITY_TO_CLASS( sdk_ragdoll, CSDKRagdoll );
IMPLEMENT_SERVERCLASS_ST_NOBASE( CSDKRagdoll, DT_SDKRagdoll )
SendPropVector( SENDINFO(m_vecRagdollOrigin), -1, SPROP_COORD ),
SendPropEHandle( SENDINFO( m_hPlayer ) ),
SendPropModelIndex( SENDINFO( m_nModelIndex ) ),
SendPropInt ( SENDINFO(m_nForceBone), 8, 0 ),
SendPropVector ( SENDINFO(m_vecForce), -1, SPROP_NOSCALE ),
SendPropVector( SENDINFO( m_vecRagdollVelocity ) )
END_SEND_TABLE()
// -------------------------------------------------------------------------------- //
void cc_CreatePredictionError_f()
{
CBaseEntity *pEnt = CBaseEntity::Instance( 1 );
pEnt->SetAbsOrigin( pEnt->GetAbsOrigin() + Vector( 63, 0, 0 ) );
}
ConCommand cc_CreatePredictionError( "CreatePredictionError", cc_CreatePredictionError_f, "Create a prediction error", FCVAR_CHEAT );
CSDKPlayer::CSDKPlayer()
{
m_PlayerAnimState = CreatePlayerAnimState( this, this, LEGANIM_9WAY, true );
UseClientSideAnimation();
m_angEyeAngles.Init();
SetViewOffset( SDK_PLAYER_VIEW_OFFSET );
m_iThrowGrenadeCounter = 0;
}
CSDKPlayer::~CSDKPlayer()
{
m_PlayerAnimState->Release();
}
CSDKPlayer *CSDKPlayer::CreatePlayer( const char *className, edict_t *ed )
{
CSDKPlayer::s_PlayerEdict = ed;
return (CSDKPlayer*)CreateEntityByName( className );
}
void CSDKPlayer::LeaveVehicle( const Vector &vecExitPoint, const QAngle &vecExitAngles )
{
BaseClass::LeaveVehicle( vecExitPoint, vecExitAngles );
//teleport physics shadow too
// Vector newPos = GetAbsOrigin();
// QAngle newAng = GetAbsAngles();
// Teleport( &newPos, &newAng, &vec3_origin );
}
void CSDKPlayer::PreThink(void)
{
// Riding a vehicle?
if ( IsInAVehicle() )
{
// make sure we update the client, check for timed damage and update suit even if we are in a vehicle
UpdateClientData();
CheckTimeBasedDamage();
// Allow the suit to recharge when in the vehicle.
CheckSuitUpdate();
WaterMove();
return;
}
BaseClass::PreThink();
}
void CSDKPlayer::PostThink()
{
BaseClass::PostThink();
QAngle angles = GetLocalAngles();
angles[PITCH] = 0;
SetLocalAngles( angles );
// Store the eye angles pitch so the client can compute its animation state correctly.
m_angEyeAngles = EyeAngles();
m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );
}
void CSDKPlayer::Precache()
{
PrecacheModel( SDK_PLAYER_MODEL );
BaseClass::Precache();
}
void CSDKPlayer::Spawn()
{
SetModel( SDK_PLAYER_MODEL );
SetMoveType( MOVETYPE_WALK );
RemoveSolidFlags( FSOLID_NOT_SOLID );
m_hRagdoll = NULL;
BaseClass::Spawn();
}
void CSDKPlayer::InitialSpawn( void )
{
BaseClass::InitialSpawn();
const ConVar *hostname = cvar->FindVar( "hostname" );
const char *title = (hostname) ? hostname->GetString() : "MESSAGE OF THE DAY";
// open info panel on client showing MOTD:
KeyValues *data = new KeyValues("data");
data->SetString( "title", title ); // info panel title
data->SetString( "type", "1" ); // show userdata from stringtable entry
data->SetString( "msg", "motd" ); // use this stringtable entry
data->SetString( "cmd", "impulse 101" );// exec this command if panel closed
ShowViewPortPanel( PANEL_INFO, true, data );
data->deleteThis();
}
void CSDKPlayer::Event_Killed( const CTakeDamageInfo &info )
{
// Note: since we're dead, it won't draw us on the client, but we don't set EF_NODRAW
// because we still want to transmit to the clients in our PVS.
BaseClass::Event_Killed( info );
CreateRagdollEntity();
}
void CSDKPlayer::CreateRagdollEntity()
{
// If we already have a ragdoll, don't make another one.
CSDKRagdoll *pRagdoll = dynamic_cast< CSDKRagdoll* >( m_hRagdoll.Get() );
if ( !pRagdoll )
{
// create a new one
pRagdoll = dynamic_cast< CSDKRagdoll* >( CreateEntityByName( "sdk_ragdoll" ) );
}
if ( pRagdoll )
{
pRagdoll->m_hPlayer = this;
pRagdoll->m_vecRagdollOrigin = GetAbsOrigin();
pRagdoll->m_vecRagdollVelocity = GetAbsVelocity();
pRagdoll->m_nModelIndex = m_nModelIndex;
pRagdoll->m_nForceBone = m_nForceBone;
pRagdoll->m_vecForce = Vector(0,0,0);
}
// ragdolls will be removed on round restart automatically
m_hRagdoll = pRagdoll;
}
void CSDKPlayer::DoAnimationEvent( PlayerAnimEvent_t event )
{
if ( event == PLAYERANIMEVENT_THROW_GRENADE )
{
// Grenade throwing has to synchronize exactly with the player's grenade weapon going away,
// and events get delayed a bit, so we let CCSPlayerAnimState pickup the change to this
// variable.
m_iThrowGrenadeCounter = (m_iThrowGrenadeCounter+1) % (1<<THROWGRENADE_COUNTER_BITS);
}
else
{
m_PlayerAnimState->DoAnimationEvent( event );
TE_PlayerAnimEvent( this, event ); // Send to any clients who can see this guy.
}
}
CWeaponSDKBase* CSDKPlayer::GetActiveSDKWeapon() const
{
return dynamic_cast< CWeaponSDKBase* >( GetActiveWeapon() );
}
void CSDKPlayer::CreateViewModel( int index /*=0*/ )
{
Assert( index >= 0 && index < MAX_VIEWMODELS );
if ( GetViewModel( index ) )
return;
CPredictedViewModel *vm = ( CPredictedViewModel * )CreateEntityByName( "predicted_viewmodel" );
if ( vm )
{
vm->SetAbsOrigin( GetAbsOrigin() );
vm->SetOwner( this );
vm->SetIndex( index );
DispatchSpawn( vm );
vm->FollowEntity( this, false );
m_hViewModel.Set( index, vm );
}
}
void CSDKPlayer::CheatImpulseCommands( int iImpulse )
{
if ( iImpulse != 101 )
{
BaseClass::CheatImpulseCommands( iImpulse );
return ;
}
gEvilImpulse101 = true;
EquipSuit();
GiveNamedItem( "weapon_mp5" );
GiveNamedItem( "weapon_grenade" );
GiveNamedItem( "weapon_shotgun" );
// Give the player everything!
GiveAmmo( 90, AMMO_BULLETS );
GiveAmmo( 3, AMMO_GRENADE );
if ( GetHealth() < 100 )
{
TakeHealth( 25, DMG_GENERIC );
}
gEvilImpulse101 = false;
}
void CSDKPlayer::FlashlightTurnOn( void )
{
AddEffects( EF_DIMLIGHT );
}
void CSDKPlayer::FlashlightTurnOff( void )
{
RemoveEffects( EF_DIMLIGHT );
}
int CSDKPlayer::FlashlightIsOn( void )
{
return IsEffectActive( EF_DIMLIGHT );
}

View File

@@ -1,100 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Player for SDK Game
//
// $NoKeywords: $
//=============================================================================//
#ifndef SDK_PLAYER_H
#define SDK_PLAYER_H
#pragma once
#include "player.h"
#include "server_class.h"
#include "sdk_playeranimstate.h"
#include "sdk_shareddefs.h"
//=============================================================================
// >> SDK Game player
//=============================================================================
class CSDKPlayer : public CBasePlayer, public ISDKPlayerAnimStateHelpers
{
public:
DECLARE_CLASS( CSDKPlayer, CBasePlayer );
DECLARE_SERVERCLASS();
DECLARE_PREDICTABLE();
CSDKPlayer();
~CSDKPlayer();
static CSDKPlayer *CreatePlayer( const char *className, edict_t *ed );
static CSDKPlayer* Instance( int iEnt );
// This passes the event to the client's and server's CPlayerAnimState.
void DoAnimationEvent( PlayerAnimEvent_t event );
virtual void FlashlightTurnOn( void );
virtual void FlashlightTurnOff( void );
virtual int FlashlightIsOn( void );
virtual void PreThink();
virtual void PostThink();
virtual void Spawn();
virtual void InitialSpawn();
virtual void Precache();
virtual void Event_Killed( const CTakeDamageInfo &info );
virtual void LeaveVehicle( const Vector &vecExitPoint, const QAngle &vecExitAngles );
CWeaponSDKBase* GetActiveSDKWeapon() const;
virtual void CreateViewModel( int viewmodelindex = 0 );
virtual void CheatImpulseCommands( int iImpulse );
CNetworkVar( int, m_iThrowGrenadeCounter ); // used to trigger grenade throw animations.
CNetworkQAngle( m_angEyeAngles ); // Copied from EyeAngles() so we can send it to the client.
CNetworkVar( int, m_iShotsFired ); // number of shots fired recently
// Tracks our ragdoll entity.
CNetworkHandle( CBaseEntity, m_hRagdoll ); // networked entity handle
// In shared code.
public:
// ISDKPlayerAnimState overrides.
virtual CWeaponSDKBase* SDKAnim_GetActiveWeapon();
virtual bool SDKAnim_CanMove();
void FireBullet(
Vector vecSrc,
const QAngle &shootAngles,
float vecSpread,
int iDamage,
int iBulletType,
CBaseEntity *pevAttacker,
bool bDoEffects,
float x,
float y );
private:
void CreateRagdollEntity();
ISDKPlayerAnimState *m_PlayerAnimState;
};
inline CSDKPlayer *ToSDKPlayer( CBaseEntity *pEntity )
{
if ( !pEntity || !pEntity->IsPlayer() )
return NULL;
#ifdef _DEBUG
Assert( dynamic_cast<CSDKPlayer*>( pEntity ) != 0 );
#endif
return static_cast< CSDKPlayer* >( pEntity );
}
#endif // SDK_PLAYER_H

View File

@@ -1,40 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Team management class. Contains all the details for a specific team
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "sdk_team.h"
#include "entitylist.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
// Datatable
IMPLEMENT_SERVERCLASS_ST(CSDKTeam, DT_SDKTeam)
END_SEND_TABLE()
LINK_ENTITY_TO_CLASS( sdk_team_manager, CSDKTeam );
//-----------------------------------------------------------------------------
// Purpose: Get a pointer to the specified TF team manager
//-----------------------------------------------------------------------------
CSDKTeam *GetGlobalSDKTeam( int iIndex )
{
return (CSDKTeam*)GetGlobalTeam( iIndex );
}
//-----------------------------------------------------------------------------
// Purpose: Needed because this is an entity, but should never be used
//-----------------------------------------------------------------------------
void CSDKTeam::Init( const char *pName, int iNumber )
{
BaseClass::Init( pName, iNumber );
// Only detect changes every half-second.
NetworkProp()->SetUpdateInterval( 0.75f );
}

View File

@@ -1,38 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Team management class. Contains all the details for a specific team
//
// $NoKeywords: $
//=============================================================================//
#ifndef SDK_TEAM_H
#define SDK_TEAM_H
#ifdef _WIN32
#pragma once
#endif
#include "utlvector.h"
#include "team.h"
//-----------------------------------------------------------------------------
// Purpose: Team Manager
//-----------------------------------------------------------------------------
class CSDKTeam : public CTeam
{
DECLARE_CLASS( CSDKTeam, CTeam );
DECLARE_SERVERCLASS();
public:
// Initialization
virtual void Init( const char *pName, int iNumber );
};
extern CSDKTeam *GetGlobalSDKTeam( int iIndex );
#endif // TF_TEAM_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,71 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "terrainmodmgr.h"
#include "terrainmodmgr_shared.h"
#include "gameinterface.h"
#include "player.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
void TerrainMod_Add( TerrainModType type, const CTerrainModParams &params )
{
if ( IsXbox() )
{
return;
}
// Move players out of the way so they don't get stuck on the terrain.
float playerStartHeights[MAX_PLAYERS];
int i;
int nPlayers = min( MAX_PLAYERS, gpGlobals->maxClients );
for( i=0; i < nPlayers; i++ )
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex( i+1 );
if( !pPlayer )
continue;
playerStartHeights[i] = pPlayer->GetAbsOrigin().z;
// Cast a ray upwards to see if we can move the player out of the way.
trace_t trace;
UTIL_TraceEntity(
pPlayer, pPlayer->GetAbsOrigin(),
pPlayer->GetAbsOrigin() + Vector( 0, 0, params.m_flRadius*2 ),
MASK_SOLID,
&trace );
pPlayer->SetLocalOrigin( trace.endpos );
}
// Apply the mod.
engine->ApplyTerrainMod( type, params );
// Move players back down.
for( i=0; i < nPlayers; i++ )
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex( i+1 );
if( !pPlayer )
continue;
// Cast a ray upwards to see if we can move the player out of the way.
trace_t trace;
UTIL_TraceEntity(
pPlayer,
pPlayer->GetAbsOrigin(),
Vector( pPlayer->GetAbsOrigin().x, pPlayer->GetAbsOrigin().y, playerStartHeights[i] ),
MASK_SOLID,
&trace );
pPlayer->SetLocalOrigin( trace.endpos );
}
}

View File

@@ -1,21 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef TERRAINMODMGR_H
#define TERRAINMODMGR_H
#ifdef _WIN32
#pragma once
#endif
#include "vector.h"
#include "terrainmod.h"
// Apply a terrain mod.
// The mod is applied on the server, and sent to all clients so they can apply it.
void TerrainMod_Add( TerrainModType type, const CTerrainModParams &params );
#endif // TERRAINMODMGR_H

View File

@@ -1,102 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include "cbase.h"
#ifdef _WIN32 // no VGUI2 support under linux
#include "vgui_gamedll_int.h"
#include "ienginevgui.h"
#include <vgui/isurface.h>
#include <vgui/IVGui.h>
#include <vgui/IInput.h>
#include "tier0/vprof.h"
#include <vgui_controls/Panel.h>
#include <KeyValues.h>
using namespace vgui;
#include <vgui_controls/Controls.h>
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void VGUI_CreateGameDLLRootPanel( void )
{
// Just using PANEL_ROOT in HL2 right now
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void VGUI_DestroyGameDLLRootPanel( void )
{
}
//-----------------------------------------------------------------------------
// Purpose: Game specific root panel
// Output : vgui::Panel
//-----------------------------------------------------------------------------
vgui::VPANEL VGui_GetGameDLLRootPanel( void )
{
if ( IsPC() )
{
vgui::VPANEL root = enginevgui->GetPanel( PANEL_GAMEDLL );
return root;
}
return NULL;
}
bool VGui_Startup( CreateInterfaceFn appSystemFactory )
{
if ( !vgui::VGui_InitInterfacesList( "GAMEDLL", &appSystemFactory, 1 ) )
return false;
return true;
}
bool VGui_PostInit()
{
if ( IsPC() )
{
// Create any root panels for .dll
VGUI_CreateGameDLLRootPanel();
// Make sure we have a panel
VPANEL root = VGui_GetGameDLLRootPanel();
if ( !root )
{
return false;
}
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void VGui_CreateGlobalPanels( void )
{
}
void VGui_Shutdown()
{
if ( IsPC() )
{
VGUI_DestroyGameDLLRootPanel();
// Make sure anything "marked for deletion"
// actually gets deleted before this dll goes away
vgui::ivgui()->RunFrame();
}
}
#endif // _WIN32

View File

@@ -1,31 +0,0 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( VGUI_GAMEDLL_INT_H )
#define VGUI_GAMEDLL_INT_H
#ifdef _WIN32
#pragma once
#endif
#include "interface.h"
#include <vgui/VGUI.h>
namespace vgui
{
class Panel;
}
bool VGui_Startup( CreateInterfaceFn appSystemFactory );
bool VGui_PostInit();
void VGui_Shutdown( void );
void VGui_CreateGlobalPanels( void );
vgui::VPANEL VGui_GetGameDLLRootPanel( void );
void VGUI_CreateGameDLLRootPanel( void );
void VGUI_DestroyGameDLLRootPanel( void );
//void VGui_PreRender();
#endif // VGUI_GAMEDLL_INT_H

Binary file not shown.

Binary file not shown.

View File

@@ -1,228 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glview", "utils\glview\glview-2003.vcproj", "{BD1604CA-F401-4C4B-821C-251F5AE157FE}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "height2normal", "utils\height2normal\height2normal-2003.vcproj", "{0FDD99E4-130F-493C-8202-4C0236CC47EA}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "serverplugin_empty", "utils\serverplugin_sample\serverplugin_empty-2003.vcproj", "{B6572CBE-7C7F-4FFF-94DE-AFBBBAB11C64}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "studiomdl", "utils\studiomdl\studiomdl-2003.vcproj", "{AE28536E-885A-41BF-99A4-41A7E424B869}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tgadiff", "utils\tgadiff\tgadiff-2003.vcproj", "{0CE0AF8A-A977-4538-9D63-BCB76DE1BAC6}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vbsp", "utils\vbsp\vbsp-2003.vcproj", "{B78B6271-B19A-4CF6-926E-40B643548E23}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vice", "utils\vice\vice-2003.vcproj", "{3CE6E7A9-89EC-4304-8D72-5B602B4DBD09}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vprojtomake", "utils\vprojtomake\vprojtomake-2003.vcproj", "{EA55446E-BC04-491C-A9F0-605DFCBB213A}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vrad", "utils\vrad\vrad-2003.vcproj", "{FC0F5DE3-F09F-4EF6-98F9-BA762FFF268D}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vrad_launcher", "utils\vrad_launcher\vrad_launcher-2003.vcproj", "{914F19DF-64EC-4E7D-8B01-76477BF06479}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vtf2tga", "utils\vtf2tga\vtf2tga-2003.vcproj", "{2A1F656C-053C-46A4-AE33-304C1D865E0C}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vtfdiff", "utils\vtfdiff\vtfdiff-2003.vcproj", "{0A368DE7-D34A-48D3-B517-996BFF2D0D5D}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vvis", "utils\vvis\vvis-2003.vcproj", "{5B065E70-6EE0-4B47-BA64-113D2F81220D}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vvis_launcher", "utils\vvis_launcher\vvis_launcher-2003.vcproj", "{4C0B9915-E8FF-4089-8927-FC934BFC1E4A}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xwad", "utils\xwad\xwad-2003.vcproj", "{B850012C-98A2-42F7-B023-9F65C448D938}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vgui_controls", "vgui2\controls\vgui_controls-2003.vcproj", "{C3CEFD6F-5CDC-41DE-8D43-D932F508F51B}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demoinfo", "utils\demoinfo\demoinfo-2003.vcproj", "{4FE3FDCA-9571-44B3-A521-C81448434490}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "motionmapper", "utils\motionmapper\motionmapper-2003.vcproj", "{A882FC08-8B92-4D4F-89BF-75BCEC2BAE11}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QC_Eyes", "utils\qc_eyes\QC_Eyes-2003.vcproj", "{D373436F-7DBF-468B-A3E4-601FB8556544}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mathlib", "mathlib\mathlib-2003.vcproj", "{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tier1", "tier1\tier1-2003.vcproj", "{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "phonemeextractor", "utils\phonemeextractor\phonemeextractor-2003.vcproj", "{8A35F55B-B5C2-47A0-8C4A-5857A8E20385}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hlmv", "utils\hlmv\hlmv-2003.vcproj", "{F3704DBF-8055-413C-B027-399E5DBCA4DD}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{BD1604CA-F401-4C4B-821C-251F5AE157FE}.Debug.ActiveCfg = Debug|Win32
{BD1604CA-F401-4C4B-821C-251F5AE157FE}.Debug.Build.0 = Debug|Win32
{BD1604CA-F401-4C4B-821C-251F5AE157FE}.Release.ActiveCfg = Release|Win32
{BD1604CA-F401-4C4B-821C-251F5AE157FE}.Release.Build.0 = Release|Win32
{0FDD99E4-130F-493C-8202-4C0236CC47EA}.Debug.ActiveCfg = Debug|Win32
{0FDD99E4-130F-493C-8202-4C0236CC47EA}.Debug.Build.0 = Debug|Win32
{0FDD99E4-130F-493C-8202-4C0236CC47EA}.Release.ActiveCfg = Release|Win32
{0FDD99E4-130F-493C-8202-4C0236CC47EA}.Release.Build.0 = Release|Win32
{B6572CBE-7C7F-4FFF-94DE-AFBBBAB11C64}.Debug.ActiveCfg = Debug|Win32
{B6572CBE-7C7F-4FFF-94DE-AFBBBAB11C64}.Debug.Build.0 = Debug|Win32
{B6572CBE-7C7F-4FFF-94DE-AFBBBAB11C64}.Release.ActiveCfg = Release|Win32
{B6572CBE-7C7F-4FFF-94DE-AFBBBAB11C64}.Release.Build.0 = Release|Win32
{AE28536E-885A-41BF-99A4-41A7E424B869}.Debug.ActiveCfg = Debug|Win32
{AE28536E-885A-41BF-99A4-41A7E424B869}.Debug.Build.0 = Debug|Win32
{AE28536E-885A-41BF-99A4-41A7E424B869}.Release.ActiveCfg = Release|Win32
{AE28536E-885A-41BF-99A4-41A7E424B869}.Release.Build.0 = Release|Win32
{0CE0AF8A-A977-4538-9D63-BCB76DE1BAC6}.Debug.ActiveCfg = Debug|Win32
{0CE0AF8A-A977-4538-9D63-BCB76DE1BAC6}.Debug.Build.0 = Debug|Win32
{0CE0AF8A-A977-4538-9D63-BCB76DE1BAC6}.Release.ActiveCfg = Release|Win32
{0CE0AF8A-A977-4538-9D63-BCB76DE1BAC6}.Release.Build.0 = Release|Win32
{B78B6271-B19A-4CF6-926E-40B643548E23}.Debug.ActiveCfg = Debug|Win32
{B78B6271-B19A-4CF6-926E-40B643548E23}.Debug.Build.0 = Debug|Win32
{B78B6271-B19A-4CF6-926E-40B643548E23}.Release.ActiveCfg = Release|Win32
{B78B6271-B19A-4CF6-926E-40B643548E23}.Release.Build.0 = Release|Win32
{3CE6E7A9-89EC-4304-8D72-5B602B4DBD09}.Debug.ActiveCfg = Debug|Win32
{3CE6E7A9-89EC-4304-8D72-5B602B4DBD09}.Debug.Build.0 = Debug|Win32
{3CE6E7A9-89EC-4304-8D72-5B602B4DBD09}.Release.ActiveCfg = Release|Win32
{3CE6E7A9-89EC-4304-8D72-5B602B4DBD09}.Release.Build.0 = Release|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Debug.ActiveCfg = Debug|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Debug.Build.0 = Debug|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Release.ActiveCfg = Release|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Release.Build.0 = Release|Win32
{FC0F5DE3-F09F-4EF6-98F9-BA762FFF268D}.Debug.ActiveCfg = Debug|Win32
{FC0F5DE3-F09F-4EF6-98F9-BA762FFF268D}.Debug.Build.0 = Debug|Win32
{FC0F5DE3-F09F-4EF6-98F9-BA762FFF268D}.Release.ActiveCfg = Release|Win32
{FC0F5DE3-F09F-4EF6-98F9-BA762FFF268D}.Release.Build.0 = Release|Win32
{914F19DF-64EC-4E7D-8B01-76477BF06479}.Debug.ActiveCfg = Debug|Win32
{914F19DF-64EC-4E7D-8B01-76477BF06479}.Debug.Build.0 = Debug|Win32
{914F19DF-64EC-4E7D-8B01-76477BF06479}.Release.ActiveCfg = Release|Win32
{914F19DF-64EC-4E7D-8B01-76477BF06479}.Release.Build.0 = Release|Win32
{2A1F656C-053C-46A4-AE33-304C1D865E0C}.Debug.ActiveCfg = Debug|Win32
{2A1F656C-053C-46A4-AE33-304C1D865E0C}.Debug.Build.0 = Debug|Win32
{2A1F656C-053C-46A4-AE33-304C1D865E0C}.Release.ActiveCfg = Release|Win32
{2A1F656C-053C-46A4-AE33-304C1D865E0C}.Release.Build.0 = Release|Win32
{0A368DE7-D34A-48D3-B517-996BFF2D0D5D}.Debug.ActiveCfg = Debug|Win32
{0A368DE7-D34A-48D3-B517-996BFF2D0D5D}.Debug.Build.0 = Debug|Win32
{0A368DE7-D34A-48D3-B517-996BFF2D0D5D}.Release.ActiveCfg = Release|Win32
{0A368DE7-D34A-48D3-B517-996BFF2D0D5D}.Release.Build.0 = Release|Win32
{5B065E70-6EE0-4B47-BA64-113D2F81220D}.Debug.ActiveCfg = Debug|Win32
{5B065E70-6EE0-4B47-BA64-113D2F81220D}.Debug.Build.0 = Debug|Win32
{5B065E70-6EE0-4B47-BA64-113D2F81220D}.Release.ActiveCfg = Release|Win32
{5B065E70-6EE0-4B47-BA64-113D2F81220D}.Release.Build.0 = Release|Win32
{4C0B9915-E8FF-4089-8927-FC934BFC1E4A}.Debug.ActiveCfg = Debug|Win32
{4C0B9915-E8FF-4089-8927-FC934BFC1E4A}.Debug.Build.0 = Debug|Win32
{4C0B9915-E8FF-4089-8927-FC934BFC1E4A}.Release.ActiveCfg = Release|Win32
{4C0B9915-E8FF-4089-8927-FC934BFC1E4A}.Release.Build.0 = Release|Win32
{B850012C-98A2-42F7-B023-9F65C448D938}.Debug.ActiveCfg = Debug|Win32
{B850012C-98A2-42F7-B023-9F65C448D938}.Debug.Build.0 = Debug|Win32
{B850012C-98A2-42F7-B023-9F65C448D938}.Release.ActiveCfg = Release|Win32
{B850012C-98A2-42F7-B023-9F65C448D938}.Release.Build.0 = Release|Win32
{C3CEFD6F-5CDC-41DE-8D43-D932F508F51B}.Debug.ActiveCfg = Debug|Win32
{C3CEFD6F-5CDC-41DE-8D43-D932F508F51B}.Debug.Build.0 = Debug|Win32
{C3CEFD6F-5CDC-41DE-8D43-D932F508F51B}.Release.ActiveCfg = Release|Win32
{C3CEFD6F-5CDC-41DE-8D43-D932F508F51B}.Release.Build.0 = Release|Win32
{4FE3FDCA-9571-44B3-A521-C81448434490}.Debug.ActiveCfg = Debug|Win32
{4FE3FDCA-9571-44B3-A521-C81448434490}.Debug.Build.0 = Debug|Win32
{4FE3FDCA-9571-44B3-A521-C81448434490}.Release.ActiveCfg = Release|Win32
{4FE3FDCA-9571-44B3-A521-C81448434490}.Release.Build.0 = Release|Win32
{A882FC08-8B92-4D4F-89BF-75BCEC2BAE11}.Debug.ActiveCfg = Debug|Win32
{A882FC08-8B92-4D4F-89BF-75BCEC2BAE11}.Debug.Build.0 = Debug|Win32
{A882FC08-8B92-4D4F-89BF-75BCEC2BAE11}.Release.ActiveCfg = Release|Win32
{A882FC08-8B92-4D4F-89BF-75BCEC2BAE11}.Release.Build.0 = Release|Win32
{D373436F-7DBF-468B-A3E4-601FB8556544}.Debug.ActiveCfg = Debug|Win32
{D373436F-7DBF-468B-A3E4-601FB8556544}.Debug.Build.0 = Debug|Win32
{D373436F-7DBF-468B-A3E4-601FB8556544}.Release.ActiveCfg = Release|Win32
{D373436F-7DBF-468B-A3E4-601FB8556544}.Release.Build.0 = Release|Win32
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}.Debug.ActiveCfg = Debug|Win32
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}.Debug.Build.0 = Debug|Win32
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}.Release.ActiveCfg = Release|Win32
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}.Release.Build.0 = Release|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Debug.ActiveCfg = Debug|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Debug.Build.0 = Debug|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Release.ActiveCfg = Release|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Release.Build.0 = Release|Win32
{8A35F55B-B5C2-47A0-8C4A-5857A8E20385}.Debug.ActiveCfg = Debug|Win32
{8A35F55B-B5C2-47A0-8C4A-5857A8E20385}.Debug.Build.0 = Debug|Win32
{8A35F55B-B5C2-47A0-8C4A-5857A8E20385}.Release.ActiveCfg = Release|Win32
{8A35F55B-B5C2-47A0-8C4A-5857A8E20385}.Release.Build.0 = Release|Win32
{F3704DBF-8055-413C-B027-399E5DBCA4DD}.Debug.ActiveCfg = Debug|Win32
{F3704DBF-8055-413C-B027-399E5DBCA4DD}.Debug.Build.0 = Debug|Win32
{F3704DBF-8055-413C-B027-399E5DBCA4DD}.Release.ActiveCfg = Release|Win32
{F3704DBF-8055-413C-B027-399E5DBCA4DD}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -1,113 +1,109 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glview", "utils\glview\glview-2005.vcproj", "{BD1604CA-F401-4C4B-821C-251F5AE157FE}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glview", "utils\glview\glview-2005.vcproj", "{BD1604CA-F401-4C4B-821C-251F5AE157FE}"
ProjectSection(ProjectDependencies) = postProject
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "height2normal", "utils\height2normal\height2normal-2005.vcproj", "{0FDD99E4-130F-493C-8202-4C0236CC47EA}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Height2normal", "utils\height2normal\height2normal-2005.vcproj", "{0FDD99E4-130F-493C-8202-4C0236CC47EA}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "serverplugin_empty", "utils\serverplugin_sample\serverplugin_empty-2005.vcproj", "{B6572CBE-7C7F-4FFF-94DE-AFBBBAB11C64}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Serverplugin_empty", "utils\serverplugin_sample\serverplugin_empty-2005.vcproj", "{B6572CBE-7C7F-4FFF-94DE-AFBBBAB11C64}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "studiomdl", "utils\studiomdl\studiomdl-2005.vcproj", "{AE28536E-885A-41BF-99A4-41A7E424B869}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tgadiff", "utils\tgadiff\tgadiff-2005.vcproj", "{0CE0AF8A-A977-4538-9D63-BCB76DE1BAC6}"
ProjectSection(ProjectDependencies) = postProject
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vbsp", "utils\vbsp\vbsp-2005.vcproj", "{B78B6271-B19A-4CF6-926E-40B643548E23}"
ProjectSection(ProjectDependencies) = postProject
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tgadiff", "utils\tgadiff\tgadiff-2005.vcproj", "{0CE0AF8A-A977-4538-9D63-BCB76DE1BAC6}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vice", "utils\vice\vice-2005.vcproj", "{3CE6E7A9-89EC-4304-8D72-5B602B4DBD09}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vbsp", "utils\vbsp\vbsp-2005.vcproj", "{B78B6271-B19A-4CF6-926E-40B643548E23}"
ProjectSection(ProjectDependencies) = postProject
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vice", "utils\vice\vice-2005.vcproj", "{3CE6E7A9-89EC-4304-8D72-5B602B4DBD09}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vrad_launcher", "utils\vrad_launcher\vrad_launcher-2005.vcproj", "{914F19DF-64EC-4E7D-8B01-76477BF06479}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vprojtomake", "utils\vprojtomake\vprojtomake-2005.vcproj", "{EA55446E-BC04-491C-A9F0-605DFCBB213A}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vtf2tga", "utils\vtf2tga\vtf2tga-2005.vcproj", "{2A1F656C-053C-46A4-AE33-304C1D865E0C}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vtfdiff", "utils\vtfdiff\vtfdiff-2005.vcproj", "{0A368DE7-D34A-48D3-B517-996BFF2D0D5D}"
ProjectSection(ProjectDependencies) = postProject
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vrad", "utils\vrad\vrad-2005.vcproj", "{FC0F5DE3-F09F-4EF6-98F9-BA762FFF268D}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vrad_launcher", "utils\vrad_launcher\vrad_launcher-2005.vcproj", "{914F19DF-64EC-4E7D-8B01-76477BF06479}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vtf2tga", "utils\vtf2tga\vtf2tga-2005.vcproj", "{2A1F656C-053C-46A4-AE33-304C1D865E0C}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vtfdiff", "utils\vtfdiff\vtfdiff-2005.vcproj", "{0A368DE7-D34A-48D3-B517-996BFF2D0D5D}"
ProjectSection(ProjectDependencies) = postProject
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vvis", "utils\vvis\vvis-2005.vcproj", "{5B065E70-6EE0-4B47-BA64-113D2F81220D}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vvis_launcher", "utils\vvis_launcher\vvis_launcher-2005.vcproj", "{4C0B9915-E8FF-4089-8927-FC934BFC1E4A}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vvis_launcher", "utils\vvis_launcher\vvis_launcher-2005.vcproj", "{4C0B9915-E8FF-4089-8927-FC934BFC1E4A}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xwad", "utils\xwad\xwad-2005.vcproj", "{B850012C-98A2-42F7-B023-9F65C448D938}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vgui_controls", "vgui2\controls\vgui_controls-2005.vcproj", "{C3CEFD6F-5CDC-41DE-8D43-D932F508F51B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demoinfo", "utils\demoinfo\demoinfo-2005.vcproj", "{4FE3FDCA-9571-44B3-A521-C81448434490}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "motionmapper", "utils\motionmapper\motionmapper-2005.vcproj", "{A882FC08-8B92-4D4F-89BF-75BCEC2BAE11}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Motionmapper", "utils\motionmapper\motionmapper-2005.vcproj", "{A882FC08-8B92-4D4F-89BF-75BCEC2BAE11}"
ProjectSection(ProjectDependencies) = postProject
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QC_Eyes", "utils\qc_eyes\QC_Eyes-2005.vcproj", "{D373436F-7DBF-468B-A3E4-601FB8556544}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mathlib", "mathlib\mathlib-2005.vcproj", "{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mathlib", "mathlib\mathlib-2005.vcproj", "{884C66F2-7F84-4570-AE6C-B634C1113D69}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tier1", "tier1\tier1-2005.vcproj", "{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "phonemeextractor", "utils\phonemeextractor\phonemeextractor-2005.vcproj", "{8A35F55B-B5C2-47A0-8C4A-5857A8E20385}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Phonemeextractor", "utils\phonemeextractor\phonemeextractor-2005.vcproj", "{8A35F55B-B5C2-47A0-8C4A-5857A8E20385}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hlmv", "utils\hlmv\hlmv-2005.vcproj", "{F3704DBF-8055-413C-B027-399E5DBCA4DD}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vgui_controls", "vgui2\vgui_controls\vgui_controls-2005.vcproj", "{BF3EDBF5-ED65-4567-B348-504C1310A1BB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vrad_dll", "utils\vrad\vrad_dll-2005.vcproj", "{0DA02E11-F553-4DD1-83D1-F760F2D96862}"
ProjectSection(ProjectDependencies) = postProject
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vvis_dll", "utils\vvis\vvis_dll-2005.vcproj", "{CB353257-04B0-4EC8-9E47-F2F17B2675C9}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
{884C66F2-7F84-4570-AE6C-B634C1113D69} = {884C66F2-7F84-4570-AE6C-B634C1113D69}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vprojtomake", "utils\vprojtomake\vprojtomake-2005.vcproj", "{EA55446E-BC04-491C-A9F0-605DFCBB213A}"
ProjectSection(ProjectDependencies) = postProject
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -127,10 +123,6 @@ Global
{B6572CBE-7C7F-4FFF-94DE-AFBBBAB11C64}.Debug|Win32.Build.0 = Debug|Win32
{B6572CBE-7C7F-4FFF-94DE-AFBBBAB11C64}.Release|Win32.ActiveCfg = Release|Win32
{B6572CBE-7C7F-4FFF-94DE-AFBBBAB11C64}.Release|Win32.Build.0 = Release|Win32
{AE28536E-885A-41BF-99A4-41A7E424B869}.Debug|Win32.ActiveCfg = Debug|Win32
{AE28536E-885A-41BF-99A4-41A7E424B869}.Debug|Win32.Build.0 = Debug|Win32
{AE28536E-885A-41BF-99A4-41A7E424B869}.Release|Win32.ActiveCfg = Release|Win32
{AE28536E-885A-41BF-99A4-41A7E424B869}.Release|Win32.Build.0 = Release|Win32
{0CE0AF8A-A977-4538-9D63-BCB76DE1BAC6}.Debug|Win32.ActiveCfg = Debug|Win32
{0CE0AF8A-A977-4538-9D63-BCB76DE1BAC6}.Debug|Win32.Build.0 = Debug|Win32
{0CE0AF8A-A977-4538-9D63-BCB76DE1BAC6}.Release|Win32.ActiveCfg = Release|Win32
@@ -143,14 +135,6 @@ Global
{3CE6E7A9-89EC-4304-8D72-5B602B4DBD09}.Debug|Win32.Build.0 = Debug|Win32
{3CE6E7A9-89EC-4304-8D72-5B602B4DBD09}.Release|Win32.ActiveCfg = Release|Win32
{3CE6E7A9-89EC-4304-8D72-5B602B4DBD09}.Release|Win32.Build.0 = Release|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Debug|Win32.ActiveCfg = Debug|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Debug|Win32.Build.0 = Debug|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Release|Win32.ActiveCfg = Release|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Release|Win32.Build.0 = Release|Win32
{FC0F5DE3-F09F-4EF6-98F9-BA762FFF268D}.Debug|Win32.ActiveCfg = Debug|Win32
{FC0F5DE3-F09F-4EF6-98F9-BA762FFF268D}.Debug|Win32.Build.0 = Debug|Win32
{FC0F5DE3-F09F-4EF6-98F9-BA762FFF268D}.Release|Win32.ActiveCfg = Release|Win32
{FC0F5DE3-F09F-4EF6-98F9-BA762FFF268D}.Release|Win32.Build.0 = Release|Win32
{914F19DF-64EC-4E7D-8B01-76477BF06479}.Debug|Win32.ActiveCfg = Debug|Win32
{914F19DF-64EC-4E7D-8B01-76477BF06479}.Debug|Win32.Build.0 = Debug|Win32
{914F19DF-64EC-4E7D-8B01-76477BF06479}.Release|Win32.ActiveCfg = Release|Win32
@@ -163,10 +147,6 @@ Global
{0A368DE7-D34A-48D3-B517-996BFF2D0D5D}.Debug|Win32.Build.0 = Debug|Win32
{0A368DE7-D34A-48D3-B517-996BFF2D0D5D}.Release|Win32.ActiveCfg = Release|Win32
{0A368DE7-D34A-48D3-B517-996BFF2D0D5D}.Release|Win32.Build.0 = Release|Win32
{5B065E70-6EE0-4B47-BA64-113D2F81220D}.Debug|Win32.ActiveCfg = Debug|Win32
{5B065E70-6EE0-4B47-BA64-113D2F81220D}.Debug|Win32.Build.0 = Debug|Win32
{5B065E70-6EE0-4B47-BA64-113D2F81220D}.Release|Win32.ActiveCfg = Release|Win32
{5B065E70-6EE0-4B47-BA64-113D2F81220D}.Release|Win32.Build.0 = Release|Win32
{4C0B9915-E8FF-4089-8927-FC934BFC1E4A}.Debug|Win32.ActiveCfg = Debug|Win32
{4C0B9915-E8FF-4089-8927-FC934BFC1E4A}.Debug|Win32.Build.0 = Debug|Win32
{4C0B9915-E8FF-4089-8927-FC934BFC1E4A}.Release|Win32.ActiveCfg = Release|Win32
@@ -175,10 +155,6 @@ Global
{B850012C-98A2-42F7-B023-9F65C448D938}.Debug|Win32.Build.0 = Debug|Win32
{B850012C-98A2-42F7-B023-9F65C448D938}.Release|Win32.ActiveCfg = Release|Win32
{B850012C-98A2-42F7-B023-9F65C448D938}.Release|Win32.Build.0 = Release|Win32
{C3CEFD6F-5CDC-41DE-8D43-D932F508F51B}.Debug|Win32.ActiveCfg = Debug|Win32
{C3CEFD6F-5CDC-41DE-8D43-D932F508F51B}.Debug|Win32.Build.0 = Debug|Win32
{C3CEFD6F-5CDC-41DE-8D43-D932F508F51B}.Release|Win32.ActiveCfg = Release|Win32
{C3CEFD6F-5CDC-41DE-8D43-D932F508F51B}.Release|Win32.Build.0 = Release|Win32
{4FE3FDCA-9571-44B3-A521-C81448434490}.Debug|Win32.ActiveCfg = Debug|Win32
{4FE3FDCA-9571-44B3-A521-C81448434490}.Debug|Win32.Build.0 = Debug|Win32
{4FE3FDCA-9571-44B3-A521-C81448434490}.Release|Win32.ActiveCfg = Release|Win32
@@ -191,10 +167,10 @@ Global
{D373436F-7DBF-468B-A3E4-601FB8556544}.Debug|Win32.Build.0 = Debug|Win32
{D373436F-7DBF-468B-A3E4-601FB8556544}.Release|Win32.ActiveCfg = Release|Win32
{D373436F-7DBF-468B-A3E4-601FB8556544}.Release|Win32.Build.0 = Release|Win32
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}.Debug|Win32.ActiveCfg = Debug|Win32
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}.Debug|Win32.Build.0 = Debug|Win32
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}.Release|Win32.ActiveCfg = Release|Win32
{E1DA9FB8-FB4C-4B14-91A6-98BCED6B9720}.Release|Win32.Build.0 = Release|Win32
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Debug|Win32.ActiveCfg = Debug|Win32
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Debug|Win32.Build.0 = Debug|Win32
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Release|Win32.ActiveCfg = Release|Win32
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Release|Win32.Build.0 = Release|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Debug|Win32.ActiveCfg = Debug|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Debug|Win32.Build.0 = Debug|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Release|Win32.ActiveCfg = Release|Win32
@@ -203,10 +179,22 @@ Global
{8A35F55B-B5C2-47A0-8C4A-5857A8E20385}.Debug|Win32.Build.0 = Debug|Win32
{8A35F55B-B5C2-47A0-8C4A-5857A8E20385}.Release|Win32.ActiveCfg = Release|Win32
{8A35F55B-B5C2-47A0-8C4A-5857A8E20385}.Release|Win32.Build.0 = Release|Win32
{F3704DBF-8055-413C-B027-399E5DBCA4DD}.Debug|Win32.ActiveCfg = Debug|Win32
{F3704DBF-8055-413C-B027-399E5DBCA4DD}.Debug|Win32.Build.0 = Debug|Win32
{F3704DBF-8055-413C-B027-399E5DBCA4DD}.Release|Win32.ActiveCfg = Release|Win32
{F3704DBF-8055-413C-B027-399E5DBCA4DD}.Release|Win32.Build.0 = Release|Win32
{BF3EDBF5-ED65-4567-B348-504C1310A1BB}.Debug|Win32.ActiveCfg = Debug|Win32
{BF3EDBF5-ED65-4567-B348-504C1310A1BB}.Debug|Win32.Build.0 = Debug|Win32
{BF3EDBF5-ED65-4567-B348-504C1310A1BB}.Release|Win32.ActiveCfg = Release|Win32
{BF3EDBF5-ED65-4567-B348-504C1310A1BB}.Release|Win32.Build.0 = Release|Win32
{0DA02E11-F553-4DD1-83D1-F760F2D96862}.Debug|Win32.ActiveCfg = Debug|Win32
{0DA02E11-F553-4DD1-83D1-F760F2D96862}.Debug|Win32.Build.0 = Debug|Win32
{0DA02E11-F553-4DD1-83D1-F760F2D96862}.Release|Win32.ActiveCfg = Release|Win32
{0DA02E11-F553-4DD1-83D1-F760F2D96862}.Release|Win32.Build.0 = Release|Win32
{CB353257-04B0-4EC8-9E47-F2F17B2675C9}.Debug|Win32.ActiveCfg = Debug|Win32
{CB353257-04B0-4EC8-9E47-F2F17B2675C9}.Debug|Win32.Build.0 = Debug|Win32
{CB353257-04B0-4EC8-9E47-F2F17B2675C9}.Release|Win32.ActiveCfg = Release|Win32
{CB353257-04B0-4EC8-9E47-F2F17B2675C9}.Release|Win32.Build.0 = Release|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Debug|Win32.ActiveCfg = Debug|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Debug|Win32.Build.0 = Debug|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Release|Win32.ActiveCfg = Release|Win32
{EA55446E-BC04-491C-A9F0-605DFCBB213A}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -1,5 +0,0 @@
@echo off
@if exist %2 attrib -r %2
@if exist %2 del %2
@copy %1 %2
@if exist %2 attrib +r %2

View File

@@ -0,0 +1,271 @@
//========= Copyright <20> 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include "cbase.h"
#include "hud.h"
#include "hud_macros.h"
#include "hudelement.h"
#include "iclientmode.h"
#include "ienginevgui.h"
#include <vgui/ILocalize.h>
#include <vgui/ISurface.h>
#include <vgui/IVGUI.h>
#include <vgui_controls/EditablePanel.h>
#include <vgui_controls/Label.h>
#include <vgui_controls/ImagePanel.h>
#include "achievement_notification_panel.h"
#include "steam/steam_api.h"
#include "iachievementmgr.h"
#include "fmtstr.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
using namespace vgui;
#define ACHIEVEMENT_NOTIFICATION_DURATION 10.0f
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
DECLARE_HUDELEMENT_DEPTH( CAchievementNotificationPanel, 100 );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CAchievementNotificationPanel::CAchievementNotificationPanel( const char *pElementName ) : CHudElement( pElementName ), BaseClass( NULL, "AchievementNotificationPanel" )
{
Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent );
m_flHideTime = 0;
m_pPanelBackground = new EditablePanel( this, "Notification_Background" );
m_pIcon = new ImagePanel( this, "Notification_Icon" );
m_pLabelHeading = new Label( this, "HeadingLabel", "" );
m_pLabelTitle = new Label( this, "TitleLabel", "" );
m_pIcon->SetShouldScaleImage( true );
vgui::ivgui()->AddTickSignal( GetVPanel() );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CAchievementNotificationPanel::Init()
{
ListenForGameEvent( "achievement_event" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CAchievementNotificationPanel::ApplySchemeSettings( IScheme *pScheme )
{
// load control settings...
LoadControlSettings( "resource/UI/AchievementNotification.res" );
BaseClass::ApplySchemeSettings( pScheme );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CAchievementNotificationPanel::PerformLayout( void )
{
BaseClass::PerformLayout();
// Set background color of various elements. Need to do this in code, if we do it in res file it gets slammed by the
// scheme. (Incl. label background: some products don't have label background colors set in their scheme and helpfully slam it to white.)
SetBgColor( Color( 0, 0, 0, 0 ) );
m_pLabelHeading->SetBgColor( Color( 0, 0, 0, 0 ) );
m_pLabelTitle->SetBgColor( Color( 0, 0, 0, 0 ) );
m_pPanelBackground->SetBgColor( Color( 62,70,55, 200 ) );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CAchievementNotificationPanel::FireGameEvent( IGameEvent * event )
{
const char *name = event->GetName();
if ( 0 == Q_strcmp( name, "achievement_event" ) )
{
const char *pchName = event->GetString( "achievement_name" );
int iCur = event->GetInt( "cur_val" );
int iMax = event->GetInt( "max_val" );
wchar_t szLocalizedName[256]=L"";
if ( IsPC() )
{
// shouldn't ever get achievement progress if steam not running and user logged in, but check just in case
if ( !steamapicontext->SteamUserStats() )
{
Msg( "Steam not running, achievement progress notification not displayed\n" );
}
// use Steam to show achievement progress UI
CGameID gameID( engine->GetAppID() );
steamapicontext->SteamUserStats()->IndicateAchievementProgress( gameID, pchName, iCur, iMax );
}
else
{
// on X360 we need to show our own achievement progress UI
const wchar_t *pchLocalizedName = ACHIEVEMENT_LOCALIZED_NAME_FROM_STR( pchName );
Assert( pchLocalizedName );
if ( !pchLocalizedName || !pchLocalizedName[0] )
return;
Q_wcsncpy( szLocalizedName, pchLocalizedName, sizeof( szLocalizedName ) );
// this is achievement progress, compose the message of form: "<name> (<#>/<max>)"
wchar_t szFmt[128]=L"";
wchar_t szText[512]=L"";
wchar_t szNumFound[16]=L"";
wchar_t szNumTotal[16]=L"";
_snwprintf( szNumFound, ARRAYSIZE( szNumFound ), L"%i", iCur );
_snwprintf( szNumTotal, ARRAYSIZE( szNumTotal ), L"%i", iMax );
const wchar_t *pchFmt = g_pVGuiLocalize->Find( "#GameUI_Achievement_Progress_Fmt" );
if ( !pchFmt || !pchFmt[0] )
return;
Q_wcsncpy( szFmt, pchFmt, sizeof( szFmt ) );
g_pVGuiLocalize->ConstructString( szText, sizeof( szText ), szFmt, 3, szLocalizedName, szNumFound, szNumTotal );
AddNotification( pchName, g_pVGuiLocalize->Find( "#GameUI_Achievement_Progress" ), szText );
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Called on each tick
//-----------------------------------------------------------------------------
void CAchievementNotificationPanel::OnTick( void )
{
if ( ( m_flHideTime > 0 ) && ( m_flHideTime < gpGlobals->curtime ) )
{
m_flHideTime = 0;
ShowNextNotification();
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CAchievementNotificationPanel::ShouldDraw( void )
{
return ( ( m_flHideTime > 0 ) && ( m_flHideTime > gpGlobals->curtime ) && CHudElement::ShouldDraw() );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CAchievementNotificationPanel::AddNotification( const char *szIconBaseName, const wchar_t *pHeading, const wchar_t *pTitle )
{
// put this notification in our queue
int iQueueItem = m_queueNotification.AddToTail();
Notification_t &notification = m_queueNotification[iQueueItem];
Q_strncpy( notification.szIconBaseName, szIconBaseName, ARRAYSIZE( notification.szIconBaseName ) );
Q_wcsncpy( notification.szHeading, pHeading, sizeof( notification.szHeading ) );
Q_wcsncpy( notification.szTitle, pTitle, sizeof( notification.szTitle ) );
// if we are not currently displaying a notification, go ahead and show this one
if ( 0 == m_flHideTime )
{
ShowNextNotification();
}
}
//-----------------------------------------------------------------------------
// Purpose: Shows next notification in queue if there is one
//-----------------------------------------------------------------------------
void CAchievementNotificationPanel::ShowNextNotification()
{
// see if we have anything to do
if ( 0 == m_queueNotification.Count() )
{
m_flHideTime = 0;
return;
}
Notification_t &notification = m_queueNotification[ m_queueNotification.Head() ];
m_flHideTime = gpGlobals->curtime + ACHIEVEMENT_NOTIFICATION_DURATION;
// set the text and icon in the dialog
SetDialogVariable( "heading", notification.szHeading );
SetDialogVariable( "title", notification.szTitle );
const char *pchIconBaseName = notification.szIconBaseName;
if ( pchIconBaseName && pchIconBaseName[0] )
{
m_pIcon->SetImage( CFmtStr( "achievements/%s.vmt", pchIconBaseName ) );
}
// resize the panel so it always looks good
// get fonts
HFont hFontHeading = m_pLabelHeading->GetFont();
HFont hFontTitle = m_pLabelTitle->GetFont();
// determine how wide the text strings are
int iHeadingWidth = UTIL_ComputeStringWidth( hFontHeading, notification.szHeading );
int iTitleWidth = UTIL_ComputeStringWidth( hFontTitle, notification.szTitle );
// use the widest string
int iTextWidth = max( iHeadingWidth, iTitleWidth );
// don't let it be insanely wide
iTextWidth = min( iTextWidth, XRES( 300 ) );
int iIconWidth = m_pIcon->GetWide();
int iSpacing = XRES( 10 );
int iPanelWidth = iSpacing + iIconWidth + iSpacing + iTextWidth + iSpacing;
int iPanelX = GetWide() - iPanelWidth;
int iIconX = iPanelX + iSpacing;
int iTextX = iIconX + iIconWidth + iSpacing;
// resize all the elements
SetXAndWide( m_pPanelBackground, iPanelX, iPanelWidth );
SetXAndWide( m_pIcon, iIconX, iIconWidth );
SetXAndWide( m_pLabelHeading, iTextX, iTextWidth );
SetXAndWide( m_pLabelTitle, iTextX, iTextWidth );
m_queueNotification.Remove( m_queueNotification.Head() );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CAchievementNotificationPanel::SetXAndWide( Panel *pPanel, int x, int wide )
{
int xCur, yCur;
pPanel->GetPos( xCur, yCur );
pPanel->SetPos( x, yCur );
pPanel->SetWide( wide );
}
CON_COMMAND_F( achievement_notification_test, "Test the hud notification UI", FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY )
{
static int iCount=0;
CAchievementNotificationPanel *pPanel = GET_HUDELEMENT( CAchievementNotificationPanel );
if ( pPanel )
{
pPanel->AddNotification( "HL2_KILL_ODESSAGUNSHIP", L"Achievement Progress", ( 0 == ( iCount % 2 ) ? L"Test Notification Message A (1/10)" :
L"Test Message B" ) );
}
#if 0
IGameEvent *event = gameeventmanager->CreateEvent( "achievement_event" );
if ( event )
{
const char *szTestStr[] = { "TF_GET_HEADSHOTS", "TF_PLAY_GAME_EVERYMAP", "TF_PLAY_GAME_EVERYCLASS", "TF_GET_HEALPOINTS" };
event->SetString( "achievement_name", szTestStr[iCount%ARRAYSIZE(szTestStr)] );
event->SetInt( "cur_val", ( iCount%9 ) + 1 );
event->SetInt( "max_val", 10 );
gameeventmanager->FireEvent( event );
}
#endif
iCount++;
}

View File

@@ -0,0 +1,57 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef ACHIEVEMENT_NOTIFICATION_PANEL_H
#define ACHIEVEMENT_NOTIFICATION_PANEL_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui_controls/EditablePanel.h>
#include "hudelement.h"
using namespace vgui;
class CAchievementNotificationPanel : public CHudElement, public EditablePanel
{
DECLARE_CLASS_SIMPLE( CAchievementNotificationPanel, EditablePanel );
public:
CAchievementNotificationPanel( const char *pElementName );
virtual void Init();
virtual void ApplySchemeSettings( IScheme *scheme );
virtual bool ShouldDraw( void );
virtual void PerformLayout( void );
virtual void LevelInit( void ) { m_flHideTime = 0; }
virtual void FireGameEvent( IGameEvent * event );
virtual void OnTick( void );
void AddNotification( const char *szIconBaseName, const wchar_t *pHeading, const wchar_t *pTitle );
private:
void ShowNextNotification();
void SetXAndWide( Panel *pPanel, int x, int wide );
float m_flHideTime;
Label *m_pLabelHeading;
Label *m_pLabelTitle;
EditablePanel *m_pPanelBackground;
ImagePanel *m_pIcon;
struct Notification_t
{
char szIconBaseName[255];
wchar_t szHeading[255];
wchar_t szTitle[255];
};
CUtlLinkedList<Notification_t> m_queueNotification;
};
#endif // ACHIEVEMENT_NOTIFICATION_PANEL_H

View File

@@ -20,6 +20,7 @@ public:
virtual ~CAlphaMaterialProxy();
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
virtual void OnBind( C_BaseEntity *pEntity );
virtual IMaterial *GetMaterial();
private:
IMaterialVar *m_AlphaVar;
@@ -50,4 +51,12 @@ void CAlphaMaterialProxy::OnBind( C_BaseEntity *pEnt )
}
}
IMaterial *CAlphaMaterialProxy::GetMaterial()
{
if ( !m_AlphaVar )
return NULL;
return m_AlphaVar->GetOwningMaterial();
}
EXPOSE_INTERFACE( CAlphaMaterialProxy, IMaterialProxy, "Alpha" IMATERIAL_PROXY_INTERFACE_VERSION );

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