From 97b8a3b4a29998e3d991d09eab8f838fa3795e92 Mon Sep 17 00:00:00 2001 From: cuckydev Date: Fri, 8 Feb 2019 18:29:55 -0500 Subject: [PATCH] Fortnite --- src/NpcAct.h | 11 ++- src/NpcAct280.cpp | 145 ++++++++++++++++++++++++++++++-- src/NpcAct300.cpp | 206 ++++++++++++++++++++++++++++++++++++++++++++++ src/NpcAct340.cpp | 113 +++++++++++++++++++++++++ src/NpcTbl.cpp | 20 ++--- 5 files changed, 478 insertions(+), 17 deletions(-) diff --git a/src/NpcAct.h b/src/NpcAct.h index 680cc57b..0729d1e9 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -284,12 +284,19 @@ void ActNpc278(NPCHAR *npc); void ActNpc292(NPCHAR *npc); +void ActNpc295(NPCHAR *npc); +void ActNpc296(NPCHAR *npc); +void ActNpc297(NPCHAR *npc); void ActNpc298(NPCHAR *npc); void ActNpc299(NPCHAR *npc); void ActNpc300(NPCHAR *npc); void ActNpc302(NPCHAR *npc); - +void ActNpc303(NPCHAR *npc); +void ActNpc304(NPCHAR *npc); +void ActNpc305(NPCHAR *npc); +void ActNpc306(NPCHAR *npc); +void ActNpc307(NPCHAR *npc); void ActNpc308(NPCHAR *npc); void ActNpc313(NPCHAR *npc); @@ -306,7 +313,9 @@ void ActNpc347(NPCHAR *npc); void ActNpc349(NPCHAR *npc); void ActNpc351(NPCHAR *npc); +void ActNpc352(NPCHAR *npc); void ActNpc355(NPCHAR *npc); void ActNpc359(NPCHAR *npc); +void ActNpc360(NPCHAR *npc); \ No newline at end of file diff --git a/src/NpcAct280.cpp b/src/NpcAct280.cpp index ed2bed7d..b64d9763 100644 --- a/src/NpcAct280.cpp +++ b/src/NpcAct280.cpp @@ -18,17 +18,150 @@ void ActNpc292(NPCHAR *npc) SetQuake(10); } +//Cloud +void ActNpc295(NPCHAR *npc) +{ + RECT rc[4]; + rc[0] = {0, 0, 208, 64}; + rc[1] = {32, 64, 144, 96}; + rc[2] = {32, 96, 104, 0x80}; + rc[3] = {104, 96, 144, 0x80}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->ani_no = npc->direct % 4; + switch (npc->direct) + { + case 0: + npc->ym = -1000; + npc->view.back = 0xD000; + npc->view.front = 0xD000; + break; + case 1: + npc->ym = -0x800; + npc->view.back = 0x7000; + npc->view.front = 0x7000; + break; + case 2: + npc->ym = -0x400; + npc->view.back = 0x4000; + npc->view.front = 0x4000; + break; + case 3: + npc->ym = -0x200; + npc->view.back = 0x2800; + npc->view.front = 0x2800; + break; + case 4: + npc->xm = -0x400; + npc->view.back = 0xD000; + npc->view.front = 0xD000; + break; + case 5: + npc->xm = -0x200; + npc->view.back = 0x7000; + npc->view.front = 0x7000; + break; + case 6: + npc->xm = -0x100; + npc->view.back = 0x4000; + npc->view.front = 0x4000; + break; + case 7: + npc->xm = -0x80; + npc->view.back = 0x2800; + npc->view.front = 0x2800; + break; + default: + break; + } + //Fallthrough + case 1: + npc->x += npc->xm; + npc->y += npc->ym; + if (npc->x < -0x8000) + npc->cond = 0; + if (npc->y < -0x4000) + npc->cond = 0; + break; + } + + npc->rect = rc[npc->ani_no]; +} + +//Cloud generator +void ActNpc296(NPCHAR *npc) +{ + if (++npc->act_wait > 16) + { + npc->act_wait = Random(0, 16); + int dir = Random(0, 100) % 4; + + int pri; + if (npc->direct) + { + switch (dir) + { + case 0: + pri = 0x80; + break; + case 1: + pri = 0x55; + break; + case 2: + pri = 0x40; + break; + case 3: + pri = 0x00; + break; + } + + SetNpChar(295, npc->x, npc->y + (Random(-7, 7) << 13), 0, 0, dir + 4, 0, pri); + } + else + { + switch (dir) + { + case 0: + pri = 0x180; + break; + case 1: + pri = 0x80; + break; + case 2: + pri = 0x40; + break; + case 3: + pri = 0x00; + break; + } + + SetNpChar(295, npc->x + (Random(-10, 10) << 13), npc->y, 0, 0, dir, 0, pri); + } + } +} + +//Sue in dragon's mouth +void ActNpc297(NPCHAR *npc) +{ + npc->x = npc->pNpc->x + 0x2000; + npc->y = npc->pNpc->y + 0x1000; + npc->rect = {112, 48, 0x80, 64}; +} + //Doctor (opening) void ActNpc298(NPCHAR *npc) { RECT rc[8]; - rc[0] = {72, 128, 88, 160}; - rc[1] = {88, 128, 104, 160}; - rc[2] = {104, 128, 120, 160}; - rc[3] = {72, 128, 88, 160}; - rc[4] = {120, 128, 136, 160}; - rc[5] = {72, 128, 88, 160}; + rc[0] = {72, 0x80, 88, 160}; + rc[1] = {88, 0x80, 104, 160}; + rc[2] = {104, 0x80, 120, 160}; + rc[3] = {72, 0x80, 88, 160}; + rc[4] = {120, 0x80, 136, 160}; + rc[5] = {72, 0x80, 88, 160}; rc[6] = {104, 160, 120, 192}; rc[7] = {120, 160, 136, 192}; diff --git a/src/NpcAct300.cpp b/src/NpcAct300.cpp index ef556d34..7783deae 100644 --- a/src/NpcAct300.cpp +++ b/src/NpcAct300.cpp @@ -103,6 +103,212 @@ void ActNpc302(NPCHAR *npc) } } +//Curly's machine gun +void ActNpc303(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + + rcLeft[0] = {216, 152, 232, 168}; + rcLeft[1] = {232, 152, 248, 168}; + rcRight[0] = {216, 168, 232, 184}; + rcRight[1] = {232, 168, 248, 184}; + + if (npc->pNpc) + { + //Set position + if (npc->pNpc->direct) + { + npc->direct = 2; + npc->x = npc->pNpc->x + 0x1000; + } + else + { + npc->direct = 0; + npc->x = npc->pNpc->x - 0x1000; + } + npc->y = npc->pNpc->y; + + //Animation + npc->ani_no = 0; + if (npc->pNpc->ani_no == 3 || npc->pNpc->ani_no == 5) + npc->y -= 0x200; + + //Set framerect + if (npc->direct) + npc->rect = rcRight[npc->ani_no]; + else + npc->rect = rcLeft[npc->ani_no]; + } +} + +//Gaudi in hospital +void ActNpc304(NPCHAR *npc) +{ + RECT rc[4]; + rc[0] = {0, 176, 24, 192}; + rc[1] = {24, 176, 48, 192}; + rc[2] = {48, 176, 72, 192}; + rc[3] = {72, 176, 96, 192}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->y += 5120; + //Fallthrough + case 1: + npc->ani_no = 0; + break; + case 10: + npc->ani_no = 1; + break; + case 20: + npc->act_no = 21; + npc->ani_no = 2; + //Fallthrough + case 21: + if (++npc->ani_wait > 10) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 3) + npc->ani_no = 2; + break; + default: + break; + } + + npc->rect = rc[npc->ani_no]; +} + +//Small puppy +void ActNpc305(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + + rcLeft[0] = {160, 144, 176, 160}; + rcLeft[1] = {176, 144, 192, 160}; + rcRight[0] = {160, 160, 176, 176}; + rcRight[1] = {176, 160, 192, 176}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->y -= 0x2000; + npc->ani_wait = Random(0, 6); + //Fallthrough + + case 1: + if (++npc->ani_wait > 6) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + npc->ani_no = 0; + break; + } + + if (npc->direct) + npc->rect = rcRight[npc->ani_no]; + else + npc->rect = rcLeft[npc->ani_no]; +} + +//Balrog (nurse) +void ActNpc306(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + rcLeft[0] = {240, 96, 280, 128}; + rcLeft[1] = {280, 96, 320, 128}; + rcRight[0] = {160, 152, 200, 184}; + rcRight[1] = {200, 152, 240, 184}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->ani_no = 0; + npc->ani_wait = 0; + npc->y += 0x800; + //Fallthrough + case 1: + if (Random(0, 120) == 10) + { + npc->act_no = 2; + npc->act_wait = 0; + npc->ani_no = 1; + } + break; + case 2: + if (++npc->act_wait > 8) + { + npc->act_no = 1; + npc->ani_no = 0; + } + break; + } + + if (npc->direct) + npc->rect = rcRight[npc->ani_no]; + else + npc->rect = rcLeft[npc->ani_no]; +} + +//Caged Santa +void ActNpc307(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + rcLeft[0] = {0, 32, 16, 48}; + rcLeft[1] = {16, 32, 32, 48}; + rcRight[0] = {0, 48, 16, 64}; + rcRight[1] = {16, 48, 32, 64}; + + switch (npc->act_no) + { + case 0: + npc->x += 0x200; + npc->y -= 0x400; + npc->act_no = 1; + npc->ani_no = 0; + npc->ani_wait = 0; + //Fallthrough + case 1: + if (Random(0, 160) == 1) + { + npc->act_no = 2; + npc->act_wait = 0; + npc->ani_no = 1; + } + break; + case 2: + if (++npc->act_wait > 12) + { + npc->act_no = 1; + npc->ani_no = 0; + } + break; + } + + if (gMC.x >= npc->x) + npc->direct = 2; + else + npc->direct = 0; + + if (npc->direct) + npc->rect = rcRight[npc->ani_no]; + else + npc->rect = rcLeft[npc->ani_no]; +} + //Stumpy void ActNpc308(NPCHAR *npc) { diff --git a/src/NpcAct340.cpp b/src/NpcAct340.cpp index 3101641d..012fedd1 100644 --- a/src/NpcAct340.cpp +++ b/src/NpcAct340.cpp @@ -168,6 +168,106 @@ void ActNpc351(NPCHAR *npc) npc->rect = rc[npc->ani_no]; } +//Ending characters +void ActNpc352(NPCHAR *npc) +{ + switch (npc->act_no) + { + case 0: + //Set state + npc->act_no = 1; + npc->ani_no = 0; + npc->count1 = npc->direct / 100; + npc->direct %= 100; + + //Set surfaces / offset + switch (npc->count1) + { + case 7: + case 8: + case 9: + case 12: + case 13: + npc->surf = 21; + break; + default: + break; + } + + switch (npc->count1) + { + case 2: + case 4: + case 9: + case 12: + npc->view.top = 0x2000; + break; + default: + break; + } + + //Balrog + if (npc->count1 == 9) + { + npc->view.back = 0x2800; + npc->view.front = 0x2800; + npc->x -= 0x200; + } + + //Spawn King's sword + if (!npc->count1) + SetNpChar(145, 0, 0, 0, 0, 2, npc, 0x100); + //Fallthrough + case 1: + npc->ym += 0x40; + if (npc->ym > 0x5FF) + npc->ym = 0x5FF; + + if (npc->flag & 8) + { + npc->ym = 0; + npc->act_no = 2; + npc->ani_no = 1; + } + + npc->y += npc->ym; + break; + } + + static RECT rc[28] = { + {304, 48, 320, 64}, + {224, 48, 240, 64}, + {32, 80, 48, 96}, + {0, 80, 16, 96}, + {224, 216, 240, 240}, + {192, 216, 208, 240}, + {48, 16, 64, 32}, + {0, 16, 16, 32}, + {112, 192, 128, 216}, + {80, 192, 96, 216}, + {304, 0, 320, 16}, + {224, 0, 240, 16}, + {176, 32, 192, 48}, + {176, 32, 192, 48}, + {240, 16, 256, 32}, + {224, 16, 240, 32}, + {208, 16, 224, 32}, + {192, 16, 208, 32}, + {280, 128, 320, 152}, + {280, 152, 320, 176}, + {32, 112, 48, 128}, + {0, 112, 16, 128}, + {80, 0, 96, 16}, + {112, 0, 128, 16}, + {16, 152, 32, 176}, + {0, 152, 16, 176}, + {48, 16, 64, 32}, + {48, 0, 64, 16} + }; + + npc->rect = rc[npc->ani_no + 2 * npc->count1]; +} + //Quote and Curly on Balrog's back void ActNpc355(NPCHAR *npc) { @@ -221,3 +321,16 @@ void ActNpc359(NPCHAR *npc) if (gMC.x < npc->x + (((WINDOW_WIDTH / 2) + 160) * 0x200) && gMC.x > npc->x - (((WINDOW_WIDTH / 2) + 160) * 0x200) && gMC.y < npc->y + (((WINDOW_HEIGHT / 2) + 200) * 0x200) && gMC.y > npc->y - (((WINDOW_HEIGHT / 2) + 40) * 0x200) && Random(0, 100) == 2) SetNpChar(73, npc->x + (Random(-6, 6) * 0x200), npc->y - 0xE00, 0, 0, 0, 0, 0); } + +//Thank you +void ActNpc360(NPCHAR *npc) +{ + if (!npc->act_no) + { + ++npc->act_no; + npc->x -= 0x1000; + npc->y -= 0x1000; + } + + npc->rect = {0, 176, 48, 184}; +} diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index de290dbd..6ad4b126 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -351,19 +351,19 @@ NPCFUNCTION gpNpcFuncTbl[361] = ActNpc292, nullptr, nullptr, - nullptr, - nullptr, - nullptr, + ActNpc295, + ActNpc296, + ActNpc297, ActNpc298, ActNpc299, ActNpc300, nullptr, ActNpc302, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, + ActNpc303, + ActNpc304, + ActNpc305, + ActNpc306, + ActNpc307, ActNpc308, nullptr, nullptr, @@ -408,7 +408,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = ActNpc349, nullptr, ActNpc351, - nullptr, + ActNpc352, nullptr, nullptr, ActNpc355, @@ -416,5 +416,5 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, ActNpc359, - nullptr, + ActNpc360, };