Skip to content

Commit

Permalink
Build with rgbds >= 0.6.0
Browse files Browse the repository at this point in the history
- Change `name: MACRO` to `MACRO name`
- Pass either `-h` or `-Z` to rgbgfx
  • Loading branch information
orbea authored Jun 14, 2024
1 parent 3c76999 commit 22d6f8e
Show file tree
Hide file tree
Showing 79 changed files with 673 additions and 667 deletions.
28 changes: 17 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ else
RGBDS_DIR =
endif

ifeq ($(filter $(shell echo 'print __RGBDS_MAJOR__ || (!__RGBDS_MAJOR__ && __RGBDS_MINOR__ < 6)' | $(RGBDS_DIR)rgbasm -),$$0),)
RGBGFX_FLAGS := -h
else
RGBGFX_FLAGS := -Z
endif

RGBASM_FLAGS = -E -Weverything -Wnumeric-string=2 -Wtruncation=1
RGBLINK_FLAGS = -n $(ROM_NAME).sym -m $(ROM_NAME).map -l layout.link -p $(FILLER)
RGBFIX_FLAGS = -csjv -t $(TITLE) -i $(MCODE) -n $(ROMVERSION) -p $(FILLER) -k 01 -l 0x33 -m 0x10 -r 3
Expand Down Expand Up @@ -119,7 +125,7 @@ endif
cd bsp; ../tools/bspcomp patch.txt ../$@; cd ..


gfx/battle/lyra_back.2bpp: rgbgfx += -h
gfx/battle/lyra_back.2bpp: rgbgfx += $(RGBGFX_FLAGS)

gfx/battle_anims/angels.2bpp: tools/gfx += --trim-whitespace
gfx/battle_anims/beam.2bpp: tools/gfx += --remove-xflip --remove-yflip --remove-whitespace
Expand Down Expand Up @@ -150,27 +156,27 @@ gfx/mail/surf_mail_border.1bpp: tools/gfx += --remove-whitespace
gfx/music_player/music_player.2bpp: tools/gfx += --trim-whitespace
gfx/music_player/note_lines.2bpp: tools/gfx += --interleave --png=$<

gfx/new_game/shrink1.2bpp: rgbgfx += -h
gfx/new_game/shrink2.2bpp: rgbgfx += -h
gfx/new_game/shrink1.2bpp: rgbgfx += $(RGBGFX_FLAGS)
gfx/new_game/shrink2.2bpp: rgbgfx += $(RGBGFX_FLAGS)

gfx/overworld/overworld.2bpp: gfx/overworld/puddle_splash.2bpp gfx/overworld/cut_grass.2bpp gfx/overworld/cut_tree.2bpp gfx/overworld/heal_machine.2bpp gfx/overworld/fishing_rod.2bpp gfx/overworld/shadow.2bpp gfx/overworld/shaking_grass.2bpp gfx/overworld/boulder_dust.2bpp ; cat $^ > $@

gfx/pack/pack_left.2bpp: tools/gfx += --trim-whitespace
gfx/pack/pack_top_left.2bpp: gfx/pack/pack_top.2bpp gfx/pack/pack_left.2bpp ; cat $^ > $@

gfx/paintings/%.2bpp: rgbgfx += -h
gfx/paintings/%.2bpp: rgbgfx += $(RGBGFX_FLAGS)

gfx/player/chris_back.2bpp: rgbgfx += -h
gfx/player/kris_back.2bpp: rgbgfx += -h
gfx/player/chris_back.2bpp: rgbgfx += $(RGBGFX_FLAGS)
gfx/player/kris_back.2bpp: rgbgfx += $(RGBGFX_FLAGS)

gfx/pokedex/pokedex.2bpp: tools/gfx += --trim-whitespace
gfx/pokedex/question_mark.2bpp: rgbgfx += -h
gfx/pokedex/question_mark.2bpp: rgbgfx += $(RGBGFX_FLAGS)
gfx/pokedex/slowpoke.2bpp: tools/gfx += --trim-whitespace

