Skip to content

Instantly share code, notes, and snippets.

@BalintCsala
Created July 27, 2020 00:02
Show Gist options
  • Save BalintCsala/11c03b359164a920281a4ccf4abae76d to your computer and use it in GitHub Desktop.
Save BalintCsala/11c03b359164a920281a4ccf4abae76d to your computer and use it in GitHub Desktop.
/* WARNING: Could not reconcile some variable overlaps */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* public: virtual bool __cdecl CactusFeature::place(class BlockSource & __ptr64,class BlockPos
const & __ptr64,class Random & __ptr64)const __ptr64 */
bool __thiscall place(CactusFeature *this,BlockSource *param_1,BlockPos *param_2,Random *param_3)
{
longlong *plVar1;
char cVar2;
uint uVar3;
uint uVar4;
uint uVar5;
uint uVar6;
uint uVar7;
uint uVar8;
LevelChunk *pLVar9;
Block *pBVar10;
Random *this_00;
int iVar11;
int iVar12;
int iVar13;
int iVar14;
ulonglong uVar15;
longlong lVar16;
uint local_68;
int local_60;
int local_5c;
undefined local_58 [16];
int local_48;
int local_44;
int local_40;
int local_3c;
int local_38;
int local_34;
lVar16 = 10;
do {
this_00 = param_3;
uVar3 = _genRandInt32((Random *)param_3);
uVar4 = _genRandInt32((Random *)this_00);
uVar5 = _genRandInt32((Random *)this_00);
uVar6 = _genRandInt32((Random *)this_00);
uVar6 = uVar6 & 3;
uVar7 = _genRandInt32((Random *)this_00);
uVar7 = uVar7 & 7;
uVar8 = _genRandInt32((Random *)this_00);
iVar14 = ((uVar3 & 7) - (uVar4 & 7)) + *(int *)(param_2 + 8);
iVar13 = (*(int *)param_2 - (uVar8 & 7)) + uVar7;
iVar12 = (uVar5 & 3) + (*(int *)(param_2 + 4) - uVar6);
pBVar10 = mAir;
if ((-1 < iVar12) && (iVar12 < *(short *)(param_1 + 0x28))) {
local_60 = iVar13 >> 4;
local_5c = iVar14 >> 4;
pLVar9 = getChunk(param_1,(ChunkPos *)&local_60);
pBVar10 = mAir;
if (pLVar9 != (LevelChunk *)0x0) {
uVar15 = SEXT28((short)((short)iVar12 >> 4));
if ((uVar15 < *(ulonglong *)(pLVar9 + 0x428)) &&
(pLVar9 + uVar15 * 0x38 + 0xa8 != (LevelChunk *)0x0)) {
plVar1 = *(longlong **)(pLVar9 + uVar15 * 0x38 + 0xa8 + 0x20);
local_68._0_3_ = CONCAT12((char)iVar14,CONCAT11((char)iVar12,(char)iVar13)) & 0xf0f0f;
local_68 = (uint)(uint3)local_68;
pBVar10 = (Block *)(**(code **)(*plVar1 + 0x10))
(plVar1,(ulonglong)
(ushort)((((ushort)(uint3)local_68 & 0xff) * 0x10 +
(ushort)(byte)((uint3)local_68 >> 0x10)) *
0x10 + ((ushort)(local_68 >> 8) & 0xff)));
}
}
}
if (**(longlong **)(pBVar10 + 0x10) == *_mAir) {
uVar3 = _genRandInt32((Random *)param_3);
uVar3 = uVar3 % 3 + 1;
uVar15 = (ulonglong)uVar3;
if (uVar3 == 0) {
iVar11 = 0;
}
else {
uVar3 = _genRandInt32((Random *)param_3);
iVar11 = (int)((ulonglong)uVar3 % (uVar15 & 0xffffffff));
}
if (0 < (int)(iVar11 + 1U)) {
uVar15 = (ulonglong)(iVar11 + 1U);
do {
local_3c = iVar13;
local_38 = iVar12;
local_34 = iVar14;
cVar2 = (**(code **)(***(longlong ***)(mCactus + 0x10) + 0x350))
(**(longlong ***)(mCactus + 0x10),param_1);
if (cVar2 != '\0') {
local_48 = iVar13;
local_44 = iVar12;
local_40 = iVar14;
if (*(WorldChangeTransaction **)(this + 0x10) == (WorldChangeTransaction *)0x0) {
local_58 = ZEXT816(0);
setBlock(param_1,(BlockPos *)&local_48,mCactus,3,(shared_ptr<class_BlockActor>)0xa8,
(ActorBlockSyncMessage *)0x0);
}
else {
setBlock(*(WorldChangeTransaction **)(this + 0x10),(BlockPos *)&local_48,
(Block *)mCactus,3);
}
}
iVar12 = iVar12 + 1;
uVar15 = uVar15 - 1;
} while (uVar15 != 0);
}
}
lVar16 = lVar16 + -1;
} while (lVar16 != 0);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment