Use constants and data for Unown chamber events

This commit is contained in:
Remy Oukaour
2018-01-11 00:25:14 -05:00
parent 3b7c495e38
commit cc8dac5a22
9 changed files with 127 additions and 106 deletions

View File

@@ -105,7 +105,7 @@ SpecialKabutoChamber: ; 8ae4e
Special_DisplayUnownWords: ; 8ae68
ld a, [ScriptVar]
ld hl, .MenuDataHeaders_UnownWalls
ld hl, MenuDataHeaders_UnownWalls
and a
jr z, .load
@@ -131,7 +131,7 @@ Special_DisplayUnownWords: ; 8ae68
add hl, de
ld a, [ScriptVar]
ld c, a
ld de, .UnownText
ld de, UnownWalls
and a
jr z, .copy
.loop2
@@ -142,10 +142,10 @@ Special_DisplayUnownWords: ; 8ae68
dec c
jr nz, .loop2
.copy
call .CopyWord
call _DisplayUnownWords_CopyWord
ld bc, AttrMap - TileMap
add hl, bc
call .FillAttr
call _DisplayUnownWords_FillAttr
call WaitBGMap2
call JoyWaitAorB
call PlayClickSFX
@@ -153,66 +153,9 @@ Special_DisplayUnownWords: ; 8ae68
ret
; 8aebc
unownwall: MACRO
rept _NARG
if \1 == "-"
x = $64
else
if \1 >= "Y"
x = 2 * (\1 - "Y") + $60
else
if \1 >= "Q"
x = 2 * (\1 - "Q") + $40
else
if \1 >= "I"
x = 2 * (\1 - "I") + $20
else
x = 2 * (\1 - "A")
endc
endc
endc
endc
db x
shift
endr
db -1 ; end
ENDM
INCLUDE "data/unown_walls.asm"
.UnownText: ; 8aebc
;.UnownText_Escape:
; db $08, $44, $04, $00, $2e, $08, $ff
unownwall "E", "S", "C", "A", "P", "E"
;.UnownText_Light:
; db $26, $20, $0c, $0e, $46, $ff
unownwall "L", "I", "G", "H", "T"
;.UnownText_Water:
; db $4c, $00, $46, $08, $42, $ff
unownwall "W", "A", "T", "E", "R"
;.UnownText_Ho_Oh:
; db $0e, $2c, $64, $2c, $0e, $ff
unownwall "H", "O", "-", "O", "H"
; 8aed5
.MenuDataHeaders_UnownWalls: ; 0x8aed5
;.MenuDataHeader_Escape:
db $40 ; flags
db 04, 03 ; start coords
db 09, 16 ; end coords
;.MenuDataHeader_Light:
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
;.MenuDataHeader_Water:
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
;.MenuDataHeader_Ho_Oh:
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
; 8aee9
.FillAttr: ; 8aee9
_DisplayUnownWords_FillAttr: ; 8aee9
ld a, [de]
cp $ff
ret z
@@ -226,7 +169,7 @@ ENDM
inc hl
inc hl
inc de
jr .FillAttr
jr _DisplayUnownWords_FillAttr
; 8aefd
.PlaceSquare: ; 8aefd
@@ -242,7 +185,7 @@ ENDM
ret
; 8af09
.CopyWord: ; 8af09
_DisplayUnownWords_CopyWord: ; 8af09
push hl
push de
.word_loop

View File

@@ -157,7 +157,7 @@ PlaceStartCancelBoxBorder: ; e128d
ld a, $f3
ld [hli], a
ld bc, 10
ld a, $ef
ld a, PUZZLE_VOID
call ByteFill
hlcoord 15, 16
ld a, $f3
@@ -218,7 +218,7 @@ UnownPuzzleJumptable: ; e12ca
ld a, [hl]
cp 1 puzcoord 0
ret c
sub $6
sub 6
ld [hl], a
jr .done_joypad
@@ -235,7 +235,7 @@ UnownPuzzleJumptable: ; e12ca
ret z
cp 5 puzcoord 0
ret nc
add $6
add 6
ld [hl], a
jr .done_joypad
@@ -835,7 +835,7 @@ INCBIN "gfx/unown_puzzle/tile_borders.2bpp"
LoadUnownPuzzlePiecesGFX: ; e17a3
ld a, [ScriptVar]
and 3
maskbits NUM_UNOWN_PUZZLES +- 1
ld e, a
ld d, 0
ld hl, .LZPointers
@@ -851,6 +851,7 @@ LoadUnownPuzzlePiecesGFX: ; e17a3
; e17bd
.LZPointers: ; e17bd
; entries correspond to UNOWNPUZZLE_* constants
dw KabutoPuzzleLZ
dw OmanytePuzzleLZ
dw AerodactylPuzzleLZ