Skip to content

Commit 264ee2b

Browse files
authored
Merge pull request #110 from mapbase-source/develop
Mapbase v6.3
2 parents fd600b5 + ec995b6 commit 264ee2b

79 files changed

Lines changed: 4217 additions & 688 deletions

File tree

Some content is hidden

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

README

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ or complicated code changes accessible and easy to use for level designers and o
4040
If you believe any content in Mapbase originates from any leak or unauthorized source (from Valve or otherwise), please contact Blixibon immediately.
4141
Mapbase is intended to be usable by everyone, including licensed Source projects and Steam mods. ***
4242

43-
The Alien Swarm SDK was used to backport features and code from newer branches of Source into a Source 2013/Half-Life 2 environment.
44-
Mapbase also implements some of Tony Sergi's code changes from the Source 2007 SDK codebase. Both SDKs are publicly distributed by Valve and are available on Steam.
43+
-- The Alien Swarm SDK was used to backport features and code from newer branches of Source into a Source 2013/Half-Life 2 environment.
44+
-- Mapbase also implements some of Tony Sergi's code changes from the Source 2007 SDK codebase. Both SDKs are publicly distributed by Valve and are available on Steam.
4545

4646
Some of the features backported from the Alien Swarm SDK (e.g. game instructor, particle rain) require assets from later versions of Source in order to work properly.
4747
The required assets have been backported from Alien Swarm and Left 4 Dead for the release build. They are not available in the code repository.
@@ -100,11 +100,13 @@ Direct contributions:
100100
- Combine lock hardware on door01_left.mdl created by Kralich (This is asset-based and not reflected in the code)
101101
- npc_vehicledriver fixes provided by CrAzY
102102
- npc_combine cover behavior patches provided by iohnnyboy
103+
- logic_playmovie icon created by URAKOLOUY5 (This is asset-based and not reflected in the code)
103104

104105
== Contributions from samisalreadytaken:
105106
=-- https://github.com/mapbase-source/source-sdk-2013/pull/47 (VScript utility/consistency changes)
106107
=-- https://github.com/mapbase-source/source-sdk-2013/pull/59 (New VScript functions and singletons based on API documentation in later Source/Source 2 games)
107108
=-- https://github.com/mapbase-source/source-sdk-2013/pull/80 (More VScript changes, including support for extremely flexible client/server messaging)
109+
=-- https://github.com/mapbase-source/source-sdk-2013/pull/105 (VScript fixes and optimizations, Vector class extensions, custom convars/commands)
108110

109111
//---------------------------------------------------------------------------------------------------------------------------------------------------
110112

@@ -117,6 +119,7 @@ Other sources:
117119
-- https://github.com/ValveSoftware/source-sdk-2013/pull/401 (func_rot_button "Starts locked" flag fix)
118120
-- https://github.com/ValveSoftware/source-sdk-2013/pull/391 (VBSP func_detail smoothing group fix)
119121
-- https://github.com/ValveSoftware/source-sdk-2013/pull/362 (npc_manhack npc_maker fix; Adjusted for formatting and save/restore in Mapbase)
122+
-- https://github.com/Petercov/Source-PlusPlus/commit/ecdf50c48cd31dec4dbdb7fea2d0780e7f0dd8ec (used as a guide for porting the Alien Swarm SDK response system)
120123
- https://github.com/momentum-mod/game/blob/1d066180b3bf74830c51e6914d46c40b0bea1fc2/mp/src/game/server/player.cpp#L6543 (spec_goto fix)
121124
- Poison zombie barnacle crash fix implemented based on a snippet from HL2: Plus posted by Agent Agrimar on Discord (Mapbase makes the barnacle recognize it as poison just like poison headcrabs)
122125
- https://gamebanana.com/skins/172192 (Airboat handling fix; This is asset-based and not reflected in the code)

sp/src/game/client/c_baseanimating.cpp

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ BEGIN_ENT_SCRIPTDESC( C_ClientRagdoll, C_BaseAnimating, "Client-side ragdolls" )
293293
END_SCRIPTDESC();
294294

295295
ScriptHook_t C_BaseAnimating::g_Hook_OnClientRagdoll;
296+
ScriptHook_t C_BaseAnimating::g_Hook_FireEvent;
296297
#endif
297298

298299
BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-side" )
@@ -346,6 +347,13 @@ BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-si
346347
BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_OnClientRagdoll, "OnClientRagdoll", FIELD_VOID, "Called when this entity turns into a client-side ragdoll." )
347348
DEFINE_SCRIPTHOOK_PARAM( "ragdoll", FIELD_HSCRIPT )
348349
END_SCRIPTHOOK()
350+
351+
BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_FireEvent, "FireEvent", FIELD_BOOLEAN, "Called when handling animation events. Return false to cancel base handling." )
352+
DEFINE_SCRIPTHOOK_PARAM( "origin", FIELD_VECTOR )
353+
DEFINE_SCRIPTHOOK_PARAM( "angles", FIELD_VECTOR )
354+
DEFINE_SCRIPTHOOK_PARAM( "event", FIELD_INTEGER )
355+
DEFINE_SCRIPTHOOK_PARAM( "options", FIELD_CSTRING )
356+
END_SCRIPTHOOK()
349357
#endif
350358
END_SCRIPTDESC();
351359

