Clean-up MyChar.cpp
This commit is contained in:
parent
7df1eb9c58
commit
30ad5189f6
3 changed files with 102 additions and 92 deletions
165
src/MyChar.cpp
165
src/MyChar.cpp
|
@ -22,21 +22,21 @@ MYCHAR gMC;
|
||||||
int noise_no;
|
int noise_no;
|
||||||
unsigned int noise_freq;
|
unsigned int noise_freq;
|
||||||
|
|
||||||
void InitMyChar()
|
void InitMyChar(void)
|
||||||
{
|
{
|
||||||
memset(&gMC, 0, sizeof(MYCHAR));
|
memset(&gMC, 0, sizeof(MYCHAR));
|
||||||
gMC.cond = 0x80;
|
gMC.cond = 0x80;
|
||||||
gMC.direct = 2;
|
gMC.direct = 2;
|
||||||
|
|
||||||
gMC.view.back = 0x1000;
|
gMC.view.back = 8 * 0x200;
|
||||||
gMC.view.top = 0x1000;
|
gMC.view.top = 8 * 0x200;
|
||||||
gMC.view.front = 0x1000;
|
gMC.view.front = 8 * 0x200;
|
||||||
gMC.view.bottom = 0x1000;
|
gMC.view.bottom = 8 * 0x200;
|
||||||
|
|
||||||
gMC.hit.back = 0xA00;
|
gMC.hit.back = 5 * 0x200;
|
||||||
gMC.hit.top = 0x1000;
|
gMC.hit.top = 8 * 0x200;
|
||||||
gMC.hit.front = 0xA00;
|
gMC.hit.front = 5 * 0x200;
|
||||||
gMC.hit.bottom = 0x1000;
|
gMC.hit.bottom = 8 * 0x200;
|
||||||
|
|
||||||
gMC.life = 3;
|
gMC.life = 3;
|
||||||
gMC.max_life = 3;
|
gMC.max_life = 3;
|
||||||
|
@ -84,13 +84,14 @@ void AnimationMyChar(BOOL bKey)
|
||||||
{
|
{
|
||||||
gMC.ani_no = 11;
|
gMC.ani_no = 11;
|
||||||
}
|
}
|
||||||
else if (gKey & gKeyUp && (gKeyRight | gKeyLeft) & gKey && bKey)
|
else if (gKey & gKeyUp && gKey & (gKeyLeft | gKeyRight) && bKey)
|
||||||
{
|
{
|
||||||
gMC.cond |= 4;
|
gMC.cond |= 4;
|
||||||
|
|
||||||
if (++gMC.ani_wait > 4)
|
if (++gMC.ani_wait > 4)
|
||||||
{
|
{
|
||||||
gMC.ani_wait = 0;
|
gMC.ani_wait = 0;
|
||||||
|
|
||||||
if (++gMC.ani_no == 7 || gMC.ani_no == 9)
|
if (++gMC.ani_no == 7 || gMC.ani_no == 9)
|
||||||
PlaySoundObject(24, 1);
|
PlaySoundObject(24, 1);
|
||||||
}
|
}
|
||||||
|
@ -98,13 +99,14 @@ void AnimationMyChar(BOOL bKey)
|
||||||
if (gMC.ani_no > 9 || gMC.ani_no < 6)
|
if (gMC.ani_no > 9 || gMC.ani_no < 6)
|
||||||
gMC.ani_no = 6;
|
gMC.ani_no = 6;
|
||||||
}
|
}
|
||||||
else if ((gKeyRight | gKeyLeft) & gKey && bKey)
|
else if (gKey & (gKeyLeft | gKeyRight) && bKey)
|
||||||
{
|
{
|
||||||
gMC.cond |= 4;
|
gMC.cond |= 4;
|
||||||
|
|
||||||
if (++gMC.ani_wait > 4)
|
if (++gMC.ani_wait > 4)
|
||||||
{
|
{
|
||||||
gMC.ani_wait = 0;
|
gMC.ani_wait = 0;
|
||||||
|
|
||||||
if (++gMC.ani_no == 2 || gMC.ani_no == 4)
|
if (++gMC.ani_no == 2 || gMC.ani_no == 4)
|
||||||
PlaySoundObject(24, 1);
|
PlaySoundObject(24, 1);
|
||||||
}
|
}
|
||||||
|
@ -163,13 +165,13 @@ void PutMyChar(int fx, int fy)
|
||||||
{
|
{
|
||||||
int arms_offset_y;
|
int arms_offset_y;
|
||||||
|
|
||||||
if ((gMC.cond & 0x80) == 0 || (gMC.cond & 2))
|
if (!(gMC.cond & 0x80) || gMC.cond & 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Draw weapon
|
// Draw weapon
|
||||||
gMC.rect_arms.left = 24 * (gArmsData[gSelectedArms].code % 13);
|
gMC.rect_arms.left = (gArmsData[gSelectedArms].code % 13) * 24;
|
||||||
gMC.rect_arms.right = gMC.rect_arms.left + 24;
|
gMC.rect_arms.right = gMC.rect_arms.left + 24;
|
||||||
gMC.rect_arms.top = 96 * (gArmsData[gSelectedArms].code / 13);
|
gMC.rect_arms.top = (gArmsData[gSelectedArms].code / 13) * 96;
|
||||||
gMC.rect_arms.bottom = gMC.rect_arms.top + 16;
|
gMC.rect_arms.bottom = gMC.rect_arms.top + 16;
|
||||||
|
|
||||||
if (gMC.direct == 2)
|
if (gMC.direct == 2)
|
||||||
|
@ -201,19 +203,19 @@ void PutMyChar(int fx, int fy)
|
||||||
if (gMC.direct == 0)
|
if (gMC.direct == 0)
|
||||||
PutBitmap3(
|
PutBitmap3(
|
||||||
&grcGame,
|
&grcGame,
|
||||||
(gMC.x - gMC.view.front) / 0x200 - fx / 0x200 - 8,
|
((gMC.x - gMC.view.front) / 0x200) - (fx / 0x200) - 8,
|
||||||
(gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
|
((gMC.y - gMC.view.top) / 0x200) - (fy / 0x200) + arms_offset_y,
|
||||||
&gMC.rect_arms,
|
&gMC.rect_arms,
|
||||||
SURFACE_ID_ARMS);
|
SURFACE_ID_ARMS);
|
||||||
else
|
else
|
||||||
PutBitmap3(
|
PutBitmap3(
|
||||||
&grcGame,
|
&grcGame,
|
||||||
(gMC.x - gMC.view.front) / 0x200 - fx / 0x200,
|
((gMC.x - gMC.view.front) / 0x200) - (fx / 0x200),
|
||||||
(gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
|
((gMC.y - gMC.view.top) / 0x200) - (fy / 0x200) + arms_offset_y,
|
||||||
&gMC.rect_arms,
|
&gMC.rect_arms,
|
||||||
SURFACE_ID_ARMS);
|
SURFACE_ID_ARMS);
|
||||||
|
|
||||||
if ((gMC.shock / 2) % 2)
|
if (gMC.shock / 2 % 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Draw player
|
// Draw player
|
||||||
|
@ -224,7 +226,7 @@ void PutMyChar(int fx, int fy)
|
||||||
rect.bottom += 32;
|
rect.bottom += 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
PutBitmap3(&grcGame, (gMC.x - gMC.view.front) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, SURFACE_ID_MY_CHAR);
|
PutBitmap3(&grcGame, ((gMC.x - gMC.view.front) / 0x200) - (fx / 0x200), ((gMC.y - gMC.view.top) / 0x200) - (fy / 0x200), &rect, SURFACE_ID_MY_CHAR);
|
||||||
|
|
||||||
// Draw air tank
|
// Draw air tank
|
||||||
RECT rcBubble[2] = {
|
RECT rcBubble[2] = {
|
||||||
|
@ -234,9 +236,9 @@ void PutMyChar(int fx, int fy)
|
||||||
|
|
||||||
++gMC.bubble;
|
++gMC.bubble;
|
||||||
if (gMC.equip & 0x10 && gMC.flag & 0x100)
|
if (gMC.equip & 0x10 && gMC.flag & 0x100)
|
||||||
PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble / 2) % 2], SURFACE_ID_CARET);
|
PutBitmap3(&grcGame, (gMC.x / 0x200) - 12 - (fx / 0x200), (gMC.y / 0x200) - 12 - (fy / 0x200), &rcBubble[gMC.bubble / 2 % 2], SURFACE_ID_CARET);
|
||||||
else if (gMC.unit == 1)
|
else if (gMC.unit == 1)
|
||||||
PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble / 2) % 2], SURFACE_ID_CARET);
|
PutBitmap3(&grcGame, (gMC.x / 0x200) - 12 - (fx / 0x200), (gMC.y / 0x200) - 12 - (fy / 0x200), &rcBubble[gMC.bubble / 2 % 2], SURFACE_ID_CARET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActMyChar_Normal(BOOL bKey)
|
void ActMyChar_Normal(BOOL bKey)
|
||||||
|
@ -281,7 +283,7 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't create "?" effect
|
// Don't create "?" effect
|
||||||
gMC.ques = 0;
|
gMC.ques = FALSE;
|
||||||
|
|
||||||
// If can't control player, stop boosting
|
// If can't control player, stop boosting
|
||||||
if (!bKey)
|
if (!bKey)
|
||||||
|
@ -309,14 +311,14 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
// Move in direction held
|
// Move in direction held
|
||||||
if (bKey)
|
if (bKey)
|
||||||
{
|
{
|
||||||
if (gKeyTrg == gKeyDown && gKey == gKeyDown && (gMC.cond & 1) == 0 && (g_GameFlags & 4) == 0)
|
if (gKeyTrg == gKeyDown && gKey == gKeyDown && !(gMC.cond & 1) && !(g_GameFlags & 4))
|
||||||
{
|
{
|
||||||
gMC.cond |= 1;
|
gMC.cond |= 1;
|
||||||
gMC.ques = 1;
|
gMC.ques = TRUE;
|
||||||
}
|
}
|
||||||
else if (gKey == gKeyDown)
|
else if (gKey == gKeyDown)
|
||||||
{
|
{
|
||||||
|
// There probably used to be commented-out code here
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -356,12 +358,13 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
// Start boosting
|
// Start boosting
|
||||||
if (bKey)
|
if (bKey)
|
||||||
{
|
{
|
||||||
if (gMC.equip & 0x21 && gKeyTrg & gKeyJump && gMC.boost_cnt)
|
if (gMC.equip & 0x21 && gKeyTrg & gKeyJump && gMC.boost_cnt != 0)
|
||||||
{
|
{
|
||||||
// Booster 0.8
|
// Booster 0.8
|
||||||
if (gMC.equip & 1)
|
if (gMC.equip & 1)
|
||||||
{
|
{
|
||||||
gMC.boost_sw = 1;
|
gMC.boost_sw = 1;
|
||||||
|
|
||||||
if (gMC.ym > 0x100)
|
if (gMC.ym > 0x100)
|
||||||
gMC.ym /= 2;
|
gMC.ym /= 2;
|
||||||
}
|
}
|
||||||
|
@ -415,7 +418,7 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow down when stopped boosting (Booster 2.0)
|
// Slow down when stopped boosting (Booster 2.0)
|
||||||
if (gMC.equip & 0x20 && gMC.boost_sw && (!(gKey & gKeyJump) || !gMC.boost_cnt))
|
if (gMC.equip & 0x20 && gMC.boost_sw != 0 && (!(gKey & gKeyJump) || gMC.boost_cnt == 0))
|
||||||
{
|
{
|
||||||
if (gMC.boost_sw == 1)
|
if (gMC.boost_sw == 1)
|
||||||
gMC.xm /= 2;
|
gMC.xm /= 2;
|
||||||
|
@ -424,7 +427,7 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop boosting
|
// Stop boosting
|
||||||
if (!gMC.boost_cnt || !(gKey & gKeyJump))
|
if (gMC.boost_cnt == 0 || !(gKey & gKeyJump))
|
||||||
gMC.boost_sw = 0;
|
gMC.boost_sw = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,17 +440,17 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
else
|
else
|
||||||
gMC.up = FALSE;
|
gMC.up = FALSE;
|
||||||
|
|
||||||
if (gKey & gKeyDown && (gMC.flag & 8) == 0)
|
if (gKey & gKeyDown && !(gMC.flag & 8))
|
||||||
gMC.down = TRUE;
|
gMC.down = TRUE;
|
||||||
else
|
else
|
||||||
gMC.down = FALSE;
|
gMC.down = FALSE;
|
||||||
|
|
||||||
if (gKeyTrg & gKeyJump
|
if (gKeyTrg & gKeyJump && (gMC.flag & 8 || gMC.flag & 0x10 || gMC.flag & 0x20))
|
||||||
&& (gMC.flag & 8 || gMC.flag & 0x10 || gMC.flag & 0x20))
|
|
||||||
{
|
{
|
||||||
if (gMC.flag & 0x2000)
|
if (gMC.flag & 0x2000)
|
||||||
{
|
{
|
||||||
// Another weird empty case needed for accurate assembly
|
// Another weird empty case needed for accurate assembly.
|
||||||
|
// There probably used to be some commented-out code here.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -458,11 +461,11 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop interacting when moved
|
// Stop interacting when moved
|
||||||
if (bKey && (gKeyShot | gKeyJump | gKeyUp | gKeyRight | gKeyLeft) & gKey)
|
if (bKey && gKey & (gKeyLeft | gKeyRight | gKeyUp | gKeyJump | gKeyShot))
|
||||||
gMC.cond &= ~1;
|
gMC.cond &= ~1;
|
||||||
|
|
||||||
// Booster losing fuel
|
// Booster losing fuel
|
||||||
if (gMC.boost_sw && gMC.boost_cnt)
|
if (gMC.boost_sw != 0 && gMC.boost_cnt != 0)
|
||||||
--gMC.boost_cnt;
|
--gMC.boost_cnt;
|
||||||
|
|
||||||
// Wind / current forces
|
// Wind / current forces
|
||||||
|
@ -476,7 +479,7 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
gMC.ym += 0x55;
|
gMC.ym += 0x55;
|
||||||
|
|
||||||
// Booster 2.0 forces and effects
|
// Booster 2.0 forces and effects
|
||||||
if (gMC.equip & 0x20 && gMC.boost_sw)
|
if (gMC.equip & 0x20 && gMC.boost_sw != 0)
|
||||||
{
|
{
|
||||||
if (gMC.boost_sw == 1)
|
if (gMC.boost_sw == 1)
|
||||||
{
|
{
|
||||||
|
@ -485,7 +488,7 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
gMC.ym = -0x100;
|
gMC.ym = -0x100;
|
||||||
|
|
||||||
// Move in direction facing
|
// Move in direction facing
|
||||||
if (!gMC.direct)
|
if (gMC.direct == 0)
|
||||||
gMC.xm -= 0x20;
|
gMC.xm -= 0x20;
|
||||||
if (gMC.direct == 2)
|
if (gMC.direct == 2)
|
||||||
gMC.xm += 0x20;
|
gMC.xm += 0x20;
|
||||||
|
@ -493,10 +496,10 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
// Boost particles (and sound)
|
// Boost particles (and sound)
|
||||||
if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
|
if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
|
||||||
{
|
{
|
||||||
if (!gMC.direct)
|
if (gMC.direct == 0)
|
||||||
SetCaret(gMC.x + 0x400, gMC.y + 0x400, 7, 2);
|
SetCaret(gMC.x + (2 * 0x200), gMC.y + (2 * 0x200), 7, 2);
|
||||||
if (gMC.direct == 2)
|
if (gMC.direct == 2)
|
||||||
SetCaret(gMC.x - 0x400, gMC.y + 0x400, 7, 0);
|
SetCaret(gMC.x - (2 * 0x200), gMC.y + (2 * 0x200), 7, 0);
|
||||||
|
|
||||||
PlaySoundObject(113, 1);
|
PlaySoundObject(113, 1);
|
||||||
}
|
}
|
||||||
|
@ -509,14 +512,14 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
// Boost particles (and sound)
|
// Boost particles (and sound)
|
||||||
if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
|
if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
|
||||||
{
|
{
|
||||||
SetCaret(gMC.x, gMC.y + 0xC00, 7, 3);
|
SetCaret(gMC.x, gMC.y + (6 * 0x200), 7, 3);
|
||||||
PlaySoundObject(113, 1);
|
PlaySoundObject(113, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (gMC.boost_sw == 3 && (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1))
|
else if (gMC.boost_sw == 3 && (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1))
|
||||||
{
|
{
|
||||||
// Boost particles (and sound)
|
// Boost particles (and sound)
|
||||||
SetCaret(gMC.x, gMC.y - 0xC00, 7, 1);
|
SetCaret(gMC.x, gMC.y - (6 * 0x200), 7, 1);
|
||||||
PlaySoundObject(113, 1);
|
PlaySoundObject(113, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -526,14 +529,14 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
gMC.ym += gravity1;
|
gMC.ym += gravity1;
|
||||||
}
|
}
|
||||||
// Booster 0.8
|
// Booster 0.8
|
||||||
else if (gMC.equip & 1 && gMC.boost_sw && gMC.ym > -0x400)
|
else if (gMC.equip & 1 && gMC.boost_sw != 0 && gMC.ym > -0x400)
|
||||||
{
|
{
|
||||||
// Upwards force
|
// Upwards force
|
||||||
gMC.ym -= 0x20;
|
gMC.ym -= 0x20;
|
||||||
|
|
||||||
if (!(gMC.boost_cnt % 3))
|
if (gMC.boost_cnt % 3 == 0)
|
||||||
{
|
{
|
||||||
SetCaret(gMC.x, gMC.hit.bottom / 2 + gMC.y, 7, 3);
|
SetCaret(gMC.x, gMC.y + (gMC.hit.bottom / 2), 7, 3);
|
||||||
PlaySoundObject(113, 1);
|
PlaySoundObject(113, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,13 +572,13 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
|
|
||||||
if (0)
|
if (0)
|
||||||
{
|
{
|
||||||
// There used to be an if here that didn't do anything, but the compiler optimised it out.
|
// There used to be an if-statement here that didn't do anything, but the compiler optimised it out.
|
||||||
// We only know this was here because empty ifs mess with the register usage.
|
// We only know this was here because empty if-statements affect the register usage.
|
||||||
// Since there's no code, we have no idea what the original condition actually was.
|
// Since there's no code, we have no idea what the original condition actually was.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit speed
|
// Limit speed
|
||||||
if ((gMC.flag & 0x100) && (gMC.flag & 0xF000) == 0)
|
if (gMC.flag & 0x100 && !(gMC.flag & 0xF000))
|
||||||
{
|
{
|
||||||
if (gMC.xm < -0x2FF)
|
if (gMC.xm < -0x2FF)
|
||||||
gMC.xm = -0x2FF;
|
gMC.xm = -0x2FF;
|
||||||
|
@ -602,17 +605,18 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
if (!gMC.sprash && gMC.flag & 0x100)
|
if (!gMC.sprash && gMC.flag & 0x100)
|
||||||
{
|
{
|
||||||
int dir;
|
int dir;
|
||||||
|
|
||||||
if (gMC.flag & 0x800)
|
if (gMC.flag & 0x800)
|
||||||
dir = 2;
|
dir = 2;
|
||||||
else
|
else
|
||||||
dir = 0;
|
dir = 0;
|
||||||
|
|
||||||
if ((gMC.flag & 8) == 0 && gMC.ym > 0x200)
|
if (!(gMC.flag & 8) && gMC.ym > 0x200)
|
||||||
{
|
{
|
||||||
for (a = 0; a < 8; a++)
|
for (a = 0; a < 8; ++a)
|
||||||
{
|
{
|
||||||
x = gMC.x + (Random(-8, 8) * 0x200);
|
x = gMC.x + (Random(-8, 8) * 0x200);
|
||||||
SetNpChar(73, x, gMC.y, gMC.xm + Random(-0x200, 0x200), Random(-0x200, 0x80) - gMC.ym / 2, dir, 0, 0);
|
SetNpChar(73, x, gMC.y, gMC.xm + Random(-0x200, 0x200), Random(-0x200, 0x80) - (gMC.ym / 2), dir, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaySoundObject(56, 1);
|
PlaySoundObject(56, 1);
|
||||||
|
@ -621,21 +625,21 @@ void ActMyChar_Normal(BOOL bKey)
|
||||||
{
|
{
|
||||||
if (gMC.xm > 0x200 || gMC.xm < -0x200)
|
if (gMC.xm > 0x200 || gMC.xm < -0x200)
|
||||||
{
|
{
|
||||||
for (a = 0; a < 8; a++)
|
for (a = 0; a < 8; ++a)
|
||||||
{
|
{
|
||||||
x = gMC.x + (Random(-8, 8) * 0x200);
|
x = gMC.x + (Random(-8, 8) * 0x200);
|
||||||
SetNpChar(73, x, gMC.y, gMC.xm + Random(-0x200, 0x200), Random(-0x200, 0x80), dir, 0, 0);
|
SetNpChar(73, x, gMC.y, gMC.xm + Random(-0x200, 0x200), Random(-0x200, 0x80), dir, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaySoundObject(56, 1);
|
PlaySoundObject(56, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gMC.sprash = 1;
|
gMC.sprash = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(gMC.flag & 0x100))
|
if (!(gMC.flag & 0x100))
|
||||||
gMC.sprash = 0;
|
gMC.sprash = FALSE;
|
||||||
|
|
||||||
// Spike damage
|
// Spike damage
|
||||||
if (gMC.flag & 0x400)
|
if (gMC.flag & 0x400)
|
||||||
|
@ -697,7 +701,7 @@ void ActMyChar_Stream(BOOL bKey)
|
||||||
|
|
||||||
if (bKey)
|
if (bKey)
|
||||||
{
|
{
|
||||||
if (gKey & (gKeyRight | gKeyLeft))
|
if (gKey & (gKeyLeft | gKeyRight))
|
||||||
{
|
{
|
||||||
if (gKey & gKeyLeft)
|
if (gKey & gKeyLeft)
|
||||||
gMC.xm -= 0x100;
|
gMC.xm -= 0x100;
|
||||||
|
@ -718,7 +722,7 @@ void ActMyChar_Stream(BOOL bKey)
|
||||||
gMC.xm += 0x80;
|
gMC.xm += 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gKey & (gKeyDown | gKeyUp))
|
if (gKey & (gKeyUp | gKeyDown))
|
||||||
{
|
{
|
||||||
if (gKey & gKeyUp)
|
if (gKey & gKeyUp)
|
||||||
gMC.ym -= 0x100;
|
gMC.ym -= 0x100;
|
||||||
|
@ -759,7 +763,7 @@ void ActMyChar_Stream(BOOL bKey)
|
||||||
if (gMC.ym < -0x200 && gMC.flag & 2)
|
if (gMC.ym < -0x200 && gMC.flag & 2)
|
||||||
SetCaret(gMC.x, gMC.y - gMC.hit.top, 13, 5);
|
SetCaret(gMC.x, gMC.y - gMC.hit.top, 13, 5);
|
||||||
if (gMC.ym > 0x200 && gMC.flag & 8)
|
if (gMC.ym > 0x200 && gMC.flag & 8)
|
||||||
SetCaret(gMC.x, gMC.hit.bottom + gMC.y, 13, 5);
|
SetCaret(gMC.x, gMC.y + gMC.hit.bottom, 13, 5);
|
||||||
|
|
||||||
if (gMC.xm > 0x400)
|
if (gMC.xm > 0x400)
|
||||||
gMC.xm = 0x400;
|
gMC.xm = 0x400;
|
||||||
|
@ -771,7 +775,7 @@ void ActMyChar_Stream(BOOL bKey)
|
||||||
if (gMC.ym < -0x400)
|
if (gMC.ym < -0x400)
|
||||||
gMC.ym = -0x400;
|
gMC.ym = -0x400;
|
||||||
|
|
||||||
if ((gKey & (gKeyUp | gKeyLeft)) == (gKeyLeft | gKeyUp))
|
if ((gKey & (gKeyLeft | gKeyUp)) == (gKeyLeft | gKeyUp))
|
||||||
{
|
{
|
||||||
if (gMC.xm < -780)
|
if (gMC.xm < -780)
|
||||||
gMC.xm = -780;
|
gMC.xm = -780;
|
||||||
|
@ -779,7 +783,7 @@ void ActMyChar_Stream(BOOL bKey)
|
||||||
gMC.ym = -780;
|
gMC.ym = -780;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gKey & (gKeyUp | gKeyRight)) == (gKeyRight | gKeyUp))
|
if ((gKey & (gKeyRight | gKeyUp)) == (gKeyRight | gKeyUp))
|
||||||
{
|
{
|
||||||
if (gMC.xm > 780)
|
if (gMC.xm > 780)
|
||||||
gMC.xm = 780;
|
gMC.xm = 780;
|
||||||
|
@ -787,7 +791,7 @@ void ActMyChar_Stream(BOOL bKey)
|
||||||
gMC.ym = -780;
|
gMC.ym = -780;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gKey & (gKeyDown | gKeyLeft)) == (gKeyLeft | gKeyDown))
|
if ((gKey & (gKeyLeft | gKeyDown)) == (gKeyLeft | gKeyDown))
|
||||||
{
|
{
|
||||||
if (gMC.xm < -780)
|
if (gMC.xm < -780)
|
||||||
gMC.xm = -780;
|
gMC.xm = -780;
|
||||||
|
@ -795,7 +799,7 @@ void ActMyChar_Stream(BOOL bKey)
|
||||||
gMC.ym = 780;
|
gMC.ym = 780;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gKey & (gKeyDown | gKeyRight)) == (gKeyRight | gKeyDown))
|
if ((gKey & (gKeyRight | gKeyDown)) == (gKeyRight | gKeyDown))
|
||||||
{
|
{
|
||||||
if (gMC.xm > 780)
|
if (gMC.xm > 780)
|
||||||
gMC.xm = 780;
|
gMC.xm = 780;
|
||||||
|
@ -807,7 +811,7 @@ void ActMyChar_Stream(BOOL bKey)
|
||||||
gMC.y += gMC.ym;
|
gMC.y += gMC.ym;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirProcess()
|
void AirProcess(void)
|
||||||
{
|
{
|
||||||
if (gMC.equip & 0x10)
|
if (gMC.equip & 0x10)
|
||||||
{
|
{
|
||||||
|
@ -816,7 +820,7 @@ void AirProcess()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((gMC.flag & 0x100) == 0)
|
if (!(gMC.flag & 0x100))
|
||||||
{
|
{
|
||||||
gMC.air = 1000;
|
gMC.air = 1000;
|
||||||
}
|
}
|
||||||
|
@ -848,26 +852,27 @@ void AirProcess()
|
||||||
{
|
{
|
||||||
gMC.air_get = 60;
|
gMC.air_get = 60;
|
||||||
}
|
}
|
||||||
else if (gMC.air_get)
|
else
|
||||||
{
|
{
|
||||||
--gMC.air_get;
|
if (gMC.air_get != 0)
|
||||||
|
--gMC.air_get;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActMyChar(BOOL bKey)
|
void ActMyChar(BOOL bKey)
|
||||||
{
|
{
|
||||||
if ((gMC.cond & 0x80) == 0)
|
if (!(gMC.cond & 0x80))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gMC.exp_wait)
|
if (gMC.exp_wait != 0)
|
||||||
--gMC.exp_wait;
|
--gMC.exp_wait;
|
||||||
|
|
||||||
if (gMC.shock)
|
if (gMC.shock != 0)
|
||||||
{
|
{
|
||||||
--gMC.shock;
|
--gMC.shock;
|
||||||
}
|
}
|
||||||
else if (gMC.exp_count)
|
else if (gMC.exp_count != 0)
|
||||||
{
|
{
|
||||||
SetValueView(&gMC.x, &gMC.y, gMC.exp_count);
|
SetValueView(&gMC.x, &gMC.y, gMC.exp_count);
|
||||||
gMC.exp_count = 0;
|
gMC.exp_count = 0;
|
||||||
|
@ -878,6 +883,7 @@ void ActMyChar(BOOL bKey)
|
||||||
case 0:
|
case 0:
|
||||||
if (!(g_GameFlags & 4) && bKey)
|
if (!(g_GameFlags & 4) && bKey)
|
||||||
AirProcess();
|
AirProcess();
|
||||||
|
|
||||||
ActMyChar_Normal(bKey);
|
ActMyChar_Normal(bKey);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -915,12 +921,12 @@ void MoveMyChar(int x, int y)
|
||||||
gMC.y = y;
|
gMC.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroMyCharXMove()
|
void ZeroMyCharXMove(void)
|
||||||
{
|
{
|
||||||
gMC.xm = 0;
|
gMC.xm = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetUnitMyChar()
|
int GetUnitMyChar(void)
|
||||||
{
|
{
|
||||||
return gMC.unit;
|
return gMC.unit;
|
||||||
}
|
}
|
||||||
|
@ -942,7 +948,8 @@ void SetMyCharDirect(unsigned char dir)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < NPC_MAX; i++)
|
|
||||||
|
for (i = 0; i < NPC_MAX; ++i)
|
||||||
if (gNPC[i].code_event == dir)
|
if (gNPC[i].code_event == dir)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -965,9 +972,9 @@ void ChangeMyUnit(unsigned char a)
|
||||||
gMC.unit = a;
|
gMC.unit = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PitMyChar()
|
void PitMyChar(void)
|
||||||
{
|
{
|
||||||
gMC.y += 0x4000;
|
gMC.y += 2 * 0x10 * 0x200; // Shove player two tiles down. I wonder what this was meant for?
|
||||||
}
|
}
|
||||||
|
|
||||||
void EquipItem(int flag, BOOL b)
|
void EquipItem(int flag, BOOL b)
|
||||||
|
@ -978,7 +985,7 @@ void EquipItem(int flag, BOOL b)
|
||||||
gMC.equip &= ~flag;
|
gMC.equip &= ~flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetCheck()
|
void ResetCheck(void)
|
||||||
{
|
{
|
||||||
gMC.cond &= ~1;
|
gMC.cond &= ~1;
|
||||||
}
|
}
|
||||||
|
@ -1003,7 +1010,7 @@ void SetNoise(int no, int freq)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutNoise()
|
void CutNoise(void)
|
||||||
{
|
{
|
||||||
noise_no = 0;
|
noise_no = 0;
|
||||||
PlaySoundObject(40, 0);
|
PlaySoundObject(40, 0);
|
||||||
|
@ -1011,7 +1018,7 @@ void CutNoise()
|
||||||
PlaySoundObject(58, 0);
|
PlaySoundObject(58, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetNoise()
|
void ResetNoise(void)
|
||||||
{
|
{
|
||||||
switch (noise_no)
|
switch (noise_no)
|
||||||
{
|
{
|
||||||
|
@ -1028,7 +1035,7 @@ void ResetNoise()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SleepNoise()
|
void SleepNoise(void)
|
||||||
{
|
{
|
||||||
PlaySoundObject(40, 0);
|
PlaySoundObject(40, 0);
|
||||||
PlaySoundObject(41, 0);
|
PlaySoundObject(41, 0);
|
||||||
|
|
23
src/MyChar.h
23
src/MyChar.h
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
// TODO - When I add bitmask constants for gMC.flags...
|
||||||
|
// 0x100 is a 'player is underwater' flag
|
||||||
|
|
||||||
struct MYCHAR
|
struct MYCHAR
|
||||||
{
|
{
|
||||||
unsigned char cond;
|
unsigned char cond;
|
||||||
|
@ -52,15 +55,15 @@ struct MYCHAR
|
||||||
int lifeBr_count;
|
int lifeBr_count;
|
||||||
int air;
|
int air;
|
||||||
int air_get;
|
int air_get;
|
||||||
signed char sprash;
|
signed char sprash; // This is explicitly a char, but used like a BOOL
|
||||||
signed char ques;
|
signed char ques; // Same for this variable as well
|
||||||
signed char boost_sw;
|
signed char boost_sw;
|
||||||
int boost_cnt;
|
int boost_cnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MYCHAR gMC;
|
extern MYCHAR gMC;
|
||||||
|
|
||||||
void InitMyChar();
|
void InitMyChar(void);
|
||||||
void AnimationMyChar(BOOL bKey);
|
void AnimationMyChar(BOOL bKey);
|
||||||
void ShowMyChar(BOOL bShow);
|
void ShowMyChar(BOOL bShow);
|
||||||
void PutMyChar(int fx, int fy);
|
void PutMyChar(int fx, int fy);
|
||||||
|
@ -69,14 +72,14 @@ void ActMyChar(BOOL bKey);
|
||||||
void GetMyCharPosition(int *x, int *y);
|
void GetMyCharPosition(int *x, int *y);
|
||||||
void SetMyCharPosition(int x, int y);
|
void SetMyCharPosition(int x, int y);
|
||||||
void MoveMyChar(int x, int y);
|
void MoveMyChar(int x, int y);
|
||||||
void ZeroMyCharXMove();
|
void ZeroMyCharXMove(void);
|
||||||
int GetUnitMyChar();
|
int GetUnitMyChar(void);
|
||||||
void SetMyCharDirect(unsigned char dir);
|
void SetMyCharDirect(unsigned char dir);
|
||||||
void ChangeMyUnit(unsigned char a);
|
void ChangeMyUnit(unsigned char a);
|
||||||
void PitMyChar();
|
void PitMyChar(void);
|
||||||
void EquipItem(int flag, BOOL b);
|
void EquipItem(int flag, BOOL b);
|
||||||
void ResetCheck();
|
void ResetCheck(void);
|
||||||
void SetNoise(int no, int freq);
|
void SetNoise(int no, int freq);
|
||||||
void CutNoise();
|
void CutNoise(void);
|
||||||
void ResetNoise();
|
void ResetNoise(void);
|
||||||
void SleepNoise();
|
void SleepNoise(void);
|
||||||
|
|
|
@ -847,7 +847,7 @@ void HitMyCharNpChar(void)
|
||||||
{
|
{
|
||||||
StartTextScript(gNPC[i].code_event);
|
StartTextScript(gNPC[i].code_event);
|
||||||
gMC.xm = 0;
|
gMC.xm = 0;
|
||||||
gMC.ques = 0;
|
gMC.ques = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -890,7 +890,7 @@ void HitMyCharBoss(void)
|
||||||
if (!(g_GameFlags & 4) && hit != 0 && gBoss[b].bits & NPC_EVENT_WHEN_TOUCHED)
|
if (!(g_GameFlags & 4) && hit != 0 && gBoss[b].bits & NPC_EVENT_WHEN_TOUCHED)
|
||||||
{
|
{
|
||||||
StartTextScript(gBoss[b].code_event);
|
StartTextScript(gBoss[b].code_event);
|
||||||
gMC.ques = 0;
|
gMC.ques = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gBoss[b].bits & NPC_REAR_AND_TOP_DONT_HURT)
|
if (gBoss[b].bits & NPC_REAR_AND_TOP_DONT_HURT)
|
||||||
|
@ -909,7 +909,7 @@ void HitMyCharBoss(void)
|
||||||
{
|
{
|
||||||
StartTextScript(gBoss[b].code_event);
|
StartTextScript(gBoss[b].code_event);
|
||||||
gMC.xm = 0;
|
gMC.xm = 0;
|
||||||
gMC.ques = 0;
|
gMC.ques = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue