diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2021-03-24 08:15:08 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2021-03-24 08:15:08 -0400 |
commit | 6b64fbc5224293394cff282bb2aedcecfa56eceb (patch) | |
tree | 648a5bf848957321a13d5a489692d3d33492359e /src/fldeff_cut.c | |
parent | a925d2b7b0c1d6d4386d3f647a18f4f797dbeab7 (diff) | |
parent | d8b76e6fb545efd69bfb18322a67243520e4d11d (diff) |
Merge branch 'master' of github.com:pret/pokefirered into misc_doc
Diffstat (limited to 'src/fldeff_cut.c')
-rw-r--r-- | src/fldeff_cut.c | 42 |
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) { |