RGBDS syntax updates (#905)

New MACRO and DEF syntax
This commit is contained in:
vulcandth
2022-06-06 16:25:42 -05:00
committed by GitHub
parent a4d346cc8c
commit 3648afda16
179 changed files with 2546 additions and 2545 deletions

View File

@@ -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)

View File

@@ -1,4 +1,4 @@
npctrade: MACRO
MACRO npctrade
; dialog set, requested mon, offered mon, nickname, dvs, item, OT ID, OT name, gender requested
db \1, \2, \3, \4, \5, \6, \7
dw \8

View File

@@ -1,14 +1,14 @@
NUM_ODD_EGGS EQU 14
DEF NUM_ODD_EGGS EQU 14
prob: MACRO
prob_total += \1
MACRO prob
DEF prob_total += \1
dw prob_total * $ffff / 100
ENDM
OddEggProbabilities:
; entries correspond to OddEggs (below)
table_width 2, OddEggProbabilities
prob_total = 0
DEF prob_total = 0
; Pichu
prob 8
prob 1

View File

@@ -1,4 +1,4 @@
rating: MACRO
MACRO rating
; count, sfx, text
db \1
dw \2, \3

View File

@@ -1,7 +1,7 @@
; Special routines can be used with the "special" map script command.
; They often use wScriptVar for arguments and return values.
add_special: MACRO
MACRO add_special
\1Special::
dba \1
ENDM

View File

@@ -1,18 +1,18 @@
unownwall: MACRO
for n, CHARLEN(\1)
x = CHARSUB(\1, n + 1)
if x == "-"
db $64
elif x >= "Y"
db 2 * (x - "Y") + $60
elif x >= "Q"
db 2 * (x - "Q") + $40
elif x >= "I"
db 2 * (x - "I") + $20
else
db 2 * (x - "A")
endc
endr
MACRO unownwall
for n, CHARLEN(\1)
DEF x = CHARSUB(\1, n + 1)
if x == "-"
db $64
elif x >= "Y"
db 2 * (x - "Y") + $60
elif x >= "Q"
db 2 * (x - "Q") + $40
elif x >= "I"
db 2 * (x - "I") + $20
else
db 2 * (x - "A")
endc
endr
db -1 ; end
ENDM