-
Notifications
You must be signed in to change notification settings - Fork 989
Remove Redundant Card Key Function
sabra55 edited this page Jan 23, 2024
·
2 revisions
Card Key (for Silph Co. doors) has two functions in-game. One of them, in engine\items\item_effects.asm, is bugged and always jumps to ItemUseNotTime
.
engine\items\item_effects.asm:
...
dw UnusableItem ; BIKE_VOUCHER
dw ItemUseXAccuracy ; X_ACCURACY
dw ItemUseEvoStone ; LEAF_STONE
- dw ItemUseCardKey ; CARD_KEY
+ dw UnusableItem ; CARD_KEY
dw UnusableItem ; NUGGET
dw UnusableItem ; ??? PP_UP
dw ItemUsePokedoll ; POKE_DOLL
...
...
set USING_X_ACCURACY, [hl] ; X Accuracy bit
jp PrintItemUseTextAndRemoveItem
-; This function is bugged and never works. It always jumps to ItemUseNotTime.
-; The Card Key is handled in a different way.
-ItemUseCardKey:
- xor a
- ld [wUnusedD71F], a
- call GetTileAndCoordsInFrontOfPlayer
- ld a, [GetTileAndCoordsInFrontOfPlayer]
- cp $18
- jr nz, .next0
- ld hl, CardKeyTable1
- jr .next1
-.next0
- cp $24
- jr nz, .next2
- ld hl, CardKeyTable2
- jr .next1
-.next2
- cp $5e
- jp nz, ItemUseNotTime
- ld hl, CardKeyTable3
-.next1
- ld a, [wCurMap]
- ld b, a
-.loop
- ld a, [hli]
- cp -1
- jp z, ItemUseNotTime
- cp b
- jr nz, .nextEntry1
- ld a, [hli]
- cp d
- jr nz, .nextEntry2
- ld a, [hli]
- cp e
- jr nz, .nextEntry3
- ld a, [hl]
- ld [wUnusedD71F], a
- jr .done
-.nextEntry1
- inc hl
-.nextEntry2
- inc hl
-.nextEntry3
- inc hl
- jr .loop
-.done
- ld hl, ItemUseText00
- call PrintText
- ld hl, wd728
- set 7, [hl]
- ret
-INCLUDE "data/events/card_key_coords.asm"
ItemUsePokedoll:
ld a, [wIsInBattle]
dec a
...
Now, just delete data/events/card_key_coords.asm.