shithub: cstory

Download patch

ref: 4d04590b2831dbdc70175c6f0131faf7d09b1cf2
parent: ff4352ffdebe5c0bcf361c50ce4e2c8bf1c5a598
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Feb 19 11:05:28 EST 2019

Made the game compile as C++03

Still need to sort out the C++11-only initialiser lists that GCC allows
in C++03 mode with a warning.

--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@
 	LIBS += -lkernel32
 endif
 
-CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF $@.d
+CXXFLAGS += -std=c++03 `sdl2-config --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF $@.d
 LIBS += `sdl2-config --static-libs` `pkg-config freetype2 --libs`
 
 ifeq ($(STATIC), 1)
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -602,5 +602,5 @@
 {
 	//Destroy font
 	UnloadFont(gFont);
-	gFont = nullptr;
+	gFont = NULL;
 }
--- a/src/Input.cpp
+++ b/src/Input.cpp
@@ -1,5 +1,6 @@
 #include "Input.h"
 
+#include <stddef.h>
 #include <stdint.h>
 
 #include <SDL.h>
@@ -21,7 +22,7 @@
 	{
 		SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
 		SDL_JoystickClose(joystick);
-		joystick = nullptr;
+		joystick = NULL;
 	}
 }
 
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -445,7 +445,7 @@
 	//Handle window events
 	bool focusGained = true;
 	
-	while (SDL_PollEvent(nullptr) || !focusGained)
+	while (SDL_PollEvent(NULL) || !focusGained)
 	{
 		SDL_Event event;
 		SDL_WaitEvent(&event);
--- a/src/Organya.cpp
+++ b/src/Organya.cpp
@@ -1,5 +1,6 @@
 #include "Organya.h"
 
+#include <stddef.h>
 #include <stdint.h>
 
 #include <SDL_rwops.h>
@@ -470,7 +471,7 @@
 	for (int j = 0; j < 16; j++) {
 		//The first note from is NULL
 		if (info.tdata[j].note_num == 0) {
-			info.tdata[j].note_list = nullptr;
+			info.tdata[j].note_list = NULL;
 			continue;
 		}
 
@@ -477,7 +478,7 @@
 		//Make note list
 		np = info.tdata[j].note_p;
 		info.tdata[j].note_list = info.tdata[j].note_p;
-		np->from = nullptr;
+		np->from = NULL;
 		np->to = (np + 1);
 		np++;
 
@@ -489,7 +490,7 @@
 
 		//The last note to is NULL
 		np--;
-		np->to = nullptr;
+		np->to = NULL;
 
 		//Set note properties
 		np = info.tdata[j].note_p; //X position
@@ -585,7 +586,7 @@
 }
 
 //Org timer
-SDL_Thread *OrganyaTimer = nullptr;
+SDL_Thread *OrganyaTimer = NULL;
 bool bEndTimer = false;
 
 int OrganyaPlayTimer(void *ptr)
@@ -631,7 +632,7 @@
 {
 	bEndTimer = true; //Tell thread to end
 	SDL_WaitThread(OrganyaTimer, NULL); //Wait for thread to end
-	OrganyaTimer = nullptr;
+	OrganyaTimer = NULL;
 }
 
 //Start and end organya
--- a/src/Sound.cpp
+++ b/src/Sound.cpp
@@ -62,7 +62,7 @@
 		delete[] data;
 	
 	//Remove from buffer list
-	for (SOUNDBUFFER **soundBuffer = &soundBuffers; *soundBuffer != nullptr; soundBuffer = &(*soundBuffer)->next)
+	for (SOUNDBUFFER **soundBuffer = &soundBuffers; *soundBuffer != NULL; soundBuffer = &(*soundBuffer)->next)
 	{
 		if (*soundBuffer == this)
 		{
@@ -85,10 +85,10 @@
 {
 	SDL_LockAudioDevice(audioDevice);
 
-	if (outBuffer != nullptr)
+	if (outBuffer != NULL)
 		*outBuffer = data;
 
-	if (outSize != nullptr)
+	if (outSize != NULL)
 		*outSize = size;
 }
 
@@ -114,7 +114,7 @@
 float MillibelToVolume(int32_t lVolume)
 {
 	//Volume is in hundredths of decibels, from 0 to -10000
-	lVolume = clamp(lVolume, (decltype(lVolume))-10000, (decltype(lVolume))0);
+	lVolume = clamp(lVolume, (int32_t)-10000, (int32_t)0);
 	return pow(10.0, lVolume / 2000.0);
 }
 
@@ -209,7 +209,7 @@
 	}
 	
 	//Mix sounds to primary buffer
-	for (SOUNDBUFFER *sound = soundBuffers; sound != nullptr; sound = sound->next)
+	for (SOUNDBUFFER *sound = soundBuffers; sound != NULL; sound = sound->next)
 		sound->Mix(buffer, samples);
 }
 
--