shithub: cstory

Download patch

ref: 834471654868adead8ba1e4dc4bfe702d22516a2
parent: 3c9ff22c22232f53d6afb4a3c437256fdc5f19b1
parent: cb87f050576d749d19f7b1f86c3a43505a22394c
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sat Nov 9 09:24:55 EST 2019

Merge branch 'accurate' into portable

--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -46,7 +46,7 @@
 	fclose(fp);
 
 	// Check if version is not correct, and return if it failed
-	if (strcmp(conf->proof, config_magic))
+	if (strcmp(conf->proof, config_magic) != 0)
 	{
 		memset(conf, 0, sizeof(CONFIG));
 		return FALSE;
--- a/src/Flags.cpp
+++ b/src/Flags.cpp
@@ -6,9 +6,9 @@
 
 // Macros for setting, un-setting and getting flags
 // Each flag is stored in a bit, so we can use the exact same macros we'd use for bits
-#define SET_FLAG(x, i) ((x)[(i) / 8] |= 1 << (i) % 8)
-#define UNSET_FLAG(x, i) ((x)[(i) / 8] &= ~(1 << (i) % 8))
-#define GET_FLAG(x, i) ((x)[(i) / 8] & (1 << (i) % 8))
+#define SET_FLAG(x, i) ((x)[(i) / 8] |= 1 << ((i) % 8))
+#define UNSET_FLAG(x, i) ((x)[(i) / 8] &= ~(1 << ((i) % 8)))
+#define GET_FLAG(x, i) ((x)[(i) / 8] & (1 << ((i) % 8)))
 
 unsigned char gFlagNPC[1000];
 unsigned char gSkipFlag[8];
--- a/src/Map.cpp
+++ b/src/Map.cpp
@@ -42,7 +42,7 @@
 	char check[3];
 	fread(check, 1, 3, fp);
 
-	if (memcmp(check, code_pxma, 3))
+	if (memcmp(check, code_pxma, 3) != 0)
 	{
 		fclose(fp);
 		return FALSE;
--- a/src/NpChar.cpp
+++ b/src/NpChar.cpp
@@ -69,7 +69,7 @@
 	// Read "PXE" check
 	char code[4];
 	fread(code, 1, 4, fp);
-	if (memcmp(code, gPassPixEve, 3))
+	if (memcmp(code, gPassPixEve, 3) != 0)
 	{
 #ifdef FIX_BUGS
 		// The original game forgot to close the file here
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -137,7 +137,7 @@
 
 	// Check header code
 	fread(profile.code, 8, 1, fp);
-	if (memcmp(profile.code, gProfileCode, 8))
+	if (memcmp(profile.code, gProfileCode, 8) != 0)
 	{
 #ifdef FIX_BUGS
 		fclose(fp);	// The original game forgets to close the file
--- a/src/Stage.cpp
+++ b/src/Stage.cpp
@@ -250,7 +250,7 @@
 
 void ChangeMusic(MusicID no)
 {
-	if (no && no == gMusicNo)
+	if (no != MUS_SILENCE && no == gMusicNo)
 		return;
 
 	//Stop and keep track of old song
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -33,7 +33,7 @@
 #include "Stage.h"
 #include "Tags.h"
 
-#define IS_COMMAND(c1, c2, c3) gTS.data[gTS.p_read + 1] == c1 && gTS.data[gTS.p_read + 2] == c2 && gTS.data[gTS.p_read + 3] == c3
+#define IS_COMMAND(c1, c2, c3) (gTS.data[gTS.p_read + 1] == (c1) && gTS.data[gTS.p_read + 2] == (c2) && gTS.data[gTS.p_read + 3] == (c3))
 
 #define TSC_BUFFER_SIZE 0x5000
 
--