From 0a436d580ec0db27af343d71259534f19cf7ab57 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 18 Jan 2025 00:18:17 +0100 Subject: [PATCH 1/2] Extern gSprites and gOamMatrices with known array size (#2090) --- include/sprite.h | 5 +++-- src/sprite.c | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/sprite.h b/include/sprite.h index 86527bc4c0..c66e0bd85e 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -1,6 +1,7 @@ #ifndef GUARD_SPRITE_H #define GUARD_SPRITE_H +#define OAM_MATRIX_COUNT 32 #define MAX_SPRITES 64 #define SPRITE_NONE 0xFF #define TAG_NONE 0xFFFF @@ -254,12 +255,12 @@ extern const union AffineAnimCmd *const gDummySpriteAffineAnimTable[]; extern const struct SpriteTemplate gDummySpriteTemplate; extern u8 gReservedSpritePaletteCount; -extern struct Sprite gSprites[]; +extern struct Sprite gSprites[MAX_SPRITES + 1]; extern u8 gOamLimit; extern u16 gReservedSpriteTileCount; extern s16 gSpriteCoordOffsetX; extern s16 gSpriteCoordOffsetY; -extern struct OamMatrix gOamMatrices[]; +extern struct OamMatrix gOamMatrices[OAM_MATRIX_COUNT]; extern bool8 gAffineAnimsDisabled; void ResetSpriteData(void); diff --git a/src/sprite.c b/src/sprite.c index d11277400f..e8abc430e6 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -5,8 +5,6 @@ #define MAX_SPRITE_COPY_REQUESTS 64 -#define OAM_MATRIX_COUNT 32 - #define sAnchorX data[6] #define sAnchorY data[7] From e83f7c79eb60043540ac114a8637e8ef58e32acf Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 18 Jan 2025 00:19:21 +0100 Subject: [PATCH 2/2] Fix conflicting types for rotating gate functions (#2087) --- include/rotating_gate.h | 6 +++--- src/rotating_gate.c | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/rotating_gate.h b/include/rotating_gate.h index fd86a6b04d..3829edab4a 100644 --- a/include/rotating_gate.h +++ b/include/rotating_gate.h @@ -1,9 +1,9 @@ #ifndef GUARD_ROTATING_GATE_H #define GUARD_ROTATING_GATE_H -void RotatingGatePuzzleCameraUpdate(s16, s16); +void RotatingGatePuzzleCameraUpdate(s16 deltaX, s16 deltaY); void RotatingGate_InitPuzzleAndGraphics(void); -u32 CheckForRotatingGatePuzzleCollision(u8, s16, s16); -bool32 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8, s16, s16); +bool32 CheckForRotatingGatePuzzleCollision(u8 direction, s16 x, s16 y); +bool32 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8 direction, s16 x, s16 y); #endif // GUARD_ROTATING_GATE_H diff --git a/src/rotating_gate.c b/src/rotating_gate.c index 0b0c68a836..0db623bb3e 100644 --- a/src/rotating_gate.c +++ b/src/rotating_gate.c @@ -3,6 +3,7 @@ #include "event_data.h" #include "event_object_movement.h" #include "fieldmap.h" +#include "rotating_gate.h" #include "sound.h" #include "sprite.h" #include "constants/songs.h" @@ -938,7 +939,7 @@ void RotatingGate_InitPuzzle(void) } } -void RotatingGatePuzzleCameraUpdate(u16 deltaX, u16 deltaY) +void RotatingGatePuzzleCameraUpdate(s16 deltaX, s16 deltaY) { if (GetCurrentMapRotatingGatePuzzleType()) { @@ -957,7 +958,7 @@ void RotatingGate_InitPuzzleAndGraphics(void) } } -bool8 CheckForRotatingGatePuzzleCollision(u8 direction, s16 x, s16 y) +bool32 CheckForRotatingGatePuzzleCollision(u8 direction, s16 x, s16 y) { s32 i; @@ -995,7 +996,7 @@ bool8 CheckForRotatingGatePuzzleCollision(u8 direction, s16 x, s16 y) return FALSE; } -bool8 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8 direction, s16 x, s16 y) +bool32 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8 direction, s16 x, s16 y) { s32 i;