This commit is contained in:
Mips96 2023-12-19 11:30:41 -06:00 committed by GitHub
commit d9244aaf4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 133 additions and 33 deletions

View File

@ -56,6 +56,7 @@
#define TEXT_OPT_AUTO _("AUTO") #define TEXT_OPT_AUTO _("AUTO")
#define TEXT_OPT_HUD _("HUD") #define TEXT_OPT_HUD _("HUD")
#define TEXT_OPT_THREEPT _("THREE POINT") #define TEXT_OPT_THREEPT _("THREE POINT")
#define TEXT_OPT_DRAWDIST _("DRAW DISTANCE")
#define TEXT_OPT_APPLY _("APPLY") #define TEXT_OPT_APPLY _("APPLY")
#define TEXT_OPT_RESETWND _("RESET WINDOW") #define TEXT_OPT_RESETWND _("RESET WINDOW")
@ -120,6 +121,7 @@
#define TEXT_OPT_AUTO _("Auto") #define TEXT_OPT_AUTO _("Auto")
#define TEXT_OPT_HUD _("HUD") #define TEXT_OPT_HUD _("HUD")
#define TEXT_OPT_THREEPT _("Three-point") #define TEXT_OPT_THREEPT _("Three-point")
#define TEXT_OPT_DRAWDIST _("Draw Distance")
#define TEXT_OPT_APPLY _("Apply") #define TEXT_OPT_APPLY _("Apply")
#define TEXT_OPT_RESETWND _("Reset Window") #define TEXT_OPT_RESETWND _("Reset Window")

View File

