Merge pull request #12 from Clownacy/master

Makefile, readme, and NPC000 improvements
This commit is contained in:
Cucky 2019-01-26 11:07:22 -05:00 committed by GitHub
commit 0d8179e98c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 114 additions and 104 deletions

View file

@ -1,19 +1,18 @@
RELEASE = 0 ifeq ($(RELEASE), 1)
CXXFLAGS := -O3 -s
ifeq ($(RELEASE), 0)
CXXFLAGS := -O0 -g -static -mconsole
FILENAME := debug
else
CXXFLAGS := -O3 -s -static
FILENAME := release FILENAME := release
else
CXXFLAGS := -O0 -g -mconsole
FILENAME := debug
endif endif
ifeq ($(JAPANESE), 1) ifeq ($(JAPANESE), 1)
CXXFLAGS += -DJAPANESE CXXFLAGS += -DJAPANESE
ifeq ($(RELEASE), 0) LIBS += -liconv
FILENAME := debugjp ifeq ($(RELEASE), 1)
else
FILENAME := releasejp FILENAME := releasejp
else
FILENAME := debugjp
endif endif
endif endif
@ -22,7 +21,12 @@ CXXFLAGS += -DFIX_BUGS
endif endif
CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags` CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags`
LIBS += `sdl2-config --static-libs` -lfreetype -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2 -lRpcrt4 -lDwrite -lusp10 -liconv LIBS += `sdl2-config --static-libs` `pkg-config freetype2 --libs`
ifeq ($(STATIC), 1)
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 # For an accurate result to the original's code, compile in alphabetical order
SOURCES = \ SOURCES = \
@ -130,9 +134,9 @@ endif
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES))) OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
all: build/$(FILENAME).exe all: build/$(FILENAME)
build/$(FILENAME).exe: $(OBJECTS) build/$(FILENAME): $(OBJECTS)
@mkdir -p $(@D) @mkdir -p $(@D)
@g++ $(CXXFLAGS) $^ -o $@ $(LIBS) @g++ $(CXXFLAGS) $^ -o $@ $(LIBS)
@echo Finished compiling: $@ @echo Finished compiling: $@
@ -147,12 +151,12 @@ obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuf
@echo Compiling $< @echo Compiling $<
@g++ $(CXXFLAGS) $< -o $@ -c @g++ $(CXXFLAGS) $< -o $@ -c
src/Resource/%.h: res/% obj/bin2h.exe src/Resource/%.h: res/% obj/bin2h
@mkdir -p $(@D) @mkdir -p $(@D)
@echo Converting $< @echo Converting $<
@obj/bin2h.exe $< $@ @obj/bin2h $< $@
obj/bin2h.exe: res/bin2h.c obj/bin2h: res/bin2h.c
@mkdir -p $(@D) @mkdir -p $(@D)
@echo Compiling $^ @echo Compiling $^
@gcc -O3 -s -static $^ -o $@ @gcc -O3 -s -static $^ -o $@

View file

@ -1,20 +1,22 @@
# Cave Story Engine 2 # Cave Story Engine 2
I'm rewriting Cave Story Engine from scratch, to be more accurate than before!
Cave Story Engine is a recompilation of Cave Story (freeware release), also porting it from DirectX to SDL2 Cave Story Engine is an in-progress decompilation of Cave Story (freeware release), ported from DirectX to SDL2.
![Screenshot](screenshot.png) ![Screenshot](screenshot.png)
How to build: ## Dependencies
Create "build" directory This project currently depends on SDL2 and Freetype2.
cd to the base directory, ## Building
make (RELEASE=1 for release build) Just run 'make' in the base directory, preferably with some of the following optional settings:
* RELEASE=1 to compile a release build (optimised, stripped, etc.)
* STATIC=1 to produce a statically-linked executable (good for Windows builds)
* JAPANESE=1 to enable the Japanese-language build (instead of the unofficial Aeon Genesis English translation)
* FIX_BUGS=1 to fix certain bugs (see [src/Bug Fixes.txt](https://github.com/cuckydev/Cave-Story-Engine-2/blob/master/src/Bug%20Fixes.txt))
## Licensing
JAPANESE=1 to enable certain Japanese differences Being a decompilation, the majority of the code in this project belongs to Daisuke "Pixel" Amaya - not us. We've yet to agree on a license for our own code.
FIX_BUGS=1 to fix certain bugs (see src/Bug Fixes.txt)

View file

@ -54,10 +54,10 @@ bool LoadEvent(char *path_event)
if (memcmp(code, gPassPixEve, 3)) if (memcmp(code, gPassPixEve, 3))
return false; return false;
//Get amount of npcs //Get amount of NPCs
int count = SDL_ReadLE32(fp); int count = SDL_ReadLE32(fp);
//Load npcs //Load NPCs
memset(gNPC, 0, sizeof(gNPC)); memset(gNPC, 0, sizeof(gNPC));
int n = 170; int n = 170;

View file

@ -10,14 +10,18 @@
//Null //Null
void ActNpc000(NPCHAR *npc) void ActNpc000(NPCHAR *npc)
{ {
RECT rect[1];
rect[0] = {0x00, 0x00, 0x10, 0x10};
if (!npc->act_no) if (!npc->act_no)
{ {
npc->act_no = 1; npc->act_no = 1;
if (npc->direct == 2) if (npc->direct == 2)
npc->y += 0x2000; npc->y += 0x2000;
} }
npc->rect = {0, 0, 16, 16}; npc->rect = rect[0];
} }
//Experience //Experience