shithub: pokecrystal

Download patch

ref: 5134266b9a4570f69df5e9bc8a0d91a116da796c
parent: 01f68fcc6ab477c7feaa07979391de9649f70fb4
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Nov 3 07:25:59 EST 2019

Rename OBJECT_LENGTH to MAPOBJECT_LENGTH and OBJECT_STRUCT_LENGTH to OBJECT_LENGTH

--- a/constants/map_object_constants.asm
+++ b/constants/map_object_constants.asm
@@ -34,7 +34,7 @@
 	const OBJECT_1F                  ; 1f
 	const OBJECT_RANGE               ; 20
 	; 21-27 are not used
-OBJECT_STRUCT_LENGTH EQU 40
+OBJECT_LENGTH EQU 40
 NUM_OBJECT_STRUCTS EQU 13 ; see wObjectStructs
 
 ; object_struct OBJECT_FACING values
@@ -114,7 +114,7 @@
 	const MAPOBJECT_FLAG_HI ; d
 	const MAPOBJECT_E ; unused
 	const MAPOBJECT_F ; unused
-OBJECT_LENGTH EQU const_value
+MAPOBJECT_LENGTH EQU const_value
 
 ; SpriteMovementData struct members (see data/sprites/map_objects.asm)
 	const_def
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -1626,7 +1626,7 @@
 	jr c, .fall_down_hole
 
 .next
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, de
 	ld d, h
 	ld e, l
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -10,7 +10,7 @@
 	push af
 	ld h, b
 	ld l, c
-	ld bc, OBJECT_STRUCT_LENGTH
+	ld bc, OBJECT_LENGTH
 	xor a
 	call ByteFill
 	pop af
@@ -2082,11 +2082,11 @@
 	jr z, .next
 	push bc
 	xor a
-	ld bc, OBJECT_STRUCT_LENGTH
+	ld bc, OBJECT_LENGTH
 	call ByteFill
 	pop bc
 .next
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, de
 	ld d, h
 	ld e, l
@@ -2149,7 +2149,7 @@
 	jr z, .ok
 	call Function565c
 .ok
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
@@ -2205,7 +2205,7 @@
 .loop
 	ldh [hMapObjectIndexBuffer], a
 	call SetFacing_Standing
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
@@ -2421,7 +2421,7 @@
 	jr z, .next
 	call Function437b
 .next
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
@@ -2582,7 +2582,7 @@
 	add hl, bc
 	set OBJ_FLAGS2_5, [hl]
 .next
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
@@ -2625,7 +2625,7 @@
 	add hl, bc
 	res OBJ_FLAGS2_5, [hl]
 .next
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
@@ -2750,7 +2750,7 @@
 	add e
 	ld [hl], a
 .skip
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
@@ -2809,7 +2809,7 @@
 	jr .add
 
 .skip
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
@@ -2817,7 +2817,7 @@
 	jr .next
 
 .add
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
--- a/engine/overworld/map_objects_2.asm
+++ b/engine/overworld/map_objects_2.asm
@@ -19,7 +19,7 @@
 	ld [de], a
 	inc de
 	pop bc
-	ld hl, OBJECT_LENGTH
+	ld hl, MAPOBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
--- a/engine/overworld/npc_movement.asm
+++ b/engine/overworld/npc_movement.asm
@@ -369,7 +369,7 @@
 	jr nz, .setcarry
 
 .next
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
@@ -523,7 +523,7 @@
 	jr .yes
 
 .next
-	ld hl, OBJECT_STRUCT_LENGTH
+	ld hl, OBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
--- a/engine/overworld/overworld.asm
+++ b/engine/overworld/overworld.asm
@@ -109,7 +109,7 @@
 	push af
 	ld a, [hl]
 	call AddSpriteGFX
-	ld de, OBJECT_LENGTH
+	ld de, MAPOBJECT_LENGTH
 	add hl, de
 	pop af
 	inc a
--- a/engine/overworld/player_object.asm
+++ b/engine/overworld/player_object.asm
@@ -132,9 +132,9 @@
 	and a
 	ret nz ; masked
 
-	ld hl, wObjectStructs + OBJECT_STRUCT_LENGTH * 1
+	ld hl, wObjectStructs + OBJECT_LENGTH * 1
 	ld a, 1
-	ld de, OBJECT_STRUCT_LENGTH
+	ld de, OBJECT_LENGTH
 .loop
 	ldh [hObjectStructIndexBuffer], a
 	ld a, [hl]
@@ -224,7 +224,7 @@
 	ret
 
 InitializeVisibleSprites:
-	ld bc, wMapObjects + OBJECT_LENGTH
+	ld bc, wMapObjects + MAPOBJECT_LENGTH
 	ld a, 1
 .loop
 	ldh [hMapObjectIndexBuffer], a
