Skip to content

Commit aa52c5d

Browse files
committed
[WIP]: Inject Mapbase master Changes
Equivalent to: mapbase-source/source-sdk-2013@af6f9fe
1 parent e82858f commit aa52c5d

File tree

132 files changed

+26872
-1564
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+26872
-1564
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[submodule "lib"]
88
path = lib
99
url = https://github.com/nillerusr/source-engine-libs.git
10+
[submodule "vscript/squirrel"]
11+
path = vscript/squirrel
12+
url = https://github.com/albertodemichelis/squirrel

fgdlib/gamedata.cpp

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#include "filesystem_tools.h"
1313
#include "tier1/strtools.h"
1414
#include "utlmap.h"
15+
#ifdef MAPBASE
16+
#include "fmtstr.h"
17+
#endif // MAPBASE
1518

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

585+
#ifdef MAPBASE
586+
//-----------------------------------------------------------------------------
587+
// Purpose: Sets up for additional instance remap fixes from Mapbase
588+
//-----------------------------------------------------------------------------
589+
void GameData::SetupInstanceRemapParams( int iStartNodes, int iStartBrushSide, bool bRemapVecLines )
590+
{
591+
// Set the numer of nodes in the level
592+
m_InstanceStartAINodes = iStartNodes;
593+
594+
// If we have a "nodeid" key, set it to ivNodeDest so it's properly recognized
595+
// during AI node remapping
596+
GDinputvariable *var = m_InstanceClass->VarForName( "nodeid" );
597+
if ( var )
598+
{
599+
var->ForceSetType( ivNodeDest );
600+
}
601+
602+
//---------------------------------------------
603+
604+
// Set the number of brush sides in the level
605+
m_InstanceStartSide = iStartBrushSide;
606+
607+
//---------------------------------------------
608+
609+
m_bRemapVecLines = bRemapVecLines;
610+
}
611+
#endif // MAPBASE
582612

583613
enum tRemapOperation
584614
{
585615
REMAP_NAME = 0,
586616
REMAP_POSITION,
587617
REMAP_ANGLE,
588618
REMAP_ANGLE_NEGATIVE_PITCH,
619+
#ifdef MAPBASE
620+
// Remaps the node ID for instance/manifest AI node support
621+
REMAP_NODE_ID,
622+
623+
// Remaps brush sides and sidelists
624+
REMAP_SIDES,
625+
#endif // MAPBASE
589626
};
590627

591628

@@ -624,6 +661,12 @@ bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *
624661
RemapOperation.Insert( ivOrigin, REMAP_POSITION );
625662
RemapOperation.Insert( ivAxis, REMAP_ANGLE );
626663
RemapOperation.Insert( ivAngleNegativePitch, REMAP_ANGLE_NEGATIVE_PITCH );
664+
#ifdef MAPBASE
665+
RemapOperation.Insert( ivNodeDest, REMAP_NODE_ID );
666+
RemapOperation.Insert( ivSide, REMAP_SIDES );
667+
RemapOperation.Insert( ivSideList, REMAP_SIDES );
668+
RemapOperation.Insert( ivVecLine, REMAP_POSITION );
669+
#endif // MAPBASE
627670
}
628671

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

658701
case REMAP_POSITION:
659702
{
703+
#ifdef MAPBASE
704+
// Only remap ivVecLine if the keyvalue is enabled
705+
if (KVType == ivVecLine && !m_bRemapVecLines)
706+
break;
707+
#endif // MAPBASE
660708
Vector inPoint( 0.0f, 0.0f, 0.0f ), outPoint;
661709

662710
sscanf ( pszInValue, "%f %f %f", &inPoint.x, &inPoint.y, &inPoint.z );
@@ -697,6 +745,53 @@ bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *
697745
sprintf( pszOutValue, "%g", -outAngles.x ); // just the pitch
698746
}
699747
break;
748+
#ifdef MAPBASE
749+
case REMAP_NODE_ID:
750+
{
751+
int value = atoi( pszInValue );
752+
if (value == -1)
753+
break;
754+
755+
//Warning( " %s %s: Remapped %i to %i", m_InstanceClass->GetName(), KVVar->GetName(), value, value + m_InstanceStartAINodes );
756+
757+
value += m_InstanceStartAINodes;
758+
759+
sprintf( pszOutValue, "%i", value );
760+
}
761+
break;
762+
763+
case REMAP_SIDES:
764+
{
765+
CUtlStringList sideList;
766+
V_SplitString( pszInValue, " ", sideList );
767+
768+
// Convert sides
769+
CUtlStringList newSideList;
770+
for (int i = 0; i < sideList.Count(); i++)
771+
{
772+
int iSide = atoi( sideList[i] );
773+
774+
//Warning( " %s %s: Remapped %i to %i", m_InstanceClass->GetName(), KVVar->GetName(), iSide, iSide + m_InstanceStartSide );
775+
776+
iSide += m_InstanceStartSide;
777+
778+
newSideList.AddToTail( const_cast<char*>( CNumStr( iSide ).String() ) );
779+
}
780+
781+
// Initial side
782+
strcpy( pszOutValue, newSideList[0] );
783+
784+
// Start at 1 for subsequent sides
785+
for (int i = 1; i < newSideList.Count(); i++)
786+
{
787+
// Any subsequent sides are spaced
788+
sprintf( pszOutValue, "%s %s", pszOutValue, newSideList[i] );
789+
}
790+
791+
//Warning("Old side list: \"%s\", new side list: \"%s\"\n", pszInValue, pszOutValue);
792+
}
793+
break;
794+
#endif // MAPBASE
700795
}
701796

