summaryrefslogtreecommitdiff
path: root/engine/overworld
diff options
context:
space:
mode:
Diffstat (limited to 'engine/overworld')
-rw-r--r--engine/overworld/decorations.asm18
-rw-r--r--engine/overworld/player_movement.asm37
2 files changed, 26 insertions, 29 deletions
diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm
index 7ba177420..bea2e0cdb 100644
--- a/engine/overworld/decorations.asm
+++ b/engine/overworld/decorations.asm
@@ -1085,17 +1085,18 @@ DecorationDesc_GiantOrnament:
db "@"
ToggleMaptileDecorations:
- lb de, 0, 4
+ ; tile coordinates work the same way as for changeblock
+ lb de, 0, 4 ; bed coordinates
ld a, [wDecoBed]
call SetDecorationTile
- lb de, 7, 4
+ lb de, 7, 4 ; plant coordinates
ld a, [wDecoPlant]
call SetDecorationTile
- lb de, 6, 0
+ lb de, 6, 0 ; poster coordinates
ld a, [wDecoPoster]
call SetDecorationTile
call SetPosterVisibility
- lb de, 0, 0
+ lb de, 0, 0 ; carpet top-left coordinates
call PadCoords_de
ld a, [wDecoCarpet]
and a
@@ -1103,15 +1104,15 @@ ToggleMaptileDecorations:
call _GetDecorationSprite
ld [hl], a
push af
- lb de, 0, 2
+ lb de, 0, 2 ; carpet bottom-left coordinates
call PadCoords_de
pop af
inc a
- ld [hli], a
+ ld [hli], a ; carpet bottom-left block
inc a
- ld [hli], a
+ ld [hli], a ; carpet bottom-middle block
dec a
- ld [hl], a
+ ld [hl], a ; carpet bottom-right block
ret
SetPosterVisibility:
@@ -1177,6 +1178,7 @@ _GetDecorationSprite:
ret
PadCoords_de:
+; adjusts coordinates, the same way as Script_changeblock
ld a, d
add 4
ld d, a
diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm
index c70357f13..a4926e7e5 100644
--- a/engine/overworld/player_movement.asm
+++ b/engine/overworld/player_movement.asm
@@ -562,8 +562,8 @@ DoPlayerMovement::
.GetAction:
; Poll player input and update movement info.
- ld hl, .table
- ld de, .table2 - .table1
+ ld hl, .action_table
+ ld de, .action_table_1_end - .action_table_1
ld a, [wCurInput]
bit D_DOWN_F, a
jr nz, .d_down
@@ -597,25 +597,20 @@ DoPlayerMovement::
ld [wWalkingTile], a
ret
-.table
-; struct:
-; walk direction
-; facing
-; x movement
-; y movement
-; tile collision pointer
-.table1
- db STANDING, FACE_CURRENT, 0, 0
- dw wPlayerStandingTile
-.table2
- db RIGHT, FACE_RIGHT, 1, 0
- dw wTileRight
- db LEFT, FACE_LEFT, -1, 0
- dw wTileLeft
- db UP, FACE_UP, 0, -1
- dw wTileUp
- db DOWN, FACE_DOWN, 0, 1
- dw wTileDown
+player_action: MACRO
+; walk direction, facing, x movement, y movement, tile collision pointer
+ db \1, \2, \3, \4
+ dw \5
+ENDM
+
+.action_table:
+.action_table_1
+ player_action STANDING, FACE_CURRENT, 0, 0, wPlayerStandingTile
+.action_table_1_end
+ player_action RIGHT, FACE_RIGHT, 1, 0, wTileRight
+ player_action LEFT, FACE_LEFT, -1, 0, wTileLeft
+ player_action UP, FACE_UP, 0, -1, wTileUp
+ player_action DOWN, FACE_DOWN, 0, 1, wTileDown
.CheckNPC:
; Returns 0 if there is an NPC in front that you can't move