From 9be37f62e0944b48912bc71e44a2ec2c5050eead Mon Sep 17 00:00:00 2001 From: Clownacy Date: Sun, 3 Feb 2019 20:54:40 +0000 Subject: [PATCH] Added NPC 111 and 112 (teleporting Quote) --- src/NpcAct.h | 3 + src/NpcAct100.cpp | 162 ++++++++++++++++++++++++++++++++++++++++++++++ src/NpcTbl.cpp | 4 +- 3 files changed, 167 insertions(+), 2 deletions(-) diff --git a/src/NpcAct.h b/src/NpcAct.h index 4fb4900e..8f1a684b 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -85,6 +85,9 @@ void ActNpc090(NPCHAR *npc); void ActNpc091(NPCHAR *npc); void ActNpc092(NPCHAR *npc); +void ActNpc111(NPCHAR *npc); +void ActNpc112(NPCHAR *npc); + void ActNpc116(NPCHAR *npc); void ActNpc119(NPCHAR *npc); diff --git a/src/NpcAct100.cpp b/src/NpcAct100.cpp index 43a1cb9f..c9b9660f 100644 --- a/src/NpcAct100.cpp +++ b/src/NpcAct100.cpp @@ -9,6 +9,168 @@ #include "Back.h" #include "Triangle.h" +//Quote (teleport out) +void ActNpc111(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + + rcLeft[0] = {0, 0, 16, 16}; + rcLeft[1] = {16, 0, 32, 16}; + + rcRight[0] = {0, 16, 16, 32}; + rcRight[1] = {16, 16, 32, 32}; + + switch ( npc->act_no ) + { + case 0: + npc->act_no = 1; + npc->ani_no = 0; + npc->y -= 0x2000; + break; + + case 1: + if (++npc->act_wait > 20) + { + npc->act_wait = 0; + npc->act_no = 2; + npc->ani_no = 1; + npc->ym = -0x2FF; + } + + break; + + case 2: + if (npc->ym > 0) + npc->hit.bottom = 0x2000; + + if (npc->flag & 8) + { + npc->act_no = 3; + npc->act_wait = 0; + npc->ani_no = 0; + } + + break; + + case 3: + if (++npc->act_wait > 40) + { + npc->act_no = 4; + npc->act_wait = 64; + PlaySoundObject(29, 1); + } + + break; + + case 4: + --npc->act_wait; + npc->ani_no = 0; + + if (npc->act_wait == 0) + npc->cond = 0; + + break; + } + + npc->ym += 0x40; + npc->y += npc->ym; + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; + + if (gMC.equip & 0x40) + { + npc->rect.top += 32; + npc->rect.bottom += 32; + } + + if (npc->act_no == 4) + { + npc->rect.bottom = npc->rect.top + npc->act_wait / 4; + + if (npc->act_wait / 2 % 2) + ++npc->rect.left; + } +} + +//Quote (teleport in) +void ActNpc112(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + + rcLeft[0] = {0, 0, 16, 16}; + rcLeft[1] = {16, 0, 32, 16}; + + rcRight[0] = {0, 16, 16, 32}; + rcRight[1] = {16, 16, 32, 32}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->ani_no = 0; + npc->ani_wait = 0; + npc->x += 0x2000; + npc->y += 0x1000; + PlaySoundObject(29, 1); + // Fallthrough + case 1: + if (++npc->act_wait == 64) + { + npc->act_no = 2; + npc->act_wait = 0; + } + + break; + + case 2: + if (++npc->act_wait > 20) + { + npc->act_no = 3; + npc->ani_no = 1; + npc->hit.bottom = 0x1000; + } + + break; + + case 3: + if (npc->flag & 8) + { + npc->act_no = 4; + npc->act_wait = 0; + npc->ani_no = 0; + } + + break; + } + + npc->ym += 0x40; + npc->y += npc->ym; + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; + + if (gMC.equip & 0x40) + { + npc->rect.top += 32; + npc->rect.bottom += 32; + } + + if (npc->act_no == 1) + { + npc->rect.bottom = npc->rect.top + npc->act_wait / 4; + + if ( npc->act_wait / 2 % 2 ) + ++npc->rect.left; + } +} + //Red petals void ActNpc116(NPCHAR *npc) { diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 03f5b63d..a9397729 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -167,8 +167,8 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, - nullptr, - nullptr, + ActNpc111, + ActNpc112, nullptr, nullptr, nullptr,