summaryrefslogtreecommitdiff
path: root/src/fldeff_cut.c
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-03-23 22:06:08 -0400
committerGitHub <noreply@github.com>2021-03-23 22:06:08 -0400
commitd8b76e6fb545efd69bfb18322a67243520e4d11d (patch)
tree12deeb8f5f21707819f36fa1e86aa73c255b8f65 /src/fldeff_cut.c
parented16a7409ae9c808a110975dec1930f9f949a6d6 (diff)
parentb280105f527f9cbb1bed2fde5ae006a87b697e23 (diff)
Merge pull request #405 from Kurausukun/port_matchings
[PARTIALLY LEAK-INFORMED] Port Matchings from Emerald and Fix Other Nonmatchings
Diffstat (limited to 'src/fldeff_cut.c')
-rw-r--r--src/fldeff_cut.c42
1 files changed, 15 insertions, 27 deletions
diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c
index eed361b49..2286f49ed 100644
--- a/src/fldeff_cut.c
+++ b/src/fldeff_cut.c
@@ -19,6 +19,7 @@
#include "constants/metatile_labels.h"
#define CUT_GRASS_SPRITE_COUNT 8
+#define CUT_SIDE 3
static EWRAM_DATA u8 *sCutGrassSpriteArrayPtr = NULL;
static EWRAM_DATA bool8 sScheduleOpenDottedHole = FALSE;
@@ -133,25 +134,18 @@ bool8 SetUpFieldMove_Cut(void)
gPostMenuFieldCallback = FieldCallback_CutTree;
return TRUE;
}
+
else
{
- // FIXME: this fakematch
- #ifndef NONMATCHING
- register s32 neg1 asm("r8");
- #else
- s32 neg1;
- #endif
- struct MapPosition *pos;
PlayerGetDestCoords(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y);
-
- for (i = 0, pos = &gPlayerFacingPosition, neg1 = 0xFFFF; i < 3; i++)
+
+ for (i = 0; i < CUT_SIDE; i++)
{
-
- y = i + neg1 + pos->y;
- for (j = 0; j < 3; j++)
+ y = gPlayerFacingPosition.y - 1 + i;
+ for (j = 0; j < CUT_SIDE; j++)
{
- x = j + neg1 + pos->x;
- if (MapGridGetZCoordAt(x, y) == pos->height)
+ x = gPlayerFacingPosition.x - 1 + j;
+ if (MapGridGetZCoordAt(x, y) == gPlayerFacingPosition.height)
{
if (MetatileAtCoordsIsGrassTile(x, y) == TRUE)
{
@@ -207,26 +201,20 @@ bool8 FldEff_CutGrass(void)
{
u8 i, j;
s16 x, y;
- // FIXME: this fakematch
- #ifndef NONMATCHING
- register s32 neg1 asm("r9");
- #else
- s32 neg1;
- #endif
- struct MapPosition *pos;
+ u8 pos;
i = 0;
PlaySE(SE_M_CUT);
+ pos = gFieldEffectArguments[1] - 1;
PlayerGetDestCoords(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y);
- for (i = 0, pos = &gPlayerFacingPosition, neg1 = 0xFFFF; i < 3; i++)
+ for (i = 0; i < CUT_SIDE; i++)
{
-
- y = i + neg1 + pos->y;
- for (j = 0; j < 3; j++)
+ y = gPlayerFacingPosition.y - 1 + i;
+ for (j = 0; j < CUT_SIDE; j++)
{
- x = j + neg1 + pos->x;
- if (MapGridGetZCoordAt(x, y) == pos->height)
+ x = gPlayerFacingPosition.x - 1 + j;
+ if (MapGridGetZCoordAt(x, y) == gPlayerFacingPosition.height)
{
if (MetatileAtCoordsIsGrassTile(x, y) == TRUE)
{