diff --git a/GSChaos/CChaos.cpp b/GSChaos/CChaos.cpp index a6f67936..8ecae375 100644 --- a/GSChaos/CChaos.cpp +++ b/GSChaos/CChaos.cpp @@ -259,6 +259,7 @@ void CChaos::FeatureInit() RegisterChaosFeature(); RegisterChaosFeature(); RegisterChaosFeature(); + RegisterChaosFeature(); RegisterChaosFeature(); // must be last!!! diff --git a/GSChaos/CFeatureMonsterWorldspawn.cpp b/GSChaos/CFeatureMonsterWorldspawn.cpp new file mode 100644 index 00000000..353c7464 --- /dev/null +++ b/GSChaos/CFeatureMonsterWorldspawn.cpp @@ -0,0 +1,42 @@ +#include "includes.h" + +void CFeatureMonsterWorldspawn::Init() +{ + CChaosFeature::Init(); +} + +void CFeatureMonsterWorldspawn::ActivateFeature() +{ + CChaosFeature::ActivateFeature(); + + monster_worldspawn = CREATE_NAMED_ENTITY(MAKE_STRING("func_wall")); + + if (!monster_worldspawn) + { + DeactivateFeature(); + return; + } + + SET_MODEL(monster_worldspawn, pEngfuncs->pfnGetLevelName()); + + gEntityInterface->pfnSpawn(monster_worldspawn); + + monster_worldspawn->v.origin = (*sv_player)->v.origin; + monster_worldspawn->v.solid = SOLID_BSP; + monster_worldspawn->v.movetype = MOVETYPE_PUSH; +} + +void CFeatureMonsterWorldspawn::DeactivateFeature() +{ + CChaosFeature::DeactivateFeature(); +} + +const char* CFeatureMonsterWorldspawn::GetFeatureName() +{ + return "monster_worldspawn"; +} + +edict_t* CFeatureMonsterWorldspawn::GetWorldspawnEdict() +{ + return monster_worldspawn; +} \ No newline at end of file diff --git a/GSChaos/CFeatureMonsterWorldspawn.h b/GSChaos/CFeatureMonsterWorldspawn.h new file mode 100644 index 00000000..868a123d --- /dev/null +++ b/GSChaos/CFeatureMonsterWorldspawn.h @@ -0,0 +1,40 @@ +/** + * Copyright - ScriptedSnark, 2024. + * CFeatureMonsterWorldspawn.h + * + * Project (GSChaos) header file + * Authors: ScriptedSnark. + * Do not delete this comment block. Respect others' work! + */ + +#ifdef CFEATUREMONSTERWORLDSPAWN_H_RECURSE_GUARD +#error Recursive header files inclusion detected in CFeatureMonsterWorldspawn.h +#else //CFEATUREMONSTERWORLDSPAWN_H_RECURSE_GUARD + +#define CFEATUREMONSTERWORLDSPAWN_H_RECURSE_GUARD + +#ifndef CFEATUREMONSTERWORLDSPAWN_H_GUARD +#define CFEATUREMONSTERWORLDSPAWN_H_GUARD +#pragma once + +#ifdef __cplusplus + +class CFeatureMonsterWorldspawn : public CChaosFeature +{ + void Init() override; + void ActivateFeature() override; + void DeactivateFeature() override; + const char* GetFeatureName() override; + virtual edict_t* GetWorldspawnEdict(); +private: + edict_t* monster_worldspawn; +}; + +#else //!__cplusplus +#error C++ compiler required to compile CFeatureMonsterWorldspawn.h +#endif //__cplusplus + +#endif //CFEATUREMONSTERWORLDSPAWN_H_GUARD + +#undef CFEATUREMONSTERWORLDSPAWN_H_RECURSE_GUARD +#endif //CFEATUREMONSTERWORLDSPAWN_H_RECURSE_GUARD \ No newline at end of file diff --git a/GSChaos/GSChaos.vcxproj b/GSChaos/GSChaos.vcxproj index 3ace65ba..7993f230 100644 --- a/GSChaos/GSChaos.vcxproj +++ b/GSChaos/GSChaos.vcxproj @@ -140,6 +140,7 @@ + @@ -250,6 +251,7 @@ + diff --git a/GSChaos/GSChaos.vcxproj.filters b/GSChaos/GSChaos.vcxproj.filters index 718e6659..1826ad42 100644 --- a/GSChaos/GSChaos.vcxproj.filters +++ b/GSChaos/GSChaos.vcxproj.filters @@ -239,6 +239,9 @@ Effects + + Effects + @@ -575,6 +578,9 @@ Effects + + Effects + diff --git a/GSChaos/dynamic_precache.cpp b/GSChaos/dynamic_precache.cpp index 4f5fc1e6..0e710fc7 100644 --- a/GSChaos/dynamic_precache.cpp +++ b/GSChaos/dynamic_precache.cpp @@ -1,14 +1,5 @@ #include "includes.h" -typedef sfxcache_t* (*_S_LoadSound)(sfx_t* s, channel_t* ch); -typedef sfx_t* (*_S_FindName)(char* name, int* pfInCache); -typedef model_t* (*_Mod_ForName)(const char* name, qboolean crash, qboolean trackCRC); -typedef int (*_PF_precache_model_I)(char* s); -typedef int (*_PF_precache_sound_I)(char* s); -typedef unsigned short (*_EV_Precache)(int type, const char* psz); -typedef void (*_PF_setmodel_I)(edict_t* e, const char* m); -typedef void (*_SV_AddSampleToHashedLookupTable)(const char* pszSample, int iSampleIndex); - _S_LoadSound ORIG_S_LoadSound = NULL; _S_FindName ORIG_S_FindName = NULL; _Mod_ForName ORIG_Mod_ForName = NULL; diff --git a/GSChaos/dynamic_precache.h b/GSChaos/dynamic_precache.h index 2dc75081..c82fa8ba 100644 --- a/GSChaos/dynamic_precache.h +++ b/GSChaos/dynamic_precache.h @@ -19,6 +19,24 @@ #ifdef __cplusplus +typedef sfxcache_t* (*_S_LoadSound)(sfx_t* s, channel_t* ch); +typedef sfx_t* (*_S_FindName)(char* name, int* pfInCache); +typedef model_t* (*_Mod_ForName)(const char* name, qboolean crash, qboolean trackCRC); +typedef int (*_PF_precache_model_I)(char* s); +typedef int (*_PF_precache_sound_I)(char* s); +typedef unsigned short (*_EV_Precache)(int type, const char* psz); +typedef void (*_PF_setmodel_I)(edict_t* e, const char* m); +typedef void (*_SV_AddSampleToHashedLookupTable)(const char* pszSample, int iSampleIndex); + +extern _S_LoadSound ORIG_S_LoadSound; +extern _S_FindName ORIG_S_FindName; +extern _Mod_ForName ORIG_Mod_ForName; +extern _PF_precache_model_I ORIG_PF_precache_model_I; +extern _PF_precache_sound_I ORIG_PF_precache_sound_I; +extern _PF_setmodel_I ORIG_PF_setmodel_I; +extern _EV_Precache ORIG_EV_Precache; +extern _SV_AddSampleToHashedLookupTable ORIG_SV_AddSampleToHashedLookupTable; + void InitDynamicPrecache(); sfx_t* S_LateLoadSound(char* name); int GetModelByIndex(const char* name); diff --git a/GSChaos/includes.h b/GSChaos/includes.h index 7a79780b..2f06775b 100644 --- a/GSChaos/includes.h +++ b/GSChaos/includes.h @@ -152,6 +152,7 @@ extern bool g_bEncrypted; #include "CFeatureDeleteRandomEntity.h" #include "CFeatureNuke.h" #include "CFeaturePlusDuck.h" +#include "CFeatureMonsterWorldspawn.h" #include "CFeatureCombineEffects.h" //======================== diff --git a/README.md b/README.md index 250ba687..9465da11 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ If you don't want to play with this feature, rename `twitch.ini` to `twitch_DISA > Delete random entity :xdd: > Nuke player > +duck +> monster_worldspawn > Combine Effects ( 3 in 1 ) ```