Merge pull request #411 from alliedmodders/terminate-fix

Add shim for TerminateRound for  CS:GO
This commit is contained in:
Ruben Gonzalez 2015-09-16 19:31:52 -04:00
commit 249be7ad56
3 changed files with 21 additions and 5 deletions

View File

@ -122,6 +122,10 @@ DETOUR_DECL_MEMBER1(DetourTerminateRound, void, int, reason)
cell_t result = Pl_Continue; cell_t result = Pl_Continue;
#if SOURCE_ENGINE == SE_CSGO
reason--;
#endif
g_pTerminateRoundForward->PushFloatByRef(&delay); g_pTerminateRoundForward->PushFloatByRef(&delay);
g_pTerminateRoundForward->PushCellByRef(&reason); g_pTerminateRoundForward->PushCellByRef(&reason);
g_pTerminateRoundForward->Execute(&result); g_pTerminateRoundForward->Execute(&result);
@ -129,6 +133,10 @@ DETOUR_DECL_MEMBER1(DetourTerminateRound, void, int, reason)
if (result >= Pl_Handled) if (result >= Pl_Handled)
return; return;
#if SOURCE_ENGINE == SE_CSGO
reason++;
#endif
#if SOURCE_ENGINE != SE_CSGO || !defined(WIN32) #if SOURCE_ENGINE != SE_CSGO || !defined(WIN32)
if (result == Pl_Changed) if (result == Pl_Changed)
return DETOUR_MEMBER_CALL(DetourTerminateRound)(delay, reason); return DETOUR_MEMBER_CALL(DetourTerminateRound)(delay, reason);

View File

@ -330,6 +330,12 @@ static cell_t CS_TerminateRound(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("GameRules not available. TerminateRound native disabled."); return pContext->ThrowNativeError("GameRules not available. TerminateRound native disabled.");
} }
int reason = params[2];
#if SOURCE_ENGINE == SE_CSGO
reason++;
#endif
#if SOURCE_ENGINE != SE_CSGO || !defined(WIN32) #if SOURCE_ENGINE != SE_CSGO || !defined(WIN32)
static ICallWrapper *pWrapper = NULL; static ICallWrapper *pWrapper = NULL;
@ -356,7 +362,7 @@ static cell_t CS_TerminateRound(IPluginContext *pContext, const cell_t *params)
vptr += sizeof(void *); vptr += sizeof(void *);
*(float *)vptr = sp_ctof(params[1]); *(float *)vptr = sp_ctof(params[1]);
vptr += sizeof(float); vptr += sizeof(float);
*(int*)vptr = params[2]; *(int*)vptr = reason;
pWrapper->Execute(vstk, NULL); pWrapper->Execute(vstk, NULL);
#else #else
@ -371,7 +377,7 @@ static cell_t CS_TerminateRound(IPluginContext *pContext, const cell_t *params)
g_pIgnoreTerminateDetour = true; g_pIgnoreTerminateDetour = true;
float delay = sp_ctof(params[1]); float delay = sp_ctof(params[1]);
int reason = params[2];
__asm __asm
{ {
push reason push reason

View File

@ -51,8 +51,8 @@
enum CSRoundEndReason enum CSRoundEndReason
{ {
CSRoundEnd_TargetBombed = 0, /**< Target Successfully Bombed! */ CSRoundEnd_TargetBombed = 0, /**< Target Successfully Bombed! */
CSRoundEnd_VIPEscaped, /**< The VIP has escaped! */ CSRoundEnd_VIPEscaped, /**< The VIP has escaped! - Doesn't exist on CS:GO */
CSRoundEnd_VIPKilled, /**< VIP has been assassinated! */ CSRoundEnd_VIPKilled, /**< VIP has been assassinated! - Doesn't exist on CS:GO */
CSRoundEnd_TerroristsEscaped, /**< The terrorists have escaped! */ CSRoundEnd_TerroristsEscaped, /**< The terrorists have escaped! */
CSRoundEnd_CTStoppedEscape, /**< The CTs have prevented most of the terrorists from escaping! */ CSRoundEnd_CTStoppedEscape, /**< The CTs have prevented most of the terrorists from escaping! */
CSRoundEnd_TerroristsStopped, /**< Escaping terrorists have all been neutralized! */ CSRoundEnd_TerroristsStopped, /**< Escaping terrorists have all been neutralized! */
@ -64,12 +64,14 @@ enum CSRoundEndReason
CSRoundEnd_TargetSaved, /**< Target has been saved! */ CSRoundEnd_TargetSaved, /**< Target has been saved! */
CSRoundEnd_HostagesNotRescued, /**< Hostages have not been rescued! */ CSRoundEnd_HostagesNotRescued, /**< Hostages have not been rescued! */
CSRoundEnd_TerroristsNotEscaped, /**< Terrorists have not escaped! */ CSRoundEnd_TerroristsNotEscaped, /**< Terrorists have not escaped! */
CSRoundEnd_VIPNotEscaped, /**< VIP has not escaped! */ CSRoundEnd_VIPNotEscaped, /**< VIP has not escaped! - Doesn't exist on CS:GO */
CSRoundEnd_GameStart, /**< Game Commencing! */ CSRoundEnd_GameStart, /**< Game Commencing! */
// The below only exist on CS:GO // The below only exist on CS:GO
CSRoundEnd_TerroristsSurrender, /**< Terrorists Surrender */ CSRoundEnd_TerroristsSurrender, /**< Terrorists Surrender */
CSRoundEnd_CTSurrender, /**< CTs Surrender */ CSRoundEnd_CTSurrender, /**< CTs Surrender */
CSRoundEnd_TerroristsPlanted, /**< Terrorists Planted the bomb */
CSRoundEnd_CTsReachedHostage, /**< CTs Reached the hostage */
}; };
enum CSWeaponID enum CSWeaponID