CBasePlayer::Spawn
0x007be4b0 · 3932 bytes · __thiscall
_ZN11CBasePlayer5SpawnEv
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBasePlayer::Spawn() */
void __thiscall CBasePlayer::Spawn(CBasePlayer *this)
{
float fVar1;
CBaseEdict *pCVar2;
code *pcVar3;
undefined4 uVar4;
char cVar5;
int iVar6;
CHintSystem *this_00;
char *pcVar7;
long lVar8;
undefined4 uVar9;
int iVar10;
uint uVar11;
undefined *puVar12;
bool bVar13;
CBasePlayer *pCVar14;
undefined4 uVar15;
undefined1 local_84 [20];
color32_s local_70;
undefined1 local_6f;
undefined1 local_6e;
undefined1 local_6d;
undefined4 local_6c;
undefined4 local_68;
void *local_64;
undefined4 local_60;
undefined4 local_58;
undefined4 local_54;
CBasePlayer *local_50;
void *local_4c;
undefined4 local_48;
CBasePlayer *local_44;
undefined **local_3c;
undefined4 local_38;
CBasePlayer *local_34;
local_6c = 0;
local_68 = 0;
if (___atan2f_finite == (CBasePlayer *)0x0) {
local_50 = (CBasePlayer *)0x0;
}
else {
(**(code **)(___atan2f_finite + 0x50))
(___atan2f_finite,&local_6c,0,0,0,0,"/data/src/game/server/player.cpp",0x13d5,
&Spawn()::tm_fmt,"(%s)%s","Unaccounted","CBasePlayer::Spawn");
local_50 = ___atan2f_finite;
}
iVar6 = _DAT_0105db00;
local_58 = local_6c;
local_54 = local_68;
if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
/* try { // try from 007bf086 to 007bf0d4 has its CatchHandler @ 007bf50d */
iVar10 = ThreadGetCurrentId();
if (iVar6 == iVar10) {
if (*(char **)_DAT_0105d15c != "CBasePlayer::Spawn") {
_DAT_0105d15c =
(CBasePlayer *)
CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcb8b1e,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
}
/* try { // try from 007be56b to 007bea83 has its CatchHandler @ 007bf519 */
iVar6 = (**(code **)(*(int *)this + 0x74c))(this);
if (iVar6 != 0) {
this_00 = (CHintSystem *)(**(code **)(*(int *)this + 0x74c))(this);
CHintSystem::ResetHints(this_00);
}
CBaseEntity::SetClassname((char *)this);
if (*(int *)(this + 0x30) == 0) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
pcVar7 = (char *)(**(code **)(*engine + 0xe0))(engine,iVar6,"rate");
if (pcVar7 != (char *)0x0) {
lVar8 = strtol(pcVar7,(char **)0x0,10);
if (4999 < lVar8) {
iVar10 = 0;
if (-1 < *(int *)(ent_steadystate_batchsize._28_4_ + 0x30)) {
iVar10 = *(int *)(ent_steadystate_batchsize._28_4_ + 0x30);
}
iVar6 = 100;
if (iVar10 < 0x65) {
iVar6 = iVar10;
}
if (lVar8 < 20000) {
iVar6 = (int)((float)(iVar6 + -1) * 6.666667e-05 * ((float)lVar8 + -5000.0) + 0.5) + 1;
}
goto LAB_007be64a;
}
}
iVar6 = 1;
LAB_007be64a:
iVar10 = gpGlobals;
*(int *)(this + 0x2340) = iVar6;
puVar12 = g_pEntityList;
uVar9 = *(undefined4 *)(iVar10 + 0xc);
*(undefined4 *)(this + 0x2344) = 0xffffffff;
uVar11 = *(uint *)(this + 0x200c);
*(undefined4 *)(this + 0x233c) = uVar9;
if ((((uVar11 != 0xffffffff) &&
(puVar12 = puVar12 + (uVar11 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar11 >> 0xc)) && (*(int *)(puVar12 + 4) != 0)) {
if (this[0x6c] == (CBasePlayer)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBasePlayer)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x200c) = 0xffffffff;
}
(**(code **)(*(int *)this + 0x570))(this);
if (this[0x2f9] == (CBasePlayer)0x0) {
if (this[0x6c] == (CBasePlayer)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBasePlayer)((byte)this[0x70] | 1);
}
this[0x2f9] = (CBasePlayer)0x1;
}
if (this[0x2fa] == (CBasePlayer)0x0) {
if (this[0x6c] == (CBasePlayer)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBasePlayer)((byte)this[0x70] | 1);
}
this[0x2fa] = (CBasePlayer)0x1;
}
iVar6 = (**(code **)(*(int *)this + 0x780))(this);
if (iVar6 != *(int *)(this + 0x1f70)) {
(**(code **)(*(int *)this + 0x78c))(this,this + 0x1f70);
*(int *)(this + 0x1f70) = iVar6;
}
CBaseEntity::SetBlocksLOS((CBaseEntity *)this,false);
iVar6 = *(int *)(this + 0x100);
if (iVar6 != *(int *)(this + 0xfc)) {
(**(code **)(*(int *)this + 0x20c))(this,this + 0xfc);
*(int *)(this + 0xfc) = iVar6;
}
if (((byte)this[0x151] & 1) == 0) {
/* try { // try from 007bf290 to 007bf30b has its CatchHandler @ 007bf519 */
CBaseEntity::ClearFlags((CBaseEntity *)this);
CBaseEntity::AddFlag((CBaseEntity *)this,0x80);
}
else {
CBaseEntity::ClearFlags((CBaseEntity *)this);
CBaseEntity::AddFlag((CBaseEntity *)this,0x180);
}
CBaseEntity::AddFlag((CBaseEntity *)this,0x10000);
fVar1 = *(float *)(gpGlobals + 0xc);
*(undefined4 *)(this + 0x202c) = 2;
*(float *)(this + 0x1f74) = fVar1 + 12.0;
CBaseEntity::SetEffects((CBaseEntity *)this,*(uint *)(this + 0xd4) & 0x10 | 8);
InitFogController(this);
InitPostProcessController(this);
*(undefined4 *)(this + 0x1d4c) = 0;
*(undefined4 *)(this + 0x1d50) = 0;
*(undefined4 *)(this + 0x1d58) = 0xffffffff;
*(undefined4 *)(this + 0x1d54) = 0;
*(undefined4 *)(this + 0x1d20) = 0;
*(undefined4 *)(this + 0x1d90) = *(undefined4 *)(this + 0x1d8c);
SetFOV(this,(CBaseEntity *)this,0,0.0,0);
*(undefined4 *)(this + 0x1f64) = 0;
iVar6 = gpGlobals;
*(undefined4 *)(this + 0x1f68) = 0;
uVar9 = vec3_origin;
fVar1 = *(float *)(iVar6 + 0xc);
*(undefined4 *)(this + 0x17e8) = 0x3f441893;
uVar15 = DAT_01053d4c;
*(undefined4 *)(this + 0x1cfc) = uVar9;
uVar4 = DAT_01053d50;
*(undefined4 *)(this + 0x1d08) = uVar9;
*(float *)(this + 0x1f3c) = fVar1 + 2.0;
*(undefined4 *)(this + 0x1d00) = uVar15;
*(undefined4 *)(this + 0x1d04) = uVar4;
*(undefined4 *)(this + 0x1d0c) = uVar15;
*(undefined4 *)(this + 0x1d10) = uVar4;
if (this[0x1f45] == (CBasePlayer)0x0) {
(**(code **)(*g_pGameRules + 0x1c0))(g_pGameRules,this);
}
(**(code **)(*g_pGameRules + 0x120))(g_pGameRules,this);
CBaseEntity::RemoveFlag((CBaseEntity *)this,2);
if (this[0x1a90] != (CBasePlayer)0x0) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a90);
this[0x1a90] = (CBasePlayer)0x0;
}
if (this[0x1a91] != (CBasePlayer)0x0) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a91);
this[0x1a91] = (CBasePlayer)0x0;
}
pcVar3 = *(code **)(*(int *)this + 0x254);
uVar9 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
(*pcVar3)(this,uVar9);
if (this[0x1a92] != (CBasePlayer)0x0) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a92);
this[0x1a92] = (CBasePlayer)0x0;
}
if (*(int *)(this + 0x1a94) != 0) {
/* try { // try from 007bf351 to 007bf383 has its CatchHandler @ 007bf519 */
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a94);
*(undefined4 *)(this + 0x1a94) = 0;
}
if (*(int *)(this + 0x1a98) != 0) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a98);
*(undefined4 *)(this + 0x1a98) = 0;
}
*(undefined4 *)(this + 0x1cc4) = 0;
iVar6 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
iVar10 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
pCVar14 = this;
UTIL_SetSize((CBaseEntity *)this,(Vector *)(iVar10 + 0xc),(Vector *)(iVar6 + 0x18));
if (this[0x2034] != (CBasePlayer)0x0) {
this[0x2034] = (CBasePlayer)0x0;
}
local_4c = (void *)0x0;
local_48 = 0;
if (___atan2f_finite == (CBasePlayer *)0x0) {
local_34 = (CBasePlayer *)0x0;
}
else {
pCVar14 = ___atan2f_finite;
(**(code **)(___atan2f_finite + 0x50))
(___atan2f_finite,&local_4c,0,0,0,0,"/data/src/game/server/player.cpp",0x143c,
&Spawn()::tm_fmt,"(%s)%s","Unaccounted","precache");
local_34 = ___atan2f_finite;
}
iVar6 = _DAT_0105db00;
local_3c = local_4c;
local_38 = local_48;
if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
/* try { // try from 007bf136 to 007bf184 has its CatchHandler @ 007bf515 */
iVar10 = ThreadGetCurrentId();
if (iVar6 == iVar10) {
if (*(char **)_DAT_0105d15c != "precache") {
_DAT_0105d15c =
(CBasePlayer *)
CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcb8b31,(char *)0x1,0xbfafa1);
}
pCVar14 = _DAT_0105d15c;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
}
/* try { // try from 007beab4 to 007beac4 has its CatchHandler @ 007bf4f2 */
cVar5 = CBaseEntity::IsPrecacheAllowed();
if (cVar5 != '\0') {
pCVar14 = this;
(**(code **)(*(int *)this + 0x6c))(this);
}
iVar6 = _DAT_0105db00;
if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
iVar10 = ThreadGetCurrentId(pCVar14);
if (iVar6 == iVar10) {
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0105d15c = *(CBasePlayer **)(_DAT_0105d15c + 100);
}
DAT_0105d158 = _DAT_0105d15c == (CBasePlayer *)0x105d160;
}
}
if (local_34 != (CBasePlayer *)0x0) {
(**(code **)(local_34 + 0x54))(local_34,local_3c,local_38,0,0,0);
}
bVar13 = gInitHUD != '\0';
*(undefined4 *)(this + 0x1f38) = 0x447a0000;
*(undefined4 *)(this + 8000) = 1000;
*(undefined4 *)(this + 0x1f4c) = 0xffffffff;
*(undefined4 *)(this + 0x1f48) = 5;
if (bVar13) {
this[0x1f44] = (CBasePlayer)0x1;
}
*(undefined4 *)(this + 0x1d54) = 0;
*(undefined4 *)(this + 0x1d58) = 0xffffffff;
/* try { // try from 007beb6c to 007beca3 has its CatchHandler @ 007bf519 */
(**(code **)(*(int *)this + 0x6c8))(this,0);
*(undefined4 *)(this + 0x1d18) = 0xc0;
uVar9 = sv_bonus_challenge._28_4_;
*(undefined4 *)(this + 0x17ec) = 0;
*(undefined4 *)(this + 0x17f0) = 0x42000000;
*(undefined4 *)(this + 0x17f4) = 0;
iVar6 = *(int *)(uVar9 + 0x30);
if (iVar6 != *(int *)(this + 0x1d34)) {
if (this[0x6c] == (CBasePlayer)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar10 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar10 + 2) = 0;
}
}
else {
this[0x70] = (CBasePlayer)((byte)this[0x70] | 1);
}
*(int *)(this + 0x1d34) = iVar6;
}
uVar9 = 0;
ConVar::SetValue(0xfee3e0);
if (*(int *)(this + 0x1dfc) == -1) {
/* try { // try from 007bf3ef to 007bf426 has its CatchHandler @ 007bf519 */
Msg("Couldn\'t alloc player sound slot!\n",uVar9);
}
CBaseEntity::ThinkSet((_func_void *)local_84,(float)this,(char *)0x0);
this[0x1f44] = (CBasePlayer)0x1;
this[0x1f46] = (CBasePlayer)0x0;
*(undefined4 *)(this + 0x1f4c) = 0xffffffff;
if (this[0x6c] == (CBasePlayer)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBasePlayer)((byte)this[0x70] | 1);
}
uVar9 = *(undefined4 *)(gpGlobals + 0xc);
*(undefined4 *)(this + 0x78) = 0;
*(undefined4 *)(this + 0x74) = uVar9;
V_strncpy((char *)(this + 0x2118),"",0x12);
CRecipientFilter::CRecipientFilter((CRecipientFilter *)&local_3c);
local_3c = &PTR__CSingleUserRecipientFilter_00c08ea8;
/* try { // try from 007becb2 to 007becb6 has its CatchHandler @ 007bf526 */
CRecipientFilter::AddRecipient((CRecipientFilter *)&local_3c,this);
/* try { // try from 007becd5 to 007bedec has its CatchHandler @ 007bf522 */
(**(code **)(*enginesound + 0x2c))(enginesound,(CRecipientFilter *)&local_3c,0,0);
(**(code **)(*(int *)this + 0x564))(this,0);
CBaseEntity::SetCollisionGroup((CBaseEntity *)this,5);
if (*(int *)(this + 0x1f7c) != 0) {
*(undefined4 *)(this + 0x1f7c) = 0;
LockPlayerInPlace(this);
}
iVar6 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
if (iVar6 == 1) {
(**(code **)(*(int *)this + 0x638))(this,*(undefined4 *)(this + 0x1d78));
}
else {
(**(code **)(*(int *)this + 0x63c))(this);
}
(**(code **)(*(int *)this + 0x688))(this);
uVar15 = 0x11;
pcVar7 = (char *)0x0;
uVar9 = 0;
local_70 = (color32_s)0x0;
local_6f = 0;
local_6e = 0;
local_6d = 0xff;
UTIL_ScreenFade((CBaseEntity *)this,&local_70,0.0,0.0,0x11);
local_64 = (void *)0x0;
local_60 = 0;
if (___atan2f_finite == (CBasePlayer *)0x0) {
local_44 = (CBasePlayer *)0x0;
}
else {
pcVar7 = (char *)0x0;
uVar15 = 0;
uVar9 = 0;
(**(code **)(___atan2f_finite + 0x50))
(___atan2f_finite,&local_64,0,0,0,0,"/data/src/game/server/player.cpp",0x14a3,
&Spawn()::tm_fmt,"(%s)%s","Unaccounted","PlayerSpawn");
local_44 = ___atan2f_finite;
}
iVar6 = _DAT_0105db00;
local_4c = local_64;
local_48 = local_60;
if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
/* try { // try from 007bf1e6 to 007bf234 has its CatchHandler @ 007bf511 */
iVar10 = ThreadGetCurrentId();
if (iVar6 == iVar10) {
if (*(char **)_DAT_0105d15c != "PlayerSpawn") {
uVar15 = 0;
pcVar7 = "Unaccounted";
uVar9 = 1;
_DAT_0105d15c =
(CBasePlayer *)
CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcd5f1b,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
}
/* try { // try from 007bee2b to 007bee30 has its CatchHandler @ 007bf4ab */
(**(code **)(*g_pGameRules + 0x110))(g_pGameRules,this,uVar9,pcVar7,uVar15);
iVar6 = _DAT_0105db00;
if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
iVar10 = ThreadGetCurrentId();
if (iVar6 == iVar10) {
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0105d15c = *(CBasePlayer **)(_DAT_0105d15c + 100);
}
DAT_0105d158 = _DAT_0105d15c == (CBasePlayer *)0x105d160;
}
}
if (local_44 != (CBasePlayer *)0x0) {
(**(code **)(local_44 + 0x54))(local_44,local_4c,local_48,0,0,0);
}
if (*(float *)(this + 0x20cc) != 1.0) {
if (this[0x6c] == (CBasePlayer)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
/* try { // try from 007bf3aa to 007bf3dc has its CatchHandler @ 007bf522 */
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBasePlayer)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x20cc) = 0x3f800000;
}
uVar15 = DAT_01053d50;
uVar9 = DAT_01053d4c;
*(undefined4 *)(this + 0x1dec) = vec3_origin;
*(undefined4 *)(this + 0x1df0) = uVar9;
*(undefined4 *)(this + 0x1df4) = uVar15;
pcVar3 = *(code **)(*(int *)this + 0x744);
uVar11 = *(uint *)(this + 0x14c);
if ((uVar11 & 0x1000) != 0) {
/* try { // try from 007bf323 to 007bf327 has its CatchHandler @ 007bf522 */
CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
uVar11 = *(uint *)(this + 0x14c);
}
if ((uVar11 & 0x800) != 0) {
/* try { // try from 007beeef to 007befce has its CatchHandler @ 007bf522 */
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
(*pcVar3)(this,this + 0x2e0,this + 0x274);
RumbleEffect(this,'\0','\0','\0');
*(undefined4 *)(this + 0x2104) = 0;
if (*(float *)(this + 0x1e1c) != -1.0) {
(**(code **)(*(int *)(this + 0x1e18) + 4))(this + 0x1e18,this + 0x1e1c);
*(undefined4 *)(this + 0x1e1c) = 0xbf800000;
}
*(undefined4 *)(this + 0x2320) = 0;
*(undefined4 *)(this + 0x2324) = 0;
*(undefined4 *)(this + 9000) = 0x3f800000;
(**(code **)(*(int *)this + 0x538))(this);
CBaseCombatCharacter::Spawn((CBaseCombatCharacter *)this);
(**(code **)(*(int *)this + 0x538))(this);
cVar5 = (**(code **)(*g_pGameRules + 0x88))(g_pGameRules);
if ((cVar5 == '\0') && (g_pScriptVM != (int *)0x0)) {
local_4c = (void *)CBaseEntity::GetScriptInstance((CBaseEntity *)this);
local_44 = (CBasePlayer *)0x20;
/* try { // try from 007bf002 to 007bf004 has its CatchHandler @ 007bf532 */
(**(code **)(*g_pScriptVM + 0x78))(g_pScriptVM,0,"player",&local_4c);
if (((uint)local_44 & 0x10000) != 0) {
free(local_4c);
}
}
local_3c = &PTR__CSingleUserRecipientFilter_00c08ea8;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)&local_3c);
iVar6 = _DAT_0105db00;
if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
iVar10 = ThreadGetCurrentId();
if (iVar6 == iVar10) {
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0105d15c = *(CBasePlayer **)(_DAT_0105d15c + 100);
}
DAT_0105d158 = _DAT_0105d15c == (CBasePlayer *)0x105d160;
}
}
if (local_50 != (CBasePlayer *)0x0) {
(**(code **)(local_50 + 0x54))(local_50,local_58,local_54,0,0,0);
}
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.