pokecrystal-board/engine/events/unown_walls.asm
Rangi 32ed487a47 Merge branch 'master' of https://github.com/pret/pokecrystal
# Conflicts:
#	audio/engine.asm
#	constants/gfx_constants.asm
#	constants/map_data_constants.asm
#	constants/pokemon_data_constants.asm
#	constants/sprite_constants.asm
#	constants/wram_constants.asm
#	data/maps/data.asm
#	engine/battle/ai/scoring.asm
#	engine/battle/core.asm
#	engine/battle/effect_commands.asm
#	engine/battle/misc.asm
#	engine/battle_anims/getpokeballwobble.asm
#	engine/breeding.asm
#	engine/buy_sell_toss.asm
#	engine/decorations.asm
#	engine/events/battle_tower/battle_tower.asm
#	engine/events/battle_tower/rules.asm
#	engine/events/buena.asm
#	engine/events/bug_contest/contest_2.asm
#	engine/events/daycare.asm
#	engine/events/dratini.asm
#	engine/events/halloffame.asm
#	engine/events/happiness_egg.asm
#	engine/events/kurt.asm
#	engine/events/lucky_number.asm
#	engine/events/magnet_train.asm
#	engine/events/overworld.asm
#	engine/events/pokerus/pokerus.asm
#	engine/events/print_unown.asm
#	engine/events/print_unown_2.asm
#	engine/events/unown_walls.asm
#	engine/item_effects.asm
#	engine/link.asm
#	engine/mon_menu.asm
#	engine/player_object.asm
#	engine/routines/playslowcry.asm
#	engine/scripting.asm
#	engine/search.asm
#	engine/search2.asm
#	engine/specials.asm
#	engine/start_menu.asm
#	engine/timeset.asm
#	home/battle_vars.asm
#	home/map.asm
#	maps/GoldenrodUndergroundSwitchRoomEntrances.asm
#	maps/IlexForest.asm
#	maps/KrissHouse2F.asm
#	maps/Route39Barn.asm
#	mobile/mobile_12_2.asm
#	mobile/mobile_40.asm
#	mobile/mobile_5f.asm
#	wram.asm
2018-02-03 19:42:56 -05:00

268 lines
3.5 KiB
NASM

HoOhChamber: ; 0x8addb
ld hl, wPartySpecies
ld a, [hl]
cp HO_OH ; is Ho-oh the first Pokémon in the party?
jr nz, .done ; if not, we're done
call GetMapAttributesPointer ; pointless?
ld de, EVENT_WALL_OPENED_IN_HO_OH_CHAMBER
ld b, SET_FLAG
call EventFlagAction
.done
ret
; 0x8adef
OmanyteChamber: ; 8adef
call GetMapAttributesPointer ; pointless?
ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER
ld b, CHECK_FLAG
call EventFlagAction
ld a, c
and a
jr nz, .nope
ld a, WATER_STONE
ld [wCurItem], a
ld hl, wNumItems
call CheckItem
jr c, .open
ld a, [wPartyCount]
ld b, a
inc b
.loop
dec b
jr z, .nope
ld a, b
dec a
ld [wCurPartyMon], a
push bc
ld a, MON_ITEM
call GetPartyParamLocation
pop bc
ld a, [hl]
cp WATER_STONE
jr nz, .loop
.open
call GetMapAttributesPointer ; pointless?
ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER
ld b, SET_FLAG
call EventFlagAction
.nope
ret
; 8ae30
SpecialAerodactylChamber: ; 8ae30
push de
push bc
call GetMapAttributesPointer
ld a, h
cp HIGH(RuinsOfAlphAerodactylChamber_MapAttributes)
jr nz, .nope
ld a, l
cp LOW(RuinsOfAlphAerodactylChamber_MapAttributes)
jr nz, .nope
ld de, EVENT_WALL_OPENED_IN_AERODACTYL_CHAMBER
ld b, SET_FLAG
call EventFlagAction
scf
jr .done
.nope
and a
.done
pop bc
pop de
ret
; 8ae4e
SpecialKabutoChamber: ; 8ae4e
push hl
push de
call GetMapAttributesPointer
ld a, h
cp HIGH(RuinsOfAlphKabutoChamber_MapAttributes)
jr nz, .done
ld a, l
cp LOW(RuinsOfAlphKabutoChamber_MapAttributes)
jr nz, .done
ld de, EVENT_WALL_OPENED_IN_KABUTO_CHAMBER
ld b, SET_FLAG
call EventFlagAction
.done
pop de
pop hl
ret
; 8ae68
DisplayUnownWords: ; 8ae68
ld a, [wScriptVar]
ld hl, MenuHeaders_UnownWalls
and a
jr z, .load
ld d, $0
ld e, $5
.loop
add hl, de
dec a
jr nz, .loop
.load
call LoadMenuHeader
xor a
ld [hBGMapMode], a
call MenuBox
call UpdateSprites
call ApplyTilemap
call MenuBoxCoord2Tile
inc hl
ld d, 0
ld e, SCREEN_WIDTH
add hl, de
add hl, de
ld a, [wScriptVar]
ld c, a
ld de, UnownWalls
and a
jr z, .copy
.loop2
ld a, [de]
inc de
cp -1
jr nz, .loop2
dec c
jr nz, .loop2
.copy
call _DisplayUnownWords_CopyWord
ld bc, wAttrMap - wTileMap
add hl, bc
call _DisplayUnownWords_FillAttr
call WaitBGMap2
call JoyWaitAorB
call PlayClickSFX
call CloseWindow
ret
; 8aebc
INCLUDE "data/events/unown_walls.asm"
_DisplayUnownWords_FillAttr: ; 8aee9
ld a, [de]
cp $ff
ret z
cp $60
ld a, VRAM_BANK_1 | PAL_BG_BROWN
jr c, .got_pal
ld a, PAL_BG_BROWN
.got_pal
call .PlaceSquare
inc hl
inc hl
inc de
jr _DisplayUnownWords_FillAttr
; 8aefd
.PlaceSquare: ; 8aefd
push hl
ld [hli], a
ld [hld], a
ld b, 0
ld c, SCREEN_WIDTH
add hl, bc
ld [hli], a
ld [hl], a
pop hl
ret
; 8af09
_DisplayUnownWords_CopyWord: ; 8af09
push hl
push de
.word_loop
ld a, [de]
cp $ff
jr z, .word_done
ld c, a
call .ConvertChar
inc hl
inc hl
inc de
jr .word_loop
.word_done
pop de
pop hl
ret
; 8af1c
.ConvertChar: ; 8af1c
push hl
ld a, c
cp $60
jr z, .Tile60
cp $62
jr z, .Tile62
cp $64
jr z, .Tile64
ld [hli], a
inc a
ld [hld], a
dec a
ld b, 0
ld c, SCREEN_WIDTH
add hl, bc
ld c, $10
add c
ld [hli], a
inc a
ld [hl], a
pop hl
ret
.Tile60:
ld [hl], $5b
inc hl
ld [hl], $5c
ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], $4d
inc hl
ld [hl], $5d
pop hl
ret
.Tile62:
ld [hl], $4e
inc hl
ld [hl], $4f
ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], $5e
inc hl
ld [hl], $5f
pop hl
ret
.Tile64:
ld [hl], $2
inc hl
ld [hl], $3
ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], $3
inc hl
ld [hl], $2
pop hl
ret
; 8af6b