Add temp var aliases
This commit is contained in:
@@ -17,12 +17,10 @@
|
||||
#define GATE_ROT_ACW(arm, longArm) GATE_ROT(ROTATE_ANTICLOCKWISE, arm, longArm)
|
||||
#define GATE_ROT_NONE 255
|
||||
|
||||
// static functions
|
||||
static void SpriteCallback_RotatingGate(struct Sprite *sprite);
|
||||
static u8 RotatingGate_CreateGate(u8 gateId, s16 deltaX, s16 deltaY);
|
||||
static void RotatingGate_HideGatesOutsideViewport(struct Sprite *sprite);
|
||||
|
||||
// enums
|
||||
enum
|
||||
{
|
||||
/*
|
||||
@@ -180,7 +178,6 @@ enum
|
||||
PUZZLE_ROUTE110_TRICK_HOUSE_PUZZLE6,
|
||||
};
|
||||
|
||||
// structure
|
||||
struct RotatingGatePuzzle
|
||||
{
|
||||
s16 x;
|
||||
@@ -189,7 +186,6 @@ struct RotatingGatePuzzle
|
||||
u8 orientation;
|
||||
};
|
||||
|
||||
// .rodata
|
||||
// Fortree
|
||||
static const struct RotatingGatePuzzle sRotatingGate_FortreePuzzleConfig[] =
|
||||
{
|
||||
@@ -219,6 +215,15 @@ static const struct RotatingGatePuzzle sRotatingGate_TrickHousePuzzleConfig[] =
|
||||
{10, 19, GATE_SHAPE_L3, GATE_ORIENTATION_180},
|
||||
};
|
||||
|
||||
#define MAX_GATES max(ARRAY_COUNT(sRotatingGate_FortreePuzzleConfig), \
|
||||
ARRAY_COUNT(sRotatingGate_TrickHousePuzzleConfig))
|
||||
|
||||
// Rotating gate puzzles use the temp vars as a byte array to track the orientation of each gate.
|
||||
// The assert below makes sure the existing puzzles don't have too many gates, and aren't quietly
|
||||
// using vars outside the temp vars. Aside from potentially reading/writing vars being used for
|
||||
// something else, using vars that persist when exiting the map could softlock the puzzle.
|
||||
STATIC_ASSERT(MAX_GATES <= (2 * NUM_TEMP_VARS), TooManyRotatingGates)
|
||||
|
||||
static const u8 sRotatingGateTiles_1[] = INCBIN_U8("graphics/rotating_gates/l1.4bpp");
|
||||
static const u8 sRotatingGateTiles_2[] = INCBIN_U8("graphics/rotating_gates/l2.4bpp");
|
||||
static const u8 sRotatingGateTiles_3[] = INCBIN_U8("graphics/rotating_gates/l3.4bpp");
|
||||
@@ -639,9 +644,7 @@ static void RotatingGate_ResetAllGateOrientations(void)
|
||||
u8 *ptr = (u8 *)GetVarPointer(VAR_TEMP_0);
|
||||
|
||||
for (i = 0; i < sRotatingGate_PuzzleCount; i++)
|
||||
{
|
||||
ptr[i] = sRotatingGate_PuzzleConfig[i].orientation;
|
||||
}
|
||||
}
|
||||
|
||||
static s32 RotatingGate_GetGateOrientation(u8 gateId)
|
||||
|
||||
Reference in New Issue
Block a user