@@ -271,7 +271,7 @@
 	jp c, .ret
 
 .next
-	ld hl, OBJECT_LENGTH
+	ld hl, MAPOBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
@@ -311,7 +311,7 @@
 	ld d, a
 	ld a, [wXCoord]
 	ld e, a
-	ld bc, wMapObjects + OBJECT_LENGTH
+	ld bc, wMapObjects + MAPOBJECT_LENGTH
 	ld a, 1
 .loop_v
 	ldh [hMapObjectIndexBuffer], a
@@ -345,7 +345,7 @@
 	pop de
 
 .next_v
-	ld hl, OBJECT_LENGTH
+	ld hl, MAPOBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
@@ -367,7 +367,7 @@
 	ld e, a
 	ld a, [wYCoord]
 	ld d, a
-	ld bc, wMapObjects + OBJECT_LENGTH
+	ld bc, wMapObjects + MAPOBJECT_LENGTH
 	ld a, 1
 .loop_h
 	ldh [hMapObjectIndexBuffer], a
@@ -401,7 +401,7 @@
 	pop de
 
 .next_h
-	ld hl, OBJECT_LENGTH
+	ld hl, MAPOBJECT_LENGTH
 	add hl, bc
 	ld b, h
 	ld c, l
--- a/home/map.asm
+++ b/home/map.asm
@@ -597,7 +597,7 @@
 ; Fill the remaining sprite IDs and y coords with 0 and -1, respectively.
 ; Bleeds into wObjectMasks due to a bug.  Uncomment the above subtraction
 ; to fix.
-	ld bc, OBJECT_LENGTH
+	ld bc, MAPOBJECT_LENGTH
 .loop
 	ld [hl],  0
 	inc hl
@@ -631,7 +631,7 @@
 	jr nz, .loop2
 
 	pop hl
-	ld bc, OBJECT_LENGTH
+	ld bc, MAPOBJECT_LENGTH
 	add hl, bc
 	pop bc
 	dec c
@@ -640,13 +640,13 @@
 
 ClearObjectStructs::
 	ld hl, wObject1Struct
-	ld bc, OBJECT_STRUCT_LENGTH * (NUM_OBJECT_STRUCTS - 1)
+	ld bc, OBJECT_LENGTH * (NUM_OBJECT_STRUCTS - 1)
 	xor a
 	call ByteFill
 
 ; Just to make sure (this is rather pointless)
 	ld hl, wObject1Struct
-	ld de, OBJECT_STRUCT_LENGTH
+	ld de, OBJECT_LENGTH
 	ld c, NUM_OBJECT_STRUCTS - 1
 	xor a
 .loop
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -202,7 +202,7 @@
 GetMapObject::
 ; Return the location of map object a in bc.
 	ld hl, wMapObjects
-	ld bc, OBJECT_LENGTH
+	ld bc, MAPOBJECT_LENGTH
 	call AddNTimes
 	ld b, h
 	ld c, l
@@ -358,7 +358,7 @@
 	ld [de], a
 	inc de
 	pop hl
-	ld bc, OBJECT_LENGTH - 1
+	ld bc, MAPOBJECT_LENGTH - 1
 	call CopyBytes
 	ret
 
@@ -370,7 +370,7 @@
 	push af
 	ld [hl], -1
 	inc hl
-	ld bc, OBJECT_LENGTH - 1
+	ld bc, MAPOBJECT_LENGTH - 1
 	xor a
 	call ByteFill
 	pop af
@@ -424,7 +424,7 @@
 	push bc
 	push de
 	ld hl, wObjectStructs
-	ld de, OBJECT_STRUCT_LENGTH
+	ld de, OBJECT_LENGTH
 	ld c, NUM_OBJECT_STRUCTS
 .loop
 	ld a, [hl]
@@ -594,7 +594,7 @@
 	ret
 
 GetObjectStruct::
-	ld bc, OBJECT_STRUCT_LENGTH
+	ld bc, OBJECT_LENGTH
 	ld hl, wObjectStructs
 	call AddNTimes
 	ld b, h
--- a/home/trainers.asm
+++ b/home/trainers.asm
@@ -15,7 +15,7 @@
 
 ; Skip the player object.
 	ld a, 1
-	ld de, wMapObjects + OBJECT_LENGTH
+	ld de, wMapObjects + MAPOBJECT_LENGTH
 
 .loop
 
@@ -78,7 +78,7 @@
 
 .next
 	pop de
-	ld hl, OBJECT_LENGTH
+	ld hl, MAPOBJECT_LENGTH
 	add hl, de
 	ld d, h
 	ld e, l