1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-22 17:47:38 +08:00

Modified SDK for GCC 4.2

This commit is contained in:
Scott Ehlert 2008-09-15 02:50:57 -05:00
parent 86f3bc8a60
commit 7ff7f366d5
696 changed files with 23423 additions and 22634 deletions

View File

@ -105,6 +105,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vprojtomake", "utils\vprojt
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720} = {E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "choreoobjects", "choreoobjects\choreoobjects-2005.vcproj", "{E60CA0E5-422B-450A-B185-53DDB734FF6B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -195,6 +197,10 @@ Global
{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
{E60CA0E5-422B-450A-B185-53DDB734FF6B}.Debug|Win32.ActiveCfg = Debug|Win32
{E60CA0E5-422B-450A-B185-53DDB734FF6B}.Debug|Win32.Build.0 = Debug|Win32
{E60CA0E5-422B-450A-B185-53DDB734FF6B}.Release|Win32.ActiveCfg = Release|Win32
{E60CA0E5-422B-450A-B185-53DDB734FF6B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,262 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="choreoobjects"
ProjectGUID="{E60CA0E5-422B-450A-B185-53DDB734FF6B}"
RootNamespace="choreoobjects"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
ExcludedFromBuild="false"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
UseUnicodeResponseFiles="false"
Optimization="0"
AdditionalIncludeDirectories="..\public;..\public\tier0;..\public\tier1;..\game\shared;..\utils\common"
PreprocessorDefinitions="WIN32;_WIN32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;CHOREOOBJECTS_STATIC_LIB"
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
BufferSecurityCheck="false"
FloatingPointModel="2"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
OpenMP="false"
UsePrecompiledHeader="0"
ExpandAttributedSource="false"
AssemblerOutput="0"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/"
GenerateXMLDocumentationFiles="false"
BrowseInformation="0"
BrowseInformationFile="$(IntDir)/"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="2"
ErrorReporting="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
CommandLine=""
ExcludedFromBuild="false"
/>
<Tool
Name="VCLibrarianTool"
UseUnicodeResponseFiles="false"
OutputFile="..\lib\public\choreoobjects.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
SuppressStartupBanner="true"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="$(OutDir)/choreoobjects.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
ExcludedFromBuild="false"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
ExcludedFromBuild="false"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
UseUnicodeResponseFiles="false"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\public;..\public\tier0;..\public\tier1;..\game\shared;..\utils\common"
PreprocessorDefinitions="WIN32;_WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;CHOREOOBJECTS_STATIC_LIB"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
OpenMP="false"
UsePrecompiledHeader="0"
ExpandAttributedSource="false"
AssemblerOutput="0"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/"
GenerateXMLDocumentationFiles="false"
BrowseInformation="0"
BrowseInformationFile="$(IntDir)/"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="1"
CompileAs="2"
ErrorReporting="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
CommandLine=""
ExcludedFromBuild="false"
/>
<Tool
Name="VCLibrarianTool"
UseUnicodeResponseFiles="false"
OutputFile="..\lib\public\choreoobjects.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
SuppressStartupBanner="true"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="$(OutDir)/choreoobjects.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
ExcludedFromBuild="false"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\game\shared\choreoactor.cpp"
>
</File>
<File
RelativePath="..\game\shared\choreochannel.cpp"
>
</File>
<File
RelativePath="..\game\shared\choreoevent.cpp"
>
</File>
<File
RelativePath="..\game\shared\choreoscene.cpp"
>
</File>
<File
RelativePath="..\game\shared\sceneimage.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="..\game\shared\choreoactor.h"
>
</File>
<File
RelativePath="..\game\shared\choreochannel.h"
>
</File>
<File
RelativePath="..\game\shared\choreoevent.h"
>
</File>
<File
RelativePath="..\game\shared\choreoscene.h"
>
</File>
<File
RelativePath="..\game\shared\sceneimage.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -100,4 +100,4 @@ int UpdateOrCreateCaptionFile( const char *pSourceName, char *pTargetName, int m
{
return ::UpdateOrCreate( pSourceName, pTargetName, maxLen, "GAME", CaptionCreateCallback, bForce );
}
#endif
#endif

View File

@ -35,4 +35,4 @@ int ByteswapMDL( void *pOutBase, const void *pFileBase, int fileSize );
#define BYTESWAP_ALIGNMENT_PADDING 4096
}
#endif // STUDIOBYTESWAP_H
#endif // STUDIOBYTESWAP_H

View File

@ -361,7 +361,7 @@ void C_ClientRagdoll::OnRestore( void )
RagdollMoved();
}
void C_ClientRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName )
void C_ClientRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName )
{
VPROF( "C_ClientRagdoll::ImpactTrace" );
@ -876,7 +876,7 @@ void C_BaseAnimating::LockStudioHdr()
if ( pStudioHdrContainer && pStudioHdrContainer->GetVirtualModel() )
{
MDLHandle_t hVirtualModel = (MDLHandle_t)pStudioHdrContainer->GetRenderHdr()->virtualModel;
MDLHandle_t hVirtualModel = (MDLHandle_t)reinterpret_cast<intptr_t>(pStudioHdrContainer->GetRenderHdr()->virtualModel);
mdlcache->LockStudioHdr( hVirtualModel );
}
m_pStudioHdr = pStudioHdrContainer; // must be last to ensure virtual model correctly set up
@ -894,7 +894,7 @@ void C_BaseAnimating::UnlockStudioHdr()
mdlcache->UnlockStudioHdr( m_hStudioHdr );
if ( m_pStudioHdr->GetVirtualModel() )
{
MDLHandle_t hVirtualModel = (MDLHandle_t)m_pStudioHdr->GetRenderHdr()->virtualModel;
MDLHandle_t hVirtualModel = (MDLHandle_t)reinterpret_cast<intptr_t>(m_pStudioHdr->GetRenderHdr()->virtualModel);
mdlcache->UnlockStudioHdr( hVirtualModel );
}
}

View File

@ -597,7 +597,7 @@ public:
virtual void Release( void );
virtual void SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightCount, float *pFlexWeights, float *pFlexDelayedWeights );
virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName );
virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName );
void ClientThink( void );
void ReleaseRagdoll( void ) { m_bReleaseRagdoll = true; }
bool ShouldSavePhysics( void ) { return true; }

View File

@ -813,7 +813,7 @@ public:
virtual char const * DamageDecal( int bitsDamageType, int gameMaterial );
virtual void DecalTrace( trace_t *pTrace, char const *decalName );
virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName );
virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName );
virtual bool ShouldPredict( void ) { return false; };
// interface function pointers
@ -1122,7 +1122,7 @@ public:
#ifdef _DEBUG
void FunctionCheck( void *pFunction, const char *name );
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name )
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name )
{
//COMPILE_TIME_ASSERT( sizeof(func) == 4 );
m_pfnTouch = func;

View File

@ -1868,7 +1868,7 @@ void C_BasePlayer::PlayPlayerJingle()
}
// Stuff for prediction
void C_BasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeat)
void C_BasePlayer::SetSuitUpdate(const char *name, int fgroup, int iNoRepeat)
{
// FIXME: Do something here?
}

View File

@ -114,7 +114,7 @@ public:
virtual void Weapon_DropPrimary( void ) {}
virtual Vector GetAutoaimVector( float flScale );
void SetSuitUpdate(char *name, int fgroup, int iNoRepeat);
void SetSuitUpdate(const char *name, int fgroup, int iNoRepeat);
// Input handling
virtual bool CreateMove( float flInputSampleTime, CUserCmd *pCmd );

View File

