Made Ending.cpp ASM-accurate

This commit is contained in:
Clownacy 2019-05-13 20:43:43 +01:00
parent d3af5e372f
commit c9d5b3d03a
13 changed files with 287 additions and 174 deletions

View file

@ -355,6 +355,70 @@ addr = 0x40AD60
name = "DefaultConfigData" name = "DefaultConfigData"
addr = 0x40AE30 addr = 0x40AE30
[[func]]
name = "ActionStripper"
addr = 0x40CF90
[[func]]
name = "PutStripper"
addr = 0x40D010
[[func]]
name = "SetStripper"
addr = 0x40D150
[[func]]
name = "RestoreStripper"
addr = 0x40D240
[[func]]
name = "ActionIllust"
addr = 0x40D2D0
[[func]]
name = "PutIllust"
addr = 0x40D350
[[func]]
name = "ReloadIllust"
addr = 0x40D3A0
[[func]]
name = "InitCreditScript"
addr = 0x40D3E0
[[func]]
name = "ReleaseCreditScript"
addr = 0x40D410
[[func]]
name = "StartCreditScript"
addr = 0x40D440
[[func]]
name = "ActionCredit"
addr = 0x40D5C0
[[func]]
name = "ActionCredit_Read"
addr = 0x40D620
[[func]]
name = "GetScriptNumber"
addr = 0x40DB00
[[func]]
name = "SetCreditIllust"
addr = 0x40DB40
[[func]]
name = "CutCreditIllust"
addr = 0x40DB60
[[func]]
name = "Scene_DownIsland"
addr = 0x40DB70
[[func]] [[func]]
name = "Call_Escape" name = "Call_Escape"
addr = 0x40DD70 addr = 0x40DD70

View file

@ -391,7 +391,7 @@ int CampLoop()
if (gKeyTrg & KEY_ESCAPE) if (gKeyTrg & KEY_ESCAPE)
{ {
switch (Call_Escape(hWnd)) switch (Call_Escape(ghWnd))
{ {
case 0: case 0:
return 0; return 0;
@ -433,7 +433,7 @@ int CampLoop()
} }
} }
if (!Flip_SystemTask(hWnd)) if (!Flip_SystemTask(ghWnd))
return 0; return 0;
} }

View file

