Merge branch 'develop' into feature/asw-response-system

# Conflicts:
#	sp/src/game/server/server_mapbase.vpc
This commit is contained in:
Blixibon
2021-04-21 16:51:36 -05:00
94 changed files with 6183 additions and 774 deletions

View File

@@ -71,7 +71,7 @@ ConVar mapbase_load_actbusy("mapbase_load_actbusy", "1", FCVAR_ARCHIVE, "Should
#ifdef GAME_DLL
// This cvar should change with each Mapbase update
ConVar mapbase_version( "mapbase_version", "6.2", FCVAR_NONE, "The version of Mapbase currently being used in this mod." );
ConVar mapbase_version( "mapbase_version", "6.3", FCVAR_NONE, "The version of Mapbase currently being used in this mod." );
extern void MapbaseGameLog_Init();
@@ -178,7 +178,7 @@ public:
#ifdef GAME_DLL
if (g_bMapContainsCustomTalker && mapbase_flush_talker.GetBool())
{
CGMsg( 1, "Mapbase Misc.", "Mapbase: Reloading response system to flush custom talker\n" );
CGMsg( 1, CON_GROUP_MAPBASE_MISC, "Mapbase: Reloading response system to flush custom talker\n" );
ReloadResponseSystem();
g_bMapContainsCustomTalker = false;
}
@@ -188,7 +188,7 @@ public:
virtual void LevelInitPreEntity()
{
#ifdef GAME_DLL
CGMsg( 0, "Mapbase Misc.", "Mapbase system loaded\n" );
CGMsg( 0, CON_GROUP_MAPBASE_MISC, "Mapbase system loaded\n" );
#endif
// Checks gameinfo.txt for Mapbase-specific options
@@ -212,8 +212,11 @@ public:
RefreshMapName();
// Shared Mapbase localization file
// Shared Mapbase scripts to avoid overwriting mod files
g_pVGuiLocalize->AddFile( "resource/mapbase_%language%.txt" );
#ifdef CLIENT_DLL
PanelMetaClassMgr()->LoadMetaClassDefinitionFile( "scripts/vgui_screens_mapbase.txt" );
#endif
}
virtual void OnRestore()
@@ -352,11 +355,11 @@ public:
return;
}
CGMsg( 1, "Mapbase Misc.", "===== Mapbase Manifest: Loading manifest file %s =====\n", file );
CGMsg( 1, CON_GROUP_MAPBASE_MISC, "===== Mapbase Manifest: Loading manifest file %s =====\n", file );
AddManifestFile(pKV, false);
CGMsg( 1, "Mapbase Misc.", "==============================================================================\n" );
CGMsg( 1, CON_GROUP_MAPBASE_MISC, "==============================================================================\n" );
pKV->deleteThis();
}
@@ -553,6 +556,11 @@ CUtlVector<MODCHAPTER> *Mapbase_GetChapterList()
return &g_MapbaseChapterList;
}
int Mapbase_GetChapterCount()
{
return g_MapbaseChapterList.Count();
}
ThreeState_t Flashlight_GetLegacyVersionKey()
{
KeyValues *gameinfo = new KeyValues( "GameInfo" );
@@ -591,7 +599,7 @@ public:
const char *scriptfile = STRING(m_target);
if ( filesystem->FileExists( scriptfile, "MOD" ) )
{
CGMsg(0, "Mapbase Misc.", "Mapbase: Adding manifest file \"%s\"\n", scriptfile);
CGMsg(0, CON_GROUP_MAPBASE_MISC, "Mapbase: Adding manifest file \"%s\"\n", scriptfile);
g_MapbaseSystem.AddManifestFile(scriptfile);
}
else

View File

@@ -8,6 +8,7 @@
#include "cbase.h"
#include "activitylist.h"
#include "in_buttons.h"
#include "rope_shared.h"
#ifdef CLIENT_DLL
#include "c_ai_basenpc.h"
#else
@@ -66,7 +67,7 @@ BEGIN_SCRIPTENUM( RenderMode, "Render modes used by Get/SetRenderMode" )
DEFINE_ENUMCONST_NAMED( kRenderTransAdd, "Additive", "" )
DEFINE_ENUMCONST_NAMED( kRenderEnvironmental, "Environmental", "" )
DEFINE_ENUMCONST_NAMED( kRenderTransAddFrameBlend, "AdditiveFractionalFrame", "" )
DEFINE_ENUMCONST_NAMED( kRenderTransAlphaAdd, "Alpha Add", "" )
DEFINE_ENUMCONST_NAMED( kRenderTransAlphaAdd, "AlphaAdd", "" )
DEFINE_ENUMCONST_NAMED( kRenderWorldGlow, "WorldSpaceGlow", "" )
DEFINE_ENUMCONST_NAMED( kRenderNone, "None", "" )
@@ -310,6 +311,22 @@ void RegisterSharedScriptConstants()
ScriptRegisterConstant( g_pScriptVM, MOVETYPE_OBSERVER, "Move type used in GetMoveType(), etc." );
ScriptRegisterConstant( g_pScriptVM, MOVETYPE_CUSTOM, "Move type used in GetMoveType(), etc." );
//
// Ropes
//
ScriptRegisterConstant( g_pScriptVM, ROPE_RESIZE, "Try to keep the rope dangling the same amount even as the rope length changes. (for use in rope flags)" );
ScriptRegisterConstant( g_pScriptVM, ROPE_BARBED, "Hack option to draw like a barbed wire. (for use in rope flags)" );
ScriptRegisterConstant( g_pScriptVM, ROPE_COLLIDE, "Collide with the world. (for use in rope flags)" );
ScriptRegisterConstant( g_pScriptVM, ROPE_SIMULATE, "Is the rope valid? (for use in rope flags)" );
ScriptRegisterConstant( g_pScriptVM, ROPE_BREAKABLE, "Can the endpoints detach? (for use in rope flags)" );
ScriptRegisterConstant( g_pScriptVM, ROPE_USE_WIND, "Wind simulation on this rope. (for use in rope flags)" );
ScriptRegisterConstant( g_pScriptVM, ROPE_INITIAL_HANG, "By default, ropes will simulate for a bit internally when they are created so they sag, but dynamically created ropes for things like harpoons don't want this. (for use in rope flags)" );
ScriptRegisterConstant( g_pScriptVM, ROPE_PLAYER_WPN_ATTACH, "If this flag is set, then the second attachment must be a player. The rope will attach to \"buff_attach\" on the player's active weapon. This is a flag because it requires special code on the client to find the weapon. (for use in rope flags)" );
ScriptRegisterConstant( g_pScriptVM, ROPE_NO_GRAVITY, "Disable gravity on this rope. (for use in rope flags)" );
ScriptRegisterConstant( g_pScriptVM, ROPE_NUMFLAGS, "The number of rope flags recognized by the game." );
ScriptRegisterConstantNamed( g_pScriptVM, Vector( ROPE_GRAVITY ), "ROPE_GRAVITY", "Default rope gravity vector." );
#ifdef GAME_DLL
//
// Sound Types, Contexts, and Channels
@@ -483,7 +500,8 @@ void RegisterSharedScriptConstants()
//ScriptRegisterConstant( g_pScriptVM, AISS_AUTO_PVS_AFTER_PVS, "" );
ScriptRegisterConstant( g_pScriptVM, AI_SLEEP_FLAGS_NONE, "No sleep flags. (NPC sleep flag used in Add/Remove/HasSleepFlags())" );
ScriptRegisterConstant( g_pScriptVM, AI_SLEEP_FLAG_AUTO_PVS, "Indicates a NPC will sleep upon exiting PVS. (NPC sleep flag used in Add/Remove/HasSleepFlags())" );
ScriptRegisterConstant( g_pScriptVM, AI_SLEEP_FLAG_AUTO_PVS_AFTER_PVS, "Indicates a NPC will sleep upon exiting PVS after entering PVS for the first time(?????) (NPC sleep flag used in Add/Remove/HasSleepFlags())" );
// note: the one "?" is escaped to prevent evaluation of a trigraph
ScriptRegisterConstant( g_pScriptVM, AI_SLEEP_FLAG_AUTO_PVS_AFTER_PVS, "Indicates a NPC will sleep upon exiting PVS after entering PVS for the first time(????\?) (NPC sleep flag used in Add/Remove/HasSleepFlags())" );
ScriptRegisterConstantNamed( g_pScriptVM, CAI_BaseNPC::SCRIPT_PLAYING, "SCRIPT_PLAYING", "Playing the action animation." );
ScriptRegisterConstantNamed( g_pScriptVM, CAI_BaseNPC::SCRIPT_WAIT, "SCRIPT_WAIT", "Waiting on everyone in the script to be ready. Plays the pre idle animation if there is one." );

View File

@@ -22,10 +22,14 @@
#include "globalstate.h"
#include "vscript_server.h"
#include "soundent.h"
#endif // !CLIENT_DLL
#include "rope.h"
#else
#include "c_rope.h"
#endif // CLIENT_DLL
#include "con_nprint.h"
#include "particle_parse.h"
#include "npcevent.h"
#include "vscript_funcs_shared.h"
#include "vscript_singletons.h"
@@ -164,18 +168,18 @@ HSCRIPT SpawnEntityFromTable( const char *pszClassname, HSCRIPT hKV )
HSCRIPT EntIndexToHScript( int index )
{
#ifdef GAME_DLL
edict_t *e = INDEXENT(index);
if ( e && !e->IsFree() )
{
return ToHScript( GetContainingEntity( e ) );
}
edict_t *e = INDEXENT(index);
if ( e && !e->IsFree() )
{
return ToHScript( GetContainingEntity( e ) );
}
#else // CLIENT_DLL
if ( index < NUM_ENT_ENTRIES )
{
return ToHScript( CBaseEntity::Instance( index ) );
}
if ( index < NUM_ENT_ENTRIES )
{
return ToHScript( CBaseEntity::Instance( index ) );
}
#endif
return NULL;
return NULL;
}
//-----------------------------------------------------------------------------
@@ -501,6 +505,61 @@ FireBulletsInfo_t *GetFireBulletsInfoFromInfo( HSCRIPT hBulletsInfo )
return HScriptToClass<FireBulletsInfo_t>( hBulletsInfo );
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
CAnimEventTInstanceHelper g_AnimEventTInstanceHelper;
BEGIN_SCRIPTDESC_ROOT( animevent_t, "Handle for accessing animevent_t info." )
DEFINE_SCRIPT_INSTANCE_HELPER( &g_AnimEventTInstanceHelper )
END_SCRIPTDESC();
bool CAnimEventTInstanceHelper::Get( void *p, const char *pszKey, ScriptVariant_t &variant )
{
animevent_t *ani = ((animevent_t *)p);
if (FStrEq( pszKey, "event" ))
variant = ani->event;
else if (FStrEq( pszKey, "options" ))
variant = ani->options;
else if (FStrEq( pszKey, "cycle" ))
variant = ani->cycle;
else if (FStrEq( pszKey, "eventtime" ))
variant = ani->eventtime;
else if (FStrEq( pszKey, "type" ))
variant = ani->type;
else if (FStrEq( pszKey, "source" ))
variant = ToHScript(ani->pSource);
else
return false;
return true;
}
bool CAnimEventTInstanceHelper::Set( void *p, const char *pszKey, ScriptVariant_t &variant )
{
animevent_t *ani = ((animevent_t *)p);
if (FStrEq( pszKey, "event" ))
ani->event = variant;
else if (FStrEq( pszKey, "options" ))
ani->options = variant;
else if (FStrEq( pszKey, "cycle" ))
ani->cycle = variant;
else if (FStrEq( pszKey, "eventtime" ))
ani->eventtime = variant;
else if (FStrEq( pszKey, "type" ))
ani->type = variant;
else if (FStrEq( pszKey, "source" ))
{
CBaseEntity *pEnt = ToEnt( variant.m_hScript );
if (pEnt)
ani->pSource = pEnt->GetBaseAnimating();
}
else
return false;
return true;
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
@@ -682,6 +741,19 @@ static void ScriptDecalTrace( HSCRIPT hTrace, const char *decalName )
UTIL_DecalTrace( &traceInfo->GetTrace(), decalName );
}
static HSCRIPT ScriptCreateRope( HSCRIPT hStart, HSCRIPT hEnd, int iStartAttachment, int iEndAttachment, float ropeWidth, const char *pMaterialName, int numSegments, int ropeFlags )
{
#ifdef CLIENT_DLL
C_RopeKeyframe *pRope = C_RopeKeyframe::Create( ToEnt( hStart ), ToEnt( hEnd ), iStartAttachment, iEndAttachment, ropeWidth, pMaterialName, numSegments, ropeFlags );
#else
CRopeKeyframe *pRope = CRopeKeyframe::Create( ToEnt( hStart ), ToEnt( hEnd ), iStartAttachment, iEndAttachment, ropeWidth, pMaterialName, numSegments );
if (pRope)
pRope->m_RopeFlags |= ropeFlags; // HACKHACK
#endif
return ToHScript( pRope );
}
//-----------------------------------------------------------------------------
// Simple particle effect dispatch
//-----------------------------------------------------------------------------
@@ -740,20 +812,29 @@ void NPrint( int pos, const char* fmt )
void NXPrint( int pos, int r, int g, int b, bool fixed, float ftime, const char* fmt )
{
static con_nprint_t *info = new con_nprint_t;
con_nprint_t info;
info->index = pos;
info->time_to_live = ftime;
info->color[0] = r / 255.f;
info->color[1] = g / 255.f;
info->color[2] = b / 255.f;
info->fixed_width_font = fixed;
info.index = pos;
info.time_to_live = ftime;
info.color[0] = r / 255.f;
info.color[1] = g / 255.f;
info.color[2] = b / 255.f;
info.fixed_width_font = fixed;
engine->Con_NXPrintf(info, fmt);
// delete info;
engine->Con_NXPrintf( &info, fmt );
}
static float IntervalPerTick()
{
return gpGlobals->interval_per_tick;
}
static int GetFrameCount()
{
return gpGlobals->framecount;
}
//=============================================================================
//=============================================================================
@@ -837,6 +918,8 @@ void RegisterSharedScriptFunctions()
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptDecalTrace, "DecalTrace", "Creates a dynamic decal based on the given trace info. The trace information can be generated by TraceLineComplex() and the decal name must be from decals_subrect.txt." );
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptDispatchParticleEffect, "DoDispatchParticleEffect", SCRIPT_ALIAS( "DispatchParticleEffect", "Dispatches a one-off particle system" ) );
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptCreateRope, "CreateRope", "Creates a single rope between two entities. Can optionally follow specific attachments." );
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptMatcherMatch, "Matcher_Match", "Compares a string to a query using Mapbase's matcher system, supporting wildcards, RS matchers, etc." );
ScriptRegisterFunction( g_pScriptVM, Matcher_NamesMatch, "Compares a string to a query using Mapbase's matcher system using wildcards only." );
ScriptRegisterFunction( g_pScriptVM, AppearsToBeANumber, "Checks if the given string appears to be a number." );
@@ -850,6 +933,9 @@ void RegisterSharedScriptFunctions()
#endif
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptIsServer, "IsServer", "Returns true if the script is being run on the server." );
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptIsClient, "IsClient", "Returns true if the script is being run on the client." );
ScriptRegisterFunction( g_pScriptVM, IntervalPerTick, "Simulation tick interval" );
ScriptRegisterFunction( g_pScriptVM, GetFrameCount, "Absolute frame counter" );
//ScriptRegisterFunction( g_pScriptVM, GetTickCount, "Simulation ticks" );
RegisterScriptSingletons();
}

