Mapbase HL2:MP compatibility and remaining HL2/Episodic support

This commit is contained in:
ALLEN-PC\acj30 2025-02-28 13:23:55 -06:00
parent 4849c2adc1
commit 1c43bc4e95
27 changed files with 304 additions and 55 deletions

View File

@ -8,10 +8,10 @@
#include "c_team_train_watcher.h"
#include "igameevents.h"
#include "c_team_objectiveresource.h"
#include "teamplayroundbased_gamerules.h"
#ifdef TF_CLIENT_DLL
#include "tf_shareddefs.h"
#include "teamplayroundbased_gamerules.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!

View File

@ -4,6 +4,8 @@
// Project Script
//-----------------------------------------------------------------------------
$Include "$SRCDIR\game\client\client_mapbase_hl2.vpc" [$HL2||$EPISODIC||$HL2MP]
$Configuration
{
$Compiler
@ -53,7 +55,6 @@ $Project
$File "$SRCDIR\game\shared\mapbase\vscript_funcs_shared.h" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\vscript_singletons.cpp" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\vscript_singletons.h" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\vscript_funcs_hl2.cpp" [$MAPBASE_VSCRIPT&&($HL2||$EPISODIC)]
$File "$SRCDIR\game\shared\mapbase\vscript_consts_shared.cpp" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\vscript_consts_weapons.cpp" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\weapon_custom_scripted.cpp" [$MAPBASE_VSCRIPT]
@ -69,25 +70,8 @@ $Project
$File "mapbase\c_func_fake_worldportal.h"
$File "mapbase\c_point_glow.cpp"
$File "mapbase\c_vgui_text_display.cpp"
$File "mapbase\c_weapon_custom_hl2.cpp" [$HL2||$EPISODIC]
$File "mapbase\mapbase_autocubemap.cpp"
}
$Folder "HL2 DLL" [$HL2||$EPISODIC]
{
// Original stunstick files are conditional'd out in the HL2 VPCs
$File "$SRCDIR\game\shared\hl2mp\weapon_stunstick.cpp"
$File "$SRCDIR\game\shared\hl2mp\weapon_stunstick.h"
}
$Folder "HL2MP" [$HL2||$EPISODIC]
{
$Folder "Weapons"
{
$File "$SRCDIR\game\shared\hl2mp\weapon_slam.cpp"
$File "$SRCDIR\game\shared\hl2mp\weapon_slam.h"
}
}
}
$Folder "Link Libraries"

View File

@ -0,0 +1,33 @@
//-----------------------------------------------------------------------------
// CLIENT_MAPBASE_HL2.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Project
{
$Folder "Source Files"
{
$Folder "Mapbase"
{
$File "$SRCDIR\game\shared\mapbase\vscript_funcs_hl2.cpp" [$MAPBASE_VSCRIPT]
$File "mapbase\c_weapon_custom_hl2.cpp"
}
$Folder "HL2 DLL"
{
// Original stunstick files are conditional'd out in the HL2 VPCs
$File "$SRCDIR\game\shared\hl2mp\weapon_stunstick.cpp"
$File "$SRCDIR\game\shared\hl2mp\weapon_stunstick.h"
}
$Folder "HL2MP"
{
$Folder "Weapons"
{
$File "$SRCDIR\game\shared\hl2mp\weapon_slam.cpp"
$File "$SRCDIR\game\shared\hl2mp\weapon_slam.h"
}
}
}
}

View File

