-
Notifications
You must be signed in to change notification settings - Fork 800
Header split #6913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Pepe20129
wants to merge
10
commits into
HarbourMasters:develop
Choose a base branch
from
Pepe20129:header_split
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Header split #6913
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9a6acc6
Some header splits
Pepe20129 b7a5290
Merge branch 'develop' into header_split
Pepe20129 305ef81
whoops
Pepe20129 79af284
Merge branch 'develop' into header_split
Pepe20129 147a445
Post-merge fixes
Pepe20129 15add1f
Add missing include
Pepe20129 0e7ada8
another one
Pepe20129 4e05681
-_-
Pepe20129 72c5b9d
I hate platform differences...
Pepe20129 df58760
...
Pepe20129 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #ifndef DEBUG_DISPLAY_H | ||
| #define DEBUG_DISPLAY_H | ||
|
|
||
| #include <libultraship/libultra.h> | ||
| #include "z64math.h" | ||
| #include <libultraship/color.h> | ||
|
|
||
| #include "extern_c_helper.h" | ||
|
|
||
| struct GraphicsContext; | ||
| struct PlayState; | ||
|
|
||
| typedef struct DebugDispObject { | ||
| /* 0x00 */ Vec3f pos; | ||
| /* 0x0C */ Vec3s rot; | ||
| /* 0x14 */ Vec3f scale; | ||
| /* 0x20 */ Color_RGBA8 color; | ||
| /* 0x24 */ s16 type; | ||
| /* 0x28 */ struct DebugDispObject* next; | ||
| } DebugDispObject; // size = 0x2C | ||
|
|
||
| EXTERN_C void DebugDisplay_Init(void); | ||
| EXTERN_C DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, | ||
| f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, | ||
| struct GraphicsContext* gfxCtx); | ||
| EXTERN_C void DebugDisplay_DrawObjects(struct PlayState* play); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,244 @@ | ||
| #ifndef ENVIRONMENT_H_ | ||
| #define ENVIRONMENT_H_ | ||
|
|
||
| #include "z64math.h" | ||
| #include "z64light.h" | ||
| #include "z64dma.h" | ||
|
|
||
| #include "extern_c_helper.h" | ||
|
|
||
| struct GameOverContext; | ||
| struct MessageContext; | ||
| struct PauseContext; | ||
| struct PlayState; | ||
| struct SkyboxContext; | ||
| struct View; | ||
|
|
||
| #define FILL_SCREEN_OPA (1 << 0) | ||
| #define FILL_SCREEN_XLU (1 << 1) | ||
|
|
||
| // TODO: NEXT_TIME macros | ||
|
|
||
| // TODO: LIGHT_SETTING macros | ||
|
|
||
| // TODO: LIGHT_BLEND macros | ||
|
|
||
| // TODO: LightMode enum | ||
|
|
||
| typedef enum SkyboxDmaState { | ||
| /* 0 */ SKYBOX_DMA_INACTIVE, | ||
| /* 1 */ SKYBOX_DMA_FILE1_START, | ||
| /* 2 */ SKYBOX_DMA_FILE1_DONE, | ||
| /* 3 */ SKYBOX_DMA_PAL1_START, | ||
| /* 11 */ SKYBOX_DMA_FILE2_START = 11, | ||
| /* 12 */ SKYBOX_DMA_FILE2_DONE, | ||
| /* 13 */ SKYBOX_DMA_PAL2_START | ||
| } SkyboxDmaState; | ||
|
|
||
| typedef enum LightningMode { | ||
| /* 0 */ LIGHTNING_MODE_OFF, // no lightning | ||
| /* 1 */ LIGHTNING_MODE_ON, // request ligtning strikes at random intervals | ||
| /* 2 */ LIGHTNING_MODE_LAST // request one lightning strike before turning off | ||
| } LightningMode; | ||
|
|
||
| typedef enum LightningStrikeState { | ||
| /* 0 */ LIGHTNING_STRIKE_WAIT, // wait between lightning strikes. request bolts when timer hits 0 | ||
| /* 1 */ LIGHTNING_STRIKE_START, // fade in the flash. note: bolts are requested in the previous state | ||
| /* 2 */ LIGHTNING_STRIKE_END // fade out the flash and go back to wait | ||
| } LightningStrikeState; | ||
|
|
||
| // TODO: WeatherMode enum | ||
|
|
||
| // TODO: ChangeSkyboxState enum | ||
|
|
||
| // TODO: PrecipitationData enum | ||
|
|
||
| // TODO: StormRequest enum | ||
|
|
||
| // TODO: StormState enum | ||
|
|
||
| // TODO: TimeBasedSeqState enum | ||
|
|
||
| typedef enum SandstormState { | ||
| /* 0 */ SANDSTORM_OFF, | ||
| /* 1 */ SANDSTORM_FILL, | ||
| /* 2 */ SANDSTORM_UNFILL, | ||
| /* 3 */ SANDSTORM_ACTIVE, | ||
| /* 4 */ SANDSTORM_DISSIPATE | ||
| } SandstormState; | ||
|
|
||
| typedef struct LightningStrike { | ||
| /* 0x00 */ u8 state; | ||
| /* 0x01 */ u8 flashRed; | ||
| /* 0x02 */ u8 flashGreen; | ||
| /* 0x03 */ u8 flashBlue; | ||
| /* 0x04 */ u8 flashAlphaTarget; | ||
| /* 0x08 */ f32 delayTimer; | ||
| } LightningStrike; // size = 0xC | ||
|
|
||
| // TODO: Update the type to upstream (TimeBasedSkyboxEntry) | ||
| // describes what skybox files and blending modes to use depending on time of day | ||
| typedef struct struct_8011FC1C { | ||
| /* 0x00 */ u16 startTime; | ||
| /* 0x02 */ u16 endTime; | ||
| /* 0x04 */ u8 blend; // if true, blend between.. skyboxes? palettes? | ||
| /* 0x05 */ u8 skybox1Index; // whats the difference between _pal and non _pal files? | ||
| /* 0x06 */ u8 skybox2Index; | ||
| } struct_8011FC1C; // size = 0x8 | ||
|
|
||
| // TODO: CurrentEnvLightSettings struct | ||
|
|
||
| // `EnvLightSettings` is very similar to `CurrentEnvLightSettings` with one key difference. | ||
| // The light settings data in the scene packs blend rate information with the fog near value. | ||
| // The blendRate determines how fast the current light settings fade to the next one | ||
| // (under LIGHT_MODE_SETTINGS, otherwise unused). | ||
|
|
||
| // TODO: BLEND_RATE macro | ||
|
|
||
| // TODO: ENV_LIGHT macros | ||
|
|
||
| // TODO: Update the type to upstream | ||
| typedef struct EnvLightSettings { | ||
| /* 0x00 */ u8 ambientColor[3]; | ||
| /* 0x03 */ s8 light1Dir[3]; | ||
| /* 0x06 */ u8 light1Color[3]; | ||
| /* 0x09 */ s8 light2Dir[3]; | ||
| /* 0x0C */ u8 light2Color[3]; | ||
| /* 0x0F */ u8 fogColor[3]; | ||
| /* 0x12 */ s16 fogNear; | ||
| /* 0x14 */ s16 fogFar; | ||
| } EnvLightSettings; // size = 0x16 | ||
|
|
||
| // TODO: Update the type to upstream | ||
| typedef struct EnvironmentContext { | ||
| /* 0x00 */ char unk_00[0x02]; | ||
| /* 0x02 */ u16 timeIncrement; // how many units of time that pass every update | ||
| /* 0x04 */ Vec3f sunPos; // moon position can be found by negating the sun position | ||
| /* 0x10 */ u8 skybox1Index; | ||
| /* 0x11 */ u8 skybox2Index; | ||
| /* 0x12 */ char unk_12[0x01]; | ||
| /* 0x13 */ u8 skyboxBlend; | ||
| /* 0x14 */ char unk_14[0x01]; | ||
| /* 0x15 */ u8 skyboxDisabled; | ||
| /* 0x16 */ u8 sunMoonDisabled; | ||
| /* 0x17 */ u8 unk_17; // currentWeatherMode for skybox? (prev called gloomySky) | ||
| /* 0x18 */ u8 unk_18; // nextWeatherMode for skybox? | ||
| /* 0x19 */ u8 unk_19; | ||
| /* 0x1A */ u16 unk_1A; | ||
| /* 0x1C */ char unk_1C[0x02]; | ||
| /* 0x1E */ u8 indoors; // when set, day time has no effect on lighting | ||
| /* 0x1F */ u8 unk_1F; // outdoor light index | ||
| /* 0x20 */ u8 unk_20; // prev outdoor light index? | ||
| /* 0x21 */ u8 unk_21; | ||
| /* 0x22 */ u16 unk_22; | ||
| /* 0x24 */ u16 unk_24; | ||
| /* 0x26 */ char unk_26[0x02]; | ||
| /* 0x28 */ LightInfo dirLight1; // used for sunlight outdoors | ||
| /* 0x36 */ LightInfo dirLight2; // used for moonlight outdoors | ||
| /* 0x44 */ s8 skyboxDmaState; | ||
| /* 0x48 */ DmaRequest dmaRequest; | ||
| /* 0x68 */ OSMesgQueue loadQueue; | ||
| /* 0x80 */ OSMesg loadMsg; | ||
| /* 0x84 */ f32 unk_84; | ||
| /* 0x88 */ f32 unk_88; | ||
| /* 0x8C */ s16 adjAmbientColor[3]; | ||
| /* 0x92 */ s16 adjLight1Color[3]; | ||
| /* 0x98 */ s16 adjFogColor[3]; | ||
| /* 0x9E */ s16 adjFogNear; | ||
| /* 0xA0 */ s16 adjFogFar; | ||
| /* 0xA2 */ char unk_A2[0x06]; | ||
| /* 0xA8 */ Vec3s windDirection; | ||
| /* 0xB0 */ f32 windSpeed; | ||
| /* 0xB4 */ u8 numLightSettings; | ||
| /* 0xB8 */ EnvLightSettings* lightSettingsList; // list of light settings from the scene file | ||
| /* 0xBC */ u8 blendIndoorLights; // when true, blend between indoor light settings when switching | ||
| /* 0xBD */ u8 unk_BD; // indoor light index | ||
| /* 0xBE */ u8 unk_BE; // prev indoor light index? | ||
| /* 0xBF */ u8 unk_BF; | ||
| /* 0xC0 */ EnvLightSettings lightSettings; | ||
| /* 0xD6 */ u16 unk_D6; | ||
| /* 0xD8 */ f32 unk_D8; // indoor light blend weight? | ||
| /* 0xDC */ u8 unk_DC; | ||
| /* 0xDD */ u8 gloomySkyMode; | ||
| /* 0xDE */ u8 unk_DE; // gloomy sky state | ||
| /* 0xDF */ u8 lightningMode; | ||
| /* 0xE0 */ u8 unk_E0; // env sounds state | ||
| /* 0xE1 */ u8 fillScreen; | ||
| /* 0xE2 */ u8 screenFillColor[4]; | ||
| /* 0xE6 */ u8 sandstormState; | ||
| /* 0xE7 */ u8 sandstormPrimA; | ||
| /* 0xE8 */ u8 sandstormEnvA; | ||
| /* 0xE9 */ u8 customSkyboxFilter; | ||
| /* 0xEA */ u8 skyboxFilterColor[4]; | ||
| /* 0xEE */ u8 unk_EE[4]; | ||
| /* 0xF2 */ u8 unk_F2[4]; | ||
| /* 0xF6 */ char unk_F6[0x06]; | ||
| } EnvironmentContext; // size = 0xFC | ||
|
|
||
| // TODO: Rename variables | ||
| EXTERN_C u8 gSkyboxBlendingEnabled; | ||
| EXTERN_C struct_8011FC1C D_8011FC1C[][9]; | ||
|
|
||
| EXTERN_C u8 gWeatherMode; | ||
| EXTERN_C u8 D_8011FB34; | ||
| EXTERN_C u8 D_8011FB38; | ||
| EXTERN_C u16 gTimeIncrement; | ||
|
|
||
| EXTERN_C LightningStrike gLightningStrike; | ||
|
|
||
| // TODO: These variables are here for BSS ordering but ideally they should not | ||
| // be extern. This could be fixed by putting more stuff (e.g. struct definitions) | ||
| // between gLightningStrike and gCustomLensFlareOn. | ||
| // TODO: Missing variables | ||
| EXTERN_C u8 gCustomLensFlareOn; | ||
| EXTERN_C Vec3f gCustomLensFlarePos; | ||
| EXTERN_C s16 gLensFlareScale; | ||
| EXTERN_C f32 gLensFlareColorIntensity; | ||
| EXTERN_C s16 gLensFlareScreenFillAlpha; | ||
|
|
||
| // Environment_UpdateSkybox was updated during porting to add a PlayState* argument? | ||
| EXTERN_C void Environment_UpdateSkybox(struct PlayState* play, u8 skyboxId, EnvironmentContext* envCtx, struct SkyboxContext* skyboxCtx); | ||
| EXTERN_C void Environment_DrawSkyboxFilters(struct PlayState* play); | ||
|
|
||
| // TODO: Rename to Environment_ZBufValToFixedPoint | ||
| EXTERN_C s32 func_8006F0A0(s32 arg0); | ||
| EXTERN_C u16 Environment_GetPixelDepth(s32 x, s32 y); | ||
| EXTERN_C void Environment_GraphCallback(struct GraphicsContext* gfxCtx, void* param); | ||
| EXTERN_C void Environment_Init(struct PlayState* play2, EnvironmentContext* envCtx, s32 unused); | ||
| EXTERN_C u8 Environment_SmoothStepToU8(u8* pvalue, u8 target, u8 scale, u8 step, u8 minStep); | ||
| EXTERN_C u8 Environment_SmoothStepToS8(s8* pvalue, s8 target, u8 scale, u8 step, u8 minStep); | ||
| EXTERN_C f32 Environment_LerpWeight(u16 max, u16 min, u16 val); | ||
| EXTERN_C f32 Environment_LerpWeightAccelDecel(u16 endFrame, u16 startFrame, u16 curFrame, u16 accelDuration, u16 decelDuration); | ||
| EXTERN_C void Environment_EnableUnderwaterLights(struct PlayState* play, s32 waterLightsIndex); | ||
| EXTERN_C void Environment_DisableUnderwaterLights(struct PlayState* play); | ||
| EXTERN_C void Environment_Update(struct PlayState* play, EnvironmentContext* envCtx, LightContext* lightCtx, | ||
| struct PauseContext* pauseCtx, struct MessageContext* msgCtx, | ||
| struct GameOverContext* gameOverCtx, struct GraphicsContext* gfxCtx); | ||
| EXTERN_C void Environment_DrawSunAndMoon(struct PlayState* play); | ||
| EXTERN_C void Environment_DrawSunLensFlare(struct PlayState* play, EnvironmentContext* envCtx, struct View* view, | ||
| struct GraphicsContext* gfxCtx, Vec3f pos, s32 unused); | ||
| EXTERN_C void Environment_DrawLensFlare(struct PlayState* play, EnvironmentContext* envCtx, struct View* view, | ||
| struct GraphicsContext* gfxCtx, Vec3f pos, s32 unused, s16 arg6, f32 arg7, s16 arg8, u8 arg9); | ||
| EXTERN_C void Environment_DrawRain(struct PlayState* play, struct View* view, struct GraphicsContext* gfxCtx); | ||
| // TODO: Rename to Environment_ChangeLightSetting | ||
| EXTERN_C void func_80074CE8(struct PlayState* play, u32 arg1); | ||
| EXTERN_C void Environment_UpdateLightningStrike(struct PlayState* play); | ||
| EXTERN_C void Environment_AddLightningBolts(struct PlayState* play, u8 num); | ||
| EXTERN_C void Environment_DrawLightning(struct PlayState* play, s32 unused); | ||
| EXTERN_C void Environment_PlaySceneSequence(struct PlayState* play); | ||
| EXTERN_C void Environment_DrawCustomLensFlare(struct PlayState* play); | ||
| EXTERN_C void Environment_InitGameOverLights(struct PlayState* play); | ||
| EXTERN_C void Environment_FadeInGameOverLights(struct PlayState* play); | ||
| EXTERN_C void Environment_FadeOutGameOverLights(struct PlayState* play); | ||
| EXTERN_C void Environment_FillScreen(struct GraphicsContext* gfxCtx, u8 red, u8 green, u8 blue, u8 alpha, u8 drawFlags); | ||
| EXTERN_C void Environment_DrawSandstorm(struct PlayState* play, u8 sandstormState); | ||
| EXTERN_C void Environment_AdjustLights(struct PlayState* play, f32 arg1, f32 arg2, f32 arg3, f32 arg4); | ||
| EXTERN_C s32 Environment_GetBgsDayCount(void); | ||
| EXTERN_C void Environment_ClearBgsDayCount(void); | ||
| EXTERN_C s32 Environment_GetTotalDays(void); | ||
| EXTERN_C void Environment_ForcePlaySequence(u16 seqId); | ||
| EXTERN_C s32 Environment_IsForcedSequenceDisabled(void); | ||
| EXTERN_C void Environment_PlayStormNatureAmbience(struct PlayState* play); | ||
| EXTERN_C void Environment_StopStormNatureAmbience(struct PlayState* play); | ||
| EXTERN_C void Environment_WarpSongLeave(struct PlayState* play); | ||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #pragma once | ||
|
|
||
| // SoH: Helper for headers which can be included in both C & C++ | ||
|
|
||
| #if __cplusplus | ||
| #define EXTERN_C extern "C" | ||
| #else | ||
| #define EXTERN_C extern | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #ifndef FONT_H | ||
| #define FONT_H | ||
|
|
||
| #include <libultraship/libultra.h> | ||
|
|
||
| #include "extern_c_helper.h" | ||
|
|
||
| // #region SoH [Port]: Increased char buffer because texture paths could be bigger than (16 * 16 / 2) | ||
| #define FONT_CHAR_MULTIPLIER 256 | ||
| // #endregion | ||
|
|
||
| // TODO get these properties from the textures themselves | ||
| #define FONT_CHAR_TEX_WIDTH 16 | ||
| #define FONT_CHAR_TEX_HEIGHT 16 | ||
| #define FONT_CHAR_TEX_SIZE ((FONT_CHAR_TEX_WIDTH * FONT_CHAR_TEX_HEIGHT) / 2) // 16x16 I4 texture | ||
|
|
||
| // TODO: Update the type to upstream | ||
| typedef struct Font { | ||
| /* 0x0000 */ uintptr_t msgOffset; | ||
| /* 0x0004 */ u32 msgLength; | ||
| /* 0x0008 */ u8 charTexBuf[FONT_CHAR_TEX_SIZE * FONT_CHAR_MULTIPLIER]; | ||
| /* 0x3C08 */ u8 iconBuf[FONT_CHAR_TEX_SIZE * FONT_CHAR_MULTIPLIER]; | ||
| /* 0x3C88 */ u8 fontBuf[FONT_CHAR_TEX_SIZE * FONT_CHAR_MULTIPLIER]; | ||
| union { | ||
| /* 0xDC88 */ char msgBuf[1280]; | ||
| /* 0xDC88 */ u16 msgBufWide[640]; | ||
| }; | ||
| } Font; // size = 0xE188 | ||
|
|
||
| // TODO: PLATFORM macros | ||
| #if false//PLATFORM_IQUE | ||
| EXTERN_C void Font_LoadCharCHN(Font* font, u16 character, u16 codePointIndex); | ||
| #endif | ||
| EXTERN_C void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex); | ||
| EXTERN_C void Font_LoadChar(Font* font, u8 character, u16 codePointIndex); | ||
| EXTERN_C void Font_LoadMessageBoxIcon(Font* font, u16 icon); | ||
| EXTERN_C void Font_LoadOrderedFont(Font* font); | ||
|
|
||
| #endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.