diff --git a/src/data/clear/framesets.asm b/src/data/clear/framesets.asm new file mode 100644 index 0000000..bccc023 --- /dev/null +++ b/src/data/clear/framesets.asm @@ -0,0 +1,89 @@ +Frameset_d5045:: + db $00, 3 + db $01, 3 + db $ff + +Frameset_d504a:: + db $02, 3 + db $03, 3 + db $ff + +Frameset_d504f:: + db $04, 3 + db $05, 3 + db $ff + +Frameset_d5054:: + db $06, 3 + db $07, 3 + db $ff + +Frameset_d5059: + db $08, 4 + db $ff + +Frameset_d505c: + db $09, 4 + db $ff + +Frameset_d505f: + db $0a, 4 + db $ff + +Frameset_d5062: + db $0b, 4 + db $ff + +Frameset_d5065: + db $0c, 4 + db $ff + +Frameset_d5068: + db $0d, 4 + db $ff + +Frameset_d506b: + db $0e, 4 + db $0f, 4 + db $10, 4 + db $10, 4 + db $0f, 4 + db $0e, 4 + db $11, 4 + db $12, 4 + db $12, 4 + db $11, 4 + db $ff + +Frameset_d5080: + db $13, 4 + db $14, 4 + db $15, 4 + db $15, 4 + db $14, 4 + db $13, 4 + db $16, 4 + db $17, 4 + db $17, 4 + db $16, 4 + db $ff + +Frameset_d5095: + db $18, 4 + db $ff + +Frameset_d5098: + db $19, 4 + db $ff + +Frameset_d509b: + db $1a, 4 + db $ff + +Frameset_d509e: + db $1b, 4 + db $ff + +Frameset_d50a1: + db $1c, 4 + db $ff diff --git a/src/data/clear/musical_coin_pals.asm b/src/data/clear/musical_coin_pals.asm new file mode 100644 index 0000000..c5ff584 --- /dev/null +++ b/src/data/clear/musical_coin_pals.asm @@ -0,0 +1,26 @@ +MusicalCoinLevelBGPals: + db 4 ; LEVEL_OUT_OF_THE_WOODS + db 4 ; LEVEL_THE_PEACEFUL_VILLAGE + db 4 ; LEVEL_THE_VAST_PLAIN + db 4 ; LEVEL_BANK_OF_THE_WILD_RIVER + db 4 ; LEVEL_THE_TIDAL_COAST + db 6 ; LEVEL_SEA_TURTLE_ROCKS + db 7 ; LEVEL_DESERT_RUINS + db 6 ; LEVEL_THE_VOLCANOS_BASE + db 7 ; LEVEL_THE_POOL_OF_RAIN + db 7 ; LEVEL_A_TOWN_IN_CHAOS + db 6 ; LEVEL_BENEATH_THE_WAVES + db 6 ; LEVEL_THE_WEST_CRATER + db 6 ; LEVEL_THE_GRASSLANDS + db 7 ; LEVEL_THE_BIG_BRIDGE + db 7 ; LEVEL_TOWER_OF_REVIVAL + db 7 ; LEVEL_THE_STEEP_CANYON + db 7 ; LEVEL_CAVE_OF_FLAMES + db 7 ; LEVEL_ABOVE_THE_CLOUDS + db 7 ; LEVEL_THE_STAGNANT_SWAMP + db 7 ; LEVEL_THE_FRIGID_SEA + db 7 ; LEVEL_CASTLE_OF_ILLUSIONS + db 7 ; LEVEL_THE_COLOSSAL_HOLE + db 7 ; LEVEL_THE_WARPED_VOID + db 7 ; LEVEL_THE_EAST_CRATER + db 7 ; LEVEL_FOREST_OF_FEAR diff --git a/src/data/clear/oam.asm b/src/data/clear/oam.asm new file mode 100644 index 0000000..1d5176d --- /dev/null +++ b/src/data/clear/oam.asm @@ -0,0 +1,231 @@ +OAM_d4e26: + dw .frame_0 + dw .frame_1 + dw .frame_2 + dw .frame_3 + dw .frame_4 + dw .frame_5 + dw .frame_6 + dw .frame_7 + dw .frame_8 + dw .frame_9 + dw .frame_10 + dw .frame_11 + dw .frame_12 + dw .frame_13 + dw .frame_14 + dw .frame_15 + dw .frame_16 + dw .frame_17 + dw .frame_18 + dw .frame_19 + dw .frame_20 + dw .frame_21 + dw .frame_22 + dw .frame_23 + dw .frame_24 + dw .frame_25 + dw .frame_26 + dw .frame_27 + dw .frame_28 + +.frame_0 + frame_oam -16, -8, $90, 7 + frame_oam -16, 0, $92, 7 + frame_oam -16, -12, $ba, 0 + frame_oam -16, 4, $ba, 0 | OAMF_XFLIP + frame_oam -16, -4, $d6, 0 + db $80 + +.frame_1 + frame_oam -16, -8, $90, 7 + frame_oam -16, 0, $92, 7 + frame_oam -16, -12, $b6, 0 + frame_oam -16, 4, $b6, 0 | OAMF_XFLIP + frame_oam -16, -4, $d8, 0 + db $80 + +.frame_2 + frame_oam -16, -8, $94, 7 + frame_oam -16, 0, $96, 7 + frame_oam -16, -12, $ba, 0 + frame_oam -16, 4, $ba, 0 | OAMF_XFLIP + frame_oam -16, -4, $d6, 0 + db $80 + +.frame_3 + frame_oam -16, -8, $94, 7 + frame_oam -16, 0, $96, 7 + frame_oam -16, -12, $b6, 0 + frame_oam -16, 4, $b6, 0 | OAMF_XFLIP + frame_oam -16, -4, $d8, 0 + db $80 + +.frame_4 + frame_oam -16, -8, $98, 7 + frame_oam -16, 0, $9a, 7 + frame_oam -16, -12, $ba, 0 + frame_oam -16, 4, $ba, 0 | OAMF_XFLIP + frame_oam -16, -4, $d6, 0 + db $80 + +.frame_5 + frame_oam -16, -8, $98, 7 + frame_oam -16, 0, $9a, 7 + frame_oam -16, -12, $b6, 0 + frame_oam -16, 4, $b6, 0 | OAMF_XFLIP + frame_oam -16, -4, $d8, 0 + db $80 + +.frame_6 + frame_oam -16, -8, $9c, 7 + frame_oam -16, 0, $9e, 7 + frame_oam -16, -12, $ba, 0 + frame_oam -16, 4, $ba, 0 | OAMF_XFLIP + frame_oam -16, -4, $d6, 0 + db $80 + +.frame_7 + frame_oam -16, -8, $9c, 7 + frame_oam -16, 0, $9e, 7 + frame_oam -16, -12, $b6, 0 + frame_oam -16, 4, $b6, 0 | OAMF_XFLIP + frame_oam -16, -4, $d8, 0 + db $80 + +.frame_8 + frame_oam -34, -12, $d0, 3 + frame_oam -34, -4, $d2, 3 + frame_oam -34, 4, $d4, 3 + frame_oam -18, -14, $f0, 3 + frame_oam -18, -6, $f2, 3 + frame_oam -18, 2, $f4, 3 + frame_oam -18, 10, $f6, 3 + frame_oam -34, 50, $da, 3 + frame_oam -34, 58, $dc, 3 + frame_oam -34, 66, $de, 3 + frame_oam -18, 46, $f8, 3 + frame_oam -18, 54, $fa, 3 + frame_oam -18, 62, $fc, 3 + frame_oam -18, 70, $fe, 3 + db $80 + +.frame_9 + frame_oam -16, -8, $c0, 4 + frame_oam -16, 0, $c2, 4 + db $80 + +.frame_10 + frame_oam -16, -8, $c4, 2 + frame_oam -16, 0, $c6, 2 + db $80 + +.frame_11 + frame_oam -16, -8, $c8, 6 + frame_oam -16, 0, $ca, 6 + db $80 + +.frame_12 + frame_oam -16, -8, $cc, 5 + frame_oam -16, 0, $ce, 5 + db $80 + +.frame_13 + frame_oam -16, -8, $e0, 4 + frame_oam -16, 0, $e2, 4 + db $80 + +.frame_14 + frame_oam -22, -16, $e4, 0 + frame_oam -16, -8, $e6, 0 + frame_oam -16, 0, $e8, 0 + frame_oam -22, 8, $ea, 0 + db $80 + +.frame_15 + frame_oam -24, -16, $e4, 0 + frame_oam -18, -8, $e6, 0 + frame_oam -18, 0, $e8, 0 + frame_oam -24, 8, $ea, 0 + db $80 + +.frame_16 + frame_oam -25, -16, $e4, 0 + frame_oam -19, -8, $e6, 0 + frame_oam -19, 0, $e8, 0 + frame_oam -25, 8, $ea, 0 + db $80 + +.frame_17 + frame_oam -20, -16, $e4, 0 + frame_oam -14, -8, $e6, 0 + frame_oam -14, 0, $e8, 0 + frame_oam -20, 8, $ea, 0 + db $80 + +.frame_18 + frame_oam -19, -16, $e4, 0 + frame_oam -13, -8, $e6, 0 + frame_oam -13, 0, $e8, 0 + frame_oam -19, 8, $ea, 0 + db $80 + +.frame_19 + frame_oam -16, -16, $e0, 0 | OAMF_BANK1 + frame_oam -16, -8, $e2, 0 | OAMF_BANK1 + frame_oam -16, 0, $e4, 0 | OAMF_BANK1 + frame_oam -16, 8, $e6, 0 | OAMF_BANK1 + db $80 + +.frame_20 + frame_oam -18, -16, $e0, 0 | OAMF_BANK1 + frame_oam -18, -8, $e2, 0 | OAMF_BANK1 + frame_oam -18, 0, $e4, 0 | OAMF_BANK1 + frame_oam -18, 8, $e6, 0 | OAMF_BANK1 + db $80 + +.frame_21 + frame_oam -19, -16, $e0, 0 | OAMF_BANK1 + frame_oam -19, -8, $e2, 0 | OAMF_BANK1 + frame_oam -19, 0, $e4, 0 | OAMF_BANK1 + frame_oam -19, 8, $e6, 0 | OAMF_BANK1 + db $80 + +.frame_22 + frame_oam -14, -16, $e0, 0 | OAMF_BANK1 + frame_oam -14, -8, $e2, 0 | OAMF_BANK1 + frame_oam -14, 0, $e4, 0 | OAMF_BANK1 + frame_oam -14, 8, $e6, 0 | OAMF_BANK1 + db $80 + +.frame_23 + frame_oam -13, -16, $e0, 0 | OAMF_BANK1 + frame_oam -13, -8, $e2, 0 | OAMF_BANK1 + frame_oam -13, 0, $e4, 0 | OAMF_BANK1 + frame_oam -13, 8, $e6, 0 | OAMF_BANK1 + db $80 + +.frame_24 + frame_oam -16, -8, $ec, 4 + frame_oam -16, 0, $ee, 4 + db $80 + +.frame_25 + frame_oam -16, -8, $ec, 5 + frame_oam -16, 0, $ee, 5 + db $80 + +.frame_26 + frame_oam -16, -8, $ec, 6 + frame_oam -16, 0, $ee, 6 + db $80 + +.frame_27 + frame_oam -16, -8, $ec, 2 + frame_oam -16, 0, $ee, 2 + db $80 + +.frame_28 + frame_oam -16, -8, $e8, 7 | OAMF_BANK1 + frame_oam -16, -1, $e8, 7 | OAMF_BANK1 | OAMF_XFLIP + db $80 diff --git a/src/data/clear/palettes.asm b/src/data/clear/palettes.asm new file mode 100644 index 0000000..9e38cd6 --- /dev/null +++ b/src/data/clear/palettes.asm @@ -0,0 +1,81 @@ +Pals_d50a4: + rgb 31, 31, 31 + rgb 27, 27, 27 + rgb 22, 22, 22 + rgb 17, 17, 17 + + rgb 31, 21, 19 + rgb 13, 21, 31 + rgb 0, 0, 23 + rgb 0, 0, 0 + + rgb 3, 13, 0 + rgb 21, 31, 14 + rgb 8, 23, 1 + rgb 0, 2, 0 + + rgb 31, 21, 19 + rgb 10, 4, 17 + rgb 30, 8, 4 + rgb 0, 0, 0 + + rgb 31, 29, 15 + rgb 28, 21, 1 + rgb 10, 10, 10 + rgb 0, 4, 0 + + rgb 31, 21, 19 + rgb 0, 0, 29 + rgb 0, 0, 12 + rgb 0, 0, 0 + + rgb 6, 30, 0 + rgb 0, 16, 0 + rgb 0, 10, 0 + rgb 0, 4, 0 + + rgb 6, 30, 0 + rgb 0, 16, 0 + rgb 30, 0, 0 + rgb 0, 4, 0 + +Pals_d50e4: + rgb 0, 22, 16 + rgb 27, 12, 0 + rgb 27, 20, 0 + rgb 0, 0, 0 + + rgb 0, 22, 16 + rgb 31, 31, 31 + rgb 6, 23, 27 + rgb 0, 0, 0 + + rgb 0, 22, 16 + rgb 31, 31, 20 + rgb 31, 27, 0 + rgb 9, 5, 0 + + rgb 0, 22, 16 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 + + rgb 0, 22, 16 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 + + rgb 0, 22, 16 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 + + rgb 0, 22, 16 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 + + rgb 0, 22, 16 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 diff --git a/src/data/clear/pencil_oam.asm b/src/data/clear/pencil_oam.asm new file mode 100644 index 0000000..69b7a73 --- /dev/null +++ b/src/data/clear/pencil_oam.asm @@ -0,0 +1,12 @@ +OAM_d65e1: + dw .frame_0 + +.frame_0 + frame_oam -16, 0, $b6, 0 + frame_oam -16, 8, $b8, 0 + frame_oam -8, 0, $ba, 1 + db $80 + +Frameset_d65f0: + db $00, 4 + db $ff diff --git a/src/data/clear/pencil_offsets.asm b/src/data/clear/pencil_offsets.asm new file mode 100644 index 0000000..8bf0e5a --- /dev/null +++ b/src/data/clear/pencil_offsets.asm @@ -0,0 +1,107 @@ +PencilScribbleXOffsets: + db 0 + db 0 + db 0 + db 0 + db 1 + db 1 + db 1 + db 1 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 1 + db 1 + db 1 + db 1 + db 0 + db 0 + db 0 + db 0 + db -1 + db -1 + db -1 + db -1 + db -1 + db -1 + db -1 + db -1 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 1 + db 1 + db 1 + db 1 + db 1 + db 1 + db 1 + db 1 + db 0 + db 0 + db 0 + db 0 + +PencilScribbleYOffsets: + db 1 + db 1 + db 1 + db 1 + db -1 + db -1 + db -1 + db -1 + db 1 + db 1 + db 1 + db 1 + db 1 + db 1 + db 1 + db 1 + db -1 + db -1 + db -1 + db -1 + db -1 + db -1 + db -1 + db -1 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 1 + db 1 + db 1 + db 1 + db 1 + db 1 + db 1 + db 1 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db -1 + db -1 + db -1 + db -1 diff --git a/src/data/golf/framesets.asm b/src/data/golf/framesets.asm new file mode 100644 index 0000000..e7ff038 --- /dev/null +++ b/src/data/golf/framesets.asm @@ -0,0 +1,150 @@ +Frameset_d4d18: + db $00, 30 + db $ff + +Frameset_d4d1b:: + db $01, 8 + db $02, 8 + db $03, 1 + db $04, 1 + db $05, 1 + db $06, 1 + db $03, 1 + db $04, 1 + db $05, 1 + db $06, 1 + db $03, 1 + db $04, 1 + db $05, 1 + db $06, 1 + db $03, 1 + db $04, 1 + db $05, 1 + db $06, 1 + db $03, 1 + db $04, 1 + db $05, 1 + db $06, 1 + db $03, 1 + db $04, 1 + db $05, 1 + db $06, 1 + db $03, 8 + db $1a, 4 + db $1b, 6 + db $00, 180 + db $ff + +Frameset_d4d58: + db $07, 20 + db $08, 10 + db $09, 10 + db $ff + +Frameset_d4d5f:: + db $0a, 8 + db $0b, 4 + db $0c, 4 + db $0a, 4 + db $0b, 4 + db $0c, 4 + db $0a, 4 + db $0b, 4 + db $0c, 4 + db $0a, 4 + db $0b, 4 + db $0c, 4 + db $0d, 4 + db $0e, 4 + db $0c, 4 + db $0d, 4 + db $0e, 4 + db $0c, 4 + db $0f, 4 + db $10, 4 + db $11, 4 + db $0f, 4 + db $10, 4 + db $11, 4 + db $0a, 4 + db $12, 8 + db $0a, 4 + db $10, 4 + db $11, 4 + db $0f, 4 + db $0d, 30 + db $09, 60 + db $0d, 10 + db $0a, 8 + db $13, 4 + db $14, 4 + db $0a, 4 + db $13, 4 + db $14, 4 + db $0a, 4 + db $13, 4 + db $14, 4 + db $0a, 4 + db $13, 4 + db $14, 4 + db $0d, 4 + db $15, 4 + db $14, 4 + db $0d, 4 + db $15, 4 + db $14, 4 + db $16, 4 + db $17, 4 + db $18, 4 + db $16, 4 + db $17, 4 + db $18, 4 + db $0a, 4 + db $19, 8 + db $0a, 4 + db $17, 4 + db $18, 4 + db $16, 4 + db $0d, 30 + db $0a, 8 + db $0b, 4 + db $ff + +Frameset_d4de4:: + db $0a, 8 + db $0b, 4 + db $0c, 4 + db $0a, 4 + db $0b, 4 + db $0c, 4 + db $0a, 4 + db $0b, 4 + db $0c, 4 + db $0a, 4 + db $0b, 4 + db $0c, 4 + db $0d, 4 + db $0e, 4 + db $0c, 4 + db $0d, 4 + db $0e, 4 + db $0c, 4 + db $0f, 4 + db $10, 4 + db $11, 4 + db $0f, 4 + db $10, 4 + db $11, 4 + db $0a, 4 + db $12, 8 + db $0a, 4 + db $10, 4 + db $11, 4 + db $0f, 4 + db $0d, 30 + db $ff + +; unreferenced +Frameset_d4e23: + db $09, 4 + db $ff diff --git a/src/data/golf/oam.asm b/src/data/golf/oam.asm new file mode 100644 index 0000000..e0693b0 --- /dev/null +++ b/src/data/golf/oam.asm @@ -0,0 +1,303 @@ +OAM_d49cc:: + dw .frame_0 + dw .frame_1 + dw .frame_2 + dw .frame_3 + dw .frame_4 + dw .frame_5 + dw .frame_6 + dw .frame_7 + dw .frame_8 + dw .frame_9 + dw .frame_10 + dw .frame_11 + dw .frame_12 + dw .frame_13 + dw .frame_14 + dw .frame_15 + dw .frame_16 + dw .frame_17 + dw .frame_18 + dw .frame_19 + dw .frame_20 + dw .frame_21 + dw .frame_22 + dw .frame_23 + dw .frame_24 + dw .frame_25 + dw .frame_26 + dw .frame_27 + +.frame_0 + frame_oam -32, -16, $00, 0 + frame_oam -32, -8, $02, 0 + frame_oam -16, -16, $20, 0 + frame_oam -16, -8, $22, 0 + frame_oam -32, 8, $00, 0 | OAMF_XFLIP + frame_oam -32, 0, $02, 0 | OAMF_XFLIP + frame_oam -16, 8, $20, 0 | OAMF_XFLIP + frame_oam -16, 0, $22, 0 | OAMF_XFLIP + db $80 + +.frame_1 + frame_oam -16, -16, $24, 0 + frame_oam -16, -8, $26, 0 + frame_oam -32, -12, $04, 0 + frame_oam -32, -4, $06, 0 + frame_oam -32, 4, $04, 0 | OAMF_XFLIP + frame_oam -16, 8, $24, 0 | OAMF_XFLIP + frame_oam -16, 0, $26, 0 | OAMF_XFLIP + db $80 + +.frame_2 + frame_oam -16, 0, $08, 0 + frame_oam -16, 8, $0a, 0 + frame_oam -32, -12, $04, 0 + frame_oam -32, -4, $06, 0 + frame_oam -32, 4, $04, 0 | OAMF_XFLIP + frame_oam -16, -16, $20, 0 + frame_oam -16, -8, $22, 0 + db $80 + +.frame_3 + frame_oam -32, -12, $54, 0 + frame_oam -32, -4, $56, 0 + frame_oam -16, -16, $5c, 0 + frame_oam -16, -8, $5e, 0 + frame_oam -16, 0, $28, 0 + frame_oam -29, 4, $58, 0 + frame_oam -32, 12, $5a, 0 + db $80 + +.frame_4 + frame_oam -32, -12, $54, 0 + frame_oam -32, -4, $56, 0 + frame_oam -16, -16, $5c, 0 + frame_oam -16, -8, $5e, 0 + frame_oam -16, 0, $28, 0 + frame_oam -29, 4, $58, 0 + frame_oam -32, 12, $5a, 0 + frame_oam -40, 8, $4a, 0 + frame_oam -40, 16, $4a, 0 | OAMF_XFLIP + db $80 + +.frame_5 + frame_oam -29, 4, $58, 0 + frame_oam -32, 12, $5a, 0 + frame_oam -39, 8, $0c, 4 + frame_oam -39, 16, $0c, 4 | OAMF_XFLIP + frame_oam -32, -12, $54, 0 + frame_oam -32, -4, $56, 0 + frame_oam -16, -16, $5c, 0 + frame_oam -16, -8, $5e, 0 + frame_oam -16, 0, $28, 0 + db $80 + +.frame_6 + frame_oam -32, -12, $54, 0 + frame_oam -32, -4, $56, 0 + frame_oam -16, -16, $5c, 0 + frame_oam -16, -8, $5e, 0 + frame_oam -16, 0, $28, 0 + frame_oam -29, 4, $58, 0 + frame_oam -32, 12, $5a, 0 + frame_oam -39, 16, $2c, 4 + frame_oam -39, 8, $2c, 4 | OAMF_XFLIP + db $80 + +.frame_7 + frame_oam -32, 6, $0e, 0 | OAMF_XFLIP + frame_oam -32, -1, $10, 0 | OAMF_XFLIP + frame_oam -32, -9, $12, 0 | OAMF_XFLIP + frame_oam -16, 7, $2e, 0 | OAMF_XFLIP + frame_oam -16, -1, $30, 0 | OAMF_XFLIP + frame_oam -16, -9, $32, 0 | OAMF_XFLIP + frame_oam -21, -17, $14, 0 | OAMF_XFLIP + db $80 + +.frame_8 + frame_oam -16, -8, $36, 0 + frame_oam -16, 0, $36, 0 | OAMF_XFLIP + frame_oam -16, -16, $34, 0 + frame_oam -16, 8, $34, 0 | OAMF_XFLIP + frame_oam -32, 0, $18, 0 | OAMF_XFLIP + frame_oam -32, -8, $1a, 0 | OAMF_XFLIP + frame_oam -32, 7, $0e, 0 | OAMF_XFLIP + frame_oam -32, -16, $0e, 0 + db $80 + +.frame_9 + frame_oam -32, -8, $16, 0 + frame_oam -16, -8, $36, 0 + frame_oam -32, 0, $16, 0 | OAMF_XFLIP + frame_oam -16, 0, $36, 0 | OAMF_XFLIP + frame_oam -16, -16, $34, 0 + frame_oam -16, 8, $34, 0 | OAMF_XFLIP + frame_oam -32, -16, $00, 0 + frame_oam -32, 8, $00, 0 | OAMF_XFLIP + db $80 + +.frame_10 + frame_oam -32, -12, $60, 0 + frame_oam -32, -4, $62, 0 + frame_oam -32, 4, $60, 0 | OAMF_XFLIP + frame_oam -16, -12, $64, 0 + frame_oam -16, -4, $66, 0 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + db $80 + +.frame_11 + frame_oam -32, -12, $60, 0 + frame_oam -32, -4, $62, 0 + frame_oam -32, 4, $60, 0 | OAMF_XFLIP + frame_oam -16, -12, $64, 0 + frame_oam -16, -4, $66, 0 + frame_oam -16, 4, $68, 0 + db $80 + +.frame_12 + frame_oam -32, -12, $60, 0 + frame_oam -32, -4, $62, 0 + frame_oam -32, 4, $60, 0 | OAMF_XFLIP + frame_oam -16, -12, $64, 0 + frame_oam -16, -4, $66, 0 + frame_oam -16, 4, $6a, 0 + db $80 + +.frame_13 + frame_oam -16, -12, $64, 0 + frame_oam -16, -4, $66, 0 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + frame_oam -32, -12, $72, 0 + frame_oam -32, -4, $74, 0 + frame_oam -32, 4, $72, 0 | OAMF_XFLIP + db $80 + +.frame_14 + frame_oam -16, -12, $64, 0 + frame_oam -16, -4, $66, 0 + frame_oam -32, -12, $72, 0 + frame_oam -32, -4, $74, 0 + frame_oam -32, 4, $72, 0 | OAMF_XFLIP + frame_oam -16, 4, $68, 0 + db $80 + +.frame_15 + frame_oam -16, -12, $64, 0 + frame_oam -16, -4, $66, 0 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + frame_oam -32, -12, $6c, 0 + frame_oam -32, -4, $6e, 0 + frame_oam -32, 4, $70, 0 + db $80 + +.frame_16 + frame_oam -16, -12, $64, 0 + frame_oam -16, -4, $66, 0 + frame_oam -32, -12, $6c, 0 + frame_oam -32, -4, $6e, 0 + frame_oam -32, 4, $70, 0 + frame_oam -16, 4, $68, 0 + db $80 + +.frame_17 + frame_oam -16, -12, $64, 0 + frame_oam -16, -4, $66, 0 + frame_oam -32, -12, $6c, 0 + frame_oam -32, -4, $6e, 0 + frame_oam -32, 4, $70, 0 + frame_oam -16, 4, $6a, 0 + db $80 + +.frame_18 + frame_oam -16, -12, $64, 0 + frame_oam -16, -4, $66, 0 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + frame_oam -32, 4, $6c, 0 | OAMF_XFLIP + frame_oam -32, -4, $6e, 0 | OAMF_XFLIP + frame_oam -32, -12, $70, 0 | OAMF_XFLIP + db $80 + +.frame_19 + frame_oam -32, 4, $60, 0 | OAMF_XFLIP + frame_oam -32, -4, $62, 0 | OAMF_XFLIP + frame_oam -32, -12, $60, 0 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + frame_oam -16, -4, $66, 0 | OAMF_XFLIP + frame_oam -16, -12, $68, 0 | OAMF_XFLIP + db $80 + +.frame_20 + frame_oam -32, 4, $60, 0 | OAMF_XFLIP + frame_oam -32, -4, $62, 0 | OAMF_XFLIP + frame_oam -32, -12, $60, 0 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + frame_oam -16, -4, $66, 0 | OAMF_XFLIP + frame_oam -16, -12, $6a, 0 | OAMF_XFLIP + db $80 + +.frame_21 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + frame_oam -16, -4, $66, 0 | OAMF_XFLIP + frame_oam -32, 4, $72, 0 | OAMF_XFLIP + frame_oam -32, -4, $74, 0 | OAMF_XFLIP + frame_oam -32, -12, $72, 0 + frame_oam -16, -12, $68, 0 | OAMF_XFLIP + db $80 + +.frame_22 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + frame_oam -16, -4, $66, 0 | OAMF_XFLIP + frame_oam -16, -12, $64, 0 + frame_oam -32, 4, $6c, 0 | OAMF_XFLIP + frame_oam -32, -4, $6e, 0 | OAMF_XFLIP + frame_oam -32, -12, $70, 0 | OAMF_XFLIP + db $80 + +.frame_23 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + frame_oam -16, -4, $66, 0 | OAMF_XFLIP + frame_oam -32, 4, $6c, 0 | OAMF_XFLIP + frame_oam -32, -4, $6e, 0 | OAMF_XFLIP + frame_oam -32, -12, $70, 0 | OAMF_XFLIP + frame_oam -16, -12, $68, 0 | OAMF_XFLIP + db $80 + +.frame_24 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + frame_oam -16, -4, $66, 0 | OAMF_XFLIP + frame_oam -32, 4, $6c, 0 | OAMF_XFLIP + frame_oam -32, -4, $6e, 0 | OAMF_XFLIP + frame_oam -32, -12, $70, 0 | OAMF_XFLIP + frame_oam -16, -12, $6a, 0 | OAMF_XFLIP + db $80 + +.frame_25 + frame_oam -16, 4, $64, 0 | OAMF_XFLIP + frame_oam -16, -4, $66, 0 | OAMF_XFLIP + frame_oam -16, -12, $64, 0 + frame_oam -32, -12, $6c, 0 + frame_oam -32, -4, $6e, 0 + frame_oam -32, 4, $70, 0 + db $80 + +.frame_26 + frame_oam -32, -12, $54, 0 + frame_oam -32, -4, $56, 0 + frame_oam -16, -16, $5c, 0 + frame_oam -16, -8, $5e, 0 + frame_oam -16, 0, $28, 0 + frame_oam -16, 8, $2a, 0 + frame_oam -32, 4, $76, 0 + frame_oam -32, 12, $78, 0 + db $80 + +.frame_27 + frame_oam -16, -16, $5c, 0 + frame_oam -16, -8, $5e, 0 + frame_oam -16, 0, $28, 0 + frame_oam -32, -12, $54, 0 + frame_oam -32, 4, $7a, 0 + frame_oam -32, -4, $56, 0 + frame_oam -16, 8, $7c, 0 + db $80 diff --git a/src/data/levels/common/framesets.asm b/src/data/levels/common/framesets.asm new file mode 100644 index 0000000..a7084ff --- /dev/null +++ b/src/data/levels/common/framesets.asm @@ -0,0 +1,28 @@ +Frameset_d8e7: + db $00, 5 + db $01, 5 + db $02, 5 + db $03, 5 + db $04, 5 + db $05, 5 + db $ff + +Frameset_d8f4: + db $06, 7 + db $07, 7 + db $08, 7 + db $09, 7 + db $0a, 7 + db $0b, 7 + db $ff + +Frameset_d901: + db $0c, 2 + db $0d, 1 + db $0e, 1 + db $0d, 2 + db $11, 1 + db $10, 2 + db $0f, 1 + db $10, 2 + db $ff diff --git a/src/engine/bank3.asm b/src/data/levels/common/oam.asm similarity index 97% rename from src/engine/bank3.asm rename to src/data/levels/common/oam.asm index a322562..177190c 100644 --- a/src/engine/bank3.asm +++ b/src/data/levels/common/oam.asm @@ -1,16 +1,3 @@ -Pals_d1fe: - rgb 0, 22, 16 - rgb 28, 31, 29 - rgb 30, 23, 0 - rgb 4, 5, 0 - -; unreferenced -Pals_d206: - rgb 0, 22, 16 - rgb 31, 31, 0 - rgb 31, 14, 0 - rgb 5, 2, 0 - OAM_d20e:: dw .frame_0 dw .frame_1 @@ -953,32 +940,3 @@ OAM_d80d: .frame_17 frame_oam -32, -4, $50, 1 db $80 - -Frameset_d8e7: - db $00, 5 - db $01, 5 - db $02, 5 - db $03, 5 - db $04, 5 - db $05, 5 - db $ff - -Frameset_d8f4: - db $06, 7 - db $07, 7 - db $08, 7 - db $09, 7 - db $0a, 7 - db $0b, 7 - db $ff - -Frameset_d901: - db $0c, 2 - db $0d, 1 - db $0e, 1 - db $0d, 2 - db $11, 1 - db $10, 2 - db $0f, 1 - db $10, 2 - db $ff diff --git a/src/data/levels/common/palettes.asm b/src/data/levels/common/palettes.asm new file mode 100644 index 0000000..2cad0d2 --- /dev/null +++ b/src/data/levels/common/palettes.asm @@ -0,0 +1,12 @@ +Pals_d1fe: + rgb 0, 22, 16 + rgb 28, 31, 29 + rgb 30, 23, 0 + rgb 4, 5, 0 + +; unreferenced +Pals_d206: + rgb 0, 22, 16 + rgb 31, 31, 0 + rgb 31, 14, 0 + rgb 5, 2, 0 diff --git a/src/data/levels/level_headers.asm b/src/data/levels/level_headers.asm new file mode 100644 index 0000000..801238f --- /dev/null +++ b/src/data/levels/level_headers.asm @@ -0,0 +1,321 @@ +LevelHeaders:: + dw .out_of_the_woods ; OUT_OF_THE_WOODS_DAY_1 + dw .out_of_the_woods ; OUT_OF_THE_WOODS_DAY_2 + dw .out_of_the_woods ; OUT_OF_THE_WOODS_DAY_3 + dw .out_of_the_woods ; OUT_OF_THE_WOODS_DAY_4 + dw .out_of_the_woods ; OUT_OF_THE_WOODS_NIGHT_1 + dw .out_of_the_woods ; OUT_OF_THE_WOODS_NIGHT_2 + dw .out_of_the_woods ; OUT_OF_THE_WOODS_NIGHT_3 + dw .out_of_the_woods ; OUT_OF_THE_WOODS_NIGHT_4 + dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_DAY_1 + dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_DAY_2 + dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_DAY_3 + dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_DAY_4 + dw .the_peaceful_village_2 ; THE_PEACEFUL_VILLAGE_NIGHT_1 + dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_NIGHT_2 + dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_NIGHT_3 + dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_NIGHT_4 + dw .the_vast_plain_1 ; THE_VAST_PLAIN_DAY_1 + dw .the_vast_plain_1 ; THE_VAST_PLAIN_DAY_2 + dw .the_vast_plain_2 ; THE_VAST_PLAIN_DAY_3 + dw .the_vast_plain_2 ; THE_VAST_PLAIN_DAY_4 + dw .the_vast_plain_1 ; THE_VAST_PLAIN_NIGHT_1 + dw .the_vast_plain_1 ; THE_VAST_PLAIN_NIGHT_2 + dw .the_vast_plain_2 ; THE_VAST_PLAIN_NIGHT_3 + dw .the_vast_plain_2 ; THE_VAST_PLAIN_NIGHT_4 + dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_DAY_1 + dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_DAY_2 + dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_DAY_3 + dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_DAY_4 + dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_NIGHT_1 + dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_NIGHT_2 + dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_NIGHT_3 + dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_NIGHT_4 + dw .the_tidal_coast_1 ; THE_TIDAL_COAST_DAY_1 + dw .the_tidal_coast_1 ; THE_TIDAL_COAST_DAY_2 + dw .the_tidal_coast_1 ; THE_TIDAL_COAST_DAY_3 + dw .the_tidal_coast_1 ; THE_TIDAL_COAST_DAY_4 + dw .the_tidal_coast_2 ; THE_TIDAL_COAST_NIGHT_1 + dw .the_tidal_coast_2 ; THE_TIDAL_COAST_NIGHT_2 + dw .the_tidal_coast_2 ; THE_TIDAL_COAST_NIGHT_3 + dw .the_tidal_coast_2 ; THE_TIDAL_COAST_NIGHT_4 + dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_DAY_1 + dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_DAY_2 + dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_DAY_3 + dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_DAY_4 + dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_NIGHT_1 + dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_NIGHT_2 + dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_NIGHT_3 + dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_NIGHT_4 + dw .desert_ruins ; DESERT_RUINS_DAY_1 + dw .desert_ruins ; DESERT_RUINS_DAY_2 + dw .desert_ruins ; DESERT_RUINS_DAY_3 + dw .desert_ruins ; DESERT_RUINS_DAY_4 + dw .desert_ruins ; DESERT_RUINS_NIGHT_1 + dw .desert_ruins ; DESERT_RUINS_NIGHT_2 + dw .desert_ruins ; DESERT_RUINS_NIGHT_3 + dw .desert_ruins ; DESERT_RUINS_NIGHT_4 + dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_DAY_1 + dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_DAY_2 + dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_DAY_3 + dw .the_volcanos_base_2 ; THE_VOLCANOS_BASE_DAY_4 + dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_NIGHT_1 + dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_NIGHT_2 + dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_NIGHT_3 + dw .the_volcanos_base_2 ; THE_VOLCANOS_BASE_NIGHT_4 + dw .the_pool_of_rain_1 ; THE_POOL_OF_RAIN_DAY_1 + dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_DAY_2 + dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_DAY_3 + dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_DAY_4 + dw .the_pool_of_rain_1 ; THE_POOL_OF_RAIN_NIGHT_1 + dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_NIGHT_2 + dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_NIGHT_3 + dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_NIGHT_4 + dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_DAY_1 + dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_DAY_2 + dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_DAY_3 + dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_DAY_4 + dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_NIGHT_1 + dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_NIGHT_2 + dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_NIGHT_3 + dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_NIGHT_4 + dw .beneath_the_waves ; BENEATH_THE_WAVES_DAY_1 + dw .beneath_the_waves ; BENEATH_THE_WAVES_DAY_2 + dw .beneath_the_waves ; BENEATH_THE_WAVES_DAY_3 + dw .beneath_the_waves ; BENEATH_THE_WAVES_DAY_4 + dw .beneath_the_waves ; BENEATH_THE_WAVES_NIGHT_1 + dw .beneath_the_waves ; BENEATH_THE_WAVES_NIGHT_2 + dw .beneath_the_waves ; BENEATH_THE_WAVES_NIGHT_3 + dw .beneath_the_waves ; BENEATH_THE_WAVES_NIGHT_4 + dw .the_west_crater ; THE_WEST_CRATER_DAY_1 + dw .the_west_crater ; THE_WEST_CRATER_DAY_2 + dw .the_west_crater ; THE_WEST_CRATER_DAY_3 + dw .the_west_crater ; THE_WEST_CRATER_DAY_4 + dw .the_west_crater ; THE_WEST_CRATER_NIGHT_1 + dw .the_west_crater ; THE_WEST_CRATER_NIGHT_2 + dw .the_west_crater ; THE_WEST_CRATER_NIGHT_3 + dw .the_west_crater ; THE_WEST_CRATER_NIGHT_4 + dw .the_grasslands ; THE_GRASSLANDS_DAY_1 + dw .the_grasslands ; THE_GRASSLANDS_DAY_2 + dw .the_grasslands ; THE_GRASSLANDS_DAY_3 + dw .the_grasslands ; THE_GRASSLANDS_DAY_4 + dw .the_grasslands ; THE_GRASSLANDS_NIGHT_1 + dw .the_grasslands ; THE_GRASSLANDS_NIGHT_2 + dw .the_grasslands ; THE_GRASSLANDS_NIGHT_3 + dw .the_grasslands ; THE_GRASSLANDS_NIGHT_4 + dw .the_big_bridge ; THE_BIG_BRIDGE_DAY_1 + dw .the_big_bridge ; THE_BIG_BRIDGE_DAY_2 + dw .the_big_bridge ; THE_BIG_BRIDGE_DAY_3 + dw .the_big_bridge ; THE_BIG_BRIDGE_DAY_4 + dw .the_big_bridge ; THE_BIG_BRIDGE_NIGHT_1 + dw .the_big_bridge ; THE_BIG_BRIDGE_NIGHT_2 + dw .the_big_bridge ; THE_BIG_BRIDGE_NIGHT_3 + dw .the_big_bridge ; THE_BIG_BRIDGE_NIGHT_4 + dw .tower_of_revival ; TOWER_OF_REVIVAL_DAY_1 + dw .tower_of_revival ; TOWER_OF_REVIVAL_DAY_2 + dw .tower_of_revival ; TOWER_OF_REVIVAL_DAY_3 + dw .tower_of_revival ; TOWER_OF_REVIVAL_DAY_4 + dw .tower_of_revival ; TOWER_OF_REVIVAL_NIGHT_1 + dw .tower_of_revival ; TOWER_OF_REVIVAL_NIGHT_2 + dw .tower_of_revival ; TOWER_OF_REVIVAL_NIGHT_3 + dw .tower_of_revival ; TOWER_OF_REVIVAL_NIGHT_4 + dw .the_steep_canyon_1 ; THE_STEEP_CANYON_DAY_1 + dw .the_steep_canyon_2 ; THE_STEEP_CANYON_DAY_2 + dw .the_steep_canyon_2 ; THE_STEEP_CANYON_DAY_3 + dw .the_steep_canyon_2 ; THE_STEEP_CANYON_DAY_4 + dw .the_steep_canyon_1 ; THE_STEEP_CANYON_NIGHT_1 + dw .the_steep_canyon_2 ; THE_STEEP_CANYON_NIGHT_2 + dw .the_steep_canyon_2 ; THE_STEEP_CANYON_NIGHT_3 + dw .the_steep_canyon_2 ; THE_STEEP_CANYON_NIGHT_4 + dw .cave_of_flames ; CAVE_OF_FLAMES_DAY_1 + dw .cave_of_flames ; CAVE_OF_FLAMES_DAY_2 + dw .cave_of_flames ; CAVE_OF_FLAMES_DAY_3 + dw .cave_of_flames ; CAVE_OF_FLAMES_DAY_4 + dw .cave_of_flames ; CAVE_OF_FLAMES_NIGHT_1 + dw .cave_of_flames ; CAVE_OF_FLAMES_NIGHT_2 + dw .cave_of_flames ; CAVE_OF_FLAMES_NIGHT_3 + dw .cave_of_flames ; CAVE_OF_FLAMES_NIGHT_4 + dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_DAY_1 + dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_DAY_2 + dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_DAY_3 + dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_DAY_4 + dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_NIGHT_1 + dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_NIGHT_2 + dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_NIGHT_3 + dw .above_the_clouds_2 ; ABOVE_THE_CLOUDS_NIGHT_4 + dw .the_stagnant_swamp_1 ; THE_STAGNANT_SWAMP_DAY_1 + dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_DAY_2 + dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_DAY_3 + dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_DAY_4 + dw .the_stagnant_swamp_1 ; THE_STAGNANT_SWAMP_NIGHT_1 + dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_NIGHT_2 + dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_NIGHT_3 + dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_NIGHT_4 + dw .the_frigid_sea ; THE_FRIGID_SEA_DAY_1 + dw .the_frigid_sea ; THE_FRIGID_SEA_DAY_2 + dw .the_frigid_sea ; THE_FRIGID_SEA_DAY_3 + dw .the_frigid_sea ; THE_FRIGID_SEA_DAY_4 + dw .the_frigid_sea ; THE_FRIGID_SEA_NIGHT_1 + dw .the_frigid_sea ; THE_FRIGID_SEA_NIGHT_2 + dw .the_frigid_sea ; THE_FRIGID_SEA_NIGHT_3 + dw .the_frigid_sea ; THE_FRIGID_SEA_NIGHT_4 + dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_DAY_1 + dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_DAY_2 + dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_DAY_3 + dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_DAY_4 + dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_NIGHT_1 + dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_NIGHT_2 + dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_NIGHT_3 + dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_NIGHT_4 + dw .the_colossal_hole_1 ; THE_COLOSSAL_HOLE_DAY_1 + dw .the_colossal_hole_1 ; THE_COLOSSAL_HOLE_DAY_2 + dw .the_colossal_hole_1 ; THE_COLOSSAL_HOLE_DAY_3 + dw .the_colossal_hole_1 ; THE_COLOSSAL_HOLE_DAY_4 + dw .the_colossal_hole_2 ; THE_COLOSSAL_HOLE_NIGHT_1 + dw .the_colossal_hole_2 ; THE_COLOSSAL_HOLE_NIGHT_2 + dw .the_colossal_hole_2 ; THE_COLOSSAL_HOLE_NIGHT_3 + dw .the_colossal_hole_2 ; THE_COLOSSAL_HOLE_NIGHT_4 + dw .the_warped_void ; THE_WARPED_VOID_DAY_1 + dw .the_warped_void ; THE_WARPED_VOID_DAY_2 + dw .the_warped_void ; THE_WARPED_VOID_DAY_3 + dw .the_warped_void ; THE_WARPED_VOID_DAY_4 + dw .the_warped_void ; THE_WARPED_VOID_NIGHT_1 + dw .the_warped_void ; THE_WARPED_VOID_NIGHT_2 + dw .the_warped_void ; THE_WARPED_VOID_NIGHT_3 + dw .the_warped_void ; THE_WARPED_VOID_NIGHT_4 + dw .the_east_crater ; THE_EAST_CRATER_DAY_1 + dw .the_east_crater ; THE_EAST_CRATER_DAY_2 + dw .the_east_crater ; THE_EAST_CRATER_DAY_3 + dw .the_east_crater ; THE_EAST_CRATER_DAY_4 + dw .the_east_crater ; THE_EAST_CRATER_NIGHT_1 + dw .the_east_crater ; THE_EAST_CRATER_NIGHT_2 + dw .the_east_crater ; THE_EAST_CRATER_NIGHT_3 + dw .the_east_crater ; THE_EAST_CRATER_NIGHT_4 + dw .forest_of_fear ; FOREST_OF_FEAR_DAY_1 + dw .forest_of_fear ; FOREST_OF_FEAR_DAY_2 + dw .forest_of_fear ; FOREST_OF_FEAR_DAY_3 + dw .forest_of_fear ; FOREST_OF_FEAR_DAY_4 + dw .forest_of_fear ; FOREST_OF_FEAR_NIGHT_1 + dw .forest_of_fear ; FOREST_OF_FEAR_NIGHT_2 + dw .forest_of_fear ; FOREST_OF_FEAR_NIGHT_3 + dw .forest_of_fear ; FOREST_OF_FEAR_NIGHT_4 + dw .the_temple ; THE_TEMPLE + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + +.out_of_the_woods + dab OutOfTheWoodsBlockMap + dw OutOfTheWoodsObjectMap +.the_peaceful_village_1 + dab ThePeacefulVillage1BlockMap + dw ThePeacefulVillage1ObjectMap +.the_vast_plain_1 + dab TheVastPlain1BlockMap + dw TheVastPlain1ObjectMap +.bank_of_the_wild_river + dab BankOfTheWildRiverBlockMap + dw BankOfTheWildRiverObjectMap +.the_tidal_coast_1 + dab TheTidalCoast1BlockMap + dw TheTidalCoast1ObjectMap +.sea_turtle_rocks + dab SeaTurtleRocksBlockMap + dw SeaTurtleRocksObjectMap +.desert_ruins + dab DesertRuinsBlockMap + dw DesertRuinsObjectMap +.the_volcanos_base_1 + dab TheVolcanosBase1BlockMap + dw TheVolcanosBase1ObjectMap +.the_pool_of_rain_1 + dab ThePoolOfRain1BlockMap + dw ThePoolOfRain1ObjectMap +.a_town_in_chaos + dab ATownInChaosBlockMap + dw ATownInChaosObjectMap +.beneath_the_waves + dab BeneathTheWavesBlockMap + dw BeneathTheWavesObjectMap +.the_west_crater + dab TheWestCraterBlockMap + dw TheWestCraterObjectMap +.the_grasslands + dab TheGrasslandsBlockMap + dw TheGrasslandsObjectMap +.the_big_bridge + dab TheBigBridgeBlockMap + dw TheBigBridgeObjectMap +.tower_of_revival + dab TowerOfRevivalBlockMap + dw TowerOfRevivalObjectMap +.the_steep_canyon_1 + dab TheSteepCanyon1BlockMap + dw TheSteepCanyon1ObjectMap +.cave_of_flames + dab CaveOfFlamesBlockMap + dw CaveOfFlamesObjectMap +.above_the_clouds_1 + dab AboveTheClouds1BlockMap + dw AboveTheClouds1ObjectMap +.the_stagnant_swamp_1 + dab TheStagnantSwamp1BlockMap + dw TheStagnantSwamp1ObjectMap +.the_frigid_sea + dab TheFrigidSeaBlockMap + dw TheFrigidSeaObjectMap +.castle_of_illusions + dab CastleOfIllusionsBlockMap + dw CastleOfIllusionsObjectMap +.the_colossal_hole_1 + dab TheColossalHole1BlockMap + dw TheColossalHole1ObjectMap +.the_warped_void + dab TheWarpedVoidBlockMap + dw TheWarpedVoidObjectMap +.the_east_crater + dab TheEastCraterBlockMap + dw TheEastCraterObjectMap +.forest_of_fear + dab ForestOfFearBlockMap + dw ForestOfFearObjectMap +.the_temple + dab HiddenFigureRoomBlockMap + dw HiddenFigureRoomObjectMap +.the_vast_plain_2 + dab TheVastPlain2BlockMap + dw TheVastPlain2ObjectMap +.the_volcanos_base_2 + dab TheVolcanosBase2BlockMap + dw TheVolcanosBase2ObjectMap +.the_pool_of_rain_2 + dab ThePoolOfRain2BlockMap + dw ThePoolOfRain2ObjectMap +.the_colossal_hole_2 + dab TheColossalHole2BlockMap + dw TheColossalHole2ObjectMap +.the_tidal_coast_2 + dab TheTidalCoast2BlockMap + dw TheTidalCoast2ObjectMap +.the_stagnant_swamp_2 + dab TheStagnantSwamp2BlockMap + dw TheStagnantSwamp2ObjectMap +.above_the_clouds_2 + dab AboveTheClouds2BlockMap + dw AboveTheClouds2ObjectMap +.the_steep_canyon_2 + dab TheSteepCanyon2BlockMap + dw TheSteepCanyon2ObjectMap +.the_peaceful_village_2 + dab ThePeacefulVillage2BlockMap + dw ThePeacefulVillage2ObjectMap diff --git a/src/engine/bank30.asm b/src/data/levels/rooms1.asm similarity index 92% rename from src/engine/bank30.asm rename to src/data/levels/rooms1.asm index f9c1b37..594072e 100644 --- a/src/engine/bank30.asm +++ b/src/data/levels/rooms1.asm @@ -1,432 +1,4 @@ -; loads a room's function table, tilemap -; main and special tiles and its palettes -LoadRoomGfx:: - ld d, $00 - ld a, [wRoom] - add a - ld e, a - rl d - ld hl, RoomBlockAndGfxData - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - ld a, h - debug_assert_not $ff - ld a, [hli] - ld [wRoomBlockFunctionTable], a - ld a, [hli] - ld [wRoomTileMap], a - ld a, [hli] - ld [wRoomMainTiles], a - ld a, [hli] - ld [wRoomSpecialTiles], a - ld a, [hl] - ld [wRoomPalettes], a - -; divide wRoomBlockFunctionTable by 6 - ld b, 0 - ld a, [wRoomBlockFunctionTable] -.loop - sub $6 - jr c, .div_done - inc b - jr .loop -.div_done - ld a, BANK("Level Data 1") - add b - ld [wRoomBlockFunctionTableBank], a - call Func_298d - call LoadBlockFunctionTable - ld a, [wRoomBlockFunctionTableBank] - ld [wc0d0], a - call LoadRoomTileMap - - ld a, [wRoomMainTiles] - srl a - srl a - srl a ; /8 - add BANK("Room Main Tiles 1") - ld [wRoomMainTilesBank], a - call LoadRoomMainTiles - - ld a, [wRoomSpecialTiles] - srl a - srl a - srl a ; /8 - add BANK("Room Special Tiles 1") - ld [wRoomSpecialTilesBank], a - call LoadRoomSpecialTiles - - ld a, BANK("Level Palettes") - ld [wPaletteBank], a - call LoadRoomPalettes - ret - -InitRoomAnimatedTiles:: - ld hl, AnimatedTilesGroups - ld d, $00 - ld a, [wAnimatedTilesGroup] - add a ; *2 - ld e, a - rl d - add hl, de - ld a, [hli] - ld [wAnimatedTilesFrameDuration], a - ld a, [hl] - ld [wAnimatedTilesGfx], a - xor a - ld [wAnimatedTilesFrame], a - ld [wAnimatedTilesFrameCount], a - ret - -InitRoomAnimatedPals:: - ld hl, RoomPalCycles - ld d, $00 - ld a, [wRoomPalCycle] - add a ; *2 - ld e, a - rl d - add hl, de - ld a, [hli] - ld [wRoomPalCyclePtr + 1], a - ld a, [hld] - ld [wRoomPalCyclePtr + 0], a - ld l, [hl] - ld h, a - ld de, ROOM_PAL_CYCLE_LENGTH - add hl, de - ld a, [hl] - ld [wRoomPalCycleDuration], a - srl a ; /2 - ld [wRoomPalCycleCounter], a - xor a - ld [wRoomPalCycleIndex], a - ret - -LevelHeaders:: - dw .out_of_the_woods ; OUT_OF_THE_WOODS_DAY_1 - dw .out_of_the_woods ; OUT_OF_THE_WOODS_DAY_2 - dw .out_of_the_woods ; OUT_OF_THE_WOODS_DAY_3 - dw .out_of_the_woods ; OUT_OF_THE_WOODS_DAY_4 - dw .out_of_the_woods ; OUT_OF_THE_WOODS_NIGHT_1 - dw .out_of_the_woods ; OUT_OF_THE_WOODS_NIGHT_2 - dw .out_of_the_woods ; OUT_OF_THE_WOODS_NIGHT_3 - dw .out_of_the_woods ; OUT_OF_THE_WOODS_NIGHT_4 - dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_DAY_1 - dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_DAY_2 - dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_DAY_3 - dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_DAY_4 - dw .the_peaceful_village_2 ; THE_PEACEFUL_VILLAGE_NIGHT_1 - dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_NIGHT_2 - dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_NIGHT_3 - dw .the_peaceful_village_1 ; THE_PEACEFUL_VILLAGE_NIGHT_4 - dw .the_vast_plain_1 ; THE_VAST_PLAIN_DAY_1 - dw .the_vast_plain_1 ; THE_VAST_PLAIN_DAY_2 - dw .the_vast_plain_2 ; THE_VAST_PLAIN_DAY_3 - dw .the_vast_plain_2 ; THE_VAST_PLAIN_DAY_4 - dw .the_vast_plain_1 ; THE_VAST_PLAIN_NIGHT_1 - dw .the_vast_plain_1 ; THE_VAST_PLAIN_NIGHT_2 - dw .the_vast_plain_2 ; THE_VAST_PLAIN_NIGHT_3 - dw .the_vast_plain_2 ; THE_VAST_PLAIN_NIGHT_4 - dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_DAY_1 - dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_DAY_2 - dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_DAY_3 - dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_DAY_4 - dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_NIGHT_1 - dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_NIGHT_2 - dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_NIGHT_3 - dw .bank_of_the_wild_river ; BANK_OF_THE_WILD_RIVER_NIGHT_4 - dw .the_tidal_coast_1 ; THE_TIDAL_COAST_DAY_1 - dw .the_tidal_coast_1 ; THE_TIDAL_COAST_DAY_2 - dw .the_tidal_coast_1 ; THE_TIDAL_COAST_DAY_3 - dw .the_tidal_coast_1 ; THE_TIDAL_COAST_DAY_4 - dw .the_tidal_coast_2 ; THE_TIDAL_COAST_NIGHT_1 - dw .the_tidal_coast_2 ; THE_TIDAL_COAST_NIGHT_2 - dw .the_tidal_coast_2 ; THE_TIDAL_COAST_NIGHT_3 - dw .the_tidal_coast_2 ; THE_TIDAL_COAST_NIGHT_4 - dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_DAY_1 - dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_DAY_2 - dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_DAY_3 - dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_DAY_4 - dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_NIGHT_1 - dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_NIGHT_2 - dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_NIGHT_3 - dw .sea_turtle_rocks ; SEA_TURTLE_ROCKS_NIGHT_4 - dw .desert_ruins ; DESERT_RUINS_DAY_1 - dw .desert_ruins ; DESERT_RUINS_DAY_2 - dw .desert_ruins ; DESERT_RUINS_DAY_3 - dw .desert_ruins ; DESERT_RUINS_DAY_4 - dw .desert_ruins ; DESERT_RUINS_NIGHT_1 - dw .desert_ruins ; DESERT_RUINS_NIGHT_2 - dw .desert_ruins ; DESERT_RUINS_NIGHT_3 - dw .desert_ruins ; DESERT_RUINS_NIGHT_4 - dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_DAY_1 - dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_DAY_2 - dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_DAY_3 - dw .the_volcanos_base_2 ; THE_VOLCANOS_BASE_DAY_4 - dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_NIGHT_1 - dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_NIGHT_2 - dw .the_volcanos_base_1 ; THE_VOLCANOS_BASE_NIGHT_3 - dw .the_volcanos_base_2 ; THE_VOLCANOS_BASE_NIGHT_4 - dw .the_pool_of_rain_1 ; THE_POOL_OF_RAIN_DAY_1 - dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_DAY_2 - dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_DAY_3 - dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_DAY_4 - dw .the_pool_of_rain_1 ; THE_POOL_OF_RAIN_NIGHT_1 - dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_NIGHT_2 - dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_NIGHT_3 - dw .the_pool_of_rain_2 ; THE_POOL_OF_RAIN_NIGHT_4 - dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_DAY_1 - dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_DAY_2 - dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_DAY_3 - dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_DAY_4 - dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_NIGHT_1 - dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_NIGHT_2 - dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_NIGHT_3 - dw .a_town_in_chaos ; A_TOWN_IN_CHAOS_NIGHT_4 - dw .beneath_the_waves ; BENEATH_THE_WAVES_DAY_1 - dw .beneath_the_waves ; BENEATH_THE_WAVES_DAY_2 - dw .beneath_the_waves ; BENEATH_THE_WAVES_DAY_3 - dw .beneath_the_waves ; BENEATH_THE_WAVES_DAY_4 - dw .beneath_the_waves ; BENEATH_THE_WAVES_NIGHT_1 - dw .beneath_the_waves ; BENEATH_THE_WAVES_NIGHT_2 - dw .beneath_the_waves ; BENEATH_THE_WAVES_NIGHT_3 - dw .beneath_the_waves ; BENEATH_THE_WAVES_NIGHT_4 - dw .the_west_crater ; THE_WEST_CRATER_DAY_1 - dw .the_west_crater ; THE_WEST_CRATER_DAY_2 - dw .the_west_crater ; THE_WEST_CRATER_DAY_3 - dw .the_west_crater ; THE_WEST_CRATER_DAY_4 - dw .the_west_crater ; THE_WEST_CRATER_NIGHT_1 - dw .the_west_crater ; THE_WEST_CRATER_NIGHT_2 - dw .the_west_crater ; THE_WEST_CRATER_NIGHT_3 - dw .the_west_crater ; THE_WEST_CRATER_NIGHT_4 - dw .the_grasslands ; THE_GRASSLANDS_DAY_1 - dw .the_grasslands ; THE_GRASSLANDS_DAY_2 - dw .the_grasslands ; THE_GRASSLANDS_DAY_3 - dw .the_grasslands ; THE_GRASSLANDS_DAY_4 - dw .the_grasslands ; THE_GRASSLANDS_NIGHT_1 - dw .the_grasslands ; THE_GRASSLANDS_NIGHT_2 - dw .the_grasslands ; THE_GRASSLANDS_NIGHT_3 - dw .the_grasslands ; THE_GRASSLANDS_NIGHT_4 - dw .the_big_bridge ; THE_BIG_BRIDGE_DAY_1 - dw .the_big_bridge ; THE_BIG_BRIDGE_DAY_2 - dw .the_big_bridge ; THE_BIG_BRIDGE_DAY_3 - dw .the_big_bridge ; THE_BIG_BRIDGE_DAY_4 - dw .the_big_bridge ; THE_BIG_BRIDGE_NIGHT_1 - dw .the_big_bridge ; THE_BIG_BRIDGE_NIGHT_2 - dw .the_big_bridge ; THE_BIG_BRIDGE_NIGHT_3 - dw .the_big_bridge ; THE_BIG_BRIDGE_NIGHT_4 - dw .tower_of_revival ; TOWER_OF_REVIVAL_DAY_1 - dw .tower_of_revival ; TOWER_OF_REVIVAL_DAY_2 - dw .tower_of_revival ; TOWER_OF_REVIVAL_DAY_3 - dw .tower_of_revival ; TOWER_OF_REVIVAL_DAY_4 - dw .tower_of_revival ; TOWER_OF_REVIVAL_NIGHT_1 - dw .tower_of_revival ; TOWER_OF_REVIVAL_NIGHT_2 - dw .tower_of_revival ; TOWER_OF_REVIVAL_NIGHT_3 - dw .tower_of_revival ; TOWER_OF_REVIVAL_NIGHT_4 - dw .the_steep_canyon_1 ; THE_STEEP_CANYON_DAY_1 - dw .the_steep_canyon_2 ; THE_STEEP_CANYON_DAY_2 - dw .the_steep_canyon_2 ; THE_STEEP_CANYON_DAY_3 - dw .the_steep_canyon_2 ; THE_STEEP_CANYON_DAY_4 - dw .the_steep_canyon_1 ; THE_STEEP_CANYON_NIGHT_1 - dw .the_steep_canyon_2 ; THE_STEEP_CANYON_NIGHT_2 - dw .the_steep_canyon_2 ; THE_STEEP_CANYON_NIGHT_3 - dw .the_steep_canyon_2 ; THE_STEEP_CANYON_NIGHT_4 - dw .cave_of_flames ; CAVE_OF_FLAMES_DAY_1 - dw .cave_of_flames ; CAVE_OF_FLAMES_DAY_2 - dw .cave_of_flames ; CAVE_OF_FLAMES_DAY_3 - dw .cave_of_flames ; CAVE_OF_FLAMES_DAY_4 - dw .cave_of_flames ; CAVE_OF_FLAMES_NIGHT_1 - dw .cave_of_flames ; CAVE_OF_FLAMES_NIGHT_2 - dw .cave_of_flames ; CAVE_OF_FLAMES_NIGHT_3 - dw .cave_of_flames ; CAVE_OF_FLAMES_NIGHT_4 - dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_DAY_1 - dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_DAY_2 - dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_DAY_3 - dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_DAY_4 - dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_NIGHT_1 - dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_NIGHT_2 - dw .above_the_clouds_1 ; ABOVE_THE_CLOUDS_NIGHT_3 - dw .above_the_clouds_2 ; ABOVE_THE_CLOUDS_NIGHT_4 - dw .the_stagnant_swamp_1 ; THE_STAGNANT_SWAMP_DAY_1 - dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_DAY_2 - dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_DAY_3 - dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_DAY_4 - dw .the_stagnant_swamp_1 ; THE_STAGNANT_SWAMP_NIGHT_1 - dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_NIGHT_2 - dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_NIGHT_3 - dw .the_stagnant_swamp_2 ; THE_STAGNANT_SWAMP_NIGHT_4 - dw .the_frigid_sea ; THE_FRIGID_SEA_DAY_1 - dw .the_frigid_sea ; THE_FRIGID_SEA_DAY_2 - dw .the_frigid_sea ; THE_FRIGID_SEA_DAY_3 - dw .the_frigid_sea ; THE_FRIGID_SEA_DAY_4 - dw .the_frigid_sea ; THE_FRIGID_SEA_NIGHT_1 - dw .the_frigid_sea ; THE_FRIGID_SEA_NIGHT_2 - dw .the_frigid_sea ; THE_FRIGID_SEA_NIGHT_3 - dw .the_frigid_sea ; THE_FRIGID_SEA_NIGHT_4 - dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_DAY_1 - dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_DAY_2 - dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_DAY_3 - dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_DAY_4 - dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_NIGHT_1 - dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_NIGHT_2 - dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_NIGHT_3 - dw .castle_of_illusions ; CASTLE_OF_ILLUSIONS_NIGHT_4 - dw .the_colossal_hole_1 ; THE_COLOSSAL_HOLE_DAY_1 - dw .the_colossal_hole_1 ; THE_COLOSSAL_HOLE_DAY_2 - dw .the_colossal_hole_1 ; THE_COLOSSAL_HOLE_DAY_3 - dw .the_colossal_hole_1 ; THE_COLOSSAL_HOLE_DAY_4 - dw .the_colossal_hole_2 ; THE_COLOSSAL_HOLE_NIGHT_1 - dw .the_colossal_hole_2 ; THE_COLOSSAL_HOLE_NIGHT_2 - dw .the_colossal_hole_2 ; THE_COLOSSAL_HOLE_NIGHT_3 - dw .the_colossal_hole_2 ; THE_COLOSSAL_HOLE_NIGHT_4 - dw .the_warped_void ; THE_WARPED_VOID_DAY_1 - dw .the_warped_void ; THE_WARPED_VOID_DAY_2 - dw .the_warped_void ; THE_WARPED_VOID_DAY_3 - dw .the_warped_void ; THE_WARPED_VOID_DAY_4 - dw .the_warped_void ; THE_WARPED_VOID_NIGHT_1 - dw .the_warped_void ; THE_WARPED_VOID_NIGHT_2 - dw .the_warped_void ; THE_WARPED_VOID_NIGHT_3 - dw .the_warped_void ; THE_WARPED_VOID_NIGHT_4 - dw .the_east_crater ; THE_EAST_CRATER_DAY_1 - dw .the_east_crater ; THE_EAST_CRATER_DAY_2 - dw .the_east_crater ; THE_EAST_CRATER_DAY_3 - dw .the_east_crater ; THE_EAST_CRATER_DAY_4 - dw .the_east_crater ; THE_EAST_CRATER_NIGHT_1 - dw .the_east_crater ; THE_EAST_CRATER_NIGHT_2 - dw .the_east_crater ; THE_EAST_CRATER_NIGHT_3 - dw .the_east_crater ; THE_EAST_CRATER_NIGHT_4 - dw .forest_of_fear ; FOREST_OF_FEAR_DAY_1 - dw .forest_of_fear ; FOREST_OF_FEAR_DAY_2 - dw .forest_of_fear ; FOREST_OF_FEAR_DAY_3 - dw .forest_of_fear ; FOREST_OF_FEAR_DAY_4 - dw .forest_of_fear ; FOREST_OF_FEAR_NIGHT_1 - dw .forest_of_fear ; FOREST_OF_FEAR_NIGHT_2 - dw .forest_of_fear ; FOREST_OF_FEAR_NIGHT_3 - dw .forest_of_fear ; FOREST_OF_FEAR_NIGHT_4 - dw .the_temple ; THE_TEMPLE - dw NULL - dw NULL - dw NULL - dw NULL - dw NULL - dw NULL - dw NULL - dw NULL - dw NULL - dw NULL - dw NULL - dw NULL - dw NULL - -.out_of_the_woods - dab OutOfTheWoodsBlockMap - dw OutOfTheWoodsObjectMap -.the_peaceful_village_1 - dab ThePeacefulVillage1BlockMap - dw ThePeacefulVillage1ObjectMap -.the_vast_plain_1 - dab TheVastPlain1BlockMap - dw TheVastPlain1ObjectMap -.bank_of_the_wild_river - dab BankOfTheWildRiverBlockMap - dw BankOfTheWildRiverObjectMap -.the_tidal_coast_1 - dab TheTidalCoast1BlockMap - dw TheTidalCoast1ObjectMap -.sea_turtle_rocks - dab SeaTurtleRocksBlockMap - dw SeaTurtleRocksObjectMap -.desert_ruins - dab DesertRuinsBlockMap - dw DesertRuinsObjectMap -.the_volcanos_base_1 - dab TheVolcanosBase1BlockMap - dw TheVolcanosBase1ObjectMap -.the_pool_of_rain_1 - dab ThePoolOfRain1BlockMap - dw ThePoolOfRain1ObjectMap -.a_town_in_chaos - dab ATownInChaosBlockMap - dw ATownInChaosObjectMap -.beneath_the_waves - dab BeneathTheWavesBlockMap - dw BeneathTheWavesObjectMap -.the_west_crater - dab TheWestCraterBlockMap - dw TheWestCraterObjectMap -.the_grasslands - dab TheGrasslandsBlockMap - dw TheGrasslandsObjectMap -.the_big_bridge - dab TheBigBridgeBlockMap - dw TheBigBridgeObjectMap -.tower_of_revival - dab TowerOfRevivalBlockMap - dw TowerOfRevivalObjectMap -.the_steep_canyon_1 - dab TheSteepCanyon1BlockMap - dw TheSteepCanyon1ObjectMap -.cave_of_flames - dab CaveOfFlamesBlockMap - dw CaveOfFlamesObjectMap -.above_the_clouds_1 - dab AboveTheClouds1BlockMap - dw AboveTheClouds1ObjectMap -.the_stagnant_swamp_1 - dab TheStagnantSwamp1BlockMap - dw TheStagnantSwamp1ObjectMap -.the_frigid_sea - dab TheFrigidSeaBlockMap - dw TheFrigidSeaObjectMap -.castle_of_illusions - dab CastleOfIllusionsBlockMap - dw CastleOfIllusionsObjectMap -.the_colossal_hole_1 - dab TheColossalHole1BlockMap - dw TheColossalHole1ObjectMap -.the_warped_void - dab TheWarpedVoidBlockMap - dw TheWarpedVoidObjectMap -.the_east_crater - dab TheEastCraterBlockMap - dw TheEastCraterObjectMap -.forest_of_fear - dab ForestOfFearBlockMap - dw ForestOfFearObjectMap -.the_temple - dab HiddenFigureRoomBlockMap - dw HiddenFigureRoomObjectMap -.the_vast_plain_2 - dab TheVastPlain2BlockMap - dw TheVastPlain2ObjectMap -.the_volcanos_base_2 - dab TheVolcanosBase2BlockMap - dw TheVolcanosBase2ObjectMap -.the_pool_of_rain_2 - dab ThePoolOfRain2BlockMap - dw ThePoolOfRain2ObjectMap -.the_colossal_hole_2 - dab TheColossalHole2BlockMap - dw TheColossalHole2ObjectMap -.the_tidal_coast_2 - dab TheTidalCoast2BlockMap - dw TheTidalCoast2ObjectMap -.the_stagnant_swamp_2 - dab TheStagnantSwamp2BlockMap - dw TheStagnantSwamp2ObjectMap -.above_the_clouds_2 - dab AboveTheClouds2BlockMap - dw AboveTheClouds2ObjectMap -.the_steep_canyon_2 - dab TheSteepCanyon2BlockMap - dw TheSteepCanyon2ObjectMap -.the_peaceful_village_2 - dab ThePeacefulVillage2BlockMap - dw ThePeacefulVillage2ObjectMap - -PointerTable_c0319:: +LevelRooms:: dw LevelRooms_c0d1f ; OUT_OF_THE_WOODS_DAY_1 dw LevelRooms_c0d1f ; OUT_OF_THE_WOODS_DAY_2 dw LevelRooms_c0e03 ; OUT_OF_THE_WOODS_DAY_3 diff --git a/src/engine/bank31.asm b/src/data/levels/rooms2.asm similarity index 100% rename from src/engine/bank31.asm rename to src/data/levels/rooms2.asm diff --git a/src/data/ow/epilogue/framesets.asm b/src/data/ow/epilogue/framesets.asm new file mode 100644 index 0000000..2dbabf7 --- /dev/null +++ b/src/data/ow/epilogue/framesets.asm @@ -0,0 +1,21 @@ +Frameset_76b5:: + db $00, 8 + db $05, 8 + db $06, 8 + db $07, 8 + db $08, 8 + db $09, 8 + db $0a, 8 + db $0b, 8 + db $0c, 8 + db $0d, 8 + db $ff + +Frameset_76ca:: + db $01, 4 + db $02, 4 + db $03, 4 + db $04, 4 + db $03, 4 + db $02, 4 + db $ff diff --git a/src/data/ow/epilogue/oam.asm b/src/data/ow/epilogue/oam.asm new file mode 100644 index 0000000..ef6dc4a --- /dev/null +++ b/src/data/ow/epilogue/oam.asm @@ -0,0 +1,107 @@ +OAM_75c3:: + dw .frame_0 + dw .frame_1 + dw .frame_2 + dw .frame_3 + dw .frame_4 + dw .frame_5 + dw .frame_6 + dw .frame_7 + dw .frame_8 + dw .frame_9 + dw .frame_10 + dw .frame_11 + dw .frame_12 + dw .frame_13 + +.frame_0 + frame_oam -16, -4, $18, 3 + frame_oam -16, -8, $20, 4 + frame_oam -16, 0, $22, 4 + frame_oam -16, -8, $00, 2 + frame_oam -16, 0, $02, 2 + db $80 + +.frame_1 + frame_oam -6, -5, $e0, 0 | OAMF_BANK1 + db $80 + +.frame_2 + frame_oam -6, -5, $e4, 0 | OAMF_BANK1 + db $80 + +.frame_3 + frame_oam -6, -5, $e6, 0 | OAMF_BANK1 + db $80 + +.frame_4 + frame_oam -6, -5, $ea, 0 | OAMF_BANK1 + db $80 + +.frame_5 + frame_oam -16, -8, $1a, 3 + frame_oam -16, -8, $24, 4 + frame_oam -16, 0, $26, 4 + frame_oam -16, -8, $04, 2 + frame_oam -16, 0, $06, 2 + db $80 + +.frame_6 + frame_oam -16, -8, $1c, 3 + frame_oam -16, -8, $28, 4 + frame_oam -16, 0, $2a, 4 + frame_oam -16, -8, $08, 2 + frame_oam -16, 0, $0a, 2 + db $80 + +.frame_7 + frame_oam -16, -8, $2c, 4 + frame_oam -16, 0, $2e, 4 + frame_oam -16, -8, $0c, 2 + frame_oam -16, 0, $0e, 2 + db $80 + +.frame_8 + frame_oam -16, -8, $30, 4 + frame_oam -16, 0, $32, 4 + frame_oam -16, -8, $10, 2 + frame_oam -16, 0, $12, 2 + db $80 + +.frame_9 + frame_oam -16, 0, $30, 4 | OAMF_XFLIP + frame_oam -16, -8, $32, 4 | OAMF_XFLIP + frame_oam -16, 0, $10, 2 | OAMF_XFLIP + frame_oam -16, -8, $12, 2 | OAMF_XFLIP + db $80 + +.frame_10 + frame_oam -16, 0, $2c, 4 | OAMF_XFLIP + frame_oam -16, -8, $2e, 4 | OAMF_XFLIP + frame_oam -16, 0, $0c, 2 | OAMF_XFLIP + frame_oam -16, -8, $0e, 2 | OAMF_XFLIP + db $80 + +.frame_11 + frame_oam -16, 0, $28, 4 | OAMF_XFLIP + frame_oam -16, -8, $2a, 4 | OAMF_XFLIP + frame_oam -16, 0, $1c, 3 | OAMF_XFLIP + frame_oam -16, 0, $08, 2 | OAMF_XFLIP + frame_oam -16, -8, $0a, 2 | OAMF_XFLIP + db $80 + +.frame_12 + frame_oam -16, 0, $24, 4 | OAMF_XFLIP + frame_oam -16, -8, $26, 4 | OAMF_XFLIP + frame_oam -16, 0, $1a, 3 | OAMF_XFLIP + frame_oam -16, 0, $04, 2 | OAMF_XFLIP + frame_oam -16, -8, $06, 2 | OAMF_XFLIP + db $80 + +.frame_13 + frame_oam -16, -4, $18, 3 | OAMF_XFLIP + frame_oam -16, 0, $20, 4 | OAMF_XFLIP + frame_oam -16, -8, $22, 4 | OAMF_XFLIP + frame_oam -16, 0, $00, 2 | OAMF_XFLIP + frame_oam -16, -8, $02, 2 | OAMF_XFLIP + db $80 diff --git a/src/data/title/framesets.asm b/src/data/title/framesets.asm index 7a30332..8093740 100644 --- a/src/data/title/framesets.asm +++ b/src/data/title/framesets.asm @@ -539,186 +539,3 @@ Frameset_71a7:: db 2, 2 db 3, 2 db $ff - -Pal_71b0:: - rgb 31, 31, 31 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 7, 0 - - rgb 31, 25, 9 - rgb 21, 15, 4 - rgb 13, 8, 1 - rgb 0, 0, 0 - - rgb 31, 31, 31 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - - rgb 31, 31, 31 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - - rgb 31, 31, 31 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - - rgb 31, 31, 31 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - - rgb 31, 31, 31 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - - rgb 31, 31, 31 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - -TimeAttack1JPTextMap:: -INCBIN "gfx/bgmaps/text/time_attack1_en.bin" - -TimeAttack2JPTextMap:: -INCBIN "gfx/bgmaps/text/time_attack2_en.bin" - -TimeAttack1ENTextMap:: -INCBIN "gfx/bgmaps/text/time_attack1_jp.bin" - -TimeAttack2ENTextMap:: -INCBIN "gfx/bgmaps/text/time_attack2_jp.bin" - -OAM_75c3:: - dw .frame_0 - dw .frame_1 - dw .frame_2 - dw .frame_3 - dw .frame_4 - dw .frame_5 - dw .frame_6 - dw .frame_7 - dw .frame_8 - dw .frame_9 - dw .frame_10 - dw .frame_11 - dw .frame_12 - dw .frame_13 - -.frame_0 - frame_oam -16, -4, $18, 3 - frame_oam -16, -8, $20, 4 - frame_oam -16, 0, $22, 4 - frame_oam -16, -8, $00, 2 - frame_oam -16, 0, $02, 2 - db $80 - -.frame_1 - frame_oam -6, -5, $e0, 0 | OAMF_BANK1 - db $80 - -.frame_2 - frame_oam -6, -5, $e4, 0 | OAMF_BANK1 - db $80 - -.frame_3 - frame_oam -6, -5, $e6, 0 | OAMF_BANK1 - db $80 - -.frame_4 - frame_oam -6, -5, $ea, 0 | OAMF_BANK1 - db $80 - -.frame_5 - frame_oam -16, -8, $1a, 3 - frame_oam -16, -8, $24, 4 - frame_oam -16, 0, $26, 4 - frame_oam -16, -8, $04, 2 - frame_oam -16, 0, $06, 2 - db $80 - -.frame_6 - frame_oam -16, -8, $1c, 3 - frame_oam -16, -8, $28, 4 - frame_oam -16, 0, $2a, 4 - frame_oam -16, -8, $08, 2 - frame_oam -16, 0, $0a, 2 - db $80 - -.frame_7 - frame_oam -16, -8, $2c, 4 - frame_oam -16, 0, $2e, 4 - frame_oam -16, -8, $0c, 2 - frame_oam -16, 0, $0e, 2 - db $80 - -.frame_8 - frame_oam -16, -8, $30, 4 - frame_oam -16, 0, $32, 4 - frame_oam -16, -8, $10, 2 - frame_oam -16, 0, $12, 2 - db $80 - -.frame_9 - frame_oam -16, 0, $30, 4 | OAMF_XFLIP - frame_oam -16, -8, $32, 4 | OAMF_XFLIP - frame_oam -16, 0, $10, 2 | OAMF_XFLIP - frame_oam -16, -8, $12, 2 | OAMF_XFLIP - db $80 - -.frame_10 - frame_oam -16, 0, $2c, 4 | OAMF_XFLIP - frame_oam -16, -8, $2e, 4 | OAMF_XFLIP - frame_oam -16, 0, $0c, 2 | OAMF_XFLIP - frame_oam -16, -8, $0e, 2 | OAMF_XFLIP - db $80 - -.frame_11 - frame_oam -16, 0, $28, 4 | OAMF_XFLIP - frame_oam -16, -8, $2a, 4 | OAMF_XFLIP - frame_oam -16, 0, $1c, 3 | OAMF_XFLIP - frame_oam -16, 0, $08, 2 | OAMF_XFLIP - frame_oam -16, -8, $0a, 2 | OAMF_XFLIP - db $80 - -.frame_12 - frame_oam -16, 0, $24, 4 | OAMF_XFLIP - frame_oam -16, -8, $26, 4 | OAMF_XFLIP - frame_oam -16, 0, $1a, 3 | OAMF_XFLIP - frame_oam -16, 0, $04, 2 | OAMF_XFLIP - frame_oam -16, -8, $06, 2 | OAMF_XFLIP - db $80 - -.frame_13 - frame_oam -16, -4, $18, 3 | OAMF_XFLIP - frame_oam -16, 0, $20, 4 | OAMF_XFLIP - frame_oam -16, -8, $22, 4 | OAMF_XFLIP - frame_oam -16, 0, $00, 2 | OAMF_XFLIP - frame_oam -16, -8, $02, 2 | OAMF_XFLIP - db $80 - -Frameset_76b5:: - db $00, 8 - db $05, 8 - db $06, 8 - db $07, 8 - db $08, 8 - db $09, 8 - db $0a, 8 - db $0b, 8 - db $0c, 8 - db $0d, 8 - db $ff - -Frameset_76ca:: - db $01, 4 - db $02, 4 - db $03, 4 - db $04, 4 - db $03, 4 - db $02, 4 - db $ff diff --git a/src/engine/bank34.asm b/src/engine/bank34.asm deleted file mode 100644 index 1900b40..0000000 --- a/src/engine/bank34.asm +++ /dev/null @@ -1,92 +0,0 @@ -; load 8 animated tiles to v1Tiles2 -; these are blocks of tiles with 4 subsets, made of 8 tiles each -; (8 * $10 * 4 = $200 bytes each block) -; wAnimatedTilesGfx determines which of these blocks to load -; wAnimatedTilesFrame determines which of the subset (frame) to load -UpdateRoomAnimatedTiles:: - ldh a, [rLY] - cp $7c - jr nc, .done - jr .useless_jump ; can be fallthrough - -.useless_jump -; check whether to advance frame - ld a, [wAnimatedTilesFrameDuration] - and a - jr z, .done - ld b, a - ld a, [wAnimatedTilesFrameCount] - inc a - ld [wAnimatedTilesFrameCount], a - cp b - jr c, .done - -; do frame - xor a - ld [wAnimatedTilesFrameCount], a - ld hl, AnimatedTilesGfx - ld a, [wAnimatedTilesGfx] - add a - add h - ld h, a - ld a, [wAnimatedTilesFrame] - inc a - cp $4 - jr nz, .ok - xor a ; reset to 0 -.ok - ld [wAnimatedTilesFrame], a - swap a - add a - add a - add a ; *$80 - ld e, a - ld d, $00 - rl d - add hl, de - - ld de, v1Tiles2 + $700 - ld b, TILE_SIZE - ld a, BANK("VRAM1") - ldh [rVBK], a -.loop_copy_tiles - wait_ppu_busy - wait_ppu_free -REPT 8 - ld a, [hli] - ld [de], a - inc e -ENDR - dec b - jr nz, .loop_copy_tiles - - xor a ; VRAM0 - ldh [rVBK], a -.done - ret - -AnimatedTilesGfx: -AnimatedTiles1Gfx: INCBIN "gfx/levels/animated/animated_tiles1.2bpp" ; ANIMATED_TILES_GFX_00 -AnimatedTiles2Gfx: INCBIN "gfx/levels/animated/animated_tiles2.2bpp" ; ANIMATED_TILES_GFX_01 -AnimatedTiles3Gfx: INCBIN "gfx/levels/animated/animated_tiles3.2bpp" ; ANIMATED_TILES_GFX_02 -AnimatedTiles4Gfx: INCBIN "gfx/levels/animated/animated_tiles4.2bpp" ; ANIMATED_TILES_GFX_03 -AnimatedTiles5Gfx: INCBIN "gfx/levels/animated/animated_tiles5.2bpp" ; ANIMATED_TILES_GFX_04 -AnimatedTiles6Gfx: INCBIN "gfx/levels/animated/animated_tiles6.2bpp" ; ANIMATED_TILES_GFX_05 -AnimatedTiles7Gfx: INCBIN "gfx/levels/animated/animated_tiles7.2bpp" ; ANIMATED_TILES_GFX_06 -AnimatedTiles8Gfx: INCBIN "gfx/levels/animated/animated_tiles8.2bpp" ; ANIMATED_TILES_GFX_07 -AnimatedTiles9Gfx: INCBIN "gfx/levels/animated/animated_tiles9.2bpp" ; ANIMATED_TILES_GFX_08 -AnimatedTiles10Gfx: INCBIN "gfx/levels/animated/animated_tiles10.2bpp" ; ANIMATED_TILES_GFX_09 -AnimatedTiles11Gfx: INCBIN "gfx/levels/animated/animated_tiles11.2bpp" ; ANIMATED_TILES_GFX_10 -AnimatedTiles12Gfx: INCBIN "gfx/levels/animated/animated_tiles12.2bpp" ; ANIMATED_TILES_GFX_11 -AnimatedTiles13Gfx: INCBIN "gfx/levels/animated/animated_tiles13.2bpp" ; ANIMATED_TILES_GFX_12 -AnimatedTiles14Gfx: INCBIN "gfx/levels/animated/animated_tiles14.2bpp" ; ANIMATED_TILES_GFX_13 -AnimatedTiles15Gfx: INCBIN "gfx/levels/animated/animated_tiles15.2bpp" ; ANIMATED_TILES_GFX_14 -AnimatedTiles16Gfx: INCBIN "gfx/levels/animated/animated_tiles16.2bpp" ; ANIMATED_TILES_GFX_15 -AnimatedTiles17Gfx: INCBIN "gfx/levels/animated/animated_tiles17.2bpp" ; ANIMATED_TILES_GFX_16 -AnimatedTiles18Gfx: INCBIN "gfx/levels/animated/animated_tiles18.2bpp" ; ANIMATED_TILES_GFX_17 -AnimatedTiles19Gfx: INCBIN "gfx/levels/animated/animated_tiles19.2bpp" ; ANIMATED_TILES_GFX_18 -AnimatedTiles20Gfx: INCBIN "gfx/levels/animated/animated_tiles20.2bpp" ; ANIMATED_TILES_GFX_19 -AnimatedTiles21Gfx: INCBIN "gfx/levels/animated/animated_tiles21.2bpp" ; ANIMATED_TILES_GFX_20 -AnimatedTiles22Gfx: INCBIN "gfx/levels/animated/animated_tiles22.2bpp" ; ANIMATED_TILES_GFX_21 -AnimatedTiles23Gfx: INCBIN "gfx/levels/animated/animated_tiles23.2bpp" ; ANIMATED_TILES_GFX_22 -AnimatedTiles24Gfx: INCBIN "gfx/levels/animated/animated_tiles24.2bpp" ; ANIMATED_TILES_GFX_23 diff --git a/src/engine/bank35.asm b/src/engine/bank35.asm deleted file mode 100644 index 41d8b43..0000000 --- a/src/engine/bank35.asm +++ /dev/null @@ -1,2265 +0,0 @@ -_ClearScreenStateTable: - ld a, [wSubState] - jumptable - - dw FastFadeToWhite - dw InitClearScreen - dw SlowFadeFromWhite - dw Func_d41bb - - dw SlowFadeBGToWhite ; SST_CLEAR_TIME_ATTACK - dw InitTimeAttackClearScreen - dw DarkenBGToPal_Fast - dw Func_d434c - - dw SlowFadeBGToWhite ; SST_CLEAR_MUSICAL_COINS - dw InitMusicalCoinScreen - dw DarkenBGToPal_Fast - dw Func_d4472 - dw Func_d4507 - dw Func_d454c - dw Func_d45f0 ; SST_CLEAR_EXIT - dw DebugReset - dw DebugReset - dw DebugReset - dw DebugReset - -InitClearScreen: - ld a, TRUE - ld [wResetDisabled], a - - call DisableLCD - call ClearBGMap0 - call ClearVirtualOAM - - call SetTreasureTransitionParam - - ldh a, [rSVBK] - push af - ld a, BANK(wTreasuresCollected) - ldh [rSVBK], a - ld a, [wTransitionParam] - cp TRANSITION_RETURN_TO_MAP - jr z, .return_to_map - call IsTreasureCollected - ld a, [hl] - or d - ld [hl], a -.return_to_map - ld a, [wTreasuresCollected] - rlca - rlca - rlca - jr c, .has_gold_music_box - rlca - jr c, .has_red_music_box - rlca - jr c, .has_green_music_box - rlca - jr c, .has_blue_music_box - rlca - jr c, .has_yellow_music_box - xor a - jr .got_number_music_boxes -.has_gold_music_box - ld a, 5 - jr .got_number_music_boxes -.has_red_music_box - ld a, 4 - jr .got_number_music_boxes -.has_green_music_box - ld a, 3 - jr .got_number_music_boxes -.has_blue_music_box - ld a, 2 - jr .got_number_music_boxes -.has_yellow_music_box - ld a, 1 -.got_number_music_boxes - ld [wNumMusicBoxes], a - pop af - ldh [rSVBK], a - - farcall LoadClearScreenPals - call LoadCollectedTreasurePal_ClearScreen - farcall LoadClearScreenGfx - farcall LoadLevelTreasureData - farcall Func_1e0045 - - hlbgcoord 6, 16 - farcall PrintNumberCoins - - ld a, [wKeyAndTreasureFlags] - ld b, a - bit GREY_TREASURE_F, b - jr z, .check_red - hlbgcoord 3, 8 - ld a, $54 - ld [hli], a - inc a - ld [hl], a -.check_red - bit RED_TREASURE_F, b - jr z, .check_green - hlbgcoord 7, 8 - ld a, $54 - ld [hli], a - inc a - ld [hl], a -.check_green - bit GREEN_TREASURE_F, b - jr z, .check_blue - hlbgcoord 11, 8 - ld a, $5c - ld [hli], a - inc a - ld [hl], a -.check_blue - bit BLUE_TREASURE_F, b - jr z, .ok - hlbgcoord 15, 8 - ld a, $5c - ld [hli], a - inc a - ld [hl], a - -.ok - call UpdateNumCollectedTreasures - call VBlank_d4764 - - xor a - ld [wSCX], a - ldh [rSCX], a - ld a, $04 - ld [wSCY], a - ldh [rSCY], a - farcall Func_1e015b - - ld a, [wPowerUpLevel] - and ACTION_HELP_LEVEL_CLEAR - jr z, .no_power_up - ld hl, wMenuObj8FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj8 - call AddClearScreenSprite -.no_power_up - ld hl, wClearScreenWarioFramesetPtr + 1 - call UpdateObjAnim - ld hl, wClearScreenWario - call AddClearScreenWarioSprite - - ld a, [wLevelEndScreen] - cp LVLEND_NO_TREASURE - jr z, .no_treasure - ld hl, wMenuObj1FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj1 - call AddClearScreenSprite - -.no_treasure - ld hl, wMenuObj2FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj2 - call AddClearScreenSprite - - ld a, [wNumMusicBoxes] - and a - jp z, .no_music_boxes - dec a - jr z, .one_music_box - dec a - jr z, .two_music_boxes - dec a - jr z, .three_music_boxes - dec a - jr z, .four_music_boxes -; all music boxes - ld hl, wMenuObj3FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj3 - call AddClearScreenSprite -.four_music_boxes - ld hl, wMenuObj4FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj4 - call AddClearScreenSprite -.three_music_boxes - ld hl, wMenuObj5FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj5 - call AddClearScreenSprite -.two_music_boxes - ld hl, wMenuObj6FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj6 - call AddClearScreenSprite -.one_music_box - ld hl, wMenuObj7FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj7 - call AddClearScreenSprite - -.no_music_boxes - ld a, LCDC_DEFAULT - ldh [rLCDC], a - ld hl, wSubState - inc [hl] - ret - -Func_d41bb: - ld a, [wPowerUpLevel] - and ACTION_HELP_LEVEL_CLEAR - jr z, .asm_d41ce - ld hl, wMenuObj8FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj8 - call AddClearScreenSprite - -.asm_d41ce - ld hl, wClearScreenWarioFramesetPtr + 1 - call UpdateObjAnim - ld a, [wClearScreenWarioVar] - and a - jr nz, .asm_d4203 - ld a, [wObjAnimWasReset] - and a - jr z, .asm_d4203 - ld a, $01 - ld [wClearScreenWarioVar], a - ; reset animation - ld hl, wClearScreenWarioFramesetOffset - xor a - ld [hli], a - ld [hli], a - ld a, [wTransitionParam] - cp TRANSITION_RETURN_TO_MAP - jr z, .asm_d41fa - ld a, HIGH(Frameset_d4d1b) - ld [hli], a - ld a, LOW(Frameset_d4d1b) - ld [hl], a - jr .asm_d4200 -.asm_d41fa - ld a, HIGH(Frameset_d4d5f) - ld [hli], a - ld a, LOW(Frameset_d4d5f) - ld [hl], a -.asm_d4200 - call UpdateObjAnim -.asm_d4203 - ld hl, wClearScreenWario - call AddClearScreenWarioSprite - - ld hl, wMenuObj2 - call AddClearScreenSprite - ld a, [wLevelEndScreen] - cp LVLEND_NO_TREASURE - jr z, .asm_d4222 - ld hl, wMenuObj1FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj1 - call AddClearScreenSprite - -.asm_d4222 - ld a, [wNumMusicBoxes] - and a - jr z, .asm_d4252 - dec a - jr z, .asm_d424c - dec a - jr z, .asm_d4246 - dec a - jr z, .asm_d4240 - dec a - jr z, .asm_d423a - ld hl, wMenuObj3 - call AddClearScreenSprite -.asm_d423a - ld hl, wMenuObj4 - call AddClearScreenSprite -.asm_d4240 - ld hl, wMenuObj5 - call AddClearScreenSprite -.asm_d4246 - ld hl, wMenuObj6 - call AddClearScreenSprite -.asm_d424c - ld hl, wMenuObj7 - call AddClearScreenSprite -.asm_d4252 - call ClearUnusedVirtualOAM - - ld a, [wJoypadPressed] - bit A_BUTTON_F, a - ret z -; fallthrough - -OpenMusicalCoinsScreen: - ld a, SST_CLEAR_MUSICAL_COINS - ld [wSubState], a - ret - -InitTimeAttackClearScreen: - ld a, TRUE - ld [wResetDisabled], a - - call DisableLCD - call ClearBGMap0 - call ClearVirtualOAM - - ld a, TRANSITION_RETURN_TO_MAP - ld [wTransitionParam], a - - farcall Func_1e000d - farcall LoadClearScreenGfx - farcall Func_1e005f - call VBlank_d4764 - - xor a - ld [wSCX], a - ldh [rSCX], a - ld a, $04 - ld [wSCY], a - ldh [rSCY], a - farcall Func_1e028a - - ld a, [wTimeAttackResult] - cp TIME_ATTACK_GOT_HIGH_SCORE - jr nz, .asm_d42d3 - ld hl, wMenuObj8FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj8 - call AddClearScreenSprite - -.asm_d42d3 - ld hl, wClearScreenWarioFramesetPtr + 1 - call UpdateObjAnim - ld hl, wClearScreenWario - call AddClearScreenWarioSprite - - ld hl, wMenuObj2FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj2 - call AddClearScreenSprite - - ld hl, wMenuObj3FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj3 - call AddClearScreenSprite - - ld a, [wKeyAndTreasureFlags] - bit GREY_KEY_F, a - jr z, .red_key - ld hl, wMenuObj4FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj4 - call AddClearScreenSprite - -.red_key - ld a, [wKeyAndTreasureFlags] - bit RED_KEY_F, a - jr z, .green_key - ld hl, wMenuObj5FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj5 - call AddClearScreenSprite - -.green_key - ld a, [wKeyAndTreasureFlags] - bit GREEN_KEY_F, a - jr z, .blue_key - ld hl, wMenuObj6FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj6 - call AddClearScreenSprite - -.blue_key - ld a, [wKeyAndTreasureFlags] - bit BLUE_KEY_F, a - jr z, .done_keys - ld hl, wMenuObj7FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj7 - call AddClearScreenSprite - -.done_keys - ld a, LCDC_DEFAULT - ldh [rLCDC], a - ld hl, wSubState - inc [hl] - ret - -Func_d434c: - ld a, [wTimeAttackResult] - cp TIME_ATTACK_GOT_HIGH_SCORE - jr nz, .asm_d435f - ld hl, wMenuObj8FramesetPtr + 1 - call UpdateObjAnim - ld hl, wMenuObj8 - call AddClearScreenSprite - -.asm_d435f - ld hl, wClearScreenWarioFramesetPtr + 1 - call UpdateObjAnim - ld a, [wActionHelpWarioVar] - and a - jr nz, .asm_d4394 - ld a, [wObjAnimWasReset] - and a - jr z, .asm_d4394 - ld a, $01 - ld [wActionHelpWarioVar], a - ld hl, wClearScreenWarioFramesetOffset - xor a - ld [hli], a - ld [hli], a - - ld a, [wTimeAttackResult] - cp TIME_ATTACK_GOT_HIGH_SCORE - jr nz, .asm_d438b - ld a, HIGH(Frameset_d4d1b) - ld [hli], a - ld a, LOW(Frameset_d4d1b) - ld [hl], a - jr .asm_d4391 -.asm_d438b - ld a, HIGH(Frameset_d4d5f) - ld [hli], a - ld a, LOW(Frameset_d4d5f) - ld [hl], a -.asm_d4391 - call UpdateObjAnim -.asm_d4394 - ld hl, wClearScreenWario - call AddClearScreenWarioSprite - - ld hl, wMenuObj2 - call AddClearScreenSprite - ld hl, wMenuObj3 - call AddClearScreenSprite - - ld a, [wKeyAndTreasureFlags] - bit GREY_KEY_F, a - jr z, .red_key - ld hl, wMenuObj4 - call AddClearScreenSprite - -.red_key - ld a, [wKeyAndTreasureFlags] - bit RED_KEY_F, a - jr z, .green_key - ld hl, wMenuObj5 - call AddClearScreenSprite - -.green_key - ld a, [wKeyAndTreasureFlags] - bit GREEN_KEY_F, a - jr z, .blue_key - ld hl, wMenuObj6 - call AddClearScreenSprite - -.blue_key - ld a, [wKeyAndTreasureFlags] - bit BLUE_KEY_F, a - jr z, .done_keys - ld hl, wMenuObj7 - call AddClearScreenSprite -.done_keys - call ClearUnusedVirtualOAM - - ld a, [wJoypadPressed] - bit A_BUTTON_F, a - ret z - jp OpenMusicalCoinsScreen - -InitMusicalCoinScreen: - call DisableLCD - call ClearBGMap0 - call ClearVirtualOAM - - call Func_d464e - call Func_d465b - call Func_d4668 - call Func_d47f1 - - ld a, $ff - ld [wAllMusicalCoinsLevel], a - ld a, [wNumMusicalCoins] - cp NUM_LEVEL_MUSICAL_COINS - call z, SetMusicalCoinFlag - - call VBlank_d47a7 - - xor a - ld [wSCX], a - ldh [rSCX], a - ld [wSCY], a - ldh [rSCY], a - - ld hl, wMenuObj3 - ld a, $38 - ld [hli], a ; y - ld a, $40 - ld [hli], a ; x - xor a - ld [hli], a - ld [hli], a - ld [hli], a - ld [hli], a - ld a, HIGH(Frameset_1f1cd4) - ld [hli], a - ld a, LOW(Frameset_1f1cd4) - ld [hl], a - farcall $7c, UpdateObjAnim - ld hl, wMenuObj3 - farcall AddPauseMenuSprite - - ld a, 8 - ld [wAnimatedTilesFrameDuration], a - ld a, ANIMATED_TILES_GFX_15 - ld [wAnimatedTilesGfx], a - xor a - ld [wAnimatedTilesFrameCount], a - ld [wAnimatedTilesFrame], a - inc a ; TRUE - ld [wRoomAnimatedTilesEnabled], a - ld a, LCDC_DEFAULT - ldh [rLCDC], a - xor a - ld [wMusicalCoinVisualCounter], a - ld a, 60 - ld [wTimer], a - ld hl, wSubState - inc [hl] - ret - -Func_d4472: - ld hl, wMenuObj3FramesetPtr + 1 - farcall $7c, UpdateObjAnim - ld hl, wMenuObj3 - farcall AddPauseMenuSprite - call ClearUnusedVirtualOAM - - ld hl, wNumMusicalCoins - ld a, [wMusicalCoinVisualCounter] - cp [hl] - jr z, .counting_up_done - ld hl, wTimer - ld a, [hl] - and a - jr z, .count_up - dec [hl] - ret - -.count_up - ld a, [wGlobalCounter] - and %11 - ret nz - play_sfx SFX_REGULAR_COIN - ld hl, wBGMapTileVRAM0Queue - ld a, HIGH(v0BGMap0 + $8b) - ld [hli], a - ld a, LOW(v0BGMap0 + $8b) - ld [hli], a - - ld a, [wMusicalCoinVisualCounter] - inc a - ld [wMusicalCoinVisualCounter], a - add a ; *2 - add $a0 - ld b, a - ld [hli], a - ld a, $98 - ld [hli], a - ld a, $ab - ld [hli], a - inc b - ld [hl], b - ld a, $80 - ld [wcee4], a - ret - -.counting_up_done - ld a, [wAllMusicalCoinsLevel] - inc a - jp z, Func_d45e1 - - play_sfx SFX_03A - - ld hl, wMenuObj1 - ld a, $42 - ld [hli], a ; y - ld a, $60 - ld [hli], a ; x - xor a - ld [hli], a - ld [hli], a - ld [hli], a - ld [hli], a - ld a, HIGH(Frameset_d65f0) - ld [hli], a - ld a, LOW(Frameset_d65f0) - ld [hl], a - call UpdateObjAnim - - ld hl, wSubState - inc [hl] - ret - -Func_d4507: - call DoPencilMovement - push af - ld hl, wMenuObj1 - call AddPencilSprite - ld hl, wMenuObj3FramesetPtr + 1 - farcall $7c, UpdateObjAnim - ld hl, wMenuObj3 - farcall AddPauseMenuSprite - call ClearUnusedVirtualOAM - pop af - and a - ret z - - xor a - ld [wTimer], a - play_sfx SFX_03A - ld hl, wSubState - inc [hl] - ret - -Func_d454c: - call DoPencilScribbling - - ld hl, wMenuObj1 - call AddPencilSprite - - ld hl, wMenuObj3FramesetPtr + 1 - farcall $7c, UpdateObjAnim - ld hl, wMenuObj3YCoord - farcall AddPauseMenuSprite - call ClearUnusedVirtualOAM - - ld hl, wTimer - inc [hl] - ld a, [hl] - cp 52 - jr nc, .done - cp 20 - ret nz - ld a, [wAllMusicalCoinsLevel] - ld e, a - ld d, $00 - ld hl, MusicalCoinLevelBGPals - add hl, de - ld b, [hl] - ld a, [wAllMusicalCoinsLevel] - cp NUM_LEVELS - 5 - jr nc, .row_4 - cp NUM_LEVELS - 10 - jr nc, .row_3 - cp NUM_LEVELS - 15 - jr nc, .row_2 - cp NUM_LEVELS - 20 - jr nc, .row_1 -; row 0 - hlbgcoord 8, 9 - jr .got_coords -.row_1 - sub 5 - hlbgcoord 8, 10 - jr .got_coords -.row_2 - sub 10 - hlbgcoord 8, 11 - jr .got_coords -.row_3 - sub 15 - hlbgcoord 8, 12 - jr .got_coords -.row_4 - sub 20 - hlbgcoord 8, 13 -.got_coords - ld e, a - ld d, $00 - add hl, de - ld d, h - ld e, l - ld hl, wBGMapTileVRAM0Queue - ld a, d - ld [hli], a - ld a, e - ld [hli], a - ld [hl], b - ld a, $81 - ld [wcee4], a - ret - -.done - play_sfx SFX_MUSICAL_COIN -; fallthrough - -Func_d45e1: - xor a - ld [wTimer + 0], a - ld a, 2 - ld [wTimer + 1], a - ld hl, wSubState - ld [hl], SST_CLEAR_EXIT - ret - -Func_d45f0: - ld hl, wMenuObj3FramesetPtr + 1 - farcall $7c, UpdateObjAnim - ld hl, wMenuObj3 - farcall AddPauseMenuSprite - call ClearUnusedVirtualOAM - - ld a, [wJoypadPressed] - bit A_BUTTON_F, a - jr nz, .skip_timer - ld hl, wTimer - dec [hl] - ret nz - ld hl, wTimer + 1 - dec [hl] - ret nz - -.skip_timer - xor a - ld [wTimer + 0], a - ld [wTimer + 1], a - ld a, [wGameModeFlags] - bit MODE_TIME_ATTACK_F, a - jr nz, .asm_d463e - ld a, [wPowerUpLevel] - and ACTION_HELP_LEVEL_CLEAR - jp nz, OpenActionHelp -.asm_d463e - farcall Func_4628 - ret - -Func_d464e: - ld hl, Pals_d50a4 - call LoadPalsToTempPals1 - ld hl, Pals_d50e4 - call LoadPalsToTempPals2 - ret - -Func_d465b: - xor a - ldh [rVBK], a - ld hl, GolfMenuGfx - ld bc, v0Tiles0 - call Decompress - ret - -Func_d4668: - ld a, BANK("VRAM1") - ldh [rVBK], a - ld hl, BGMap_d6502 - ld bc, v1BGMap0 - call Decompress - xor a - ldh [rVBK], a - ld hl, BGMap_d63fd - ld bc, v0BGMap0 - call Decompress - ret - -AddClearScreenSprite: - ld a, [wSCY] - ld b, a - ld a, [hli] - add OAM_Y_OFS - sub b - ld [wCurSprite], a - ld a, [hli] - add OAM_X_OFS - ld [wCurSpriteXCoord], a - ld a, [hli] - ld [wCurSpriteFrame], a - ld a, [hl] - ld [wCurSpriteAttributes], a - ld hl, OAM_d4e26 - call AddSprite - ret - -AddClearScreenWarioSprite: - ld a, [wSCY] - ld b, a - ld a, [hli] - add OAM_Y_OFS - sub b - ld [wCurSprite], a - ld a, [hli] - add OAM_X_OFS - ld [wCurSpriteXCoord], a - ld a, [hli] - ld [wCurSpriteFrame], a - ld a, [hl] - ld [wCurSpriteAttributes], a - ld hl, OAM_d49cc - call AddSprite - ret - -SetTreasureTransitionParam: - ld a, [wLevelEndScreen] - cp LVLEND_NO_TREASURE - jr z, .no_treasure - dec a - ld b, a - ld a, [wLevel] - srl a - srl a - srl a - add a - add a - add b - ld e, a - ld d, $00 - ld hl, LevelTreasureIDs_WithoutTemple - add hl, de - ld a, [hl] - ld [wTransitionParam], a - cp LEAD_OVERALLS_T - jr z, .lead_overalls - cp SWIMMING_FLIPPERS_T - jr z, .swimming_flippers - cp HEAD_SMASH_HELMET_T - jr z, .head_smash - cp GRAB_GLOVE_T - jr z, .grab_glove - cp GARLIC_T - jr z, .garlic - cp SUPER_JUMP_SLAM_OVERALLS_T - jr z, .super_jump_slam_overalls - cp HIGH_JUMP_BOOTS_T - jr z, .high_jump_boots - cp PRINCE_FROGS_GLOVES_T - jr z, .prince_frogs_gloves - cp SUPER_GRAB_GLOVES_T - jr z, .super_grab_gloves - ret -.no_treasure - ld a, TRANSITION_RETURN_TO_MAP - ld [wTransitionParam], a - ret - -.lead_overalls - ld a, LEAD_OVERALLS | ACTION_HELP_LEVEL_CLEAR - jr .set_power_up_level -.swimming_flippers - ld a, SWIMMING_FLIPPERS | ACTION_HELP_LEVEL_CLEAR - jr .set_power_up_level -.head_smash - ld a, HEAD_SMASH_HELMET | ACTION_HELP_LEVEL_CLEAR - jr .set_power_up_level -.grab_glove - ld a, GRAB_GLOVE | ACTION_HELP_LEVEL_CLEAR - jr .set_power_up_level -.garlic - ld a, GARLIC | ACTION_HELP_LEVEL_CLEAR - jr .set_power_up_level -.super_jump_slam_overalls - ld a, SUPER_JUMP_SLAM_OVERALLS | ACTION_HELP_LEVEL_CLEAR - jr .set_power_up_level -.high_jump_boots - ld a, HIGH_JUMP_BOOTS | ACTION_HELP_LEVEL_CLEAR - jr .set_power_up_level -.prince_frogs_gloves - ld a, PRINCE_FROGS_GLOVES | ACTION_HELP_LEVEL_CLEAR - jr .set_power_up_level -.super_grab_gloves - ld a, SUPER_GRAB_GLOVES | ACTION_HELP_LEVEL_CLEAR -.set_power_up_level - ld [wPowerUpLevel], a - ret - -UpdateNumCollectedTreasures: - ldh a, [rSVBK] - push af - ld a, $02 - ldh [rSVBK], a - xor a - ld [wNumCollectedTreasures + 1], a - ld [wNumCollectedTreasures + 0], a - ld a, NUM_TREASURES - 1 -.loop_treasures - push af - call IsTreasureCollected - and a - jr z, .next_treasure - ld a, [wNumCollectedTreasures + 1] - add 1 - daa - ld [wNumCollectedTreasures + 1], a - ld a, [wNumCollectedTreasures + 0] - adc 0 - daa - ld [wNumCollectedTreasures + 0], a -.next_treasure - pop af - dec a - jr nz, .loop_treasures - pop af - ldh [rSVBK], a - ret - -VBlank_d4764: - ld hl, .Func - ld de, wVBlankFunc - ld b, .end - .Func - call CopyHLToDE - ret - -.Func: - ld a, [wSCY] - ldh [rSCY], a - ld a, [wSCX] - ldh [rSCX], a - - xor a - ldh [rVBK], a - ld hl, v0Tiles2 tile $71 + (TILE_SIZE - 2) - ld c, [hl] - ld b, TILE_SIZE - 1 - ld de, v0Tiles2 tile $71 + (TILE_SIZE - 4) -.loop1 - ld a, [de] - ld [hld], a - dec l - dec e - dec e - dec b - jr nz, .loop1 - ld [hl], c - - ld hl, v0Tiles2 tile $71 + (TILE_SIZE - 1) - ld c, [hl] - ld b, TILE_SIZE - 1 - ld de, v0Tiles2 tile $71 + (TILE_SIZE - 3) -.loop2 - ld a, [de] - ld [hld], a - dec l - dec e - dec e - dec b - jr nz, .loop2 - ld [hl], c - - ld a, HIGH(wVirtualOAM) - call hTransferVirtualOAM - ret -.end - -VBlank_d47a7: - ld hl, .Func - ld de, wVBlankFunc - ld b, .end - .Func - call CopyHLToDE - ret - -.Func: - ld a, [wSCY] - ldh [rSCY], a - ld a, [wSCX] - ldh [rSCX], a - ld a, [wcee4] - bit 7, a - jr z, .dma_transfer - and $7f - jr nz, .asm_d47d9 - ld hl, wBGMapTileVRAM0Queue - ld a, [hli] - ld d, a - ld a, [hli] - ld e, a - ld a, [hli] - ld [de], a - ld a, [hli] - ld d, a - ld a, [hli] - ld e, a - ld a, [hli] - ld [de], a - jr .asm_d47e6 -.asm_d47d9 - ld a, BANK("VRAM1") - ldh [rVBK], a - ld hl, wBGMapTileVRAM0Queue - ld a, [hli] - ld d, a - ld a, [hli] - ld e, a - ld a, [hl] - ld [de], a -.asm_d47e6 - ld hl, wcee4 - res 7, [hl] -.dma_transfer - ld a, HIGH(wVirtualOAM) - call hTransferVirtualOAM - ret -.end - -Func_d47f1: - ld a, BANK("VRAM1") - ldh [rVBK], a - ld hl, wMusicalCoinFlags - lb bc, (NUM_LEVELS / 8), 8 - debgcoord 8, 9 - ld a, -1 - ldh [hffa0], a -.loop_bits - ldh a, [hffa0] - inc a - ldh [hffa0], a - rrc [hl] - call c, .ApplyBGPal - inc e - ld a, e - and $1f - cp 13 - jr nz, .next_bit - ld a, e - add BG_MAP_WIDTH - 5 - ld e, a -.next_bit - dec c - jr nz, .loop_bits - inc hl ; next byte in wMusicalCoinFlags - ld c, 8 - dec b - jr nz, .loop_bits - bit 0, [hl] - call nz, .ApplyBGPal - xor a - ldh [rVBK], a - ret - -.ApplyBGPal: - push bc - push hl - ldh a, [hffa0] - ld c, a - ld b, $00 - ld hl, MusicalCoinLevelBGPals - add hl, bc - ld a, [hl] - ld [de], a - pop hl - pop bc - ret - -SetMusicalCoinFlag: - ld a, [wLevel] - srl a - srl a - srl a - ld c, a - ld [wAllMusicalCoinsLevel], a ; LEVEL_* constant - srl a - srl a - srl a - ld e, a ; /8 - ld d, $00 - ld hl, wMusicalCoinFlags - add hl, de - ld a, c - and %111 - ld c, a - jr z, .got_flag -.rotate_flags_right - rrc [hl] - dec c - jr nz, .rotate_flags_right -.got_flag - bit 0, [hl] - jr z, .set_flag - ; already set - push af - ld a, $ff - ld [wAllMusicalCoinsLevel], a - pop af - jr .restore_flags -.set_flag - set 0, [hl] -.restore_flags - and a - ret z ; no need to rotate back -.rotate_flags_left - rlc [hl] - dec a - jr nz, .rotate_flags_left - ret - -; check if a bit is set in wMusicalCoinFlags -; for the level in wOWLevel -_CheckLevelMusicalCoinFlag:: - ld hl, wMusicalCoinFlags - ld a, [wOWLevel] - dec a - ld c, a - srl a - srl a - srl a ; /8 - ld e, a - ld d, $00 - add hl, de - ld a, c - and %111 - ld c, a - jr z, .check_flag -.loop_1 - rrc [hl] - dec c - jr nz, .loop_1 -.check_flag - ld c, a - bit 0, [hl] - jr nz, .flag_set - ld b, FALSE - jr .got_result -.flag_set - ld b, TRUE -.got_result - ld a, c - and a - ret z -.loop_2 - rlc [hl] - dec a - jr nz, .loop_2 - ret - -AddPencilSprite: - ld a, [wSCY] - ld b, a - ld a, [hli] - add OAM_Y_OFS - sub b - ld [wCurSprite], a - ld a, [hli] - add OAM_X_OFS - ld [wCurSpriteXCoord], a - ld a, [hli] - ld [wCurSpriteFrame], a - ld a, [hl] - ld [wCurSpriteAttributes], a - ld hl, OAM_d65e1 - call AddSprite - ret - -; returns TRUE in a if done movement -DoPencilMovement: - ld a, [wAllMusicalCoinsLevel] - cp NUM_LEVELS - 5 - jr nc, .row_4 - cp NUM_LEVELS - 10 - jr nc, .row_3 - cp NUM_LEVELS - 15 - jr nc, .row_2 - cp NUM_LEVELS - 20 - jr nc, .row_1 -; row 0 - ld b, a - ld d, $48 - jr .got_y -.row_1 - sub 5 - ld b, a - ld d, $50 - jr .got_y -.row_2 - sub 10 - ld b, a - ld d, $58 - jr .got_y -.row_3 - sub 15 - ld b, a - ld d, $60 - jr .got_y -.row_4 - sub 20 - ld b, a - ld d, $68 -.got_y - ld hl, wMenuObj1YCoord - ld a, [hl] ; y - cp d - jr z, .check_column - ; move down - inc [hl] - xor a - ret - -.check_column - dec b - jr z, .col_1 - dec b - jr z, .col_2 - dec b - jr z, .col_3 - dec b - jr z, .col_4 -; col 0 - ld e, $40 - jr .got_x -.col_1 - ld e, $48 - jr .got_x -.col_2 - ld e, $50 - jr .got_x -.col_3 - ld e, $58 - jr .got_x -.col_4 - ld e, $60 -.got_x - ld hl, wMenuObj1XCoord - ld a, [hl] - cp e - jr z, .done_movement - ; move left - dec [hl] - xor a - ret -.done_movement - ld a, TRUE - ret - -DoPencilScribbling: - ld a, [wTimer] - ld e, a - ld d, $00 - ld hl, PencilScribbleXOffsets - add hl, de - ld a, [wMenuObj1YCoord] - add [hl] - ld [wMenuObj1YCoord], a - ld hl, PencilScribbleYOffsets - add hl, de - ld a, [wMenuObj1XCoord] - add [hl] - ld [wMenuObj1XCoord], a - ret - -MusicalCoinLevelBGPals: - db 4 ; LEVEL_OUT_OF_THE_WOODS - db 4 ; LEVEL_THE_PEACEFUL_VILLAGE - db 4 ; LEVEL_THE_VAST_PLAIN - db 4 ; LEVEL_BANK_OF_THE_WILD_RIVER - db 4 ; LEVEL_THE_TIDAL_COAST - db 6 ; LEVEL_SEA_TURTLE_ROCKS - db 7 ; LEVEL_DESERT_RUINS - db 6 ; LEVEL_THE_VOLCANOS_BASE - db 7 ; LEVEL_THE_POOL_OF_RAIN - db 7 ; LEVEL_A_TOWN_IN_CHAOS - db 6 ; LEVEL_BENEATH_THE_WAVES - db 6 ; LEVEL_THE_WEST_CRATER - db 6 ; LEVEL_THE_GRASSLANDS - db 7 ; LEVEL_THE_BIG_BRIDGE - db 7 ; LEVEL_TOWER_OF_REVIVAL - db 7 ; LEVEL_THE_STEEP_CANYON - db 7 ; LEVEL_CAVE_OF_FLAMES - db 7 ; LEVEL_ABOVE_THE_CLOUDS - db 7 ; LEVEL_THE_STAGNANT_SWAMP - db 7 ; LEVEL_THE_FRIGID_SEA - db 7 ; LEVEL_CASTLE_OF_ILLUSIONS - db 7 ; LEVEL_THE_COLOSSAL_HOLE - db 7 ; LEVEL_THE_WARPED_VOID - db 7 ; LEVEL_THE_EAST_CRATER - db 7 ; LEVEL_FOREST_OF_FEAR - -PencilScribbleXOffsets: - db 0 - db 0 - db 0 - db 0 - db 1 - db 1 - db 1 - db 1 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 1 - db 1 - db 1 - db 1 - db 0 - db 0 - db 0 - db 0 - db -1 - db -1 - db -1 - db -1 - db -1 - db -1 - db -1 - db -1 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 1 - db 1 - db 1 - db 1 - db 1 - db 1 - db 1 - db 1 - db 0 - db 0 - db 0 - db 0 - -PencilScribbleYOffsets: - db 1 - db 1 - db 1 - db 1 - db -1 - db -1 - db -1 - db -1 - db 1 - db 1 - db 1 - db 1 - db 1 - db 1 - db 1 - db 1 - db -1 - db -1 - db -1 - db -1 - db -1 - db -1 - db -1 - db -1 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 1 - db 1 - db 1 - db 1 - db 1 - db 1 - db 1 - db 1 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db -1 - db -1 - db -1 - db -1 - -OAM_d49cc:: - dw .frame_0 - dw .frame_1 - dw .frame_2 - dw .frame_3 - dw .frame_4 - dw .frame_5 - dw .frame_6 - dw .frame_7 - dw .frame_8 - dw .frame_9 - dw .frame_10 - dw .frame_11 - dw .frame_12 - dw .frame_13 - dw .frame_14 - dw .frame_15 - dw .frame_16 - dw .frame_17 - dw .frame_18 - dw .frame_19 - dw .frame_20 - dw .frame_21 - dw .frame_22 - dw .frame_23 - dw .frame_24 - dw .frame_25 - dw .frame_26 - dw .frame_27 - -.frame_0 - frame_oam -32, -16, $00, 0 - frame_oam -32, -8, $02, 0 - frame_oam -16, -16, $20, 0 - frame_oam -16, -8, $22, 0 - frame_oam -32, 8, $00, 0 | OAMF_XFLIP - frame_oam -32, 0, $02, 0 | OAMF_XFLIP - frame_oam -16, 8, $20, 0 | OAMF_XFLIP - frame_oam -16, 0, $22, 0 | OAMF_XFLIP - db $80 - -.frame_1 - frame_oam -16, -16, $24, 0 - frame_oam -16, -8, $26, 0 - frame_oam -32, -12, $04, 0 - frame_oam -32, -4, $06, 0 - frame_oam -32, 4, $04, 0 | OAMF_XFLIP - frame_oam -16, 8, $24, 0 | OAMF_XFLIP - frame_oam -16, 0, $26, 0 | OAMF_XFLIP - db $80 - -.frame_2 - frame_oam -16, 0, $08, 0 - frame_oam -16, 8, $0a, 0 - frame_oam -32, -12, $04, 0 - frame_oam -32, -4, $06, 0 - frame_oam -32, 4, $04, 0 | OAMF_XFLIP - frame_oam -16, -16, $20, 0 - frame_oam -16, -8, $22, 0 - db $80 - -.frame_3 - frame_oam -32, -12, $54, 0 - frame_oam -32, -4, $56, 0 - frame_oam -16, -16, $5c, 0 - frame_oam -16, -8, $5e, 0 - frame_oam -16, 0, $28, 0 - frame_oam -29, 4, $58, 0 - frame_oam -32, 12, $5a, 0 - db $80 - -.frame_4 - frame_oam -32, -12, $54, 0 - frame_oam -32, -4, $56, 0 - frame_oam -16, -16, $5c, 0 - frame_oam -16, -8, $5e, 0 - frame_oam -16, 0, $28, 0 - frame_oam -29, 4, $58, 0 - frame_oam -32, 12, $5a, 0 - frame_oam -40, 8, $4a, 0 - frame_oam -40, 16, $4a, 0 | OAMF_XFLIP - db $80 - -.frame_5 - frame_oam -29, 4, $58, 0 - frame_oam -32, 12, $5a, 0 - frame_oam -39, 8, $0c, 4 - frame_oam -39, 16, $0c, 4 | OAMF_XFLIP - frame_oam -32, -12, $54, 0 - frame_oam -32, -4, $56, 0 - frame_oam -16, -16, $5c, 0 - frame_oam -16, -8, $5e, 0 - frame_oam -16, 0, $28, 0 - db $80 - -.frame_6 - frame_oam -32, -12, $54, 0 - frame_oam -32, -4, $56, 0 - frame_oam -16, -16, $5c, 0 - frame_oam -16, -8, $5e, 0 - frame_oam -16, 0, $28, 0 - frame_oam -29, 4, $58, 0 - frame_oam -32, 12, $5a, 0 - frame_oam -39, 16, $2c, 4 - frame_oam -39, 8, $2c, 4 | OAMF_XFLIP - db $80 - -.frame_7 - frame_oam -32, 6, $0e, 0 | OAMF_XFLIP - frame_oam -32, -1, $10, 0 | OAMF_XFLIP - frame_oam -32, -9, $12, 0 | OAMF_XFLIP - frame_oam -16, 7, $2e, 0 | OAMF_XFLIP - frame_oam -16, -1, $30, 0 | OAMF_XFLIP - frame_oam -16, -9, $32, 0 | OAMF_XFLIP - frame_oam -21, -17, $14, 0 | OAMF_XFLIP - db $80 - -.frame_8 - frame_oam -16, -8, $36, 0 - frame_oam -16, 0, $36, 0 | OAMF_XFLIP - frame_oam -16, -16, $34, 0 - frame_oam -16, 8, $34, 0 | OAMF_XFLIP - frame_oam -32, 0, $18, 0 | OAMF_XFLIP - frame_oam -32, -8, $1a, 0 | OAMF_XFLIP - frame_oam -32, 7, $0e, 0 | OAMF_XFLIP - frame_oam -32, -16, $0e, 0 - db $80 - -.frame_9 - frame_oam -32, -8, $16, 0 - frame_oam -16, -8, $36, 0 - frame_oam -32, 0, $16, 0 | OAMF_XFLIP - frame_oam -16, 0, $36, 0 | OAMF_XFLIP - frame_oam -16, -16, $34, 0 - frame_oam -16, 8, $34, 0 | OAMF_XFLIP - frame_oam -32, -16, $00, 0 - frame_oam -32, 8, $00, 0 | OAMF_XFLIP - db $80 - -.frame_10 - frame_oam -32, -12, $60, 0 - frame_oam -32, -4, $62, 0 - frame_oam -32, 4, $60, 0 | OAMF_XFLIP - frame_oam -16, -12, $64, 0 - frame_oam -16, -4, $66, 0 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - db $80 - -.frame_11 - frame_oam -32, -12, $60, 0 - frame_oam -32, -4, $62, 0 - frame_oam -32, 4, $60, 0 | OAMF_XFLIP - frame_oam -16, -12, $64, 0 - frame_oam -16, -4, $66, 0 - frame_oam -16, 4, $68, 0 - db $80 - -.frame_12 - frame_oam -32, -12, $60, 0 - frame_oam -32, -4, $62, 0 - frame_oam -32, 4, $60, 0 | OAMF_XFLIP - frame_oam -16, -12, $64, 0 - frame_oam -16, -4, $66, 0 - frame_oam -16, 4, $6a, 0 - db $80 - -.frame_13 - frame_oam -16, -12, $64, 0 - frame_oam -16, -4, $66, 0 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - frame_oam -32, -12, $72, 0 - frame_oam -32, -4, $74, 0 - frame_oam -32, 4, $72, 0 | OAMF_XFLIP - db $80 - -.frame_14 - frame_oam -16, -12, $64, 0 - frame_oam -16, -4, $66, 0 - frame_oam -32, -12, $72, 0 - frame_oam -32, -4, $74, 0 - frame_oam -32, 4, $72, 0 | OAMF_XFLIP - frame_oam -16, 4, $68, 0 - db $80 - -.frame_15 - frame_oam -16, -12, $64, 0 - frame_oam -16, -4, $66, 0 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - frame_oam -32, -12, $6c, 0 - frame_oam -32, -4, $6e, 0 - frame_oam -32, 4, $70, 0 - db $80 - -.frame_16 - frame_oam -16, -12, $64, 0 - frame_oam -16, -4, $66, 0 - frame_oam -32, -12, $6c, 0 - frame_oam -32, -4, $6e, 0 - frame_oam -32, 4, $70, 0 - frame_oam -16, 4, $68, 0 - db $80 - -.frame_17 - frame_oam -16, -12, $64, 0 - frame_oam -16, -4, $66, 0 - frame_oam -32, -12, $6c, 0 - frame_oam -32, -4, $6e, 0 - frame_oam -32, 4, $70, 0 - frame_oam -16, 4, $6a, 0 - db $80 - -.frame_18 - frame_oam -16, -12, $64, 0 - frame_oam -16, -4, $66, 0 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - frame_oam -32, 4, $6c, 0 | OAMF_XFLIP - frame_oam -32, -4, $6e, 0 | OAMF_XFLIP - frame_oam -32, -12, $70, 0 | OAMF_XFLIP - db $80 - -.frame_19 - frame_oam -32, 4, $60, 0 | OAMF_XFLIP - frame_oam -32, -4, $62, 0 | OAMF_XFLIP - frame_oam -32, -12, $60, 0 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - frame_oam -16, -4, $66, 0 | OAMF_XFLIP - frame_oam -16, -12, $68, 0 | OAMF_XFLIP - db $80 - -.frame_20 - frame_oam -32, 4, $60, 0 | OAMF_XFLIP - frame_oam -32, -4, $62, 0 | OAMF_XFLIP - frame_oam -32, -12, $60, 0 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - frame_oam -16, -4, $66, 0 | OAMF_XFLIP - frame_oam -16, -12, $6a, 0 | OAMF_XFLIP - db $80 - -.frame_21 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - frame_oam -16, -4, $66, 0 | OAMF_XFLIP - frame_oam -32, 4, $72, 0 | OAMF_XFLIP - frame_oam -32, -4, $74, 0 | OAMF_XFLIP - frame_oam -32, -12, $72, 0 - frame_oam -16, -12, $68, 0 | OAMF_XFLIP - db $80 - -.frame_22 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - frame_oam -16, -4, $66, 0 | OAMF_XFLIP - frame_oam -16, -12, $64, 0 - frame_oam -32, 4, $6c, 0 | OAMF_XFLIP - frame_oam -32, -4, $6e, 0 | OAMF_XFLIP - frame_oam -32, -12, $70, 0 | OAMF_XFLIP - db $80 - -.frame_23 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - frame_oam -16, -4, $66, 0 | OAMF_XFLIP - frame_oam -32, 4, $6c, 0 | OAMF_XFLIP - frame_oam -32, -4, $6e, 0 | OAMF_XFLIP - frame_oam -32, -12, $70, 0 | OAMF_XFLIP - frame_oam -16, -12, $68, 0 | OAMF_XFLIP - db $80 - -.frame_24 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - frame_oam -16, -4, $66, 0 | OAMF_XFLIP - frame_oam -32, 4, $6c, 0 | OAMF_XFLIP - frame_oam -32, -4, $6e, 0 | OAMF_XFLIP - frame_oam -32, -12, $70, 0 | OAMF_XFLIP - frame_oam -16, -12, $6a, 0 | OAMF_XFLIP - db $80 - -.frame_25 - frame_oam -16, 4, $64, 0 | OAMF_XFLIP - frame_oam -16, -4, $66, 0 | OAMF_XFLIP - frame_oam -16, -12, $64, 0 - frame_oam -32, -12, $6c, 0 - frame_oam -32, -4, $6e, 0 - frame_oam -32, 4, $70, 0 - db $80 - -.frame_26 - frame_oam -32, -12, $54, 0 - frame_oam -32, -4, $56, 0 - frame_oam -16, -16, $5c, 0 - frame_oam -16, -8, $5e, 0 - frame_oam -16, 0, $28, 0 - frame_oam -16, 8, $2a, 0 - frame_oam -32, 4, $76, 0 - frame_oam -32, 12, $78, 0 - db $80 - -.frame_27 - frame_oam -16, -16, $5c, 0 - frame_oam -16, -8, $5e, 0 - frame_oam -16, 0, $28, 0 - frame_oam -32, -12, $54, 0 - frame_oam -32, 4, $7a, 0 - frame_oam -32, -4, $56, 0 - frame_oam -16, 8, $7c, 0 - db $80 - -Frameset_d4d18: - db $00, 30 - db $ff - -Frameset_d4d1b:: - db $01, 8 - db $02, 8 - db $03, 1 - db $04, 1 - db $05, 1 - db $06, 1 - db $03, 1 - db $04, 1 - db $05, 1 - db $06, 1 - db $03, 1 - db $04, 1 - db $05, 1 - db $06, 1 - db $03, 1 - db $04, 1 - db $05, 1 - db $06, 1 - db $03, 1 - db $04, 1 - db $05, 1 - db $06, 1 - db $03, 1 - db $04, 1 - db $05, 1 - db $06, 1 - db $03, 8 - db $1a, 4 - db $1b, 6 - db $00, 180 - db $ff - -Frameset_d4d58: - db $07, 20 - db $08, 10 - db $09, 10 - db $ff - -Frameset_d4d5f:: - db $0a, 8 - db $0b, 4 - db $0c, 4 - db $0a, 4 - db $0b, 4 - db $0c, 4 - db $0a, 4 - db $0b, 4 - db $0c, 4 - db $0a, 4 - db $0b, 4 - db $0c, 4 - db $0d, 4 - db $0e, 4 - db $0c, 4 - db $0d, 4 - db $0e, 4 - db $0c, 4 - db $0f, 4 - db $10, 4 - db $11, 4 - db $0f, 4 - db $10, 4 - db $11, 4 - db $0a, 4 - db $12, 8 - db $0a, 4 - db $10, 4 - db $11, 4 - db $0f, 4 - db $0d, 30 - db $09, 60 - db $0d, 10 - db $0a, 8 - db $13, 4 - db $14, 4 - db $0a, 4 - db $13, 4 - db $14, 4 - db $0a, 4 - db $13, 4 - db $14, 4 - db $0a, 4 - db $13, 4 - db $14, 4 - db $0d, 4 - db $15, 4 - db $14, 4 - db $0d, 4 - db $15, 4 - db $14, 4 - db $16, 4 - db $17, 4 - db $18, 4 - db $16, 4 - db $17, 4 - db $18, 4 - db $0a, 4 - db $19, 8 - db $0a, 4 - db $17, 4 - db $18, 4 - db $16, 4 - db $0d, 30 - db $0a, 8 - db $0b, 4 - db $ff - -Frameset_d4de4:: - db $0a, 8 - db $0b, 4 - db $0c, 4 - db $0a, 4 - db $0b, 4 - db $0c, 4 - db $0a, 4 - db $0b, 4 - db $0c, 4 - db $0a, 4 - db $0b, 4 - db $0c, 4 - db $0d, 4 - db $0e, 4 - db $0c, 4 - db $0d, 4 - db $0e, 4 - db $0c, 4 - db $0f, 4 - db $10, 4 - db $11, 4 - db $0f, 4 - db $10, 4 - db $11, 4 - db $0a, 4 - db $12, 8 - db $0a, 4 - db $10, 4 - db $11, 4 - db $0f, 4 - db $0d, 30 - db $ff - -; unreferenced -Frameset_d4e23: - db $09, 4 - db $ff - -OAM_d4e26: - dw .frame_0 - dw .frame_1 - dw .frame_2 - dw .frame_3 - dw .frame_4 - dw .frame_5 - dw .frame_6 - dw .frame_7 - dw .frame_8 - dw .frame_9 - dw .frame_10 - dw .frame_11 - dw .frame_12 - dw .frame_13 - dw .frame_14 - dw .frame_15 - dw .frame_16 - dw .frame_17 - dw .frame_18 - dw .frame_19 - dw .frame_20 - dw .frame_21 - dw .frame_22 - dw .frame_23 - dw .frame_24 - dw .frame_25 - dw .frame_26 - dw .frame_27 - dw .frame_28 - -.frame_0 - frame_oam -16, -8, $90, 7 - frame_oam -16, 0, $92, 7 - frame_oam -16, -12, $ba, 0 - frame_oam -16, 4, $ba, 0 | OAMF_XFLIP - frame_oam -16, -4, $d6, 0 - db $80 - -.frame_1 - frame_oam -16, -8, $90, 7 - frame_oam -16, 0, $92, 7 - frame_oam -16, -12, $b6, 0 - frame_oam -16, 4, $b6, 0 | OAMF_XFLIP - frame_oam -16, -4, $d8, 0 - db $80 - -.frame_2 - frame_oam -16, -8, $94, 7 - frame_oam -16, 0, $96, 7 - frame_oam -16, -12, $ba, 0 - frame_oam -16, 4, $ba, 0 | OAMF_XFLIP - frame_oam -16, -4, $d6, 0 - db $80 - -.frame_3 - frame_oam -16, -8, $94, 7 - frame_oam -16, 0, $96, 7 - frame_oam -16, -12, $b6, 0 - frame_oam -16, 4, $b6, 0 | OAMF_XFLIP - frame_oam -16, -4, $d8, 0 - db $80 - -.frame_4 - frame_oam -16, -8, $98, 7 - frame_oam -16, 0, $9a, 7 - frame_oam -16, -12, $ba, 0 - frame_oam -16, 4, $ba, 0 | OAMF_XFLIP - frame_oam -16, -4, $d6, 0 - db $80 - -.frame_5 - frame_oam -16, -8, $98, 7 - frame_oam -16, 0, $9a, 7 - frame_oam -16, -12, $b6, 0 - frame_oam -16, 4, $b6, 0 | OAMF_XFLIP - frame_oam -16, -4, $d8, 0 - db $80 - -.frame_6 - frame_oam -16, -8, $9c, 7 - frame_oam -16, 0, $9e, 7 - frame_oam -16, -12, $ba, 0 - frame_oam -16, 4, $ba, 0 | OAMF_XFLIP - frame_oam -16, -4, $d6, 0 - db $80 - -.frame_7 - frame_oam -16, -8, $9c, 7 - frame_oam -16, 0, $9e, 7 - frame_oam -16, -12, $b6, 0 - frame_oam -16, 4, $b6, 0 | OAMF_XFLIP - frame_oam -16, -4, $d8, 0 - db $80 - -.frame_8 - frame_oam -34, -12, $d0, 3 - frame_oam -34, -4, $d2, 3 - frame_oam -34, 4, $d4, 3 - frame_oam -18, -14, $f0, 3 - frame_oam -18, -6, $f2, 3 - frame_oam -18, 2, $f4, 3 - frame_oam -18, 10, $f6, 3 - frame_oam -34, 50, $da, 3 - frame_oam -34, 58, $dc, 3 - frame_oam -34, 66, $de, 3 - frame_oam -18, 46, $f8, 3 - frame_oam -18, 54, $fa, 3 - frame_oam -18, 62, $fc, 3 - frame_oam -18, 70, $fe, 3 - db $80 - -.frame_9 - frame_oam -16, -8, $c0, 4 - frame_oam -16, 0, $c2, 4 - db $80 - -.frame_10 - frame_oam -16, -8, $c4, 2 - frame_oam -16, 0, $c6, 2 - db $80 - -.frame_11 - frame_oam -16, -8, $c8, 6 - frame_oam -16, 0, $ca, 6 - db $80 - -.frame_12 - frame_oam -16, -8, $cc, 5 - frame_oam -16, 0, $ce, 5 - db $80 - -.frame_13 - frame_oam -16, -8, $e0, 4 - frame_oam -16, 0, $e2, 4 - db $80 - -.frame_14 - frame_oam -22, -16, $e4, 0 - frame_oam -16, -8, $e6, 0 - frame_oam -16, 0, $e8, 0 - frame_oam -22, 8, $ea, 0 - db $80 - -.frame_15 - frame_oam -24, -16, $e4, 0 - frame_oam -18, -8, $e6, 0 - frame_oam -18, 0, $e8, 0 - frame_oam -24, 8, $ea, 0 - db $80 - -.frame_16 - frame_oam -25, -16, $e4, 0 - frame_oam -19, -8, $e6, 0 - frame_oam -19, 0, $e8, 0 - frame_oam -25, 8, $ea, 0 - db $80 - -.frame_17 - frame_oam -20, -16, $e4, 0 - frame_oam -14, -8, $e6, 0 - frame_oam -14, 0, $e8, 0 - frame_oam -20, 8, $ea, 0 - db $80 - -.frame_18 - frame_oam -19, -16, $e4, 0 - frame_oam -13, -8, $e6, 0 - frame_oam -13, 0, $e8, 0 - frame_oam -19, 8, $ea, 0 - db $80 - -.frame_19 - frame_oam -16, -16, $e0, 0 | OAMF_BANK1 - frame_oam -16, -8, $e2, 0 | OAMF_BANK1 - frame_oam -16, 0, $e4, 0 | OAMF_BANK1 - frame_oam -16, 8, $e6, 0 | OAMF_BANK1 - db $80 - -.frame_20 - frame_oam -18, -16, $e0, 0 | OAMF_BANK1 - frame_oam -18, -8, $e2, 0 | OAMF_BANK1 - frame_oam -18, 0, $e4, 0 | OAMF_BANK1 - frame_oam -18, 8, $e6, 0 | OAMF_BANK1 - db $80 - -.frame_21 - frame_oam -19, -16, $e0, 0 | OAMF_BANK1 - frame_oam -19, -8, $e2, 0 | OAMF_BANK1 - frame_oam -19, 0, $e4, 0 | OAMF_BANK1 - frame_oam -19, 8, $e6, 0 | OAMF_BANK1 - db $80 - -.frame_22 - frame_oam -14, -16, $e0, 0 | OAMF_BANK1 - frame_oam -14, -8, $e2, 0 | OAMF_BANK1 - frame_oam -14, 0, $e4, 0 | OAMF_BANK1 - frame_oam -14, 8, $e6, 0 | OAMF_BANK1 - db $80 - -.frame_23 - frame_oam -13, -16, $e0, 0 | OAMF_BANK1 - frame_oam -13, -8, $e2, 0 | OAMF_BANK1 - frame_oam -13, 0, $e4, 0 | OAMF_BANK1 - frame_oam -13, 8, $e6, 0 | OAMF_BANK1 - db $80 - -.frame_24 - frame_oam -16, -8, $ec, 4 - frame_oam -16, 0, $ee, 4 - db $80 - -.frame_25 - frame_oam -16, -8, $ec, 5 - frame_oam -16, 0, $ee, 5 - db $80 - -.frame_26 - frame_oam -16, -8, $ec, 6 - frame_oam -16, 0, $ee, 6 - db $80 - -.frame_27 - frame_oam -16, -8, $ec, 2 - frame_oam -16, 0, $ee, 2 - db $80 - -.frame_28 - frame_oam -16, -8, $e8, 7 | OAMF_BANK1 - frame_oam -16, -1, $e8, 7 | OAMF_BANK1 | OAMF_XFLIP - db $80 - -Frameset_d5045:: - db $00, 3 - db $01, 3 - db $ff - -Frameset_d504a:: - db $02, 3 - db $03, 3 - db $ff - -Frameset_d504f:: - db $04, 3 - db $05, 3 - db $ff - -Frameset_d5054:: - db $06, 3 - db $07, 3 - db $ff - -Frameset_d5059: - db $08, 4 - db $ff - -Frameset_d505c: - db $09, 4 - db $ff - -Frameset_d505f: - db $0a, 4 - db $ff - -Frameset_d5062: - db $0b, 4 - db $ff - -Frameset_d5065: - db $0c, 4 - db $ff - -Frameset_d5068: - db $0d, 4 - db $ff - -Frameset_d506b: - db $0e, 4 - db $0f, 4 - db $10, 4 - db $10, 4 - db $0f, 4 - db $0e, 4 - db $11, 4 - db $12, 4 - db $12, 4 - db $11, 4 - db $ff - -Frameset_d5080: - db $13, 4 - db $14, 4 - db $15, 4 - db $15, 4 - db $14, 4 - db $13, 4 - db $16, 4 - db $17, 4 - db $17, 4 - db $16, 4 - db $ff - -Frameset_d5095: - db $18, 4 - db $ff - -Frameset_d5098: - db $19, 4 - db $ff - -Frameset_d509b: - db $1a, 4 - db $ff - -Frameset_d509e: - db $1b, 4 - db $ff - -Frameset_d50a1: - db $1c, 4 - db $ff - -Pals_d50a4: - rgb 31, 31, 31 - rgb 27, 27, 27 - rgb 22, 22, 22 - rgb 17, 17, 17 - - rgb 31, 21, 19 - rgb 13, 21, 31 - rgb 0, 0, 23 - rgb 0, 0, 0 - - rgb 3, 13, 0 - rgb 21, 31, 14 - rgb 8, 23, 1 - rgb 0, 2, 0 - - rgb 31, 21, 19 - rgb 10, 4, 17 - rgb 30, 8, 4 - rgb 0, 0, 0 - - rgb 31, 29, 15 - rgb 28, 21, 1 - rgb 10, 10, 10 - rgb 0, 4, 0 - - rgb 31, 21, 19 - rgb 0, 0, 29 - rgb 0, 0, 12 - rgb 0, 0, 0 - - rgb 6, 30, 0 - rgb 0, 16, 0 - rgb 0, 10, 0 - rgb 0, 4, 0 - - rgb 6, 30, 0 - rgb 0, 16, 0 - rgb 30, 0, 0 - rgb 0, 4, 0 - -Pals_d50e4: - rgb 0, 22, 16 - rgb 27, 12, 0 - rgb 27, 20, 0 - rgb 0, 0, 0 - - rgb 0, 22, 16 - rgb 31, 31, 31 - rgb 6, 23, 27 - rgb 0, 0, 0 - - rgb 0, 22, 16 - rgb 31, 31, 20 - rgb 31, 27, 0 - rgb 9, 5, 0 - - rgb 0, 22, 16 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - - rgb 0, 22, 16 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - - rgb 0, 22, 16 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - - rgb 0, 22, 16 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - - rgb 0, 22, 16 - rgb 21, 21, 21 - rgb 10, 10, 10 - rgb 0, 0, 0 - -; TODO in its own section to be added to golf.o? -GolfMenuGfx:: INCBIN "gfx/golf/golf_menu.2bpp.rle" - -BGMap_d63fd: -INCBIN "gfx/bgmaps/map_d63fd.bin" - -BGMap_d6502: -INCBIN "gfx/bgmaps/map_d6502.bin" - -OAM_d65e1: - dw .frame_0 - -.frame_0 - frame_oam -16, 0, $b6, 0 - frame_oam -16, 8, $b8, 0 - frame_oam -8, 0, $ba, 1 - db $80 - -Frameset_d65f0: - db $00, 4 - db $ff diff --git a/src/engine/clear/add_sprite.asm b/src/engine/clear/add_sprite.asm new file mode 100644 index 0000000..2e3dc8c --- /dev/null +++ b/src/engine/clear/add_sprite.asm @@ -0,0 +1,35 @@ +AddClearScreenSprite: + ld a, [wSCY] + ld b, a + ld a, [hli] + add OAM_Y_OFS + sub b + ld [wCurSprite], a + ld a, [hli] + add OAM_X_OFS + ld [wCurSpriteXCoord], a + ld a, [hli] + ld [wCurSpriteFrame], a + ld a, [hl] + ld [wCurSpriteAttributes], a + ld hl, OAM_d4e26 + call AddSprite + ret + +AddClearScreenWarioSprite: + ld a, [wSCY] + ld b, a + ld a, [hli] + add OAM_Y_OFS + sub b + ld [wCurSprite], a + ld a, [hli] + add OAM_X_OFS + ld [wCurSpriteXCoord], a + ld a, [hli] + ld [wCurSpriteFrame], a + ld a, [hl] + ld [wCurSpriteAttributes], a + ld hl, OAM_d49cc + call AddSprite + ret diff --git a/src/engine/clear/musical_coin_flags.asm b/src/engine/clear/musical_coin_flags.asm new file mode 100644 index 0000000..946f776 --- /dev/null +++ b/src/engine/clear/musical_coin_flags.asm @@ -0,0 +1,129 @@ +Func_d47f1: + ld a, BANK("VRAM1") + ldh [rVBK], a + ld hl, wMusicalCoinFlags + lb bc, (NUM_LEVELS / 8), 8 + debgcoord 8, 9 + ld a, -1 + ldh [hffa0], a +.loop_bits + ldh a, [hffa0] + inc a + ldh [hffa0], a + rrc [hl] + call c, .ApplyBGPal + inc e + ld a, e + and $1f + cp 13 + jr nz, .next_bit + ld a, e + add BG_MAP_WIDTH - 5 + ld e, a +.next_bit + dec c + jr nz, .loop_bits + inc hl ; next byte in wMusicalCoinFlags + ld c, 8 + dec b + jr nz, .loop_bits + bit 0, [hl] + call nz, .ApplyBGPal + xor a + ldh [rVBK], a + ret + +.ApplyBGPal: + push bc + push hl + ldh a, [hffa0] + ld c, a + ld b, $00 + ld hl, MusicalCoinLevelBGPals + add hl, bc + ld a, [hl] + ld [de], a + pop hl + pop bc + ret + +SetMusicalCoinFlag: + ld a, [wLevel] + srl a + srl a + srl a + ld c, a + ld [wAllMusicalCoinsLevel], a ; LEVEL_* constant + srl a + srl a + srl a + ld e, a ; /8 + ld d, $00 + ld hl, wMusicalCoinFlags + add hl, de + ld a, c + and %111 + ld c, a + jr z, .got_flag +.rotate_flags_right + rrc [hl] + dec c + jr nz, .rotate_flags_right +.got_flag + bit 0, [hl] + jr z, .set_flag + ; already set + push af + ld a, $ff + ld [wAllMusicalCoinsLevel], a + pop af + jr .restore_flags +.set_flag + set 0, [hl] +.restore_flags + and a + ret z ; no need to rotate back +.rotate_flags_left + rlc [hl] + dec a + jr nz, .rotate_flags_left + ret + +; check if a bit is set in wMusicalCoinFlags +; for the level in wOWLevel +_CheckLevelMusicalCoinFlag:: + ld hl, wMusicalCoinFlags + ld a, [wOWLevel] + dec a + ld c, a + srl a + srl a + srl a ; /8 + ld e, a + ld d, $00 + add hl, de + ld a, c + and %111 + ld c, a + jr z, .check_flag +.loop_1 + rrc [hl] + dec c + jr nz, .loop_1 +.check_flag + ld c, a + bit 0, [hl] + jr nz, .flag_set + ld b, FALSE + jr .got_result +.flag_set + ld b, TRUE +.got_result + ld a, c + and a + ret z +.loop_2 + rlc [hl] + dec a + jr nz, .loop_2 + ret diff --git a/src/engine/clear/musical_coins.asm b/src/engine/clear/musical_coins.asm new file mode 100644 index 0000000..d3803c9 --- /dev/null +++ b/src/engine/clear/musical_coins.asm @@ -0,0 +1,294 @@ +InitMusicalCoinScreen: + call DisableLCD + call ClearBGMap0 + call ClearVirtualOAM + + call Func_d464e + call Func_d465b + call Func_d4668 + call Func_d47f1 + + ld a, $ff + ld [wAllMusicalCoinsLevel], a + ld a, [wNumMusicalCoins] + cp NUM_LEVEL_MUSICAL_COINS + call z, SetMusicalCoinFlag + + call VBlank_MusicalCoinsScreen + + xor a + ld [wSCX], a + ldh [rSCX], a + ld [wSCY], a + ldh [rSCY], a + + ld hl, wMenuObj3 + ld a, $38 + ld [hli], a ; y + ld a, $40 + ld [hli], a ; x + xor a + ld [hli], a + ld [hli], a + ld [hli], a + ld [hli], a + ld a, HIGH(Frameset_1f1cd4) + ld [hli], a + ld a, LOW(Frameset_1f1cd4) + ld [hl], a + farcall $7c, UpdateObjAnim + ld hl, wMenuObj3 + farcall AddPauseMenuSprite + + ld a, 8 + ld [wAnimatedTilesFrameDuration], a + ld a, ANIMATED_TILES_GFX_15 + ld [wAnimatedTilesGfx], a + xor a + ld [wAnimatedTilesFrameCount], a + ld [wAnimatedTilesFrame], a + inc a ; TRUE + ld [wRoomAnimatedTilesEnabled], a + ld a, LCDC_DEFAULT + ldh [rLCDC], a + xor a + ld [wMusicalCoinVisualCounter], a + ld a, 60 + ld [wTimer], a + ld hl, wSubState + inc [hl] + ret + +Func_d4472: + ld hl, wMenuObj3FramesetPtr + 1 + farcall $7c, UpdateObjAnim + ld hl, wMenuObj3 + farcall AddPauseMenuSprite + call ClearUnusedVirtualOAM + + ld hl, wNumMusicalCoins + ld a, [wMusicalCoinVisualCounter] + cp [hl] + jr z, .counting_up_done + ld hl, wTimer + ld a, [hl] + and a + jr z, .count_up + dec [hl] + ret + +.count_up + ld a, [wGlobalCounter] + and %11 + ret nz + play_sfx SFX_REGULAR_COIN + ld hl, wBGMapTileVRAM0Queue + ld a, HIGH(v0BGMap0 + $8b) + ld [hli], a + ld a, LOW(v0BGMap0 + $8b) + ld [hli], a + + ld a, [wMusicalCoinVisualCounter] + inc a + ld [wMusicalCoinVisualCounter], a + add a ; *2 + add $a0 + ld b, a + ld [hli], a + ld a, $98 + ld [hli], a + ld a, $ab + ld [hli], a + inc b + ld [hl], b + ld a, $80 + ld [wcee4], a + ret + +.counting_up_done + ld a, [wAllMusicalCoinsLevel] + inc a + jp z, Func_d45e1 + + play_sfx SFX_03A + + ld hl, wMenuObj1 + ld a, $42 + ld [hli], a ; y + ld a, $60 + ld [hli], a ; x + xor a + ld [hli], a + ld [hli], a + ld [hli], a + ld [hli], a + ld a, HIGH(Frameset_d65f0) + ld [hli], a + ld a, LOW(Frameset_d65f0) + ld [hl], a + call UpdateObjAnim + + ld hl, wSubState + inc [hl] + ret + +Func_d4507: + call DoPencilMovement + push af + ld hl, wMenuObj1 + call AddPencilSprite + ld hl, wMenuObj3FramesetPtr + 1 + farcall $7c, UpdateObjAnim + ld hl, wMenuObj3 + farcall AddPauseMenuSprite + call ClearUnusedVirtualOAM + pop af + and a + ret z + + xor a + ld [wTimer], a + play_sfx SFX_03A + ld hl, wSubState + inc [hl] + ret + +Func_d454c: + call DoPencilScribbling + + ld hl, wMenuObj1 + call AddPencilSprite + + ld hl, wMenuObj3FramesetPtr + 1 + farcall $7c, UpdateObjAnim + ld hl, wMenuObj3YCoord + farcall AddPauseMenuSprite + call ClearUnusedVirtualOAM + + ld hl, wTimer + inc [hl] + ld a, [hl] + cp 52 + jr nc, .done + cp 20 + ret nz + ld a, [wAllMusicalCoinsLevel] + ld e, a + ld d, $00 + ld hl, MusicalCoinLevelBGPals + add hl, de + ld b, [hl] + ld a, [wAllMusicalCoinsLevel] + cp NUM_LEVELS - 5 + jr nc, .row_4 + cp NUM_LEVELS - 10 + jr nc, .row_3 + cp NUM_LEVELS - 15 + jr nc, .row_2 + cp NUM_LEVELS - 20 + jr nc, .row_1 +; row 0 + hlbgcoord 8, 9 + jr .got_coords +.row_1 + sub 5 + hlbgcoord 8, 10 + jr .got_coords +.row_2 + sub 10 + hlbgcoord 8, 11 + jr .got_coords +.row_3 + sub 15 + hlbgcoord 8, 12 + jr .got_coords +.row_4 + sub 20 + hlbgcoord 8, 13 +.got_coords + ld e, a + ld d, $00 + add hl, de + ld d, h + ld e, l + ld hl, wBGMapTileVRAM0Queue + ld a, d + ld [hli], a + ld a, e + ld [hli], a + ld [hl], b + ld a, $81 + ld [wcee4], a + ret + +.done + play_sfx SFX_MUSICAL_COIN +; fallthrough + +Func_d45e1: + xor a + ld [wTimer + 0], a + ld a, 2 + ld [wTimer + 1], a + ld hl, wSubState + ld [hl], SST_CLEAR_EXIT + ret + +ExitClearScreen: + ld hl, wMenuObj3FramesetPtr + 1 + farcall $7c, UpdateObjAnim + ld hl, wMenuObj3 + farcall AddPauseMenuSprite + call ClearUnusedVirtualOAM + + ld a, [wJoypadPressed] + bit A_BUTTON_F, a + jr nz, .skip_timer + ld hl, wTimer + dec [hl] + ret nz + ld hl, wTimer + 1 + dec [hl] + ret nz + +.skip_timer + xor a + ld [wTimer + 0], a + ld [wTimer + 1], a + ld a, [wGameModeFlags] + bit MODE_TIME_ATTACK_F, a + jr nz, .asm_d463e + ld a, [wPowerUpLevel] + and ACTION_HELP_LEVEL_CLEAR + jp nz, OpenActionHelp +.asm_d463e + farcall Func_4628 + ret + +Func_d464e: + ld hl, Pals_d50a4 + call LoadPalsToTempPals1 + ld hl, Pals_d50e4 + call LoadPalsToTempPals2 + ret + +Func_d465b: + xor a + ldh [rVBK], a + ld hl, GolfMenuGfx + ld bc, v0Tiles0 + call Decompress + ret + +Func_d4668: + ld a, BANK("VRAM1") + ldh [rVBK], a + ld hl, BGMap_d6502 + ld bc, v1BGMap0 + call Decompress + xor a + ldh [rVBK], a + ld hl, BGMap_d63fd + ld bc, v0BGMap0 + call Decompress + ret diff --git a/src/engine/clear/pencil.asm b/src/engine/clear/pencil.asm new file mode 100644 index 0000000..0750189 --- /dev/null +++ b/src/engine/clear/pencil.asm @@ -0,0 +1,113 @@ +AddPencilSprite: + ld a, [wSCY] + ld b, a + ld a, [hli] + add OAM_Y_OFS + sub b + ld [wCurSprite], a + ld a, [hli] + add OAM_X_OFS + ld [wCurSpriteXCoord], a + ld a, [hli] + ld [wCurSpriteFrame], a + ld a, [hl] + ld [wCurSpriteAttributes], a + ld hl, OAM_d65e1 + call AddSprite + ret + +; returns TRUE in a if done movement +DoPencilMovement: + ld a, [wAllMusicalCoinsLevel] + cp NUM_LEVELS - 5 + jr nc, .row_4 + cp NUM_LEVELS - 10 + jr nc, .row_3 + cp NUM_LEVELS - 15 + jr nc, .row_2 + cp NUM_LEVELS - 20 + jr nc, .row_1 +; row 0 + ld b, a + ld d, $48 + jr .got_y +.row_1 + sub 5 + ld b, a + ld d, $50 + jr .got_y +.row_2 + sub 10 + ld b, a + ld d, $58 + jr .got_y +.row_3 + sub 15 + ld b, a + ld d, $60 + jr .got_y +.row_4 + sub 20 + ld b, a + ld d, $68 +.got_y + ld hl, wMenuObj1YCoord + ld a, [hl] ; y + cp d + jr z, .check_column + ; move down + inc [hl] + xor a + ret + +.check_column + dec b + jr z, .col_1 + dec b + jr z, .col_2 + dec b + jr z, .col_3 + dec b + jr z, .col_4 +; col 0 + ld e, $40 + jr .got_x +.col_1 + ld e, $48 + jr .got_x +.col_2 + ld e, $50 + jr .got_x +.col_3 + ld e, $58 + jr .got_x +.col_4 + ld e, $60 +.got_x + ld hl, wMenuObj1XCoord + ld a, [hl] + cp e + jr z, .done_movement + ; move left + dec [hl] + xor a + ret +.done_movement + ld a, TRUE + ret + +DoPencilScribbling: + ld a, [wTimer] + ld e, a + ld d, $00 + ld hl, PencilScribbleXOffsets + add hl, de + ld a, [wMenuObj1YCoord] + add [hl] + ld [wMenuObj1YCoord], a + ld hl, PencilScribbleYOffsets + add hl, de + ld a, [wMenuObj1XCoord] + add [hl] + ld [wMenuObj1XCoord], a + ret diff --git a/src/engine/clear/state_table.asm b/src/engine/clear/state_table.asm new file mode 100644 index 0000000..33cb90c --- /dev/null +++ b/src/engine/clear/state_table.asm @@ -0,0 +1,25 @@ +_ClearScreenStateTable: + ld a, [wSubState] + jumptable + + dw FastFadeToWhite + dw InitClearScreen + dw SlowFadeFromWhite + dw UpdateClearScreen + + dw SlowFadeBGToWhite ; SST_CLEAR_TIME_ATTACK + dw InitTimeAttackClearScreen + dw DarkenBGToPal_Fast + dw Func_d434c + + dw SlowFadeBGToWhite ; SST_CLEAR_MUSICAL_COINS + dw InitMusicalCoinScreen + dw DarkenBGToPal_Fast + dw Func_d4472 + dw Func_d4507 + dw Func_d454c + dw ExitClearScreen ; SST_CLEAR_EXIT + dw DebugReset + dw DebugReset + dw DebugReset + dw DebugReset diff --git a/src/engine/clear/time_attack_clear.asm b/src/engine/clear/time_attack_clear.asm new file mode 100644 index 0000000..0394e03 --- /dev/null +++ b/src/engine/clear/time_attack_clear.asm @@ -0,0 +1,172 @@ +InitTimeAttackClearScreen: + ld a, TRUE + ld [wResetDisabled], a + + call DisableLCD + call ClearBGMap0 + call ClearVirtualOAM + + ld a, TRANSITION_RETURN_TO_MAP + ld [wTransitionParam], a + + farcall Func_1e000d + farcall LoadClearScreenGfx + farcall Func_1e005f + call VBlank_ClearScreen + + xor a + ld [wSCX], a + ldh [rSCX], a + ld a, $04 + ld [wSCY], a + ldh [rSCY], a + farcall Func_1e028a + + ld a, [wTimeAttackResult] + cp TIME_ATTACK_GOT_HIGH_SCORE + jr nz, .asm_d42d3 + ld hl, wMenuObj8FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj8 + call AddClearScreenSprite + +.asm_d42d3 + ld hl, wClearScreenWarioFramesetPtr + 1 + call UpdateObjAnim + ld hl, wClearScreenWario + call AddClearScreenWarioSprite + + ld hl, wMenuObj2FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj2 + call AddClearScreenSprite + + ld hl, wMenuObj3FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj3 + call AddClearScreenSprite + + ld a, [wKeyAndTreasureFlags] + bit GREY_KEY_F, a + jr z, .red_key + ld hl, wMenuObj4FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj4 + call AddClearScreenSprite + +.red_key + ld a, [wKeyAndTreasureFlags] + bit RED_KEY_F, a + jr z, .green_key + ld hl, wMenuObj5FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj5 + call AddClearScreenSprite + +.green_key + ld a, [wKeyAndTreasureFlags] + bit GREEN_KEY_F, a + jr z, .blue_key + ld hl, wMenuObj6FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj6 + call AddClearScreenSprite + +.blue_key + ld a, [wKeyAndTreasureFlags] + bit BLUE_KEY_F, a + jr z, .done_keys + ld hl, wMenuObj7FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj7 + call AddClearScreenSprite + +.done_keys + ld a, LCDC_DEFAULT + ldh [rLCDC], a + ld hl, wSubState + inc [hl] + ret + +Func_d434c: + ld a, [wTimeAttackResult] + cp TIME_ATTACK_GOT_HIGH_SCORE + jr nz, .asm_d435f + ld hl, wMenuObj8FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj8 + call AddClearScreenSprite + +.asm_d435f + ld hl, wClearScreenWarioFramesetPtr + 1 + call UpdateObjAnim + ld a, [wActionHelpWarioVar] + and a + jr nz, .asm_d4394 + ld a, [wObjAnimWasReset] + and a + jr z, .asm_d4394 + ld a, $01 + ld [wActionHelpWarioVar], a + ld hl, wClearScreenWarioFramesetOffset + xor a + ld [hli], a + ld [hli], a + + ld a, [wTimeAttackResult] + cp TIME_ATTACK_GOT_HIGH_SCORE + jr nz, .asm_d438b + ld a, HIGH(Frameset_d4d1b) + ld [hli], a + ld a, LOW(Frameset_d4d1b) + ld [hl], a + jr .asm_d4391 +.asm_d438b + ld a, HIGH(Frameset_d4d5f) + ld [hli], a + ld a, LOW(Frameset_d4d5f) + ld [hl], a +.asm_d4391 + call UpdateObjAnim +.asm_d4394 + ld hl, wClearScreenWario + call AddClearScreenWarioSprite + + ld hl, wMenuObj2 + call AddClearScreenSprite + ld hl, wMenuObj3 + call AddClearScreenSprite + + ld a, [wKeyAndTreasureFlags] + bit GREY_KEY_F, a + jr z, .red_key + ld hl, wMenuObj4 + call AddClearScreenSprite + +.red_key + ld a, [wKeyAndTreasureFlags] + bit RED_KEY_F, a + jr z, .green_key + ld hl, wMenuObj5 + call AddClearScreenSprite + +.green_key + ld a, [wKeyAndTreasureFlags] + bit GREEN_KEY_F, a + jr z, .blue_key + ld hl, wMenuObj6 + call AddClearScreenSprite + +.blue_key + ld a, [wKeyAndTreasureFlags] + bit BLUE_KEY_F, a + jr z, .done_keys + ld hl, wMenuObj7 + call AddClearScreenSprite +.done_keys + call ClearUnusedVirtualOAM + + ld a, [wJoypadPressed] + bit A_BUTTON_F, a + ret z + jp OpenMusicalCoinsScreen diff --git a/src/engine/clear/treasure_clear.asm b/src/engine/clear/treasure_clear.asm new file mode 100644 index 0000000..c99d471 --- /dev/null +++ b/src/engine/clear/treasure_clear.asm @@ -0,0 +1,275 @@ +InitClearScreen: + ld a, TRUE + ld [wResetDisabled], a + + call DisableLCD + call ClearBGMap0 + call ClearVirtualOAM + + call SetTreasureTransitionParam + + ldh a, [rSVBK] + push af + ld a, BANK(wTreasuresCollected) + ldh [rSVBK], a + ld a, [wTransitionParam] + cp TRANSITION_RETURN_TO_MAP + jr z, .return_to_map + call IsTreasureCollected + ld a, [hl] + or d + ld [hl], a +.return_to_map + ld a, [wTreasuresCollected] + rlca + rlca + rlca + jr c, .has_gold_music_box + rlca + jr c, .has_red_music_box + rlca + jr c, .has_green_music_box + rlca + jr c, .has_blue_music_box + rlca + jr c, .has_yellow_music_box + xor a + jr .got_number_music_boxes +.has_gold_music_box + ld a, 5 + jr .got_number_music_boxes +.has_red_music_box + ld a, 4 + jr .got_number_music_boxes +.has_green_music_box + ld a, 3 + jr .got_number_music_boxes +.has_blue_music_box + ld a, 2 + jr .got_number_music_boxes +.has_yellow_music_box + ld a, 1 +.got_number_music_boxes + ld [wNumMusicBoxes], a + pop af + ldh [rSVBK], a + + farcall LoadClearScreenPals + call LoadCollectedTreasurePal_ClearScreen + farcall LoadClearScreenGfx + farcall LoadLevelTreasureData + farcall Func_1e0045 + + hlbgcoord 6, 16 + farcall PrintNumberCoins + + ld a, [wKeyAndTreasureFlags] + ld b, a + bit GREY_TREASURE_F, b + jr z, .check_red + hlbgcoord 3, 8 + ld a, $54 + ld [hli], a + inc a + ld [hl], a +.check_red + bit RED_TREASURE_F, b + jr z, .check_green + hlbgcoord 7, 8 + ld a, $54 + ld [hli], a + inc a + ld [hl], a +.check_green + bit GREEN_TREASURE_F, b + jr z, .check_blue + hlbgcoord 11, 8 + ld a, $5c + ld [hli], a + inc a + ld [hl], a +.check_blue + bit BLUE_TREASURE_F, b + jr z, .ok + hlbgcoord 15, 8 + ld a, $5c + ld [hli], a + inc a + ld [hl], a + +.ok + call UpdateNumCollectedTreasures + call VBlank_ClearScreen + + xor a + ld [wSCX], a + ldh [rSCX], a + ld a, $04 + ld [wSCY], a + ldh [rSCY], a + farcall Func_1e015b + + ld a, [wPowerUpLevel] + and ACTION_HELP_LEVEL_CLEAR + jr z, .no_power_up + ld hl, wMenuObj8FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj8 + call AddClearScreenSprite +.no_power_up + ld hl, wClearScreenWarioFramesetPtr + 1 + call UpdateObjAnim + ld hl, wClearScreenWario + call AddClearScreenWarioSprite + + ld a, [wLevelEndScreen] + cp LVLEND_NO_TREASURE + jr z, .no_treasure + ld hl, wMenuObj1FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj1 + call AddClearScreenSprite + +.no_treasure + ld hl, wMenuObj2FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj2 + call AddClearScreenSprite + + ld a, [wNumMusicBoxes] + and a + jp z, .no_music_boxes + dec a + jr z, .one_music_box + dec a + jr z, .two_music_boxes + dec a + jr z, .three_music_boxes + dec a + jr z, .four_music_boxes +; all music boxes + ld hl, wMenuObj3FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj3 + call AddClearScreenSprite +.four_music_boxes + ld hl, wMenuObj4FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj4 + call AddClearScreenSprite +.three_music_boxes + ld hl, wMenuObj5FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj5 + call AddClearScreenSprite +.two_music_boxes + ld hl, wMenuObj6FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj6 + call AddClearScreenSprite +.one_music_box + ld hl, wMenuObj7FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj7 + call AddClearScreenSprite + +.no_music_boxes + ld a, LCDC_DEFAULT + ldh [rLCDC], a + ld hl, wSubState + inc [hl] + ret + +UpdateClearScreen: + ld a, [wPowerUpLevel] + and ACTION_HELP_LEVEL_CLEAR + jr z, .asm_d41ce + ld hl, wMenuObj8FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj8 + call AddClearScreenSprite + +.asm_d41ce + ld hl, wClearScreenWarioFramesetPtr + 1 + call UpdateObjAnim + ld a, [wClearScreenWarioVar] + and a + jr nz, .asm_d4203 + ld a, [wObjAnimWasReset] + and a + jr z, .asm_d4203 + ld a, TRUE + ld [wClearScreenWarioVar], a + ; reset animation + ld hl, wClearScreenWarioFramesetOffset + xor a + ld [hli], a + ld [hli], a + ld a, [wTransitionParam] + cp TRANSITION_RETURN_TO_MAP + jr z, .asm_d41fa + ld a, HIGH(Frameset_d4d1b) + ld [hli], a + ld a, LOW(Frameset_d4d1b) + ld [hl], a + jr .got_frameset +.asm_d41fa + ld a, HIGH(Frameset_d4d5f) + ld [hli], a + ld a, LOW(Frameset_d4d5f) + ld [hl], a +.got_frameset + call UpdateObjAnim +.asm_d4203 + ld hl, wClearScreenWario + call AddClearScreenWarioSprite + + ld hl, wMenuObj2 + call AddClearScreenSprite + ld a, [wLevelEndScreen] + cp LVLEND_NO_TREASURE + jr z, .draw_music_boxes + ld hl, wMenuObj1FramesetPtr + 1 + call UpdateObjAnim + ld hl, wMenuObj1 + call AddClearScreenSprite + +.draw_music_boxes + ld a, [wNumMusicBoxes] + and a + jr z, .no_music_boxes + dec a + jr z, .one_music_box + dec a + jr z, .two_music_boxes + dec a + jr z, .three_music_boxes + dec a + jr z, .four_music_boxes +; five music boxes + ld hl, wMenuObj3 + call AddClearScreenSprite +.four_music_boxes + ld hl, wMenuObj4 + call AddClearScreenSprite +.three_music_boxes + ld hl, wMenuObj5 + call AddClearScreenSprite +.two_music_boxes + ld hl, wMenuObj6 + call AddClearScreenSprite +.one_music_box + ld hl, wMenuObj7 + call AddClearScreenSprite +.no_music_boxes + call ClearUnusedVirtualOAM + + ld a, [wJoypadPressed] + bit A_BUTTON_F, a + ret z +; fallthrough + +OpenMusicalCoinsScreen: + ld a, SST_CLEAR_MUSICAL_COINS + ld [wSubState], a + ret diff --git a/src/engine/clear/treasure_count.asm b/src/engine/clear/treasure_count.asm new file mode 100644 index 0000000..f9ba725 --- /dev/null +++ b/src/engine/clear/treasure_count.asm @@ -0,0 +1,29 @@ +UpdateNumCollectedTreasures: + ldh a, [rSVBK] + push af + ld a, BANK(wTreasuresCollected) + ldh [rSVBK], a + xor a + ld [wNumCollectedTreasures + 1], a + ld [wNumCollectedTreasures + 0], a + ld a, NUM_TREASURES - 1 +.loop_treasures + push af + call IsTreasureCollected + and a + jr z, .next_treasure + ld a, [wNumCollectedTreasures + 1] + add 1 + daa + ld [wNumCollectedTreasures + 1], a + ld a, [wNumCollectedTreasures + 0] + adc 0 + daa + ld [wNumCollectedTreasures + 0], a +.next_treasure + pop af + dec a + jr nz, .loop_treasures + pop af + ldh [rSVBK], a + ret diff --git a/src/engine/clear/treasure_transition.asm b/src/engine/clear/treasure_transition.asm new file mode 100644 index 0000000..278539f --- /dev/null +++ b/src/engine/clear/treasure_transition.asm @@ -0,0 +1,72 @@ +SetTreasureTransitionParam: + ld a, [wLevelEndScreen] + cp LVLEND_NO_TREASURE + jr z, .no_treasure + dec a + ld b, a + ld a, [wLevel] + srl a + srl a + srl a + add a + add a + add b + ld e, a + ld d, $00 + ld hl, LevelTreasureIDs_WithoutTemple + add hl, de + ld a, [hl] + ld [wTransitionParam], a + cp LEAD_OVERALLS_T + jr z, .lead_overalls + cp SWIMMING_FLIPPERS_T + jr z, .swimming_flippers + cp HEAD_SMASH_HELMET_T + jr z, .head_smash + cp GRAB_GLOVE_T + jr z, .grab_glove + cp GARLIC_T + jr z, .garlic + cp SUPER_JUMP_SLAM_OVERALLS_T + jr z, .super_jump_slam_overalls + cp HIGH_JUMP_BOOTS_T + jr z, .high_jump_boots + cp PRINCE_FROGS_GLOVES_T + jr z, .prince_frogs_gloves + cp SUPER_GRAB_GLOVES_T + jr z, .super_grab_gloves + ret +.no_treasure + ld a, TRANSITION_RETURN_TO_MAP + ld [wTransitionParam], a + ret + +.lead_overalls + ld a, LEAD_OVERALLS | ACTION_HELP_LEVEL_CLEAR + jr .set_power_up_level +.swimming_flippers + ld a, SWIMMING_FLIPPERS | ACTION_HELP_LEVEL_CLEAR + jr .set_power_up_level +.head_smash + ld a, HEAD_SMASH_HELMET | ACTION_HELP_LEVEL_CLEAR + jr .set_power_up_level +.grab_glove + ld a, GRAB_GLOVE | ACTION_HELP_LEVEL_CLEAR + jr .set_power_up_level +.garlic + ld a, GARLIC | ACTION_HELP_LEVEL_CLEAR + jr .set_power_up_level +.super_jump_slam_overalls + ld a, SUPER_JUMP_SLAM_OVERALLS | ACTION_HELP_LEVEL_CLEAR + jr .set_power_up_level +.high_jump_boots + ld a, HIGH_JUMP_BOOTS | ACTION_HELP_LEVEL_CLEAR + jr .set_power_up_level +.prince_frogs_gloves + ld a, PRINCE_FROGS_GLOVES | ACTION_HELP_LEVEL_CLEAR + jr .set_power_up_level +.super_grab_gloves + ld a, SUPER_GRAB_GLOVES | ACTION_HELP_LEVEL_CLEAR +.set_power_up_level + ld [wPowerUpLevel], a + ret diff --git a/src/engine/clear/vblank.asm b/src/engine/clear/vblank.asm new file mode 100644 index 0000000..7cb7ead --- /dev/null +++ b/src/engine/clear/vblank.asm @@ -0,0 +1,97 @@ +VBlank_ClearScreen: + ld hl, .Func + ld de, wVBlankFunc + ld b, .end - .Func + call CopyHLToDE + ret + +.Func: + ld a, [wSCY] + ldh [rSCY], a + ld a, [wSCX] + ldh [rSCX], a + + xor a + ldh [rVBK], a + ld hl, v0Tiles2 tile $71 + (TILE_SIZE - 2) + ld c, [hl] + ld b, TILE_SIZE - 1 + ld de, v0Tiles2 tile $71 + (TILE_SIZE - 4) +.loop1 + ld a, [de] + ld [hld], a + dec l + dec e + dec e + dec b + jr nz, .loop1 + ld [hl], c + + ld hl, v0Tiles2 tile $71 + (TILE_SIZE - 1) + ld c, [hl] + ld b, TILE_SIZE - 1 + ld de, v0Tiles2 tile $71 + (TILE_SIZE - 3) +.loop2 + ld a, [de] + ld [hld], a + dec l + dec e + dec e + dec b + jr nz, .loop2 + ld [hl], c + + ld a, HIGH(wVirtualOAM) + call hTransferVirtualOAM + ret +.end + +VBlank_MusicalCoinsScreen: + ld hl, .Func + ld de, wVBlankFunc + ld b, .end - .Func + call CopyHLToDE + ret + +.Func: + ld a, [wSCY] + ldh [rSCY], a + ld a, [wSCX] + ldh [rSCX], a + ld a, [wcee4] + bit 7, a + jr z, .dma_transfer + and $7f + jr nz, .asm_d47d9 + ld hl, wBGMapTileVRAM0Queue + ld a, [hli] + ld d, a + ld a, [hli] + ld e, a + ld a, [hli] + ld [de], a + ld a, [hli] + ld d, a + ld a, [hli] + ld e, a + ld a, [hli] + ld [de], a + jr .asm_d47e6 +.asm_d47d9 + ld a, BANK("VRAM1") + ldh [rVBK], a + ld hl, wBGMapTileVRAM0Queue + ld a, [hli] + ld d, a + ld a, [hli] + ld e, a + ld a, [hl] + ld [de], a +.asm_d47e6 + ld hl, wcee4 + res 7, [hl] +.dma_transfer + ld a, HIGH(wVirtualOAM) + call hTransferVirtualOAM + ret +.end diff --git a/src/engine/level/load_room_gfx.asm b/src/engine/level/load_room_gfx.asm new file mode 100644 index 0000000..e9a4b17 --- /dev/null +++ b/src/engine/level/load_room_gfx.asm @@ -0,0 +1,105 @@ +; loads a room's function table, tilemap +; main and special tiles and its palettes +LoadRoomGfx:: + ld d, $00 + ld a, [wRoom] + add a + ld e, a + rl d + ld hl, RoomBlockAndGfxData + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ld a, h + debug_assert_not $ff + ld a, [hli] + ld [wRoomBlockFunctionTable], a + ld a, [hli] + ld [wRoomTileMap], a + ld a, [hli] + ld [wRoomMainTiles], a + ld a, [hli] + ld [wRoomSpecialTiles], a + ld a, [hl] + ld [wRoomPalettes], a + +; divide wRoomBlockFunctionTable by 6 + ld b, 0 + ld a, [wRoomBlockFunctionTable] +.loop + sub $6 + jr c, .div_done + inc b + jr .loop +.div_done + ld a, BANK("Level Data 1") + add b + ld [wRoomBlockFunctionTableBank], a + call Func_298d + call LoadBlockFunctionTable + ld a, [wRoomBlockFunctionTableBank] + ld [wc0d0], a + call LoadRoomTileMap + + ld a, [wRoomMainTiles] + srl a + srl a + srl a ; /8 + add BANK("Room Main Tiles 1") + ld [wRoomMainTilesBank], a + call LoadRoomMainTiles + + ld a, [wRoomSpecialTiles] + srl a + srl a + srl a ; /8 + add BANK("Room Special Tiles 1") + ld [wRoomSpecialTilesBank], a + call LoadRoomSpecialTiles + + ld a, BANK("Level Palettes") + ld [wPaletteBank], a + call LoadRoomPalettes + ret + +InitRoomAnimatedTiles:: + ld hl, AnimatedTilesGroups + ld d, $00 + ld a, [wAnimatedTilesGroup] + add a ; *2 + ld e, a + rl d + add hl, de + ld a, [hli] + ld [wAnimatedTilesFrameDuration], a + ld a, [hl] + ld [wAnimatedTilesGfx], a + xor a + ld [wAnimatedTilesFrame], a + ld [wAnimatedTilesFrameCount], a + ret + +InitRoomAnimatedPals:: + ld hl, RoomPalCycles + ld d, $00 + ld a, [wRoomPalCycle] + add a ; *2 + ld e, a + rl d + add hl, de + ld a, [hli] + ld [wRoomPalCyclePtr + 1], a + ld a, [hld] + ld [wRoomPalCyclePtr + 0], a + ld l, [hl] + ld h, a + ld de, ROOM_PAL_CYCLE_LENGTH + add hl, de + ld a, [hl] + ld [wRoomPalCycleDuration], a + srl a ; /2 + ld [wRoomPalCycleCounter], a + xor a + ld [wRoomPalCycleIndex], a + ret diff --git a/src/engine/level/update_animated_tiles.asm b/src/engine/level/update_animated_tiles.asm new file mode 100644 index 0000000..5ad3ecd --- /dev/null +++ b/src/engine/level/update_animated_tiles.asm @@ -0,0 +1,66 @@ +; load 8 animated tiles to v1Tiles2 +; these are blocks of tiles with 4 subsets, made of 8 tiles each +; (8 * $10 * 4 = $200 bytes each block) +; wAnimatedTilesGfx determines which of these blocks to load +; wAnimatedTilesFrame determines which of the subset (frame) to load +UpdateRoomAnimatedTiles:: + ldh a, [rLY] + cp $7c + jr nc, .done + jr .useless_jump ; can be fallthrough + +.useless_jump +; check whether to advance frame + ld a, [wAnimatedTilesFrameDuration] + and a + jr z, .done + ld b, a + ld a, [wAnimatedTilesFrameCount] + inc a + ld [wAnimatedTilesFrameCount], a + cp b + jr c, .done + +; do frame + xor a + ld [wAnimatedTilesFrameCount], a + ld hl, AnimatedTilesGfx + ld a, [wAnimatedTilesGfx] + add a + add h + ld h, a + ld a, [wAnimatedTilesFrame] + inc a + cp $4 + jr nz, .ok + xor a ; reset to 0 +.ok + ld [wAnimatedTilesFrame], a + swap a + add a + add a + add a ; *$80 + ld e, a + ld d, $00 + rl d + add hl, de + + ld de, v1Tiles2 + $700 + ld b, TILE_SIZE + ld a, BANK("VRAM1") + ldh [rVBK], a +.loop_copy_tiles + wait_ppu_busy + wait_ppu_free +REPT 8 + ld a, [hli] + ld [de], a + inc e +ENDR + dec b + jr nz, .loop_copy_tiles + + xor a ; VRAM0 + ldh [rVBK], a +.done + ret diff --git a/src/engine/title/load_gfx.asm b/src/engine/title/load_gfx.asm index 07a793f..ba58496 100644 --- a/src/engine/title/load_gfx.asm +++ b/src/engine/title/load_gfx.asm @@ -44,7 +44,7 @@ LoadTitleScreenTileMap: ret LoadTimeAttackDescriptionPals: - ld hl, Pal_71b0 + ld hl, Pals_71b0 call LoadPalsToTempPals1 ret diff --git a/src/gfx.asm b/src/gfx.asm index fffd81b..16297f7 100644 --- a/src/gfx.asm +++ b/src/gfx.asm @@ -22,6 +22,54 @@ SECTION "Title Framesets", ROMX INCLUDE "data/title/framesets.asm" +Pals_71b0:: + rgb 31, 31, 31 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 7, 0 + + rgb 31, 25, 9 + rgb 21, 15, 4 + rgb 13, 8, 1 + rgb 0, 0, 0 + + rgb 31, 31, 31 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 + + rgb 31, 31, 31 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 + + rgb 31, 31, 31 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 + + rgb 31, 31, 31 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 + + rgb 31, 31, 31 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 + + rgb 31, 31, 31 + rgb 21, 21, 21 + rgb 10, 10, 10 + rgb 0, 0, 0 + +TimeAttack1JPTextMap:: INCBIN "gfx/bgmaps/text/time_attack1_en.bin" +TimeAttack2JPTextMap:: INCBIN "gfx/bgmaps/text/time_attack2_en.bin" +TimeAttack1ENTextMap:: INCBIN "gfx/bgmaps/text/time_attack1_jp.bin" +TimeAttack2ENTextMap:: INCBIN "gfx/bgmaps/text/time_attack2_jp.bin" + +INCLUDE "data/ow/epilogue/oam.asm" +INCLUDE "data/ow/epilogue/framesets.asm" SECTION "Wario Gfx 1", ROMX @@ -254,3 +302,32 @@ INCLUDE "gfx/oam/objects6.asm" SECTION "Level Palettes", ROMX INCLUDE "data/levels/palettes.asm" + + +SECTION "Animated Tile GFX", ROMX + +AnimatedTilesGfx:: +AnimatedTiles1Gfx:: INCBIN "gfx/levels/animated/animated_tiles1.2bpp" ; ANIMATED_TILES_GFX_00 +AnimatedTiles2Gfx:: INCBIN "gfx/levels/animated/animated_tiles2.2bpp" ; ANIMATED_TILES_GFX_01 +AnimatedTiles3Gfx:: INCBIN "gfx/levels/animated/animated_tiles3.2bpp" ; ANIMATED_TILES_GFX_02 +AnimatedTiles4Gfx:: INCBIN "gfx/levels/animated/animated_tiles4.2bpp" ; ANIMATED_TILES_GFX_03 +AnimatedTiles5Gfx:: INCBIN "gfx/levels/animated/animated_tiles5.2bpp" ; ANIMATED_TILES_GFX_04 +AnimatedTiles6Gfx:: INCBIN "gfx/levels/animated/animated_tiles6.2bpp" ; ANIMATED_TILES_GFX_05 +AnimatedTiles7Gfx:: INCBIN "gfx/levels/animated/animated_tiles7.2bpp" ; ANIMATED_TILES_GFX_06 +AnimatedTiles8Gfx:: INCBIN "gfx/levels/animated/animated_tiles8.2bpp" ; ANIMATED_TILES_GFX_07 +AnimatedTiles9Gfx:: INCBIN "gfx/levels/animated/animated_tiles9.2bpp" ; ANIMATED_TILES_GFX_08 +AnimatedTiles10Gfx:: INCBIN "gfx/levels/animated/animated_tiles10.2bpp" ; ANIMATED_TILES_GFX_09 +AnimatedTiles11Gfx:: INCBIN "gfx/levels/animated/animated_tiles11.2bpp" ; ANIMATED_TILES_GFX_10 +AnimatedTiles12Gfx:: INCBIN "gfx/levels/animated/animated_tiles12.2bpp" ; ANIMATED_TILES_GFX_11 +AnimatedTiles13Gfx:: INCBIN "gfx/levels/animated/animated_tiles13.2bpp" ; ANIMATED_TILES_GFX_12 +AnimatedTiles14Gfx:: INCBIN "gfx/levels/animated/animated_tiles14.2bpp" ; ANIMATED_TILES_GFX_13 +AnimatedTiles15Gfx:: INCBIN "gfx/levels/animated/animated_tiles15.2bpp" ; ANIMATED_TILES_GFX_14 +AnimatedTiles16Gfx:: INCBIN "gfx/levels/animated/animated_tiles16.2bpp" ; ANIMATED_TILES_GFX_15 +AnimatedTiles17Gfx:: INCBIN "gfx/levels/animated/animated_tiles17.2bpp" ; ANIMATED_TILES_GFX_16 +AnimatedTiles18Gfx:: INCBIN "gfx/levels/animated/animated_tiles18.2bpp" ; ANIMATED_TILES_GFX_17 +AnimatedTiles19Gfx:: INCBIN "gfx/levels/animated/animated_tiles19.2bpp" ; ANIMATED_TILES_GFX_18 +AnimatedTiles20Gfx:: INCBIN "gfx/levels/animated/animated_tiles20.2bpp" ; ANIMATED_TILES_GFX_19 +AnimatedTiles21Gfx:: INCBIN "gfx/levels/animated/animated_tiles21.2bpp" ; ANIMATED_TILES_GFX_20 +AnimatedTiles22Gfx:: INCBIN "gfx/levels/animated/animated_tiles22.2bpp" ; ANIMATED_TILES_GFX_21 +AnimatedTiles23Gfx:: INCBIN "gfx/levels/animated/animated_tiles23.2bpp" ; ANIMATED_TILES_GFX_22 +AnimatedTiles24Gfx:: INCBIN "gfx/levels/animated/animated_tiles24.2bpp" ; ANIMATED_TILES_GFX_23 diff --git a/src/home/home2.asm b/src/home/home2.asm index caf1e1b..4639f9f 100644 --- a/src/home/home2.asm +++ b/src/home/home2.asm @@ -57,14 +57,14 @@ LoadRoom:: ld a, [wROMBank] push af - ld a, BANK(PointerTable_c0319) + ld a, BANK(LevelRooms) bankswitch ld a, [wLevel] add a ; *2 ld e, a ld d, $00 rl d - ld hl, PointerTable_c0319 + ld hl, LevelRooms add hl, de ld a, [hli] ld h, [hl] diff --git a/src/layout.link b/src/layout.link index 5316a73..33e3cd1 100644 --- a/src/layout.link +++ b/src/layout.link @@ -140,17 +140,19 @@ ROMX $2e ROMX $2f "Bank 2F" ROMX $30 - "Bank 30" + "Level Data" + "Rooms 1" ROMX $31 - "Bank 31" + "Rooms 2" ROMX $32 "Block Function Tables 1" ROMX $33 "Level Palettes" ROMX $34 - "Bank 34" + "Update Animated Tiles" + "Animated Tile GFX" ROMX $35 - "Bank 35" + "Clear Level" ROMX $36 "Bank 36" ROMX $37 diff --git a/src/main.asm b/src/main.asm index 85c382e..fd6f9a1 100644 --- a/src/main.asm +++ b/src/main.asm @@ -98,7 +98,9 @@ SECTION "Bank 3", ROMX INCLUDE "engine/level/particles.asm" INCLUDE "engine/level/spawn_edge.asm" -INCLUDE "engine/bank3.asm" +INCLUDE "data/levels/common/palettes.asm" +INCLUDE "data/levels/common/oam.asm" +INCLUDE "data/levels/common/framesets.asm" SECTION "Block Functions", ROMX @@ -328,14 +330,19 @@ SECTION "Object Loading", ROMX INCLUDE "engine/level/load_objects.asm" -SECTION "Bank 30", ROMX +SECTION "Level Data", ROMX -INCLUDE "engine/bank30.asm" +INCLUDE "engine/level/load_room_gfx.asm" +INCLUDE "data/levels/level_headers.asm" +SECTION "Rooms 1", ROMX -SECTION "Bank 31", ROMX +INCLUDE "data/levels/rooms1.asm" -INCLUDE "engine/bank31.asm" + +SECTION "Rooms 2", ROMX + +INCLUDE "data/levels/rooms2.asm" SECTION "Block Function Tables 1", ROMX @@ -343,14 +350,37 @@ SECTION "Block Function Tables 1", ROMX INCLUDE "data/levels/function_tables1.asm" -SECTION "Bank 34", ROMX +SECTION "Update Animated Tiles", ROMX + +INCLUDE "engine/level/update_animated_tiles.asm" + -INCLUDE "engine/bank34.asm" +SECTION "Clear Level", ROMX +INCLUDE "engine/clear/state_table.asm" +INCLUDE "engine/clear/treasure_clear.asm" +INCLUDE "engine/clear/time_attack_clear.asm" +INCLUDE "engine/clear/musical_coins.asm" +INCLUDE "engine/clear/add_sprite.asm" +INCLUDE "engine/clear/treasure_transition.asm" +INCLUDE "engine/clear/treasure_count.asm" +INCLUDE "engine/clear/vblank.asm" +INCLUDE "engine/clear/musical_coin_flags.asm" +INCLUDE "engine/clear/pencil.asm" +INCLUDE "data/clear/musical_coin_pals.asm" +INCLUDE "data/clear/pencil_offsets.asm" +INCLUDE "data/golf/oam.asm" +INCLUDE "data/golf/framesets.asm" +INCLUDE "data/clear/oam.asm" +INCLUDE "data/clear/framesets.asm" +INCLUDE "data/clear/palettes.asm" -SECTION "Bank 35", ROMX +; TODO in its own section to be added to golf.o? +GolfMenuGfx:: INCBIN "gfx/golf/golf_menu.2bpp.rle" +BGMap_d63fd: INCBIN "gfx/bgmaps/map_d63fd.bin" +BGMap_d6502: INCBIN "gfx/bgmaps/map_d6502.bin" -INCLUDE "engine/bank35.asm" +INCLUDE "data/clear/pencil_oam.asm" SECTION "Bank 37", ROMX