Remove WINDOWS and NONPORTABLE
Now that the portable stuff gets its own branch, these are unneeded
This commit is contained in:
parent
44f3b15348
commit
4e50046d4b
15 changed files with 12 additions and 361 deletions
2
Makefile
2
Makefile
|
@ -41,7 +41,7 @@ ifeq ($(DEBUG_SAVE), 1)
|
||||||
CXXFLAGS += -DDEBUG_SAVE
|
CXXFLAGS += -DDEBUG_SAVE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS += -std=c++98 -MMD -MP -MF $@.d -DWINDOWS -DNONPORTABLE
|
CXXFLAGS += -std=c++98 -MMD -MP -MF $@.d
|
||||||
LIBS += -lkernel32 -lgdi32 -lddraw -ldinput -ldsound -lversion -lshlwapi -limm32 -lwinmm -ldxguid
|
LIBS += -lkernel32 -lgdi32 -lddraw -ldinput -ldsound -lversion -lshlwapi -limm32 -lwinmm -ldxguid
|
||||||
|
|
||||||
ifeq ($(STATIC), 1)
|
ifeq ($(STATIC), 1)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;WINDOWS;NONPORTABLE"
|
PreprocessorDefinitions="WIN32;_DEBUG"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="0"
|
BasicRuntimeChecks="0"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;WINDOWS;NONPORTABLE"
|
PreprocessorDefinitions="WIN32;NDEBUG"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
AssemblerOutput="4"
|
AssemblerOutput="4"
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;WINDOWS;NONPORTABLE;JAPANESE"
|
PreprocessorDefinitions="WIN32;NDEBUG;JAPANESE"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
AssemblerOutput="4"
|
AssemblerOutput="4"
|
||||||
|
@ -174,7 +174,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;WINDOWS;NONPORTABLE;JAPANESE"
|
PreprocessorDefinitions="WIN32;_DEBUG;JAPANESE"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="0"
|
BasicRuntimeChecks="0"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
|
|
14
src/Back.cpp
14
src/Back.cpp
|
@ -31,7 +31,6 @@ BOOL InitBack(const char *fName, int type)
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef NONPORTABLE
|
|
||||||
// This is ridiculously platform-dependant:
|
// This is ridiculously platform-dependant:
|
||||||
// It should break on big-endian CPUs, and platforms where short isn't 16-bit and long isn't 32-bit.
|
// It should break on big-endian CPUs, and platforms where short isn't 16-bit and long isn't 32-bit.
|
||||||
unsigned short bmp_header_buffer[7]; // These names aren't the original. This ruins the stack frame layout.
|
unsigned short bmp_header_buffer[7]; // These names aren't the original. This ruins the stack frame layout.
|
||||||
|
@ -54,19 +53,6 @@ BOOL InitBack(const char *fName, int type)
|
||||||
|
|
||||||
gBack.partsW = bmp_header_buffer2[1];
|
gBack.partsW = bmp_header_buffer2[1];
|
||||||
gBack.partsH = bmp_header_buffer2[2];
|
gBack.partsH = bmp_header_buffer2[2];
|
||||||
#else
|
|
||||||
if (fgetc(fp) != 'B' || fgetc(fp) != 'M')
|
|
||||||
{
|
|
||||||
fclose(fp);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
fseek(fp, 18, SEEK_SET);
|
|
||||||
|
|
||||||
gBack.partsW = File_ReadLE32(fp);
|
|
||||||
gBack.partsH = File_ReadLE32(fp);
|
|
||||||
fclose(fp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Set background stuff and load texture
|
// Set background stuff and load texture
|
||||||
gBack.flag = 1;
|
gBack.flag = 1;
|
||||||
|
|
|
@ -25,36 +25,13 @@ BOOL LoadConfigData(CONFIG *conf)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Read data
|
// Read data
|
||||||
#ifdef NONPORTABLE
|
|
||||||
size_t fread_result = fread(conf, sizeof(CONFIG), 1, fp); // Not the original name
|
size_t fread_result = fread(conf, sizeof(CONFIG), 1, fp); // Not the original name
|
||||||
#else
|
|
||||||
// Read the version id and font name
|
|
||||||
fread(conf->proof, sizeof(conf->proof), 1, fp);
|
|
||||||
fread(conf->font_name, sizeof(conf->font_name), 1, fp);
|
|
||||||
|
|
||||||
// Read control settings
|
|
||||||
conf->move_button_mode = File_ReadLE32(fp);
|
|
||||||
conf->attack_button_mode = File_ReadLE32(fp);
|
|
||||||
conf->ok_button_mode = File_ReadLE32(fp);
|
|
||||||
|
|
||||||
// Read display mode (320x240, 640x480, 24-bit fullscreen, 32-bit fullscreen) TODO: add more things?
|
|
||||||
conf->display_mode = File_ReadLE32(fp);
|
|
||||||
|
|
||||||
// Read joystick configuration (if enabled, and mappings)
|
|
||||||
conf->bJoystick = File_ReadLE32(fp);
|
|
||||||
for (int button = 0; button < 8; button++)
|
|
||||||
conf->joystick_button[button] = File_ReadLE32(fp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Close file
|
// Close file
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
// Check if version is not correct, and return if it failed
|
// Check if version is not correct, and return if it failed
|
||||||
#ifdef NONPORTABLE
|
|
||||||
if (fread_result != 1 || strcmp(conf->proof, config_magic))
|
if (fread_result != 1 || strcmp(conf->proof, config_magic))
|
||||||
#else
|
|
||||||
if (strcmp(conf->proof, config_magic))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
memset(conf, 0, sizeof(CONFIG));
|
memset(conf, 0, sizeof(CONFIG));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
30
src/Game.cpp
30
src/Game.cpp
|
@ -682,20 +682,7 @@ BOOL Game(HWND hWnd)
|
||||||
|
|
||||||
if (!LoadGenericData())
|
if (!LoadGenericData())
|
||||||
{
|
{
|
||||||
#if defined(NONPORTABLE) && defined(WINDOWS)
|
MessageBoxA(hWnd, "\x94\xC4\x97\x70\x83\x74\x83\x40\x83\x43\x83\x8B\x82\xAA\x93\xC7\x82\xDF\x82\xC8\x82\xA2", "\x83\x47\x83\x89\x81\x5B", MB_OK);
|
||||||
#ifdef JAPANESE
|
|
||||||
MessageBoxA(hWnd, "\x94\xC4\x97\x70\x83\x74\x83\x40\x83\x43\x83\x8B\x82\xAA\x93\xC7\x82\xDF\x82\xC8\x82\xA2", "\x83\x47\x83\x89\x81\x5B", MB_OK);
|
|
||||||
#else
|
|
||||||
MessageBoxA(hWnd, "Couldn't read general purpose files", "Error", MB_OK);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef JAPANESE
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "エラー", "汎用ファイルが読めない", NULL);
|
|
||||||
#else
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Couldn't read general purpose files", NULL);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,20 +693,7 @@ BOOL Game(HWND hWnd)
|
||||||
|
|
||||||
if (!LoadNpcTable(path))
|
if (!LoadNpcTable(path))
|
||||||
{
|
{
|
||||||
#if defined(NONPORTABLE) && defined(WINDOWS)
|
MessageBoxA(hWnd, "\x4E\x50\x43\x83\x65\x81\x5B\x83\x75\x83\x8B\x82\xAA\x93\xC7\x82\xDF\x82\xC8\x82\xA2", "\x83\x47\x83\x89\x81\x5B", MB_OK);
|
||||||
#ifdef JAPANESE
|
|
||||||
MessageBoxA(hWnd, "\x4E\x50\x43\x83\x65\x81\x5B\x83\x75\x83\x8B\x82\xAA\x93\xC7\x82\xDF\x82\xC8\x82\xA2", "\x83\x47\x83\x89\x81\x5B", MB_OK);
|
|
||||||
#else
|
|
||||||
MessageBoxA(hWnd, "Couldn't read the NPC table", "Error", MB_OK);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef JAPANESE
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "エラー", "NPCテーブルが読めない", NULL);
|
|
||||||
#else
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Couldn't read the NPC table", NULL);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ void GetCompileDate(int *year, int *month, int *day)
|
||||||
*month = i;
|
*month = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
// TODO - Inaccurate stack frame
|
// TODO - Inaccurate stack frame
|
||||||
BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
|
BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
|
||||||
{
|
{
|
||||||
|
@ -95,18 +94,7 @@ BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
|
|
||||||
{
|
|
||||||
*v1 = 1;
|
|
||||||
*v2 = 0;
|
|
||||||
*v3 = 0;
|
|
||||||
*v4 = 6;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
// This seems to be broken in recent Windows (Sndvol32.exe was renamed 'SndVol.exe')
|
// This seems to be broken in recent Windows (Sndvol32.exe was renamed 'SndVol.exe')
|
||||||
// TODO - Inaccurate stack frame
|
// TODO - Inaccurate stack frame
|
||||||
BOOL OpenVolumeConfiguration(HWND hWnd)
|
BOOL OpenVolumeConfiguration(HWND hWnd)
|
||||||
|
@ -170,9 +158,7 @@ BOOL OpenVolumeConfiguration(HWND hWnd)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
void DeleteDebugLog(void)
|
void DeleteDebugLog(void)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
@ -196,9 +182,7 @@ BOOL PrintDebugLog(const char *string, int value1, int value2, int value3)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
/*
|
/*
|
||||||
This function is a mystery. It seems to check if the system time is within
|
This function is a mystery. It seems to check if the system time is within
|
||||||
a certain range, specified by the two parameters. Nothing in the original game
|
a certain range, specified by the two parameters. Nothing in the original game
|
||||||
|
@ -227,17 +211,12 @@ int CheckTime(SYSTEMTIME *system_time_low, SYSTEMTIME *system_time_high)
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOL CheckFileExists(const char *name)
|
BOOL CheckFileExists(const char *name)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
#ifdef NONPORTABLE
|
|
||||||
sprintf(path, "%s\\%s", gModulePath, name);
|
sprintf(path, "%s\\%s", gModulePath, name);
|
||||||
#else
|
|
||||||
sprintf(path, "%s/%s", gModulePath, name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FILE *file = fopen(path, "rb");
|
FILE *file = fopen(path, "rb");
|
||||||
|
|
||||||
|
@ -250,7 +229,6 @@ BOOL CheckFileExists(const char *name)
|
||||||
|
|
||||||
long GetFileSizeLong(const char *path)
|
long GetFileSizeLong(const char *path)
|
||||||
{
|
{
|
||||||
#ifdef NONPORTABLE
|
|
||||||
DWORD len;
|
DWORD len;
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
|
|
||||||
|
@ -263,24 +241,8 @@ long GetFileSizeLong(const char *path)
|
||||||
len = GetFileSize(hFile, NULL);
|
len = GetFileSize(hFile, NULL);
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
return len;
|
return len;
|
||||||
#else
|
|
||||||
long len;
|
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
fp = fopen(path, "rb");
|
|
||||||
if (fp == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
fseek(fp, 0, SEEK_END);
|
|
||||||
len = ftell(fp);
|
|
||||||
fclose(fp);
|
|
||||||
return len;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
BOOL PrintBitmapError(const char *string, int value)
|
BOOL PrintBitmapError(const char *string, int value)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
@ -299,7 +261,6 @@ BOOL PrintBitmapError(const char *string, int value)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOL IsShiftJIS(unsigned char c)
|
BOOL IsShiftJIS(unsigned char c)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,17 +4,13 @@
|
||||||
|
|
||||||
void GetCompileDate(int *year, int *month, int *day);
|
void GetCompileDate(int *year, int *month, int *day);
|
||||||
BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4);
|
BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4);
|
||||||
#ifdef WINDOWS
|
|
||||||
BOOL OpenVolumeConfiguration(HWND hWnd);
|
BOOL OpenVolumeConfiguration(HWND hWnd);
|
||||||
void DeleteDebugLog(void);
|
void DeleteDebugLog(void);
|
||||||
BOOL PrintDebugLog(const char *string, int value1, int value2, int value3);
|
BOOL PrintDebugLog(const char *string, int value1, int value2, int value3);
|
||||||
int CheckTime(SYSTEMTIME *system_time_low, SYSTEMTIME *system_time_high);
|
int CheckTime(SYSTEMTIME *system_time_low, SYSTEMTIME *system_time_high);
|
||||||
#endif
|
|
||||||
BOOL CheckFileExists(const char *name);
|
BOOL CheckFileExists(const char *name);
|
||||||
long GetFileSizeLong(const char *path);
|
long GetFileSizeLong(const char *path);
|
||||||
#ifdef WINDOWS
|
|
||||||
BOOL PrintBitmapError(const char *string, int value);
|
BOOL PrintBitmapError(const char *string, int value);
|
||||||
#endif
|
|
||||||
BOOL IsShiftJIS(unsigned char c);
|
BOOL IsShiftJIS(unsigned char c);
|
||||||
BOOL CenterWindow(HWND hWnd);
|
BOOL CenterWindow(HWND hWnd);
|
||||||
BOOL LoadWindowRect(HWND hWnd, const char *filename, BOOL unknown);
|
BOOL LoadWindowRect(HWND hWnd, const char *filename, BOOL unknown);
|
||||||
|
|
|
@ -50,14 +50,9 @@ BOOL LoadMapData2(const char *path_map)
|
||||||
{
|
{
|
||||||
fread(&dum, 1, 1, fp);
|
fread(&dum, 1, 1, fp);
|
||||||
// Get width and height
|
// Get width and height
|
||||||
#ifdef NONPORTABLE
|
|
||||||
// This fails on big-endian hardware, and platforms where short is not two bytes long.
|
// This fails on big-endian hardware, and platforms where short is not two bytes long.
|
||||||
fread(&gMap.width, 2, 1, fp);
|
fread(&gMap.width, 2, 1, fp);
|
||||||
fread(&gMap.length, 2, 1, fp);
|
fread(&gMap.length, 2, 1, fp);
|
||||||
#else
|
|
||||||
gMap.width = File_ReadLE16(fp);
|
|
||||||
gMap.length = File_ReadLE16(fp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gMap.data == NULL)
|
if (gMap.data == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -449,32 +449,14 @@ BOOL SaveTimeCounter()
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
// Read data
|
// Read data
|
||||||
#ifdef NONPORTABLE
|
|
||||||
fread(&rec, sizeof(REC), 1, fp);
|
fread(&rec, sizeof(REC), 1, fp);
|
||||||
#else
|
|
||||||
rec.counter[0] = File_ReadLE32(fp);
|
|
||||||
rec.counter[1] = File_ReadLE32(fp);
|
|
||||||
rec.counter[2] = File_ReadLE32(fp);
|
|
||||||
rec.counter[3] = File_ReadLE32(fp);
|
|
||||||
rec.random[0] = fgetc(fp);
|
|
||||||
rec.random[1] = fgetc(fp);
|
|
||||||
rec.random[2] = fgetc(fp);
|
|
||||||
rec.random[3] = fgetc(fp);
|
|
||||||
#endif
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
p = (unsigned char*)&rec.counter[0];
|
p = (unsigned char*)&rec.counter[0];
|
||||||
#ifdef NONPORTABLE
|
|
||||||
p[0] -= rec.random[0];
|
p[0] -= rec.random[0];
|
||||||
p[1] -= rec.random[0];
|
p[1] -= rec.random[0];
|
||||||
p[2] -= rec.random[0];
|
p[2] -= rec.random[0];
|
||||||
p[3] -= rec.random[0] / 2;
|
p[3] -= rec.random[0] / 2;
|
||||||
#else
|
|
||||||
p[0] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[0]) : (rec.random[0] / 2);
|
|
||||||
p[1] -= rec.random[0];
|
|
||||||
p[2] -= rec.random[0];
|
|
||||||
p[3] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[0] / 2) : (rec.random[0]);
|
|
||||||
#endif
|
|
||||||
// If this is faster than our new time, quit
|
// If this is faster than our new time, quit
|
||||||
if (rec.counter[0] < time_count)
|
if (rec.counter[0] < time_count)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -487,35 +469,17 @@ BOOL SaveTimeCounter()
|
||||||
rec.random[i] = Random(0, 250) + i;
|
rec.random[i] = Random(0, 250) + i;
|
||||||
|
|
||||||
p = (unsigned char*)&rec.counter[i];
|
p = (unsigned char*)&rec.counter[i];
|
||||||
#ifdef NONPORTABLE
|
|
||||||
p[0] += rec.random[i];
|
p[0] += rec.random[i];
|
||||||
p[1] += rec.random[i];
|
p[1] += rec.random[i];
|
||||||
p[2] += rec.random[i];
|
p[2] += rec.random[i];
|
||||||
p[3] += rec.random[i] / 2;
|
p[3] += rec.random[i] / 2;
|
||||||
#else
|
|
||||||
p[0] += (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i]) : (rec.random[i] / 2);
|
|
||||||
p[1] += rec.random[i];
|
|
||||||
p[2] += rec.random[i];
|
|
||||||
p[3] += (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i] / 2) : (rec.random[i]);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fp = fopen(path, "wb");
|
fp = fopen(path, "wb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef NONPORTABLE
|
|
||||||
fwrite(&rec, sizeof(REC), 1, fp);
|
fwrite(&rec, sizeof(REC), 1, fp);
|
||||||
#else
|
|
||||||
File_WriteLE32(rec.counter[0], fp);
|
|
||||||
File_WriteLE32(rec.counter[1], fp);
|
|
||||||
File_WriteLE32(rec.counter[2], fp);
|
|
||||||
File_WriteLE32(rec.counter[3], fp);
|
|
||||||
fputc(rec.random[0], fp);
|
|
||||||
fputc(rec.random[1], fp);
|
|
||||||
fputc(rec.random[2], fp);
|
|
||||||
fputc(rec.random[3], fp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -537,35 +501,17 @@ int LoadTimeCounter()
|
||||||
REC rec;
|
REC rec;
|
||||||
|
|
||||||
// Read data
|
// Read data
|
||||||
#ifdef NONPORTABLE
|
|
||||||
fread(&rec, sizeof(REC), 1, fp);
|
fread(&rec, sizeof(REC), 1, fp);
|
||||||
#else
|
|
||||||
rec.counter[0] = File_ReadLE32(fp);
|
|
||||||
rec.counter[1] = File_ReadLE32(fp);
|
|
||||||
rec.counter[2] = File_ReadLE32(fp);
|
|
||||||
rec.counter[3] = File_ReadLE32(fp);
|
|
||||||
rec.random[0] = fgetc(fp);
|
|
||||||
rec.random[1] = fgetc(fp);
|
|
||||||
rec.random[2] = fgetc(fp);
|
|
||||||
rec.random[3] = fgetc(fp);
|
|
||||||
#endif
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
// Decode from checksum
|
// Decode from checksum
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
p = (unsigned char*)&rec.counter[i];
|
p = (unsigned char*)&rec.counter[i];
|
||||||
#ifdef NONPORTABLE
|
|
||||||
p[0] -= rec.random[i];
|
p[0] -= rec.random[i];
|
||||||
p[1] -= rec.random[i];
|
p[1] -= rec.random[i];
|
||||||
p[2] -= rec.random[i];
|
p[2] -= rec.random[i];
|
||||||
p[3] -= rec.random[i] / 2;
|
p[3] -= rec.random[i] / 2;
|
||||||
#else
|
|
||||||
p[0] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i]) : (rec.random[i] / 2);
|
|
||||||
p[1] -= rec.random[i];
|
|
||||||
p[2] -= rec.random[i];
|
|
||||||
p[3] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i] / 2) : (rec.random[i]);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify checksum's result
|
// Verify checksum's result
|
||||||
|
|
|
@ -78,11 +78,7 @@ BOOL LoadEvent(const char *path_event)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get amount of NPCs
|
// Get amount of NPCs
|
||||||
#ifdef NONPORTABLE
|
|
||||||
fread(&count, 4, 1, fp);
|
fread(&count, 4, 1, fp);
|
||||||
#else
|
|
||||||
count = File_ReadLE32(fp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Load NPCs
|
// Load NPCs
|
||||||
memset(gNPC, 0, sizeof(gNPC));
|
memset(gNPC, 0, sizeof(gNPC));
|
||||||
|
@ -91,16 +87,7 @@ BOOL LoadEvent(const char *path_event)
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
// Get data from file
|
// Get data from file
|
||||||
#ifdef NONPORTABLE
|
|
||||||
fread(&eve, sizeof(EVENT), 1, fp);
|
fread(&eve, sizeof(EVENT), 1, fp);
|
||||||
#else
|
|
||||||
eve.x = File_ReadLE16(fp);
|
|
||||||
eve.y = File_ReadLE16(fp);
|
|
||||||
eve.code_flag = File_ReadLE16(fp);
|
|
||||||
eve.code_event = File_ReadLE16(fp);
|
|
||||||
eve.code_char = File_ReadLE16(fp);
|
|
||||||
eve.bits = File_ReadLE16(fp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Set NPC parameters
|
// Set NPC parameters
|
||||||
gNPC[n].direct = (eve.bits & NPC_SPAWN_IN_OTHER_DIRECTION) ? 2 : 0;
|
gNPC[n].direct = (eve.bits & NPC_SPAWN_IN_OTHER_DIRECTION) ? 2 : 0;
|
||||||
|
|
|
@ -36,7 +36,6 @@ BOOL LoadNpcTable(const char *path)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NONPORTABLE
|
|
||||||
for (n = 0; n < num; n++) // bits
|
for (n = 0; n < num; n++) // bits
|
||||||
fread(&gNpcTable[n].bits, 2, 1, fp);
|
fread(&gNpcTable[n].bits, 2, 1, fp);
|
||||||
for (n = 0; n < num; n++) // life
|
for (n = 0; n < num; n++) // life
|
||||||
|
@ -57,28 +56,6 @@ BOOL LoadNpcTable(const char *path)
|
||||||
fread(&gNpcTable[n].hit, 4, 1, fp);
|
fread(&gNpcTable[n].hit, 4, 1, fp);
|
||||||
for (n = 0; n < num; n++) // view
|
for (n = 0; n < num; n++) // view
|
||||||
fread(&gNpcTable[n].view, 4, 1, fp);
|
fread(&gNpcTable[n].view, 4, 1, fp);
|
||||||
#else
|
|
||||||
for (n = 0; n < num; n++) // bits
|
|
||||||
gNpcTable[n].bits = File_ReadLE16(fp);
|
|
||||||
for (n = 0; n < num; n++) // life
|
|
||||||
gNpcTable[n].life = File_ReadLE16(fp);
|
|
||||||
for (n = 0; n < num; n++) // surf
|
|
||||||
fread(&gNpcTable[n].surf, 1, 1, fp);
|
|
||||||
for (n = 0; n < num; n++) // destroy_voice
|
|
||||||
fread(&gNpcTable[n].destroy_voice, 1, 1, fp);
|
|
||||||
for (n = 0; n < num; n++) // hit_voice
|
|
||||||
fread(&gNpcTable[n].hit_voice, 1, 1, fp);
|
|
||||||
for (n = 0; n < num; n++) // size
|
|
||||||
fread(&gNpcTable[n].size, 1, 1, fp);
|
|
||||||
for (n = 0; n < num; n++) // exp
|
|
||||||
gNpcTable[n].exp = File_ReadLE32(fp);
|
|
||||||
for (n = 0; n < num; n++) // damage
|
|
||||||
gNpcTable[n].damage = File_ReadLE32(fp);
|
|
||||||
for (n = 0; n < num; n++) // hit
|
|
||||||
fread(&gNpcTable[n].hit, 4, 1, fp);
|
|
||||||
for (n = 0; n < num; n++) // view
|
|
||||||
fread(&gNpcTable[n].view, 4, 1, fp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -79,43 +79,7 @@ BOOL SaveProfile(const char *name)
|
||||||
memcpy(profile.flags, gFlagNPC, sizeof(profile.flags));
|
memcpy(profile.flags, gFlagNPC, sizeof(profile.flags));
|
||||||
|
|
||||||
// Write to file
|
// Write to file
|
||||||
#ifdef NONPORTABLE
|
|
||||||
fwrite(&profile, sizeof(PROFILE), 1, fp);
|
fwrite(&profile, sizeof(PROFILE), 1, fp);
|
||||||
#else
|
|
||||||
fwrite(profile.code, 8, 1, fp);
|
|
||||||
File_WriteLE32(profile.stage, fp);
|
|
||||||
File_WriteLE32(profile.music, fp);
|
|
||||||
File_WriteLE32(profile.x, fp);
|
|
||||||
File_WriteLE32(profile.y, fp);
|
|
||||||
File_WriteLE32(profile.direct, fp);
|
|
||||||
File_WriteLE16(profile.max_life, fp);
|
|
||||||
File_WriteLE16(profile.star, fp);
|
|
||||||
File_WriteLE16(profile.life, fp);
|
|
||||||
File_WriteLE16(profile.a, fp);
|
|
||||||
File_WriteLE32(profile.select_arms, fp);
|
|
||||||
File_WriteLE32(profile.select_item, fp);
|
|
||||||
File_WriteLE32(profile.equip, fp);
|
|
||||||
File_WriteLE32(profile.unit, fp);
|
|
||||||
File_WriteLE32(profile.counter, fp);
|
|
||||||
for (int arm = 0; arm < 8; arm++)
|
|
||||||
{
|
|
||||||
File_WriteLE32(profile.arms[arm].code, fp);
|
|
||||||
File_WriteLE32(profile.arms[arm].level, fp);
|
|
||||||
File_WriteLE32(profile.arms[arm].exp, fp);
|
|
||||||
File_WriteLE32(profile.arms[arm].max_num, fp);
|
|
||||||
File_WriteLE32(profile.arms[arm].num, fp);
|
|
||||||
}
|
|
||||||
for (int item = 0; item < 32; item++)
|
|
||||||
File_WriteLE32(profile.items[item].code, fp);
|
|
||||||
for (int stage = 0; stage < 8; stage++)
|
|
||||||
{
|
|
||||||
File_WriteLE32(profile.permitstage[stage].index, fp);
|
|
||||||
File_WriteLE32(profile.permitstage[stage].event, fp);
|
|
||||||
}
|
|
||||||
fwrite(profile.permit_mapping, 0x80, 1, fp);
|
|
||||||
fwrite(FLAG, 4, 1, fp);
|
|
||||||
fwrite(profile.flags, 1000, 1, fp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -151,43 +115,7 @@ BOOL LoadProfile(const char *name)
|
||||||
// Read data
|
// Read data
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
memset(&profile, 0, sizeof(PROFILE));
|
memset(&profile, 0, sizeof(PROFILE));
|
||||||
#ifdef NONPORTABLE
|
|
||||||
fread(&profile, sizeof(PROFILE), 1, fp);
|
fread(&profile, sizeof(PROFILE), 1, fp);
|
||||||
#else
|
|
||||||
fread(profile.code, 8, 1, fp);
|
|
||||||
profile.stage = File_ReadLE32(fp);
|
|
||||||
profile.music = (MusicID)File_ReadLE32(fp);
|
|
||||||
profile.x = File_ReadLE32(fp);
|
|
||||||
profile.y = File_ReadLE32(fp);
|
|
||||||
profile.direct = File_ReadLE32(fp);
|
|
||||||
profile.max_life = File_ReadLE16(fp);
|
|
||||||
profile.star = File_ReadLE16(fp);
|
|
||||||
profile.life = File_ReadLE16(fp);
|
|
||||||
profile.a = File_ReadLE16(fp);
|
|
||||||
profile.select_arms = File_ReadLE32(fp);
|
|
||||||
profile.select_item = File_ReadLE32(fp);
|
|
||||||
profile.equip = File_ReadLE32(fp);
|
|
||||||
profile.unit = File_ReadLE32(fp);
|
|
||||||
profile.counter = File_ReadLE32(fp);
|
|
||||||
for (int arm = 0; arm < 8; arm++)
|
|
||||||
{
|
|
||||||
profile.arms[arm].code = File_ReadLE32(fp);
|
|
||||||
profile.arms[arm].level = File_ReadLE32(fp);
|
|
||||||
profile.arms[arm].exp = File_ReadLE32(fp);
|
|
||||||
profile.arms[arm].max_num = File_ReadLE32(fp);
|
|
||||||
profile.arms[arm].num = File_ReadLE32(fp);
|
|
||||||
}
|
|
||||||
for (int item = 0; item < 32; item++)
|
|
||||||
profile.items[item].code = File_ReadLE32(fp);
|
|
||||||
for (int stage = 0; stage < 8; stage++)
|
|
||||||
{
|
|
||||||
profile.permitstage[stage].index = File_ReadLE32(fp);
|
|
||||||
profile.permitstage[stage].event = File_ReadLE32(fp);
|
|
||||||
}
|
|
||||||
fread(profile.permit_mapping, 0x80, 1, fp);
|
|
||||||
fread(profile.FLAG, 4, 1, fp);
|
|
||||||
fread(profile.flags, 1000, 1, fp);
|
|
||||||
#endif
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
// Set things
|
// Set things
|
||||||
|
@ -250,22 +178,7 @@ BOOL InitializeGame(HWND hWnd)
|
||||||
InitFlags();
|
InitFlags();
|
||||||
if (!TransferStage(13, 200, 10, 8))
|
if (!TransferStage(13, 200, 10, 8))
|
||||||
{
|
{
|
||||||
#if defined(NONPORTABLE) && defined(WINDOWS)
|
MessageBoxA(hWnd, "\x83\x58\x83\x65\x81\x5B\x83\x57\x82\xCC\x93\xC7\x82\xDD\x8D\x9E\x82\xDD\x82\xC9\x8E\xB8\x94\x73", "\x83\x47\x83\x89\x81\x5B", MB_OK);
|
||||||
#ifdef JAPANESE
|
|
||||||
MessageBoxA(hWnd, "\x83\x58\x83\x65\x81\x5B\x83\x57\x82\xCC\x93\xC7\x82\xDD\x8D\x9E\x82\xDD\x82\xC9\x8E\xB8\x94\x73", "\x83\x47\x83\x89\x81\x5B", MB_OK);
|
|
||||||
#else
|
|
||||||
MessageBoxA(hWnd, "Failed to load stage", "Error", MB_OK);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
(void)hWnd;
|
|
||||||
|
|
||||||
#ifdef JAPANESE
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "エラー", "ステージの読み込みに失敗", NULL);
|
|
||||||
#else
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Failed to load stage", NULL);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,11 +224,7 @@ const char *gMusicTable[42] =
|
||||||
"ACCESS",
|
"ACCESS",
|
||||||
"IRONH",
|
"IRONH",
|
||||||
"GRAND",
|
"GRAND",
|
||||||
#ifdef NONPORTABLE
|
"Curly", // Uses the original filename instead of the internal 8.3 one
|
||||||
"Curly", // The vanilla game used the original filename instead of the internal 8.3 one
|
|
||||||
#else
|
|
||||||
"CURLY",
|
|
||||||
#endif
|
|
||||||
"OSIDE",
|
"OSIDE",
|
||||||
"REQUIEM",
|
"REQUIEM",
|
||||||
"WANPAK2",
|
"WANPAK2",
|
||||||
|
|
|
@ -705,20 +705,7 @@ int TextScriptProc()
|
||||||
y = GetTextScriptNo(gTS.p_read + 19);
|
y = GetTextScriptNo(gTS.p_read + 19);
|
||||||
if (!TransferStage(z, w, x, y))
|
if (!TransferStage(z, w, x, y))
|
||||||
{
|
{
|
||||||
#if defined(NONPORTABLE) && defined(WINDOWS)
|
MessageBoxA(ghWnd, "\x83\x58\x83\x65\x81\x5B\x83\x57\x82\xCC\x93\xC7\x82\xDD\x8D\x9E\x82\xDD\x82\xC9\x8E\xB8\x94\x73", "\x83\x47\x83\x89\x81\x5B", MB_OK);
|
||||||
#ifdef JAPANESE
|
|
||||||
MessageBoxA(ghWnd, "\x83\x58\x83\x65\x81\x5B\x83\x57\x82\xCC\x93\xC7\x82\xDD\x8D\x9E\x82\xDD\x82\xC9\x8E\xB8\x94\x73", "\x83\x47\x83\x89\x81\x5B", MB_OK);
|
|
||||||
#else
|
|
||||||
MessageBoxA(ghWnd, "Failed to load stage", "Error", MB_OK);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef JAPANESE
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "エラー", "ステージの読み込みに失敗", NULL);
|
|
||||||
#else
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Failed to load stage", NULL);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1270,23 +1257,8 @@ int TextScriptProc()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char str_0[0x40];
|
char str_0[0x40];
|
||||||
#ifdef JAPANESE
|
sprintf(str_0, "\x95\x73\x96\xBE\x82\xCC\x83\x52\x81\x5B\x83\x68:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
||||||
#if defined(NONPORTABLE) && defined(WINDOWS)
|
MessageBoxA(NULL, str_0, "\x83\x47\x83\x89\x81\x5B", MB_OK);
|
||||||
sprintf(str_0, "\x95\x73\x96\xBE\x82\xCC\x83\x52\x81\x5B\x83\x68:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
|
||||||
MessageBoxA(NULL, str_0, "\x83\x47\x83\x89\x81\x5B", MB_OK);
|
|
||||||
#else
|
|
||||||
sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "エラー", str_0, NULL);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
sprintf(str_0, "Unknown code:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
|
||||||
#if defined(NONPORTABLE) && defined(WINDOWS)
|
|
||||||
MessageBoxA(NULL, str_0, "Error", MB_OK);
|
|
||||||
#else
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", str_0, NULL);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
// Avoid name collisions
|
// Avoid name collisions
|
||||||
#undef DrawText
|
#undef DrawText
|
||||||
#undef FindResource
|
#undef FindResource
|
||||||
#undef CreateWindow
|
#undef CreateWindow
|
||||||
#else
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
typedef int HWND;
|
|
||||||
|
|
||||||
typedef int BOOL;
|
|
||||||
|
|
||||||
#ifndef FALSE
|
|
||||||
#define FALSE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TRUE
|
|
||||||
#define TRUE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct RECT
|
|
||||||
{
|
|
||||||
long left;
|
|
||||||
long top;
|
|
||||||
long right;
|
|
||||||
long bottom;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SET_RECT(rect, l, t, r, b) \
|
#define SET_RECT(rect, l, t, r, b) \
|
||||||
rect.left = l; \
|
rect.left = l; \
|
||||||
|
@ -37,8 +12,4 @@ struct RECT
|
||||||
rect.right = r; \
|
rect.right = r; \
|
||||||
rect.bottom = b;
|
rect.bottom = b;
|
||||||
|
|
||||||
#ifndef MAX_PATH
|
|
||||||
#define MAX_PATH FILENAME_MAX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOL SystemTask();
|
BOOL SystemTask();
|
||||||
|
|
Loading…
Add table
Reference in a new issue