2018-06-24 14:09:41 +00:00
|
|
|
InitDecorations:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, DECO_FEATHERY_BED
|
2018-01-23 21:45:34 +00:00
|
|
|
ld [wDecoBed], a
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, DECO_TOWN_MAP
|
2018-01-23 21:45:34 +00:00
|
|
|
ld [wDecoPoster], a
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
_PlayerDecorationMenu:
|
2015-12-19 01:07:09 +00:00
|
|
|
ld a, [wWhichIndexSet]
|
2015-11-17 20:54:03 +00:00
|
|
|
push af
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .MenuHeader
|
|
|
|
call LoadMenuHeader
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer5], a
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, $1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer6], a
|
2015-11-17 20:54:03 +00:00
|
|
|
.top_loop
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer6]
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [wMenuCursorBuffer], a
|
|
|
|
call .FindCategoriesWithOwnedDecos
|
|
|
|
call DoNthMenu
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer6], a
|
2015-11-17 20:54:03 +00:00
|
|
|
jr c, .exit_menu
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, .pointers
|
|
|
|
call MenuJumptable
|
|
|
|
jr nc, .top_loop
|
|
|
|
|
|
|
|
.exit_menu
|
|
|
|
call ExitMenu
|
|
|
|
pop af
|
2015-12-19 01:07:09 +00:00
|
|
|
ld [wWhichIndexSet], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer5]
|
2015-11-17 20:54:03 +00:00
|
|
|
ld c, a
|
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuHeader:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 5, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-11-17 20:54:03 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_WRAP ; flags
|
2015-11-17 20:54:03 +00:00
|
|
|
db 0 ; items
|
|
|
|
dw wd002
|
|
|
|
dw PlaceNthMenuStrings
|
|
|
|
dw .pointers
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.pointers
|
2015-11-17 20:54:03 +00:00
|
|
|
dw DecoBedMenu, .bed
|
|
|
|
dw DecoCarpetMenu, .carpet
|
|
|
|
dw DecoPlantMenu, .plant
|
|
|
|
dw DecoPosterMenu, .poster
|
|
|
|
dw DecoConsoleMenu, .game
|
|
|
|
dw DecoOrnamentMenu, .ornament
|
|
|
|
dw DecoBigDollMenu, .big_doll
|
|
|
|
dw DecoExitMenu, .exit
|
|
|
|
|
|
|
|
.bed db "BED@"
|
|
|
|
.carpet db "CARPET@"
|
|
|
|
.plant db "PLANT@"
|
|
|
|
.poster db "POSTER@"
|
|
|
|
.game db "GAME CONSOLE@"
|
|
|
|
.ornament db "ORNAMENT@"
|
|
|
|
.big_doll db "BIG DOLL@"
|
|
|
|
.exit db "EXIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.FindCategoriesWithOwnedDecos:
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
2015-12-19 01:07:09 +00:00
|
|
|
ld [wWhichIndexSet], a
|
2015-11-17 20:54:03 +00:00
|
|
|
call .ClearStringBuffer2
|
|
|
|
call .FindOwndDecos
|
|
|
|
ld a, 7
|
|
|
|
call .AppendToStringBuffer2
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer2
|
2015-11-17 20:54:03 +00:00
|
|
|
ld de, wd002
|
|
|
|
ld bc, ITEM_NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.ClearStringBuffer2:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer2
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld bc, ITEM_NAME_LENGTH - 1
|
|
|
|
ld a, -1
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.AppendToStringBuffer2:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer2
|
2015-11-17 20:54:03 +00:00
|
|
|
inc [hl]
|
|
|
|
ld e, [hl]
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.FindOwndDecos:
|
2015-12-27 02:59:03 +00:00
|
|
|
ld hl, .dw
|
2015-11-17 20:54:03 +00:00
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
or e
|
|
|
|
jr z, .done
|
|
|
|
push hl
|
|
|
|
call _de_
|
|
|
|
pop hl
|
|
|
|
jr nc, .next
|
|
|
|
ld a, [hl]
|
|
|
|
push hl
|
|
|
|
call .AppendToStringBuffer2
|
|
|
|
pop hl
|
|
|
|
.next
|
|
|
|
inc hl
|
|
|
|
jr .loop
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.dw
|
2015-11-17 20:54:03 +00:00
|
|
|
dwb FindOwnedBeds, 0 ; bed
|
|
|
|
dwb FindOwnedCarpets, 1 ; carpet
|
|
|
|
dwb FindOwnedPlants, 2 ; plant
|
|
|
|
dwb FindOwnedPosters, 3 ; poster
|
|
|
|
dwb FindOwnedConsoles, 4 ; game console
|
|
|
|
dwb FindOwnedOrnaments, 5 ; ornament
|
|
|
|
dwb FindOwnedBigDolls, 6 ; big doll
|
|
|
|
dw 0 ; end
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Deco_FillTempWithMinusOne:
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ld hl, wd002
|
|
|
|
ld [hli], a
|
|
|
|
ld a, -1
|
|
|
|
ld bc, $10
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckAllDecorationFlags:
|
2015-11-17 20:54:03 +00:00
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
cp -1
|
|
|
|
jr z, .done
|
|
|
|
push hl
|
|
|
|
push af
|
|
|
|
ld b, CHECK_FLAG
|
|
|
|
call DecorationFlagAction
|
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
pop bc
|
|
|
|
ld a, b
|
|
|
|
call nz, AppendDecoIndex
|
|
|
|
pop hl
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
AppendDecoIndex:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, wd002
|
|
|
|
inc [hl]
|
|
|
|
ld e, [hl]
|
|
|
|
ld d, $0
|
|
|
|
add hl, de
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FindOwnedDecosInCategory:
|
2015-11-17 20:54:03 +00:00
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
call Deco_FillTempWithMinusOne
|
|
|
|
pop hl
|
|
|
|
call CheckAllDecorationFlags
|
|
|
|
pop bc
|
|
|
|
ld a, [wd002]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld a, c
|
|
|
|
call AppendDecoIndex
|
|
|
|
ld a, 0
|
|
|
|
call AppendDecoIndex
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoBedMenu:
|
2015-11-17 20:54:03 +00:00
|
|
|
call FindOwnedBeds
|
|
|
|
call PopulateDecoCategoryMenu
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FindOwnedBeds:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, .beds
|
2015-12-29 21:44:37 +00:00
|
|
|
ld c, BEDS
|
2015-11-17 20:54:03 +00:00
|
|
|
jp FindOwnedDecosInCategory
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.beds
|
2015-11-17 20:54:03 +00:00
|
|
|
db DECO_FEATHERY_BED ; 2
|
|
|
|
db DECO_PINK_BED ; 3
|
|
|
|
db DECO_POLKADOT_BED ; 4
|
|
|
|
db DECO_PIKACHU_BED ; 5
|
|
|
|
db -1
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoCarpetMenu:
|
2015-11-17 20:54:03 +00:00
|
|
|
call FindOwnedCarpets
|
|
|
|
call PopulateDecoCategoryMenu
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FindOwnedCarpets:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, .carpets
|
2015-12-29 21:44:37 +00:00
|
|
|
ld c, CARPETS
|
2015-11-17 20:54:03 +00:00
|
|
|
jp FindOwnedDecosInCategory
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.carpets
|
2015-11-17 20:54:03 +00:00
|
|
|
db DECO_RED_CARPET ; 7
|
|
|
|
db DECO_BLUE_CARPET ; 8
|
|
|
|
db DECO_YELLOW_CARPET ; 9
|
|
|
|
db DECO_GREEN_CARPET ; a
|
|
|
|
db -1
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoPlantMenu:
|
2015-11-17 20:54:03 +00:00
|
|
|
call FindOwnedPlants
|
|
|
|
call PopulateDecoCategoryMenu
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FindOwnedPlants:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, .plants
|
2015-12-29 21:44:37 +00:00
|
|
|
ld c, PLANTS
|
2015-11-17 20:54:03 +00:00
|
|
|
jp FindOwnedDecosInCategory
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.plants
|
2015-11-17 20:54:03 +00:00
|
|
|
db DECO_MAGNAPLANT ; c
|
|
|
|
db DECO_TROPICPLANT ; d
|
|
|
|
db DECO_JUMBOPLANT ; e
|
|
|
|
db -1
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoPosterMenu:
|
2015-11-17 20:54:03 +00:00
|
|
|
call FindOwnedPosters
|
|
|
|
call PopulateDecoCategoryMenu
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FindOwnedPosters:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, .posters
|
2015-12-29 21:44:37 +00:00
|
|
|
ld c, POSTERS
|
2015-11-17 20:54:03 +00:00
|
|
|
jp FindOwnedDecosInCategory
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.posters
|
2015-11-17 20:54:03 +00:00
|
|
|
db DECO_TOWN_MAP ; 10
|
|
|
|
db DECO_PIKACHU_POSTER ; 11
|
|
|
|
db DECO_CLEFAIRY_POSTER ; 12
|
|
|
|
db DECO_JIGGLYPUFF_POSTER ; 13
|
|
|
|
db -1
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoConsoleMenu:
|
2015-11-17 20:54:03 +00:00
|
|
|
call FindOwnedConsoles
|
|
|
|
call PopulateDecoCategoryMenu
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FindOwnedConsoles:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, .consoles
|
2015-12-29 21:44:37 +00:00
|
|
|
ld c, CONSOLES
|
2015-11-17 20:54:03 +00:00
|
|
|
jp FindOwnedDecosInCategory
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.consoles
|
2015-11-17 20:54:03 +00:00
|
|
|
db DECO_FAMICOM ; 15
|
|
|
|
db DECO_SNES ; 16
|
|
|
|
db DECO_N64 ; 17
|
|
|
|
db DECO_VIRTUAL_BOY ; 18
|
|
|
|
db -1
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoOrnamentMenu:
|
2015-11-17 20:54:03 +00:00
|
|
|
call FindOwnedOrnaments
|
|
|
|
call PopulateDecoCategoryMenu
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FindOwnedOrnaments:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, .ornaments
|
2015-12-29 21:44:37 +00:00
|
|
|
ld c, DOLLS
|
2015-11-17 20:54:03 +00:00
|
|
|
jp FindOwnedDecosInCategory
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.ornaments
|
2015-11-17 20:54:03 +00:00
|
|
|
db DECO_PIKACHU_DOLL ; 1e
|
|
|
|
db DECO_SURF_PIKACHU_DOLL ; 1f
|
|
|
|
db DECO_CLEFAIRY_DOLL ; 20
|
|
|
|
db DECO_JIGGLYPUFF_DOLL ; 21
|
|
|
|
db DECO_BULBASAUR_DOLL ; 22
|
|
|
|
db DECO_CHARMANDER_DOLL ; 23
|
|
|
|
db DECO_SQUIRTLE_DOLL ; 24
|
|
|
|
db DECO_POLIWAG_DOLL ; 25
|
|
|
|
db DECO_DIGLETT_DOLL ; 26
|
|
|
|
db DECO_STARMIE_DOLL ; 27
|
|
|
|
db DECO_MAGIKARP_DOLL ; 28
|
|
|
|
db DECO_ODDISH_DOLL ; 29
|
|
|
|
db DECO_GENGAR_DOLL ; 2a
|
|
|
|
db DECO_SHELLDER_DOLL ; 2b
|
|
|
|
db DECO_GRIMER_DOLL ; 2c
|
|
|
|
db DECO_VOLTORB_DOLL ; 2d
|
|
|
|
db DECO_WEEDLE_DOLL ; 2e
|
|
|
|
db DECO_UNOWN_DOLL ; 2f
|
|
|
|
db DECO_GEODUDE_DOLL ; 30
|
|
|
|
db DECO_MACHOP_DOLL ; 31
|
|
|
|
db DECO_TENTACOOL_DOLL ; 32
|
|
|
|
db DECO_GOLD_TROPHY_DOLL ; 33
|
|
|
|
db DECO_SILVER_TROPHY_DOLL ; 34
|
|
|
|
db -1
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoBigDollMenu:
|
2015-11-17 20:54:03 +00:00
|
|
|
call FindOwnedBigDolls
|
|
|
|
call PopulateDecoCategoryMenu
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FindOwnedBigDolls:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, .big_dolls
|
2015-12-29 21:44:37 +00:00
|
|
|
ld c, BIG_DOLLS
|
2015-11-17 20:54:03 +00:00
|
|
|
jp FindOwnedDecosInCategory
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.big_dolls
|
2015-11-17 20:54:03 +00:00
|
|
|
db DECO_BIG_SNORLAX_DOLL ; 1a
|
|
|
|
db DECO_BIG_ONIX_DOLL ; 1b
|
|
|
|
db DECO_BIG_LAPRAS_DOLL ; 1c
|
|
|
|
db -1
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoExitMenu:
|
2015-11-17 20:54:03 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
PopulateDecoCategoryMenu:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [wd002]
|
|
|
|
and a
|
|
|
|
jr z, .empty
|
|
|
|
cp 8
|
|
|
|
jr nc, .beyond_eight
|
|
|
|
xor a
|
2015-12-19 01:07:09 +00:00
|
|
|
ld [wWhichIndexSet], a
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .NonscrollingMenuHeader
|
|
|
|
call LoadMenuHeader
|
2015-11-17 20:54:03 +00:00
|
|
|
call DoNthMenu
|
|
|
|
jr c, .no_action_1
|
|
|
|
call DoDecorationAction2
|
|
|
|
|
|
|
|
.no_action_1
|
|
|
|
call ExitMenu
|
|
|
|
ret
|
|
|
|
|
|
|
|
.beyond_eight
|
|
|
|
ld hl, wd002
|
|
|
|
ld e, [hl]
|
|
|
|
dec [hl]
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
ld [hl], -1
|
2018-01-23 21:08:43 +00:00
|
|
|
call LoadStandardMenuHeader
|
|
|
|
ld hl, .ScrollingMenuHeader
|
|
|
|
call CopyMenuHeader
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-17 20:54:03 +00:00
|
|
|
call InitScrollingMenu
|
|
|
|
xor a
|
2015-11-23 21:04:53 +00:00
|
|
|
ld [wMenuScrollPosition], a
|
2015-12-18 03:31:16 +00:00
|
|
|
call ScrollingMenu
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuJoypad]
|
2015-11-17 20:54:03 +00:00
|
|
|
cp 2
|
|
|
|
jr z, .no_action_2
|
|
|
|
call DoDecorationAction2
|
|
|
|
|
|
|
|
.no_action_2
|
|
|
|
call ExitMenu
|
|
|
|
ret
|
|
|
|
|
|
|
|
.empty
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, .NothingToChooseText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.NothingToChooseText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _NothingToChooseText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.NonscrollingMenuHeader:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .NonscrollingMenuData
|
2015-11-17 20:54:03 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.NonscrollingMenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_WRAP ; flags
|
2015-11-17 20:54:03 +00:00
|
|
|
db 0 ; items
|
|
|
|
dw wd002
|
|
|
|
dw DecorationMenuFunction
|
|
|
|
dw DecorationAttributes
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.ScrollingMenuHeader:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 1, 1, SCREEN_WIDTH - 2, SCREEN_HEIGHT - 2
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .ScrollingMenuData
|
2015-11-17 20:54:03 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.ScrollingMenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db SCROLLINGMENU_DISPLAY_ARROWS ; flags
|
2015-11-17 20:54:03 +00:00
|
|
|
db 8, 0 ; rows, columns
|
2019-06-09 00:31:24 +00:00
|
|
|
db SCROLLINGMENU_ITEMS_NORMAL ; item format
|
2015-11-17 20:54:03 +00:00
|
|
|
dbw 0, wd002 ; text pointer
|
|
|
|
dba DecorationMenuFunction
|
|
|
|
dbw 0, 0
|
|
|
|
dbw 0, 0
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetDecorationData:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, DecorationAttributes
|
|
|
|
ld bc, 6
|
|
|
|
call AddNTimes
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetDecorationName:
|
2015-11-17 20:54:03 +00:00
|
|
|
push hl
|
|
|
|
call GetDecorationData
|
|
|
|
call GetDecoName
|
|
|
|
pop hl
|
|
|
|
call CopyName2
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationMenuFunction:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-17 20:54:03 +00:00
|
|
|
push de
|
|
|
|
call GetDecorationData
|
|
|
|
call GetDecoName
|
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DoDecorationAction2:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationData
|
|
|
|
ld de, 2 ; function 2
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
ld hl, .DecoActions
|
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.DecoActions:
|
2015-11-17 20:54:03 +00:00
|
|
|
dw DecoAction_nothing
|
|
|
|
dw DecoAction_setupbed
|
|
|
|
dw DecoAction_putawaybed
|
|
|
|
dw DecoAction_setupcarpet
|
|
|
|
dw DecoAction_putawaycarpet
|
|
|
|
dw DecoAction_setupplant
|
|
|
|
dw DecoAction_putawayplant
|
|
|
|
dw DecoAction_setupposter
|
|
|
|
dw DecoAction_putawayposter
|
|
|
|
dw DecoAction_setupconsole
|
|
|
|
dw DecoAction_putawayconsole
|
|
|
|
dw DecoAction_setupbigdoll
|
|
|
|
dw DecoAction_putawaybigdoll
|
|
|
|
dw DecoAction_setupornament
|
|
|
|
dw DecoAction_putawayornament
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetDecorationFlag:
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationData
|
|
|
|
ld de, 3 ; event flag
|
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, [hl]
|
|
|
|
ld e, a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationFlagAction:
|
2015-11-17 20:54:03 +00:00
|
|
|
push bc
|
|
|
|
call GetDecorationFlag
|
|
|
|
pop bc
|
|
|
|
call EventFlagAction
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetDecorationSprite:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, c
|
|
|
|
call GetDecorationData
|
|
|
|
ld de, 5 ; sprite
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
ld c, a
|
|
|
|
ret
|
|
|
|
|
2017-12-27 16:56:03 +00:00
|
|
|
INCLUDE "data/decorations/attributes.asm"
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2017-12-27 16:56:03 +00:00
|
|
|
INCLUDE "data/decorations/names.asm"
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetDecoName:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld e, [hl]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld bc, wStringBuffer2
|
2015-11-17 20:54:03 +00:00
|
|
|
push bc
|
|
|
|
ld hl, .NameFunctions
|
|
|
|
rst JumpTable
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.NameFunctions:
|
2015-11-17 20:54:03 +00:00
|
|
|
dw .invalid
|
|
|
|
dw .plant
|
|
|
|
dw .bed
|
|
|
|
dw .carpet
|
|
|
|
dw .poster
|
|
|
|
dw .doll
|
|
|
|
dw .bigdoll
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.invalid
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.plant
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, e
|
|
|
|
jr .getdeconame
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.bed
|
2015-11-17 20:54:03 +00:00
|
|
|
call .plant
|
|
|
|
ld a, _BED
|
|
|
|
jr .getdeconame
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.carpet
|
2015-11-17 20:54:03 +00:00
|
|
|
call .plant
|
|
|
|
ld a, _CARPET
|
|
|
|
jr .getdeconame
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.poster
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, e
|
|
|
|
call .getpokename
|
|
|
|
ld a, _POSTER
|
|
|
|
jr .getdeconame
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.doll
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, e
|
|
|
|
call .getpokename
|
|
|
|
ld a, _DOLL
|
|
|
|
jr .getdeconame
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.bigdoll
|
2015-11-17 20:54:03 +00:00
|
|
|
push de
|
|
|
|
ld a, BIG_
|
|
|
|
call .getdeconame
|
|
|
|
pop de
|
|
|
|
ld a, e
|
|
|
|
jr .getpokename
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.unused
|
2015-11-17 20:54:03 +00:00
|
|
|
push de
|
|
|
|
call .getdeconame
|
|
|
|
pop de
|
|
|
|
ld a, e
|
|
|
|
jr .getdeconame
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.getpokename
|
2015-11-17 20:54:03 +00:00
|
|
|
push bc
|
2018-07-28 23:27:34 +00:00
|
|
|
ld [wNamedObjectIndexBuffer], a
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetPokemonName
|
|
|
|
pop bc
|
|
|
|
jr .copy
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.getdeconame
|
2015-11-17 20:54:03 +00:00
|
|
|
call ._getdeconame
|
|
|
|
jr .copy
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
._getdeconame
|
2015-11-17 20:54:03 +00:00
|
|
|
push bc
|
|
|
|
ld hl, DecorationNames
|
|
|
|
call GetNthString
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.copy
|
2015-11-17 20:54:03 +00:00
|
|
|
ld h, b
|
|
|
|
ld l, c
|
|
|
|
call CopyName2
|
|
|
|
dec hl
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_nothing:
|
2015-11-17 20:54:03 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_setupbed:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoBed
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TrySetItUp
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_putawaybed:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoBed
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TryPutItAway
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_setupcarpet:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoCarpet
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TrySetItUp
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_putawaycarpet:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoCarpet
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TryPutItAway
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_setupplant:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoPlant
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TrySetItUp
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_putawayplant:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoPlant
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TryPutItAway
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_setupposter:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoPoster
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TrySetItUp
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_putawayposter:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoPoster
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TryPutItAway
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_setupconsole:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoConsole
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TrySetItUp
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_putawayconsole:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoConsole
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TryPutItAway
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_setupbigdoll:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoBigDoll
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TrySetItUp
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_putawaybigdoll:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoBigDoll
|
2015-11-17 20:54:03 +00:00
|
|
|
jp DecoAction_TryPutItAway
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_TrySetItUp:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [hl]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer1], a
|
2015-11-17 20:54:03 +00:00
|
|
|
push hl
|
|
|
|
call DecoAction_SetItUp
|
|
|
|
jr c, .failed
|
|
|
|
ld a, 1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer5], a
|
2015-11-17 20:54:03 +00:00
|
|
|
pop hl
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [hl], a
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.failed
|
|
|
|
pop hl
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_SetItUp:
|
2015-11-17 20:54:03 +00:00
|
|
|
; See if there's anything of the same type already out
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer1]
|
2015-11-17 20:54:03 +00:00
|
|
|
and a
|
|
|
|
jr z, .nothingthere
|
|
|
|
; See if that item is already out
|
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-17 20:54:03 +00:00
|
|
|
cp b
|
|
|
|
jr z, .alreadythere
|
|
|
|
; Put away the item that's already out, and set up the new one
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
|
|
|
ld hl, wStringBuffer4
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationName
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer1]
|
|
|
|
ld hl, wStringBuffer3
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationName
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, PutAwayAndSetUpText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.nothingthere
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
|
|
|
ld hl, wStringBuffer3
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationName
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, SetUpTheDecoText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.alreadythere
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, AlreadySetUpText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_TryPutItAway:
|
2015-11-17 20:54:03 +00:00
|
|
|
; If there is no item of that type already set, there is nothing to put away.
|
|
|
|
ld a, [hl]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer1], a
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer1]
|
2015-11-17 20:54:03 +00:00
|
|
|
and a
|
|
|
|
jr z, .nothingthere
|
|
|
|
; Put it away.
|
|
|
|
ld a, $1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer5], a
|
|
|
|
ld a, [wBuffer1]
|
|
|
|
ld [wMenuSelection], a
|
|
|
|
ld hl, wStringBuffer3
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationName
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, PutAwayTheDecoText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.nothingthere
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, NothingToPutAwayText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_setupornament:
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, WhichSidePutOnText
|
2015-11-17 20:54:03 +00:00
|
|
|
call DecoAction_AskWhichSide
|
|
|
|
jr c, .cancel
|
|
|
|
call DecoAction_SetItUp_Ornament
|
|
|
|
jr c, .cancel
|
|
|
|
ld a, $1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer5], a
|
2015-11-17 20:54:03 +00:00
|
|
|
jr DecoAction_FinishUp_Ornament
|
|
|
|
|
|
|
|
.cancel
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_putawayornament:
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, WhichSidePutAwayText
|
2015-11-17 20:54:03 +00:00
|
|
|
call DecoAction_AskWhichSide
|
|
|
|
jr nc, .incave
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.incave
|
|
|
|
call DecoAction_PutItAway_Ornament
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_FinishUp_Ornament:
|
2015-11-17 20:54:03 +00:00
|
|
|
call QueryWhichSide
|
2017-12-10 00:41:03 +00:00
|
|
|
ld a, [wSelectedDecoration]
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [hl], a
|
2017-12-10 00:41:03 +00:00
|
|
|
ld a, [wOtherDecoration]
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [de], a
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_SetItUp_Ornament:
|
2017-12-10 00:41:03 +00:00
|
|
|
ld a, [wSelectedDecoration]
|
2015-11-17 20:54:03 +00:00
|
|
|
and a
|
|
|
|
jr z, .nothingthere
|
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-17 20:54:03 +00:00
|
|
|
cp b
|
|
|
|
jr z, .failed
|
|
|
|
ld a, b
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer3
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationName
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
|
|
|
ld hl, wStringBuffer4
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationName
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2017-12-10 00:41:03 +00:00
|
|
|
ld [wSelectedDecoration], a
|
2015-11-17 20:54:03 +00:00
|
|
|
call .getwhichside
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, PutAwayAndSetUpText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.nothingthere
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2017-12-10 00:41:03 +00:00
|
|
|
ld [wSelectedDecoration], a
|
2015-11-17 20:54:03 +00:00
|
|
|
call .getwhichside
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
|
|
|
ld hl, wStringBuffer3
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationName
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, SetUpTheDecoText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.failed
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, AlreadySetUpText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.getwhichside
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-17 20:54:03 +00:00
|
|
|
ld b, a
|
2017-12-10 00:41:03 +00:00
|
|
|
ld a, [wOtherDecoration]
|
2015-11-17 20:54:03 +00:00
|
|
|
cp b
|
|
|
|
ret nz
|
|
|
|
xor a
|
2017-12-10 00:41:03 +00:00
|
|
|
ld [wOtherDecoration], a
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
WhichSidePutOnText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _WhichSidePutOnText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_PutItAway_Ornament:
|
2017-12-10 00:41:03 +00:00
|
|
|
ld a, [wSelectedDecoration]
|
2015-11-17 20:54:03 +00:00
|
|
|
and a
|
|
|
|
jr z, .nothingthere
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer3
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationName
|
|
|
|
ld a, $1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer5], a
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
2017-12-10 00:41:03 +00:00
|
|
|
ld [wSelectedDecoration], a
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, PutAwayTheDecoText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.nothingthere
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, NothingToPutAwayText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
WhichSidePutAwayText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _WhichSidePutAwayText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecoAction_AskWhichSide:
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextbox
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, MenuHeader_0x26eab
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetMenu2
|
|
|
|
call ExitMenu
|
2018-01-23 21:08:43 +00:00
|
|
|
call CopyMenuData
|
2015-11-17 20:54:03 +00:00
|
|
|
jr c, .nope
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-17 20:54:03 +00:00
|
|
|
cp 3
|
|
|
|
jr z, .nope
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer2], a
|
2015-11-17 20:54:03 +00:00
|
|
|
call QueryWhichSide
|
|
|
|
ld a, [hl]
|
2017-12-10 00:41:03 +00:00
|
|
|
ld [wSelectedDecoration], a
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [de]
|
2017-12-10 00:41:03 +00:00
|
|
|
ld [wOtherDecoration], a
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.nope
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
QueryWhichSide:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wDecoRightOrnament
|
|
|
|
ld de, wDecoLeftOrnament
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBuffer2]
|
2015-11-17 20:54:03 +00:00
|
|
|
cp 1
|
|
|
|
ret z
|
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
MenuHeader_0x26eab:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 0, 0, 13, 7
|
2018-01-23 21:08:43 +00:00
|
|
|
dw MenuData_0x26eb3
|
2015-11-17 20:54:03 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
MenuData_0x26eb3:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR ; flags
|
2015-11-17 20:54:03 +00:00
|
|
|
db 3 ; items
|
|
|
|
db "RIGHT SIDE@"
|
|
|
|
db "LEFT SIDE@"
|
|
|
|
db "CANCEL@"
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
PutAwayTheDecoText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _PutAwayTheDecoText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
NothingToPutAwayText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _NothingToPutAwayText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
SetUpTheDecoText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _SetUpTheDecoText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
PutAwayAndSetUpText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _PutAwayAndSetUpText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
AlreadySetUpText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _AlreadySetUpText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetDecorationName_c_de:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, c
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
call GetDecorationName
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationFlagAction_c:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, c
|
|
|
|
jp DecorationFlagAction
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetDecorationName_c:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, c
|
|
|
|
call GetDecorationID
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer1
|
2015-11-17 20:54:03 +00:00
|
|
|
push hl
|
|
|
|
call GetDecorationName
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SetSpecificDecorationFlag:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, c
|
|
|
|
call GetDecorationID
|
|
|
|
ld b, SET_FLAG
|
|
|
|
call DecorationFlagAction
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetDecorationID:
|
2015-11-17 20:54:03 +00:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
ld hl, DecorationIDs
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SetAllDecorationFlags:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, DecorationIDs
|
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
cp -1
|
|
|
|
jr z, .done
|
|
|
|
push hl
|
|
|
|
ld b, SET_FLAG
|
|
|
|
call DecorationFlagAction
|
|
|
|
pop hl
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
2017-12-27 16:56:03 +00:00
|
|
|
INCLUDE "data/decorations/decorations.asm"
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DescribeDecoration::
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, b
|
2018-01-12 06:40:20 +00:00
|
|
|
ld hl, .JumpTable
|
2015-11-17 20:54:03 +00:00
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.JumpTable:
|
2018-01-12 06:40:20 +00:00
|
|
|
; entries correspond to DECODESC_* constants
|
2015-11-17 20:54:03 +00:00
|
|
|
dw DecorationDesc_Poster
|
|
|
|
dw DecorationDesc_LeftOrnament
|
|
|
|
dw DecorationDesc_RightOrnament
|
|
|
|
dw DecorationDesc_GiantOrnament
|
|
|
|
dw DecorationDesc_Console
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationDesc_Poster:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoPoster]
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, DecorationDesc_PosterPointers
|
|
|
|
ld de, 3
|
|
|
|
call IsInArray
|
|
|
|
jr c, .nope
|
|
|
|
ld de, DecorationDesc_NullPoster
|
|
|
|
ld b, BANK(DecorationDesc_NullPoster)
|
|
|
|
ret
|
|
|
|
|
|
|
|
.nope
|
|
|
|
ld b, BANK(DecorationDesc_TownMapPoster)
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, [hl]
|
|
|
|
ld e, a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationDesc_PosterPointers:
|
2015-11-17 20:54:03 +00:00
|
|
|
dbw DECO_TOWN_MAP, DecorationDesc_TownMapPoster
|
|
|
|
dbw DECO_PIKACHU_POSTER, DecorationDesc_PikachuPoster
|
|
|
|
dbw DECO_CLEFAIRY_POSTER, DecorationDesc_ClefairyPoster
|
|
|
|
dbw DECO_JIGGLYPUFF_POSTER, DecorationDesc_JigglypuffPoster
|
|
|
|
db -1
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
DecorationDesc_TownMapPoster:
|
2015-12-09 23:25:44 +00:00
|
|
|
opentext
|
2019-10-20 22:24:17 +00:00
|
|
|
writetext .LookTownMapText
|
2015-11-25 15:16:29 +00:00
|
|
|
waitbutton
|
2018-01-24 16:17:05 +00:00
|
|
|
special OverworldTownMap
|
2015-11-25 15:16:29 +00:00
|
|
|
closetext
|
2015-11-17 20:54:03 +00:00
|
|
|
end
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.LookTownMapText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _LookTownMapText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
DecorationDesc_PikachuPoster:
|
2019-10-20 22:24:17 +00:00
|
|
|
jumptext .LookPikachuPosterText
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.LookPikachuPosterText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _LookPikachuPosterText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
DecorationDesc_ClefairyPoster:
|
2019-10-20 22:24:17 +00:00
|
|
|
jumptext .LookClefairyPosterText
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.LookClefairyPosterText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _LookClefairyPosterText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
DecorationDesc_JigglypuffPoster:
|
2019-10-20 22:24:17 +00:00
|
|
|
jumptext .LookJigglypuffPosterText
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.LookJigglypuffPosterText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _LookJigglypuffPosterText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationDesc_NullPoster:
|
2015-11-17 20:54:03 +00:00
|
|
|
end
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationDesc_LeftOrnament:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoLeftOrnament]
|
2015-11-17 20:54:03 +00:00
|
|
|
jr DecorationDesc_OrnamentOrConsole
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationDesc_RightOrnament:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoRightOrnament]
|
2015-11-17 20:54:03 +00:00
|
|
|
jr DecorationDesc_OrnamentOrConsole
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationDesc_Console:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoConsole]
|
2015-11-17 20:54:03 +00:00
|
|
|
jr DecorationDesc_OrnamentOrConsole
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationDesc_OrnamentOrConsole:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld c, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer3
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetDecorationName_c_de
|
|
|
|
ld b, BANK(.OrnamentConsoleScript)
|
|
|
|
ld de, .OrnamentConsoleScript
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.OrnamentConsoleScript:
|
2019-10-20 22:24:17 +00:00
|
|
|
jumptext .LookAdorableDecoText
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.LookAdorableDecoText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _LookAdorableDecoText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DecorationDesc_GiantOrnament:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld b, BANK(.BigDollScript)
|
|
|
|
ld de, .BigDollScript
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.BigDollScript:
|
2019-10-20 22:24:17 +00:00
|
|
|
jumptext .LookGiantDecoText
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.LookGiantDecoText:
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _LookGiantDecoText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ToggleMaptileDecorations:
|
2018-07-14 03:19:24 +00:00
|
|
|
; tile coordinates work the same way as for changeblock
|
|
|
|
lb de, 0, 4 ; bed coordinates
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoBed]
|
2015-11-17 20:54:03 +00:00
|
|
|
call SetDecorationTile
|
2018-07-14 03:19:24 +00:00
|
|
|
lb de, 7, 4 ; plant coordinates
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoPlant]
|
2015-11-17 20:54:03 +00:00
|
|
|
call SetDecorationTile
|
2018-07-14 03:19:24 +00:00
|
|
|
lb de, 6, 0 ; poster coordinates
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoPoster]
|
2015-11-17 20:54:03 +00:00
|
|
|
call SetDecorationTile
|
|
|
|
call SetPosterVisibility
|
2018-07-14 03:19:24 +00:00
|
|
|
lb de, 0, 0 ; carpet top-left coordinates
|
2015-11-17 20:54:03 +00:00
|
|
|
call PadCoords_de
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoCarpet]
|
2015-11-17 20:54:03 +00:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
call _GetDecorationSprite
|
|
|
|
ld [hl], a
|
|
|
|
push af
|
2018-07-14 03:19:24 +00:00
|
|
|
lb de, 0, 2 ; carpet bottom-left coordinates
|
2015-11-17 20:54:03 +00:00
|
|
|
call PadCoords_de
|
|
|
|
pop af
|
|
|
|
inc a
|
2018-07-14 03:19:24 +00:00
|
|
|
ld [hli], a ; carpet bottom-left block
|
2015-11-17 20:54:03 +00:00
|
|
|
inc a
|
2018-07-14 03:19:24 +00:00
|
|
|
ld [hli], a ; carpet bottom-middle block
|
2015-11-17 20:54:03 +00:00
|
|
|
dec a
|
2018-07-14 03:19:24 +00:00
|
|
|
ld [hl], a ; carpet bottom-right block
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SetPosterVisibility:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld b, SET_FLAG
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoPoster]
|
2015-11-17 20:54:03 +00:00
|
|
|
and a
|
|
|
|
jr nz, .ok
|
|
|
|
ld b, RESET_FLAG
|
|
|
|
|
|
|
|
.ok
|
2018-01-23 00:10:09 +00:00
|
|
|
ld de, EVENT_PLAYERS_ROOM_POSTER
|
2015-11-17 20:54:03 +00:00
|
|
|
jp EventFlagAction
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SetDecorationTile:
|
2015-11-17 20:54:03 +00:00
|
|
|
push af
|
|
|
|
call PadCoords_de
|
|
|
|
pop af
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
call _GetDecorationSprite
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ToggleDecorationsVisibility:
|
2018-01-23 00:10:09 +00:00
|
|
|
ld de, EVENT_PLAYERS_HOUSE_2F_CONSOLE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wVariableSprites + SPRITE_CONSOLE - SPRITE_VARS
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoConsole]
|
2015-11-17 20:54:03 +00:00
|
|
|
call ToggleDecorationVisibility
|
2018-01-23 00:10:09 +00:00
|
|
|
ld de, EVENT_PLAYERS_HOUSE_2F_DOLL_1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wVariableSprites + SPRITE_DOLL_1 - SPRITE_VARS
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoLeftOrnament]
|
2015-11-17 20:54:03 +00:00
|
|
|
call ToggleDecorationVisibility
|
2018-01-23 00:10:09 +00:00
|
|
|
ld de, EVENT_PLAYERS_HOUSE_2F_DOLL_2
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wVariableSprites + SPRITE_DOLL_2 - SPRITE_VARS
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoRightOrnament]
|
2015-11-17 20:54:03 +00:00
|
|
|
call ToggleDecorationVisibility
|
2018-01-23 00:10:09 +00:00
|
|
|
ld de, EVENT_PLAYERS_HOUSE_2F_BIG_DOLL
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wVariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wDecoBigDoll]
|
2015-11-17 20:54:03 +00:00
|
|
|
call ToggleDecorationVisibility
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ToggleDecorationVisibility:
|
2015-11-17 20:54:03 +00:00
|
|
|
and a
|
|
|
|
jr z, .hide
|
|
|
|
call _GetDecorationSprite
|
|
|
|
ld [hl], a
|
|
|
|
ld b, RESET_FLAG
|
|
|
|
jp EventFlagAction
|
|
|
|
|
|
|
|
.hide
|
|
|
|
ld b, SET_FLAG
|
|
|
|
jp EventFlagAction
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
_GetDecorationSprite:
|
2015-11-17 20:54:03 +00:00
|
|
|
ld c, a
|
|
|
|
push de
|
|
|
|
push hl
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetDecorationSprite
|
2015-11-17 20:54:03 +00:00
|
|
|
pop hl
|
|
|
|
pop de
|
|
|
|
ld a, c
|
|
|
|
ret
|
2017-12-16 04:59:24 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
PadCoords_de:
|
2018-07-14 03:19:24 +00:00
|
|
|
; adjusts coordinates, the same way as Script_changeblock
|
2017-12-16 04:59:24 +00:00
|
|
|
ld a, d
|
|
|
|
add 4
|
|
|
|
ld d, a
|
|
|
|
ld a, e
|
|
|
|
add 4
|
|
|
|
ld e, a
|
|
|
|
call GetBlockLocation
|
|
|
|
ret
|