@@ -3651,7 +3659,11 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
36513659
flEventCycle,
36523660
gpGlobals->curtime );
36533661
}
3654-
3662+
3663+
#ifdef MAPBASE_VSCRIPT
3664+
if (ScriptHookFireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() ) == false)
3665+
continue;
3666+
#endif
36553667

36563668
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
36573669
}
@@ -3684,13 +3696,38 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
36843696
gpGlobals->curtime );
36853697
}
36863698

3699+
#ifdef MAPBASE_VSCRIPT
3700+
if (ScriptHookFireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() ) == false)
3701+
continue;
3702+
#endif
3703+
36873704
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
36883705
}
36893706
}
36903707

36913708
m_flPrevEventCycle = flEventCycle;
36923709
}
36933710

3711+
#ifdef MAPBASE_VSCRIPT
3712+
//-----------------------------------------------------------------------------
3713+
// Purpose:
3714+
//-----------------------------------------------------------------------------
3715+
bool C_BaseAnimating::ScriptHookFireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
3716+
{
3717+
if (m_ScriptScope.IsInitialized() && g_Hook_FireEvent.CanRunInScope(m_ScriptScope))
3718+
{
3719+
// origin, angles, event, options
3720+
ScriptVariant_t args[] = { origin, angles, event, options };
3721+
ScriptVariant_t returnValue = true;
3722+
g_Hook_FireEvent.Call( m_ScriptScope, &returnValue, args );
3723+
3724+
return returnValue.m_bool;
3725+
}
3726+
3727+
return true;
3728+
}
3729+
#endif
3730+
36943731
//-----------------------------------------------------------------------------
36953732
// Purpose: Parses a muzzle effect event and sends it out for drawing
36963733
// Input : *options - event parameters in text format

sp/src/game/client/c_baseanimating.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ class C_BaseAnimating : public C_BaseEntity, private IModelLoadCallback
164164
virtual void FireObsoleteEvent( const Vector& origin, const QAngle& angles, int event, const char *options );
165165
virtual const char* ModifyEventParticles( const char* token ) { return token; }
166166

167+
#ifdef MAPBASE_VSCRIPT
168+
bool ScriptHookFireEvent( const Vector& origin, const QAngle& angles, int event, const char *options );
169+
#endif
170+
167171
#if defined ( SDK_DLL ) || defined ( HL2MP )
168172
virtual void ResetEventsParity() { m_nPrevResetEventsParity = -1; } // used to force animation events to function on players so the muzzleflashes and other events occur
169173
// so new functions don't have to be made to parse the models like CSS does in ProcessMuzzleFlashEvent
@@ -477,6 +481,7 @@ class C_BaseAnimating : public C_BaseEntity, private IModelLoadCallback
477481
HSCRIPT ScriptBecomeRagdollOnClient();
478482

479483
static ScriptHook_t g_Hook_OnClientRagdoll;
484+
static ScriptHook_t g_Hook_FireEvent;
480485

481486
float ScriptGetPoseParameter(const char* szName);
482487
#endif

sp/src/game/client/c_baseentity.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ BEGIN_ENT_SCRIPTDESC_ROOT( C_BaseEntity, "Root class of all client-side entities
451451

452452
DEFINE_SCRIPTFUNC_NAMED( ScriptGetModelName, "GetModelName", "Returns the name of the model" )
453453

454+
DEFINE_SCRIPTFUNC_NAMED( ScriptStopSound, "StopSound", "Stops a sound from this entity." )
454455
DEFINE_SCRIPTFUNC_NAMED( ScriptEmitSound, "EmitSound", "Plays a sound from this entity." )
455456
DEFINE_SCRIPTFUNC_NAMED( VScriptPrecacheScriptSound, "PrecacheSoundScript", "Precache a sound for later playing." )
456457
DEFINE_SCRIPTFUNC_NAMED( ScriptSoundDuration, "GetSoundDuration", "Returns float duration of the sound. Takes soundname and optional actormodelname." )
@@ -472,6 +473,7 @@ BEGIN_ENT_SCRIPTDESC_ROOT( C_BaseEntity, "Root class of all client-side entities
472473
DEFINE_SCRIPTFUNC_NAMED( GetAbsAngles, "GetAngles", "Get entity pitch, yaw, roll as a vector" )
473474
DEFINE_SCRIPTFUNC_NAMED( SetAbsAngles, "SetAngles", "Set entity pitch, yaw, roll" )
474475

476+
DEFINE_SCRIPTFUNC( SetSize, "" )
475477
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoundingMins, "GetBoundingMins", "Get a vector containing min bounds, centered on object" )
476478
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoundingMaxs, "GetBoundingMaxs", "Get a vector containing max bounds, centered on object" )
477479