@ -48,8 +48,10 @@ DEFINE_SCRIPT_INSTANCE_HELPER( INextBotComponent, &g_NextBotComponentScriptInsta
#endif
#endif
BEGIN_ENT_SCRIPTDESC_ROOT( INextBotComponent, "Next bot component" )
#ifdef TF_DLL
#ifdef MAPBASE_VSCRIPT
DEFINE_SCRIPT_INSTANCE_HELPER( &g_NextBotComponentScriptInstanceHelper )
#endif
#endif
DEFINE_SCRIPTFUNC( Reset, "Resets the internal update state" )
DEFINE_SCRIPTFUNC( ComputeUpdateInterval, "Recomputes the component update interval" )

View File

@ -4,6 +4,8 @@
// Project Base Script
//-----------------------------------------------------------------------------
$Include "$SRCDIR\game\server\server_mapbase_hl2.vpc" [$HL2||$EPISODIC||$HL2MP]
$Configuration
{
$Compiler
@ -52,15 +54,12 @@ $Project
$File "$SRCDIR\game\shared\mapbase\vscript_funcs_shared.h" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\vscript_singletons.cpp" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\vscript_singletons.h" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\vscript_funcs_hl2.cpp" [$MAPBASE_VSCRIPT&&($HL2||$EPISODIC)]
$File "$SRCDIR\game\shared\mapbase\vscript_consts_shared.cpp" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\vscript_consts_weapons.cpp" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\weapon_custom_scripted.cpp" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\weapon_custom_scripted.h" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\logic_script_client.cpp" [$MAPBASE_VSCRIPT]
$File "mapbase\ai_grenade.cpp" [$HL2||$EPISODIC]
$File "mapbase\ai_grenade.h" [$HL2||$EPISODIC]
$File "mapbase\ai_monitor.cpp"
$File "mapbase\ai_weaponmodifier.cpp"
$File "mapbase\custom_weapon_factory.cpp"
@ -88,32 +87,10 @@ $Project
$File "mapbase\SystemConvarMod.h"
$File "mapbase\variant_tools.h"
$File "mapbase\vgui_text_display.cpp"
$File "mapbase\weapon_custom_hl2.cpp" [$HL2||$EPISODIC]
$File "mapbase\logic_eventlistener.cpp"
$File "mapbase\logic_register_activator.cpp"
}
$Folder "HL2 DLL" [$HL2||$EPISODIC]
{
// Original stunstick files are conditional'd out in the HL2 VPCs
$File "$SRCDIR\game\shared\hl2mp\weapon_stunstick.cpp"
$File "$SRCDIR\game\shared\hl2mp\weapon_stunstick.h"
}
$Folder "HL2MP" [$HL2||$EPISODIC]
{
$Folder "Weapons"
{
$File "hl2mp\grenade_satchel.cpp"
$File "hl2mp\grenade_satchel.h"
$File "hl2mp\grenade_tripmine.cpp"
$File "hl2mp\grenade_tripmine.h"
$File "$SRCDIR\game\shared\hl2mp\weapon_slam.cpp"
$File "$SRCDIR\game\shared\hl2mp\weapon_slam.h"
}
}
}
$Folder "Link Libraries"

View File

@ -0,0 +1,41 @@
//-----------------------------------------------------------------------------
// SERVER_MAPBASE_HL2.VPC
//
// Project Base Script
//-----------------------------------------------------------------------------
$Project
{
$Folder "Source Files"
{
$Folder "Mapbase"
{
$File "$SRCDIR\game\shared\mapbase\vscript_funcs_hl2.cpp" [$MAPBASE_VSCRIPT]
$File "mapbase\ai_grenade.cpp"
$File "mapbase\ai_grenade.h"
$File "mapbase\weapon_custom_hl2.cpp"
}
$Folder "HL2 DLL"
{
// Original stunstick files are conditional'd out in the HL2 VPCs
$File "$SRCDIR\game\shared\hl2mp\weapon_stunstick.cpp"
$File "$SRCDIR\game\shared\hl2mp\weapon_stunstick.h"
}
$Folder "HL2MP"
{
$Folder "Weapons"
{
$File "hl2mp\grenade_satchel.cpp"
$File "hl2mp\grenade_satchel.h"
$File "hl2mp\grenade_tripmine.cpp"
$File "hl2mp\grenade_tripmine.h"
$File "$SRCDIR\game\shared\hl2mp\weapon_slam.cpp"
$File "$SRCDIR\game\shared\hl2mp\weapon_slam.h"
}
}
}
}

View File

@ -10,6 +10,7 @@
#include "hl2_shareddefs.h"
#ifdef HL2MP
#include "hl2mp_gamerules.h"
#ifdef CLIENT_DLL
#include "hl2mp/c_hl2mp_player.h"
#else

View File

