Merge pull request #75 from GabrielRavier/betterComments

Improved quite a few comments
This commit is contained in:
Clownacy 2019-11-10 12:14:25 +00:00 committed by GitHub
commit 01db50d0e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 33 additions and 30 deletions

View file

@ -766,7 +766,7 @@ void ActBossChar_MonstX(void)
gBoss[1].act_no = 20; gBoss[1].act_no = 20;
gBoss[2].act_no = 20; gBoss[2].act_no = 20;
// Fallthrough // Fallthrough
case 503: case 503: // Exactly identical to case 603
if (++npc->act_wait > 50) if (++npc->act_wait > 50)
{ {
if (npc->x > gMC.x) if (npc->x > gMC.x)
@ -803,7 +803,7 @@ void ActBossChar_MonstX(void)
gBoss[2].act_no = 40; gBoss[2].act_no = 40;
// Fallthrough // Fallthrough
case 603: case 603: // Exactly identical to case 503
if (++npc->act_wait > 50) if (++npc->act_wait > 50)
{ {
if (npc->x > gMC.x) if (npc->x > gMC.x)

View file

@ -66,6 +66,7 @@ BULLET gBul[BULLET_MAX];
void InitBullet() void InitBullet()
{ {
// Identical to ClearBullet
for (int i = 0; i < BULLET_MAX; i++) for (int i = 0; i < BULLET_MAX; i++)
gBul[i].cond = 0; gBul[i].cond = 0;
} }
@ -110,6 +111,7 @@ void DeleteBullet(int code)
void ClearBullet() void ClearBullet()
{ {
// Identical to InitBullet
for (int i = 0; i < BULLET_MAX; i++) for (int i = 0; i < BULLET_MAX; i++)
gBul[i].cond = 0; gBul[i].cond = 0;
} }
@ -2352,7 +2354,7 @@ void ActBullet()
case 33: case 33:
ActBullet_SuperBom(&gBul[i], 3); ActBullet_SuperBom(&gBul[i], 3);
break; break;
case 34: case 34: // Identical to case 43
ActBullet_Nemesis(&gBul[i], 1); ActBullet_Nemesis(&gBul[i], 1);
break; break;
case 35: case 35:
@ -2379,7 +2381,7 @@ void ActBullet()
case 42: case 42:
ActBullet_SpurTail(&gBul[i], 3); ActBullet_SpurTail(&gBul[i], 3);
break; break;
case 43: case 43: // Identical to case 34
ActBullet_Nemesis(&gBul[i], 1); ActBullet_Nemesis(&gBul[i], 1);
break; break;
case 44: case 44:

View file

@ -76,7 +76,7 @@ void StartFadeIn(signed char dir)
} }
} }
x = x; // What x = x; // x is assigned to itself. Thanks, Pixel. (Most likely, the original code wasn't written the exact same way)
} }
void ProcFade() void ProcFade()

View file

