Skip to content

Instantly share code, notes, and snippets.

@leoetlino
Created October 27, 2020 20:23
Show Gist options
  • Save leoetlino/138171c942f2c42d393b255ad317eab0 to your computer and use it in GitHub Desktop.
Save leoetlino/138171c942f2c42d393b255ad317eab0 to your computer and use it in GitHub Desktop.
bool __cdecl ActorSystem::needToFreezeScene(ActorSystem *this)
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
v1 = BaseProcMgr::sInstance->procInitializer->mTaskQueue;
ksys::util::TaskQueueLock::TaskQueueLock(&lock);
v2 = ksys::util::TaskQueueBase::activeTasksBegin(v1, &lock);
_.playerAcc.acquired = 0;
_.playerAcc.actor = 0LL;
v27 = 0;
v3 = (BaseProcEvent *)v2;
playerLink = ActorSystem::sInstance->playerLink;
if ( !playerLink )
{
ksys::act::ActorLinkConstDataAccess::acquire(&_.playerAcc, 0LL);
if ( !_.playerAcc.actor )
goto LABEL_6;
goto LABEL_5;
}
playerLink->vtable->getActorViaAccessor(playerLink, &_.playerAcc);
if ( _.playerAcc.actor )
{
LABEL_5:
v7 = act::acc::getActorMtx(&_.playerAcc);
playerPos.x = v7->pos_x;
playerPos.y = v7->pos_y;
playerPos.z = v7->pos_z;
}
LABEL_6:
ksys::act::ActorLinkConstDataAccess::~ActorLinkConstDataAccess(&_.playerAcc);
actorCreateInitializer = BaseProcMgr::sInstance->procInitializer;
v9 = actorCreateInitializer->field_8;
if ( v9 < 1 )
{
v12 = 0;
}
else
{
v10 = 0LL;
v11 = 0LL;
v12 = 0;
do
{
if ( (unsigned int)v9 <= (unsigned __int64)v11 )
v13 = actorCreateInitializer->e0;
else
v13 = (BaseProcInitializer::E0_ *)((char *)actorCreateInitializer->e0 + v10);
v14 = v13->thread;
if ( v14 )
{
v15 = needToFreezeSceneForActorCreate((BaseProcEvent *)v14->task, &playerPos);
v9 = actorCreateInitializer->field_8;
if ( v15 )
v12 = 1;
}
++v11;
v10 += 0x48LL;
}
while ( v11 < v9 );
}
ret = v12;
if ( v3 != ksys::util::TaskQueueBase::activeTasksEnd(v1) )
{
v17 = v5;
v18 = -v5;
do
{
ret |= needToFreezeSceneForActorCreate(v3, &playerPos);
v3 = (BaseProcEvent *)(*(_QWORD *)(&v3->_.b.entryId + v17) + v18);
}
while ( v3 != ksys::util::TaskQueueBase::activeTasksEnd(v1) );
}
v19 = PlacementMgr::sInstance;
if ( PlacementMgr::sInstance )
{
_.vec3.x = playerPos.x + -200.0;
_.vec3.y = playerPos.y + 0.0;
_.vec3.z = playerPos.z + -200.0;
if ( !PlacementMgr::isStaticCompoundReady(PlacementMgr::sInstance, (Vec3 *)&_, 1) )
goto returnOne;
a2.x = playerPos.x + 200.0;
a2.y = playerPos.y + 0.0;
a2.z = playerPos.z + -200.0;
if ( !PlacementMgr::isStaticCompoundReady(v19, &a2, 1)
|| (pos.x = playerPos.x + -200.0,
pos.y = playerPos.y + 0.0,
pos.z = playerPos.z + 200.0,
!PlacementMgr::isStaticCompoundReady(v19, &pos, 1))
|| (v21.x = playerPos.x + 200.0,
v21.y = playerPos.y + 0.0,
v21.z = playerPos.z + 200.0,
!PlacementMgr::isStaticCompoundReady(v19, &v21, 1)) )
{
returnOne:
LOBYTE(ret) = 1;
}
}
ksys::util::TaskQueueLock::~TaskQueueLock(&lock);
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment