shithub: pokecrystal

Download patch

ref: 3144b54bd1dcc47ea339fcd2bd215ec96fc38c4a
parent: 95e48ef992a6c89a147543ba0eed8fe671cadcac
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sat Apr 4 13:46:36 EDT 2020

Enable rgbds warnings and remove CFLAGS=-O2 (default is now -O3)

--- a/FAQ.md
+++ b/FAQ.md
@@ -8,6 +8,7 @@
 - [I can't build the ROM, `make` just prints an error!](#i-cant-build-the-rom-make-just-prints-an-error)
   - [`gcc`: command not found](#gcc-command-not-found)
   - ["ERROR: `UNION` already defined"](#error-union-already-defined)
+  - ["ERROR: Macro not defined"](#error-macro-not-defined)
   - ["Expression must be 8-bit"](#expression-must-be-8-bit)
   - ["Segmentation fault" from `rgbgfx`](#segmentation-fault-from-rgbgfx)
   - ["Section is too big" or "Unable to place section in bank"](#section-is-too-big-or-unable-to-place-section-in-bank)
@@ -38,6 +39,10 @@
 You need to install `gcc`. If you're using Cygwin, re-run its setup, and at "Select Packages", choose to install `gcc-core`.
 
 ### "ERROR: `UNION` already defined"
+
+Download [**rgbds 0.4.0**][rgbds] or newer. Older versions will not work.
+
+### "ERROR: Macro not defined"
 
 Download [**rgbds 0.4.0**][rgbds] or newer. Older versions will not work.
 
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -87,7 +87,7 @@
 ```bash
 sudo apt-get install pkg-config flex bison libpng-dev
 git clone -b v0.4.0 --depth=1 https://github.com/rednex/rgbds
-sudo make -C rgbds CFLAGS=-O2 install
+sudo make -C rgbds install
 ```
 
 ### OpenSUSE
@@ -103,7 +103,7 @@
 ```bash
 sudo zypper install pkg-config flex bison libpng16-devel
 git clone -b v0.4.0 --depth=1 https://github.com/rednex/rgbds
-sudo make -C rgbds CFLAGS=-O2 install
+sudo make -C rgbds install
 ```
 
 ### Arch Linux
@@ -121,7 +121,7 @@
 ```bash
 sudo pacman -S pkg-config flex bison libpng
 git clone -b v0.4.0 --depth=1 https://github.com/rednex/rgbds
-sudo make -C rgbds CFLAGS=-O2 install
+sudo make -C rgbds install
 ```
 
 ### Termux
@@ -158,7 +158,7 @@
 
 ```bash
 git clone -b v0.4.0 --depth=1 https://github.com/rednex/rgbds
-sudo make -C rgbds CFLAGS=-O2 install
+sudo make -C rgbds install
 ```
 
 Now you're ready to [build **pokecrystal**](#build-pokecrystal).
--- a/Makefile
+++ b/Makefile
@@ -45,8 +45,8 @@
 .SECONDARY:
 
 all: crystal
-crystal: pokecrystal.gbc
-crystal11: pokecrystal11.gbc
+crystal:    pokecrystal.gbc
+crystal11:  pokecrystal11.gbc
 crystal-au: pokecrystal-au.gbc
 
 clean:
@@ -66,9 +66,10 @@
 	$(MAKE) -C tools/
 
 
-$(crystal_obj):   RGBASMFLAGS =
-$(crystal11_obj): RGBASMFLAGS = -D _CRYSTAL11
-$(crystal_au_obj): RGBASMFLAGS = -D _CRYSTAL11 -D _CRYSTAL_AU
+RGBASMFLAGS = -L -Weverything
+$(crystal_obj):    RGBASMFLAGS +=
+$(crystal11_obj):  RGBASMFLAGS += -D _CRYSTAL11
+$(crystal_au_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _CRYSTAL_AU
 
 # The dep rules have to be explicit or else missing files won't be reported.
 # As a side effect, they're evaluated immediately instead of when the rule is invoked.
@@ -75,7 +76,7 @@
 # It doesn't look like $(shell) can be deferred so there might not be a better way.
 define DEP
 $1: $2 $$(shell tools/scan_includes $2)
-	$$(RGBASM) $$(RGBASMFLAGS) -L -o $$@ $$<
+	$$(RGBASM) $$(RGBASMFLAGS) -o $$@ $$<
 endef
 
 # Build tools when building the rom.
--- a/constants.asm
+++ b/constants.asm
@@ -1,4 +1,4 @@
-if __RGBDS_MINOR__ < 4
+if __RGBDS_MAJOR__ <= 0 && __RGBDS_MINOR__ < 4
 	fail "pokecrystal requires rgbds 0.4.0 or newer."
 endc
 
--- a/engine/events/overworld.asm
+++ b/engine/events/overworld.asm
@@ -750,13 +750,13 @@
 EscapeRopeFunction:
 	call FieldMoveJumptableReset
 	ld a, $1
-	jr dig_incave
+	jr EscapeRopeOrDig
 
 DigFunction:
 	call FieldMoveJumptableReset
 	ld a, $2
 
-dig_incave
+EscapeRopeOrDig:
 	ld [wBuffer2], a
 .loop
 	ld hl, .DigTable
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -241,7 +241,7 @@
 	ld a, [wTrainerClass]
 	call GetTrainerPalettePointer
 	ld a, e
-	jr got_palette_pointer_8bd7
+	jr LoadNthMiddleBGPal
 
 LoadMonPaletteAsNthBGPal:
 	ld a, [wCurPartySpecies]
@@ -248,7 +248,7 @@
 	call _GetMonPalettePointer
 	ld a, e
 	bit 7, a
-	jr z, got_palette_pointer_8bd7
+	jr z, LoadNthMiddleBGPal
 	and $7f
 	inc hl
 	inc hl
@@ -255,7 +255,7 @@
 	inc hl
 	inc hl
 
-got_palette_pointer_8bd7
+LoadNthMiddleBGPal:
 	push hl
 	ld hl, wBGPals1
 	ld de, 1 palettes
--- a/engine/gfx/load_pics.asm
+++ b/engine/gfx/load_pics.asm
@@ -247,7 +247,7 @@
 ; This is a thing for some reason.
 
 PICS_FIX EQU $36
-GLOBAL PICS_FIX
+EXPORT PICS_FIX
 
 	push hl
 	push bc
--- a/engine/pokedex/pokedex.asm
+++ b/engine/pokedex/pokedex.asm
@@ -16,7 +16,7 @@
 	const DEXSTATE_EXIT
 
 POKEDEX_SCX EQU 5
-GLOBAL POKEDEX_SCX
+EXPORT POKEDEX_SCX
 
 Pokedex:
 	ldh a, [hWX]