[LEAK-INFORMED] fix cut nonmatchings

This commit is contained in:
Kurausukun
2021-03-18 23:47:39 -04:00
parent f41d7b222c
commit f18aeb187d
2 changed files with 15 additions and 31 deletions
-4
View File
@@ -20,10 +20,6 @@
#define NUM_FIELD_MAP_OBJECT_TEMPLATES 0x51
#if !defined(NONMATCHING) && MODERN
#define static
#endif
static void MoveCoordsInDirection(u32, s16 *, s16 *, s16, s16);
static bool8 ObjectEventExecSingleMovementAction(struct ObjectEvent *, struct Sprite *);
static u8 GetCollisionInDirection(struct ObjectEvent *, u8);
+15 -27
View File
@@ -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)
{