summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2018-07-17 14:24:09 +0200
committerxCrystal <rgr.crystal@gmail.com>2018-07-17 14:24:09 +0200
commiteb87f849ff7a0ec07a27035fb183234ed04ef540 (patch)
treecdbe7ea8c0430e64a89cad5e93b250f6291677c9 /src
parent80a5aa82a0ab5b786ceaf1edb2e05375fa89d7c4 (diff)
map permission functions
Diffstat (limited to 'src')
-rw-r--r--src/engine/bank03.asm6
-rw-r--r--src/engine/home.asm23
-rw-r--r--src/wram.asm7
3 files changed, 22 insertions, 14 deletions
diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm
index aac9c1b..744a3ef 100644
--- a/src/engine/bank03.asm
+++ b/src/engine/bank03.asm
@@ -677,7 +677,7 @@ Func_c58b: ; c58b (3:458b)
ld b, a
ld a, [wPlayerYCoord]
ld c, a
- call GetFloorObjectFromPos
+ call GetPermissionOfMapPosition
and $10
push af
ld c, SPRITE_ANIM_FIELD_0F
@@ -776,7 +776,7 @@ AttemptScriptedMovement: ; c619 (3:4619)
ld a, c
cp $1f
jr nc, .quit_movement
- call GetFloorObjectFromPos
+ call GetPermissionOfMapPosition
and $40 | $80 ; the two impassable objects found in the floor map
jr nz, .quit_movement
ld a, b
@@ -943,7 +943,7 @@ Func_c71e: ; c71e (3:471e)
ld a, $ff
ld [wd3b6], a
call Func_c653
- call GetFloorObjectFromPos
+ call GetPermissionOfMapPosition
and $40
jr z, .asm_c73d
farcall Func_1c72e
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 948d810..a922861 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -10592,31 +10592,35 @@ Func_3917: ; 3917 (0:3917)
call DisableSRAM
ret
-GetFloorObjectFromPos: ; 3927 (0:3927)
+; return in a the permission byte corresponding to the current map's x,y coordinates at bc
+GetPermissionOfMapPosition: ; 3927 (0:3927)
push hl
- call FindFloorTileFromPos
+ call GetPermissionByteOfMapPosition
ld a, [hl]
pop hl
ret
; 0x392e
-SetFloorObjectFromPos: ; 392e (0:392e)
+; set to a the permission byte corresponding to the current map's x,y coordinates at bc
+SetPermissionOfMapPosition: ; 392e (0:392e)
push hl
push af
- call FindFloorTileFromPos
+ call GetPermissionByteOfMapPosition
pop af
ld [hl], a
pop hl
ret
; 0x3937
-UpdateFloorObjectFromPos: ; 3937 (0:3937)
+; set the permission byte corresponding to the current map's x,y coordinates at bc
+; to the value of register a anded by its current value
+UpdatePermissionOfMapPosition: ; 3937 (0:3937)
push hl
push bc
push de
cpl
ld e, a
- call FindFloorTileFromPos
+ call GetPermissionByteOfMapPosition
ld a, [hl]
and e
ld [hl], a
@@ -10626,8 +10630,9 @@ UpdateFloorObjectFromPos: ; 3937 (0:3937)
ret
; 0x3946
-; puts a floor tile in hl given coords in bc (x,y. measured in tiles)
-FindFloorTileFromPos: ; 3946 (0:3946)
+; returns in hl the address within wPermissionMap that corresponds to
+; the current map's x,y coordinates at bc
+GetPermissionByteOfMapPosition: ; 3946 (0:3946)
push bc
srl b
srl c
@@ -10637,7 +10642,7 @@ FindFloorTileFromPos: ; 3946 (0:3946)
or b
ld c, a
ld b, $0
- ld hl, wFloorObjectMap
+ ld hl, wPermissionMap
add hl, bc
pop bc
ret
diff --git a/src/wram.asm b/src/wram.asm
index 9f8acc7..e40d382 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -1521,8 +1521,11 @@ wBoosterViableCardList:: ; d133
NEXTU
-; map of the current room with unpassable objects (walls, NPCs, etc). Might be a permission map
-wFloorObjectMap::
+; permission map of the current room with unpassable objects (walls, NPCs, etc).
+; $00: passable (floor)
+; $40: unpassable and talkable (NPC or talkable wall)
+; $80: unpassable and untalkable (wall)
+wPermissionMap::
ds $100
ENDU