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.
This commit is contained in:
Clownacy 2019-02-19 16:05:28 +00:00
parent ff4352ffde
commit 4d04590b28
6 changed files with 16 additions and 14 deletions

View file

@ -34,7 +34,7 @@ ifeq ($(WINDOWS), 1)
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)

View file

@ -602,5 +602,5 @@ void EndTextObject()
{
//Destroy font
UnloadFont(gFont);
gFont = nullptr;
gFont = NULL;
}

View file

@ -1,5 +1,6 @@
#include "Input.h"
#include <stddef.h>
#include <stdint.h>
#include <SDL.h>
@ -21,7 +22,7 @@ void ReleaseDirectInput()
{
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
SDL_JoystickClose(joystick);
joystick = nullptr;
joystick = NULL;
}
}

View file

@ -445,7 +445,7 @@ bool SystemTask()
//Handle window events
bool focusGained = true;
while (SDL_PollEvent(nullptr) || !focusGained)
while (SDL_PollEvent(NULL) || !focusGained)
{
SDL_Event event;
SDL_WaitEvent(&event);

View file

@ -1,5 +1,6 @@
#include "Organya.h"
#include <stddef.h>
#include <stdint.h>
#include <SDL_rwops.h>
@ -470,14 +471,14 @@ void LoadOrganya(const char *name)
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;
}
//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 @@ void LoadOrganya(const char *name)
//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 @@ void SetOrganyaFadeout()
}
//Org timer
SDL_Thread *OrganyaTimer = nullptr;
SDL_Thread *OrganyaTimer = NULL;
bool bEndTimer = false;
int OrganyaPlayTimer(void *ptr)
@ -631,7 +632,7 @@ void OrganyaEndTimer()
{
bEndTimer = true; //Tell thread to end
SDL_WaitThread(OrganyaTimer, NULL); //Wait for thread to end
OrganyaTimer = nullptr;
OrganyaTimer = NULL;
}
//Start and end organya

View file

@ -62,7 +62,7 @@ SOUNDBUFFER::~SOUNDBUFFER()
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 @@ void SOUNDBUFFER::Lock(uint8_t **outBuffer, size_t *outSize)
{
SDL_LockAudioDevice(audioDevice);
if (outBuffer != nullptr)
if (outBuffer != NULL)
*outBuffer = data;
if (outSize != nullptr)
if (outSize != NULL)
*outSize = size;
}
@ -114,7 +114,7 @@ void SOUNDBUFFER::SetFrequency(uint32_t dwFrequency)
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 @@ void AudioCallback(void *userdata, uint8_t *stream, int len)
}
//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);
}