Skip to content

Commit

Permalink
Split GAME_ and ENGINE_ macros
Browse files Browse the repository at this point in the history
  • Loading branch information
JaceCear committed Dec 10, 2024
1 parent 04a48f0 commit eddb0ba
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
18 changes: 14 additions & 4 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@

/* TODO: Move config.h into a different location? */

#define GAME_SA1 1
#define GAME_SA2 2
#define GAME_SA3 3
#define GAME_SA1 1
#define GAME_SA2 2
#define GAME_SA3 3
#define GAME_KATAM 4

// TODO: Define this in Makefile through a compiler macro!
#define ENGINE_1 1
#define ENGINE_2 2
#define ENGINE_3 3
#define ENGINE_4 4

// TODO: Define this in Makefile through a compiler macro?
#define GAME GAME_SA2

// TODO: Do SA1 and SA2 use the same engine ver?
// TODO: Do SA3 and KATAM use the same engine ver?
#define ENGINE GAME

// TODO: Put somewhere else?
#if PLATFORM_GBA
#define USE_NEW_DMA 0
Expand Down
6 changes: 0 additions & 6 deletions include/game/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,4 @@

void GameStart(void);

#define GAME_SA1 1
#define GAME_SA2 2
#define GAME_SA3 3
#define GAME_KATAM 4
#define CURRENT_GAME GAME_SA2

#endif // GUARD_GAME_H
2 changes: 1 addition & 1 deletion include/sprite.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ typedef struct {
} Background; /* size = 0x40 */

typedef struct {
#if (CURRENT_GAME >= GAME_SA3)
#if (ENGINE >= ENGINE_3)
// In SA3 flip-bits are integrated into the oamIndex.
// X-Flip: Bit 14
// Y-Flip: Bit 15
Expand Down
6 changes: 4 additions & 2 deletions src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ u8 gNumHBlankIntrs = 0;
struct BlendRegs gBldRegs ALIGNED(8) = {};
u8 gOamFreeIndex = 0;
struct Task gEmptyTask ALIGNED(16) = {};

// NOTE: gNextFreeAffineIndex introduced in SA3, unused before.
u8 gNextFreeAffineIndex = 0;
BgAffineReg gBgAffineRegs[NUM_AFFINE_BACKGROUNDS] = {};
void *gVramHeapStartAddr = NULL;
Expand Down Expand Up @@ -251,7 +253,7 @@ void GameInit(void)
gBgAffineRegs[1].x = 0;
gBgAffineRegs[1].y = 0;

#if (CURRENT_GAME >= GAME_SA3)
#if (GAME >= GAME_SA3)
gNextFreeAffineIndex = 0;
#endif
gUnknown_03001944 = 0;
Expand Down Expand Up @@ -381,7 +383,7 @@ void GameLoop(void)
gFlagsPreVBlank = gFlags;
VBlankIntrWait();

#if (CURRENT_GAME >= GAME_SA3)
#if (GAME >= GAME_SA3)
gNextFreeAffineIndex = 0;
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/multi_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ u32 gMultiSioIntrFuncBuf[0x120 / 4] = {}; // Interrupt Routine RAM Execution Buf

struct MultiSioArea gMultiSioArea = {};

#if (CURRENT_GAME <= GAME_SA2)
#if (GAME <= GAME_SA2)
UNUSED u32 gUnusedMultiSioSpace[2] = {};
#endif

Expand Down

0 comments on commit eddb0ba

Please sign in to comment.