@ -532,7 +532,7 @@ int ModeAction(HWND hWnd)
} }
} }
if (swPlay % 2 && g_GameFlags & 1) if (swPlay % 2 && g_GameFlags & 1) // The "swPlay % 2" part is always true
{ {
if (g_GameFlags & 2) if (g_GameFlags & 2)
ActMyChar(TRUE); ActMyChar(TRUE);
@ -635,7 +635,7 @@ int ModeAction(HWND hWnd)
RotationArmsRev(); RotationArmsRev();
} }
if (swPlay % 2) if (swPlay % 2) // This is always true
{ {
switch (TextScriptProc()) switch (TextScriptProc())
{ {

View file

@ -27,7 +27,7 @@ void GetCompileDate(int *year, int *month, int *day)
months[10] = "Oct"; months[10] = "Oct";
months[11] = "Nov"; months[11] = "Nov";
months[12] = "Dec"; months[12] = "Dec";
sscanf(__DATE__, "%s %d %d", month_string, day, year); sscanf(__DATE__, "%s %d %d", month_string, day, year); // The expansion of __DATE__ is not reproductible. TODO : Think about changing this to be reproductible
for (i = 0; i < 12; ++i) // This being 12 instead of 13 might be a bug, but it works anyway by accident for (i = 0; i < 12; ++i) // This being 12 instead of 13 might be a bug, but it works anyway by accident
if (!memcmp(&month_string, months[i], 3)) if (!memcmp(&month_string, months[i], 3))

View file

@ -64,7 +64,7 @@ void WriteMiniMapLine(int line)
a == 83 || a == 83 ||
a == 84 || a == 84 ||
a == 87 || a == 87 ||
a == 96 || // This is already listed above a == 96 || // This is already listed above, so that part of the expression is always false
a == 112 || a == 112 ||
a == 115 || a == 115 ||
a == 116 || a == 116 ||

View file

@ -680,7 +680,7 @@ void ActMyChar_Normal(BOOL bKey)
// Change position // Change position
if (gMC.xm <= resist && gMC.xm >= -resist) if (gMC.xm <= resist && gMC.xm >= -resist)
{ {
// Okay, this is getting stupid. Why the HELL is the code written like this? // This case is completely empty. This is most likely the result of commented code or some other change (so this is most likely inaccurate to the original source)
} }
else else
{ {

View file

@ -507,7 +507,7 @@ void HitMyCharMap()
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]); gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
break; break;
// Water and water blocks // Water and water blocks (same as the previous case)
case 0x60: case 0x60:
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]); gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
break; break;

View file

@ -135,7 +135,7 @@ void DamageMyChar(int damage)
// Lose a whimsical star // Lose a whimsical star
if (gMC.equip & 0x80 && gMC.star > 0) if (gMC.equip & 0x80 && gMC.star > 0)
gMC.star = (short)gMC.star - 1; // Why the hell is it written this way? gMC.star = (short)gMC.star - 1; // For some reason, does a cast to short. Might not accurate to the original source (possibly, Pixel was just being careful about int size/conversion, or this is from some weird macro)
// Lose experience // Lose experience
if (gMC.equip & 4) if (gMC.equip & 4)

View file

@ -306,7 +306,7 @@ void ActNpc025(NPCHAR *npc)
break; break;
case 2: case 2: // Identical to case 4
if (++npc->act_wait <= 0x40) if (++npc->act_wait <= 0x40)
{ {
npc->y -= 0x200; npc->y -= 0x200;
@ -328,7 +328,7 @@ void ActNpc025(NPCHAR *npc)
break; break;
case 4: case 4: // Identical to case 2
if (++npc->act_wait <= 0x40) if (++npc->act_wait <= 0x40)
{ {
npc->y -= 0x200; npc->y -= 0x200;

View file

@ -1122,7 +1122,7 @@ void ActNpc051(NPCHAR *npc)
npc->tgt_x = npc->x; npc->tgt_x = npc->x;
npc->tgt_y = npc->y; npc->tgt_y = npc->y;
if (npc->direct == 0) if (npc->direct == 0) // Completely redundant as both the conditions are the same
npc->ym = 0x400; npc->ym = 0x400;
else else
npc->ym = 0x400; npc->ym = 0x400;
@ -1895,7 +1895,7 @@ void ActNpc058(NPCHAR *npc)
break; break;
} }
if (npc->act_no) if (npc->act_no) // This is always true
{ {
if (npc->act_wait < 150) if (npc->act_wait < 150)
++npc->act_wait; ++npc->act_wait;

View file

@ -671,7 +671,7 @@ void ActNpc110(NPCHAR *npc)
if (npc->act_wait > 18) if (npc->act_wait > 18)
{ {
npc->act_no = 1; npc->act_no = 1;
npc->act_no = 1; npc->act_no = 1; // Duplicate line
} }
break; break;

View file

@ -69,8 +69,8 @@ void ActNpc160(NPCHAR *npc)
break; break;
case 3: case 3:
npc->damage = 20; npc->damage = 20; // Overriden by the following line
npc->damage = 0; // Smart code npc->damage = 0;
if (++npc->act_wait > 24) if (++npc->act_wait > 24)
{ {

View file

@ -747,11 +747,11 @@ void ActNpc284(NPCHAR *npc)
npc->act_no = 34; npc->act_no = 34;
break; break;
case 0: case 0: // Identical to case 2
npc->act_no = 32; npc->act_no = 32;
break; break;
case 2: case 2: // Identical to case 0
npc->act_no = 32; npc->act_no = 32;
break; break;
} }

View file

@ -142,20 +142,20 @@ void ActNpc321(NPCHAR *npc)
break; break;
case 1: case 1:
if (gMC.direct == 0) if (gMC.direct == 0) // Does the same thing whether this is false or true
npc->x = npc->pNpc->x; npc->x = npc->pNpc->x;
else else
npc->x = npc->pNpc->x; // Duplicate derp npc->x = npc->pNpc->x;
direct = 1; direct = 1;
npc->y = npc->pNpc->y - 0x1400; npc->y = npc->pNpc->y - 0x1400;
break; break;
case 2: case 2:
if (gMC.direct == 0) if (gMC.direct == 0) // Does the same thing whether this is false or true
npc->x = npc->pNpc->x; npc->x = npc->pNpc->x;
else else
npc->x = npc->pNpc->x; // Duplicate derp npc->x = npc->pNpc->x;
direct = 3; direct = 3;
npc->y = npc->pNpc->y + 0x1400; npc->y = npc->pNpc->y + 0x1400;

View file

@ -520,7 +520,7 @@ void LoseNpChar(NPCHAR *npc, BOOL bVanish)
// Create value view // Create value view
if (npc->bits & NPC_SHOW_DAMAGE) if (npc->bits & NPC_SHOW_DAMAGE)
{ {
if ((npc->bits & NPC_SHOW_DAMAGE) && npc->damage_view) if ((npc->bits & NPC_SHOW_DAMAGE) && npc->damage_view) // npc->bits & NPC_SHOW_DAMAGE is already verified at this point, so this is redundant
SetValueView(&npc->x, &npc->y, npc->damage_view); SetValueView(&npc->x, &npc->y, npc->damage_view);
if (bVanish) if (bVanish)
VanishNpChar(npc); VanishNpChar(npc);

View file

@ -521,7 +521,7 @@ BOOL OrgData::SetMusicInfo(MUSICINFO *mi, unsigned long flag)
for (i = 0; i < MAXMELODY; i++) for (i = 0; i < MAXMELODY; i++)
{ {
info.tdata[i].freq = mi->tdata[i].freq; info.tdata[i].freq = mi->tdata[i].freq;
info.tdata[i].pipi = info.tdata[i].pipi; info.tdata[i].pipi = info.tdata[i].pipi; // info.tdata[i].pipi is assigned to itself. Thanks, Pixel. (Most likely, the original code wasn't written the exact same way)
} }
} }

View file

@ -368,10 +368,10 @@ int MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no)
{ {
if (!MakePixelWaveData(ptp_pointer, pcm_buffer)) if (!MakePixelWaveData(ptp_pointer, pcm_buffer))
{ {
if (pcm_buffer != NULL) if (pcm_buffer != NULL) // This is always true
free(pcm_buffer); free(pcm_buffer);
if (mixed_pcm_buffer != NULL) if (mixed_pcm_buffer != NULL) // This is always true
free(mixed_pcm_buffer); free(mixed_pcm_buffer);
return -1; return -1;
@ -390,7 +390,7 @@ int MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no)
++ptp_pointer; ++ptp_pointer;
} }
// Maybe this used to be something to prevent audio popping? // This is self-assignment, so redundant. Maybe this used to be something to prevent audio popping ?
mixed_pcm_buffer[0] = mixed_pcm_buffer[0]; mixed_pcm_buffer[0] = mixed_pcm_buffer[0];
mixed_pcm_buffer[sample_count - 1] = mixed_pcm_buffer[sample_count - 1]; mixed_pcm_buffer[sample_count - 1] = mixed_pcm_buffer[sample_count - 1];

View file

@ -96,6 +96,7 @@ void ActStar()
if (star[i].ym < -0xA00) if (star[i].ym < -0xA00)
star[i].ym = -0xA00; star[i].ym = -0xA00;
// Duplicate of the past 8 lines of code
if (star[i].xm > 0xA00) if (star[i].xm > 0xA00)
star[i].xm = 0xA00; star[i].xm = 0xA00;
if (star[i].xm < -0xA00) if (star[i].xm < -0xA00)