CBasePropDoor::TryOpenClose
0x007f4910 · 2014 bytes · __thiscall
_ZN13CBasePropDoor12TryOpenCloseEP11CBaseEntityS1_i
Decompiled
undefined (4 params)
/* CBasePropDoor::TryOpenClose(CBaseEntity*, CBaseEntity*, int) */
uint __thiscall
CBasePropDoor::TryOpenClose
(CBasePropDoor *this,CBaseEntity *param_1,CBaseEntity *param_2,int param_3)
{
CBasePropDoor CVar1;
code *pcVar2;
CBasePropDoor *pCVar3;
char cVar4;
undefined4 *puVar5;
int iVar6;
int *piVar7;
undefined4 uVar8;
uint uVar9;
undefined *puVar10;
CBaseEntity *pCVar11;
CCSPlayer *pCVar12;
int iVar13;
uVar9 = *(uint *)(this + 0x1628);
if ((((uVar9 != 0xffffffff) &&
(puVar10 = g_pEntityList + (uVar9 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar10 + 8) == uVar9 >> 0xc)) && (*(int *)(puVar10 + 4) != 0)) {
return 0;
}
if (param_1 == (CBaseEntity *)0x0) {
cVar4 = (**(code **)(*(int *)this + 0x478))(this);
if (cVar4 == '\0') {
LAB_007f498c:
if (this[0x162e] == (CBasePropDoor)0x0) goto LAB_007f4999;
pCVar11 = (CBaseEntity *)0x0;
if (param_1 == (CBaseEntity *)0x0) goto LAB_007f499b;
goto LAB_007f4b5a;
}
LAB_007f4999:
pCVar11 = (CBaseEntity *)0x0;
}
else {
cVar4 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
if (cVar4 == '\0') {
cVar4 = (**(code **)(*(int *)this + 0x478))(this);
if (cVar4 == '\0') goto LAB_007f498c;
pCVar11 = (CBaseEntity *)0x0;
LAB_007f4ab1:
iVar6 = CBaseEntity::GetTeamNumber(param_1);
if ((iVar6 == 3) && (cVar4 = (**(code **)(*(int *)this + 0x484))(this,3), cVar4 == '\0')) {
cVar4 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
if (cVar4 != '\0') {
cVar4 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
pCVar12 = (CCSPlayer *)0x0;
if (cVar4 != '\0') {
pCVar12 = (CCSPlayer *)param_1;
}
CCSPlayer::HintMessage(pCVar12,"#L4D_Hint_pz_no_break_saferoom_doors",false,false,false);
}
goto LAB_007f4bb8;
}
}
else {
iVar6 = (**(code **)(*(int *)param_1 + 0x52c))(param_1);
pCVar11 = param_1;
if (((iVar6 == 0) ||
(iVar6 = (**(code **)(*(int *)param_1 + 0x52c))(param_1),
(*(byte *)(iVar6 + 0x12d) & 8) == 0)) &&
(cVar4 = (**(code **)(*(int *)this + 0x478))(this), cVar4 != '\0')) goto LAB_007f4ab1;
}
if (this[0x162e] != (CBasePropDoor)0x0) {
LAB_007f4b5a:
iVar6 = CBaseEntity::GetTeamNumber(param_1);
if (iVar6 == 3) {
cVar4 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
if (cVar4 != '\0') {
cVar4 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
pCVar12 = (CCSPlayer *)0x0;
if (cVar4 != '\0') {
pCVar12 = (CCSPlayer *)param_1;
}
CCSPlayer::HintMessage(pCVar12,"#L4D_Hint_pz_no_break_rescue_doors",false,false,false);
}
goto LAB_007f4bb8;
}
}
}
LAB_007f499b:
cVar4 = CDirectorSessionManager::IsWaitingForTeamReady
(*(CDirectorSessionManager **)(TheDirector + 0x634));
if (cVar4 == '\0') {
LAB_007f4bf0:
iVar6 = *(int *)(this + 0x15f4);
if (iVar6 != 0) goto LAB_007f49c4;
if ((param_3 & 1U) == 0) {
if (param_3 != 2) {
return 1;
}
if (pCVar11 == (CBaseEntity *)0x0) {
return 1;
}
iVar6 = CBaseEntity::GetTeamNumber(pCVar11);
cVar4 = IsASurvivorTeam(iVar6);
if (cVar4 == '\0') {
return 1;
}
iVar6 = *(int *)(this + 0x15e8);
if (iVar6 < 1) {
return 1;
}
iVar13 = 0;
do {
uVar9 = *(uint *)(*(int *)(this + 0x15dc) + iVar13 * 4);
if ((((uVar9 != 0xffffffff) &&
(puVar10 = g_pEntityList + (uVar9 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar10 + 8) == uVar9 >> 0xc)) &&
(pCVar3 = *(CBasePropDoor **)(puVar10 + 4), pCVar3 != (CBasePropDoor *)0x0)) {
puVar5 = (undefined4 *)(**(code **)(*(int *)pCVar11 + 0xc))(pCVar11);
*(undefined4 *)(pCVar3 + 0x1620) = *puVar5;
DoorClose(pCVar3);
}
iVar13 = iVar13 + 1;
} while (iVar13 != iVar6);
return 1;
}
}
else {
iVar6 = *(int *)(this + 0x15f4);
if (iVar6 == 0) {
cVar4 = (**(code **)(*(int *)this + 0x478))(this);
if (cVar4 != '\0') {
if ((param_1 == (CBaseEntity *)0x0) ||
(cVar4 = (**(code **)(*(int *)param_1 + 0x16c))(param_1), cVar4 == '\0')) {
param_1 = (CBaseEntity *)0x0;
}
cVar4 = CTerrorGameRules::IsVersusMode();
if (cVar4 == '\0') {
piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"waiting_checkpoint_door_used",0,0);
}
else {
piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"waiting_door_used_versus");
}
if (piVar7 != (int *)0x0) {
pcVar2 = *(code **)(*piVar7 + 0x30);
uVar8 = 0;
if (param_1 != (CBaseEntity *)0x0) {
uVar8 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_1 + 0x30));
}
(*pcVar2)(piVar7,"userid",uVar8);
if (*(int *)(this + 0x30) == 0) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
(**(code **)(*piVar7 + 0x30))(piVar7,"entindex",iVar6);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
}
LAB_007f4bb8:
PlayLockSounds((CBaseEntity *)this,(locksound_t *)(this + 0x15f8),1,0);
return 0;
}
goto LAB_007f4bf0;
}
LAB_007f49c4:
if (iVar6 != 2) {
if (iVar6 == 1) {
CVar1 = this[0x162c];
if (CVar1 == (CBasePropDoor)0x0) {
return 1;
}
if ((param_3 & 2U) == 0) {
return 1;
}
if (this[0x1624] != (CBasePropDoor)0x0) {
return 1;
}
if (param_1 == (CBaseEntity *)0x0) {
*(undefined4 *)(this + 0x1620) = 0xffffffff;
}
else {
puVar5 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
*(undefined4 *)(this + 0x1620) = *puVar5;
}
DoorClose(this);
return (uint)(byte)CVar1;
}
if (iVar6 == 3) {
if (this[0x162c] == (CBasePropDoor)0x0) {
return 1;
}
}
else if (iVar6 != 4) {
return 1;
}
if ((param_3 & 1U) == 0) {
return 1;
}
if (this[0x1624] != (CBasePropDoor)0x0) {
return 1;
}
if (param_1 == (CBaseEntity *)0x0) {
*(undefined4 *)(this + 0x1620) = 0xffffffff;
}
else {
puVar5 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
*(undefined4 *)(this + 0x1620) = *puVar5;
}
uVar9 = *(uint *)(this + 0x1620);
pCVar11 = (CBaseEntity *)0x0;
if (((uVar9 != 0xffffffff) &&
(puVar10 = g_pEntityList + (uVar9 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar10 + 8) == uVar9 >> 0xc)) {
pCVar11 = *(CBaseEntity **)(puVar10 + 4);
}
DoorOpen(this,pCVar11);
return 1;
}
if (((byte)this[0x149] & 0x20) == 0) {
return 1;
}
if ((param_3 & 2U) == 0) {
if (param_3 != 1) {
return 1;
}
if (pCVar11 == (CBaseEntity *)0x0) {
return 1;
}
iVar6 = CBaseEntity::GetTeamNumber(pCVar11);
cVar4 = IsASurvivorTeam(iVar6);
if (cVar4 == '\0') {
return 1;
}
iVar6 = *(int *)(this + 0x15e8);
if (iVar6 < 1) {
return 1;
}
iVar13 = 0;
do {
uVar9 = *(uint *)(*(int *)(this + 0x15dc) + iVar13 * 4);
if (((uVar9 != 0xffffffff) &&
(puVar10 = g_pEntityList + (uVar9 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& ((*(uint *)(puVar10 + 8) == uVar9 >> 0xc &&
(pCVar3 = *(CBasePropDoor **)(puVar10 + 4), pCVar3 != (CBasePropDoor *)0x0)))) {
puVar5 = (undefined4 *)(**(code **)(*(int *)pCVar11 + 0xc))(pCVar11);
*(undefined4 *)(pCVar3 + 0x1620) = *puVar5;
DoorOpen(pCVar3,pCVar11);
}
iVar13 = iVar13 + 1;
} while (iVar13 != iVar6);
return 1;
}
}
if (this[0x1624] != (CBasePropDoor)0x0) {
if (param_1 == (CBaseEntity *)0x0) goto LAB_007f5025;
iVar6 = CBaseEntity::GetTeamNumber(param_1);
cVar4 = IsASurvivorTeam(iVar6);
if (cVar4 != '\0') {
uVar9 = (**(code **)(*(int *)this + 0x478))(this);
if ((char)uVar9 == '\0') {
PlayLockSounds((CBaseEntity *)this,(locksound_t *)(this + 0x15f8),1,0);
COutputEvent::FireOutput((COutputEvent *)(this + 0x172c),param_1,param_2,0.0);
return uVar9;
}
cVar4 = CDirectorSessionManager::IsWaitingForTeamReady
(*(CDirectorSessionManager **)(TheDirector + 0x634));
if (cVar4 != '\0') {
return 1;
}
(**(code **)(*(int *)this + 0x488))(this,param_1);
return uVar9;
}
if (this[0x1624] != (CBasePropDoor)0x0) goto LAB_007f5025;
}
if (param_1 == (CBaseEntity *)0x0) {
*(undefined4 *)(this + 0x1620) = 0xffffffff;
}
else {
iVar6 = CBaseEntity::GetTeamNumber(param_1);
if (iVar6 == 3) {
LAB_007f5025:
iVar6 = (**(code **)(*(int *)this + 0x340))(this,0x331);
cVar4 = (**(code **)(*(int *)this + 0x478))(this);
if ((cVar4 == '\0') && (-1 < iVar6)) {
CDynamicProp::PropSetSequence((CDynamicProp *)this,iVar6);
}
PlayLockSounds((CBaseEntity *)this,(locksound_t *)(this + 0x15f8),1,0);
COutputEvent::FireOutput((COutputEvent *)(this + 0x172c),param_1,param_2,0.0);
return 1;
}
puVar5 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
*(undefined4 *)(this + 0x1620) = *puVar5;
}
PlayLockSounds((CBaseEntity *)this,(locksound_t *)(this + 0x15f8),0,0);
iVar6 = (**(code **)(*(int *)this + 0x340))(this,0x330);
cVar4 = (**(code **)(*(int *)this + 0x478))(this);
if ((cVar4 == '\0') && (-1 < iVar6)) {
CDynamicProp::PropSetSequence((CDynamicProp *)this,iVar6);
}
else if (iVar6 == -1) goto LAB_007f4ffe;
cVar4 = CBaseAnimating::HasAnimEvent((CBaseAnimating *)this,iVar6,1);
if (cVar4 != '\0') {
return 1;
}
LAB_007f4ffe:
DoorActivate(this);
return 1;
}
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.