@@ -541,7 +543,13 @@ BEGIN_ENT_SCRIPTDESC_ROOT( C_BaseEntity, "Root class of all client-side entities
541543
DEFINE_SCRIPTFUNC_NAMED( IsBaseCombatWeapon, "IsWeapon", "Returns true if this entity is a weapon." )
542544
DEFINE_SCRIPTFUNC( IsWorld, "Returns true if this entity is the world." )
543545

546+
DEFINE_SCRIPTFUNC( SetModel, "Set client-only entity model" )
547+
//DEFINE_SCRIPTFUNC_NAMED( ScriptInitializeAsClientEntity, "InitializeAsClientEntity", "" )
548+
DEFINE_SCRIPTFUNC_NAMED( Remove, "Destroy", "Remove clientside entity" )
544549
DEFINE_SCRIPTFUNC_NAMED( GetEntityIndex, "entindex", "" )
550+
551+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetContextThink, "SetContextThink", "Set a think function on this entity." )
552+
545553
#endif
546554

547555
END_SCRIPTDESC();
@@ -578,6 +586,7 @@ BEGIN_RECV_TABLE_NOBASE(C_BaseEntity, DT_BaseEntity)
578586
RecvPropInt(RECVINFO(m_clrRender)),
579587
#ifdef MAPBASE
580588
RecvPropInt(RECVINFO(m_iViewHideFlags)),
589+
RecvPropBool(RECVINFO(m_bDisableFlashlight)),
581590
#endif
582591
RecvPropInt(RECVINFO(m_iTeamNum)),
583592
RecvPropInt(RECVINFO(m_CollisionGroup)),
@@ -1333,6 +1342,15 @@ void C_BaseEntity::Term()
13331342
{
13341343
g_pScriptVM->RemoveInstance( m_hScriptInstance );
13351344
m_hScriptInstance = NULL;
1345+
1346+
#ifdef MAPBASE_VSCRIPT
1347+
FOR_EACH_VEC( m_ScriptThinkFuncs, i )
1348+
{
1349+
HSCRIPT h = m_ScriptThinkFuncs[i]->m_hfnThink;
1350+
if ( h ) g_pScriptVM->ReleaseScript( h );
1351+
}
1352+
m_ScriptThinkFuncs.PurgeAndDeleteElements();
1353+
#endif
13361354
}
13371355
}
13381356

@@ -1683,6 +1701,11 @@ bool C_BaseEntity::ShouldReceiveProjectedTextures( int flags )
16831701
if ( IsEffectActive( EF_NODRAW ) )
16841702
return false;
16851703

1704+
#ifdef MAPBASE
1705+
if ( m_bDisableFlashlight )
1706+
return false;
1707+
#endif
1708+
16861709
if( flags & SHADOW_FLAGS_FLASHLIGHT )
16871710
{
16881711
if ( GetRenderMode() > kRenderNormal && GetRenderColor().a == 0 )

sp/src/game/client/c_baseentity.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ struct thinkfunc_t
161161
int m_nLastThinkTick;
162162
};
163163

164+
#ifdef MAPBASE_VSCRIPT
165+
struct scriptthinkfunc_t
166+
{
167+
int m_nNextThinkTick;
168+
HSCRIPT m_hfnThink;
169+
unsigned short m_iContextHash;
170+
bool m_bNoParam;
171+
};
172+
#endif
173+
164174
#define CREATE_PREDICTED_ENTITY( className ) \
165175
C_BaseEntity::CreatePredictedEntityByName( className, __FILE__, __LINE__ );
166176

@@ -1173,6 +1183,7 @@ class C_BaseEntity : public IClientEntity
11731183
#ifdef MAPBASE_VSCRIPT
11741184
const char* ScriptGetModelName( void ) const { return STRING(GetModelName()); }
11751185

1186+
void ScriptStopSound(const char* soundname);
11761187
void ScriptEmitSound(const char* soundname);
11771188
float ScriptSoundDuration(const char* soundname, const char* actormodel);
11781189

@@ -1378,6 +1389,7 @@ class C_BaseEntity : public IClientEntity
13781389

13791390
#ifdef MAPBASE
13801391
int m_iViewHideFlags;
1392+
bool m_bDisableFlashlight;
13811393
#endif
13821394

13831395
private:
@@ -1518,6 +1530,15 @@ class C_BaseEntity : public IClientEntity
15181530
CUtlVector< thinkfunc_t > m_aThinkFunctions;
15191531
int m_iCurrentThinkContext;
15201532

