summaryrefslogtreecommitdiff
path: root/src/engine/home.asm
diff options
context:
space:
mode:
authorAndrew Martinek <andrewrmartinek@gmail.com>2019-10-06 23:00:27 -0400
committerAndrew Martinek <andrewrmartinek@gmail.com>2019-10-06 23:00:27 -0400
commita44f17b9a15cf1a572d5e8056a69c368265729f2 (patch)
treee8137a71e6c6fb2cbb56d3d58be084f3958ba39e /src/engine/home.asm
parentfda59356c20813bb57d59de8d9b2b100f0fe275d (diff)
Fixed a few macros that were giving weird code. Updated tcgdisasm
Diffstat (limited to 'src/engine/home.asm')
-rw-r--r--src/engine/home.asm37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/engine/home.asm b/src/engine/home.asm
index adcbabd..4135afa 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -10908,15 +10908,16 @@ Func_3997: ; 3997 (0:3997)
call BankswitchROM
ret
-Func_39a7: ; 39a7 (0:39a7)
- ld l, $0
- call Func_39ad
+; returns in hl a pointer to the first element for the a'th NPC
+GetLoadedNPCID: ; 39a7 (0:39a7)
+ ld l, LOADED_NPC_ID
+ call GetItemInLoadedNPCIndex
ret
-; return hl = wd34a + a * $c + l, with a < $8
-Func_39ad: ; 39ad (0:39ad)
+; return in hl a pointer to the a'th items element l
+GetItemInLoadedNPCIndex: ; 39ad (0:39ad)
push bc
- cp $8
+ cp LOADED_NPC_MAX
jr c, .asm_39b4
debug_ret
xor a
@@ -10929,24 +10930,24 @@ Func_39ad: ; 39ad (0:39ad)
add l
ld l, a
ld h, $0
- ld bc, wd34a
+ ld bc, wLoadedNPCs
add hl, bc
pop bc
ret
-; Finds the index on wd34a table of the npc in wTempNPC
-; returns it in a and puts it into wd3aa
+; Finds the index on wLoadedNPCs table of the npc in wTempNPC
+; returns it in a and puts it into wLoadedNPCTempIndex
; c flag set if no npc found
-Func_39c3: ; 39c3 (0:39c3)
+FindLoadedNPC: ; 39c3 (0:39c3)
push hl
push bc
push de
xor a
- ld [wd3aa], a
+ ld [wLoadedNPCTempIndex], a
ld b, a
- ld c, $8
- ld de, $000c
- ld hl, wd34a
+ ld c, LOADED_NPC_MAX
+ ld de, LOADED_NPC_LENGTH
+ ld hl, wLoadedNPCs
ld a, [wTempNPC]
.findNPCLoop
cp [hl]
@@ -10959,7 +10960,7 @@ Func_39c3: ; 39c3 (0:39c3)
jr z, .exit
.foundNPCMatch
ld a, b
- ld [wd3aa], a
+ ld [wLoadedNPCTempIndex], a
or a
.exit
pop de
@@ -11069,7 +11070,7 @@ Func_3a5e: ; 3a5e (0:3a5e)
call Func_c653
ld a, $4
call BankswitchROM
- ld a, [wd334]
+ ld a, [wPlayerDirection]
ld d, a
.asm_3a79
ld a, [hli]
@@ -11086,9 +11087,9 @@ Func_3a5e: ; 3a5e (0:3a5e)
cp c
jr nz, .asm_3aab
ld a, [hli]
- ld [wd0c6], a
+ ld [wNextOWSequence], a
ld a, [hli]
- ld [wd0c7], a
+ ld [wNextOWSequence+1], a
ld a, [hli]
ld [wd0ca], a
ld a, [hli]