From 3927bcdb9d0429b5ff303cb787e522878bd01749 Mon Sep 17 00:00:00 2001 From: Rangi Date: Thu, 24 May 2018 12:36:35 -0400 Subject: [PATCH] =?UTF-8?q?Function6ec1=20=E2=86=92=20CanObjectMoveInDirec?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/bugs_and_glitches.md | 6 +++--- engine/overworld/map_objects.asm | 4 ++-- engine/overworld/npc_movement.asm | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index b78244d4c..2b5a6a152 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -44,7 +44,7 @@ These are known bugs and glitches in the original Pokémon Crystal game: code th - [Two tiles in the `port` tileset are drawn incorrectly](#two-tiles-in-the-port-tileset-are-drawn-incorrectly) - [`LoadMetatiles` wraps around past 128 blocks](#loadmetatiles-wraps-around-past-128-blocks) - [Surfing directly across a map connection does not load the new map](#surfing-directly-across-a-map-connection-does-not-load-the-new-map) -- [`Function6ec1` does not correctly limit object movement](#function6ec1-does-not-correctly-limit-object-movement) +- [Swimming NPCs aren't limited by their movement radius](#swimming-npcs-arent-limited-by-their-movement-radius) - [`CheckOwnMon` only checks the first five letters of OT names](#checkownmon-only-checks-the-first-five-letters-of-ot-names) - [Catching a Transformed Pokémon always catches a Ditto](#catching-a-transformed-pokémon-always-catches-a-ditto) - [Using a Park Ball in normal battles has a corrupt animation](#using-a-park-ball-in-normal-battles-has-a-corrupt-animation) @@ -1185,11 +1185,11 @@ In [home/map.asm](/home/map.asm): *To do:* Identify specific code causing this bug and fix it. -## `Function6ec1` does not correctly limit object movement +## Swimming NPCs aren't limited by their movement radius This bug is why the Lapras in [maps/UnionCaveB2F.asm](/maps/UnionCaveB2F.asm), which uses `SPRITEMOVEDATA_SWIM_WANDER`, is not restricted by its `1, 1` movement radius. -In [engine/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm): +This is a bug with `CanObjectMoveInDirection` in [engine/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm): ```asm ld hl, OBJECT_FLAGS1 diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index e38112db9..6652beead 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -696,7 +696,7 @@ MapObjectMovementPattern: ; 47dd and %00000011 or 0 call InitStep - call Function6ec1 + call CanObjectMoveInDirection jr c, .ok2 ld de, SFX_STRENGTH call PlaySFX @@ -1049,7 +1049,7 @@ MapObjectMovementPattern: ; 47dd .RandomWalkContinue: call InitStep - call Function6ec1 ; check whether the object can move in that direction + call CanObjectMoveInDirection ; check whether the object can move in that direction jr c, .NewDuration call UpdateTallGrassFlags ld hl, OBJECT_ACTION diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index 66b64037c..40ced1a5f 100644 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -1,4 +1,4 @@ -Function6ec1: ; 6ec1 +CanObjectMoveInDirection: ; 6ec1 ld hl, OBJECT_PALETTE add hl, bc