gfx/pokegear/pokegear.2bpp: tools/gfx += --trim-whitespace
gfx/pokegear/pokegear_sprites.2bpp: tools/gfx += --trim-whitespace

gfx/pokemon/%/back.2bpp: rgbgfx += -h
gfx/pokemon/%/back.2bpp: rgbgfx += $(RGBGFX_FLAGS)

gfx/pc/obj.2bpp: gfx/pc/modes.2bpp gfx/pc/bags.2bpp ; cat $^ > $@

Expand All @@ -190,10 +196,10 @@ gfx/trade/ball_poof_cable.2bpp: gfx/trade/ball.2bpp gfx/trade/poof.2bpp gfx/trad
gfx/trade/game_boy_cable.2bpp: gfx/trade/game_boy.2bpp gfx/trade/link_cable.2bpp ; cat $^ > $@
gfx/trade/trade_screen.2bpp: gfx/trade/border.2bpp gfx/trade/textbox.2bpp ; cat $^ > $@

gfx/trainer_card/chris_card.2bpp: rgbgfx += -h
gfx/trainer_card/kris_card.2bpp: rgbgfx += -h
gfx/trainer_card/chris_card.2bpp: rgbgfx += $(RGBGFX_FLAGS)
gfx/trainer_card/kris_card.2bpp: rgbgfx += $(RGBGFX_FLAGS)

gfx/trainers/%.2bpp: rgbgfx += -h
gfx/trainers/%.2bpp: rgbgfx += $(RGBGFX_FLAGS)

gfx/type_chart/bg.2bpp: tools/gfx += --remove-duplicates --remove-xflip --remove-yflip
gfx/type_chart/bg0.2bpp: gfx/type_chart/bg.2bpp.vram1p gfx/type_chart/bg.2bpp.vram0p ; cat $^ > $@
Expand Down
2 changes: 1 addition & 1 deletion audio/alternate_music.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
alternate_music: MACRO
MACRO alternate_music
; pointer, bitmask, unset music id, set music id
dw \1
db \2, \3, \4
Expand Down
8 changes: 4 additions & 4 deletions audio/music_player.asm
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ INCBIN "gfx/music_player/note_lines.2bpp.lz"

SECTION "Music Player", ROMX

jrbutton: MACRO
MACRO jrbutton
; assumes hl == hJoyPressed
ld a, [hl]
and \1
jr nz, \2
ENDM

jpbutton: MACRO
MACRO jpbutton
; assumes hl == hJoyPressed
ld a, [hl]
and \1
jmp nz, \2
ENDM

jrheldbutton: MACRO
MACRO jrheldbutton
; assumes hl == hJoyDown
ld a, [wTextDelayFrames]
and a
Expand All @@ -47,7 +47,7 @@ jrheldbutton: MACRO
.no\@:
ENDM

jpheldbutton: MACRO
MACRO jpheldbutton
; assumes hl == hJoyDown
ld a, [wTextDelayFrames]
and a
Expand Down
2 changes: 1 addition & 1 deletion charmap.asm
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ NGRAMS_END EQU $52
setcharmap default


rawchar: MACRO
MACRO rawchar
setcharmap no_ngrams
db \#
setcharmap default
Expand Down
2 changes: 1 addition & 1 deletion constants/deco_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ NUM_DECO_ACTIONS EQU const_value - 1

__deco_value__ = 0

deco: MACRO
MACRO deco
const DECO_\1
DECOFLAG_\1 EQU __deco_value__
__deco_value__ += 1
Expand Down
4 changes: 2 additions & 2 deletions constants/map_constants.asm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
newgroup: MACRO
MACRO newgroup
const_value += 1
__map_value__ = 1
ENDM

map_const: MACRO
MACRO map_const
;\1: map id
;\2: width: in blocks
;\3: height: in blocks
Expand Down
4 changes: 2 additions & 2 deletions constants/pokemon_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ CANCEL EQU -1
; - CosmeticSpeciesAndFormTable (see data/pokemon/variant_forms.asm)
; - ValidVariantRanges (see data/pokemon/valid_variants.asm)