@ -39,20 +39,27 @@ void ActionStripper()
// Draw casts // Draw casts
void PutStripper() void PutStripper()
{ {
RECT rc;
for (int s = 0; s < MAX_STRIP; s++) for (int s = 0; s < MAX_STRIP; s++)
{ {
if (Strip[s].flag & 0x80) if (Strip[s].flag & 0x80)
{ {
// Draw text // Draw text
RECT rc = {0, 16 * s, 320, 16 * s + 16}; rc.left = 0;
PutBitmap3(&grcFull, (Strip[s].x + ((WINDOW_WIDTH - 320) << 8)) / 0x200, Strip[s].y / 0x200, &rc, SURFACE_ID_CREDIT_CAST); rc.right = 320;
rc.top = s * 0x10;
rc.bottom = rc.top + 0x10;
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 = 24 * (Strip[s].cast % 13);
rc.right = rc.left + 24; rc.right = rc.left + 24;
rc.top = 24 * (Strip[s].cast / 13); rc.top = 24 * (Strip[s].cast / 13);
rc.bottom = rc.top + 24; rc.bottom = rc.top + 24;
PutBitmap3(&grcFull, (Strip[s].x + ((WINDOW_WIDTH - 320) << 8)) / 0x200 - 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);
} }
} }
} }
@ -60,34 +67,47 @@ void PutStripper()
// Create a cast object // Create a cast object
void SetStripper(int x, int y, const char *text, int cast) void SetStripper(int x, int y, const char *text, int cast)
{ {
for (int s = 0; s < MAX_STRIP; s++) RECT rc;
{ int s;
if (!(Strip[s].flag & 0x80))
{
// 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 for (s = 0; s < MAX_STRIP; s++)
RECT rc = {0, 16 * s, 320, 16 * s + 16}; if (!(Strip[s].flag & 0x80))
CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST);
PutText2(0, 16 * s, text, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST);
break; break;
}
} if (s == MAX_STRIP)
return;
// 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
rc.left = 0;
rc.right = 320;
rc.top = s * 0x10;
rc.bottom = rc.top + 0x10;
CortBox2(&rc, 0, 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()
{ {
RECT rc;
for (int s = 0; s < MAX_STRIP; s++) for (int s = 0; s < MAX_STRIP; s++)
{ {
if (Strip[s].flag & 0x80) if (Strip[s].flag & 0x80)
{ {
RECT rc = {0, 16 * s, 320, 16 * s + 16}; rc.left = 0;
rc.right = 320;
rc.top = s * 0x10;
rc.bottom = rc.top + 0x10;
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);
} }
@ -121,8 +141,13 @@ void ActionIllust()
void PutIllust() void PutIllust()
{ {
RECT rcIllust = {0, 0, 160, 240}; RECT rcIllust = {0, 0, 160, 240};
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240
// Widescreen edit
RECT rcClip = {(WINDOW_WIDTH - 320) / 2, 0, WINDOW_WIDTH, WINDOW_HEIGHT}; RECT rcClip = {(WINDOW_WIDTH - 320) / 2, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
PutBitmap3(&rcClip, (Illust.x + ((WINDOW_WIDTH - 320) << 8)) / 0x200, (WINDOW_HEIGHT - 240) / 2, &rcIllust, SURFACE_ID_CREDITS_IMAGE); PutBitmap3(&rcClip, (Illust.x / 0x200) + ((WINDOW_WIDTH - 320) / 2), (WINDOW_HEIGHT - 240) / 2, &rcIllust, SURFACE_ID_CREDITS_IMAGE);
#else
PutBitmap3(&grcFull, (Illust.x / 0x200) + ((WINDOW_WIDTH - 320) / 2), (WINDOW_HEIGHT - 240) / 2, &rcIllust, SURFACE_ID_CREDITS_IMAGE);
#endif
} }
// Load illustration // Load illustration
@ -151,8 +176,10 @@ void ReleaseCreditScript()
} }
} }
const char *credit_script = "Credit.tsc";
// Start playing credits // Start playing credits
bool StartCreditScript() BOOL StartCreditScript()
{ {
// Clear previously existing credits data // Clear previously existing credits data
if (Credit.pData) if (Credit.pData)
@ -163,22 +190,22 @@ bool StartCreditScript()
// Open file // Open file
char path[PATH_LENGTH]; char path[PATH_LENGTH];
sprintf(path, "%s/%s", gDataPath, "Credit.tsc"); sprintf(path, "%s/%s", gDataPath, credit_script);
Credit.size = GetFileSizeLong(path); Credit.size = GetFileSizeLong(path);
if (Credit.size == -1) if (Credit.size == -1)
return false; return FALSE;
// Allocate buffer data // Allocate buffer data
Credit.pData = (char*)malloc(Credit.size); Credit.pData = (char*)malloc(Credit.size);
if (Credit.pData == NULL) if (Credit.pData == NULL)
return false; return FALSE;
FILE *fp = fopen(path, "rb"); FILE *fp = fopen(path, "rb");
if (fp == NULL) if (fp == NULL)
{ {
printf("Couldn't open %s", path); free(Credit.pData);
return false; return FALSE;
} }
// Read data // Read data
@ -199,98 +226,97 @@ bool StartCreditScript()
// Modify cliprect // Modify cliprect
grcGame.left = WINDOW_WIDTH / 2; grcGame.left = WINDOW_WIDTH / 2;
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240
// These three are non-vanilla: for wide/tallscreen support // These three are non-vanilla: for wide/tallscreen support
grcGame.right = ((WINDOW_WIDTH - 320) / 2) + 320; grcGame.right = ((WINDOW_WIDTH - 320) / 2) + 320;
grcGame.top = (WINDOW_HEIGHT - 240) / 2; grcGame.top = (WINDOW_HEIGHT - 240) / 2;
grcGame.bottom = ((WINDOW_HEIGHT - 240) / 2) + 240; grcGame.bottom = ((WINDOW_HEIGHT - 240) / 2) + 240;
#endif
// Reload casts // Reload casts
if (!ReloadBitmap_File("casts", SURFACE_ID_CASTS)) if (!ReloadBitmap_File("casts", SURFACE_ID_CASTS))
return false; return FALSE;
// Clear casts // Clear casts
memset(Strip, 0, sizeof(Strip)); memset(Strip, 0, sizeof(Strip));
return true; return TRUE;
} }
// Get number from text (4 digit) // Get number from text (4 digit)
int GetScriptNumber(const char *text) int GetScriptNumber(const char *text)
{ {
return 1000 * text[0] - 48000 + return (text[0] - '0') * 1000 +
100 * text[1] - 4800 + (text[1] - '0') * 100 +
10 * text[2] - 480 + (text[2] - '0') * 10 +
text[3] - 48; text[3] - '0';
} }
// Parse credits // Parse credits
void ActionCredit_Read() void ActionCredit_Read()
{ {
while (Credit.offset < Credit.size) int a, b, len;
{ char text[40];
// Get character
unsigned char character = Credit.pData[Credit.offset];
int a, b, len; while (1)
switch (character) {
if (Credit.offset >= Credit.size)
break;
switch (Credit.pData[Credit.offset])
{ {
case '[': // Create cast case '[': // Create cast
// Get the range for the cast text // Get the range for the cast text
a = ++Credit.offset; ++Credit.offset;
a = Credit.offset;
while (Credit.pData[a] != ']') while (Credit.pData[a] != ']')
{ {
if (IsShiftJIS(Credit.pData[a])) if (IsShiftJIS(Credit.pData[a]))
a += 2; a += 2;
else else
a++; a += 1;
} }
len = a - Credit.offset; 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], len);
memcpy(text, &Credit.pData[Credit.offset], a - Credit.offset);
text[len] = 0; text[len] = 0;
// Get cast id // Get cast id
Credit.offset = a + 1; Credit.offset = a;
len = GetScriptNumber(&Credit.pData[a + 1]); len = GetScriptNumber(&Credit.pData[++Credit.offset]);
// Create cast object // Create cast object
SetStripper(Credit.start_x, (WINDOW_HEIGHT << 9) + 0x1000, text, len); SetStripper(Credit.start_x, (WINDOW_HEIGHT * 0x200) + (8 * 0x200), text, len);
// Change offset // Change offset
Credit.offset += 4; Credit.offset += 4;
return; return;
case 'j': // Jump to label case '-': // Wait for X amount of frames
// Get number ++Credit.offset;
b = GetScriptNumber(&Credit.pData[++Credit.offset]); Credit.wait = GetScriptNumber(&Credit.pData[Credit.offset]);
// Change offset
Credit.offset += 4; Credit.offset += 4;
Credit.mode = 2;
return;
// Jump to specific label case '+': // Change casts x-position
while (Credit.offset < Credit.size) ++Credit.offset;
{ Credit.start_x = GetScriptNumber(&Credit.pData[Credit.offset]) * 0x200;
if (Credit.pData[Credit.offset] == 'l') Credit.offset += 4;
{ return;
// What is this
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
Credit.offset += 4;
if (b == a)
return;
}
else if (IsShiftJIS(Credit.pData[Credit.offset]))
{
Credit.offset += 2;
}
else
{
++Credit.offset;
}
}
case '/': // Stop credits
Credit.mode = 0;
return;
case '!': // Change music
++Credit.offset;
a = GetScriptNumber(&Credit.pData[Credit.offset]);
Credit.offset += 4;
ChangeMusic(a);
return; return;
case '~': // Start fading out music case '~': // Start fading out music
@ -298,9 +324,46 @@ void ActionCredit_Read()
SetOrganyaFadeout(); SetOrganyaFadeout();
return; return;
case 'j': // Jump to label
++Credit.offset;
// Get number
b = GetScriptNumber(&Credit.pData[Credit.offset]);
// Change offset
Credit.offset += 4;
// Jump to specific label
if (1)
{
while (Credit.offset < Credit.size)
{
if (Credit.pData[Credit.offset] == 'l')
{
// What is this
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
Credit.offset += 4;
if (b == a)
break;
}
else if (IsShiftJIS(Credit.pData[Credit.offset]))
{
Credit.offset += 2;
}
else
{
++Credit.offset;
}
}
}
return;
case 'f': // Flag jump case 'f': // Flag jump
++Credit.offset;
// Read numbers XXXX:YYYY // Read numbers XXXX:YYYY
a = GetScriptNumber(&Credit.pData[++Credit.offset]); a = GetScriptNumber(&Credit.pData[Credit.offset]);
Credit.offset += 5; Credit.offset += 5;
b = GetScriptNumber(&Credit.pData[Credit.offset]); b = GetScriptNumber(&Credit.pData[Credit.offset]);
Credit.offset += 4; Credit.offset += 4;
@ -316,7 +379,7 @@ void ActionCredit_Read()
a = GetScriptNumber(&Credit.pData[++Credit.offset]); a = GetScriptNumber(&Credit.pData[++Credit.offset]);
Credit.offset += 4; Credit.offset += 4;
if (b == a) if (b == a)
return; break;
} }
else if (IsShiftJIS(Credit.pData[Credit.offset])) else if (IsShiftJIS(Credit.pData[Credit.offset]))
{ {
@ -330,47 +393,30 @@ void ActionCredit_Read()
} }
return; return;
case '+': // Change casts x-position default:
Credit.start_x = GetScriptNumber(&Credit.pData[++Credit.offset]) << 9; // Progress through file
Credit.offset += 4; ++Credit.offset;
return; break;
case '-': // Wait for X amount of frames
Credit.wait = GetScriptNumber(&Credit.pData[++Credit.offset]);
Credit.offset += 4;
Credit.mode = 2;
return;
case '/': // Stop credits
Credit.mode = 0;
return;
case '!': // Change music
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
Credit.offset += 4;
ChangeMusic(a);
return;
} }
// Progress through file
++Credit.offset;
} }
} }
// Update credits // Update credits
void ActionCredit() void ActionCredit()
{ {
if (Credit.offset < Credit.size) if (Credit.offset >= Credit.size)
return;
// Update script, or if waiting, decrement the wait value
switch (Credit.mode)
{ {
// Update script, or if waiting, decrement the wait value case 1:
if (Credit.mode == 1)
{
ActionCredit_Read(); ActionCredit_Read();
} break;
else if (Credit.mode == 2 && --Credit.wait <= 0)
{ case 2:
Credit.mode = 1; if (--Credit.wait <= 0)
} Credit.mode = 1;
} }
} }
@ -388,7 +434,7 @@ void CutCreditIllust()
} }
// Scene of the island falling // Scene of the island falling
int Scene_DownIsland(int mode) int Scene_DownIsland(int hWnd, 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_frame = {(WINDOW_WIDTH - 160) / 2, (WINDOW_HEIGHT - 80) / 2, (WINDOW_WIDTH + 160) / 2, (WINDOW_HEIGHT + 80) / 2};
@ -410,11 +456,13 @@ int Scene_DownIsland(int mode)
// Escape menu // Escape menu
if (gKey & 0x8000) if (gKey & 0x8000)
{ {
int escRet = Call_Escape(hWnd); switch (Call_Escape(hWnd))
if (escRet == 0) {
return 0; case 0:
if (escRet == 2) return 0;
return 2; case 2:
return 2;
}
} }
switch (mode) switch (mode)
@ -425,33 +473,27 @@ int Scene_DownIsland(int mode)
break; break;
case 1: case 1:
if (wait >= 350) if (wait < 350)
{
if (wait >= 500)
{
if (wait >= 600)
{
// End scene
if (wait == 750)
wait = 900;
}
else
{
// Move down slow
sprite.y += 0xC;
}
}
else
{
// Move down slower
sprite.y += 0x19;
}
}
else
{ {
// Move down at normal speed // Move down at normal speed
sprite.y += 0x33; sprite.y += 0x33;
} }
else if (wait < 500)
{
// Move down slower
sprite.y += 0x19;
}
else if (wait < 600)
{
// Move down slow
sprite.y += 0xC;
}
else if (wait == 750)
{
// End scene
wait = 900;
}
break; break;
} }

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "WindowsWrapper.h"
struct CREDIT struct CREDIT
{ {
int size; int size;
@ -42,8 +44,8 @@ void PutIllust();
void ReloadIllust(int a); void ReloadIllust(int a);
void InitCreditScript(); void InitCreditScript();
void ReleaseCreditScript(); void ReleaseCreditScript();
bool StartCreditScript(); BOOL StartCreditScript();
void ActionCredit(); void ActionCredit();
void SetCreditIllust(int a); void SetCreditIllust(int a);
void CutCreditIllust(); void CutCreditIllust();
int Scene_DownIsland(int mode); int Scene_DownIsland(int hWnd, int mode);

View file

@ -141,7 +141,7 @@ int ModeOpening()
// Escape menu // Escape menu
if (gKey & KEY_ESCAPE) if (gKey & KEY_ESCAPE)
{ {
int escRet = Call_Escape(hWnd); int escRet = Call_Escape(ghWnd);
if (escRet == 0) if (escRet == 0)
return 0; return 0;
if (escRet == 2) if (escRet == 2)
@ -193,7 +193,7 @@ int ModeOpening()
PutTextScript(); PutTextScript();
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask(hWnd)) if (!Flip_SystemTask(ghWnd))
return 0; return 0;
++gCounter; ++gCounter;
@ -204,7 +204,7 @@ int ModeOpening()
{ {
CortBox(&grcGame, 0x000000); CortBox(&grcGame, 0x000000);
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask(hWnd)) if (!Flip_SystemTask(ghWnd))
return 0; return 0;
} }
return 2; return 2;
@ -335,7 +335,7 @@ int ModeTitle()
if (gKey & KEY_ESCAPE) if (gKey & KEY_ESCAPE)
{ {
int escRet = Call_Escape(hWnd); int escRet = Call_Escape(ghWnd);
if (escRet == 0) if (escRet == 0)
return 0; return 0;
if (escRet == 2) if (escRet == 2)
@ -420,7 +420,7 @@ int ModeTitle()
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask(hWnd)) if (!Flip_SystemTask(ghWnd))
return 0; return 0;
} }
@ -433,7 +433,7 @@ int ModeTitle()
{ {
CortBox(&grcGame, 0); CortBox(&grcGame, 0);
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask(hWnd)) if (!Flip_SystemTask(ghWnd))
return 0; return 0;
} }
@ -479,7 +479,7 @@ int ModeAction()
// Escape menu // Escape menu
if (gKey & KEY_ESCAPE) if (gKey & KEY_ESCAPE)
{ {
int escRet = Call_Escape(hWnd); int escRet = Call_Escape(ghWnd);
if (escRet == 0) if (escRet == 0)
return 0; return 0;
if (escRet == 2) if (escRet == 2)
@ -614,7 +614,7 @@ int ModeAction()
PutTextScript(); PutTextScript();
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask(hWnd)) if (!Flip_SystemTask(ghWnd))
break; break;
++gCounter; ++gCounter;
} }

