Browse Source

Clean up debug.cpp

pull/100/head
Anders Jenbo 7 years ago
parent
commit
47fa5d46d9
  1. 54
      Source/debug.cpp
  2. 2
      Source/debug.h
  3. 4
      Source/diablo.cpp

54
Source/debug.cpp

@ -9,7 +9,6 @@ void LoadDebugGFX()
if (visiondebug) if (visiondebug)
pSquareCel = LoadFileInMem("Data\\Square.CEL", 0); pSquareCel = LoadFileInMem("Data\\Square.CEL", 0);
} }
// 525720: using guessed type int visiondebug;
void FreeDebugGFX() void FreeDebugGFX()
{ {
@ -18,8 +17,7 @@ void FreeDebugGFX()
void CheckDungeonClear() void CheckDungeonClear()
{ {
int i; int i, j;
int j;
for (j = 0; j < MAXDUNY; j++) { for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++) { for (i = 0; i < MAXDUNX; i++) {
@ -37,8 +35,7 @@ void CheckDungeonClear()
#ifdef _DEBUG #ifdef _DEBUG
void GiveGoldCheat() void GiveGoldCheat()
{ {
int i; // esi int i, ni;
int ni; // ebp
for (i = 0; i < 40; i++) { for (i = 0; i < 40; i++) {
if (!plr[myplr].InvGrid[i]) { if (!plr[myplr].InvGrid[i]) {
@ -55,7 +52,7 @@ void GiveGoldCheat()
void StoresCheat() void StoresCheat()
{ {
int i; // eax int i;
numpremium = 0; numpremium = 0;
@ -72,8 +69,8 @@ void StoresCheat()
void TakeGoldCheat() void TakeGoldCheat()
{ {
int i; // esi int i;
char ig; // cl char ig;
for (i = 0; i < 40; i++) { for (i = 0; i < 40; i++) {
ig = plr[myplr].InvGrid[i]; ig = plr[myplr].InvGrid[i];
@ -133,9 +130,9 @@ void SetAllSpellsCheat()
SetSpellLevelCheat(SPL_BONESPIRIT, 1); SetSpellLevelCheat(SPL_BONESPIRIT, 1);
} }
void PrintDebugPlayer(BOOLEAN bNextPlayer) void PrintDebugPlayer(BOOL bNextPlayer)
{ {
char dstr[128]; // [esp+Ch] [ebp-80h] char dstr[128];
if (bNextPlayer) if (bNextPlayer)
dbgplr = ((_BYTE)dbgplr + 1) & 3; dbgplr = ((_BYTE)dbgplr + 1) & 3;
@ -159,19 +156,21 @@ void PrintDebugPlayer(BOOLEAN bNextPlayer)
void PrintDebugQuest() void PrintDebugQuest()
{ {
char dstr[128]; // [esp+0h] [ebp-80h] char dstr[128];
sprintf(dstr, "Quest %i : Active = %i, Var1 = %i", dbgqst, quests[dbgqst]._qactive, quests[dbgqst]._qvar1); sprintf(dstr, "Quest %i : Active = %i, Var1 = %i", dbgqst, quests[dbgqst]._qactive, quests[dbgqst]._qvar1);
NetSendCmdString(1 << myplr, dstr); NetSendCmdString(1 << myplr, dstr);
if (++dbgqst == MAXQUESTS)
dbgqst++;
if (dbgqst == MAXQUESTS)
dbgqst = 0; dbgqst = 0;
} }
void PrintDebugMonster(int m) void PrintDebugMonster(int m)
{ {
BOOLEAN bActive; // ecx BOOL bActive;
int i; // eax int i;
char dstr[128]; // [esp+Ch] [ebp-80h] char dstr[128];
sprintf(dstr, "Monster %i = %s", m, monster[m].mName); sprintf(dstr, "Monster %i = %s", m, monster[m].mName);
NetSendCmdString(1 << myplr, dstr); NetSendCmdString(1 << myplr, dstr);
@ -195,26 +194,25 @@ void PrintDebugMonster(int m)
void GetDebugMonster() void GetDebugMonster()
{ {
int v0; // ecx int mi1, mi2;
int v1; // eax
mi1 = pcursmonst;
v0 = pcursmonst; if (mi1 == -1) {
if (pcursmonst == -1) { mi2 = dMonster[cursmx][cursmy];
v1 = dMonster[cursmx][cursmy]; if (mi2) {
if (v1) { mi1 = mi2 - 1;
v0 = v1 - 1; if (mi2 <= 0)
if (v1 <= 0) mi1 = -1 - mi2;
v0 = -1 - v1;
} else { } else {
v0 = dbgmon; mi1 = dbgmon;
} }
} }
PrintDebugMonster(v0); PrintDebugMonster(mi1);
} }
void NextDebugMonster() void NextDebugMonster()
{ {
char dstr[128]; // [esp+0h] [ebp-80h] char dstr[128];
if (dbgmon++ == MAXMONSTERS) if (dbgmon++ == MAXMONSTERS)
dbgmon = 0; dbgmon = 0;

2
Source/debug.h

@ -16,7 +16,7 @@ void TakeGoldCheat();
void MaxSpellsCheat(); void MaxSpellsCheat();
void SetSpellLevelCheat(char spl, int spllvl); void SetSpellLevelCheat(char spl, int spllvl);
void SetAllSpellsCheat(); void SetAllSpellsCheat();
void PrintDebugPlayer(BOOLEAN bNextPlayer); void PrintDebugPlayer(BOOL bNextPlayer);
void PrintDebugQuest(); void PrintDebugQuest();
void PrintDebugMonster(int m); void PrintDebugMonster(int m);
void GetDebugMonster(); void GetDebugMonster();

4
Source/diablo.cpp

@ -1490,10 +1490,10 @@ void PressChar(int vkey)
} }
break; break;
case 'D': case 'D':
PrintDebugPlayer(1); PrintDebugPlayer(TRUE);
break; break;
case 'd': case 'd':
PrintDebugPlayer(0); PrintDebugPlayer(FALSE);
break; break;
case 'e': case 'e':
if(debug_mode_key_d) { if(debug_mode_key_d) {

Loading…
Cancel
Save