Add behavior value for enabling GEO_RENDER_RANGE

This commit is contained in:
Agent X 2025-12-13 23:20:08 -05:00
parent 0dcb4f030a
commit 9422c34836
6 changed files with 11 additions and 5 deletions

View file

@ -195,6 +195,7 @@
--- @field public RespawnShellBoxes integer
--- @field public MultipleCapCollection integer
--- @field public InfiniteRenderDistance integer
--- @field public ProcessLODs integer
--- @field public CourtyardBoosRequirement integer
--- @field public starsNeededForDialog StarsNeededForDialog
--- @field public dialogs BehaviorDialogs

View file

@ -336,6 +336,7 @@
| RespawnShellBoxes | `integer` | |
| MultipleCapCollection | `integer` | |
| InfiniteRenderDistance | `integer` | |
| ProcessLODs | `integer` | |
| CourtyardBoosRequirement | `integer` | |
| starsNeededForDialog | [StarsNeededForDialog](structs.md#StarsNeededForDialog) | read-only |
| dialogs | [BehaviorDialogs](structs.md#BehaviorDialogs) | read-only |

View file

@ -168,6 +168,7 @@ struct BehaviorValues gDefaultBehaviorValues = {
.RespawnShellBoxes = TRUE,
.MultipleCapCollection = FALSE,
.InfiniteRenderDistance = TRUE,
.ProcessLODs = FALSE,
.CourtyardBoosRequirement = 12,
.starsNeededForDialog = { 1, 3, 8, 30, 50, 70 },
.dialogs = {

View file

@ -265,6 +265,7 @@ struct BehaviorValues {
u8 RespawnShellBoxes;
u8 MultipleCapCollection;
u8 InfiniteRenderDistance;
u8 ProcessLODs;
s16 CourtyardBoosRequirement;
struct StarsNeededForDialog starsNeededForDialog;
struct BehaviorDialogs dialogs;

View file

@ -16,11 +16,12 @@
#include "pc/lua/smlua_hooks.h"
#include "pc/utils/misc.h"
#include "pc/debuglog.h"
#include "game/skybox.h"
#include "game/first_person_cam.h"
#include "skybox.h"
#include "first_person_cam.h"
#include "course_table.h"
#include "skybox.h"
#include "mario.h"
#include "hardcoded.h"
/**
* This file contains the code that processes the scene graph for rendering.
@ -633,8 +634,8 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
* range of this node.
*/
static void geo_process_level_of_detail(struct GraphNodeLevelOfDetail *node) {
// We assume modern hardware is powerful enough to draw the most detailed variant
s16 distanceFromCam = 0;
Mtx *mtx = gMatStackFixed[gMatStackIndex];
s16 distanceFromCam = gBehaviorValues.ProcessLODs ? (s32) -mtx->m[3][2] : 0; // z-component of the translation column
if (node->minDistance <= distanceFromCam && distanceFromCam < node->maxDistance) {
if (node->node.children != 0) {

View file

@ -340,7 +340,7 @@ static struct LuaObjectField sBehaviorTrajectoriesFields[LUA_BEHAVIOR_TRAJECTORI
{ "UnagiTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, UnagiTrajectory), false, LOT_POINTER, 1, sizeof(Trajectory*) },
};
#define LUA_BEHAVIOR_VALUES_FIELD_COUNT 32
#define LUA_BEHAVIOR_VALUES_FIELD_COUNT 33
static struct LuaObjectField sBehaviorValuesFields[LUA_BEHAVIOR_VALUES_FIELD_COUNT] = {
{ "BowlingBallBob2Speed", LVT_F32, offsetof(struct BehaviorValues, BowlingBallBob2Speed), false, LOT_NONE, 1, sizeof(f32) },
{ "BowlingBallBobSpeed", LVT_F32, offsetof(struct BehaviorValues, BowlingBallBobSpeed), false, LOT_NONE, 1, sizeof(f32) },
@ -361,6 +361,7 @@ static struct LuaObjectField sBehaviorValuesFields[LUA_BEHAVIOR_VALUES_FIELD_COU
{ "MipsStar1Requirement", LVT_S16, offsetof(struct BehaviorValues, MipsStar1Requirement), false, LOT_NONE, 1, sizeof(s16) },
{ "MipsStar2Requirement", LVT_S16, offsetof(struct BehaviorValues, MipsStar2Requirement), false, LOT_NONE, 1, sizeof(s16) },
{ "MultipleCapCollection", LVT_U8, offsetof(struct BehaviorValues, MultipleCapCollection), false, LOT_NONE, 1, sizeof(u8) },
{ "ProcessLODs", LVT_U8, offsetof(struct BehaviorValues, ProcessLODs), false, LOT_NONE, 1, sizeof(u8) },
{ "RacingPenguinBigHeight", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinBigHeight), false, LOT_NONE, 1, sizeof(f32) },
{ "RacingPenguinBigRadius", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinBigRadius), false, LOT_NONE, 1, sizeof(f32) },
{ "RacingPenguinHeight", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinHeight), false, LOT_NONE, 1, sizeof(f32) },