CDirectorScavengeMode::EndScavengeRound
0x008b3bf0 · 1181 bytes · __thiscall
_ZN21CDirectorScavengeMode16EndScavengeRoundEv
Decompiled
undefined (1 param)
/* CDirectorScavengeMode::EndScavengeRound() */
void __thiscall CDirectorScavengeMode::EndScavengeRound(CDirectorScavengeMode *this)
{
float fVar1;
CDirector *pCVar2;
int iVar3;
int iVar4;
int iVar5;
int iVar6;
int iVar7;
NextBotManager *this_00;
int *piVar8;
undefined4 uVar9;
longdouble lVar10;
float fVar11;
ScavengeRoundEnd local_1d [13];
iVar4 = gpGlobals;
if (this[8] == (CDirectorScavengeMode)0x0) {
return;
}
this[8] = (CDirectorScavengeMode)0x0;
CTerrorGameRules::SetRoundEndTime(g_pGameRules,*(float *)(iVar4 + 0xc));
iVar3 = CTerrorGameRules::GetVersusTeamFor(g_pGameRules,2);
iVar4 = CTerrorGameRules::GetVersusTeamFor(g_pGameRules,3);
lVar10 = (longdouble)CTerrorGameRules::GetRemainingAccumulatedTime(g_pGameRules);
CTerrorGameRules::SetTeamRoundTime(g_pGameRules,iVar3,(float)lVar10);
CTerrorGameRules::GetRoundDuration(g_pGameRules,2);
fVar11 = *(float *)(this + 4);
if (fVar11 <= 0.0) {
lVar10 = (longdouble)CTerrorGameRules::GetRemainingAccumulatedTime(g_pGameRules);
if (((float)lVar10 <= 0.0) && (this[0xc] == (CDirectorScavengeMode)0x0)) {
lVar10 = (longdouble)
CDirector::GetScriptValue
(TheDirector,"ScavengeRoundInitialTime",
*(float *)(scavenge_round_initial_time._28_4_ + 0x2c));
fVar11 = (float)lVar10;
goto LAB_008b3cd6;
}
}
else {
lVar10 = (longdouble)CTerrorGameRules::GetRoundStartTime(g_pGameRules);
fVar11 = fVar11 - (float)lVar10;
LAB_008b3cd6:
CTerrorGameRules::OverrideRoundDuration(g_pGameRules,2,fVar11);
}
if (TheDirector[0x4e5] == (CDirector)0x0) {
ForEachTerrorPlayer<ScavengeRoundHalftime>((ScavengeRoundHalftime *)local_1d);
iVar4 = (**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"scavenge_round_halftime",0,0);
if (iVar4 != 0) {
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,iVar4,0);
}
uVar9 = 9;
goto LAB_008b3ea3;
}
iVar5 = CTerrorGameRules::GetScavengeRoundHalfScore(g_pGameRules,true,-1);
iVar6 = CTerrorGameRules::GetScavengeRoundHalfScore(g_pGameRules,false,-1);
if (iVar5 == iVar6) {
lVar10 = (longdouble)CTerrorGameRules::GetRoundDuration(g_pGameRules,2);
fVar11 = (float)lVar10;
lVar10 = (longdouble)CTerrorGameRules::GetRoundDuration(g_pGameRules,3);
fVar1 = (float)lVar10;
if (fVar11 != fVar1) {
if (iVar5 == 0) {
if (fVar1 < fVar11) {
iVar4 = iVar3;
}
}
else if (fVar11 < fVar1) {
iVar4 = iVar3;
}
if (iVar4 != 0) {
uVar9 = 10;
goto LAB_008b3d57;
}
}
iVar4 = 0;
uVar9 = 10;
CTerrorGameRules::IncrementScavengeMatchScore(g_pGameRules,1);
CTerrorGameRules::IncrementScavengeMatchScore(g_pGameRules,2);
}
else {
uVar9 = 9;
iVar4 = (iVar5 <= iVar6) + 1;
LAB_008b3d57:
CTerrorGameRules::IncrementScavengeMatchScore(g_pGameRules,iVar4);
}
CTerrorGameRules::SetWinningTeamNumber(g_pGameRules,iVar4,-1);
iVar3 = CTerrorGameRules::GetScavengeMatchScore(g_pGameRules,2);
iVar5 = CTerrorGameRules::GetScavengeMatchScore(g_pGameRules,3);
iVar6 = CTerrorGameRules::GetRoundLimit(g_pGameRules);
iVar4 = iVar6 / 2 + 1;
iVar7 = CTerrorGameRules::GetRoundNumber(g_pGameRules);
if (((iVar5 < iVar4) && (iVar3 < iVar4)) ||
((iVar6 != iVar7 && -1 < iVar6 - iVar7 && (iVar3 == iVar5)))) {
ForEachTerrorPlayer<ScavengeRoundEnd>(local_1d);
iVar4 = (**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"scavenge_round_finished",0,0);
if (iVar4 != 0) {
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,iVar4,0);
}
}
else {
ForEachTerrorPlayer<ScavengeMatchEnd>((ScavengeMatchEnd *)local_1d);
piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"scavenge_match_finished",1,0);
if (piVar8 != (int *)0x0) {
if (iVar5 < iVar3) {
uVar9 = CTerrorGameRules::GetVersusTeamFor(g_pGameRules,2);
}
else {
uVar9 = 0;
if (iVar3 < iVar5) {
uVar9 = CTerrorGameRules::GetVersusTeamFor(g_pGameRules,3);
}
}
(**(code **)(*piVar8 + 0x30))(piVar8,"winners",uVar9);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar8,0);
}
uVar9 = 0xc;
}
LAB_008b3ea3:
this_00 = (NextBotManager *)TheNextBots();
NextBotManager::AddFlags(this_00,0x20);
pCVar2 = TheDirector;
TheDirector[0x4e4] = (CDirector)0x1;
CDirector::EndScenario(pCVar2,uVar9);
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.