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.asm111
1 files changed, 51 insertions, 60 deletions
diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm
index 90b26578..8e5920d5 100755
--- a/engine/hidden_object_functions17.asm
+++ b/engine/hidden_object_functions17.asm
@@ -1,4 +1,4 @@
-PrintRedsNESText: ; 5db79 (17:5b79)
+PrintRedsNESText: ; 5dbae (17:5bae)
call EnableAutoTextBoxDrawing
tx_pre_jump RedBedroomSNESText
@@ -22,7 +22,10 @@ Route15GateLeftBinoculars: ; 5db8f (17:5b8f)
ld a, ARTICUNO
ld [wcf91], a
call PlayCry
- jp DisplayMonFrontSpriteInBox
+ call DisplayMonFrontSpriteInBox
+ xor a
+ ld [H_AUTOBGTRANSFERENABLED], a
+ ret
Route15UpstairsBinocularsText: ; 5dba8 (17:5ba8)
TX_FAR _Route15UpstairsBinocularsText
@@ -52,6 +55,30 @@ KabutopsFossilText: ; 5dbd4 (17:5bd4)
TX_FAR _KabutopsFossilText
db "@"
+FanClubPicture1: ; 5dbad (17:5c12)
+ ld a, RAPIDASH
+ ld [wcf91], a
+ call DisplayMonFrontSpriteInBox
+ call EnableAutoTextBoxDrawing
+ tx_pre FanClubPicture1Text
+ ret
+
+FanClubPicture1Text: ; 5dbbe (17:5bbe)
+ TX_FAR _FanClubPicture1Text
+ db "@"
+
+FanClubPicture2: ; 5dbad (17:5c28)
+ ld a, FEAROW
+ ld [wcf91], a
+ call DisplayMonFrontSpriteInBox
+ call EnableAutoTextBoxDrawing
+ tx_pre FanClubPicture2Text
+ ret
+
+FanClubPicture2Text: ; 5dc39 (17:5c39)
+ TX_FAR _FanClubPicture2Text
+ db "@"
+
DisplayMonFrontSpriteInBox: ; 5dbd9 (17:5bd9)
; Displays a pokemon's front sprite in a pop-up window.
; [wcf91] = pokemon interal id number
@@ -110,8 +137,7 @@ LinkCableHelp: ; 5dc29 (17:5c29)
ld hl, wd730
set 6, [hl]
coord hl, 0, 0
- ld b, $8
- ld c, $d
+ lb bc, $8, $d
call TextBoxBorder
coord hl, 2, 2
ld de, HowToLinkText
@@ -339,53 +365,17 @@ GymTrashScript: ; 5ddfc (17:5dfc)
.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 Func_f2d0c
tx_pre_id VermilionGymTrashSuccesText1
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: ; 5ddfc (17:5dfc)
GymTrashCans: ; 5de7d (17:5e7d)
; 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
; 5dec8
VermilionGymTrashSuccesText1: ; 5dec8 (17:5ec8)