diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2023-06-18 02:43:47 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-18 16:43:47 +1000 |
| commit | 587d12e3cbb2a1ffb6774c0823c54ce0e80a579b (patch) | |
| tree | 77e25fd29e6bce3b979b7d50ec3851c9d2a9fc1e /src | |
| parent | 9c40dea7709726bd29fac8253586bc96c9f3ab8a (diff) | |
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>
Diffstat (limited to 'src')
| -rw-r--r-- | src/boot_O2_g3/boot_main.c | 1 | ||||
| -rw-r--r-- | src/boot_O2_g3/idle.c | 3 | ||||
| -rw-r--r-- | src/boot_O2_g3/irqmgr.c | 1 | ||||
| -rw-r--r-- | src/boot_O2_g3/z_std_dma.c | 1 | ||||
| -rw-r--r-- | src/code/flg_set.c | 5 | ||||
| -rw-r--r-- | src/code/main.c | 1 | ||||
| -rw-r--r-- | src/code/sched.c | 1 | ||||
| -rw-r--r-- | src/code/sys_flashrom.c | 1 | ||||
| -rw-r--r-- | src/code/sys_slowly.c | 2 | ||||
| -rw-r--r-- | src/code/z_collision_check.c | 7 | ||||
| -rw-r--r-- | src/code/z_nmi_buff.c | 7 | ||||
| -rw-r--r-- | src/code/z_scene.c | 66 | ||||
| -rw-r--r-- | src/code/z_sound_source.c | 9 |
13 files changed, 68 insertions, 37 deletions
diff --git a/src/boot_O2_g3/boot_main.c b/src/boot_O2_g3/boot_main.c index 6a561992b..ed16c34e0 100644 --- a/src/boot_O2_g3/boot_main.c +++ b/src/boot_O2_g3/boot_main.c @@ -2,6 +2,7 @@ #include "global.h" #include "stack.h" #include "stackcheck.h" +#include "z64thread.h" StackEntry sBootStackInfo; OSThread sIdleThread; diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c index 6c63e2a70..f7c847449 100644 --- a/src/boot_O2_g3/idle.c +++ b/src/boot_O2_g3/idle.c @@ -3,6 +3,7 @@ #include "stack.h" #include "buffers.h" #include "stackcheck.h" +#include "z64thread.h" u8 D_80096B20 = 1; vu8 gViConfigUseDefault = 1; @@ -94,10 +95,12 @@ void Idle_InitVideo(void) { D_8009B290 = 2; gViConfigMode = osViModeNtscLan1; break; + case OS_TV_MPAL: D_8009B290 = 30; gViConfigMode = osViModeMpalLan1; break; + case OS_TV_PAL: D_8009B290 = 44; gViConfigMode = osViModeFpalLan1; diff --git a/src/boot_O2_g3/irqmgr.c b/src/boot_O2_g3/irqmgr.c index 1f1e94ab4..9a773f279 100644 --- a/src/boot_O2_g3/irqmgr.c +++ b/src/boot_O2_g3/irqmgr.c @@ -1,5 +1,6 @@ #include "global.h" #include "stackcheck.h" +#include "z64thread.h" vs32 gIrqMgrResetStatus = 0; volatile OSTime sIrqMgrResetTime = 0; diff --git a/src/boot_O2_g3/z_std_dma.c b/src/boot_O2_g3/z_std_dma.c index 00d894f74..71b7ae846 100644 --- a/src/boot_O2_g3/z_std_dma.c +++ b/src/boot_O2_g3/z_std_dma.c @@ -2,6 +2,7 @@ #include "global.h" #include "stack.h" #include "stackcheck.h" +#include "z64thread.h" u32 sDmaMgrDmaBuffSize = 0x2000; diff --git a/src/code/flg_set.c b/src/code/flg_set.c index bb25818a6..f7c8c261e 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -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]" }, diff --git a/src/code/main.c b/src/code/main.c index 186240489..3da3d25d7 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -9,6 +9,7 @@ #include "stack.h" #include "stackcheck.h" #include "system_heap.h" +#include "z64thread.h" extern OSMesgQueue sSiIntMsgQ; extern OSMesg sSiIntMsgBuf[1]; diff --git a/src/code/sched.c b/src/code/sched.c index c06eb41ba..29c558ea7 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -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 diff --git a/src/code/sys_flashrom.c b/src/code/sys_flashrom.c index c2665741e..f2424b850 100644 --- a/src/code/sys_flashrom.c +++ b/src/code/sys_flashrom.c @@ -3,6 +3,7 @@ #include "stack.h" #include "stackcheck.h" #include "system_malloc.h" +#include "z64thread.h" OSMesgQueue sFlashromMesgQueue; OSMesg sFlashromMesg[1]; diff --git a/src/code/sys_slowly.c b/src/code/sys_slowly.c index 754c5d472..47170db62 100644 --- a/src/code/sys_slowly.c +++ b/src/code/sys_slowly.c @@ -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; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index b7f07d14d..f3f4043dd 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -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; diff --git a/src/code/z_nmi_buff.c b/src/code/z_nmi_buff.c index 205bd8d0f..eacfc5f46 100644 --- a/src/code/z_nmi_buff.c +++ b/src/code/z_nmi_buff.c @@ -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) { diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 368b4509e..529458f83 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -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 }; /** diff --git a/src/code/z_sound_source.c b/src/code/z_sound_source.c index 15ebd018a..4962f7072 100644 --- a/src/code/z_sound_source.c +++ b/src/code/z_sound_source.c @@ -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); } |
