ZombieReplacement::Save
0x009ef590 · 2293 bytes · __thiscall
_ZN17ZombieReplacement4SaveEP13CTerrorPlayer
Decompiled
undefined (2 params)
/* ZombieReplacement::Save(CTerrorPlayer*) */
void __thiscall ZombieReplacement::Save(ZombieReplacement *this,CTerrorPlayer *param_1)
{
uint uVar1;
CBaseEdict *pCVar2;
ZombieReplacement ZVar3;
undefined4 uVar4;
int *piVar5;
int iVar6;
undefined *puVar7;
undefined *puVar8;
int iVar9;
longdouble lVar10;
int local_48;
undefined *local_44;
undefined *local_40;
CBaseCombatWeapon *local_38;
CTerrorPlayer *local_34;
int local_30 [8];
local_30[0] = 0;
local_30[1] = 0;
local_30[2] = 0;
local_30[3] = 0;
local_30[4] = 0;
local_34 = param_1;
/* try { // try from 009ef5cb to 009efdad has its CatchHandler @ 009efe85 */
ForEachTerrorPlayer<ObserverCollector>((ObserverCollector *)&local_34);
iVar9 = local_30[3];
*(undefined4 *)(this + 0x104) = 0;
if (local_30[3] != 0) {
CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::GrowVector
((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)(this + 0xf8),
local_30[3]);
CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::ShiftElementsRight
((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)(this + 0xf8),0,iVar9);
if (0 < iVar9) {
iVar6 = 0;
do {
*(undefined4 *)(*(int *)(this + 0xf8) + iVar6 * 4) =
*(undefined4 *)(local_30[0] + iVar6 * 4);
iVar6 = iVar6 + 1;
} while (iVar6 != iVar9);
}
}
uVar4 = (**(code **)(*(int *)param_1 + 0x544))(param_1);
*(undefined4 *)this = uVar4;
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
}
*(undefined4 *)(this + 4) = *(undefined4 *)(param_1 + 0x2e0);
*(undefined4 *)(this + 8) = *(undefined4 *)(param_1 + 0x2e4);
*(undefined4 *)(this + 0xc) = *(undefined4 *)(param_1 + 0x2e8);
if (((byte)param_1[0x14d] & 0x10) != 0) {
CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)param_1);
}
*(undefined4 *)(this + 0x10) = *(undefined4 *)(param_1 + 0x274);
*(undefined4 *)(this + 0x14) = *(undefined4 *)(param_1 + 0x278);
*(undefined4 *)(this + 0x18) = *(undefined4 *)(param_1 + 0x27c);
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
}
*(undefined4 *)(this + 0x1c) = *(undefined4 *)(param_1 + 0x37c);
*(undefined4 *)(this + 0x20) = *(undefined4 *)(param_1 + 0x380);
*(undefined4 *)(this + 0x24) = *(undefined4 *)(param_1 + 900);
*(undefined4 *)(this + 0x28) = *(undefined4 *)(param_1 + 0x100);
lVar10 = (longdouble)(**(code **)(*(int *)param_1 + 0x7e4))(param_1);
*(float *)(this + 0x2c) = (float)lVar10;
ZVar3 = (ZombieReplacement)(**(code **)(*(int *)param_1 + 300))(param_1);
this[0x30] = ZVar3;
this[0x31] = *(ZombieReplacement *)(param_1 + 0x2d94);
uVar4 = CBaseEntity::GetGender((CBaseEntity *)param_1);
*(undefined4 *)(this + 0x34) = uVar4;
uVar4 = CTerrorPlayer::GetActiveTerrorWeapon(param_1);
*(undefined4 *)(this + 0x38) = uVar4;
iVar9 = 1;
do {
local_38 = (CBaseCombatWeapon *)CTerrorPlayer::GetTerrorWeapon(param_1,iVar9);
if (local_38 != (CBaseCombatWeapon *)0x0) {
CBaseCombatCharacter::Weapon_Detach((CBaseCombatCharacter *)param_1,local_38);
CUtlVector<CTerrorWeapon*,CUtlMemory<CTerrorWeapon*,int>>::InsertBefore
((CUtlVector<CTerrorWeapon*,CUtlMemory<CTerrorWeapon*,int>> *)(this + 0x3c),
*(int *)(this + 0x48),(CTerrorWeapon **)&local_38);
}
iVar9 = iVar9 + 1;
} while (iVar9 != 0x38);
iVar9 = 0;
do {
uVar4 = CBaseCombatCharacter::GetAmmoCount((CBaseCombatCharacter *)param_1,iVar9);
*(undefined4 *)(this + iVar9 * 4 + 0x50) = uVar4;
iVar9 = iVar9 + 1;
} while (iVar9 != 0x20);
piVar5 = (int *)CBasePlayer::GetViewModel((CBasePlayer *)param_1,0);
if (piVar5 != (int *)0x0) {
(**(code **)(*piVar5 + 0x3bc))(piVar5,0x20);
}
puVar8 = g_pEntityList;
uVar1 = *(uint *)(param_1 + 0x3e64);
uVar4 = 0;
local_40 = g_pEntityList;
if (((uVar1 != 0xffffffff) &&
(puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar7 + 8) == uVar1 >> 0xc)) {
uVar4 = *(undefined4 *)(puVar7 + 4);
}
*(undefined4 *)(this + 0xd0) = uVar4;
local_44 = puVar8 + 4;
if ((local_44 == (undefined *)0x0) || (*(int *)(puVar8 + 8) != 0)) {
local_48 = 0;
}
else {
local_48 = *(int *)(puVar8 + 4);
}
uVar1 = *(uint *)(param_1 + 0x3e64);
if (((uVar1 == 0xffffffff) ||
(puVar8 = puVar8 + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar8 + 8) != uVar1 >> 0xc)) {
iVar9 = 0;
}
else {
iVar9 = *(int *)(puVar8 + 4);
}
if (local_48 != iVar9) {
if (param_1[0x6c] == (CTerrorPlayer)0x0) {
pCVar2 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar9 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar9 + 2) = 0;
local_40 = g_pEntityList;
local_44 = g_pEntityList + 4;
}
}
else {
param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
}
*(undefined4 *)(param_1 + 0x3e64) = 0;
}
uVar4 = 0;
*(undefined4 *)(this + 0xd4) = *(undefined4 *)(param_1 + 0x3e7c);
*(undefined4 *)(this + 0xd8) = *(undefined4 *)(param_1 + 0x330c);
uVar1 = *(uint *)(param_1 + 0x33c0);
if (((uVar1 != 0xffffffff) &&
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) {
uVar4 = *(undefined4 *)(puVar8 + 4);
}
*(undefined4 *)(this + 0xdc) = uVar4;
if ((local_44 == (undefined *)0x0) || (*(int *)(local_40 + 8) != 0)) {
iVar9 = 0;
}
else {
iVar9 = *(int *)(local_40 + 4);
}
uVar1 = *(uint *)(param_1 + 0x33c0);
if (((uVar1 == 0xffffffff) ||
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar8 + 8) != uVar1 >> 0xc)) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(puVar8 + 4);
}
if (iVar9 != iVar6) {
if (param_1[0x6c] == (CTerrorPlayer)0x0) {
pCVar2 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar9 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar9 + 2) = 0;
local_40 = g_pEntityList;
local_44 = g_pEntityList + 4;
}
}
else {
param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
}
*(undefined4 *)(param_1 + 0x33c0) = 0;
}
uVar1 = *(uint *)(param_1 + 0x3edc);
uVar4 = 0;
if (((uVar1 != 0xffffffff) &&
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) {
uVar4 = *(undefined4 *)(puVar8 + 4);
}
*(undefined4 *)(this + 0xe0) = uVar4;
if ((local_44 == (undefined *)0x0) || (*(int *)(local_40 + 8) != 0)) {
iVar9 = 0;
}
else {
iVar9 = *(int *)(local_40 + 4);
}
uVar1 = *(uint *)(param_1 + 0x3edc);
if (((uVar1 == 0xffffffff) ||
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar8 + 8) != uVar1 >> 0xc)) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(puVar8 + 4);
}
if (iVar9 != iVar6) {
if (param_1[0x6c] == (CTerrorPlayer)0x0) {
pCVar2 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar9 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar9 + 2) = 0;
local_40 = g_pEntityList;
local_44 = g_pEntityList + 4;
}
}
else {
param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
}
*(undefined4 *)(param_1 + 0x3edc) = 0;
}
uVar1 = *(uint *)(param_1 + 0x3e44);
uVar4 = 0;
if (((uVar1 != 0xffffffff) &&
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) {
uVar4 = *(undefined4 *)(puVar8 + 4);
}
*(undefined4 *)(this + 0xe4) = uVar4;
if ((local_44 == (undefined *)0x0) || (*(int *)(local_40 + 8) != 0)) {
iVar9 = 0;
}
else {
iVar9 = *(int *)(local_40 + 4);
}
uVar1 = *(uint *)(param_1 + 0x3e44);
if (((uVar1 == 0xffffffff) ||
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar8 + 8) != uVar1 >> 0xc)) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(puVar8 + 4);
}
if (iVar9 != iVar6) {
if (param_1[0x6c] == (CTerrorPlayer)0x0) {
pCVar2 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar9 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar9 + 2) = 0;
local_40 = g_pEntityList;
local_44 = g_pEntityList + 4;
}
}
else {
param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
}
*(undefined4 *)(param_1 + 0x3e44) = 0;
}
uVar1 = *(uint *)(param_1 + 0x3e4c);
uVar4 = 0;
if (((uVar1 != 0xffffffff) &&
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) {
uVar4 = *(undefined4 *)(puVar8 + 4);
}
*(undefined4 *)(this + 0xe8) = uVar4;
if ((local_44 == (undefined *)0x0) || (*(int *)(local_40 + 8) != 0)) {
iVar9 = 0;
}
else {
iVar9 = *(int *)(local_40 + 4);
}
uVar1 = *(uint *)(param_1 + 0x3e4c);
if (((uVar1 == 0xffffffff) ||
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar8 + 8) != uVar1 >> 0xc)) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(puVar8 + 4);
}
if (iVar9 != iVar6) {
if (param_1[0x6c] == (CTerrorPlayer)0x0) {
pCVar2 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar9 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar9 + 2) = 0;
local_40 = g_pEntityList;
local_44 = g_pEntityList + 4;
}
}
else {
param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
}
*(undefined4 *)(param_1 + 0x3e4c) = 0;
}
uVar1 = *(uint *)(param_1 + 0x2a48);
uVar4 = 0;
if (((uVar1 != 0xffffffff) &&
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) {
uVar4 = *(undefined4 *)(puVar8 + 4);
}
*(undefined4 *)(this + 0xec) = uVar4;
if ((local_44 == (undefined *)0x0) || (*(int *)(local_40 + 8) != 0)) {
iVar9 = 0;
}
else {
iVar9 = *(int *)(local_40 + 4);
}
uVar1 = *(uint *)(param_1 + 0x2a48);
if (((uVar1 == 0xffffffff) ||
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar8 + 8) != uVar1 >> 0xc)) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(puVar8 + 4);
}
if (iVar9 != iVar6) {
if (param_1[0x6c] == (CTerrorPlayer)0x0) {
pCVar2 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar9 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar9 + 2) = 0;
local_40 = g_pEntityList;
local_44 = g_pEntityList + 4;
}
}
else {
param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
}
*(undefined4 *)(param_1 + 0x2a48) = 0;
}
uVar1 = *(uint *)(param_1 + 0x30bc);
uVar4 = 0;
if (((uVar1 != 0xffffffff) &&
(puVar8 = local_40 + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) {
uVar4 = *(undefined4 *)(puVar8 + 4);
}
*(undefined4 *)(this + 0xf0) = uVar4;
if ((local_44 == (undefined *)0x0) || (*(int *)(local_40 + 8) != 0)) {
iVar9 = 0;
}
else {
iVar9 = *(int *)(local_40 + 4);
}
uVar1 = *(uint *)(param_1 + 0x30bc);
if (((uVar1 == 0xffffffff) ||
(local_40 = local_40 + (uVar1 & 0xfff) * 0x10, local_40 == (undefined *)0xfffffffc)) ||
(*(uint *)(local_40 + 8) != uVar1 >> 0xc)) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(local_40 + 4);
}
if (iVar9 != iVar6) {
if (param_1[0x6c] == (CTerrorPlayer)0x0) {
pCVar2 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar9 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar9 + 2) = 0;
}
}
else {
param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
}
*(undefined4 *)(param_1 + 0x30bc) = 0;
}
local_30[3] = 0;
this[0xf4] = (ZombieReplacement)((byte)((uint)*(undefined4 *)(param_1 + 0x150) >> 0x1b) & 1);
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_30);
local_30[4] = local_30[0];
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_30);
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.