ref: 01db50d0e701d9d03998c8972275f4014d311c2f
parent: 9c56888ffd17a687953a2a3c79b5feab1843fb30
parent: f7a3eee9b511301e89ec0d62a83bea218f2e57a2
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sun Nov 10 07:14:25 EST 2019
Merge pull request #75 from GabrielRavier/betterComments Improved quite a few comments
--- a/src/BossX.cpp
+++ b/src/BossX.cpp
@@ -766,7 +766,7 @@
gBoss[1].act_no = 20;
gBoss[2].act_no = 20;
// Fallthrough
- case 503:
+ case 503: // Exactly identical to case 603
if (++npc->act_wait > 50)
{
if (npc->x > gMC.x)
@@ -803,7 +803,7 @@
gBoss[2].act_no = 40;
// Fallthrough
- case 603:
+ case 603: // Exactly identical to case 503
if (++npc->act_wait > 50)
{
if (npc->x > gMC.x)
--- a/src/Bullet.cpp
+++ b/src/Bullet.cpp
@@ -66,6 +66,7 @@
void InitBullet()
{
+ // Identical to ClearBullet
for (int i = 0; i < BULLET_MAX; i++)
gBul[i].cond = 0;
}
@@ -110,6 +111,7 @@
void ClearBullet()
{
+ // Identical to InitBullet
for (int i = 0; i < BULLET_MAX; i++)
gBul[i].cond = 0;
}
@@ -2352,7 +2354,7 @@
case 33:
ActBullet_SuperBom(&gBul[i], 3);
break;
- case 34:
+ case 34: // Identical to case 43
ActBullet_Nemesis(&gBul[i], 1);
break;
case 35:
@@ -2379,7 +2381,7 @@
case 42:
ActBullet_SpurTail(&gBul[i], 3);
break;
- case 43:
+ case 43: // Identical to case 34
ActBullet_Nemesis(&gBul[i], 1);
break;
case 44:
--- a/src/Fade.cpp
+++ b/src/Fade.cpp
@@ -76,7 +76,7 @@
}
}
- 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()
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -532,7 +532,7 @@
}
}
- if (swPlay % 2 && g_GameFlags & 1)
+ if (swPlay % 2 && g_GameFlags & 1) // The "swPlay % 2" part is always true
{
if (g_GameFlags & 2)
ActMyChar(TRUE);
@@ -635,7 +635,7 @@
RotationArmsRev();
}
- if (swPlay % 2)
+ if (swPlay % 2) // This is always true
{
switch (TextScriptProc())
{
--- a/src/Generic.cpp
+++ b/src/Generic.cpp
@@ -27,7 +27,7 @@
months[10] = "Oct";
months[11] = "Nov";
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
if (!memcmp(&month_string, months[i], 3))
--- a/src/MiniMap.cpp
+++ b/src/MiniMap.cpp
@@ -64,7 +64,7 @@
a == 83 ||
a == 84 ||
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 == 115 ||
a == 116 ||
--- a/src/MyChar.cpp
+++ b/src/MyChar.cpp
@@ -680,7 +680,7 @@
// Change position
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
{
--- a/src/MycHit.cpp
+++ b/src/MycHit.cpp
@@ -507,7 +507,7 @@
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
break;
- // Water and water blocks
+ // Water and water blocks (same as the previous case)
case 0x60:
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
break;
--- a/src/MycParam.cpp
+++ b/src/MycParam.cpp
@@ -135,7 +135,7 @@
// Lose a whimsical star
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
if (gMC.equip & 4)
--- a/src/NpcAct020.cpp
+++ b/src/NpcAct020.cpp
@@ -306,7 +306,7 @@
break;
- case 2:
+ case 2: // Identical to case 4
if (++npc->act_wait <= 0x40)
{
npc->y -= 0x200;
@@ -328,7 +328,7 @@
break;
- case 4:
+ case 4: // Identical to case 2
if (++npc->act_wait <= 0x40)
{
npc->y -= 0x200;
--- a/src/NpcAct040.cpp
+++ b/src/NpcAct040.cpp
@@ -1122,7 +1122,7 @@
npc->tgt_x = npc->x;
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;
else
npc->ym = 0x400;
@@ -1895,7 +1895,7 @@
break;
}
- if (npc->act_no)
+ if (npc->act_no) // This is always true
{
if (npc->act_wait < 150)
++npc->act_wait;
--- a/src/NpcAct100.cpp
+++ b/src/NpcAct100.cpp
@@ -671,7 +671,7 @@
if (npc->act_wait > 18)
{
npc->act_no = 1;
- npc->act_no = 1;
+ npc->act_no = 1; // Duplicate line
}
break;
--- a/src/NpcAct160.cpp
+++ b/src/NpcAct160.cpp
@@ -69,8 +69,8 @@
break;
case 3:
- npc->damage = 20;
- npc->damage = 0; // Smart code
+ npc->damage = 20; // Overriden by the following line
+ npc->damage = 0;
if (++npc->act_wait > 24)
{
--- a/src/NpcAct280.cpp
+++ b/src/NpcAct280.cpp
@@ -747,11 +747,11 @@
npc->act_no = 34;
break;
- case 0:
+ case 0: // Identical to case 2
npc->act_no = 32;
break;
- case 2:
+ case 2: // Identical to case 0
npc->act_no = 32;
break;
}
--- a/src/NpcAct320.cpp
+++ b/src/NpcAct320.cpp
@@ -142,10 +142,10 @@
break;
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;
else
- npc->x = npc->pNpc->x; // Duplicate derp
+ npc->x = npc->pNpc->x;
direct = 1;
npc->y = npc->pNpc->y - 0x1400;
@@ -152,10 +152,10 @@
break;
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;
else
- npc->x = npc->pNpc->x; // Duplicate derp
+ npc->x = npc->pNpc->x;
direct = 3;
npc->y = npc->pNpc->y + 0x1400;
--- a/src/NpcHit.cpp
+++ b/src/NpcHit.cpp
@@ -520,7 +520,7 @@
// Create value view
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);
if (bVanish)
VanishNpChar(npc);
--- a/src/Organya.cpp
+++ b/src/Organya.cpp
@@ -521,7 +521,7 @@
for (i = 0; i < MAXMELODY; i++)
{
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)
}
}
--- a/src/Sound.cpp
+++ b/src/Sound.cpp
@@ -368,10 +368,10 @@
{
if (!MakePixelWaveData(ptp_pointer, pcm_buffer))
{
- if (pcm_buffer != NULL)
+ if (pcm_buffer != NULL) // This is always true
free(pcm_buffer);
- if (mixed_pcm_buffer != NULL)
+ if (mixed_pcm_buffer != NULL) // This is always true
free(mixed_pcm_buffer);
return -1;
@@ -390,7 +390,7 @@
++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[sample_count - 1] = mixed_pcm_buffer[sample_count - 1];
--- a/src/Star.cpp
+++ b/src/Star.cpp
@@ -96,6 +96,7 @@
if (star[i].ym < -0xA00)
star[i].ym = -0xA00;
+ // Duplicate of the past 8 lines of code
if (star[i].xm > 0xA00)
star[i].xm = 0xA00;
if (star[i].xm < -0xA00)