Skip to content

Commit

Permalink
in-progress: 20160315b
Browse files Browse the repository at this point in the history
  • Loading branch information
sigsegv-mvm committed Apr 29, 2016
1 parent 369d4ce commit 381375d
Show file tree
Hide file tree
Showing 26 changed files with 919 additions and 240 deletions.
6 changes: 5 additions & 1 deletion AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sourceFiles = [
'src/common.cpp',
'src/sizeof.cpp',
'src/extension.cpp',
'src/client.cpp',
'src/factory.cpp',
'src/gameconf.cpp',
'src/library.cpp',
'src/disasm/disasm.cpp',
Expand Down Expand Up @@ -45,6 +45,8 @@ sourceFiles = [
'src/stub/objects.cpp',
'src/stub/econ.cpp',
'src/stub/cdebugoverlay.cpp',
'src/stub/particles.cpp',
'src/stub/igamesystem.cpp',
'src/link/link.cpp',
'src/link/nextbot1.cpp',
'src/link/nextbot2.cpp',
Expand Down Expand Up @@ -91,6 +93,7 @@ sourceFiles = [
'src/mod/robot/ticklish.cpp',
'src/mod/sniper/charge_uncap.cpp',
'src/mod/sniper/head_uncap.cpp',
'src/mod/sound/tele_activate.cpp',
'src/mod/util/console_recv.cpp',
'src/mod/util/console_send.cpp',
'src/mod/util/listenserverhost.cpp',
Expand All @@ -102,6 +105,7 @@ sourceFiles = [
'src/mod/visualize/explosive_headshot.cpp',
'src/mod/visualize/minigun_deflect.cpp',
'src/mod/visualize/taunt_attacks.cpp',
'src/mod/visualize/jar_radius.cpp',
]

###############
Expand Down
8 changes: 8 additions & 0 deletions PackageScript
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ folder_list = [
'addons/sourcemod/gamedata/sigsegv',
# 'addons/sourcemod/configs',
'custom/sigsegv/resource',
'custom/sigsegv/scripts',
]

# Create the distribution folder hierarchy.
Expand Down Expand Up @@ -86,6 +87,13 @@ CopyFiles('resource', 'custom/sigsegv/resource',
]
)

# Script files
CopyFiles('scripts', 'custom/sigsegv/scripts',
[
'sigsegv_sound_overrides.txt',
]
)

# Copy binaries.
for cxx_task in Extension.extensions:
src = os.path.join('..', cxx_task.binary.path)
Expand Down
79 changes: 79 additions & 0 deletions gamedata/sigsegv/misc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,85 @@
type "sym"
sym "_ZN11CBaseEntity6RemoveEv"
}

"UTIL_EntitiesInSphere"
{
type "sym"
sym "_Z21UTIL_EntitiesInSphereRK6VectorfP20CFlaggedEntitiesEnum"
}
"CTFProjectile_Jar::Explode"
{
type "sym"
sym "_ZN17CTFProjectile_Jar7ExplodeEP10CGameTracei"
}
"CBaseProjectile::GetProjectileType"
{
type "sym"
sym "_ZNK15CBaseProjectile17GetProjectileTypeEv"
}
"CTFWeaponBaseGrenadeProj::GetWeaponID"
{
type "sym"
sym "_ZNK24CTFWeaponBaseGrenadeProj11GetWeaponIDEv"
}

"DispatchParticleEffect [overload 1]"
{
type "sym"
sym "_Z22DispatchParticleEffectPKc20ParticleAttachment_tP11CBaseEntityS0_b"
}
"DispatchParticleEffect [overload 2]"
{
type "sym"
sym "_Z22DispatchParticleEffectPKc20ParticleAttachment_tP11CBaseEntityib"
}
"DispatchParticleEffect [overload 3]"
{
type "sym"
sym "_Z22DispatchParticleEffectPKc6Vector6QAngleP11CBaseEntity"
}
"DispatchParticleEffect [overload 4]"
{
type "sym"
sym "_Z22DispatchParticleEffectPKc6VectorS1_6QAngleP11CBaseEntity"
}
"DispatchParticleEffect [overload 5]"
{
type "sym"
sym "_Z22DispatchParticleEffecti6VectorS_6QAngleP11CBaseEntity"
}
"DispatchParticleEffect [overload 6]"
{
type "sym"
sym "_Z22DispatchParticleEffectPKc20ParticleAttachment_tP11CBaseEntityS0_6VectorS4_bb"
}
"DispatchParticleEffect [overload 7]"
{
type "sym"
sym "_Z22DispatchParticleEffectPKc6Vector6QAngleS1_S1_bP11CBaseEntityi"
}
"StopParticleEffects"
{
type "sym"
sym "_Z19StopParticleEffectsP11CBaseEntity"
}

"CBaseEntity::EmitSound"
{
type "sym"
sym "_ZN11CBaseEntity9EmitSoundEPKcfPf"
}

"IGameSystem::Add"
{
type "sym"
sym "_ZN11IGameSystem3AddEPS_"
}
"IGameSystem::Remove"
{
type "sym"
sym "_ZN11IGameSystem6RemoveEPS_"
}
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions gamedata/sigsegv/tfplayer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@
type "sym"
sym "_ZN15CTFPlayerShared10StunPlayerEffiP9CTFPlayer"
}
"CTFPlayerShared::OnConditionAdded"
{
type "sym"
sym "_ZN15CTFPlayerShared16OnConditionAddedE7ETFCond"
}
"CTFPlayerShared::OnConditionRemoved"
{
type "sym"
sym "_ZN15CTFPlayerShared18OnConditionRemovedE7ETFCond"
}

