CTerrorPlayer::WarpGhostToInitialPosition
0x009c7390 · 2634 bytes · __thiscall
_ZN13CTerrorPlayer26WarpGhostToInitialPositionEb
Decompiled
undefined (2 params)
/* CTerrorPlayer::WarpGhostToInitialPosition(bool) */
void __thiscall CTerrorPlayer::WarpGhostToInitialPosition(CTerrorPlayer *this,bool param_1)
{
float *pfVar1;
CBaseEntity *this_00;
code *pcVar2;
CBaseEdict *pCVar3;
char cVar4;
int iVar5;
undefined4 uVar6;
CBasePlayer *pCVar7;
uint uVar8;
CBasePlayer *pCVar9;
CFuncElevator *this_01;
int iVar10;
bool bVar11;
longdouble lVar12;
float fVar13;
Vector *pVVar14;
CTerrorPlayer *pCVar15;
Vector *local_64;
int local_50;
undefined4 local_4c;
float local_48;
undefined4 local_44 [3];
float local_38;
float local_34;
float local_30;
CBaseEntity *local_2c;
int local_28;
undefined4 local_24;
undefined1 local_20;
undefined1 local_1f;
cVar4 = (**(code **)(*(int *)this + 0x558))(this);
if (cVar4 == '\0') {
return;
}
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
local_50 = *(int *)(this + 0x2e0);
local_4c = *(undefined4 *)(this + 0x2e4);
local_48 = *(float *)(this + 0x2e8);
cVar4 = CDirector::IsFinale(TheDirector);
if ((((cVar4 != '\0') && (**(int **)(TheDirector + 0x638) != 3)) &&
((*(int *)(ZombieFinaleGhostWarpToSurvivor._28_4_ + 0x30) == 0 ||
(iVar5 = (**(code **)(*(int *)this + 0x544))(this), iVar5 == 8)))) ||
(cVar4 = CDirectorChallengeMode::AutoSpawnInfectedGhosts
(*(CDirectorChallengeMode **)(TheDirector + 0x648)), cVar4 != '\0')) {
uVar6 = (**(code **)(*(int *)this + 0x544))(this);
cVar4 = ZombieManager::GetRandomPZSpawnPosition
(TheZombieManager,uVar6,10,this,(Vector *)&local_50);
if (cVar4 != '\0') {
CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)&local_50);
(**(code **)(*(int *)this + 0x778))(this);
goto LAB_009c7c3d;
}
}
cVar4 = (**(code **)(*(int *)this + 0x778))(this);
if (cVar4 == '\0') {
iVar5 = *(int *)(this + 0x4024);
iVar10 = iVar5;
do {
uVar8 = iVar10 + 1;
if (uVar8 < 4) {
*(uint *)(this + 0x4024) = uVar8;
}
else {
*(undefined4 *)(this + 0x4024) = 0;
uVar8 = 0;
}
pCVar7 = (CBasePlayer *)GetPlayerByCharacter(uVar8);
if ((((pCVar7 != (CBasePlayer *)0x0) &&
(cVar4 = (**(code **)(*(int *)pCVar7 + 300))(pCVar7), cVar4 != '\0')) &&
(cVar4 = CBasePlayer::IsOnElevator(pCVar7), cVar4 == '\0')) &&
(0.25 < (*(float *)(ZombieNoiseLevelHoldTime._28_4_ + 0x2c) -
(*(float *)(gpGlobals + 0xc) - *(float *)(pCVar7 + 0x3310))) +
*(float *)(pCVar7 + 0x3304) / *(float *)(ZombieNoiseLevelFadeRate._28_4_ + 0x2c)))
{
iVar10 = (**(code **)(*(int *)pCVar7 + 0x52c))(pCVar7);
if (iVar10 == 0) {
if (((byte)pCVar7[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pCVar7);
}
pCVar9 = pCVar7 + 0x2e0;
}
else {
pCVar9 = (CBasePlayer *)(iVar10 + 0x2c);
}
local_38 = *(float *)pCVar9;
local_34 = *(float *)(pCVar9 + 4);
local_30 = *(float *)(pCVar9 + 8);
cVar4 = FindNearbySpawnSpot(this,(Vector *)&local_38,0,true,100.0);
if (cVar4 != '\0') {
local_50 = (int)local_38;
local_4c = local_34;
local_48 = local_30;
CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)&local_50);
if (*(int *)(this + 0x2cb0) < 1) {
if (this[0x6c] == (CTerrorPlayer)0x0) {
pCVar3 = *(CBaseEdict **)(this + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x2cb0) = 1;
}
if (pCVar7 != (CBasePlayer *)0x0) goto LAB_009c75c4;
goto LAB_009c7c3d;
}
}
iVar10 = *(int *)(this + 0x4024);
} while (iVar10 != iVar5);
}
local_64 = (Vector *)&local_38;
if ((param_1) && (cVar4 = CTerrorGameRules::IsScavengeMode(), cVar4 != '\0')) {
local_38 = 0.0;
local_34 = 0.0;
local_30 = 0.0;
local_2c = (CBaseEntity *)0x0;
local_28 = 0;
/* try { // try from 009c7816 to 009c7838 has its CatchHandler @ 009c7e3a */
ForEachSurvivor<AmbulatorySurvivorCollector>((AmbulatorySurvivorCollector *)local_64);
if ((int)local_2c < 1) {
local_2c = (CBaseEntity *)0x0;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_64);
local_28 = (int)local_38;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_64);
goto LAB_009c76d8;
}
iVar5 = RandomInt(0,(int)local_2c + -1);
pCVar7 = *(CBasePlayer **)((int)local_38 + iVar5 * 4);
local_2c = (CBaseEntity *)0x0;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_64);
local_28 = (int)local_38;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_64);
if (pCVar7 == (CBasePlayer *)0x0) goto LAB_009c76d8;
LAB_009c7867:
if (((byte)pCVar7[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pCVar7);
}
local_50 = *(int *)(pCVar7 + 0x2e0);
local_4c = *(undefined4 *)(pCVar7 + 0x2e4);
local_48 = *(float *)(pCVar7 + 0x2e8);
this_01 = (CFuncElevator *)CBasePlayer::GetElevator(pCVar7);
cVar4 = CDirector::IsFinale(TheDirector);
bVar11 = false;
if (cVar4 == '\0') {
bVar11 = *(int *)(this + 0x2c14) != 0;
}
cVar4 = CTerrorGameRules::HasPlayerControlledZombies();
if ((cVar4 != '\0') &&
((bVar11 = this_01 == (CFuncElevator *)0x0, pCVar7[0x1a91] != (CBasePlayer)0x0 ||
(((byte)pCVar7[0x150] & 2) != 0)))) {
*(uint *)(this + 0x1cb0) = *(uint *)(this + 0x1cb0) | 4;
CBaseEntity::AddFlag((CBaseEntity *)this,2);
if (this[0x1a90] != (CTerrorPlayer)0x1) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a90);
this[0x1a90] = (CTerrorPlayer)0x1;
}
if (this[0x1a91] != (CTerrorPlayer)0x1) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a91);
this[0x1a91] = (CTerrorPlayer)0x1;
}
if (*(int *)(this + 0x1a94) != 0) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a94);
*(undefined4 *)(this + 0x1a94) = 0;
}
pcVar2 = *(code **)(*(int *)this + 0x254);
iVar5 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
(*pcVar2)(this,iVar5 + 0x3c);
iVar5 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
iVar10 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
CBaseEntity::SetCollisionBounds
((CBaseEntity *)this,(Vector *)(iVar10 + 0x24),(Vector *)(iVar5 + 0x30));
}
local_64 = (Vector *)&local_38;
if (bVar11) {
fVar13 = *(float *)(ZombieGhostSpawnDistance._28_4_ + 0x2c) + *(float *)(this + 0x2bc0);
pCVar15 = this;
FindGhostSpawnPosition((CTerrorPlayer *)local_64,(CTerrorPlayer *)pCVar7,(float)this);
pVVar14 = (Vector *)&local_50;
local_50 = (int)local_38;
local_4c = local_34;
local_48 = local_30;
CBaseEntity::SetAbsOrigin((CBaseEntity *)this,pVVar14);
if (((*(int *)(this + 0x2cb0) == 0) &&
(cVar4 = (**(code **)(*(int *)this + 0x778))(this,pVVar14,pCVar15,fVar13), cVar4 == '\0'))
&& (*(int *)(this + 0x2cb0) != 1)) {
if (this[0x6c] == (CTerrorPlayer)0x0) {
pCVar3 = *(CBaseEdict **)(this + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x2cb0) = 1;
}
goto LAB_009c7c3d;
}
if (((this_01 == (CFuncElevator *)0x0) ||
(iVar5 = CFuncElevator::GetDestinationFloor(this_01), iVar5 < 0)) ||
((*(int *)(this_01 + 0x54c) <= iVar5 ||
(pfVar1 = (float *)(*(int *)(this_01 + 0x540) + iVar5 * 0xc), pfVar1 == (float *)0x0)))) {
bVar11 = false;
}
else {
fVar13 = *pfVar1;
bVar11 = true;
lVar12 = (longdouble)
CFuncElevator::GetCurrentHeight(this_01,"CTerrorPlayer::WarpGhostToInitialPosition");
local_48 = (fVar13 + local_48) - (float)lVar12;
}
}
else {
LAB_009c76d8:
local_64 = (Vector *)&local_38;
local_38 = -9999.0;
local_34 = 2.8026e-45;
local_30 = 0.0;
local_2c = (CBaseEntity *)0x0;
local_28 = 1;
local_24 = 0;
ForEachTerrorPlayer<HighestFlowDistance>((HighestFlowDistance *)local_64);
pCVar7 = (CBasePlayer *)local_2c;
if (local_2c != (CBaseEntity *)0x0) goto LAB_009c7867;
local_38 = 0.0;
local_34 = 0.0;
local_30 = 0.0;
local_2c = (CBaseEntity *)0x0;
local_28 = 0;
/* try { // try from 009c7741 to 009c7763 has its CatchHandler @ 009c7e25 */
ForEachSurvivor<SurvivorCollector>((SurvivorCollector *)local_64);
if ((int)local_2c < 1) {
/* try { // try from 009c7e0b to 009c7e1c has its CatchHandler @ 009c7e25 */
GetPlayerSpawnPosition(8,&local_50,0,0);
}
else {
iVar5 = RandomInt(0,(int)local_2c + -1);
this_00 = *(CBaseEntity **)((int)local_38 + iVar5 * 4);
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
local_50 = *(int *)(this_00 + 0x2e0);
local_4c = *(undefined4 *)(this_00 + 0x2e4);
local_48 = *(float *)(this_00 + 0x2e8);
}
local_64 = (Vector *)&local_38;
local_2c = (CBaseEntity *)0x0;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_64);
bVar11 = false;
local_28 = (int)local_38;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_64);
}
cVar4 = FindNearbySpawnSpot(this,(Vector *)&local_50,0,true,100.0);
if ((cVar4 == '\0') &&
(cVar4 = FindNearbySpawnSpot(this,(Vector *)&local_50,0,true,1000.0), cVar4 == '\0')) {
GetPlayerSpawnPosition(8,(Vector *)&local_50,0,0);
}
CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)&local_50);
if (this[0x1a90] != (CTerrorPlayer)0x1) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a90);
this[0x1a90] = (CTerrorPlayer)0x1;
}
if (this[0x1a91] != (CTerrorPlayer)0x0) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a91);
this[0x1a91] = (CTerrorPlayer)0x0;
}
CBaseEntity::AddFlag((CBaseEntity *)this,2);
iVar5 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
iVar10 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
CBaseEntity::SetCollisionBounds
((CBaseEntity *)this,(Vector *)(iVar10 + 0x24),(Vector *)(iVar5 + 0x30));
if (bVar11) {
return;
}
LAB_009c7c3d:
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
local_64 = (Vector *)&local_38;
local_38 = *(float *)(this + 0x2e0);
local_2c = (CBaseEntity *)0x0;
local_28 = 0x4cbebc20;
local_34 = *(float *)(this + 0x2e4);
local_24 = 0;
local_30 = *(float *)(this + 0x2e8);
local_20 = 1;
local_1f = 0;
ForEachTerrorPlayer<ClosestSurvivorScan>((ClosestSurvivorScan *)local_64);
pCVar7 = (CBasePlayer *)local_2c;
if (local_2c != (CBaseEntity *)0x0) {
LAB_009c75c4:
local_64 = (Vector *)&local_38;
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
if (((byte)*(CBaseEntity *)(pCVar7 + 0x14d) & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pCVar7);
}
local_38 = *(float *)(pCVar7 + 0x2e0) - *(float *)(this + 0x2e0);
local_34 = *(float *)(pCVar7 + 0x2e4) - *(float *)(this + 0x2e4);
local_30 = *(float *)(pCVar7 + 0x2e8) - *(float *)(this + 0x2e8);
VectorAngles(local_64,(QAngle *)local_44);
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
if (((byte)*(CBaseEntity *)(pCVar7 + 0x14d) & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pCVar7);
}
if (SQRT((*(float *)(pCVar7 + 0x2e4) - *(float *)(this + 0x2e4)) *
(*(float *)(pCVar7 + 0x2e4) - *(float *)(this + 0x2e4)) +
(*(float *)(pCVar7 + 0x2e8) - *(float *)(this + 0x2e8)) *
(*(float *)(pCVar7 + 0x2e8) - *(float *)(this + 0x2e8)) +
(*(float *)(pCVar7 + 0x2e0) - *(float *)(this + 0x2e0)) *
(*(float *)(pCVar7 + 0x2e0) - *(float *)(this + 0x2e0))) < 64.0) {
local_44[0] = 0;
}
CBasePlayer::SnapEyeAngles((CBasePlayer *)this,(QAngle *)local_44);
}
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.