2019-08-31 19:28:20 +00:00
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Carries the Mapbase CAutoGameSystem that loads manifest among other things.
// Also includes code that does not fit anywhere else.
//
// $NoKeywords: $
//=============================================================================//
# include "cbase.h"
# include "tier0/icommandline.h"
# include "igamesystem.h"
# include "filesystem.h"
# include <vgui_controls/Controls.h>
# include <vgui/ILocalize.h>
# include "saverestore_utlvector.h"
# include "props_shared.h"
# include "utlbuffer.h"
# ifdef CLIENT_DLL
# include "hud_closecaption.h"
# include "panelmetaclassmgr.h"
# include "c_soundscape.h"
# else
# include "soundscape_system.h"
# include "AI_ResponseSystem.h"
# include "mapbase/SystemConvarMod.h"
Mapbase v3.0
- Overhauled matcher system and added expanded wildcard support, meaning "text", "te?t", "blah_test", etc. are now supported instead of only trailing *
- Added support for regular expression matching
- Added the missing matrixinvert.h file, which prevented programmers from compiling vbsp
- Fixed env_global_light brightness
- Added info_player_view_proxy, an entity which mimics a player's view (created for script_intro)
- New UnZoomWithRate and SetZoomRate inputs on env_zoom
- New "Don't change target's angles" flag on logic_measure_movement
- Fixed logic_measure_movement not using ignore origin flags correctly
- Fixed filter_damage_mod secondary filter not recognizing mode correctly
- Fixed DisableGeigerCounter causing NPCs to ignore player, and possibly fixed other adverse effects in similar code
- Added SetEntityName input for setting an entity's targetname
- Added "SetTarget" support to point_posecontroller
- Added "sk_alyx_health" convar for adjustable npc_alyx health, restored/fixed "sk_barney_health" for adjustable npc_barney health
- Added ignore flags and several direction-related inputs to math_vector
- Added pose parameter stuff to logic_modelinfo
- Fixed ChangeWeapon not changing during combat
- Fixed holster/unholster on NPCs without holster/unholster animations
- Fixed func_tank and other "player in the way" code ignoring notarget
- Added SetPoseParameter input to animating entities
- Introduced an experimental chapter system which allows for custom chapter title/restriction management
- Added SetChapterTitle input to worldspawn for dynamic title changing
- Fixed func_tankairboatgun damage credit, added ability to use its damage keyvalues
- Fixed mapbase_rpc_enabled not actually affecting RPC
- Moved some newly found Combine soldier grenade code to ai_grenade for other grenade users
- Fixed some problems with the new shared activities
- Restored an old Mapbase entity as "prop_interactable", an entity which contains all of the functionality of a func_button/func_door in a prop entity
- Added env_microphone pitch scale for scaling the pitch of transmitted sounds
- Added experimental, long-overdue code for scenes to be able to access !target#'s and other scene-related names through AI_INPUT
- Added "mat_specular_disable_on_missing", which "disables" specular reflections when the cubemap texture is missing
- Fixed $envmapmasktransform and $bumptransform on VertexLitGeneric and related shaders
- Areaportal leaks now stop compilation in leaktest
- Replaced "-nodefaultcubemap" with "-defaultcubemap" as the shader changes allow maps to compile without default cubemaps by default with little effect
2020-02-05 19:08:49 +00:00
# include "gameinterface.h"
2019-08-31 19:28:20 +00:00
# endif
// memdbgon must be the last include file in a .cpp file!!!
# include "tier0/memdbgon.h"
# define GENERIC_MANIFEST_FILE "scripts / mapbase_default_manifest.txt"
# ifdef CLIENT_DLL
# define AUTOLOADED_MANIFEST_FILE VarArgs("maps / %s_manifest.txt", g_MapName)
# else
# define AUTOLOADED_MANIFEST_FILE UTIL_VarArgs("maps / %s_manifest.txt", g_MapName)
# endif
// The soundscape system does not operate in a way that supports soundscape loading after map initialization.
// I have decided to make a direct change to the system that loads "maps/%mapname%_soundscapes.txt" instead and suggest the usage of #include and #base to users.
// Sorry. It's not broken, so I won't fix it.
# define MAPBASE_SOUNDSCAPE_SUPPORT 0
const char * g_MapName ;
extern ISoundEmitterSystemBase * soundemitterbase ;
ConVar mapbase_load_default_manifest ( " mapbase_load_default_manifest " , " 1 " , FCVAR_ARCHIVE , " Should we automatically load our default manifest file? ( \" maps/%mapname%_manifest.txt \" ) " ) ;
ConVar mapbase_load_soundscripts ( " mapbase_load_soundscripts " , " 1 " , FCVAR_ARCHIVE , " Should we load map-specific soundscripts? e.g. \" maps/mapname_level_sounds.txt \" " ) ;
//ConVar mapbase_load_propdata("mapbase_load_propdata", "1", FCVAR_ARCHIVE, "Should we load map-specific propdata files? e.g. \"maps/mapname_propdata.txt\"");
# if MAPBASE_SOUNDSCAPE_SUPPORT
ConVar mapbase_load_soundscapes ( " mapbase_load_soundscapes " , " 1 " , FCVAR_ARCHIVE , " Should we load map-specific soundscapes? e.g. \" maps/mapname_soundscapes.txt \" " ) ;
# endif
# ifdef CLIENT_DLL
//ConVar mapbase_load_cc("mapbase_load_cc", "1", FCVAR_ARCHIVE, "Should we load map-specific closed captioning? e.g. \"maps/mapname_closecaption_english.txt\" and \"maps/mapname_closecaption_english.dat\"");
ConVar mapbase_load_localization ( " mapbase_load_localization " , " 1 " , FCVAR_ARCHIVE , " Should we load map-specific localized text files? e.g. \" maps/mapname_english.txt \" " ) ;
# else
ConVar mapbase_load_sentences ( " mapbase_load_sentences " , " 1 " , FCVAR_ARCHIVE , " Should we load map-specific sentences? e.g. \" maps/mapname_sentences.txt \" " ) ;
ConVar mapbase_load_talker ( " mapbase_load_talker " , " 1 " , FCVAR_ARCHIVE , " Should we load map-specific talker files? e.g. \" maps/mapname_talker.txt \" " ) ;
ConVar mapbase_flush_talker ( " mapbase_flush_talker " , " 1 " , FCVAR_NONE , " Normally, when a map with custom talker files is unloaded, the response system resets to rid itself of the custom file(s) . Turn this convar off to prevent that from happening . " ) ;
ConVar mapbase_load_actbusy ( " mapbase_load_actbusy " , " 1 " , FCVAR_ARCHIVE , " Should we load map-specific actbusy files? e.g. \" maps/mapname_actbusy.txt \" " ) ;
# endif
# ifdef GAME_DLL
Mapbase v2.0; bulk commit
- Added custom map compile tools (vbsp, vvis, vrad)
- Changed blink fix (shouldn't change anything in-game)
- Added auto-completion to ent_create, npc_create, and the main set of "npc_" debug commands
- Added ent_create_aimed, an ent_create equivalent of npc_create_aimed
- Made hunters start using the "vs. player" melee animation against smaller NPCs that look weird with the "stab" attack
- Added "explosion_sparks" convar, which fixes broken code for giving explosions sparks (disabled by default because of how different it looks)
- Made interaction code capable of being dispatched on any entity, not just combat characters
- Added npc_barnacle_ignite convar, which lets barnacles be ignited by flares
- Fixed certain NPCs getting out of the way for the player when they hate them
- Fixed auto-generated "speak" scene responses not using parameters that work on real VCDs
- Made "stop_on_nonidle" capable of being used in any mod, not just HL2 episodic mods
- Selectable color for ragdoll boogie/point_ragdollboogie
- Fixed PickupWeaponInstant not firing weapon pickup outputs
- Introduced inputs and keyvalues for "lerping" to math_counter_advanced
- Fixed ClearConsole on logic_console
- logic_convar should now detect client convars correctly
- New NormalizeAngles input on math_vector
- logic_modelinfo LookupActivity input
- math_generate fixed and expanded to be more like math_counter
- Added a WIP game logging system for playtesting maps
- Introduced logic_playerinfo, an entity that can read a player's name or ID
- Fixed some new filters not working with filter_multi
- Added radius pickup spawnflag to func_physbox
- Added "Preserve name" spawnflag to weapons
- Added cc_achievement_debug message for when an achievement doesn't exist
- Made npc_combine_s not speak while in logic_choreographed_scenes
- Fixed zombie torsos/legs/headcrabs not being serverside when zombie is forced to server ragdoll
- Expanded and cleaned up npc_zombie_custom
- Fixed func_commandredirects not cleaning up correctly and sometimes crashing the game
- Allowed player squad commands to go through +USE-held objects
- Added a bunch of I/O/KV to trigger_waterydeath for better configuration
- Changed save comment system to use the chapter title from world properties, and the ability to suppress the title popup that normally results from it
- Adjusted game_convar_mod for MP planning
- Removed the func_precipitation custom particle/splash code for now, as it was causing problems
- Fixed env_global_light not accepting lightcolor
- Added "Additional Buttons" to player_speedmod
- Added save comment to RPC
- Added env_projectedtexture attenuation
- Added scripted_sequence OnPreIdleSequence
- Added OnCrab to zombies
- Added skill_changed game event (may need further testing)
- Added a fix for viewmodels flipping under extreme FOV values
- Added code that allows mappers to change the skin on shotgunners without it usually flipping back randomly
- Fixed a very, very, very major shader performance issue
- New SetAbsOrigin/Angles inputs on all entities, analogous to SetLocalOrigin/Angles
- Code improvements for I/O involving angles
- logic_entity_position improvements/fixes, including a new OutAngles output that outputs the angles on position calls
- Alternate collision/player avoidance spawnflag obsoletion enforcement disabled
- Enable/DisableHazardLights inputs on the EP2 jalopy, equivalent to the keyvalue
- Miscellaneous shader formatting adjustments and fixes
- Fixed AlwaysDrawOff on env_projectedtexture not being a valid input
2019-12-14 04:20:02 +00:00
extern void MapbaseGameLog_Init ( ) ;
2019-08-31 19:28:20 +00:00
extern void ParseCustomActbusyFile ( const char * file ) ;
extern bool LoadResponseSystemFile ( const char * scriptfile ) ;
extern void ReloadResponseSystem ( ) ;
// Reloads the response system when the map changes to avoid custom talker leaking
static bool g_bMapContainsCustomTalker ;
# endif
// Indicates this is a core Mapbase mod and not a mod using its code.
static bool g_bMapbaseCore ;
// The game's name found in gameinfo.txt. Mostly used for Discord RPC.
char g_iszGameName [ 128 ] ;
enum
{
MANIFEST_SOUNDSCRIPTS ,
//MANIFEST_PROPDATA,
# if MAPBASE_SOUNDSCAPE_SUPPORT
MANIFEST_SOUNDSCAPES ,
# endif
# ifdef CLIENT_DLL
//MANIFEST_CLOSECAPTION,
MANIFEST_LOCALIZATION ,
MANIFEST_VGUI ,
# else
MANIFEST_TALKER ,
MANIFEST_SENTENCES ,
MANIFEST_ACTBUSY ,
# endif
// Must always be kept below
MANIFEST_NUM_TYPES ,
} ;
struct ManifestType_t
{
//int type;
const char * string ;
ConVar * cvar ;
} ;
// KEEP THS IN SYNC WITH THE ENUM!
static const ManifestType_t gm_szManifestFileStrings [ MANIFEST_NUM_TYPES ] = {
{ " soundscripts " , & mapbase_load_soundscripts } ,
//{ "propdata", &mapbase_load_propdata },
# if MAPBASE_SOUNDSCAPE_SUPPORT
{ " soundscapes " , & mapbase_load_soundscapes } ,
# endif
# ifdef CLIENT_DLL
//{ "closecaption", &mapbase_load_cc },
{ " localization " , & mapbase_load_localization } ,
{ " vgui " , NULL } ,
# else
{ " talker " , & mapbase_load_talker } ,
{ " sentences " , & mapbase_load_sentences } ,
{ " actbusy " , & mapbase_load_actbusy } ,
# endif
} ;
//-----------------------------------------------------------------------------
// Purpose: System used to load map-specific files, etc.
//-----------------------------------------------------------------------------
class CMapbaseSystem : public CAutoGameSystem
{
public :
DECLARE_DATADESC ( ) ;
CMapbaseSystem ( ) : CAutoGameSystem ( " CMapbaseSystem " )
{
}
inline bool GetGameInfoKeyValues ( KeyValues * pKeyValues )
{
return pKeyValues - > LoadFromFile ( filesystem , " gameinfo.txt " , " GAME " ) ;
}
virtual void LevelInitPreEntity ( )
{
# ifdef GAME_DLL
Msg ( " Mapbase system loaded \n " ) ;
# endif
// Checks gameinfo.txt for Mapbase-specific options
KeyValues * gameinfo = new KeyValues ( " GameInfo " ) ;
if ( GetGameInfoKeyValues ( gameinfo ) )
{
// Indicates this is a core Mapbase mod and not a mod using its code
g_bMapbaseCore = gameinfo - > GetBool ( " mapbase_core " , false ) ;
if ( ! gameinfo - > GetBool ( " hide_mod_name " , false ) )
{
// Store the game's name
Mapbase v3.0
- Overhauled matcher system and added expanded wildcard support, meaning "text", "te?t", "blah_test", etc. are now supported instead of only trailing *
- Added support for regular expression matching
- Added the missing matrixinvert.h file, which prevented programmers from compiling vbsp
- Fixed env_global_light brightness
- Added info_player_view_proxy, an entity which mimics a player's view (created for script_intro)
- New UnZoomWithRate and SetZoomRate inputs on env_zoom
- New "Don't change target's angles" flag on logic_measure_movement
- Fixed logic_measure_movement not using ignore origin flags correctly
- Fixed filter_damage_mod secondary filter not recognizing mode correctly
- Fixed DisableGeigerCounter causing NPCs to ignore player, and possibly fixed other adverse effects in similar code
- Added SetEntityName input for setting an entity's targetname
- Added "SetTarget" support to point_posecontroller
- Added "sk_alyx_health" convar for adjustable npc_alyx health, restored/fixed "sk_barney_health" for adjustable npc_barney health
- Added ignore flags and several direction-related inputs to math_vector
- Added pose parameter stuff to logic_modelinfo
- Fixed ChangeWeapon not changing during combat
- Fixed holster/unholster on NPCs without holster/unholster animations
- Fixed func_tank and other "player in the way" code ignoring notarget
- Added SetPoseParameter input to animating entities
- Introduced an experimental chapter system which allows for custom chapter title/restriction management
- Added SetChapterTitle input to worldspawn for dynamic title changing
- Fixed func_tankairboatgun damage credit, added ability to use its damage keyvalues
- Fixed mapbase_rpc_enabled not actually affecting RPC
- Moved some newly found Combine soldier grenade code to ai_grenade for other grenade users
- Fixed some problems with the new shared activities
- Restored an old Mapbase entity as "prop_interactable", an entity which contains all of the functionality of a func_button/func_door in a prop entity
- Added env_microphone pitch scale for scaling the pitch of transmitted sounds
- Added experimental, long-overdue code for scenes to be able to access !target#'s and other scene-related names through AI_INPUT
- Added "mat_specular_disable_on_missing", which "disables" specular reflections when the cubemap texture is missing
- Fixed $envmapmasktransform and $bumptransform on VertexLitGeneric and related shaders
- Areaportal leaks now stop compilation in leaktest
- Replaced "-nodefaultcubemap" with "-defaultcubemap" as the shader changes allow maps to compile without default cubemaps by default with little effect
2020-02-05 19:08:49 +00:00
const char * pszGameName = gameinfo - > GetString ( " game_rpc " , NULL ) ;
if ( pszGameName = = NULL )
pszGameName = gameinfo - > GetString ( " game " ) ;
Q_strncpy ( g_iszGameName , pszGameName , sizeof ( g_iszGameName ) ) ;
2019-08-31 19:28:20 +00:00
}
}
gameinfo - > deleteThis ( ) ;
# ifdef GAME_DLL
if ( g_bMapContainsCustomTalker & & mapbase_flush_talker . GetBool ( ) )
{
DevMsg ( " Mapbase: Reloading response system to flush custom talker \n " ) ;
ReloadResponseSystem ( ) ;
g_bMapContainsCustomTalker = false ;
}
g_MapName = STRING ( gpGlobals - > mapname ) ;
# else
//char mapname[128];
//Q_StripExtension(MapName(), mapname, sizeof(mapname));
g_MapName = MapName ( ) - 4 ; // Removes ".bsp"
// Shared Mapbase localization file
g_pVGuiLocalize - > AddFile ( " resource/mapbase_%language%.txt " ) ;
# endif
// Check for a generic "mapname_manifest.txt" file and load it.
if ( filesystem - > FileExists ( AUTOLOADED_MANIFEST_FILE , " GAME " ) /*&& !FStrEq(name, "closecaption")*/ )
{
AddManifestFile ( AUTOLOADED_MANIFEST_FILE ) ;
}
else
{
// Load the generic script instead.
ParseGenericManifest ( ) ;
}
}
Mapbase v2.0; bulk commit
- Added custom map compile tools (vbsp, vvis, vrad)
- Changed blink fix (shouldn't change anything in-game)
- Added auto-completion to ent_create, npc_create, and the main set of "npc_" debug commands
- Added ent_create_aimed, an ent_create equivalent of npc_create_aimed
- Made hunters start using the "vs. player" melee animation against smaller NPCs that look weird with the "stab" attack
- Added "explosion_sparks" convar, which fixes broken code for giving explosions sparks (disabled by default because of how different it looks)
- Made interaction code capable of being dispatched on any entity, not just combat characters
- Added npc_barnacle_ignite convar, which lets barnacles be ignited by flares
- Fixed certain NPCs getting out of the way for the player when they hate them
- Fixed auto-generated "speak" scene responses not using parameters that work on real VCDs
- Made "stop_on_nonidle" capable of being used in any mod, not just HL2 episodic mods
- Selectable color for ragdoll boogie/point_ragdollboogie
- Fixed PickupWeaponInstant not firing weapon pickup outputs
- Introduced inputs and keyvalues for "lerping" to math_counter_advanced
- Fixed ClearConsole on logic_console
- logic_convar should now detect client convars correctly
- New NormalizeAngles input on math_vector
- logic_modelinfo LookupActivity input
- math_generate fixed and expanded to be more like math_counter
- Added a WIP game logging system for playtesting maps
- Introduced logic_playerinfo, an entity that can read a player's name or ID
- Fixed some new filters not working with filter_multi
- Added radius pickup spawnflag to func_physbox
- Added "Preserve name" spawnflag to weapons
- Added cc_achievement_debug message for when an achievement doesn't exist
- Made npc_combine_s not speak while in logic_choreographed_scenes
- Fixed zombie torsos/legs/headcrabs not being serverside when zombie is forced to server ragdoll
- Expanded and cleaned up npc_zombie_custom
- Fixed func_commandredirects not cleaning up correctly and sometimes crashing the game
- Allowed player squad commands to go through +USE-held objects
- Added a bunch of I/O/KV to trigger_waterydeath for better configuration
- Changed save comment system to use the chapter title from world properties, and the ability to suppress the title popup that normally results from it
- Adjusted game_convar_mod for MP planning
- Removed the func_precipitation custom particle/splash code for now, as it was causing problems
- Fixed env_global_light not accepting lightcolor
- Added "Additional Buttons" to player_speedmod
- Added save comment to RPC
- Added env_projectedtexture attenuation
- Added scripted_sequence OnPreIdleSequence
- Added OnCrab to zombies
- Added skill_changed game event (may need further testing)
- Added a fix for viewmodels flipping under extreme FOV values
- Added code that allows mappers to change the skin on shotgunners without it usually flipping back randomly
- Fixed a very, very, very major shader performance issue
- New SetAbsOrigin/Angles inputs on all entities, analogous to SetLocalOrigin/Angles
- Code improvements for I/O involving angles
- logic_entity_position improvements/fixes, including a new OutAngles output that outputs the angles on position calls
- Alternate collision/player avoidance spawnflag obsoletion enforcement disabled
- Enable/DisableHazardLights inputs on the EP2 jalopy, equivalent to the keyvalue
- Miscellaneous shader formatting adjustments and fixes
- Fixed AlwaysDrawOff on env_projectedtexture not being a valid input
2019-12-14 04:20:02 +00:00
# ifdef GAME_DLL
virtual void LevelInitPostEntity ( )
{
MapbaseGameLog_Init ( ) ;
}
# endif
2019-08-31 19:28:20 +00:00
virtual void LevelShutdownPreEntity ( )
{
// How would we make sure they don't last between maps?
// TODO: Investigate ReloadLocalizationFiles()
//g_pVGuiLocalize->RemoveAll();
//g_pVGuiLocalize->ReloadLocalizationFiles();
}
virtual void LevelShutdownPostEntity ( )
{
g_MapName = NULL ;
}
// Get a generic, hardcoded manifest with hardcoded names.
void ParseGenericManifest ( )
{
if ( ! mapbase_load_default_manifest . GetBool ( ) )
return ;
KeyValues * pKV = new KeyValues ( " DefaultManifest " ) ;
pKV - > LoadFromFile ( filesystem , GENERIC_MANIFEST_FILE ) ;
AddManifestFile ( pKV /*, true*/ ) ;
pKV - > deleteThis ( ) ;
}
2020-05-22 20:26:31 -05:00
void AddManifestFile ( const char * file )
2019-08-31 19:28:20 +00:00
{
KeyValues * pKV = new KeyValues ( file ) ;
if ( ! pKV - > LoadFromFile ( filesystem , file ) )
{
Warning ( " Mapbase Manifest: \" %s \" is unreadable or missing (can't load KV, check for syntax errors) \n " , file ) ;
pKV - > deleteThis ( ) ;
return ;
}
DevMsg ( " ===== Mapbase Manifest: Loading manifest file %s ===== \n " , file ) ;
AddManifestFile ( pKV , false ) ;
DevMsg ( " ============================================================================== \n " ) ;
pKV - > deleteThis ( ) ;
}
void LoadFromValue ( const char * value , int type , bool bDontWarn )
{
if ( ! filesystem - > FileExists ( value , " GAME " ) /*&& !FStrEq(name, "closecaption")*/ )
{
if ( ! bDontWarn )
{
Warning ( " Mapbase Manifest: WARNING! \" %s \" does not exist! \n " , value ) ;
}
return ;
}
switch ( type )
{
case MANIFEST_SOUNDSCRIPTS : { soundemitterbase - > AddSoundOverrides ( value ) ; } break ;
//case MANIFEST_PROPDATA: { g_PropDataSystem.ParsePropDataFile(value); } break;
# ifdef CLIENT_DLL
//case MANIFEST_CLOSECAPTION: { todo } break;
case MANIFEST_LOCALIZATION : { g_pVGuiLocalize - > AddFile ( value , " GAME " , true ) ; } break ;
case MANIFEST_VGUI : { PanelMetaClassMgr ( ) - > LoadMetaClassDefinitionFile ( value ) ; } break ;
# if MAPBASE_SOUNDSCAPE_SUPPORT
case MANIFEST_SOUNDSCAPES : { Soundscape_AddFile ( value ) ; } break ;
# endif
# else
case MANIFEST_TALKER : {
g_bMapContainsCustomTalker = true ;
LoadResponseSystemFile ( value ) ; //PrecacheCustomResponseSystem( value );
} break ;
# if MAPBASE_SOUNDSCAPE_SUPPORT
case MANIFEST_SOUNDSCAPES : { g_SoundscapeSystem . AddSoundscapeFile ( value ) ; } break ;
# endif
case MANIFEST_SENTENCES : { engine - > PrecacheSentenceFile ( value ) ; } break ;
case MANIFEST_ACTBUSY : { ParseCustomActbusyFile ( value ) ; } break ;
# endif
}
}
// This doesn't call deleteThis()!
void AddManifestFile ( KeyValues * pKV , bool bDontWarn = false )
{
const char * name ;
char value [ MAX_PATH ] ;
char * szToken ;
bool inparam = false ;
for ( KeyValues * pKey = pKV - > GetFirstSubKey ( ) ; pKey ; pKey = pKey - > GetNextKey ( ) )
{
name = pKey - > GetName ( ) ;
// Parse %mapname%, etc.
inparam = false ;
value [ 0 ] = ' \0 ' ;
szToken = strtok ( strdup ( pKey - > GetString ( ) ) , " % " ) ; // Was tempvalue
while ( szToken ! = NULL )
{
if ( inparam )
{
const char * append = szToken ;
if ( FStrEq ( szToken , " mapname " ) )
append = g_MapName ;
//else if (FStrEq(szToken, "mapdir"))
//{
// // TODO
//}
# ifdef CLIENT_DLL
else if ( FStrEq ( szToken , " language " ) )
{
char uilanguage [ 64 ] ;
engine - > GetUILanguage ( uilanguage , sizeof ( uilanguage ) ) ;
append = uilanguage ;
}
# endif
Q_strncat ( value , append , sizeof ( value ) ) ;
inparam = false ;
}
else
{
Q_strncat ( value , szToken , sizeof ( value ) ) ;
inparam = true ;
}
szToken = strtok ( NULL , " % " ) ;
}
if ( FStrEq ( name , " NoErrors " ) )
{
bDontWarn = pKey - > GetBool ( ) ;
}
for ( int i = 0 ; i < MANIFEST_NUM_TYPES ; i + + )
{
if ( FStrEq ( name , gm_szManifestFileStrings [ i ] . string ) )
{
if ( ! gm_szManifestFileStrings [ i ] . cvar | | gm_szManifestFileStrings [ i ] . cvar - > GetBool ( ) )
{
LoadFromValue ( value , i , bDontWarn ) ;
}
break ;
}
}
}
}
2020-05-22 20:26:31 -05:00
# ifdef MAPBASE_VSCRIPT
void ScriptAddManifestFile ( const char * szScript ) { AddManifestFile ( szScript ) ; }
void LoadSoundscriptFile ( const char * szScript ) { LoadFromValue ( szScript , MANIFEST_SOUNDSCRIPTS , false ) ; }
# ifndef CLIENT_DLL
void LoadTalkerFile ( const char * szScript ) { LoadFromValue ( szScript , MANIFEST_TALKER , false ) ; }
void LoadActbusyFile ( const char * szScript ) { LoadFromValue ( szScript , MANIFEST_ACTBUSY , false ) ; }
# endif
virtual void RegisterVScript ( )
{
g_pScriptVM - > RegisterInstance ( this , " Mapbase " ) ;
}
# endif
2019-08-31 19:28:20 +00:00
} ;
CMapbaseSystem g_MapbaseSystem ;
BEGIN_DATADESC_NO_BASE ( CMapbaseSystem )
//DEFINE_UTLVECTOR( m_StoredManifestFiles, FIELD_STRING ),
END_DATADESC ( )
2020-05-22 20:26:31 -05:00
# ifdef MAPBASE_VSCRIPT
BEGIN_SCRIPTDESC_ROOT ( CMapbaseSystem , SCRIPT_SINGLETON " All-purpose Mapbase system primarily used for map-specific files. " )
DEFINE_SCRIPTFUNC_NAMED ( ScriptAddManifestFile , " AddManifestFile " , " Loads a manifest file. " )
DEFINE_SCRIPTFUNC ( LoadSoundscriptFile , " Loads a custom soundscript file. " )
# ifndef CLIENT_DLL
DEFINE_SCRIPTFUNC ( LoadTalkerFile , " Loads a custom talker file. " )
DEFINE_SCRIPTFUNC ( LoadActbusyFile , " Loads a custom actbusy file. " )
# endif
END_SCRIPTDESC ( ) ;
# endif
2019-08-31 19:28:20 +00:00
# ifdef GAME_DLL
Mapbase v3.0
- Overhauled matcher system and added expanded wildcard support, meaning "text", "te?t", "blah_test", etc. are now supported instead of only trailing *
- Added support for regular expression matching
- Added the missing matrixinvert.h file, which prevented programmers from compiling vbsp
- Fixed env_global_light brightness
- Added info_player_view_proxy, an entity which mimics a player's view (created for script_intro)
- New UnZoomWithRate and SetZoomRate inputs on env_zoom
- New "Don't change target's angles" flag on logic_measure_movement
- Fixed logic_measure_movement not using ignore origin flags correctly
- Fixed filter_damage_mod secondary filter not recognizing mode correctly
- Fixed DisableGeigerCounter causing NPCs to ignore player, and possibly fixed other adverse effects in similar code
- Added SetEntityName input for setting an entity's targetname
- Added "SetTarget" support to point_posecontroller
- Added "sk_alyx_health" convar for adjustable npc_alyx health, restored/fixed "sk_barney_health" for adjustable npc_barney health
- Added ignore flags and several direction-related inputs to math_vector
- Added pose parameter stuff to logic_modelinfo
- Fixed ChangeWeapon not changing during combat
- Fixed holster/unholster on NPCs without holster/unholster animations
- Fixed func_tank and other "player in the way" code ignoring notarget
- Added SetPoseParameter input to animating entities
- Introduced an experimental chapter system which allows for custom chapter title/restriction management
- Added SetChapterTitle input to worldspawn for dynamic title changing
- Fixed func_tankairboatgun damage credit, added ability to use its damage keyvalues
- Fixed mapbase_rpc_enabled not actually affecting RPC
- Moved some newly found Combine soldier grenade code to ai_grenade for other grenade users
- Fixed some problems with the new shared activities
- Restored an old Mapbase entity as "prop_interactable", an entity which contains all of the functionality of a func_button/func_door in a prop entity
- Added env_microphone pitch scale for scaling the pitch of transmitted sounds
- Added experimental, long-overdue code for scenes to be able to access !target#'s and other scene-related names through AI_INPUT
- Added "mat_specular_disable_on_missing", which "disables" specular reflections when the cubemap texture is missing
- Fixed $envmapmasktransform and $bumptransform on VertexLitGeneric and related shaders
- Areaportal leaks now stop compilation in leaktest
- Replaced "-nodefaultcubemap" with "-defaultcubemap" as the shader changes allow maps to compile without default cubemaps by default with little effect
2020-02-05 19:08:49 +00:00
static CUtlVector < MODTITLECOMMENT > g_MapbaseChapterMaps ;
static CUtlVector < MODCHAPTER > g_MapbaseChapterList ;
CUtlVector < MODTITLECOMMENT > * Mapbase_GetChapterMaps ( )
{
if ( g_MapbaseChapterMaps . Count ( ) = = 0 )
{
// Check the chapter list
KeyValues * chapterlist = new KeyValues ( " ChapterList " ) ;
if ( chapterlist - > LoadFromFile ( filesystem , " scripts/chapters.txt " , " MOD " ) )
{
KeyValues * pKey = chapterlist - > GetFirstSubKey ( ) ;
if ( pKey )
{
if ( Q_stricmp ( pKey - > GetName ( ) , " Chapters " ) = = 0 )
{
for ( KeyValues * pChapters = pKey - > GetFirstSubKey ( ) ; pChapters ; pChapters = pChapters - > GetNextKey ( ) )
{
int index = g_MapbaseChapterList . AddToTail ( ) ;
g_MapbaseChapterList [ index ] . iChapter = atoi ( pChapters - > GetName ( ) ) ;
Q_strncpy ( g_MapbaseChapterList [ index ] . pChapterName , pChapters - > GetString ( ) , sizeof ( g_MapbaseChapterList [ index ] ) ) ;
}
}
for ( pKey = pKey - > GetNextKey ( ) ; pKey ; pKey = pKey - > GetNextKey ( ) )
{
int index = g_MapbaseChapterMaps . AddToTail ( ) ;
Q_strncpy ( g_MapbaseChapterMaps [ index ] . pBSPName , pKey - > GetName ( ) , sizeof ( g_MapbaseChapterMaps [ index ] . pBSPName ) ) ;
Q_strncpy ( g_MapbaseChapterMaps [ index ] . pTitleName , pKey - > GetString ( ) , sizeof ( g_MapbaseChapterMaps [ index ] . pTitleName ) ) ;
//comment.pBSPName = pKey->GetName();
//comment.pTitleName = pKey->GetString();
}
}
}
chapterlist - > deleteThis ( ) ;
}
return & g_MapbaseChapterMaps ;
}
CUtlVector < MODCHAPTER > * Mapbase_GetChapterList ( )
{
return & g_MapbaseChapterList ;
}
2019-08-31 19:28:20 +00:00
ThreeState_t Flashlight_GetLegacyVersionKey ( )
{
KeyValues * gameinfo = new KeyValues ( " GameInfo " ) ;
if ( g_MapbaseSystem . GetGameInfoKeyValues ( gameinfo ) )
{
// -1 = default
int iUseLegacyFlashlight = gameinfo - > GetInt ( " use_legacy_flashlight " , - 1 ) ;
if ( iUseLegacyFlashlight > - 1 )
return iUseLegacyFlashlight ! = 0 ? TRS_TRUE : TRS_FALSE ;
}
gameinfo - > deleteThis ( ) ;
return TRS_NONE ;
}
static void CC_Mapbase_LoadManifestFile ( const CCommand & args )
{
2020-05-22 20:26:31 -05:00
g_MapbaseSystem . AddManifestFile ( args [ 1 ] ) ;
2019-08-31 19:28:20 +00:00
}
static ConCommand mapbase_loadmanifestfile ( " mapbase_loadmanifestfile " , CC_Mapbase_LoadManifestFile , " Loads a Mapbase manifest file. If you don't want this to be saved and found when reloaded, type a '1' after the file path. " ) ;
# define SF_MANIFEST_START_ACTIVATED (1 << 0)
class CMapbaseManifestEntity : public CPointEntity
{
public :
DECLARE_DATADESC ( ) ;
DECLARE_CLASS ( CMapbaseManifestEntity , CPointEntity ) ;
void Spawn ( void )
{
BaseClass : : Spawn ( ) ;
if ( HasSpawnFlags ( SF_MANIFEST_START_ACTIVATED ) )
{
LoadManifestFile ( ) ;
}
}
void LoadManifestFile ( void )
{
const char * scriptfile = STRING ( m_target ) ;
if ( filesystem - > FileExists ( scriptfile , " GAME " ) )
{
Msg ( " Mapbase: Adding manifest file \" %s \" \n " , scriptfile ) ;
g_MapbaseSystem . AddManifestFile ( scriptfile ) ;
}
else
{
Warning ( " Mapbase: Manifest file \" %s \" does not exist! " , scriptfile ) ;
}
}
void InputActivate ( inputdata_t & inputdata )
{
LoadManifestFile ( ) ;
}
} ;
LINK_ENTITY_TO_CLASS ( mapbase_manifest , CMapbaseManifestEntity ) ;
BEGIN_DATADESC ( CMapbaseManifestEntity )
// Needs to be set up in the Activate methods of derived classes
//DEFINE_CUSTOM_FIELD( m_pInstancedResponseSystem, responseSystemSaveRestoreOps ),
// Function Pointers
DEFINE_INPUTFUNC ( FIELD_VOID , " Activate " , InputActivate ) ,
END_DATADESC ( )
# endif