diff options
author | YamaArashi <shadow962@live.com> | 2015-07-25 19:26:54 -0700 |
---|---|---|
committer | YamaArashi <shadow962@live.com> | 2015-07-25 19:26:54 -0700 |
commit | 93255d6d17fbb3702a0f8670d7ecc2ed627af2a7 (patch) | |
tree | d14acaf4efeb96e252c0e195a757ea212b8c69a0 /engine/hidden_object_functions17.asm | |
parent | 7f6d0d49b61a77cfba76057d99881634b882486b (diff) |
yet more naming
Diffstat (limited to 'engine/hidden_object_functions17.asm')
-rwxr-xr-x | engine/hidden_object_functions17.asm | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index 788dd777..aad8c468 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -349,12 +349,21 @@ GymTrashScript: ; 5ddfc (17:5dfc) add hl, de ld a, [hli] - ld [$ffdb], a +; 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, [$ffdb] + ld a, [hGymTrashCanRandNumMask] and b dec a pop hl @@ -398,6 +407,12 @@ GymTrashScript: ; 5ddfc (17:5dfc) jp PrintPredefTextID 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 +; to 5 bytes. db 2, 1, 3, 0, 0 ; 0 db 3, 0, 2, 4, 0 ; 1 db 2, 1, 5, 0, 0 ; 2 |