Mapbase v6.0

- Fixed path_track paths saving as pointers instead of handles
- Fixed player animations not falling to base class correctly
- Fixed logic_externaldata creating garbage in trailing spaces
- Added "SetHandModelSkin" input
- Added unique colors for various types of console message, adjustable via convars
- Added the ability to use map-specific weapon scripts
- Added a way to display (placeholder) text entirely from Faceposer scenes
- Added "autobreak" keyvalue to game_text, which automatically breaks long text into different lines
- Added the ability to change a game_text's font (very limited)
- Added LightToggle input to point_spotlight
- Added Enable/DisableSprites on npc_manhack
- Added ai_goal_police behavior from metrocops to Combine soldiers and citizens
- Added func_precipitation particle rain systems from the Alien Swarm SDK
- Added new func_precipitation spawnflags for controlling behavior in particle types
- Added "mapbase_version" cvar which shows the version of Mapbase a mod might be running on
- Fixed an oversight with NPC crouch activities which was causing npc_metropolice to stop firing in standoffs
- Added toggleable patches to npc_combine AI which make soldiers less likely to stand around without shooting or rush to melee when not needed
- Added key for custom logo font on env_credits scripts
- Added SetSpeed and SetPushDir inputs for trigger_push
- Added a bunch of I/O/KV to func_fish_pool to allow for more control over the fish
- Added OnLostEnemy/Player support for npc_combine_camera
- Added enhanced save/restore for the Response System, toggleable via convar
- Added a convar which allows users to disable weapon autoswitching when picking up ammo
- Split VScript base script into its own file
- Added VScript descriptions for NPC squads and the manager class which handles them
- Moved several classes, functions, etc. to the VScript library itself for future usage in other projects, like VBSP
- Added VScript to VBSP with basic map file interfacing
- Made some VScript documentation more clear due to deprecation of online documentation
- Added VScript "hook" registration, creating a standardized system which shows up in script_help documentation
- Added VScript-driven custom weapons
- Added clientside VScript scopes
- Added a bunch of weapon-related VScript functions
- Split a bunch of cluttered VScript stuff into different files
- Added VScript functions for "following" entities/bonemerging
- Added VScript functions for grenades
- Added a few more VScript trigger functions
- Added OnDeath hook for VScript
- Fixed documentation for aliased functions in VScript
- Fixed $bumpmask not working on SDK_LightmappedGeneric
- Made vertex blend swapping in Hammer use a constant instead of a combo (makes it easier to compile the shader, especially for $bumpmask's sake)
- Fixed brush phong, etc. causing SDK_WorldVertexTransition to stop working
- Added limited support for $envmapmask in the bumpmapping shader
- Fixed more issues with parallax corrected cubemaps and instances
- Made instance variable recursion consistent with VMFII
This commit is contained in:
Blixibon
2020-11-26 02:26:55 +00:00
parent 3b5b3a9ccb
commit eb014cce6c
125 changed files with 8058 additions and 2767 deletions

View File

@@ -18,6 +18,9 @@
#ifdef PARALLAX_CORRECTED_CUBEMAPS
#include "matrixinvert.h"
#endif
#ifdef MAPBASE_VSCRIPT
#include "vscript_vbsp.h"
#endif
#ifdef VSVMFIO
#include "VmfImport.h"
@@ -53,6 +56,9 @@ extern qboolean onlyents;
extern entity_t *g_ManifestWorldSpawn;
char g_MainMapPath[ MAX_PATH ];
// This is done for the instancing fix
bool g_pParallaxObbsDone[MAX_MAP_CUBEMAPSAMPLES];
#endif
@@ -2568,6 +2574,32 @@ void CMapFile::MergeEntities( entity_t *pInstanceEntity, CMapFile *Instance, Vec
Q_snprintf( temp, sizeof( temp ), "%f", vOutNormal.z );
SetKeyValue( entity, "normal.z", temp );*/
}
#ifdef MAPBASE
else if ( !strcmp( pEntity, "func_instance" ) )
{
int iNumReplaces = 0;
for ( epair_t *epSubInstance = entity->epairs; epSubInstance != NULL; epSubInstance = epSubInstance->next )
{
if ( strnicmp( epSubInstance->key, INSTANCE_VARIABLE_KEY, strlen( INSTANCE_VARIABLE_KEY ) ) == 0 )
{
iNumReplaces++;
}
}
// Merge this instance's keys
for ( epair_t *epInstance = pInstanceEntity->epairs; epInstance != NULL; epInstance = epInstance->next )
{
if ( strnicmp( epInstance->key, INSTANCE_VARIABLE_KEY, strlen( INSTANCE_VARIABLE_KEY ) ) == 0 )
{
iNumReplaces++;
char szKey[32];
Q_snprintf(szKey, sizeof(szKey), "replace%i", iNumReplaces);
SetKeyValue( entity, szKey, epInstance->value );
}
}
}
#endif
}
#ifdef MERGE_INSTANCE_DEBUG_INFO
@@ -2766,6 +2798,23 @@ bool LoadMapFile( const char *pszFileName )
if ((eResult == ChunkFile_Ok) || (eResult == ChunkFile_EOF))
{
#ifdef MAPBASE_VSCRIPT
if ( g_pScriptVM )
{
HSCRIPT hFunc = g_pScriptVM->LookupFunction( "OnMapLoaded" );
if ( hFunc )
{
// Use GetLoadingMap()
//g_pScriptVM->SetValue( "map", g_LoadingMap->GetScriptInstance() );
g_pScriptVM->Call( hFunc );
g_pScriptVM->ReleaseFunction( hFunc );
//g_pScriptVM->ClearValue( "map" );
}
}
#endif
// Update the overlay/side list(s).
Overlay_UpdateSideLists( g_LoadingMap->m_StartMapOverlays );
OverlayTransition_UpdateSideLists( g_LoadingMap->m_StartMapWaterOverlays );
@@ -2781,31 +2830,31 @@ bool LoadMapFile( const char *pszFileName )
// Fill out parallax obb matrix array
// "i" is static so this code could account for
// multiple LoadMapFile() calls from instances, etc.
for (static int i = 0; i < g_nCubemapSamples; i++)
for (int i = 0; i < g_nCubemapSamples; i++)
{
if (g_pParallaxObbStrs[i][0] != '\0')
if (g_pParallaxObbStrs[i][0] != '\0' && g_pParallaxObbsDone[i] == false)
{
Warning( "Testing OBB string %s\n", g_pParallaxObbStrs[i] );
entity_t* obbEnt = NULL;
for (int i2 = 0; i2 < g_LoadingMap->num_entities; i2++)
{
entity_t* obbEnt = &g_LoadingMap->entities[i2];
if (stricmp( ValueForKey( obbEnt, "targetname" ), g_pParallaxObbStrs[i] ) != 0)
if (stricmp( ValueForKey( &g_LoadingMap->entities[i2], "targetname" ), g_pParallaxObbStrs[i] ) != 0)
continue;
if (obbEnt)
{
g_pParallaxObbStrs[i] = ValueForKey(obbEnt, "transformationmatrix");
Warning( "Using OBB transformation matrix \"%s\"\n", g_pParallaxObbStrs[i] );
}
else
{
Warning( "Cannot find parallax obb \"%s\"\n", g_pParallaxObbStrs[i] );
g_pParallaxObbStrs[i][0] = '\0';
}
obbEnt = &g_LoadingMap->entities[i2];
g_pParallaxObbStrs[i] = ValueForKey(obbEnt, "transformationmatrix");
Warning( "Using OBB transformation matrix \"%s\"\n", g_pParallaxObbStrs[i] );
g_pParallaxObbsDone[i] = true;
break;
}
if (!obbEnt)
{
Warning( "Cannot find parallax obb \"%s\" (num_entities is %i)\n", g_pParallaxObbStrs[i], g_LoadingMap->num_entities );
//g_pParallaxObbStrs[i][0] = '\0';
}
}
}
@@ -3320,6 +3369,133 @@ ChunkFileResult_t LoadSolidKeyCallback(const char *szKey, const char *szValue, m
}
#ifdef MAPBASE_VSCRIPT
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
HSCRIPT CMapFile::GetScriptInstance()
{
if (!m_hScriptInstance)
m_hScriptInstance = g_pScriptVM->RegisterInstance( this );
return m_hScriptInstance;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CMapFile::ScriptGetEntityKeyValues( int idx, HSCRIPT hKeyTable, HSCRIPT hValTable )
{
epair_t *curPair = entities[idx].epairs;
while (curPair)
{
g_pScriptVM->ArrayAppend( hKeyTable, curPair->key );
g_pScriptVM->ArrayAppend( hValTable, curPair->value );
curPair = curPair->next;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int CMapFile::ScriptAddSimpleEntityKV( HSCRIPT hKV )
{
if (num_entities == MAX_MAP_ENTITIES)
{
// Exits.
g_MapError.ReportError ("num_entities == MAX_MAP_ENTITIES");
return -1;
}
entity_t *mapent = NULL;
if (::num_entities > 0)
{
// We're not loading maps anymore. Add this to the central BSP
mapent = &::entities[num_entities];
::num_entities++;
}
else
{
mapent = &entities[num_entities];
num_entities++;
}
memset(mapent, 0, sizeof(*mapent));
mapent->firstbrush = nummapbrushes;
mapent->numbrushes = 0;
//mapent->portalareas[0] = -1;
//mapent->portalareas[1] = -1;
LoadEntity_t LoadEntity;
LoadEntity.pEntity = mapent;
// No default flags/contents
LoadEntity.nBaseFlags = 0;
LoadEntity.nBaseContents = 0;
int nIterator = -1;
ScriptVariant_t varKey, varValue;
char szValue[256];
while ((nIterator = g_pScriptVM->GetKeyValue( hKV, nIterator, &varKey, &varValue )) != -1)
{
switch (varValue.m_type)
{
case FIELD_CSTRING: Q_strncpy( szValue, varValue.m_pszString, sizeof(szValue) ); break;
case FIELD_INTEGER: Q_snprintf( szValue, sizeof(szValue), "%i", varValue.m_int ); break;
case FIELD_FLOAT: Q_snprintf( szValue, sizeof(szValue), "%f", varValue.m_float ); break;
case FIELD_CHARACTER: Q_snprintf( szValue, sizeof( szValue ), "%c", varValue.m_char ); break;
case FIELD_BOOLEAN: Q_snprintf( szValue, sizeof(szValue), "%d", varValue.m_bool ); break;
case FIELD_VECTOR: Q_snprintf( szValue, sizeof(szValue), "%f %f %f", (*varValue.m_pVector).x, (*varValue.m_pVector).y, (*varValue.m_pVector).z ); break;
default: szValue[0] = '\0'; break;
}
LoadEntityKeyCallback( varKey, szValue, &LoadEntity );
g_pScriptVM->ReleaseValue( varKey );
g_pScriptVM->ReleaseValue( varValue );
}
return num_entities - 1;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int CMapFile::ScriptAddInstance( const char *pszVMF, const Vector& vecOrigin, const QAngle& angAngles )
{
if (num_entities == MAX_MAP_ENTITIES)
{
// Exits.
g_MapError.ReportError ("num_entities == MAX_MAP_ENTITIES");
return -1;
}
entity_t *mapent = &entities[num_entities];
num_entities++;
memset(mapent, 0, sizeof(*mapent));
mapent->firstbrush = nummapbrushes;
mapent->numbrushes = 0;
//mapent->portalareas[0] = -1;
//mapent->portalareas[1] = -1;
SetKeyValue( mapent, "classname", "func_instance" );
SetKeyValue( mapent, "file", pszVMF );
SetKeyValue( mapent, "fixup_style", "2" ); // No fixup
char szValue[256];
Q_snprintf( szValue, sizeof(szValue), "%f %f %f", vecOrigin.x, vecOrigin.y, vecOrigin.z );
SetKeyValue( mapent, "origin", szValue );
Q_snprintf( szValue, sizeof(szValue), "%f %f %f", angAngles.x, angAngles.y, angAngles.z );
SetKeyValue( mapent, "angles", szValue );
return num_entities - 1;
}
#endif
/*
================
TestExpandBrushes