Yet another header cleanup (#1284)

* thread, scene and interface

* non header stuff

* fix missing stuff

* z64sound_source.h

* collision_check.h

* Update include/z64sound_source.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update include/z64scene.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update include/z64thread.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* review

* review

* Update src/code/z_collision_check.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sound_source.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

---------

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
Anghelo Carvajal
2023-06-18 02:43:47 -04:00
committed by GitHub
parent 9c40dea770
commit 587d12e3cb
27 changed files with 531 additions and 559 deletions
+5
View File
@@ -12,6 +12,11 @@
#include "global.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
typedef struct FlagSetEntry {
/* 0x0 */ u8* value;
/* 0x4 */ const char* name;
} FlagSetEntry; // size = 0x8
static FlagSetEntry sFlagEntries[] = {
{ &gSaveContext.save.saveInfo.weekEventReg[0], "week_event_reg[0]" },
{ &gSaveContext.save.saveInfo.weekEventReg[1], "week_event_reg[1]" },
+1
View File
@@ -9,6 +9,7 @@
#include "stack.h"
#include "stackcheck.h"
#include "system_heap.h"
#include "z64thread.h"
extern OSMesgQueue sSiIntMsgQ;
extern OSMesg sSiIntMsgBuf[1];
+1
View File
@@ -1,6 +1,7 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "stackcheck.h"
#include "z64thread.h"
#define RSP_DONE_MSG 667
#define RDP_DONE_MSG 668
+1
View File
@@ -3,6 +3,7 @@
#include "stack.h"
#include "stackcheck.h"
#include "system_malloc.h"
#include "z64thread.h"
OSMesgQueue sFlashromMesgQueue;
OSMesg sFlashromMesg[1];
+2
View File
@@ -8,9 +8,11 @@
*
* @note: `argCount` must be set manually, as this file implements no way to configure it.
*/
#include "slowly.h"
#include "global.h"
#include "stackcheck.h"
#include "z64thread.h"
void Slowly_Main(SlowlyMgr* slowly) {
slowly->status |= SLOWLY_STATUS_STARTED;
+7
View File
@@ -1,4 +1,11 @@
#include "global.h"
#include "z64collision_check.h"
typedef s32 (*ColChkResetFunc)(struct PlayState*, Collider*);
typedef void (*ColChkBloodFunc)(struct PlayState*, Collider*, Vec3f*);
typedef void (*ColChkApplyFunc)(struct PlayState*, CollisionCheckContext*, Collider*);
typedef void (*ColChkVsFunc)(struct PlayState*, CollisionCheckContext*, Collider*, Collider*);
typedef s32 (*ColChkLineFunc)(struct PlayState*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*);
Vec3f D_801EDE00;
Vec3f D_801EDE10;
+7
View File
@@ -3,6 +3,13 @@
#define COLD_RESET 0
#define NMI 1
typedef struct {
/* 0x00 */ u32 resetting;
/* 0x04 */ u32 resetCount;
/* 0x08 */ OSTime duration;
/* 0x10 */ OSTime resetTime;
} NmiBuff; // size >= 0x18
NmiBuff* gNMIBuffer;
void Nmi_Init(void) {
+33 -33
View File
@@ -526,7 +526,7 @@ void Scene_CommandSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd) {
// SceneTableEntry Header Command 0x1A: Material Animations
void Scene_CommandAnimatedMaterials(PlayState* play, SceneCmd* cmd) {
play->sceneMaterialAnims = (AnimatedMaterial*)Lib_SegmentedToVirtual(cmd->textureAnimations.segment);
play->sceneMaterialAnims = Lib_SegmentedToVirtual(cmd->textureAnimations.segment);
}
/**
@@ -536,38 +536,38 @@ void Scene_SetExitFade(PlayState* play) {
play->transitionType = Entrance_GetTransitionFlags(play->nextEntrance) & 0x7F;
}
void (*sSceneCmdHandlers[])(PlayState*, SceneCmd*) = {
Scene_CommandSpawnList,
Scene_CommandActorList,
Scene_CommandActorCutsceneCamList,
Scene_CommandCollisionHeader,
Scene_CommandRoomList,
Scene_CommandWindSettings,
Scene_CommandEntranceList,
Scene_CommandSpecialFiles,
Scene_CommandRoomBehavior,
Scene_Command09,
Scene_CommandMesh,
Scene_CommandObjectList,
Scene_CommandLightList,
Scene_CommandPathList,
Scene_CommandTransiActorList,
Scene_CommandEnvLightSettings,
Scene_CommandTimeSettings,
Scene_CommandSkyboxSettings,
Scene_CommandSkyboxDisables,
Scene_CommandExitList,
NULL,
Scene_CommandSoundSettings,
Scene_CommandEchoSetting,
Scene_CommandCutsceneScriptList,
Scene_CommandAltHeaderList,
Scene_CommandSetRegionVisitedFlag,
Scene_CommandAnimatedMaterials,
Scene_CommandCutsceneList,
Scene_CommandMiniMap,
Scene_Command1D,
Scene_CommandMiniMapCompassInfo,
void (*sSceneCmdHandlers[SCENE_CMD_MAX])(PlayState*, SceneCmd*) = {
Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST
Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST
Scene_CommandActorCutsceneCamList, // SCENE_CMD_ID_ACTOR_CUTSCENE_CAM_LIST
Scene_CommandCollisionHeader, // SCENE_CMD_ID_COL_HEADER
Scene_CommandRoomList, // SCENE_CMD_ID_ROOM_LIST
Scene_CommandWindSettings, // SCENE_CMD_ID_WIND_SETTINGS
Scene_CommandEntranceList, // SCENE_CMD_ID_ENTRANCE_LIST
Scene_CommandSpecialFiles, // SCENE_CMD_ID_SPECIAL_FILES
Scene_CommandRoomBehavior, // SCENE_CMD_ID_ROOM_BEHAVIOR
Scene_Command09, // SCENE_CMD_ID_UNK_09
Scene_CommandMesh, // SCENE_CMD_ID_ROOM_SHAPE
Scene_CommandObjectList, // SCENE_CMD_ID_OBJECT_LIST
Scene_CommandLightList, // SCENE_CMD_ID_LIGHT_LIST
Scene_CommandPathList, // SCENE_CMD_ID_PATH_LIST
Scene_CommandTransiActorList, // SCENE_CMD_ID_TRANSI_ACTOR_LIST
Scene_CommandEnvLightSettings, // SCENE_CMD_ID_ENV_LIGHT_SETTINGS
Scene_CommandTimeSettings, // SCENE_CMD_ID_TIME_SETTINGS
Scene_CommandSkyboxSettings, // SCENE_CMD_ID_SKYBOX_SETTINGS
Scene_CommandSkyboxDisables, // SCENE_CMD_ID_SKYBOX_DISABLES
Scene_CommandExitList, // SCENE_CMD_ID_EXIT_LIST
NULL, // SCENE_CMD_ID_END
Scene_CommandSoundSettings, // SCENE_CMD_ID_SOUND_SETTINGS
Scene_CommandEchoSetting, // SCENE_CMD_ID_ECHO_SETTINGS
Scene_CommandCutsceneScriptList, // SCENE_CMD_ID_CUTSCENE_SCRIPT_LIST
Scene_CommandAltHeaderList, // SCENE_CMD_ID_ALTERNATE_HEADER_LIST
Scene_CommandSetRegionVisitedFlag, // SCENE_CMD_ID_SET_REGION_VISITED
Scene_CommandAnimatedMaterials, // SCENE_CMD_ID_ANIMATED_MATERIAL_LIST
Scene_CommandCutsceneList, // SCENE_CMD_ID_ACTOR_CUTSCENE_LIST
Scene_CommandMiniMap, // SCENE_CMD_ID_MINIMAP_INFO
Scene_Command1D, // SCENE_CMD_ID_UNUSED_1D
Scene_CommandMiniMapCompassInfo, // SCENE_CMD_ID_MINIMAP_COMPASS_ICON_INFO
};
/**
+5 -4
View File
@@ -1,11 +1,12 @@
#include "global.h"
#include "z64sound_source.h"
void SoundSource_InitAll(PlayState* play) {
SoundSource* sources = &play->soundSources[0];
s32 i;
// clang-format off
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { sources[i].countdown = 0; }
for (i = 0; i < SOUND_SOURCE_COUNT; i++) { sources[i].countdown = 0; }
// clang-format on
}
@@ -13,7 +14,7 @@ void SoundSource_UpdateAll(PlayState* play) {
SoundSource* source = &play->soundSources[0];
s32 i;
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) {
for (i = 0; i < SOUND_SOURCE_COUNT; i++) {
if (source->countdown != 0) {
if (DECR(source->countdown) == 0) {
AudioSfx_StopByPos(&source->projectedPos);
@@ -37,7 +38,7 @@ void SoundSource_Add(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId,
s32 i;
source = &play->soundSources[0];
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) {
for (i = 0; i < SOUND_SOURCE_COUNT; i++) {
if (source->countdown == 0) {
break;
}
@@ -52,7 +53,7 @@ void SoundSource_Add(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId,
}
// If no sound source is available, replace the sound source with the smallest remaining countdown
if (i >= ARRAY_COUNT(play->soundSources)) {
if (i >= SOUND_SOURCE_COUNT) {
source = backupSource;
AudioSfx_StopByPos(&source->projectedPos);
}