diff --git a/src/NpcAct.h b/src/NpcAct.h index 8ca36c81..90677526 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -36,6 +36,7 @@ void ActNpc037(NPCHAR *npc); void ActNpc039(NPCHAR *npc); void ActNpc042(NPCHAR *npc); +void ActNpc043(NPCHAR *npc); void ActNpc046(NPCHAR *npc); @@ -47,7 +48,16 @@ void ActNpc062(NPCHAR *npc); void ActNpc064(NPCHAR *npc); void ActNpc065(NPCHAR *npc); +void ActNpc070(NPCHAR *npc); +void ActNpc071(NPCHAR *npc); +void ActNpc072(NPCHAR *npc); void ActNpc073(NPCHAR *npc); +void ActNpc074(NPCHAR *npc); +void ActNpc075(NPCHAR *npc); +void ActNpc076(NPCHAR *npc); +void ActNpc077(NPCHAR *npc); +void ActNpc078(NPCHAR *npc); +void ActNpc079(NPCHAR *npc); void ActNpc083(NPCHAR *npc); void ActNpc084(NPCHAR *npc); diff --git a/src/NpcAct040.cpp b/src/NpcAct040.cpp index 8bc7d61e..2a29ebd0 100644 --- a/src/NpcAct040.cpp +++ b/src/NpcAct040.cpp @@ -294,7 +294,28 @@ void ActNpc042(NPCHAR *npc) npc->rect = rcRight[npc->ani_no]; } -// H/V Trigger +//Chalkboard +void ActNpc043(NPCHAR *npc) +{ + RECT rcLeft[1]; + RECT rcRight[1]; + + rcLeft[0] = {128, 80, 168, 112}; + rcRight[0] = {168, 80, 208, 112}; + + if (npc->act_no == 0) + { + npc->act_no = 1; + npc->y -= 0x2000; + } + + if (npc->direct == 0) + npc->rect = rcLeft[0]; + else + npc->rect = rcRight[0]; +} + +//H/V Trigger void ActNpc046(NPCHAR *npc) { RECT rect[1]; diff --git a/src/NpcAct060.cpp b/src/NpcAct060.cpp index 3522bcba..04acf303 100644 --- a/src/NpcAct060.cpp +++ b/src/NpcAct060.cpp @@ -9,6 +9,7 @@ #include "Back.h" #include "Triangle.h" #include "Map.h" +#include "CommonDefines.h" //Kazuma at computer void ActNpc062(NPCHAR *npc) @@ -257,6 +258,137 @@ void ActNpc065(NPCHAR *npc) npc->rect = rect_right[npc->ani_no]; } +//Sparkle +void ActNpc070(NPCHAR *npc) +{ + RECT rect[4]; + + rect[0] = {96, 48, 112, 64}; + rect[1] = {112, 48, 128, 64}; + rect[2] = {128, 48, 144, 64}; + rect[3] = {144, 48, 160, 64}; + + if (++npc->ani_wait > 3) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 3) + npc->ani_no = 0; + + npc->rect = rect[npc->ani_no]; +} + +//Chinfish +void ActNpc071(NPCHAR *npc) +{ + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->tgt_x = npc->x; + npc->tgt_y = npc->y; + npc->ym = 0x80; + // Fallthrough + case 1: + if (npc->tgt_y < npc->y) + npc->ym -= 8; + if (npc->tgt_y > npc->y) + npc->ym += 8; + + if (npc->ym > 0x100) + npc->ym = 0x100; + if (npc->ym < -0x100) + npc->ym = -0x100; + + break; + } + + npc->x += npc->xm; + npc->y += npc->ym; + + RECT rcLeft[3]; + RECT rcRight[3]; + + rcLeft[0].left = 64; + rcLeft[0].top = 32; + rcLeft[0].right = 80; + rcLeft[0].bottom = 48; + rcLeft[1].left = 80; + rcLeft[1].top = 32; + rcLeft[1].right = 96; + rcLeft[1].bottom = 48; + rcLeft[2].left = 96; + rcLeft[2].top = 32; + rcLeft[2].right = 112; + rcLeft[2].bottom = 48; + + rcRight[0].left = 64; + rcRight[0].top = 48; + rcRight[0].right = 80; + rcRight[0].bottom = 64; + rcRight[1].left = 80; + rcRight[1].top = 48; + rcRight[1].right = 96; + rcRight[1].bottom = 64; + rcRight[2].left = 96; + rcRight[2].top = 48; + rcRight[2].right = 112; + rcRight[2].bottom = 64; + + if (++npc->ani_wait > 4) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + npc->ani_no = 0; + + if (npc->shock) + npc->ani_no = 2; + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; +} + +//Sprinkler +void ActNpc072(NPCHAR *npc) +{ + if (npc->direct == 0) + { + if (++npc->ani_wait > 1) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + { + npc->ani_no = 0; + return; + } + + if (gMC.x < npc->x + (WINDOW_WIDTH * 0x200) && gMC.x > npc->x - (WINDOW_WIDTH * 0x200) && gMC.y < npc->y + (WINDOW_HEIGHT * 0x200) && gMC.y > npc->y - (WINDOW_HEIGHT * 0x200)) + { + if (++npc->act_no % 2) + SetNpChar(73, npc->x, npc->y, 2 * Random(-0x200, 0x200), 3 * Random(-0x200, 0x80), 0, 0, 0x100); + + SetNpChar(73, npc->x, npc->y, 2 * Random(-0x200, 0x200), 3 * Random(-0x200, 0x80), 0, 0, 0x100); + } + } + + RECT rect[2]; + + rect[0] = {224, 48, 240, 64}; + rect[1] = {240, 48, 256, 64}; + + npc->rect = rect[npc->ani_no]; +} + //Water droplet void ActNpc073(NPCHAR *npc) { @@ -300,3 +432,251 @@ void ActNpc073(NPCHAR *npc) if (npc->y > gMap.length * 0x10 * 0x200) npc->cond = 0; } + +// Jack +void ActNpc074(NPCHAR *npc) +{ + RECT rcLeft[6]; + RECT rcRight[6]; + + rcLeft[0] = {64, 0, 80, 16}; + rcLeft[1] = {80, 0, 96, 16}; + rcLeft[2] = {96, 0, 112, 16}; + rcLeft[3] = {64, 0, 80, 16}; + rcLeft[4] = {112, 0, 128, 16}; + rcLeft[5] = {64, 0, 80, 16}; + + rcRight[0] = {64, 16, 80, 32}; + rcRight[1] = {80, 16, 96, 32}; + rcRight[2] = {96, 16, 112, 32}; + rcRight[3] = {64, 16, 80, 32}; + rcRight[4] = {112, 16, 128, 32}; + rcRight[5] = {64, 16, 80, 32}; + + 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, 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; + + case 8: + npc->act_no = 9; + npc->ani_no = 2; + npc->ani_wait = 0; + // Fallthrough + case 9: + 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->xm = 0x200; + else + npc->xm = -0x200; + + break; + } + + npc->ym += 0x40; + + if (npc->xm > 0x400) + npc->xm = 0x400; + if (npc->xm < -0x400) + npc->xm = -0x400; + + 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]; +} + +// Kanpachi (fishing) +void ActNpc075(NPCHAR *npc) +{ + RECT rcLeft[2]; + + rcLeft[0].left = 272; + rcLeft[0].top = 32; + rcLeft[0].right = 296; + rcLeft[0].bottom = 56; + rcLeft[1].left = 296; + rcLeft[1].top = 32; + rcLeft[1].right = 320; + rcLeft[1].bottom = 56; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->ani_no = 0; + npc->ani_wait = 0; + // Fallthrough + case 1: + if (npc->x - 0x6000 < gMC.x && npc->x + 0x6000 > gMC.x && npc->y - 0x6000 < gMC.y && npc->y + 0x2000 > gMC.y) + npc->ani_no = 1; + else + npc->ani_no = 0; + + break; + } + + npc->rect = rcLeft[npc->ani_no]; +} + +//Flowers +void ActNpc076(NPCHAR *npc) +{ + npc->rect = {16 * npc->code_event, 0, npc->rect.left + 16, 16}; +} + +//Yamashita +void ActNpc077(NPCHAR *npc) +{ + RECT rc[3]; + + rc[0] = {0, 16, 48, 48}; + rc[1] = {48, 16, 96, 48}; + rc[2] = {96, 16, 144, 48}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->ani_no = 0; + npc->ani_wait = 0; + // 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 == 0) + npc->rect = rc[npc->ani_no]; + else + npc->rect = rc[2]; +} + +// Pot +void ActNpc078(NPCHAR *npc) +{ + RECT rc[2]; + + rc[0] = {160, 48, 176, 64}; + rc[1] = {176, 48, 192, 64}; + + if (npc->direct == 0) + npc->rect = rc[0]; + else + npc->rect = rc[1]; +} + +// Mahin the sex god +void ActNpc079(NPCHAR *npc) +{ + RECT rcLeft[3]; + RECT rcRight[3]; + + rcLeft[0] = {0, 0, 16, 16}; + rcLeft[1] = {16, 0, 32, 16}; + rcLeft[2] = {32, 0, 48, 16}; + + rcRight[0] = {0, 16, 16, 32}; + rcRight[1] = {16, 16, 32, 32}; + rcRight[2] = {32, 16, 48, 32}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->ani_no = 2; + npc->ani_wait = 0; + break; + + case 2: + npc->ani_no = 0; + + if (Random(0, 120) == 10) + { + npc->act_no = 3; + 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 3: + if (++npc->act_wait > 8 ) + { + npc->act_no = 2; + npc->ani_no = 0; + } + + break; + } + + npc->ym += 0x40; + if ( npc->ym > 0x5FF ) + npc->ym = 0x5FF; + + npc->y += npc->ym; + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; +} diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 6460b705..61e54126 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -99,7 +99,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, ActNpc042, - nullptr, + ActNpc043, nullptr, nullptr, ActNpc046, @@ -126,16 +126,16 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, - nullptr, - nullptr, - nullptr, + ActNpc070, + ActNpc071, + ActNpc072, ActNpc073, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, + ActNpc074, + ActNpc075, + ActNpc076, + ActNpc077, + ActNpc078, + ActNpc079, nullptr, nullptr, nullptr,