ref: 9bef4b1d49363a395feee19d6b2c70d733df41ac
parent: 861064bf121f7dee3cddf8c9b942641fbc3b6376
author: Gabriel Ravier <gabravier@gmail.com>
date: Fri Sep 13 14:49:17 EDT 2019
Commented BossFrog entirely Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
--- a/src/BossFrog.cpp
+++ b/src/BossFrog.cpp
@@ -3,12 +3,12 @@
#include "WindowsWrapper.h"
#include "Boss.h"
+#include "CommonDefines.h"
#include "Frame.h"
#include "Game.h"
#include "MyChar.h"
#include "NpChar.h"
#include "Sound.h"
-#include "Stage.h"
#include "Triangle.h"
enum BalfrogStates
@@ -24,7 +24,9 @@
BALFROG_MIDAIR = 104,
BALFROG_INITIALIZE_LAND = 110,
BALFROG_LAND = 111,
- BALFROG_INITIALIZE_SHOOT = 113,
+ BALFROG_INITIALIZE_SHOOT = 112,
+ BALFROG_SHOOT = 113,
+ BALFROG_AFTER_SHOOT_WAIT = 114,
BALFROG_INITIALIZE_LEAP_1 = 120,
BALFROG_INITIALIZE_LEAP_2 = 121,
BALFROG_INITIALIZE_LEAP_3 = 122,
@@ -39,6 +41,18 @@
BALFROG_GONE_INTO_CEILING = 143
};
+enum BalfrogAnims
+{
+ BALFANI_NOTHING = 0,
+ BALFANI_STANDING_STILL = 1,
+ BALFANI_MOUTH_BARELY_OPEN_CROUCHING = 2,
+ BALFANI_MOUTH_OPEN_CROUCHING = 3,
+ BALFANI_MOUTH_OPEN_CROUCHING_FLASHING = 4,
+ BALFANI_JUMPING = 5,
+ BALFANI_BALROG_WHITE = 6,
+ BALFANI_BALROG_CROUCHING = 7,
+ BALFANI_BALROG_JUMPING = 8
+};
// Balfrog's mouth
static void ActBossChar02_01(void)
@@ -46,7 +60,7 @@
NPCHAR *boss;
int minus;
- if (gBoss[0].direct == 0)
+ if (gBoss[0].direct == DIR_LEFT)
minus = 1;
else
minus = -1;
@@ -55,8 +69,8 @@
switch (gBoss[0].ani_no)
{
- case 0:
- boss->hit_voice = 52;
+ case BALFANI_NOTHING:
+ boss->hit_voice = SND_BEHEMOTH_LARGE_HURT;
boss->hit.front = PIXELS_TO_UNITS(16);
boss->hit.top = PIXELS_TO_UNITS(16);
boss->hit.back = PIXELS_TO_UNITS(16);
@@ -65,23 +79,23 @@
boss->bits = NPC_INVULNERABLE;
break;
- case 1:
+ case BALFANI_STANDING_STILL:
boss->x = gBoss[0].x + -PIXELS_TO_UNITS(24) * minus;
boss->y = gBoss[0].y - PIXELS_TO_UNITS(24);
break;
- case 2:
+ case BALFANI_MOUTH_BARELY_OPEN_CROUCHING:
boss->x = gBoss[0].x + -PIXELS_TO_UNITS(24) * minus;
boss->y = gBoss[0].y - PIXELS_TO_UNITS(20);
break;
- case 3:
- case 4:
+ case BALFANI_MOUTH_OPEN_CROUCHING:
+ case BALFANI_MOUTH_OPEN_CROUCHING_FLASHING:
boss->x = gBoss[0].x + -PIXELS_TO_UNITS(24) * minus;
boss->y = gBoss[0].y - PIXELS_TO_UNITS(32);
break;
- case 5:
+ case BALFANI_JUMPING:
boss->x = gBoss[0].x + -PIXELS_TO_UNITS(24) * minus;
boss->y = gBoss[0].y - PIXELS_TO_UNITS(43);
break;
@@ -94,8 +108,8 @@
switch (gBoss[0].ani_no)
{
- case 0:
- boss->hit_voice = 52;
+ case BALFANI_NOTHING:
+ boss->hit_voice = SND_BEHEMOTH_LARGE_HURT;
boss->hit.front = PIXELS_TO_UNITS(24);
boss->hit.top = PIXELS_TO_UNITS(16);
boss->hit.back = PIXELS_TO_UNITS(24);
@@ -104,11 +118,11 @@
boss->bits = NPC_INVULNERABLE;
break;
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
+ case BALFANI_STANDING_STILL:
+ case BALFANI_MOUTH_BARELY_OPEN_CROUCHING:
+ case BALFANI_MOUTH_OPEN_CROUCHING:
+ case BALFANI_MOUTH_OPEN_CROUCHING_FLASHING:
+ case BALFANI_JUMPING:
boss->x = gBoss[0].x;
boss->y = gBoss[0].y;
break;
@@ -125,17 +139,18 @@
// Rects 1-4 are for when Balfrog is a frog, 5-8 for when he reverts into Balrog and goes into the ceiling
RECT rcLeft[9] = {
- {0, 0, 0, 0},
- {0, 48, 80, 112},
- {0, 112, 80, 176},
- {0, 176, 80, 240},
- {160, 48, 240, 112},
- {160, 112, 240, 200},
- {200, 0, 240, 24},
- {80, 0, 120, 24},
- {120, 0, 160, 24},
+ {0, 0, 0, 0}, // Nothing
+ {0, 48, 80, 112}, // Balfrog standing still
+ {0, 112, 80, 176}, // Balfrog with his mouth barely open, crouching
+ {0, 176, 80, 240}, // Balfrog with his mouth open, crouching
+ {160, 48, 240, 112}, // Balfrog with his mouth open, crouching, flashing
+ {160, 112, 240, 200}, // Balfrog jumping
+ {200, 0, 240, 24}, // Balrog completely white
+ {80, 0, 120, 24}, // Balrog crouching
+ {120, 0, 160, 24}, // Balrog jumping
};
+ // See above
RECT rcRight[9] = {
{0, 0, 0, 0},
{80, 48, 160, 112},
@@ -155,12 +170,12 @@
case BALFROG_INITIALIZE:
boss->x = TILES_TO_UNITS(6);
boss->y = (TILES_TO_UNITS(12) + PIXELS_TO_UNITS(8));
- boss->direct = 2;
+ boss->direct = DIR_RIGHT;
boss->view.front = TILES_TO_UNITS(3);
boss->view.top = TILES_TO_UNITS(3);
boss->view.back = TILES_TO_UNITS(2);
boss->view.bottom = TILES_TO_UNITS(1);
- boss->hit_voice = 52;
+ boss->hit_voice = SND_BEHEMOTH_LARGE_HURT;
boss->hit.front = TILES_TO_UNITS(1) + PIXELS_TO_UNITS(8);
boss->hit.top = TILES_TO_UNITS(1);
boss->hit.back = TILES_TO_UNITS(1) + PIXELS_TO_UNITS(8);
@@ -174,7 +189,7 @@
case BALFROG_START:
boss->act_no = (BALFROG_START + 1);
- boss->ani_no = 3;
+ boss->ani_no = BALFANI_MOUTH_OPEN_CROUCHING;
boss->cond = NPCCOND_ALIVE;
boss->rect = rcRight[0];
@@ -186,7 +201,7 @@
gBoss[2].damage = 5;
for (i = 0; i < 8; ++i)
- SetNpChar(NPC_SMOKE, boss->x + PIXELS_TO_UNITS(Random(-12, 12)), boss->y + PIXELS_TO_UNITS(Random(-12, 12)), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+ SetNpChar(NPC_SMOKE, boss->x + PIXELS_TO_UNITS(Random(-12, 12)), boss->y + PIXELS_TO_UNITS(Random(-12, 12)), Random(-341, 341), Random(-PIXELS_TO_UNITS(3), 0), DIR_LEFT, NULL, 0x100);
break;
@@ -196,9 +211,9 @@
// Fallthrough
case BALFROG_FLICKER:
if (++boss->act_wait / 2 % 2)
- boss->ani_no = 3;
+ boss->ani_no = BALFANI_MOUTH_OPEN_CROUCHING;
else
- boss->ani_no = 0;
+ boss->ani_no = BALFANI_NOTHING;
break;
@@ -205,15 +220,15 @@
case BALFROG_WAIT:
boss->act_no = BALFROG_INITIALIZE_HOP_1;
boss->act_wait = 0;
- boss->ani_no = 1;
+ boss->ani_no = BALFANI_STANDING_STILL;
boss->xm = 0;
// Fallthrough
case BALFROG_INITIALIZE_HOP_1:
- if (++boss->act_wait > 50)
+ if (++boss->act_wait > SECONDS_TO_FRAMES(1))
{
boss->act_no = BALFROG_INITIALIZE_HOP_2;
boss->ani_wait = 0;
- boss->ani_no = 2;
+ boss->ani_no = BALFANI_MOUTH_BARELY_OPEN_CROUCHING;
}
break;
@@ -223,7 +238,7 @@
{
boss->act_no = BALFROG_HOP;
boss->ani_wait = 0;
- boss->ani_no = 1;
+ boss->ani_no = BALFANI_STANDING_STILL;
}
break;
@@ -232,11 +247,11 @@
if (++boss->ani_wait > 4)
{
boss->act_no = BALFROG_MIDAIR;
- boss->ani_no = 5;
+ boss->ani_no = BALFANI_JUMPING;
boss->ym = -PIXELS_TO_UNITS(2);
PlaySoundObject(25, 1);
- if (boss->direct == 0)
+ if (boss->direct == DIR_LEFT)
boss->xm = -PIXELS_TO_UNITS(1);
else
boss->xm = PIXELS_TO_UNITS(1);
@@ -248,71 +263,71 @@
break;
case BALFROG_MIDAIR:
- if (boss->direct == 0 && boss->flag & 1)
+ if (boss->direct == DIR_LEFT && boss->flag & COLL_LEFT_WALL)
{
- boss->direct = 2;
+ boss->direct = DIR_RIGHT;
boss->xm = PIXELS_TO_UNITS(1);
}
- if (boss->direct == 2 && boss->flag & 4)
+ if (boss->direct == DIR_RIGHT && boss->flag & COLL_RIGHT_WALL)
{
- boss->direct = 0;
+ boss->direct = DIR_LEFT;
boss->xm = -PIXELS_TO_UNITS(1);
}
- if (boss->flag & 8)
+ if (boss->flag & COLL_GROUND)
{
- PlaySoundObject(26, 1);
+ PlaySoundObject(SND_LARGE_OBJECT_HIT_GROUND, 1);
SetQuake(30);
- boss->act_no = 100;
- boss->ani_no = 1;
- boss->view.top = 0x6000;
- boss->view.bottom = 0x2000;
+ boss->act_no = BALFROG_WAIT;
+ boss->ani_no = BALFANI_STANDING_STILL;
+ boss->view.top = TILES_TO_UNITS(3);
+ boss->view.bottom = TILES_TO_UNITS(1);
- if (boss->direct == 0 && boss->x < gMC.x)
+ if (boss->direct == DIR_LEFT && boss->x < gMC.x)
{
- boss->direct = 2;
- boss->act_no = 110;
+ boss->direct = DIR_RIGHT;
+ boss->act_no = BALFROG_INITIALIZE_LAND;
}
- if (boss->direct == 2 && boss->x > gMC.x)
+ if (boss->direct == DIR_RIGHT && boss->x > gMC.x)
{
- boss->direct = 0;
- boss->act_no = 110;
+ boss->direct = DIR_LEFT;
+ boss->act_no = BALFROG_INITIALIZE_LAND;
}
- SetNpChar(110, Random(4, 16) * 0x2000, Random(0, 4) * 0x2000, 0, 0, 4, 0, 0x80);
+ SetNpChar(110, TILES_TO_UNITS(Random(4, 16)), TILES_TO_UNITS(Random(0, 4)), 0, 0, DIR_AUTO, NULL, 0x80);
for (i = 0; i < 4; ++i)
- SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + boss->hit.bottom, Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+ SetNpChar(NPC_SMOKE, boss->x + PIXELS_TO_UNITS(Random(-12, 12)), boss->y + boss->hit.bottom, Random(-341, 341), Random(-PIXELS_TO_UNITS(3), 0), DIR_LEFT, NULL, 0x100);
}
break;
- case 110:
- boss->ani_no = 1;
+ case BALFROG_INITIALIZE_LAND:
+ boss->ani_no = BALFANI_STANDING_STILL;
boss->act_wait = 0;
- boss->act_no = 111;
+ boss->act_no = BALFROG_LAND;
// Fallthrough
- case 111:
+ case BALFROG_LAND:
++boss->act_wait;
boss->xm = 8 * boss->xm / 9;
- if (boss->act_wait > 50)
+ if (boss->act_wait > SECONDS_TO_FRAMES(1))
{
- boss->ani_no = 2;
+ boss->ani_no = BALFANI_MOUTH_BARELY_OPEN_CROUCHING;
boss->ani_wait = 0;
- boss->act_no = 112;
+ boss->act_no = BALFROG_INITIALIZE_SHOOT;
}
break;
- case 112:
+ case BALFROG_INITIALIZE_SHOOT:
if (++boss->ani_wait > 4)
{
- boss->act_no = 113;
+ boss->act_no = BALFROG_SHOOT;
boss->act_wait = 0;
- boss->ani_no = 3;
+ boss->ani_no = BALFANI_MOUTH_OPEN_CROUCHING;
boss->count1 = 16;
gBoss[1].bits |= NPC_SHOOTABLE;
boss->tgt_x = boss->life;
@@ -320,18 +335,18 @@
break;
- case 113:
+ case BALFROG_SHOOT:
if (boss->shock)
{
if (boss->count2++ / 2 % 2)
- boss->ani_no = 4;
+ boss->ani_no = BALFANI_MOUTH_OPEN_CROUCHING_FLASHING;
else
- boss->ani_no = 3;
+ boss->ani_no = BALFANI_MOUTH_OPEN_CROUCHING;
}
else
{
boss->count2 = 0;
- boss->ani_no = 3;
+ boss->ani_no = BALFANI_MOUTH_OPEN_CROUCHING;
}
boss->xm = 10 * boss->xm / 11;
@@ -341,28 +356,28 @@
boss->act_wait = 0;
--boss->count1;
- if (boss->direct == 0)
- deg = GetArktan(boss->x - 0x4000 - gMC.x, boss->y - 0x1000 - gMC.y);
+ if (boss->direct == DIR_LEFT)
+ deg = GetArktan(boss->x - TILES_TO_UNITS(2) - gMC.x, boss->y - PIXELS_TO_UNITS(8) - gMC.y);
else
- deg = GetArktan(boss->x + 0x4000 - gMC.x, boss->y - 0x1000 - gMC.y);
+ deg = GetArktan(boss->x + TILES_TO_UNITS(2) - gMC.x, boss->y - PIXELS_TO_UNITS(8) - gMC.y);
- deg += (unsigned char)Random(-16, 16);
+ deg += (unsigned char)Random(-0x10, 0x10);
ym = GetSin(deg);
xm = GetCos(deg);
- if (boss->direct == 0)
- SetNpChar(108, boss->x - 0x4000, boss->y - 0x1000, xm, ym, 0, 0, 0x100);
+ if (boss->direct == DIR_LEFT)
+ SetNpChar(NPC_PROJECTILE_BALFROG_SPITBALL, boss->x - TILES_TO_UNITS(2), boss->y - PIXELS_TO_UNITS(8), xm, ym, DIR_LEFT, NULL, 0x100);
else
- SetNpChar(108, boss->x + 0x4000, boss->y - 0x1000, xm, ym, 0, 0, 0x100);
+ SetNpChar(NPC_PROJECTILE_BALFROG_SPITBALL, boss->x + TILES_TO_UNITS(2), boss->y - PIXELS_TO_UNITS(8), xm, ym, DIR_LEFT, NULL, 0x100);
- PlaySoundObject(39, 1);
+ PlaySoundObject(SND_ENEMY_SHOOT_PROJETILE, 1);
if (boss->count1 == 0 || boss->life < boss->tgt_x - 90)
{
- boss->act_no = 114;
+ boss->act_no = BALFROG_AFTER_SHOOT_WAIT;
boss->act_wait = 0;
- boss->ani_no = 2;
+ boss->ani_no = BALFANI_MOUTH_BARELY_OPEN_CROUCHING;
boss->ani_wait = 0;
gBoss[1].bits &= ~NPC_SHOOTABLE;
}
@@ -370,188 +385,188 @@
break;
- case 114:
+ case BALFROG_AFTER_SHOOT_WAIT:
if (++boss->ani_wait > 10)
{
if (++gBoss[1].count1 > 2)
{
gBoss[1].count1 = 0;
- boss->act_no = 120;
+ boss->act_no = BALFROG_INITIALIZE_LEAP_1;
}
else
{
- boss->act_no = 100;
+ boss->act_no = BALFROG_WAIT;
}
boss->ani_wait = 0;
- boss->ani_no = 1;
+ boss->ani_no = BALFANI_STANDING_STILL;
}
break;
- case 120:
- boss->act_no = 121;
+ case BALFROG_INITIALIZE_LEAP_1:
+ boss->act_no = BALFROG_INITIALIZE_LEAP_2;
boss->act_wait = 0;
- boss->ani_no = 1;
+ boss->ani_no = BALFANI_STANDING_STILL;
boss->xm = 0;
// Fallthrough
- case 121:
- if (++boss->act_wait > 50)
+ case BALFROG_INITIALIZE_LEAP_2:
+ if (++boss->act_wait > SECONDS_TO_FRAMES(1))
{
- boss->act_no = 122;
+ boss->act_no = BALFROG_INITIALIZE_LEAP_3;
boss->ani_wait = 0;
- boss->ani_no = 2;
+ boss->ani_no = BALFANI_MOUTH_BARELY_OPEN_CROUCHING;
}
break;
- case 122:
+ case BALFROG_INITIALIZE_LEAP_3:
if (++boss->ani_wait > 20)
{
- boss->act_no = 123;
+ boss->act_no = BALFROG_LEAP;
boss->ani_wait = 0;
- boss->ani_no = 1;
+ boss->ani_no = BALFANI_STANDING_STILL;
}
break;
- case 123:
+ case BALFROG_LEAP:
if (++boss->ani_wait > 4)
{
- boss->act_no = 124;
- boss->ani_no = 5;
- boss->ym = -0xA00;
- boss->view.top = 0x8000;
- boss->view.bottom = 0x3000;
- PlaySoundObject(25, 1);
+ boss->act_no = BALFROG_LEAP_MIDAIR;
+ boss->ani_no = BALFANI_JUMPING;
+ boss->ym = -PIXELS_TO_UNITS(5);
+ boss->view.top = TILES_TO_UNITS(4);
+ boss->view.bottom = TILES_TO_UNITS(1) + PIXELS_TO_UNITS(8);
+ PlaySoundObject(SND_SILLY_EXPLOSION, 1);
}
break;
- case 124:
- if (boss->flag & 8)
+ case BALFROG_LEAP_MIDAIR:
+ if (boss->flag & COLL_GROUND)
{
- PlaySoundObject(26, 1);
+ PlaySoundObject(SND_LARGE_OBJECT_HIT_GROUND, 1);
SetQuake(60);
- boss->act_no = 100;
- boss->ani_no = 1;
- boss->view.top = 0x6000;
- boss->view.bottom = 0x2000;
+ boss->act_no = BALFROG_WAIT;
+ boss->ani_no = BALFANI_STANDING_STILL;
+ boss->view.top = TILES_TO_UNITS(3);
+ boss->view.bottom = TILES_TO_UNITS(1);
for (i = 0; i < 2; ++i)
- SetNpChar(104, Random(4, 16) * 0x2000, Random(0, 4) * 0x2000, 0, 0, 4, 0, 0x80);
+ SetNpChar(NPC_ENEMY_FROG, TILES_TO_UNITS(Random(4, 16)), TILES_TO_UNITS(Random(0, 4)), 0, 0, DIR_AUTO, NULL, 0x80);
for (i = 0; i < 6; ++i)
- SetNpChar(110, Random(4, 16) * 0x2000, Random(0, 4) * 0x2000, 0, 0, 4, 0, 0x80);
+ SetNpChar(NPC_ENEMY_PUCHI, TILES_TO_UNITS(Random(4, 16)), TILES_TO_UNITS(Random(0, 4)), 0, 0, DIR_AUTO, NULL, 0x80);
for (i = 0; i < 8; ++i)
- SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + boss->hit.bottom, Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+ SetNpChar(NPC_SMOKE, boss->x + PIXELS_TO_UNITS(Random(-12, 12)), boss->y + boss->hit.bottom, Random(-341, 341), Random(-PIXELS_TO_UNITS(3), 0), DIR_LEFT, NULL, 0x100);
- if (boss->direct == 0 && boss->x < gMC.x)
+ if (boss->direct == DIR_LEFT && boss->x < gMC.x)
{
- boss->direct = 2;
- boss->act_no = 110;
+ boss->direct = DIR_RIGHT;
+ boss->act_no = BALFROG_INITIALIZE_LAND;
}
- if (boss->direct == 2 && boss->x > gMC.x)
+ if (boss->direct == DIR_RIGHT && boss->x > gMC.x)
{
- boss->direct = 0;
- boss->act_no = 110;
+ boss->direct = DIR_LEFT;
+ boss->act_no = BALFROG_INITIALIZE_LAND;
}
}
break;
- case 130:
- boss->act_no = 131;
- boss->ani_no = 3;
+ case BALFROG_DIE:
+ boss->act_no = BALFROG_DIE_FLASHING;
+ boss->ani_no = BALFANI_MOUTH_OPEN_CROUCHING;
boss->act_wait = 0;
boss->xm = 0;
- PlaySoundObject(72, 1);
+ PlaySoundObject(SND_EXPLOSION, 1);
for (i = 0; i < 8; ++i)
- SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+ SetNpChar(NPC_SMOKE, boss->x + PIXELS_TO_UNITS(Random(-12, 12)), boss->y + PIXELS_TO_UNITS(Random(-12, 12)), Random(-341, 341), Random(-PIXELS_TO_UNITS(3), 0), DIR_LEFT, NULL, 0x100);
gBoss[1].cond = 0;
gBoss[2].cond = 0;
// Fallthrough
- case 131:
+ case BALFROG_DIE_FLASHING:
if (++boss->act_wait % 5 == 0)
- SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+ SetNpChar(NPC_SMOKE, boss->x + PIXELS_TO_UNITS(Random(-12, 12)), boss->y + PIXELS_TO_UNITS(Random(-12, 12)), Random(-341, 341), Random(-PIXELS_TO_UNITS(3), 0), DIR_LEFT, NULL, 0x100);
if (boss->act_wait / 2 % 2)
- boss->x -= 0x200;
+ boss->x -= PIXELS_TO_UNITS(1);
else
- boss->x += 0x200;
+ boss->x += PIXELS_TO_UNITS(1);
- if (boss->act_wait > 100)
+ if (boss->act_wait > SECONDS_TO_FRAMES(2))
{
boss->act_wait = 0;
- boss->act_no = 132;
+ boss->act_no = BALFROG_REVERT;
}
break;
- case 132:
+ case BALFROG_REVERT:
if (++boss->act_wait / 2 % 2)
{
- boss->view.front = 0x2800;
- boss->view.top = 0x1800;
- boss->view.back = 0x2800;
- boss->view.bottom = 0x1800;
- boss->ani_no = 6;
+ boss->view.front = TILES_TO_UNITS(1) + PIXELS_TO_UNITS(8);
+ boss->view.top = PIXELS_TO_UNITS(12);
+ boss->view.back = TILES_TO_UNITS(1) + PIXELS_TO_UNITS(8);
+ boss->view.bottom = PIXELS_TO_UNITS(12);
+ boss->ani_no = BALFANI_BALROG_WHITE;
}
else
{
- boss->view.front = 0x6000;
- boss->view.top = 0x6000;
- boss->view.back = 0x4000;
- boss->view.bottom = 0x2000;
- boss->ani_no = 3;
+ boss->view.front = TILES_TO_UNITS(3);
+ boss->view.top = TILES_TO_UNITS(3);
+ boss->view.back = TILES_TO_UNITS(2);
+ boss->view.bottom = TILES_TO_UNITS(1);
+ boss->ani_no = BALFANI_MOUTH_OPEN_CROUCHING;
}
if (boss->act_wait % 9 == 0)
- SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+ SetNpChar(NPC_SMOKE, boss->x + PIXELS_TO_UNITS(Random(-12, 12)), boss->y + PIXELS_TO_UNITS(Random(-12, 12)), Random(-341, 341), Random(-PIXELS_TO_UNITS(3), 0), DIR_LEFT, NULL, 0x100);
- if (boss->act_wait > 150)
+ if (boss->act_wait > SECONDS_TO_FRAMES(3))
{
- boss->act_no = 140;
- boss->hit.bottom = 0x1800;
+ boss->act_no = BALFROG_NOP_START;
+ boss->hit.bottom = PIXELS_TO_UNITS(12);
}
break;
- case 140:
- boss->act_no = 141;
+ case BALFROG_NOP_START:
+ boss->act_no = BALFROG_NOP;
// Fallthrough
- case 141:
- if (boss->flag & 8)
+ case BALFROG_NOP:
+ if (boss->flag & COLL_GROUND)
{
- boss->act_no = 142;
+ boss->act_no = BALFROG_GO_INTO_CEILING;
boss->act_wait = 0;
- boss->ani_no = 7;
+ boss->ani_no = BALFANI_BALROG_CROUCHING;
}
break;
- case 142:
+ case BALFROG_GO_INTO_CEILING:
if (++boss->act_wait > 30)
{
- boss->ani_no = 8;
- boss->ym = -0xA00;
+ boss->ani_no = BALFANI_BALROG_JUMPING;
+ boss->ym = -PIXELS_TO_UNITS(5);
boss->bits |= NPC_IGNORE_SOLIDITY;
- boss->act_no = 143;
+ boss->act_no = BALFROG_GONE_INTO_CEILING;
}
break;
- case 143:
- boss->ym = -0xA00;
+ case BALFROG_GONE_INTO_CEILING:
+ boss->ym = -PIXELS_TO_UNITS(5);
if (boss->y < 0)
{
boss->cond = 0;
- PlaySoundObject(26, 1);
+ PlaySoundObject(SND_LARGE_OBJECT_HIT_GROUND, 1);
SetQuake(30);
}
@@ -559,13 +574,13 @@
}
boss->ym += 0x40;
- if (boss->ym > 0x5FF)
- boss->ym = 0x5FF;
+ if (boss->ym > (PIXELS_TO_UNITS(3) - 1))
+ boss->ym = (PIXELS_TO_UNITS(3) - 1);
boss->x += boss->xm;
boss->y += boss->ym;
- if (boss->direct == 0)
+ if (boss->direct == DIR_LEFT)
boss->rect = rcLeft[boss->ani_no];
else
boss->rect = rcRight[boss->ani_no];
--- a/src/CommonDefines.h
+++ b/src/CommonDefines.h
@@ -2,3 +2,30 @@
#define WINDOW_WIDTH 320
#define WINDOW_HEIGHT 240
+
+enum Direction
+{
+ DIR_LEFT = 0,
+ DIR_UP = 1,
+ DIR_RIGHT = 2,
+ DIR_DOWN = 3,
+ DIR_AUTO = 4
+};
+
+enum Collisions
+{
+ COLL_LEFT_WALL = 1, // Touching a left wall
+ COLL_CEILING = 2, // Touching a ceiling
+ COLL_RIGHT_WALL = 4, // Touching a right wall
+ COLL_GROUND = 8, // Touching the ground
+ // To be continued
+};
+
+#define TILES_TO_UNITS(x) ((x) * 0x2000)
+#define UNITS_TO_TILES(x) ((x) / 0x2000)
+#define TILES_TO_PIXELS(x) ((x) * 0x10)
+#define PIXELS_TO_TILES(x) ((x) / 0x10)
+#define PIXELS_TO_UNITS(x) ((x) * 0x200)
+#define UNITS_TO_PIXELS(x) ((x) / 0x200)
+#define SECONDS_TO_FRAMES(x) ((x) * 50)
+#define FRAMES_TO_SECONDS(x) ((x) / 50)
--- a/src/NpChar.h
+++ b/src/NpChar.h
@@ -39,7 +39,15 @@
NPC_ENEMY_BEHEMOTH = 2,
NPC_NULL_DELETES_ITSELF = 3,
NPC_SMOKE = 4,
- // To be finished later
+ // To be continued
+ NPC_ENEMY_FROG = 104,
+ NPC_SPEECH_BALLOON_HEY_LOW = 105,
+ NPC_SPEECH_BALLOON_HEY_HIGH = 106,
+ NPC_MALCO_UNDAMAGED = 107,
+ NPC_PROJECTILE_BALFROG_SPITBALL = 108,
+ NPC_MALCO_DAMAGED = 109,
+ NPC_ENEMY_PUCHI = 110,
+ // To be continued
};
struct NPCHAR
--- a/src/Sound.h
+++ b/src/Sound.h
@@ -23,3 +23,17 @@
void ChangeSoundVolume(int no, long volume);
void ChangeSoundPan(int no, long pan);
int MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no);
+
+enum SoundEffectNames
+{
+ // To be continued
+ SND_SILLY_EXPLOSION = 25,
+ SND_LARGE_OBJECT_HIT_GROUND = 26,
+ // To be continued
+ SND_ENEMY_SHOOT_PROJETILE = 39,
+ // To be continued
+ SND_BEHEMOTH_LARGE_HURT = 52,
+ // To be continued
+ SND_EXPLOSION = 72,
+ // To be continued
+};
--- a/src/Stage.h
+++ b/src/Stage.h
@@ -66,10 +66,3 @@
BOOL TransferStage(int no, int w, int x, int y);
void ChangeMusic(MusicID no);
void ReCallMusic();
-
-#define TILES_TO_UNITS(x) ((x) * 0x2000)
-#define UNITS_TO_TILES(x) ((x) / 0x2000)
-#define TILES_TO_PIXELS(x) ((x) * 0x10)
-#define PIXELS_TO_TILES(x) ((x) / 0x10)
-#define PIXELS_TO_UNITS(x) ((x) * 0x200)
-#define UNITS_TO_PIXELS(x) ((x) / 0x200)