ref: b9a68fec2589eb6969be63e6ed1eb3fca312c307
parent: 4c35f3ac8506e5f326658bbab91c257584f7b716
author: Remy Oukaour <[email protected]>
date: Thu Dec 28 16:22:35 EST 2017
Consistent if/else/endc (matches rept/endr) and DEF (matches BANK/HIGH/LOW)
--- a/engine/billspc.asm
+++ b/engine/billspc.asm
@@ -1442,9 +1442,9 @@
jr .loop\@
.done\@
-IF \1
+if \1
call CloseSRAM
-ENDC
+endc
ld a, -1
ld [de], a
ld a, [wd004]
--- a/engine/events/battle_tower.asm
+++ b/engine/events/battle_tower.asm
@@ -26,13 +26,13 @@
ld a, [hRandomAdd]
add b
ld b, a ; b contains the nr of the trainer
-IF DEF(CRYSTAL11)
+if DEF(CRYSTAL11)
and (1 << 7) - 1
cp 70
-ELSE
+else
and (1 << 5) - 1
cp 21
-ENDC
+endc
jr nc, .resample
ld b, a
--- a/engine/intro_menu.asm
+++ b/engine/intro_menu.asm
@@ -199,9 +199,9 @@
ld [Coins], a
ld [Coins + 1], a
-IF START_MONEY >= $10000
+if START_MONEY >= $10000
ld a, HIGH(START_MONEY >> 8)
-ENDC
+endc
ld [Money], a
ld a, HIGH(START_MONEY) ; mid
ld [Money + 1], a
@@ -646,11 +646,11 @@
ret z
push hl
ld hl, PokedexCaught
-IF NUM_POKEMON % 8
+if NUM_POKEMON % 8
ld b, NUM_POKEMON / 8 + 1
-ELSE
+else
ld b, NUM_POKEMON / 8
-ENDC
+endc
call CountSetBits
pop hl
ld de, wd265
--- a/engine/pic_animation.asm
+++ b/engine/pic_animation.asm
@@ -55,7 +55,7 @@
pokeanim: MACRO
rept _NARG
; Workaround for a bug where macro args can't come after the start of a symbol
-if !def(\1_POKEANIM)
+if !DEF(\1_POKEANIM)
\1_POKEANIM EQUS "PokeAnim_\1_"
endc
db (\1_POKEANIM - PokeAnim_SetupCommands) / 2
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -147,9 +147,9 @@
dw Script_loadmenudata ; 4f
dw Script_closewindow ; 50
dw Script_jumptextfaceplayer ; 51
-IF _CRYSTAL
+if _CRYSTAL
dw Script_farjumptext ; 52
-ENDC
+endc
dw Script_jumptext ; 53
dw Script_waitbutton ; 54
dw Script_buttonsound ; 55
@@ -338,7 +338,7 @@
end
-IF _CRYSTAL
+if _CRYSTAL
Script_farjumptext:
; script command 0x52
@@ -355,7 +355,7 @@
ld hl, JumpTextScript
jp ScriptJump
-ENDC
+endc
Script_writetext:
--- a/macros/base_stats.asm
+++ b/macros/base_stats.asm
@@ -1,7 +1,7 @@
; Used in data/pokemon/base_stats/*.asm
define: MACRO
-if !def(\1)
+if !DEF(\1)
\1 EQUS \2
endc
ENDM
@@ -9,7 +9,7 @@
const_value = 0
add_tm: MACRO
-if !def(TM01)
+if !DEF(TM01)
TM01 = const_value
enum_start 1
endc
@@ -19,7 +19,7 @@
ENDM
add_hm: MACRO
-if !def(HM01)
+if !DEF(HM01)
HM01 = const_value
endc
define _\@_1, "HM_\1"
@@ -38,7 +38,7 @@
tms2 = 0
tms3 = 0
rept _NARG
- if def(\1_TMNUM)
+ if DEF(\1_TMNUM)
if \1_TMNUM < 24 + 1
tms1 = tms1 | (1 << ((\1_TMNUM) - 1))
elif \1_TMNUM < 48 + 1
--- a/macros/coords.asm
+++ b/macros/coords.asm
@@ -43,9 +43,9 @@
bcbgcoord EQUS "bgcoord bc,"
bgcoord: MACRO
-IF _NARG >= 4
+ if _NARG >= 4
ld \1, \3 bgrows + \2 + \4
-ELSE
+ else
ld \1, \3 bgrows + \2 + vBGMap0
-ENDC
+ endc
ENDM
--- a/macros/scripts/events.asm
+++ b/macros/scripts/events.asm
@@ -538,13 +538,13 @@
dw \1 ; text_pointer
ENDM
-; IF _CRYSTAL
+; if _CRYSTAL
enum farjumptext_command ; $52
farjumptext: MACRO
db farjumptext_command
dba \1
ENDM
-; ENDC
+; endc
enum jumptext_command ; $53
jumptext: MACRO
--- a/main.asm
+++ b/main.asm
@@ -645,8 +645,8 @@
SECTION "Mobile Stadium 2", ROMX
-IF DEF(CRYSTAL11)
+if DEF(CRYSTAL11)
INCBIN "mobile/stadium/stadium2_2.bin"
-ELSE
+else
INCBIN "mobile/stadium/stadium2_1.bin"
-ENDC
+endc
--- a/mobile/battle_tower_47.asm
+++ b/mobile/battle_tower_47.asm
@@ -5,12 +5,11 @@
; 3: Player won
ld a, [rSVBK]
push af
- ld a, 3 ; BANK(BT_OTTrainerClass)
+ ld a, BANK(BT_OTTrainerClass)
ld [rSVBK], a
-IF DEF(CRYSTAL11)
+if DEF(CRYSTAL11)
ld hl, BT_OTTrainerClass
-ELSE
- ld hl, BT_OTName + 5
+else
; BUG ALERT
; Instead of loading the Trainer Class, this routine
; loads the 6th character in the Trainer's name, then
@@ -17,7 +16,8 @@
; uses it to get the gender of the trainer.
; As a consequence, the enemy trainer's dialog will
; always be sampled from the female array.
-ENDC
+ ld hl, BT_OTName + 5
+endc
ld a, [hl]
dec a
ld e, a
--- a/mobile/mobile_5c.asm
+++ b/mobile/mobile_5c.asm
@@ -936,11 +936,11 @@
INCBIN "gfx/trade/game_boy_n64.2bpp"
Tilemap_1733af:
-IF DEF(CRYSTAL11)
+if DEF(CRYSTAL11)
INCBIN "gfx/unknown/1733af_corrupt.tilemap"
-ELSE
+else
INCBIN "gfx/unknown/1733af.tilemap"
-ENDC
+endc
Attrmap_173517:
INCBIN "gfx/unknown/173517.attrmap"
--- a/wram.asm
+++ b/wram.asm
@@ -827,12 +827,12 @@
wBackupDexListingCursor:: db
wBackupDexListingPage:: db
wDexCurrentLocation:: db
-IF DEF(CRYSTAL11)
+if DEF(CRYSTAL11)
wPokedexStatus:: db
wPokedexDataEnd::
-ELSE
+else
wPokedexDataEnd:: ds 1
-ENDC
+endc
ds 2
NEXTU ; c6d0
@@ -1312,9 +1312,9 @@
NEXTU ; cf64
; pokedex
wDexEntryPrevJumptableIndex:: db
-IF !DEF(CRYSTAL11)
+if !DEF(CRYSTAL11)
wPokedexStatus:: db
-ENDC
+endc
NEXTU ; cf64
; miscellaneous