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

@ -142,6 +142,11 @@ SLIDING EQU 3
EMOTE_OBJECT EQU 7
; see engine/overworld.asm
MAX_OUTDOOR_SPRITES EQU 23
SPRITE_GFX_LIST_CAPACITY EQU $20
; SpawnPoints indexes (see data/maps/spawn_points.asm)
const_value = -1
const SPAWN_N_A
@ -178,6 +183,26 @@ const_value = -1
NUM_SPAWNS EQU const_value
; treemon sets
; TreeMons indexes (see data/wild/treemons.asm)
const_def
const TREEMON_SET_CITY
const TREEMON_SET_CANYON
const TREEMON_SET_AZALEA
const TREEMON_SET_ROUTE
const TREEMON_SET_KANTO
const TREEMON_SET_LAKE
const TREEMON_SET_FOREST
const TREEMON_SET_ROCK
NUM_TREEMON_SETS EQU const_value
; treemon scores
const_def
const TREEMON_SCORE_BAD ; 0
const TREEMON_SCORE_GOOD ; 1
const TREEMON_SCORE_RARE ; 2
; TryBGEvent arguments (see engine/events.asm)
const_def
const BGEVENT_READ
@ -253,28 +278,8 @@ const_value set 1
NUM_FRUIT_TREES EQU const_value +- 1
; treemon sets
; TreeMons indexes (see data/wild/treemons.asm)
const_def
const TREEMON_SET_CITY
const TREEMON_SET_CANYON
const TREEMON_SET_AZALEA
const TREEMON_SET_ROUTE
const TREEMON_SET_KANTO
const TREEMON_SET_LAKE
const TREEMON_SET_FOREST
const TREEMON_SET_ROCK
NUM_TREEMON_SETS EQU const_value
; treemon scores
const_def
const TREEMON_SCORE_BAD ; 0
const TREEMON_SCORE_GOOD ; 1
const TREEMON_SCORE_RARE ; 2
; elevator floors
; used by `elevfloor`
; used by elevfloor
const_def
const FLOOR_B4F
const FLOOR_B3F
@ -305,6 +310,20 @@ CMDQUEUE_CAPACITY EQU 4
; command queue types
CMDQUEUE_STONETABLE EQU 2
; see engine/overworld.asm
MAX_OUTDOOR_SPRITES EQU 23
SPRITE_GFX_LIST_CAPACITY EQU $20
; used by Special_UnownPuzzle
; LoadUnownPuzzlePiecesGFX.LZPointers indexes (see engine/unown_puzzle.asm)
const_def
const UNOWNPUZZLE_KABUTO ; 0
const UNOWNPUZZLE_OMANYTE ; 1
const UNOWNPUZZLE_AERODACTYL ; 2
const UNOWNPUZZLE_HO_OH ; 3
NUM_UNOWN_PUZZLES EQU const_value
; used by Special_DisplayUnownWords
; UnownWalls and MenuDataHeaders_UnownWalls indexes (see data/unown_walls.asm)
const_def
const UNOWNWORDS_ESCAPE ; 0
const UNOWNWORDS_LIGHT ; 1
const UNOWNWORDS_WATER ; 2
const UNOWNWORDS_HO_OH ; 3

58
data/unown_walls.asm Normal file
View File

@ -0,0 +1,58 @@
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
UnownWalls: ; 8aebc
; UNOWNWORDS_ESCAPE
; db $08, $44, $04, $00, $2e, $08, $ff
unownwall "E", "S", "C", "A", "P", "E"
; UNOWNWORDS_LIGHT
; db $26, $20, $0c, $0e, $46, $ff
unownwall "L", "I", "G", "H", "T"
; UNOWNWORDS_WATER
; db $4c, $00, $46, $08, $42, $ff
unownwall "W", "A", "T", "E", "R"
; UNOWNWORDS_HO_OH
; db $0e, $2c, $64, $2c, $0e, $ff
unownwall "H", "O", "-", "O", "H"
; 8aed5
MenuDataHeaders_UnownWalls: ; 0x8aed5
; UNOWNWORDS_ESCAPE
db $40 ; flags
db 04, 03 ; start coords
db 09, 16 ; end coords
; UNOWNWORDS_LIGHT
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
; UNOWNWORDS_WATER
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
; UNOWNWORDS_HO_OH
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
; 8aee9

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

View File