@ -74,6 +74,19 @@ acttable_t CWeapon357::m_acttable[] =
IMPLEMENT_ACTTABLE( CWeapon357 );
#ifdef MAPBASE
// Allows Weapon_BackupActivity() to access the 357's activity table.
acttable_t *Get357Acttable()
{
return CWeapon357::m_acttable;
}
int Get357ActtableCount()
{
return ARRAYSIZE(CWeapon357::m_acttable);
}
#endif
#endif
//-----------------------------------------------------------------------------

View File

@ -74,6 +74,19 @@ acttable_t CWeaponAR2::m_acttable[] =
IMPLEMENT_ACTTABLE(CWeaponAR2);
#ifdef MAPBASE
// Allows Weapon_BackupActivity() to access the AR2's activity table.
acttable_t *GetAR2Acttable()
{
return CWeaponAR2::m_acttable;
}
int GetAR2ActtableCount()
{
return ARRAYSIZE(CWeaponAR2::m_acttable);
}
#endif
#endif
CWeaponAR2::CWeaponAR2( )

View File

@ -31,6 +31,10 @@ public:
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
#ifndef CLIENT_DLL
DECLARE_ACTTABLE();
#endif
void ItemPostFrame( void );
void Precache( void );
@ -74,10 +78,6 @@ protected:
CNetworkVar( float, m_flDelayedFire );
CNetworkVar( bool, m_bShotDelayed );
int m_nVentPose;
#ifndef CLIENT_DLL
DECLARE_ACTTABLE();
#endif
};

View File

@ -412,6 +412,10 @@ public:
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
#ifndef CLIENT_DLL
DECLARE_ACTTABLE();
#endif
private:
void SetSkin( int skinNum );
@ -433,10 +437,6 @@ private:
void SetChargerState( ChargerState_t state );
void DoLoadEffect( void );
#ifndef CLIENT_DLL
DECLARE_ACTTABLE();
#endif
private:
// Charger effects
@ -493,6 +493,18 @@ acttable_t CWeaponCrossbow::m_acttable[] =
IMPLEMENT_ACTTABLE(CWeaponCrossbow);
#ifdef MAPBASE
acttable_t* GetCrossbowActtable()
{
return CWeaponCrossbow::m_acttable;
}
int GetCrossbowActtableCount()
{
return ARRAYSIZE(CWeaponCrossbow::m_acttable);
}
#endif
#endif
//-----------------------------------------------------------------------------

View File

