Updated the GiveC4 to return a player pointer (#876)

This commit is contained in:
Javekson 2023-10-08 17:59:45 +04:00 committed by GitHub
parent 96ba309e4a
commit a9ec63df1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 13 deletions

View File

@ -458,8 +458,8 @@ typedef IHookChainClassImpl<void, class CHalfLifeMultiplay> CReGameHook_CSGameRu
typedef IHookChainRegistryClassEmptyImpl<void, class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_RemoveGuns;
// CHalfLifeMultiplay::GiveC4 hook
typedef IHookChainClassImpl<void, class CHalfLifeMultiplay> CReGameHook_CSGameRules_GiveC4;
typedef IHookChainRegistryClassEmptyImpl<void, class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_GiveC4;
typedef IHookChainClassImpl<CBasePlayer *, class CHalfLifeMultiplay> CReGameHook_CSGameRules_GiveC4;
typedef IHookChainRegistryClassEmptyImpl<CBasePlayer *, class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_GiveC4;
// CHalfLifeMultiplay::ChangeLevel hook
typedef IHookChainClassImpl<void, class CHalfLifeMultiplay> CReGameHook_CSGameRules_ChangeLevel;

View File

@ -578,7 +578,7 @@ public:
// check if the scenario has been won/lost
virtual void CheckWinConditions();
virtual void RemoveGuns();
virtual void GiveC4();
virtual CBasePlayer *GiveC4();
virtual void ChangeLevel();
virtual void GoToIntermission();
@ -601,7 +601,7 @@ public:
void RestartRound_OrigFunc();
void CheckWinConditions_OrigFunc();
void RemoveGuns_OrigFunc();
void GiveC4_OrigFunc();
CBasePlayer *GiveC4_OrigFunc();
void ChangeLevel_OrigFunc();
void GoToIntermission_OrigFunc();
void BalanceTeams_OrigFunc();

View File

@ -681,9 +681,9 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CleanUpMap)()
PLAYBACK_EVENT((FEV_GLOBAL | FEV_RELIABLE), 0, m_usResetDecals);
}
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, GiveC4)
LINK_HOOK_CLASS_CUSTOM_CHAIN2(CBasePlayer *, CHalfLifeMultiplay, CSGameRules, GiveC4)
void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(GiveC4)()
CBasePlayer *EXT_FUNC CHalfLifeMultiplay::__API_HOOK(GiveC4)()
{
int iTeamCount;
int iTemp = 0;
@ -744,7 +744,7 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(GiveC4)()
{
#ifdef REGAMEDLL_FIXES
// we already have bomber
return;
return pPlayer;
#endif
}
}
@ -772,10 +772,12 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(GiveC4)()
if (pPlayer->pev->deadflag != DEAD_NO || pPlayer->m_iTeam != TERRORIST)
continue;
pPlayer->MakeBomber();
return;
if (pPlayer->MakeBomber())
return pPlayer;
}
}
return nullptr;
}
void CHalfLifeMultiplay::QueueCareerRoundEndMenu(float tmDelay, int iWinStatus)

View File

@ -38,7 +38,7 @@
#include <API/CSInterfaces.h>
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 24
#define REGAMEDLL_API_VERSION_MINOR 25
// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
@ -337,8 +337,8 @@ typedef IHookChain<void> IReGameHook_CSGameRules_RemoveGuns;
typedef IHookChainRegistry<void> IReGameHookRegistry_CSGameRules_RemoveGuns;
// CHalfLifeMultiplay::GiveC4 hook
typedef IHookChain<void> IReGameHook_CSGameRules_GiveC4;
typedef IHookChainRegistry<void> IReGameHookRegistry_CSGameRules_GiveC4;
typedef IHookChain<CBasePlayer *> IReGameHook_CSGameRules_GiveC4;
typedef IHookChainRegistry<CBasePlayer *> IReGameHookRegistry_CSGameRules_GiveC4;
// CHalfLifeMultiplay::ChangeLevel hook
typedef IHookChain<void> IReGameHook_CSGameRules_ChangeLevel;

View File

@ -6,5 +6,5 @@
#pragma once
#define VERSION_MAJOR 5
#define VERSION_MINOR 23
#define VERSION_MINOR 25
#define VERSION_MAINTENANCE 0