diff --git a/src/NpcAct.h b/src/NpcAct.h index 1bb7e4ac..1932b594 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -6,3 +6,5 @@ void ActNpc003(NPCHAR *npc); void ActNpc004(NPCHAR *npc); void ActNpc005(NPCHAR *npc); void ActNpc006(NPCHAR *npc); + +void ActNpc016(NPCHAR *npc); diff --git a/src/NpcAct000.cpp b/src/NpcAct000.cpp index 544d5c77..065090ca 100644 --- a/src/NpcAct000.cpp +++ b/src/NpcAct000.cpp @@ -614,3 +614,58 @@ void ActNpc006(NPCHAR *npc) else npc->rect = rcLeft[npc->ani_no]; } + +//Save point +void ActNpc016(NPCHAR *npc) +{ + RECT rects[8]; + + rects[0] = {96, 16, 112, 32}; + rects[1] = {112, 16, 128, 32}; + rects[2] = {128, 16, 144, 32}; + rects[3] = {144, 16, 160, 32}; + rects[4] = {160, 16, 176, 32}; + rects[5] = {176, 16, 192, 32}; + rects[6] = {192, 16, 208, 32}; + rects[7] = {208, 16, 224, 32}; + + switch (npc->act_no) + { + case 0: + npc->bits |= 0x2000u; + npc->act_no = 1; + + if (npc->direct == 2) + { + npc->bits &= ~0x2000u; + npc->ym = -0x200; + + for (int i = 0; i < 4; ++i) + SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100); + } + + // Fallthrough + case 1: + if (npc->flag & 8) + npc->bits |= 0x2000u; + + break; + } + + if ( ++npc->ani_wait > 2 ) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if ( npc->ani_no > 7 ) + npc->ani_no = 0; + + npc->ym += 0x40; + if ( npc->ym > 0x5FF ) + npc->ym = 0x5FF; + + npc->y += npc->ym; + + npc->rect = rects[npc->ani_no]; +} diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index ce5ab964..eaf87079 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -72,7 +72,7 @@ NPCFUNCTION gpNpcFuncTbl[] = nullptr, nullptr, nullptr, - nullptr, + &ActNpc016, nullptr, nullptr, nullptr,