Clean-up Ending.cpp
This commit is contained in:
parent
b4e651398a
commit
a3fd87e581
2 changed files with 55 additions and 48 deletions
|
@ -23,9 +23,11 @@ STRIP Strip[MAX_STRIP];
|
||||||
ILLUSTRATION Illust;
|
ILLUSTRATION Illust;
|
||||||
|
|
||||||
// Update casts
|
// Update casts
|
||||||
void ActionStripper()
|
void ActionStripper(void)
|
||||||
{
|
{
|
||||||
for (int s = 0; s < MAX_STRIP; s++)
|
int s;
|
||||||
|
|
||||||
|
for (s = 0; s < MAX_STRIP; ++s)
|
||||||
{
|
{
|
||||||
// Move up
|
// Move up
|
||||||
if (Strip[s].flag & 0x80 && Credit.mode)
|
if (Strip[s].flag & 0x80 && Credit.mode)
|
||||||
|
@ -37,26 +39,27 @@ void ActionStripper()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw casts
|
// Draw casts
|
||||||
void PutStripper()
|
void PutStripper(void)
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
|
int s;
|
||||||
|
|
||||||
for (int s = 0; s < MAX_STRIP; s++)
|
for (s = 0; s < MAX_STRIP; ++s)
|
||||||
{
|
{
|
||||||
if (Strip[s].flag & 0x80)
|
if (Strip[s].flag & 0x80)
|
||||||
{
|
{
|
||||||
// Draw text
|
// Draw text
|
||||||
rc.left = 0;
|
rc.left = 0;
|
||||||
rc.right = 320;
|
rc.right = 320;
|
||||||
rc.top = s * 0x10;
|
rc.top = s * 16;
|
||||||
rc.bottom = rc.top + 0x10;
|
rc.bottom = rc.top + 16;
|
||||||
|
|
||||||
PutBitmap3(&grcFull, (Strip[s].x / 0x200) + ((WINDOW_WIDTH - 320) / 2), (Strip[s].y / 0x200), &rc, SURFACE_ID_CREDIT_CAST);
|
PutBitmap3(&grcFull, (Strip[s].x / 0x200) + ((WINDOW_WIDTH - 320) / 2), (Strip[s].y / 0x200), &rc, SURFACE_ID_CREDIT_CAST);
|
||||||
|
|
||||||
// Draw character
|
// Draw character
|
||||||
rc.left = 24 * (Strip[s].cast % 13);
|
rc.left = (Strip[s].cast % 13) * 24;
|
||||||
rc.right = rc.left + 24;
|
rc.right = rc.left + 24;
|
||||||
rc.top = 24 * (Strip[s].cast / 13);
|
rc.top = (Strip[s].cast / 13) * 24;
|
||||||
rc.bottom = rc.top + 24;
|
rc.bottom = rc.top + 24;
|
||||||
|
|
||||||
PutBitmap3(&grcFull, (Strip[s].x / 0x200) + ((WINDOW_WIDTH - 320) / 2) - 24, (Strip[s].y / 0x200) - 8, &rc, SURFACE_ID_CASTS);
|
PutBitmap3(&grcFull, (Strip[s].x / 0x200) + ((WINDOW_WIDTH - 320) / 2) - 24, (Strip[s].y / 0x200) - 8, &rc, SURFACE_ID_CASTS);
|
||||||
|
@ -70,7 +73,7 @@ void SetStripper(int x, int y, const char *text, int cast)
|
||||||
RECT rc;
|
RECT rc;
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
for (s = 0; s < MAX_STRIP; s++)
|
for (s = 0; s < MAX_STRIP; ++s)
|
||||||
if (!(Strip[s].flag & 0x80))
|
if (!(Strip[s].flag & 0x80))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -87,26 +90,27 @@ void SetStripper(int x, int y, const char *text, int cast)
|
||||||
// Draw text
|
// Draw text
|
||||||
rc.left = 0;
|
rc.left = 0;
|
||||||
rc.right = 320;
|
rc.right = 320;
|
||||||
rc.top = s * 0x10;
|
rc.top = s * 16;
|
||||||
rc.bottom = rc.top + 0x10;
|
rc.bottom = rc.top + 16;
|
||||||
|
|
||||||
CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST);
|
CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST);
|
||||||
PutText2(0, rc.top, text, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST);
|
PutText2(0, rc.top, text, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regenerate cast text
|
// Regenerate cast text
|
||||||
void RestoreStripper()
|
void RestoreStripper(void)
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
|
int s;
|
||||||
|
|
||||||
for (int s = 0; s < MAX_STRIP; s++)
|
for (s = 0; s < MAX_STRIP; ++s)
|
||||||
{
|
{
|
||||||
if (Strip[s].flag & 0x80)
|
if (Strip[s].flag & 0x80)
|
||||||
{
|
{
|
||||||
rc.left = 0;
|
rc.left = 0;
|
||||||
rc.right = 320;
|
rc.right = 320;
|
||||||
rc.top = s * 0x10;
|
rc.top = s * 16;
|
||||||
rc.bottom = rc.top + 0x10;
|
rc.bottom = rc.top + 16;
|
||||||
|
|
||||||
CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST);
|
CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST);
|
||||||
PutText2(0, rc.top, Strip[s].str, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST);
|
PutText2(0, rc.top, Strip[s].str, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST);
|
||||||
|
@ -115,30 +119,30 @@ void RestoreStripper()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle the illustration
|
// Handle the illustration
|
||||||
void ActionIllust()
|
void ActionIllust(void)
|
||||||
{
|
{
|
||||||
switch (Illust.act_no)
|
switch (Illust.act_no)
|
||||||
{
|
{
|
||||||
case 0: // Off-screen to the left
|
case 0: // Off-screen to the left
|
||||||
Illust.x = -0x14000;
|
Illust.x = -160 * 0x200;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // Move in from the left
|
case 1: // Move in from the left
|
||||||
Illust.x += 0x5000;
|
Illust.x += 40 * 0x200;
|
||||||
if (Illust.x > 0)
|
if (Illust.x > 0)
|
||||||
Illust.x = 0;
|
Illust.x = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // Move out from the right
|
case 2: // Move out from the right
|
||||||
Illust.x -= 0x5000;
|
Illust.x -= 0x5000;
|
||||||
if (Illust.x < -0x14000)
|
if (Illust.x < -160 * 0x200)
|
||||||
Illust.x = -0x14000;
|
Illust.x = -160 * 0x200;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw illustration
|
// Draw illustration
|
||||||
void PutIllust()
|
void PutIllust(void)
|
||||||
{
|
{
|
||||||
RECT rcIllust = {0, 0, 160, 240};
|
RECT rcIllust = {0, 0, 160, 240};
|
||||||
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240
|
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240
|
||||||
|
@ -159,16 +163,16 @@ void ReloadIllust(int a)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize and release credits
|
// Initialize and release credits
|
||||||
void InitCreditScript()
|
void InitCreditScript(void)
|
||||||
{
|
{
|
||||||
// Clear script state and casts
|
// Clear script state and casts
|
||||||
memset(&Credit, 0, sizeof(CREDIT));
|
memset(&Credit, 0, sizeof(CREDIT));
|
||||||
memset(Strip, 0, sizeof(Strip));
|
memset(Strip, 0, sizeof(Strip));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReleaseCreditScript()
|
void ReleaseCreditScript(void)
|
||||||
{
|
{
|
||||||
if (Credit.pData)
|
if (Credit.pData != NULL)
|
||||||
{
|
{
|
||||||
// Free script data
|
// Free script data
|
||||||
free(Credit.pData);
|
free(Credit.pData);
|
||||||
|
@ -179,10 +183,10 @@ void ReleaseCreditScript()
|
||||||
const char *credit_script = "Credit.tsc";
|
const char *credit_script = "Credit.tsc";
|
||||||
|
|
||||||
// Start playing credits
|
// Start playing credits
|
||||||
BOOL StartCreditScript()
|
BOOL StartCreditScript(void)
|
||||||
{
|
{
|
||||||
// Clear previously existing credits data
|
// Clear previously existing credits data
|
||||||
if (Credit.pData)
|
if (Credit.pData != NULL)
|
||||||
{
|
{
|
||||||
free(Credit.pData);
|
free(Credit.pData);
|
||||||
Credit.pData = NULL;
|
Credit.pData = NULL;
|
||||||
|
@ -221,7 +225,7 @@ BOOL StartCreditScript()
|
||||||
Credit.offset = 0;
|
Credit.offset = 0;
|
||||||
Credit.wait = 0;
|
Credit.wait = 0;
|
||||||
Credit.mode = 1;
|
Credit.mode = 1;
|
||||||
Illust.x = -0x14000;
|
Illust.x = -160 * 0x200;
|
||||||
Illust.act_no = 0;
|
Illust.act_no = 0;
|
||||||
|
|
||||||
// Modify cliprect
|
// Modify cliprect
|
||||||
|
@ -243,7 +247,7 @@ BOOL StartCreditScript()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update credits
|
// Update credits
|
||||||
void ActionCredit()
|
void ActionCredit(void)
|
||||||
{
|
{
|
||||||
if (Credit.offset >= Credit.size)
|
if (Credit.offset >= Credit.size)
|
||||||
return;
|
return;
|
||||||
|
@ -258,11 +262,12 @@ void ActionCredit()
|
||||||
case 2:
|
case 2:
|
||||||
if (--Credit.wait <= 0)
|
if (--Credit.wait <= 0)
|
||||||
Credit.mode = 1;
|
Credit.mode = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse credits
|
// Parse credits
|
||||||
void ActionCredit_Read()
|
void ActionCredit_Read(void)
|
||||||
{
|
{
|
||||||
int a, b, len;
|
int a, b, len;
|
||||||
char text[40];
|
char text[40];
|
||||||
|
@ -429,7 +434,7 @@ void SetCreditIllust(int a)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slide illustration off-screen
|
// Slide illustration off-screen
|
||||||
void CutCreditIllust()
|
void CutCreditIllust(void)
|
||||||
{
|
{
|
||||||
Illust.act_no = 2;
|
Illust.act_no = 2;
|
||||||
}
|
}
|
||||||
|
@ -437,8 +442,10 @@ void CutCreditIllust()
|
||||||
// Scene of the island falling
|
// Scene of the island falling
|
||||||
int Scene_DownIsland(HWND hWnd, int mode)
|
int Scene_DownIsland(HWND hWnd, int mode)
|
||||||
{
|
{
|
||||||
|
int wait;
|
||||||
|
|
||||||
// Setup background
|
// Setup background
|
||||||
RECT rc_frame = {(WINDOW_WIDTH - 160) / 2, (WINDOW_HEIGHT - 80) / 2, (WINDOW_WIDTH + 160) / 2, (WINDOW_HEIGHT + 80) / 2};
|
RECT rc_frame = {(WINDOW_WIDTH / 2) - 80, (WINDOW_HEIGHT / 2) - 40, (WINDOW_WIDTH / 2) + 80, (WINDOW_HEIGHT / 2) + 40};
|
||||||
RECT rc_sky = {0, 0, 160, 80};
|
RECT rc_sky = {0, 0, 160, 80};
|
||||||
RECT rc_ground = {160, 48, 320, 80};
|
RECT rc_ground = {160, 48, 320, 80};
|
||||||
|
|
||||||
|
@ -446,10 +453,10 @@ int Scene_DownIsland(HWND hWnd, int mode)
|
||||||
RECT rc_sprite = {160, 0, 200, 24};
|
RECT rc_sprite = {160, 0, 200, 24};
|
||||||
|
|
||||||
ISLAND_SPRITE sprite;
|
ISLAND_SPRITE sprite;
|
||||||
sprite.x = 0x15000;
|
sprite.x = 168 * 0x200;
|
||||||
sprite.y = 0x8000;
|
sprite.y = 64 * 0x200;
|
||||||
|
|
||||||
for (int wait = 0; wait < 900; wait++)
|
for (wait = 0; wait < 900; ++wait)
|
||||||
{
|
{
|
||||||
// Get pressed keys
|
// Get pressed keys
|
||||||
GetTrg();
|
GetTrg();
|
||||||
|
@ -500,9 +507,9 @@ int Scene_DownIsland(HWND hWnd, int mode)
|
||||||
|
|
||||||
// Draw scene
|
// Draw scene
|
||||||
CortBox(&grcFull, 0);
|
CortBox(&grcFull, 0);
|
||||||
PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 80 + (WINDOW_HEIGHT - 240) / 2, &rc_sky, SURFACE_ID_LEVEL_SPRITESET_1);
|
PutBitmap3(&rc_frame, 80 + ((WINDOW_WIDTH - 320) / 2), 80 + ((WINDOW_HEIGHT - 240) / 2), &rc_sky, SURFACE_ID_LEVEL_SPRITESET_1);
|
||||||
PutBitmap3(&rc_frame, sprite.x / 0x200 - 20 + (WINDOW_WIDTH - 320) / 2, sprite.y / 512 - 12 + (WINDOW_HEIGHT - 240) / 2, &rc_sprite, SURFACE_ID_LEVEL_SPRITESET_1);
|
PutBitmap3(&rc_frame, (sprite.x / 0x200) - 20 + ((WINDOW_WIDTH - 320) / 2), (sprite.y / 0x200) - 12 + ((WINDOW_HEIGHT - 240) / 2), &rc_sprite, SURFACE_ID_LEVEL_SPRITESET_1);
|
||||||
PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 128 + (WINDOW_HEIGHT - 240) / 2, &rc_ground, SURFACE_ID_LEVEL_SPRITESET_1);
|
PutBitmap3(&rc_frame, 80 + ((WINDOW_WIDTH - 320) / 2), 128 + ((WINDOW_HEIGHT - 240) / 2), &rc_ground, SURFACE_ID_LEVEL_SPRITESET_1);
|
||||||
PutTimeCounter(16, 8);
|
PutTimeCounter(16, 8);
|
||||||
|
|
||||||
// Draw window
|
// Draw window
|
||||||
|
|
22
src/Ending.h
22
src/Ending.h
|
@ -37,19 +37,19 @@ struct ISLAND_SPRITE
|
||||||
|
|
||||||
#define MAX_STRIP ((WINDOW_HEIGHT / 16) + 1)
|
#define MAX_STRIP ((WINDOW_HEIGHT / 16) + 1)
|
||||||
|
|
||||||
void ActionStripper();
|
void ActionStripper(void);
|
||||||
void PutStripper();
|
void PutStripper(void);
|
||||||
void SetStripper(int x, int y, const char *text, int cast);
|
void SetStripper(int x, int y, const char *text, int cast);
|
||||||
void RestoreStripper();
|
void RestoreStripper(void);
|
||||||
void ActionIllust();
|
void ActionIllust(void);
|
||||||
void PutIllust();
|
void PutIllust(void);
|
||||||
void ReloadIllust(int a);
|
void ReloadIllust(int a);
|
||||||
void InitCreditScript();
|
void InitCreditScript(void);
|
||||||
void ReleaseCreditScript();
|
void ReleaseCreditScript(void);
|
||||||
BOOL StartCreditScript();
|
BOOL StartCreditScript(void);
|
||||||
void ActionCredit();
|
void ActionCredit(void);
|
||||||
void ActionCredit_Read();
|
void ActionCredit_Read(void);
|
||||||
int GetScriptNumber(const char *text);
|
int GetScriptNumber(const char *text);
|
||||||
void SetCreditIllust(int a);
|
void SetCreditIllust(int a);
|
||||||
void CutCreditIllust();
|
void CutCreditIllust(void);
|
||||||
int Scene_DownIsland(HWND hWnd, int mode);
|
int Scene_DownIsland(HWND hWnd, int mode);
|
||||||
|
|
Loading…
Add table
Reference in a new issue