Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved utils, refactoring #214

Merged
merged 16 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
do
plugin="$(basename "${file%.*}")"
echo -e "\nCompiling $plugin\n"
spcomp -v2 -i scripting/include -o plugins/"$plugin".smx "$file" NO_DEBUG=1 ${{ matrix.game.args }}
spcomp -v2 -i scripting/include -o plugins/disabled/srccoop_debug/"$plugin".smx "$file" ${{ matrix.game.args }}
spcomp -v2 --warnings-as-errors -i scripting/include -o plugins/"$plugin".smx "$file" NO_DEBUG=1 ${{ matrix.game.args }}
spcomp -v2 --warnings-as-errors -i scripting/include -o plugins/disabled/srccoop_debug/"$plugin".smx "$file" ${{ matrix.game.args }}
done
- name: Create package
Expand Down
5 changes: 0 additions & 5 deletions scripting/include/logdebug.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
* Define NO_DEBUG before including this file to completely disable all debugging
*/

#if defined _logdebug_included
#endinput
#endif
#define _logdebug_included

#pragma newdecls required
#pragma semicolon 1

Expand Down
18 changes: 5 additions & 13 deletions scripting/include/srccoop.inc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#if defined _srccoop_included
#endinput
#endif
#define _srccoop_included

#pragma newdecls required
#pragma semicolon 1

Expand Down Expand Up @@ -142,22 +137,19 @@
// Includes
//------------------------------------------------------


#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <regex>
#include <dhooks>
#include <topmenus>
#include <sourcescramble>

#include <sourcescramble>
#include <logdebug>

#include <srccoop/util/assert>
#include <srccoop/typedef>
#include <srccoop/public>
#include <srccoop_api/classdef>
#include <srccoop/utils>
#include <srccoop_api>
#include <srccoop/config>
#include <srccoop/features>
#include <srccoop/globals>
Expand All @@ -168,9 +160,9 @@
#include <srccoop/manager_persistence>
#include <srccoop/entitypatch>
#if defined SRCCOOP_BLACKMESA
#include <srccoop/blackmesa/entitypatch>
#include <srccoop/blackmesa/deathnotice>
#include <srccoop/blackmesa/idle_anims>
#include <srccoop/bms/entitypatch>
#include <srccoop/bms/deathnotice>
#include <srccoop/bms/idle_anims>
#elseif defined SRCCOOP_HL2DM
#include <srccoop/hl2dm/deathnotice>
#endif
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#if defined _srccoop_deathnotice_game_included
#endinput
#endif
#define _srccoop_deathnotice_game_included

#pragma newdecls required
#pragma semicolon 1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#if defined _srccoop_entitypatch_bm_included
#endinput
#endif
#define _srccoop_entitypatch_bm_included

#pragma newdecls required
#pragma semicolon 1

