shithub: cstory

Download patch

ref: 65682dd913369ce9614a927ea2921586661f388e
parent: fb8ba25d0faf2b4a7d17ea9d3ce09a86de19be97
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Jan 6 16:01:17 EST 2020

Made Dialog.cpp valid C89

See #41

--- a/src/ArmsItem.h
+++ b/src/ArmsItem.h
@@ -11,7 +11,7 @@
 // "Num" often means "ammo" here
 
 /// Weapon struct
-struct ARMS
+typedef struct ARMS
 {
 	/// ID of the weapon
 	int code;
@@ -27,13 +27,13 @@
 
 	/// Current ammunition
 	int num;
-};
+} ARMS;
 
-struct ITEM
+typedef struct ITEM
 {
 	/// ID of the item
 	int code;
-};
+} ITEM;
 
 
 // Limits for the amount of weapons and items
--- a/src/Dialog.cpp
+++ b/src/Dialog.cpp
@@ -19,8 +19,6 @@
 // TODO - Inaccurate stack frame
 INT_PTR __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 {
-	(void)lParam;
-
 	char string_buffer[104];
 
 	int year;
@@ -32,6 +30,8 @@
 	int version3;
 	int version4;
 
+	(void)lParam;
+
 	switch (Msg)
 	{
 		case WM_INITDIALOG:
@@ -104,9 +104,9 @@
 
 INT_PTR __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 {
-	(void)lParam;
-
 	char string[100];
+
+	(void)lParam;
 
 	switch (Msg)
 	{
--- a/src/Dialog.h
+++ b/src/Dialog.h
@@ -2,7 +2,15 @@
 
 #include "WindowsWrapper.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 INT_PTR __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
 INT_PTR __stdcall DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
 INT_PTR __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
 INT_PTR __stdcall QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Generic.h
+++ b/src/Generic.h
@@ -2,6 +2,10 @@
 
 #include "WindowsWrapper.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void GetCompileDate(int *year, int *month, int *day);
 BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4);
 BOOL OpenVolumeConfiguration(HWND hWnd);
@@ -16,3 +20,7 @@
 BOOL LoadWindowRect(HWND hWnd, const char *filename, BOOL unknown);
 BOOL SaveWindowRect(HWND hWnd, const char *filename);
 BOOL IsEnableBitmap(const char *path);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Profile.h
+++ b/src/Profile.h
@@ -6,7 +6,11 @@
 #include "SelStage.h"
 #include "Stage.h"
 
-struct PROFILE
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct PROFILE
 {
 	char code[8];
 	int stage;
@@ -29,9 +33,13 @@
 	signed char permit_mapping[0x80];
 	char FLAG[4];
 	unsigned char flags[1000];
-};
+} PROFILE;
 
 BOOL IsProfile(void);
 BOOL SaveProfile(const char *name);
 BOOL LoadProfile(const char *name);
 BOOL InitializeGame(HWND hWnd);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/SelStage.h
+++ b/src/SelStage.h
@@ -2,11 +2,15 @@
 
 #include "WindowsWrapper.h"
 
-struct PERMIT_STAGE
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct PERMIT_STAGE
 {
 	int index;
 	int event;
-};
+} PERMIT_STAGE;
 
 extern PERMIT_STAGE gPermitStage[8];
 
@@ -16,3 +20,7 @@
 void MoveStageSelectCursor(void);
 void PutStageSelectObject(void);
 int StageSelectLoop(int *p_event);
+
+#ifdef __cplusplus
+}
+#endif
--- a/vs2003/CSE2.vcproj
+++ b/vs2003/CSE2.vcproj
@@ -243,6 +243,12 @@
 			</File>
 			<File
 				RelativePath="..\src\Dialog.cpp">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						CompileAs="1"/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\Draw.cpp">