ref: 73e18b4610f468e40ded1cf475d6f011df2c8a2a
parent: 5ea356a3bd46a96604d5f2dadd00fcf0d418ccdb
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Sep 3 20:54:11 EDT 2019
Removed the WINDOWS and NONPORTABLE stuff Now that all the ASM-accurate stuff is in its own branch, we don't need these anymore.
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@
CXXFLAGS += -DDEBUG_SAVE
endif
-CXXFLAGS += -std=c++98 -MMD -MP -MF $@.d -DWINDOWS `pkg-config sdl2 --cflags`
+CXXFLAGS += -std=c++98 -MMD -MP -MF $@.d `pkg-config sdl2 --cflags`
LIBS += -lkernel32 -lgdi32 -lddraw -ldinput -ldsound -lversion -lshlwapi -limm32 -lwinmm -ldxguid
ifeq ($(STATIC), 1)
--- a/src/Back.cpp
+++ b/src/Back.cpp
@@ -32,30 +32,6 @@
if (fp == NULL)
return FALSE;
-#ifdef NONPORTABLE
- // 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.
- unsigned short bmp_header_buffer[7]; // These names aren't the original. This ruins the stack frame layout.
- unsigned long bmp_header_buffer2[10];
-
- fread(bmp_header_buffer, 14, 1, fp);
-
- // Check if this is a valid bitmap file
- if (bmp_header_buffer[0] != 0x4D42) // 'MB' (we use hex to prevent a compiler warning)
- {
-#ifdef FIX_BUGS
- // The original game forgets to close fp
- fclose(fp);
-#endif
- return FALSE;
- }
-
- fread(bmp_header_buffer2, 40, 1, fp);
- fclose(fp);
-
- gBack.partsW = bmp_header_buffer2[1];
- gBack.partsH = bmp_header_buffer2[2];
-#else
if (fgetc(fp) != 'B' || fgetc(fp) != 'M')
{
fclose(fp);
@@ -67,7 +43,6 @@
gBack.partsW = File_ReadLE32(fp);
gBack.partsH = File_ReadLE32(fp);
fclose(fp);
-#endif
// Set background stuff and load texture
gBack.flag = 1;
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -25,10 +25,6 @@
if (fp == NULL)
return FALSE;
- // Read data
-#ifdef NONPORTABLE
- 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);
@@ -45,17 +41,12 @@
conf->bJoystick = File_ReadLE32(fp);
for (int button = 0; button < 8; button++)
conf->joystick_button[button] = File_ReadLE32(fp);
-#endif
// Close file
fclose(fp);
// Check if version is not correct, and return if it failed
-#ifdef NONPORTABLE
- if (fread_result != 1 || strcmp(conf->proof, config_magic))
-#else
if (strcmp(conf->proof, config_magic))
-#endif
{
memset(conf, 0, sizeof(CONFIG));
return FALSE;
--- a/src/Map.cpp
+++ b/src/Map.cpp
@@ -51,14 +51,8 @@
{
fread(&dum, 1, 1, fp);
// Get width and height
-#ifdef NONPORTABLE
- // This fails on big-endian hardware, and platforms where short is not two bytes long.
- fread(&gMap.width, 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)
{
--- a/src/MycParam.cpp
+++ b/src/MycParam.cpp
@@ -2,6 +2,8 @@
#include <stdio.h>
+#include "SDL.h"
+
#include "WindowsWrapper.h"
#include "ArmsItem.h"
@@ -450,9 +452,6 @@
if (fp)
{
// Read data
-#ifdef NONPORTABLE
- 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);
@@ -461,21 +460,13 @@
rec.random[1] = fgetc(fp);
rec.random[2] = fgetc(fp);
rec.random[3] = fgetc(fp);
-#endif
fclose(fp);
p = (unsigned char*)&rec.counter[0];
-#ifdef NONPORTABLE
- p[0] -= rec.random[0];
- p[1] -= rec.random[0];
- p[2] -= rec.random[0];
- 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 (rec.counter[0] < time_count)
return TRUE;
@@ -488,17 +479,10 @@
rec.random[i] = Random(0, 250) + i;
p = (unsigned char*)&rec.counter[i];
-#ifdef NONPORTABLE
- p[0] += rec.random[i];
- p[1] += rec.random[i];
- p[2] += rec.random[i];
- 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");
@@ -505,9 +489,6 @@
if (fp == NULL)
return FALSE;
-#ifdef NONPORTABLE
- 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);
@@ -516,7 +497,6 @@
fputc(rec.random[1], fp);
fputc(rec.random[2], fp);
fputc(rec.random[3], fp);
-#endif
fclose(fp);
return TRUE;
@@ -538,9 +518,6 @@
REC rec;
// Read data
-#ifdef NONPORTABLE
- 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);
@@ -549,7 +526,6 @@
rec.random[1] = fgetc(fp);
rec.random[2] = fgetc(fp);
rec.random[3] = fgetc(fp);
-#endif
fclose(fp);
// Decode from checksum
@@ -556,17 +532,10 @@
for (i = 0; i < 4; i++)
{
p = (unsigned char*)&rec.counter[i];
-#ifdef NONPORTABLE
- p[0] -= rec.random[i];
- p[1] -= rec.random[i];
- p[2] -= rec.random[i];
- 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
--- a/src/NpChar.cpp
+++ b/src/NpChar.cpp
@@ -79,11 +79,7 @@
}
// Get amount of NPCs
-#ifdef NONPORTABLE
- fread(&count, 4, 1, fp);
-#else
count = File_ReadLE32(fp);
-#endif
// Load NPCs
memset(gNPC, 0, sizeof(gNPC));
@@ -92,9 +88,6 @@
for (i = 0; i < count; i++)
{
// Get data from file
-#ifdef NONPORTABLE
- fread(&eve, sizeof(EVENT), 1, fp);
-#else
eve.x = File_ReadLE16(fp);
eve.y = File_ReadLE16(fp);
eve.code_flag = File_ReadLE16(fp);
@@ -101,7 +94,6 @@
eve.code_event = File_ReadLE16(fp);
eve.code_char = File_ReadLE16(fp);
eve.bits = File_ReadLE16(fp);
-#endif
// Set NPC parameters
gNPC[n].direct = (eve.bits & NPC_SPAWN_IN_OTHER_DIRECTION) ? 2 : 0;
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -37,29 +37,7 @@
return FALSE;
}
-#ifdef NONPORTABLE
for (n = 0; n < num; n++) // bits
- fread(&gNpcTable[n].bits, 2, 1, fp);
- for (n = 0; n < num; n++) // life
- fread(&gNpcTable[n].life, 2, 1, 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
- fread(&gNpcTable[n].exp, 4, 1, fp);
- for (n = 0; n < num; n++) // damage
- fread(&gNpcTable[n].damage, 4, 1, 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);
-#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);
@@ -79,7 +57,6 @@
fread(&gNpcTable[n].hit, 4, 1, fp);
for (n = 0; n < num; n++) // view
fread(&gNpcTable[n].view, 4, 1, fp);
-#endif
fclose(fp);
return TRUE;
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -80,9 +80,6 @@
memcpy(profile.flags, gFlagNPC, sizeof(profile.flags));
// Write to file
-#ifdef NONPORTABLE
- fwrite(&profile, sizeof(PROFILE), 1, fp);
-#else
fwrite(profile.code, 8, 1, fp);
File_WriteLE32(profile.stage, fp);
File_WriteLE32(profile.music, fp);
@@ -116,7 +113,6 @@
fwrite(profile.permit_mapping, 0x80, 1, fp);
fwrite(FLAG, 4, 1, fp);
fwrite(profile.flags, 1000, 1, fp);
-#endif
fclose(fp);
return TRUE;
@@ -152,9 +148,6 @@
// Read data
fseek(fp, 0, SEEK_SET);
memset(&profile, 0, sizeof(PROFILE));
-#ifdef NONPORTABLE
- fread(&profile, sizeof(PROFILE), 1, fp);
-#else
fread(profile.code, 8, 1, fp);
profile.stage = File_ReadLE32(fp);
profile.music = (MusicID)File_ReadLE32(fp);
@@ -188,7 +181,6 @@
fread(profile.permit_mapping, 0x80, 1, fp);
fread(profile.FLAG, 4, 1, fp);
fread(profile.flags, 1000, 1, fp);
-#endif
fclose(fp);
// Set things
--- a/src/Resource.cpp
+++ b/src/Resource.cpp
@@ -82,11 +82,7 @@
{"ORG", "BALLOS", rBallos, sizeof(rBallos)},
{"ORG", "BDOWN", rBreakDown, sizeof(rBreakDown)},
{"ORG", "CEMETERY", rCemetery, sizeof(rCemetery)},
-#ifdef NONPORTABLE
- {"ORG", "Curly", rCurly, sizeof(rCurly)},
-#else
{"ORG", "CURLY", rCurly, sizeof(rCurly)},
-#endif
{"ORG", "DR", rDr, sizeof(rDr)},
{"ORG", "ENDING", rEnding, sizeof(rEnding)},
{"ORG", "ESCAPE", rEscape, sizeof(rEscape)},
--- a/src/Stage.cpp
+++ b/src/Stage.cpp
@@ -224,11 +224,7 @@
"ACCESS",
"IRONH",
"GRAND",
-#ifdef NONPORTABLE
- "Curly", // The vanilla game used the original filename instead of the internal 8.3 one
-#else
"CURLY",
-#endif
"OSIDE",
"REQUIEM",
"WANPAK2",
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -1263,20 +1263,11 @@
{
char str_0[0x40];
#ifdef JAPANESE
- #if defined(NONPORTABLE) && defined(WINDOWS)
- 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
+ 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);
#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
+ 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]);
+ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", str_0, NULL);
#endif
return 0;
--- a/src/WindowsWrapper.h
+++ b/src/WindowsWrapper.h
@@ -1,13 +1,5 @@
#pragma once
-/*
-#ifdef WINDOWS
-#include <windows.h>
-// Avoid name collisions
-#undef DrawText
-#undef FindResource
-#undef CreateWindow
-#else
-*/
+
#include <stdio.h>
typedef int HWND;
@@ -32,7 +24,6 @@
long right;
long bottom;
};
-//#endif
#define SET_RECT(rect, l, t, r, b) \
rect.left = l; \
--
⑨