Merge branch 'master' of https://github.com/cuckydev/Cave-Story-Engine-2
This commit is contained in:
commit
f45a0adb29
7 changed files with 317 additions and 9 deletions
35
src/Back.cpp
35
src/Back.cpp
|
@ -89,39 +89,64 @@ void PutBack(int fx, int fy)
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
|
//Sky
|
||||||
rect.top = 0;
|
rect.top = 0;
|
||||||
rect.bottom = 88;
|
rect.bottom = 88;
|
||||||
rect.left = 0;
|
rect.left = 0;
|
||||||
rect.right = 320;
|
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.top = 88;
|
||||||
rect.bottom = 123;
|
rect.bottom = 123;
|
||||||
rect.left = gBack.fx / 2;
|
rect.left = gBack.fx / 2;
|
||||||
rect.right = 320;
|
rect.right = 320;
|
||||||
PutBitmap4(&grcGame, 0, 88, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
PutBitmap4(&grcGame, 0, 88, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||||
|
|
||||||
rect.left = 0;
|
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.top = 123;
|
||||||
rect.bottom = 146;
|
rect.bottom = 146;
|
||||||
rect.left = gBack.fx % 320;
|
rect.left = gBack.fx % 320;
|
||||||
rect.right = 320;
|
rect.right = 320;
|
||||||
PutBitmap4(&grcGame, 0, 123, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
PutBitmap4(&grcGame, 0, 123, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||||
|
|
||||||
rect.left = 0;
|
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.top = 146;
|
||||||
rect.bottom = 176;
|
rect.bottom = 176;
|
||||||
rect.left = 2 * gBack.fx % 320;
|
rect.left = 2 * gBack.fx % 320;
|
||||||
rect.right = 320;
|
rect.right = 320;
|
||||||
PutBitmap4(&grcGame, 0, 146, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
PutBitmap4(&grcGame, 0, 146, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||||
|
|
||||||
rect.left = 0;
|
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.top = 176;
|
||||||
rect.bottom = 240;
|
rect.bottom = 240;
|
||||||
rect.left = 4 * gBack.fx % 320;
|
rect.left = 4 * gBack.fx % 320;
|
||||||
rect.right = 320;
|
rect.right = 320;
|
||||||
PutBitmap4(&grcGame, 0, 176, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
PutBitmap4(&grcGame, 0, 176, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||||
|
|
||||||
rect.left = 0;
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -8,7 +8,10 @@
|
||||||
#include "Generic.h"
|
#include "Generic.h"
|
||||||
#include "Ending.h"
|
#include "Ending.h"
|
||||||
#include "Flags.h"
|
#include "Flags.h"
|
||||||
|
#include "KeyControl.h"
|
||||||
|
#include "Escape.h"
|
||||||
#include "Organya.h"
|
#include "Organya.h"
|
||||||
|
#include "Main.h"
|
||||||
#include "Stage.h"
|
#include "Stage.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
#include "TextScr.h"
|
#include "TextScr.h"
|
||||||
|
@ -369,3 +372,76 @@ void CutCreditIllust()
|
||||||
{
|
{
|
||||||
Illust.act_no = 2;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,12 @@ struct ILLUSTRATION
|
||||||
int x;
|
int x;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ISLAND_SPRITE
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
};
|
||||||
|
|
||||||
void ActionStripper();
|
void ActionStripper();
|
||||||
void PutStripper();
|
void PutStripper();
|
||||||
void SetStripper(int x, int y, char *text, int cast);
|
void SetStripper(int x, int y, char *text, int cast);
|
||||||
|
@ -39,3 +45,4 @@ bool StartCreditScript();
|
||||||
void ActionCredit();
|
void ActionCredit();
|
||||||
void SetCreditIllust(int a);
|
void SetCreditIllust(int a);
|
||||||
void CutCreditIllust();
|
void CutCreditIllust();
|
||||||
|
int Scene_DownIsland(int mode);
|
||||||
|
|
|
@ -329,6 +329,11 @@ void ActNpc323(NPCHAR *npc);
|
||||||
void ActNpc324(NPCHAR *npc);
|
void ActNpc324(NPCHAR *npc);
|
||||||
void ActNpc325(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 ActNpc334(NPCHAR *npc);
|
||||||
void ActNpc335(NPCHAR *npc);
|
void ActNpc335(NPCHAR *npc);
|
||||||
void ActNpc336(NPCHAR *npc);
|
void ActNpc336(NPCHAR *npc);
|
||||||
|
|
|
@ -426,6 +426,190 @@ void ActNpc325(NPCHAR *npc)
|
||||||
npc->rect = rc[npc->ani_no];
|
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
|
//Sweat
|
||||||
void ActNpc334(NPCHAR *npc)
|
void ActNpc334(NPCHAR *npc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -382,10 +382,10 @@ NPCFUNCTION gpNpcFuncTbl[361] =
|
||||||
ActNpc323,
|
ActNpc323,
|
||||||
ActNpc324,
|
ActNpc324,
|
||||||
ActNpc325,
|
ActNpc325,
|
||||||
nullptr,
|
ActNpc326,
|
||||||
nullptr,
|
ActNpc327,
|
||||||
nullptr,
|
ActNpc328,
|
||||||
nullptr,
|
ActNpc329,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
|
|
|
@ -1227,6 +1227,17 @@ int TextScriptProc()
|
||||||
CutCreditIllust();
|
CutCreditIllust();
|
||||||
gTS.p_read += 4;
|
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'))
|
else if (IS_COMMAND('E','S','C'))
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
|
|
Loading…
Add table
Reference in a new issue