diff --git a/src/Back.cpp b/src/Back.cpp index 8c980d2e..8c1b93ad 100644 --- a/src/Back.cpp +++ b/src/Back.cpp @@ -89,39 +89,64 @@ void PutBack(int fx, int fy) case 6: case 7: + //Sky rect.top = 0; rect.bottom = 88; rect.left = 0; rect.right = 320; - PutBitmap4(&grcGame, 0, 0, &rect, SURFACE_ID_LEVEL_BACKGROUND); + PutBitmap4(&grcGame, (WINDOW_WIDTH - 320) / 2, 0, &rect, SURFACE_ID_LEVEL_BACKGROUND); + + rect.left = 106; + rect.right = 255; + for (int i = 0; i < ((WINDOW_WIDTH + 329) / 320); i++) + { + PutBitmap4(&grcGame, (WINDOW_WIDTH - 320) / 2 - (149 * (i + 1)), 0, &rect, SURFACE_ID_LEVEL_BACKGROUND); + PutBitmap4(&grcGame, (WINDOW_WIDTH - 320) / 2 + 320 + (149 * i), 0, &rect, SURFACE_ID_LEVEL_BACKGROUND); + } + + //Cloud layer 1 rect.top = 88; rect.bottom = 123; rect.left = gBack.fx / 2; rect.right = 320; PutBitmap4(&grcGame, 0, 88, &rect, SURFACE_ID_LEVEL_BACKGROUND); + rect.left = 0; - PutBitmap4(&grcGame, 320 - gBack.fx / 2 % 320, 88, &rect, SURFACE_ID_LEVEL_BACKGROUND); + for (int i = 0; i < ((WINDOW_WIDTH + 329) / 320) + 1; i++) + PutBitmap4(&grcGame, (320 * (i + 1)) - gBack.fx / 2 % 320, 88, &rect, SURFACE_ID_LEVEL_BACKGROUND); + + //Cloud layer 2 rect.top = 123; rect.bottom = 146; rect.left = gBack.fx % 320; rect.right = 320; PutBitmap4(&grcGame, 0, 123, &rect, SURFACE_ID_LEVEL_BACKGROUND); + rect.left = 0; - PutBitmap4(&grcGame, 320 - gBack.fx % 320, 123, &rect, SURFACE_ID_LEVEL_BACKGROUND); + for (int i = 0; i < ((WINDOW_WIDTH + 329) / 320) + 1; i++) + PutBitmap4(&grcGame, (320 * (i + 1)) - gBack.fx % 320, 123, &rect, SURFACE_ID_LEVEL_BACKGROUND); + + //Cloud layer 3 rect.top = 146; rect.bottom = 176; rect.left = 2 * gBack.fx % 320; rect.right = 320; PutBitmap4(&grcGame, 0, 146, &rect, SURFACE_ID_LEVEL_BACKGROUND); + rect.left = 0; - PutBitmap4(&grcGame, 320 - 2 * gBack.fx % 320, 146, &rect, SURFACE_ID_LEVEL_BACKGROUND); + for (int i = 0; i < ((WINDOW_WIDTH + 329) / 320) + 1; i++) + PutBitmap4(&grcGame, (320 * (i + 1)) - 2 * gBack.fx % 320, 146, &rect, SURFACE_ID_LEVEL_BACKGROUND); + + //Cloud layer 4 rect.top = 176; rect.bottom = 240; rect.left = 4 * gBack.fx % 320; rect.right = 320; PutBitmap4(&grcGame, 0, 176, &rect, SURFACE_ID_LEVEL_BACKGROUND); + rect.left = 0; - PutBitmap4(&grcGame, 320 - 4 * gBack.fx % 320, 176, &rect, SURFACE_ID_LEVEL_BACKGROUND); + for (int i = 0; i < ((WINDOW_WIDTH + 329) / 320) + 1; i++) + PutBitmap4(&grcGame, (320 * (i + 1)) - 4 * gBack.fx % 320, 176, &rect, SURFACE_ID_LEVEL_BACKGROUND); break; default: diff --git a/src/Ending.cpp b/src/Ending.cpp index d1eef0e9..f38f0131 100644 --- a/src/Ending.cpp +++ b/src/Ending.cpp @@ -8,7 +8,10 @@ #include "Generic.h" #include "Ending.h" #include "Flags.h" +#include "KeyControl.h" +#include "Escape.h" #include "Organya.h" +#include "Main.h" #include "Stage.h" #include "Draw.h" #include "TextScr.h" @@ -369,3 +372,76 @@ void CutCreditIllust() { Illust.act_no = 2; } + +//Scene of the island falling +int Scene_DownIsland(int mode) +{ + RECT rc_sprite; + RECT rc_ground; + RECT rc_sky; + RECT rc_frame; + ISLAND_SPRITE sprite; + + rc_frame = {(WINDOW_WIDTH - 160) / 2, (WINDOW_HEIGHT - 80) / 2, (WINDOW_WIDTH + 160) / 2, (WINDOW_HEIGHT + 80) / 2}; + rc_sky = {0, 0, 160, 80}; + rc_ground = {160, 48, 320, 80}; + rc_sprite = {160, 0, 200, 24}; + sprite.x = 0x15000; + sprite.y = 0x8000; + + for (int wait = 0; wait < 900; wait++) + { + GetTrg(); + + if (gKey & 0x8000) + { + int escRet = Call_Escape(); + if (escRet == 0) + return 0; + if (escRet == 2) + return 2; + } + + switch (mode) + { + case 0: + sprite.y += 0x33; + break; + + case 1: + if (wait >= 350) + { + if (wait >= 500) + { + if (wait >= 600) + { + if (wait == 750) + wait = 900; + } + else + { + sprite.y += 0xC; + } + } + else + { + sprite.y += 0x19; + } + } + break; + } + + + CortBox(&grcFull, 0); + PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 80 + (WINDOW_HEIGHT - 240) / 2, &rc_sky, 21); + PutBitmap3(&rc_frame, sprite.x / 0x200 - 20 + (WINDOW_WIDTH - 320) / 2, sprite.y / 512 - 12 + (WINDOW_HEIGHT - 240) / 2, &rc_sprite, 21); + PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 128 + (WINDOW_HEIGHT - 240) / 2, &rc_ground, 21); + //PutTimeCounter(16, 8); + + PutFramePerSecound(); + if (!Flip_SystemTask()) + return 0; + } + + return 1; +} diff --git a/src/Ending.h b/src/Ending.h index f22841d5..1a7627af 100644 --- a/src/Ending.h +++ b/src/Ending.h @@ -26,6 +26,12 @@ struct ILLUSTRATION int x; }; +struct ISLAND_SPRITE +{ + int x; + int y; +}; + void ActionStripper(); void PutStripper(); void SetStripper(int x, int y, char *text, int cast); @@ -39,3 +45,4 @@ bool StartCreditScript(); void ActionCredit(); void SetCreditIllust(int a); void CutCreditIllust(); +int Scene_DownIsland(int mode); diff --git a/src/NpcAct.h b/src/NpcAct.h index b9b3a3b8..545cfd0c 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -329,6 +329,11 @@ void ActNpc323(NPCHAR *npc); void ActNpc324(NPCHAR *npc); void ActNpc325(NPCHAR *npc); +void ActNpc326(NPCHAR *npc); +void ActNpc327(NPCHAR *npc); +void ActNpc328(NPCHAR *npc); +void ActNpc329(NPCHAR *npc); + void ActNpc334(NPCHAR *npc); void ActNpc335(NPCHAR *npc); void ActNpc336(NPCHAR *npc); diff --git a/src/NpcAct320.cpp b/src/NpcAct320.cpp index 40c278e3..97e245b1 100644 --- a/src/NpcAct320.cpp +++ b/src/NpcAct320.cpp @@ -426,6 +426,190 @@ void ActNpc325(NPCHAR *npc) npc->rect = rc[npc->ani_no]; } +//Sue/Itoh becoming humans +void ActNpc326(NPCHAR *npc) +{ + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->y -= 0x1000; + npc->x += 0x2000; + npc->ani_no = 0; + //Fallthrough + case 1: + if (++npc->act_wait > 80) + { + npc->act_no = 10; + npc->act_wait = 0; + } + else + { + if (npc->direct) + { + if (npc->act_wait == 50) + npc->ani_no = 1; + if (npc->act_wait == 60) + npc->ani_no = 0; + } + else + { + if (npc->act_wait == 30) + npc->ani_no = 1; + if (npc->act_wait == 40) + npc->ani_no = 0; + } + } + break; + case 10: + if (++npc->act_wait > 50) + { + npc->act_no = 15; + npc->ani_no = 4; + if ( npc->direct ) + npc->act_wait = -20; + else + npc->act_wait = 0; + } + else + { + if (npc->act_wait / 2 & 1) + npc->ani_no = 2; + else + npc->ani_no = 3; + } + break; + case 15: + if (++npc->act_wait > 40) + { + npc->act_wait = 0; + npc->act_no = 20; + } + break; + case 20: + npc->ym += 0x40; + if (npc->ym > 0x5FF) + npc->ym = 0x5FF; + + npc->y += npc->ym; + + if (++npc->act_wait > 50) + { + npc->act_no = 30; + npc->act_wait = 0; + npc->ani_no = 6; + + if (npc->direct) + SetNpChar(327, npc->x, npc->y - 0x1000, 0, 0, 0, npc, 0x100); + else + SetNpChar(327, npc->x, npc->y - 0x2000, 0, 0, 0, npc, 0x100); + } + break; + case 30: + if (++npc->act_wait == 30) + npc->ani_no = 7; + if (npc->act_wait == 40) + npc->act_no = 40; + break; + case 40: + npc->act_no = 41; + npc->act_wait = 0; + npc->ani_no = 0; + //Fallthorugh + case 41: + if (++npc->act_wait == 30) + npc->ani_no = 1; + if (npc->act_wait == 40) + npc->ani_no = 0; + break; + default: + break; + } + + RECT rcSu[8]; + RECT rcItoh[8]; + rcItoh[0] = {0, 128, 16, 152}; + rcItoh[1] = {16, 128, 32, 152}; + rcItoh[2] = {32, 128, 48, 152}; + rcItoh[3] = {48, 128, 64, 152}; + rcItoh[4] = {64, 128, 80, 152}; + rcItoh[5] = {80, 128, 96, 152}; + rcItoh[6] = {96, 128, 112, 152}; + rcItoh[7] = {112, 128, 128, 152}; + rcSu[0] = {128, 128, 144, 152}; + rcSu[1] = {144, 128, 160, 152}; + rcSu[2] = {160, 128, 176, 152}; + rcSu[3] = {176, 128, 192, 152}; + rcSu[4] = {192, 128, 208, 152}; + rcSu[5] = {208, 128, 224, 152}; + rcSu[6] = {224, 128, 240, 152}; + rcSu[7] = {32, 152, 48, 176}; + + if (npc->direct) + npc->rect = rcSu[npc->ani_no]; + else + npc->rect = rcItoh[npc->ani_no]; +} + +//Sneeze +void ActNpc327(NPCHAR *npc) +{ + RECT rc[2]; + rc[0] = {240, 80, 256, 96}; + rc[1] = {256, 80, 272, 96}; + + ++npc->act_wait; + + switch (npc->act_no) + { + case 0: + if (npc->act_wait < 4) + npc->y -= 0x400; + + if (npc->pNpc->ani_no == 7) + { + npc->ani_no = 1; + npc->act_no = 1; + npc->tgt_x = npc->x; + npc->tgt_y = npc->y; + } + break; + + case 1: + if (npc->act_wait >= 48) + { + npc->x = npc->tgt_x; + npc->y = npc->tgt_y; + } + else + { + npc->x = npc->tgt_x + (Random(-1, 1) << 9); + npc->y = npc->tgt_y + (Random(-1, 1) << 9); + } + break; + } + + if (npc->act_wait > 70) + npc->cond = 0; + + npc->rect = rc[npc->ani_no]; +} + +//Thingy that turns Sue and Itoh into humans for 4 seconds +void ActNpc328(NPCHAR *npc) +{ + npc->rect = {96, 0, 128, 48}; +} + +//Laboratory fan +void ActNpc329(NPCHAR *npc) +{ + if (++npc->ani_wait / 2 & 1) + npc->rect = {48, 0, 64, 16}; + else + npc->rect = {64, 0, 80, 16}; +} + //Sweat void ActNpc334(NPCHAR *npc) { diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 84977ba4..872a4957 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -382,10 +382,10 @@ NPCFUNCTION gpNpcFuncTbl[361] = ActNpc323, ActNpc324, ActNpc325, - nullptr, - nullptr, - nullptr, - nullptr, + ActNpc326, + ActNpc327, + ActNpc328, + ActNpc329, nullptr, nullptr, nullptr, diff --git a/src/TextScr.cpp b/src/TextScr.cpp index 76513aa7..54a0756b 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -1227,6 +1227,17 @@ int TextScriptProc() CutCreditIllust(); gTS.p_read += 4; } + else if (IS_COMMAND('X','X','1')) + { + bExit = true; + z = GetTextScriptNo(gTS.p_read + 4); + int islRet = Scene_DownIsland(z); + if (islRet == 0) + return 0; + if (islRet == 2) + return 2; + gTS.p_read += 8; + } else if (IS_COMMAND('E','S','C')) { return 2;