"CTFPlayerSharedUtils::GetEconItemViewByLoadoutSlot"
{
Expand Down
8 changes: 8 additions & 0 deletions scripts/sigsegv_sound_overrides.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"MVM.Robot_Teleporter_Activate"
{
"channel" "CHAN_STATIC"
"volume" "1"
"pitch" "100"
"soundlevel" "SNDLVL_150dB"
"wave" ")mvm/mvm_tele_activate.wav"
}
16 changes: 13 additions & 3 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ class ICvar;
class ISpatialPartition;
class IEngineTrace;
class IStaticPropMgrServer;
class IVDebugOverlay;
class IGameEventManager2;
class IEngineSound;
class IVDebugOverlay;
class ISoundEmitterSystemBase;
class IMaterialSystem;
class CGlobalVars;
class CBaseEntityList;
class IBaseClientDLL;
class IMaterialSystem;
namespace SourcePawn {
class ISourcePawnEngine;
}
Expand All @@ -38,13 +40,17 @@ extern ISpatialPartition *partition;
extern IEngineTrace *enginetrace;
extern IStaticPropMgrServer *staticpropmgr;
extern IGameEventManager2 *gameeventmanager;
extern IEngineSound *enginesound;
extern IVDebugOverlay *debugoverlay;

extern ISoundEmitterSystemBase *soundemitterbase;

extern IMaterialSystem *g_pMaterialSystem;

extern CGlobalVars *gpGlobals;
extern CBaseEntityList *g_pEntityList;

extern IBaseClientDLL *clientdll;
extern IMaterialSystem *g_pMaterialSystem;

extern SourcePawn::ISourcePawnEngine *g_pSourcePawn;
extern SourceMod::IExtensionManager *smexts;
Expand Down Expand Up @@ -155,6 +161,10 @@ extern SourceMod::IExtensionManager *smexts;
#include <mp_shareddefs.h>
#include <materialsystem/imaterialsystem.h>
#include <materialsystem/imaterial.h>
#include <particle_parse.h>
#include <SoundEmitterSystem/isoundemittersystembase.h>
#include <IEngineSound.h>
#include <igamesystem.h>

#define DECLARE_PREDICTABLE()
#include <collisionproperty.h>
Expand Down
75 changes: 68 additions & 7 deletions src/extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "prop.h"
#include "util/rtti.h"
#include "disasm/disasm.h"
#include "client.h"
#include "factory.h"


CExtSigsegv g_Ext;
Expand All @@ -20,13 +20,17 @@ ISpatialPartition *partition = nullptr;
IEngineTrace *enginetrace = nullptr;
IStaticPropMgrServer *staticpropmgr = nullptr;
IGameEventManager2 *gameeventmanager = nullptr;
IEngineSound *enginesound = nullptr;
IVDebugOverlay *debugoverlay = nullptr;

ISoundEmitterSystemBase *soundemitterbase = nullptr;

IMaterialSystem *g_pMaterialSystem = nullptr;

CGlobalVars *gpGlobals = nullptr;
CBaseEntityList *g_pEntityList = nullptr;

IBaseClientDLL *clientdll = nullptr;
IMaterialSystem *g_pMaterialSystem = nullptr;

SourcePawn::ISourcePawnEngine *g_pSourcePawn = nullptr;
SourceMod::IExtensionManager *smexts = nullptr;
Expand Down Expand Up @@ -54,7 +58,11 @@ bool CExtSigsegv::SDK_OnLoad(char *error, size_t maxlen, bool late)
// sharesys->AddDependency(myself, "sdktools.ext", true, true);
// SM_GET_IFACE(SDKTOOLS, g_pSDKTools);

gameeventmanager->LoadEventsFromFile("resource/sigsegv_events.res");
if (gameeventmanager != nullptr) {
gameeventmanager->LoadEventsFromFile("resource/sigsegv_events.res");
}

this->LoadSoundOverrides();

g_pEntityList = reinterpret_cast<CBaseEntityList *>(gamehelpers->GetGlobalEntityList());

Expand All @@ -73,7 +81,9 @@ bool CExtSigsegv::SDK_OnLoad(char *error, size_t maxlen, bool late)

Prop::PreloadAll();

CModManager::LoadAllMods();
g_ModManager.Load();

IGameSystem::Add(this);

return true;

Expand All @@ -84,7 +94,9 @@ bool CExtSigsegv::SDK_OnLoad(char *error, size_t maxlen, bool late)

void CExtSigsegv::SDK_OnUnload()
{
CModManager::UnloadAllMods();
IGameSystem::Remove(this);

g_ModManager.Unload();

LibMgr::Unload();

Expand Down Expand Up @@ -121,15 +133,23 @@ bool CExtSigsegv::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, b
GET_V_IFACE_CURRENT(GetEngineFactory, enginetrace, IEngineTrace, INTERFACEVERSION_ENGINETRACE_SERVER);
GET_V_IFACE_CURRENT(GetEngineFactory, staticpropmgr, IStaticPropMgrServer, INTERFACEVERSION_STATICPROPMGR_SERVER);
GET_V_IFACE_CURRENT(GetEngineFactory, gameeventmanager, IGameEventManager2, INTERFACEVERSION_GAMEEVENTSMANAGER2);
GET_V_IFACE_CURRENT(GetEngineFactory, enginesound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);

//GET_V_IFACE_CURRENT(GetEngineFactory, debugoverlay, IVDebugOverlay, VDEBUG_OVERLAY_INTERFACE_VERSION);
debugoverlay = (IVDebugOverlay *)ismm->VInterfaceMatch(ismm->GetEngineFactory(), VDEBUG_OVERLAY_INTERFACE_VERSION, 0);

if (IsClient()) {
clientdll = (IBaseClientDLL *)ismm->VInterfaceMatch(GetClientFactory(), CLIENT_DLL_INTERFACE_VERSION, 0);
if (GetSoundEmitterSystemFactory() != nullptr) {
soundemitterbase = (ISoundEmitterSystemBase *)ismm->VInterfaceMatch(GetSoundEmitterSystemFactory(), SOUNDEMITTERSYSTEM_INTERFACE_VERSION, 0);
}

if (GetMaterialSystemFactory() != nullptr) {
g_pMaterialSystem = (IMaterialSystem *)ismm->VInterfaceMatch(GetMaterialSystemFactory(), MATERIAL_SYSTEM_INTERFACE_VERSION, 0);
}

if (GetClientFactory() != nullptr) {
clientdll = (IBaseClientDLL *)ismm->VInterfaceMatch(GetClientFactory(), CLIENT_DLL_INTERFACE_VERSION, 0);
}

gpGlobals = ismm->GetCGlobals();

LibMgr::SetPtr(Library::SERVER, (void *)ismm->GetServerFactory(false));
Expand All @@ -153,6 +173,47 @@ bool CExtSigsegv::RegisterConCommandBase(ConCommandBase *pCommand)
}


void CExtSigsegv::LevelInitPreEntity()
{
this->LoadSoundOverrides();

g_ModManager.LevelInitPreEntity();
}

void CExtSigsegv::LevelInitPostEntity()
{
g_ModManager.LevelInitPostEntity();
}

void CExtSigsegv::LevelShutdownPreEntity()
{
g_ModManager.LevelShutdownPreEntity();
}

void CExtSigsegv::LevelShutdownPostEntity()
{
g_ModManager.LevelShutdownPostEntity();
}

void CExtSigsegv::FrameUpdatePreEntityThink()
{
g_ModManager.FrameUpdatePreEntityThink();
}

void CExtSigsegv::FrameUpdatePostEntityThink()
{
g_ModManager.FrameUpdatePostEntityThink();
}


void CExtSigsegv::LoadSoundOverrides()
{
if (soundemitterbase != nullptr) {
soundemitterbase->AddSoundOverrides("scripts/sigsegv_sound_overrides.txt", true);
}
}


void CExtSigsegv::EnableColorSpew()
{
#if defined POSIX
Expand Down
Loading

0 comments on commit 381375d

Please sign in to comment.