Redid formatting for files starting with [C-E]
Also fixed potentially erroneous macro MAX_STRIP (would have problems with operation order in operations) Btw used regex "((//|\;)[^ \t]|(for|while|if|while|do|void|int|bool)\(|(for|while|if|while|do)\ \(.*\)\;|\(\ |\ \)|//\ [a-z])" for this Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
parent
44edb7d26e
commit
e8875bd051
6 changed files with 149 additions and 130 deletions
|
@ -23,14 +23,16 @@ void ActCaret00(CARET *crt)
|
|||
|
||||
void ActCaret01(CARET *crt)
|
||||
{
|
||||
RECT rcLeft[4] = {
|
||||
RECT rcLeft[4] =
|
||||
{
|
||||
{0, 64, 8, 72},
|
||||
{8, 64, 16, 72},
|
||||
{16, 64, 24, 72},
|
||||
{24, 64, 32, 72},
|
||||
};
|
||||
|
||||
RECT rcRight[4] = {
|
||||
RECT rcRight[4] =
|
||||
{
|
||||
{64, 24, 72, 32},
|
||||
{72, 24, 80, 32},
|
||||
{80, 24, 88, 32},
|
||||
|
@ -63,21 +65,24 @@ void ActCaret01(CARET *crt)
|
|||
|
||||
void ActCaret02(CARET *crt)
|
||||
{
|
||||
RECT rect_left[4] = {
|
||||
RECT rect_left[4] =
|
||||
{
|
||||
{0, 32, 16, 48},
|
||||
{16, 32, 32, 48},
|
||||
{32, 32, 48, 48},
|
||||
{48, 32, 64, 48},
|
||||
};
|
||||
|
||||
RECT rect_right[4] = {
|
||||
RECT rect_right[4] =
|
||||
{
|
||||
{176, 0, 192, 16},
|
||||
{192, 0, 208, 16},
|
||||
{208, 0, 224, 16},
|
||||
{224, 0, 240, 16},
|
||||
};
|
||||
|
||||
RECT rect_up[3] = {
|
||||
RECT rect_up[3] =
|
||||
{
|
||||
{0, 32, 16, 48},
|
||||
{32, 32, 48, 48},
|
||||
{16, 32, 32, 48},
|
||||
|
@ -126,7 +131,8 @@ void ActCaret02(CARET *crt)
|
|||
|
||||
void ActCaret03(CARET *crt)
|
||||
{
|
||||
RECT rect[4] = {
|
||||
RECT rect[4] =
|
||||
{
|
||||
{0, 48, 16, 64},
|
||||
{16, 48, 32, 64},
|
||||
{32, 48, 48, 64},
|
||||
|
@ -145,7 +151,8 @@ void ActCaret03(CARET *crt)
|
|||
|
||||
void ActCaret04(CARET *crt)
|
||||
{
|
||||
RECT rect[9] = {
|
||||
RECT rect[9] =
|
||||
{
|
||||
{64, 32, 80, 48},
|
||||
{80, 32, 96, 48},
|
||||
{96, 32, 112, 48},
|
||||
|
@ -170,7 +177,8 @@ void ActCaret04(CARET *crt)
|
|||
|
||||
void ActCaret05(CARET *crt)
|
||||
{
|
||||
RECT rect[7] = {
|
||||
RECT rect[7] =
|
||||
{
|
||||
{32, 64, 40, 72},
|
||||
{32, 72, 40, 80},
|
||||
{40, 64, 48, 72},
|
||||
|
@ -186,7 +194,7 @@ void ActCaret05(CARET *crt)
|
|||
++crt->ani_no;
|
||||
}
|
||||
|
||||
if ( crt->ani_no > 6 )
|
||||
if (crt->ani_no > 6)
|
||||
crt->cond = 0;
|
||||
|
||||
crt->x += 0x80;
|
||||
|
@ -197,7 +205,8 @@ void ActCaret05(CARET *crt)
|
|||
|
||||
void ActCaret07(CARET *crt)
|
||||
{
|
||||
RECT rcLeft[7] = {
|
||||
RECT rcLeft[7] =
|
||||
{
|
||||
{56, 0, 64, 8},
|
||||
{64, 0, 72, 8},
|
||||
{72, 0, 80, 8},
|
||||
|
@ -264,12 +273,14 @@ void ActCaret09(CARET *crt)
|
|||
|
||||
void ActCaret10(CARET *crt)
|
||||
{
|
||||
RECT rcLeft[2] = {
|
||||
RECT rcLeft[2] =
|
||||
{
|
||||
{0, 0, 56, 16},
|
||||
{0, 16, 56, 32},
|
||||
};
|
||||
|
||||
RECT rcRight[2] = {
|
||||
RECT rcRight[2] =
|
||||
{
|
||||
{0, 96, 56, 112},
|
||||
{0, 112, 56, 128},
|
||||
};
|
||||
|
@ -314,7 +325,8 @@ void ActCaret11(CARET *crt)
|
|||
crt->x += crt->xm;
|
||||
crt->y += crt->ym;
|
||||
|
||||
RECT rcRight[7] = {
|
||||
RECT rcRight[7] =
|
||||
{
|
||||
{56, 8, 64, 16},
|
||||
{64, 8, 72, 16},
|
||||
{72, 8, 80, 16},
|
||||
|
@ -336,7 +348,8 @@ void ActCaret11(CARET *crt)
|
|||
|
||||
void ActCaret12(CARET *crt)
|
||||
{
|
||||
RECT rcLeft[2] = {
|
||||
RECT rcLeft[2] =
|
||||
{
|
||||
{112, 0, 144, 32},
|
||||
{144, 0, 176, 32},
|
||||
};
|
||||
|
@ -353,7 +366,8 @@ void ActCaret12(CARET *crt)
|
|||
|
||||
void ActCaret13(CARET *crt)
|
||||
{
|
||||
RECT rcLeft[2] = {
|
||||
RECT rcLeft[2] =
|
||||
{
|
||||
{56, 24, 64, 32},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
@ -397,7 +411,8 @@ void ActCaret13(CARET *crt)
|
|||
|
||||
void ActCaret14(CARET *crt)
|
||||
{
|
||||
RECT rect[5] = {
|
||||
RECT rect[5] =
|
||||
{
|
||||
{0, 96, 40, 136},
|
||||
{40, 96, 80, 136},
|
||||
{80, 96, 120, 136},
|
||||
|
@ -418,7 +433,8 @@ void ActCaret14(CARET *crt)
|
|||
|
||||
void ActCaret15(CARET *crt)
|
||||
{
|
||||
RECT rcLeft[4] = {
|
||||
RECT rcLeft[4] =
|
||||
{
|
||||
{0, 72, 8, 80},
|
||||
{8, 72, 16, 80},
|
||||
{16, 72, 24, 80},
|
||||
|
@ -438,7 +454,8 @@ void ActCaret15(CARET *crt)
|
|||
|
||||
void ActCaret16(CARET *crt)
|
||||
{
|
||||
RECT rcLeft[2] = {
|
||||
RECT rcLeft[2] =
|
||||
{
|
||||
{104, 96, 144, 104},
|
||||
{104, 104, 144, 112},
|
||||
};
|
||||
|
@ -454,7 +471,8 @@ void ActCaret16(CARET *crt)
|
|||
|
||||
void ActCaret17(CARET *crt)
|
||||
{
|
||||
RECT rcLeft[2] = {
|
||||
RECT rcLeft[2] =
|
||||
{
|
||||
{0, 144, 144, 152},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
@ -468,7 +486,7 @@ void ActCaret17(CARET *crt)
|
|||
crt->rect = rcLeft[1];
|
||||
}
|
||||
|
||||
//Tables
|
||||
// Tables
|
||||
CARET_TABLE gCaretTable[18] =
|
||||
{
|
||||
{0, 0},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#define PATH_LENGTH 260 //Pixel had the path size locked to 260 (dangerously low), if you tried to open the executable in a path with more than around 220 characters, it'd crash.
|
||||
#define PATH_LENGTH 260 // Pixel had the path size locked to 260 (dangerously low), if you tried to open the executable in a path with more than around 220 characters, it'd crash.
|
||||
|
||||
#define WINDOW_WIDTH 320
|
||||
#define WINDOW_HEIGHT 240
|
||||
|
|
59
src/Draw.cpp
59
src/Draw.cpp
|
@ -56,7 +56,7 @@ BOOL Flip_SystemTask()
|
|||
if (!SystemTask())
|
||||
return FALSE;
|
||||
|
||||
//Framerate limiter
|
||||
// Framerate limiter
|
||||
static uint32_t timePrev;
|
||||
const uint32_t timeNow = SDL_GetTicks();
|
||||
|
||||
|
@ -81,15 +81,15 @@ BOOL StartDirectDraw(int lMagnification, int lColourDepth)
|
|||
{
|
||||
(void)lColourDepth;
|
||||
|
||||
//Initialize rendering
|
||||
// Initialize rendering
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
//Create renderer
|
||||
// Create renderer
|
||||
gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED);
|
||||
|
||||
if (gRenderer != NULL)
|
||||
{
|
||||
//Print the name of the renderer SDL2 is using
|
||||
// Print the name of the renderer SDL2 is using
|
||||
SDL_RendererInfo info;
|
||||
SDL_GetRendererInfo(gRenderer, &info);
|
||||
printf("Renderer: %s\n", info.name);
|
||||
|
@ -120,10 +120,10 @@ BOOL StartDirectDraw(int lMagnification, int lColourDepth)
|
|||
|
||||
void EndDirectDraw()
|
||||
{
|
||||
//Quit sub-system
|
||||
// Quit sub-system
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
//Release all surfaces
|
||||
// Release all surfaces
|
||||
for (int i = 0; i < SURFACE_ID_MAX; i++)
|
||||
ReleaseSurface(i);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ static bool IsEnableBitmap(SDL_RWops *fp)
|
|||
|
||||
void ReleaseSurface(int s)
|
||||
{
|
||||
//Release the surface we want to release
|
||||
// Release the surface we want to release
|
||||
if (surf[s].in_use)
|
||||
{
|
||||
SDL_DestroyTexture(surf[s].texture);
|
||||
|
@ -172,7 +172,7 @@ BOOL MakeSurface_Generic(int bxsize, int bysize, Surface_Ids surf_no)
|
|||
}
|
||||
else
|
||||
{
|
||||
//Create surface
|
||||
// Create surface
|
||||
surf[surf_no].surface = SDL_CreateRGBSurfaceWithFormat(0, bxsize * magnification, bysize * magnification, 0, SDL_PIXELFORMAT_RGB24);
|
||||
SDL_SetSurfaceBlendMode(surf[surf_no].surface, SDL_BLENDMODE_NONE);
|
||||
|
||||
|
@ -320,7 +320,7 @@ static BOOL LoadBitmap_File(const char *name, Surface_Ids surf_no, bool create_s
|
|||
char path[PATH_LENGTH];
|
||||
SDL_RWops *fp;
|
||||
|
||||
//Attempt to load PBM
|
||||
// Attempt to load PBM
|
||||
sprintf(path, "%s/%s.pbm", gDataPath, name);
|
||||
fp = SDL_RWFromFile(path, "rb");
|
||||
if (fp)
|
||||
|
@ -338,7 +338,7 @@ static BOOL LoadBitmap_File(const char *name, Surface_Ids surf_no, bool create_s
|
|||
}
|
||||
}
|
||||
|
||||
//Attempt to load BMP
|
||||
// Attempt to load BMP
|
||||
sprintf(path, "%s/%s.bmp", gDataPath, name);
|
||||
fp = SDL_RWFromFile(path, "rb");
|
||||
if (fp)
|
||||
|
@ -412,22 +412,22 @@ static SDL_Rect RectToSDLRectScaled(RECT *rect)
|
|||
|
||||
void BackupSurface(Surface_Ids surf_no, RECT *rect)
|
||||
{
|
||||
//Get renderer size
|
||||
// Get renderer size
|
||||
int w, h;
|
||||
SDL_GetRendererOutputSize(gRenderer, &w, &h);
|
||||
|
||||
//Get texture of what's currently rendered on screen
|
||||
// Get texture of what's currently rendered on screen
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, SDL_PIXELFORMAT_RGB24);
|
||||
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE);
|
||||
SDL_RenderReadPixels(gRenderer, NULL, SDL_PIXELFORMAT_RGB24, surface->pixels, surface->pitch);
|
||||
|
||||
//Get rects
|
||||
// Get rects
|
||||
SDL_Rect frameRect = RectToSDLRectScaled(rect);
|
||||
|
||||
SDL_BlitSurface(surface, &frameRect, surf[surf_no].surface, &frameRect);
|
||||
surf[surf_no].needs_updating = true;
|
||||
|
||||
//Free surface
|
||||
// Free surface
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
|
||||
|
@ -439,40 +439,39 @@ static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_
|
|||
surf[surf_no].needs_updating = false;
|
||||
}
|
||||
|
||||
//Get SDL_Rects
|
||||
// Get SDL_Rects
|
||||
SDL_Rect clipRect = RectToSDLRectScaled(rcView);
|
||||
|
||||
SDL_Rect frameRect = RectToSDLRectScaled(rect);
|
||||
|
||||
//Get dest rect
|
||||
// Get dest rect
|
||||
SDL_Rect destRect = {x * magnification, y * magnification, frameRect.w, frameRect.h};
|
||||
|
||||
//Set cliprect
|
||||
// Set cliprect
|
||||
SDL_RenderSetClipRect(gRenderer, &clipRect);
|
||||
|
||||
SDL_SetTextureBlendMode(surf[surf_no].texture, transparent ? SDL_BLENDMODE_BLEND : SDL_BLENDMODE_NONE);
|
||||
|
||||
//Draw to screen
|
||||
// Draw to screen
|
||||
if (SDL_RenderCopy(gRenderer, surf[surf_no].texture, &frameRect, &destRect) < 0)
|
||||
printf("Failed to draw texture %d\nSDL Error: %s\n", surf_no, SDL_GetError());
|
||||
|
||||
//Undo cliprect
|
||||
// Undo cliprect
|
||||
SDL_RenderSetClipRect(gRenderer, NULL);
|
||||
}
|
||||
|
||||
void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no) //Transparency
|
||||
void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no) // Transparency
|
||||
{
|
||||
DrawBitmap(rcView, x, y, rect, surf_no, true);
|
||||
}
|
||||
|
||||
void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no) //No Transparency
|
||||
void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no) // No Transparency
|
||||
{
|
||||
DrawBitmap(rcView, x, y, rect, surf_no, false);
|
||||
}
|
||||
|
||||
void Surface2Surface(int x, int y, RECT *rect, int to, int from)
|
||||
{
|
||||
//Get rects
|
||||
// Get rects
|
||||
SDL_Rect rcSet = {x * magnification, y * magnification, (rect->right - rect->left) * magnification, (rect->bottom - rect->top) * magnification};
|
||||
SDL_Rect frameRect = RectToSDLRectScaled(rect);
|
||||
|
||||
|
@ -488,10 +487,10 @@ unsigned long GetCortBoxColor(unsigned long col)
|
|||
|
||||
void CortBox(RECT *rect, uint32_t col)
|
||||
{
|
||||
//Get rect
|
||||
// Get rect
|
||||
SDL_Rect destRect = RectToSDLRectScaled(rect);
|
||||
|
||||
//Set colour and draw
|
||||
// Set colour and draw
|
||||
const unsigned char col_red = col & 0x0000FF;
|
||||
const unsigned char col_green = (col & 0x00FF00) >> 8;
|
||||
const unsigned char col_blue = (col & 0xFF0000) >> 16;
|
||||
|
@ -501,10 +500,10 @@ void CortBox(RECT *rect, uint32_t col)
|
|||
|
||||
void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no)
|
||||
{
|
||||
//Get rect
|
||||
// Get rect
|
||||
SDL_Rect destRect = RectToSDLRectScaled(rect);
|
||||
|
||||
//Set colour and draw
|
||||
// Set colour and draw
|
||||
const unsigned char col_red = col & 0x0000FF;
|
||||
const unsigned char col_green = (col & 0x00FF00) >> 8;
|
||||
const unsigned char col_blue = (col & 0xFF0000) >> 16;
|
||||
|
@ -558,7 +557,7 @@ static unsigned char* GetFontFromWindows(size_t *data_size, const char *font_nam
|
|||
|
||||
void InitTextObject(const char *font_name)
|
||||
{
|
||||
//Get font size
|
||||
// Get font size
|
||||
unsigned int fontWidth, fontHeight;
|
||||
|
||||
// The original did this, but Windows would downscale it to 5/10 anyway.
|
||||
|
@ -569,8 +568,10 @@ void InitTextObject(const char *font_name)
|
|||
}
|
||||
else
|
||||
{*/
|
||||
|
||||
fontWidth = 5 * magnification;
|
||||
fontHeight = 10 * magnification;
|
||||
|
||||
// }
|
||||
|
||||
size_t data_size;
|
||||
|
@ -632,7 +633,7 @@ void PutText2(int x, int y, const char *text, uint32_t color, Surface_Ids surf_n
|
|||
|
||||
void EndTextObject()
|
||||
{
|
||||
//Destroy font
|
||||
// Destroy font
|
||||
UnloadFont(gFont);
|
||||
gFont = NULL;
|
||||
}
|
||||
|
|
140
src/Ending.cpp
140
src/Ending.cpp
|
@ -23,32 +23,32 @@ CREDIT Credit;
|
|||
STRIP Strip[MAX_STRIP];
|
||||
ILLUSTRATION Illust;
|
||||
|
||||
//Update casts
|
||||
// Update casts
|
||||
void ActionStripper()
|
||||
{
|
||||
for (int s = 0; s < MAX_STRIP; s++)
|
||||
{
|
||||
//Move up
|
||||
// Move up
|
||||
if (Strip[s].flag & 0x80 && Credit.mode)
|
||||
Strip[s].y -= 0x100;
|
||||
//Get removed when off-screen
|
||||
// Get removed when off-screen
|
||||
if (Strip[s].y <= -0x2000)
|
||||
Strip[s].flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//Draw casts
|
||||
// Draw casts
|
||||
void PutStripper()
|
||||
{
|
||||
for (int s = 0; s < MAX_STRIP; s++)
|
||||
{
|
||||
if (Strip[s].flag & 0x80)
|
||||
{
|
||||
//Draw text
|
||||
// Draw text
|
||||
RECT rc = {0, 16 * s, 320, 16 * s + 16};
|
||||
PutBitmap3(&grcFull, (Strip[s].x + ((WINDOW_WIDTH - 320) << 8)) / 0x200, Strip[s].y / 0x200, &rc, SURFACE_ID_CREDIT_CAST);
|
||||
|
||||
//Draw character
|
||||
// Draw character
|
||||
rc.left = 24 * (Strip[s].cast % 13);
|
||||
rc.right = rc.left + 24;
|
||||
rc.top = 24 * (Strip[s].cast / 13);
|
||||
|
@ -58,21 +58,21 @@ void PutStripper()
|
|||
}
|
||||
}
|
||||
|
||||
//Create a cast object
|
||||
// Create a cast object
|
||||
void SetStripper(int x, int y, const char *text, int cast)
|
||||
{
|
||||
for (int s = 0; s < MAX_STRIP; s++)
|
||||
{
|
||||
if (!(Strip[s].flag & 0x80))
|
||||
{
|
||||
//Initialize cast property
|
||||
// Initialize cast property
|
||||
Strip[s].flag = 0x80;
|
||||
Strip[s].x = x;
|
||||
Strip[s].y = y;
|
||||
Strip[s].cast = cast;
|
||||
strcpy(Strip[s].str, text);
|
||||
|
||||
//Draw text
|
||||
// Draw text
|
||||
RECT rc = {0, 16 * s, 320, 16 * s + 16};
|
||||
CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST);
|
||||
PutText2(0, 16 * s, text, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST);
|
||||
|
@ -81,7 +81,7 @@ void SetStripper(int x, int y, const char *text, int cast)
|
|||
}
|
||||
}
|
||||
|
||||
//Regenerate cast text
|
||||
// Regenerate cast text
|
||||
void RestoreStripper()
|
||||
{
|
||||
for (int s = 0; s < MAX_STRIP; s++)
|
||||
|
@ -95,22 +95,22 @@ void RestoreStripper()
|
|||
}
|
||||
}
|
||||
|
||||
//Handle the illustration
|
||||
// Handle the illustration
|
||||
void ActionIllust()
|
||||
{
|
||||
switch (Illust.act_no)
|
||||
{
|
||||
case 0: //Off-screen to the left
|
||||
case 0: // Off-screen to the left
|
||||
Illust.x = -0x14000;
|
||||
break;
|
||||
|
||||
case 1: //Move in from the left
|
||||
case 1: // Move in from the left
|
||||
Illust.x += 0x5000;
|
||||
if (Illust.x > 0)
|
||||
Illust.x = 0;
|
||||
break;
|
||||
|
||||
case 2: //Move out from the right
|
||||
case 2: // Move out from the right
|
||||
Illust.x -= 0x5000;
|
||||
if (Illust.x < -0x14000)
|
||||
Illust.x = -0x14000;
|
||||
|
@ -118,7 +118,7 @@ void ActionIllust()
|
|||
}
|
||||
}
|
||||
|
||||
//Draw illustration
|
||||
// Draw illustration
|
||||
void PutIllust()
|
||||
{
|
||||
RECT rcIllust = {0, 0, 160, 240};
|
||||
|
@ -126,7 +126,7 @@ void PutIllust()
|
|||
PutBitmap3(&rcClip, (Illust.x + ((WINDOW_WIDTH - 320) << 8)) / 0x200, (WINDOW_HEIGHT - 240) / 2, &rcIllust, SURFACE_ID_CREDITS_IMAGE);
|
||||
}
|
||||
|
||||
//Load illustration
|
||||
// Load illustration
|
||||
void ReloadIllust(int a)
|
||||
{
|
||||
char name[16];
|
||||
|
@ -134,10 +134,10 @@ void ReloadIllust(int a)
|
|||
ReloadBitmap_Resource(name, SURFACE_ID_CREDITS_IMAGE);
|
||||
}
|
||||
|
||||
//Initialize and release credits
|
||||
// Initialize and release credits
|
||||
void InitCreditScript()
|
||||
{
|
||||
//Clear script state and casts
|
||||
// Clear script state and casts
|
||||
memset(&Credit, 0, sizeof(CREDIT));
|
||||
memset(Strip, 0, sizeof(Strip));
|
||||
}
|
||||
|
@ -146,23 +146,23 @@ void ReleaseCreditScript()
|
|||
{
|
||||
if (Credit.pData)
|
||||
{
|
||||
//Free script data
|
||||
// Free script data
|
||||
free(Credit.pData);
|
||||
Credit.pData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//Start playing credits
|
||||
// Start playing credits
|
||||
bool StartCreditScript()
|
||||
{
|
||||
//Clear previously existing credits data
|
||||
// Clear previously existing credits data
|
||||
if (Credit.pData)
|
||||
{
|
||||
free(Credit.pData);
|
||||
Credit.pData = NULL;
|
||||
}
|
||||
|
||||
//Open file
|
||||
// Open file
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gDataPath, "Credit.tsc");
|
||||
|
||||
|
@ -170,7 +170,7 @@ bool StartCreditScript()
|
|||
if (Credit.size == -1)
|
||||
return false;
|
||||
|
||||
//Allcoate buffer data
|
||||
// Allocate buffer data
|
||||
Credit.pData = (char*)malloc(Credit.size);
|
||||
if (Credit.pData == NULL)
|
||||
return false;
|
||||
|
@ -182,7 +182,7 @@ bool StartCreditScript()
|
|||
return false;
|
||||
}
|
||||
|
||||
//Read data
|
||||
// Read data
|
||||
fread(Credit.pData, 1, Credit.size, fp);
|
||||
EncryptionBinaryData2((uint8_t*)Credit.pData, Credit.size);
|
||||
|
||||
|
@ -191,30 +191,30 @@ bool StartCreditScript()
|
|||
fclose(fp);
|
||||
#endif
|
||||
|
||||
//Reset credits
|
||||
// Reset credits
|
||||
Credit.offset = 0;
|
||||
Credit.wait = 0;
|
||||
Credit.mode = 1;
|
||||
Illust.x = -0x14000;
|
||||
Illust.act_no = 0;
|
||||
|
||||
//Modify cliprect
|
||||
// Modify cliprect
|
||||
grcGame.left = WINDOW_WIDTH / 2;
|
||||
// These three are non-vanilla: for wide/tallscreen support
|
||||
grcGame.right = ((WINDOW_WIDTH - 320) / 2) + 320;
|
||||
grcGame.top = (WINDOW_HEIGHT - 240) / 2;
|
||||
grcGame.bottom = ((WINDOW_HEIGHT - 240) / 2) + 240;
|
||||
|
||||
//Reload casts
|
||||
// Reload casts
|
||||
if (!ReloadBitmap_File("casts", SURFACE_ID_CASTS))
|
||||
return false;
|
||||
|
||||
//Clear casts
|
||||
// Clear casts
|
||||
memset(Strip, 0, sizeof(Strip));
|
||||
return true;
|
||||
}
|
||||
|
||||
//Get number from text (4 digit)
|
||||
// Get number from text (4 digit)
|
||||
int GetScriptNumber(const char *text)
|
||||
{
|
||||
return 1000 * text[0] - 48000 +
|
||||
|
@ -223,19 +223,19 @@ int GetScriptNumber(const char *text)
|
|||
text[3] - 48;
|
||||
}
|
||||
|
||||
//Parse credits
|
||||
// Parse credits
|
||||
void ActionCredit_Read()
|
||||
{
|
||||
while (Credit.offset < Credit.size)
|
||||
{
|
||||
//Get character
|
||||
// Get character
|
||||
uint8_t character = Credit.pData[Credit.offset];
|
||||
|
||||
int a, b, len;
|
||||
switch (character)
|
||||
{
|
||||
case '[': //Create cast
|
||||
//Get the range for the cast text
|
||||
case '[': // Create cast
|
||||
// Get the range for the cast text
|
||||
a = ++Credit.offset;
|
||||
|
||||
while (Credit.pData[a] != ']')
|
||||
|
@ -248,35 +248,35 @@ void ActionCredit_Read()
|
|||
|
||||
len = a - Credit.offset;
|
||||
|
||||
//Copy the text to the cast text
|
||||
// Copy the text to the cast text
|
||||
char text[40];
|
||||
memcpy(text, &Credit.pData[Credit.offset], a - Credit.offset);
|
||||
text[len] = 0;
|
||||
|
||||
//Get cast id
|
||||
// Get cast id
|
||||
Credit.offset = a + 1;
|
||||
len = GetScriptNumber(&Credit.pData[a + 1]);
|
||||
|
||||
//Create cast object
|
||||
// Create cast object
|
||||
SetStripper(Credit.start_x, (WINDOW_HEIGHT << 9) + 0x1000, text, len);
|
||||
|
||||
//Change offset
|
||||
// Change offset
|
||||
Credit.offset += 4;
|
||||
return;
|
||||
|
||||
case 'j': //Jump to label
|
||||
//Get number
|
||||
case 'j': // Jump to label
|
||||
// Get number
|
||||
b = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
|
||||
//Change offset
|
||||
// Change offset
|
||||
Credit.offset += 4;
|
||||
|
||||
//Jump to specific label
|
||||
// Jump to specific label
|
||||
while (Credit.offset < Credit.size)
|
||||
{
|
||||
if (Credit.pData[Credit.offset] == 'l')
|
||||
{
|
||||
//what is this
|
||||
// What is this
|
||||
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
Credit.offset += 4;
|
||||
if (b == a)
|
||||
|
@ -294,29 +294,29 @@ void ActionCredit_Read()
|
|||
|
||||
return;
|
||||
|
||||
case '~': //Start fading out music
|
||||
case '~': // Start fading out music
|
||||
++Credit.offset;
|
||||
SetOrganyaFadeout();
|
||||
return;
|
||||
|
||||
case 'f': //Flag jump
|
||||
//Read numbers XXXX:YYYY
|
||||
case 'f': // Flag jump
|
||||
// Read numbers XXXX:YYYY
|
||||
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
Credit.offset += 5;
|
||||
b = GetScriptNumber(&Credit.pData[Credit.offset]);
|
||||
Credit.offset += 4;
|
||||
|
||||
//If flag is set
|
||||
// If flag is set
|
||||
if (GetNPCFlag(a))
|
||||
{
|
||||
//Jump to label
|
||||
while ( Credit.offset < Credit.size )
|
||||
// Jump to label
|
||||
while (Credit.offset < Credit.size)
|
||||
{
|
||||
if (Credit.pData[Credit.offset] == 'l')
|
||||
{
|
||||
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
Credit.offset += 4;
|
||||
if ( b == a )
|
||||
if (b == a)
|
||||
return;
|
||||
}
|
||||
else if (IsShiftJIS(Credit.pData[Credit.offset]))
|
||||
|
@ -331,39 +331,39 @@ void ActionCredit_Read()
|
|||
}
|
||||
return;
|
||||
|
||||
case '+': //Change casts x-position
|
||||
case '+': // Change casts x-position
|
||||
Credit.start_x = GetScriptNumber(&Credit.pData[++Credit.offset]) << 9;
|
||||
Credit.offset += 4;
|
||||
return;
|
||||
|
||||
case '-': //Wait for X amount of frames
|
||||
case '-': // Wait for X amount of frames
|
||||
Credit.wait = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
Credit.offset += 4;
|
||||
Credit.mode = 2;
|
||||
return;
|
||||
|
||||
case '/': //Stop credits
|
||||
case '/': // Stop credits
|
||||
Credit.mode = 0;
|
||||
return;
|
||||
|
||||
case '!': //Change music
|
||||
case '!': // Change music
|
||||
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
Credit.offset += 4;
|
||||
ChangeMusic(a);
|
||||
return;
|
||||
}
|
||||
|
||||
//Progress through file
|
||||
// Progress through file
|
||||
++Credit.offset;
|
||||
}
|
||||
}
|
||||
|
||||
//Update credits
|
||||
// Update credits
|
||||
void ActionCredit()
|
||||
{
|
||||
if (Credit.offset < Credit.size)
|
||||
{
|
||||
//Update script, or if waiting, decrement the wait value
|
||||
// Update script, or if waiting, decrement the wait value
|
||||
if (Credit.mode == 1)
|
||||
{
|
||||
ActionCredit_Read();
|
||||
|
@ -375,28 +375,28 @@ void ActionCredit()
|
|||
}
|
||||
}
|
||||
|
||||
//Change illustration
|
||||
// Change illustration
|
||||
void SetCreditIllust(int a)
|
||||
{
|
||||
ReloadIllust(a);
|
||||
Illust.act_no = 1;
|
||||
}
|
||||
|
||||
//Slide illustration off-screen
|
||||
// Slide illustration off-screen
|
||||
void CutCreditIllust()
|
||||
{
|
||||
Illust.act_no = 2;
|
||||
}
|
||||
|
||||
//Scene of the island falling
|
||||
// Scene of the island falling
|
||||
int Scene_DownIsland(int mode)
|
||||
{
|
||||
//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_sky = {0, 0, 160, 80};
|
||||
RECT rc_ground = {160, 48, 320, 80};
|
||||
|
||||
//Setup island
|
||||
// Setup island
|
||||
RECT rc_sprite = {160, 0, 200, 24};
|
||||
|
||||
ISLAND_SPRITE sprite;
|
||||
|
@ -405,10 +405,10 @@ int Scene_DownIsland(int mode)
|
|||
|
||||
for (int wait = 0; wait < 900; wait++)
|
||||
{
|
||||
//Get pressed keys
|
||||
// Get pressed keys
|
||||
GetTrg();
|
||||
|
||||
//Escape menu
|
||||
// Escape menu
|
||||
if (gKey & 0x8000)
|
||||
{
|
||||
int escRet = Call_Escape();
|
||||
|
@ -421,7 +421,7 @@ int Scene_DownIsland(int mode)
|
|||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
//Move down
|
||||
// Move down
|
||||
sprite.y += 0x33;
|
||||
break;
|
||||
|
||||
|
@ -432,38 +432,38 @@ int Scene_DownIsland(int mode)
|
|||
{
|
||||
if (wait >= 600)
|
||||
{
|
||||
//End scene
|
||||
// End scene
|
||||
if (wait == 750)
|
||||
wait = 900;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Move down slow
|
||||
// Move down slow
|
||||
sprite.y += 0xC;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Move down slower
|
||||
// Move down slower
|
||||
sprite.y += 0x19;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Move down at normal speed
|
||||
// Move down at normal speed
|
||||
sprite.y += 0x33;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//Draw scene
|
||||
// Draw scene
|
||||
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, 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, 80 + (WINDOW_WIDTH - 320) / 2, 128 + (WINDOW_HEIGHT - 240) / 2, &rc_ground, SURFACE_ID_LEVEL_SPRITESET_1);
|
||||
PutTimeCounter(16, 8);
|
||||
|
||||
//Draw window
|
||||
// Draw window
|
||||
PutFramePerSecound();
|
||||
if (!Flip_SystemTask())
|
||||
return 0;
|
||||
|
|
|
@ -33,7 +33,7 @@ struct ISLAND_SPRITE
|
|||
int y;
|
||||
};
|
||||
|
||||
#define MAX_STRIP (WINDOW_HEIGHT / 16) + 1
|
||||
#define MAX_STRIP ((WINDOW_HEIGHT / 16) + 1)
|
||||
|
||||
void ActionStripper();
|
||||
void PutStripper();
|
||||
|
|
|
@ -13,33 +13,33 @@ int Call_Escape()
|
|||
|
||||
while (1)
|
||||
{
|
||||
//Get pressed keys
|
||||
// Get pressed keys
|
||||
GetTrg();
|
||||
|
||||
if (gKeyTrg & KEY_ESCAPE) //Escape is pressed, quit game
|
||||
if (gKeyTrg & KEY_ESCAPE) // Escape is pressed, quit game
|
||||
{
|
||||
gKeyTrg = 0;
|
||||
return 0;
|
||||
}
|
||||
if (gKeyTrg & KEY_F1) //F1 is pressed, continue
|
||||
if (gKeyTrg & KEY_F1) // F1 is pressed, continue
|
||||
{
|
||||
gKeyTrg = 0;
|
||||
return 1;
|
||||
}
|
||||
if (gKeyTrg & KEY_F2) //F2 is pressed, reset
|
||||
if (gKeyTrg & KEY_F2) // F2 is pressed, reset
|
||||
{
|
||||
gKeyTrg = 0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
//Draw screen
|
||||
// Draw screen
|
||||
CortBox(&grcFull, 0x000000);
|
||||
PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, SURFACE_ID_TEXT_BOX);
|
||||
PutFramePerSecound();
|
||||
|
||||
if (!Flip_SystemTask())
|
||||
{
|
||||
//Quit if window is closed
|
||||
// Quit if window is closed
|
||||
gKeyTrg = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue