Skip to content

Commit

Permalink
Balrog fires missiles now
Browse files Browse the repository at this point in the history
Moved player tiles in title/save screen, was getting clobbered
Pooh Black's bubbles weren't moving
Fix Quote sprite facing the wrong direction when teleporting
  • Loading branch information
andwn committed Feb 18, 2018
1 parent f836c1f commit 01ace50
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 90 deletions.
2 changes: 1 addition & 1 deletion inc/sheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ enum {
SHEET_FIRE, SHEET_MAPI, SHEET_MUCORE, SHEET_MUCORE2,SHEET_MUCORE3,SHEET_CAGE,
SHEET_BLADES, SHEET_NEMESV, SHEET_BLOCK, SHEET_BLOCKM, SHEET_ROCK, SHEET_CRYSTAL,
SHEET_BUTE, SHEET_BUTEARW,SHEET_ROLLING, SHEET_DELEET, SHEET_BONE, SHEET_DEVIL,
SHEET_BUTEDIE, SHEET_PLATF, SHEET_ROT, SHEET_TARGET,
SHEET_BUTEDIE, SHEET_PLATF, SHEET_ROT, SHEET_TARGET, SHEET_BLGMISL,
};

uint8_t sheet_num;
Expand Down
71 changes: 33 additions & 38 deletions src/ai/balrog.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ void ai_balrog_boss_msl(Entity *e) {
/* fallthrough */
case 1:
{
if (++e->timer > TIME(30)) {
if (++e->timer > TIME_8(30)) {
e->state = STATE_CHARGE;
e->timer2 ^= 1; // affects how we react if we miss the player
}
Expand All @@ -719,7 +719,7 @@ void ai_balrog_boss_msl(Entity *e) {
case STATE_CHARGE+1:
{
ANIMATE(e, 16, WALK1,STAND,WALK2,STAND);
e->x_speed += e->dir ? SPEED(0x20) : -SPEED(0x20);
e->x_speed += e->dir ? SPEED_8(0x20) : -SPEED_8(0x20);
//walking_animation(o);

// stuck against the wall?
Expand All @@ -732,12 +732,12 @@ void ai_balrog_boss_msl(Entity *e) {
//}
// he behaves differently after every other time he pauses
if (e->timer2) {
if (++e->timer > TIME(75)) {
if (++e->timer > TIME_8(75)) {
e->frame = STAND;
e->state = STATE_PAUSE;
}
} else {
if (++e->timer > TIME(24)) e->state = STATE_JUMP_FIRE;
if (++e->timer > TIME_8(24)) e->state = STATE_JUMP_FIRE;
}
}
break;
Expand All @@ -749,19 +749,22 @@ void ai_balrog_boss_msl(Entity *e) {
e->grounded = FALSE;
e->timer = 0;
e->frame = ARMSUP;
e->y_speed = -SPEED(0x5ff);
e->y_speed = -SPEED_12(0x5ff);
}
/* fallthrough */
case STATE_JUMP_FIRE+1:
{
FACE_PLAYER(e);
// fire missiles
if (++e->timer < 30) {
if ((e->timer % 6) == 1) {
if (++e->timer < TIME_8(30)) {
if ((e->timer & 7) == 1) {
sound_play(SND_EM_FIRE, 5);
//Entity *shot = SpawnEntityAtActionPoint(o, OBJ_BALROG_MISSILE);
//shot->dir = e->dir;
//shot->xinertia = 0x100;
Entity *shot = entity_create(e->x, e->y, OBJ_BALROG_MISSILE, 0);
shot->dir = e->dir;
shot->hit_box = (bounding_box) { 6,6,6,6 };
shot->display_box = (bounding_box) { 8,8,8,8 };
//shot->x_speed = SPEED_8(0xFF);
//if(shot->dir) shot->x_speed = -shot->x_speed;
}
}
// landed?
Expand Down Expand Up @@ -791,60 +794,52 @@ void ai_balrog_boss_msl(Entity *e) {
}
e->x = e->x_next;
e->y = e->y_next;
if(!e->grounded) e->y_speed += 0x20;
LIMIT_X(0x300);
LIMIT_Y(0x5ff);
if(!e->grounded) e->y_speed += SPEED_8(0x20);
LIMIT_X(SPEED_10(0x300));
LIMIT_Y(SPEED_12(0x5ff));
}

void ai_balrog_missile(Entity *e) {
if ((e->dir == 1 && collide_stage_rightwall(e)) ||
(e->dir == 0 && collide_stage_leftwall(e)))
{
//SmokeClouds(o, 3, 0, 0);
if ((e->dir && blk(e->x, 6, e->y, 0) == 0x41) ||
(!e->dir && blk(e->x, -6, e->y, 0) == 0x41)) {
SMOKE_AREA((e->x >> CSF) - 16, (e->y >> CSF) - 16, 32, 32, 3);
//effect(e->CenterX(), e->CenterY(), EFFECT_BOOMFLASH);
sound_play(SND_MISSILE_HIT, 5);

e->state = STATE_DELETE;
return;
}

if (e->state == 0)
{
if (e->state == 0) {
// recoil in oppisite direction
e->x_speed = random(-2, -1) << 9;
if (e->dir == 0) e->x_speed = -e->x_speed;

e->y_speed = random(-2, 0) << 9;
e->x_speed = SPEED_10(((random() & 1) - 2) << CSF);
if (!e->dir) e->x_speed = -e->x_speed;

e->y_speed = SPEED_10(((random() & 1) - 2) << CSF);
e->state = 1;
}

e->x_speed += e->dir ? 0x20 : -0x20;
e->x_speed += e->dir ? SPEED_8(0x20) : -SPEED_8(0x20);

//if ((++e->timer2 % 4) == 1)
//{
// effect(e->CenterX() - e->x_speed, e->CenterY(), EFFECT_SMOKETRAIL_SLOW);
//}

// heat-seeking at start, then level out straight
if (e->timer2 < 50)
{
if (e->y < player.y)
e->y_speed += 0x20;
else
e->y_speed -= 0x20;
}
else
{
if (e->timer2 < TIME_8(50)) {
if (e->y < player.y) e->y_speed += SPEED_8(0x20);
else e->y_speed -= SPEED_8(0x20);
} else {
e->y_speed = 0;
}

// flash
//e->frame ^= 1;

if (e->x_speed < -0x400)
e->x_speed = -0x600;
if (e->x_speed > 0x400)
e->x_speed = 0x600;
if (e->x_speed < -SPEED_12(0x400)) e->x_speed = -SPEED_12(0x600);
if (e->x_speed > SPEED_12(0x400)) e->x_speed = SPEED_12(0x600);

e->x += e->x_speed;
e->y += e->y_speed;
}
19 changes: 18 additions & 1 deletion src/ai/basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,20 +280,37 @@ void ai_teleIn(Entity *e) {
break;
case 3: break;
}
// Force a specific direction
switch(stageID) {
case STAGE_ARTHURS_HOUSE:
case STAGE_EGG_CORRIDOR:
case STAGE_GRASSTOWN:
case STAGE_LABYRINTH_M:
case STAGE_EGG_CORRIDOR_2:
e->dir = 1;
break;
case STAGE_GRASSTOWN_SHELTER:
case STAGE_SAND_ZONE:
case STAGE_SAND_ZONE_2:
case STAGE_LABYRINTH_A:
e->dir = 0;
break;
}
}

void onspawn_teleOut(Entity *e) {
e->y -= 32 << CSF;
SNAP_TO_GROUND(e);
// PAL was jumping too high here
if(IS_PALSYSTEM) e->y_speed = -0x360;
else e->y_speed = -SPEED(0x3E0);
else e->y_speed = -SPEED_10(0x3E0);
}

void ai_teleOut(Entity *e) {
switch(e->state) {
case 0: // Hopping up
{
e->dir = player.dir;
if(++e->timer >= TIME_8(20)) {
e->state++;
e->timer = 0;
Expand Down
Loading

0 comments on commit 01ace50

Please sign in to comment.