summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorentrpntr <entrpntr@gmail.com>2020-04-27 03:33:13 -0400
committerentrpntr <entrpntr@gmail.com>2020-04-27 03:35:35 -0400
commit70d3a3fdbc508eeb4557ddc43d78ba12ed41963e (patch)
tree202f65e4131709331ae62cbe5eace4d6f8b6aa58
parent75cf425d30db6a036743cf85c483c1b537063605 (diff)
Sync with the recent updates to pokecrystal.
-rw-r--r--Makefile9
-rw-r--r--audio/engine.asm2
-rw-r--r--audio/sfx.asm116
-rw-r--r--constants/deco_constants.asm2
-rw-r--r--constants/event_flags.asm6
-rw-r--r--constants/item_constants.asm2
-rw-r--r--constants/move_constants.asm2
-rw-r--r--constants/pokemon_constants.asm4
-rw-r--r--constants/pokemon_data_constants.asm2
-rw-r--r--constants/script_constants.asm2
-rw-r--r--data/items/attributes.asm2
-rw-r--r--data/maps/attributes.asm6
-rw-r--r--engine/battle/ai/scoring.asm2
-rw-r--r--engine/battle/core.asm49
-rw-r--r--engine/events/bug_contest/judging.asm4
-rwxr-xr-xengine/events/heal_machine_anim.asm38
-rw-r--r--engine/events/print_unown.asm10
-rwxr-xr-xengine/gfx/color.asm12
-rw-r--r--engine/menus/intro_menu.asm2
-rw-r--r--engine/overworld/events.asm10
-rw-r--r--engine/overworld/scripting.asm4
-rwxr-xr-xgfx/overworld/heal_machine.pal4
-rw-r--r--gfx/pics_gold.asm2
-rw-r--r--gfx/sgb/gold_border.2bpp (renamed from gfx/sgb_border/gold.2bpp)bin928 -> 928 bytes
-rwxr-xr-xgfx/sgb/gold_border.pal (renamed from gfx/sgb_border/gold.pal)0
-rw-r--r--gfx/sgb/gold_border.png (renamed from gfx/sgb_border/gold.png)bin926 -> 926 bytes
-rw-r--r--gfx/sgb/gold_border.sgb.tilemap (renamed from gfx/sgb_border/gold.map)0
-rw-r--r--gfx/sgb/silver_border.2bpp (renamed from gfx/sgb_border/silver.2bpp)bin928 -> 928 bytes
-rwxr-xr-xgfx/sgb/silver_border.pal (renamed from gfx/sgb_border/silver.pal)0
-rw-r--r--gfx/sgb/silver_border.png (renamed from gfx/sgb_border/silver.png)bin926 -> 926 bytes
-rw-r--r--gfx/sgb/silver_border.sgb.tilemap (renamed from gfx/sgb_border/silver.map)0
-rw-r--r--home/copy.asm12
-rw-r--r--home/farcall.asm4
-rw-r--r--home/gfx.asm8
-rw-r--r--home/map.asm4
-rw-r--r--home/menu.asm4
-rwxr-xr-xhome/print_text.asm4
-rwxr-xr-xhram.asm1
-rw-r--r--macros.asm4
-rw-r--r--macros/code.asm13
-rwxr-xr-xmacros/coords.asm6
-rwxr-xr-xmacros/data.asm23
-rwxr-xr-xmacros/gfx.asm28
-rw-r--r--macros/legacy.asm5
-rw-r--r--macros/scripts/audio.asm4
-rw-r--r--macros/scripts/movement.asm4
-rwxr-xr-xmacros/wram.asm5
-rw-r--r--maps/LakeOfRage.asm2
-rw-r--r--maps/PlayersHouse2F.asm4
-rw-r--r--rgbdscheck.asm12
-rw-r--r--tools/gfx.c71
-rw-r--r--tools/gfx.py2
-rw-r--r--wram.asm3
53 files changed, 292 insertions, 223 deletions
diff --git a/Makefile b/Makefile
index 88ed3f9b..a413ae1a 100644
--- a/Makefile
+++ b/Makefile
@@ -51,11 +51,11 @@ gold: pokegold.gbc
silver: pokesilver.gbc
tidy:
- rm -f $(roms) $(gold_obj) $(silver_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym)
+ rm -f $(roms) $(gold_obj) $(silver_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
$(MAKE) clean -C tools/
clean:
- rm -f $(roms) $(gold_obj) $(silver_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym)
+ rm -f $(roms) $(gold_obj) $(silver_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
find gfx \( -iname "*.png" -not -iname "big_onix.png" \) -delete
$(MAKE) clean -C tools/
@@ -70,11 +70,14 @@ RGBASMFLAGS = -L -Weverything
$(gold_obj): RGBASMFLAGS += -D _GOLD
$(silver_obj): RGBASMFLAGS += -D _SILVER
+rgbdscheck.o: rgbdscheck.asm
+ $(RGBASM) -o $@ $<
+
# 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.
# 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)
+$1: $2 $$(shell tools/scan_includes $2) | rgbdscheck.o
$$(RGBASM) $$(RGBASMFLAGS) -o $$@ $$<
endef
diff --git a/audio/engine.asm b/audio/engine.asm
index 50ce3104..645c121a 100644
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -1294,7 +1294,7 @@ GetNoiseSample:
; load ptr to sample header in wNoiseSampleAddress
; are we on the last channel?
ld a, [wCurChannel]
- and NUM_MUSIC_CHANS + -1
+ and NUM_MUSIC_CHANS - 1
cp CHAN4
; ret if not
ret nz
diff --git a/audio/sfx.asm b/audio/sfx.asm
index 4bffdacb..dec2b7ae 100644
--- a/audio/sfx.asm
+++ b/audio/sfx.asm
@@ -944,7 +944,7 @@ Sfx_RegisterPhoneNumber_Ch5:
note __, 8
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_RegisterPhoneNumber_Ch6:
togglesfx
@@ -968,7 +968,7 @@ Sfx_RegisterPhoneNumber_Ch6:
note __, 8
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_RegisterPhoneNumber_Ch7:
togglesfx
@@ -989,7 +989,7 @@ Sfx_RegisterPhoneNumber_Ch7:
note __, 8
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_RegisterPhoneNumber_Ch8:
togglesfx
@@ -1000,7 +1000,7 @@ Sfx_RegisterPhoneNumber_Ch8:
note __, 16
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_3RdPlace:
musicheader 3, 5, Sfx_3RdPlace_Ch5
@@ -1024,7 +1024,7 @@ Sfx_3RdPlace_Ch5:
note D_, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_3RdPlace_Ch6:
togglesfx
@@ -1041,7 +1041,7 @@ Sfx_3RdPlace_Ch6:
note G_, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_3RdPlace_Ch7:
togglesfx
@@ -1058,7 +1058,7 @@ Sfx_3RdPlace_Ch7:
note B_, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetEgg:
musicheader 4, 5, Sfx_GetEgg_Ch5
@@ -1096,7 +1096,7 @@ Sfx_GetEgg_Ch5:
note __, 9
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetEgg_Ch6:
togglesfx
@@ -1125,7 +1125,7 @@ Sfx_GetEgg_Ch6:
note __, 9
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetEgg_Ch7:
togglesfx
@@ -1144,7 +1144,7 @@ Sfx_GetEgg_Ch7:
note __, 9
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetEgg_Ch8:
togglesfx
@@ -1156,7 +1156,7 @@ Sfx_GetEgg_Ch8:
note __, 12
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_MoveDeleted:
musicheader 4, 5, Sfx_MoveDeleted_Ch5
@@ -1192,7 +1192,7 @@ Sfx_MoveDeleted_Ch5:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_MoveDeleted_Ch6:
togglesfx
@@ -1228,7 +1228,7 @@ Sfx_MoveDeleted_Ch6:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_MoveDeleted_Ch7:
togglesfx
@@ -1255,7 +1255,7 @@ Sfx_MoveDeleted_Ch7:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_MoveDeleted_Ch8:
togglesfx
@@ -1267,7 +1267,7 @@ Sfx_MoveDeleted_Ch8:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_2ndPlace:
musicheader 4, 5, Sfx_2ndPlace_Ch5
@@ -1307,7 +1307,7 @@ Sfx_2ndPlace_Ch5:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_2ndPlace_Ch6:
togglesfx
@@ -1331,7 +1331,7 @@ Sfx_2ndPlace_Ch6:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_2ndPlace_Ch7:
togglesfx
@@ -1369,7 +1369,7 @@ Sfx_2ndPlace_Ch7:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_2ndPlace_Ch8:
togglesfx
@@ -1384,7 +1384,7 @@ Sfx_2ndPlace_Ch8:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_1stPlace:
musicheader 4, 5, Sfx_1stPlace_Ch5
@@ -1431,7 +1431,7 @@ Sfx_1stPlace_Ch5:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_1stPlace_Ch6:
togglesfx
@@ -1455,7 +1455,7 @@ Sfx_1stPlace_Ch6:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_1stPlace_Ch7:
togglesfx
@@ -1479,7 +1479,7 @@ Sfx_1stPlace_Ch7:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_1stPlace_Ch8:
togglesfx
@@ -1500,7 +1500,7 @@ Sfx_1stPlace_Ch8:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_ChooseACard:
musicheader 4, 5, Sfx_ChooseACard_Ch5
@@ -1552,7 +1552,7 @@ Sfx_ChooseACard_Ch5:
note __, 12
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_ChooseACard_Ch6:
togglesfx
@@ -1584,7 +1584,7 @@ Sfx_ChooseACard_Ch6:
note __, 12
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_ChooseACard_Ch7:
togglesfx
@@ -1620,7 +1620,7 @@ Sfx_ChooseACard_Ch7:
note __, 12
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_ChooseACard_Ch8:
togglesfx
@@ -1645,7 +1645,7 @@ Sfx_ChooseACard_Ch8:
note B_, 16
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetTm:
musicheader 4, 5, Sfx_GetTm_Ch5
@@ -1677,7 +1677,7 @@ Sfx_GetTm_Ch5:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetTm_Ch6:
togglesfx
@@ -1700,7 +1700,7 @@ Sfx_GetTm_Ch6:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetTm_Ch7:
togglesfx
@@ -1731,7 +1731,7 @@ Sfx_GetTm_Ch7:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetTm_Ch8:
togglesfx
@@ -1751,7 +1751,7 @@ Sfx_GetTm_Ch8:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetBadge:
musicheader 4, 5, Sfx_GetBadge_Ch5
@@ -1778,7 +1778,7 @@ Sfx_GetBadge_Ch5:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetBadge_branch_f11aa:
note __, 5
@@ -1849,7 +1849,7 @@ Sfx_GetBadge_Ch6:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetBadge_Ch7:
togglesfx
@@ -1888,7 +1888,7 @@ Sfx_GetBadge_Ch7:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_GetBadge_Ch8:
togglesfx
@@ -1914,7 +1914,7 @@ Sfx_GetBadge_Ch8:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_QuitSlots:
musicheader 4, 5, Sfx_QuitSlots_Ch5
@@ -1952,7 +1952,7 @@ Sfx_QuitSlots_Ch5:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_QuitSlots_Ch6:
togglesfx
@@ -1979,7 +1979,7 @@ Sfx_QuitSlots_Ch6:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_QuitSlots_Ch7:
togglesfx
@@ -2010,7 +2010,7 @@ Sfx_QuitSlots_Ch7:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_QuitSlots_Ch8:
togglesfx
@@ -2030,7 +2030,7 @@ Sfx_QuitSlots_Ch8:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_Protect:
musicheader 2, 5, Sfx_Protect_Ch5
@@ -2873,7 +2873,7 @@ Sfx_DexFanfareLessThan20_Ch5:
note D_, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfareLessThan20_Ch6:
togglesfx
@@ -2892,7 +2892,7 @@ Sfx_DexFanfareLessThan20_Ch6:
note F#, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfareLessThan20_Ch7:
togglesfx
@@ -2920,7 +2920,7 @@ Sfx_DexFanfareLessThan20_Ch7:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfareLessThan20_Ch8:
togglesfx
@@ -2931,7 +2931,7 @@ Sfx_DexFanfareLessThan20_Ch8:
note __, 12
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare140169:
musicheader 4, 5, Sfx_DexFanfare140169_Ch5
@@ -2966,7 +2966,7 @@ Sfx_DexFanfare140169_Ch5:
note __, 8
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare140169_Ch6:
togglesfx
@@ -2992,7 +2992,7 @@ Sfx_DexFanfare140169_Ch6:
note __, 8
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare140169_Ch7:
togglesfx
@@ -3026,7 +3026,7 @@ Sfx_DexFanfare140169_Ch7:
note __, 4
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare140169_Ch8:
togglesfx
@@ -3043,7 +3043,7 @@ Sfx_DexFanfare140169_Ch8:
note D_, 8
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare170199:
musicheader 4, 5, Sfx_DexFanfare170199_Ch5
@@ -3078,7 +3078,7 @@ Sfx_DexFanfare170199_Ch5:
note __, 4
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare170199_Ch6:
togglesfx
@@ -3106,7 +3106,7 @@ Sfx_DexFanfare170199_Ch6:
note __, 4
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare170199_Ch7:
togglesfx
@@ -3134,7 +3134,7 @@ Sfx_DexFanfare170199_Ch7:
note __, 4
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare170199_Ch8:
togglesfx
@@ -3189,7 +3189,7 @@ Sfx_DexFanfare200229_Ch5:
note __, 4
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare200229_Ch6:
togglesfx
@@ -3212,7 +3212,7 @@ Sfx_DexFanfare200229_Ch6:
note __, 4
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare200229_Ch7:
togglesfx
@@ -3256,7 +3256,7 @@ Sfx_DexFanfare200229_Ch7:
note __, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare200229_Ch8:
togglesfx
@@ -3285,7 +3285,7 @@ Sfx_DexFanfare200229_Ch8:
note B_, 12
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare230Plus:
musicheader 4, 5, Sfx_DexFanfare230Plus_Ch5
@@ -3339,7 +3339,7 @@ Sfx_DexFanfare230Plus_Ch5:
note __, 2
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare230Plus_Ch6:
togglesfx
@@ -3374,7 +3374,7 @@ Sfx_DexFanfare230Plus_Ch6:
note __, 2
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare230Plus_Ch7:
togglesfx
@@ -3423,7 +3423,7 @@ Sfx_DexFanfare230Plus_Ch7:
note __, 2
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_DexFanfare230Plus_Ch8:
togglesfx
@@ -3459,7 +3459,7 @@ Sfx_DexFanfare230Plus_Ch8:
note D_, 6
endchannel
- togglesfx
+ togglesfx ; unused
Sfx_NotVeryEffective:
musicheader 1, 8, Sfx_NotVeryEffective_Ch8
diff --git a/constants/deco_constants.asm b/constants/deco_constants.asm
index 22cf1e67..0d9e6e43 100644
--- a/constants/deco_constants.asm
+++ b/constants/deco_constants.asm
@@ -11,7 +11,7 @@ const_value = 1
const MAGNAPLANT
const TROPICPLANT
const JUMBOPLANT
- const TOWN_MAP_D
+ const TOWN_MAP_POSTER
const FAMICOM
const SUPER_NES
const NINTENDO_64
diff --git a/constants/event_flags.asm b/constants/event_flags.asm
index 77f3773f..a73f1e9b 100644
--- a/constants/event_flags.asm
+++ b/constants/event_flags.asm
@@ -699,10 +699,10 @@
const EVENT_DECO_PLANT_1
const EVENT_DECO_PLANT_2
const EVENT_DECO_PLANT_3
- const EVENT_DECO_PLANT_4
- const EVENT_DECO_POSTER_1 ; 2b0
- const EVENT_DECO_POSTER_2
+ const EVENT_DECO_POSTER_1
+ const EVENT_DECO_POSTER_2 ; 2b0
const EVENT_DECO_POSTER_3
+ const EVENT_DECO_POSTER_4
const EVENT_DECO_FAMICOM
const EVENT_DECO_SNES
const EVENT_DECO_N64
diff --git a/constants/item_constants.asm b/constants/item_constants.asm
index 5bdbc959..a12977d5 100644
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -103,7 +103,7 @@
const MYSTIC_WATER ; 5f
const TWISTEDSPOON ; 60
const WHT_APRICORN ; 61
- const BLACKBELT ; 62
+ const BLACKBELT_I ; 62
const BLK_APRICORN ; 63
const ITEM_64 ; 64
const PNK_APRICORN ; 65
diff --git a/constants/move_constants.asm b/constants/move_constants.asm
index 7fbac6bc..2f39eefc 100644
--- a/constants/move_constants.asm
+++ b/constants/move_constants.asm
@@ -253,7 +253,7 @@
const WHIRLPOOL ; $fa
const BEAT_UP ; $fb
-const_value SET const_value + -1
+const_value SET const_value - 1
const NUM_ATTACKS ; $fb
diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm
index cbc12702..33494bcc 100644
--- a/constants/pokemon_constants.asm
+++ b/constants/pokemon_constants.asm
@@ -252,7 +252,7 @@ const_value set 1
const LUGIA
const HO_OH
const CELEBI
-NUM_POKEMON EQU const_value + -1
+NUM_POKEMON EQU const_value - 1
const MON_FC
const EGG
const MON_FE
@@ -292,7 +292,7 @@ NUM_POKEMON EQU const_value + -1
const UNOWN_X ; 24
const UNOWN_Y ; 25
const UNOWN_Z ; 26
-NUM_UNOWN EQU const_value + -1 ; 26
+NUM_UNOWN EQU const_value - 1 ; 26
; pokemon structure in RAM
MON_SPECIES EQUS "(wPartyMon1Species - wPartyMon1)"
diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm
index 838c8036..bff6e366 100644
--- a/constants/pokemon_data_constants.asm
+++ b/constants/pokemon_data_constants.asm
@@ -70,7 +70,7 @@ MONS_PER_BOX EQU 20
NUM_BOXES EQU 14
; hall of fame
-HOF_MON_LENGTH = 1 + 2 + 2 + 1 + (MON_NAME_LENGTH + -1) ; species, id, dvs, level, nick
+HOF_MON_LENGTH = 1 + 2 + 2 + 1 + (MON_NAME_LENGTH - 1) ; species, id, dvs, level, nick
HOF_LENGTH = 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; win count, party, terminator
NUM_HOF_TEAMS = 30
diff --git a/constants/script_constants.asm b/constants/script_constants.asm
index ec9e5dac..1d1e962a 100644
--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -218,7 +218,7 @@ EMOTE_FROM_MEM EQU -1
const FRUITTREE_PEWTER_CITY_1 ; 1c
const FRUITTREE_PEWTER_CITY_2 ; 1d
const FRUITTREE_FUCHSIA_CITY ; 1e
-NUM_FRUIT_TREES EQU const_value + -1
+NUM_FRUIT_TREES EQU const_value - 1
; describedecoration arguments
; DescribeDecoration.JumpTable indexes (see engine/overworld/decorations.asm)
diff --git a/data/items/attributes.asm b/data/items/attributes.asm
index 90316996..d8977b47 100644
--- a/data/items/attributes.asm
+++ b/data/items/attributes.asm
@@ -301,7 +301,7 @@ Item2Attributes:
; WHT APRICORN
item_attribute 200, 0, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
-; BLACKBELT
+; BLACKBELT_I
item_attribute 100, HELD_FIGHTING_BOOST, 10, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; BLK APRICORN
diff --git a/data/maps/attributes.asm b/data/maps/attributes.asm
index 2f9c0d05..d16b1c61 100644
--- a/data/maps/attributes.asm
+++ b/data/maps/attributes.asm
@@ -38,7 +38,7 @@ _tgt = 0
endc
if "\1" == "north"
-_blk = \3_WIDTH * (\3_HEIGHT + -3) + _src
+_blk = \3_WIDTH * (\3_HEIGHT - 3) + _src
_map = _tgt
_win = (\3_WIDTH + 6) * \3_HEIGHT + 1
_y = \3_HEIGHT * 2 - 1
@@ -60,9 +60,9 @@ _len = \3_WIDTH
endc
elif "\1" == "west"
-_blk = (\3_WIDTH * _src) + \3_WIDTH + -3
+_blk = (\3_WIDTH * _src) + \3_WIDTH - 3
_map = (CURRENT_MAP_WIDTH + 6) * _tgt
-_win = (\3_WIDTH + 6) * 2 + -6
+_win = (\3_WIDTH + 6) * 2 - 6
_y = (\4) * -2
_x = \3_WIDTH * 2 - 1
_len = CURRENT_MAP_HEIGHT + 3 - (\4)
diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm
index 41d4841c..9a16b224 100644
--- a/engine/battle/ai/scoring.asm
+++ b/engine/battle/ai/scoring.asm
@@ -1537,7 +1537,7 @@ AI_Smart_Spite:
dec [hl]
ret
-Function_0x38d16:
+Function_0x38cf7:
jp AIDiscourageMove
AI_Smart_DestinyBond:
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index af102990..3814348d 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -5964,7 +5964,7 @@ LoadEnemyMon:
; Fill stats
ld de, wEnemyMonMaxHP
ld b, FALSE
- ld hl, wEnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; wLinkBattleRNs + 7 ; ?
+ ld hl, wEnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1)
predef CalcMonStats
; If we're in a trainer battle,
@@ -8036,7 +8036,7 @@ ShowLinkBattleParticipantsAfterEnd:
ld a, BANK(sLinkBattleStats)
call OpenSRAM
- call AddLastBattleToLinkRecord
+ call AddLastLinkBattleToLinkRecord
call ReadAndPrintLinkBattleRecord
call CloseSRAM
@@ -8052,6 +8052,9 @@ ShowLinkBattleParticipantsAfterEnd:
.Draw:
db " DRAW@"
+LINK_BATTLE_RECORD_LENGTH EQUS "(sLinkBattleRecord1End - sLinkBattleRecord1)" ; 18
+NUM_LINK_BATTLE_RECORDS EQUS "((sLinkBattleStatsEnd - sLinkBattleRecord) / LINK_BATTLE_RECORD_LENGTH)" ; 5
+
_DisplayLinkRecord:
ld a, BANK(sLinkBattleStats)
call OpenSRAM
@@ -8077,7 +8080,7 @@ ReadAndPrintLinkBattleRecord:
call ClearSprites
call .PrintBattleRecord
hlcoord 0, 8
- ld b, 5
+ ld b, NUM_LINK_BATTLE_RECORDS
ld de, sLinkBattleRecord + 2
.loop
push bc
@@ -8094,7 +8097,7 @@ ReadAndPrintLinkBattleRecord:
ld h, d
ld l, e
ld de, wceed
- ld bc, 10
+ ld bc, NAME_LENGTH - 1
call CopyBytes
ld a, "@"
ld [de], a
@@ -8131,7 +8134,7 @@ ReadAndPrintLinkBattleRecord:
call PlaceString
.next
pop hl
- ld bc, 18
+ ld bc, LINK_BATTLE_RECORD_LENGTH
add hl, bc
ld d, h
ld e, l
@@ -8300,7 +8303,7 @@ GetRoamMonSpecies:
ld hl, wRoamMon3Species
ret
-AddLastBattleToLinkRecord:
+AddLastLinkBattleToLinkRecord:
ld hl, wOTPlayerID
ld de, wStringBuffer1
ld bc, 2
@@ -8308,10 +8311,10 @@ AddLastBattleToLinkRecord:
ld hl, wOTPlayerName
ld bc, NAME_LENGTH - 1
call CopyBytes
- ld hl, sLinkBattleStats - 12
+ ld hl, sLinkBattleStats - (LINK_BATTLE_RECORD_LENGTH - 6)
call .StoreResult
ld hl, sLinkBattleRecord
- ld d, 5
+ ld d, NUM_LINK_BATTLE_RECORDS
.loop
push hl
inc hl
@@ -8322,17 +8325,17 @@ AddLastBattleToLinkRecord:
and a
jr z, .copy
push de
- ld bc, 12
+ ld bc, LINK_BATTLE_RECORD_LENGTH - 6
ld de, wStringBuffer1
call CompareBytesLong
pop de
pop hl
jr c, .done
- ld bc, 18
+ ld bc, LINK_BATTLE_RECORD_LENGTH
add hl, bc
dec d
jr nz, .loop
- ld bc, -18
+ ld bc, -LINK_BATTLE_RECORD_LENGTH
add hl, bc
push hl
@@ -8340,7 +8343,7 @@ AddLastBattleToLinkRecord:
ld d, h
ld e, l
ld hl, wStringBuffer1
- ld bc, 12
+ ld bc, LINK_BATTLE_RECORD_LENGTH - 6
call CopyBytes
ld b, 6
xor a
@@ -8359,12 +8362,12 @@ AddLastBattleToLinkRecord:
ld a, [wBattleResult]
and $f
cp LOSE
- ld bc, sLinkBattleWins + 1 - (sLinkBattleStats - 12)
+ ld bc, (sLinkBattleRecord1Wins - sLinkBattleRecord1) + 1
jr c, .okay ; WIN
- ld bc, sLinkBattleLosses + 1 - (sLinkBattleStats - 12)
+ ld bc, (sLinkBattleRecord1Losses - sLinkBattleRecord1) + 1
jr z, .okay ; LOSE
; DRAW
- ld bc, sLinkBattleDraws + 1 - (sLinkBattleStats - 12)
+ ld bc, (sLinkBattleRecord1Draws - sLinkBattleRecord1) + 1
.okay
add hl, bc
call .CheckOverflow
@@ -8386,8 +8389,8 @@ AddLastBattleToLinkRecord:
ret
.FindOpponentAndAppendRecord:
- ld b, 5
- ld hl, sLinkBattleRecord + 17
+ ld b, NUM_LINK_BATTLE_RECORDS
+ ld hl, sLinkBattleRecord1End - 1
ld de, wceed
.loop3
push bc
@@ -8405,7 +8408,7 @@ AddLastBattleToLinkRecord:
ld a, c
ld [de], a
inc de
- ld bc, 18
+ ld bc, LINK_BATTLE_RECORD_LENGTH
add hl, bc
pop bc
dec b
@@ -8454,26 +8457,26 @@ AddLastBattleToLinkRecord:
.done2
push bc
ld a, b
- ld bc, 18
+ ld bc, LINK_BATTLE_RECORD_LENGTH
ld hl, sLinkBattleRecord
call AddNTimes
push hl
ld de, wceed
- ld bc, 18
+ ld bc, LINK_BATTLE_RECORD_LENGTH
call CopyBytes
pop hl
pop bc
push hl
ld a, c
- ld bc, 18
+ ld bc, LINK_BATTLE_RECORD_LENGTH
ld hl, sLinkBattleRecord
call AddNTimes
pop de
push hl
- ld bc, 18
+ ld bc, LINK_BATTLE_RECORD_LENGTH
call CopyBytes
ld hl, wceed
- ld bc, 18
+ ld bc, LINK_BATTLE_RECORD_LENGTH
pop de
call CopyBytes
ret
diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm
index fd8015a9..4f55fd78 100644
--- a/engine/events/bug_contest/judging.asm
+++ b/engine/events/bug_contest/judging.asm
@@ -125,7 +125,7 @@ INCLUDE "data/events/bug_contest_winners.asm"
BugContest_GetPlayersResult:
ld hl, wBugContestThirdPlaceWinnerID
- ld de, - BUG_CONTESTANT_SIZE
+ ld de, -BUG_CONTESTANT_SIZE
ld b, 3 ; 3rd, 2nd, or 1st
.loop
ld a, [hl]
@@ -210,7 +210,7 @@ DetermineContestWinners:
CopyTempContestant:
; Could've just called CopyBytes.
ld de, wBugContestTempWinnerID
-rept BUG_CONTESTANT_SIZE + -1
+rept BUG_CONTESTANT_SIZE - 1
ld a, [de]
inc de
ld [hli], a
diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm
index 9770c35b..7d2262af 100755
--- a/engine/events/heal_machine_anim.asm
+++ b/engine/events/heal_machine_anim.asm
@@ -134,25 +134,25 @@ ENDM
ret
.PC_ElmsLab_OAM:
- dsprite 4, 0, 4, 2, $7c, PAL_OW_TREE | OBP_NUM
- dsprite 4, 0, 4, 6, $7c, PAL_OW_TREE | OBP_NUM
- dsprite 4, 6, 4, 0, $7d, PAL_OW_TREE | OBP_NUM
- dsprite 4, 6, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
- dsprite 5, 3, 4, 0, $7d, PAL_OW_TREE | OBP_NUM
- dsprite 5, 3, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
- dsprite 6, 0, 4, 0, $7d, PAL_OW_TREE | OBP_NUM
- dsprite 6, 0, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
+ dbsprite 4, 4, 2, 0, $7c, PAL_OW_TREE | OBP_NUM
+ dbsprite 4, 4, 6, 0, $7c, PAL_OW_TREE | OBP_NUM
+ dbsprite 4, 4, 0, 6, $7d, PAL_OW_TREE | OBP_NUM
+ dbsprite 5, 4, 0, 6, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
+ dbsprite 4, 5, 0, 3, $7d, PAL_OW_TREE | OBP_NUM
+ dbsprite 5, 5, 0, 3, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
+ dbsprite 4, 6, 0, 0, $7d, PAL_OW_TREE | OBP_NUM
+ dbsprite 5, 6, 0, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
.HealMachineGFX:
INCBIN "gfx/overworld/heal_machine.2bpp"
.HOF_OAM:
- dsprite 7, 4, 10, 1, $7d, PAL_OW_TREE | OBP_NUM
- dsprite 7, 4, 10, 6, $7d, PAL_OW_TREE | OBP_NUM
- dsprite 7, 3, 9, 5, $7d, PAL_OW_TREE | OBP_NUM
- dsprite 7, 3, 11, 2, $7d, PAL_OW_TREE | OBP_NUM
- dsprite 7, 1, 9, 1, $7d, PAL_OW_TREE | OBP_NUM
- dsprite 7, 1, 11, 5, $7d, PAL_OW_TREE | OBP_NUM
+ dbsprite 10, 7, 1, 4, $7d, PAL_OW_TREE | OBP_NUM
+ dbsprite 10, 7, 6, 4, $7d, PAL_OW_TREE | OBP_NUM
+ dbsprite 9, 7, 5, 3, $7d, PAL_OW_TREE | OBP_NUM
+ dbsprite 11, 7, 2, 3, $7d, PAL_OW_TREE | OBP_NUM
+ dbsprite 9, 7, 1, 1, $7d, PAL_OW_TREE | OBP_NUM
+ dbsprite 11, 7, 5, 1, $7d, PAL_OW_TREE | OBP_NUM
.LoadPalettes:
call IsCGB
@@ -171,15 +171,7 @@ INCBIN "gfx/overworld/heal_machine.2bpp"
ret
.palettes
- rst $38
- ld a, a
- ld a, a
- ld a, [hl+]
- rst $38
- inc b
- nop
- nop
-;INCLUDE "gfx/overworld/heal_machine.pal"
+INCLUDE "gfx/overworld/heal_machine.pal"
.FlashPalettes8Times:
ld c, 8
diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm
index 893e8e6d..0d67ae72 100644
--- a/engine/events/print_unown.asm
+++ b/engine/events/print_unown.asm
@@ -112,7 +112,7 @@ _UnownPrinter:
ld a, [hl]
and a
jr nz, .wrap_around_left
- ld [hl], 26 + 1
+ ld [hl], NUM_UNOWN + 1
.wrap_around_left
dec [hl]
jr .return
@@ -120,7 +120,7 @@ _UnownPrinter:
.press_right
ld hl, wJumptableIndex
ld a, [hl]
- cp 26
+ cp NUM_UNOWN
jr c, .wrap_around_right
ld [hl], -1
.wrap_around_right
@@ -132,7 +132,7 @@ _UnownPrinter:
.UpdateUnownFrontpic:
ld a, [wJumptableIndex]
- cp 26
+ cp NUM_UNOWN
jr z, .vacant
inc a
ld [wUnownLetter], a
@@ -158,9 +158,9 @@ _UnownPrinter:
hlcoord 1, 9
ld de, UnownDexVacantString
call PlaceString
- xor a ; sDecompressScratch
+ xor a ; sScratch
call OpenSRAM
- ld hl, sDecompressScratch
+ ld hl, sScratch
ld bc, $31 tiles
xor a
call ByteFill
diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm
index dd39d6de..92524d92 100755
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -1303,15 +1303,15 @@ Palettes_a265: INCLUDE "gfx/pals/silver_a265.pal"
ENDC
IF DEF(_GOLD)
-SGBBorderMap: INCBIN "gfx/sgb_border/gold.map"
-SGBBorderPalettes: INCLUDE "gfx/sgb_border/gold.pal"
-SGBBorder: INCBIN "gfx/sgb_border/gold.2bpp"
+SGBBorderMap: INCBIN "gfx/sgb/gold_border.sgb.tilemap"
+SGBBorderPalettes: INCLUDE "gfx/sgb/gold_border.pal"
+SGBBorder: INCBIN "gfx/sgb/gold_border.2bpp"
ENDC
IF DEF(_SILVER)
-SGBBorderMap: INCBIN "gfx/sgb_border/silver.map"
-SGBBorderPalettes: INCLUDE "gfx/sgb_border/silver.pal"
-SGBBorder: INCBIN "gfx/sgb_border/silver.2bpp"
+SGBBorderMap: INCBIN "gfx/sgb/silver_border.sgb.tilemap"
+SGBBorderPalettes: INCLUDE "gfx/sgb/silver_border.pal"
+SGBBorder: INCBIN "gfx/sgb/silver_border.2bpp"
ENDC
Palettes_ad2d:
diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm
index 74eb21f4..b4092ec7 100644
--- a/engine/menus/intro_menu.asm
+++ b/engine/menus/intro_menu.asm
@@ -1436,7 +1436,7 @@ Function6434:
.asm_646b
ld hl, wce63
inc [hl]
- xor a
+ xor a ; MUSIC_NONE
ld [wMusicFadeID], a
ld [wMusicFadeID + 1], a
ld hl, wMusicFade
diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm
index ba50fb25..794fa074 100644
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -371,7 +371,7 @@ SetUpFiveStepWildEncounterCooldown:
ld [wWildEncounterCooldown], a
ret
-ret_968d7:
+ret_96804:
ret
SetMinTwoStepWildEncounterCooldown:
@@ -763,7 +763,7 @@ PlayerMovement:
ret
.jump:
- call ret_968d7 ; mobile
+ call ret_96804
xor a
ld c, a
ret
@@ -963,7 +963,7 @@ DoPlayerEvent:
PlayerEventScriptPointers:
; entries correspond to PLAYEREVENT_* constants
- dba Invalid_0x96c2d ; PLAYEREVENT_NONE
+ dba Invalid_0x96b60 ; PLAYEREVENT_NONE
dba SeenByTrainerScript ; PLAYEREVENT_SEENBYTRAINER
dba TalkToTrainerScript ; PLAYEREVENT_TALKTOTRAINER
dba FindItemInBallScript ; PLAYEREVENT_ITEMBALL
@@ -973,9 +973,9 @@ PlayerEventScriptPointers:
dba Script_OverworldWhiteout ; PLAYEREVENT_WHITEOUT
dba HatchEggScript ; PLAYEREVENT_HATCH
dba ChangeDirectionScript ; PLAYEREVENT_JOYCHANGEFACING
- dba Invalid_0x96c2d ; (NUM_PLAYER_EVENTS)
+ dba Invalid_0x96b60 ; (NUM_PLAYER_EVENTS)
-Invalid_0x96c2d:
+Invalid_0x96b60:
end
; unused
diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm
index 7c5bfe55..7659c42d 100644
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -479,11 +479,11 @@ Script_verbosegiveitem:
ld de, GiveItemScript
jp ScriptCall
-ret_96f76:
+ret_96e71:
ret
GiveItemScript:
- callasm ret_96f76
+ callasm ret_96e71
writetext ReceivedItemText
iffalse .Full
waitsfx
diff --git a/gfx/overworld/heal_machine.pal b/gfx/overworld/heal_machine.pal
index 9a32250d..28a76de4 100755
--- a/gfx/overworld/heal_machine.pal
+++ b/gfx/overworld/heal_machine.pal
@@ -1,4 +1,4 @@
RGB 31, 31, 31
- RGB 21, 21, 21
- RGB 10, 10, 10
+ RGB 31, 19, 10
+ RGB 31, 07, 01
RGB 00, 00, 00
diff --git a/gfx/pics_gold.asm b/gfx/pics_gold.asm
index 2fe86495..e3d5f583 100644
--- a/gfx/pics_gold.asm
+++ b/gfx/pics_gold.asm
@@ -2,7 +2,7 @@ INCLUDE "constants.asm"
; PokemonPicPointers and UnownPicPointers are assumed to start at the same
-; address, but in different banks. This is enforced in pokegold.link.
+; address, but in different banks. This is enforced in layout.link.
SECTION "Pic Pointers", ROMX
diff --git a/gfx/sgb_border/gold.2bpp b/gfx/sgb/gold_border.2bpp
index aad569e8..aad569e8 100644
--- a/gfx/sgb_border/gold.2bpp
+++ b/gfx/sgb/gold_border.2bpp
Binary files differ
diff --git a/gfx/sgb_border/gold.pal b/gfx/sgb/gold_border.pal
index 047c676e..047c676e 100755
--- a/gfx/sgb_border/gold.pal
+++ b/gfx/sgb/gold_border.pal
diff --git a/gfx/sgb_border/gold.png b/gfx/sgb/gold_border.png
index ab03c950..ab03c950 100644
--- a/gfx/sgb_border/gold.png
+++ b/gfx/sgb/gold_border.png
Binary files differ
diff --git a/gfx/sgb_border/gold.map b/gfx/sgb/gold_border.sgb.tilemap
index 3a3edb57..3a3edb57 100644
--- a/gfx/sgb_border/gold.map
+++ b/gfx/sgb/gold_border.sgb.tilemap
diff --git a/gfx/sgb_border/silver.2bpp b/gfx/sgb/silver_border.2bpp
index aad569e8..aad569e8 100644
--- a/gfx/sgb_border/silver.2bpp
+++ b/gfx/sgb/silver_border.2bpp
Binary files differ
diff --git a/gfx/sgb_border/silver.pal b/gfx/sgb/silver_border.pal
index cafa90ad..cafa90ad 100755
--- a/gfx/sgb_border/silver.pal
+++ b/gfx/sgb/silver_border.pal
diff --git a/gfx/sgb_border/silver.png b/gfx/sgb/silver_border.png
index a9d63b6e..a9d63b6e 100644
--- a/gfx/sgb_border/silver.png
+++ b/gfx/sgb/silver_border.png
Binary files differ
diff --git a/gfx/sgb_border/silver.map b/gfx/sgb/silver_border.sgb.tilemap
index 30f04252..30f04252 100644
--- a/gfx/sgb_border/silver.map
+++ b/gfx/sgb/silver_border.sgb.tilemap
diff --git a/home/copy.asm b/home/copy.asm
index 838bb52d..5f4ea079 100644
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -17,31 +17,31 @@ CopyBytes::
GetFarByte::
; retrieve a single byte from a:hl, and return it in a.
; bankswitch to new bank
- ld [wBuffer], a
+ ld [wTempBank], a
ldh a, [hROMBank]
push af
- ld a, [wBuffer]
+ ld a, [wTempBank]
rst Bankswitch
; get byte from new bank
ld a, [hl]
- ld [wBuffer], a
+ ld [wFarByte], a
; bankswitch to previous bank
pop af
rst Bankswitch
; return retrieved value in a
- ld a, [wBuffer]
+ ld a, [wFarByte]
ret
GetFarHalfword::
; retrieve a halfword from a:hl, and return it in hl.
; bankswitch to new bank
- ld [wBuffer], a
+ ld [wTempBank], a
ldh a, [hROMBank]
push af
- ld a, [wBuffer]
+ ld a, [wTempBank]
rst Bankswitch
; get halfword from new bank, put it in hl
diff --git a/home/farcall.asm b/home/farcall.asm
index 1c8b6f3f..0c8e9e39 100644
--- a/home/farcall.asm
+++ b/home/farcall.asm
@@ -2,10 +2,10 @@ FarCall_hl::
; Call a:hl.
; Preserves other registers.
- ld [wBuffer], a
+ ld [wTempBank], a
ldh a, [hROMBank]
push af
- ld a, [wBuffer]
+ ld a, [wTempBank]
rst Bankswitch
call FarCall_JumpToHL
diff --git a/home/gfx.asm b/home/gfx.asm
index 897a43ef..a1a2dee2 100644
--- a/home/gfx.asm
+++ b/home/gfx.asm
@@ -61,10 +61,10 @@ DecompressRequest2bpp::
FarCopyBytes::
; copy bc bytes from a:hl to de
- ld [wBuffer], a
+ ld [wTempBank], a
ldh a, [hROMBank]
push af
- ld a, [wBuffer]
+ ld a, [wTempBank]
rst Bankswitch
call CopyBytes
@@ -77,10 +77,10 @@ FarCopyBytesDouble::
; Copy bc bytes from a:hl to bc*2 bytes at de,
; doubling each byte in the process.
- ld [wBuffer], a
+ ld [wTempBank], a
ldh a, [hROMBank]
push af
- ld a, [wBuffer]
+ ld a, [wTempBank]
rst Bankswitch
; switcheroo, de <> hl
diff --git a/home/map.asm b/home/map.asm
index 94f30850..5f34070e 100644
--- a/home/map.asm
+++ b/home/map.asm
@@ -1452,10 +1452,10 @@ MapTextbox::
Call_a_de::
; Call a:de.
- ld [wBuffer], a
+ ld [wTempBank], a
ldh a, [hROMBank]
push af
- ld a, [wBuffer]
+ ld a, [wTempBank]
rst Bankswitch
call .de
diff --git a/home/menu.asm b/home/menu.asm
index 0b0944a7..1c473072 100644
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -762,10 +762,10 @@ MenuTextboxWaitButton::
ret
Place2DMenuItemName::
- ld [wBuffer], a
+ ld [wTempBank], a
ldh a, [hROMBank]
push af
- ld a, [wBuffer]
+ ld a, [wTempBank]
rst Bankswitch
call PlaceString
diff --git a/home/print_text.asm b/home/print_text.asm
index bd26f66c..04bc8ece 100755
--- a/home/print_text.asm
+++ b/home/print_text.asm
@@ -136,10 +136,10 @@ Function33e9::
.digits db "0123456789ABCDEF"
FarPrintText::
- ld [wBuffer], a
+ ld [wTempBank], a
ldh a, [hROMBank]
push af
- ld a, [wBuffer]
+ ld a, [wTempBank]
rst Bankswitch
call PrintText
diff --git a/hram.asm b/hram.asm
index cedfdc58..274349eb 100755
--- a/hram.asm
+++ b/hram.asm
@@ -109,6 +109,7 @@ hMoneyTemp:: ds 3 ; ffc5
NEXTU ; ffc5
hMGJoypadPressed:: db ; ffc5
hMGJoypadReleased:: db ; ffc6
+hMGPrevTIMA:: db ; ffc7
ENDU ; ffc8
hLCDCPointer:: db ; ffc8
diff --git a/macros.asm b/macros.asm
index 88f7115a..a0e6e6cf 100644
--- a/macros.asm
+++ b/macros.asm
@@ -22,10 +22,10 @@ INCLUDE "macros/legacy.asm"
dr: macro
IF DEF(_GOLD)
-INCBIN "baserom-gold.gbc", \1, \2 +- \1
+INCBIN "baserom-gold.gbc", \1, \2 - \1
ELSE
IF DEF(_SILVER)
-INCBIN "baserom-silver.gbc", \1, \2 +- \1
+INCBIN "baserom-silver.gbc", \1, \2 - \1
ENDC
ENDC
ENDM
diff --git a/macros/code.asm b/macros/code.asm
index 9429884c..c92e7132 100644
--- a/macros/code.asm
+++ b/macros/code.asm
@@ -8,17 +8,6 @@ ln: MACRO ; r, hi, lo
ld \1, ((\2) & $f) << 4 | ((\3) & $f)
ENDM
-ldpixel: MACRO
-if _NARG >= 5
- lb \1, \2 * 8 + \4, \3 * 8 + \5
-else
- lb \1, \2 * 8, \3 * 8
-endc
-ENDM
-
-depixel EQUS "ldpixel de,"
-bcpixel EQUS "ldpixel bc,"
-
; Design patterns
jumptable: MACRO
@@ -62,7 +51,7 @@ calc_sine_wave: MACRO
; input: a = a signed 6-bit value
; output: a = d * sin(a * pi/32)
and %111111
- cp %100000
+ cp %100000
jr nc, .negative\@
call .apply\@
ld a, h
diff --git a/macros/coords.asm b/macros/coords.asm
index 3ea6e415..5a87e1d3 100755
--- a/macros/coords.asm
+++ b/macros/coords.asm
@@ -49,3 +49,9 @@ lda_coord: MACRO
ld a, [(\2) * SCREEN_WIDTH + (\1) + \3]
endc
ENDM
+
+menu_coords: MACRO
+; x1, y1, x2, y2
+ db \2, \1 ; start coords
+ db \4, \3 ; end coords
+ENDM
diff --git a/macros/data.asm b/macros/data.asm
index b9b4b0a9..932525eb 100755
--- a/macros/data.asm
+++ b/macros/data.asm
@@ -47,7 +47,7 @@ dx: MACRO
x = 8 * ((\1) - 1)
rept \1
db ((\2) >> x) & $ff
-x = x + -8
+x = x - 8
endr
ENDM
@@ -93,27 +93,6 @@ dba_pic: MACRO ; dbw bank, address
dw \1
ENDM
-dbpixel: MACRO
-if _NARG >= 4
-; x tile, x pxl, y tile, y pxl
- db \1 * 8 + \3, \2 * 8 + \4
-else
-; x, y
- db \1 * 8, \2 * 8
-endc
-ENDM
-
-dsprite: MACRO
-; y tile, y pxl, x tile, x pxl, vtile offset, attributes
- db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5, \6
-ENDM
-
-menu_coords: MACRO
-; x1, y1, x2, y2
- db \2, \1 ; start coords
- db \4, \3 ; end coords
-ENDM
-
bcd: MACRO
rept _NARG
dn ((\1) % 100) / 10, (\1) % 10
diff --git a/macros/gfx.asm b/macros/gfx.asm
index 24c79e1f..2c67cfc8 100755
--- a/macros/gfx.asm
+++ b/macros/gfx.asm
@@ -20,3 +20,31 @@ tile EQUS "+ LEN_2BPP_TILE *"
; example usage:
; INCBIN "foo.gbcpal", middle_colors
middle_colors EQUS "PAL_COLOR_SIZE, PAL_COLOR_SIZE * 2"
+
+dbpixel: MACRO
+if _NARG >= 4
+; x tile, y tile, x pixel, y pixel
+ db \1 * TILE_WIDTH + \3, \2 * TILE_WIDTH + \4
+else
+; x tile, y tile
+ db \1 * TILE_WIDTH, \2 * TILE_WIDTH
+endc
+ENDM
+
+ldpixel: MACRO
+if _NARG >= 5
+; register, x tile, y tile, x pixel, y pixel
+ lb \1, \2 * TILE_WIDTH + \4, \3 * TILE_WIDTH + \5
+else
+; register, x tile, y tile
+ lb \1, \2 * TILE_WIDTH, \3 * TILE_WIDTH
+endc
+ENDM
+
+depixel EQUS "ldpixel de,"
+bcpixel EQUS "ldpixel bc,"
+
+dbsprite: MACRO
+; x tile, y tile, x pixel, y pixel, vtile offset, attributes
+ db (\2 * TILE_WIDTH) % $100 + \4, (\1 * TILE_WIDTH) % $100 + \3, \5, \6
+ENDM
diff --git a/macros/legacy.asm b/macros/legacy.asm
index eae91e88..59ce0d2f 100644
--- a/macros/legacy.asm
+++ b/macros/legacy.asm
@@ -6,6 +6,11 @@
callba EQUS "farcall"
callab EQUS "callfar"
+; macros/gfx.asm
+dsprite: MACRO
+ dbsprite \2, \4, \1, \3, \5, \6
+ENDM
+
; macros/scripts/audio.asm
__ EQU 0
CC EQU 13
diff --git a/macros/scripts/audio.asm b/macros/scripts/audio.asm
index 92654ff9..6f87bc3e 100644
--- a/macros/scripts/audio.asm
+++ b/macros/scripts/audio.asm
@@ -41,7 +41,7 @@ noise_note: MACRO
ENDM
; MusicCommands indexes (see audio/engine.asm)
- enum_start $d0, +8
+ enum_start $d0, 8
FIRST_MUSIC_CMD EQU __enum__
enum octave_cmd ; $d0
@@ -49,7 +49,7 @@ octave: MACRO
db octave_cmd | 8 - (\1) ; octave
ENDM
-__enumdir__ = +1
+__enumdir__ = 1
enum note_type_cmd ; $d8
note_type: MACRO
diff --git a/macros/scripts/movement.asm b/macros/scripts/movement.asm
index 2896700e..f6ea46a6 100644
--- a/macros/scripts/movement.asm
+++ b/macros/scripts/movement.asm
@@ -1,5 +1,5 @@
; MovementPointers indexes (see engine/overworld/movement.asm)
- enum_start 0, +4
+ enum_start 0, 4
; Directional movements
@@ -73,7 +73,7 @@ fast_jump_step: MACRO
db movement_fast_jump_step | \1
ENDM
-__enumdir__ = +1
+__enumdir__ = 1
; Control
enum movement_remove_sliding ; $38
diff --git a/macros/wram.asm b/macros/wram.asm
index 4294abb5..1e7ab534 100755
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -106,7 +106,7 @@ curbox: MACRO
\1Species:: ds MONS_PER_BOX + 1
\1Mons::
\1Mon1:: box_struct \1Mon1
-\1Mon2:: ds BOXMON_STRUCT_LENGTH * (MONS_PER_BOX + -1)
+\1Mon2:: ds BOXMON_STRUCT_LENGTH * (MONS_PER_BOX - 1)
\1MonOT:: ds NAME_LENGTH * MONS_PER_BOX
\1MonNicknames:: ds MON_NAME_LENGTH * MONS_PER_BOX
\1MonNicknamesEnd::
@@ -206,7 +206,7 @@ hof_mon: MACRO
\1ID:: dw
\1DVs:: dw
\1Level:: db
-\1Nickname:: ds MON_NAME_LENGTH + -1
+\1Nickname:: ds MON_NAME_LENGTH - 1
\1End::
ENDM
@@ -227,6 +227,7 @@ link_battle_record: MACRO
\1Wins:: dw
\1Losses:: dw
\1Draws:: dw
+\1End::
ENDM
trademon: MACRO
diff --git a/maps/LakeOfRage.asm b/maps/LakeOfRage.asm
index b493f90e..35c811a1 100644
--- a/maps/LakeOfRage.asm
+++ b/maps/LakeOfRage.asm
@@ -202,7 +202,7 @@ WesleyScript:
.MetWesley:
writetext WesleyGivesGiftText
promptbutton
- verbosegiveitem BLACKBELT
+ verbosegiveitem BLACKBELT_I
iffalse WesleyDoneScript
setevent EVENT_GOT_BLACKBELT_FROM_WESLEY
writetext WesleyGaveGiftText
diff --git a/maps/PlayersHouse2F.asm b/maps/PlayersHouse2F.asm
index 711b9594..65b4dbe1 100644
--- a/maps/PlayersHouse2F.asm
+++ b/maps/PlayersHouse2F.asm
@@ -9,7 +9,7 @@ PlayersHouse2F_MapScripts:
db 2 ; callbacks
callback MAPCALLBACK_NEWMAP, .InitializeRoom
- callback MAPCALLBACK_TILES, .SetSpawn
+ callback MAPCALLBACK_TILES, .SetUpTileDecorations
; unused
.Null:
@@ -26,7 +26,7 @@ PlayersHouse2F_MapScripts:
.SkipInitialization:
return
-.SetSpawn:
+.SetUpTileDecorations:
special ToggleMaptileDecorations
return
diff --git a/rgbdscheck.asm b/rgbdscheck.asm
new file mode 100644
index 00000000..4d84ab46
--- /dev/null
+++ b/rgbdscheck.asm
@@ -0,0 +1,12 @@
+; pokegold requires rgbds 0.4.0 or newer.
+MAJOR EQU 0
+MINOR EQU 4
+PATCH EQU 0
+
+if !DEF(__RGBDS_MAJOR__) || !DEF(__RGBDS_MINOR__) || !DEF(__RGBDS_PATCH__)
+ fail "pokegold requires rgbds {MAJOR}.{MINOR}.{PATCH} or newer."
+elif (__RGBDS_MAJOR__ < MAJOR) || \
+ (__RGBDS_MAJOR__ == MAJOR && __RGBDS_MINOR__ < MINOR) || \
+ (__RGBDS_MAJOR__ == MAJOR && __RGBDS_MINOR__ == MINOR && __RGBDS_PATCH__ < PATCH)
+ fail "pokegold requires rgbds {MAJOR}.{MINOR}.{PATCH} or newer."
+endc
diff --git a/tools/gfx.c b/tools/gfx.c
index 8c4066ab..d7be9a81 100644
--- a/tools/gfx.c
+++ b/tools/gfx.c
@@ -8,7 +8,7 @@
#include "common.h"
static void usage(void) {
- fprintf(stderr, "Usage: gfx [--trim-whitespace] [--remove-whitespace] [--interleave] [--remove-duplicates [--keep-whitespace]] [--remove-xflip] [--remove-yflip] [--png filename] [-d depth] [-h] [-o outfile] infile\n");
+ fprintf(stderr, "Usage: gfx [--trim-whitespace] [--remove-whitespace] [--interleave] [--remove-duplicates [--keep-whitespace]] [--remove-xflip] [--remove-yflip] [--preserve indexes] [--png filename] [-d depth] [-h] [-o outfile] infile\n");
}
static void error(char *message) {
@@ -27,6 +27,8 @@ struct Options {
int keep_whitespace;
int remove_xflip;
int remove_yflip;
+ int *preserved;
+ int num_preserved;
char *png_file;
};
@@ -43,11 +45,13 @@ void get_args(int argc, char *argv[]) {
{"keep-whitespace", no_argument, &Options.keep_whitespace, 1},
{"remove-xflip", no_argument, &Options.remove_xflip, 1},
{"remove-yflip", no_argument, &Options.remove_yflip, 1},
+ {"preserve", required_argument, 0, 'r'},
{"png", required_argument, 0, 'p'},
{"depth", required_argument, 0, 'd'},
{"help", no_argument, 0, 'h'},
{0}
};
+ char *token;
for (int opt = 0; opt != -1;) {
switch (opt = getopt_long(argc, argv, "ho:d:p:", long_options)) {
case 'h':
@@ -59,6 +63,15 @@ void get_args(int argc, char *argv[]) {
case 'd':
Options.depth = strtoul(optarg, NULL, 0);
break;
+ case 'r':
+ token = strtok(optarg, ",");
+ while (token) {
+ Options.num_preserved++;
+ Options.preserved = realloc(Options.preserved, Options.num_preserved * sizeof(int));
+ Options.preserved[Options.num_preserved-1] = strtoul(optarg, NULL, 0);
+ token = strtok(NULL, ",");
+ }
+ break;
case 'p':
Options.png_file = optarg;
break;
@@ -73,6 +86,23 @@ void get_args(int argc, char *argv[]) {
}
}
+bool is_preserved(int index) {
+ for (int i = 0; i < Options.num_preserved; i++) {
+ if (Options.preserved[i] == index) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void shift_preserved(int removed_index) {
+ for (int i = 0; i < Options.num_preserved; i++) {
+ if (Options.preserved[i] >= removed_index) {
+ Options.preserved[i]--;
+ }
+ }
+}
+
struct Graphic {
int size;
uint8_t *data;
@@ -91,7 +121,7 @@ bool is_whitespace(uint8_t *tile, int tile_size) {
void trim_whitespace(struct Graphic *graphic) {
int tile_size = Options.depth * 8;
for (int i = graphic->size - tile_size; i > 0; i -= tile_size) {
- if (is_whitespace(&graphic->data[i], tile_size)) {
+ if (is_whitespace(&graphic->data[i], tile_size) && !is_preserved(i / tile_size)) {
graphic->size = i;
} else {
break;
@@ -102,9 +132,15 @@ void trim_whitespace(struct Graphic *graphic) {
void remove_whitespace(struct Graphic *graphic) {
int tile_size = Options.depth * 8;
if (Options.interleave) tile_size *= 2;
+
+ // Make sure we have a whole number of tiles, round down if required
+ graphic->size &= ~(tile_size - 1);
+
int i = 0;
- for (int j = 0; i < graphic->size && j < graphic->size; i += tile_size, j += tile_size) {
- while (is_whitespace(&graphic->data[j], tile_size)) {
+ for (int j = 0, d = 0; i < graphic->size && j < graphic->size; i += tile_size, j += tile_size) {
+ while (j < graphic->size && is_whitespace(&graphic->data[j], tile_size) && !is_preserved(j / tile_size - d)) {
+ shift_preserved(j / tile_size);
+ d++;
j += tile_size;
}
if (j >= graphic->size) {
@@ -136,11 +172,17 @@ void remove_duplicates(struct Graphic *graphic) {
int tile_size = Options.depth * 8;
if (Options.interleave) tile_size *= 2;
int num_tiles = 0;
- for (int i = 0, j = 0; i < graphic->size && j < graphic->size; i += tile_size, j += tile_size) {
- while (tile_exists(&graphic->data[j], graphic->data, tile_size, num_tiles)) {
- if (Options.keep_whitespace && is_whitespace(&graphic->data[j], tile_size)) {
+
+ // Make sure we have a whole number of tiles, round down if required
+ graphic->size &= ~(tile_size - 1);
+
+ for (int i = 0, j = 0, d = 0; i < graphic->size && j < graphic->size; i += tile_size, j += tile_size) {
+ while (j < graphic->size && tile_exists(&graphic->data[j], graphic->data, tile_size, num_tiles)) {
+ if ((Options.keep_whitespace && is_whitespace(&graphic->data[j], tile_size)) || is_preserved(j / tile_size - d)) {
break;
}
+ shift_preserved(j / tile_size);
+ d++;
j += tile_size;
}
if (j >= graphic->size) {
@@ -155,7 +197,8 @@ void remove_duplicates(struct Graphic *graphic) {
}
bool flip_exists(uint8_t *tile, uint8_t *tiles, int tile_size, int num_tiles, bool xflip, bool yflip) {
- uint8_t *flip = calloc(tile_size, 1);
+ uint8_t flip[tile_size];
+ memset(flip, 0, sizeof(flip));
int half_size = tile_size / 2;
for (int i = 0; i < tile_size; i++) {
int byte = i;
@@ -183,11 +226,17 @@ void remove_flip(struct Graphic *graphic, bool xflip, bool yflip) {
int tile_size = Options.depth * 8;
if (Options.interleave) tile_size *= 2;
int num_tiles = 0;
- for (int i = 0, j = 0; i < graphic->size && j < graphic->size; i += tile_size, j += tile_size) {
- while (flip_exists(&graphic->data[j], graphic->data, tile_size, num_tiles, xflip, yflip)) {
- if (Options.keep_whitespace && is_whitespace(&graphic->data[j], tile_size)) {
+
+ // Make sure we have a whole number of tiles, round down if required
+ graphic->size &= ~(tile_size - 1);
+
+ for (int i = 0, j = 0, d = 0; i < graphic->size && j < graphic->size; i += tile_size, j += tile_size) {
+ while (j < graphic->size && flip_exists(&graphic->data[j], graphic->data, tile_size, num_tiles, xflip, yflip)) {
+ if ((Options.keep_whitespace && is_whitespace(&graphic->data[j], tile_size)) || is_preserved(j / tile_size - d)) {
break;
}
+ shift_preserved(j / tile_size);
+ d++;
j += tile_size;
}
if (j >= graphic->size) {
diff --git a/tools/gfx.py b/tools/gfx.py
index 2505499d..eadc7add 100644
--- a/tools/gfx.py
+++ b/tools/gfx.py
@@ -150,7 +150,7 @@ def filepath_rules(filepath):
elif name in overworld_px16:
args['width'] = 16
- elif 'gfx/sgb_border' in filedir:
+ elif 'gfx/sgb' in filedir:
args['width'] = 128
args['pal_file'] = os.path.join(filedir, name + '.pal')
diff --git a/wram.asm b/wram.asm
index fc1dc032..f0174890 100644
--- a/wram.asm
+++ b/wram.asm
@@ -2527,7 +2527,8 @@ wFailedToFlee:: db ; d152
wNumFleeAttempts:: db ; d153
wd154:: ds 1 ; d154
wROMBankBackup:: ds 1 ; d155
-wBuffer:: ds 1 ; d156
+wFarByte::
+wTempBank:: db ; d156
wTimeOfDay:: ds 1 ; d157
wd158:: ds 1 ; d158