@ -3251,6 +3251,19 @@ CBaseEntity *PhysCannonGetHeldEntity( CBaseCombatWeapon *pActiveWeapon )
return NULL;
}
CBaseEntity *GetPlayerHeldEntity( CBasePlayer *pPlayer )
{
CBaseEntity *pObject = NULL;
CPlayerPickupController *pPlayerPickupController = (CPlayerPickupController *)(pPlayer->GetUseEntity());
if ( pPlayerPickupController )
{
pObject = pPlayerPickupController->GetGrabController().GetAttached();
}
return pObject;
}
float PlayerPickupGetHeldObjectMass( CBaseEntity *pPickupControllerEntity, IPhysicsObject *pHeldObject )
{
float mass = 0.0f;

View File

@ -52,6 +52,7 @@ float PlayerPickupGetHeldObjectMass( CBaseEntity *pPickupControllerEntity, IPhys
float PhysCannonGetHeldObjectMass( CBaseCombatWeapon *pActiveWeapon, IPhysicsObject *pHeldObject );
CBaseEntity *PhysCannonGetHeldEntity( CBaseCombatWeapon *pActiveWeapon );
CBaseEntity *GetPlayerHeldEntity( CBasePlayer *pPlayer );
// derive from this so we can add save/load data to it
struct game_shadowcontrol_params_t : public hlshadowcontrol_params_t

View File

@ -143,6 +143,19 @@ acttable_t CWeaponPistol::m_acttable[] =
IMPLEMENT_ACTTABLE( CWeaponPistol );
#ifdef MAPBASE
// Allows Weapon_BackupActivity() to access the pistol's activity table.
acttable_t *GetPistolActtable()
{
return CWeaponPistol::m_acttable;
}
int GetPistolActtableCount()
{
return ARRAYSIZE(CWeaponPistol::m_acttable);
}
#endif
#endif
//-----------------------------------------------------------------------------

View File

@ -114,6 +114,19 @@ acttable_t CWeaponShotgun::m_acttable[] =
IMPLEMENT_ACTTABLE(CWeaponShotgun);
#ifdef MAPBASE
// Allows Weapon_BackupActivity() to access the shotgun's activity table.
acttable_t *GetShotgunActtable()
{
return CWeaponShotgun::m_acttable;
}
int GetShotgunActtableCount()
{
return ARRAYSIZE(CWeaponShotgun::m_acttable);
}
#endif
#endif

View File

@ -99,6 +99,19 @@ acttable_t CWeaponSMG1::m_acttable[] =
};
IMPLEMENT_ACTTABLE(CWeaponSMG1);
#ifdef MAPBASE
// Allows Weapon_BackupActivity() to access the SMG1's activity table.
acttable_t *GetSMG1Acttable()
{
return CWeaponSMG1::m_acttable;
}
int GetSMG1ActtableCount()
{
return ARRAYSIZE(CWeaponSMG1::m_acttable);
}
#endif
#endif
//=========================================================

View File

@ -28,8 +28,8 @@
#include "c_te_effect_dispatch.h"
#include "fx_quad.h"
#include "fx.h"
#include "beamdraw.h"
extern void DrawHalo( IMaterial* pMaterial, const Vector &source, float scale, float const *color, float flHDRColorScale = 1.0f );
extern void FormatViewModelAttachment( Vector &vOrigin, bool bInverse );
#endif

View File

@ -11,11 +11,15 @@
#pragma once
#endif
#ifdef HL2MP
#include "weapon_hl2mpbasebasebludgeon.h"
#else
#ifdef CLIENT_DLL
#include "c_basehlcombatweapon.h"
#else
#include "basebludgeonweapon.h"
#endif
#endif
#define STUNSTICK_RANGE 75.0f
#define STUNSTICK_REFIRE 0.8f
@ -26,8 +30,10 @@
#ifdef CLIENT_DLL
#define CWeaponStunStick C_WeaponStunStick
#ifndef HL2MP
#define CBaseHLBludgeonWeapon C_BaseHLBludgeonWeapon
#endif
#endif
#ifndef HL2MP
class CWeaponStunStick : public CBaseHLBludgeonWeapon

View File

@ -13,7 +13,7 @@
#pragma once
#endif
#if defined(MAPBASE_VSCRIPT) && (defined(TF_DLL) || defined(TF_CLIENT_DLL))
#if defined(MAPBASE_VSCRIPT) && defined(MAPBASE_MP)
// Mapbase and TF2 VScript have functions with the same names which do different things and/or take different parameters.
// If enabled, the code will prioritize the syntax from TF2 VScript.
// If disabled, it will prioritize the syntax from Mapbase VScript.

View File

@ -0,0 +1,23 @@
$Macro OUTBINNAME "mod_episodic"
$Conditional "MOD_LAUNCHER" "1"
$Include "launcher_main.vpc"
$Configuration
{
$Compiler
{
$PreprocessorDefinitions "$BASE;MOD_APPID=243750" // Replace with your appid if you ship on Steam.
}
}
$Project "Launcher Main (Mod Episodic)"
{
$Folder "Resource Files" [$WINDOWS]
{
// Use the same resources as HL2MP
$File "launcher_main_mod_hl2mp.rc"
$File "res\mod_hl2mp.ico"
}
}

View File

@ -0,0 +1,23 @@
$Macro OUTBINNAME "mod_hl2"
$Conditional "MOD_LAUNCHER" "1"
$Include "launcher_main.vpc"
$Configuration
{
$Compiler
{
$PreprocessorDefinitions "$BASE;MOD_APPID=243750" // Replace with your appid if you ship on Steam.
}
}
$Project "Launcher Main (Mod HL2)"
{
$Folder "Resource Files" [$WINDOWS]
{
// Use the same resources as HL2MP
$File "launcher_main_mod_hl2mp.rc"
$File "res\mod_hl2mp.ico"
}
}

View File

@ -0,0 +1,14 @@
//-----------------------------------------------------------------------------
// game_shader_generic_example_episodic.vpc
//
// Project Script for mods to use an an example of how to override shaders
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\.."
$Macro OUTBINNAME "game_shader_generic_example"
$Macro GAMENAME "mod_episodic"
$Include "$SRCDIR\materialsystem\stdshaders\game_shader_generic_example_base.vpc"
$Project "Game Shaders (Episodic)"
{
}

View File

@ -0,0 +1,14 @@
//-----------------------------------------------------------------------------
// game_shader_generic_example_hl2.vpc
//
// Project Script for mods to use an an example of how to override shaders
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\.."
$Macro OUTBINNAME "game_shader_generic_example"
$Macro GAMENAME "mod_hl2"
$Include "$SRCDIR\materialsystem\stdshaders\game_shader_generic_example_base.vpc"
$Project "Game Shaders (HL2)"
{
}

View File

@ -0,0 +1,17 @@
//-----------------------------------------------------------------------------
// game_shader_generic_std_episodic.vpc
//
// Project Script for mods to use an an example of how to override shaders
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\.."
$Macro OUTBINNAME "game_shader_generic_std"
$Macro GAMENAME "mod_episodic"
$Macro OUTBINDIR "$SRCDIR\..\game\$GAMENAME\bin"
$Include "$SRCDIR\materialsystem\stdshaders\stdshader_dx9_inc.vpc"
$Project "Standard Shader Replacements (Episodic)"
{
}

View File

@ -0,0 +1,17 @@
//-----------------------------------------------------------------------------
// game_shader_generic_std_hl2.vpc
//
// Project Script for mods to use an an example of how to override shaders
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\.."
$Macro OUTBINNAME "game_shader_generic_std"
$Macro GAMENAME "mod_hl2"
$Macro OUTBINDIR "$SRCDIR\..\game\$GAMENAME\bin"
$Include "$SRCDIR\materialsystem\stdshaders\stdshader_dx9_inc.vpc"
$Project "Standard Shader Replacements (HL2)"
{
}

View File

@ -31,6 +31,7 @@ $Project "game_shader_generic_example"
"materialsystem\stdshaders\game_shader_generic_example_hl2mp.vpc" [$HL2MP]
"materialsystem\stdshaders\game_shader_generic_example_tf.vpc" [$TF]
"materialsystem\stdshaders\game_shader_generic_example_hl2.vpc" [$HL2]
"materialsystem\stdshaders\game_shader_generic_example_episodic.vpc" [$EPISODIC]
}
// Use this project if you want to override all std shaders with your own.
@ -40,6 +41,7 @@ $Project "game_shader_generic_std"
"materialsystem\stdshaders\game_shader_generic_std_hl2mp.vpc" [$HL2MP]
"materialsystem\stdshaders\game_shader_generic_std_tf.vpc" [$TF]
"materialsystem\stdshaders\game_shader_generic_std_hl2.vpc" [$HL2]
"materialsystem\stdshaders\game_shader_generic_std_episodic.vpc" [$EPISODIC]
}
$Project "glview"
@ -64,6 +66,8 @@ $Project "launcher_main"
{
"launcher_main\launcher_main_mod_hl2mp.vpc" [$HL2MP]
"launcher_main\launcher_main_mod_tf.vpc" [$TF]
"launcher_main\launcher_main_mod_hl2.vpc" [$HL2]
"launcher_main\launcher_main_mod_episodic.vpc" [$EPISODIC]
}
$Project "responserules"

View File

@ -33,6 +33,7 @@ $Configuration "Debug"
// Mapbase base definitions
$PreprocessorDefinitions "$BASE;MAPBASE" [$MAPBASE]
$PreprocessorDefinitions "$BASE;MAPBASE_MP" [$MAPBASE&&($HL2MP||$TF)]
}
}
@ -47,5 +48,6 @@ $Configuration "Release"
// Mapbase base definitions
$PreprocessorDefinitions "$BASE;MAPBASE" [$MAPBASE]
$PreprocessorDefinitions "$BASE;MAPBASE_MP" [$MAPBASE&&($HL2MP||$TF)]
}
}