shithub: cstory

Download patch

ref: fb8ba25d0faf2b4a7d17ea9d3ce09a86de19be97
parent: 33c1ea8f2046d00e6a135c464a3e2bc26259e4f8
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Jan 6 15:57:11 EST 2020

Made Stage.cpp valid C89

See #41

--- a/src/Back.h
+++ b/src/Back.h
@@ -2,7 +2,11 @@
 
 #include "WindowsWrapper.h"
 
-struct BACK
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct BACK
 {
 	BOOL flag;	// Basically unused
 	int partsW;
@@ -11,7 +15,7 @@
 	int numY;
 	int type;
 	int fx;
-};
+} BACK;
 
 extern BACK gBack;
 extern int gWaterY;
@@ -20,3 +24,7 @@
 void ActBack(void);
 void PutBack(int fx, int fy);
 void PutFront(int fx, int fy);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Boss.h
+++ b/src/Boss.h
@@ -2,6 +2,10 @@
 
 #include "NpChar.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define BOSS_MAX 20
 extern NPCHAR gBoss[BOSS_MAX];
 
@@ -14,3 +18,7 @@
 void HitBossBullet(void);
 void ActBossChar(void);
 void HitBossMap(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Caret.h
+++ b/src/Caret.h
@@ -2,6 +2,10 @@
 
 #include "WindowsWrapper.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct CARET_TABLE
 {
 	int view_left;
@@ -30,3 +34,7 @@
 void ActCaret(void);
 void PutCaret(int fx, int fy);
 void SetCaret(int x, int y, int code, int dir);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Flash.h
+++ b/src/Flash.h
@@ -1,5 +1,9 @@
 #pragma once
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void InitFlash(void);
 void SetFlash(int x, int y, int mode);
 void ActFlash_Explosion(int flx, int fly);
@@ -7,3 +11,7 @@
 void ActFlash(int flx, int fly);
 void PutFlash(void);
 void ResetFlash(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Frame.h
+++ b/src/Frame.h
@@ -1,6 +1,10 @@
 #pragma once
 
-struct FRAME
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct FRAME
 {
 	int x;
 	int y;
@@ -9,7 +13,7 @@
 	int wait;
 	int quake;
 	int quake2;
-};
+} FRAME;
 
 extern FRAME gFrame;
 
@@ -23,3 +27,7 @@
 void SetQuake(int time);
 void SetQuake2(int time);
 void ResetQuake(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Map.h
+++ b/src/Map.h
@@ -2,6 +2,10 @@
 
 #include "WindowsWrapper.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct MAP_DATA
 {
 	unsigned char *data;
@@ -25,3 +29,7 @@
 void PutStage_Back(int fx, int fy);
 void PutStage_Front(int fx, int fy);
 void PutMapDataVector(int fx, int fy);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/MapName.h
+++ b/src/MapName.h
@@ -2,7 +2,15 @@
 
 #include "WindowsWrapper.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void ReadyMapName(const char *str);
 void PutMapName(BOOL bMini);
 void StartMapName(void);
 void RestoreMapName(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/NpChar.h
+++ b/src/NpChar.h
@@ -5,6 +5,10 @@
 
 #include "Draw.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define NPC_MAX 0x200
 
 enum NPCCond
@@ -51,7 +55,7 @@
 	// To be continued
 };
 
-struct NPCHAR
+typedef struct NPCHAR
 {
 	unsigned char cond;
 	int flag;
@@ -98,8 +102,8 @@
 	unsigned char shock;
 	int damage_view;
 	int damage;
-	NPCHAR *pNpc;
-};
+	struct NPCHAR *pNpc;
+} NPCHAR;
 
 struct EVENT
 {
@@ -140,3 +144,7 @@
 BOOL IsNpCharCode(int code);
 BOOL GetNpCharAlive(int code_event);
 int CountAliveNpChar(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Organya.h
+++ b/src/Organya.h
@@ -1,4 +1,4 @@
-	#pragma once
+#pragma once
 
 #ifdef FIX_BUGS
 // The original source code forgot to set this (you can tell because, in the original EXE,
@@ -9,6 +9,10 @@
 
 #include "WindowsWrapper.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define MAXTRACK 16
 #define MAXMELODY 8
 #define MAXDRAM 8
@@ -27,3 +31,7 @@
 void SetOrganyaFadeout(void);
 BOOL StartOrganya(LPDIRECTSOUND lpDS, const char *wave_filename);
 void EndOrganya(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Stage.cpp
+++ b/src/Stage.cpp
@@ -248,9 +248,9 @@
 	"WHITE"
 };
 
+MusicID gMusicNo;
 unsigned int gOldPos;
 MusicID gOldNo;
-MusicID gMusicNo;
 
 void ChangeMusic(MusicID no)
 {
--- a/src/Stage.h
+++ b/src/Stage.h
@@ -2,7 +2,11 @@
 
 #include "WindowsWrapper.h"
 
-enum MusicID
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum MusicID
 {
 	MUS_SILENCE = 0x0,
 	MUS_MISCHIEVOUS_ROBOT = 0x1,
@@ -46,9 +50,9 @@
 	MUS_SEAL_CHAMBER = 0x27,
 	MUS_TOROKOS_THEME = 0x28,
 	MUS_WHITE = 0x29
-};
+} MusicID;
 
-struct STAGE_TABLE
+typedef struct STAGE_TABLE
 {
 	char parts[0x20];
 	char map[0x20];
@@ -58,7 +62,7 @@
 	char boss[0x20];
 	signed char boss_no;
 	char name[0x20];
-};
+} STAGE_TABLE;
 
 extern int gStageNo;
 extern MusicID gMusicNo;
@@ -66,3 +70,7 @@
 BOOL TransferStage(int no, int w, int x, int y);
 void ChangeMusic(MusicID no);
 void ReCallMusic(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/TextScr.h
+++ b/src/TextScr.h
@@ -2,6 +2,10 @@
 
 #include "WindowsWrapper.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct TEXT_SCRIPT
 {
 	// Path (reload when exit teleporter menu/inventory)
@@ -64,3 +68,7 @@
 void PutTextScript(void);
 int TextScriptProc(void);
 void RestoreTextScript(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/vs2003/CSE2.vcproj
+++ b/vs2003/CSE2.vcproj
@@ -321,6 +321,12 @@
 			</File>
 			<File
 				RelativePath="..\src\Stage.cpp">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						CompileAs="1"/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\Star.cpp">