diff --git a/Makefile b/Makefile index 6161b58a..a8b33ca1 100644 --- a/Makefile +++ b/Makefile @@ -45,10 +45,12 @@ SOURCES = \ Boss \ BossAlmo1 \ BossAlmo2 \ + BossBallos \ BossFrog \ BossIronH \ BossLife \ BossOhm \ + BossPress \ BossTwinD \ BossX \ BulHit \ diff --git a/src/Boss.cpp b/src/Boss.cpp index eee22014..658cdb81 100644 --- a/src/Boss.cpp +++ b/src/Boss.cpp @@ -6,9 +6,11 @@ #include "Boss.h" #include "BossAlmo1.h" #include "BossAlmo2.h" +#include "BossBallos.h" #include "BossFrog.h" #include "BossIronH.h" #include "BossOhm.h" +#include "BossPress.h" #include "BossTwinD.h" #include "BossX.h" #include "NpChar.h" @@ -198,8 +200,8 @@ BOSSFUNCTION gpBossFuncTbl[10] = ActBossChar_Ironhead, ActBossChar_Twin, ActBossChar_Undead, - nullptr, //ActBossChar_Press, - nullptr, //ActBossChar_Ballos + ActBossChar_Press, + ActBossChar_Ballos }; void ActBossChar() diff --git a/src/BossBallos.cpp b/src/BossBallos.cpp new file mode 100644 index 00000000..3f8ccc6b --- /dev/null +++ b/src/BossBallos.cpp @@ -0,0 +1,673 @@ +#include "BossBallos.h" + +#include "Boss.h" +#include "Flash.h" +#include "Frame.h" +#include "Game.h" +#include "MyChar.h" +#include "MycParam.h" +#include "NpChar.h" +#include "Sound.h" + +static void ActBossChar_Eye(NPCHAR *npc) +{ + RECT rcLeft[5]; + RECT rcRight[5]; + + rcLeft[0] = {272, 0, 296, 16}; + rcLeft[1] = {272, 16, 296, 32}; + rcLeft[2] = {272, 32, 296, 48}; + rcLeft[3] = {0, 0, 0, 0}; + rcLeft[4] = {240, 16, 264, 32}; + + rcRight[0] = {296, 0, 320, 16}; + rcRight[1] = {296, 16, 320, 32}; + rcRight[2] = {296, 32, 320, 48}; + rcRight[3] = {0, 0, 0, 0}; + rcRight[4] = {240, 32, 264, 48}; + + switch (npc->act_no) + { + case 100: + npc->act_no = 101; + npc->ani_no = 0; + npc->ani_wait = 0; + // Fallthrough + case 101: + if (++npc->ani_wait > 2) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 2) + npc->act_no = 102; + + break; + + case 102: + npc->ani_no = 3; + break; + + case 200: + npc->act_no = 201; + npc->ani_no = 3; + npc->ani_wait = 0; + // Fallthrough + case 201: + if (++npc->ani_wait > 2) + { + npc->ani_wait = 0; + --npc->ani_no; + } + + if ( npc->ani_no <= 0 ) + npc->act_no = 202; + + break; + + case 300: + npc->act_no = 301; + npc->ani_no = 4; + + if (npc->direct == 0) + SetDestroyNpChar(npc->x - 0x800, npc->y, 0x800, 10); + else + SetDestroyNpChar(npc->x + 0x800, npc->y, 0x800, 10); + + break; + } + + if (npc->direct == 0) + npc->x = gBoss[0].x - 0x3000; + else + npc->x = gBoss[0].x + 0x3000; + + npc->y = gBoss[0].y - 0x4800; + + if (npc->act_no >= 0 && npc->act_no < 300) + { + if (npc->ani_no == 3) + npc->bits |= 0x20; + else + npc->bits &= ~0x20; + } + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; +} + +static void ActBossChar_Body(NPCHAR *npc) +{ + RECT rc[4]; + + rc[0] = {0, 0, 120, 120}; + rc[1] = {120, 0, 240, 120}; + rc[2] = {0, 120, 120, 240}; + rc[3] = {120, 120, 240, 240}; + + npc->x = gBoss[0].x; + npc->y = gBoss[0].y; + + npc->rect = rc[npc->ani_no]; +} + +static void ActBossChar_HITAI(NPCHAR *npc) +{ + npc->x = gBoss[0].x; + npc->y = gBoss[0].y - 0x5800; +} + +static void ActBossChar_HARA(NPCHAR *npc) +{ + npc->x = gBoss[0].x; + npc->y = gBoss[0].y; +} + +void ActBossChar_Ballos(void) +{ + static unsigned char flash; + + switch (gBoss[0].act_no) + { + case 0: + gBoss[0].act_no = 1; + gBoss[0].cond = 0x80; + gBoss[0].exp = 1; + gBoss[0].direct = 0; + gBoss[0].x = 0x28000; + gBoss[0].y = -0x8000; + gBoss[0].hit_voice = 54; + gBoss[0].hit.front = 0x4000; + gBoss[0].hit.top = 0x6000; + gBoss[0].hit.back = 0x4000; + gBoss[0].hit.bottom = 0x6000; + gBoss[0].bits = 0x8248; + gBoss[0].size = 3; + gBoss[0].damage = 0; + gBoss[0].code_event = 1000; + gBoss[0].life = 800; + + gBoss[1].cond = 0x90; + gBoss[1].direct = 0; + gBoss[1].bits = 8; + gBoss[1].life = 10000; + gBoss[1].view.front = 0x1800; + gBoss[1].view.top = 0; + gBoss[1].view.back = 0x1800; + gBoss[1].view.bottom = 0x2000; + gBoss[1].hit.front = 0x1800; + gBoss[1].hit.top = 0; + gBoss[1].hit.back = 0x1800; + gBoss[1].hit.bottom = 0x2000; + + gBoss[2] = gBoss[1]; + gBoss[2].direct = 2; + + gBoss[3].cond = 0x90; + gBoss[3].bits = 0xD; + gBoss[3].view.front = 0x7800; + gBoss[3].view.top = 0x7800; + gBoss[3].view.back = 0x7800; + gBoss[3].view.bottom = 0x7800; + gBoss[3].hit.front = 0x6000; + gBoss[3].hit.top = 0x3000; + gBoss[3].hit.back = 0x6000; + gBoss[3].hit.bottom = 0x4000; + + gBoss[4].cond = 0x90; + gBoss[4].bits = 0xD; + gBoss[4].hit.front = 0x4000; + gBoss[4].hit.top = 0x1000; + gBoss[4].hit.back = 0x4000; + gBoss[4].hit.bottom = 0x1000; + + gBoss[5].cond = 0x90; + gBoss[5].bits = 0x4C; + gBoss[5].hit.front = 0x4000; + gBoss[5].hit.top = 0; + gBoss[5].hit.back = 0x4000; + gBoss[5].hit.bottom = 0x6000; + break; + + case 100: + gBoss[0].act_no = 101; + gBoss[0].ani_no = 0; + gBoss[0].x = gMC.x; + SetNpChar(333, gMC.x, 0x26000, 0, 0, 2, 0, 0x100); + gBoss[0].act_wait = 0; + // Fallthrough + case 101: + if (++gBoss[0].act_wait > 30) + gBoss[0].act_no = 102; + + break; + + case 102: + gBoss[0].ym += 0x40; + if (gBoss[0].ym > 0xC00) + gBoss[0].ym = 0xC00; + + gBoss[0].y += gBoss[0].ym; + + if (gBoss[0].y > 0x26000 - gBoss[0].hit.bottom) + { + gBoss[0].y = 0x26000 - gBoss[0].hit.bottom; + gBoss[0].ym = 0; + gBoss[0].act_no = 103; + gBoss[0].act_wait = 0; + SetQuake2(30); + PlaySoundObject(44, 1); + + if ( gMC.y > gBoss[0].y + 0x6000 && gMC.x < gBoss[0].x + 0x3000 && gMC.x > gBoss[0].x - 0x3000 ) + DamageMyChar(16); + + for (int i = 0; i < 0x10; ++i) + SetNpChar(4, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + 0x5000, 0, 0, 0, 0, 0x100); + + if (gMC.flag & 8) + gMC.ym = -0x200; + } + + break; + + case 103: + if (++gBoss[0].act_wait == 50) + { + gBoss[0].act_no = 104; + gBoss[1].act_no = 100; + gBoss[2].act_no = 100; + } + + break; + + case 200: + gBoss[0].act_no = 201; + gBoss[0].count1 = 0; + // Fallthrough + case 201: + gBoss[0].act_no = 203; + gBoss[0].xm = 0; + ++gBoss[0].count1; + gBoss[0].hit.bottom = 0x6000; + gBoss[0].damage = 0; + + if (gBoss[0].count1 % 3) + gBoss[0].act_wait = 50; + else + gBoss[0].act_wait = 150; + // Fallthrough + case 203: + if (--gBoss[0].act_wait <= 0) + { + gBoss[0].act_no = 204; + gBoss[0].ym = -0xC00; + + if (gMC.x > gBoss[0].x) + gBoss[0].xm = 0x200; + else + gBoss[0].xm = -0x200; + } + + break; + + case 204: + if (gBoss[0].x < 0xA000) + gBoss[0].xm = 0x200; + if (gBoss[0].x > 0x44000) + gBoss[0].xm = -0x200; + + gBoss[0].ym += 0x55; + if (gBoss[0].ym > 0xC00) + gBoss[0].ym = 0xC00; + + gBoss[0].x += gBoss[0].xm; + gBoss[0].y += gBoss[0].ym; + + if (gBoss[0].y > 0x26000 - gBoss[0].hit.bottom) + { + gBoss[0].y = 0x26000 - gBoss[0].hit.bottom; + gBoss[0].ym = 0; + gBoss[0].act_no = 201; + gBoss[0].act_wait = 0; + + if (gMC.y > gBoss[0].y + 0x7000) + DamageMyChar(16); + + if (gMC.flag & 8) + gMC.ym = -0x200; + + SetQuake2(30); + PlaySoundObject(26, 1); + SetNpChar(332, gBoss[0].x - 0x1800, gBoss[0].y + 0x6800, 0, 0, 0, 0, 0x100); + SetNpChar(332, gBoss[0].x + 0x1800, gBoss[0].y + 0x6800, 0, 0, 2, 0, 0x100); + PlaySoundObject(44, 1); + + for (int i = 0; i < 0x10; ++i) + SetNpChar(4, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + 0x5000, 0, 0, 0, 0, 0x100); + } + + break; + + case 220: + gBoss[0].act_no = 221; + gBoss[0].life = 1200; + gBoss[1].act_no = 200; + gBoss[2].act_no = 200; + gBoss[0].xm = 0; + gBoss[0].ani_no = 0; + gBoss[0].shock = 0; + flash = 0; + // Fallthrough + case 221: + gBoss[0].ym += 0x40; + if (gBoss[0].ym > 0xC00) + gBoss[0].ym = 0xC00; + + gBoss[0].y += gBoss[0].ym; + + if (gBoss[0].y > 0x26000 - gBoss[0].hit.bottom) + { + gBoss[0].y = 0x26000 - gBoss[0].hit.bottom; + gBoss[0].ym = 0; + gBoss[0].act_no = 222; + gBoss[0].act_wait = 0; + SetQuake2(30); + PlaySoundObject(26, 1); + + for (int i = 0; i < 0x10; ++i) + SetNpChar(4, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + 0x5000, 0, 0, 0, 0, 0x100); + + if (gMC.flag & 8) + gMC.ym = -0x200; + } + + break; + + case 300: + gBoss[0].act_no = 301; + gBoss[0].act_wait = 0; + + for (int i = 0; i < 0x100; i += 0x40) + { + SetNpChar(342, gBoss[0].x, gBoss[0].y, 0, 0, i, gBoss, 0x5A); + SetNpChar(342, gBoss[0].x, gBoss[0].y, 0, 0, i + 544, gBoss, 0x5A); + } + + SetNpChar(343, gBoss[0].x, gBoss[0].y, 0, 0, 0, gBoss, 0x18); + SetNpChar(344, gBoss[0].x - 0x3000, gBoss[0].y - 0x4800, 0, 0, 0, gBoss, 0x20); + SetNpChar(344, gBoss[0].x + 0x3000, gBoss[0].y - 0x4800, 0, 0, 2, gBoss, 0x20); + // Fallthrough + case 301: + gBoss[0].y += (0x1C200 - gBoss[0].y) / 8; + + if (++gBoss[0].act_wait > 50) + { + gBoss[0].act_no = 310; + gBoss[0].act_wait = 0; + } + + break; + + case 311: + gBoss[0].direct = 0; + gBoss[0].xm = -0x3AA; + gBoss[0].ym = 0; + gBoss[0].x += gBoss[0].xm; + + if (gBoss[0].x < 0xDE00) + { + gBoss[0].x = 0xDE00; + gBoss[0].act_no = 312; + } + + break; + + case 312: + gBoss[0].direct = 1; + gBoss[0].ym = -0x3AA; + gBoss[0].xm = 0; + gBoss[0].y += gBoss[0].ym; + + if (gBoss[0].y < 0xDE00) + { + gBoss[0].y = 0xDE00; + gBoss[0].act_no = 313; + } + + break; + + case 313: + gBoss[0].direct = 2; + gBoss[0].xm = 0x3AA; + gBoss[0].ym = 0; + gBoss[0].x += gBoss[0].xm; + + if (gBoss[0].x > 0x40200) + { + gBoss[0].x = 0x40200; + gBoss[0].act_no = 314; + } + + if (gBoss[0].count1) + --gBoss[0].count1; + + if (gBoss[0].count1 == 0 && gBoss[0].x > 0x26000 && gBoss[0].x < 0x2A000) + gBoss[0].act_no = 400; + + break; + + case 314: + gBoss[0].direct = 3; + gBoss[0].ym = 0x3AA; + gBoss[0].xm = 0; + gBoss[0].y += gBoss[0].ym; + + if (gBoss[0].y > 0x1C200) + { + gBoss[0].y = 0x1C200; + gBoss[0].act_no = 311; + } + + break; + + case 400: + gBoss[0].act_no = 401; + gBoss[0].act_wait = 0; + gBoss[0].xm = 0; + gBoss[0].ym = 0; + DeleteNpCharCode(339, 0); + // Fallthrough + case 401: + gBoss[0].y += (0x13E00 - gBoss[0].y) / 8; + + if (++gBoss[0].act_wait > 50) + { + gBoss[0].act_wait = 0; + gBoss[0].act_no = 410; + + for (int i = 0; i < 0x100; i += 0x20) + SetNpChar(346, gBoss[0].x, gBoss[0].y, 0, 0, i, gBoss, 0x50); + + SetNpChar(343, gBoss[0].x, gBoss[0].y, 0, 0, 0, gBoss, 0x18); + SetNpChar(344, gBoss[0].x - 0x3000, gBoss[0].y - 0x4800, 0, 0, 0, gBoss, 0x20); + SetNpChar(344, gBoss[0].x + 0x3000, gBoss[0].y - 0x4800, 0, 0, 2, gBoss, 0x20); + } + + break; + + case 410: + if (++gBoss[0].act_wait > 50) + { + gBoss[0].act_wait = 0; + gBoss[0].act_no = 411; + } + + break; + + case 411: + if (++gBoss[0].act_wait % 30 == 1) + SetNpChar(348, (2 * (gBoss[0].act_wait / 30) + 2) << 13, 0x2A000, 0, 0, 0, 0, 0x180); + + if (gBoss[0].act_wait / 3 & 1) + PlaySoundObject(26, 1); + + if (gBoss[0].act_wait > 540) + gBoss[0].act_no = 420; + + break; + + case 420: + gBoss[0].act_no = 421; + gBoss[0].act_wait = 0; + gBoss[0].ani_wait = 0; + SetQuake2(30); + PlaySoundObject(35, 1); + gBoss[1].act_no = 102; + gBoss[2].act_no = 102; + + for (int i = 0; i < 0x100; ++i) + SetNpChar(4, gBoss[0].x + (Random(-60, 60) * 0x200), gBoss[0].y + (Random(-60, 60) * 0x200), 0, 0, 0, 0, 0); + // Fallthrough + case 421: + if (++gBoss[0].ani_wait > 500) + { + gBoss[0].ani_wait = 0; + gBoss[0].act_no = 422; + } + + break; + + case 422: + if (++gBoss[0].ani_wait > 200) + { + gBoss[0].ani_wait = 0; + gBoss[0].act_no = 423; + } + + break; + + case 423: + if (++gBoss[0].ani_wait > 20) + { + gBoss[0].ani_wait = 0; + gBoss[0].act_no = 424; + } + + break; + + case 424: + if (++gBoss[0].ani_wait > 200) + { + gBoss[0].ani_wait = 0; + gBoss[0].act_no = 425; + } + + break; + + case 425: + if (++gBoss[0].ani_wait > 500) + { + gBoss[0].ani_wait = 0; + gBoss[0].act_no = 426; + } + + break; + + case 426: + if (++gBoss[0].ani_wait > 200) + { + gBoss[0].ani_wait = 0; + gBoss[0].act_no = 427; + } + + break; + + case 427: + if (++gBoss[0].ani_wait > 20) + { + gBoss[0].ani_wait = 0; + gBoss[0].act_no = 428; + } + + break; + + case 428: + if (++gBoss[0].ani_wait > 200) + { + gBoss[0].ani_wait = 0; + gBoss[0].act_no = 421; + } + + break; + + case 1000: + gBoss[0].act_no = 1001; + gBoss[0].act_wait = 0; + gBoss[1].act_no = 300; + gBoss[2].act_no = 300; + gBoss[0].bits &= ~0x41; + gBoss[3].bits &= ~0x41; + gBoss[4].bits &= ~0x41; + gBoss[5].bits &= ~0x41; + // Fallthrough + case 1001: + if (++gBoss[0].act_wait % 12 == 0) + PlaySoundObject(44, 1); + + SetDestroyNpChar(gBoss[0].x + (Random(-60, 60) * 0x200), gBoss[0].y + (Random(-60, 60) * 0x200), 1, 1); + + if (gBoss[0].act_wait > 150) + { + gBoss[0].act_wait = 0; + gBoss[0].act_no = 1002; + SetFlash(gBoss[0].x, gBoss[0].y, 1); + PlaySoundObject(35, 1); + } + + break; + + case 1002: + SetQuake2(40); + + if (++gBoss[0].act_wait == 50) + { + gBoss[0].cond = 0; + gBoss[1].cond = 0; + gBoss[2].cond = 0; + gBoss[3].cond = 0; + gBoss[4].cond = 0; + gBoss[5].cond = 0; + DeleteNpCharCode(350, 1); + DeleteNpCharCode(348, 1); + } + + break; + } + + if (gBoss[0].act_no > 420 && gBoss[0].act_no < 500) + { + gBoss[3].bits |= 0x20; + gBoss[4].bits |= 0x20; + gBoss[5].bits |= 0x20; + + if (++gBoss[0].act_wait > 300) + { + gBoss[0].act_wait = 0; + + if (gMC.x > gBoss[0].x) + { + for (int i = 0; i < 8; ++i) + SetNpChar(350, ((Random(-4, 4) + 156) * 0x2000) / 4, (Random(8, 68) * 0x2000) / 4, 0, 0, 0, 0, 0x100); + } + else + { + for (int i = 0; i < 8; ++i) + SetNpChar(350, (Random(-4, 4) * 0x2000) / 4, (Random(8, 68) * 0x2000) / 4, 0, 0, 2, 0, 0x100); + } + } + + if (gBoss[0].act_wait == 270 || gBoss[0].act_wait == 280 || gBoss[0].act_wait == 290) + { + SetNpChar(353, gBoss[0].x, gBoss[0].y - 0x6800, 0, 0, 1, 0, 0x100); + PlaySoundObject(39, 1); + + for (int i = 0; i < 4; ++i) + SetNpChar(4, gBoss[0].x, gBoss[0].y - 0x6800, 0, 0, 0, 0, 0x100); + } + + if (gBoss[0].life > 500) + { + if (Random(0, 10) == 2) + SetNpChar(270, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + (Random(0, 40) * 0x200), 0, 0, 3, 0, 0); + } + else + { + if (Random(0, 4) == 2) + SetNpChar(270, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + (Random(0, 40) * 0x200), 0, 0, 3, 0, 0); + } + } + + if (gBoss[0].shock) + { + if ((++flash >> 1) & 1) + gBoss[3].ani_no = 0; + else + gBoss[3].ani_no = 1; + } + else + { + gBoss[3].ani_no = 0; + } + + if (gBoss[0].act_no > 420) + gBoss[3].ani_no += 2; + + ActBossChar_Eye(&gBoss[1]); + ActBossChar_Eye(&gBoss[2]); + ActBossChar_Body(&gBoss[3]); + ActBossChar_HITAI(&gBoss[4]); + ActBossChar_HARA(&gBoss[5]); +} \ No newline at end of file diff --git a/src/BossBallos.h b/src/BossBallos.h new file mode 100644 index 00000000..6ed874fe --- /dev/null +++ b/src/BossBallos.h @@ -0,0 +1,3 @@ +#pragma once + +void ActBossChar_Ballos(void); diff --git a/src/BossPress.cpp b/src/BossPress.cpp new file mode 100644 index 00000000..ab25ff95 --- /dev/null +++ b/src/BossPress.cpp @@ -0,0 +1,222 @@ +#include "BossPress.h" + +#include "Boss.h" +#include "Game.h" +#include "Map.h" +#include "Sound.h" +#include "WindowsWrapper.h" + +void ActBossChar_Press(void) +{ + switch (gBoss[0].act_no) + { + case 0: + gBoss[0].act_no = 10; + gBoss[0].cond = 0x80; + gBoss[0].exp = 1; + gBoss[0].direct = 2; + gBoss[0].x = 0; + gBoss[0].y = 0; + gBoss[0].view.front = 0x5000; + gBoss[0].view.top = 0x7800; + gBoss[0].view.back = 0x5000; + gBoss[0].view.bottom = 0x7800; + gBoss[0].hit_voice = 54; + gBoss[0].hit.front = 0x6200; + gBoss[0].hit.top = 0x7800; + gBoss[0].hit.back = 0x5000; + gBoss[0].hit.bottom = 0x6000; + gBoss[0].bits = 0x8248; + gBoss[0].size = 3; + gBoss[0].damage = 10; + gBoss[0].code_event = 1000; + gBoss[0].life = 700; + break; + + case 5: + gBoss[0].act_no = 6; + gBoss[0].x = 0; + gBoss[0].y = 0; + gBoss[1].cond = 0; + gBoss[2].cond = 0; + break; + + case 10: + gBoss[0].act_no = 11; + gBoss[0].x = 0x14000; + gBoss[0].y = 0x9400; + break; + + case 20: + gBoss[0].damage = 0; + gBoss[0].act_no = 21; + gBoss[0].x = 0x14000; + gBoss[0].y = 0x33A00; + gBoss[0].bits &= ~0x40; + gBoss[1].cond = 0; + gBoss[2].cond = 0; + // Fallthrough + case 21: + if ((++gBoss[0].act_wait & 0xF) == 0) + SetDestroyNpChar(gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + (Random(-60, 60) * 0x200), 1, 1); + + break; + + case 30: + gBoss[0].act_no = 31; + gBoss[0].ani_no = 2; + gBoss[0].x = 81920; + gBoss[0].y = 0x8000; + // Fallthrough + case 31: + gBoss[0].y += 0x800; + + if (gBoss[0].y >= 0x33A00) + { + gBoss[0].y = 0x33A00; + gBoss[0].ani_no = 0; + gBoss[0].act_no = 20; + PlaySoundObject(44, 1); + + for (int i = 0; i < 5; ++i) + SetNpChar(4, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + 0x7800, 0, 0, 0, 0, 0x100); + + } + + break; + + case 100: + gBoss[0].act_no = 101; + gBoss[0].count2 = 9; + gBoss[0].act_wait = -100; + + gBoss[1].cond = 0x80; + gBoss[1].hit.front = 0x1C00; + gBoss[1].hit.back = 0x1C00; + gBoss[1].hit.top = 0x1000; + gBoss[1].hit.bottom = 0x1000; + gBoss[1].bits = 12; + + gBoss[2] = gBoss[1]; + + gBoss[3].cond = 0x90; + gBoss[3].bits |= 0x20; + gBoss[3].hit.front = 0xC00; + gBoss[3].hit.back = 0xC00; + gBoss[3].hit.top = 0x1000; + gBoss[3].hit.bottom = 0x1000; + + SetNpChar(325, gBoss[0].x, gBoss[0].y + 0x7800, 0, 0, 0, 0, 0x100); + // Fallthrough + case 101: + if (gBoss[0].count2 > 1 && gBoss[0].life < 70 * gBoss[0].count2) + { + --gBoss[0].count2; + + for (int i = 0; i < 5; ++i) + { + ChangeMapParts(i + 8, gBoss[0].count2, 0); + SetDestroyNpChar((i + 8) * 0x2000, gBoss[0].count2 * 0x2000, 0, 4); + PlaySoundObject(12, 1); + } + } + + if (++gBoss[0].act_wait == 81 || gBoss[0].act_wait == 241) + SetNpChar(323, 0x6000, 0x1E000, 0, 0, 1, 0, 0x100); + + if (gBoss[0].act_wait == 1 || gBoss[0].act_wait == 161) + SetNpChar(323, 0x22000, 0x1E000, 0, 0, 1, 0, 0x100); + + if (gBoss[0].act_wait >= 300) + { + gBoss[0].act_wait = 0; + SetNpChar(325, gBoss[0].x, gBoss[0].y + 0x7800, 0, 0, 0, 0, 0x100); + } + + break; + + case 500: + gBoss[3].bits &= ~0x20; + + gBoss[0].act_no = 501; + gBoss[0].act_wait = 0; + gBoss[0].count1 = 0; + + DeleteNpCharCode(325, 1); + DeleteNpCharCode(330, 1); + // Fallthrough + case 501: + if ((++gBoss[0].act_wait & 0xF) == 0) + { + PlaySoundObject(12, 1); + SetDestroyNpChar(gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + (Random(-60, 60) * 0x200), 1, 1); + } + + if (gBoss[0].act_wait == 95) + gBoss[0].ani_no = 1; + if (gBoss[0].act_wait == 98) + gBoss[0].ani_no = 2; + + if (gBoss[0].act_wait > 100) + gBoss[0].act_no = 510; + break; + + case 510: + gBoss[0].ym += 0x40; + gBoss[0].damage = 0x7F; + gBoss[0].y += gBoss[0].ym; + + if (gBoss[0].count1 == 0 && gBoss[0].y > 0x14000) + { + gBoss[0].count1 = 1; + gBoss[0].ym = -0x200; + gBoss[0].damage = 0; + + for (int i = 0; i < 7; ++i) + { + ChangeMapParts(i + 7, 14, 0); + SetDestroyNpChar((i + 7) * 0x2000, 0x1C000, 0, 0); + PlaySoundObject(12, 1); + } + } + + if (gBoss[0].y > 0x3C000) + gBoss[0].act_no = 520; + + break; + } + + gBoss[1].x = gBoss[0].x - 0x3000; + gBoss[1].y = gBoss[0].y + 0x6800; + + gBoss[2].x = gBoss[0].x + 0x3000; + gBoss[2].y = gBoss[0].y + 0x6800; + + gBoss[3].x = gBoss[0].x; + gBoss[3].y = gBoss[0].y + 0x5000; + + RECT rc[3]; + RECT rcDamage[3]; + + rc[0] = {0, 0, 80, 120}; + rc[1] = {80, 0, 160, 120}; + rc[2] = {160, 0, 240, 120}; + + rcDamage[0] = {0, 120, 80, 240}; + rcDamage[1] = {80, 120, 160, 240}; + rcDamage[2] = {160, 120, 240, 240}; + + if (gBoss[0].shock) + { + static unsigned char flash; + + if ((++flash >> 1) & 1) + gBoss[0].rect = rc[gBoss[0].ani_no]; + else + gBoss[0].rect = rcDamage[gBoss[0].ani_no]; + } + else + { + gBoss[0].rect = rc[gBoss[0].ani_no]; + } +} \ No newline at end of file diff --git a/src/BossPress.h b/src/BossPress.h new file mode 100644 index 00000000..9d651720 --- /dev/null +++ b/src/BossPress.h @@ -0,0 +1,3 @@ +#pragma once + +void ActBossChar_Press(void); diff --git a/src/NpcAct280.cpp b/src/NpcAct280.cpp index 1ce3747f..e080f21f 100644 --- a/src/NpcAct280.cpp +++ b/src/NpcAct280.cpp @@ -1507,10 +1507,10 @@ void ActNpc295(NPCHAR *npc) npc->view.back = 0x2800; npc->view.front = 0x2800; break; - default: - break; } - //Fallthrough + + break; + case 1: npc->x += npc->xm; npc->y += npc->ym; @@ -1530,7 +1530,7 @@ void ActNpc296(NPCHAR *npc) if (++npc->act_wait > 16) { npc->act_wait = Random(0, 16); - int dir = Random(0, 100) % 4; + int dir = Random(0, 100) & 3; int pri; if (npc->direct) @@ -1551,7 +1551,7 @@ void ActNpc296(NPCHAR *npc) break; } - SetNpChar(295, npc->x, npc->y + (Random(-7, 7) << 13), 0, 0, dir + 4, 0, pri); + SetNpChar(295, npc->x, npc->y + (Random(-7, 7) * 0x2000), 0, 0, dir + 4, 0, pri); } else { @@ -1571,7 +1571,7 @@ void ActNpc296(NPCHAR *npc) break; } - SetNpChar(295, npc->x + (Random(-10, 10) << 13), npc->y, 0, 0, dir, 0, pri); + SetNpChar(295, npc->x + (Random(-10, 10) * 0x2000), npc->y, 0, 0, dir, 0, pri); } } }