Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ waf3*/
.vscode/
.depproj/
source-engine.sln
hl2/
out/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "lib"]
path = lib
url = https://github.com/nillerusr/source-engine-libs.git
[submodule "vscript/squirrel"]
path = vscript/squirrel
url = https://github.com/albertodemichelis/squirrel
99 changes: 99 additions & 0 deletions fgdlib/gamedata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include "filesystem_tools.h"
#include "tier1/strtools.h"
#include "utlmap.h"
#ifdef MAPBASE
#include "fmtstr.h"
#endif // MAPBASE

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
Expand Down Expand Up @@ -579,13 +582,47 @@ GDclass *GameData::BeginInstanceRemap( const char *pszClassName, const char *psz
return m_InstanceClass;
}

#ifdef MAPBASE
//-----------------------------------------------------------------------------
// Purpose: Sets up for additional instance remap fixes from Mapbase
//-----------------------------------------------------------------------------
void GameData::SetupInstanceRemapParams( int iStartNodes, int iStartBrushSide, bool bRemapVecLines )
{
// Set the numer of nodes in the level
m_InstanceStartAINodes = iStartNodes;

// If we have a "nodeid" key, set it to ivNodeDest so it's properly recognized
// during AI node remapping
GDinputvariable *var = m_InstanceClass->VarForName( "nodeid" );
if ( var )
{
var->ForceSetType( ivNodeDest );
}

//---------------------------------------------

// Set the number of brush sides in the level
m_InstanceStartSide = iStartBrushSide;

//---------------------------------------------

m_bRemapVecLines = bRemapVecLines;
}
#endif // MAPBASE

enum tRemapOperation
{
REMAP_NAME = 0,
REMAP_POSITION,
REMAP_ANGLE,
REMAP_ANGLE_NEGATIVE_PITCH,
#ifdef MAPBASE
// Remaps the node ID for instance/manifest AI node support
REMAP_NODE_ID,

// Remaps brush sides and sidelists
REMAP_SIDES,
#endif // MAPBASE
};


Expand Down Expand Up @@ -624,6 +661,12 @@ bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *
RemapOperation.Insert( ivOrigin, REMAP_POSITION );
RemapOperation.Insert( ivAxis, REMAP_ANGLE );
RemapOperation.Insert( ivAngleNegativePitch, REMAP_ANGLE_NEGATIVE_PITCH );
#ifdef MAPBASE
RemapOperation.Insert( ivNodeDest, REMAP_NODE_ID );
RemapOperation.Insert( ivSide, REMAP_SIDES );
RemapOperation.Insert( ivSideList, REMAP_SIDES );
RemapOperation.Insert( ivVecLine, REMAP_POSITION );
#endif // MAPBASE
}

if ( !m_InstanceClass )
Expand Down Expand Up @@ -657,6 +700,11 @@ bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *

case REMAP_POSITION:
{
#ifdef MAPBASE
// Only remap ivVecLine if the keyvalue is enabled
if (KVType == ivVecLine && !m_bRemapVecLines)
break;
#endif // MAPBASE
Vector inPoint( 0.0f, 0.0f, 0.0f ), outPoint;

sscanf ( pszInValue, "%f %f %f", &inPoint.x, &inPoint.y, &inPoint.z );
Expand Down Expand Up @@ -697,6 +745,53 @@ bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *
sprintf( pszOutValue, "%g", -outAngles.x ); // just the pitch
}
break;
#ifdef MAPBASE
case REMAP_NODE_ID:
{
int value = atoi( pszInValue );
if (value == -1)
break;

//Warning( " %s %s: Remapped %i to %i", m_InstanceClass->GetName(), KVVar->GetName(), value, value + m_InstanceStartAINodes );

value += m_InstanceStartAINodes;

sprintf( pszOutValue, "%i", value );
}
break;

case REMAP_SIDES:
{
CUtlStringList sideList;
V_SplitString( pszInValue, " ", sideList );

// Convert sides
CUtlStringList newSideList;
for (int i = 0; i < sideList.Count(); i++)
{
int iSide = atoi( sideList[i] );

//Warning( " %s %s: Remapped %i to %i", m_InstanceClass->GetName(), KVVar->GetName(), iSide, iSide + m_InstanceStartSide );

iSide += m_InstanceStartSide;

newSideList.AddToTail( const_cast<char*>( CNumStr( iSide ).String() ) );
}

// Initial side
strcpy( pszOutValue, newSideList[0] );

// Start at 1 for subsequent sides
for (int i = 1; i < newSideList.Count(); i++)
{
// Any subsequent sides are spaced
sprintf( pszOutValue, "%s %s", pszOutValue, newSideList[i] );
}

//Warning("Old side list: \"%s\", new side list: \"%s\"\n", pszInValue, pszOutValue);
}
break;
#endif // MAPBASE
}

