ref: 9498fe13bedcca0417eee735173e59b94a236d02
parent: 65682dd913369ce9614a927ea2921586661f388e
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Jan 6 16:15:42 EST 2020
Made TextScr.cpp valid C89 See #41
--- a/src/BossLife.h
+++ b/src/BossLife.h
@@ -2,7 +2,15 @@
#include "WindowsWrapper.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void InitBossLife(void);
BOOL StartBossLife(int code_event);
BOOL StartBossLife2(void);
void PutBossLife(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Ending.h
+++ b/src/Ending.h
@@ -4,6 +4,10 @@
#include "CommonDefines.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct CREDIT
{
long size;
@@ -53,3 +57,7 @@
void SetCreditIllust(int a);
void CutCreditIllust(void);
int Scene_DownIsland(HWND hWnd, int mode);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Fade.h
+++ b/src/Fade.h
@@ -2,6 +2,10 @@
#include "WindowsWrapper.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void InitFade(void);
void SetFadeMask(void);
void ClearFade(void);
@@ -10,3 +14,7 @@
void ProcFade(void);
void PutFade(void);
BOOL GetFadeActive(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Flags.h
+++ b/src/Flags.h
@@ -2,6 +2,10 @@
#include "WindowsWrapper.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern unsigned char gFlagNPC[1000];
extern unsigned char gSkipFlag[8];
@@ -13,3 +17,7 @@
void SetSkipFlag(long a);
void CutSkipFlag(long a);
BOOL GetSkipFlag(long a);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/KeyControl.h
+++ b/src/KeyControl.h
@@ -1,5 +1,9 @@
#pragma once
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum KeyBind
{
//The movement keys go in the order of left, right, up and down
@@ -53,3 +57,7 @@
extern long gKeyDown;
void GetTrg(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -20,6 +20,7 @@
#include "Organya.h"
#include "Profile.h"
#include "Sound.h"
+#include "Tags.h"
#include "Triangle.h"
LRESULT __stdcall WindowProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
--- a/src/Main.h
+++ b/src/Main.h
@@ -2,6 +2,10 @@
#include "WindowsWrapper.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern HWND ghWnd;
extern BOOL bFullscreen;
@@ -9,3 +13,7 @@
unsigned long GetFramePerSecound(void);
BOOL SystemTask(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/MiniMap.h
+++ b/src/MiniMap.h
@@ -2,6 +2,10 @@
#include "WindowsWrapper.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern char gMapping[0x80];
int MiniMapLoop(void);
@@ -8,3 +12,7 @@
BOOL IsMapping(void);
void StartMapping(void);
void SetMapping(int a);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/MycParam.h
+++ b/src/MycParam.h
@@ -2,16 +2,20 @@
#include "WindowsWrapper.h"
-struct ARMS_LEVEL
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct ARMS_LEVEL
{
int exp[3];
-};
+} ARMS_LEVEL;
-struct REC
+typedef struct REC
{
long counter[4];
unsigned char random[4];
-};
+} REC;
extern ARMS_LEVEL gArmsLevelTable[14];
@@ -30,3 +34,7 @@
void PutTimeCounter(int x, int y);
BOOL SaveTimeCounter(void);
int LoadTimeCounter(void);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/PixTone.h
+++ b/src/PixTone.h
@@ -2,15 +2,19 @@
#include "WindowsWrapper.h"
-struct PIXTONEPARAMETER2
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct PIXTONEPARAMETER2
{
int model;
double num;
int top;
int offset;
-};
+} PIXTONEPARAMETER2;
-struct PIXTONEPARAMETER
+typedef struct PIXTONEPARAMETER
{
int use;
int size;
@@ -24,7 +28,11 @@
int pointBy;
int pointCx;
int pointCy;
-};
+} PIXTONEPARAMETER;
void MakeWaveTables(void);
BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Sound.h
+++ b/src/Sound.h
@@ -11,6 +11,10 @@
#include "PixTone.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define SE_MAX 160 // According to the Organya source code release, this is the real name for this constant
enum SoundEffectNames
@@ -42,3 +46,7 @@
void ChangeSoundVolume(int no, long volume);
void ChangeSoundPan(int no, long pan);
int MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no);
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/Tags.h
+++ b/src/Tags.h
@@ -2,5 +2,13 @@
#include "WindowsWrapper.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern char gModulePath[MAX_PATH];
extern char gDataPath[MAX_PATH];
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -120,8 +120,10 @@
// Load generic .tsc
BOOL LoadTextScript2(const char *name)
{
- // Get path
char path[MAX_PATH];
+ FILE *fp;
+
+ // Get path
sprintf(path, "%s\\%s", gDataPath, name);
gTS.size = GetFileSizeLong(path);
@@ -129,7 +131,7 @@
return FALSE;
// Open file
- FILE *fp = fopen(path, "rb");
+ fp = fopen(path, "rb");
if (fp == NULL)
return FALSE;
@@ -150,15 +152,19 @@
// Load stage .tsc
BOOL LoadTextScript_Stage(const char *name)
{
- // Open Head.tsc
char path[MAX_PATH];
+ FILE *fp;
+ long head_size;
+ long body_size;
+
+ // Open Head.tsc
sprintf(path, "%s\\%s", gDataPath, "Head.tsc");
- long head_size = GetFileSizeLong(path);
+ head_size = GetFileSizeLong(path);
if (head_size == INVALID_FILE_SIZE)
return FALSE;
- FILE *fp = fopen(path, "rb");
+ fp = fopen(path, "rb");
if (fp == NULL)
return FALSE;
@@ -171,7 +177,7 @@
// Open stage's .tsc
sprintf(path, "%s\\%s", gDataPath, name);
- long body_size = GetFileSizeLong(path);
+ body_size = GetFileSizeLong(path);
if (body_size == INVALID_FILE_SIZE)
return FALSE;
--- a/src/TextScr.h
+++ b/src/TextScr.h
@@ -6,7 +6,7 @@
extern "C" {
#endif
-struct TEXT_SCRIPT
+typedef struct TEXT_SCRIPT
{
// Path (reload when exit teleporter menu/inventory)
char path[MAX_PATH];
@@ -55,7 +55,7 @@
// NOD cursor blink
unsigned char wait_beam;
-};
+} TEXT_SCRIPT;
BOOL InitTextScript2(void);
void EndTextScript(void);
--- a/vs2003/CSE2.vcproj
+++ b/vs2003/CSE2.vcproj
@@ -345,6 +345,12 @@
</File>
<File
RelativePath="..\src\TextScr.cpp">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="1"/>
+ </FileConfiguration>
</File>
<File
RelativePath="..\src\Triangle.cpp">