From b915e7315d58f622d3c590e3988ef45d3e09c719 Mon Sep 17 00:00:00 2001 From: cuckydev Date: Sun, 3 Feb 2019 16:06:09 -0500 Subject: [PATCH] OMH (oh my heck) ITS SANTA --- src/NpcAct.h | 2 +- src/NpcAct040.cpp | 80 +++++++++++++++++++++++++++++++++++++++++++++++ src/NpcTbl.cpp | 2 +- 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/src/NpcAct.h b/src/NpcAct.h index 8ed387d4..4fb4900e 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -40,7 +40,7 @@ void ActNpc034(NPCHAR *npc); void ActNpc037(NPCHAR *npc); void ActNpc038(NPCHAR *npc); void ActNpc039(NPCHAR *npc); - +void ActNpc040(NPCHAR *npc); void ActNpc041(NPCHAR *npc); void ActNpc042(NPCHAR *npc); void ActNpc043(NPCHAR *npc); diff --git a/src/NpcAct040.cpp b/src/NpcAct040.cpp index 26f4fc4a..2767d008 100644 --- a/src/NpcAct040.cpp +++ b/src/NpcAct040.cpp @@ -10,6 +10,86 @@ #include "Back.h" #include "Triangle.h" +//Santa +void ActNpc040(NPCHAR *npc) +{ + RECT rcLeft[7]; + RECT rcRight[7]; + + rcLeft[0] = {0, 32, 16, 48}; + rcLeft[1] = {16, 32, 32, 48}; + rcLeft[2] = {32, 32, 48, 48}; + rcLeft[3] = {0, 32, 16, 48}; + rcLeft[4] = {48, 32, 64, 48}; + rcLeft[5] = {0, 32, 16, 48}; + rcLeft[6] = {64, 32, 80, 48}; + + rcRight[0] = {0, 48, 16, 64}; + rcRight[1] = {16, 48, 32, 64}; + rcRight[2] = {32, 48, 48, 64}; + rcRight[3] = {0, 48, 16, 64}; + rcRight[4] = {48, 48, 64, 64}; + rcRight[5] = {0, 48, 16, 64}; + rcRight[6] = {64, 48, 80, 64}; + + switch ( npc->act_no ) + { + case 0: + npc->act_no = 1; + npc->ani_no = 0; + npc->ani_wait = 0; + case 1: + if (Random(0, 120) == 10) + { + npc->act_no = 2; + npc->act_wait = 0; + npc->ani_no = 1; + } + if (npc->x - 0x4000 < gMC.x && npc->x + 0x4000 > gMC.x && npc->y - 0x4000 < gMC.y && npc->y + 0x2000 > gMC.y) + { + if (npc->x <= gMC.x) + npc->direct = 2; + else + npc->direct = 0; + } + break; + case 2: + if (++npc->act_wait > 8) + { + npc->act_no = 1; + npc->ani_no = 0; + } + break; + case 3: + npc->act_no = 4; + npc->ani_no = 2; + npc->ani_wait = 0; + case 4: + if (++npc->ani_wait > 4) + { + npc->ani_wait = 0; + npc->ani_no++; + } + if (npc->ani_no > 5) + npc->ani_no = 2; + if (npc->direct) + npc->x += 0x200; + else + npc->x -= 0x200; + break; + case 5: + npc->ani_no = 6; + break; + default: + break; + } + + if (npc->direct) + npc->rect = rcRight[npc->ani_no]; + else + npc->rect = rcLeft[npc->ani_no]; +} + //Busted Door void ActNpc041(NPCHAR *npc) { diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 80c916be..03f5b63d 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -96,7 +96,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = ActNpc037, ActNpc038, ActNpc039, - nullptr, + ActNpc040, ActNpc041, ActNpc042, ActNpc043,