Merge pull request #58 from Clownacy/master
Cleanup, ARM Linux portability improvements, an accuracy fix, and dependency generation
This commit is contained in:
commit
e796a55a75
6 changed files with 25 additions and 19 deletions
25
Makefile
25
Makefile
|
@ -1,14 +1,14 @@
|
||||||
ifeq ($(RELEASE), 1)
|
ifeq ($(RELEASE), 1)
|
||||||
CXXFLAGS := -O3 -s
|
CXXFLAGS = -O3 -s
|
||||||
FILENAME_DEF = release
|
FILENAME_DEF = release
|
||||||
else
|
else
|
||||||
CXXFLAGS := -O0 -g
|
CXXFLAGS = -O0 -g
|
||||||
FILENAME_DEF = debug
|
FILENAME_DEF = debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(JAPANESE), 1)
|
ifeq ($(JAPANESE), 1)
|
||||||
CXXFLAGS += -DJAPANESE
|
CXXFLAGS += -DJAPANESE
|
||||||
LIBS += -liconv
|
|
||||||
ifeq ($(RELEASE), 1)
|
ifeq ($(RELEASE), 1)
|
||||||
FILENAME_DEF = releasejp
|
FILENAME_DEF = releasejp
|
||||||
else
|
else
|
||||||
|
@ -26,11 +26,15 @@ ifeq ($(WINDOWS), 1)
|
||||||
ifeq ($(CONSOLE), 1)
|
ifeq ($(CONSOLE), 1)
|
||||||
CXXFLAGS += -mconsole
|
CXXFLAGS += -mconsole
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(JAPANESE), 1)
|
||||||
|
LIBS += -liconv
|
||||||
|
endif
|
||||||
|
|
||||||
CXXFLAGS += -DWINDOWS
|
CXXFLAGS += -DWINDOWS
|
||||||
LIBS += -lkernel32
|
LIBS += -lkernel32
|
||||||
endif
|
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`
|
LIBS += `sdl2-config --static-libs` `pkg-config freetype2 --libs`
|
||||||
|
|
||||||
ifeq ($(STATIC), 1)
|
ifeq ($(STATIC), 1)
|
||||||
|
@ -186,6 +190,7 @@ ifneq ($(WINDOWS), 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
||||||
|
DEPENDENCIES = $(addprefix obj/$(FILENAME)/, $(addsuffix .o.d, $(SOURCES)))
|
||||||
|
|
||||||
ifeq ($(WINDOWS), 1)
|
ifeq ($(WINDOWS), 1)
|
||||||
OBJECTS += obj/$(FILENAME)/win_icon.o
|
OBJECTS += obj/$(FILENAME)/win_icon.o
|
||||||
|
@ -195,18 +200,18 @@ all: build/$(FILENAME)
|
||||||
|
|
||||||
build/$(FILENAME): $(OBJECTS)
|
build/$(FILENAME): $(OBJECTS)
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@g++ $(CXXFLAGS) $^ -o $@ $(LIBS)
|
@$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS)
|
||||||
@echo Finished compiling: $@
|
@echo Finished compiling: $@
|
||||||
|
|
||||||
obj/$(FILENAME)/%.o: src/%.cpp
|
obj/$(FILENAME)/%.o: src/%.cpp
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@echo Compiling $^
|
@echo Compiling $<
|
||||||
@g++ $(CXXFLAGS) $^ -o $@ -c
|
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
||||||
|
|
||||||
obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuffix .h, $(RESOURCES)))
|
obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuffix .h, $(RESOURCES)))
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@echo Compiling $<
|
@echo Compiling $<
|
||||||
@g++ $(CXXFLAGS) $< -o $@ -c
|
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
||||||
|
|
||||||
src/Resource/%.h: res/% obj/bin2h
|
src/Resource/%.h: res/% obj/bin2h
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
|
@ -216,7 +221,9 @@ src/Resource/%.h: res/% obj/bin2h
|
||||||
obj/bin2h: res/bin2h.c
|
obj/bin2h: res/bin2h.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@echo Compiling $^
|
@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
|
obj/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
|
|
|
@ -16,7 +16,7 @@ bool GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
|
||||||
bool CheckFileExists(const char *name)
|
bool CheckFileExists(const char *name)
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[PATH_LENGTH];
|
||||||
sprintf(path, "%s\\%s", gModulePath, name);
|
sprintf(path, "%s/%s", gModulePath, name);
|
||||||
|
|
||||||
FILE *file = fopen(path, "rb");
|
FILE *file = fopen(path, "rb");
|
||||||
if (file)
|
if (file)
|
||||||
|
|
|
@ -280,7 +280,6 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create window
|
//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);
|
gWindow = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, gWindowWidth, gWindowHeight, bFullscreen ? SDL_WINDOW_FULLSCREEN : 0);
|
||||||
|
|
||||||
if (gWindow)
|
if (gWindow)
|
||||||
|
|
|
@ -260,9 +260,9 @@ void ActNpc104(NPCHAR *npc)
|
||||||
if (bJump)
|
if (bJump)
|
||||||
{
|
{
|
||||||
if (gMC.x > npc->x)
|
if (gMC.x > npc->x)
|
||||||
npc->direct = 0;
|
|
||||||
else
|
|
||||||
npc->direct = 2;
|
npc->direct = 2;
|
||||||
|
else
|
||||||
|
npc->direct = 0;
|
||||||
|
|
||||||
npc->act_no = 10;
|
npc->act_no = 10;
|
||||||
npc->ani_no = 2;
|
npc->ani_no = 2;
|
||||||
|
@ -272,7 +272,7 @@ void ActNpc104(NPCHAR *npc)
|
||||||
PlaySoundObject(30, 1);
|
PlaySoundObject(30, 1);
|
||||||
|
|
||||||
if (npc->direct == 0)
|
if (npc->direct == 0)
|
||||||
npc->xm = -0x200u;
|
npc->xm = -0x200;
|
||||||
else
|
else
|
||||||
npc->xm = 0x200;
|
npc->xm = 0x200;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
static char gWaveModelTable[6][256];
|
static signed char gWaveModelTable[6][256];
|
||||||
|
|
||||||
void MakeWaveTables(void)
|
void MakeWaveTables(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
if (pcm_buffer[j] + mixed_pcm_buffer[j] - 0x100 < -0x7F)
|
||||||
mixed_pcm_buffer[j] = 0;
|
mixed_pcm_buffer[j] = 0;
|
||||||
else if (pcm_buffer[j] + mixed_pcm_buffer[j] - 0x100 > 0x7F)
|
else if (pcm_buffer[j] + mixed_pcm_buffer[j] - 0x100 > 0x7F)
|
||||||
mixed_pcm_buffer[j] = -1;
|
mixed_pcm_buffer[j] = 0xFF;
|
||||||
else
|
else
|
||||||
mixed_pcm_buffer[j] += pcm_buffer[j] + -0x80;
|
mixed_pcm_buffer[j] += pcm_buffer[j] + -0x80;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue