shithub: pokecrystal

Download patch

ref: c85b32ed8035ce51dd9d3bd52440cebd912ce92c
parent: c5d18de8ff9b587a7987cc2cde793386f1eaf217
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Wed May 23 15:06:04 EDT 2018

More sprite movement data flag constants

--- a/constants/map_object_constants.asm
+++ b/constants/map_object_constants.asm
@@ -63,6 +63,15 @@
 HIGH_PRIORITY EQU 1 << HIGH_PRIORITY_F
 OVERHEAD      EQU 1 << OVERHEAD_F
 
+; object_struct OBJECT_PALETTE bit flags
+WALK_ON_WATER_F    EQU 5
+STRENGTH_BOULDER_F EQU 6
+BIG_OBJECT_F       EQU 7
+
+WALK_ON_WATER    EQU 1 << WALK_ON_WATER_F
+STRENGTH_BOULDER EQU 1 << STRENGTH_BOULDER_F
+BIG_OBJECT       EQU 1 << BIG_OBJECT_F
+
 ; map_object struct members (see macros/wram.asm)
 	const_def
 	const MAPOBJECT_OBJECT_STRUCT_ID ; 0
--- a/data/sprites/map_objects.asm
+++ b/data/sprites/map_objects.asm
@@ -175,7 +175,7 @@
 	db OBJECT_ACTION_BIG_DOLL_SYM ; action
 	db 1 << 1 | FIXED_FACING | SLIDING | 1 << 5 ; flags1
 	db LOW_PRIORITY ; flags2
-	db 1 << 6 | 1 << 7 ; palette flags
+	db STRENGTH_BOULDER | BIG_OBJECT ; palette flags
 
 ; SPRITEMOVEDATA_POKEMON
 	db SPRITEMOVEFN_BOUNCE ; movement function
@@ -207,7 +207,7 @@
 	db OBJECT_ACTION_STAND ; action
 	db 1 << 1 | FIXED_FACING | SLIDING | 1 << 5 ; flags1
 	db 0 ; flags2
-	db 1 << 6 ; palette flags
+	db STRENGTH_BOULDER ; palette flags
 
 ; SPRITEMOVEDATA_FOLLOWNOTEXACT
 	db SPRITEMOVEFN_FOLLOWNOTEXACT ; movement function
@@ -263,7 +263,7 @@
 	db OBJECT_ACTION_BIG_DOLL_ASYM ; action
 	db 1 << 1 | FIXED_FACING | SLIDING | 1 << 5 ; flags1
 	db LOW_PRIORITY ; flags2
-	db 1 << 6 | 1 << 7 ; palette flags
+	db STRENGTH_BOULDER | BIG_OBJECT ; palette flags
 
 ; SPRITEMOVEDATA_BIGDOLL
 	db SPRITEMOVEFN_STRENGTH ; movement function
@@ -271,7 +271,7 @@
 	db OBJECT_ACTION_BIG_DOLL ; action
 	db 1 << 1 | FIXED_FACING | SLIDING | 1 << 5 ; flags1
 	db LOW_PRIORITY ; flags2
-	db 1 << 6 | 1 << 7 ; palette flags
+	db STRENGTH_BOULDER | BIG_OBJECT ; palette flags
 
 ; SPRITEMOVEDATA_BOULDERDUST
 	db SPRITEMOVEFN_BOULDERDUST ; movement function
@@ -295,7 +295,7 @@
 	db OBJECT_ACTION_STAND ; action
 	db 0 ; flags1
 	db 0 ; flags2
-	db 1 << 5 ; palette flags
+	db WALK_ON_WATER ; palette flags
 
 ; 25
 	db SPRITEMOVEFN_00 ; movement function
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -2444,7 +2444,7 @@
 	ld [hUsedSpriteTile], a
 	ld hl, OBJECT_PALETTE
 	add hl, bc
-	bit 7, [hl]
+	bit BIG_OBJECT_F, [hl]
 	jr z, .ok7
 	ld a, d
 	add 2
--- a/engine/overworld/npc_movement.asm
+++ b/engine/overworld/npc_movement.asm
@@ -2,8 +2,8 @@
 
 	ld hl, OBJECT_PALETTE
 	add hl, bc
-	bit 5, [hl]
-	jr z, .not_bit_5
+	bit WALK_ON_WATER_F, [hl]
+	jr z, .walks_on_land
 
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
@@ -17,7 +17,7 @@
 	ret c
 	jr .resume
 
-.not_bit_5
+.walks_on_land
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
 	bit 4, [hl]
@@ -331,7 +331,7 @@
 
 	ld hl, OBJECT_PALETTE
 	add hl, bc
-	bit 7, [hl]
+	bit BIG_OBJECT_F, [hl]
 	jr z, .got
 
 	call Function7171
--- a/engine/overworld/player_movement.asm
+++ b/engine/overworld/player_movement.asm
@@ -684,7 +684,7 @@
 
 	ld hl, OBJECT_PALETTE
 	add hl, bc
-	bit 6, [hl]
+	bit STRENGTH_BOULDER_F, [hl]
 	jr z, .not_boulder
 
 	ld hl, OBJECT_FLAGS2
@@ -696,7 +696,7 @@
 	ld hl, OBJECT_RANGE
 	add hl, bc
 	ld a, [hl]
-	and $fc
+	and %11111100
 	or d
 	ld [hl], a