@ -1,98 +1,98 @@
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: Entity that propagates train data for escort gametype
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "c_team_train_watcher.h"
#include "igameevents.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
IMPLEMENT_CLIENTCLASS_DT_NOBASE(C_TeamTrainWatcher, DT_TeamTrainWatcher, CTeamTrainWatcher)
RecvPropFloat( RECVINFO( m_flTotalProgress ) ),
RecvPropInt( RECVINFO( m_iTrainSpeedLevel ) ),
RecvPropFloat( RECVINFO( m_flRecedeTime ) ),
RecvPropInt( RECVINFO( m_nNumCappers ) ),
END_RECV_TABLE()
C_TeamTrainWatcher *g_pTrainWatcher = NULL;
C_TeamTrainWatcher::C_TeamTrainWatcher()
{
g_pTrainWatcher = this;
// force updates when we get our baseline
m_iTrainSpeedLevel = -2;
m_flTotalProgress = -1;
m_flRecedeTime = -1;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_TeamTrainWatcher::~C_TeamTrainWatcher()
{
if ( g_pTrainWatcher == this )
{
g_pTrainWatcher = NULL;
}
}
void C_TeamTrainWatcher::OnPreDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnPreDataChanged( updateType );
m_iOldTrainSpeedLevel = m_iTrainSpeedLevel;
m_flOldProgress = m_flTotalProgress;
m_flOldRecedeTime = m_flRecedeTime;
m_nOldNumCappers = m_nNumCappers;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_TeamTrainWatcher::OnDataChanged( DataUpdateType_t updateType )
{
if ( m_iOldTrainSpeedLevel != m_iTrainSpeedLevel || m_nOldNumCappers != m_nNumCappers )
{
IGameEvent *event = gameeventmanager->CreateEvent( "escort_speed" );
if ( event )
{
event->SetInt( "speed", m_iTrainSpeedLevel );
event->SetInt( "players", m_nNumCappers );
gameeventmanager->FireEventClientSide( event );
}
}
if ( m_flOldProgress != m_flTotalProgress )
{
IGameEvent *event = gameeventmanager->CreateEvent( "escort_progress" );
if ( event )
{
event->SetFloat( "progress", m_flTotalProgress );
if ( m_flOldProgress <= -1 )
{
event->SetBool( "reset", true );
}
gameeventmanager->FireEventClientSide( event );
}
}
if ( m_flOldRecedeTime != m_flRecedeTime )
{
IGameEvent *event = gameeventmanager->CreateEvent( "escort_recede" );
if ( event )
{
event->SetFloat( "recedetime", m_flRecedeTime );
gameeventmanager->FireEventClientSide( event );
}
}
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: Entity that propagates train data for escort gametype
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "c_team_train_watcher.h"
#include "igameevents.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
IMPLEMENT_CLIENTCLASS_DT_NOBASE(C_TeamTrainWatcher, DT_TeamTrainWatcher, CTeamTrainWatcher)
RecvPropFloat( RECVINFO( m_flTotalProgress ) ),
RecvPropInt( RECVINFO( m_iTrainSpeedLevel ) ),
RecvPropFloat( RECVINFO( m_flRecedeTime ) ),
RecvPropInt( RECVINFO( m_nNumCappers ) ),
END_RECV_TABLE()
C_TeamTrainWatcher *g_pTrainWatcher = NULL;
C_TeamTrainWatcher::C_TeamTrainWatcher()
{
g_pTrainWatcher = this;
// force updates when we get our baseline
m_iTrainSpeedLevel = -2;
m_flTotalProgress = -1;
m_flRecedeTime = -1;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_TeamTrainWatcher::~C_TeamTrainWatcher()
{
if ( g_pTrainWatcher == this )
{
g_pTrainWatcher = NULL;
}
}
void C_TeamTrainWatcher::OnPreDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnPreDataChanged( updateType );
m_iOldTrainSpeedLevel = m_iTrainSpeedLevel;
m_flOldProgress = m_flTotalProgress;
m_flOldRecedeTime = m_flRecedeTime;
m_nOldNumCappers = m_nNumCappers;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_TeamTrainWatcher::OnDataChanged( DataUpdateType_t updateType )
{
if ( m_iOldTrainSpeedLevel != m_iTrainSpeedLevel || m_nOldNumCappers != m_nNumCappers )
{
IGameEvent *event = gameeventmanager->CreateEvent( "escort_speed" );
if ( event )
{
event->SetInt( "speed", m_iTrainSpeedLevel );
event->SetInt( "players", m_nNumCappers );
gameeventmanager->FireEventClientSide( event );
}
}
if ( m_flOldProgress != m_flTotalProgress )
{
IGameEvent *event = gameeventmanager->CreateEvent( "escort_progress" );
if ( event )
{
event->SetFloat( "progress", m_flTotalProgress );
if ( m_flOldProgress <= -1 )
{
event->SetBool( "reset", true );
}
gameeventmanager->FireEventClientSide( event );
}
}
if ( m_flOldRecedeTime != m_flRecedeTime )
{
IGameEvent *event = gameeventmanager->CreateEvent( "escort_recede" );
if ( event )
{
event->SetFloat( "recedetime", m_flRecedeTime );
gameeventmanager->FireEventClientSide( event );
}
}
}

View File

@ -1,59 +1,59 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef C_TEAM_TRAIN_WATCHER_H
#define C_TEAM_TRAIN_WATCHER_H
#ifdef _WIN32
#pragma once
#endif
#include "c_baseentity.h"
class C_TeamTrainWatcher : public C_BaseEntity
{
DECLARE_CLASS( C_TeamTrainWatcher, C_BaseEntity );
public:
DECLARE_CLIENTCLASS();
C_TeamTrainWatcher();
~C_TeamTrainWatcher();
virtual void OnPreDataChanged( DataUpdateType_t updateType );
virtual void OnDataChanged( DataUpdateType_t updateType );
float GetTotalProgress( void ) { return m_flTotalProgress; }
int GetSpeedLevel( void ) { return m_iTrainSpeedLevel; }
private:
// === Networked Data ===
// percent distance to cp1, distance to cp2, etc
// adds up to 1.0
//CNetworkArray( float, m_flDistances, MAX_CONTROL_POINTS );
// current total progress, percentage
CNetworkVar( float, m_flTotalProgress );
float m_flOldProgress;
CNetworkVar( int, m_iTrainSpeedLevel );
int m_iOldTrainSpeedLevel;
CNetworkVar( float, m_flRecedeTime );
float m_flOldRecedeTime;
CNetworkVar( int, m_nNumCappers );
int m_nOldNumCappers;
};
extern C_TeamTrainWatcher *g_pTrainWatcher;
inline C_TeamTrainWatcher *TrainWatcher()
{
return g_pTrainWatcher;
}
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef C_TEAM_TRAIN_WATCHER_H
#define C_TEAM_TRAIN_WATCHER_H
#ifdef _WIN32
#pragma once
#endif
#include "c_baseentity.h"
class C_TeamTrainWatcher : public C_BaseEntity
{
DECLARE_CLASS( C_TeamTrainWatcher, C_BaseEntity );
public:
DECLARE_CLIENTCLASS();
C_TeamTrainWatcher();
~C_TeamTrainWatcher();
virtual void OnPreDataChanged( DataUpdateType_t updateType );
virtual void OnDataChanged( DataUpdateType_t updateType );
float GetTotalProgress( void ) { return m_flTotalProgress; }
int GetSpeedLevel( void ) { return m_iTrainSpeedLevel; }
private:
// === Networked Data ===
// percent distance to cp1, distance to cp2, etc
// adds up to 1.0
//CNetworkArray( float, m_flDistances, MAX_CONTROL_POINTS );
// current total progress, percentage
CNetworkVar( float, m_flTotalProgress );
float m_flOldProgress;
CNetworkVar( int, m_iTrainSpeedLevel );
int m_iOldTrainSpeedLevel;
CNetworkVar( float, m_flRecedeTime );
float m_flOldRecedeTime;
CNetworkVar( int, m_nNumCappers );
int m_nOldNumCappers;
};
extern C_TeamTrainWatcher *g_pTrainWatcher;
inline C_TeamTrainWatcher *TrainWatcher()
{
return g_pTrainWatcher;
}
#endif //C_TEAM_TRAIN_WATCHER_H

View File

@ -4,6 +4,7 @@
Version="8.00"
Name="Client (HL2)"
ProjectGUID="{F2D9D6B0-DEE5-4217-9336-A4FEBA24C790}"
RootNamespace="Client (HL2)"
>
<Platforms>
<Platform
@ -28,8 +29,8 @@
<Tool
Name="VCCustomBuildTool"
Description="Copying to destination folder"
CommandLine="if exist &quot;..\..\game\hl2\bin\client.dll&quot; attrib -r &quot;..\..\game\hl2\bin\client.dll&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)&quot;client.dll &quot;..\..\game\hl2\bin&quot;&#x0D;&#x0A;"
Outputs="..\..\game\hl2\bin\client.dll"
CommandLine="if exist ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.dll attrib -r ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;if exist ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.pdb attrib -r ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;"
Outputs="..\..\..\game\hl2\bin\client.dll;..\..\..\game\hl2\bin\client.pdb"
/>
<Tool
Name="VCXMLDataGeneratorTool"
@ -87,7 +88,7 @@
UseUnicodeResponseFiles="false"
AdditionalDependencies="winmm.lib"
ShowProgress="0"
OutputFile="$(OutDir)/Client.dll"
OutputFile="$(OutDir)/client.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\common;..\..\lib\public"
@ -148,8 +149,8 @@
<Tool
Name="VCCustomBuildTool"
Description="Copying to destination folder"
CommandLine="if exist &quot;..\..\game\hl2\bin\client.dll&quot; attrib -r &quot;..\..\game\hl2\bin\client.dll&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)&quot;client.dll &quot;..\..\game\hl2\bin&quot;&#x0D;&#x0A;if exist &quot;..\..\game\hl2\bin\client.pdb&quot; attrib -r &quot;..\..\game\hl2\bin\client.pdb&quot;&#x0D;&#x0A;if exist &quot;$(TargetDir)&quot;client.pdb copy &quot;$(TargetDir)&quot;client.pdb &quot;..\..\game\hl2\bin\client.pdb&quot;&#x0D;&#x0A;"
Outputs="..\..\game\hl2\bin\client.dll&quot;;&quot;..\..\game\hl2\bin\client.pdb"
CommandLine="if exist ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.dll attrib -r ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;if exist ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.pdb attrib -r ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\hl2\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;"
Outputs="..\..\..\game\hl2\bin\client.dll;..\..\..\game\hl2\bin\client.pdb"
/>
<Tool
Name="VCXMLDataGeneratorTool"
@ -209,7 +210,7 @@
UseUnicodeResponseFiles="false"
AdditionalDependencies="winmm.lib"
ShowProgress="0"
OutputFile="$(OutDir)/Client.dll"
OutputFile="$(OutDir)/client.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\common;..\..\lib\public"
@ -263,6 +264,7 @@
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\achievement_notification_panel.cpp"
@ -2755,6 +2757,7 @@
</Filter>
<Filter
Name="Link Libraries"
Filter="lib"
>
<File
RelativePath="..\..\lib\public\bitmap.lib"
@ -2811,6 +2814,7 @@
</Filter>
<Filter
Name="MP3"
Filter="h;cpp"
>
<File
RelativePath=".\mp3player.cpp"
@ -2823,6 +2827,7 @@
</Filter>
<Filter
Name="Tool Framework"
Filter="h;cpp"
>
<File
RelativePath="..\..\public\tools\bonelist.cpp"
@ -2847,6 +2852,7 @@
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\animationlayer.h"
@ -3627,6 +3633,7 @@
</Filter>
<Filter
Name="Public Header Files"
Filter="h"
>
<File
RelativePath="..\..\public\mathlib\amd3dx.h"
@ -4527,6 +4534,7 @@
</Filter>
<Filter
Name="Game Shared Header Files"
Filter="h"
>
<File
RelativePath="..\shared\activitylist.h"
@ -4995,6 +5003,7 @@
</Filter>
<Filter
Name="game_controls Header Files"
Filter="h"
>
<File
RelativePath=".\game_controls\baseviewport.h"

View File

@ -4,6 +4,7 @@
Version="8.00"
Name="Client (HL2MP)"
ProjectGUID="{5FE91DC8-B6DF-4061-984E-36FD36623E72}"
RootNamespace="Client (HL2MP)"
>
<Platforms>
<Platform
@ -28,8 +29,8 @@
<Tool
Name="VCCustomBuildTool"
Description="Copying to destination folder"
CommandLine="if exist &quot;..\..\game\hl2\bin\client.dll&quot; attrib -r &quot;..\..\game\hl2\bin\client.dll&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)&quot;client.dll &quot;..\..\game\hl2\bin&quot;&#x0D;&#x0A;"
Outputs="..\..\game\hl2\bin\client.dll"
CommandLine="if exist ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.dll attrib -r ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;if exist ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.pdb attrib -r ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;"
Outputs="..\..\..\game\hl2mp\bin\client.dll;..\..\..\game\hl2mp\bin\client.pdb"
/>
<Tool
Name="VCXMLDataGeneratorTool"
@ -87,7 +88,7 @@
UseUnicodeResponseFiles="false"
AdditionalDependencies="winmm.lib"
ShowProgress="0"
OutputFile="$(OutDir)/Client.dll"
OutputFile="$(OutDir)/client.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\common;..\..\lib\public"
@ -148,8 +149,8 @@
<Tool
Name="VCCustomBuildTool"
Description="Copying to destination folder"
CommandLine="if exist &quot;..\..\game\hl2\bin\client.dll&quot; attrib -r &quot;..\..\game\hl2\bin\client.dll&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)&quot;client.dll &quot;..\..\game\hl2\bin&quot;&#x0D;&#x0A;if exist &quot;..\..\game\hl2\bin\client.pdb&quot; attrib -r &quot;..\..\game\hl2\bin\client.pdb&quot;&#x0D;&#x0A;if exist &quot;$(TargetDir)&quot;client.pdb copy &quot;$(TargetDir)&quot;client.pdb &quot;..\..\game\hl2\bin\client.pdb&quot;&#x0D;&#x0A;"
Outputs="..\..\game\hl2\bin\client.dll&quot;;&quot;..\..\game\hl2\bin\client.pdb"
CommandLine="if exist ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.dll attrib -r ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;if exist ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.pdb attrib -r ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\hl2mp\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;"
Outputs="..\..\..\game\hl2mp\bin\client.dll;..\..\..\game\hl2mp\bin\client.pdb"
/>
<Tool
Name="VCXMLDataGeneratorTool"
@ -209,7 +210,7 @@
UseUnicodeResponseFiles="false"
AdditionalDependencies="winmm.lib"
ShowProgress="0"
OutputFile="$(OutDir)/Client.dll"
OutputFile="$(OutDir)/client.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\common;..\..\lib\public"
@ -263,6 +264,7 @@
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\achievement_notification_panel.cpp"
@ -1864,6 +1866,10 @@
RelativePath="..\shared\teamplay_gamerules.cpp"
>
</File>
<File
RelativePath="..\shared\teamplay_round_timer.cpp"
>
</File>
<File
RelativePath="..\shared\teamplayroundbased_gamerules.cpp"
>
@ -2923,6 +2929,7 @@
</Filter>
<Filter
Name="Link Libraries"
Filter="lib"
>
<File
RelativePath="..\..\lib\public\bitmap.lib"
@ -2987,6 +2994,7 @@
</Filter>
<Filter
Name="MP3"
Filter="h;cpp"
>
<File
RelativePath=".\mp3player.cpp"
@ -2999,6 +3007,7 @@
</Filter>
<Filter
Name="Tool Framework"
Filter="h;cpp"
>
<File
RelativePath="..\..\public\tools\bonelist.cpp"
@ -3023,6 +3032,7 @@
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\animationlayer.h"
@ -3803,6 +3813,7 @@
</Filter>
<Filter
Name="Public Header Files"
Filter="h"
>
<File
RelativePath="..\..\public\mathlib\amd3dx.h"
@ -4703,6 +4714,7 @@
</Filter>
<Filter
Name="Game Shared Header Files"
Filter="h"
>
<File
RelativePath="..\shared\activitylist.h"
@ -5171,6 +5183,7 @@
</Filter>
<Filter
Name="game_controls Header Files"
Filter="h"
>
<File
RelativePath=".\game_controls\baseviewport.h"

View File

@ -4,6 +4,7 @@
Version="8.00"
Name="Client (SDK)"
ProjectGUID="{09603CC0-928D-4939-83E5-C255291B9466}"
RootNamespace="Client (SDK)"
>
<Platforms>
<Platform
@ -28,8 +29,8 @@
<Tool
Name="VCCustomBuildTool"
Description="Copying to destination folder"
CommandLine="if exist &quot;..\..\game\hl2\bin\client.dll&quot; attrib -r &quot;..\..\game\hl2\bin\client.dll&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)&quot;client.dll &quot;..\..\game\hl2\bin&quot;&#x0D;&#x0A;"
Outputs="..\..\game\hl2\bin\client.dll"
CommandLine="if exist ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.dll attrib -r ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;if exist ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.pdb attrib -r ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;"
Outputs="..\..\..\game\sdk\bin\client.dll;..\..\..\game\sdk\bin\client.pdb"
/>
<Tool
Name="VCXMLDataGeneratorTool"
@ -87,7 +88,7 @@
UseUnicodeResponseFiles="false"
AdditionalDependencies="winmm.lib"
ShowProgress="0"
OutputFile="$(OutDir)/Client.dll"
OutputFile="$(OutDir)/client.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\common;..\..\lib\public"
@ -148,8 +149,8 @@
<Tool
Name="VCCustomBuildTool"
Description="Copying to destination folder"
CommandLine="if exist &quot;..\..\game\hl2\bin\client.dll&quot; attrib -r &quot;..\..\game\hl2\bin\client.dll&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)&quot;client.dll &quot;..\..\game\hl2\bin&quot;&#x0D;&#x0A;if exist &quot;..\..\game\hl2\bin\client.pdb&quot; attrib -r &quot;..\..\game\hl2\bin\client.pdb&quot;&#x0D;&#x0A;if exist &quot;$(TargetDir)&quot;client.pdb copy &quot;$(TargetDir)&quot;client.pdb &quot;..\..\game\hl2\bin\client.pdb&quot;&#x0D;&#x0A;"
Outputs="..\..\game\hl2\bin\client.dll&quot;;&quot;..\..\game\hl2\bin\client.pdb"
CommandLine="if exist ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.dll attrib -r ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.dll&#x0D;&#x0A;if exist ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.pdb attrib -r ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; ..\..\..\game\sdk\bin\&quot;$(TargetName)&quot;.pdb&#x0D;&#x0A;"
Outputs="..\..\..\game\sdk\bin\client.dll;..\..\..\game\sdk\bin\client.pdb"
/>
<Tool
Name="VCXMLDataGeneratorTool"
@ -209,7 +210,7 @@
UseUnicodeResponseFiles="false"
AdditionalDependencies="winmm.lib"
ShowProgress="0"
OutputFile="$(OutDir)/Client.dll"
OutputFile="$(OutDir)/client.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\common;..\..\lib\public"
@ -263,6 +264,7 @@
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\achievement_notification_panel.cpp"
@ -2575,6 +2577,7 @@
</Filter>
<Filter
Name="Link Libraries"
Filter="lib"
>
<File
RelativePath="..\..\lib\public\bitmap.lib"
@ -2631,6 +2634,7 @@
</Filter>
<Filter
Name="MP3"
Filter="h;cpp"
>
<File
RelativePath=".\mp3player.cpp"
@ -2643,6 +2647,7 @@
</Filter>
<Filter
Name="Tool Framework"
Filter="h;cpp"
>
<File
RelativePath="..\..\public\tools\bonelist.cpp"
@ -2667,6 +2672,7 @@
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\animationlayer.h"
@ -3447,6 +3453,7 @@
</Filter>
<Filter
Name="Public Header Files"
Filter="h"
>
<File
RelativePath="..\..\public\mathlib\amd3dx.h"
@ -4347,6 +4354,7 @@
</Filter>
<Filter
Name="Game Shared Header Files"
Filter="h"
>
<File
RelativePath="..\shared\activitylist.h"
@ -4803,6 +4811,7 @@
</Filter>
<Filter
Name="game_controls Header Files"
Filter="h"
>
<File
RelativePath=".\game_controls\baseviewport.h"

View File

@ -1,277 +1,277 @@
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "vgui/IInput.h"
#include <vgui/IVGUI.h>
#include "commentary_modelviewer.h"
#include "iclientmode.h"
#include "baseviewport.h"
DECLARE_BUILD_FACTORY( CCommentaryModelPanel );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CCommentaryModelPanel::CCommentaryModelPanel( vgui::Panel *parent, const char *name ) : CModelPanel( parent, name )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CCommentaryModelViewer::CCommentaryModelViewer(IViewPort *pViewPort) : Frame(NULL, PANEL_COMMENTARY_MODELVIEWER )
{
m_pViewPort = pViewPort;
m_pModelPanel = NULL;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CCommentaryModelViewer::~CCommentaryModelViewer()
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
LoadControlSettings( "Resource/UI/CommentaryModelViewer.res" );
m_pModelPanel = dynamic_cast<CCommentaryModelPanel*>( FindChildByName( "modelpanel" ) );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::PerformLayout( void )
{
int w,h;
GetParent()->GetSize( w, h );
SetBounds(0,0,w,h);
if ( m_pModelPanel )
{
m_pModelPanel->SetBounds(0,0,w,h);
}
BaseClass::PerformLayout();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::SetModel( const char *pszName, const char *pszAttached )
{
if ( !m_pModelPanel )
return;
m_pModelPanel->SwapModel( pszName, pszAttached );
m_flYawSpeed = 0;
m_flZoomSpeed = 0;
m_bTranslating = false;
m_vecResetPos = m_pModelPanel->m_pModelInfo->m_vecOriginOffset;
m_vecResetAngles = m_pModelPanel->m_pModelInfo->m_vecAbsAngles;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::ShowPanel(bool bShow)
{
if ( BaseClass::IsVisible() == bShow )
return;
if ( bShow )
{
Activate();
SetMouseInputEnabled( true );
}
else
{
SetVisible( false );
SetMouseInputEnabled( false );
}
m_pViewPort->ShowBackGround( bShow );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::OnCommand( const char *command )
{
if ( Q_stricmp( command, "vguicancel" ) )
{
engine->ClientCmd( const_cast<char *>( command ) );
}
Close();
m_pViewPort->ShowBackGround( false );
BaseClass::OnCommand( command );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::OnKeyCodePressed( vgui::KeyCode code )
{
if ( code == KEY_ENTER )
{
Close();
m_pViewPort->ShowBackGround( false );
}
else if ( code == KEY_SPACE )
{
m_bTranslating = !m_bTranslating;
}
else if ( code == KEY_R )
{
m_pModelPanel->m_pModelInfo->m_vecOriginOffset = m_vecResetPos;
m_pModelPanel->m_pModelInfo->m_vecAbsAngles = m_vecResetAngles;
m_flYawSpeed = 0;
m_flZoomSpeed = 0;
m_pModelPanel->ZoomToFrameDistance();
}
else
{
BaseClass::OnKeyCodePressed( code );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::OnThink( void )
{
HandleMovementInput();
BaseClass::OnThink();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::HandleMovementInput( void )
{
bool bLeftDown = input()->IsKeyDown(KEY_LEFT);
bool bRightDown = input()->IsKeyDown(KEY_RIGHT);
bool bForwardDown = input()->IsKeyDown(KEY_UP);
bool bBackDown = input()->IsKeyDown(KEY_DOWN);
float flAccel = 0.05;
// Rotation around Z
if ( bLeftDown )
{
if ( m_flYawSpeed > 0 )
{
m_flYawSpeed = 0;
}
m_flYawSpeed = max(m_flYawSpeed-flAccel, -3.0);
}
else if ( bRightDown )
{
if ( m_flYawSpeed < 0 )
{
m_flYawSpeed = 0;
}
m_flYawSpeed = min(m_flYawSpeed+flAccel, 3.0);
}
if ( m_flYawSpeed != 0 )
{
if ( m_bTranslating )
{
m_pModelPanel->m_pModelInfo->m_vecOriginOffset.y = clamp( m_pModelPanel->m_pModelInfo->m_vecOriginOffset.y + m_flYawSpeed, -100, 100 );
}
else
{
m_pModelPanel->m_pModelInfo->m_vecAbsAngles.y = anglemod( m_pModelPanel->m_pModelInfo->m_vecAbsAngles.y + m_flYawSpeed );
}
if ( !bLeftDown && !bRightDown )
{
m_flYawSpeed = ( m_flYawSpeed > 0 ) ? max(0,m_flYawSpeed-0.1) : min(0,m_flYawSpeed+0.1);
}
}
// Zooming
if ( bForwardDown )
{
if ( m_flZoomSpeed > 0 )
{
m_flZoomSpeed = 0;
}
m_flZoomSpeed = max(m_flZoomSpeed-flAccel, -3.0);
}
else if ( bBackDown )
{
if ( m_flZoomSpeed < 0 )
{
m_flZoomSpeed = 0;
}
m_flZoomSpeed = min(m_flZoomSpeed+flAccel, 3.0);
}
if ( m_flZoomSpeed != 0 )
{
if ( m_bTranslating )
{
m_pModelPanel->m_pModelInfo->m_vecOriginOffset.z = clamp( m_pModelPanel->m_pModelInfo->m_vecOriginOffset.z + m_flZoomSpeed, -100, 300 );
}
else
{
float flZoomMin = m_pModelPanel->m_flFrameDistance * 0.75;
float flZoomMax = m_pModelPanel->m_flFrameDistance * 1.5;
m_pModelPanel->m_pModelInfo->m_vecOriginOffset.x = clamp( m_pModelPanel->m_pModelInfo->m_vecOriginOffset.x + m_flZoomSpeed, flZoomMin, flZoomMax );
}
if ( !bForwardDown && !bBackDown )
{
m_flZoomSpeed = ( m_flZoomSpeed > 0 ) ? max(0,m_flZoomSpeed-0.1) : min(0,m_flZoomSpeed+0.1);
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CommentaryShowModelViewer( const CCommand &args )
{
if ( args.ArgC() < 2 )
{
ConMsg( "Usage: commentary_showmodelviewer <model name> <optional attached model name>\n" );
return;
}
CBaseViewport *pViewport = dynamic_cast<CBaseViewport *>( g_pClientMode->GetViewport() );
if ( pViewport )
{
IViewPortPanel *pCommentaryPanel = pViewport->FindPanelByName( PANEL_COMMENTARY_MODELVIEWER );
if ( !pCommentaryPanel )
{
pCommentaryPanel = pViewport->CreatePanelByName( PANEL_COMMENTARY_MODELVIEWER );
pViewport->AddNewPanel( pCommentaryPanel, "PANEL_COMMENTARY_MODELVIEWER" );
}
if ( pCommentaryPanel )
{
//((CCommentaryModelViewer*)pCommentaryPanel)->InvalidateLayout( false, true );
((CCommentaryModelViewer*)pCommentaryPanel)->SetModel( args[1], args[2] );
pViewport->ShowPanel( pCommentaryPanel, true );
}
}
}
ConCommand commentary_showmodelviewer( "commentary_showmodelviewer", CommentaryShowModelViewer, "Display the commentary model viewer. Usage: commentary_showmodelviewer <model name> <optional attached model name>", FCVAR_NONE );
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "vgui/IInput.h"
#include <vgui/IVGUI.h>
#include "commentary_modelviewer.h"
#include "iclientmode.h"
#include "baseviewport.h"
DECLARE_BUILD_FACTORY( CCommentaryModelPanel );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CCommentaryModelPanel::CCommentaryModelPanel( vgui::Panel *parent, const char *name ) : CModelPanel( parent, name )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CCommentaryModelViewer::CCommentaryModelViewer(IViewPort *pViewPort) : Frame(NULL, PANEL_COMMENTARY_MODELVIEWER )
{
m_pViewPort = pViewPort;
m_pModelPanel = NULL;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CCommentaryModelViewer::~CCommentaryModelViewer()
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
LoadControlSettings( "Resource/UI/CommentaryModelViewer.res" );
m_pModelPanel = dynamic_cast<CCommentaryModelPanel*>( FindChildByName( "modelpanel" ) );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::PerformLayout( void )
{
int w,h;
GetParent()->GetSize( w, h );
SetBounds(0,0,w,h);
if ( m_pModelPanel )
{
m_pModelPanel->SetBounds(0,0,w,h);
}
BaseClass::PerformLayout();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::SetModel( const char *pszName, const char *pszAttached )
{
if ( !m_pModelPanel )
return;
m_pModelPanel->SwapModel( pszName, pszAttached );
m_flYawSpeed = 0;
m_flZoomSpeed = 0;
m_bTranslating = false;
m_vecResetPos = m_pModelPanel->m_pModelInfo->m_vecOriginOffset;
m_vecResetAngles = m_pModelPanel->m_pModelInfo->m_vecAbsAngles;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::ShowPanel(bool bShow)
{
if ( BaseClass::IsVisible() == bShow )
return;
if ( bShow )
{
Activate();
SetMouseInputEnabled( true );
}
else
{
SetVisible( false );
SetMouseInputEnabled( false );
}
m_pViewPort->ShowBackGround( bShow );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::OnCommand( const char *command )
{
if ( Q_stricmp( command, "vguicancel" ) )
{
engine->ClientCmd( const_cast<char *>( command ) );
}
Close();
m_pViewPort->ShowBackGround( false );
BaseClass::OnCommand( command );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::OnKeyCodePressed( vgui::KeyCode code )
{
if ( code == KEY_ENTER )
{
Close();
m_pViewPort->ShowBackGround( false );
}
else if ( code == KEY_SPACE )
{
m_bTranslating = !m_bTranslating;
}
else if ( code == KEY_R )
{
m_pModelPanel->m_pModelInfo->m_vecOriginOffset = m_vecResetPos;
m_pModelPanel->m_pModelInfo->m_vecAbsAngles = m_vecResetAngles;
m_flYawSpeed = 0;
m_flZoomSpeed = 0;
m_pModelPanel->ZoomToFrameDistance();
}
else
{
BaseClass::OnKeyCodePressed( code );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::OnThink( void )
{
HandleMovementInput();
BaseClass::OnThink();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCommentaryModelViewer::HandleMovementInput( void )
{
bool bLeftDown = input()->IsKeyDown(KEY_LEFT);
bool bRightDown = input()->IsKeyDown(KEY_RIGHT);
bool bForwardDown = input()->IsKeyDown(KEY_UP);
bool bBackDown = input()->IsKeyDown(KEY_DOWN);
float flAccel = 0.05;
// Rotation around Z
if ( bLeftDown )
{
if ( m_flYawSpeed > 0 )
{
m_flYawSpeed = 0;
}
m_flYawSpeed = max(m_flYawSpeed-flAccel, -3.0);
}
else if ( bRightDown )
{
if ( m_flYawSpeed < 0 )
{
m_flYawSpeed = 0;
}
m_flYawSpeed = min(m_flYawSpeed+flAccel, 3.0);
}
if ( m_flYawSpeed != 0 )
{
if ( m_bTranslating )
{
m_pModelPanel->m_pModelInfo->m_vecOriginOffset.y = clamp( m_pModelPanel->m_pModelInfo->m_vecOriginOffset.y + m_flYawSpeed, -100, 100 );
}
else
{
m_pModelPanel->m_pModelInfo->m_vecAbsAngles.y = anglemod( m_pModelPanel->m_pModelInfo->m_vecAbsAngles.y + m_flYawSpeed );
}
if ( !bLeftDown && !bRightDown )
{
m_flYawSpeed = ( m_flYawSpeed > 0 ) ? max(0,m_flYawSpeed-0.1) : min(0,m_flYawSpeed+0.1);
}
}
// Zooming
if ( bForwardDown )
{
if ( m_flZoomSpeed > 0 )
{
m_flZoomSpeed = 0;
}
m_flZoomSpeed = max(m_flZoomSpeed-flAccel, -3.0);
}
else if ( bBackDown )
{
if ( m_flZoomSpeed < 0 )
{
m_flZoomSpeed = 0;
}
m_flZoomSpeed = min(m_flZoomSpeed+flAccel, 3.0);
}
if ( m_flZoomSpeed != 0 )
{
if ( m_bTranslating )
{
m_pModelPanel->m_pModelInfo->m_vecOriginOffset.z = clamp( m_pModelPanel->m_pModelInfo->m_vecOriginOffset.z + m_flZoomSpeed, -100, 300 );
}
else
{
float flZoomMin = m_pModelPanel->m_flFrameDistance * 0.75;
float flZoomMax = m_pModelPanel->m_flFrameDistance * 1.5;
m_pModelPanel->m_pModelInfo->m_vecOriginOffset.x = clamp( m_pModelPanel->m_pModelInfo->m_vecOriginOffset.x + m_flZoomSpeed, flZoomMin, flZoomMax );
}
if ( !bForwardDown && !bBackDown )
{
m_flZoomSpeed = ( m_flZoomSpeed > 0 ) ? max(0,m_flZoomSpeed-0.1) : min(0,m_flZoomSpeed+0.1);
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CommentaryShowModelViewer( const CCommand &args )
{
if ( args.ArgC() < 2 )
{
ConMsg( "Usage: commentary_showmodelviewer <model name> <optional attached model name>\n" );
return;
}
CBaseViewport *pViewport = dynamic_cast<CBaseViewport *>( g_pClientMode->GetViewport() );
if ( pViewport )
{
IViewPortPanel *pCommentaryPanel = pViewport->FindPanelByName( PANEL_COMMENTARY_MODELVIEWER );
if ( !pCommentaryPanel )
{
pCommentaryPanel = pViewport->CreatePanelByName( PANEL_COMMENTARY_MODELVIEWER );
pViewport->AddNewPanel( pCommentaryPanel, "PANEL_COMMENTARY_MODELVIEWER" );
}
if ( pCommentaryPanel )
{
//((CCommentaryModelViewer*)pCommentaryPanel)->InvalidateLayout( false, true );
((CCommentaryModelViewer*)pCommentaryPanel)->SetModel( args[1], args[2] );
pViewport->ShowPanel( pCommentaryPanel, true );
}
}
}
ConCommand commentary_showmodelviewer( "commentary_showmodelviewer", CommentaryShowModelViewer, "Display the commentary model viewer. Usage: commentary_showmodelviewer <model name> <optional attached model name>", FCVAR_NONE );

View File

@ -1,75 +1,75 @@
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef COMMENTARY_MODELVIEWER_H
#define COMMENTARY_MODELVIEWER_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui_controls/Frame.h>
#include <game/client/iviewport.h>
#include "basemodelpanel.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CCommentaryModelPanel : public CModelPanel
{
public:
DECLARE_CLASS_SIMPLE( CCommentaryModelPanel, CModelPanel );
CCommentaryModelPanel( vgui::Panel *parent, const char *name );
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CCommentaryModelViewer : public vgui::Frame, public IViewPortPanel
{
DECLARE_CLASS_SIMPLE( CCommentaryModelViewer, vgui::Frame );
public:
CCommentaryModelViewer(IViewPort *pViewPort);
virtual ~CCommentaryModelViewer();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void PerformLayout( void );
virtual void OnCommand( const char *command );
virtual void OnKeyCodePressed( vgui::KeyCode code );
virtual void OnThink( void );
void SetModel( const char *pszName, const char *pszAttached );
void HandleMovementInput( void );
// IViewPortPanel
public:
virtual const char *GetName( void ) { return PANEL_COMMENTARY_MODELVIEWER; }
virtual void SetData(KeyValues *data) {};
virtual void Reset() {};
virtual void Update() {};
virtual bool NeedsUpdate( void ) { return false; }
virtual bool HasInputElements( void ) { return true; }
virtual void ShowPanel( bool bShow );
// both vgui::Frame and IViewPortPanel define these, so explicitly define them here as passthroughs to vgui
vgui::VPANEL GetVPanel( void ) { return BaseClass::GetVPanel(); }
virtual bool IsVisible() { return BaseClass::IsVisible(); }
virtual void SetParent( vgui::VPANEL parent ) { BaseClass::SetParent( parent ); }
private:
IViewPort *m_pViewPort;
CCommentaryModelPanel *m_pModelPanel;
Vector m_vecResetPos;
Vector m_vecResetAngles;
bool m_bTranslating;
float m_flYawSpeed;
float m_flZoomSpeed;
};
#endif // COMMENTARY_MODELVIEWER_H
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef COMMENTARY_MODELVIEWER_H
#define COMMENTARY_MODELVIEWER_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui_controls/Frame.h>
#include <game/client/iviewport.h>
#include "basemodelpanel.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CCommentaryModelPanel : public CModelPanel
{
public:
DECLARE_CLASS_SIMPLE( CCommentaryModelPanel, CModelPanel );
CCommentaryModelPanel( vgui::Panel *parent, const char *name );
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CCommentaryModelViewer : public vgui::Frame, public IViewPortPanel
{
DECLARE_CLASS_SIMPLE( CCommentaryModelViewer, vgui::Frame );
public:
CCommentaryModelViewer(IViewPort *pViewPort);
virtual ~CCommentaryModelViewer();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void PerformLayout( void );
virtual void OnCommand( const char *command );
virtual void OnKeyCodePressed( vgui::KeyCode code );
virtual void OnThink( void );
void SetModel( const char *pszName, const char *pszAttached );
void HandleMovementInput( void );
// IViewPortPanel
public:
virtual const char *GetName( void ) { return PANEL_COMMENTARY_MODELVIEWER; }
virtual void SetData(KeyValues *data) {};
virtual void Reset() {};
virtual void Update() {};
virtual bool NeedsUpdate( void ) { return false; }
virtual bool HasInputElements( void ) { return true; }
virtual void ShowPanel( bool bShow );
// both vgui::Frame and IViewPortPanel define these, so explicitly define them here as passthroughs to vgui
vgui::VPANEL GetVPanel( void ) { return BaseClass::GetVPanel(); }
virtual bool IsVisible() { return BaseClass::IsVisible(); }
virtual void SetParent( vgui::VPANEL parent ) { BaseClass::SetParent( parent ); }
private:
IViewPort *m_pViewPort;
CCommentaryModelPanel *m_pModelPanel;
Vector m_vecResetPos;
Vector m_vecResetAngles;
bool m_bTranslating;
float m_flYawSpeed;
float m_flZoomSpeed;
};
#endif // COMMENTARY_MODELVIEWER_H

File diff suppressed because it is too large Load Diff

View File

@ -1,209 +1,209 @@
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef BASEMODEL_PANEL_H
#define BASEMODEL_PANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "matsys_controls/mdlpanel.h"
//-----------------------------------------------------------------------------
// Resource file data used in posing the model inside of the model panel.
//-----------------------------------------------------------------------------
struct BMPResAnimData_t
{
const char *m_pszName;
const char *m_pszSequence;
const char *m_pszActivity;
KeyValues *m_pPoseParameters;
bool m_bDefault;
BMPResAnimData_t()
{
m_pszName = NULL;
m_pszSequence = NULL;
m_pszActivity = NULL;
m_pPoseParameters = NULL;
m_bDefault = false;
}
~BMPResAnimData_t()
{
if ( m_pszName && m_pszName[0] )
{
delete [] m_pszName;
m_pszName = NULL;
}
if ( m_pszSequence && m_pszSequence[0] )
{
delete [] m_pszSequence;
m_pszSequence = NULL;
}
if ( m_pszActivity && m_pszActivity[0] )
{
delete [] m_pszActivity;
m_pszActivity = NULL;
}
if ( m_pPoseParameters )
{
m_pPoseParameters->deleteThis();
m_pPoseParameters = NULL;
}
}
};
struct BMPResAttachData_t
{
const char *m_pszModelName;
int m_nSkin;
BMPResAttachData_t()
{
m_pszModelName = NULL;
m_nSkin = 0;
}
~BMPResAttachData_t()
{
if ( m_pszModelName && m_pszModelName[0] )
{
delete [] m_pszModelName;
m_pszModelName = NULL;
}
}
};
struct BMPResData_t
{
float m_flFOV;
const char *m_pszModelName;
const char *m_pszModelName_HWM;
const char *m_pszVCD;
QAngle m_angModelPoseRot;
Vector m_vecOriginOffset;
Vector m_vecFramedOriginOffset;
Vector2D m_vecViewportOffset;
int m_nSkin;
bool m_bUseSpotlight;
CUtlVector<BMPResAnimData_t> m_aAnimations;
CUtlVector<BMPResAttachData_t> m_aAttachModels;
BMPResData_t()
{
m_flFOV = 0.0f;
m_pszModelName = NULL;
m_pszModelName_HWM = NULL;
m_pszVCD = NULL;
m_angModelPoseRot.Init();
m_vecOriginOffset.Init();
m_vecFramedOriginOffset.Init();
m_vecViewportOffset.Init();
m_nSkin = 0;
m_bUseSpotlight = false;
}
~BMPResData_t()
{
if ( m_pszModelName && m_pszModelName[0] )
{
delete [] m_pszModelName;
m_pszModelName = NULL;
}
if ( m_pszModelName_HWM && m_pszModelName_HWM[0] )
{
delete [] m_pszModelName_HWM;
m_pszModelName_HWM = NULL;
}
if ( m_pszVCD && m_pszVCD[0] )
{
delete [] m_pszVCD;
m_pszVCD = NULL;
}
m_aAnimations.Purge();
m_aAttachModels.Purge();
}
};
//-----------------------------------------------------------------------------
// Base Model Panel
//
// ...vgui::Panel |--> vgui
// +->vgui::EditablePanel |
// +->PotterWheelPanel |--> matsys_controls
// +->MDLPanel |
// +->BaseModelPanel |--> game_controls, client.dll
//
//-----------------------------------------------------------------------------
class CBaseModelPanel : public CMDLPanel
{
DECLARE_CLASS_SIMPLE( CBaseModelPanel, CMDLPanel );
public:
// Constructor, Destructor.
CBaseModelPanel( vgui::Panel *pParent, const char *pName );
virtual ~CBaseModelPanel();
// Overridden mdlpanel.h
virtual void SetMDL( MDLHandle_t handle );
virtual void SetMDL( const char *pMDLName );
// Overridden methods of vgui::Panel
virtual void ApplySettings( KeyValues *inResourceData );
virtual void PerformLayout();
// Animaiton.
int FindDefaultAnim( void );
int FindAnimByName( const char *pszName );
void SetModelAnim( int iAnim );
// Manipulation.
virtual void OnKeyCodePressed ( vgui::KeyCode code );
virtual void OnKeyCodeReleased( vgui::KeyCode code );
virtual void OnMousePressed ( vgui::MouseCode code );
virtual void OnMouseReleased( vgui::MouseCode code );
virtual void OnCursorMoved( int x, int y );
virtual void OnMouseWheeled( int delta );
private:
// Resource file data.
void ParseModelResInfo( KeyValues *inResourceData );
void ParseModelAnimInfo( KeyValues *inResourceData );
void ParseModelAttachInfo( KeyValues *inResourceData );
void SetupModelDefaults( void );
void SetupModelAnimDefaults( void );
void LookAtBounds( const Vector &vecBoundsMin, const Vector &vecBoundsMax );
int FindSequenceFromActivity( CStudioHdr *pStudioHdr, const char *pszActivity );
private:
BMPResData_t m_BMPResData; // Base model panel data set in the .res file.
QAngle m_angPlayer;
Vector m_vecPlayerPos;
bool m_bForcePos;
bool m_bMousePressed;
bool m_bAllowRotation;
// VGUI script accessible variables.
CPanelAnimationVar( bool, m_bStartFramed, "start_framed", "0" );
CPanelAnimationVar( bool, m_bDisableManipulation, "disable_manipulation", "0" );
};
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef BASEMODEL_PANEL_H
#define BASEMODEL_PANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "matsys_controls/mdlpanel.h"
//-----------------------------------------------------------------------------
// Resource file data used in posing the model inside of the model panel.
//-----------------------------------------------------------------------------
struct BMPResAnimData_t
{
const char *m_pszName;
const char *m_pszSequence;
const char *m_pszActivity;
KeyValues *m_pPoseParameters;
bool m_bDefault;
BMPResAnimData_t()
{
m_pszName = NULL;
m_pszSequence = NULL;
m_pszActivity = NULL;
m_pPoseParameters = NULL;
m_bDefault = false;
}
~BMPResAnimData_t()
{
if ( m_pszName && m_pszName[0] )
{
delete [] m_pszName;
m_pszName = NULL;
}
if ( m_pszSequence && m_pszSequence[0] )
{
delete [] m_pszSequence;
m_pszSequence = NULL;
}
if ( m_pszActivity && m_pszActivity[0] )
{
delete [] m_pszActivity;
m_pszActivity = NULL;
}
if ( m_pPoseParameters )
{
m_pPoseParameters->deleteThis();
m_pPoseParameters = NULL;
}
}
};
struct BMPResAttachData_t
{
const char *m_pszModelName;
int m_nSkin;
BMPResAttachData_t()
{
m_pszModelName = NULL;
m_nSkin = 0;
}
~BMPResAttachData_t()
{
if ( m_pszModelName && m_pszModelName[0] )
{
delete [] m_pszModelName;
m_pszModelName = NULL;
}
}
};
struct BMPResData_t
{
float m_flFOV;
const char *m_pszModelName;
const char *m_pszModelName_HWM;
const char *m_pszVCD;
QAngle m_angModelPoseRot;
Vector m_vecOriginOffset;
Vector m_vecFramedOriginOffset;
Vector2D m_vecViewportOffset;
int m_nSkin;
bool m_bUseSpotlight;
CUtlVector<BMPResAnimData_t> m_aAnimations;
CUtlVector<BMPResAttachData_t> m_aAttachModels;
BMPResData_t()
{
m_flFOV = 0.0f;
m_pszModelName = NULL;
m_pszModelName_HWM = NULL;
m_pszVCD = NULL;
m_angModelPoseRot.Init();
m_vecOriginOffset.Init();
m_vecFramedOriginOffset.Init();
m_vecViewportOffset.Init();
m_nSkin = 0;
m_bUseSpotlight = false;
}
~BMPResData_t()
{
if ( m_pszModelName && m_pszModelName[0] )
{
delete [] m_pszModelName;
m_pszModelName = NULL;
}
if ( m_pszModelName_HWM && m_pszModelName_HWM[0] )
{
delete [] m_pszModelName_HWM;
m_pszModelName_HWM = NULL;
}
if ( m_pszVCD && m_pszVCD[0] )
{
delete [] m_pszVCD;
m_pszVCD = NULL;
}
m_aAnimations.Purge();
m_aAttachModels.Purge();
}
};
//-----------------------------------------------------------------------------
// Base Model Panel
//
// ...vgui::Panel |--> vgui
// +->vgui::EditablePanel |
// +->PotterWheelPanel |--> matsys_controls
// +->MDLPanel |
// +->BaseModelPanel |--> game_controls, client.dll
//
//-----------------------------------------------------------------------------
class CBaseModelPanel : public CMDLPanel
{
DECLARE_CLASS_SIMPLE( CBaseModelPanel, CMDLPanel );
public:
// Constructor, Destructor.
CBaseModelPanel( vgui::Panel *pParent, const char *pName );
virtual ~CBaseModelPanel();
// Overridden mdlpanel.h
virtual void SetMDL( MDLHandle_t handle );
virtual void SetMDL( const char *pMDLName );
// Overridden methods of vgui::Panel
virtual void ApplySettings( KeyValues *inResourceData );
virtual void PerformLayout();
// Animaiton.
int FindDefaultAnim( void );
int FindAnimByName( const char *pszName );
void SetModelAnim( int iAnim );
// Manipulation.
virtual void OnKeyCodePressed ( vgui::KeyCode code );
virtual void OnKeyCodeReleased( vgui::KeyCode code );
virtual void OnMousePressed ( vgui::MouseCode code );
virtual void OnMouseReleased( vgui::MouseCode code );
virtual void OnCursorMoved( int x, int y );
virtual void OnMouseWheeled( int delta );
private:
// Resource file data.
void ParseModelResInfo( KeyValues *inResourceData );
void ParseModelAnimInfo( KeyValues *inResourceData );
void ParseModelAttachInfo( KeyValues *inResourceData );
void SetupModelDefaults( void );
void SetupModelAnimDefaults( void );
void LookAtBounds( const Vector &vecBoundsMin, const Vector &vecBoundsMax );
int FindSequenceFromActivity( CStudioHdr *pStudioHdr, const char *pszActivity );
private:
BMPResData_t m_BMPResData; // Base model panel data set in the .res file.
QAngle m_angPlayer;
Vector m_vecPlayerPos;
bool m_bForcePos;
bool m_bMousePressed;
bool m_bAllowRotation;
// VGUI script accessible variables.
CPanelAnimationVar( bool, m_bStartFramed, "start_framed", "0" );
CPanelAnimationVar( bool, m_bDisableManipulation, "disable_manipulation", "0" );
};
#endif // BASEMODEL_PANEL_H

File diff suppressed because it is too large Load Diff

View File

@ -1,232 +1,232 @@
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef BASEMODELPANEL_H
#define BASEMODELPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui/IScheme.h>
#include <vgui_controls/ImagePanel.h>
#include <vgui_controls/EditablePanel.h>
#include "gameeventlistener.h"
#include "KeyValues.h"
class C_SceneEntity;
class CModelPanelModel : public C_BaseFlex
{
public:
CModelPanelModel(){}
DECLARE_CLASS( CModelPanelModel, C_BaseFlex );
virtual bool IsMenuModel() const{ return true; }
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CModelPanelModelAnimation
{
public:
CModelPanelModelAnimation()
{
m_pszName = NULL;
m_pszSequence = NULL;
m_pszActivity = NULL;
m_pPoseParameters = NULL;
m_bDefault = false;
}
~CModelPanelModelAnimation()
{
if ( m_pszName && m_pszName[0] )
{
delete [] m_pszName;
m_pszName = NULL;
}
if ( m_pszSequence && m_pszSequence[0] )
{
delete [] m_pszSequence;
m_pszSequence = NULL;
}
if ( m_pszActivity && m_pszActivity[0] )
{
delete [] m_pszActivity;
m_pszActivity = NULL;
}
if ( m_pPoseParameters )
{
m_pPoseParameters->deleteThis();
m_pPoseParameters = NULL;
}
}
public:
const char *m_pszName;
const char *m_pszSequence;
const char *m_pszActivity;
KeyValues *m_pPoseParameters;
bool m_bDefault;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CModelPanelAttachedModelInfo
{
public:
CModelPanelAttachedModelInfo()
{
m_pszModelName = NULL;
m_nSkin = 0;
}
~CModelPanelAttachedModelInfo()
{
if ( m_pszModelName && m_pszModelName[0] )
{
delete [] m_pszModelName;
m_pszModelName = NULL;
}
}
public:
const char *m_pszModelName;
int m_nSkin;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CModelPanelModelInfo
{
public:
CModelPanelModelInfo()
{
m_pszModelName = NULL;
m_pszModelName_HWM = NULL;
m_nSkin = -1;
m_vecAbsAngles.Init();
m_vecOriginOffset.Init();
m_vecFramedOriginOffset.Init();
m_bUseSpotlight = false;
}
~CModelPanelModelInfo()
{
if ( m_pszModelName && m_pszModelName[0] )
{
delete [] m_pszModelName;
m_pszModelName = NULL;
}
if ( m_pszModelName_HWM && m_pszModelName_HWM[0] )
{
delete [] m_pszModelName_HWM;
m_pszModelName_HWM = NULL;
}
if ( m_pszVCD && m_pszVCD[0] )
{
delete [] m_pszVCD;
m_pszVCD = NULL;
}
m_Animations.PurgeAndDeleteElements();
m_AttachedModelsInfo.PurgeAndDeleteElements();
}
public:
const char *m_pszModelName;
const char *m_pszModelName_HWM;
int m_nSkin;
const char *m_pszVCD;
Vector m_vecAbsAngles;
Vector m_vecOriginOffset;
Vector2D m_vecViewportOffset;
Vector m_vecFramedOriginOffset;
bool m_bUseSpotlight;
CUtlVector<CModelPanelModelAnimation*> m_Animations;
CUtlVector<CModelPanelAttachedModelInfo*> m_AttachedModelsInfo;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CModelPanel : public vgui::EditablePanel, public CGameEventListener
{
public:
DECLARE_CLASS_SIMPLE( CModelPanel, vgui::EditablePanel );
CModelPanel( vgui::Panel *parent, const char *name );
virtual ~CModelPanel();
virtual void Paint();
virtual void ApplySettings( KeyValues *inResourceData );
virtual void DeleteVCDData( void );
virtual void DeleteModelData( void );
virtual void SetFOV( int nFOV ){ m_nFOV = nFOV; }
virtual void SetPanelDirty( void ){ m_bPanelDirty = true; }
virtual bool SetSequence( const char *pszSequence );
MESSAGE_FUNC_PARAMS( OnAddAnimation, "AddAnimation", data );
MESSAGE_FUNC_PARAMS( OnSetAnimation, "SetAnimation", data );
void SetDefaultAnimation( const char *pszName );
void SwapModel( const char *pszName, const char *pszAttached = NULL );
virtual void ParseModelInfo( KeyValues *inResourceData );
void ClearAttachedModelInfos( void );
void CalculateFrameDistance( void );
void ZoomToFrameDistance( void );
public: // IGameEventListener:
virtual void FireGameEvent( IGameEvent * event );
protected:
virtual void SetupModel( void );
virtual void SetupVCD( void );
virtual const char *GetModelName( void );
private:
void InitCubeMaps();
int FindAnimByName( const char *pszName );
void CalculateFrameDistanceInternal( const model_t *pModel );
public:
int m_nFOV;
float m_flFrameDistance;
bool m_bStartFramed;
CModelPanelModelInfo *m_pModelInfo;
CHandle<CModelPanelModel> m_hModel;
CUtlVector<CHandle<C_BaseAnimating> > m_AttachedModels;
CHandle<C_SceneEntity> m_hScene;
private:
bool m_bPanelDirty;
int m_iDefaultAnimation;
bool m_bAllowOffscreen;
CTextureReference m_DefaultEnvCubemap;
CTextureReference m_DefaultHDREnvCubemap;
};
#endif // BASEMODELPANEL_H
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef BASEMODELPANEL_H
#define BASEMODELPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui/IScheme.h>
#include <vgui_controls/ImagePanel.h>
#include <vgui_controls/EditablePanel.h>
#include "gameeventlistener.h"
#include "KeyValues.h"
class C_SceneEntity;
class CModelPanelModel : public C_BaseFlex
{
public:
CModelPanelModel(){}
DECLARE_CLASS( CModelPanelModel, C_BaseFlex );
virtual bool IsMenuModel() const{ return true; }
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CModelPanelModelAnimation
{
public:
CModelPanelModelAnimation()
{
m_pszName = NULL;
m_pszSequence = NULL;
m_pszActivity = NULL;
m_pPoseParameters = NULL;
m_bDefault = false;
}
~CModelPanelModelAnimation()
{
if ( m_pszName && m_pszName[0] )
{
delete [] m_pszName;
m_pszName = NULL;
}
if ( m_pszSequence && m_pszSequence[0] )
{
delete [] m_pszSequence;
m_pszSequence = NULL;
}
if ( m_pszActivity && m_pszActivity[0] )
{
delete [] m_pszActivity;
m_pszActivity = NULL;
}
if ( m_pPoseParameters )
{
m_pPoseParameters->deleteThis();
m_pPoseParameters = NULL;
}
}
public:
const char *m_pszName;
const char *m_pszSequence;
const char *m_pszActivity;
KeyValues *m_pPoseParameters;
bool m_bDefault;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CModelPanelAttachedModelInfo
{
public:
CModelPanelAttachedModelInfo()
{
m_pszModelName = NULL;
m_nSkin = 0;
}
~CModelPanelAttachedModelInfo()
{
if ( m_pszModelName && m_pszModelName[0] )
{
delete [] m_pszModelName;
m_pszModelName = NULL;
}
}
public:
const char *m_pszModelName;
int m_nSkin;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CModelPanelModelInfo
{
public:
CModelPanelModelInfo()
{
m_pszModelName = NULL;
m_pszModelName_HWM = NULL;
m_nSkin = -1;
m_vecAbsAngles.Init();
m_vecOriginOffset.Init();
m_vecFramedOriginOffset.Init();
m_bUseSpotlight = false;
}
~CModelPanelModelInfo()
{
if ( m_pszModelName && m_pszModelName[0] )
{
delete [] m_pszModelName;
m_pszModelName = NULL;
}
if ( m_pszModelName_HWM && m_pszModelName_HWM[0] )
{
delete [] m_pszModelName_HWM;
m_pszModelName_HWM = NULL;
}
if ( m_pszVCD && m_pszVCD[0] )
{
delete [] m_pszVCD;
m_pszVCD = NULL;
}
m_Animations.PurgeAndDeleteElements();
m_AttachedModelsInfo.PurgeAndDeleteElements();
}
public:
const char *m_pszModelName;
const char *m_pszModelName_HWM;
int m_nSkin;
const char *m_pszVCD;
Vector m_vecAbsAngles;
Vector m_vecOriginOffset;
Vector2D m_vecViewportOffset;
Vector m_vecFramedOriginOffset;
bool m_bUseSpotlight;
CUtlVector<CModelPanelModelAnimation*> m_Animations;
CUtlVector<CModelPanelAttachedModelInfo*> m_AttachedModelsInfo;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CModelPanel : public vgui::EditablePanel, public CGameEventListener
{
public:
DECLARE_CLASS_SIMPLE( CModelPanel, vgui::EditablePanel );
CModelPanel( vgui::Panel *parent, const char *name );
virtual ~CModelPanel();
virtual void Paint();
virtual void ApplySettings( KeyValues *inResourceData );
virtual void DeleteVCDData( void );
virtual void DeleteModelData( void );
virtual void SetFOV( int nFOV ){ m_nFOV = nFOV; }
virtual void SetPanelDirty( void ){ m_bPanelDirty = true; }
virtual bool SetSequence( const char *pszSequence );
MESSAGE_FUNC_PARAMS( OnAddAnimation, "AddAnimation", data );
MESSAGE_FUNC_PARAMS( OnSetAnimation, "SetAnimation", data );
void SetDefaultAnimation( const char *pszName );
void SwapModel( const char *pszName, const char *pszAttached = NULL );
virtual void ParseModelInfo( KeyValues *inResourceData );
void ClearAttachedModelInfos( void );
void CalculateFrameDistance( void );
void ZoomToFrameDistance( void );
public: // IGameEventListener:
virtual void FireGameEvent( IGameEvent * event );
protected:
virtual void SetupModel( void );
virtual void SetupVCD( void );
virtual const char *GetModelName( void );
private:
void InitCubeMaps();
int FindAnimByName( const char *pszName );
void CalculateFrameDistanceInternal( const model_t *pModel );
public:
int m_nFOV;
float m_flFrameDistance;
bool m_bStartFramed;
CModelPanelModelInfo *m_pModelInfo;
CHandle<CModelPanelModel> m_hModel;
CUtlVector<CHandle<C_BaseAnimating> > m_AttachedModels;
CHandle<C_SceneEntity> m_hScene;
private:
bool m_bPanelDirty;
int m_iDefaultAnimation;
bool m_bAllowOffscreen;
CTextureReference m_DefaultEnvCubemap;
CTextureReference m_DefaultHDREnvCubemap;
};
#endif // BASEMODELPANEL_H

View File

@ -8,6 +8,7 @@
#include "particles_simple.h"
#include "baseparticleentity.h"
#include "iefx.h"
#include "fx.h"
#include "decals.h"
#include "beamdraw.h"
#include "hud.h"

View File

@ -149,7 +149,7 @@ void C_NPC_Hydra::StandardBlendingRules( Vector pos[], Quaternion q[], float cu
{
VPROF( "C_NPC_Hydra::StandardBlendingRules" );
studiohdr_t *hdr = GetModelPtr();
const studiohdr_t *hdr = GetModelPtr()->GetRenderHdr();
if ( !hdr )
{
return;
@ -169,7 +169,7 @@ void C_NPC_Hydra::StandardBlendingRules( Vector pos[], Quaternion q[], float cu
{
poseparam[i] = 0;
}
CalcPose( hdr, NULL, pos, q, 0.0f, 0.0f, poseparam, BONE_USED_BY_ANYTHING );
CalcPose( GetModelPtr(), NULL, pos, q, 0.0f, 0.0f, poseparam, BONE_USED_BY_ANYTHING );
// allocate arrays
if (m_boneLength)

View File

@ -798,7 +798,7 @@ void C_HL2MPRagdoll::Interp_Copy( C_BaseAnimatingOverlay *pSourceEntity )
}
}
void C_HL2MPRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName )
void C_HL2MPRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName )
{
IPhysicsObject *pPhysicsObject = VPhysicsGetObject();

View File

@ -150,7 +150,7 @@ public:
int GetPlayerEntIndex() const;
IRagdoll* GetIRagdoll() const;
void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName );
void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName );
void UpdateOnRemove( void );
virtual void SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightCount, float *pFlexWeights, float *pFlexDelayedWeights );

View File

@ -534,7 +534,7 @@ void C_PhysPropClientside::Clone( Vector &velocity )
}
}
void C_PhysPropClientside::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName )
void C_PhysPropClientside::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName )
{
VPROF( "C_PhysPropClientside::ImpactTrace" );
IPhysicsObject *pPhysicsObject = VPhysicsGetObject();

View File

@ -32,7 +32,7 @@ public:
virtual CollideType_t GetCollideType( void ) { return ENTITY_SHOULD_RESPOND; }
virtual void StartTouch( C_BaseEntity *pOther );
virtual void HitSurface( C_BaseEntity *pOther );
virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName );
virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName );
virtual bool IsClientCreated( void ) const { return true; }
virtual int GetMultiplayerPhysicsMode() { return m_iPhysicsMode; }
virtual float GetMass();

View File

@ -88,7 +88,7 @@ public:
int GetPlayerEntIndex() const;
IRagdoll* GetIRagdoll() const;
void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName );
void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName );
private:
@ -151,7 +151,7 @@ void C_SDKRagdoll::Interp_Copy( C_BaseAnimatingOverlay *pSourceEntity )
}
}
void C_SDKRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName )
void C_SDKRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName )
{
IPhysicsObject *pPhysicsObject = VPhysicsGetObject();

View File

@ -1,36 +1,36 @@
//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============//
//
// Purpose: Game-specific impact effect hooks
//
//=============================================================================//
#include "cbase.h"
#include "fx.h"
#include "c_te_effect_dispatch.h"
#include "tier0/vprof.h"
#include "fx_line.h"
#include "fx_quad.h"
#include "view.h"
#include "particles_localspace.h"
#include "dlight.h"
#include "iefx.h"
#include "ClientEffectPrecacheSystem.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
extern Vector GetTracerOrigin( const CEffectData &data );
extern void FX_TracerSound( const Vector &start, const Vector &end, int iTracerType );
extern ConVar muzzleflash_light;
//-----------------------------------------------------------------------------
// Purpose: Gauss Gun's Tracer
//-----------------------------------------------------------------------------
void GaussTracerCallback( const CEffectData &data )
{
float flVelocity = data.m_flScale;
bool bWhiz = (data.m_fFlags & TRACER_FLAG_WHIZ);
FX_GaussTracer( (Vector&)data.m_vStart, (Vector&)data.m_vOrigin, flVelocity, bWhiz );
}
//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============//
//
// Purpose: Game-specific impact effect hooks
//
//=============================================================================//
#include "cbase.h"
#include "fx.h"
#include "c_te_effect_dispatch.h"
#include "tier0/vprof.h"
#include "fx_line.h"
#include "fx_quad.h"
#include "view.h"
#include "particles_localspace.h"
#include "dlight.h"
#include "iefx.h"
#include "ClientEffectPrecacheSystem.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
extern Vector GetTracerOrigin( const CEffectData &data );
extern void FX_TracerSound( const Vector &start, const Vector &end, int iTracerType );
extern ConVar muzzleflash_light;
//-----------------------------------------------------------------------------
// Purpose: Gauss Gun's Tracer
//-----------------------------------------------------------------------------
void GaussTracerCallback( const CEffectData &data )
{
float flVelocity = data.m_flScale;
bool bWhiz = (data.m_fFlags & TRACER_FLAG_WHIZ);
FX_GaussTracer( (Vector&)data.m_vStart, (Vector&)data.m_vOrigin, flVelocity, bWhiz );
}
DECLARE_CLIENT_EFFECT( "GaussTracer", GaussTracerCallback );

View File

@ -1185,7 +1185,7 @@ float CResponseSystem::ScoreCriteriaAgainstRuleCriteria( const AI_CriteriaSet& s
if ( verbose )
{
DevMsg( "matched, weight %4.2f (s %4.2f x c %4.2f)",
score, w, c->weight );
score, w, c->weight.GetFloat() );
}
}
else
@ -1574,7 +1574,7 @@ void CResponseSystem::DescribeResponseGroup( ResponseGroup *group, int selected,
i == selected ? "-> " : " ",
AI_Response::DescribeResponse( r->GetType() ),
r->value,
r->weight );
r->weight.GetFloat() );
}
}

View File

@ -42,4 +42,4 @@ private:
Vector m_axis;
};
#endif //CRAGDOLLMAGNET_H
#endif //CRAGDOLLMAGNET_H

View File

@ -881,7 +881,7 @@ bool IsListeningToCommentary( void )
void CPointCommentaryNode::Spawn( void )
{
// No model specified?
char *szModel = (char *)STRING( GetModelName() );
const char *szModel = (char *)STRING( GetModelName() );
if (!szModel || !*szModel)
{
szModel = "models/extras/info_speech.mdl";

View File

@ -124,7 +124,7 @@ void CEffectsServer::Smoke( const Vector &origin, int mModel, float flScale, flo
CPVSFilter filter( origin );
if ( !SuppressTE( filter ) )
{
te->Smoke( filter, 0.0, &origin, mModel, flScale * 0.1f, flFramerate );
te->Smoke( filter, 0.0, &origin, mModel, flScale * 0.1f, (int)flFramerate );
}
}

View File

@ -309,7 +309,7 @@ void CEntityFlame::FlameThink( void )
if( !m_hEntAttached->IsNPC() && hl2_episodic.GetBool() )
{
const float ENTITYFLAME_MOVE_AWAY_DIST = 24.0f;
const int ENTITYFLAME_MOVE_AWAY_DIST = 24;
// Make a sound near my origin, and up a little higher (in case I'm on the ground, so NPC's still hear it)
CSoundEnt::InsertSound( SOUND_MOVE_AWAY, GetAbsOrigin(), ENTITYFLAME_MOVE_AWAY_DIST, 0.1f, this, SOUNDENT_CHANNEL_REPEATED_DANGER );
CSoundEnt::InsertSound( SOUND_MOVE_AWAY, GetAbsOrigin() + Vector( 0, 0, 48.0f ), ENTITYFLAME_MOVE_AWAY_DIST, 0.1f, this, SOUNDENT_CHANNEL_REPEATING );

View File

@ -381,7 +381,7 @@ void CEnvBeam::Strike( void )
if ( pStart == NULL || pEnd == NULL )
return;
m_speed = clamp( m_speed, 0, MAX_BEAM_SCROLLSPEED );
m_speed = (int)clamp( m_speed, 0, MAX_BEAM_SCROLLSPEED );
int pointStart = IsStaticPointEntity( pStart );
int pointEnd = IsStaticPointEntity( pEnd );
@ -710,7 +710,7 @@ void CEnvBeam::BeamUpdateVars( void )
m_nNumBeamEnts = 2;
m_speed = clamp( m_speed, 0, MAX_BEAM_SCROLLSPEED );
m_speed = (int)clamp( m_speed, 0, MAX_BEAM_SCROLLSPEED );
// NOTE: If the end entity is the beam itself (and the start entity
// isn't *also* the beam itself, we've got problems. This is a problem

View File

@ -197,4 +197,4 @@ int CEnvFade::DrawDebugTextOverlays( void )
text_offset++;
}
return text_offset;
}
}

View File

@ -249,4 +249,4 @@ bool CEventLog::Init()
ListenForGameEvent( "player_connect" );
return true;
}
}

View File

@ -62,6 +62,7 @@ END_DATADESC()
//-----------------------------------------------------------------------------
// List of maps in HL2 that we must apply our skybox fog fixup hack to
//-----------------------------------------------------------------------------
#ifdef HL2_DLL
static const char *s_pBogusFogMaps[] =
{
"d1_canals_01",
@ -85,6 +86,7 @@ static const char *s_pBogusFogMaps[] =
"d3_citadel_01",
NULL
};
#endif
//-----------------------------------------------------------------------------
// Constructor, destructor
@ -135,10 +137,10 @@ void CSkyCamera::Activate( )
{
if ( !Q_stricmp( s_pBogusFogMaps[i], STRING(gpGlobals->mapname) ) )
{
m_skyboxData.fog.colorPrimary.SetR( ( m_skyboxData.fog.colorPrimary.GetR() + m_skyboxData.fog.colorSecondary.GetR() ) * 0.5f );
m_skyboxData.fog.colorPrimary.SetG( ( m_skyboxData.fog.colorPrimary.GetG() + m_skyboxData.fog.colorSecondary.GetG() ) * 0.5f );
m_skyboxData.fog.colorPrimary.SetB( ( m_skyboxData.fog.colorPrimary.GetB() + m_skyboxData.fog.colorSecondary.GetB() ) * 0.5f );
m_skyboxData.fog.colorPrimary.SetA( ( m_skyboxData.fog.colorPrimary.GetA() + m_skyboxData.fog.colorSecondary.GetA() ) * 0.5f );
m_skyboxData.fog.colorPrimary.SetR( (byte)(( m_skyboxData.fog.colorPrimary.GetR() + m_skyboxData.fog.colorSecondary.GetR() ) * 0.5f) );
m_skyboxData.fog.colorPrimary.SetG( (byte)(( m_skyboxData.fog.colorPrimary.GetG() + m_skyboxData.fog.colorSecondary.GetG() ) * 0.5f) );
m_skyboxData.fog.colorPrimary.SetB( (byte)(( m_skyboxData.fog.colorPrimary.GetB() + m_skyboxData.fog.colorSecondary.GetB() ) * 0.5f) );
m_skyboxData.fog.colorPrimary.SetA( (byte)(( m_skyboxData.fog.colorPrimary.GetA() + m_skyboxData.fog.colorSecondary.GetA() ) * 0.5f) );
m_skyboxData.fog.colorSecondary = m_skyboxData.fog.colorPrimary;
}
}

View File

@ -309,7 +309,7 @@ void Templates_StartUniqueInstance( void )
g_iCurrentTemplateInstance++;
// Make sure there's enough room to fit it into the string
int iMax = pow(10.0f, (int)((strlen(ENTITYIO_FIXUP_STRING) - 1))); // -1 for the &
int iMax = (int)pow(10.0f, (int)((strlen(ENTITYIO_FIXUP_STRING) - 1))); // -1 for the &
if ( g_iCurrentTemplateInstance >= iMax )
{
// We won't hit this.

View File

@ -675,6 +675,8 @@ bool CAI_BaseActor::CheckSceneEventCompletion( CSceneEventInfo *info, float curr
}
}
}
default:
break;
}
return BaseClass::CheckSceneEventCompletion( info, currenttime, scene, event );
@ -1784,6 +1786,8 @@ void CAI_BaseActor::PlayExpressionForState( NPC_STATE state )
SetExpression( STRING(m_iszDeathExpression) );
}
break;
default:
break;
}
}

View File

@ -81,11 +81,11 @@ public:
m_flBlinktime( 0 ),
m_hLookTarget( NULL ),
m_iszExpressionScene( NULL_STRING ),
m_iszExpressionOverride( NULL_STRING ),
m_iszIdleExpression( NULL_STRING ),
m_iszAlertExpression( NULL_STRING ),
m_iszCombatExpression( NULL_STRING ),
m_iszDeathExpression( NULL_STRING ),
m_iszExpressionOverride( NULL_STRING )
m_iszDeathExpression( NULL_STRING )
{
memset( m_flextarget, 0, 64 * sizeof( m_flextarget[0] ) );
}

View File

@ -171,8 +171,12 @@ extern ConVar ai_vehicle_avoidance;
#ifdef DEBUG_AI_FRAME_THINK_LIMITS
#define DbgFrameLimitMsg DevMsg
#else
#if defined __GNUC__ || (defined _MSC_VER && _MSC_VER >= 1400)
#define DbgFrameLimitMsg(...)
#else
#define DbgFrameLimitMsg (void)
#endif
#endif
// NPC damage adjusters
ConVar sk_npc_head( "sk_npc_head","2" );
@ -311,7 +315,7 @@ CJob *g_pQueuedNavigationQueryJob = NULL;
static void ProcessNavigationQueries( CFunctor **pData, unsigned int nCount )
{
// Run all queued navigation on a separate thread
for ( int i = 0; i < nCount; i++ )
for ( unsigned int i = 0; i < nCount; i++ )
{
(*pData[i])();
}
@ -1067,7 +1071,7 @@ void CAI_BaseNPC::DecalTrace( trace_t *pTrace, char const *decalName )
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CAI_BaseNPC::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName )
void CAI_BaseNPC::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName )
{
if ( m_fNoDamageDecal )
{
@ -1356,7 +1360,7 @@ class CTriggerTraceEnum : public IEntityEnumerator
{
public:
CTriggerTraceEnum( Ray_t *pRay, const CTakeDamageInfo &info, const Vector& dir, int contentsMask ) :
m_info( info ), m_VecDir(dir), m_ContentsMask(contentsMask), m_pRay(pRay)
m_VecDir(dir), m_ContentsMask(contentsMask), m_pRay(pRay), m_info( info )
{
}
@ -1537,12 +1541,12 @@ void CBaseEntity::CreateBubbleTrailTracer( const Vector &vecShotSrc, const Vecto
if ( flLengthSqr > SHOT_UNDERWATER_BUBBLE_DIST * SHOT_UNDERWATER_BUBBLE_DIST )
{
VectorMA( vecShotSrc, SHOT_UNDERWATER_BUBBLE_DIST, vecShotDir, vecBubbleEnd );
nBubbles = WATER_BULLET_BUBBLES_PER_INCH * SHOT_UNDERWATER_BUBBLE_DIST;
nBubbles = static_cast<int>(WATER_BULLET_BUBBLES_PER_INCH * SHOT_UNDERWATER_BUBBLE_DIST);
}
else
{
float flLength = sqrt(flLengthSqr) - 0.1f;
nBubbles = WATER_BULLET_BUBBLES_PER_INCH * flLength;
nBubbles = static_cast<int>(WATER_BULLET_BUBBLES_PER_INCH * flLength);
VectorMA( vecShotSrc, flLength, vecShotDir, vecBubbleEnd );
}
@ -2220,7 +2224,7 @@ CBaseGrenade* CAI_BaseNPC::IncomingGrenade(void)
continue;
// Check if it's near me
iDist = ( pBG->GetAbsOrigin() - GetAbsOrigin() ).Length();
iDist = (int)(pBG->GetAbsOrigin() - GetAbsOrigin()).Length();
if ( iDist <= NPC_GRENADE_FEAR_DIST )
return pBG;
@ -3320,7 +3324,7 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS )
int iPVSOffset = (bInPVS) ? 0 : NO_PVS_OFFSET;
int iMapping = iStateOffset + iPVSOffset + iFacingOffset + range;
Assert( iMapping < ARRAYSIZE( mappings ) );
Assert( iMapping < (int)ARRAYSIZE( mappings ) );
AI_Efficiency_t efficiency = mappings[iMapping];
@ -3602,7 +3606,7 @@ void CAI_BaseNPC::RebalanceThinks()
{
rebalanceCandidates.Sort( ThinkRebalanceCompare );
int iMaxThinkersPerTick = ceil( (float)( rebalanceCandidates.Count() + 1 ) / (float)iTicksPer10Hz ); // +1 to account for "this"
int iMaxThinkersPerTick = (int)ceil( (float)((rebalanceCandidates.Count() + 1) / iTicksPer10Hz) ); // +1 to account for "this"
int iCurTickDistributing = min( gpGlobals->tickcount, rebalanceCandidates[0].iNextThinkTick );
int iRemainingThinksToDistribute = iMaxThinkersPerTick - 1; // Start with one fewer first time because "this" is
@ -4376,6 +4380,8 @@ void CAI_BaseNPC::SetState( NPC_STATE State )
DevMsg( 2, "Stripped\n" );
}
break;
default:
break;
}
bool fNotifyChange = false;
@ -5074,6 +5080,8 @@ NPC_STATE CAI_BaseNPC::SelectIdealState( void )
m_pSquad->SquadNewEnemy( GetEnemy() );
}
break;
default:
break;
}
}
@ -5118,6 +5126,9 @@ NPC_STATE CAI_BaseNPC::SelectIdealState( void )
case NPC_STATE_DEAD:
return NPC_STATE_DEAD;
default:
break;
}
// The best ideal state is the current ideal state.
@ -5144,7 +5155,7 @@ void CAI_BaseNPC::GiveWeapon( string_t iszWeaponName )
// If I have a name, make my weapon match it with "_weapon" appended
if ( GetEntityName() != NULL_STRING )
{
pWeapon->SetName( AllocPooledString(UTIL_VarArgs("%s_weapon", GetEntityName())) );
pWeapon->SetName( AllocPooledString(UTIL_VarArgs("%s_weapon", STRING(GetEntityName()))) );
}
Weapon_Equip( pWeapon );
@ -6395,6 +6406,8 @@ bool CAI_BaseNPC::IsActivityMovementPhased( Activity activity )
case ACT_RUN_CROUCH_AIM:
case ACT_RUN_PROTECTED:
return true;
default:
break;
}
return false;
}
@ -6415,7 +6428,7 @@ void CAI_BaseNPC::OnChangeActivity( Activity eNewActivity )
//=========================================================
// SetSequenceByName
//=========================================================
void CAI_BaseNPC::SetSequenceByName( char *szSequence )
void CAI_BaseNPC::SetSequenceByName( const char *szSequence )
{
int iSequence = LookupSequence( szSequence );
@ -6853,7 +6866,7 @@ void CAI_BaseNPC::NPCInit ( void )
// If I have a name, make my weapon match it with "_weapon" appended
if ( GetEntityName() != NULL_STRING )
{
pWeapon->SetName( AllocPooledString(UTIL_VarArgs("%s_weapon", GetEntityName())) );
pWeapon->SetName( AllocPooledString(UTIL_VarArgs("%s_weapon", STRING(GetEntityName()))) );
}
if ( GetEffects() & EF_NOSHADOW )
@ -7776,7 +7789,7 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
DbgEnemyMsg( this, " (%s displaced)\n", pBestEnemy->GetDebugName() );
iBestPriority = IRelationPriority ( pEnemy );
iBestDistSq = (pEnemy->GetAbsOrigin() - GetAbsOrigin() ).LengthSqr();
iBestDistSq = (int)(pEnemy->GetAbsOrigin() - GetAbsOrigin()).LengthSqr();
pBestEnemy = pEnemy;
bBestUnreachable = bUnreachable;
fBestSeen = TRS_NONE;
@ -7792,7 +7805,7 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
// currently think is the best visible enemy. No need to do
// a distance check, just get mad at this one for now.
iBestPriority = IRelationPriority ( pEnemy );
iBestDistSq = ( pEnemy->GetAbsOrigin() - GetAbsOrigin() ).LengthSqr();
iBestDistSq = (int)(pEnemy->GetAbsOrigin() - GetAbsOrigin()).LengthSqr();
pBestEnemy = pEnemy;
bBestUnreachable = bUnreachable;
fBestSeen = TRS_NONE;
@ -7803,7 +7816,7 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
// this entity is disliked just as much as the entity that
// we currently think is the best visible enemy, so we only
// get mad at it if it is closer.
iDistSq = ( pEnemy->GetAbsOrigin() - GetAbsOrigin() ).LengthSqr();
iDistSq = (int)(pEnemy->GetAbsOrigin() - GetAbsOrigin()).LengthSqr();
bool bAcceptCurrent = false;
bool bCloser = ( ( iBestDistSq - iDistSq ) > EnemyDistTolerance() );
@ -7967,6 +7980,8 @@ Activity CAI_BaseNPC::GetReloadActivity( CAI_Hint* pHint )
}
break;
}
default:
break;
}
}
return nReloadActivity;
@ -7998,6 +8013,8 @@ Activity CAI_BaseNPC::GetCoverActivity( CAI_Hint *pHint )
nCoverActivity = ACT_COVER_LOW;
break;
}
default:
break;
}
}
@ -8014,7 +8031,7 @@ Activity CAI_BaseNPC::GetCoverActivity( CAI_Hint *pHint )
//=========================================================
float CAI_BaseNPC::CalcIdealYaw( const Vector &vecTarget )
{
Vector vecProjection;
Vector vecProjection = Vector(0.0f, 0.0f, 0.0f);
// strafing npc needs to face 90 degrees away from its goal
if ( GetNavigator()->GetMovementActivity() == ACT_STRAFE_LEFT )
@ -8789,9 +8806,9 @@ void CAI_BaseNPC::DrawDebugGeometryOverlays(void)
CBaseCombatCharacter *npcEnemy = (eMemory->hEnemy)->MyCombatCharacterPointer();
if (npcEnemy)
{
float r,g,b;
int r,g,b;
char debugText[255];
debugText[0] = NULL;
debugText[0] = '\0';
if (npcEnemy == GetEnemy())
{
@ -8983,7 +9000,7 @@ int CAI_BaseNPC::DrawDebugTextOverlays(void)
// Print State
// --------------
static const char *pStateNames[] = { "None", "Idle", "Alert", "Combat", "Scripted", "PlayDead", "Dead" };
if ( (int)m_NPCState < ARRAYSIZE(pStateNames) )
if ( (size_t)m_NPCState < ARRAYSIZE(pStateNames) )
{
Q_snprintf(tempstr,sizeof(tempstr),"Stat: %s, ", pStateNames[m_NPCState] );
EntityText(text_offset,tempstr,0);
@ -9005,7 +9022,7 @@ int CAI_BaseNPC::DrawDebugTextOverlays(void)
// -----------------
if( GetHintGroup() != NULL_STRING )
{
Q_snprintf(tempstr,sizeof(tempstr),"Hint Group: %s", GetHintGroup() );
Q_snprintf(tempstr,sizeof(tempstr),"Hint Group: %s", STRING(GetHintGroup()) );
EntityText(text_offset,tempstr,0);
text_offset++;
}
@ -9015,8 +9032,8 @@ int CAI_BaseNPC::DrawDebugTextOverlays(void)
// -----------------
int navTypeIndex = (int)GetNavType() + 1;
static const char *pMoveNames[] = { "None", "Ground", "Jump", "Fly", "Climb" };
Assert( navTypeIndex >= 0 && navTypeIndex < ARRAYSIZE(pMoveNames) );
if ( navTypeIndex < ARRAYSIZE(pMoveNames) )
Assert( navTypeIndex >= 0 && navTypeIndex < (int)ARRAYSIZE(pMoveNames) );
if ( navTypeIndex < (int)ARRAYSIZE(pMoveNames) )
{
Q_snprintf(tempstr,sizeof(tempstr),"Move: %s, ", pMoveNames[navTypeIndex] );
EntityText(text_offset,tempstr,0);
@ -9258,7 +9275,7 @@ void CAI_BaseNPC::ReportAIState( void )
static const char *pStateNames[] = { "None", "Idle", "Alert", "Combat", "Scripted", "PlayDead", "Dead" };
DevMsg( "%s: ", GetClassname() );
if ( (int)m_NPCState < ARRAYSIZE(pStateNames) )
if ( (size_t)m_NPCState < ARRAYSIZE(pStateNames) )
DevMsg( "State: %s, ", pStateNames[m_NPCState] );
if( m_Activity != ACT_INVALID && m_IdealActivity != ACT_INVALID )
@ -9773,7 +9790,7 @@ Vector CAI_BaseNPC::GetActualShootTrajectory( const Vector &shootOrigin )
return shotDir;
}
#endif HL2_DLL
#endif // HL2_DLL
//-----------------------------------------------------------------------------
@ -10336,7 +10353,7 @@ void CAI_BaseNPC::PickupWeapon( CBaseCombatWeapon *pWeapon )
//=========================================================
// DropItem - dead npc drops named item
//=========================================================
CBaseEntity *CAI_BaseNPC::DropItem ( char *pszItemName, Vector vecPos, QAngle vecAng )
CBaseEntity *CAI_BaseNPC::DropItem ( const char *pszItemName, Vector vecPos, QAngle vecAng )
{
if ( !pszItemName )
{
@ -10419,7 +10436,7 @@ bool CAI_BaseNPC::ShouldPlayIdleSound( void )
//-----------------------------------------------------------------------------
void CAI_BaseNPC::MakeAIFootstepSound( float volume, float duration )
{
CSoundEnt::InsertSound( SOUND_COMBAT, EyePosition(), volume, duration, this, SOUNDENT_CHANNEL_NPC_FOOTSTEP );
CSoundEnt::InsertSound( SOUND_COMBAT, EyePosition(), (int)volume, duration, this, SOUNDENT_CHANNEL_NPC_FOOTSTEP );
}
//-----------------------------------------------------------------------------
@ -10952,7 +10969,7 @@ int CAI_BaseNPC::Save( ISave &save )
{
const char *pszSchedule = m_pSchedule->GetName();
Assert( Q_strlen( pszSchedule ) < sizeof( saveHeader.szSchedule ) - 1 );
Assert( Q_strlen( pszSchedule ) < (int)sizeof( saveHeader.szSchedule ) - 1 );
Q_strncpy( saveHeader.szSchedule, pszSchedule, sizeof( saveHeader.szSchedule ) );
CRC32_Init( &saveHeader.scheduleCrc );
@ -10973,7 +10990,7 @@ int CAI_BaseNPC::Save( ISave &save )
if ( pIdealSchedule )
{
const char *pszIdealSchedule = pIdealSchedule->GetName();
Assert( Q_strlen( pszIdealSchedule ) < sizeof( saveHeader.szIdealSchedule ) - 1 );
Assert( Q_strlen( pszIdealSchedule ) < (int)sizeof( saveHeader.szIdealSchedule ) - 1 );
Q_strncpy( saveHeader.szIdealSchedule, pszIdealSchedule, sizeof( saveHeader.szIdealSchedule ) );
}
}
@ -10985,7 +11002,7 @@ int CAI_BaseNPC::Save( ISave &save )
if ( pFailSchedule )
{
const char *pszFailSchedule = pFailSchedule->GetName();
Assert( Q_strlen( pszFailSchedule ) < sizeof( saveHeader.szFailSchedule ) - 1 );
Assert( Q_strlen( pszFailSchedule ) < (int)sizeof( saveHeader.szFailSchedule ) - 1 );
Q_strncpy( saveHeader.szFailSchedule, pszFailSchedule, sizeof( saveHeader.szFailSchedule ) );
}
}
@ -10995,7 +11012,7 @@ int CAI_BaseNPC::Save( ISave &save )
const char *pszSequenceName = GetSequenceName( GetSequence() );
if ( pszSequenceName && *pszSequenceName )
{
Assert( Q_strlen( pszSequenceName ) < sizeof( saveHeader.szSequence ) - 1 );
Assert( Q_strlen( pszSequenceName ) < (int)sizeof( saveHeader.szSequence ) - 1 );
Q_strncpy( saveHeader.szSequence, pszSequenceName, sizeof(saveHeader.szSequence) );
}
}
@ -14015,6 +14032,8 @@ bool CAI_BaseNPC::IsCrouchedActivity( Activity activity )
case ACT_COVER_SMG1_LOW:
case ACT_RELOAD_SMG1_LOW:
return true;
default:
break;
}
return false;

View File

@ -931,7 +931,7 @@ public:
Activity GetIdealActivity( void ) { return m_IdealActivity; }
void SetIdealActivity( Activity NewActivity );
void ResetIdealActivity( Activity newIdealActivity );
void SetSequenceByName( char *szSequence );
void SetSequenceByName( const char *szSequence );
void SetSequenceById( int iSequence );
Activity GetScriptCustomMoveActivity( void );
int GetScriptCustomMoveSequence( void );
@ -1748,7 +1748,7 @@ public:
virtual float GetHitgroupDamageMultiplier( int iHitGroup, const CTakeDamageInfo &info );
void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr );
void DecalTrace( trace_t *pTrace, char const *decalName );
void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName );
void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName );
virtual bool PlayerInSpread( const Vector &sourcePos, const Vector &targetPos, float flSpread, float maxDistOffCenter, bool ignoreHatedPlayers = true );
CBaseEntity * PlayerInRange( const Vector &vecLocation, float flDist );
bool PointInSpread( CBaseCombatCharacter *pCheckEntity, const Vector &sourcePos, const Vector &targetPos, const Vector &testPoint, float flSpread, float maxDistOffCenter );
@ -1805,7 +1805,7 @@ public:
virtual void PickupWeapon( CBaseCombatWeapon *pWeapon );
virtual void PickupItem( CBaseEntity *pItem ) { };
CBaseEntity* DropItem( char *pszItemName, Vector vecPos, QAngle vecAng );// drop an item.
CBaseEntity* DropItem( const char *pszItemName, Vector vecPos, QAngle vecAng );// drop an item.
//---------------------------------
@ -2338,11 +2338,11 @@ typedef CHandle<CAI_BaseNPC> AIHANDLE;
#define DEFINE_SCHEDULE( id, text ) \
scheduleIds.PushBack( #id, id ); \
char * g_psz##id = \
"\n Schedule" \
"\n " #id \
text \
"\n"; \
const char * g_psz##id = \
"\n Schedule" \
"\n " #id \
text \
"\n"; \
schedulesToLoad.AddToTail( (char *)g_psz##id );
//-----------------

View File

@ -336,8 +336,6 @@ void CAI_BasePhysicsFlyingBot::TranslateNavGoal( CBaseEntity *pTarget, Vector &c
//-----------------------------------------------------------------------------
IMotionEvent::simresult_e CAI_BasePhysicsFlyingBot::Simulate( IPhysicsMotionController *pController, IPhysicsObject *pObject, float deltaTime, Vector &linear, AngularImpulse &angular )
{
static int count;
IPhysicsObject *pPhysicsObject = VPhysicsGetObject();
// Assert( pPhysicsObject );
if (!pPhysicsObject)

View File

@ -1254,7 +1254,7 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
{
if (!GetHintNode())
{
SetHintNode( CAI_HintManager::FindHint( this, HINT_NONE, pTask->flTaskData, 2000 ) );
SetHintNode( CAI_HintManager::FindHint( this, HINT_NONE, (int)pTask->flTaskData, 2000 ) );
}
if (GetHintNode())
{
@ -1452,7 +1452,7 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
break;
case TASK_SET_SCHEDULE:
if ( !SetSchedule( pTask->flTaskData ) )
if ( !SetSchedule( (int)pTask->flTaskData ) )
TaskFail(FAIL_SCHEDULE_NOT_FOUND);
break;
@ -2713,7 +2713,7 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
}
case TASK_SPEAK_SENTENCE:
{
SpeakSentence(pTask->flTaskData);
SpeakSentence((int)pTask->flTaskData);
TaskComplete();
break;
}
@ -3045,7 +3045,7 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
{
int iMinDist, iMaxDist, iParameter;
iParameter = pTask->flTaskData;
iParameter = (int)pTask->flTaskData;
iMinDist = iParameter / 10000;
iMaxDist = iParameter - (iMinDist * 10000);
@ -3584,6 +3584,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
{
case ACT_WALK_AIM: curActivity = ACT_WALK; break;
case ACT_RUN_AIM: curActivity = ACT_RUN; break;
default: break;
}
if ( curActivity != followActivity )

View File

@ -15,11 +15,15 @@
#include "networkvar.h"
#ifdef DEBUG
#ifdef _MSC_VER
#pragma warning(push)
#endif
#include <typeinfo>
#ifdef _MSC_VER
#pragma warning(pop)
#pragma warning(disable:4290)
#endif
#endif
#if defined( _WIN32 )
#pragma once
@ -274,28 +278,28 @@ public:
{
if ( condition >= ID_SPACE_OFFSET && condition < ID_SPACE_OFFSET + 10000 ) // it's local to us
condition = GetClassScheduleIdSpace()->ConditionLocalToGlobal( condition );
GetOuter()->SetCondition( condition );
CAI_ComponentWithOuter<NPC_CLASS, CAI_BehaviorBase>::GetOuter()->SetCondition( condition );
}
bool HasCondition( int condition )
{
if ( condition >= ID_SPACE_OFFSET && condition < ID_SPACE_OFFSET + 10000 ) // it's local to us
condition = GetClassScheduleIdSpace()->ConditionLocalToGlobal( condition );
return GetOuter()->HasCondition( condition );
return CAI_ComponentWithOuter<NPC_CLASS, CAI_BehaviorBase>::GetOuter()->HasCondition( condition );
}
bool HasInterruptCondition( int condition )
{
if ( condition >= ID_SPACE_OFFSET && condition < ID_SPACE_OFFSET + 10000 ) // it's local to us
condition = GetClassScheduleIdSpace()->ConditionLocalToGlobal( condition );
return GetOuter()->HasInterruptCondition( condition );
return CAI_ComponentWithOuter<NPC_CLASS, CAI_BehaviorBase>::GetOuter()->HasInterruptCondition( condition );
}
void ClearCondition( int condition )
{
if ( condition >= ID_SPACE_OFFSET && condition < ID_SPACE_OFFSET + 10000 ) // it's local to us
condition = GetClassScheduleIdSpace()->ConditionLocalToGlobal( condition );
GetOuter()->ClearCondition( condition );
CAI_ComponentWithOuter<NPC_CLASS, CAI_BehaviorBase>::GetOuter()->ClearCondition( condition );
}
protected:
@ -310,7 +314,7 @@ protected:
}
virtual CAI_ClassScheduleIdSpace *GetClassScheduleIdSpace()
{
return GetOuter()->GetClassScheduleIdSpace();
return CAI_ComponentWithOuter<NPC_CLASS, CAI_BehaviorBase>::GetOuter()->GetClassScheduleIdSpace();
}
static CAI_ClassScheduleIdSpace &AccessClassScheduleIdSpaceDirect()
@ -1041,7 +1045,7 @@ inline void CAI_BehaviorHost<BASE_NPC>::ChangeBehaviorTo( CAI_BehaviorBase *pNew
if ( pOldBehavior )
{
pOldBehavior->EndScheduleSelection();
VacateStrategySlot();
this->VacateStrategySlot();
}
OnChangeRunningBehavior( pOldBehavior, pNewBehavior );

View File

@ -350,7 +350,7 @@ void CAI_AssaultBehavior::ClearAssaultPoint( void )
}
else
{
DevMsg("**ERROR: Can't find next assault point: %s\n", m_hAssaultPoint->m_NextAssaultPointName );
DevMsg("**ERROR: Can't find next assault point: %s\n", STRING(m_hAssaultPoint->m_NextAssaultPointName) );
// Bomb out of assault behavior.
m_AssaultCue = CUE_NO_ASSAULT;
@ -1112,6 +1112,9 @@ bool CAI_AssaultBehavior::PollAssaultCue( void )
// Player told me to go, so go!
return m_ReceivedAssaultCue == CUE_COMMANDER;
break;
default:
break;
}
return false;

View File

@ -2542,7 +2542,7 @@ AI_FollowFormation_t *AIGetFormation( AI_Formations_t formation )
{
if ( formation < 0 )
formation = (AI_Formations_t)0;
else if ( formation >= ARRAYSIZE( g_AI_Formations ) )
else if ( (size_t)formation >= ARRAYSIZE( g_AI_Formations ) )
formation = (AI_Formations_t)(ARRAYSIZE( g_AI_Formations ) - 1 );
return g_AI_Formations[formation];

View File

@ -268,7 +268,7 @@ bool CAI_LeadBehavior::GetClosestPointOnRoute( const Vector &targetPos, Vector *
float flNearestDist = 999999999;
float flPathDist, flPathDist2D;
Vector vecNearestPoint;
Vector vecNearestPoint = Vector(0.0f, 0.0f, 0.0f);
Vector vecPrevPos = GetOuter()->GetAbsOrigin();
for ( ; (waypoint != NULL) ; waypoint = waypoint->GetNext() )
{
@ -934,6 +934,7 @@ void CAI_LeadBehavior::RunTask( const Task_t *pTask )
{
case ACT_WALK_AIM: curActivity = ACT_WALK; break;
case ACT_RUN_AIM: curActivity = ACT_RUN; break;
default: break;
}
if ( curActivity != followActivity )

View File

@ -62,9 +62,9 @@ END_DATADESC();
// Constructor
//-----------------------------------------------------------------------------
CAI_PassengerBehavior::CAI_PassengerBehavior( void ) :
m_bEnabled( false ),
m_hVehicle( NULL ),
m_PassengerState( PASSENGER_STATE_OUTSIDE ),
m_PassengerState( PASSENGER_STATE_OUTSIDE ),
m_hVehicle( NULL ),
m_bEnabled( false ),
m_PassengerIntent( PASSENGER_INTENT_NONE ),
m_nTransitionSequence( -1 )
{
@ -231,7 +231,7 @@ void CAI_PassengerBehavior::InitVehicleState( void )
m_vehicleState.m_flNextWarningTime = gpGlobals->curtime;
m_vehicleState.m_vecLastAngles = m_hVehicle->GetAbsAngles();
Vector localVelocity;
Vector localVelocity(0.0f, 0.0f, 0.0f);
GetLocalVehicleVelocity( &m_vehicleState.m_vecLastLocalVelocity );
m_vehicleState.m_flLastSpeedSqr = localVelocity.LengthSqr();

View File

@ -53,14 +53,14 @@ void CRopeAnchor::Spawn()
BaseClass::Spawn();
// Decent enough default in case something happens to our owner!
float flDist = 384;
float flDist = 384.0f;
if( GetOwnerEntity() )
{
flDist = fabs( GetOwnerEntity()->GetAbsOrigin().z - GetAbsOrigin().z );
}
m_hRope = CRopeKeyframe::CreateWithSecondPointDetached( this, -1, flDist, RAPPEL_ROPE_WIDTH, "cable/cable.vmt", 5, true );
m_hRope = CRopeKeyframe::CreateWithSecondPointDetached( this, -1, (int)flDist, RAPPEL_ROPE_WIDTH, "cable/cable.vmt", 5, true );
ASSERT( m_hRope != NULL );
@ -355,7 +355,7 @@ void CAI_RappelBehavior::BeginRappel()
Vector forward;
GetOuter()->GetVectors( &forward, NULL, NULL );
CSoundEnt::InsertSound( SOUND_DANGER, tr.m_pEnt->EarPosition() - forward * 12.0f, 32.0f, 0.2f, GetOuter() );
CSoundEnt::InsertSound( SOUND_DANGER, tr.m_pEnt->EarPosition() - forward * 12.0f, 32, 0.2f, GetOuter() );
}
}

View File

@ -1110,7 +1110,7 @@ void CAI_MappedActivityBehavior_Temporary::UpdateTranslateActivityMap()
CBaseCombatWeapon *pWeapon = GetOuter()->GetActiveWeapon();
const char *pszWeaponClass = ( pWeapon ) ? pWeapon->GetClassname() : "";
for ( int i = 0; i < ARRAYSIZE(mappings); i++ )
for ( size_t i = 0; i < ARRAYSIZE(mappings); i++ )
{
if ( !mappings[i].pszWeapon || stricmp( mappings[i].pszWeapon, pszWeaponClass ) == 0 )
{

View File

@ -974,7 +974,7 @@ int CAI_BlendedMotor::BuildInsertNode( int i, float flTime )
Assert( flTime > 0.0 );
for (i; i < m_scriptTurn.Count() - 1; i++)
for (; i < m_scriptTurn.Count() - 1; i++)
{
if (m_scriptTurn[i].flTime < flTime)
{
@ -1223,6 +1223,8 @@ void CAI_BlendedMotor::BuildVelocityScript( const AILocalMoveGoal_t &move )
script.flMaxVelocity = 0;
break;
*/
default:
break;
}
}
else

View File

@ -214,8 +214,8 @@ class CAI_BlendingHost : public BASE_NPC
{
DECLARE_CLASS_NOFRIEND( CAI_BlendingHost, BASE_NPC );
public:
const CAI_BlendedMotor *GetBlendedMotor() const { return assert_cast<const CAI_BlendedMotor *>(GetMotor()); }
CAI_BlendedMotor * GetBlendedMotor() { return assert_cast<CAI_BlendedMotor *>(GetMotor()); }
const CAI_BlendedMotor *GetBlendedMotor() const { return assert_cast<const CAI_BlendedMotor *>(this->GetMotor()); }
CAI_BlendedMotor * GetBlendedMotor() { return assert_cast<CAI_BlendedMotor *>(this->GetMotor()); }
CAI_Motor *CreateMotor()
{
@ -232,7 +232,7 @@ public:
float MaxYawSpeed( void )
{
float override = GetBlendedMotor()->OverrideMaxYawSpeed( GetActivity() );
float override = GetBlendedMotor()->OverrideMaxYawSpeed( this->GetActivity() );
if ( override != -1 )
return override;
return BaseClass::MaxYawSpeed();

View File

@ -331,6 +331,8 @@ int CAI_BaseNPC::TranslateSchedule( int scheduleType )
return SCHED_ALERT_WALK;
case NPC_STATE_COMBAT:
return SCHED_COMBAT_WALK;
default:
break;
}
}
break;

View File

@ -122,4 +122,4 @@ public:
DECLARE_DATADESC();
};
#endif // AI_DYNAMICLINK_H
#endif // AI_DYNAMICLINK_H

View File

@ -45,4 +45,4 @@ private:
CNPCEventResponseSystem *NPCEventResponse();
#endif // AI_EVENTRESPONSE_H
#endif // AI_EVENTRESPONSE_H

View File

@ -311,7 +311,7 @@ int CAI_HintManager::FindAllHints( CAI_BaseNPC *pNPC, const Vector &position, co
// If we have no hints, bail
int c = CAI_HintManager::gm_AllHints.Count();
if ( !c )
return NULL;
return 0;
// Remove the nearest flag. It makes now sense with random.
bool hadNearest = hintCriteria.HasFlag( bits_HINT_NODE_NEAREST );
@ -684,7 +684,7 @@ int CAI_HintManager::GetFlags( const char *token )
char *lowercase = (char *)_alloca( len + 1 );
Q_strncpy( lowercase, token, len+1 );
strlwr( lowercase );
Q_strlower( lowercase );
if ( strstr( "none", lowercase ) )
{
@ -1038,6 +1038,8 @@ bool CAI_Hint::IsViewable(void)
case HINT_WORLD_VISUALLY_INTERESTING_DONT_AIM:
case HINT_WORLD_VISUALLY_INTERESTING_STEALTH:
return true;
default:
break;
}
return false;
@ -1625,7 +1627,7 @@ hinttypedescs_t g_pszHintDescriptions[] =
//-----------------------------------------------------------------------------
const char *GetHintTypeDescription( Hint_e iHintType )
{
for ( int i = 0; i < ARRAYSIZE(g_pszHintDescriptions); i++ )
for ( size_t i = 0; i < ARRAYSIZE(g_pszHintDescriptions); i++ )
{
if ( g_pszHintDescriptions[i].iType == iHintType )
return g_pszHintDescriptions[i].pszDesc;
@ -1655,7 +1657,7 @@ void CC_ai_drop_hint( const CCommand &args )
{
Msg("Invalid hint type specified. Format: ai_drop_hint <hint type>\nValid hint types:\n");
for ( int i = 0; i < ARRAYSIZE(g_pszHintDescriptions); i++ )
for ( size_t i = 0; i < ARRAYSIZE(g_pszHintDescriptions); i++ )
{
Msg("%d : %s\n", g_pszHintDescriptions[i].iType, g_pszHintDescriptions[i].pszDesc );
}

View File

@ -201,6 +201,7 @@ public:
CAIHintVector &operator=( const CAIHintVector &src )
{
CopyArray( src.Base(), src.Count() );
return *this;
}
};

View File

@ -11,7 +11,7 @@
struct ai_hull_t
{
ai_hull_t( int bit, const char *pName, const Vector &_mins, const Vector &_maxs, const Vector &_smallMins, const Vector &_smallMaxs )
: hullBit( bit ), mins( _mins ), maxs( _maxs ), smallMins( _smallMins ), smallMaxs( _smallMaxs ), name( pName ) {}
: hullBit( bit ), name( pName ), mins( _mins ), maxs( _maxs ), smallMins( _smallMins ), smallMaxs( _smallMaxs ) {}
int hullBit;
const char* name;

View File

@ -72,4 +72,4 @@ namespace NAI_Hull
Hull_t LookupId(const char *szName);
};
#endif // AI_HULL_H
#endif // AI_HULL_H

View File

@ -44,4 +44,4 @@ private:
float m_flMaxDist;
};
#endif//AI_LOOKTARGET_H
#endif//AI_LOOKTARGET_H

View File

@ -34,14 +34,18 @@ void DebugNoteMovementFailure()
}
// a place to put breakpoints
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4189)
#endif
AIMoveResult_t DbgResult( AIMoveResult_t result )
{
#ifdef _MSC_VER
if ( result < AIMR_OK )
{
int breakHere = 1;
//int breakHere = 1;
}
#endif
switch ( result )
{
@ -747,10 +751,11 @@ void CAI_Motor::UpdateYaw( int yawSpeed )
GetOuter()->SetUpdatedYaw();
float yaw = static_cast<float>(yawSpeed);
float ideal, current, newYaw;
if ( yawSpeed == -1 )
yawSpeed = GetYawSpeed();
if ( yaw == -1.0f )
yaw = GetYawSpeed();
// NOTE: GetIdealYaw() will never exactly be reached because UTIL_AngleMod
// also truncates the angle to 16 bits of resolution. So lets truncate it here.
@ -760,7 +765,7 @@ void CAI_Motor::UpdateYaw( int yawSpeed )
// FIXME: this needs a proper interval
float dt = min( 0.2, gpGlobals->curtime - GetLastThink() );
newYaw = AI_ClampYaw( (float)yawSpeed * 10.0, current, ideal, dt );
newYaw = AI_ClampYaw( yaw * 10.0f, current, ideal, dt );
if (newYaw != current)
{
@ -908,7 +913,7 @@ AIMoveResult_t CAI_Motor::MoveNormalExecute( const AILocalMoveGoal_t &move )
AIMR_BLOCKED_WORLD, // AIM_PARTIAL_HIT_WORLD
AIMR_BLOCKED_WORLD, // AIM_PARTIAL_HIT_TARGET
};
Assert( ARRAYSIZE( moveResults ) == AIM_NUM_RESULTS && fMotorResult >= 0 && fMotorResult <= ARRAYSIZE( moveResults ) );
Assert( (AIMotorMoveResult_t)ARRAYSIZE( moveResults ) == AIM_NUM_RESULTS && fMotorResult >= 0 && fMotorResult <= (AIMotorMoveResult_t)ARRAYSIZE( moveResults ) );
AIMoveResult_t result = moveResults[fMotorResult];

View File

@ -138,6 +138,8 @@ void CAI_MoveAndShootOverlay::UpdateMoveShootActivity( bool bMoveAimAtEnemy )
case ACT_RUN:
newActivity = ACT_RUN_AIM;
break;
default:
break;
}
}
else
@ -150,6 +152,8 @@ void CAI_MoveAndShootOverlay::UpdateMoveShootActivity( bool bMoveAimAtEnemy )
case ACT_RUN_AIM:
newActivity = ACT_RUN;
break;
default:
break;
}
}

View File

@ -114,7 +114,7 @@ bool CAI_MoveSolver::Solve( const AI_MoveSuggestion_t *pSuggestions, int nSugges
AI_MoveSuggestion_t *pHighSuggestion;
};
Solution_t solutions[NUM_SOLUTIONS] = { 0 };
Solution_t solutions[NUM_SOLUTIONS] = { {0.0f, 0.0f, NULL} };
//---------------------------------
@ -133,15 +133,15 @@ bool CAI_MoveSolver::Solve( const AI_MoveSuggestion_t *pSuggestions, int nSugges
// Convert arc values to solution indices relative to right post. Right is angle down, left is angle up.
float halfSpan = current.arc.span * 0.5;
int center = round( ( halfSpan * NUM_SOLUTIONS ) / 360 );
int left = ( current.arc.span * NUM_SOLUTIONS ) / 360;
int center = (int)round( ( halfSpan * NUM_SOLUTIONS ) / 360 );
int left = (int)( (current.arc.span * NUM_SOLUTIONS) / 360 );
float angRight = current.arc.center - halfSpan;
if (angRight < 0.0)
angRight += 360;
int base = ( angRight * NUM_SOLUTIONS ) / 360;
int base = (int)( (angRight * NUM_SOLUTIONS) / 360 );
// Sweep from left to right, summing the bias. For positive suggestions,
// the bias is further weighted to favor the center of the arc.

View File

@ -90,12 +90,12 @@ int CAI_GlobalNamespace::NextGlobalBase() const
//
CAI_LocalIdSpace::CAI_LocalIdSpace( bool fIsRoot )
: m_pGlobalNamespace( NULL ),
m_pParentIDSpace( NULL ),
m_globalBase( (fIsRoot) ? 0 : -1 ),
: m_globalBase( (fIsRoot) ? 0 : -1 ),
m_localBase( (fIsRoot) ? 0 : MAX_STRING_INDEX ),
m_localTop( -1 ),
m_globalTop( -1 )
m_globalTop( -1 ),
m_pParentIDSpace( NULL ),
m_pGlobalNamespace( NULL )
{
};

View File

@ -1221,7 +1221,6 @@ float CAI_Navigator::GetPathTimeToGoal()
AI_PathNode_t CAI_Navigator::GetNearestNode()
{
COMPILE_TIME_ASSERT( (int)AIN_NO_NODE == NO_NODE );
return (AI_PathNode_t)( GetPathfinder()->NearestNodeToNPC() );
}
@ -2325,6 +2324,9 @@ bool CAI_Navigator::PreMove()
GetMotor()->MoveJumpStop();
break;
}
default:
break;
}
SetNavType( NAV_GROUND );
@ -2530,6 +2532,8 @@ bool CAI_Navigator::Move( float flInterval )
case NAV_FLY:
OnMoveBlocked( &moveResult );
break;
default:
break;
}
break;
}
@ -3819,6 +3823,9 @@ bool CAI_Navigator::DoFindPath( void )
}
}
break;
default:
break;
}
return returnCode;
@ -4131,18 +4138,18 @@ void CAI_Navigator::DrawDebugRouteOverlay(void)
if (waypoint)
{
Vector RGB = GetRouteColor(waypoint->NavType(), waypoint->Flags());
NDebugOverlay::Line(GetLocalOrigin(), waypoint->GetPos(), RGB[0],RGB[1],RGB[2], true,0);
NDebugOverlay::Line(GetLocalOrigin(), waypoint->GetPos(), (int)RGB[0], (int)RGB[1], (int)RGB[2], true,0);
}
while (waypoint)
{
Vector RGB = GetWaypointColor(waypoint->NavType());
NDebugOverlay::Box(waypoint->GetPos(), Vector(-3,-3,-3),Vector(3,3,3), RGB[0],RGB[1],RGB[2], true,0);
NDebugOverlay::Box(waypoint->GetPos(), Vector(-3,-3,-3), Vector(3,3,3), (int)RGB[0], (int)RGB[1], (int)RGB[2], true, 0);
if (waypoint->GetNext())
{
Vector RGB = GetRouteColor(waypoint->GetNext()->NavType(), waypoint->GetNext()->Flags());
NDebugOverlay::Line(waypoint->GetPos(), waypoint->GetNext()->GetPos(),RGB[0],RGB[1],RGB[2], true,0);
NDebugOverlay::Line(waypoint->GetPos(), waypoint->GetNext()->GetPos(), (int)RGB[0], (int)RGB[1], (int)RGB[2], true, 0);
}
waypoint = waypoint->GetNext();
}

View File

@ -663,12 +663,12 @@ inline AI_NavGoal_t::AI_NavGoal_t( GoalType_t type,
dest(AIN_NO_DEST),
destNode(AIN_NO_NODE),
activity(activity),
arrivalActivity( AIN_DEF_ACTIVITY ),
arrivalSequence( ACT_INVALID ),
tolerance(tolerance),
maxInitialSimplificationDist(-1),
flags(flags),
pTarget(pTarget),
arrivalActivity( AIN_DEF_ACTIVITY ),
arrivalSequence( ACT_INVALID )
pTarget(pTarget)
{
}
@ -681,12 +681,12 @@ inline AI_NavGoal_t::AI_NavGoal_t( const Vector &dest,
dest(dest),
destNode(AIN_NO_NODE),
activity(activity),
arrivalActivity( AIN_DEF_ACTIVITY ),
arrivalSequence( ACT_INVALID ),
tolerance(tolerance),
maxInitialSimplificationDist(-1),
flags(flags),
pTarget(pTarget),
arrivalActivity( AIN_DEF_ACTIVITY ),
arrivalSequence( ACT_INVALID )
pTarget(pTarget)
{
}
@ -700,12 +700,12 @@ inline AI_NavGoal_t::AI_NavGoal_t( GoalType_t type,
dest(dest),
destNode(AIN_NO_NODE),
activity(activity),
arrivalActivity( AIN_DEF_ACTIVITY ),
arrivalSequence( ACT_INVALID ),
tolerance(tolerance),
maxInitialSimplificationDist(-1),
flags(flags),
pTarget(pTarget),
arrivalActivity( AIN_DEF_ACTIVITY ),
arrivalSequence( ACT_INVALID )
pTarget(pTarget)
{
}
@ -718,12 +718,12 @@ inline AI_NavGoal_t::AI_NavGoal_t( AI_PathNode_t destNode,
dest(AIN_NO_DEST),
destNode(destNode),
activity(activity),
arrivalActivity( AIN_DEF_ACTIVITY ),
arrivalSequence( ACT_INVALID ),
tolerance(tolerance),
maxInitialSimplificationDist(-1),
flags(flags),
pTarget(pTarget),
arrivalActivity( AIN_DEF_ACTIVITY ),
arrivalSequence( ACT_INVALID )
pTarget(pTarget)
{
}
@ -737,12 +737,12 @@ inline AI_NavGoal_t::AI_NavGoal_t( GoalType_t type,
dest(AIN_NO_DEST),
destNode(destNode),
activity(activity),
arrivalActivity( AIN_DEF_ACTIVITY ),
arrivalSequence( ACT_INVALID ),
tolerance(tolerance),
maxInitialSimplificationDist(-1),
flags(flags),
pTarget(pTarget),
arrivalActivity( AIN_DEF_ACTIVITY ),
arrivalSequence( ACT_INVALID )
pTarget(pTarget)
{
}

View File

@ -47,13 +47,13 @@ public:
class CNodeFilter : public INodeListFilter
{
public:
CNodeFilter( CAI_BaseNPC *pNPC, const Vector &pos ) : m_pNPC(pNPC), m_pos(pos)
CNodeFilter( CAI_BaseNPC *pNPC, const Vector &pos ) : m_pos(pos), m_pNPC(pNPC)
{
if ( m_pNPC )
m_capabilities = m_pNPC->CapabilitiesGet();
}
CNodeFilter( const Vector &pos ) : m_pNPC(NULL), m_pos(pos)
CNodeFilter( const Vector &pos ) : m_pos(pos), m_pNPC(NULL)
{
}

View File

@ -2414,7 +2414,7 @@ void CAI_NetworkBuilder::InitClimbNodePosition(CAI_Network *pNetwork, CAI_Node *
{
float floorZ = GetFloorZ(origin); // FIXME: don't use this
if (abs(pNode->GetOrigin().z - floorZ) < 36)
if (fabs(pNode->GetOrigin().z - floorZ) < 36.0f)
{
CAI_Node *new_node = pNetwork->AddNode( pNode->GetOrigin(), pNode->m_flYaw );
new_node->m_pHint = NULL;

View File

@ -1514,7 +1514,7 @@ AI_Waypoint_t *CAI_Pathfinder::BuildRadialRoute( const Vector &vStartPos, const
vNextPos.y += flRadius * sin( flCurAngle );
// Build a route from the last position to the current one
pNextRoute = BuildLocalRoute( vLastPos, vNextPos, NULL, NULL, NO_NODE, fRouteBits, goalTolerance);
pNextRoute = BuildLocalRoute( vLastPos, vNextPos, NULL, 0, NO_NODE, fRouteBits, goalTolerance);
// If we can't find a route, we failed
if ( pNextRoute == NULL )
@ -1547,7 +1547,7 @@ AI_Waypoint_t *CAI_Pathfinder::BuildRadialRoute( const Vector &vStartPos, const
return NULL;
// Append a path to the final position
pLastRoute = BuildLocalRoute( vLastPos, vGoalPos, NULL, NULL, NO_NODE, bAirRoute ? bits_BUILD_FLY : bits_BUILD_GROUND, goalTolerance );
pLastRoute = BuildLocalRoute( vLastPos, vGoalPos, NULL, 0, NO_NODE, bAirRoute ? bits_BUILD_FLY : bits_BUILD_GROUND, goalTolerance );
if ( pLastRoute == NULL )
return NULL;
@ -1687,7 +1687,7 @@ public:
m_moveTypes( buildFlags & ( bits_BUILD_GROUND | bits_BUILD_FLY | bits_BUILD_JUMP | bits_BUILD_CLIMB ) ),
m_pRoute( NULL )
{
COMPILE_TIME_ASSERT( bits_BUILD_GROUND == bits_CAP_MOVE_GROUND && bits_BUILD_FLY == bits_CAP_MOVE_FLY && bits_BUILD_JUMP == bits_CAP_MOVE_JUMP && bits_BUILD_CLIMB == bits_CAP_MOVE_CLIMB );
COMPILE_TIME_ASSERT( (int)bits_BUILD_GROUND == (int)bits_CAP_MOVE_GROUND && (int)bits_BUILD_FLY == (int)bits_CAP_MOVE_FLY && (int)bits_BUILD_JUMP == (int)bits_CAP_MOVE_JUMP && (int)bits_BUILD_CLIMB == (int)bits_CAP_MOVE_CLIMB );
}
bool IsValid( CAI_Node *pNode )
@ -2098,9 +2098,9 @@ void CAI_Pathfinder::CTriDebugOverlay::FadeTriOverlayLines(void)
{
for (int i=0;i<NUM_NPC_DEBUG_OVERLAYS;i++)
{
m_debugTriOverlayLine[i]->r *= 0.5;
m_debugTriOverlayLine[i]->g *= 0.5;
m_debugTriOverlayLine[i]->b *= 0.5;
m_debugTriOverlayLine[i]->r = static_cast<int>(m_debugTriOverlayLine[i]->r * 0.5);
m_debugTriOverlayLine[i]->g = static_cast<int>(m_debugTriOverlayLine[i]->g * 0.5);
m_debugTriOverlayLine[i]->b = static_cast<int>(m_debugTriOverlayLine[i]->b * 0.5);
}
}
}

View File

@ -54,8 +54,8 @@ inline float cube( float f )
CAI_PlaneSolver::CAI_PlaneSolver( CAI_BaseNPC *pNpc )
: m_pNpc( pNpc ),
m_fSolvedPrev( false ),
m_PrevTarget( FLT_MAX, FLT_MAX, FLT_MAX ),
m_fSolvedPrev( false ),
m_PrevSolution( 0 ),
m_ClosestHaveBeenToCurrent( FLT_MAX ),
m_TimeLastProgress( FLT_MAX ),

View File

@ -135,10 +135,10 @@ private:
struct CircleObstacles_t
{
CircleObstacles_t( const Vector &center, float radius, CBaseEntity *pEntity, AI_MoveSuggType_t type )
: center(center),
radius(radius),
hEntity(pEntity),
type(type)
: center(center),
radius(radius),
type(type),
hEntity(pEntity)
{
}

View File

@ -141,7 +141,7 @@ public:
CConceptInfoMap() :
CUtlMap<AIConcept_t, ConceptInfo_t *>( CaselessStringLessThan )
{
for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ )
for ( size_t i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ )
{
Insert( g_ConceptInfos[i].concept, &g_ConceptInfos[i] );
}
@ -165,7 +165,7 @@ CAI_AllySpeechManager::~CAI_AllySpeechManager()
void CAI_AllySpeechManager::Spawn()
{
Assert( g_ConceptInfoMap.Count() != 0 );
for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ )
for ( size_t i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ )
m_ConceptTimers.Insert( AllocPooledString( g_ConceptInfos[i].concept ), CSimpleSimTimer() );
}
@ -1536,7 +1536,7 @@ bool CAI_PlayerAlly::ShouldSpeakRandom( AIConcept_t concept, int iChance )
if ( flModifier < 0.001 )
return false;
iChance = floor( (float)iChance / flModifier );
iChance = (int)floor( iChance / flModifier );
}
}

View File

@ -14,6 +14,7 @@
#include "ai_speechfilter.h"
#ifndef _WIN32
#undef min
#undef max
#endif
#include "stdstring.h"
#ifndef _WIN32

View File

@ -239,7 +239,7 @@ bool CAI_SchedulesManager::LoadSchedulesFromBuffer( const char *prefix, char *pS
int taskNum = 0;
pfile = engine->ParseFile(pfile, token, sizeof( token ) );
while ((token[0]!=NULL) && (stricmp("Interrupts",token)))
while ((token[0] != '\0') && (stricmp("Interrupts", token)))
{
// Convert generic ID to sub-class specific enum
int taskID = CAI_BaseNPC::GetTaskID(token);
@ -477,7 +477,7 @@ bool CAI_SchedulesManager::LoadSchedulesFromBuffer( const char *prefix, char *pS
// Now read in the interrupts
// ==========================
pfile = engine->ParseFile(pfile, token, sizeof( token ) );
while ((token[0]!=NULL) && (stricmp("Schedule",token)))
while ((token[0] != '\0') && (stricmp("Schedule", token)))
{
// Convert generic ID to sub-class specific enum
int condID = CAI_BaseNPC::GetConditionID(token);

View File

@ -197,4 +197,4 @@ private:
//-----------------------------------------------------------------------------
#endif // AI_SCHEDULE_H
#endif // AI_SCHEDULE_H

View File

@ -104,9 +104,9 @@ public:
m_flPlayerTargetFOV( 0 ),
m_fPlayerTargetLOS( TRS_NONE ),
m_fPlayerBlockingActor( TRS_NONE ),
m_fActorInPVS( TRS_NONE ),
m_flMinTimeout( 0 ),
m_flMaxTimeout( 0 ),
m_fActorInPVS( TRS_NONE ),
m_fActorInVehicle( TRS_NONE ),
m_fPlayerInVehicle( TRS_NONE )
{
@ -253,4 +253,4 @@ private:
//=============================================================================
#endif // AI_SCRIPTCONDITIONS_H
#endif // AI_SCRIPTCONDITIONS_H

View File

@ -41,8 +41,7 @@ CAI_SensedObjectsManager g_AI_SensedObjectsManager;
//-----------------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
#pragma pack(push, 1)
struct AISightIterVal_t
{
@ -254,7 +253,7 @@ CBaseEntity *CAI_Senses::GetFirstSeenEntity( AISightIter_t *pIter, seentype_t iS
pIterVal->SeenArray = (char)iSeenType;
int iFirstArray = ( iSeenType == SEEN_ALL ) ? 0 : iSeenType;
for ( int i = iFirstArray; i < ARRAYSIZE( m_SeenArrays ); i++ )
for ( int i = iFirstArray; i < (int)ARRAYSIZE( m_SeenArrays ); i++ )
{
if ( m_SeenArrays[i]->Count() != 0 )
{
@ -276,7 +275,7 @@ CBaseEntity *CAI_Senses::GetNextSeenEntity( AISightIter_t *pIter ) const
{
AISightIterVal_t *pIterVal = (AISightIterVal_t *)pIter;
for ( int i = pIterVal->array; i < ARRAYSIZE( m_SeenArrays ); i++ )
for ( int i = pIterVal->array; i < (int)ARRAYSIZE( m_SeenArrays ); i++ )
{
for ( int j = pIterVal->iNext; j < m_SeenArrays[i]->Count(); j++ )
{
@ -654,7 +653,7 @@ void CAI_Senses::PerformSensing( void )
// Look
// -----------------
if( !HasSensingFlags(SENSING_FLAGS_DONT_LOOK) )
Look( m_LookDist );
Look( static_cast<int>(m_LookDist) );
// ------------------
// Listen

View File

@ -212,12 +212,12 @@ static int g_nExpressers;
#endif
CAI_Expresser::CAI_Expresser( CBaseFlex *pOuter )
: m_pOuter( pOuter ),
m_pSink( NULL ),
: m_pSink( NULL ),
m_flStopTalkTime( 0 ),
m_flBlockedTalkTime( 0 ),
m_flStopTalkTimeWithoutDelay( 0 ),
m_voicePitch( 100 )
m_flBlockedTalkTime( 0 ),
m_voicePitch( 100 ),
m_pOuter( pOuter )
{
#ifdef DEBUG
g_nExpressers++;
@ -467,7 +467,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res
if ( spoke )
{
m_flLastTimeAcceptedSpeak = gpGlobals->curtime;
if ( DebuggingSpeech() && g_pDeveloper->GetInt() > 0 && response && result->GetType() != RESPONSE_PRINT )
if ( DebuggingSpeech() && g_pDeveloper->GetInt() > 0 && response[0] != '\0' && result->GetType() != RESPONSE_PRINT )
{
Vector vPrintPos;
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
@ -900,7 +900,7 @@ void CAI_ExpresserHost_NPC_DoModifyOrAppendCriteria( CAI_BaseNPC *pSpeaker, AI_C
}
static const char *pStateNames[] = { "None", "Idle", "Alert", "Combat", "Scripted", "PlayDead", "Dead" };
if ( (int)pSpeaker->m_NPCState < ARRAYSIZE(pStateNames) )
if ( (int)pSpeaker->m_NPCState < (int)ARRAYSIZE(pStateNames) )
{
set.AppendCriteria( "npcstate", UTIL_VarArgs( "[NPCState::%s]", pStateNames[pSpeaker->m_NPCState] ) );
}
@ -1023,4 +1023,4 @@ void CMultiplayer_Expresser::AllowMultipleScenes()
void CMultiplayer_Expresser::DisallowMultipleScenes()
{
m_bAllowMultipleScenes = false;
}
}

View File

@ -288,15 +288,15 @@ public:
virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; }
float GetResponseDuration( AI_Response *response );
float GetTimeSpeechComplete() const { return GetExpresser()->GetTimeSpeechComplete(); }
float GetTimeSpeechComplete() const { return this->GetExpresser()->GetTimeSpeechComplete(); }
bool IsSpeaking() { return GetExpresser()->IsSpeaking(); }
bool CanSpeak() { return GetExpresser()->CanSpeak(); }
bool CanSpeakAfterMyself() { return GetExpresser()->CanSpeakAfterMyself(); }
bool IsSpeaking() { return this->GetExpresser()->IsSpeaking(); }
bool CanSpeak() { return this->GetExpresser()->CanSpeak(); }
bool CanSpeakAfterMyself() { return this->GetExpresser()->CanSpeakAfterMyself(); }
void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true ) { GetExpresser()->SetSpokeConcept( concept, response, bCallback ); }
float GetTimeSpokeConcept( AIConcept_t concept ) { return GetExpresser()->GetTimeSpokeConcept( concept ); }
bool SpokeConcept( AIConcept_t concept ) { return GetExpresser()->SpokeConcept( concept ); }
void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true ) { this->GetExpresser()->SetSpokeConcept( concept, response, bCallback ); }
float GetTimeSpokeConcept( AIConcept_t concept ) { return this->GetExpresser()->GetTimeSpokeConcept( concept ); }
bool SpokeConcept( AIConcept_t concept ) { return this->GetExpresser()->SpokeConcept( concept ); }
protected:
int PlaySentence( const char *pszSentence, float delay, float volume = VOL_NORM, soundlevel_t soundlevel = SNDLVL_TALKING, CBaseEntity *pListener = NULL );
@ -312,7 +312,7 @@ protected:
template <class BASE_NPC>
inline void CAI_ExpresserHost<BASE_NPC>::NoteSpeaking( float duration, float delay )
{
GetExpresser()->NoteSpeaking( duration, delay );
this->GetExpresser()->NoteSpeaking( duration, delay );
}
//-----------------------------------------------------------------------------
@ -320,8 +320,8 @@ inline void CAI_ExpresserHost<BASE_NPC>::NoteSpeaking( float duration, float del
template <class BASE_NPC>
inline bool CAI_ExpresserHost<BASE_NPC>::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
{
AssertOnce( GetExpresser()->GetOuter() == this );
return GetExpresser()->Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter );
AssertOnce( this->GetExpresser()->GetOuter() == this );
return this->GetExpresser()->Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter );
}
//-----------------------------------------------------------------------------
@ -329,7 +329,7 @@ inline bool CAI_ExpresserHost<BASE_NPC>::Speak( AIConcept_t concept, const char
template <class BASE_NPC>
inline int CAI_ExpresserHost<BASE_NPC>::PlaySentence( const char *pszSentence, float delay, float volume, soundlevel_t soundlevel, CBaseEntity *pListener )
{
return GetExpresser()->SpeakRawSentence( pszSentence, delay, volume, soundlevel, pListener );
return this->GetExpresser()->SpeakRawSentence( pszSentence, delay, volume, soundlevel, pListener );
}
//-----------------------------------------------------------------------------
@ -341,9 +341,9 @@ inline void CAI_ExpresserHost<BASE_NPC>::ModifyOrAppendCriteria( AI_CriteriaSet&
{
BaseClass::ModifyOrAppendCriteria( criteriaSet );
if ( MyNPCPointer() )
if ( this->MyNPCPointer() )
{
CAI_ExpresserHost_NPC_DoModifyOrAppendCriteria( MyNPCPointer(), criteriaSet );
CAI_ExpresserHost_NPC_DoModifyOrAppendCriteria( this->MyNPCPointer(), criteriaSet );
}
}
@ -362,7 +362,7 @@ inline IResponseSystem *CAI_ExpresserHost<BASE_NPC>::GetResponseSystem()
template <class BASE_NPC>
inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ )
{
return GetExpresser()->SpeakFindResponse( concept, modifiers );
return this->GetExpresser()->SpeakFindResponse( concept, modifiers );
}
//-----------------------------------------------------------------------------
@ -370,7 +370,7 @@ inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t
template <class BASE_NPC>
inline bool CAI_ExpresserHost<BASE_NPC>::SpeakDispatchResponse( AIConcept_t concept, AI_Response *response )
{
if ( GetExpresser()->SpeakDispatchResponse( concept, response ) )
if ( this->GetExpresser()->SpeakDispatchResponse( concept, response ) )
{
PostSpeakDispatchResponse( concept, response );
return true;
@ -384,7 +384,7 @@ inline bool CAI_ExpresserHost<BASE_NPC>::SpeakDispatchResponse( AIConcept_t conc
template <class BASE_NPC>
inline float CAI_ExpresserHost<BASE_NPC>::GetResponseDuration( AI_Response *response )
{
return GetExpresser()->GetResponseDuration( response );
return this->GetExpresser()->GetResponseDuration( response );
}
//-----------------------------------------------------------------------------

View File

@ -263,7 +263,7 @@ void CAI_Squad::AddToSquad(CAI_BaseNPC *pNPC)
if (m_SquadMembers.Count() == MAX_SQUAD_MEMBERS)
{
DevMsg("Error!! Squad %s is too big!!! Replacing last member\n",this->m_Name);
DevMsg("Error!! Squad %s is too big!!! Replacing last member\n", STRING(this->m_Name));
m_SquadMembers.Remove(m_SquadMembers.Count()-1);
}
m_SquadMembers.AddToTail(pNPC);

View File

@ -748,7 +748,7 @@ bool CAI_TacticalServices::FindLateralLos( const Vector &vecThreat, Vector *pRes
int iDelta = COVER_DELTA;
// If we're limited in how far we're allowed to move laterally, don't bother checking past it
int iMaxLateralDelta = GetOuter()->GetMaxTacticalLateralMovement();
int iMaxLateralDelta = (int)GetOuter()->GetMaxTacticalLateralMovement();
if ( iMaxLateralDelta != MAXTACLAT_IGNORE && iMaxLateralDelta < iDelta )
{
iChecks = 1;

View File

@ -805,7 +805,7 @@ CPathTrack *CAI_TrackPather::FindClosestPointOnPath( CPathTrack *pPath,
float flPathDist, flPathDist2D;
// NOTE: Gotta do it this crazy way because paths can be one-way.
Vector vecNearestPoint;
Vector vecNearestPoint = Vector(0.0f, 0.0f, 0.0f);
Vector vecNearestPathSegment;
for ( int i = 0; i < 2; ++i )
{

View File

@ -530,7 +530,7 @@ void CBaseAnimating::SetLightingOriginRelative( string_t strLightingOriginRelati
{
if( !pLightingOrigin )
{
DevWarning( "%s: Cannot find Lighting Origin named: %s\n", GetEntityName().ToCStr(), strLightingOriginRelative );
DevWarning( "%s: Cannot find Lighting Origin named: %s\n", GetEntityName().ToCStr(), STRING(strLightingOriginRelative) );
}
else
{
@ -2527,7 +2527,7 @@ void CBaseAnimating::LockStudioHdr()
if ( pStudioHdrContainer && pStudioHdrContainer->GetVirtualModel() )
{
MDLHandle_t hVirtualModel = (MDLHandle_t)pStudioHdrContainer->GetRenderHdr()->virtualModel;
MDLHandle_t hVirtualModel = (MDLHandle_t)reinterpret_cast<intptr_t>(pStudioHdrContainer->GetRenderHdr()->virtualModel);
mdlcache->LockStudioHdr( hVirtualModel );
}
m_pStudioHdr = pStudioHdrContainer; // must be last to ensure virtual model correctly set up
@ -2545,7 +2545,7 @@ void CBaseAnimating::UnlockStudioHdr()
mdlcache->UnlockStudioHdr( modelinfo->GetCacheHandle( mdl ) );
if ( m_pStudioHdr->GetVirtualModel() )
{
MDLHandle_t hVirtualModel = (MDLHandle_t)m_pStudioHdr->GetRenderHdr()->virtualModel;
MDLHandle_t hVirtualModel = (MDLHandle_t)reinterpret_cast<intptr_t>(m_pStudioHdr->GetRenderHdr()->virtualModel);
mdlcache->UnlockStudioHdr( hVirtualModel );
}
}

View File

@ -20,7 +20,7 @@
#include "ndebugoverlay.h"
#include "te_effect_dispatch.h"
#include "rumble_shared.h"
#include "gamestats.h"
#include "GameStats.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

View File

@ -54,4 +54,4 @@ private:
Activity ChooseIntersectionPointAndActivity( trace_t &hitTrace, const Vector &mins, const Vector &maxs, CBasePlayer *pOwner );
};
#endif
#endif

View File

@ -1522,8 +1522,6 @@ Killed
*/
void CBaseCombatCharacter::Event_Killed( const CTakeDamageInfo &info )
{
extern ConVar npc_vphysics;
// Advance life state to dying
m_lifeState = LIFE_DYING;
@ -3076,7 +3074,7 @@ void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrc, float flRa
// be less than 128 units.
float soundRadius = max( 128.0f, flRadius * 1.5 );
CSoundEnt::InsertSound( SOUND_COMBAT | SOUND_CONTEXT_EXPLOSION, vecSrc, soundRadius, 0.25, info.GetInflictor() );
CSoundEnt::InsertSound( SOUND_COMBAT | SOUND_CONTEXT_EXPLOSION, vecSrc, (int)soundRadius, 0.25, info.GetInflictor() );
}
}

View File

@ -228,7 +228,7 @@ class CWeaponLOSFilter : public CTraceFilterSkipTwoEntities
{
DECLARE_CLASS( CWeaponLOSFilter, CTraceFilterSkipTwoEntities );
public:
CWeaponLOSFilter::CWeaponLOSFilter( IHandleEntity *pHandleEntity, IHandleEntity *pHandleEntity2, int collisionGroup ) :
CWeaponLOSFilter( IHandleEntity *pHandleEntity, IHandleEntity *pHandleEntity2, int collisionGroup ) :
CTraceFilterSkipTwoEntities( pHandleEntity, pHandleEntity2, collisionGroup ), m_pVehicle( NULL )
{
// If the tracing entity is in a vehicle, then ignore it

View File

@ -563,8 +563,8 @@ void CBaseEntity::AddTimedOverlay( const char *msg, int endTime )
int len = strlen(msg);
pNewTO->msg = new char[len + 1];
Q_strncpy(pNewTO->msg,msg, len+1);
pNewTO->msgEndTime = gpGlobals->curtime + endTime;
pNewTO->msgStartTime = gpGlobals->curtime;
pNewTO->msgEndTime = (int)gpGlobals->curtime + endTime;
pNewTO->msgStartTime = (int)gpGlobals->curtime;
pNewTO->pNextTimedOverlay = m_pTimedOverlay;
m_pTimedOverlay = pNewTO;
}
@ -705,7 +705,7 @@ void CBaseEntity::DrawTimedOverlays(void)
// If messages aren't paused fade out
if (!CBaseEntity::Debug_IsPaused())
{
nAlpha = 255*((gpGlobals->curtime - pTO->msgStartTime)/(pTO->msgEndTime - pTO->msgStartTime));
nAlpha = (int)(255*((gpGlobals->curtime - pTO->msgStartTime)/(pTO->msgEndTime - pTO->msgStartTime)));
}
int r = 185;
int g = 145;
@ -864,7 +864,7 @@ int CBaseEntity::DrawDebugTextOverlays(void)
if( m_iGlobalname != NULL_STRING )
{
Q_snprintf( tempstr, sizeof(tempstr), "GLOBALNAME: %s", m_iGlobalname );
Q_snprintf( tempstr, sizeof(tempstr), "GLOBALNAME: %s", STRING(m_iGlobalname) );
EntityText(offset,tempstr, 0);
offset++;
}
@ -3577,7 +3577,7 @@ void CBaseEntity::DrawInputOverlay(const char *szInputName, CBaseEntity *pCaller
{
Q_snprintf( bigstring,sizeof(bigstring), "%3.1f (%s) <-- (%s)\n", gpGlobals->curtime, szInputName, pCaller ? pCaller->GetDebugName() : NULL);
}
AddTimedOverlay(bigstring, 10.0);
AddTimedOverlay(bigstring, 10);
if ( Value.FieldType() == FIELD_INTEGER )
{
@ -3608,7 +3608,7 @@ void CBaseEntity::DrawOutputOverlay(CEventAction *ev)
{
Q_snprintf( bigstring,sizeof(bigstring), "%3.1f (%s) --> (%s)\n", gpGlobals->curtime, STRING(ev->m_iTargetInput), STRING(ev->m_iTarget));
}
AddTimedOverlay(bigstring, 10.0);
AddTimedOverlay(bigstring, 10);
// Now print to the console
if ( ev->m_flDelay )
@ -4649,7 +4649,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex )
char token[256];
const char *pOptions = pEvent->pszOptions();
nexttoken( token, pOptions, ' ' );
if ( token )
if ( token[0] != '\0' )
{
PrecacheParticleSystem( token );
}
@ -5106,6 +5106,8 @@ void CC_Ent_Dump( const CCommand& args )
}
}
break;
default:
break;
}
// don't print out the duplicate keys
@ -6924,8 +6926,8 @@ void CBaseEntity::SUB_PerformFadeOut( void )
dt = 0.1f;
}
m_nRenderMode = kRenderTransTexture;
int speed = max(1,256*dt); // fade out over 1 second
SetRenderColorA( UTIL_Approach( 0, m_clrRender->a, speed ) );
int speed = (int)max(1,256*dt); // fade out over 1 second
SetRenderColorA( (byte)UTIL_Approach( 0, m_clrRender->a, speed ) );
}
bool CBaseEntity::SUB_AllowedToFade( void )

View File

@ -909,7 +909,7 @@ public:
bool IsWorld() { return entindex() == 0; }
virtual char const *DamageDecal( int bitsDamageType, int gameMaterial );
virtual void DecalTrace( trace_t *pTrace, char const *decalName );
virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName = NULL );
virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName = NULL );
void AddPoints( int score, bool bAllowNegativeScore );
void AddPointsToTeam( int score, bool bAllowNegativeScore );
@ -1061,23 +1061,23 @@ public:
#ifdef _DEBUG
void FunctionCheck( void *pFunction, const char *name );
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name )
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name )
{
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
COMPILE_TIME_ASSERT( sizeof(func) == MFP_SIZE );
m_pfnTouch = func;
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnTouch)), name );
return func;
}
USEPTR UseSet( USEPTR func, char *name )
USEPTR UseSet( USEPTR func, const char *name )
{
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
COMPILE_TIME_ASSERT( sizeof(func) == MFP_SIZE );
m_pfnUse = func;
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnUse)), name );
return func;
}
ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, char *name )
ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, const char *name )
{
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
COMPILE_TIME_ASSERT( sizeof(func) == MFP_SIZE );
m_pfnBlocked = func;
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnBlocked)), name );
return func;

View File

@ -62,9 +62,9 @@ IMPLEMENT_SERVERCLASS_ST(CBaseFlex, DT_BaseFlex)
SendPropInt (SENDINFO(m_blinktoggle), 1, SPROP_UNSIGNED ),
SendPropVector (SENDINFO(m_viewtarget), -1, SPROP_COORD),
#ifdef HL2_DLL
SendPropFloat ( SENDINFO_VECTORELEM(m_vecViewOffset, 0), 0, SPROP_NOSCALE ),
SendPropFloat ( SENDINFO_VECTORELEM(m_vecViewOffset, 1), 0, SPROP_NOSCALE ),
SendPropFloat ( SENDINFO_VECTORELEM(m_vecViewOffset, 2), 0, SPROP_NOSCALE ),
SendPropFloat ( SENDINFO_VECTORELEM2(m_vecViewOffset, 0, x), 0, SPROP_NOSCALE ),
SendPropFloat ( SENDINFO_VECTORELEM2(m_vecViewOffset, 1, y), 0, SPROP_NOSCALE ),
SendPropFloat ( SENDINFO_VECTORELEM2(m_vecViewOffset, 2, z), 0, SPROP_NOSCALE ),
SendPropVector ( SENDINFO(m_vecLean), -1, SPROP_COORD ),
SendPropVector ( SENDINFO(m_vecShift), -1, SPROP_COORD ),
@ -383,6 +383,8 @@ bool CBaseFlex::ClearSceneEvent( CSceneEventInfo *info, bool fastKill, bool canc
}
}
return true;
default:
break;
}
return false;
}
@ -669,7 +671,7 @@ bool CBaseFlex::HandleStartGestureSceneEvent( CSceneEventInfo *info, CChoreoScen
if ( looping )
{
DevMsg( 1, "vcd error, gesture %s of model %s is marked as STUDIO_LOOPING!\n",
event->GetParameters(), GetModelName() );
event->GetParameters(), STRING(GetModelName()) );
}
SetLayerLooping( info->m_iLayer, false ); // force to not loop
@ -765,6 +767,9 @@ bool CBaseFlex::StartSceneEvent( CSceneEventInfo *info, CChoreoScene *scene, CCh
case CChoreoEvent::EXPRESSION: // These are handled client-side
return true;
default:
break;
}
return false;

View File

@ -47,7 +47,7 @@ void CBaseGrenadeConcussion::FallThink(void)
Remove( );
return;
}
CSoundEnt::InsertSound ( SOUND_DANGER, GetAbsOrigin() + GetAbsVelocity() * 0.5, GetAbsVelocity().Length( ), 0.2 );
CSoundEnt::InsertSound ( SOUND_DANGER, GetAbsOrigin() + GetAbsVelocity() * 0.5, (int)GetAbsVelocity().Length(), 0.2 );
SetNextThink( gpGlobals->curtime + random->RandomFloat(0.05, 0.1) );

View File

@ -329,4 +329,4 @@ uint64 CBaseMultiplayerPlayer::GetSteamIDAsUInt64( void )
return steamIDForPlayer.ConvertToUint64();
return 0;
}
#endif // NO_STEAM
#endif // NO_STEAM

View File

@ -121,4 +121,4 @@ inline CBaseMultiplayerPlayer *ToBaseMultiplayerPlayer( CBaseEntity *pEntity )
#endif
}
#endif // BASEMULTIPLAYERPLAYER_H
#endif // BASEMULTIPLAYERPLAYER_H

View File

@ -62,4 +62,4 @@ private:
static CBaseTempEntity *s_pTempEntities;
};
#endif // BASETEMPENTITY_H
#endif // BASETEMPENTITY_H

View File

@ -14,4 +14,4 @@
#include "baseviewmodel_shared.h"
#endif // BASEVIEWMODEL_H
#endif // BASEVIEWMODEL_H

View File

@ -804,7 +804,7 @@ void CFuncRotating::RampPitchVol( void )
float fpitch = FANPITCHMIN + (FANPITCHMAX - FANPITCHMIN) * fpct;
int pitch = clamp(fpitch, 0, 255);
int pitch = (int)clamp(fpitch, 0, 255);
if (pitch == PITCH_NORM)
{
pitch = PITCH_NORM - 1;

View File

@ -143,19 +143,19 @@ bool CBaseButton::KeyValue( const char *szKeyName, const char *szValue )
{
if (FStrEq(szKeyName, "locked_sound"))
{
m_bLockedSound = atof(szValue);
m_bLockedSound = atoi(szValue);
}
else if (FStrEq(szKeyName, "locked_sentence"))
{
m_bLockedSentence = atof(szValue);
m_bLockedSentence = atoi(szValue);
}
else if (FStrEq(szKeyName, "unlocked_sound"))
{
m_bUnlockedSound = atof(szValue);
m_bUnlockedSound = atoi(szValue);
}
else if (FStrEq(szKeyName, "unlocked_sentence"))
{
m_bUnlockedSentence = atof(szValue);
m_bUnlockedSentence = atoi(szValue);
}
else
{
@ -802,7 +802,7 @@ int CBaseButton::DrawDebugTextOverlays()
if (m_debugOverlays & OVERLAY_TEXT_BIT)
{
static char *pszStates[] =
static const char *pszStates[] =
{
"Pressed",
"Unpressed",
@ -1584,4 +1584,4 @@ void CMomentaryRotButton::Enable( void )
void CMomentaryRotButton::Disable( void )
{
m_bDisabled = true;
}
}

View File

@ -1222,6 +1222,7 @@ void variant_t::SetOther( void *data )
case FIELD_EHANDLE: *((EHANDLE *)data) = eVal; break;
case FIELD_CLASSPTR: *((CBaseEntity **)data) = eVal; break;
default: break;
}
}
@ -1274,8 +1275,14 @@ bool variant_t::Convert( fieldtype_t newType )
SetBool( iVal != 0 );
return true;
}
default:
break;
}
break;
default:
break;
}
case FIELD_FLOAT:
@ -1293,6 +1300,9 @@ bool variant_t::Convert( fieldtype_t newType )
SetBool( flVal != 0 );
return true;
}
default:
break;
}
break;
}
@ -1380,6 +1390,9 @@ bool variant_t::Convert( fieldtype_t newType )
SetEntity( ent );
return true;
}
default:
break;
}
break;
@ -1399,6 +1412,9 @@ bool variant_t::Convert( fieldtype_t newType )
}
return true;
}
default:
break;
}
break;
}
@ -1479,6 +1495,9 @@ const char *variant_t::ToString( void ) const
Q_strncpy( szBuf, pszName, 512 );
return (szBuf);
}
default:
break;
}
return("No conversion to string");

View File

@ -912,7 +912,7 @@ void CC_Player_TestDispatchEffect( const CCommand &args )
AngleVectors( vecAngles, &data.m_vNormal );
}
data.m_nEntIndex = pPlayer->entindex();
data.m_fFlags = flags;
data.m_fFlags = (int)flags;
data.m_flMagnitude = magnitude;
data.m_flScale = scale;
DispatchEffect( (char *)args[1], data );
@ -1306,6 +1306,7 @@ void CC_HurtMe_f(const CCommand &args)
static ConCommand hurtme("hurtme", CC_HurtMe_f, "Hurts the player.\n\tArguments: <health to lose>", FCVAR_CHEAT);
#ifdef _DEBUG
static bool IsInGroundList( CBaseEntity *ent, CBaseEntity *ground )
{
if ( !ground || !ent )
@ -1327,6 +1328,7 @@ static bool IsInGroundList( CBaseEntity *ent, CBaseEntity *ground )
return false;
}
#endif
static int DescribeGroundList( CBaseEntity *ent )
{

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