summaryrefslogtreecommitdiff
path: root/engine/hidden_object_functions17.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/hidden_object_functions17.asm')
-rwxr-xr-xengine/hidden_object_functions17.asm149
1 files changed, 70 insertions, 79 deletions
diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm
index 1b571d35..2279225e 100755
--- a/engine/hidden_object_functions17.asm
+++ b/engine/hidden_object_functions17.asm
@@ -14,7 +14,7 @@ RedBedroomPCText:
TX_PLAYERS_PC
Route15GateLeftBinoculars:
- ld a, [wSpriteStateData1 + 9]
+ ld a, [wPlayerFacingDirection]
cp SPRITE_FACING_UP
ret nz
call EnableAutoTextBoxDrawing
@@ -22,7 +22,10 @@ Route15GateLeftBinoculars:
ld a, ARTICUNO
ld [wcf91], a
call PlayCry
- jp DisplayMonFrontSpriteInBox
+ call DisplayMonFrontSpriteInBox
+ xor a
+ ld [H_AUTOBGTRANSFERENABLED], a
+ ret
Route15UpstairsBinocularsText:
TX_FAR _Route15UpstairsBinocularsText
@@ -52,6 +55,30 @@ KabutopsFossilText:
TX_FAR _KabutopsFossilText
db "@"
+FanClubPicture1:
+ ld a, RAPIDASH
+ ld [wcf91], a
+ call DisplayMonFrontSpriteInBox
+ call EnableAutoTextBoxDrawing
+ tx_pre FanClubPicture1Text
+ ret
+
+FanClubPicture1Text:
+ TX_FAR _FanClubPicture1Text
+ db "@"
+
+FanClubPicture2:
+ ld a, FEAROW
+ ld [wcf91], a
+ call DisplayMonFrontSpriteInBox
+ call EnableAutoTextBoxDrawing
+ tx_pre FanClubPicture2Text
+ ret
+
+FanClubPicture2Text:
+ TX_FAR _FanClubPicture2Text
+ db "@"
+
DisplayMonFrontSpriteInBox:
; Displays a pokemon's front sprite in a pop-up window.
; [wcf91] = pokemon interal id number
@@ -95,23 +122,22 @@ LinkCableHelp:
ld hl, LinkCableHelpText1
call PrintText
xor a
- ld [wMenuItemOffset], a ; not used
+ ld [wMenuItemOffset], a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
- ld a, 3
+ ld a, $3
ld [wMaxMenuItem], a
- ld a, 2
+ ld a, $2
ld [wTopMenuItemY], a
- ld a, 1
+ ld a, $1
ld [wTopMenuItemX], a
.linkHelpLoop
ld hl, wd730
set 6, [hl]
coord hl, 0, 0
- ld b, 8
- ld c, 13
+ lb bc, $8, $d
call TextBoxBorder
coord hl, 2, 2
ld de, HowToLinkText
@@ -122,13 +148,13 @@ LinkCableHelp:
bit 1, a ; pressed b
jr nz, .exit
ld a, [wCurrentMenuItem]
- cp 3 ; pressed a on "STOP READING"
+ cp $3 ; pressed a on "STOP READING"
jr z, .exit
ld hl, wd730
res 6, [hl]
ld hl, LinkCableInfoTexts
add a
- ld d, 0
+ ld d, $0
ld e, a
add hl, de
ld a, [hli]
@@ -184,11 +210,11 @@ ViridianSchoolBlackboard:
ld [wLastMenuItem], a
ld a, D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
- ld a, 2
+ ld a, $2
ld [wMaxMenuItem], a
- ld a, 2
+ ld a, $2
ld [wTopMenuItemY], a
- ld a, 1
+ ld a, $1
ld [wTopMenuItemX], a
.blackboardLoop
ld hl, wd730
@@ -210,24 +236,24 @@ ViridianSchoolBlackboard:
bit 4, a ; pressed right
jr z, .didNotPressRight
; move cursor to right column
- ld a, 2
+ ld a, $2
ld [wMaxMenuItem], a
- ld a, 2
+ ld a, $2
ld [wTopMenuItemY], a
- ld a, 6
+ ld a, $6
ld [wTopMenuItemX], a
- ld a, 3 ; in the the right column, use an offset to prevent overlap
+ ld a, $3 ; in the the right column, use an offset to prevent overlap
ld [wMenuItemOffset], a
jr .blackboardLoop
.didNotPressRight
bit 5, a ; pressed left
jr z, .didNotPressLeftOrRight
; move cursor to left column
- ld a, 2
+ ld a, $2
ld [wMaxMenuItem], a
- ld a, 2
+ ld a, $2
ld [wTopMenuItemY], a
- ld a, 1
+ ld a, $1
ld [wTopMenuItemX], a
xor a
ld [wMenuItemOffset], a
@@ -235,9 +261,9 @@ ViridianSchoolBlackboard:
.didNotPressLeftOrRight
ld a, [wCurrentMenuItem]
ld b, a
- ld a, [wMenuItemOffset]
+ ld a, [wAnimationID]
add b
- cp 5 ; cursor is pointing to "QUIT"
+ cp $5 ; cursor is pointing to "QUIT"
jr z, .exitBlackboard
; we must have pressed a on a status condition
; so print the text
@@ -245,7 +271,7 @@ ViridianSchoolBlackboard:
res 6, [hl]
ld hl, ViridianBlackboardStatusPointers
add a
- ld d, 0
+ ld d, $0
ld e, a
add hl, de
ld a, [hli]
@@ -339,53 +365,17 @@ GymTrashScript:
.openFirstLock
; Next can is trying for the second switch.
SetEvent EVENT_1ST_LOCK_OPENED
-
- ld hl, GymTrashCans
- ld a, [wGymTrashCanIndex]
- ; * 5
- ld b, a
- add a
- add a
- add b
-
- ld d, 0
- ld e, a
- add hl, de
- ld a, [hli]
-
-; There is a bug in this code. It should calculate a value in the range [0, 3]
-; but if the mask and random number don't have any 1 bits in common, then
-; the result of the AND will be 0. When 1 is subtracted from that, the value
-; will become $ff. This will result in 255 being added to hl, which will cause
-; hl to point to one of the zero bytes that pad the end of the ROM bank.
-; Trash can 0 was intended to be able to have the second lock only when the
-; first lock was in trash can 1 or 3. However, due to this bug, trash can 0 can
-; have the second lock regardless of which trash can had the first lock.
-
- ld [hGymTrashCanRandNumMask], a
- push hl
- call Random
- swap a
- ld b, a
- ld a, [hGymTrashCanRandNumMask]
- and b
- dec a
- pop hl
-
- ld d, 0
- ld e, a
- add hl, de
- ld a, [hl]
- and $f
- ld [wSecondLockTrashCanIndex], a
-
+ callab Yellow_SampleSecondTrashCan
tx_pre_id VermilionGymTrashSuccessText1
jr .done
.trySecondLock
- ld a, [wSecondLockTrashCanIndex]
- ld b, a
ld a, [wGymTrashCanIndex]
+ ld b, a
+ ld a, [wSecondLockTrashCanIndex]
+ cp b
+ jr z, .openSecondLock
+ ld a, [wSecondLockTrashCanIndex + 1]
cp b
jr z, .openSecondLock
@@ -413,25 +403,26 @@ GymTrashScript:
GymTrashCans:
; byte 0: mask for random number
; bytes 1-4: indices of the trash cans that can have the second lock
-; (but see the comment above explaining a bug regarding this)
; Note that the mask is simply the number of valid trash can indices that
-; follow. The remaining bytes are filled with 0 to pad the length of each entry
+; follow. The remaining bytes are filled with -1 to pad the length of each entry
; to 5 bytes.
- db 2, 1, 3, 0, 0 ; 0
- db 3, 0, 2, 4, 0 ; 1
- db 2, 1, 5, 0, 0 ; 2
- db 3, 0, 4, 6, 0 ; 3
+; This is functionally replaced with GymTrashCans3a but was never removed from source.
+
+ db 2, 1, 3, -1, -1 ; 0
+ db 3, 0, 2, 4, -1 ; 1
+ db 2, 1, 5, -1, -1 ; 2
+ db 3, 0, 4, 6, -1 ; 3
db 4, 1, 3, 5, 7 ; 4
- db 3, 2, 4, 8, 0 ; 5
- db 3, 3, 7, 9, 0 ; 6
+ db 3, 2, 4, 8, -1 ; 5
+ db 3, 3, 7, 9, -1 ; 6
db 4, 4, 6, 8, 10 ; 7
- db 3, 5, 7, 11, 0 ; 8
- db 3, 6, 10, 12, 0 ; 9
+ db 3, 5, 7, 11, -1 ; 8
+ db 3, 6, 10, 12, -1 ; 9
db 4, 7, 9, 11, 13 ; 10
- db 3, 8, 10, 14, 0 ; 11
- db 2, 9, 13, 0, 0 ; 12
- db 3, 10, 12, 14, 0 ; 13
- db 2, 11, 13, 0, 0 ; 14
+ db 3, 8, 10, 14, -1 ; 11
+ db 2, 9, 13, -1, -1 ; 12
+ db 3, 10, 12, 14, -1 ; 13
+ db 2, 11, 13, -1, -1 ; 14
VermilionGymTrashSuccessText1:
TX_FAR _VermilionGymTrashSuccessText1