From e42f114b2d0abe9a4531654eaca2084ec445c74d Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Fri, 21 Jun 2024 22:57:44 -0400 Subject: [PATCH] Add gLevelValues.jrbDarkenSkybox --- autogen/lua_definitions/structs.lua | 1 + docs/lua/structs.md | 1 + src/game/hardcoded.c | 3 ++- src/game/hardcoded.h | 1 + src/game/skybox.c | 5 +++-- src/pc/lua/smlua_cobject_autogen.c | 3 ++- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 3019d9f3..b6438629 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -904,6 +904,7 @@ --- @field public hudRedCoinsRadar integer --- @field public hudSecretsRadar integer --- @field public infiniteStairsRequirement integer +--- @field public jrbDarkenSkybox integer --- @field public maxCoins integer --- @field public maxLives integer --- @field public metalCapDuration integer diff --git a/docs/lua/structs.md b/docs/lua/structs.md index c17994e7..9baf2b7e 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -1245,6 +1245,7 @@ | hudRedCoinsRadar | `integer` | | | hudSecretsRadar | `integer` | | | infiniteStairsRequirement | `integer` | | +| jrbDarkenSkybox | `integer` | | | maxCoins | `integer` | | | maxLives | `integer` | | | metalCapDuration | `integer` | | diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index 5e71f878..c6e2d707 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -124,7 +124,8 @@ struct LevelValues gDefaultLevelValues = { .numCoinsToLife = 50, .wdwWaterLevelSpeed = 10.0f, .useGlobalStarIds = FALSE, - .zoomOutCameraOnPause = TRUE + .zoomOutCameraOnPause = TRUE, + .jrbDarkenSkybox = TRUE }; struct LevelValues gLevelValues = { 0 }; diff --git a/src/game/hardcoded.h b/src/game/hardcoded.h index 0a38a1ad..98aec62e 100644 --- a/src/game/hardcoded.h +++ b/src/game/hardcoded.h @@ -90,6 +90,7 @@ struct LevelValues { f32 wdwWaterLevelSpeed; u8 useGlobalStarIds; u8 zoomOutCameraOnPause; + u8 jrbDarkenSkybox; }; extern struct LevelValues gLevelValues; diff --git a/src/game/skybox.c b/src/game/skybox.c index cfb60213..b469f1ae 100644 --- a/src/game/skybox.c +++ b/src/game/skybox.c @@ -10,7 +10,8 @@ #include "segment2.h" #include "sm64.h" #include "hud.h" - +#include "geo_commands.h" +#include "hardcoded.h" /** * @file skybox.c @@ -343,7 +344,7 @@ Gfx *create_skybox_facing_camera(s8 player, s8 background, f32 fov, s8 colorIndex = 1; // If the first star is collected in JRB, make the sky darker and slightly green - if (background == 8 && !(save_file_get_star_flags(gCurrSaveFileNum - 1, COURSE_JRB - 1) & 1)) { + if (background == BACKGROUND_ABOVE_CLOUDS && gLevelValues.jrbDarkenSkybox && !(save_file_get_star_flags(gCurrSaveFileNum - 1, COURSE_JRB - 1) & 1)) { colorIndex = 0; } diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index bb86d9ac..e444ae9f 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -996,7 +996,7 @@ static struct LuaObjectField sLakituStateFields[LUA_LAKITU_STATE_FIELD_COUNT] = { "yaw", LVT_S16, offsetof(struct LakituState, yaw), false, LOT_NONE }, }; -#define LUA_LEVEL_VALUES_FIELD_COUNT 50 +#define LUA_LEVEL_VALUES_FIELD_COUNT 51 static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { { "bubbleOnDeathBarrierInCapStages", LVT_U8, offsetof(struct LevelValues, bubbleOnDeathBarrierInCapStages), false, LOT_NONE }, { "cellHeightLimit", LVT_S16, offsetof(struct LevelValues, cellHeightLimit), false, LOT_NONE }, @@ -1021,6 +1021,7 @@ static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { "hudRedCoinsRadar", LVT_U8, offsetof(struct LevelValues, hudRedCoinsRadar), false, LOT_NONE }, { "hudSecretsRadar", LVT_U8, offsetof(struct LevelValues, hudSecretsRadar), false, LOT_NONE }, { "infiniteStairsRequirement", LVT_S16, offsetof(struct LevelValues, infiniteStairsRequirement), false, LOT_NONE }, + { "jrbDarkenSkybox", LVT_U8, offsetof(struct LevelValues, jrbDarkenSkybox), false, LOT_NONE }, { "maxCoins", LVT_U16, offsetof(struct LevelValues, maxCoins), false, LOT_NONE }, { "maxLives", LVT_U16, offsetof(struct LevelValues, maxLives), false, LOT_NONE }, { "metalCapDuration", LVT_U16, offsetof(struct LevelValues, metalCapDuration), false, LOT_NONE },