@ -316,7 +316,7 @@ SECTION "Crystal Features 2", ROMX
INCLUDE "engine/events/kurt.asm"
INCLUDE "engine/player_gfx.asm"
INCLUDE "mobile/mobile_22.asm"
INCLUDE "engine/events/crystal_unown.asm"
INCLUDE "engine/events/unown_walls.asm"
INCLUDE "engine/events/buena.asm"
INCLUDE "engine/events/dratini.asm"
INCLUDE "engine/events/battle_tower/rules.asm"

View File

@ -49,7 +49,7 @@ RuinsOfAlphAerodactylChamber_MapScriptHeader:
MapRuinsOfAlphAerodactylChamberSignpost2Script:
refreshscreen $0
writebyte $2
writebyte UNOWNPUZZLE_AERODACTYL
special Special_UnownPuzzle
closetext
iftrue UnknownScript_0x58df7
@ -83,7 +83,7 @@ MapRuinsOfAlphAerodactylChamberSignpost3Script:
MapRuinsOfAlphAerodactylChamberSignpost4Script:
opentext
writetext UnknownText_0x58e4f
writebyte $1
writebyte UNOWNWORDS_LIGHT
special Special_DisplayUnownWords
closetext
end
@ -93,7 +93,7 @@ MapRuinsOfAlphAerodactylChamberSignpost5Script:
iftrue UnknownScript_0x58e46
opentext
writetext UnknownText_0x58e81
writebyte $1
writebyte UNOWNWORDS_LIGHT
special Special_DisplayUnownWords
closetext
end

View File

@ -50,7 +50,7 @@ RuinsOfAlphHoOhChamber_MapScriptHeader:
MapRuinsOfAlphHoOhChamberSignpost2Script:
refreshscreen $0
writebyte $3
writebyte UNOWNPUZZLE_HO_OH
special Special_UnownPuzzle
closetext
iftrue UnknownScript_0x585ba
@ -84,7 +84,7 @@ MapRuinsOfAlphHoOhChamberSignpost3Script:
MapRuinsOfAlphHoOhChamberSignpost4Script:
opentext
writetext UnknownText_0x58612
writebyte $3
writebyte UNOWNWORDS_HO_OH
special Special_DisplayUnownWords
closetext
end
@ -94,7 +94,7 @@ MapRuinsOfAlphHoOhChamberSignpost5Script:
iftrue UnknownScript_0x58609
opentext
writetext UnknownText_0x58644
writebyte $3
writebyte UNOWNWORDS_HO_OH
special Special_DisplayUnownWords
closetext
end

View File

@ -56,7 +56,7 @@ RuinsOfAlphKabutoChamberReceptionistScript:
MapRuinsOfAlphKabutoChamberSignpost2Script:
refreshscreen $0
writebyte $0
writebyte UNOWNPUZZLE_KABUTO
special Special_UnownPuzzle
closetext
iftrue UnknownScript_0x58778
@ -121,7 +121,7 @@ MapRuinsOfAlphKabutoChamberSignpost3Script:
MapRuinsOfAlphKabutoChamberSignpost4Script:
opentext
writetext UnknownText_0x58aa7
writebyte $0
writebyte UNOWNWORDS_ESCAPE
special Special_DisplayUnownWords
closetext
end
@ -131,7 +131,7 @@ MapRuinsOfAlphKabutoChamberSignpost5Script:
iftrue UnknownScript_0x587f7
opentext
writetext UnknownText_0x58ad9
writebyte $0
writebyte UNOWNWORDS_ESCAPE
special Special_DisplayUnownWords
closetext
end

View File

@ -50,7 +50,7 @@ RuinsOfAlphOmanyteChamber_MapScriptHeader:
MapRuinsOfAlphOmanyteChamberSignpost2Script:
refreshscreen $0
writebyte $1
writebyte UNOWNPUZZLE_OMANYTE
special Special_UnownPuzzle
closetext
iftrue UnknownScript_0x58c36
@ -84,7 +84,7 @@ MapRuinsOfAlphOmanyteChamberSignpost3Script:
MapRuinsOfAlphOmanyteChamberSignpost4Script:
opentext
writetext UnknownText_0x58c8e
writebyte $2
writebyte UNOWNWORDS_WATER
special Special_DisplayUnownWords
closetext
end
@ -94,7 +94,7 @@ MapRuinsOfAlphOmanyteChamberSignpost5Script:
iftrue UnknownScript_0x58c85
opentext
writetext UnknownText_0x58cc0
writebyte $2
writebyte UNOWNWORDS_WATER
special Special_DisplayUnownWords
closetext
end