1533+
#ifdef MAPBASE_VSCRIPT
1534+
public:
1535+
void ScriptSetContextThink( const char* szContext, HSCRIPT hFunc, float time );
1536+
void ScriptContextThink();
1537+
private:
1538+
CUtlVector< scriptthinkfunc_t* > m_ScriptThinkFuncs;
1539+
public:
1540+
#endif
1541+
15211542
// Object eye position
15221543
Vector m_vecViewOffset;
15231544

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//========= Copyright © 1996-2009, Valve Corporation, All rights reserved. ============//
2+
//
3+
// Purpose:
4+
//
5+
//
6+
//=====================================================================================//
7+
#include "cbase.h"
8+
#include "c_movie_display.h"
9+
10+
// memdbgon must be the last include file in a .cpp file!!!
11+
#include "tier0/memdbgon.h"
12+
13+
IMPLEMENT_CLIENTCLASS_DT( C_MovieDisplay, DT_MovieDisplay, CMovieDisplay )
14+
RecvPropBool( RECVINFO( m_bEnabled ) ),
15+
RecvPropBool( RECVINFO( m_bLooping ) ),
16+
RecvPropString( RECVINFO( m_szMovieFilename ) ),
17+
RecvPropString( RECVINFO( m_szGroupName ) ),
18+
END_RECV_TABLE()
19+
20+
C_MovieDisplay::C_MovieDisplay()
21+
{
22+
}
23+
24+
C_MovieDisplay::~C_MovieDisplay()
25+
{
26+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//========= Copyright © 1996-2009, Valve Corporation, All rights reserved. ============//
2+
//
3+
// Purpose:
4+
//
5+
//=====================================================================================//
6+
7+
#ifndef C_MOVIE_DISPLAY_H
8+
#define C_MOVIE_DISPLAY_H
9+
10+
#include "cbase.h"
11+
12+
class C_MovieDisplay : public C_BaseEntity
13+
{
14+
public:
15+
DECLARE_CLASS( C_MovieDisplay, C_BaseEntity );
16+
DECLARE_CLIENTCLASS();
17+
18+
C_MovieDisplay();
19+
~C_MovieDisplay();
20+
21+
bool IsEnabled( void ) const { return m_bEnabled; }
22+
bool IsLooping( void ) const { return m_bLooping; }
23+
24+
const char *GetMovieFilename( void ) const { return m_szMovieFilename; }
25+
const char *GetGroupName( void ) const { return m_szGroupName; }
26+
27+
private:
28+
bool m_bEnabled;
29+
bool m_bLooping;
30+
char m_szMovieFilename[128];
31+
char m_szGroupName[128];
32+
};
33+
34+
#endif //C_MOVIE_DISPLAY_H

sp/src/game/client/c_world.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class C_World : public C_BaseEntity
4949
#endif
5050

5151
#ifdef MAPBASE_VSCRIPT
52+
void ClientThink() { ScriptContextThink(); }
53+
5254
// -2 = Use server language
5355
ScriptLanguage_t GetScriptLanguage() { return (ScriptLanguage_t)(m_iScriptLanguageClient != -2 ? m_iScriptLanguageClient : m_iScriptLanguageServer); }
5456
#endif

sp/src/game/client/cdll_client_int.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ void ProcessCacheUsedMaterials()
274274
}
275275
}
276276

277+
void VGui_ClearVideoPanels();
278+
277279
// String tables
278280
INetworkStringTable *g_pStringTableParticleEffectNames = NULL;
279281
INetworkStringTable *g_StringTableEffectDispatch = NULL;
@@ -1217,6 +1219,8 @@ void CHLClient::Shutdown( void )
12171219
g_pSixenseInput = NULL;
12181220
#endif
12191221

1222+
VGui_ClearVideoPanels();
1223+
12201224
C_BaseAnimating::ShutdownBoneSetupThreadPool();
12211225
ClientWorldFactoryShutdown();
12221226

sp/src/game/client/client_mapbase.vpc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ $Project
3131
$File "c_postprocesscontroller.cpp"
3232
$File "c_postprocesscontroller.h"
3333
$File "c_env_dof_controller.cpp"
34+
$File "c_movie_display.cpp"
35+
$File "c_movie_display.h"
36+
$File "vgui_movie_display.cpp"
3437

3538
$Folder "Mapbase"
3639
{
@@ -57,6 +60,7 @@ $Project
5760
$File "mapbase\c_func_fake_worldportal.cpp"
5861
$File "mapbase\c_func_fake_worldportal.h"
5962
$File "mapbase\c_point_glow.cpp"
63+
$File "mapbase\c_vgui_text_display.cpp"
6064
}
6165

6266
$Folder "HL2 DLL"

0 commit comments

Comments
 (0)