summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Harding <33dannye@gmail.com>2021-04-05 10:33:20 -0500
committerGitHub <noreply@github.com>2021-04-05 10:33:20 -0500
commit732a632a948595906df649252f66fdad5e2b4468 (patch)
treec78ec1bc8ee69324eefa89f64ff4e903d55dce9f
parent2bd3cc006136b1e0ac1949a169b74fa2c8215e84 (diff)
parent99808f1ac473167d952edb986f6a1d102c564b61 (diff)
Merge pull request #103 from ElectroDeoxys/master
Finish banks $5 and $1c
-rw-r--r--src/constants/script_constants.asm22
-rw-r--r--src/data/sgb_data/border_debug_1.binbin0 -> 1981 bytes
-rw-r--r--src/data/sgb_data/border_debug_2.binbin0 -> 78 bytes
-rw-r--r--src/data/sgb_data/border_debug_3.binbin0 -> 102 bytes
-rw-r--r--src/data/sgb_data/border_debug_4.binbin0 -> 520 bytes
-rw-r--r--src/data/sgb_data/border_intro_1.binbin0 -> 2833 bytes
-rw-r--r--src/data/sgb_data/border_intro_2.binbin0 -> 945 bytes
-rw-r--r--src/data/sgb_data/border_intro_3.binbin0 -> 82 bytes
-rw-r--r--src/data/sgb_data/border_intro_4.binbin0 -> 765 bytes
-rw-r--r--src/data/sgb_data/border_medals_1.binbin0 -> 3435 bytes
-rw-r--r--src/data/sgb_data/border_medals_2.binbin0 -> 248 bytes
-rw-r--r--src/data/sgb_data/border_medals_3.binbin0 -> 73 bytes
-rw-r--r--src/data/sgb_data/border_medals_4.binbin0 -> 72 bytes
-rw-r--r--src/data/sgb_data/border_medals_5.binbin0 -> 440 bytes
-rw-r--r--src/data/sgb_data/unused_pals_1.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_10.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_11.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_12.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_13.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_14.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_15.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_16.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_17.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_18.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_19.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_2.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_20.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_21.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_22.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_23.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_24.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_25.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_26.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_27.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_28.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_29.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_3.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_30.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_31.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_32.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_33.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_34.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_35.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_36.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_37.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_38.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_39.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_4.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_40.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_41.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_42.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_5.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_6.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_7.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_8.binbin0 -> 35 bytes
-rw-r--r--src/data/sgb_data/unused_pals_9.binbin0 -> 35 bytes
-rw-r--r--src/engine/bank04.asm10
-rw-r--r--src/engine/bank05.asm136
-rw-r--r--src/engine/bank1c.asm555
-rw-r--r--src/engine/home.asm2
-rw-r--r--tools/compressed_data_extractor.py95
61 files changed, 743 insertions, 77 deletions
diff --git a/src/constants/script_constants.asm b/src/constants/script_constants.asm
index a6a05be..d7ae7d6 100644
--- a/src/constants/script_constants.asm
+++ b/src/constants/script_constants.asm
@@ -278,3 +278,25 @@ WEST EQU $03
NO_MOVE EQU %10000000 ; For rotations without movement
VARIABLE_CARD EQU 0 ; use the card located in wCardReceived instead of using the script's argument
+
+; medal flags set in EVENT_MEDAL_FLAGS
+ const_def
+ const FIGHTING_MEDAL_F ; 0
+ const ROCK_MEDAL_F ; 1
+ const PSYCHIC_MEDAL_F ; 2
+ const LIGHTNING_MEDAL_F ; 3
+ const WATER_MEDAL_F ; 4
+ const FIRE_MEDAL_F ; 5
+ const SCIENCE_MEDAL_F ; 6
+ const GRASS_MEDAL_F ; 7
+
+FIGHTING_MEDAL EQU 1 << FIGHTING_MEDAL_F
+ROCK_MEDAL EQU 1 << ROCK_MEDAL_F
+PSYCHIC_MEDAL EQU 1 << PSYCHIC_MEDAL_F
+LIGHTNING_MEDAL EQU 1 << LIGHTNING_MEDAL_F
+WATER_MEDAL EQU 1 << WATER_MEDAL_F
+FIRE_MEDAL EQU 1 << FIRE_MEDAL_F
+SCIENCE_MEDAL EQU 1 << SCIENCE_MEDAL_F
+GRASS_MEDAL EQU 1 << GRASS_MEDAL_F
+
+NUM_MEDALS EQU 8
diff --git a/src/data/sgb_data/border_debug_1.bin b/src/data/sgb_data/border_debug_1.bin
new file mode 100644
index 0000000..00c7b8a
--- /dev/null
+++ b/src/data/sgb_data/border_debug_1.bin
Binary files differ
diff --git a/src/data/sgb_data/border_debug_2.bin b/src/data/sgb_data/border_debug_2.bin
new file mode 100644
index 0000000..84b2283
--- /dev/null
+++ b/src/data/sgb_data/border_debug_2.bin
Binary files differ
diff --git a/src/data/sgb_data/border_debug_3.bin b/src/data/sgb_data/border_debug_3.bin
new file mode 100644
index 0000000..b611b7d
--- /dev/null
+++ b/src/data/sgb_data/border_debug_3.bin
Binary files differ
diff --git a/src/data/sgb_data/border_debug_4.bin b/src/data/sgb_data/border_debug_4.bin
new file mode 100644
index 0000000..8b86378
--- /dev/null
+++ b/src/data/sgb_data/border_debug_4.bin
Binary files differ
diff --git a/src/data/sgb_data/border_intro_1.bin b/src/data/sgb_data/border_intro_1.bin
new file mode 100644
index 0000000..ff39636
--- /dev/null
+++ b/src/data/sgb_data/border_intro_1.bin
Binary files differ
diff --git a/src/data/sgb_data/border_intro_2.bin b/src/data/sgb_data/border_intro_2.bin
new file mode 100644
index 0000000..2d8170b
--- /dev/null
+++ b/src/data/sgb_data/border_intro_2.bin
Binary files differ
diff --git a/src/data/sgb_data/border_intro_3.bin b/src/data/sgb_data/border_intro_3.bin
new file mode 100644
index 0000000..02477ff
--- /dev/null
+++ b/src/data/sgb_data/border_intro_3.bin
Binary files differ
diff --git a/src/data/sgb_data/border_intro_4.bin b/src/data/sgb_data/border_intro_4.bin
new file mode 100644
index 0000000..4fd870f
--- /dev/null
+++ b/src/data/sgb_data/border_intro_4.bin
Binary files differ
diff --git a/src/data/sgb_data/border_medals_1.bin b/src/data/sgb_data/border_medals_1.bin
new file mode 100644
index 0000000..4dcc13c
--- /dev/null
+++ b/src/data/sgb_data/border_medals_1.bin
Binary files differ
diff --git a/src/data/sgb_data/border_medals_2.bin b/src/data/sgb_data/border_medals_2.bin
new file mode 100644
index 0000000..ac6b64e
--- /dev/null
+++ b/src/data/sgb_data/border_medals_2.bin
Binary files differ
diff --git a/src/data/sgb_data/border_medals_3.bin b/src/data/sgb_data/border_medals_3.bin
new file mode 100644
index 0000000..9cbc840
--- /dev/null
+++ b/src/data/sgb_data/border_medals_3.bin
Binary files differ
diff --git a/src/data/sgb_data/border_medals_4.bin b/src/data/sgb_data/border_medals_4.bin
new file mode 100644
index 0000000..09f1acd
--- /dev/null
+++ b/src/data/sgb_data/border_medals_4.bin
Binary files differ
diff --git a/src/data/sgb_data/border_medals_5.bin b/src/data/sgb_data/border_medals_5.bin
new file mode 100644
index 0000000..2d9b6a4
--- /dev/null
+++ b/src/data/sgb_data/border_medals_5.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_1.bin b/src/data/sgb_data/unused_pals_1.bin
new file mode 100644
index 0000000..d29caa9
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_1.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_10.bin b/src/data/sgb_data/unused_pals_10.bin
new file mode 100644
index 0000000..bfaa01d
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_10.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_11.bin b/src/data/sgb_data/unused_pals_11.bin
new file mode 100644
index 0000000..619ff8d
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_11.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_12.bin b/src/data/sgb_data/unused_pals_12.bin
new file mode 100644
index 0000000..c4e235e
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_12.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_13.bin b/src/data/sgb_data/unused_pals_13.bin
new file mode 100644
index 0000000..3e4b042
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_13.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_14.bin b/src/data/sgb_data/unused_pals_14.bin
new file mode 100644
index 0000000..90179cf
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_14.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_15.bin b/src/data/sgb_data/unused_pals_15.bin
new file mode 100644
index 0000000..de5b71f
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_15.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_16.bin b/src/data/sgb_data/unused_pals_16.bin
new file mode 100644
index 0000000..71ae2c2
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_16.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_17.bin b/src/data/sgb_data/unused_pals_17.bin
new file mode 100644
index 0000000..5d7d4d3
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_17.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_18.bin b/src/data/sgb_data/unused_pals_18.bin
new file mode 100644
index 0000000..fdfc713
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_18.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_19.bin b/src/data/sgb_data/unused_pals_19.bin
new file mode 100644
index 0000000..fdfc713
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_19.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_2.bin b/src/data/sgb_data/unused_pals_2.bin
new file mode 100644
index 0000000..fdfc713
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_2.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_20.bin b/src/data/sgb_data/unused_pals_20.bin
new file mode 100644
index 0000000..fdfc713
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_20.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_21.bin b/src/data/sgb_data/unused_pals_21.bin
new file mode 100644
index 0000000..dcfc362
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_21.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_22.bin b/src/data/sgb_data/unused_pals_22.bin
new file mode 100644
index 0000000..dcfc362
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_22.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_23.bin b/src/data/sgb_data/unused_pals_23.bin
new file mode 100644
index 0000000..dcfc362
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_23.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_24.bin b/src/data/sgb_data/unused_pals_24.bin
new file mode 100644
index 0000000..e99a8e2
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_24.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_25.bin b/src/data/sgb_data/unused_pals_25.bin
new file mode 100644
index 0000000..2a71e58
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_25.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_26.bin b/src/data/sgb_data/unused_pals_26.bin
new file mode 100644
index 0000000..2a71e58
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_26.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_27.bin b/src/data/sgb_data/unused_pals_27.bin
new file mode 100644
index 0000000..db55ea8
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_27.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_28.bin b/src/data/sgb_data/unused_pals_28.bin
new file mode 100644
index 0000000..db55ea8
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_28.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_29.bin b/src/data/sgb_data/unused_pals_29.bin
new file mode 100644
index 0000000..db55ea8
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_29.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_3.bin b/src/data/sgb_data/unused_pals_3.bin
new file mode 100644
index 0000000..9b6adfc
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_3.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_30.bin b/src/data/sgb_data/unused_pals_30.bin
new file mode 100644
index 0000000..9c865d7
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_30.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_31.bin b/src/data/sgb_data/unused_pals_31.bin
new file mode 100644
index 0000000..9c865d7
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_31.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_32.bin b/src/data/sgb_data/unused_pals_32.bin
new file mode 100644
index 0000000..3e4b042
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_32.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_33.bin b/src/data/sgb_data/unused_pals_33.bin
new file mode 100644
index 0000000..3e4b042
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_33.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_34.bin b/src/data/sgb_data/unused_pals_34.bin
new file mode 100644
index 0000000..e3fe228
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_34.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_35.bin b/src/data/sgb_data/unused_pals_35.bin
new file mode 100644
index 0000000..e3fe228
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_35.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_36.bin b/src/data/sgb_data/unused_pals_36.bin
new file mode 100644
index 0000000..e3fe228
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_36.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_37.bin b/src/data/sgb_data/unused_pals_37.bin
new file mode 100644
index 0000000..d510328
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_37.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_38.bin b/src/data/sgb_data/unused_pals_38.bin
new file mode 100644
index 0000000..d510328
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_38.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_39.bin b/src/data/sgb_data/unused_pals_39.bin
new file mode 100644
index 0000000..2a71e58
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_39.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_4.bin b/src/data/sgb_data/unused_pals_4.bin
new file mode 100644
index 0000000..9b80afe
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_4.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_40.bin b/src/data/sgb_data/unused_pals_40.bin
new file mode 100644
index 0000000..2a6a293
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_40.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_41.bin b/src/data/sgb_data/unused_pals_41.bin
new file mode 100644
index 0000000..3e4b042
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_41.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_42.bin b/src/data/sgb_data/unused_pals_42.bin
new file mode 100644
index 0000000..1660c61
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_42.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_5.bin b/src/data/sgb_data/unused_pals_5.bin
new file mode 100644
index 0000000..455845b
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_5.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_6.bin b/src/data/sgb_data/unused_pals_6.bin
new file mode 100644
index 0000000..e3fe228
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_6.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_7.bin b/src/data/sgb_data/unused_pals_7.bin
new file mode 100644
index 0000000..e0147e6
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_7.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_8.bin b/src/data/sgb_data/unused_pals_8.bin
new file mode 100644
index 0000000..838d652
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_8.bin
Binary files differ
diff --git a/src/data/sgb_data/unused_pals_9.bin b/src/data/sgb_data/unused_pals_9.bin
new file mode 100644
index 0000000..fa5bc6f
--- /dev/null
+++ b/src/data/sgb_data/unused_pals_9.bin
Binary files differ
diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm
index f1d31c1..38b1271 100644
--- a/src/engine/bank04.asm
+++ b/src/engine/bank04.asm
@@ -63,7 +63,7 @@ Medal_1029e: ; 1029e (4:429e)
call PauseSong
ld a, MUSIC_STOP
call PlaySong
- farcall Func_70000
+ farcall SetMainSGBBorder
call DisableLCD
call Func_10000
ld a, $fa
@@ -2810,7 +2810,7 @@ _GameLoop: ; 126d1 (4:66d1)
call ZeroObjectPositions
ld hl, wVBlankOAMCopyToggle
inc [hl]
- farcall Func_70018
+ farcall SetIntroSGBBorder
ld a, $ff
ld [wd627], a
.main_menu_loop
@@ -2846,7 +2846,7 @@ MainMenu_NewGame: ; 12704 (4:6704)
call DisableSRAM
ld a, MUSIC_STOP
call PlaySong
- farcall Func_70000
+ farcall SetMainSGBBorder
ld a, MUSIC_OVERWORLD
ld [wDefaultSong], a
call PlayDefaultSong
@@ -2863,7 +2863,7 @@ MainMenu_ContinueFromDiary: ; 12741 (4:6741)
call Func_11320
jr nc, MainMenu_NewGame
farcall Func_c1ed
- farcall Func_70000
+ farcall SetMainSGBBorder
call EnableSRAM
xor a
ld [sba44], a
@@ -2890,7 +2890,7 @@ MainMenu_ContinueDuel: ; 1277e (4:677e)
call PlaySong
farcall Func_c9cb
farcall $04, Func_3a40
- farcall Func_70000
+ farcall SetMainSGBBorder
ld a, GAME_EVENT_CONTINUE_DUEL
ld [wGameEvent], a
farcall $03, ExecuteGameEvent
diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm
index e22a88c..f8ed5d7 100644
--- a/src/engine/bank05.asm
+++ b/src/engine/bank05.asm
@@ -575,9 +575,30 @@ ConvertColorToEnergyCardID: ; 1430f (5:430f)
db FIGHTING_ENERGY
db PSYCHIC_ENERGY
db DOUBLE_COLORLESS_ENERGY
+; 0x14323
+; returns carry if loaded attack effect has
+; an "initial effect 2" or "require selection" command type
+; unreferenced?
Func_14323: ; 14323 (5:4323)
- INCROM $14323, $1433d
+ ld hl, wLoadedAttackEffectCommands
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, EFFECTCMDTYPE_INITIAL_EFFECT_2
+ push hl
+ call CheckMatchingCommand
+ pop hl
+ jr nc, .set_carry
+ ld a, EFFECTCMDTYPE_REQUIRE_SELECTION
+ call CheckMatchingCommand
+ jr nc, .set_carry
+ or a
+ ret
+.set_carry
+ scf
+ ret
+; 0x1433d
; return carry depending on card index in a:
; - if energy card, return carry if no energy card has been played yet
@@ -1785,8 +1806,98 @@ TrySetUpBossStartingPlayArea: ; 1581b (5:581b)
scf
ret
+; expects a $00-terminated list of 3-byte data with the following:
+; - non-zero value (anything but $1 is ignored)
+; - card ID to look for in Play Area
+; - number of energy cards
+; returns carry if a card ID is found in bench with at least the
+; listed number of energy cards
+; unreferenced?
Func_1585b: ; 1585b (5:585b)
- INCROM $1585b, $158b2
+ ld a, [hli]
+ or a
+ jr z, .no_carry
+ dec a
+ jr nz, .next_1
+ ld a, [hli]
+ ld b, PLAY_AREA_BENCH_1
+ push hl
+ call LookForCardIDInPlayArea_Bank5
+ jr nc, .next_2
+ ld e, a
+ push de
+ call CountNumberOfEnergyCardsAttached
+ pop de
+ pop hl
+ ld b, [hl]
+ cp b
+ jr nc, .set_carry
+ inc hl
+ jr Func_1585b
+
+.next_1
+ inc hl
+ inc hl
+ jr Func_1585b
+
+.next_2
+ pop hl
+ inc hl
+ jr Func_1585b
+
+.no_carry
+ or a
+ ret
+
+.set_carry
+ ld a, e
+ scf
+ ret
+; 0x15886
+
+; expects a $00-terminated list of 3-byte data with the following:
+; - non-zero value
+; - card ID
+; - number of energy cards
+; goes through the given list and if a card with a listed ID is found
+; with less than the number of energy cards corresponding to its entry
+; then have AI try to play an energy card from the hand to it
+; unreferenced?
+Func_15886: ; 15886 (5:5886)
+ push hl
+ call CreateEnergyCardListFromHand
+ pop hl
+ ret c ; quit if no energy cards in hand
+
+.loop_energy_cards
+ ld a, [hli]
+ or a
+ ret z ; done
+ ld a, [hli]
+ ld b, PLAY_AREA_ARENA
+ push hl
+ call LookForCardIDInPlayArea_Bank5
+ jr nc, .next ; skip if not found in Play Area
+ ld e, a
+ push de
+ call CountNumberOfEnergyCardsAttached
+ pop de
+ pop hl
+ cp [hl]
+ inc hl
+ jr nc, .loop_energy_cards
+ ld a, e
+ ldh [hTempPlayAreaLocation_ff9d], a
+ push hl
+ call AITryToPlayEnergyCard
+ pop hl
+ ret c
+ jr .loop_energy_cards
+.next
+ pop hl
+ inc hl
+ jr .loop_energy_cards
+; 0x158b2
; determine AI score for retreating
; return carry if AI decides to retreat
@@ -3920,8 +4031,25 @@ CheckForEvolutionInDeck: ; 16451 (5:6451)
scf
ret
+; processes AI energy card playing logic
+; with AI_ENERGY_FLAG_DONT_PLAY flag on
+; unreferenced?
Func_16488: ; 16488 (5:6488)
- INCROM $16488, $164a1
+ ld a, AI_ENERGY_FLAG_DONT_PLAY
+ ld [wAIEnergyAttachLogicFlags], a
+ ld de, wTempPlayAreaAIScore
+ ld hl, wPlayAreaAIScore
+ ld b, MAX_PLAY_AREA_POKEMON
+.loop
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec b
+ jr nz, .loop
+ ld a, [wAIScore]
+ ld [de], a
+ jr AIProcessAndTryToPlayEnergy.has_logic_flags
+; 0x164a1
; have AI choose an energy card to play, but do not play it.
; does not consider whether the cards have evolutions to be played.
@@ -3995,6 +4123,8 @@ RetrievePlayAreaAIScoreFromBackup1: ; 164d3 (5:64d3)
AIProcessAndTryToPlayEnergy: ; 164e8 (5:64e8)
xor a
ld [wAIEnergyAttachLogicFlags], a
+
+.has_logic_flags
call CreateEnergyCardListFromHand
jr nc, AIProcessEnergyCards
diff --git a/src/engine/bank1c.asm b/src/engine/bank1c.asm
index 2207d2e..1c68fb5 100644
--- a/src/engine/bank1c.asm
+++ b/src/engine/bank1c.asm
@@ -1,7 +1,7 @@
-Func_70000: ; 70000 (1c:4000)
+SetMainSGBBorder: ; 70000 (1c:4000)
ld a, [wConsole]
- cp $1
- ret nz
+ cp CONSOLE_SGB
+ ret nz ; exit if not SGB
ld b, $1
ld a, EVENT_RECEIVED_LEGENDARY_CARDS
farcall GetEventValue
@@ -10,15 +10,15 @@ Func_70000: ; 70000 (1c:4000)
ld b, $2
.asm_70013
ld a, b
- call Func_70044
+ call SetSGBBorder
ret
-Func_70018: ; 70018 (1c:4018)
+SetIntroSGBBorder: ; 70018 (1c:4018)
ld a, [wConsole]
- cp $1
- ret nz
+ cp CONSOLE_SGB
+ ret nz ; exit if not SGB
ld a, $0
- call Func_70044
+ call SetSGBBorder
ret
AtrcEnPacket_Disable: ; 70024 (1c:4024)
@@ -32,29 +32,52 @@ IconEnPacket: ; 70034 (1c:4034)
db $01
ds $0e
-Func_70044: ; 70044 (1c:4044)
+; sets SGB border corresponding with value in register a
+; $0 = intro
+; $1 = medals (gold)
+; $2 = medals (blue)
+; $3 = debug
+SetSGBBorder: ; 70044 (1c:4044)
push hl
push bc
- add a
+ add a ; *2
ld c, a
- add a
- add c
+ add a ; *4
+ add c ; *6
ld c, a
ld b, $0
- ld hl, Unknown_70057
+ ld hl, .SGBBorders
add hl, bc
- call Func_70082
+ call DecompressAndSendSGBBorder
pop bc
pop hl
ret
-Unknown_70057: ; 70057 (1c:4057)
- INCROM $70057, $70082
+.SGBBorders
+ ; tiles, pals (?), map (?)
+ dw SGBBorderIntroGfxPointers, SGBData_BorderIntro3, SGBData_BorderIntro4
+ dw SGBBorderMedalsGfxPointers, SGBData_BorderMedals3, SGBData_BorderMedals5
+ dw SGBBorderMedalsGfxPointers, SGBData_BorderMedals4, SGBData_BorderMedals5
+ dw SGBBorderDebugGfxPointers, SGBData_BorderDebug3, SGBData_BorderDebug4
+; 0x7006f
-Func_70082: ; 70082 (1c:4082)
+; forces SGB border intro
+; unreferenced?
+Func_7006f: ; 7006f (1c:406f)
ld a, [wConsole]
- cp $1
- ret nz
+ cp CONSOLE_SGB
+ ret nz ; exit if not SGB
+ ld de, SGBData_BorderIntro3
+ ld hl, SGBData_BorderIntro4
+ call SetMainSGBBorderPalsAndMap
+ call Func_701c0
+ ret
+; 0x70082
+
+DecompressAndSendSGBBorder: ; 70082 (1c:4082)
+ ld a, [wConsole]
+ cp CONSOLE_SGB
+ ret nz ; exit if not SGB
push hl
push bc
ld a, [hli]
@@ -64,6 +87,7 @@ Func_70082: ; 70082 (1c:4082)
call Func_700a3
pop hl
inc hl
+
ld a, [hli]
ld e, a
ld a, [hli]
@@ -71,7 +95,7 @@ Func_70082: ; 70082 (1c:4082)
ld a, [hli]
ld h, [hl]
ld l, a
- call Func_700fe
+ call SetMainSGBBorderPalsAndMap
call Func_701c0
pop bc
pop hl
@@ -84,17 +108,19 @@ Func_700a3: ; 700a3 (1c:40a3)
push hl
call Func_70136
pop hl
+
push hl
ld a, [hli]
ld h, [hl]
ld l, a
ld de, v0Tiles1
- call Func_701e9
- call Func_701fe
+ call DecompressSGBData
+ call PrepareBGMapForSendingSGBBorder
ld hl, ChrTrnPacket_BGTiles1
- call Func_70177
+ call SendSGBBorder
pop hl
- ld de, $0002
+
+ ld de, 2
add hl, de
ld a, [hli]
ld h, [hl]
@@ -105,9 +131,9 @@ Func_700a3: ; 700a3 (1c:40a3)
call Func_70136
dec hl
ld de, v0Tiles1
- call Func_701e9
+ call DecompressSGBData
ld hl, ChrTrnPacket_BGTiles2
- call Func_70177
+ call SendSGBBorder
.asm_700da
pop de
pop bc
@@ -126,25 +152,29 @@ ChrTrnPacket_BGTiles2: ; 700ee (1c:40ee)
db 1
ds $0e
-Func_700fe: ; 700fe (1c:40fe)
+; de = pals
+; hl = map
+SetMainSGBBorderPalsAndMap: ; 700fe (1c:40fe)
push hl
push bc
push de
push hl
push de
- push hl
+ push hl ; input hl
call Func_70136
pop hl
ld de, v0Tiles1
- call Func_701e9
- pop hl
+ call DecompressSGBData
+
+ pop hl ; input de
ld de, v0Tiles2
- call Func_701e9
- call Func_701fe
- pop hl
- call Func_70214
+ call DecompressSGBData
+ call PrepareBGMapForSendingSGBBorder
+
+ pop hl ; input hl
+ call FillSGBBorderMedalSlots
ld hl, PctTrnPacket
- call Func_70177
+ call SendSGBBorder
pop de
pop bc
pop hl
@@ -167,6 +197,7 @@ Func_70136: ; 70136 (1c:4136)
ld [wd41f], a
ld a, [wLCDC]
ld [wd420], a
+
di
ld hl, MaskEnPacket_Freeze_Bank1c
call SendSGB
@@ -178,6 +209,7 @@ Func_70136: ; 70136 (1c:4136)
ld a, %11100100
ldh [rBGP], a
call SetBGP
+
xor a
ldh [hSCX], a
ldh [rSCX], a
@@ -188,7 +220,7 @@ Func_70136: ; 70136 (1c:4136)
pop hl
ret
-Func_70177: ; 70177 (1c:4177)
+SendSGBBorder: ; 70177 (1c:4177)
push hl
push bc
push de
@@ -249,7 +281,8 @@ Func_701c0: ; 701c0 (1c:41c0)
pop hl
ret
-Func_701e9: ; 701e9 (1c:41e9)
+; decompresses data pointed by hl to de
+DecompressSGBData: ; 701e9 (1c:41e9)
ld a, [hli]
ld c, a
ld a, [hli]
@@ -267,13 +300,15 @@ Func_701e9: ; 701e9 (1c:41e9)
call DecompressData
ret
-Func_701fe: ; 701fe (1c:41fe)
+; fills a 20x13 rectangle in v0BGMap0
+; with values ascending bytes starting at $80
+PrepareBGMapForSendingSGBBorder: ; 701fe (1c:41fe)
ld hl, v0BGMap0
ld de, $000c
ld a, $80
ld c, $d
.asm_70208
- ld b, $14
+ ld b, SCREEN_WIDTH
.asm_7020a
ld [hli], a
inc a
@@ -284,25 +319,30 @@ Func_701fe: ; 701fe (1c:41fe)
jr nz, .asm_70208
ret
-Func_70214: ; 70214 (1c:4214)
+; iterates all the medals obtained by the player
+; and fills the corresponding medal slot in the SGB border
+FillSGBBorderMedalSlots: ; 70214 (1c:4214)
+; exit if not SGBData_BorderMedals5
ld a, l
- cp $dc
+ cp LOW(SGBData_BorderMedals5)
ret nz
ld a, h
- cp $49
+ cp HIGH(SGBData_BorderMedals5)
ret nz
- ld hl, Unknown_7024a
+
+ ld hl, .SGBBorderMedalTiles
ld a, EVENT_MEDAL_FLAGS
farcall GetEventValue
- ld c, $8
-.asm_70227
+ ld c, NUM_MEDALS
+.loop_medals
push bc
push hl
push af
bit 7, a
- jr z, .asm_7023e
- ld c, $9
-.asm_70230
+ jr z, .next_medal
+
+ ld c, 3 * 3
+.loop_tiles
push bc
ld e, [hl]
inc hl
@@ -315,20 +355,114 @@ Func_70214: ; 70214 (1c:4214)
ld [de], a
pop bc
dec c
- jr nz, .asm_70230
-.asm_7023e
+ jr nz, .loop_tiles
+
+.next_medal
pop af
rlca
pop hl
- ld bc, $0024
+ ld bc, 3 * 3 * 4
add hl, bc
pop bc
dec c
- jr nz, .asm_70227
+ jr nz, .loop_medals
ret
-Unknown_7024a: ; 7024a (1c:424a)
- INCROM $7024a, $7036a
+border_medal_tile: MACRO
+ dw \1 ; VRAM address
+ db \2 ; tile
+ db \3 ; pal (?)
+ENDM
+
+.SGBBorderMedalTiles
+; GRASS_MEDAL
+ border_medal_tile v0Tiles1 + $182, $3f, $10
+ border_medal_tile v0Tiles1 + $184, $40, $10
+ border_medal_tile v0Tiles1 + $186, $41, $10
+ border_medal_tile v0Tiles1 + $1c2, $42, $10
+ border_medal_tile v0Tiles1 + $1c4, $43, $10
+ border_medal_tile v0Tiles1 + $1c6, $44, $10
+ border_medal_tile v0Tiles1 + $202, $45, $10
+ border_medal_tile v0Tiles1 + $204, $46, $10
+ border_medal_tile v0Tiles1 + $206, $47, $10
+
+; SCIENCE_MEDAL
+ border_medal_tile v0Tiles1 + $282, $48, $10
+ border_medal_tile v0Tiles1 + $284, $49, $10
+ border_medal_tile v0Tiles1 + $286, $4a, $10
+ border_medal_tile v0Tiles1 + $2c2, $4b, $10
+ border_medal_tile v0Tiles1 + $2c4, $4c, $10
+ border_medal_tile v0Tiles1 + $2c6, $4d, $10
+ border_medal_tile v0Tiles1 + $302, $4e, $10
+ border_medal_tile v0Tiles1 + $304, $4f, $10
+ border_medal_tile v0Tiles1 + $306, $50, $10
+
+; FIRE_MEDAL
+ border_medal_tile v0Tiles1 + $382, $51, $10
+ border_medal_tile v0Tiles1 + $384, $52, $10
+ border_medal_tile v0Tiles1 + $386, $53, $10
+ border_medal_tile v0Tiles1 + $3c2, $54, $10
+ border_medal_tile v0Tiles1 + $3c4, $55, $10
+ border_medal_tile v0Tiles1 + $3c6, $56, $10
+ border_medal_tile v0Tiles1 + $402, $57, $10
+ border_medal_tile v0Tiles1 + $404, $58, $10
+ border_medal_tile v0Tiles1 + $406, $59, $10
+
+; WATER_MEDAL
+ border_medal_tile v0Tiles1 + $482, $5a, $10
+ border_medal_tile v0Tiles1 + $484, $5b, $10
+ border_medal_tile v0Tiles1 + $486, $5c, $10
+ border_medal_tile v0Tiles1 + $4c2, $5d, $10
+ border_medal_tile v0Tiles1 + $4c4, $5e, $10
+ border_medal_tile v0Tiles1 + $4c6, $5f, $10
+ border_medal_tile v0Tiles1 + $502, $60, $10
+ border_medal_tile v0Tiles1 + $504, $61, $10
+ border_medal_tile v0Tiles1 + $506, $62, $10
+
+; LIGHTNING_MEDAL
+ border_medal_tile v0Tiles1 + $1b8, $63, $10
+ border_medal_tile v0Tiles1 + $1ba, $64, $10
+ border_medal_tile v0Tiles1 + $1bc, $65, $10
+ border_medal_tile v0Tiles1 + $1f8, $66, $10
+ border_medal_tile v0Tiles1 + $1fa, $67, $10
+ border_medal_tile v0Tiles1 + $1fc, $68, $10
+ border_medal_tile v0Tiles1 + $238, $69, $10
+ border_medal_tile v0Tiles1 + $23a, $6a, $10
+ border_medal_tile v0Tiles1 + $23c, $6b, $10
+
+; FIGHTING_MEDAL
+ border_medal_tile v0Tiles1 + $2b8, $7e, $10
+ border_medal_tile v0Tiles1 + $2ba, $7f, $10
+ border_medal_tile v0Tiles1 + $2bc, $80, $10
+ border_medal_tile v0Tiles1 + $2f8, $81, $10
+ border_medal_tile v0Tiles1 + $2fa, $82, $10
+ border_medal_tile v0Tiles1 + $2fc, $83, $10
+ border_medal_tile v0Tiles1 + $338, $84, $10
+ border_medal_tile v0Tiles1 + $33a, $85, $10
+ border_medal_tile v0Tiles1 + $33c, $86, $10
+
+; ROCK_MEDAL
+ border_medal_tile v0Tiles1 + $3b8, $75, $10
+ border_medal_tile v0Tiles1 + $3ba, $76, $10
+ border_medal_tile v0Tiles1 + $3bc, $77, $10
+ border_medal_tile v0Tiles1 + $3f8, $78, $10
+ border_medal_tile v0Tiles1 + $3fa, $79, $10
+ border_medal_tile v0Tiles1 + $3fc, $7a, $10
+ border_medal_tile v0Tiles1 + $438, $7b, $10
+ border_medal_tile v0Tiles1 + $43a, $7c, $10
+ border_medal_tile v0Tiles1 + $43c, $7d, $10
+
+; PSYCHIC_MEDAL
+ border_medal_tile v0Tiles1 + $4b8, $6c, $10
+ border_medal_tile v0Tiles1 + $4ba, $6d, $10
+ border_medal_tile v0Tiles1 + $4bc, $6e, $10
+ border_medal_tile v0Tiles1 + $4f8, $6f, $10
+ border_medal_tile v0Tiles1 + $4fa, $70, $10
+ border_medal_tile v0Tiles1 + $4fc, $71, $10
+ border_medal_tile v0Tiles1 + $538, $72, $10
+ border_medal_tile v0Tiles1 + $53a, $73, $10
+ border_medal_tile v0Tiles1 + $53c, $74, $10
+; 0x7036a
; decompresses palette data depending on wd132
; then sends it as SGB packet
@@ -440,7 +574,84 @@ DecompressSGBPalette: ; 70403 (1c:4403)
ret
; 0x7041d
- INCROM $7041d, $70498
+; sends an SGB packet related with palettes
+; unreferenced?
+Func_7041d: ; 7041d (1c:441d)
+ ld a, [wConsole]
+ cp CONSOLE_SGB
+ ret nz ; exit if not SGB
+
+ push hl
+ push bc
+ push de
+ push bc
+ push hl
+ push hl
+ ld hl, SGBData_UnusedPals1
+ call DecompressSGBPalette
+ ld hl, wLoadedPalData
+ ld de, wTempSGBPacket + $1
+ ld bc, $8
+ call CopyDataHLtoDE
+
+ pop hl
+ call DecompressSGBPalette
+ ld hl, wLoadedPalData + 2
+ ld de, wTempSGBPacket + $9
+ ld bc, $6
+ call CopyDataHLtoDE
+
+ xor a
+ ld [wTempSGBPacket + $f], a
+ ld hl, wTempSGBPacket
+ ld a, $09
+ ld [hl], a
+ call Func_704c7
+ call SendSGB
+
+ pop hl
+ ld c, $0f
+ ld a, l
+ cp LOW(SGBData_UnusedPals1)
+ jr nz, .asm_7046a
+ ld a, h
+ cp HIGH(SGBData_UnusedPals1)
+ jr nz, .asm_7046a
+ ld c, $0a
+
+.asm_7046a
+ ld a, c
+ ld [wTempSGBPacket + $3], a
+ pop bc
+ ld hl, wTempSGBPacket
+ push hl
+ ld a, $21
+ ld [hli], a
+ ld a, $01
+ ld [hli], a
+ ld a, $01
+ ld [hli], a
+ inc hl
+ ld a, b
+ ld [hli], a
+ ld a, c
+ ld [hli], a
+ ld a, $05
+ add b
+ ld [hli], a
+ ld a, $05
+ add c
+ ld [hli], a
+ xor a
+ ld [wTempSGBPacket + $e], a
+ ld [wTempSGBPacket + $f], a
+ pop hl
+ call SendSGB
+ pop de
+ pop bc
+ pop hl
+ ret
+; 0x70498
; send an ATTR_BLK SGB packet
; input:
@@ -502,7 +713,69 @@ Func_704c7: ; 704c7 (1c:44c7)
ret
; 0x704d3
- INCROM $704d3, $7322f
+SGBData_BorderDebug4: ; 704d3 (1c:44d3)
+ dw $800 ; length
+ INCBIN "data/sgb_data/border_debug_4.bin"
+
+SGBData_BorderIntro4: ; 706dd (1c:46dd)
+ dw $800 ; length
+ INCBIN "data/sgb_data/border_intro_4.bin"
+
+SGBData_BorderMedals5: ; 709dc (1c:49dc)
+ dw $800 ; length
+ INCBIN "data/sgb_data/border_medals_5.bin"
+
+SGBBorderDebugGfxPointers: ; 70b96 (1c:4b96)
+ dw SGBData_BorderDebug1
+ dw SGBData_BorderDebug2
+
+SGBData_BorderDebug1: ; 70b9a (1c:45b9a)
+ dw $1000 ; length
+ INCBIN "data/sgb_data/border_debug_1.bin"
+
+SGBData_BorderDebug2: ; 71359 (1c:5359)
+ dw $a0 ; length
+ INCBIN "data/sgb_data/border_debug_2.bin"
+
+SGBBorderIntroGfxPointers: ; 713a9 (1c:53a9)
+ dw SGBData_BorderIntro1
+ dw SGBData_BorderIntro2
+
+SGBData_BorderIntro1: ; 713ad (1c:53ad)
+ dw $1000 ; length
+ INCBIN "data/sgb_data/border_intro_1.bin"
+
+SGBData_BorderIntro2: ; 71ec0 (1c:5ec0)
+ dw $4e0 ; length
+ INCBIN "data/sgb_data/border_intro_2.bin"
+
+SGBBorderMedalsGfxPointers: ; 72273 (1c:6273)
+ dw SGBData_BorderMedals1
+ dw SGBData_BorderMedals2
+
+SGBData_BorderMedals1: ; 72277 (1c:5277)
+ dw $1000 ; length
+ INCBIN "data/sgb_data/border_medals_1.bin"
+
+SGBData_BorderMedals2: ; 72fe4 (1c:5fe4)
+ dw $100 ; length
+ INCBIN "data/sgb_data/border_medals_2.bin"
+
+SGBData_BorderDebug3: ; 730de (1c:70de)
+ dw $60 ; length
+ INCBIN "data/sgb_data/border_debug_3.bin"
+
+SGBData_BorderIntro3: ; 73146 (1c:7146)
+ dw $60 ; length
+ INCBIN "data/sgb_data/border_intro_3.bin"
+
+SGBData_BorderMedals3: ; 7319a (1c:719a)
+ dw $60 ; length
+ INCBIN "data/sgb_data/border_medals_3.bin"
+
+SGBData_BorderMedals4: ; 731e5 (1c:71e5)
+ dw $60 ; length
+ INCBIN "data/sgb_data/border_medals_4.bin"
SGBData_MapPals1: ; 7322f (1c:722f)
dw $20 ; length
@@ -572,7 +845,173 @@ SGBData_LaboratoryBooster: ; 73471 (1c:7471)
dw $20 ; length
INCBIN "data/sgb_data/laboratory_booster_pals.bin"
- INCROM $73496, $73aa8
+SGBData_UnusedPals1: ; 73496 (1c:7496)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_1.bin"
+
+SGBData_UnusedPals2: ; 734bb (1c:74bb)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_2.bin"
+
+SGBData_UnusedPals_3: ; 734e0 (1c:74e0)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_3.bin"
+
+SGBData_UnusedPals_4: ; 73505 (1c:7505)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_4.bin"
+
+SGBData_UnusedPals_5: ; 7352a (1c:752a)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_5.bin"
+
+SGBData_UnusedPals_6: ; 7354f (1c:754f)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_6.bin"
+
+SGBData_UnusedPals_7: ; 73574 (1c:7574)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_7.bin"
+
+SGBData_UnusedPals_8: ; 73599 (1c:7599)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_8.bin"
+
+SGBData_UnusedPals_9: ; 735be (1c:75be)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_9.bin"
+
+SGBData_UnusedPals10: ; 735e3 (1c:75e3)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_10.bin"
+
+SGBData_UnusedPals11: ; 73608 (1c:7608)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_11.bin"
+
+SGBData_UnusedPals12: ; 7362d (1c:762d)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_12.bin"
+
+SGBData_UnusedPals13: ; 73652 (1c:7652)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_13.bin"
+
+SGBData_UnusedPals14: ; 73677 (1c:7677)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_14.bin"
+
+SGBData_UnusedPals15: ; 7369c (1c:769c)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_15.bin"
+
+SGBData_UnusedPals16: ; 736c1 (1c:76c1)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_16.bin"
+
+SGBData_UnusedPals17: ; 736e6 (1c:76e6)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_17.bin"
+
+SGBData_UnusedPals18: ; 7370b (1c:770b)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_18.bin"
+
+SGBData_UnusedPals19: ; 73730 (1c:7730)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_19.bin"
+
+SGBData_UnusedPals20: ; 73755 (1c:7755)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_20.bin"
+
+SGBData_UnusedPals21: ; 7377a (1c:777a)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_21.bin"
+
+SGBData_UnusedPals22: ; 7379f (1c:779f)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_22.bin"
+
+SGBData_UnusedPals23: ; 737c4 (1c:77c4)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_23.bin"
+
+SGBData_UnusedPals24: ; 737e9 (1c:77e9)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_24.bin"
+
+SGBData_UnusedPals25: ; 7380e (1c:780e)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_25.bin"
+
+SGBData_UnusedPals26: ; 73833 (1c:7833)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_26.bin"
+
+SGBData_UnusedPals27: ; 73858 (1c:7858)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_27.bin"
+
+SGBData_UnusedPals28: ; 7387d (1c:787d)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_28.bin"
+
+SGBData_UnusedPals29: ; 738a2 (1c:78a2)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_29.bin"
+
+SGBData_UnusedPals30: ; 738c7 (1c:78c7)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_30.bin"
+
+SGBData_UnusedPals31: ; 738ec (1c:78ec)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_31.bin"
+
+SGBData_UnusedPals32: ; 73911 (1c:7911)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_32.bin"
+
+SGBData_UnusedPals33: ; 73936 (1c:7936)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_33.bin"
+
+SGBData_UnusedPals34: ; 7395b (1c:795b)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_34.bin"
+
+SGBData_UnusedPals35: ; 73980 (1c:7980)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_35.bin"
+
+SGBData_UnusedPals36: ; 739a5 (1c:79a5)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_36.bin"
+
+SGBData_UnusedPals37: ; 739ca (1c:79ca)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_37.bin"
+
+SGBData_UnusedPals38: ; 739ef (1c:79ef)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_38.bin"
+
+SGBData_UnusedPals39: ; 73a14 (1c:7a14)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_39.bin"
+
+SGBData_UnusedPals40: ; 73a39 (1c:7a39)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_40.bin"
+
+SGBData_UnusedPals41: ; 73a5e (1c:7a5e)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_41.bin"
+
+SGBData_UnusedPals42: ; 73a83 (1c:7a83)
+ dw $20 ; length
+ INCBIN "data/sgb_data/unused_pals_42.bin"
SGBData_GameBoyLink: ; 73aa8 (1c:7aa8)
dw $40 ; length
@@ -589,5 +1028,3 @@ SGBData_GameBoyPrinter: ; 73b05 (1c:7b05)
SGBData_TitleScreen: ; 73b33 (1c:7b33)
dw $40 ; length
INCBIN "data/sgb_data/title_screen_pals.bin"
-
- INCROM $73b63, $74000
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 621afd4..b848287 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -4329,7 +4329,7 @@ Func_161e: ; 161e (0:161e)
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, $07
+ ld a, EFFECTCMDTYPE_PKMN_POWER_TRIGGER
call CheckMatchingCommand
ret c ; return if command not found
bank1call DrawDuelMainScene
diff --git a/tools/compressed_data_extractor.py b/tools/compressed_data_extractor.py
index 9756c02..422e887 100644
--- a/tools/compressed_data_extractor.py
+++ b/tools/compressed_data_extractor.py
@@ -7,6 +7,8 @@ parser.add_argument('offsets', metavar='offsets', type=str, nargs='+',
help='start offset(s) of the compressed data')
parser.add_argument('-s', metavar='suffix', dest='suffix', type=str, nargs=1, default=[],
help='suffix for output file names')
+parser.add_argument('-d', dest='decompress', action='store_true',
+ help='whether the output file should be decompressed')
args = parser.parse_args()
@@ -18,10 +20,6 @@ def getByteString(offset, len):
def getByte(offset):
return getByteString(offset, 1)[0]
-def convertOffset(ptrBytes, offset):
- bank = floor(offset / 0x4000)
- return (ptrBytes[0] + (ptrBytes[1] << 8)) + bank * 0x4000 - 0x4000
-
def getFormattedOffset(offset):
return '{:0x}'.format(offset)
@@ -43,9 +41,10 @@ def getCompressedData(offset):
cmdByte = getByte(pos)
pos += 1
data.append(cmdByte)
+ print('{:0x}'.format(cmdByte))
- for b in range(8):
- if (cmdByte & (1 << (7 - b)) != 0):
+ for bit in range(8):
+ if (cmdByte & (1 << (7 - bit)) != 0):
# copy one byte literally
data.append(getByte(pos))
pos += 1
@@ -71,13 +70,91 @@ def getCompressedData(offset):
# the decompression might finish while still
# reading command bits, so break early when this happens
if (size == 0):
+ if not repeatToggle:
+ # extra bytes to match source
+ data.append(getByte(pos))
+ data.append(getByte(pos + 1))
+
break
return bytes(data)
-def outputData(offset, filename):
+def decompressData(source):
+ buffer = [0x00 for i in range(0x100)]
+ sourcePos = 0
+ bufferPos = 0xef
+ lenByte = 0x00
+ repeatToggle = False
+
+ decompData = [] # final decompressed data that will be output
+
+ while True:
+ if sourcePos >= len(source):
+ # got to the end of the data
+ break
+
+ cmdByte = source[sourcePos]
+ sourcePos += 1
+
+ for cmdBit in range(8):
+ if sourcePos >= len(source):
+ # got to the end of the data
+ break
+
+ if (cmdByte & (1 << (7 - cmdBit)) != 0):
+ # copy one byte literally
+ byteToCopy = source[sourcePos]
+
+ decompData.append(byteToCopy)
+ buffer[bufferPos] = byteToCopy
+ sourcePos += 1
+ bufferPos = (bufferPos + 1) % 0x100
+ else:
+ # copy previous sequence
+ repeatToggle = not repeatToggle
+
+ if (repeatToggle):
+ # sequence length
+ offsetToCopy = source[sourcePos]
+ lenByte = source[sourcePos + 1]
+ bytesToCopy = []
+
+ curLen = (lenByte >> 4) + 2
+ for i in range(curLen):
+ buffer[bufferPos] = buffer[offsetToCopy]
+ bytesToCopy.append(buffer[offsetToCopy])
+ offsetToCopy = (offsetToCopy + 1) % 0x100
+ bufferPos = (bufferPos + 1) % 0x100
+
+ decompData.extend(bytesToCopy)
+ sourcePos += 2
+ else:
+ # no sequence length byte if toggle is off
+ offsetToCopy = source[sourcePos]
+ bytesToCopy = []
+
+ curLen = (lenByte & 0x0f) + 2
+ for i in range(curLen):
+ buffer[bufferPos] = buffer[offsetToCopy]
+ bytesToCopy.append(buffer[offsetToCopy])
+ offsetToCopy = (offsetToCopy + 1) % 0x100
+ bufferPos = (bufferPos + 1) % 0x100
+
+ decompData.extend(bytesToCopy)
+ sourcePos += 1
+
+ return bytes(decompData)
+
+def outputData(offset, filename, decompress):
+ comprData = getCompressedData(offset)
+ data = []
+ if decompress:
+ data = decompressData(comprData)
+ else:
+ data = comprData
+
with open(filename + '.bin', 'wb') as outFile:
- outFile.write(getCompressedData(offset))
+ outFile.write(data)
n = 1
for offsetStr in args.offsets:
@@ -87,5 +164,5 @@ for offsetStr in args.offsets:
filename = args.suffix[0]
if (len(args.offsets) > 1):
filename = filename + str(n)
- outputData(offset, filename)
+ outputData(offset, filename, args.decompress)
n += 1