View file

@ -2,16 +2,18 @@
#include <stdio.h> #include <stdio.h>
#include "WindowsWrapper.h"
#include "CommonDefines.h" #include "CommonDefines.h"
#include "Tags.h" #include "Tags.h"
bool GetCompileVersion(int *v1, int *v2, int *v3, int *v4) BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
{ {
*v1 = 1; *v1 = 1;
*v2 = 0; *v2 = 0;
*v3 = 0; *v3 = 0;
*v4 = 6; *v4 = 6;
return true; return TRUE;
} }
long GetFileSizeLong(const char *path) long GetFileSizeLong(const char *path)
@ -29,7 +31,7 @@ long GetFileSizeLong(const char *path)
return len; return len;
} }
bool CheckFileExists(const char *name) BOOL CheckFileExists(const char *name)
{ {
char path[PATH_LENGTH]; char path[PATH_LENGTH];
sprintf(path, "%s/%s", gModulePath, name); sprintf(path, "%s/%s", gModulePath, name);
@ -38,17 +40,17 @@ bool CheckFileExists(const char *name)
if (file) if (file)
{ {
fclose(file); fclose(file);
return true; return TRUE;
} }
return false; return FALSE;
} }
bool IsShiftJIS(unsigned char c) BOOL IsShiftJIS(unsigned char c)
{ {
if (c > 0x80 && c < 0xA0) if (c > 0x80 && c < 0xA0)
return true; return TRUE;
if (c < 0xE0 || c >= 0xF0) if (c < 0xE0 || c >= 0xF0)
return false; return FALSE;
return true; return TRUE;
} }