View File

@@ -121,4 +121,13 @@ private:
HSCRIPT m_planeAccessor;
};
//-----------------------------------------------------------------------------
// Exposes animevent_t to VScript
//-----------------------------------------------------------------------------
class CAnimEventTInstanceHelper : public IScriptInstanceHelper
{
bool Get( void *p, const char *pszKey, ScriptVariant_t &variant );
bool Set( void *p, const char *pszKey, ScriptVariant_t &variant );
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -5,8 +5,8 @@
// $NoKeywords: $
//=============================================================================
#ifndef VSCRIPT_SINGLETONS
#define VSCRIPT_SINGLETONS
#ifndef VSCRIPT_SINGLETONS_H
#define VSCRIPT_SINGLETONS_H
#ifdef _WIN32
#pragma once
#endif
@@ -29,21 +29,24 @@ class CNetMsgScriptHelper : public CAutoGameSystem
class CNetMsgScriptHelper
#endif
{
#ifdef CLIENT_DLL
public:
bool m_bWriteReady; // dt ready to send
#endif
private:
#ifdef GAME_DLL
CRecipientFilter m_filter;
bf_read *m_MsgIn;
CRecipientFilter m_filter;
#else
bf_read m_MsgIn;
#endif
HSCRIPT m_Hooks;
bf_write m_MsgOut;
byte m_MsgData[ PAD_NUMBER( SCRIPT_NETMSG_DATA_SIZE, 4 ) ];
HSCRIPT m_Hooks;
public:
#ifdef CLIENT_DLL
bool m_bWriteReady; // dt ready to send
CNetMsgScriptHelper() : m_Hooks(NULL), m_bWriteReady(false) {}
#else
CNetMsgScriptHelper() : m_Hooks(NULL) {}
@@ -58,9 +61,9 @@ public:
void InitPostVM();
#ifdef GAME_DLL
void RecieveMessage( bf_read *msg, CBaseEntity *pPlayer );
void ReceiveMessage( bf_read *msg, CBaseEntity *pPlayer );
#else
void RecieveMessage( bf_read &msg );
void ReceiveMessage( bf_read &msg );
#endif
void WriteToBuffer( bf_write *bf );
@@ -72,7 +75,7 @@ public:
#else
void Send();
#endif
void Recieve( const char *msg, HSCRIPT func );
void Receive( const char *msg, HSCRIPT func );
#ifdef GAME_DLL
inline void DoSendUserMsg( CRecipientFilter *filter, int type );
@@ -100,14 +103,14 @@ public:
void WriteShort( int iValue ); // 16 bit short
void WriteWord( int iValue ); // 16 bit unsigned short
void WriteLong( int iValue ); // 32 bit long
void WriteFloat( float flValue );
void WriteNormal( float flValue ); // 12 bit
void WriteFloat( float flValue ); // 32 bit float
void WriteNormal( float flValue ); // 12 bit (1 + NORMAL_FRACTIONAL_BITS)
void WriteAngle( float flValue ); // 8 bit unsigned char
void WriteCoord( float flValue );
void WriteVec3Coord( const Vector& rgflValue );
void WriteVec3Normal( const Vector& rgflValue ); // 27 bit ( 3 + 2 * (1 + NORMAL_FRACTIONAL_BITS) )
void WriteAngles( const QAngle& rgflValue );
void WriteString( const char *sz ); // max 512 bytes at once
void WriteString( const char *sz );
void WriteBool( bool bValue ); // 1 bit
void WriteEntity( HSCRIPT hEnt ); // 11 bit (entindex)
void WriteEHandle( HSCRIPT hEnt ); // 32 bit long

View File

@@ -5,8 +5,8 @@
// $NoKeywords: $
//=============================================================================
#ifndef VSCRIPT_FUNCS_MATH
#define VSCRIPT_FUNCS_MATH
#ifndef WEAPON_CUSTOM_SCRIPTED_H
#define WEAPON_CUSTOM_SCRIPTED_H
#ifdef _WIN32
#pragma once
#endif