Skip to content

Instantly share code, notes, and snippets.

@leoetlino
Created September 26, 2019 19:42
Show Gist options
  • Save leoetlino/f565a3ef85877fb7dcb294244a720e90 to your computer and use it in GitHub Desktop.
Save leoetlino/f565a3ef85877fb7dcb294244a720e90 to your computer and use it in GitHub Desktop.
v2 = Random::sInstance.y;
v3 = Random::sInstance.z;
v4 = Random::sInstance.w;
v5 = Random::sInstance.x ^ (Random::sInstance.x << 0xB) ^ ((Random::sInstance.x ^ (Random::sInstance.x << 0xB)) >> 8) ^ Random::sInstance.w;
v6 = v5 ^ (Random::sInstance.w >> 0x13);
this->field_248->eggMazeRoute &= ~3u;
v7 = v2 ^ (v2 << 0xB) ^ ((v2 ^ (v2 << 0xB)) >> 8) ^ v6;
v8 = v7 ^ (v5 >> 0x13);
mod5 = v8 % 5;
if ( v6 & 1 )
routeDirection1 = 1;
else
routeDirection1 = 3;
this->field_248->eggMazeRoute |= routeDirection1;
Random::sInstance.x = v3;
Random::sInstance.y = v4;
Random::sInstance.z = v6;
Random::sInstance.w = v8;
v11 = mod5 + 2;
twomod5plus2 = 2 * (mod5 + 2);
if ( v6 & 1 )
routeDirection2 = 3;
else
routeDirection2 = 1;
this->field_248->eggMazeRoute &= ~(unsigned __int16)(3 << (twomod5plus2 & ~1));
this->field_248->eggMazeRoute |= routeDirection2 << (twomod5plus2 & ~1);
this->field_248->eggMazeRoute &= ~(0xC << 2 * mod5);
this->field_248->eggMazeRoute |= 8 << 2 * mod5;
if ( (_DWORD)mod5 )
{
v14 = this->field_248;
v15 = v3 ^ (v3 << 0xB) ^ ((v3 ^ (v3 << 0xB)) >> 8) ^ v8;
v16 = v14->eggMazeRoute;
Random::sInstance.x = v4;
Random::sInstance.y = v6;
v17 = v15 ^ (v7 >> 0x13);
Random::sInstance.z = v8;
Random::sInstance.w = v17;
v18 = eggMazeData[6 * (v16 & 3) + v17 % 6];
v14->eggMazeRoute = v16 & ~0xC;
this->field_248->eggMazeRoute |= 4 * v18;
if ( (_DWORD)mod5 == 1 )
{
v21 = v17;
v17 = v8;
v23 = v6;
v6 = v4;
}
else
{
v19 = this->field_248;
v20 = (unsigned __int16)v19->eggMazeRoute;
v21 = v4 ^ (v4 << 0xB) ^ ((v4 ^ (v4 << 0xB)) >> 8) ^ v17 ^ ((v3 ^ (v3 << 0xB) ^ ((v3 ^ (v3 << 0xB)) >> 8) ^ v8) >> 0x13);
Random::sInstance.z = v17;
Random::sInstance.w = v21;
v22 = eggMazeData[6 * ((v20 >> 2) & 3) + v21 % 6];
Random::sInstance.x = v6;
Random::sInstance.y = v8;
v19->eggMazeRoute = v20 & ~0x30;
this->field_248->eggMazeRoute |= 0x10 * v22;
if ( (unsigned int)mod5 >= 3 )
{
v23 = v8;
v79 = 3;
do
{
v80 = this->field_248;
v81 = v6 ^ (v6 << 0xB);
v6 = v23;
v23 = v17;
v17 = v21;
v82 = v81 ^ (v81 >> 8);
v83 = (unsigned __int16)v80->eggMazeRoute;
v84 = 2 * v79;
v21 = v82 ^ v17 ^ (v17 >> 0x13);
v80->eggMazeRoute = v83 & ~(3 << 2 * v79);
v85 = &eggMazeData[6 * ((v83 >> 2 * ((unsigned __int8)v79 - 1)) & 3)];
v79 = (v79 + 1) & 0xFF;
this->field_248->eggMazeRoute |= v85[v21 % 6] << v84;
}
while ( (unsigned int)mod5 >= v79 );
Random::sInstance.x = v6;
Random::sInstance.y = v23;
Random::sInstance.z = v17;
Random::sInstance.w = v21;
}
else
{
v23 = v8;
}
}
}
else
{
v21 = v8;
v17 = v6;
v23 = v4;
v6 = v3;
}
v24 = this->field_248;
v27 = (unsigned __int16)v24->eggMazeRoute;
v26 = &v24->eggMazeRoute;
v25 = v27;
if ( ((v11 + 1) & 0xFFu) > 6 )
{
v34 = v21;
v30 = v17;
v21 = v23;
v17 = v6;
}
else
{
v28 = (unsigned __int8)(v8 % 5 + 3);
v29 = v6 ^ (v6 << 0xB) ^ ((v6 ^ (v6 << 0xB)) >> 8) ^ v21;
v30 = v29 ^ (v21 >> 0x13);
v31 = eggMazeData[6 * ((v25 >> twomod5plus2) & 3) + v30 % 6];
Random::sInstance.x = v23;
Random::sInstance.y = v17;
Random::sInstance.z = v21;
Random::sInstance.w = v29 ^ (v21 >> 0x13);
*v26 = v25 & ~(unsigned __int16)(3 << 2 * v28);
this->field_248->eggMazeRoute |= v31 << 2 * v28;
v32 = this->field_248;
v33 = (unsigned __int16)v32->eggMazeRoute;
v26 = &v32->eggMazeRoute;
v25 = v33;
if ( ((v11 + 2) & 0xFFu) > 6 )
{
v34 = v6 ^ (v6 << 0xB) ^ ((v6 ^ (v6 << 0xB)) >> 8) ^ v21 ^ (v21 >> 0x13);
v30 = v21;
v21 = v17;
v17 = v23;
}
else
{
v34 = v23 ^ (v23 << 0xB) ^ ((v23 ^ (v23 << 0xB)) >> 8) ^ v30 ^ ((v6 ^ (v6 << 0xB) ^ ((v6 ^ (v6 << 0xB)) >> 8) ^ v21) >> 0x13);
Random::sInstance.x = v17;
Random::sInstance.y = v21;
Random::sInstance.z = v30;
Random::sInstance.w = v34;
v35 = v11 + 3;
v36 = eggMazeData[6 * ((v25 >> 2 * (unsigned __int8)v28) & 3) + v34 % 6];
*v26 = v25 & ~(unsigned __int16)(3 << 2 * (v28 + 1));
this->field_248->eggMazeRoute |= v36 << 2 * (v28 + 1);
v37 = this->field_248;
v38 = this->field_248;
v39 = v38->eggMazeRoute;
v26 = &v38->eggMazeRoute;
LOWORD(v25) = v39;
if ( (unsigned __int8)v35 <= 6u )
{
v40 = 2 * v28 + 2;
do
{
v41 = v17 ^ (v17 << 0xB);
v17 = v21;
v21 = v30;
v30 = v34;
v34 ^= v41 ^ (v41 >> 8) ^ (v34 >> 0x13);
v42 = &eggMazeData[6 * (((unsigned __int16)v25 >> (v40 & 0xFE)) & 3)];
v40 += 2;
v43 = v42[v34 % 6];
v37->eggMazeRoute = v25 & ~(3 << v40);
this->field_248->eggMazeRoute |= v43 << v40;
v37 = this->field_248;
v44 = this->field_248;
v45 = v44->eggMazeRoute;
v26 = &v44->eggMazeRoute;
LOWORD(v25) = v45;
++v35;
}
while ( (unsigned __int8)v35 < 7u );
Random::sInstance.x = v17;
Random::sInstance.y = v21;
Random::sInstance.z = v30;
Random::sInstance.w = v34;
}
}
}
*v26 = v25 & 0x3FFF;
this->field_248->eggMazeRoute |= 0x8000u;
Random::sInstance.x = v21;
Random::sInstance.y = v30;
Random::sInstance.z = v34;
Random::sInstance.w = v17 ^ (v17 << 0xB) ^ ((v17 ^ (v17 << 0xB)) >> 8) ^ v34 ^ (v34 >> 0x13);
v46 = &sD4PuzzleSolutions[((unsigned __int8)(v17 ^ ((unsigned __int16)(v17 ^ ((_WORD)v17 << 0xB)) >> 8) ^ v34) ^ (unsigned __int8)(v34 >> 0x13)) & 0xF];
v47 = v46->values[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment