CreateInfoTransitioningPlayers
0x008f8950 · 3102 bytes · unknown
_Z30CreateInfoTransitioningPlayersv
Decompiled
undefined (0 params)
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* CreateInfoTransitioningPlayers() */
void CreateInfoTransitioningPlayers(void)
{
PlayerSaveData *this;
CBaseEdict *this_00;
char cVar1;
int iVar2;
char *pcVar3;
char *pcVar4;
undefined4 uVar5;
undefined4 uVar6;
CTransitioningPlayer *this_01;
int iVar7;
int iVar8;
undefined4 uVar9;
undefined4 uVar10;
Checkpoint *pCVar11;
KeyValues *this_02;
int iVar12;
float fVar13;
SurvivorBot *this_03;
uint uVar14;
undefined1 *puVar15;
undefined4 uVar16;
int iVar17;
int in_GS_OFFSET;
bool bVar18;
longdouble lVar19;
float fVar20;
float fVar21;
int local_94;
int local_8c;
undefined4 local_88;
float local_70;
float local_6c;
float local_68;
float local_64;
float local_60;
float local_5c;
float local_58;
float local_54;
float local_50;
float local_4c;
float local_48;
float local_44;
char local_40 [32];
int local_20;
iVar17 = 0;
DAT_00fa9a14 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (0 < DAT_0100e518) {
do {
while( true ) {
this = (PlayerSaveData *)(g_SavedPlayers + iVar17 * 4);
iVar2 = KeyValues::GetInt(*(KeyValues **)this,"restoreState",0);
if (iVar2 == 0) break;
KeyValues::GetInt(*(KeyValues **)this,"userID",0);
uVar5 = KeyValues::GetString(*(KeyValues **)this,"idealName","");
UTIL_LogPrintf("Skipping saved player %s(%d) - restore was already done\n",uVar5);
LAB_008f89d2:
iVar17 = iVar17 + 1;
if (DAT_0100e518 <= iVar17) goto LAB_008f8ae0;
}
pcVar3 = (char *)KeyValues::GetString(*(KeyValues **)this,"targetMap","");
pcVar4 = *(char **)(gpGlobals + 0x3c);
if (pcVar4 == (char *)0x0) {
pcVar4 = "";
}
if (pcVar3 == pcVar4) {
LAB_008f8b00:
iVar2 = KeyValues::GetInt(*(KeyValues **)this,"teamNumber",0);
if (iVar2 == 2) {
local_88 = KeyValues::GetInt(*(KeyValues **)this,"character",0);
if ((*(int *)(SurvivorBotTransition._28_4_ + 0x30) != 0) &&
(cVar1 = CDirector::NoSurvivorBots(TheDirector), cVar1 == '\0')) {
s_placeholderBotIndex = iVar17;
pcVar4 = (char *)SurvivorCharacterDisplayName(local_88);
this_03 = NextBotCreatePlayerBot<SurvivorBot>(pcVar4);
if (this_03 != (SurvivorBot *)0x0) {
uVar5 = KeyValues::GetInt(*(KeyValues **)this,"userID",0);
uVar6 = KeyValues::GetString(*(KeyValues **)this,"idealName","");
uVar9 = SurvivorCharacterDisplayName(local_88);
UTIL_LogPrintf("CREATING BOT %s FOR %s(%d)\n",uVar9,uVar6,uVar5);
KeyValues::GetInt(*(KeyValues **)this,"userID",0);
uVar5 = KeyValues::GetString(*(KeyValues **)this,"idealName","");
uVar6 = SurvivorCharacterDisplayName(local_88);
DevMsg(1,"[TAKEOVER]: Creating placeholder bot %s for %s(%d)\n",uVar6,uVar5);
(**(code **)(*(int *)this_03 + 0x8cc))(this_03,2,local_88,1);
CDirector::OnPlayerTransitioned(TheDirector);
pcVar4 = (char *)KeyValues::GetString(*(KeyValues **)this,"idealName","");
V_strncpy(local_40,pcVar4,0x20);
pcVar4 = (char *)SurvivorCharacterDisplayName(local_88);
KeyValues::SetString(*(KeyValues **)this,"idealName",pcVar4);
KeyValues::SetInt(*(KeyValues **)this,"sb_transition",1);
PlayerSaveData::Restore(this,(CTerrorPlayer *)this_03);
KeyValues::SetString(*(KeyValues **)this,"idealName",local_40);
cVar1 = CDirector::IsInTransition(TheDirector);
if ((cVar1 != '\0') &&
(cVar1 = (**(code **)(*(int *)this_03 + 300))(this_03), cVar1 == '\0')) {
pCVar11 = (Checkpoint *)TerrorNavMesh::GetInitialCheckpoint(TheNavMesh);
CTerrorPlayer::CheckpointRespawn((CTerrorPlayer *)this_03,pCVar11);
iVar2 = KeyValues::GetInt(*(KeyValues **)this,"skin",0);
if (iVar2 != *(int *)(this_03 + 0x458)) {
if (this_03[0x6c] == (SurvivorBot)0x0) {
this_00 = *(CBaseEdict **)(this_03 + 0x30);
if (this_00 != (CBaseEdict *)0x0) {
*(uint *)this_00 = *(uint *)this_00 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(this_00);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this_03[0x70] = (SurvivorBot)((byte)this_03[0x70] | 1);
}
*(int *)(this_03 + 0x458) = iVar2;
}
}
iVar2 = KeyValues::GetInt(*(KeyValues **)this,"userID",0);
SurvivorBot::SetHumanSpectatorByUserID(this_03,iVar2,local_40);
s_placeholderBotIndex = 0xffffffff;
goto LAB_008f89d2;
}
s_placeholderBotIndex = 0xffffffff;
}
}
else {
local_88 = 8;
}
this_01 = (CTransitioningPlayer *)
CBaseEntity::Create("info_transitioning_player",(Vector *)&vec3_origin,
(QAngle *)&vec3_angle,(CBaseEntity *)0x0);
iVar2 = KeyValues::GetInt(*(KeyValues **)this,"teamNumber",0);
iVar7 = KeyValues::GetInt(*(KeyValues **)this,"state",0);
bVar18 = iVar7 == 0;
local_8c = KeyValues::GetInt(*(KeyValues **)this,"health",0);
if ((!bVar18) && (iVar2 == 2)) {
cVar1 = CDirector::IsTransitionScenarioRestart();
bVar18 = true;
local_8c = (-(uint)(cVar1 == '\0') & 0xffffffce) + 100;
}
iVar7 = KeyValues::GetInt(*(KeyValues **)this,"incapacitated",0);
iVar8 = KeyValues::GetInt(*(KeyValues **)this,"fumes",0);
lVar19 = (longdouble)KeyValues::GetFloat(*(KeyValues **)this,"healthBuffer",0.0);
uVar5 = KeyValues::GetInt(*(KeyValues **)this,"teamNumber",0);
uVar6 = KeyValues::GetInt(*(KeyValues **)this,"userID",0);
uVar9 = KeyValues::GetInt(*(KeyValues **)this,"deaths",0);
uVar16 = 0;
if (iVar2 == 2) {
uVar16 = KeyValues::GetInt(*(KeyValues **)this,"score",0);
}
uVar10 = KeyValues::GetString(*(KeyValues **)this,"idealName","");
CTransitioningPlayer::Init
(this_01,uVar10,uVar16,uVar9,uVar6,uVar5,local_8c,(int)lVar19,bVar18,iVar8 != 0,
iVar7 != 0,0,local_88);
GetTransitionedLandmarkOffset();
pcVar4 = (char *)KeyValues::GetString(*(KeyValues **)this,"pos","");
local_4c = vec3_origin;
local_48 = DAT_01053d4c;
local_44 = DAT_01053d50;
sscanf(pcVar4,"%f %f %f");
local_64 = local_70 + local_4c;
local_60 = local_6c + local_48;
local_5c = local_68 + local_44;
pcVar4 = (char *)KeyValues::GetString(*(KeyValues **)this,"angles","");
local_58 = vec3_angle;
local_54 = DAT_01053d40;
local_50 = DAT_01053d44;
sscanf(pcVar4,"%f %f %f");
HackRotateAroundLandmark((Vector *)&local_64,(QAngle *)&local_58);
iVar2 = KeyValues::GetInt(*(KeyValues **)this,"state",0);
if (iVar2 == 0) {
uVar14 = KeyValues::GetInt(*(KeyValues **)this,"teamNumber",0);
fVar13 = local_5c;
fVar20 = local_64;
fVar21 = local_60;
LAB_008f918a:
GetSafeSpawnPos(&local_4c,0,fVar20,fVar21,fVar13,(ulonglong)uVar14 << 0x20,
CONCAT44(local_8c,(QAngle *)&local_58));
local_64 = local_4c;
local_60 = local_48;
local_5c = local_44;
}
else {
pCVar11 = (Checkpoint *)TerrorNavMesh::GetInitialCheckpoint(TheNavMesh);
if (pCVar11 == (Checkpoint *)0x0) {
uVar14 = KeyValues::GetInt(*(KeyValues **)this,"teamNumber",0);
fVar13 = DAT_01053d50;
fVar20 = vec3_origin;
fVar21 = DAT_01053d4c;
goto LAB_008f918a;
}
Checkpoint::GetSpawnPosition
(pCVar11,(Vector *)&local_64,(QAngle *)&local_58,(TerrorNavArea **)0x0);
pcVar4 = (char *)UTIL_VarArgs("%f %f %f",(double)local_58,(double)local_54,
(double)local_50);
KeyValues::SetString(*(KeyValues **)this,"angles",pcVar4);
}
pcVar4 = (char *)UTIL_VarArgs("%f %f %f",(double)local_64,(double)local_60,(double)local_5c)
;
KeyValues::SetString(*(KeyValues **)this,"pos",pcVar4);
KeyValues::SetInt(*(KeyValues **)this,"positionFixedUp",1);
(**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
iVar2 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
DropToGround((CBaseEntity *)&local_4c,(Vector *)0x0,(Vector *)&local_64,
(Vector *)(iVar2 + 0xc));
CBaseEntity::SetAbsOrigin((CBaseEntity *)this_01,(Vector *)&local_4c);
CBaseEntity::SetAbsAngles((CBaseEntity *)this_01,(QAngle *)&local_58);
this_02 = (KeyValues *)KeyValues::GetFirstSubKey(*(KeyValues **)this);
if (this_02 == (KeyValues *)0x0) {
local_88 = 0;
local_94 = 0;
iVar2 = 1;
}
else {
iVar2 = 1;
local_88 = 0;
local_94 = 0;
do {
while( true ) {
pcVar4 = (char *)KeyValues::GetName(this_02);
iVar8 = _V_strcmp(pcVar4,"weapon");
iVar7 = local_94;
if (iVar8 == 0) break;
LAB_008f9018:
local_94 = iVar7;
this_02 = (KeyValues *)KeyValues::GetNextKey(this_02);
if (this_02 == (KeyValues *)0x0) goto LAB_008f90ec;
}
iVar8 = KeyValues::GetInt(this_02,"weaponID",0);
if (iVar8 == 0xd) {
local_88 = 1;
goto LAB_008f9018;
}
if ((((iVar8 == 0xe) || (iVar8 == 0xc)) || (iVar8 == 0xf)) ||
(iVar12 = KeyValues::GetInt(this_02,"weaponSlot",-1), iVar7 = iVar8, iVar12 == 0))
goto LAB_008f9018;
if (iVar12 == 1) {
iVar2 = iVar8;
}
this_02 = (KeyValues *)KeyValues::GetNextKey(this_02);
} while (this_02 != (KeyValues *)0x0);
}
LAB_008f90ec:
CTransitioningPlayer::InitItems(this_01,local_94,iVar2,local_88);
goto LAB_008f89d2;
}
iVar2 = _V_stricmp(pcVar3,pcVar4);
if (iVar2 == 0) goto LAB_008f8b00;
puVar15 = &DAT_00d539c2;
if (*(undefined1 **)(gpGlobals + 0x3c) != (undefined1 *)0x0) {
puVar15 = *(undefined1 **)(gpGlobals + 0x3c);
}
iVar17 = iVar17 + 1;
uVar5 = KeyValues::GetInt(*(KeyValues **)this,"userID",0);
uVar6 = KeyValues::GetString(*(KeyValues **)this,"idealName","");
UTIL_LogPrintf("Skipping saved player %s(%d) - we\'re on %s and it\'s only valid for %s\n",
uVar6,uVar5,puVar15);
} while (iVar17 < DAT_0100e518);
}
LAB_008f8ae0:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.