shithub: cstory

Download patch

ref: 33c1ea8f2046d00e6a135c464a3e2bc26259e4f8
parent: c838e8ebcb81ef81412ca2832f6ceff0b65972fb
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Jan 6 15:05:49 EST 2020

Made ValueView.cpp valid C89

--- a/src/ValueView.cpp
+++ b/src/ValueView.cpp
@@ -1,9 +1,10 @@
+#include "ValueView.h"
+
 #include <string.h>
 
 #include "WindowsWrapper.h"
 
 #include "Draw.h"
-#include "ValueView.h"
 
 #define VALUEVIEW_MAX 0x10
 
@@ -26,6 +27,9 @@
 	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 @@
 	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 @@
 
 	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);
--- 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 @@
   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
--- a/vs2003/CSE2.vcproj
+++ b/vs2003/CSE2.vcproj
@@ -339,6 +339,12 @@
 			</File>
 			<File
 				RelativePath="..\src\ValueView.cpp">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						CompileAs="1"/>
+				</FileConfiguration>
 			</File>
 			<Filter
 				Name="NPC"