Skip to content

Commit

Permalink
Fix Nemesis, Misery black lightning, Undead Core power shot
Browse files Browse the repository at this point in the history
  • Loading branch information
andwn committed Feb 19, 2018
1 parent d435f0b commit ff0181b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 35 deletions.
58 changes: 29 additions & 29 deletions src/ai/coreu.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void ai_undead_core(Entity *e) {
e->timer++;

if (e->dir || e->frame > 0 || e->health < 200) {
if (e->timer > TIME(200)) {
if (e->timer > TIME_8(200)) {
e->timer2++;
sound_play(SND_CORE_THRUST, 5);

Expand Down Expand Up @@ -176,15 +176,15 @@ void ai_undead_core(Entity *e) {
e->timer++;
RunHurtFlash(e->timer);

if (e->timer < TIME(300)) {
if ((e->timer % TIME(120)) == 0) {
if (e->timer < TIME_10(300)) {
if ((e->timer % TIME_8(120)) == 0) {
SpawnPellet(1);
} else if ((e->timer % TIME(120)) == TIME(60)) {
} else if ((e->timer % TIME_8(120)) == TIME_8(60)) {
SpawnPellet(0);
}
}

if (e->timer > TIME(400) || (e->savedhp - e->health) > 50) {
if (e->timer > TIME_10(400) || (e->savedhp - e->health) > 50) {
e->state = CR_FaceClosed;
}
}
Expand Down Expand Up @@ -221,7 +221,7 @@ void ai_undead_core(Entity *e) {
//CreateSpinner(x, y);
}

if (e->timer > TIME(400) || (e->savedhp - e->health) > 150 || e->health < 200) {
if (e->timer > TIME_10(400) || (e->savedhp - e->health) > 150 || e->health < 200) {
e->state = CR_FaceClosed;
}
}
Expand Down Expand Up @@ -253,9 +253,9 @@ void ai_undead_core(Entity *e) {
e->timer++;
RunHurtFlash(e->timer);

if ((e->timer % TIME(120)) == 0) {
if ((e->timer % TIME_8(120)) == 0) {
SpawnPellet(1);
} else if ((e->timer % TIME(120)) == TIME(60)) {
} else if ((e->timer % TIME_8(120)) == TIME_8(60)) {
SpawnPellet(0);
}
}
Expand Down Expand Up @@ -283,13 +283,13 @@ void ai_undead_core(Entity *e) {
e->jump_time++;

// upper platforms
if (e->jump_time == TIME(75)) {
if (e->jump_time == TIME_8(75)) {
entity_create(block_to_sub(stageWidth) + 40,
block_to_sub(1 + (random() & 3)), OBJ_UDMINI_PLATFORM, 0);
}

// lower platforms
if (e->jump_time == TIME(150)) {
if (e->jump_time == TIME_8(150)) {
e->jump_time = 0;
entity_create(block_to_sub(stageWidth) + 40,
block_to_sub(10 + (random() % 5)), OBJ_UDMINI_PLATFORM, 0);
Expand All @@ -300,8 +300,8 @@ void ai_undead_core(Entity *e) {
break;
}

LIMIT_X(SPEED(0x80));
LIMIT_Y(SPEED(0x80));
LIMIT_X(SPEED_8(0x80));
LIMIT_Y(SPEED_8(0x80));

e->x += e->x_speed;
e->y += e->y_speed;
Expand Down Expand Up @@ -367,7 +367,7 @@ static uint8_t RunDefeated(Entity *e) {
e->x_speed = 0x40;
e->y_speed = 0x80;

if (++e->timer > TIME(200)) {
if (++e->timer > TIME_8(200)) {
e->state = CR_Exploding;
e->x_speed = 0;
e->y_speed = 0;
Expand All @@ -390,7 +390,7 @@ static uint8_t RunDefeated(Entity *e) {
//SmokePuff(x, y);
//effect(x, y, EFFECT_BOOMFLASH);

if (e->timer > TIME(100)) {
if (e->timer > TIME_8(100)) {
sound_play(SND_EXPLOSION1, 5);
SCREEN_FLASH(30);
// Delete this stuff now while the screen is white
Expand All @@ -409,7 +409,7 @@ static uint8_t RunDefeated(Entity *e) {
case CR_Exploding+1:
{
camera_shake(40);
if (++e->timer > TIME(5)) {
if (++e->timer > TIME_8(5)) {
e->state = STATE_DELETE;
bossEntity = NULL;

Expand Down Expand Up @@ -459,10 +459,10 @@ void ai_undead_core_face(Entity *e) {
{
e->eflags |= NPC_SHOOTABLE;

if (++e->timer > TIME(300))
if (++e->timer > TIME_10(300))
e->timer = 0;

if (e->timer > TIME(250)) {
if (e->timer > TIME_8(250)) {
if ((e->timer & 31) == 1)
sound_play(SND_QUAKE, 5);

Expand All @@ -472,10 +472,10 @@ void ai_undead_core_face(Entity *e) {
}
}

if (e->timer == TIME(200))
if (e->timer == TIME_8(200))
sound_play(SND_CORE_CHARGE, 5);

if (e->timer >= TIME(200)) { //&& (e->timer & 1))
if (e->timer >= TIME_8(200)) { //&& (e->timer & 1))
e->frame = 3; // mouth lit
} else {
e->frame = 2; // mouth norm
Expand Down Expand Up @@ -660,8 +660,8 @@ void ai_udmini_platform(Entity *e) {
e->state = 1;
e->y_mark = e->y;

e->x_speed = -SPEED(0x200);
e->y_speed = SPEED(0x100);
e->x_speed = -SPEED_10(0x200);
e->y_speed = SPEED_10(0x100);
if (random() & 1) e->y_speed = -e->y_speed;
} /* fallthrough */
case 1:
Expand All @@ -670,7 +670,7 @@ void ai_udmini_platform(Entity *e) {

if (e->y > e->y_mark) e->y_speed -= 0x10;
if (e->y < e->y_mark) e->y_speed += 0x10;
LIMIT_Y(SPEED(0x100));
LIMIT_Y(SPEED_8(0xFF));

// when player jumps on them, they open up and start
// moving their Y to align with the core.
Expand Down Expand Up @@ -731,19 +731,19 @@ void ai_ud_pellet(Entity *e) {
switch(e->state) {
case 0:
{
e->x_speed = -SPEED(0x200);
e->x_speed = -SPEED_10(0x200);
e->state = 1;
} /* fallthrough */
case 1: // falling
{
if (e->eflags & NPC_OPTION2) {
e->y_speed -= SPEED(0x20);
LIMIT_Y(SPEED(0x5ff));
e->y_speed -= SPEED_8(0x20);
LIMIT_Y(SPEED_12(0x5ff));

if (blk(e->x, 0, e->y, -4) == 0x41) e->state = 2;
} else {
e->y_speed += SPEED(0x20);
LIMIT_Y(SPEED(0x5ff));
e->y_speed += SPEED_8(0x20);
LIMIT_Y(SPEED_12(0x5ff));

if (blk(e->x, 0, e->y, 4) == 0x41) e->state = 2;
}
Expand All @@ -755,7 +755,7 @@ void ai_ud_pellet(Entity *e) {
case 2: // hit ground/ceiling
{
sound_play(SND_MISSILE_HIT, 5);
e->x_speed = (e->x > player.x) ? -SPEED(0x400) : SPEED(0x400);
e->x_speed = (e->x > player.x) ? -SPEED_10(0x3FF) : SPEED_10(0x3FF);
e->y_speed = 0;

e->state = 3;
Expand Down Expand Up @@ -856,7 +856,7 @@ void ai_ud_spinner_trail(Entity *e)
}
*/
void ai_ud_blast(Entity *e) {
e->x += -SPEED(0x1000);
e->x += -SPEED_12(0xFFF);
//e->frame ^= 1;

//SmokePuff(e->CenterX() + (random(0, 16) << CSF),
Expand Down
4 changes: 2 additions & 2 deletions src/ai/misery.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ void ai_misery_ball(Entity *e) {
if (PLAYER_DIST_X(8<<CSF) && player.y > e->y) {
e->state = 10;
e->timer = 0;
} else if(++e->timer > TIME(750)) {
} else if(++e->timer > TIME_10(750)) {
effect_create_smoke(e->x >> CSF, e->y >> CSF);
e->state = STATE_DELETE;
}
Expand Down Expand Up @@ -652,5 +652,5 @@ void ai_black_lightning(Entity *e) {
effect_create_smoke(e->x >> CSF, e->y >> CSF);
e->state = STATE_DELETE;
}
e->y += SPEED(0x1000);
e->y += SPEED_12(0xFFF);
}
4 changes: 2 additions & 2 deletions src/sheet.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void sheets_load_weapon(Weapon *w) {
case WEAPON_NEMESIS:
SHEET_ADD(SHEET_NEMES, w->level == 1 ? &SPR_NemB1h
: w->level == 2 ? &SPR_NemB2h
: &SPR_NemB3h, 2,3,2, 0,0, 1,0);
: &SPR_NemB3h, 2,3,2, 0,0, 0,1);
SHEET_LOAD(w->level == 1 ? &SPR_NemB1v
: w->level == 2 ? &SPR_NemB2v
: &SPR_NemB3v, 2,6, TILE_NEMINDEX, 1);
Expand Down Expand Up @@ -128,7 +128,7 @@ void sheets_refresh_weapon(Weapon *w) {
case WEAPON_NEMESIS:
SHEET_MOD(SHEET_NEMES, w->level == 1 ? &SPR_NemB1h
: w->level == 2 ? &SPR_NemB2h
: &SPR_NemB3h, 2,3,2, 0,0, 1,0);
: &SPR_NemB3h, 2,3,2, 0,0, 0,1);
SHEET_LOAD(w->level == 1 ? &SPR_NemB1v
: w->level == 2 ? &SPR_NemB2v
: &SPR_NemB3v, 2,6, TILE_NEMINDEX, 1);
Expand Down
8 changes: 6 additions & 2 deletions src/weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ void weapon_fire_nemesis(Weapon *w) {
b->sprite.size = SPRITE_SIZE(3, 2);
b->sprite.attribut = TILE_ATTR_FULL(PAL0,0,0,(b->dir&1),sheets[w->sheet].index);
b->x = player.x + ((b->dir&1) ? pixel_to_sub(12) : -pixel_to_sub(12));
b->y = player.y + pixel_to_sub(3);
b->y = player.y + pixel_to_sub(1);
b->x_speed = ((b->dir&1) ? speed : -speed);
b->y_speed = 0;
b->hit_box = (bounding_box) { 5, 3, 5, 3 };
Expand All @@ -421,7 +421,7 @@ void weapon_fire_nemesis(Weapon *w) {
case DOWN:
b->sprite.size = SPRITE_SIZE(2, 3);
b->sprite.attribut = TILE_ATTR_FULL(PAL0,0,(b->dir&1),0,TILE_NEMINDEX);
b->x = player.x;
b->x = player.x - (4<<CSF);
b->y = player.y + ((b->dir&1) ? pixel_to_sub(12) : -pixel_to_sub(12));
b->x_speed = 0;
b->y_speed = ((b->dir&1) ? speed : -speed);
Expand Down Expand Up @@ -790,6 +790,7 @@ void bullet_missile_explode(Bullet *b) {
b->y_speed = 0;
b->ttl = 8;
b->damage = 1 + b->level;
if(b->type == WEAPON_SUPERMISSILE) b->damage += b->level;
b->hit_box = (bounding_box) { 12, 12, 12, 12 };
for(uint8_t i = b->level; i < 4; i++) {
effect_create_smoke(sub_to_pixel(b->x) - 10 + (random() % 20),
Expand Down Expand Up @@ -821,9 +822,11 @@ static void create_blade_slash(Bullet *b, uint8_t burst) {
if((b->ttl & 15) == 0) {
slash = &playerBullet[1];
slash->dir = LEFT;
slash->dir &= ~2;
} else if((b->ttl & 15) == 4) {
slash = &playerBullet[2];
slash->dir = RIGHT;
slash->dir &= ~2;
} else if((b->ttl & 15) == 8) {
slash = &playerBullet[3];
slash->dir = LEFT;
Expand All @@ -837,6 +840,7 @@ static void create_blade_slash(Bullet *b, uint8_t burst) {
if((b->ttl & 15) == 0) {
slash = &playerBullet[1];
slash->dir = b->dir;
slash->dir &= ~2;
} else if((b->ttl & 15) == 8) {
slash = &playerBullet[2];
slash->dir = b->dir;
Expand Down

0 comments on commit ff0181b

Please sign in to comment.