mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-04-12 04:30:08 +03:00
- 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
186 lines
4.7 KiB
C++
186 lines
4.7 KiB
C++
//========= Copyright Valve Corporation, All rights reserved. ============//
|
|
//
|
|
// Purpose:
|
|
//
|
|
// $Workfile: $
|
|
// $Date: $
|
|
// $NoKeywords: $
|
|
//=============================================================================//
|
|
|
|
// C callable material system interface for the utils.
|
|
|
|
#include "materialsystem/imaterialsystem.h"
|
|
#include "materialsystem/imaterial.h"
|
|
#include "materialsystem/imaterialvar.h"
|
|
#include <cmdlib.h>
|
|
#include "utilmatlib.h"
|
|
#include "tier0/dbg.h"
|
|
#include <windows.h>
|
|
#include "filesystem.h"
|
|
#include "materialsystem/materialsystem_config.h"
|
|
#include "mathlib/Mathlib.h"
|
|
|
|
void LoadMaterialSystemInterface( CreateInterfaceFn fileSystemFactory )
|
|
{
|
|
if( g_pMaterialSystem )
|
|
return;
|
|
|
|
// materialsystem.dll should be in the path, it's in bin along with vbsp.
|
|
const char *pDllName = "materialsystem.dll";
|
|
CSysModule *materialSystemDLLHInst;
|
|
materialSystemDLLHInst = g_pFullFileSystem->LoadModule( pDllName );
|
|
if( !materialSystemDLLHInst )
|
|
{
|
|
Error( "Can't load MaterialSystem.dll\n" );
|
|
}
|
|
|
|
CreateInterfaceFn clientFactory = Sys_GetFactory( materialSystemDLLHInst );
|
|
if ( clientFactory )
|
|
{
|
|
g_pMaterialSystem = (IMaterialSystem *)clientFactory( MATERIAL_SYSTEM_INTERFACE_VERSION, NULL );
|
|
if ( !g_pMaterialSystem )
|
|
{
|
|
Error( "Could not get the material system interface from materialsystem.dll (" __FILE__ ")" );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Error( "Could not find factory interface in library MaterialSystem.dll" );
|
|
}
|
|
|
|
if (!g_pMaterialSystem->Init( "shaderapiempty.dll", 0, fileSystemFactory ))
|
|
{
|
|
Error( "Could not start the empty shader (shaderapiempty.dll)!" );
|
|
}
|
|
}
|
|
|
|
void InitMaterialSystem( const char *materialBaseDirPath, CreateInterfaceFn fileSystemFactory )
|
|
{
|
|
LoadMaterialSystemInterface( fileSystemFactory );
|
|
MaterialSystem_Config_t config;
|
|
g_pMaterialSystem->OverrideConfig( config, false );
|
|
g_pMaterialSystem->ModInit();
|
|
}
|
|
|
|
void ShutdownMaterialSystem( )
|
|
{
|
|
if ( g_pMaterialSystem )
|
|
{
|
|
g_pMaterialSystem->Shutdown();
|
|
g_pMaterialSystem = NULL;
|
|
}
|
|
}
|
|
|
|
MaterialSystemMaterial_t FindMaterial( const char *materialName, bool *pFound, bool bComplain )
|
|
{
|
|
IMaterial *pMat = g_pMaterialSystem->FindMaterial( materialName, TEXTURE_GROUP_OTHER, bComplain );
|
|
MaterialSystemMaterial_t matHandle = pMat;
|
|
|
|
if ( pFound )
|
|
{
|
|
*pFound = true;
|
|
if ( IsErrorMaterial( pMat ) )
|
|
*pFound = false;
|
|
}
|
|
|
|
return matHandle;
|
|
}
|
|
|
|
void GetMaterialDimensions( MaterialSystemMaterial_t materialHandle, int *width, int *height )
|
|
{
|
|
PreviewImageRetVal_t retVal;
|
|
ImageFormat dummyImageFormat;
|
|
IMaterial *material = ( IMaterial * )materialHandle;
|
|
bool translucent;
|
|
retVal = material->GetPreviewImageProperties( width, height, &dummyImageFormat, &translucent );
|
|
if (retVal != MATERIAL_PREVIEW_IMAGE_OK )
|
|
{
|
|
#if 0
|
|
if (retVal == MATERIAL_PREVIEW_IMAGE_BAD )
|
|
{
|
|
Error( "problem getting preview image for %s",
|
|
g_pMaterialSystem->GetMaterialName( materialInfo[matID].materialHandle ) );
|
|
}
|
|
#else
|
|
*width = 128;
|
|
*height = 128;
|
|
#endif
|
|
}
|
|
}
|
|
|
|
void GetMaterialReflectivity( MaterialSystemMaterial_t materialHandle, float *reflectivityVect )
|
|
{
|
|
IMaterial *material = ( IMaterial * )materialHandle;
|
|
const IMaterialVar *reflectivityVar;
|
|
|
|
bool found;
|
|
reflectivityVar = material->FindVar( "$reflectivity", &found, false );
|
|
if( !found )
|
|
{
|
|
Vector tmp;
|
|
material->GetReflectivity( tmp );
|
|
VectorCopy( tmp.Base(), reflectivityVect );
|
|
}
|
|
else
|
|
{
|
|
reflectivityVar->GetVecValue( reflectivityVect, 3 );
|
|
}
|
|
}
|
|
|
|
int GetMaterialShaderPropertyBool( MaterialSystemMaterial_t materialHandle, int propID )
|
|
{
|
|
IMaterial *material = ( IMaterial * )materialHandle;
|
|
switch( propID )
|
|
{
|
|
case UTILMATLIB_NEEDS_BUMPED_LIGHTMAPS:
|
|
return material->GetPropertyFlag( MATERIAL_PROPERTY_NEEDS_BUMPED_LIGHTMAPS );
|
|
|
|
case UTILMATLIB_NEEDS_LIGHTMAP:
|
|
return material->GetPropertyFlag( MATERIAL_PROPERTY_NEEDS_LIGHTMAP );
|
|
|
|
default:
|
|
Assert( 0 );
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
int GetMaterialShaderPropertyInt( MaterialSystemMaterial_t materialHandle, int propID )
|
|
{
|
|
IMaterial *material = ( IMaterial * )materialHandle;
|
|
switch( propID )
|
|
{
|
|
case UTILMATLIB_OPACITY:
|
|
if (material->IsTranslucent())
|
|
return UTILMATLIB_TRANSLUCENT;
|
|
if (material->IsAlphaTested())
|
|
return UTILMATLIB_ALPHATEST;
|
|
return UTILMATLIB_OPAQUE;
|
|
|
|
default:
|
|
Assert( 0 );
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
const char *GetMaterialVar( MaterialSystemMaterial_t materialHandle, const char *propertyName )
|
|
{
|
|
IMaterial *material = ( IMaterial * )materialHandle;
|
|
IMaterialVar *var;
|
|
bool found;
|
|
var = material->FindVar( propertyName, &found, false );
|
|
if( found )
|
|
{
|
|
return var->GetStringValue();
|
|
}
|
|
else
|
|
{
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
const char *GetMaterialShaderName( MaterialSystemMaterial_t materialHandle )
|
|
{
|
|
IMaterial *material = ( IMaterial * )materialHandle;
|
|
return material->GetShaderName();
|
|
}
|