diff --git a/Makefile b/Makefile index 2f91fa1b..433c9099 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ ifeq ($(RELEASE), 1) - CXXFLAGS := -O3 -s + CXXFLAGS = -O3 -s FILENAME_DEF = release else - CXXFLAGS := -O0 -g + CXXFLAGS = -O0 -g FILENAME_DEF = debug endif ifeq ($(JAPANESE), 1) CXXFLAGS += -DJAPANESE - LIBS += -liconv + ifeq ($(RELEASE), 1) FILENAME_DEF = releasejp else @@ -26,16 +26,20 @@ ifeq ($(WINDOWS), 1) ifeq ($(CONSOLE), 1) CXXFLAGS += -mconsole endif + ifeq ($(JAPANESE), 1) + LIBS += -liconv + endif + CXXFLAGS += -DWINDOWS LIBS += -lkernel32 endif -CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags` +CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF $@.d LIBS += `sdl2-config --static-libs` `pkg-config freetype2 --libs` ifeq ($(STATIC), 1) -CXXFLAGS += -static -LIBS += -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2 -lRpcrt4 -lDwrite -lusp10 + CXXFLAGS += -static + LIBS += -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2 -lRpcrt4 -lDwrite -lusp10 endif # For an accurate result to the original's code, compile in alphabetical order @@ -186,27 +190,28 @@ ifneq ($(WINDOWS), 1) endif OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES))) +DEPENDENCIES = $(addprefix obj/$(FILENAME)/, $(addsuffix .o.d, $(SOURCES))) ifeq ($(WINDOWS), 1) -OBJECTS += obj/$(FILENAME)/win_icon.o + OBJECTS += obj/$(FILENAME)/win_icon.o endif all: build/$(FILENAME) build/$(FILENAME): $(OBJECTS) @mkdir -p $(@D) - @g++ $(CXXFLAGS) $^ -o $@ $(LIBS) + @$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS) @echo Finished compiling: $@ obj/$(FILENAME)/%.o: src/%.cpp @mkdir -p $(@D) - @echo Compiling $^ - @g++ $(CXXFLAGS) $^ -o $@ -c + @echo Compiling $< + @$(CXX) $(CXXFLAGS) $< -o $@ -c obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuffix .h, $(RESOURCES))) @mkdir -p $(@D) @echo Compiling $< - @g++ $(CXXFLAGS) $< -o $@ -c + @$(CXX) $(CXXFLAGS) $< -o $@ -c src/Resource/%.h: res/% obj/bin2h @mkdir -p $(@D) @@ -216,7 +221,9 @@ src/Resource/%.h: res/% obj/bin2h obj/bin2h: res/bin2h.c @mkdir -p $(@D) @echo Compiling $^ - @gcc -O3 -s -static $^ -o $@ + @$(CC) -O3 -s -static $^ -o $@ + +include $(wildcard $(DEPENDENCIES)) obj/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico @mkdir -p $(@D) diff --git a/src/Generic.cpp b/src/Generic.cpp index 33f8b811..20bbe30e 100644 --- a/src/Generic.cpp +++ b/src/Generic.cpp @@ -16,7 +16,7 @@ bool GetCompileVersion(int *v1, int *v2, int *v3, int *v4) bool CheckFileExists(const char *name) { char path[PATH_LENGTH]; - sprintf(path, "%s\\%s", gModulePath, name); + sprintf(path, "%s/%s", gModulePath, name); FILE *file = fopen(path, "rb"); if (file) diff --git a/src/Main.cpp b/src/Main.cpp index ef45bc4c..326b9a4c 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -280,7 +280,6 @@ int main(int argc, char *argv[]) } //Create window - SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"); gWindow = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, gWindowWidth, gWindowHeight, bFullscreen ? SDL_WINDOW_FULLSCREEN : 0); if (gWindow) diff --git a/src/NpcAct100.cpp b/src/NpcAct100.cpp index a9e2fbbc..48d81858 100644 --- a/src/NpcAct100.cpp +++ b/src/NpcAct100.cpp @@ -260,9 +260,9 @@ void ActNpc104(NPCHAR *npc) if (bJump) { if (gMC.x > npc->x) - npc->direct = 0; - else npc->direct = 2; + else + npc->direct = 0; npc->act_no = 10; npc->ani_no = 2; @@ -272,7 +272,7 @@ void ActNpc104(NPCHAR *npc) PlaySoundObject(30, 1); if (npc->direct == 0) - npc->xm = -0x200u; + npc->xm = -0x200; else npc->xm = 0x200; } diff --git a/src/PixTone.cpp b/src/PixTone.cpp index ee7b3df0..33e82185 100644 --- a/src/PixTone.cpp +++ b/src/PixTone.cpp @@ -6,7 +6,7 @@ #include "WindowsWrapper.h" -static char gWaveModelTable[6][256]; +static signed char gWaveModelTable[6][256]; void MakeWaveTables(void) { diff --git a/src/Sound.cpp b/src/Sound.cpp index 00a9b052..20dce1ec 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -323,7 +323,7 @@ size_t MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no) if (pcm_buffer[j] + mixed_pcm_buffer[j] - 0x100 < -0x7F) mixed_pcm_buffer[j] = 0; else if (pcm_buffer[j] + mixed_pcm_buffer[j] - 0x100 > 0x7F) - mixed_pcm_buffer[j] = -1; + mixed_pcm_buffer[j] = 0xFF; else mixed_pcm_buffer[j] += pcm_buffer[j] + -0x80; }