ext_const_def: MACRO
MACRO ext_const_def
if _NARG >= 1
def ext_const_value = \1
else
Expand All @@ -297,7 +297,7 @@ ext_const_def: MACRO
endc
ENDM

ext_const: MACRO
MACRO ext_const
const_skip
DEF \1 EQU ext_const_value
redef ext_const_value += const_inc
Expand Down
8 changes: 4 additions & 4 deletions constants/tmhm_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

__tmhm_value__ = 1

add_tmnum: MACRO
MACRO add_tmnum
\1_TMNUM EQU __tmhm_value__
__tmhm_value__ += 1
ENDM

add_tm: MACRO
MACRO add_tm
if !DEF(TM01)
TM01 = const_value
endc
Expand Down Expand Up @@ -99,7 +99,7 @@ endc
add_tm SWORDS_DANCE ; $4a
NUM_TMS = __tmhm_value__ - 1

add_hm: MACRO
MACRO add_hm
if !DEF(HM01)
HM01 = const_value
endc
Expand All @@ -115,7 +115,7 @@ ENDM
add_hm WATERFALL ; $50
NUM_HMS = __tmhm_value__ - NUM_TMS - 1

add_mt: MACRO
MACRO add_mt
if !DEF(MT01)
MT01 = const_value
endc
Expand Down
2 changes: 1 addition & 1 deletion constants/trainer_constants.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__trainer_class__ = 0

trainerclass: MACRO
MACRO trainerclass
\1 EQU __trainer_class__
__trainer_class__ += 1
const_def 1
Expand Down
6 changes: 3 additions & 3 deletions data/battle/effect_command_pointers.asm
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
command: MACRO
MACRO command
const \1_command
\1 EQUS "db \1_command"
dw BattleCommand_\1
ENDM

commandx: MACRO
MACRO commandx
const \1_command
\1 EQUS "db \1_command,"
dw BattleCommand_\1
ENDM

commandonly: MACRO
MACRO commandonly
const \1_command
\1 EQUS "db \1_command"
ENDM
Expand Down
2 changes: 1 addition & 1 deletion data/battle_anims/oam.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
battleanimoam: MACRO
MACRO battleanimoam
db \1 ; vtile offset
db \2 ; data length
dw \3 ; data pointer
Expand Down
2 changes: 1 addition & 1 deletion data/battle_anims/object_gfx.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
anim_obj_gfx: MACRO
MACRO anim_obj_gfx
; # tiles, label
db \1
dba \2
Expand Down
2 changes: 1 addition & 1 deletion data/battle_anims/objects.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ABSOLUTE_X EQU $00
RELATIVE_X EQU $01

battleanimobj: MACRO
MACRO battleanimobj
db \1 ; flags
; bit 7: priority
; bit 6: y flip (for enemy)
Expand Down
2 changes: 1 addition & 1 deletion data/decorations/attributes.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
decoration: MACRO
MACRO decoration
; type, name, command, event flag, tile/sprite
db \1, \2, \3
dw \4
Expand Down
2 changes: 1 addition & 1 deletion data/events/engine_flags.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
engine_flag: MACRO
MACRO engine_flag
; location, bit
; (all locations are in WRAM bank 1)
dwb \1 + (\2 / 8), 1 << (\2 % 8)
Expand Down
2 changes: 1 addition & 1 deletion data/events/odd_eggs.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NUM_ODD_EGGS EQU 5
ODD_EGG_LENGTH EQU 10

prob: MACRO
MACRO prob
prob_total += \1
dw prob_total * $ffff / 100
ENDM
Expand Down
2 changes: 1 addition & 1 deletion data/events/special_pointers.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_special: MACRO
MACRO add_special
\1Special::
dba \1
ENDM
Expand Down
2 changes: 1 addition & 1 deletion data/growth_rates.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
growth_rate: MACRO
MACRO growth_rate
; [1]/[2]*n**3 + [3]*n**2 + [4]*n - [5]
dn \1, \2
if \3 < 0
Expand Down
4 changes: 2 additions & 2 deletions data/items/attributes.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
item_attribute: MACRO
MACRO item_attribute
; price, held effect, parameter, pocket, field menu, battle menu
dw \1
db \2, \3, \4
Expand Down Expand Up @@ -517,7 +517,7 @@ ItemAttributes:
item_attribute 50, 0, 0, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
assert_table_length NUM_ITEMS

