ref: d35cfad0de085fab1b0c40c7f0497c9b745cb7b2
parent: 76e2ea534fa8374e62b8916e068514101cd617fa
author: PikalaxALT <PikalaxALT@gmail.com>
date: Mon Nov 2 06:15:32 EST 2015
object_struct
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -3247,7 +3247,7 @@
Function3d490: ; 3d490
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld c, a
.asm_3d493
push bc
@@ -3271,7 +3271,7 @@
; 3d4ae
Function3d4ae: ; 3d4ae
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld c, a
cp $8
jr nz, .back
@@ -9486,7 +9486,7 @@
Function3fc5b: ; 3fc5b
ld hl, Sprites
xor a
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld b, $6
ld e, $a8
.asm_3fc65
@@ -9497,10 +9497,10 @@
inc hl
ld [hl], e
inc hl
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld [hli], a
inc a
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld a, $1
ld [hli], a
ld a, d
@@ -9508,9 +9508,9 @@
ld d, a
dec c
jr nz, .asm_3fc69
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
add $3
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld a, e
add $8
ld e, a
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -516,7 +516,7 @@
const OBJECT_SPRITE
const OBJECT_MAP_OBJECT_INDEX
const OBJECT_SPRITE_TILE
- const OBJECT_03
+ const OBJECT_MOVEMENTTYPE
const OBJECT_FLAGS1
const OBJECT_FLAGS2
const OBJECT_PALETTE
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -396,7 +396,7 @@
ret
.return6
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
call CheckPitTile
jr nz, .pittile
ld a, 6
@@ -606,7 +606,7 @@
.IsObject
call PlayTalkObject
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
call GetObjectStruct
ld hl, OBJECT_MAP_OBJECT_INDEX
add hl, bc
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -161,7 +161,7 @@
jr nc, .no
.ice_check
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
call CheckIceTile
jr z, .no
scf
@@ -235,7 +235,7 @@
; 97d64
TryWildEncounter_BugContest: ; 97d64
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
call CheckSuperTallGrassTile
ld b, 40 percent
jr z, .ok
@@ -352,7 +352,7 @@
ld hl, wd6de
xor a
.asm_97e0c
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld a, [hl]
and a
jr z, .asm_97e19
@@ -365,7 +365,7 @@
.asm_97e19
ld de, $0006
add hl, de
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
inc a
cp $4
jr nz, .asm_97e0c
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -828,7 +828,7 @@
ret
; 4769
-Function4769: ; 4769
+RestoreDefaultMovement: ; 4769
ld hl, OBJECT_MAP_OBJECT_INDEX
add hl, bc
ld a, [hl]
@@ -1029,7 +1029,7 @@
jp Function4b26
; 4869
-Function4869: ; 4869
+Function4869: ; standing?
call Function462a
call Function467b
ld hl, OBJECT_11
@@ -1083,7 +1083,7 @@
; 48a6
Function48a6: ; 48a6
- ld hl, Function500e
+ ld hl, Function500e ; scripted
jp Function5041
; 48ac
@@ -1500,7 +1500,7 @@
add hl, bc
ld [hl], 2
ld hl, wd4cf
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
cp [hl]
jr z, .ok
ld hl, OBJECT_09
@@ -2047,7 +2047,7 @@
; 4e13
Function4e13: ; 4e13
- call Function4769
+ call RestoreDefaultMovement
call Function1a47
ld hl, OBJECT_FACING
add hl, bc
@@ -2396,7 +2396,7 @@
db -11, -10, -9, -8, -6, -4, 0, 0
; 5000
-Function5000: ; 5000
+Function5000: ; unscripted?
ld a, [wc2de]
ld hl, wc2df
ld [hl], a
@@ -2406,8 +2406,8 @@
ret
; 500e
-Function500e: ; 500e
- ld hl, wc2e3
+Function500e: ; scripted
+ ld hl, wMovementDataPointer
call Function1aae
ret
; 5015
@@ -2418,7 +2418,7 @@
ld e, [hl]
inc [hl]
ld d, 0
- ld hl, wc2e2
+ ld hl, wMovementPerson
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2448,7 +2448,7 @@
; 503d
Function503d: ; 503d
- ld a, [wc2e2]
+ ld a, [wMovementPerson]
ret
; 5041
@@ -2467,14 +2467,14 @@
CopyMovementPointer: ; 5055
ld a, l
- ld [wc2eb], a
+ ld [wMovementPointer], a
ld a, h
- ld [wc2ec], a
+ ld [wMovementPointer + 1], a
ret
; 505e
GetMovementByte: ; 505e
- ld hl, wc2eb
+ ld hl, wMovementPointer
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2489,7 +2489,7 @@
DoMovementFunction: ; 506b
push af
- call Function54b8
+ call ApplyMovementToFollower
pop af
ld hl, MovementPointers
rst JumpTable
@@ -2502,14 +2502,14 @@
; 54b8
-Function54b8: ; 54b8
+ApplyMovementToFollower: ; 54b8
ld e, a
- ld a, [wd4ce]
+ ld a, [wObjectFollow_Follower]
cp -1
ret z
- ld a, [wd4cd]
+ ld a, [wObjectFollow_Leader]
ld d, a
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
cp d
ret nz
ld a, e
@@ -2565,7 +2565,7 @@
; 550a
Function550a: ; 550a
- ld a, [wd4cd]
+ ld a, [wObjectFollow_Leader]
cp -1
jr z, .nope
push bc
@@ -2581,7 +2581,7 @@
.nope
ld a, $ff
- ld [wd4ce], a
+ ld [wObjectFollow_Follower], a
ld a, $47
scf
ret
@@ -2652,7 +2652,7 @@
Function5579: ; 5579
push bc
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld c, a
call Function5582
pop bc
@@ -2713,7 +2713,7 @@
ld [hli], a
ld a, [de]
ld [hli], a
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld [hli], a
push hl
ld hl, OBJECT_MAP_X
@@ -2738,7 +2738,7 @@
ld bc, ObjectStructs
xor a
.loop
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
call GetObjectSprite
jr z, .ok
call Function565c
@@ -2748,7 +2748,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
@@ -2802,13 +2802,13 @@
xor a
ld bc, ObjectStructs
.loop
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
call Function5680
ld hl, OBJECT_STRUCT_LENGTH
add hl, bc
ld b, h
ld c, l
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
@@ -3033,7 +3033,7 @@
ld bc, ObjectStructs
xor a
.loop
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
call GetObjectSprite
jr z, .next
call Function437b
@@ -3043,7 +3043,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
@@ -3056,7 +3056,7 @@
ld [wc2df], a
xor a
ld [wd04e], a
- ld [wd4e2], a
+ ld [PlayerObject12], a
call Function57bc
callba CheckWarpCollision
call c, SpawnInFacingDown
@@ -3101,7 +3101,7 @@
Function57e2: ; 57e2
ld a, d
- and $80
+ and %10000000
ret z
ld bc, NONE ; debug?
ld hl, OBJECT_FACING
@@ -3123,69 +3123,69 @@
ret
; 5803
-Function5803:: ; 5803
+StartFollow:: ; 5803
push bc
ld a, b
- call Function5815
+ call SetLeaderIfVisible
pop bc
ret c
ld a, c
- call Function582c
+ call SetFollowerIfVisible
callba Function848a
ret
; 5815
-Function5815: ; 5815
- call Function18de
+SetLeaderIfVisible: ; 5815
+ call CheckObjectVisibility
ret c
- ld a, [hMapObjectIndexBuffer2]
- ld [wd4cd], a
+ ld a, [hObjectStructIndexBuffer]
+ ld [wObjectFollow_Leader], a
ret
; 581f
-Function581f:: ; 581f
- call Function5826
- call Function5847
+StopFollow:: ; 581f
+ call ResetLeader
+ call ResetFollower
ret
; 5826
-Function5826: ; 5826
+ResetLeader: ; 5826
ld a, -1
- ld [wd4cd], a
+ ld [wObjectFollow_Leader], a
ret
; 582c
-Function582c: ; 582c
+SetFollowerIfVisible: ; 582c
push af
- call Function5847
+ call ResetFollower
pop af
- call Function18de
+ call CheckObjectVisibility
ret c
- ld hl, OBJECT_03
+ ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
- ld [hl], $13
+ ld [hl], SPRITEMOVEDATA_13
ld hl, OBJECT_09
add hl, bc
ld [hl], 0
- ld a, [hMapObjectIndexBuffer2]
- ld [wd4ce], a
+ ld a, [hObjectStructIndexBuffer]
+ ld [wObjectFollow_Follower], a
ret
; 5847
-Function5847: ; 5847
- ld a, [wd4ce]
+ResetFollower: ; 5847
+ ld a, [wObjectFollow_Follower]
cp -1
ret z
call GetObjectStruct
callba Function58e3
ld a, -1
- ld [wd4ce], a
+ ld [wObjectFollow_Follower], a
ret
; 585c
SetFlagsForMovement_1:: ; 585c
ld a, c
- call Function18de
+ call CheckObjectVisibility
ret c
push bc
call Function587a
@@ -3198,7 +3198,7 @@
; 586e
Function586e: ; 586e
- call Function18de
+ call CheckObjectVisibility
ret c
ld hl, OBJECT_FLAGS2
add hl, bc
@@ -3231,7 +3231,7 @@
; 5897
_SetFlagsForMovement_2:: ; 5897
- ld a, [wd4cd]
+ ld a, [wObjectFollow_Leader]
cp -1
ret z
push bc
@@ -3242,7 +3242,7 @@
pop bc
cp c
ret nz
- ld a, [wd4ce]
+ ld a, [wObjectFollow_Follower]
cp -1
ret z
call GetObjectStruct
@@ -3278,7 +3278,7 @@
; 58d8
Function58d8: ; 58d8
- call Function18de
+ call CheckObjectVisibility
ret c
ld hl, OBJECT_FLAGS2
add hl, bc
@@ -3298,7 +3298,7 @@
add hl, bc
ld a, [hl]
pop bc
- ld hl, OBJECT_03
+ ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld [hl], a
ld hl, OBJECT_09
@@ -3316,7 +3316,7 @@
ld hl, .standing_movefns
add hl, de
ld a, [hl]
- ld hl, OBJECT_03
+ ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld [hl], a
ld hl, OBJECT_09
@@ -3431,13 +3431,13 @@
Function59a4: ; 59a4
xor a
- ld hl, wc2eb
+ ld hl, wMovementPointer
ld bc, 13
call ByteFill
ld d, 0
ld bc, ObjectStructs
- ld hl, wc2eb
+ ld hl, wMovementPointer
.loop
push hl
call GetObjectSprite
@@ -3488,7 +3488,7 @@
; 59f3
Function59f3: ; 59f3
- ld hl, wc2eb
+ ld hl, wMovementPointer
.next
ld a, [hli]
ld d, a
@@ -3677,16 +3677,16 @@
.Addresses ; 5ace
dw PlayerStruct
- dw ObjectStruct1
- dw ObjectStruct2
- dw ObjectStruct3
- dw ObjectStruct4
- dw ObjectStruct5
- dw ObjectStruct6
- dw ObjectStruct7
- dw ObjectStruct8
- dw ObjectStruct9
- dw ObjectStruct10
- dw ObjectStruct11
- dw ObjectStruct12
+ dw Object1Struct
+ dw Object2Struct
+ dw Object3Struct
+ dw Object4Struct
+ dw Object5Struct
+ dw Object6Struct
+ dw Object7Struct
+ dw Object8Struct
+ dw Object9Struct
+ dw Object10Struct
+ dw Object11Struct
+ dw Object12Struct
; 5ae8
--- a/engine/movement.asm
+++ b/engine/movement.asm
@@ -205,8 +205,8 @@
; 51c1
Movement_step_end: ; 51c1
- call Function4769
- ld hl, OBJECT_03
+ call RestoreDefaultMovement
+ ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld [hl], a
ld hl, OBJECT_27
@@ -221,8 +221,8 @@
; 51db
Movement_48: ; 51db
- call Function4769
- ld hl, OBJECT_03
+ call RestoreDefaultMovement
+ ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld [hl], a
ld hl, OBJECT_27
@@ -242,8 +242,8 @@
Movement_remove_person: ; 51fd
call Function4357
- ld hl, wd4cd
- ld a, [hMapObjectIndexBuffer1]
+ ld hl, wObjectFollow_Leader
+ ld a, [hMapObjectIndexBuffer]
cp [hl]
jr nz, .asm_520a
ld [hl], $ff
@@ -738,7 +738,7 @@
.asm_5430
ld hl, wd4cf
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
cp [hl]
jr z, .asm_543f
@@ -761,7 +761,7 @@
add hl, bc
ld [hl], $4
ld hl, wd4cf
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
cp [hl]
jr z, .asm_5461
ld hl, OBJECT_09
@@ -784,7 +784,7 @@
add hl, bc
ld [hl], $1
ld hl, wd4cf
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
cp [hl]
jr z, .asm_5483
ld hl, OBJECT_09
@@ -813,7 +813,7 @@
ld [hl], $2
call Function5529
ld hl, wd4cf
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
cp [hl]
jr z, .asm_54b1
ld hl, OBJECT_09
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1191,7 +1191,7 @@
ApplyPersonFacing: ; 0x9728b
ld a, d
push de
- call Function18de
+ call CheckObjectVisibility
jr c, .not_visible ; 0x97290 $27
ld hl, OBJECT_SPRITE
add hl, bc
@@ -1258,7 +1258,7 @@
call GetScriptByte
call GetScriptPerson
call _CopyObjectStruct
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld b, 0 ; clear
call ApplyEventActionAppearDisappear
ret
@@ -1276,7 +1276,7 @@
ld a, [hLastTalked]
.ok
call DeleteObjectStruct
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld b, 1 ; set
call ApplyEventActionAppearDisappear
callba RefreshMapAppearDisappear
@@ -1316,7 +1316,7 @@
call GetScriptByte
call GetScriptPerson
ld c, a
- callba Function5803
+ callba StartFollow
ret
; 0x9733a
@@ -1323,7 +1323,7 @@
Script_stopfollow: ; 0x9733a
; script command 0x71
- callba Function581f
+ callba StopFollow
ret
; 0x97341
--- a/home.asm
+++ b/home.asm
@@ -1515,11 +1515,11 @@
add hl, bc
ld e, [hl]
- ld a, [MapX]
+ ld a, [PlayerMapX]
cp d
jr z, .CheckY
- ld a, [MapY]
+ ld a, [PlayerMapY]
cp e
jr z, .CheckX
@@ -1527,7 +1527,7 @@
ret
.CheckY
- ld a, [MapY]
+ ld a, [PlayerMapY]
sub e
jr z, .NotFacing
jr nc, .Above
@@ -1545,7 +1545,7 @@
jr .CheckFacing
.CheckX
- ld a, [MapX]
+ ld a, [PlayerMapX]
sub d
jr z, .NotFacing
jr nc, .Left
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -356,14 +356,14 @@
; a80
Functiona80:: ; a80
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
push af
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
push af
xor a
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld a, 6
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
.loop
push hl
@@ -377,9 +377,9 @@
jr z, .loop
pop af
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
pop af
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ret
; aa5
@@ -459,37 +459,37 @@
cp b
pop bc
jr nz, .asm_b27
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
dec a
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ret nz
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
dec a
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
ret nz
ld a, "─"
ld [hl], a
ld a, -1
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld a, 6
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
ret
.asm_b27
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
and a
ret z
dec a
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ret nz
dec a
- ld [hMapObjectIndexBuffer1], a
- ld a, [hMapObjectIndexBuffer2]
+ ld [hMapObjectIndexBuffer], a
+ ld a, [hObjectStructIndexBuffer]
dec a
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
ret nz
ld a, $6
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
ld a, $ee
ld [hl], a
ret
--- a/home/map.asm
+++ b/home/map.asm
@@ -252,10 +252,10 @@
; 2266
Function2266:: ; 2266
- ld a, [MapY]
+ ld a, [PlayerMapY]
sub $4
ld e, a
- ld a, [MapX]
+ ld a, [PlayerMapX]
sub $4
ld d, a
ld a, [wCurrMapWarpCount]
@@ -652,11 +652,11 @@
; 2471
Function2471:: ; 2471
- ld hl, ObjectStruct1
+ ld hl, Object1Struct
ld bc, OBJECT_STRUCT_LENGTH * (NUM_OBJECT_STRUCTS - 1)
xor a
call ByteFill
- ld hl, ObjectStruct1
+ ld hl, Object1Struct
ld de, OBJECT_STRUCT_LENGTH
ld c, NUM_OBJECT_STRUCTS - 1
xor a
@@ -729,9 +729,9 @@
ld hl, OverworldMap
ld a, [MapWidth]
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
add $6
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld c, a
ld b, 0
rept 3
@@ -750,7 +750,7 @@
ld b, a
.asm_250c
push hl
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
ld c, a
.asm_2510
ld a, [de]
@@ -759,7 +759,7 @@
dec c
jr nz, .asm_2510
pop hl
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
add l
ld l, a
jr nc, .asm_251e
@@ -794,10 +794,10 @@
ld e, a
ld a, [NorthConnectionStripLocation + 1]
ld d, a
- ld a, [NorthMapObjectIndexBuffer1]
- ld [hMapObjectIndexBuffer1], a
- ld a, [NorthMapObjectIndexBuffer2]
- ld [hMapObjectIndexBuffer2], a
+ ld a, [NorthMapObjectIndexBuffer]
+ ld [hMapObjectIndexBuffer], a
+ ld a, [NorthObjectStructIndexBuffer]
+ ld [hObjectStructIndexBuffer], a
call FillNorthConnectionStrip
.South
@@ -817,10 +817,10 @@
ld e, a
ld a, [SouthConnectionStripLocation + 1]
ld d, a
- ld a, [SouthMapObjectIndexBuffer1]
- ld [hMapObjectIndexBuffer1], a
- ld a, [SouthMapObjectIndexBuffer2]
- ld [hMapObjectIndexBuffer2], a
+ ld a, [SouthMapObjectIndexBuffer]
+ ld [hMapObjectIndexBuffer], a
+ ld a, [SouthObjectStructIndexBuffer]
+ ld [hObjectStructIndexBuffer], a
call FillSouthConnectionStrip
.West
@@ -843,7 +843,7 @@
ld a, [WestConnectionStripLength]
ld b, a
ld a, [WestConnectedMapWidth]
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
call FillWestConnectionStrip
.East
@@ -866,7 +866,7 @@
ld a, [EastConnectionStripLength]
ld b, a
ld a, [EastConnectedMapWidth]
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
call FillEastConnectionStrip
.Done
@@ -882,7 +882,7 @@
push de
push hl
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld b, a
.x
ld a, [hli]
@@ -892,7 +892,7 @@
jr nz, .x
pop hl
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
ld e, a
ld d, 0
add hl, de
@@ -917,7 +917,7 @@
.asm_25f6
ld a, [MapWidth]
add 6
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
push de
@@ -933,13 +933,13 @@
inc de
pop hl
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld e, a
ld d, 0
add hl, de
pop de
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
add e
ld e, a
jr nc, .asm_2617
@@ -1171,7 +1171,7 @@
CheckObjectMask:: ; 2707
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld e, a
ld d, $0
ld hl, wObjectMasks
@@ -1181,7 +1181,7 @@
; 2712
MaskObject:: ; 2712
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld e, a
ld d, $0
ld hl, wObjectMasks
@@ -1191,7 +1191,7 @@
; 271e
UnmaskObject:: ; 271e
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld e, a
ld d, $0
ld hl, wObjectMasks
@@ -1463,7 +1463,7 @@
ld de, XCoord + 1
ld a, [MapWidth]
add $6
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld a, [wd151]
and a
jr z, .asm_28cb
@@ -1477,7 +1477,7 @@
.asm_28c0
ld de, wdcbf
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld c, a
ld b, $0
add hl, bc
@@ -1512,7 +1512,7 @@
ld l, a
ld a, [MapWidth]
add $6
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld de, XCoord + 1
ld b, $6
ld c, $5
@@ -1537,7 +1537,7 @@
.asm_2908
pop hl
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld c, a
ld b, $0
add hl, bc
@@ -1552,15 +1552,15 @@
ld [TilePermissions], a
call Function296c
call Function294d
- ld a, [MapX]
+ ld a, [PlayerMapX]
ld d, a
- ld a, [MapY]
+ ld a, [PlayerMapY]
ld e, a
call Function2a3c
- ld [StandingTile], a
+ ld [PlayerStandingTile], a
call Function29ff
ret nz
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
and 7
ld hl, .data_2945
add l
@@ -1580,9 +1580,9 @@
; 294d
Function294d:: ; 294d
- ld a, [MapX]
+ ld a, [PlayerMapX]
ld d, a
- ld a, [MapY]
+ ld a, [PlayerMapY]
ld e, a
push de
inc e
@@ -1598,9 +1598,9 @@
; 296c
Function296c:: ; 296c
- ld a, [MapX]
+ ld a, [PlayerMapX]
ld d, a
- ld a, [MapY]
+ ld a, [PlayerMapY]
ld e, a
push de
dec d
@@ -1725,10 +1725,10 @@
ld h, [hl]
ld l, a
- ld a, [MapX]
+ ld a, [PlayerMapX]
add d
ld d, a
- ld a, [MapY]
+ ld a, [PlayerMapY]
add e
ld e, a
ld a, [hl]
@@ -1906,10 +1906,10 @@
call CheckTriggers
ld b, a
; Load your current coordinates into de. This will be used to check if your position is in the xy-trigger table for the current map.
- ld a, [MapX]
+ ld a, [PlayerMapX]
sub 4
ld d, a
- ld a, [MapY]
+ ld a, [PlayerMapY]
sub 4
ld e, a
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -21,7 +21,7 @@
ld hl, UsedSprites + 2
ld c, SPRITE_GFX_LIST_CAPACITY - 1
ld b, a
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
cp 0
jr z, .nope
ld a, b
@@ -78,7 +78,7 @@
Function184a:: ; 184a
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
call GetTileCollision
ld b, a
ret
@@ -85,7 +85,7 @@
; 1852
CheckOnWater:: ; 1852
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
call GetTileCollision
sub 1
ret z
@@ -209,7 +209,7 @@
; 18c3
CheckStandingOnEntrance:: ; 18c3
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
cp $71 ; door
ret z
cp $79
@@ -232,9 +232,9 @@
; 18de
-Function18de:: ; 18de
+CheckObjectVisibility:: ; 18de
; Sets carry if the object is not visible on the screen.
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
@@ -241,7 +241,7 @@
ld a, [hl]
cp -1
jr z, .not_visible
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
call GetObjectStruct
and a
ret
@@ -326,7 +326,7 @@
; 194d
Function194d:: ; 194d
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
call GetMapObject
call CopyObjectStruct
ret
@@ -335,9 +335,9 @@
_CopyObjectStruct:: ; 1956
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
call UnmaskObject
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
call GetMapObject
callba CopyObjectStruct
ret
@@ -344,13 +344,13 @@
; 1967
Function1967:: ; 1967
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
ld a, [hl]
cp -1
- ret z
+ ret z ; already hidden
ld [hl], -1
push af
call Function1985
@@ -361,18 +361,18 @@
; 1985
Function1985:: ; 1985
- ld hl, wd4cd
+ ld hl, wObjectFollow_Leader
cp [hl]
jr z, .ok
- ld hl, wd4ce
+ ld hl, wObjectFollow_Follower
cp [hl]
ret nz
.ok
- callba Function581f
+ callba StopFollow
ld a, -1
- ld [wd4cd], a
- ld [wd4ce], a
+ ld [wObjectFollow_Leader], a
+ ld [wObjectFollow_Follower], a
ret
; 199f
@@ -413,11 +413,11 @@
cp $d
ret nc
ld b, a
- ld a, [wd4cd]
+ ld a, [wObjectFollow_Leader]
cp b
jr nz, .ok
ld a, -1
- ld [wd4cd], a
+ ld [wObjectFollow_Leader], a
.ok
ld a, b
@@ -429,19 +429,19 @@
Function19e9:: ; 19e9
- ld [wc2e2], a
+ ld [wMovementPerson], a
ld a, [hROMBank]
- ld [wc2e3], a
+ ld [wMovementDataPointer], a
ld a, l
- ld [wc2e3 + 1], a
+ ld [wMovementDataPointer + 1], a
ld a, h
- ld [wc2e3 + 2], a
- ld a, [wc2e2]
- call Function18de
+ ld [wMovementDataPointer + 2], a
+ ld a, [wMovementPerson]
+ call CheckObjectVisibility
ret c
- ld hl, OBJECT_03
+ ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
- ld [hl], $14
+ ld [hl], SPRITEMOVEDATA_14
ld hl, OBJECT_09
add hl, bc
ld [hl], 0
@@ -486,7 +486,7 @@
Function1a2f:: ; 1a2f
- ld hl, OBJECT_03
+ ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld a, [hl]
cp OBJECT_STRUCT_3_DATA_HEIGHT
@@ -544,7 +544,7 @@
; 1a71
Function1a71:: ; 1a71
- ld hl, OBJECT_03
+ ld hl, OBJECT_MOVEMENTTYPE
add hl, de
ld [hl], a
push de
--- a/hram.asm
+++ b/hram.asm
@@ -32,8 +32,8 @@
hJoyLast EQU $ffa9
hInMenu EQU $ffaa
-hMapObjectIndexBuffer1 EQU $ffaf
-hMapObjectIndexBuffer2 EQU $ffb0
+hMapObjectIndexBuffer EQU $ffaf
+hObjectStructIndexBuffer EQU $ffb0
hPastLeadingZeroes EQU $ffb3
--- a/main.asm
+++ b/main.asm
@@ -2345,7 +2345,7 @@
call CheckCounterTile
jr nz, .asm_6ff1
- ld a, [MapX]
+ ld a, [PlayerMapX]
sub d
cpl
inc a
@@ -2352,7 +2352,7 @@
add d
ld d, a
- ld a, [MapY]
+ ld a, [PlayerMapY]
sub e
cpl
inc a
@@ -2362,7 +2362,7 @@
.asm_6ff1
ld bc, ObjectStructs ; redundant
ld a, 0
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
call Function7041
ret nc
ld hl, OBJECT_DIRECTION_WALKING
@@ -2390,7 +2390,7 @@
; 7015
Function7015: ; unreferenced
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
call GetObjectStruct
call Function7021
call Function7041
@@ -2430,7 +2430,7 @@
ld bc, ObjectStructs
xor a
.loop
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
call GetObjectSprite
jr z, .nope
ld hl, OBJECT_FLAGS1
@@ -2458,9 +2458,9 @@
jr nz, .ok
.ok2
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld l, a
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
cp l
jr nz, .setcarry
@@ -2475,9 +2475,9 @@
ld a, [hl]
cp e
jr nz, .nope
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld l, a
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
cp l
jr nz, .setcarry
@@ -2486,7 +2486,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
@@ -2590,20 +2590,20 @@
; 7113
Function7113: ; unreferenced
- ld a, [MapX]
+ ld a, [PlayerMapX]
ld d, a
- ld a, [MapY]
+ ld a, [PlayerMapY]
ld e, a
ld bc, ObjectStructs
xor a
.loop
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
call GetObjectSprite
jr z, .asm_7160
- ld hl, OBJECT_03
+ ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld a, [hl]
- cp $15
+ cp SPRITEMOVEDATA_15
jr nz, .asm_7136
call Function7171
jr c, .asm_716f
@@ -2620,7 +2620,7 @@
ld a, [hl]
cp d
jr nz, .asm_714e
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
cp $0
jr z, .asm_7160
jr .asm_716f
@@ -2643,7 +2643,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
@@ -3198,8 +3198,8 @@
GetSpawnCoord: ; 8029
ld a, -1
- ld [wd4cd], a
- ld [wd4ce], a
+ ld [wObjectFollow_Leader], a
+ ld [wObjectFollow_Follower], a
ld a, $0
ld hl, PlayerObjectTemplate
call Function19a6
@@ -3221,10 +3221,10 @@
.ok
ld [hl], e
ld a, $0
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld bc, MapObjects
ld a, $0
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
ld de, ObjectStructs
call Function8116
ld a, $0
@@ -3269,7 +3269,7 @@
Function80a1:: ; 80a1
ld a, b
- call Function18de
+ call CheckObjectVisibility
ret c
ld hl, OBJECT_MAP_X
add hl, bc
@@ -3277,7 +3277,7 @@
ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld b, a
call CopyDECoordsToMapObject
and a
@@ -3288,26 +3288,26 @@
ld a, [XCoord]
add 4
ld d, a
- ld hl, MapX
+ ld hl, PlayerMapX
sub [hl]
ld [hl], d
ld hl, MapObjects + MAPOBJECT_X_COORD
ld [hl], d
- ld hl, MapX2
+ ld hl, PlayerNextMapX
ld [hl], d
ld d, a
ld a, [YCoord]
add 4
ld e, a
- ld hl, MapY
+ ld hl, PlayerMapY
sub [hl]
ld [hl], e
ld hl, MapObjects + MAPOBJECT_Y_COORD
ld [hl], e
- ld hl, MapY2
+ ld hl, PlayerNextMapY
ld [hl], e
ld e, a
- ld a, [wd4cd]
+ ld a, [wObjectFollow_Leader]
cp $0
ret nz
ret
@@ -3322,12 +3322,12 @@
ld a, 1
ld de, OBJECT_STRUCT_LENGTH
.loop
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
ld a, [hl]
and a
jr z, .done
add hl, de
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
@@ -3354,11 +3354,11 @@
; 811d
Function811d: ; 811d
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
ld [hl], a
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld [wc2f0], a
ld hl, MAPOBJECT_SPRITE
add hl, bc
@@ -3406,7 +3406,7 @@
ld bc, MapObjects + OBJECT_LENGTH
ld a, 1
.loop
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld hl, MAPOBJECT_SPRITE
add hl, bc
ld a, [hl]
@@ -3447,7 +3447,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
inc a
cp NUM_OBJECTS
jr nz, .loop
@@ -3491,7 +3491,7 @@
ld bc, MapObjects + OBJECT_LENGTH
ld a, 1
.loop
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld hl, MAPOBJECT_SPRITE
add hl, bc
ld a, [hl]
@@ -3526,7 +3526,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
inc a
cp NUM_OBJECTS
jr nz, .loop
@@ -3549,7 +3549,7 @@
ld bc, MapObjects + OBJECT_LENGTH
ld a, 1
.loop
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ld hl, MAPOBJECT_SPRITE
add hl, bc
ld a, [hl]
@@ -3584,7 +3584,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
inc a
cp NUM_OBJECTS
jr nz, .loop
@@ -3773,13 +3773,13 @@
Function839e:: ; 839e
push bc
ld a, c
- call Function18de
+ call CheckObjectVisibility
ld d, b
ld e, c
pop bc
ret c
ld a, b
- call Function18de
+ call CheckObjectVisibility
ret c
ld hl, OBJECT_MAP_X
add hl, bc
@@ -3841,13 +3841,13 @@
ld hl, OBJECT_SPRITE_Y
add hl, de
ld [hl], a
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
ld hl, OBJECT_32
add hl, de
ld [hl], a
- ld hl, OBJECT_03
+ ld hl, OBJECT_MOVEMENTTYPE
add hl, de
- ld [hl], $1a
+ ld [hl], SPRITEMOVEDATA_1A
ld hl, OBJECT_09
add hl, de
ld [hl], $0
@@ -3977,7 +3977,7 @@
; 849d
Function849d: ; 849d
- ld a, [wd4cd]
+ ld a, [wObjectFollow_Leader]
call GetObjectStruct
ld hl, OBJECT_MAP_X
add hl, bc
@@ -3985,7 +3985,7 @@
ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
- ld a, [wd4ce]
+ ld a, [wObjectFollow_Follower]
call GetObjectStruct
ld hl, OBJECT_MAP_X
add hl, bc
@@ -5325,7 +5325,7 @@
CheckContinueWaterfall: ; cb38
xor a
ld [ScriptVar], a
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
call CheckWaterfallTile
ret z
callba MobileFn_1060c1
@@ -6067,7 +6067,7 @@
callba CheckFacingObject
jr nc, .fail
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
call GetObjectStruct
ld hl, OBJECT_MAP_OBJECT_INDEX
add hl, bc
@@ -17687,7 +17687,7 @@
Function1499a:: ; 1499a
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
cp $60
jr z, .asm_149ad
cp $68
@@ -17704,7 +17704,7 @@
; 149af
Function149af:: ; 149af
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
cp $70
jr z, .asm_149c4
cp $76
@@ -17724,7 +17724,7 @@
CheckWarpCollision: ; 149c6
ld de, 1
ld hl, .blocks
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
call IsInArray
ret
; 149d3
@@ -17743,7 +17743,7 @@
; 149dd
CheckGrassCollision:: ; 149dd
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
ld hl, .blocks
ld de, 1
call IsInArray
@@ -17783,7 +17783,7 @@
; 14a07
Function14a07:: ; 14a07
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
ld de, $001f
cp $71 ; door
ret z
@@ -41815,15 +41815,15 @@
ld c, a
xor a
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
.loop
push bc
push hl
ld e, 0
callba Function8e83f
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
inc a
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
pop hl
pop bc
dec c
@@ -46604,7 +46604,7 @@
ret z
ld c, a
xor a
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
.asm_503ea
push bc
push hl
@@ -46612,9 +46612,9 @@
ld a, BANK(Function8e83f)
ld e, $0
rst FarCall
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
inc a
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
pop hl
pop bc
dec c
@@ -49273,7 +49273,7 @@
; Tiles such as waterfalls and warps move the player
; in a given direction, overriding input.
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
ld c, a
call CheckWhirlpoolTile
jr c, .asm_800c4
@@ -49434,7 +49434,7 @@
cp 2
jr z, .asm_801be
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
call CheckIceTile
jr nc, .ice
@@ -49521,7 +49521,7 @@
TryJumpLedge: ; 801f3
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
ld e, a
and $f0
cp $a0 ; ledge
@@ -49573,7 +49573,7 @@
ld d, 0
ld hl, .EdgeWarps
add hl, de
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
cp [hl]
jr nz, .asm_80259
@@ -49757,7 +49757,7 @@
; tile collision pointer
.table1
db STANDING, FACE_CURRENT, 0, 0
- dw StandingTile
+ dw PlayerStandingTile
.table2
db RIGHT, FACE_RIGHT, 1, 0
dw TileRight
@@ -49773,13 +49773,13 @@
IsNPCInFront: ; 80341
ld a, 0
- ld [hMapObjectIndexBuffer1], a
- ld a, [MapX]
+ ld [hMapObjectIndexBuffer], a
+ ld a, [PlayerMapX]
ld d, a
ld a, [WalkingX]
add d
ld d, a
- ld a, [MapY]
+ ld a, [PlayerMapY]
ld e, a
ld a, [WalkingY]
add e
@@ -49963,7 +49963,7 @@
jr z, .asm_80420
cp $f0
jr z, .asm_80420
- ld a, [StandingTile]
+ ld a, [PlayerStandingTile]
call CheckIceTile
jr nc, .asm_8041e
ld a, [PlayerState]
@@ -58179,7 +58179,7 @@
Function8e86c: ; 8e86c (23:686c)
push bc
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
ld hl, PartyMon1Item
ld bc, PartyMon2 - PartyMon1
call AddNTimes
@@ -58251,7 +58251,7 @@
Function8e8df: ; 8e8df (23:68df)
push bc
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
ld hl, PartyMon1Item
ld bc, $30
call AddNTimes
@@ -58279,7 +58279,7 @@
Function8e908: ; 8e908 (23:6908)
ld a, [wc3b7]
push af
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
ld hl, PartySpecies
ld e, a
ld d, $0
@@ -58288,7 +58288,7 @@
call ReadMonMenuIcon
ld [CurIcon], a
call Function8e9db
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
rept 4
add a
endr
@@ -58305,7 +58305,7 @@
Function8e936: ; 8e936 (23:6936)
push bc
- ld a, [hMapObjectIndexBuffer2]
+ ld a, [hObjectStructIndexBuffer]
ld b, a
call Function8e94c
ld a, b
@@ -77866,11 +77866,11 @@
ld c, $0
Function104265: ; 104265 (41:4265)
-; back up the value of c to hMapObjectIndexBuffer1
- ld a, [hMapObjectIndexBuffer1]
+; back up the value of c to hMapObjectIndexBuffer
+ ld a, [hMapObjectIndexBuffer]
push af
ld a, c
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
; for each row on the screen
ld c, SCREEN_HEIGHT
@@ -77886,7 +77886,7 @@
jr nz, .loop2
; load the original value of c into hl 12 times
- ld a, [hMapObjectIndexBuffer1]
+ ld a, [hMapObjectIndexBuffer]
ld b, 12
.loop3
ld [hli], a
@@ -77896,9 +77896,9 @@
dec c
jr nz, .loop1
-; restore the original value of hMapObjectIndexBuffer1
+; restore the original value of hMapObjectIndexBuffer
pop af
- ld [hMapObjectIndexBuffer1], a
+ ld [hMapObjectIndexBuffer], a
ret
@@ -78411,7 +78411,7 @@
and a
ret
.down
- ld a, [MapY]
+ ld a, [PlayerMapY]
sub 4
ld b, a
ld a, [MapHeight]
@@ -78421,7 +78421,7 @@
and a
ret
.up
- ld a, [MapY]
+ ld a, [PlayerMapY]
sub 4
cp -1
jr z, .ok
@@ -78428,7 +78428,7 @@
and a
ret
.left
- ld a, [MapX]
+ ld a, [PlayerMapX]
sub $4
cp -1
jr z, .ok
@@ -78435,7 +78435,7 @@
and a
ret
.right
- ld a, [MapX]
+ ld a, [PlayerMapX]
sub 4
ld b, a
ld a, [MapWidth]
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -14428,7 +14428,7 @@
ld a, [wcfa9]
ld [wcd82], a
dec a
- ld [hMapObjectIndexBuffer2], a
+ ld [hObjectStructIndexBuffer], a
ld a, $10
ld [wc3b7], a
ld hl, Function8e83f
--- a/wram.asm
+++ b/wram.asm
@@ -306,12 +306,12 @@
wc2de:: ds 1
wc2df:: ds 3
-wc2e2:: ds 1
-wc2e3:: ds 3
+wMovementPerson:: ds 1
+wMovementDataPointer:: ds 3
wc2e6:: ds 4
wc2ea:: ds 1
-wc2eb:: ds 1
-wc2ec:: ds 4
+wMovementPointer:: ds 2
+ ds 3
wc2f0:: ds 1
wc2f1:: ds 1
wc2f2:: ds 1
@@ -1649,9 +1649,9 @@
ds 2
NorthConnectionStripLocation:: ; d1ad
ds 2
-NorthMapObjectIndexBuffer1:: ; d1af
+NorthMapObjectIndexBuffer:: ; d1af
ds 1
-NorthMapObjectIndexBuffer2:: ; d1b0
+NorthObjectStructIndexBuffer:: ; d1b0
ds 1
NorthConnectionStripYOffset:: ; d1b1
ds 1
@@ -1669,9 +1669,9 @@
ds 2
SouthConnectionStripLocation:: ; d1b9
ds 2
-SouthMapObjectIndexBuffer1:: ; d1bb
+SouthMapObjectIndexBuffer:: ; d1bb
ds 1
-SouthMapObjectIndexBuffer2:: ; d1bc
+SouthObjectStructIndexBuffer:: ; d1bc
ds 1
SouthConnectionStripYOffset:: ; d1bd
ds 1
@@ -2036,85 +2036,57 @@
ds 1
ds 1
-wd4cd:: ds 1
-wd4ce:: ds 1
+wObjectFollow_Leader:: ds 1
+wObjectFollow_Follower:: ds 1
wd4cf:: ds 1
wd4d0:: ds 1
-wd4d1:: ds 5
+wd4d1:: ds 1
+ ds 4
ObjectStructs::
-
-PlayerStruct:: ; d4d6
- ds 2
-PlayerSprite:: ; d4d8
+object_struct: MACRO
+\1Struct::
+\1Sprite:: ds 1
+\1MapObjectIndex:: ds 1
+\1SpriteTile:: ds 1
+\1MovementType:: ds 1
+\1Flags:: ds 2
+\1Palette:: ds 1
+\1Walking:: ds 1
+\1Direction:: ds 1
ds 1
+\1StepDuration:: ds 1
+\1Action:: ds 1
+\1Object12:: ds 1
+\1Facing:: ds 1
+\1StandingTile:: ds 1
+\1NextTile:: ds 1
+\1MapX:: ds 1
+\1MapY:: ds 1
+\1NextMapX:: ds 1
+\1NextMapY:: ds 1
ds 3
-PlayerPalette:: ; d4dc
- ds 1
- ds 1
-PlayerDirection:: ; d4de
-; uses bits 2 and 3 / $0c / %00001100
-; %00 down
-; %01 up
-; %10 left
-; $11 right
- ds 1
- ds 2
-PlayerAction:: ; d4e1
-; 1 standing
-; 2 walking
-; 4 spinning
-; 6 fishing
- ds 1
-wd4e2:: ds 1
-PlayerFacing:: ; d4e3
- ds 1
-StandingTile:: ; d4e4
- ds 1
-StandingTile2:: ; d4e5
- ds 1
-; relative to the map struct including borders
-MapX:: ; d4e6
- ds 1
-MapY:: ; d4e7
- ds 1
-MapX2:: ; d4e8
- ds 1
-MapY2:: ; d4e9
- ds 1
- ds 3
-; relative to the bg map, in px
-PlayerSpriteX:: ; d4ed
- ds 1
-PlayerSpriteY:: ; d4ee
- ds 1
- ds 15
+\1SpriteX:: ds 1
+\1SpriteY:: ds 1
+\1SpriteXOffset:: ds 1
+\1SpriteYOffset:: ds 1
+ ds 6
+ ds 7
+ENDM
-ObjectStruct1:: ; d4fe
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct2:: ; d526
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct3:: ; d54e
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct4:: ; d576
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct5:: ; d59e
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct6:: ; d5c6
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct7:: ; d5ee
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct8:: ; d616
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct9:: ; d63e
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct10:: ; d666
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct11:: ; d68e
- ds OBJECT_STRUCT_LENGTH
-ObjectStruct12:: ; d6b6
- ds OBJECT_STRUCT_LENGTH
-; d6de
+ object_struct Player
+ object_struct Object1
+ object_struct Object2
+ object_struct Object3
+ object_struct Object4
+ object_struct Object5
+ object_struct Object6
+ object_struct Object7
+ object_struct Object8
+ object_struct Object9
+ object_struct Object10
+ object_struct Object11
+ object_struct Object12
wd6de::
ds 64