Skip to content

Instantly share code, notes, and snippets.

@MrSapps
Created April 14, 2018 18:46
Show Gist options
  • Save MrSapps/8350ed201f5db885fd33c80e7e0b6c6b to your computer and use it in GitHub Desktop.
Save MrSapps/8350ed201f5db885fd33c80e7e0b6c6b to your computer and use it in GitHub Desktop.
_WORD *__cdecl LibGV_40466A(Prim_unknown_0x54 *pObj, _WORD *pPrims, int count)
{
_DWORD *primOffPtr; // [esp+8h] [ebp-18h]
int vF3; // [esp+Ch] [ebp-14h]
BYTE *pScratch; // [esp+10h] [ebp-10h]
int vertCount; // [esp+14h] [ebp-Ch]
int vF4; // [esp+18h] [ebp-8h]
int sizeBytes; // [esp+1Ch] [ebp-4h]
sizeBytes = pObj->field_30_primF1_size;
vertCount = pObj->field_32_primF2_vert_count;
vF3 = pObj->field_34_primF3;
vF4 = pObj->field_36_primF4;
pScratch = (BYTE *)&gScratchPadMemory_991E40;
while ( --count >= 0 )
{
*pPrims = *((_DWORD *)pScratch + 1);
primOffPtr = (_DWORD *)((char *)pPrims + vF3);
if ( vertCount != 1 )
{
if ( vertCount != 2 )
{
if ( vertCount != 3 )
{
if ( vertCount != 4 )
{
goto next_prim;
}
*primOffPtr = *(_DWORD *)pScratch;
primOffPtr = (_DWORD *)((char *)primOffPtr + vF4);
pScratch += 8;
}
*primOffPtr = *(_DWORD *)pScratch;
primOffPtr = (_DWORD *)((char *)primOffPtr + vF4);
pScratch += 8;
}
*primOffPtr = *(_DWORD *)pScratch;
primOffPtr = (_DWORD *)((char *)primOffPtr + vF4);
pScratch += 8;
}
*primOffPtr = *(_DWORD *)pScratch;
pScratch += 8;
next_prim:
pPrims = (_WORD *)((char *)pPrims + sizeBytes);
}
return pPrims;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment