aboutsummaryrefslogtreecommitdiffstats
path: root/home/hidden_events.asm
blob: ae8ee439d664ca67437c7ed38887fbed6ae12204 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
UpdateCinnabarGymGateTileBlocks::
	farcall UpdateCinnabarGymGateTileBlocks_
	ret

CheckForHiddenEventOrBookshelfOrCardKeyDoor::
	ldh a, [hLoadedROMBank]
	push af
	ldh a, [hJoyHeld]
	bit B_PAD_A, a
	jr z, .nothingFound
; A button is pressed
	ld a, BANK(CheckForHiddenEvent)
	call BankswitchCommon
	call CheckForHiddenEvent
	ldh a, [hDidntFindAnyHiddenEvent]
	and a
	jr nz, .hiddenEventNotFound
	xor a
	ldh [hItemAlreadyFound], a
	ld a, [wHiddenEventFunctionRomBank]
	call BankswitchCommon
	call JumpToAddress
	ldh a, [hItemAlreadyFound]
	jr .done
.hiddenEventNotFound
	predef GetTileAndCoordsInFrontOfPlayer
	farcall PrintBookshelfText
	ldh a, [hInteractedWithBookshelf]
	and a
	jr z, .done
.nothingFound
	ld a, $ff
.done
	ldh [hItemAlreadyFound], a
	pop af
	call BankswitchCommon
	ret