CDirector::OnEndScenario
0x00883500 · 3068 bytes · __thiscall
_ZN9CDirector13OnEndScenarioEP26EndScenarioGameEventInfo_t
Decompiled
undefined (2 params)
/* CDirector::OnEndScenario(EndScenarioGameEventInfo_t*) */
void __thiscall CDirector::OnEndScenario(CDirector *this,EndScenarioGameEventInfo_t *param_1)
{
char cVar1;
int *piVar2;
int iVar3;
longdouble lVar4;
float fVar5;
float local_64;
int local_60 [4];
undefined4 local_50;
char *local_4c;
undefined1 local_48;
undefined4 local_44;
undefined4 local_40;
undefined4 local_3c;
undefined4 local_38;
undefined4 local_34;
int local_30 [8];
cVar1 = CDirectorChallengeMode::OnEndScenarioNonVirtual
(*(EndScenarioGameEventInfo_t **)(this + 0x648));
if (cVar1 != '\0') {
return;
}
cVar1 = CDirectorSurvivalMode::OnEndScenarioNonVirtual
(*(CDirectorSurvivalMode **)(this + 0x640),param_1);
if (cVar1 != '\0') {
return;
}
switch(*(undefined4 *)param_1) {
case 0:
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + 1.0 != *(float *)(this + 0x270)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(float *)(this + 0x270) = (float)lVar4 + 1.0;
}
if (*(float *)(this + 0x26c) != 1.0) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x26c);
*(undefined4 *)(this + 0x26c) = 0x3f800000;
}
*(char **)(param_1 + 8) = "#L4D_Scenario_Restart";
ForEachTerrorPlayer<MissionAborted>((MissionAborted *)&local_40);
cVar1 = GameModeHasRounds();
if (cVar1 != '\0') {
if (this[0x4e5] == (CDirector)0x0) {
this[0x4e5] = (CDirector)0x1;
this[0x4e6] = (CDirector)0x0;
}
else {
this[0x4e5] = (CDirector)0x0;
}
}
break;
case 1:
local_40 = 0xff000000;
UTIL_ScreenFadeAll((color32_s *)&local_40,7.0,0.0,0x1a);
goto LAB_00883873;
case 3:
*(undefined4 *)(param_1 + 4) = 2;
*(char **)(param_1 + 8) = "#L4D_Scenario_Finale_Won";
break;
case 4:
LAB_00883873:
if (**(int **)(this + 0x638) != 5) {
if (((cameraFinaleWinStr == 0) ||
(iVar3 = cameraFinaleWinStr, DAT_0100028c != CGameString::gm_iSerialNumber)) &&
(iVar3 = 0, DAT_01000288 != 0)) {
AllocPooledString((char *)local_60);
cameraFinaleWinStr = local_60[0];
DAT_0100028c = CGameString::gm_iSerialNumber;
iVar3 = local_60[0];
}
piVar2 = (int *)CGlobalEntityList::FindEntityByNameFast((CGlobalEntityList *)gEntList,0,iVar3)
;
if (piVar2 == (int *)0x0) {
if ((cameraFinaleStr == 0) ||
(iVar3 = cameraFinaleStr, DAT_0100027c != CGameString::gm_iSerialNumber)) {
if (DAT_01000278 == 0) {
iVar3 = 0;
}
else {
AllocPooledString((char *)local_60);
cameraFinaleStr = local_60[0];
DAT_0100027c = CGameString::gm_iSerialNumber;
iVar3 = local_60[0];
}
}
piVar2 = (int *)CGlobalEntityList::FindEntityByNameFast
((CGlobalEntityList *)gEntList,0,iVar3);
if (piVar2 != (int *)0x0) goto LAB_008838ee;
}
else {
LAB_008838ee:
local_40 = 0;
local_34 = 0xffffffff;
local_30[0] = 0;
(**(code **)(*piVar2 + 0xb4))(piVar2,"Enable",0,0,(MissionLost *)&local_40,0);
}
ForEachTerrorPlayer<FinaleLossSetup>((FinaleLossSetup *)&local_50);
piVar2 = (int *)CGlobalEntityList::FindEntityByClassname
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,"trigger_finale");
if ((piVar2 != (int *)0x0) ||
(piVar2 = (int *)CGlobalEntityList::FindEntityByClassname
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,
"finale_trigger"), piVar2 != (int *)0x0)) {
local_40 = 0;
local_34 = 0xffffffff;
local_30[0] = 0;
(**(code **)(*piVar2 + 0xb4))(piVar2,"FinaleLost",0,0,(MissionLost *)&local_40,0);
}
}
*(undefined4 *)(param_1 + 4) = 3;
*(char **)(param_1 + 8) = "#L4D_Scenario_Survivors_Dead";
if (*(float *)(this + 0x3ac) <= 0.0) {
fVar5 = 99999.9;
}
else {
lVar4 = (longdouble)IntervalTimer::Now();
fVar5 = (float)lVar4 - *(float *)(this + 0x3ac);
}
*(float *)(this + 0x3b0) = fVar5 + *(float *)(this + 0x3b0);
lVar4 = (longdouble)IntervalTimer::Now();
if ((float)lVar4 != *(float *)(this + 0x3ac)) {
(**(code **)(*(int *)(this + 0x3a8) + 4))(this + 0x3a8,this + 0x3ac);
*(float *)(this + 0x3ac) = (float)lVar4;
}
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + 7.0 != *(float *)(this + 0x270)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(float *)(this + 0x270) = (float)lVar4 + 7.0;
}
if (*(float *)(this + 0x26c) != 7.0) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x26c);
*(undefined4 *)(this + 0x26c) = 0x40e00000;
}
iVar3 = (**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"mission_lost",0,0);
if (iVar3 != 0) {
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,iVar3,0);
}
ForEachTerrorPlayer<MissionLost>((MissionLost *)&local_40);
*(int *)(this + 0x440) = *(int *)(this + 0x440) + 1;
break;
case 5:
cVar1 = CTerrorGameRules::IsMissionFinalMap();
if ((cVar1 == '\0') || (this[0x4e5] == (CDirector)0x0)) {
local_64 = *(float *)(versus_round_restarttimer._28_4_ + 0x2c);
}
else {
local_64 = *(float *)(versus_round_restarttimer_finale._28_4_ + 0x2c);
}
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + local_64 != *(float *)(this + 0x270)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(float *)(this + 0x270) = (float)lVar4 + local_64;
}
if (local_64 != *(float *)(this + 0x26c)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x26c);
*(float *)(this + 0x26c) = local_64;
}
goto LAB_00883660;
case 6:
iVar3 = CTerrorGameRules::GetMissionNextMap((KeyValues **)0x0);
if (iVar3 == 0) {
StartRematchVote(this);
return;
}
this[0x4e6] = (CDirector)0x1;
case 0xb:
ForEachTerrorPlayer<PrepareVersusPreChangelevel>((PrepareVersusPreChangelevel *)&local_40);
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + 4.0 != *(float *)(this + 0x270)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(float *)(this + 0x270) = (float)lVar4 + 4.0;
}
if (*(float *)(this + 0x26c) != 4.0) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x26c);
*(undefined4 *)(this + 0x26c) = 0x40800000;
}
break;
case 7:
cVar1 = IsFirstMapInScenario();
if (cVar1 == '\0') {
ForEachTerrorPlayer<PrepareVersusPreChangelevel>((PrepareVersusPreChangelevel *)&local_40);
}
fVar5 = *(float *)(versus_level_restart_delay._28_4_ + 0x2c);
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + fVar5 != *(float *)(this + 0x270)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(float *)(this + 0x270) = (float)lVar4 + fVar5;
}
if (fVar5 != *(float *)(this + 0x26c)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x26c);
*(float *)(this + 0x26c) = fVar5;
}
break;
case 8:
case 0xd:
local_30[0] = 0;
local_30[1] = 0;
local_30[2] = 0;
local_30[3] = 0;
local_30[4] = 0;
local_40 = 0xffffffff;
local_3c = 2;
local_38 = 3;
local_34 = 9;
/* try { // try from 00883ced to 00883d4f has its CatchHandler @ 00884151 */
ForEachPlayer<PlayerCollector>((PlayerCollector *)&local_40);
if (0 < local_30[3]) {
iVar3 = 0;
do {
CBaseEntity::AddFlag(*(CBaseEntity **)(local_30[0] + iVar3 * 4),0x20);
iVar3 = iVar3 + 1;
} while (iVar3 < local_30[3]);
}
local_50 = 0xffffffff;
local_4c = "vs_shutting_down";
local_48 = 1;
local_44 = 0;
ForEachTerrorPlayer<CShowViewportPanel>((CShowViewportPanel *)&local_50);
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + 3.0 != *(float *)(this + 0x270)) {
/* try { // try from 00883f71 to 00883f73 has its CatchHandler @ 00884151 */
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(float *)(this + 0x270) = (float)lVar4 + 3.0;
}
if (*(float *)(this + 0x26c) != 3.0) {
/* try { // try from 00883eb9 to 00883ebb has its CatchHandler @ 00884151 */
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x26c);
*(undefined4 *)(this + 0x26c) = 0x40400000;
}
local_30[3] = 0;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_30);
local_30[4] = local_30[0];
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_30);
break;
case 9:
fVar5 = *(float *)(scavenge_round_restart_delay._28_4_ + 0x2c);
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + fVar5 != *(float *)(this + 0x270)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(float *)(this + 0x270) = (float)lVar4 + fVar5;
}
if (fVar5 != *(float *)(this + 0x26c)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x26c);
*(float *)(this + 0x26c) = fVar5;
}
goto LAB_00883660;
case 10:
fVar5 = *(float *)(scavenge_round_restart_delay_tied._28_4_ + 0x2c);
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + fVar5 != *(float *)(this + 0x270)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(float *)(this + 0x270) = (float)lVar4 + fVar5;
}
if (fVar5 != *(float *)(this + 0x26c)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x26c);
*(float *)(this + 0x26c) = fVar5;
}
goto LAB_00883660;
case 0xc:
fVar5 = *(float *)(scavenge_match_finished_delay._28_4_ + 0x2c);
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + fVar5 != *(float *)(this + 0x270)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(float *)(this + 0x270) = (float)lVar4 + fVar5;
}
if (fVar5 != *(float *)(this + 0x26c)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x26c);
*(float *)(this + 0x26c) = fVar5;
}
LAB_00883660:
*(char **)(param_1 + 8) = "#L4D_Scenario_Restart";
break;
case 0x11:
local_40 = 0xff000000;
UTIL_ScreenFadeAll((color32_s *)&local_40,4.0,0.0,0x1a);
if (*(float *)(this + 0x270) != -1.0) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(undefined4 *)(this + 0x270) = 0xbf800000;
}
if (*(float *)(this + 0x27c) <= 0.0) {
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + 4.0 != *(float *)(this + 0x27c)) {
(**(code **)(*(int *)(this + 0x274) + 4))(this + 0x274,this + 0x27c);
*(float *)(this + 0x27c) = (float)lVar4 + 4.0;
}
if (*(float *)(this + 0x278) != 4.0) {
(**(code **)(*(int *)(this + 0x274) + 4))(this + 0x274,this + 0x278);
*(undefined4 *)(this + 0x278) = 0x40800000;
}
}
break;
case 0x12:
lVar4 = (longdouble)CountdownTimer::Now();
if ((float)lVar4 + 1.0 != *(float *)(this + 0x270)) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
*(float *)(this + 0x270) = (float)lVar4 + 1.0;
}
if (*(float *)(this + 0x26c) != 1.0) {
(**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x26c);
*(undefined4 *)(this + 0x26c) = 0x3f800000;
}
*(char **)(param_1 + 8) = "#L4D_Scenario_Restart";
ForEachTerrorPlayer<MissionAborted>((MissionAborted *)&local_40);
}
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.