return ( strcmpi( pszInValue, pszOutValue ) != 0 );
Expand All @@ -713,7 +808,11 @@ bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *
//-----------------------------------------------------------------------------
bool GameData::RemapNameField( const char *pszInValue, char *pszOutValue, TNameFixup NameFixup )
{
#ifdef MAPBASE
if ( pszInValue[ 0 ] && pszInValue[ 0 ] != '@' && pszInValue[ 0 ] != '!' )
#else
strcpy( pszOutValue, pszInValue );
#endif // MAPBASE

if ( pszInValue[ 0 ] && pszInValue[ 0 ] != '@' )
{ // ! at the start of a value means it is global and should not be remaped
Expand Down
100 changes: 100 additions & 0 deletions game/client/C_Env_Projected_Texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,104 @@
#include "c_baseentity.h"
#include "basetypes.h"

#ifdef ASW_PROJECTED_TEXTURES
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class C_EnvProjectedTexture : public C_BaseEntity
{
DECLARE_CLASS( C_EnvProjectedTexture, C_BaseEntity );
public:
DECLARE_CLIENTCLASS();

void SetMaterial( IMaterial *pMaterial );
void SetLightColor( byte r, byte g, byte b, byte a );
void SetSize( float flSize );
void SetRotation( float flRotation );

virtual void OnDataChanged( DataUpdateType_t updateType );
void ShutDownLightHandle( void );

#ifdef MAPBASE
virtual void Simulate();
#else
virtual bool Simulate();
#endif // MAPBASE

void UpdateLight( void );

C_EnvProjectedTexture();
~C_EnvProjectedTexture();

static void SetVisibleBBoxMinHeight( float flVisibleBBoxMinHeight ) { m_flVisibleBBoxMinHeight = flVisibleBBoxMinHeight; }
static float GetVisibleBBoxMinHeight( void ) { return m_flVisibleBBoxMinHeight; }
static C_EnvProjectedTexture *Create( );

private:

inline bool IsBBoxVisible( void );
bool IsBBoxVisible( Vector vecExtentsMin,
Vector vecExtentsMax );

ClientShadowHandle_t m_LightHandle;
bool m_bForceUpdate;

EHANDLE m_hTargetEntity;
#ifdef MAPBASE
bool m_bDontFollowTarget;
#endif // MAPBASE

bool m_bState;
bool m_bAlwaysUpdate;
float m_flLightFOV;
#ifdef MAPBASE
float m_flLightHorFOV;
#endif // MAPBASE
bool m_bEnableShadows;
bool m_bLightOnlyTarget;
bool m_bLightWorld;
bool m_bCameraSpace;
float m_flBrightnessScale;
color32 m_LightColor;
Vector m_CurrentLinearFloatLightColor;
float m_flCurrentLinearFloatLightAlpha;
#ifdef MAPBASE
float m_flCurrentBrightnessScale;
#endif // MAPBASE
float m_flColorTransitionTime;
float m_flAmbient;
float m_flNearZ;
float m_flFarZ;
char m_SpotlightTextureName[ MAX_PATH ];
CTextureReference m_SpotlightTexture;
int m_nSpotlightTextureFrame;
int m_nShadowQuality;
#ifdef MAPBASE
float m_flConstantAtten;
float m_flLinearAtten;
float m_flQuadraticAtten;
float m_flShadowAtten;
float m_flShadowFilter;

bool m_bAlwaysDraw;
//bool m_bProjectedTextureVersion;
#endif // MAPBASE

Vector m_vecExtentsMin;
Vector m_vecExtentsMax;

static float m_flVisibleBBoxMinHeight;
};



bool C_EnvProjectedTexture::IsBBoxVisible( void )
{
return IsBBoxVisible( GetAbsOrigin() + m_vecExtentsMin, GetAbsOrigin() + m_vecExtentsMax );
}

#else

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -62,4 +160,6 @@ class C_EnvProjectedTexture : public C_BaseEntity

C_EnvProjectedTexture* GetEnvProjectedTextureList();

#endif // ASW_PROJECTED_TEXTURES

#endif // C_ENVPROJECTEDTEXTURE_H
Loading