From 33c1ea8f2046d00e6a135c464a3e2bc26259e4f8 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 6 Jan 2020 20:05:49 +0000 Subject: [PATCH 01/10] Made ValueView.cpp valid C89 --- src/ValueView.cpp | 52 ++++++++++++++++++++++++---------------------- src/ValueView.h | 12 +++++++++-- vs2003/CSE2.vcproj | 6 ++++++ 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/src/ValueView.cpp b/src/ValueView.cpp index ba9bcd3f..57b5601a 100644 --- a/src/ValueView.cpp +++ b/src/ValueView.cpp @@ -1,9 +1,10 @@ +#include "ValueView.h" + #include #include "WindowsWrapper.h" #include "Draw.h" -#include "ValueView.h" #define VALUEVIEW_MAX 0x10 @@ -26,6 +27,9 @@ void SetValueView(int *px, int *py, int value) int fig[4]; BOOL sw; int i; + RECT rect[20]; + RECT rcPlus; + RECT rcMinus; for (i = 0; i < VALUEVIEW_MAX; ++i) { @@ -91,28 +95,26 @@ void SetValueView(int *px, int *py, int value) gVV[index].rect.right = 40; gVV[index].rect.bottom = 8 * (index + 1); - RECT rect[20] = { - {0, 56, 8, 64}, - {8, 56, 16, 64}, - {16, 56, 24, 64}, - {24, 56, 32, 64}, - {32, 56, 40, 64}, - {40, 56, 48, 64}, - {48, 56, 56, 64}, - {56, 56, 64, 64}, - {64, 56, 72, 64}, - {72, 56, 80, 64}, - {0, 64, 8, 72}, - {8, 64, 16, 72}, - {16, 64, 24, 72}, - {24, 64, 32, 72}, - {32, 64, 40, 72}, - {40, 64, 48, 72}, - {48, 64, 56, 72}, - {56, 64, 64, 72}, - {64, 64, 72, 72}, - {72, 64, 80, 72}, - }; + SET_RECT(rect[0], 0, 56, 8, 64); + SET_RECT(rect[1], 8, 56, 16, 64); + SET_RECT(rect[2], 16, 56, 24, 64); + SET_RECT(rect[3], 24, 56, 32, 64); + SET_RECT(rect[4], 32, 56, 40, 64); + SET_RECT(rect[5], 40, 56, 48, 64); + SET_RECT(rect[6], 48, 56, 56, 64); + SET_RECT(rect[7], 56, 56, 64, 64); + SET_RECT(rect[8], 64, 56, 72, 64); + SET_RECT(rect[9], 72, 56, 80, 64); + SET_RECT(rect[10], 0, 64, 8, 72); + SET_RECT(rect[11], 8, 64, 16, 72); + SET_RECT(rect[12], 16, 64, 24, 72); + SET_RECT(rect[13], 24, 64, 32, 72); + SET_RECT(rect[14], 32, 64, 40, 72); + SET_RECT(rect[15], 40, 64, 48, 72); + SET_RECT(rect[16], 48, 64, 56, 72); + SET_RECT(rect[17], 56, 64, 64, 72); + SET_RECT(rect[18], 64, 64, 72, 72); + SET_RECT(rect[19], 72, 64, 80, 72); // Get digits dig[0] = 1; @@ -133,8 +135,8 @@ void SetValueView(int *px, int *py, int value) sw = FALSE; - RECT rcPlus = {32, 48, 40, 56}; - RECT rcMinus = {40, 48, 48, 56}; + SET_RECT(rcPlus, 32, 48, 40, 56); + SET_RECT(rcMinus, 40, 48, 48, 56); // Draw value CortBox2(&gVV[index].rect, 0x000000, SURFACE_ID_VALUE_VIEW); diff --git a/src/ValueView.h b/src/ValueView.h index c11a5b25..cf80e060 100644 --- a/src/ValueView.h +++ b/src/ValueView.h @@ -2,7 +2,11 @@ #include "WindowsWrapper.h" -struct VALUEVIEW +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct VALUEVIEW { BOOL flag; int *px; @@ -11,9 +15,13 @@ struct VALUEVIEW int value; int count; RECT rect; -}; +} VALUEVIEW; void ClearValueView(void); void SetValueView(int *px, int *py, int value); void ActValueView(void); void PutValueView(int flx, int fly); + +#ifdef __cplusplus +} +#endif diff --git a/vs2003/CSE2.vcproj b/vs2003/CSE2.vcproj index 7393511d..37a8cbe2 100644 --- a/vs2003/CSE2.vcproj +++ b/vs2003/CSE2.vcproj @@ -339,6 +339,12 @@ + + + Date: Mon, 6 Jan 2020 20:57:11 +0000 Subject: [PATCH 02/10] Made Stage.cpp valid C89 See #41 --- src/Back.h | 12 ++++++++++-- src/Boss.h | 8 ++++++++ src/Caret.h | 8 ++++++++ src/Flash.h | 8 ++++++++ src/Frame.h | 12 ++++++++++-- src/Map.h | 8 ++++++++ src/MapName.h | 8 ++++++++ src/NpChar.h | 14 +++++++++++--- src/Organya.h | 10 +++++++++- src/Stage.cpp | 2 +- src/Stage.h | 16 ++++++++++++---- src/TextScr.h | 8 ++++++++ vs2003/CSE2.vcproj | 6 ++++++ 13 files changed, 107 insertions(+), 13 deletions(-) diff --git a/src/Back.h b/src/Back.h index 184d4711..5c17614f 100644 --- 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 @@ struct BACK int numY; int type; int fx; -}; +} BACK; extern BACK gBack; extern int gWaterY; @@ -20,3 +24,7 @@ BOOL InitBack(const char *fName, int type); void ActBack(void); void PutBack(int fx, int fy); void PutFront(int fx, int fy); + +#ifdef __cplusplus +} +#endif diff --git a/src/Boss.h b/src/Boss.h index ab3e6807..8cf99182 100644 --- 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 SetBossCharActNo(int a); void HitBossBullet(void); void ActBossChar(void); void HitBossMap(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/Caret.h b/src/Caret.h index ab249e84..c7a33727 100644 --- 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 InitCaret(void); void ActCaret(void); void PutCaret(int fx, int fy); void SetCaret(int x, int y, int code, int dir); + +#ifdef __cplusplus +} +#endif diff --git a/src/Flash.h b/src/Flash.h index bbd99eaf..9d640a59 100644 --- 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_Flash(void); void ActFlash(int flx, int fly); void PutFlash(void); void ResetFlash(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/Frame.h b/src/Frame.h index 3f78684f..fa599399 100644 --- 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 @@ struct FRAME int wait; int quake; int quake2; -}; +} FRAME; extern FRAME gFrame; @@ -23,3 +27,7 @@ void SetFrameTargetBoss(int no, int wait); void SetQuake(int time); void SetQuake2(int time); void ResetQuake(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/Map.h b/src/Map.h index 071999b9..44eb9e0b 100644 --- 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 @@ BOOL ChangeMapParts(int x, int y, unsigned char no); void PutStage_Back(int fx, int fy); void PutStage_Front(int fx, int fy); void PutMapDataVector(int fx, int fy); + +#ifdef __cplusplus +} +#endif diff --git a/src/MapName.h b/src/MapName.h index c48312a8..15c7267a 100644 --- 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 diff --git a/src/NpChar.h b/src/NpChar.h index c5721561..9e03224d 100644 --- 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 @@ enum NPCNames // To be continued }; -struct NPCHAR +typedef struct NPCHAR { unsigned char cond; int flag; @@ -98,8 +102,8 @@ struct NPCHAR unsigned char shock; int damage_view; int damage; - NPCHAR *pNpc; -}; + struct NPCHAR *pNpc; +} NPCHAR; struct EVENT { @@ -140,3 +144,7 @@ void GetNpCharPosition(int *x, int *y, int i); BOOL IsNpCharCode(int code); BOOL GetNpCharAlive(int code_event); int CountAliveNpChar(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/Organya.h b/src/Organya.h index c81ca8a2..d8b820ff 100644 --- 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 StopOrganyaMusic(void); void SetOrganyaFadeout(void); BOOL StartOrganya(LPDIRECTSOUND lpDS, const char *wave_filename); void EndOrganya(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/Stage.cpp b/src/Stage.cpp index a9313d68..69046217 100644 --- a/src/Stage.cpp +++ b/src/Stage.cpp @@ -248,9 +248,9 @@ const char *gMusicTable[42] = { "WHITE" }; +MusicID gMusicNo; unsigned int gOldPos; MusicID gOldNo; -MusicID gMusicNo; void ChangeMusic(MusicID no) { diff --git a/src/Stage.h b/src/Stage.h index de2432d9..f5940025 100644 --- 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 @@ enum MusicID 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 @@ struct STAGE_TABLE char boss[0x20]; signed char boss_no; char name[0x20]; -}; +} STAGE_TABLE; extern int gStageNo; extern MusicID gMusicNo; @@ -66,3 +70,7 @@ extern MusicID gMusicNo; BOOL TransferStage(int no, int w, int x, int y); void ChangeMusic(MusicID no); void ReCallMusic(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/TextScr.h b/src/TextScr.h index fc46a1d0..a073b731 100644 --- 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 StopTextScript(void); void PutTextScript(void); int TextScriptProc(void); void RestoreTextScript(void); + +#ifdef __cplusplus +} +#endif diff --git a/vs2003/CSE2.vcproj b/vs2003/CSE2.vcproj index 37a8cbe2..47797702 100644 --- a/vs2003/CSE2.vcproj +++ b/vs2003/CSE2.vcproj @@ -321,6 +321,12 @@ + + + From 65682dd913369ce9614a927ea2921586661f388e Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 6 Jan 2020 21:01:17 +0000 Subject: [PATCH 03/10] Made Dialog.cpp valid C89 See #41 --- src/ArmsItem.h | 8 ++++---- src/Dialog.cpp | 8 ++++---- src/Dialog.h | 8 ++++++++ src/Generic.h | 8 ++++++++ src/Profile.h | 12 ++++++++++-- src/SelStage.h | 12 ++++++++++-- vs2003/CSE2.vcproj | 6 ++++++ 7 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/ArmsItem.h b/src/ArmsItem.h index be9bc84b..8f777a6a 100644 --- a/src/ArmsItem.h +++ b/src/ArmsItem.h @@ -11,7 +11,7 @@ extern "C" { // "Num" often means "ammo" here /// Weapon struct -struct ARMS +typedef struct ARMS { /// ID of the weapon int code; @@ -27,13 +27,13 @@ struct ARMS /// 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 diff --git a/src/Dialog.cpp b/src/Dialog.cpp index f57fe31f..ab33b6ca 100644 --- a/src/Dialog.cpp +++ b/src/Dialog.cpp @@ -19,8 +19,6 @@ static const char *version_string = // 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_PTR __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara int version3; int version4; + (void)lParam; + switch (Msg) { case WM_INITDIALOG: @@ -104,10 +104,10 @@ INT_PTR __stdcall DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa INT_PTR __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - (void)lParam; - char string[100]; + (void)lParam; + switch (Msg) { case WM_INITDIALOG: diff --git a/src/Dialog.h b/src/Dialog.h index 6ff69e82..35b1a6ad 100644 --- 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 diff --git a/src/Generic.h b/src/Generic.h index 9259689e..cb3ec376 100644 --- 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 CenterWindow(HWND hWnd); BOOL LoadWindowRect(HWND hWnd, const char *filename, BOOL unknown); BOOL SaveWindowRect(HWND hWnd, const char *filename); BOOL IsEnableBitmap(const char *path); + +#ifdef __cplusplus +} +#endif diff --git a/src/Profile.h b/src/Profile.h index 7298a230..a2efac5e 100644 --- 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 @@ struct PROFILE 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 diff --git a/src/SelStage.h b/src/SelStage.h index 419b94b7..b7c47b53 100644 --- 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 @@ BOOL SubPermitStage(int index); void MoveStageSelectCursor(void); void PutStageSelectObject(void); int StageSelectLoop(int *p_event); + +#ifdef __cplusplus +} +#endif diff --git a/vs2003/CSE2.vcproj b/vs2003/CSE2.vcproj index 47797702..033252f3 100644 --- a/vs2003/CSE2.vcproj +++ b/vs2003/CSE2.vcproj @@ -243,6 +243,12 @@ + + + From 9498fe13bedcca0417eee735173e59b94a236d02 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 6 Jan 2020 21:15:42 +0000 Subject: [PATCH 04/10] Made TextScr.cpp valid C89 See #41 --- src/BossLife.h | 8 ++++++++ src/Ending.h | 8 ++++++++ src/Fade.h | 8 ++++++++ src/Flags.h | 8 ++++++++ src/KeyControl.h | 8 ++++++++ src/Main.cpp | 1 + src/Main.h | 8 ++++++++ src/MiniMap.h | 8 ++++++++ src/MycParam.h | 16 ++++++++++++---- src/PixTone.h | 16 ++++++++++++---- src/Sound.h | 8 ++++++++ src/Tags.h | 8 ++++++++ src/TextScr.cpp | 18 ++++++++++++------ src/TextScr.h | 4 ++-- vs2003/CSE2.vcproj | 6 ++++++ 15 files changed, 117 insertions(+), 16 deletions(-) diff --git a/src/BossLife.h b/src/BossLife.h index 1d5ffc63..28fa00f1 100644 --- 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 diff --git a/src/Ending.h b/src/Ending.h index 54033793..9a749e36 100644 --- 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 @@ int GetScriptNumber(const char *text); void SetCreditIllust(int a); void CutCreditIllust(void); int Scene_DownIsland(HWND hWnd, int mode); + +#ifdef __cplusplus +} +#endif diff --git a/src/Fade.h b/src/Fade.h index b1f17366..4613be9d 100644 --- 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 StartFadeIn(signed char dir); void ProcFade(void); void PutFade(void); BOOL GetFadeActive(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/Flags.h b/src/Flags.h index 15a6ad2f..97aef8a4 100644 --- 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 @@ BOOL GetNPCFlag(long a); void SetSkipFlag(long a); void CutSkipFlag(long a); BOOL GetSkipFlag(long a); + +#ifdef __cplusplus +} +#endif diff --git a/src/KeyControl.h b/src/KeyControl.h index 9063c82b..1a6da5c3 100644 --- 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 gKeyRight; extern long gKeyDown; void GetTrg(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/Main.cpp b/src/Main.cpp index 757575fb..98450750 100644 --- 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); diff --git a/src/Main.h b/src/Main.h index 09b3e5aa..3acd86b8 100644 --- 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 @@ void PutFramePerSecound(void); unsigned long GetFramePerSecound(void); BOOL SystemTask(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/MiniMap.h b/src/MiniMap.h index add3aee5..a53fa872 100644 --- a/src/MiniMap.h +++ b/src/MiniMap.h @@ -2,9 +2,17 @@ #include "WindowsWrapper.h" +#ifdef __cplusplus +extern "C" { +#endif + extern char gMapping[0x80]; int MiniMapLoop(void); BOOL IsMapping(void); void StartMapping(void); void SetMapping(int a); + +#ifdef __cplusplus +} +#endif diff --git a/src/MycParam.h b/src/MycParam.h index 5e625bef..d1256d67 100644 --- 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 PutMyAir(int x, int y); void PutTimeCounter(int x, int y); BOOL SaveTimeCounter(void); int LoadTimeCounter(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/PixTone.h b/src/PixTone.h index 99991309..e8e6c254 100644 --- 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 @@ struct PIXTONEPARAMETER int pointBy; int pointCx; int pointCy; -}; +} PIXTONEPARAMETER; void MakeWaveTables(void); BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData); + +#ifdef __cplusplus +} +#endif diff --git a/src/Sound.h b/src/Sound.h index 46a0e032..ef60d65d 100644 --- 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 ChangeSoundFrequency(int no, DWORD rate); 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 diff --git a/src/Tags.h b/src/Tags.h index d66bf478..0bc06aeb 100644 --- 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 diff --git a/src/TextScr.cpp b/src/TextScr.cpp index 65119232..a2fa078e 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -120,8 +120,10 @@ void EncryptionBinaryData2(unsigned char *pData, long size) // 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 @@ BOOL LoadTextScript2(const char *name) return FALSE; // Open file - FILE *fp = fopen(path, "rb"); + fp = fopen(path, "rb"); if (fp == NULL) return FALSE; @@ -150,15 +152,19 @@ BOOL LoadTextScript2(const char *name) // 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 @@ BOOL LoadTextScript_Stage(const char *name) // 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; diff --git a/src/TextScr.h b/src/TextScr.h index a073b731..ddfd49ea 100644 --- 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 @@ struct TEXT_SCRIPT // NOD cursor blink unsigned char wait_beam; -}; +} TEXT_SCRIPT; BOOL InitTextScript2(void); void EndTextScript(void); diff --git a/vs2003/CSE2.vcproj b/vs2003/CSE2.vcproj index 033252f3..73cc0ec7 100644 --- a/vs2003/CSE2.vcproj +++ b/vs2003/CSE2.vcproj @@ -345,6 +345,12 @@ + + + From 58d7a45392adea33a3b13fc6a86284f1791c38be Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 6 Jan 2020 21:20:17 +0000 Subject: [PATCH 05/10] Empty Tags.h There's no evidence Tags.h contained these variables (if anything, it appears that Pixel manually declared them in every file that used them). gg Pixel --- src/Back.cpp | 2 +- src/Config.cpp | 2 +- src/Draw.cpp | 1 - src/Ending.cpp | 1 - src/Game.cpp | 1 - src/Generic.cpp | 2 +- src/Main.cpp | 1 - src/Main.h | 3 +++ src/Map.cpp | 2 +- src/MycParam.cpp | 2 +- src/NpChar.cpp | 2 +- src/Profile.cpp | 2 +- src/Sound.cpp | 2 +- src/Tags.h | 14 ++------------ src/TextScr.cpp | 1 - 15 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/Back.cpp b/src/Back.cpp index 001101f0..c5f2de76 100644 --- a/src/Back.cpp +++ b/src/Back.cpp @@ -9,9 +9,9 @@ #include "Draw.h" #include "Frame.h" #include "Game.h" +#include "Main.h" #include "Map.h" #include "Stage.h" -#include "Tags.h" BACK gBack; int gWaterY; diff --git a/src/Config.cpp b/src/Config.cpp index c9d21b10..dfc02224 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -5,7 +5,7 @@ #include "WindowsWrapper.h" #include "Config.h" -#include "Tags.h" +#include "Main.h" static const char* const config_filename = "Config.dat"; // Not the original name static const char* const config_magic = "DOUKUTSU20041206"; // Not the original name diff --git a/src/Draw.cpp b/src/Draw.cpp index a638c0b1..b48972c5 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -14,7 +14,6 @@ #include "Generic.h" #include "Main.h" #include "MapName.h" -#include "Tags.h" #include "TextScr.h" typedef enum SurfaceType diff --git a/src/Ending.cpp b/src/Ending.cpp index e5108768..70af5dbf 100644 --- a/src/Ending.cpp +++ b/src/Ending.cpp @@ -16,7 +16,6 @@ #include "Organya.h" #include "Stage.h" #include "TextScr.h" -#include "Tags.h" CREDIT Credit; STRIP Strip[MAX_STRIP]; diff --git a/src/Game.cpp b/src/Game.cpp index e9c4c565..c7357235 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -40,7 +40,6 @@ #include "Sound.h" #include "Stage.h" #include "Star.h" -#include "Tags.h" #include "TextScr.h" #include "ValueView.h" diff --git a/src/Generic.cpp b/src/Generic.cpp index a435ced8..e6db4928 100644 --- a/src/Generic.cpp +++ b/src/Generic.cpp @@ -6,7 +6,7 @@ #include "WindowsWrapper.h" -#include "Tags.h" +#include "Main.h" void GetCompileDate(int *year, int *month, int *day) { diff --git a/src/Main.cpp b/src/Main.cpp index 98450750..757575fb 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -20,7 +20,6 @@ #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); diff --git a/src/Main.h b/src/Main.h index 3acd86b8..5735a749 100644 --- a/src/Main.h +++ b/src/Main.h @@ -6,6 +6,9 @@ extern "C" { #endif +extern char gModulePath[MAX_PATH]; +extern char gDataPath[MAX_PATH]; + extern HWND ghWnd; extern BOOL bFullscreen; diff --git a/src/Map.cpp b/src/Map.cpp index 5627db2c..f16ccc78 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -9,8 +9,8 @@ #include "CommonDefines.h" #include "Draw.h" +#include "Main.h" #include "NpChar.h" -#include "Tags.h" #define PXM_BUFFER_SIZE 0x4B000 diff --git a/src/MycParam.cpp b/src/MycParam.cpp index 5fff9171..74d17afa 100644 --- a/src/MycParam.cpp +++ b/src/MycParam.cpp @@ -9,10 +9,10 @@ #include "Caret.h" #include "Draw.h" #include "Game.h" +#include "Main.h" #include "MyChar.h" #include "NpChar.h" #include "Sound.h" -#include "Tags.h" #include "TextScr.h" #include "ValueView.h" diff --git a/src/NpChar.cpp b/src/NpChar.cpp index d35226a5..64a02467 100644 --- a/src/NpChar.cpp +++ b/src/NpChar.cpp @@ -11,10 +11,10 @@ #include "Draw.h" #include "Flags.h" #include "Game.h" +#include "Main.h" #include "MyChar.h" #include "NpcTbl.h" #include "Sound.h" -#include "Tags.h" #include "ValueView.h" NPCHAR gNPC[NPC_MAX]; diff --git a/src/Profile.cpp b/src/Profile.cpp index 4f228244..c28c51aa 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -12,13 +12,13 @@ #include "Flags.h" #include "Frame.h" #include "Game.h" +#include "Main.h" #include "MiniMap.h" #include "MyChar.h" #include "NpChar.h" #include "SelStage.h" #include "Stage.h" #include "Star.h" -#include "Tags.h" #include "ValueView.h" const char *gDefaultName = "Profile.dat"; diff --git a/src/Sound.cpp b/src/Sound.cpp index 662891db..5e15e9a1 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -22,9 +22,9 @@ equivalents. #include "WindowsWrapper.h" +#include "Main.h" #include "Organya.h" #include "PixTone.h" -#include "Tags.h" LPDIRECTSOUND lpDS; // DirectSoundオブジェクト (DirectSound object) LPDIRECTSOUNDBUFFER lpPRIMARYBUFFER; // 一時バッファ (Temporary buffer) diff --git a/src/Tags.h b/src/Tags.h index 0bc06aeb..09235ab7 100644 --- a/src/Tags.h +++ b/src/Tags.h @@ -1,14 +1,4 @@ #pragma once -#include "WindowsWrapper.h" - -#ifdef __cplusplus -extern "C" { -#endif - -extern char gModulePath[MAX_PATH]; -extern char gDataPath[MAX_PATH]; - -#ifdef __cplusplus -} -#endif +// Apparently this used to contain a bunch of structs? +// For now, the structs are in header files matching their purpose. diff --git a/src/TextScr.cpp b/src/TextScr.cpp index a2fa078e..6be4012e 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -32,7 +32,6 @@ #include "SelStage.h" #include "Sound.h" #include "Stage.h" -#include "Tags.h" #define TSC_BUFFER_SIZE 0x5000 From 8a860c57f366dd33439abed266b7d2cf485492cf Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 6 Jan 2020 21:21:33 +0000 Subject: [PATCH 06/10] Deleted Types.h Leftover from the Linux port, where it seemed to contains standard types like int32_t and __quad_t. Personally, I think Linux port implementation details like this are out of the scope of the project. --- src/Types.h | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 src/Types.h diff --git a/src/Types.h b/src/Types.h deleted file mode 100644 index 892ace5a..00000000 --- a/src/Types.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -//This was originally some sort of POSIX standard thing? leftover from the Linux port From 098647f7fd6bfad8ac47bca2686b908d5c4b431a Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 7 Jan 2020 04:39:14 +0000 Subject: [PATCH 07/10] More-accurate TextScr.cpp variable arrangement --- src/TextScr.cpp | 52 +++++++++++++++++++++++----------------------- vs2003/CSE2.vcproj | 2 +- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/TextScr.cpp b/src/TextScr.cpp index 6be4012e..eb89bd64 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -41,7 +41,6 @@ TEXT_SCRIPT gTS; -int gNumberTextScript[4]; char text[4][0x40]; RECT gRect_line = {0, 0, 216, 16}; @@ -88,6 +87,7 @@ void EndTextScript(void) // Release buffers ReleaseSurface(SURFACE_ID_TEXT_BOX); + for (i = 0; i < 4; ++i) ReleaseSurface((SurfaceID)(SURFACE_ID_TEXT_LINE1 + i)); } @@ -95,12 +95,14 @@ void EndTextScript(void) // Decrypt .tsc void EncryptionBinaryData2(unsigned char *pData, long size) { - int val1; - int work; int i; + int work; + int half; + int val1; half = size / 2; + if (pData[half] == 0) val1 = -7; else @@ -119,8 +121,8 @@ void EncryptionBinaryData2(unsigned char *pData, long size) // Load generic .tsc BOOL LoadTextScript2(const char *name) { - char path[MAX_PATH]; FILE *fp; + char path[MAX_PATH]; // Get path sprintf(path, "%s\\%s", gDataPath, name); @@ -151,8 +153,8 @@ BOOL LoadTextScript2(const char *name) // Load stage .tsc BOOL LoadTextScript_Stage(const char *name) { - char path[MAX_PATH]; FILE *fp; + char path[MAX_PATH]; long head_size; long body_size; @@ -300,6 +302,7 @@ BOOL JumpTextScript(int no) // Find where event starts gTS.p_read = 0; + while(1) { // Check if we are still in the proper range @@ -324,6 +327,7 @@ BOOL JumpTextScript(int no) // Advance until new-line while (gTS.data[gTS.p_read] != '\n') ++gTS.p_read; + ++gTS.p_read; return TRUE; @@ -351,15 +355,17 @@ void CheckNewLine(void) } } +int gNumberTextScript[4]; + // Type a number into the text buffer void SetNumberTextScript(int index) { + char str[5]; + BOOL bZero; int a; int b; - int i; - BOOL bZero; int offset; - char str[5]; + int i; // Get digit table int table[3]; @@ -429,15 +435,7 @@ void ClearTextLine(void) // Draw textbox and whatever else void PutTextScript(void) { - RECT rcFace; - RECT rcItemBox1; - RECT rcItemBox2; - RECT rcItemBox3; - RECT rcItemBox4; - RECT rcItemBox5; int i; - RECT rect_yesno; - RECT rect_cur; RECT rect; int text_offset; @@ -473,6 +471,7 @@ void PutTextScript(void) } // Draw face picture + RECT rcFace; rcFace.left = (gTS.face % 6) * 48; rcFace.top = (gTS.face / 6) * 48; rcFace.right = rcFace.left + 48; @@ -522,11 +521,11 @@ void PutTextScript(void) } // Draw GIT - SET_RECT(rcItemBox1, 0, 0, 72, 16) - SET_RECT(rcItemBox2, 0, 8, 72, 24) - SET_RECT(rcItemBox3, 240, 0, 244, 8) - SET_RECT(rcItemBox4, 240, 8, 244, 16) - SET_RECT(rcItemBox5, 240, 16, 244, 24) + RECT rcItemBox1 = {0, 0, 72, 16}; + RECT rcItemBox2 = {0, 8, 72, 24}; + RECT rcItemBox3 = {240, 0, 244, 8}; + RECT rcItemBox4 = {240, 8, 244, 16}; + RECT rcItemBox5 = {240, 16, 244, 24}; if (gTS.item != 0) { @@ -559,8 +558,8 @@ void PutTextScript(void) } // Draw Yes / No selection - SET_RECT(rect_yesno, 152, 48, 244, 80) - SET_RECT(rect_cur, 112, 88, 128, 104) + RECT rect_yesno = {152, 48, 244, 80}; + RECT rect_cur = {112, 88, 128, 104}; if (gTS.mode == 6) { @@ -578,11 +577,12 @@ void PutTextScript(void) // Parse TSC int TextScriptProc(void) { - BOOL bExit; - char c[3]; - int w, x, y, z; int i; + char c[3]; char str[72]; + int w, x, y, z; + + BOOL bExit; RECT rcSymbol = {64, 48, 72, 56}; diff --git a/vs2003/CSE2.vcproj b/vs2003/CSE2.vcproj index 73cc0ec7..3725c70c 100644 --- a/vs2003/CSE2.vcproj +++ b/vs2003/CSE2.vcproj @@ -349,7 +349,7 @@ Name="Release|Win32"> + CompileAs="0"/> Date: Tue, 7 Jan 2020 04:40:27 +0000 Subject: [PATCH 08/10] Make VS2003 compile everything as C++ again As recent findings in #41 have shown, the codebase appears to be C++98, not C89. --- vs2003/CSE2.vcproj | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/vs2003/CSE2.vcproj b/vs2003/CSE2.vcproj index 3725c70c..27e0f055 100644 --- a/vs2003/CSE2.vcproj +++ b/vs2003/CSE2.vcproj @@ -243,12 +243,6 @@ - - - @@ -327,42 +321,18 @@ - - - - - - - - - - - - Date: Tue, 7 Jan 2020 04:46:58 +0000 Subject: [PATCH 09/10] Remove all the C-compatibility stuff --- src/ArmsItem.h | 8 -------- src/Back.h | 8 -------- src/Boss.h | 8 -------- src/Bullet.h | 8 -------- src/Caret.h | 8 -------- src/Dialog.h | 8 -------- src/Draw.h | 8 -------- src/Ending.h | 8 -------- src/Fade.h | 8 -------- src/Flags.h | 8 -------- src/Flash.h | 8 -------- src/Frame.h | 8 -------- src/Game.h | 8 -------- src/Generic.h | 8 -------- src/KeyControl.h | 8 -------- src/Main.h | 8 -------- src/Map.h | 8 -------- src/MapName.h | 8 -------- src/MiniMap.h | 8 -------- src/MyChar.h | 8 -------- src/MycParam.h | 8 -------- src/NpChar.h | 8 -------- src/Organya.h | 8 -------- src/PixTone.h | 8 -------- src/Profile.h | 8 -------- src/SelStage.h | 8 -------- src/Sound.h | 8 -------- src/Stage.h | 8 -------- src/Star.h | 8 -------- src/TextScr.h | 8 -------- 30 files changed, 240 deletions(-) diff --git a/src/ArmsItem.h b/src/ArmsItem.h index 8f777a6a..c98bb2ae 100644 --- a/src/ArmsItem.h +++ b/src/ArmsItem.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - // "Arms" is a synonym of "weapon" here // "Code" means "ID" here // "Num" often means "ammo" here @@ -114,7 +110,3 @@ int RotationArmsRev(void); /// Change the current weapon to be the first one and play the usual rotation animation void ChangeToFirstArms(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Back.h b/src/Back.h index 5c17614f..f10ccb0b 100644 --- a/src/Back.h +++ b/src/Back.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct BACK { BOOL flag; // Basically unused @@ -24,7 +20,3 @@ BOOL InitBack(const char *fName, int type); void ActBack(void); void PutBack(int fx, int fy); void PutFront(int fx, int fy); - -#ifdef __cplusplus -} -#endif diff --git a/src/Boss.h b/src/Boss.h index 8cf99182..ab3e6807 100644 --- a/src/Boss.h +++ b/src/Boss.h @@ -2,10 +2,6 @@ #include "NpChar.h" -#ifdef __cplusplus -extern "C" { -#endif - #define BOSS_MAX 20 extern NPCHAR gBoss[BOSS_MAX]; @@ -18,7 +14,3 @@ void SetBossCharActNo(int a); void HitBossBullet(void); void ActBossChar(void); void HitBossMap(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Bullet.h b/src/Bullet.h index c10e7810..5604d8f3 100644 --- a/src/Bullet.h +++ b/src/Bullet.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct BULLET { int flag; @@ -73,7 +69,3 @@ void PutBullet(int fx, int fy); void SetBullet(int no, int x, int y, int dir); void ActBullet(void); BOOL IsActiveSomeBullet(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Caret.h b/src/Caret.h index c7a33727..ab249e84 100644 --- a/src/Caret.h +++ b/src/Caret.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - struct CARET_TABLE { int view_left; @@ -34,7 +30,3 @@ void InitCaret(void); void ActCaret(void); void PutCaret(int fx, int fy); void SetCaret(int x, int y, int code, int dir); - -#ifdef __cplusplus -} -#endif diff --git a/src/Dialog.h b/src/Dialog.h index 35b1a6ad..6ff69e82 100644 --- a/src/Dialog.h +++ b/src/Dialog.h @@ -2,15 +2,7 @@ #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 diff --git a/src/Draw.h b/src/Draw.h index 04018025..8c4b625d 100644 --- a/src/Draw.h +++ b/src/Draw.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - #ifndef RGB #define RGB(r,g,b) ((r) | ((g) << 8) | ((b) << 16)) #endif @@ -74,7 +70,3 @@ void InitTextObject(const char *font_name); void PutText(int x, int y, const char *text, unsigned long color); void PutText2(int x, int y, const char *text, unsigned long color, SurfaceID surf_no); void EndTextObject(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Ending.h b/src/Ending.h index 9a749e36..54033793 100644 --- a/src/Ending.h +++ b/src/Ending.h @@ -4,10 +4,6 @@ #include "CommonDefines.h" -#ifdef __cplusplus -extern "C" { -#endif - struct CREDIT { long size; @@ -57,7 +53,3 @@ int GetScriptNumber(const char *text); void SetCreditIllust(int a); void CutCreditIllust(void); int Scene_DownIsland(HWND hWnd, int mode); - -#ifdef __cplusplus -} -#endif diff --git a/src/Fade.h b/src/Fade.h index 4613be9d..b1f17366 100644 --- a/src/Fade.h +++ b/src/Fade.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - void InitFade(void); void SetFadeMask(void); void ClearFade(void); @@ -14,7 +10,3 @@ void StartFadeIn(signed char dir); void ProcFade(void); void PutFade(void); BOOL GetFadeActive(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Flags.h b/src/Flags.h index 97aef8a4..15a6ad2f 100644 --- a/src/Flags.h +++ b/src/Flags.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - extern unsigned char gFlagNPC[1000]; extern unsigned char gSkipFlag[8]; @@ -17,7 +13,3 @@ BOOL GetNPCFlag(long a); void SetSkipFlag(long a); void CutSkipFlag(long a); BOOL GetSkipFlag(long a); - -#ifdef __cplusplus -} -#endif diff --git a/src/Flash.h b/src/Flash.h index 9d640a59..bbd99eaf 100644 --- a/src/Flash.h +++ b/src/Flash.h @@ -1,9 +1,5 @@ #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); @@ -11,7 +7,3 @@ void ActFlash_Flash(void); void ActFlash(int flx, int fly); void PutFlash(void); void ResetFlash(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Frame.h b/src/Frame.h index fa599399..95b8e6b5 100644 --- a/src/Frame.h +++ b/src/Frame.h @@ -1,9 +1,5 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - typedef struct FRAME { int x; @@ -27,7 +23,3 @@ void SetFrameTargetBoss(int no, int wait); void SetQuake(int time); void SetQuake2(int time); void ResetQuake(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Game.h b/src/Game.h index 86edd98b..224ea03f 100644 --- a/src/Game.h +++ b/src/Game.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - enum GameFlagsValues { // To be continued @@ -37,7 +33,3 @@ int Random(int min, int max); void PutNumber4(int x, int y, int value, BOOL bZero); BOOL Game(HWND hWnd); - -#ifdef __cplusplus -} -#endif diff --git a/src/Generic.h b/src/Generic.h index cb3ec376..9259689e 100644 --- a/src/Generic.h +++ b/src/Generic.h @@ -2,10 +2,6 @@ #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); @@ -20,7 +16,3 @@ BOOL CenterWindow(HWND hWnd); BOOL LoadWindowRect(HWND hWnd, const char *filename, BOOL unknown); BOOL SaveWindowRect(HWND hWnd, const char *filename); BOOL IsEnableBitmap(const char *path); - -#ifdef __cplusplus -} -#endif diff --git a/src/KeyControl.h b/src/KeyControl.h index 1a6da5c3..9063c82b 100644 --- a/src/KeyControl.h +++ b/src/KeyControl.h @@ -1,9 +1,5 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - enum KeyBind { //The movement keys go in the order of left, right, up and down @@ -57,7 +53,3 @@ extern long gKeyRight; extern long gKeyDown; void GetTrg(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Main.h b/src/Main.h index 5735a749..09808682 100644 --- a/src/Main.h +++ b/src/Main.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - extern char gModulePath[MAX_PATH]; extern char gDataPath[MAX_PATH]; @@ -16,7 +12,3 @@ void PutFramePerSecound(void); unsigned long GetFramePerSecound(void); BOOL SystemTask(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Map.h b/src/Map.h index 44eb9e0b..071999b9 100644 --- a/src/Map.h +++ b/src/Map.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct MAP_DATA { unsigned char *data; @@ -29,7 +25,3 @@ BOOL ChangeMapParts(int x, int y, unsigned char no); void PutStage_Back(int fx, int fy); void PutStage_Front(int fx, int fy); void PutMapDataVector(int fx, int fy); - -#ifdef __cplusplus -} -#endif diff --git a/src/MapName.h b/src/MapName.h index 15c7267a..c48312a8 100644 --- a/src/MapName.h +++ b/src/MapName.h @@ -2,15 +2,7 @@ #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 diff --git a/src/MiniMap.h b/src/MiniMap.h index a53fa872..add3aee5 100644 --- a/src/MiniMap.h +++ b/src/MiniMap.h @@ -2,17 +2,9 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - extern char gMapping[0x80]; int MiniMapLoop(void); BOOL IsMapping(void); void StartMapping(void); void SetMapping(int a); - -#ifdef __cplusplus -} -#endif diff --git a/src/MyChar.h b/src/MyChar.h index e9e01c8c..07a810eb 100644 --- a/src/MyChar.h +++ b/src/MyChar.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - // TODO - When I add bitmask constants for gMC.flags... // 0x100 is a 'player is underwater' flag @@ -87,7 +83,3 @@ void SetNoise(int no, int freq); void CutNoise(void); void ResetNoise(void); void SleepNoise(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/MycParam.h b/src/MycParam.h index d1256d67..82ab63b2 100644 --- a/src/MycParam.h +++ b/src/MycParam.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct ARMS_LEVEL { int exp[3]; @@ -34,7 +30,3 @@ void PutMyAir(int x, int y); void PutTimeCounter(int x, int y); BOOL SaveTimeCounter(void); int LoadTimeCounter(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/NpChar.h b/src/NpChar.h index 9e03224d..a0781459 100644 --- a/src/NpChar.h +++ b/src/NpChar.h @@ -5,10 +5,6 @@ #include "Draw.h" -#ifdef __cplusplus -extern "C" { -#endif - #define NPC_MAX 0x200 enum NPCCond @@ -144,7 +140,3 @@ void GetNpCharPosition(int *x, int *y, int i); BOOL IsNpCharCode(int code); BOOL GetNpCharAlive(int code_event); int CountAliveNpChar(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Organya.h b/src/Organya.h index d8b820ff..b0e5a792 100644 --- a/src/Organya.h +++ b/src/Organya.h @@ -9,10 +9,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - #define MAXTRACK 16 #define MAXMELODY 8 #define MAXDRAM 8 @@ -31,7 +27,3 @@ void StopOrganyaMusic(void); void SetOrganyaFadeout(void); BOOL StartOrganya(LPDIRECTSOUND lpDS, const char *wave_filename); void EndOrganya(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/PixTone.h b/src/PixTone.h index e8e6c254..45589105 100644 --- a/src/PixTone.h +++ b/src/PixTone.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct PIXTONEPARAMETER2 { int model; @@ -32,7 +28,3 @@ typedef struct PIXTONEPARAMETER void MakeWaveTables(void); BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData); - -#ifdef __cplusplus -} -#endif diff --git a/src/Profile.h b/src/Profile.h index a2efac5e..1ddab80e 100644 --- a/src/Profile.h +++ b/src/Profile.h @@ -6,10 +6,6 @@ #include "SelStage.h" #include "Stage.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct PROFILE { char code[8]; @@ -39,7 +35,3 @@ BOOL IsProfile(void); BOOL SaveProfile(const char *name); BOOL LoadProfile(const char *name); BOOL InitializeGame(HWND hWnd); - -#ifdef __cplusplus -} -#endif diff --git a/src/SelStage.h b/src/SelStage.h index b7c47b53..7f1a49d4 100644 --- a/src/SelStage.h +++ b/src/SelStage.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct PERMIT_STAGE { int index; @@ -20,7 +16,3 @@ BOOL SubPermitStage(int index); void MoveStageSelectCursor(void); void PutStageSelectObject(void); int StageSelectLoop(int *p_event); - -#ifdef __cplusplus -} -#endif diff --git a/src/Sound.h b/src/Sound.h index ef60d65d..46a0e032 100644 --- a/src/Sound.h +++ b/src/Sound.h @@ -11,10 +11,6 @@ #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 @@ -46,7 +42,3 @@ void ChangeSoundFrequency(int no, DWORD rate); 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 diff --git a/src/Stage.h b/src/Stage.h index f5940025..be4f13fd 100644 --- a/src/Stage.h +++ b/src/Stage.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef enum MusicID { MUS_SILENCE = 0x0, @@ -70,7 +66,3 @@ extern MusicID gMusicNo; BOOL TransferStage(int no, int w, int x, int y); void ChangeMusic(MusicID no); void ReCallMusic(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/Star.h b/src/Star.h index 231242eb..672effb0 100644 --- a/src/Star.h +++ b/src/Star.h @@ -1,13 +1,5 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - void InitStar(void); void ActStar(void); void PutStar(int fx, int fy); - -#ifdef __cplusplus -} -#endif diff --git a/src/TextScr.h b/src/TextScr.h index ddfd49ea..9cc49259 100644 --- a/src/TextScr.h +++ b/src/TextScr.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct TEXT_SCRIPT { // Path (reload when exit teleporter menu/inventory) @@ -68,7 +64,3 @@ void StopTextScript(void); void PutTextScript(void); int TextScriptProc(void); void RestoreTextScript(void); - -#ifdef __cplusplus -} -#endif From dbe773f01a1221c483643e33bd50d0245d2aa077 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 7 Jan 2020 04:50:15 +0000 Subject: [PATCH 10/10] ...Remove more C-compatibility stuff --- src/BossLife.h | 8 -------- src/ValueView.h | 8 -------- 2 files changed, 16 deletions(-) diff --git a/src/BossLife.h b/src/BossLife.h index 28fa00f1..1d5ffc63 100644 --- a/src/BossLife.h +++ b/src/BossLife.h @@ -2,15 +2,7 @@ #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 diff --git a/src/ValueView.h b/src/ValueView.h index cf80e060..368e7039 100644 --- a/src/ValueView.h +++ b/src/ValueView.h @@ -2,10 +2,6 @@ #include "WindowsWrapper.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct VALUEVIEW { BOOL flag; @@ -21,7 +17,3 @@ void ClearValueView(void); void SetValueView(int *px, int *py, int value); void ActValueView(void); void PutValueView(int flx, int fly); - -#ifdef __cplusplus -} -#endif