ref: c0f29fac7b7d9e34a48152f288c702ac4ad04fbd
dir: /src/NpcAct240.cpp/
#include "WindowsWrapper.h" #include "NpcAct.h" #include "MyChar.h" #include "NpChar.h" #include "Game.h" #include "Sound.h" #include "Back.h" #include "Triangle.h" //Mimiga (jailed) void ActNpc240(NPCHAR *npc) { RECT rcLeft[6]; RECT rcRight[6]; rcLeft[0] = {160, 64, 176, 80}; rcLeft[1] = {176, 64, 192, 80}; rcLeft[2] = {192, 64, 208, 80}; rcLeft[3] = {160, 64, 176, 80}; rcLeft[4] = {208, 64, 224, 80}; rcLeft[5] = {160, 64, 176, 80}; rcRight[0] = {160, 80, 176, 96}; rcRight[1] = {176, 80, 192, 96}; rcRight[2] = {192, 80, 208, 96}; rcRight[3] = {160, 80, 176, 96}; rcRight[4] = {208, 80, 224, 96}; rcRight[5] = {160, 80, 176, 96}; switch (npc->act_no) { case 0: npc->act_no = 1; npc->ani_no = 0; npc->ani_wait = 0; npc->xm = 0; // Fallthrough case 1: if (Random(0, 60) == 1) { npc->act_no = 2; npc->act_wait = 0; npc->ani_no = 1; } if (Random(0, 60) == 1) { npc->act_no = 10; 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; case 10: npc->act_no = 11; npc->act_wait = Random(0, 16); npc->ani_no = 2; npc->ani_wait = 0; if (Random(0, 9) % 2) npc->direct = 0; else npc->direct = 2; // Fallthrough case 11: if (npc->direct == 0 && npc->flag & 1) npc->direct = 2; else if (npc->direct == 2 && npc->flag & 4) npc->direct = 0; if (npc->direct == 0) npc->xm = -0x200u; else npc->xm = 0x200; if (++npc->ani_wait > 4) { npc->ani_wait = 0; ++npc->ani_no; } if (npc->ani_no > 5) npc->ani_no = 2; if (++npc->act_wait > 32) npc->act_no = 0; break; } npc->ym += 0x20; if (npc->ym > 0x5FF) npc->ym = 0x5FF; npc->x += npc->xm; npc->y += npc->ym; if (npc->direct == 0) npc->rect = rcLeft[npc->ani_no]; else npc->rect = rcRight[npc->ani_no]; } //Curly (carried and unconcious) void ActNpc259(NPCHAR *npc) { RECT rcLeft = {224, 96, 240, 112}; RECT rcRight = {224, 112, 240, 128}; switch (npc->act_no) { case 0: npc->bits &= ~0x2000; npc->act_no = 1; // Fallthrough case 1: if (gMC.direct == 0) npc->direct = 0; else npc->direct = 2; npc->y = gMC.y - 0x800; if (npc->direct == 0) { npc->x = gMC.x + 0x600; npc->rect = rcLeft; } else { npc->x = gMC.x - 0x600; npc->rect = rcRight; } if (gMC.ani_no % 2) ++npc->rect.top; break; case 10: npc->act_no = 11; npc->xm = 0x40; npc->ym = -0x20; npc->rect = rcLeft; break; case 11: if (npc->y < 0x8000) npc->ym = 0x20; npc->x += npc->xm; npc->y += npc->ym; break; case 20: VanishNpChar(npc); SetDestroyNpCharUp(npc->x, npc->y, 0x2000, 0x40); break; } }