View file

@ -1,6 +1,8 @@
#pragma once #pragma once
bool GetCompileVersion(int *v1, int *v2, int *v3, int *v4); #include "WindowsWrapper.h"
BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4);
long GetFileSizeLong(const char *path); long GetFileSizeLong(const char *path);
bool CheckFileExists(const char *name); BOOL CheckFileExists(const char *name);
bool IsShiftJIS(unsigned char c); BOOL IsShiftJIS(unsigned char c);

View file

@ -32,7 +32,7 @@ char gDataPath[PATH_LENGTH];
int gJoystickButtonTable[8]; int gJoystickButtonTable[8];
int hWnd; // Placeholder until we restore the WinAPI code int ghWnd; // Placeholder until we restore the WinAPI code
bool gbUseJoystick = false; bool gbUseJoystick = false;
bool bFps = false; bool bFps = false;
@ -350,7 +350,7 @@ int main(int argc, char *argv[])
PutBitmap3(&clip_rect, (WINDOW_WIDTH - 64) / 2, (WINDOW_HEIGHT - 8) / 2, &loading_rect, SURFACE_ID_LOADING); PutBitmap3(&clip_rect, (WINDOW_WIDTH - 64) / 2, (WINDOW_HEIGHT - 8) / 2, &loading_rect, SURFACE_ID_LOADING);
// Draw to screen // Draw to screen
if (Flip_SystemTask(hWnd)) if (Flip_SystemTask(ghWnd))
{ {
// Initialize sound // Initialize sound
InitDirectSound(); InitDirectSound();

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
extern int hWnd; extern int ghWnd;
void PutFramePerSecound(); void PutFramePerSecound();
int GetFramePerSecound(); int GetFramePerSecound();

View file

@ -95,7 +95,7 @@ int MiniMapLoop()
if (gKey & KEY_ESCAPE) if (gKey & KEY_ESCAPE)
{ {
switch (Call_Escape(hWnd)) switch (Call_Escape(ghWnd))
{ {
case 0: case 0:
return 0; return 0;
@ -115,7 +115,7 @@ int MiniMapLoop()
CortBox(&rcView, 0); CortBox(&rcView, 0);
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask(hWnd)) if (!Flip_SystemTask(ghWnd))
return 0; return 0;
} }
@ -139,7 +139,7 @@ int MiniMapLoop()
if (gKey & KEY_ESCAPE) if (gKey & KEY_ESCAPE)
{ {
switch (Call_Escape(hWnd)) switch (Call_Escape(ghWnd))
{ {
case 0: case 0:
return 0; return 0;
@ -170,7 +170,7 @@ int MiniMapLoop()
PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, SURFACE_ID_TEXT_BOX); PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, SURFACE_ID_TEXT_BOX);
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask(hWnd)) if (!Flip_SystemTask(ghWnd))
return 0; return 0;
} }
@ -180,7 +180,7 @@ int MiniMapLoop()
if (gKey & KEY_ESCAPE) if (gKey & KEY_ESCAPE)
{ {
switch (Call_Escape(hWnd)) switch (Call_Escape(ghWnd))
{ {
case 0: case 0:
return 0; return 0;
@ -200,7 +200,7 @@ int MiniMapLoop()
CortBox(&rcView, 0); CortBox(&rcView, 0);
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask(hWnd)) if (!Flip_SystemTask(ghWnd))
return 0; return 0;
} }

View file

@ -254,12 +254,12 @@ BOOL InitializeGame()
InitFlags(); InitFlags();
if (!TransferStage(13, 200, 10, 8)) if (!TransferStage(13, 200, 10, 8))
{ {
// TODO - restore this when hWnd is available // TODO - restore this when ghWnd is available
/*#if defined(NONPORTABLE) && defined(WINDOWS) /*#if defined(NONPORTABLE) && defined(WINDOWS)
#ifdef JAPANESE #ifdef JAPANESE
MessageBoxA(hWnd, "ステージの読み込みに失敗", "エラー", MB_OK); MessageBoxA(ghWnd, "ステージの読み込みに失敗", "エラー", MB_OK);
#else #else
MessageBoxA(hWnd, "Failed to load stage", "Error", MB_OK); MessageBoxA(ghWnd, "Failed to load stage", "Error", MB_OK);
#endif #endif
#else*/ #else*/
#ifdef JAPANESE #ifdef JAPANESE

View file

@ -151,7 +151,7 @@ int StageSelectLoop(int *p_event)
if (gKey & KEY_ESCAPE) if (gKey & KEY_ESCAPE)
{ {
int escRet = Call_Escape(hWnd); int escRet = Call_Escape(ghWnd);
if (escRet == 0) if (escRet == 0)
return 0; return 0;
if (escRet == 2) if (escRet == 2)
@ -193,7 +193,7 @@ int StageSelectLoop(int *p_event)
PutFramePerSecound(); PutFramePerSecound();
} }
while (Flip_SystemTask(hWnd)); while (Flip_SystemTask(ghWnd));
return 0; return 0;
} }

View file

@ -21,6 +21,7 @@
#include "Game.h" #include "Game.h"
#include "Generic.h" #include "Generic.h"
#include "KeyControl.h" #include "KeyControl.h"
#include "Main.h"
#include "Map.h" #include "Map.h"
#include "MapName.h" #include "MapName.h"
#include "MiniMap.h" #include "MiniMap.h"
@ -682,7 +683,7 @@ int TextScriptProc()
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Failed to load stage", NULL); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Failed to load stage", NULL);
#endif #endif
//MessageBoxA(hWnd, "ステージの読み込みに失敗", "エラー", 0); //MessageBoxA(ghWnd, "ステージの読み込みに失敗", "エラー", 0);
return 0; return 0;
} }
} }
@ -1207,7 +1208,7 @@ int TextScriptProc()
bExit = TRUE; bExit = TRUE;
z = GetTextScriptNo(gTS.p_read + 4); z = GetTextScriptNo(gTS.p_read + 4);
switch (Scene_DownIsland(z)) switch (Scene_DownIsland(ghWnd, z))
{ {
case 0: case 0:
return 0; return 0;