This commit is contained in:
YamaArashi 2015-07-18 20:49:52 -07:00
parent b96ef8d2d4
commit c169073eed
61 changed files with 743 additions and 612 deletions

View file

@ -1,9 +1,9 @@
HiddenItems: ; 76688 (1d:6688)
ld hl, HiddenItemCoords
call Func_76857
ld [wTrainerScreenX], a
ld hl, wd6f0
ld a, [wTrainerScreenX]
call FindHiddenItemOrCoinsIndex
ld [wHiddenItemOrCoinsIndex], a
ld hl, wObtainedHiddenItemsFlags
ld a, [wHiddenItemOrCoinsIndex]
ld c, a
ld b, $2
predef FlagActionPredef
@ -11,9 +11,9 @@ HiddenItems: ; 76688 (1d:6688)
and a
ret nz
call EnableAutoTextBoxDrawing
ld a, $1
ld a, 1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld a, [wWhichTrade] ; item ID
ld a, [wHiddenObjectFunctionArgument] ; item ID
ld [wd11e], a
call GetItemName
tx_pre_jump FoundHiddenItemText
@ -23,12 +23,12 @@ INCLUDE "data/hidden_item_coords.asm"
FoundHiddenItemText: ; 7675b (1d:675b)
TX_FAR _FoundHiddenItemText
TX_ASM
ld a, [wWhichTrade] ; item ID
ld a, [wHiddenObjectFunctionArgument] ; item ID
ld b, a
ld c, 1
call GiveItem
jr nc, .BagFull
ld hl, wd6f0
ld hl, wObtainedHiddenItemsFlags
ld a, [wTrainerScreenX]
ld c, a
ld b, $1
@ -56,10 +56,10 @@ HiddenCoins: ; 76799 (1d:6799)
and a
ret z
ld hl, HiddenCoinCoords
call Func_76857
ld [wTrainerScreenX], a
ld hl, wd6fe
ld a, [wTrainerScreenX]
call FindHiddenItemOrCoinsIndex
ld [wHiddenItemOrCoinsIndex], a
ld hl, wObtainedHiddenCoinsFlags
ld a, [wHiddenItemOrCoinsIndex]
ld c, a
ld b, $2
predef FlagActionPredef
@ -70,7 +70,7 @@ HiddenCoins: ; 76799 (1d:6799)
ld [hCoins - 1], a
ld [hCoins], a
ld [hCoins + 1], a
ld a, [wWhichTrade]
ld a, [wHiddenObjectFunctionArgument]
sub COIN
cp 10
jr z, .bcd10
@ -99,7 +99,7 @@ HiddenCoins: ; 76799 (1d:6799)
ld hl, hCoins + 1
ld c, $2
predef AddBCDPredef
ld hl, wd6fe
ld hl, wObtainedHiddenCoinsFlags
ld a, [wTrainerScreenX]
ld c, a
ld b, $1
@ -130,31 +130,31 @@ DroppedHiddenCoinsText: ; 7684d (1d:684d)
TX_FAR _DroppedHiddenCoinsText
db "@"
Func_76857: ; 76857 (1d:6857)
ld a, [wTrainerScreenY]
FindHiddenItemOrCoinsIndex: ; 76857 (1d:6857)
ld a, [wHiddenObjectY]
ld d, a
ld a, [wTrainerScreenX]
ld a, [wHiddenObjectX]
ld e, a
ld a, [W_CURMAP]
ld b, a
ld c, $ff
ld c, -1
.loop
inc c
ld a, [hli]
cp $ff ; end of the list?
ret z ; if so, we're done here
cp b
jr nz, .asm_76877
jr nz, .next1
ld a, [hli]
cp d
jr nz, .asm_76878
jr nz, .next2
ld a, [hli]
cp e
jr nz, .loop
ld a, c
ret
.asm_76877
.next1
inc hl
.asm_76878
.next2
inc hl
jr .loop

View file

@ -1,4 +1,4 @@
Func_46981: ; 46981 (11:6981)
IsPlayerOnDungeonWarp: ; 46981 (11:6981)
xor a
ld [wWhichDungeonWarp], a
ld a, [wd72d]
@ -6,7 +6,7 @@ Func_46981: ; 46981 (11:6981)
ret nz
call ArePlayerCoordsInArray
ret nc
ld a, [wWhichTrade]
ld a, [wCoordIndex]
ld [wWhichDungeonWarp], a
ld hl, wd72d
set 4, [hl]
@ -58,7 +58,7 @@ CheckForHiddenObject: ; 469a0 (11:69a0)
ld [wHiddenObjectX], a
ld c, a
call CheckIfCoordsInFrontOfPlayerMatch
ld a, [$ffea]
ld a, [hCoordsInFrontOfPlayerMatch]
and a
jr z, .foundMatchingObject
inc hl
@ -85,7 +85,7 @@ CheckForHiddenObject: ; 469a0 (11:69a0)
ret
; checks if the coordinates in front of the player's sprite match Y in b and X in c
; [$ffea] = $00 if they match, $ff if they don't match
; [hCoordsInFrontOfPlayerMatch] = $00 if they match, $ff if they don't match
CheckIfCoordsInFrontOfPlayerMatch: ; 46a01 (11:6a01)
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_UP
@ -127,7 +127,7 @@ CheckIfCoordsInFrontOfPlayerMatch: ; 46a01 (11:6a01)
.didNotMatch
ld a, $ff
.done
ld [$ffea], a
ld [hCoordsInFrontOfPlayerMatch], a
ret
INCLUDE "data/hidden_objects.asm"

View file

@ -210,9 +210,8 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1)
.moveDown
ld de, 2*SCREEN_WIDTH
add hl, de ; move tile pointer two rows down
ld de, $100
ld bc, $400
lb de, 1, 0
lb bc, 4, SPRITE_FACING_DOWN
jr TryWalking
.notDown
cp $80 ; $40 <= a < $80: up (or right)
@ -223,8 +222,8 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1)
.moveUp
ld de, -2*SCREEN_WIDTH
add hl, de ; move tile pointer two rows up
ld de, $ff00
ld bc, $804
lb de, -1, 0
lb bc, 8, SPRITE_FACING_UP
jr TryWalking
.notUp
cp $c0 ; $80 <= a < $c0: left (or up)
@ -235,8 +234,8 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1)
.moveLeft
dec hl
dec hl ; move tile pointer two columns left
ld de, $ff
ld bc, $208
lb de, 0, -1
lb bc, 2, SPRITE_FACING_LEFT
jr TryWalking
.notLeft ; $c0 <= a: right (or down)
ld a, [wCurSpriteMovement2]
@ -245,8 +244,8 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1)
.moveRight
inc hl
inc hl ; move tile pointer two columns right
ld de, $1
ld bc, $10c
lb de, 0, 1
lb bc, 1, SPRITE_FACING_RIGHT
jr TryWalking
; changes facing direction by zeroing the movement delta and calling TryWalking