702797
return ( strcmpi( pszInValue, pszOutValue ) != 0 );
@@ -713,7 +808,11 @@ bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *
713808
//-----------------------------------------------------------------------------
714809
bool GameData::RemapNameField( const char *pszInValue, char *pszOutValue, TNameFixup NameFixup )
715810
{
811+
#ifdef MAPBASE
812+
if ( pszInValue[ 0 ] && pszInValue[ 0 ] != '@' && pszInValue[ 0 ] != '!' )
813+
#else
716814
strcpy( pszOutValue, pszInValue );
815+
#endif // MAPBASE
717816

718817
if ( pszInValue[ 0 ] && pszInValue[ 0 ] != '@' )
719818
{ // ! at the start of a value means it is global and should not be remaped

game/client/C_Env_Projected_Texture.h

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,104 @@
1414
#include "c_baseentity.h"
1515
#include "basetypes.h"
1616

17+
#ifdef ASW_PROJECTED_TEXTURES
18+
//-----------------------------------------------------------------------------
19+
// Purpose:
20+
//-----------------------------------------------------------------------------
21+
class C_EnvProjectedTexture : public C_BaseEntity
22+
{
23+
DECLARE_CLASS( C_EnvProjectedTexture, C_BaseEntity );
24+
public:
25+
DECLARE_CLIENTCLASS();
26+
27+
void SetMaterial( IMaterial *pMaterial );
28+
void SetLightColor( byte r, byte g, byte b, byte a );
29+
void SetSize( float flSize );
30+
void SetRotation( float flRotation );
31+
32+
virtual void OnDataChanged( DataUpdateType_t updateType );
33+
void ShutDownLightHandle( void );
34+
35+
#ifdef MAPBASE
36+
virtual void Simulate();
37+
#else
38+
virtual bool Simulate();
39+
#endif // MAPBASE
40+
41+
void UpdateLight( void );
42+
43+
C_EnvProjectedTexture();
44+
~C_EnvProjectedTexture();
45+
46+
static void SetVisibleBBoxMinHeight( float flVisibleBBoxMinHeight ) { m_flVisibleBBoxMinHeight = flVisibleBBoxMinHeight; }
47+
static float GetVisibleBBoxMinHeight( void ) { return m_flVisibleBBoxMinHeight; }
48+
static C_EnvProjectedTexture *Create( );
49+
50+
private:
51+
52+
inline bool IsBBoxVisible( void );
53+
bool IsBBoxVisible( Vector vecExtentsMin,
54+
Vector vecExtentsMax );
55+
56+
ClientShadowHandle_t m_LightHandle;
57+
bool m_bForceUpdate;
58+
59+
EHANDLE m_hTargetEntity;
60+
#ifdef MAPBASE
61+
bool m_bDontFollowTarget;
62+
#endif // MAPBASE
63+
64+
bool m_bState;
65+
bool m_bAlwaysUpdate;
66+
float m_flLightFOV;
67+
#ifdef MAPBASE
68+
float m_flLightHorFOV;
69+
#endif // MAPBASE
70+
bool m_bEnableShadows;
71+
bool m_bLightOnlyTarget;
72+
bool m_bLightWorld;
73+
bool m_bCameraSpace;
74+
float m_flBrightnessScale;
75+
color32 m_LightColor;
76+
Vector m_CurrentLinearFloatLightColor;
77+
float m_flCurrentLinearFloatLightAlpha;
78+
#ifdef MAPBASE
79+
float m_flCurrentBrightnessScale;
80+
#endif // MAPBASE
81+
float m_flColorTransitionTime;
82+
float m_flAmbient;
83+
float m_flNearZ;
84+
float m_flFarZ;
85+
char m_SpotlightTextureName[ MAX_PATH ];
86+
CTextureReference m_SpotlightTexture;
87+
int m_nSpotlightTextureFrame;
88+
int m_nShadowQuality;
89+
#ifdef MAPBASE
90+
float m_flConstantAtten;
91+
float m_flLinearAtten;
92+
float m_flQuadraticAtten;
93+
float m_flShadowAtten;
94+
float m_flShadowFilter;
95+
96+
bool m_bAlwaysDraw;
97+
//bool m_bProjectedTextureVersion;
98+
#endif // MAPBASE
99+
100+
Vector m_vecExtentsMin;
101+
Vector m_vecExtentsMax;
102+
103+
static float m_flVisibleBBoxMinHeight;
104+
};
105+
106+
107+
108+
bool C_EnvProjectedTexture::IsBBoxVisible( void )
109+
{
110+
return IsBBoxVisible( GetAbsOrigin() + m_vecExtentsMin, GetAbsOrigin() + m_vecExtentsMax );
111+
}
112+
113+
#else
114+
17115
//-----------------------------------------------------------------------------
18116
// Purpose:
19117
//-----------------------------------------------------------------------------
@@ -62,4 +160,6 @@ class C_EnvProjectedTexture : public C_BaseEntity
62160

63161
C_EnvProjectedTexture* GetEnvProjectedTextureList();
64162

163+
#endif // ASW_PROJECTED_TEXTURES
164+
65165
#endif // C_ENVPROJECTEDTEXTURE_H

0 commit comments

Comments
 (0)