@ -13,6 +13,9 @@
#include "game/object_list_processor.h" #include "game/object_list_processor.h"
#include "graph_node.h" #include "graph_node.h"
#include "surface_collision.h" #include "surface_collision.h"
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
// Macros for retrieving arguments from behavior scripts. // Macros for retrieving arguments from behavior scripts.
#define BHV_CMD_GET_1ST_U8(index) (u8)((gCurBhvCommand[index] >> 24) & 0xFF) // unused #define BHV_CMD_GET_1ST_U8(index) (u8)((gCurBhvCommand[index] >> 24) & 0xFF) // unused
@ -999,7 +1002,7 @@ void cur_obj_update(void) {
if (!(objFlags & OBJ_FLAG_ACTIVE_FROM_AFAR)) { if (!(objFlags & OBJ_FLAG_ACTIVE_FROM_AFAR)) {
// If the object has a render distance, check if it should be shown. // If the object has a render distance, check if it should be shown.
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (distanceFromMario > gCurrentObject->oDrawingDistance) { if (distanceFromMario > gCurrentObject->oDrawingDistance * configDrawDistance / 100.0f) {
// Out of render distance, hide the object. // Out of render distance, hide the object.
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
gCurrentObject->activeFlags |= ACTIVE_FLAG_FAR_AWAY; gCurrentObject->activeFlags |= ACTIVE_FLAG_FAR_AWAY;

View File

@ -14,6 +14,9 @@
#include "game/mario.h" #include "game/mario.h"
#include "game/object_list_processor.h" #include "game/object_list_processor.h"
#include "surface_load.h" #include "surface_load.h"
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
s32 unused8038BE90; s32 unused8038BE90;
@ -786,7 +789,7 @@ void load_object_collision_model(void) {
} }
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (marioDist < gCurrentObject->oDrawingDistance) { if (marioDist < gCurrentObject->oDrawingDistance * configDrawDistance / 100.0f) {
#endif #endif
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE; gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
// bub.c.inc // bub.c.inc
// NOTE: These first set of functions spawn a school of bub depending on objF4's // NOTE: These first set of functions spawn a school of bub depending on objF4's
@ -9,7 +13,7 @@ void bub_spawner_act_0(void) {
s32 i; s32 i;
s32 sp18 = o->oBirdChirpChirpUnkF4; s32 sp18 = o->oBirdChirpChirpUnkF4;
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 1500.0f) { if (o->oDistanceToMario < 15 * configDrawDistance) {
#endif #endif
for (i = 0; i < sp18; i++) for (i = 0; i < sp18; i++)
spawn_object(o, MODEL_BUB, bhvBub); spawn_object(o, MODEL_BUB, bhvBub);

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
/** /**
* Behavior for bhvChainChomp, bhvChainChompChainPart, bhvWoodenPost, and bhvChainChompGate. * Behavior for bhvChainChomp, bhvChainChompChainPart, bhvWoodenPost, and bhvChainChompGate.
@ -54,7 +58,7 @@ static void chain_chomp_act_uninitialized(void) {
s32 i; s32 i;
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 3000.0f) { if (o->oDistanceToMario < 30 * configDrawDistance) {
#endif #endif
segments = mem_pool_alloc(gObjectMemoryPool, 5 * sizeof(struct ChainSegment)); segments = mem_pool_alloc(gObjectMemoryPool, 5 * sizeof(struct ChainSegment));
if (segments != NULL) { if (segments != NULL) {
@ -364,7 +368,7 @@ static void chain_chomp_act_move(void) {
// Unload chain if mario is far enough // Unload chain if mario is far enough
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oChainChompReleaseStatus == CHAIN_CHOMP_NOT_RELEASED && o->oDistanceToMario > 4000.0f) { if (o->oChainChompReleaseStatus == CHAIN_CHOMP_NOT_RELEASED && o->oDistanceToMario > 40 * configDrawDistance) {
o->oAction = CHAIN_CHOMP_ACT_UNLOAD_CHAIN; o->oAction = CHAIN_CHOMP_ACT_UNLOAD_CHAIN;
o->oForwardVel = o->oVelY = 0.0f; o->oForwardVel = o->oVelY = 0.0f;
} else { } else {

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
/** /**
* Behavior for bhvCloud and bhvCloudPart. * Behavior for bhvCloud and bhvCloudPart.
@ -48,7 +52,7 @@ static void cloud_act_spawn_parts(void) {
*/ */
static void cloud_act_fwoosh_hidden(void) { static void cloud_act_fwoosh_hidden(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 2000.0f) { if (o->oDistanceToMario < 20 * configDrawDistance) {
#endif #endif
cur_obj_unhide(); cur_obj_unhide();
o->oAction = CLOUD_ACT_SPAWN_PARTS; o->oAction = CLOUD_ACT_SPAWN_PARTS;
@ -63,7 +67,7 @@ static void cloud_act_fwoosh_hidden(void) {
*/ */
static void cloud_fwoosh_update(void) { static void cloud_fwoosh_update(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario > 2500.0f) { if (o->oDistanceToMario > 25 * configDrawDistance) {
o->oAction = CLOUD_ACT_UNLOAD; o->oAction = CLOUD_ACT_UNLOAD;
} else { } else {
#endif #endif

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
// coin.c.inc // coin.c.inc
struct ObjectHitbox sYellowCoinHitbox = { struct ObjectHitbox sYellowCoinHitbox = {
@ -185,7 +189,7 @@ void bhv_coin_formation_loop(void) {
switch (o->oAction) { switch (o->oAction) {
case 0: case 0:
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 2000.0f) { if (o->oDistanceToMario < 20 * configDrawDistance) {
#endif #endif
for (bitIndex = 0; bitIndex < 8; bitIndex++) { for (bitIndex = 0; bitIndex < 8; bitIndex++) {
if (!(o->oCoinUnkF4 & (1 << bitIndex))) if (!(o->oCoinUnkF4 & (1 << bitIndex)))
@ -198,7 +202,7 @@ void bhv_coin_formation_loop(void) {
break; break;
case 1: case 1:
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario > 2100.0f) if (o->oDistanceToMario > 21 * configDrawDistance)
o->oAction++; o->oAction++;
#endif #endif
break; break;

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
/** /**
* Behavior for bhvEnemyLakitu. * Behavior for bhvEnemyLakitu.
@ -25,7 +29,7 @@ static struct ObjectHitbox sEnemyLakituHitbox = {
*/ */
static void enemy_lakitu_act_uninitialized(void) { static void enemy_lakitu_act_uninitialized(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 2000.0f) { if (o->oDistanceToMario < 20 * configDrawDistance) {
#endif #endif
spawn_object_relative_with_scale(CLOUD_BP_LAKITU_CLOUD, 0, 0, 0, 2.0f, o, MODEL_MIST, bhvCloud); spawn_object_relative_with_scale(CLOUD_BP_LAKITU_CLOUD, 0, 0, 0, 2.0f, o, MODEL_MIST, bhvCloud);

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
/** /**
* @file fish.inc.c * @file fish.inc.c
* Implements behaviour and spawning for fish located in the Secret Aquarium and other levels. * Implements behaviour and spawning for fish located in the Secret Aquarium and other levels.
@ -43,7 +47,7 @@ void fish_act_spawn(void) {
* Fish moves at random with a max-range of 700.0f. * Fish moves at random with a max-range of 700.0f.
*/ */
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < minDistToMario || gCurrLevelNum == LEVEL_SA) { if (o->oDistanceToMario < minDistToMario * configDrawDistance / 100 || gCurrLevelNum == LEVEL_SA) {
#endif #endif
for (i = 0; i < schoolQuantity; i++) { for (i = 0; i < schoolQuantity; i++) {
fishObject = spawn_object(o, model, bhvFish); fishObject = spawn_object(o, model, bhvFish);
@ -64,7 +68,7 @@ void fish_act_spawn(void) {
void fish_act_respawn(void) { void fish_act_respawn(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (gCurrLevelNum != LEVEL_SA) { if (gCurrLevelNum != LEVEL_SA) {
if (gMarioObject->oPosY - o->oPosY > 2000.0f) { if (gMarioObject->oPosY - o->oPosY > 20 * configDrawDistance) {
o->oAction = FISH_ACT_RESPAWN; o->oAction = FISH_ACT_RESPAWN;
} }
} }

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
/** /**
* Behavior for bhvGoomba and bhvGoombaTripletSpawner, * Behavior for bhvGoomba and bhvGoombaTripletSpawner,
@ -79,7 +83,7 @@ void bhv_goomba_triplet_spawner_update(void) {
// spawn them // spawn them
if (o->oAction == GOOMBA_TRIPLET_SPAWNER_ACT_UNLOADED) { if (o->oAction == GOOMBA_TRIPLET_SPAWNER_ACT_UNLOADED) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 3000.0f) { if (o->oDistanceToMario < 30 * configDrawDistance) {
#endif #endif
// The spawner is capable of spawning more than 3 goombas, but this // The spawner is capable of spawning more than 3 goombas, but this
// is not used in the game // is not used in the game
@ -102,7 +106,7 @@ void bhv_goomba_triplet_spawner_update(void) {
o->oAction += 1; o->oAction += 1;
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
} }
} else if (o->oDistanceToMario > 4000.0f) { } else if (o->oDistanceToMario > 40 * configDrawDistance) {
// If mario is too far away, enter the unloaded action. The goombas // If mario is too far away, enter the unloaded action. The goombas
// will detect this and unload themselves // will detect this and unload themselves
o->oAction = GOOMBA_TRIPLET_SPAWNER_ACT_UNLOADED; o->oAction = GOOMBA_TRIPLET_SPAWNER_ACT_UNLOADED;

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
// heave_ho.c.inc // heave_ho.c.inc
s16 D_8032F460[][2] = { { 30, 0 }, { 42, 1 }, { 52, 0 }, { 64, 1 }, { 74, 0 }, s16 D_8032F460[][2] = { { 30, 0 }, { 42, 1 }, { 52, 0 }, { 64, 1 }, { 74, 0 },
@ -73,7 +77,7 @@ void heave_ho_act_3(void) {
void heave_ho_act_0(void) { void heave_ho_act_0(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (find_water_level(o->oPosX, o->oPosZ) < o->oPosY && o->oDistanceToMario < 4000.0f) { if (find_water_level(o->oPosX, o->oPosZ) < o->oPosY && o->oDistanceToMario < 40 * configDrawDistance) {
#else #else
if (find_water_level(o->oPosX, o->oPosZ) < (o->oPosY - 50.0f)) { if (find_water_level(o->oPosX, o->oPosZ) < (o->oPosY - 50.0f)) {
#endif #endif

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
// king_bobomb.c.inc // king_bobomb.c.inc
// Copy of geo_update_projectile_pos_from_parent // Copy of geo_update_projectile_pos_from_parent
@ -296,7 +300,7 @@ void king_bobomb_move(void) {
cur_obj_call_action_function(sKingBobombActions); cur_obj_call_action_function(sKingBobombActions);
exec_anim_sound_state(sKingBobombSoundStates); exec_anim_sound_state(sKingBobombSoundStates);
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 5000.0f) if (o->oDistanceToMario < 50 * configDrawDistance)
#endif #endif
cur_obj_enable_rendering(); cur_obj_enable_rendering();
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE

View File

@ -1,5 +1,9 @@
// lll_floating_wood_piece.c.inc // lll_floating_wood_piece.c.inc
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
void bhv_lll_wood_piece_loop(void) { void bhv_lll_wood_piece_loop(void) {
if (o->oTimer == 0) if (o->oTimer == 0)
o->oPosY -= 100.0f; o->oPosY -= 100.0f;
@ -15,7 +19,7 @@ void bhv_lll_floating_wood_bridge_loop(void) {
switch (o->oAction) { switch (o->oAction) {
case 0: case 0:
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 2500.0f) { if (o->oDistanceToMario < 25 * configDrawDistance) {
#endif #endif
for (i = 1; i < 4; i++) { for (i = 1; i < 4; i++) {
sp3C = spawn_object_relative(0, (i - 2) * 300, 0, 0, o, MODEL_LLL_WOOD_BRIDGE, sp3C = spawn_object_relative(0, (i - 2) * 300, 0, 0, o, MODEL_LLL_WOOD_BRIDGE,
@ -29,7 +33,7 @@ void bhv_lll_floating_wood_bridge_loop(void) {
break; break;
case 1: case 1:
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario > 2600.0f) if (o->oDistanceToMario > 26 * configDrawDistance)
o->oAction = 2; o->oAction = 2;
#endif #endif
break; break;

View File

@ -1,5 +1,9 @@
// lll_rotating_hex_flame.c.inc // lll_rotating_hex_flame.c.inc
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
void bhv_lll_rotating_hex_flame_loop(void) { void bhv_lll_rotating_hex_flame_loop(void) {
f32 sp24 = o->oLllRotatingHexFlameUnkF4; f32 sp24 = o->oLllRotatingHexFlameUnkF4;
f32 sp20 = o->oLllRotatingHexFlameUnkF8; f32 sp20 = o->oLllRotatingHexFlameUnkF8;
@ -31,7 +35,7 @@ void fire_bar_spawn_flames(s16 a0) {
void fire_bar_act_0(void) { void fire_bar_act_0(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 3000.0f) if (o->oDistanceToMario < 30 * configDrawDistance)
#endif #endif
o->oAction = 1; o->oAction = 1;
} }
@ -48,7 +52,7 @@ void fire_bar_act_2(void) {
o->oAngleVelYaw = -0x100; o->oAngleVelYaw = -0x100;
o->oMoveAngleYaw += o->oAngleVelYaw; o->oMoveAngleYaw += o->oAngleVelYaw;
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario > 3200.0f) if (o->oDistanceToMario > 32 * configDrawDistance)
o->oAction = 3; o->oAction = 3;
#endif #endif
} }

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
/** /**
* Behavior for bhvPiranhaPlant. * Behavior for bhvPiranhaPlant.
* This controls Piranha Plants, which alternate between sleeping, attacking, * This controls Piranha Plants, which alternate between sleeping, attacking,
@ -331,7 +335,7 @@ void bhv_piranha_plant_loop(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
// In WF, hide all Piranha Plants once high enough up. // In WF, hide all Piranha Plants once high enough up.
if (gCurrLevelNum == LEVEL_WF) { if (gCurrLevelNum == LEVEL_WF) {
if (gMarioObject->oPosY > 3400.0f) if (gMarioObject->oPosY > 34 * configDrawDistance)
cur_obj_hide(); cur_obj_hide();
else else
cur_obj_unhide(); cur_obj_unhide();

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
/** /**
* Behavior for bhvPokey and bhvPokeyBodyPart. * Behavior for bhvPokey and bhvPokeyBodyPart.
@ -152,7 +156,7 @@ static void pokey_act_uninitialized(void) {
s16 partModel; s16 partModel;
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 2000.0f) { if (o->oDistanceToMario < 20 * configDrawDistance) {
#endif #endif
partModel = MODEL_POKEY_HEAD; partModel = MODEL_POKEY_HEAD;
@ -190,7 +194,7 @@ static void pokey_act_wander(void) {
if (o->oPokeyNumAliveBodyParts == 0) { if (o->oPokeyNumAliveBodyParts == 0) {
obj_mark_for_deletion(o); obj_mark_for_deletion(o);
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
} else if (o->oDistanceToMario > 2500.0f) { } else if (o->oDistanceToMario > 25 * configDrawDistance) {
o->oAction = POKEY_ACT_UNLOAD_PARTS; o->oAction = POKEY_ACT_UNLOAD_PARTS;
o->oForwardVel = 0.0f; o->oForwardVel = 0.0f;
#endif #endif

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
// sl_walking_penguin.c.inc // sl_walking_penguin.c.inc
struct SLWalkingPenguinStep { struct SLWalkingPenguinStep {
@ -98,7 +102,7 @@ void bhv_sl_walking_penguin_loop(void) {
cur_obj_move_standard(-78); cur_obj_move_standard(-78);
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (!cur_obj_hide_if_mario_far_away_y(1000.0f)) if (!cur_obj_hide_if_mario_far_away_y(10 * configDrawDistance))
#endif #endif
play_penguin_walking_sound(PENGUIN_WALK_BIG); play_penguin_walking_sound(PENGUIN_WALK_BIG);

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
/** /**
* Behavior file for bhvSnufit and bhvSnufitBalls. * Behavior file for bhvSnufit and bhvSnufitBalls.
* Snufits are present in HMC and CotMC, and are the fly guy * Snufits are present in HMC and CotMC, and are the fly guy
@ -181,7 +185,7 @@ void bhv_snufit_balls_loop(void) {
// If far from Mario or in a different room, despawn. // If far from Mario or in a different room, despawn.
if ((o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM) if ((o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM)
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
|| (o->oTimer != 0 && o->oDistanceToMario > 1500.0f) || (o->oTimer != 0 && o->oDistanceToMario > 15 * configDrawDistance)
#endif #endif
){ ){
obj_mark_for_deletion(o); obj_mark_for_deletion(o);

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
struct TripletButterflyActivationData { struct TripletButterflyActivationData {
s32 model; s32 model;
const BehaviorScript *behavior; const BehaviorScript *behavior;
@ -55,7 +59,7 @@ static void triplet_butterfly_act_init(void) {
static void triplet_butterfly_act_wander(void) { static void triplet_butterfly_act_wander(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario > 1500.0f) { if (o->oDistanceToMario > 15 * configDrawDistance) {
obj_mark_for_deletion(o); obj_mark_for_deletion(o);
} else { } else {
#endif #endif

View File

@ -1,5 +1,9 @@
// water_bomb_cannon.inc.c // water_bomb_cannon.inc.c
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
void bhv_bubble_cannon_barrel_loop(void) { void bhv_bubble_cannon_barrel_loop(void) {
struct Object *val04; struct Object *val04;
@ -39,7 +43,7 @@ void bhv_bubble_cannon_barrel_loop(void) {
void water_bomb_cannon_act_0(void) { void water_bomb_cannon_act_0(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 2000.0f) { if (o->oDistanceToMario < 20 * configDrawDistance) {
#endif #endif
spawn_object(o, MODEL_CANNON_BARREL, bhvCannonBarrelBubbles); spawn_object(o, MODEL_CANNON_BARREL, bhvCannonBarrelBubbles);
cur_obj_unhide(); cur_obj_unhide();
@ -53,7 +57,7 @@ void water_bomb_cannon_act_0(void) {
void water_bomb_cannon_act_1(void) { void water_bomb_cannon_act_1(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario > 2500.0f) { if (o->oDistanceToMario > 25 * configDrawDistance) {
o->oAction = 2; o->oAction = 2;
} else if (o->oBehParams2ndByte == 0) { } else if (o->oBehParams2ndByte == 0) {
#else #else

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
// whirlpool.c.inc // whirlpool.c.inc
static struct ObjectHitbox sWhirlpoolHitbox = { static struct ObjectHitbox sWhirlpoolHitbox = {
@ -36,7 +40,7 @@ void whirpool_orient_graph(void) {
void bhv_whirlpool_loop(void) { void bhv_whirlpool_loop(void) {
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 5000.0f) { if (o->oDistanceToMario < 50 * configDrawDistance) {
#endif #endif
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;

View File

@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
// whomp.c.inc // whomp.c.inc
void whomp_play_sfx_from_pound_animation(void) { void whomp_play_sfx_from_pound_animation(void) {
@ -250,9 +254,9 @@ void bhv_whomp_loop(void) {
// o->oBehParams2ndByte here seems to be a flag // o->oBehParams2ndByte here seems to be a flag
// indicating whether this is a normal or king whomp // indicating whether this is a normal or king whomp
if (o->oBehParams2ndByte != 0) if (o->oBehParams2ndByte != 0)
cur_obj_hide_if_mario_far_away_y(2000.0f); cur_obj_hide_if_mario_far_away_y(20 * configDrawDistance);
else else
cur_obj_hide_if_mario_far_away_y(1000.0f); cur_obj_hide_if_mario_far_away_y(10 * configDrawDistance);
#endif #endif
load_object_collision_model(); load_object_collision_model();
} }

View File

@ -27,6 +27,9 @@
#include "obj_behaviors.h" #include "obj_behaviors.h"
#include "object_helpers.h" #include "object_helpers.h"
#include "object_list_processor.h" #include "object_list_processor.h"
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif
#include "rendering_graph_node.h" #include "rendering_graph_node.h"
#include "save_file.h" #include "save_file.h"
#include "spawn_object.h" #include "spawn_object.h"
@ -531,7 +534,7 @@ void set_object_visibility(struct Object *obj, s32 dist) {
f32 objZ = obj->oPosZ; f32 objZ = obj->oPosZ;
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE
if (is_point_within_radius_of_mario(objX, objY, objZ, dist) == TRUE) { if (is_point_within_radius_of_mario(objX, objY, objZ, dist * configDrawDistance / 100) == TRUE) {
#endif #endif
obj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; obj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
#ifndef NODRAWINGDISTANCE #ifndef NODRAWINGDISTANCE

View File

@ -85,6 +85,7 @@ static const u8 optsVideoStr[][32] = {
{ TEXT_OPT_AUTO }, { TEXT_OPT_AUTO },
{ TEXT_OPT_HUD }, { TEXT_OPT_HUD },
{ TEXT_OPT_THREEPT }, { TEXT_OPT_THREEPT },
{ TEXT_OPT_DRAWDIST },
{ TEXT_OPT_APPLY }, { TEXT_OPT_APPLY },
}; };
@ -261,8 +262,11 @@ static struct Option optsVideo[] = {
DEF_OPT_TOGGLE( optsVideoStr[5], &configWindow.vsync ), DEF_OPT_TOGGLE( optsVideoStr[5], &configWindow.vsync ),
DEF_OPT_CHOICE( optsVideoStr[1], &configFiltering, filterChoices ), DEF_OPT_CHOICE( optsVideoStr[1], &configFiltering, filterChoices ),
DEF_OPT_TOGGLE( optsVideoStr[7], &configHUD ), DEF_OPT_TOGGLE( optsVideoStr[7], &configHUD ),
#ifndef NODRAWINGDISTANCE
DEF_OPT_SCROLL( optsVideoStr[9], &configDrawDistance, 50, 509, 10 ),
#endif
DEF_OPT_BUTTON( optsVideoStr[4], optvideo_reset_window ), DEF_OPT_BUTTON( optsVideoStr[4], optvideo_reset_window ),
DEF_OPT_BUTTON( optsVideoStr[9], optvideo_apply ), DEF_OPT_BUTTON( optsVideoStr[10], optvideo_apply ),
}; };
static struct Option optsAudio[] = { static struct Option optsAudio[] = {

View File

@ -90,6 +90,9 @@ bool configCameraMouse = false;
#endif #endif
bool configSkipIntro = 0; bool configSkipIntro = 0;
bool configHUD = true; bool configHUD = true;
#ifndef NODRAWINGDISTANCE
unsigned int configDrawDistance = 100;
#endif
#ifdef DISCORDRPC #ifdef DISCORDRPC
bool configDiscordRPC = true; bool configDiscordRPC = true;
#endif #endif
@ -102,6 +105,9 @@ static const struct ConfigOption options[] = {
{.name = "window_h", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.h}, {.name = "window_h", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.h},
{.name = "vsync", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.vsync}, {.name = "vsync", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.vsync},
{.name = "texture_filtering", .type = CONFIG_TYPE_UINT, .uintValue = &configFiltering}, {.name = "texture_filtering", .type = CONFIG_TYPE_UINT, .uintValue = &configFiltering},
#ifndef NODRAWINGDISTANCE
{.name = "drawing_distance", .type = CONFIG_TYPE_UINT, .uintValue = &configDrawDistance},
#endif
{.name = "master_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMasterVolume}, {.name = "master_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMasterVolume},
{.name = "music_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMusicVolume}, {.name = "music_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMusicVolume},
{.name = "sfx_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configSfxVolume}, {.name = "sfx_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configSfxVolume},

View File

@ -55,6 +55,9 @@ extern bool configCameraMouse;
extern bool configCameraAnalog; extern bool configCameraAnalog;
#endif #endif
extern bool configHUD; extern bool configHUD;
#ifndef NODRAWINGDISTANCE
extern unsigned int configDrawDistance;
#endif
extern bool configSkipIntro; extern bool configSkipIntro;
#ifdef DISCORDRPC #ifdef DISCORDRPC
extern bool configDiscordRPC; extern bool configDiscordRPC;