From ad8f018e984ad7571cbc25c81e096c0400edd302 Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Mon, 3 Sep 2018 16:56:07 +0200 Subject: [PATCH] SetPlayerGPtrs is now binary exact! --- Source/player.cpp | 11 +++++------ Source/player.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/player.cpp b/Source/player.cpp index 45f380230..5fd6ef35a 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -111,12 +111,11 @@ struct player_cpp_init // 47F204: using guessed type int player_inf; // 68643C: using guessed type int player_cpp_init_value; -void __fastcall SetPlayerGPtrs(char *pData, char *pAnim) +void __fastcall SetPlayerGPtrs(BYTE *pData, BYTE **pAnim) { - int delta = pData - pAnim; - for (int i = 8; i; i--) { - *(DWORD *)pAnim = (DWORD)&pData[*(DWORD *)&pAnim[delta]]; - pAnim += 4; + for ( int i = 0; i < 8; i++ ) + { + pAnim[i] = pData + ((DWORD *)pData)[i]; } } @@ -227,7 +226,7 @@ LABEL_27: LABEL_37: sprintf(arglist, "PlrGFX\\%s\\%s\\%s%s.CL2", v17, v15, v15, v19); LoadFileWithMem(arglist, v6); - SetPlayerGPtrs((char *)v6, v7); + SetPlayerGPtrs((BYTE *)v6, (BYTE **)v7); v3->_pGFXLoad |= v18; v5 = leveltype; goto LABEL_38; diff --git a/Source/player.h b/Source/player.h index 1be5d917f..5f9aeffa3 100644 --- a/Source/player.h +++ b/Source/player.h @@ -20,7 +20,7 @@ extern int deathdelay; // weak extern int plr_dframe_size; // idb void __cdecl player_cpp_init(); -void __fastcall SetPlayerGPtrs(char *pData, char *pAnim); /* unsigned char *+** */ +void __fastcall SetPlayerGPtrs(BYTE *pData, BYTE **pAnim); /* unsigned char *+** */ void __fastcall LoadPlrGFX(int pnum, int gfxflag); void __fastcall InitPlayerGFX(int pnum); void __fastcall InitPlrGFXMem(int pnum);