map permission functions

This commit is contained in:
xCrystal
2018-07-17 14:24:09 +02:00
parent 80a5aa82a0
commit eb87f849ff
3 changed files with 22 additions and 14 deletions
+3 -3
View File
@@ -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
+14 -9
View File
@@ -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
+5 -2
View File
@@ -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