Skip to content

Commit

Permalink
Add more compile switches for BM
Browse files Browse the repository at this point in the history
  • Loading branch information
Alienmario committed Aug 25, 2024
1 parent 29aaced commit b22eef1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
7 changes: 5 additions & 2 deletions scripting/include/srccoop.inc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#define ENTPATCH_POINT_SERVERCOMMAND_CHANGELEVEL
#define ENTPATCH_ENV_ZOOM
#define ENTPATCH_ENV_CREDITS
#define ENTPATCH_ENV_INTROCREDITS
#define ENTPATCH_ENV_SPRITE
#define ENTPATCH_AI_SCRIPT_CONDITIONS
#define ENTPATCH_FUNC_ROTATING
Expand All @@ -90,6 +91,8 @@
#define ENTPATCH_GOAL_LEAD
#define ENTPATCH_SETPLAYERAVOIDSTATE
#define ENTPATCH_NPC_SLEEP
#define ENTPATCH_FUNC_TRACKAUTOCHANGE
#define ENTPATCH_FUNC_TRACKTRAIN
#define ENTPATCH_BM_XENTURRET
#define ENTPATCH_BM_ICHTHYOSAUR
#define ENTPATCH_BM_GARGANTUA
Expand All @@ -102,8 +105,7 @@
#define ENTPATCH_BM_PROP_CHARGERS
#define ENTPATCH_BM_MISC_MARIONETTIST
#define ENTPATCH_BM_MUSIC_TRACK
#define ENTPATCH_FUNC_TRACKAUTOCHANGE
#define ENTPATCH_FUNC_TRACKTRAIN
#define ENTPATCH_BM_SNARK_NEST

#define PLAYERPATCH_SETSUITUPDATE
#define PLAYERPATCH_PICKUP_FORCEPLAYERTODROPTHISOBJECT
Expand All @@ -116,6 +118,7 @@
#define GAMEPATCH_IS_MULTIPLAYER
#define GAMEPATCH_BLOCK_RESTOREWORLD
#define GAMEPATCH_BLOCK_RESPAWNPLAYERS
#define GAMEPATCH_BLOCK_ANNOUNCER
#define GAMEPATCH_ALLOW_FLASHLIGHT
#define GAMEPATCH_TEAMSELECT_UI

Expand Down
11 changes: 3 additions & 8 deletions scripting/include/srccoop/utils.inc
Original file line number Diff line number Diff line change
Expand Up @@ -840,14 +840,9 @@ stock float PlayerDotProductToEntity(CBasePlayer pPlayer, CBaseEntity pEnt)

stock float PlayerDotProductToEntityCenter(CBasePlayer pPlayer, CBaseEntity pEnt)
{
float midpoint[3], mins[3], maxs[3];
pEnt.GetMins(mins);
pEnt.GetMaxs(maxs);
MoveVector(mins, maxs, 0.5, midpoint);

pEnt.GetAbsOrigin(mins);
AddVectors(mins, midpoint, midpoint);
return PlayerDotProductToPoint(pPlayer, midpoint);
float vecCenter[3];
pEnt.WorldSpaceCenter(vecCenter);
return PlayerDotProductToPoint(pPlayer, vecCenter);
}

stock float PlayerDotProductToPoint(CBasePlayer pPlayer, const float vecPoint[3])
Expand Down
17 changes: 16 additions & 1 deletion scripting/srccoop.sp
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,22 @@ public void OnPluginStart()

#if defined SRCCOOP_BLACKMESA

#if defined GAMEPATCH_BLOCK_ANNOUNCER
HookEvent("broadcast_teamsound", Event_BroadcastTeamsound, EventHookMode_Pre);
HookEvent("broadcast_killstreak", Event_BroadcastKillstreak, EventHookMode_Pre);
#endif

#if defined ENTPATCH_SNIPER
AddTempEntHook("BlackMesa Shot", BlackMesaFireBulletsTEHook);
#endif

#if defined ENTPATCH_ENV_INTROCREDITS
UserMsg iIntroCredits = GetUserMessageId("IntroCredits");
if (iIntroCredits != INVALID_MESSAGE_ID)
{
HookUserMessage(iIntroCredits, Hook_IntroCreditsMsg, true);
}
#endif

#endif // SRCCOOP_BLACKMESA

Expand Down Expand Up @@ -353,7 +361,7 @@ public void OnConfigsExecutedPost()

if (CoopManager.IsFeatureEnabled(FT_STRIP_DEFAULT_EQUIPMENT))
{
CBaseEntity pGameEquip = CBaseEntity.Create("game_player_equip"); // will spawn players with nothing if it exists
CBaseEntity pGameEquip = CBaseEntity.Create("game_player_equip"); // will spawn players with nothing if it exists
if (pGameEquip.IsValid())
{
if (!CoopManager.IsFeatureEnabled(FT_STRIP_DEFAULT_EQUIPMENT_KEEPSUIT))
Expand All @@ -363,6 +371,7 @@ public void OnConfigsExecutedPost()
pGameEquip.Spawn();
}
}

if (CoopManager.IsFeatureEnabled(FT_DISABLE_CANISTER_DROPS))
{
CBaseEntity pGameGamerules = CBaseEntity.Create("game_mp_gamerules");
Expand All @@ -375,12 +384,15 @@ public void OnConfigsExecutedPost()
}

PrecacheScriptSound("HL2Player.SprintStart");

#if defined ENTPATCH_BM_XENTURRET
AddFileToDownloadsTable("models/props_xen/xen_turret_mpfix.dx80.vtx");
AddFileToDownloadsTable("models/props_xen/xen_turret_mpfix.dx90.vtx");
AddFileToDownloadsTable("models/props_xen/xen_turret_mpfix.mdl");
AddFileToDownloadsTable("models/props_xen/xen_turret_mpfix.phy");
AddFileToDownloadsTable("models/props_xen/xen_turret_mpfix.sw.vtx");
AddFileToDownloadsTable("models/props_xen/xen_turret_mpfix.vvd");
#endif

#endif // SRCCOOP_BLACKMESA
}
Expand Down Expand Up @@ -797,10 +809,13 @@ public void OnEntityCreated(int iEntIndex, const char[] szClassname)
{
SDKHook(iEntIndex, SDKHook_Spawn, Hook_ItemSpawnDelay);
}
#if defined ENTPATCH_BM_SNARK_NEST
if (strcmp(szClassname, "item_weapon_snark") == 0)
{
SDKHook(iEntIndex, SDKHook_OnTakeDamagePost, Hook_OnItemSnarkDamagePost);
return;
}
#endif
if (strcmp(szClassname, "item_suit") == 0)
{
DHookEntity(hkOnTryPickUp, true, iEntIndex, _, Hook_OnEquipmentTryPickUpPost);
Expand Down

0 comments on commit b22eef1

Please sign in to comment.