From 5ed2336e908b63544e79dd37b2a6792b6bd717be Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Wed, 22 Aug 2018 23:15:16 -0500 Subject: [PATCH] Fix types of animation data (#176) --- Source/dead.cpp | 6 ++-- Source/engine.cpp | 6 ++-- Source/engine.h | 2 +- Source/items.cpp | 6 ++-- Source/items.h | 2 +- Source/missiles.cpp | 12 +++---- Source/monster.cpp | 88 ++++++++++++++++++++++----------------------- Source/msg.cpp | 2 +- Source/multi.cpp | 2 +- Source/objects.cpp | 6 ++-- Source/objects.h | 2 +- Source/player.cpp | 28 +++++++-------- Source/player.h | 2 +- Source/scrollrt.cpp | 20 +++++------ Source/scrollrt.h | 4 +-- Source/towners.cpp | 40 ++++++++++----------- Source/towners.h | 2 +- structs.h | 62 ++++++++++++++++---------------- 18 files changed, 146 insertions(+), 146 deletions(-) diff --git a/Source/dead.cpp b/Source/dead.cpp index 28471d299..791073d9e 100644 --- a/Source/dead.cpp +++ b/Source/dead.cpp @@ -56,10 +56,10 @@ void __cdecl InitDead() } v16 = 0; v4 = v0; - memset32(&dead[v0], misfiledata[16].mAnimData[0], 8u); + memset32(&dead[v0], (unsigned int)misfiledata[16].mAnimData[0], 8u); _LOBYTE(dead[v4]._deadtrans) = 0; dead[v4]._deadFrame = 8; - v5 = misfiledata[18].mAnimData[0]; + v5 = (unsigned int)misfiledata[18].mAnimData[0]; dead[v4].field_24 = 128; dead[v4].field_28 = 32; v6 = v0 + 1; @@ -83,7 +83,7 @@ void __cdecl InitDead() v10 = monster[v9].MType; v11 = (char *)(v8 - 8); v15 = (int *)8; - v14 = v10->Anims[4].Frames; + v14 = (int *)v10->Anims[4].Frames; do { v12 = v14; diff --git a/Source/engine.cpp b/Source/engine.cpp index ce9ba6560..567d4f7ea 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -1876,15 +1876,15 @@ void __cdecl mem_free_mutex() DeleteCriticalSection(&sgMemCrit); } -void *__fastcall DiabloAllocPtr(int dwBytes) +unsigned char *__fastcall DiabloAllocPtr(int dwBytes) { int v1; // ebx - void *v2; // ebx + unsigned char *v2; // ebx int v3; // eax v1 = dwBytes; EnterCriticalSection(&sgMemCrit); - v2 = SMemAlloc(v1, "C:\\Src\\Diablo\\Source\\ENGINE.CPP", 2236, 0); + v2 = (unsigned char *)SMemAlloc(v1, "C:\\Src\\Diablo\\Source\\ENGINE.CPP", 2236, 0); LeaveCriticalSection(&sgMemCrit); if ( !v2 ) { diff --git a/Source/engine.h b/Source/engine.h index e4383f1ac..7e91f9281 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -50,7 +50,7 @@ void __cdecl engine_cpp_init_2(); void __cdecl mem_init_mutex(); void __cdecl mem_atexit_mutex(); void __cdecl mem_free_mutex(); -void *__fastcall DiabloAllocPtr(int dwBytes); +unsigned char *__fastcall DiabloAllocPtr(int dwBytes); void __fastcall mem_free_dbg(void *p); unsigned char *__fastcall LoadFileInMem(char *pszName, int *pdwFileLen); void __fastcall LoadFileWithMem(char *pszName, void *buf); diff --git a/Source/items.cpp b/Source/items.cpp index b42e23624..47656db98 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -10,7 +10,7 @@ ItemGetRecordStruct itemrecord[MAXITEMS]; ItemStruct item[MAXITEMS+1]; char itemhold[3][3]; char byte_641234[28]; /* check if part of above */ -int Item2Frm[35]; +unsigned char *Item2Frm[35]; int UniqueItemFlag[128]; int numitems; int gnNumGetRecords; @@ -644,7 +644,7 @@ void __cdecl InitItemGFX() do { sprintf(arglist, "Items\\%s.CEL", ItemDropStrs[v0]); - Item2Frm[v0] = (int)LoadFileInMem(arglist, 0); + Item2Frm[v0] = LoadFileInMem(arglist, 0); ++v0; } while ( v0 < 35 ); @@ -786,7 +786,7 @@ void __fastcall CalcPlrItemVals(int p, bool Loadgfx) int v28; // eax int v29; // ebx int v30; // ecx - int v31; // eax + unsigned char *v31; // eax int v32; // eax int v33; // ecx int i; // edx diff --git a/Source/items.h b/Source/items.h index ea474433a..5ff47d9ea 100644 --- a/Source/items.h +++ b/Source/items.h @@ -10,7 +10,7 @@ extern ItemGetRecordStruct itemrecord[MAXITEMS]; extern ItemStruct item[MAXITEMS+1]; extern char itemhold[3][3]; extern char byte_641234[28]; /* check if part of above */ -extern int Item2Frm[35]; +extern unsigned char *Item2Frm[35]; extern int UniqueItemFlag[128]; extern int numitems; extern int gnNumGetRecords; diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 6e61ea863..a19d23d41 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -2089,7 +2089,7 @@ void __fastcall SetMissAnim(int mi, int animtype) int v7; // esi int v8; // eax int v9; // eax - int v10; // edi + unsigned char *v10; // edi int v11; // eax v2 = mi; @@ -2140,7 +2140,7 @@ void __fastcall LoadMissileGFX(int mi) v3 = 0; if ( v1->mAnimFAmt ) { - v4 = v1->mAnimData; + v4 = (int *)v1->mAnimData; do { v5 = (int)&v2[*(_DWORD *)&v2[4 * v3++]]; @@ -2157,7 +2157,7 @@ void __fastcall LoadMissileGFX(int mi) { sprintf(arglist, "Missiles\\%s.CL2", v1->mName); if ( !v1->mAnimData[0] ) - v1->mAnimData[0] = (int)LoadFileInMem(arglist, 0); + v1->mAnimData[0] = LoadFileInMem(arglist, 0); } else { @@ -2203,7 +2203,7 @@ void __cdecl InitMissileGFX() void __fastcall FreeMissileGFX(int mi) { int v1; // esi - int v2; // ecx + unsigned char *v2; // ecx signed int v3; // ebx void **v4; // edi void *v5; // ecx @@ -2214,7 +2214,7 @@ void __fastcall FreeMissileGFX(int mi) v2 = misfiledata[v1].mAnimData[0]; if ( v2 ) { - mem_free_dbg((void *)(v2 - 4 * misfiledata[v1].mAnimFAmt)); + mem_free_dbg(&v2[-4 * misfiledata[v1].mAnimFAmt]); misfiledata[v1].mAnimData[0] = 0; } } @@ -6454,7 +6454,7 @@ void __fastcall mi_null_32(int i) //int v12; // eax int v13; // ecx int v14; // ecx - int v15; // eax + unsigned char *v15; // eax int v16; // [esp+Ch] [ebp-14h] int arglist; // [esp+10h] [ebp-10h] int x; // [esp+14h] [ebp-Ch] diff --git a/Source/monster.cpp b/Source/monster.cpp index ec4495458..888330ba4 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -643,9 +643,9 @@ void __fastcall InitMonsterGFX(int monst) v2 = (unsigned char)Monsters[monst].mtype; v31 = v2; v3 = v2 << 7; - v4 = Monsters[monst].Anims[0].Frames; + v4 = (int *)Monsters[monst].Anims[0].Frames; v5 = (int *)((char *)monsterdata[0].Frames + v3); - v30 = Monsters[monst].Anims[0].Frames; + v30 = (int *)Monsters[monst].Anims[0].Frames; v28 = (int *)((char *)monsterdata[0].Frames + v3); do { @@ -797,7 +797,7 @@ void __fastcall InitMonster(int i, int rd, int mtype, int x, int y) MonsterData *v19; // eax short v20; // cx int v21; // edx - int v22; // edx + unsigned char *v22; // edx int v24; // ecx int v25; // ecx char v26; // dl @@ -821,7 +821,7 @@ void __fastcall InitMonster(int i, int rd, int mtype, int x, int y) monster[v6].mName = v9; monster[v6].MType = monst; monster[v6].MData = v8; - monster[v6]._mAFNum = monst->Anims[0].Frames[rd]; + monster[v6]._mAnimData = monst->Anims[0].Frames[rd]; v10 = monst->Anims[0].Delay; monster[v6]._mAnimDelay = v10; monster[v6]._mAnimCnt = random(88, v10 - 1); @@ -878,7 +878,7 @@ void __fastcall InitMonster(int i, int rd, int mtype, int x, int y) { v22 = monst->Anims[5].Frames[v5]; monster[v6]._mFlags |= 4u; - monster[v6]._mAFNum = v22; + monster[v6]._mAnimData = v22; monster[v6]._mAnimFrame = 1; monster[v6]._mmode = MM_SATTACK; } @@ -943,7 +943,7 @@ void __cdecl ClrAllMonsters() monster[i]._mdir = random(89, 8); monster[i]._mxvel = 0; monster[i]._myvel = 0; - monster[i]._mAFNum = 0; + monster[i]._mAnimData = 0; monster[i]._mAnimDelay = 0; monster[i]._mAnimCnt = 0; monster[i]._mAnimLen = 0; @@ -1017,8 +1017,8 @@ void __fastcall PlaceUniqueMonst(int uniqindex, int miniontype, int unpackfilesi char v35; // al short v36; // cx char v37; // al - int v38; // ecx - int v39; // eax + CMonster *v38; // ecx + unsigned char *v39; // eax int v40; // edx int v41; // eax char filestr[64]; // [esp+4h] [ebp-60h] @@ -1288,10 +1288,10 @@ LABEL_83: PlaceGroup(v43, unpackfilesize, v36, nummonsters - 1); if ( v3->_mAi != AI_GARG ) { - v38 = (int)v3->MType; - v39 = *(_DWORD *)(v38 + 4 * v3->_mdir + 8); + v38 = v3->MType; + v39 = v38->Anims[0].Frames[v3->_mdir]; v40 = v3->_mAnimLen - 1; - v3->_mAFNum = v39; + v3->_mAnimData = v39; v41 = random(88, v40); v3->_mFlags &= 0xFFFFFFFB; v3->_mmode = 0; @@ -1406,7 +1406,7 @@ void __fastcall PlaceGroup(int mtype, int num, unsigned char leaderf, int leader int *v19; // edx int v20; // ecx int v21; // ebx - int v22; // ecx + unsigned char *v22; // ecx int mtypea; // [esp+Ch] [ebp-24h] signed int v25; // [esp+14h] [ebp-1Ch] int v26; // [esp+18h] [ebp-18h] @@ -1494,7 +1494,7 @@ void __fastcall PlaceGroup(int mtype, int num, unsigned char leaderf, int leader { v21 = nummonsters; v22 = monster[v18].MType->Anims[0].Frames[monster[v18]._mdir]; - monster[v18]._mAFNum = v22; + monster[v18]._mAnimData = v22; monster[v21]._mAnimFrame = random(88, monster[v21]._mAnimLen - 1) + 1; monster[v21]._mFlags &= 0xFFFFFFFB; monster[v21]._mmode = MM_STAND; @@ -1875,7 +1875,7 @@ void __fastcall NewMonsterAnim(int i, AnimStruct *anim, int md) int v5; // edx v3 = &monster[i]; - v3->_mAFNum = anim->Frames[md]; + v3->_mAnimData = anim->Frames[md]; v4 = anim->Rate; v3->_mAnimCnt = 0; v3->_mAnimLen = v4; @@ -2990,7 +2990,7 @@ void __fastcall M_StartHeal(int i) int v1; // edi int v2; // esi CMonster *v3; // eax - int v4; // ecx + unsigned char *v4; // ecx int v5; // eax v1 = i; @@ -3001,7 +3001,7 @@ void __fastcall M_StartHeal(int i) TermMsg("M_StartHeal: Monster %d \"%s\" MType NULL", v1, monster[v2].mName); v3 = monster[v2].MType; v4 = v3->Anims[5].Frames[monster[v2]._mdir]; - monster[v2]._mAFNum = v4; + monster[v2]._mAnimData = v4; v5 = v3->Anims[5].Rate; monster[v2]._mFlags |= 2u; monster[v2]._mAnimFrame = v5; @@ -3058,7 +3058,7 @@ int __fastcall M_DoStand(int i) int v2; // esi CMonster *v3; // eax int v4; // ecx - int v5; // eax + unsigned char *v5; // eax v1 = i; if ( (unsigned int)i >= MAXMONSTERS ) @@ -3072,7 +3072,7 @@ int __fastcall M_DoStand(int i) v5 = v3->Anims[1].Frames[v4]; else v5 = v3->Anims[0].Frames[v4]; - monster[v2]._mAFNum = v5; + monster[v2]._mAnimData = v5; if ( monster[v2]._mAnimFrame == monster[v2]._mAnimLen ) M_Enemy(v1); ++monster[v2]._mVar2; @@ -4225,7 +4225,7 @@ int __fastcall M_DoDelay(int i) TermMsg("M_DoDelay: Monster %d \"%s\" MType NULL", v1, monster[v2].mName); v3 = M_GetDir(v1); v4 = monster[v2]._mAi == AI_LAZURUS; - monster[v2]._mAFNum = monster[v2].MType->Anims[0].Frames[v3]; + monster[v2]._mAnimData = monster[v2].MType->Anims[0].Frames[v3]; if ( v4 ) { v5 = monster[v2]._mVar2; @@ -4741,7 +4741,7 @@ void __fastcall MAI_Zombie(int i) M_StartAttack(arglist); } if ( v3->_mmode == MM_STAND ) - v3->_mAFNum = v3->MType->Anims[0].Frames[v3->_mdir]; + v3->_mAnimData = v3->MType->Anims[0].Frames[v3->_mdir]; } } } @@ -4813,7 +4813,7 @@ LABEL_10: } LABEL_16: if ( v2->_mmode == MM_STAND ) - v2->_mAFNum = v2->MType->Anims[0].Frames[v7]; + v2->_mAnimData = v2->MType->Anims[0].Frames[v7]; } } @@ -4943,7 +4943,7 @@ void __fastcall MAI_Snake(int i) M_StartAttack(arglist); LABEL_49: if ( esi3->_mmode == MM_STAND ) - esi3->_mAFNum = esi3->MType->Anims[0].Frames[esi3->_mdir]; + esi3->_mAnimData = esi3->MType->Anims[0].Frames[esi3->_mdir]; return; } v17 = 10 - (unsigned char)esi3->_mint + random(105, 10); @@ -5163,7 +5163,7 @@ void __fastcall MAI_Bat(int i) } } if ( esi3->_mmode == MM_STAND ) - esi3->_mAFNum = esi3->MType->Anims[0].Frames[midir]; + esi3->_mAnimData = esi3->MType->Anims[0].Frames[midir]; } } } @@ -5234,7 +5234,7 @@ void __fastcall MAI_SkelBow(int i) } } if ( v2->_mmode == MM_STAND ) - v2->_mAFNum = v2->MType->Anims[0].Frames[v17]; + v2->_mAnimData = v2->MType->Anims[0].Frames[v17]; } } @@ -5288,7 +5288,7 @@ void __fastcall MAI_Fat(int i) } } if ( v2->_mmode == MM_STAND ) - v2->_mAFNum = v2->MType->Anims[0].Frames[md]; + v2->_mAnimData = v2->MType->Anims[0].Frames[md]; } } @@ -5385,7 +5385,7 @@ void __fastcall MAI_Sneak(int i) if ( v2->_mmode == MM_STAND ) { if ( abs(v17) >= 2 || abs(v4) >= 2 || v15 >= 4 * (unsigned char)v2->_mint + 10 ) - v2->_mAFNum = v2->MType->Anims[0].Frames[md]; + v2->_mAnimData = v2->MType->Anims[0].Frames[md]; else M_StartAttack(arglist); } @@ -5646,7 +5646,7 @@ void __fastcall MAI_Cleaver(int i) else M_StartAttack(arglist); if ( v2->_mmode == MM_STAND ) - v2->_mAFNum = v2->MType->Anims[0].Frames[v7]; + v2->_mAnimData = v2->MType->Anims[0].Frames[v7]; } } @@ -5770,7 +5770,7 @@ LABEL_26: } } if ( v3->_mmode == MM_STAND ) - v3->_mAFNum = v3->MType->Anims[0].Frames[md]; + v3->_mAnimData = v3->MType->Anims[0].Frames[md]; } } @@ -5847,7 +5847,7 @@ void __fastcall MAI_Ranged(int i, int missile_type, unsigned char special) } else { - monster[v4]._mAFNum = monster[v4].MType->Anims[0].Frames[v20]; + monster[v4]._mAnimData = monster[v4].MType->Anims[0].Frames[v20]; } } } @@ -6694,7 +6694,7 @@ LABEL_26: } } if ( v2->_mmode == MM_STAND ) - v2->_mAFNum = v2->MType->Anims[0].Frames[md]; + v2->_mAnimData = v2->MType->Anims[0].Frames[md]; } } // 679660: using guessed type char gbMaxPlayers; @@ -6848,7 +6848,7 @@ LABEL_23: } } if ( esi3->_mmode == MM_STAND ) - esi3->_mAFNum = esi3->MType->Anims[0].Frames[esi3->_mdir]; + esi3->_mAnimData = esi3->MType->Anims[0].Frames[esi3->_mdir]; } } @@ -7073,7 +7073,7 @@ void __fastcall MAI_Garbud(int i) MAI_Round(arglist, 1u); monster[v2]._mdir = v8; if ( monster[v2]._mmode == MM_STAND ) - monster[v2]._mAFNum = monster[v2].MType->Anims[0].Frames[v8]; + monster[v2]._mAnimData = monster[v2].MType->Anims[0].Frames[v8]; } } @@ -7131,7 +7131,7 @@ void __fastcall MAI_Zhar(int i) MAI_Counselor(arglist); monster[v2]._mdir = v11; if ( monster[v2]._mmode == MM_STAND ) - monster[v2]._mAFNum = monster[v2].MType->Anims[0].Frames[v11]; + monster[v2]._mAnimData = monster[v2].MType->Anims[0].Frames[v11]; } } @@ -7190,7 +7190,7 @@ void __fastcall MAI_SnotSpil(int i) } monster[v2]._mdir = v5; if ( monster[v2]._mmode == MM_STAND ) - monster[v2]._mAFNum = monster[v2].MType->Anims[0].Frames[v5]; + monster[v2]._mAnimData = monster[v2].MType->Anims[0].Frames[v5]; } } // 5CF330: using guessed type int setpc_h; @@ -7260,7 +7260,7 @@ LABEL_29: monster[v2]._mdir = v5; v8 = monster[v2]._mmode; if ( v8 == MM_STAND || v8 == MM_TALK ) - monster[v2]._mAFNum = monster[v2].MType->Anims[0].Frames[v5]; + monster[v2]._mAnimData = monster[v2].MType->Anims[0].Frames[v5]; } } // 679660: using guessed type char gbMaxPlayers; @@ -7302,7 +7302,7 @@ LABEL_10: MAI_Succ(ia); monster[v2]._mdir = v5; if ( monster[v2]._mmode == MM_STAND ) - monster[v2]._mAFNum = monster[v2].MType->Anims[0].Frames[v5]; + monster[v2]._mAnimData = monster[v2].MType->Anims[0].Frames[v5]; } } // 679660: using guessed type char gbMaxPlayers; @@ -7345,7 +7345,7 @@ void __fastcall MAI_Lachdanan(int i) } monster[v2]._mdir = v6; if ( monster[v2]._mmode == MM_STAND ) - monster[v2]._mAFNum = monster[v2].MType->Anims[0].Frames[v6]; + monster[v2]._mAnimData = monster[v2].MType->Anims[0].Frames[v6]; } } @@ -7387,7 +7387,7 @@ void __fastcall MAI_Warlord(int i) monster[v2]._mdir = v5; v7 = monster[v2]._mmode; if ( v7 == MM_STAND || v7 == MM_TALK ) - monster[v2]._mAFNum = monster[v2].MType->Anims[0].Frames[v5]; + monster[v2]._mAnimData = monster[v2].MType->Anims[0].Frames[v5]; } } @@ -8097,10 +8097,10 @@ void __fastcall SyncMonsterAnim(int i) char *v7; // edx int v8; // esi int v9; // edx - int v10; // ecx - int v11; // edx + unsigned char *v10; // ecx + unsigned char *v11; // edx int v12; // ecx - int v13; // edx + unsigned char *v13; // edx v1 = i; if ( (unsigned int)i >= MAXMONSTERS ) @@ -8149,18 +8149,18 @@ void __fastcall SyncMonsterAnim(int i) case MM_HEAL: v10 = v5->Anims[5].Frames[v9]; LABEL_13: - monster[v2]._mAFNum = v10; + monster[v2]._mAnimData = v10; return; case MM_CHARGE: v11 = v5->Anims[2].Frames[v9]; monster[v2]._mAnimFrame = 1; - monster[v2]._mAFNum = v11; + monster[v2]._mAnimData = v11; v12 = v5->Anims[2].Rate; break; default: v13 = v5->Anims[0].Frames[v9]; monster[v2]._mAnimFrame = 1; - monster[v2]._mAFNum = v13; + monster[v2]._mAnimData = v13; v12 = v5->Anims[0].Rate; break; } diff --git a/Source/msg.cpp b/Source/msg.cpp index 684050e25..3d09b47ed 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -3430,7 +3430,7 @@ int __fastcall On_PLAYER_JOINLEVEL(struct TCmdLocParam1 *pCmd, int pnum) int v4; // esi int v5; // ecx int v6; // ST08_4 - int v7; // edx + unsigned char *v7; // edx int v8; // eax int v9; // ecx int v10; // eax diff --git a/Source/multi.cpp b/Source/multi.cpp index 4df47e09b..94fb25243 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -1091,7 +1091,7 @@ void __fastcall multi_player_joins(int pnum, TCmdPlrInfoHdr *cmd, int a3) bool v7; // zf char *v8; // eax int v9; // ST08_4 - int v10; // edx + unsigned char *v10; // edx int v11; // eax int v12; // ecx int v13; // eax diff --git a/Source/objects.cpp b/Source/objects.cpp index 236fafadd..db637720d 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -4,7 +4,7 @@ int trapid; // weak int trapdir; // weak -int pObjCels[40]; +unsigned char *pObjCels[40]; char ObjFileList[40]; int objectactive[MAXOBJECTS]; int nobjects; // idb @@ -415,7 +415,7 @@ void __cdecl InitObjectGFX() sprintf(filestr, "Objects\\%s.CEL", v8); v9 = LoadFileInMem(filestr, 0); v10 = numobjfiles++; - pObjCels[v10] = (int)v9; + pObjCels[v10] = v9; } ++v7; } @@ -1713,7 +1713,7 @@ void __fastcall SetMapObjects(unsigned char *pMap, int startx, int starty) sprintf(filestr, "Objects\\%s.CEL", v16); v17 = LoadFileInMem(filestr, 0); v18 = numobjfiles++; - pObjCels[v18] = (int)v17; + pObjCels[v18] = v17; } ++v15; } diff --git a/Source/objects.h b/Source/objects.h index c36a30b9c..79464a40e 100644 --- a/Source/objects.h +++ b/Source/objects.h @@ -4,7 +4,7 @@ extern int trapid; // weak extern int trapdir; // weak -extern int pObjCels[40]; +extern unsigned char *pObjCels[40]; extern char ObjFileList[40]; extern int objectactive[MAXOBJECTS]; extern int nobjects; // idb diff --git a/Source/player.cpp b/Source/player.cpp index c06a805f5..03ab072c4 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -315,19 +315,19 @@ void __fastcall InitPlrGFXMem(int pnum) unsigned int v3; // eax char *v4; // ecx int v5; // esi - void *v6; // eax + unsigned char *v6; // eax bool v7; // zf unsigned int v8; // ebx unsigned int v9; // eax char *v10; // ecx - void *v11; // eax - void *v12; // eax - void *v13; // eax - void *v14; // eax - void *v15; // eax - void *v16; // eax - void *v17; // eax - void *v18; // eax + unsigned char *v11; // eax + unsigned char *v12; // eax + unsigned char *v13; // eax + unsigned char *v14; // eax + unsigned char *v15; // eax + unsigned char *v16; // eax + unsigned char *v17; // eax + unsigned char *v18; // eax v1 = pnum; if ( (unsigned int)pnum >= MAX_PLRS ) @@ -514,10 +514,10 @@ void __fastcall FreePlayerGFX(int pnum) plr[v2]._pGFXLoad = 0; } -void __fastcall NewPlrAnim(int pnum, int Peq, int numFrames, int Delay, int width) +void __fastcall NewPlrAnim(int pnum, unsigned char *Peq, int numFrames, int Delay, int width) { int v5; // edi - int v6; // esi + unsigned char *v6; // esi int v7; // eax v5 = pnum; @@ -1046,7 +1046,7 @@ void __fastcall InitPlayer(int pnum, bool FirstTime) int v6; // ST08_4 int v8; // eax int v10; // ST08_4 - int v11; // edx + unsigned char *v11; // edx int v12; // eax unsigned int v13; // edi bool v14; // zf @@ -2038,7 +2038,7 @@ void __fastcall StartSpell(int pnum, int d, int cx, int cy) { int v4; // edi int v5; // esi - int v6; // edx + unsigned char *v6; // edx int v7; // ST08_4 int v8; // edx int a2; // [esp+Ch] [ebp-4h] @@ -5040,7 +5040,7 @@ void __fastcall SyncPlrAnim(int pnum) int v1; // esi int v2; // eax int v3; // ecx - int v4; // ecx + unsigned char *v4; // ecx int v5; // edx v1 = pnum; diff --git a/Source/player.h b/Source/player.h index 669705685..50eed7df3 100644 --- a/Source/player.h +++ b/Source/player.h @@ -26,7 +26,7 @@ void __fastcall InitPlayerGFX(int pnum); void __fastcall InitPlrGFXMem(int pnum); int __fastcall GetPlrGFXSize(char *szCel); void __fastcall FreePlayerGFX(int pnum); -void __fastcall NewPlrAnim(int pnum, int Peq, int numFrames, int Delay, int width); +void __fastcall NewPlrAnim(int pnum, unsigned char *Peq, int numFrames, int Delay, int width); void __fastcall ClearPlrPVars(int pnum); void __fastcall SetPlrAnims(int pnum); void __fastcall ClearPlrRVars(PlayerStruct *p); diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 8453dc580..52b0e6968 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -318,7 +318,7 @@ LABEL_14: while ( (signed int)v8 < (signed int)&plr[4]._pHitPoints ); } -void __fastcall DrawPlayer(int pnum, int x, int y, int px, int py, int animdata, int animframe, int animwidth, int a9, int a10) +void __fastcall DrawPlayer(int pnum, int x, int y, int px, int py, unsigned char *animdata, int animframe, int animwidth, int a9, int a10) { char *v10; // edx int v11; // eax @@ -399,7 +399,7 @@ void __fastcall DrawPlayer(int pnum, int x, int y, int px, int py, int animdata, // 5CF31D: using guessed type char setlevel; // 69BEF8: using guessed type int light_table_index; -void __fastcall DrawClippedPlayer(int pnum, int x, int y, int px, int py, int animdata, int animframe, int animwidth, int a9, int a10) +void __fastcall DrawClippedPlayer(int pnum, int x, int y, int px, int py, unsigned char *animdata, int animframe, int animwidth, int a9, int a10) { char *v10; // edx int v11; // eax @@ -1060,7 +1060,7 @@ void __fastcall scrollrt_draw_clipped_dungeon(char *a1, int sx, int sy, int a4, v27 = a4 + v24->_mxoff - v25->flags_2; if ( v23 == pcursmonst ) { - Cl2DecodeClrHL(233, v27, v26, (char *)v24->_mAFNum, v24->_mAnimFrame, v25->flags_1, 0, 8); + Cl2DecodeClrHL(233, v27, v26, (char *)v24->_mAnimData, v24->_mAnimFrame, v25->flags_1, 0, 8); v23 = draw_monster_num; } DrawClippedMonster(a1a, sy, v27, v26, v23, 0, 8); @@ -1117,7 +1117,7 @@ void __fastcall scrollrt_draw_clipped_dungeon(char *a1, int sx, int sy, int a4, v35 = a4 + v32->_mxoff - v33->flags_2; if ( v31 == pcursmonst ) { - Cl2DecodeClrHL(233, v35, v34, (char *)v32->_mAFNum, v32->_mAnimFrame, v33->flags_1, 0, 8); + Cl2DecodeClrHL(233, v35, v34, (char *)v32->_mAnimData, v32->_mAnimFrame, v33->flags_1, 0, 8); v31 = draw_monster_num; } DrawClippedMonster(a1a, sy, v35, v34, v31, 0, 8); @@ -1186,7 +1186,7 @@ void __fastcall DrawClippedMonster(int x, int y, int a3, int a4, int mon_id, int if ( (unsigned int)mon_id < 0xC8 ) { v7 = mon_id; - v8 = (char *)monster[mon_id]._mAFNum; + v8 = (char *)monster[mon_id]._mAnimData; if ( v8 ) { v9 = monster[v7]._mAnimFrame; @@ -1733,7 +1733,7 @@ void __fastcall scrollrt_draw_clipped_dungeon_2(char *buffer, int x, int y, int v30 = sx + v27->_mxoff - v28->flags_2; if ( v26 == pcursmonst ) { - Cl2DecodeClrHL(233, v30, v29, (char *)v27->_mAFNum, v27->_mAnimFrame, v28->flags_1, a5, 8); + Cl2DecodeClrHL(233, v30, v29, (char *)v27->_mAnimData, v27->_mAnimFrame, v28->flags_1, a5, 8); v26 = draw_monster_num; } DrawClippedMonster(a1, y, v30, v29, v26, a5, 8); @@ -1791,7 +1791,7 @@ void __fastcall scrollrt_draw_clipped_dungeon_2(char *buffer, int x, int y, int v38 = sx + v35->_mxoff - v36->flags_2; if ( v34 == pcursmonst ) { - Cl2DecodeClrHL(233, v38, v37, (char *)v35->_mAFNum, v35->_mAnimFrame, v36->flags_1, a5, 8); + Cl2DecodeClrHL(233, v38, v37, (char *)v35->_mAnimData, v35->_mAnimFrame, v36->flags_1, a5, 8); v34 = draw_monster_num; } DrawClippedMonster(a1, y, v38, v37, v34, a5, 8); @@ -2335,7 +2335,7 @@ void __fastcall scrollrt_draw_dungeon(char *buffer, int x, int y, int a4, int a5 v29 = sx + v26->_mxoff - v27->flags_2; if ( v25 == pcursmonst ) { - Cl2DecodeFrm2(233, v29, v28, (char *)v26->_mAFNum, v26->_mAnimFrame, v27->flags_1, 0, a5); + Cl2DecodeFrm2(233, v29, v28, (char *)v26->_mAnimData, v26->_mAnimFrame, v27->flags_1, 0, a5); v25 = draw_monster_num; } DrawMonster(xa, y, v29, v28, v25, 0, a5); @@ -2392,7 +2392,7 @@ void __fastcall scrollrt_draw_dungeon(char *buffer, int x, int y, int a4, int a5 v37 = sx + v34->_mxoff - v35->flags_2; if ( v33 == pcursmonst ) { - Cl2DecodeFrm2(233, v37, v36, (char *)v34->_mAFNum, v34->_mAnimFrame, v35->flags_1, 0, a5); + Cl2DecodeFrm2(233, v37, v36, (char *)v34->_mAnimData, v34->_mAnimFrame, v35->flags_1, 0, a5); v33 = draw_monster_num; } DrawMonster(xa, y, v37, v36, v33, 0, a5); @@ -2461,7 +2461,7 @@ void __fastcall DrawMonster(int x, int y, int a3, int a4, int mon_id, int a6, in if ( (unsigned int)mon_id < 0xC8 ) { v7 = mon_id; - v8 = (char *)monster[mon_id]._mAFNum; + v8 = (char *)monster[mon_id]._mAnimData; if ( v8 ) { v9 = monster[v7]._mAnimFrame; diff --git a/Source/scrollrt.h b/Source/scrollrt.h index bfff8c79e..20cc42703 100644 --- a/Source/scrollrt.h +++ b/Source/scrollrt.h @@ -28,8 +28,8 @@ void __cdecl ClearCursor(); void __fastcall DrawMissile(int x, int y, int sx, int sy, int a5, int a6, int del_flag); void __fastcall DrawClippedMissile(int x, int y, int sx, int sy, int a5, int a6, int a7); void __fastcall DrawDeadPlayer(int x, int y, int sx, int sy, int a5, int a6, bool clipped); -void __fastcall DrawPlayer(int pnum, int x, int y, int px, int py, int animdata, int animframe, int animwidth, int a9, int a10); -void __fastcall DrawClippedPlayer(int pnum, int x, int y, int px, int py, int animdata, int animframe, int animwidth, int a9, int a10); +void __fastcall DrawPlayer(int pnum, int x, int y, int px, int py, unsigned char *animdata, int animframe, int animwidth, int a9, int a10); +void __fastcall DrawClippedPlayer(int pnum, int x, int y, int px, int py, unsigned char *animdata, int animframe, int animwidth, int a9, int a10); void __fastcall DrawView(int StartX, int StartY); void __fastcall DrawGame(int x, int y); void __fastcall scrollrt_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag); diff --git a/Source/towners.cpp b/Source/towners.cpp index ba0fce159..76fce176d 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -343,7 +343,7 @@ void __fastcall SetTownerGPtrs(void *pData, void **pAnim) while ( v5 < 8 ); } -void __fastcall NewTownerAnim(int tnum, void *pAnim, int numFrames, int Delay) +void __fastcall NewTownerAnim(int tnum, unsigned char *pAnim, int numFrames, int Delay) { int v4; // ecx @@ -419,7 +419,7 @@ void __cdecl InitSmith() v0 = numtowners; InitQstSnds(numtowners); v1 = v0; - towner[v1]._tNData = (char *)LoadFileInMem("Towners\\Smith\\SmithN.CEL", 0); + towner[v1]._tNData = LoadFileInMem("Towners\\Smith\\SmithN.CEL", 0); v2 = (unsigned int *)towner[v1]._tNAnim; v3 = 8; do @@ -431,7 +431,7 @@ void __cdecl InitSmith() while ( v3 ); v4 = numtowners; towner[v1]._tNFrames = 16; - NewTownerAnim(v4, (void *)towner[v1]._tNAnim[1], 16, 3); + NewTownerAnim(v4, towner[v1]._tNAnim[1], 16, 3); strcpy(towner[v1]._tName, "Griswold the Blacksmith"); ++numtowners; } @@ -449,7 +449,7 @@ void __cdecl InitBarOwner() v0 = numtowners; InitQstSnds(numtowners); v1 = v0; - towner[v1]._tNData = (char *)LoadFileInMem("Towners\\TwnF\\TwnFN.CEL", 0); + towner[v1]._tNData = LoadFileInMem("Towners\\TwnF\\TwnFN.CEL", 0); v2 = (unsigned int *)towner[v1]._tNAnim; v3 = 8; do @@ -461,7 +461,7 @@ void __cdecl InitBarOwner() while ( v3 ); v4 = numtowners; towner[v1]._tNFrames = 16; - NewTownerAnim(v4, (void *)towner[v1]._tNAnim[1], 16, 3); + NewTownerAnim(v4, towner[v1]._tNAnim[1], 16, 3); strcpy(towner[v1]._tName, "Ogden the Tavern owner"); ++numtowners; } @@ -479,7 +479,7 @@ void __cdecl InitTownDead() v0 = numtowners; InitQstSnds(numtowners); v1 = v0; - towner[v1]._tNData = (char *)LoadFileInMem("Towners\\Butch\\Deadguy.CEL", 0); + towner[v1]._tNData = LoadFileInMem("Towners\\Butch\\Deadguy.CEL", 0); v2 = (unsigned int *)towner[v1]._tNAnim; v3 = 8; do @@ -491,7 +491,7 @@ void __cdecl InitTownDead() while ( v3 ); v4 = numtowners; towner[v1]._tNFrames = 8; - NewTownerAnim(v4, (void *)towner[v1]._tNAnim[4], 8, 6); + NewTownerAnim(v4, towner[v1]._tNAnim[4], 8, 6); strcpy(towner[v1]._tName, "Wounded Townsman"); ++numtowners; } @@ -507,7 +507,7 @@ void __cdecl InitWitch() v0 = numtowners; InitQstSnds(numtowners); v1 = v0; - towner[v1]._tNData = (char *)LoadFileInMem("Towners\\TownWmn1\\Witch.CEL", 0); + towner[v1]._tNData = LoadFileInMem("Towners\\TownWmn1\\Witch.CEL", 0); v2 = (unsigned int *)towner[v1]._tNAnim; v3 = 8; do @@ -518,7 +518,7 @@ void __cdecl InitWitch() } while ( v3 ); towner[v1]._tNFrames = 19; - NewTownerAnim(numtowners, (void *)towner[v1]._tNAnim[0], 19, 6); + NewTownerAnim(numtowners, towner[v1]._tNAnim[0], 19, 6); strcpy(towner[v1]._tName, "Adria the Witch"); ++numtowners; } @@ -534,7 +534,7 @@ void __cdecl InitBarmaid() v0 = numtowners; InitQstSnds(numtowners); v1 = v0; - towner[v1]._tNData = (char *)LoadFileInMem("Towners\\TownWmn1\\WmnN.CEL", 0); + towner[v1]._tNData = LoadFileInMem("Towners\\TownWmn1\\WmnN.CEL", 0); v2 = (unsigned int *)towner[v1]._tNAnim; v3 = 8; do @@ -545,7 +545,7 @@ void __cdecl InitBarmaid() } while ( v3 ); towner[v1]._tNFrames = 18; - NewTownerAnim(numtowners, (void *)towner[v1]._tNAnim[0], 18, 6); + NewTownerAnim(numtowners, towner[v1]._tNAnim[0], 18, 6); strcpy(towner[v1]._tName, "Gillian the Barmaid"); ++numtowners; } @@ -562,7 +562,7 @@ void __cdecl InitBoy() v0 = numtowners; InitQstSnds(numtowners); v1 = v0; - towner[v1]._tNData = (char *)LoadFileInMem("Towners\\TownBoy\\PegKid1.CEL", 0); + towner[v1]._tNData = LoadFileInMem("Towners\\TownBoy\\PegKid1.CEL", 0); v2 = (unsigned int *)towner[v1]._tNAnim; v3 = 8; do @@ -573,7 +573,7 @@ void __cdecl InitBoy() } while ( v3 ); towner[v1]._tNFrames = 20; - NewTownerAnim(numtowners, (void *)towner[v1]._tNAnim[0], 20, 6); + NewTownerAnim(numtowners, towner[v1]._tNAnim[0], 20, 6); strcpy(towner[v1]._tName, "Wirt the Peg-legged boy"); ++numtowners; } @@ -591,7 +591,7 @@ void __cdecl InitHealer() v0 = numtowners; InitQstSnds(numtowners); v1 = v0; - towner[v1]._tNData = (char *)LoadFileInMem("Towners\\Healer\\Healer.CEL", 0); + towner[v1]._tNData = LoadFileInMem("Towners\\Healer\\Healer.CEL", 0); v2 = (unsigned int *)towner[v1]._tNAnim; v3 = 8; do @@ -603,7 +603,7 @@ void __cdecl InitHealer() while ( v3 ); v4 = numtowners; towner[v1]._tNFrames = 20; - NewTownerAnim(v4, (void *)towner[v1]._tNAnim[7], 20, 6); + NewTownerAnim(v4, towner[v1]._tNAnim[7], 20, 6); strcpy(towner[v1]._tName, "Pepin the Healer"); ++numtowners; } @@ -619,7 +619,7 @@ void __cdecl InitTeller() v0 = numtowners; InitQstSnds(numtowners); v1 = v0; - towner[v1]._tNData = (char *)LoadFileInMem("Towners\\Strytell\\Strytell.CEL", 0); + towner[v1]._tNData = LoadFileInMem("Towners\\Strytell\\Strytell.CEL", 0); v2 = (unsigned int *)towner[v1]._tNAnim; v3 = 8; do @@ -630,7 +630,7 @@ void __cdecl InitTeller() } while ( v3 ); towner[v1]._tNFrames = 25; - NewTownerAnim(numtowners, (void *)towner[v1]._tNAnim[0], 25, 3); + NewTownerAnim(numtowners, towner[v1]._tNAnim[0], 25, 3); strcpy(towner[v1]._tName, "Cain the Elder"); ++numtowners; } @@ -646,7 +646,7 @@ void __cdecl InitDrunk() v0 = numtowners; InitQstSnds(numtowners); v1 = v0; - towner[v1]._tNData = (char *)LoadFileInMem("Towners\\Drunk\\TwnDrunk.CEL", 0); + towner[v1]._tNData = LoadFileInMem("Towners\\Drunk\\TwnDrunk.CEL", 0); v2 = (unsigned int *)towner[v1]._tNAnim; v3 = 8; do @@ -657,7 +657,7 @@ void __cdecl InitDrunk() } while ( v3 ); towner[v1]._tNFrames = 18; - NewTownerAnim(numtowners, (void *)towner[v1]._tNAnim[0], 18, 3); + NewTownerAnim(numtowners, towner[v1]._tNAnim[0], 18, 3); strcpy(towner[v1]._tName, "Farnham the Drunk"); ++numtowners; } @@ -697,7 +697,7 @@ void __cdecl InitCows() SetTownerGPtrs(*v6, (void **)towner[v5]._tNAnim); v7 = numtowners; towner[numtowners]._tNFrames = 12; - NewTownerAnim(v7, (void *)towner[0]._tNAnim[v4 + 58 * v7], 12, 3); + NewTownerAnim(v7, towner[0]._tNAnim[v4 + 58 * v7], 12, 3); v7 *= 232; *(int *)((char *)&towner[0]._tAnimFrame + v7) = random(0, 11) + 1; *(int *)((char *)&towner[0]._tSelFlag + v7) = 1; diff --git a/Source/towners.h b/Source/towners.h index 174825639..8bed8f870 100644 --- a/Source/towners.h +++ b/Source/towners.h @@ -13,7 +13,7 @@ extern TownerStruct towner[16]; int __fastcall GetActiveTowner(int t); void __fastcall SetTownerGPtrs(void *pData, void **pAnim); /* unsigned char *+** */ -void __fastcall NewTownerAnim(int tnum, void *pAnim, int numFrames, int Delay); /* unsigned char * */ +void __fastcall NewTownerAnim(int tnum, unsigned char *pAnim, int numFrames, int Delay); void __fastcall InitTownerInfo(int i, int w, bool sel, int t, int x, int y, int ao, int tp); void __fastcall InitQstSnds(int i); void __cdecl InitSmith(); diff --git a/structs.h b/structs.h index d5e010d5e..951c3d5a3 100644 --- a/structs.h +++ b/structs.h @@ -127,7 +127,7 @@ struct MisFileData unsigned char mAnimFAmt; char *mName; int mFlags; - int mAnimData[16]; // unsigned char * + unsigned char *mAnimData[16]; unsigned char mAnimDelay[16]; unsigned char mAnimLen[16]; int mAnimWidth[16]; @@ -309,7 +309,7 @@ struct ItemStruct int _ix; int _iy; int _iAnimFlag; - int _iAnimData; // unsigned char * (PSX name -> ItemFrame) + unsigned char *_iAnimData; // PSX name -> ItemFrame int _iAnimLen; int _iAnimFrame; int _iAnimWidth; @@ -375,7 +375,7 @@ struct ItemStruct struct DeadStruct { - int _deadData[8]; // unsigned char * + unsigned char *_deadData[8]; int _deadFrame; int field_24; // width int field_28; // cel or fnum _deadtype? @@ -448,7 +448,7 @@ struct MissileStruct int _miDelFlag; int _miAnimType; int _miAnimFlags; - int _miAnimData; // unsigned char * + unsigned char *_miAnimData; int _miAnimDelay; int _miAnimLen; int _miAnimWidth; @@ -478,10 +478,10 @@ struct MissileStruct int _miVar8; }; -struct AnimStruct +struct AnimStruct // note: wrong names { int CMem; // [unsigned] char * ?? - int Frames[8]; // unsigned char * + unsigned char *Frames[8]; // probably Data[8] int Rate; int Delay; }; @@ -503,7 +503,7 @@ struct CMonster void *trans_file; }; -struct MonsterStruct +struct MonsterStruct // note: missing field _mAFNum { int _mMTidx; int _mmode; @@ -528,7 +528,7 @@ struct MonsterStruct unsigned char _menemyx; unsigned char _menemyy; short falign_52; - int _mAFNum; + unsigned char *_mAnimData; int _mAnimDelay; int _mAnimCnt; int _mAnimLen; @@ -720,7 +720,7 @@ struct ObjectStruct int _oy; int _oLight; int _oAnimFlag; - int _oAnimData; // unsigned char * + unsigned char *_oAnimData; int _oAnimDelay; int _oAnimCnt; int _oAnimLen; @@ -787,7 +787,7 @@ struct PlayerStruct int _pdir; int _nextdir; int _pgfxnum; - int _pAnimData; // unsigned char * + unsigned char *_pAnimData; int _pAnimDelay; int _pAnimCnt; int _pAnimLen; @@ -865,29 +865,29 @@ struct PlayerStruct unsigned char _pSLvlVisited[10]; char gap20F[9]; int _pGFXLoad; - int _pNAnim[8]; // unsigned char * + unsigned char *_pNAnim[8]; int _pNFrames; int _pNWidth; - int _pWAnim[8]; // unsigned char * + unsigned char *_pWAnim[8]; int _pWFrames; int _pWWidth; - int _pAAnim[8]; // unsigned char * + unsigned char *_pAAnim[8]; int _pAFrames; int _pAWidth; int _pAFNum; - int _pLAnim[8]; // unsigned char * - int _pFAnim[8]; // unsigned char * - int _pTAnim[8]; // unsigned char * + unsigned char *_pLAnim[8]; + unsigned char *_pFAnim[8]; + unsigned char *_pTAnim[8]; int _pSFrames; int _pSWidth; int _pSFNum; - int _pHAnim[8]; // unsigned char * + unsigned char *_pHAnim[8]; int _pHFrames; int _pHWidth; - int _pDAnim[8]; // unsigned char * + unsigned char *_pDAnim[8]; int _pDFrames; int _pDWidth; - int _pBAnim[8]; // unsigned char * + unsigned char *_pBAnim[8]; int _pBFrames; int _pBWidth; ItemStruct InvBody[7]; @@ -925,15 +925,15 @@ struct PlayerStruct short wReserved[8]; int pDiabloKillLevel; int dwReserved[7]; - void *_pNData; - void *_pWData; - void *_pAData; - void *_pLData; - void *_pFData; - void *_pTData; - void *_pHData; - void *_pDData; - void *_pBData; + unsigned char *_pNData; + unsigned char *_pWData; + unsigned char *_pAData; + unsigned char *_pLData; + unsigned char *_pFData; + unsigned char *_pTData; + unsigned char *_pHData; + unsigned char *_pDData; + unsigned char *_pBData; int unused_54D4; }; @@ -997,7 +997,7 @@ struct TownerStruct int _txvel; int _tyvel; int _tdir; - void *_tAnimData; // unsigned char * + unsigned char *_tAnimData; int _tAnimDelay; int _tAnimCnt; int _tAnimLen; @@ -1018,9 +1018,9 @@ struct TownerStruct int _tVar3; int _tVar4; char _tName[32]; - int _tNAnim[8]; // unsigned char * + unsigned char *_tNAnim[8]; int _tNFrames; - char *_tNData; // unsigned char * + unsigned char *_tNData; }; struct _SNETUIDATA