Expand All @@ -15,7 +10,7 @@ static bool g_pPlayerIronsightClassic[MAXPLAYERS + 1];
// scientists should classify as allies (in MP, base function returns false when player is not passed in)
// this allows npcs to pass filter in "player ally only" triggers
//------------------------------------------------------
public MRESReturn Hook_IsPlayerAlly(int _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_IsPlayerAlly(int _this, DHookReturn hReturn, DHookParam hParams)
{
DHookSetReturn(hReturn, true);
return MRES_Supercede;
Expand Down Expand Up @@ -66,7 +61,7 @@ public void Hook_GargSpawnPost(int iEntIndex)
// CAI_BaseNPC - npc_gargantua
// fix the 'ChasePlayer' input by setting a target ent.
//------------------------------------------------------
public MRESReturn Hook_GargAcceptInputPost(int _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_GargAcceptInputPost(int _this, DHookReturn hReturn, DHookParam hParams)
{
if (!DHookIsNullParam(hParams, 1))
{
Expand Down Expand Up @@ -262,7 +257,7 @@ public void Hook_XenTurretSpawnPost(int iEntIndex)
//------------------------------------------------------
CBaseEntity g_pActiveMarionettist[MAXPLAYERS+1] = {view_as<CBaseEntity>(-1), ...};

public MRESReturn Hook_MarionettistAcceptInput(int _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_MarionettistAcceptInput(int _this, DHookReturn hReturn, DHookParam hParams)
{
if (CoopManager.IsCoopModeEnabled())
{
Expand Down Expand Up @@ -543,7 +538,7 @@ public MRESReturn Hook_MusicTrackThink(int _this)
return MRES_Supercede;
}

public MRESReturn Hook_MusicTrackAcceptInput(int _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_MusicTrackAcceptInput(int _this, DHookReturn hReturn, DHookParam hParams)
{
char szInputType[MAX_FORMAT];
char szBuffer[MAX_VALUE];
Expand Down Expand Up @@ -648,7 +643,7 @@ public MRESReturn Hook_TestGroundMove(Address _this, DHookReturn hReturn, DHookP
// `env_xen_portal_effect`
// Fixes xen portals not pushing players.
//------------------------------------------------------
public MRESReturn Hook_XenPortalEffect_AcceptInput(int _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_XenPortalEffect_AcceptInput(int _this, DHookReturn hReturn, DHookParam hParams)
{
char szInputType[MAX_FORMAT];
DHookGetParamString(hParams, 1, szInputType, sizeof(szInputType));
Expand Down Expand Up @@ -823,7 +818,7 @@ public void Hook_GrenadeFragSpawnPost(const int iEntIndex)
// weapon_357/weapon_crossbow
// New constructed logic of toggling ironsights.
//------------------------------------------------------
public MRESReturn Hook_ToggleIronsights(int _this, Handle hParams)
public MRESReturn Hook_ToggleIronsights(int _this, DHookParam hParams)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand Down Expand Up @@ -875,8 +870,7 @@ public MRESReturn Hook_ToggleIronsights(int _this, Handle hParams)
}
pPlayer.SetFOV(pWeapon, bWillBeUsingIronsights ? iFOV : 0, 0.5);
pWeapon.SetIronsights(bWillBeUsingIronsights);

PreventWeaponFiring(pWeapon, 0.5);
pWeapon.DelayNextAttack(0.5);

return MRES_Supercede;
}
Expand All @@ -887,7 +881,7 @@ public MRESReturn Hook_ToggleIronsights(int _this, Handle hParams)
// weapon_357
// Fixes the shooting animation played while using ironsights.
//------------------------------------------------------
public MRESReturn Hook_IronsightGetPrimaryAttackActivity(int _this, Handle hReturn)
public MRESReturn Hook_IronsightGetPrimaryAttackActivity(int _this, DHookReturn hReturn)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -909,7 +903,7 @@ public MRESReturn Hook_IronsightGetPrimaryAttackActivity(int _this, Handle hRetu
// weapon_crossbow
// Fixes the shooting animation played while using ironsights.
//------------------------------------------------------
public MRESReturn Hook_CrossbowGetPrimaryAttackActivity(int _this, Handle hReturn)
public MRESReturn Hook_CrossbowGetPrimaryAttackActivity(int _this, DHookReturn hReturn)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand Down Expand Up @@ -941,7 +935,7 @@ void ConvarQuery_IronsightClassic(QueryCookie hCookie, int iClient, ConVarQueryR
//------------------------------------------------------
// Caches the client settings used for ironsights.
//------------------------------------------------------
public MRESReturn Hook_IronsightDeployPost_SaveSettings(int _this, Handle hReturn)
public MRESReturn Hook_IronsightDeployPost_SaveSettings(int _this, DHookReturn hReturn)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -959,7 +953,7 @@ public MRESReturn Hook_IronsightDeployPost_SaveSettings(int _this, Handle hRetur
// grenade_bolt
// Disables explosive bolts by blocking the call.
//------------------------------------------------------
public MRESReturn Hook_GrenadeBoltAcceptInput(int _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_GrenadeBoltAcceptInput(int _this, DHookReturn hReturn, DHookParam hParams)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -978,7 +972,7 @@ public MRESReturn Hook_GrenadeBoltAcceptInput(int _this, Handle hReturn, Handle
// weapon_crossbow
// Sets the skin of the crossbow.
//------------------------------------------------------
public MRESReturn Hook_CrossbowDeployPost(int _this, Handle hReturn)
public MRESReturn Hook_CrossbowDeployPost(int _this, DHookReturn hReturn)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -1004,7 +998,7 @@ public MRESReturn Hook_CrossbowDeployPost(int _this, Handle hReturn)
// TODO: Hooking ItemPostFrame with IsMultiplayer = false causes prediction issues.
// Fix this by not calling IsMultiplayer = false.
//------------------------------------------------------
public MRESReturn Hook_CrossbowItemPostFrame(int _this, Handle hReturn)
public MRESReturn Hook_CrossbowItemPostFrame(int _this, DHookReturn hReturn)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand Down Expand Up @@ -1032,7 +1026,7 @@ public MRESReturn Hook_CrossbowItemPostFrame(int _this, Handle hReturn)
// weapon_crossbow
// See `Hook_CrossbowItemPostFrame` for details.
//------------------------------------------------------
public MRESReturn Hook_CrossbowItemPostFramePost(int _this, Handle hReturn)
public MRESReturn Hook_CrossbowItemPostFramePost(int _this, DHookReturn hReturn)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -1049,7 +1043,7 @@ public MRESReturn Hook_CrossbowItemPostFramePost(int _this, Handle hReturn)
// - Sets the rearm bool
// - Sets animations
//------------------------------------------------------
public MRESReturn Hook_CrossbowPrimaryAttack(int _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_CrossbowPrimaryAttack(int _this, DHookReturn hReturn, DHookParam hParams)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -1062,7 +1056,7 @@ public MRESReturn Hook_CrossbowPrimaryAttack(int _this, Handle hReturn, Handle h
// weapon_crossbow
// See `Hook_CrossbowPrimaryAttack` for details.
//------------------------------------------------------
public MRESReturn Hook_CrossbowPrimaryAttackPost(int _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_CrossbowPrimaryAttackPost(int _this, DHookReturn hReturn, DHookParam hParams)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -1075,7 +1069,7 @@ public MRESReturn Hook_CrossbowPrimaryAttackPost(int _this, Handle hReturn, Hand
// weapon_crossbow
// Fixes the rearm animation when pulling out the crossbow.
//------------------------------------------------------
public MRESReturn Hook_CrossbowGetDrawActivity(int _this, Handle hReturn)
public MRESReturn Hook_CrossbowGetDrawActivity(int _this, DHookReturn hReturn)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -1088,7 +1082,7 @@ public MRESReturn Hook_CrossbowGetDrawActivity(int _this, Handle hReturn)
// weapon_crossbow
// See `Hook_CrossbowGetDrawActivity` for details.
//------------------------------------------------------
public MRESReturn Hook_CrossbowGetDrawActivityPost(int _this, Handle hReturn)
public MRESReturn Hook_CrossbowGetDrawActivityPost(int _this, DHookReturn hReturn)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -1102,7 +1096,7 @@ public MRESReturn Hook_CrossbowGetDrawActivityPost(int _this, Handle hReturn)
// `CWeapon_Crossbow::FireBolt` is only called by `CWeapon_Crossbow::PrimaryAttack` which is hooked.
// If this gets called with singleplayer being set, this will crash the server.
//------------------------------------------------------
public MRESReturn Hook_CrossbowFireBolt(int _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_CrossbowFireBolt(int _this, DHookReturn hReturn, DHookParam hParams)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -1115,7 +1109,7 @@ public MRESReturn Hook_CrossbowFireBolt(int _this, Handle hReturn, Handle hParam
// weapon_crossbow
// See `Hook_CrossbowFireBolt` for details.
//------------------------------------------------------
public MRESReturn Hook_CrossbowFireBoltPost(int _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_CrossbowFireBoltPost(int _this, DHookReturn hReturn, DHookParam hParams)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -1128,7 +1122,7 @@ public MRESReturn Hook_CrossbowFireBoltPost(int _this, Handle hReturn, Handle hP
// weapon_tau
// Fixes the tau velocity.
//------------------------------------------------------
public MRESReturn Hook_TauFireBeam(int _this, Handle hReturn)
public MRESReturn Hook_TauFireBeam(int _this, DHookReturn hReturn)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand All @@ -1141,7 +1135,7 @@ public MRESReturn Hook_TauFireBeam(int _this, Handle hReturn)
// weapon_tau
// See `Hook_TauFireBeamPost` for details.
//------------------------------------------------------
public MRESReturn Hook_TauFireBeamPost(int _this, Handle hReturn)
public MRESReturn Hook_TauFireBeamPost(int _this, DHookReturn hReturn)
{
if (CoopManager.IsFeatureEnabled(FT_SP_WEAPONS))
{
Expand Down Expand Up @@ -1171,7 +1165,7 @@ public MRESReturn Hook_Dissolve(int _this, DHookReturn hReturn, DHookParam hPara

// Switches between using singleplayer and multiplayer weapon values.
// This will get triggered by the command `params_reload_server`.
public MRESReturn Hook_CParamsManager_InitInstances(Address _this, Handle hReturn, Handle hParams)
public MRESReturn Hook_CParamsManager_InitInstances(Address _this, DHookReturn hReturn, DHookParam hParams)
{
// TODO:
// Currently, this is getting only called during level init, but
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#if defined _srccoop_idle_anims_game_included
#endinput
#endif
#define _srccoop_idle_anims_game_included

#pragma newdecls required
#pragma semicolon 1

Expand Down
5 changes: 0 additions & 5 deletions scripting/include/srccoop/checkpoint.inc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#if defined _srccoop_checkpoint_included
#endinput
#endif
#define _srccoop_checkpoint_included

#pragma newdecls required
#pragma semicolon 1

Expand Down
5 changes: 0 additions & 5 deletions scripting/include/srccoop/commands.inc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#if defined _srccoop_commands_included
#endinput
#endif
#define _srccoop_commands_included

#pragma newdecls required
#pragma semicolon 1

Expand Down
9 changes: 2 additions & 7 deletions scripting/include/srccoop/config.inc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#if defined _srccoop_config_included
#endinput
#endif
#define _srccoop_config_included

#pragma newdecls required
#pragma semicolon 1

Expand All @@ -21,11 +16,11 @@ enum struct SourceCoopConfig
float PORTAL_TOUCH_SIZE;

//------------------------------------------------------
// MANAGER
// COOPMANAGER
//------------------------------------------------------

// Freeze intro - screenfade properties
int FROZEN_FADE_COLOR[4];
RGBA FROZEN_FADE_COLOR;
int FROZEN_FADE_DUR_IN;
int FROZEN_FADE_DUR_OUT;

Expand Down
5 changes: 0 additions & 5 deletions scripting/include/srccoop/deathnotice.inc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#if defined _srccoop_deathnotice_included
#endinput
#endif
#define _srccoop_deathnotice_included

#pragma newdecls required
#pragma semicolon 1

Expand Down
Loading
Loading