Skip to content

Commit

Permalink
split up more game globals
Browse files Browse the repository at this point in the history
  • Loading branch information
freshollie committed Nov 25, 2023
1 parent 02bbe55 commit 326cccc
Show file tree
Hide file tree
Showing 160 changed files with 354 additions and 181 deletions.
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,15 @@
"zone_6.h": "c",
"zone_final.h": "c",
"pause_menu.h": "c",
"title_screen.h": "c"
"title_screen.h": "c",
"game_modes.h": "c",
"main.h": "c",
"unknown_task.h": "c",
"entities_0.h": "c",
"dust_cloud.h": "c",
"unknown_effect.h": "c",
"underwater_effects.h": "c",
"dust_effect_braking.h": "c"
},
"asm-code-lens.donated": true,
"editor.formatOnSave": true,
Expand Down
8 changes: 0 additions & 8 deletions include/constants/game_modes.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
#ifndef GUARD_CONSTANTS_GAME_MODE_H
#define GUARD_CONSTANTS_GAME_MODE_H

#define GAME_MODE_SINGLE_PLAYER 0
#define GAME_MODE_TIME_ATTACK 1
#define GAME_MODE_BOSS_TIME_ATTACK 2

#define GAME_MODE_MULTI_PLAYER 3
#define GAME_MODE_TEAM_PLAY 4
#define GAME_MODE_MULTI_PLAYER_COLLECT_RINGS 5

#endif
3 changes: 3 additions & 0 deletions include/constants/zones.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@
#define IS_EXTRA_STAGE(lvl) ((lvl) == LEVEL_INDEX(ZONE_FINAL, ACT_TRUE_AREA_53))
#define IS_FINAL_OR_EXTRA_STAGE(lvl) ((IS_FINAL_STAGE(lvl)) || (IS_EXTRA_STAGE(lvl)))

#define ZONE_TIME_TO_INT(minutes, seconds) (((minutes * 60) + seconds) * 60)
#define MAX_COURSE_TIME (ZONE_TIME_TO_INT(10, 0))

#endif // GUARD_ZONES_H
8 changes: 8 additions & 0 deletions include/game/bosses/final_intro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef GUARD_BOSSES_FINAL_INTRO_h
#define GUARD_BOSSES_FINAL_INTRO_h

#include "global.h"

void CreateTrueArea53Intro(void);

#endif // GUARD_BOSSES_FINAL_INTRO_h
14 changes: 12 additions & 2 deletions include/game/dust_effect_braking.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#ifndef GUARD_BRAKE_DUST_CLOUD_H
#define GUARD_BRAKE_DUST_CLOUD_H

extern struct Task *CreateBrakingDustEffect(s32, s32);
extern void sub_801F754(void);
#include "core.h"

struct Task *CreateBrakingDustEffect(s32, s32);
void sub_801F754(void);

typedef struct {
s8 unk0;
u8 filler1[3];
struct Task *t;
} UNK_30059D0;

extern UNK_30059D0 gUnknown_030059D0;

#endif // GUARD_BRAKE_DUST_CLOUD_H
1 change: 1 addition & 0 deletions include/game/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "gba/types.h"
#include "sprite.h"
#include "game/game.h"
#include "game/stage/player.h"
#include "game/stage/camera.h"

#define ENTITY_DATA_SIZE_SA1 4
Expand Down
101 changes: 2 additions & 99 deletions include/game/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,13 @@
#include "task.h"

#include "sakit/globals.h"
#include "constants/game_modes.h"
#include "sakit/player.h"
#include "constants/characters.h"

// TODO: force users to include player
#include "game/stage/player.h"

#define ZONE_TIME_TO_INT(minutes, seconds) \
(((minutes * 60) + seconds) * GBA_FRAMES_PER_SECOND)
#define MAX_COURSE_TIME (ZONE_TIME_TO_INT(10, 0))

#define TIME_RECORDS_PER_COURSE 3

// TODO: move to staging
#define NUM_MULTIPLAYER_SCORES 10
#define MAX_MULTIPLAYER_SCORE 99
#define SPECIAL_STAGE_REQUIRED_SP_RING_COUNT 7

void GameStart(void);

extern struct Task *gGameStageTask;

typedef struct {
s8 unk0;
u8 filler1[3];
struct Task *t;
} UNK_30059D0;

extern UNK_30059D0 gUnknown_030059D0;