key_item_attribute: MACRO
MACRO key_item_attribute
; selectable, field menu, battle menu
db \1
dn \2, \3
Expand Down
2 changes: 1 addition & 1 deletion data/items/mom_phone.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
momitem: MACRO
MACRO momitem
; money to trigger, cost, kind, item
dt \1
dt \2
Expand Down
4 changes: 2 additions & 2 deletions data/maps/attributes.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
map_attributes: MACRO
MACRO map_attributes
; label, map, border block, connections
CURRENT_MAP_WIDTH = \2_WIDTH
CURRENT_MAP_HEIGHT = \2_HEIGHT
Expand All @@ -13,7 +13,7 @@ CURRENT_MAP_HEIGHT = \2_HEIGHT
ENDM

; Connections go in order: north, south, west, east
connection: MACRO
MACRO connection
;\1: direction
;\2: map name
;\3: map id
Expand Down
2 changes: 1 addition & 1 deletion data/maps/landmarks.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
landmark: MACRO
MACRO landmark
db \1, \2
dw \3
ENDM
Expand Down
2 changes: 1 addition & 1 deletion data/maps/maps.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
map: MACRO
MACRO map
;\1: map name: for the MapAttributes pointer (see data/maps/attributes.asm)
;\2: tileset: a TILESET_* constant
;\3: environment: TOWN, ROUTE, INDOOR, CAVE, ENVIRONMENT_5, GATE, or DUNGEON
Expand Down
6 changes: 3 additions & 3 deletions data/maps/palettes.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
special_pal_for: MACRO
MACRO special_pal_for
if !STRCMP("\1", "map")
db PAL_FOR_MAP
map_id \2 ; map id
Expand All @@ -16,7 +16,7 @@ endc
ENDM

SpecialBGPalettes:
special_bg_pal: MACRO
MACRO special_bg_pal
special_pal_for \1, \2
db \3 ; type
dw \4 ; source
Expand Down Expand Up @@ -94,7 +94,7 @@ ENDM
db 0 ; end

SpecialOBPalettes:
special_ob_pal: MACRO
MACRO special_ob_pal
special_pal_for \1, \2
dw \3 ; source
if _NARG == 6
Expand Down
2 changes: 1 addition & 1 deletion data/maps/scenes.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
scene_var: MACRO
MACRO scene_var
; db group, map
; dw address
map_id \1
Expand Down
2 changes: 1 addition & 1 deletion data/maps/setup_script_pointers.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_mapsetup: MACRO
MACRO add_mapsetup
\1_MapSetupCmd:
dba \1
ENDM
Expand Down
2 changes: 1 addition & 1 deletion data/maps/setup_scripts.asm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ MapSetupScripts:
assert_table_length NUM_MAPSETUP_SCRIPTS

; valid commands are listed in MapSetupCommands (see data/maps/setup_script_pointers.asm)
mapsetup: MACRO
MACRO mapsetup
db (\1_MapSetupCmd - MapSetupCommands) / 3
ENDM

Expand Down
2 changes: 1 addition & 1 deletion data/maps/spawn_points.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spawn: MACRO
MACRO spawn
; map, y, x
map_id \1
db \2, \3
Expand Down
2 changes: 1 addition & 1 deletion data/maps/special_music.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Functions are defined in home/audio.asm.
; Specifying GetMapMusic makes the Bicycle music not play.

music_map: MACRO
MACRO music_map
map_id \1
dw \2
ENDM
Expand Down
2 changes: 1 addition & 1 deletion data/moves/moves.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
move: MACRO
MACRO move
db \1 ; animation
db \2 ; effect
db \3 ; power
Expand Down
2 changes: 1 addition & 1 deletion data/music_player/song_info.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
song_info: MACRO
MACRO song_info
li \1
db \2, \3, \4
ENDM
Expand Down
Loading

0 comments on commit 22d6f8e

Please sign in to comment.