// Copies of BG control regs for Multiplayer(?)
typedef struct {
u16 unk0;
u16 unk2;
u16 unk4;
u16 unk6;
} MultiPlayerBgCtrlRegs; /* size: 8 */
extern MultiPlayerBgCtrlRegs *gUnknown_03005840;

extern u8 gSmallAirBubbleCount;

struct MultiplayerPlayer {
// TODO: Verify that this is Sprite!
// (Used in Task_Item_Invincibility @ 0x0802AC60)
Expand All @@ -73,35 +41,6 @@ struct MultiplayerPlayer {
// Some sort of unused task variable
extern struct Task *gDummyTask;

struct UNK_80D62D8 {
u8 unk0[28];
u32 unk1C;
u32 unk20;
u8 unk24[12];
};

typedef struct {
u16 pal[16 * 16];
} WaterData;

// Seems to be belonging to water effect
typedef struct {
/* 0x00 */ bool8 isActive;
/* 0x01 */ u8 unk1;
/* 0x01 */ u8 unk2;
/* 0x01 */ u8 unk3;
/* 0x04 */ s16 currentWaterLevel;
/* 0x06 */ s16 targetWaterLevel;
/* 0x08 */ u32 unk8;
/* 0x0C */ u32 mask;

// t -> u16 palette[16*16] (additional "palette memory" for GUI stuff?)
/* 0x10 */ struct Task *t; /* size: 0x400 */
/* 0x14 */ Sprite s;
} Water;

extern Water gWater;

// TODO: find out what task is parent to IA
typedef struct {
u8 filler0[0x18];
Expand All @@ -123,15 +62,6 @@ typedef struct {
/* 0x2C */ Sprite s;
} TaskStrc_8011C98; /* size: 0x5C */

struct Backgrounds {
Background unk0;
Background unk40;
Background unk80;
Background unkC0;
};

extern struct Backgrounds gStageBackgroundsRam;

// rodata
extern const AnimId gPlayerCharacterIdleAnims[NUM_CHARACTERS];

Expand All @@ -150,28 +80,12 @@ extern const u8 gUnknown_08CB41C0[0x6a44];

extern const u8 gUnknown_08CBAC04[];

// TODO: Might need to be moved out of this header?
void Player_SetMovestate_IsInScriptedSequence(void);
void Player_ClearMovestate_IsInScriptedSequence(void);

void sub_802E164(s32, u16);

void CreateTrueArea53Intro(void);

// Sweep anim
void sub_802E044(s32, u16);

u16 CreateStageResults(u32, u16, u8);

void sub_8019F08(void);
struct Task *CreateStageGoalBonusPointsAnim(s32, s32, u16);
extern void Task_801F214(void);
void sub_801F550(struct Task *);

void sub_80218E4(Player *);
void sub_8023B5C(Player *, s8);
void sub_8023260(Player *);

// HandlePlayerDestroy?
extern bool32 sub_800C4FC(Sprite *, s32, s32, u8);

Expand All @@ -193,17 +107,6 @@ s32 sub_801F07C(s32, s32, s32, s32, void *, Func801F100);

s32 sub_801F100(s32, s32, s32, s32, Func801F100);

// TODO: Include header this belongs to
u32 sub_800C944(Sprite *, s32, s32);

// TODO: Include header this belongs to
bool32 sub_800CA20(Sprite *s, s32 x, s32 y, u16 p3, Player *p);
bool32 sub_800C320(Sprite *s, s32 x, s32 y, u16 p3, Player *p);
bool32 sub_800C418(Sprite *s, s32 x, s32 y, u16 p3, Player *p);

// Lose rings?
bool32 sub_800CBA4(Player *);

// TODO: Move this into the module sub_801F15C gets defined in, once it's decomped
typedef struct {
/* 0x00 */ s32 x;
Expand Down
4 changes: 4 additions & 0 deletions include/game/game_7.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef GUARD_GAME_7_H
#define GUARD_GAME_7_H

#include "global.h"

void sub_802E044(s32, u16);
void sub_802E164(s32, u16);
void sub_802DBC0(u8 p0, u16 p1);
void sub_802DCC8(u8 p0, u16 p1);
void sub_802DDC4(u8 p0, u16 p1);
Expand Down
5 changes: 4 additions & 1 deletion include/game/multiplayer/finish.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef GUARD_MULTIPLAYER_FINISH_H
#define GUARD_MULTIPLAYER_FINISH_H

extern void sub_8019CCC(u8 sioId, u8 count);
#include "global.h"

void sub_8019CCC(u8 sioId, u8 count);
void sub_8019F08(void);

#endif // GUARD_MULTIPLAYER_FINISH_H
17 changes: 17 additions & 0 deletions include/game/multiplayer/player_unk_2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


#ifndef GUARD_MULTIPLAYER_PLAYER_UNK_2_H
#define GUARD_MULTIPLAYER_PLAYER_UNK_2_H

#include "global.h"

// Copies of BG control regs for Multiplayer(?)
typedef struct {
u16 unk0;
u16 unk2;
u16 unk4;
u16 unk6;
} MultiPlayerBgCtrlRegs; /* size: 8 */
extern MultiPlayerBgCtrlRegs *gUnknown_03005840;

#endif // GUARD_MULTIPLAYER_PLAYER_UNK_2_H
11 changes: 0 additions & 11 deletions include/game/player.h

This file was deleted.

12 changes: 10 additions & 2 deletions include/game/save.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
#define GUARD_SAVE_H

#include "global.h"
#include "constants/zones.h"

#include "sakit/globals.h"

#include "game/player_controls.h"
#include "game/game.h"
#include "constants/zones.h"
#include "constants/characters.h"

#define PLAYER_NAME_END_CHAR 0xFFFF

#define NUM_MULTIPLAYER_SCORES 10
#define MAX_MULTIPLAYER_SCORE 99

#define TIME_RECORDS_PER_COURSE 3

struct MultiplayerScore {
u32 playerId;
u16 playerName[MAX_PLAYER_NAME_LENGTH];
Expand Down
2 changes: 0 additions & 2 deletions include/game/special_stage/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include "sprite.h"
#include "game/screen_fade.h"

#define SPECIAL_STAGE_REQUIRED_SP_RING_COUNT 7

#define SPECIAL_STAGE_ZONE_SIZE 8

#define MIN_SPECIAL_STAGE_PLAYER_X 48
Expand Down
1 change: 1 addition & 0 deletions include/game/stage/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extern const Background gStageCameraBgTemplates[4];

void UpdateCamera(void);

// TODO: Collision
extern const u32 *gUnknown_030059C8;

extern const u16 gUnknown_080D5964[][2];
Expand Down
13 changes: 9 additions & 4 deletions include/game/stage/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
#define GUARD_STAGE_PLAYER_H

#include "sakit/player.h"
#include "constants/move_states.h"

#define PLAYER_IS_ALIVE (!(gPlayer.moveState & MOVESTATE_DEAD))
#define IS_ALIVE(player) (!(player->moveState & MOVESTATE_DEAD))

void InitializePlayer(Player *p);
void sub_80218E4(Player *);
void sub_8023B5C(Player *, s8);
void sub_8023260(Player *);
s32 sub_802195C(Player *p, u8 *p1, s32 *out);
s32 sub_8021A34(Player *p, u8 *p1, s32 *out);
s32 sub_8021B08(Player *p, u8 *p1, s32 *out);

void Player_SetMovestate_IsInScriptedSequence(void);
void Player_ClearMovestate_IsInScriptedSequence(void);

#endif // GUARD_STAGE_PLAYER_H
4 changes: 4 additions & 0 deletions include/game/stage/results.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef GUARD_STAGE_RESULTS_H
#define GUARD_STAGE_RESULTS_H

#include "global.h"

u16 CreateStageResults(u32, u16, u8);

extern const u16 sAnimsGotThroughZoneAndActNames[11][3];
extern const u16 sStageResultsHeadlineTexts[5][3];
extern const u16 sAnimsGotThroughCharacterNames[5][3];
Expand Down
10 changes: 10 additions & 0 deletions include/game/stage/stage.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@ void ApplyGameStageSettings(void);
void GameStageStart(void);
void CreateGameStage(void);

struct Backgrounds {
Background unk0;
Background unk40;
Background unk80;
Background unkC0;
};

extern struct Task *gGameStageTask;
extern struct Backgrounds gStageBackgroundsRam;

#endif // GUARD_STAGE_H
8 changes: 0 additions & 8 deletions include/game/true_area_53/intro.h

This file was deleted.

2 changes: 2 additions & 0 deletions include/game/underwater_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ struct Task *SpawnAirBubbles(s32 p0, s32 p1, s32 p2, s32 p3);
struct Task *SpawnBubblesAfterDrowning(Player *p);
bool32 RandomlySpawnAirBubbles(Player *p);

extern u8 gSmallAirBubbleCount;

#endif // GUARD_GAME_2_H
Loading

0 comments on commit 326cccc

Please sign in to comment.