diff --git a/include/text_options_strings.h.in b/include/text_options_strings.h.in index 8c6732e4..3ba7cc8a 100644 --- a/include/text_options_strings.h.in +++ b/include/text_options_strings.h.in @@ -56,6 +56,7 @@ #define TEXT_OPT_AUTO _("AUTO") #define TEXT_OPT_HUD _("HUD") #define TEXT_OPT_THREEPT _("THREE POINT") +#define TEXT_OPT_DRAWDIST _("DRAW DISTANCE") #define TEXT_OPT_APPLY _("APPLY") #define TEXT_OPT_RESETWND _("RESET WINDOW") @@ -120,6 +121,7 @@ #define TEXT_OPT_AUTO _("Auto") #define TEXT_OPT_HUD _("HUD") #define TEXT_OPT_THREEPT _("Three-point") +#define TEXT_OPT_DRAWDIST _("Draw Distance") #define TEXT_OPT_APPLY _("Apply") #define TEXT_OPT_RESETWND _("Reset Window") diff --git a/src/engine/behavior_script.c b/src/engine/behavior_script.c index f61f2bf4..2848e977 100644 --- a/src/engine/behavior_script.c +++ b/src/engine/behavior_script.c @@ -13,6 +13,9 @@ #include "game/object_list_processor.h" #include "graph_node.h" #include "surface_collision.h" +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif // Macros for retrieving arguments from behavior scripts. #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 the object has a render distance, check if it should be shown. #ifndef NODRAWINGDISTANCE - if (distanceFromMario > gCurrentObject->oDrawingDistance) { + if (distanceFromMario > gCurrentObject->oDrawingDistance * configDrawDistance / 100.0f) { // Out of render distance, hide the object. gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; gCurrentObject->activeFlags |= ACTIVE_FLAG_FAR_AWAY; diff --git a/src/engine/surface_load.c b/src/engine/surface_load.c index ac2ee50c..c62ef003 100644 --- a/src/engine/surface_load.c +++ b/src/engine/surface_load.c @@ -14,6 +14,9 @@ #include "game/mario.h" #include "game/object_list_processor.h" #include "surface_load.h" +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif s32 unused8038BE90; @@ -786,7 +789,7 @@ void load_object_collision_model(void) { } #ifndef NODRAWINGDISTANCE - if (marioDist < gCurrentObject->oDrawingDistance) { + if (marioDist < gCurrentObject->oDrawingDistance * configDrawDistance / 100.0f) { #endif gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE; #ifndef NODRAWINGDISTANCE diff --git a/src/game/behaviors/bub.inc.c b/src/game/behaviors/bub.inc.c index 7bf71690..f8577d47 100644 --- a/src/game/behaviors/bub.inc.c +++ b/src/game/behaviors/bub.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + // bub.c.inc // 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 sp18 = o->oBirdChirpChirpUnkF4; #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 1500.0f) { + if (o->oDistanceToMario < 15 * configDrawDistance) { #endif for (i = 0; i < sp18; i++) spawn_object(o, MODEL_BUB, bhvBub); diff --git a/src/game/behaviors/chain_chomp.inc.c b/src/game/behaviors/chain_chomp.inc.c index 9b9c3423..4d0af942 100644 --- a/src/game/behaviors/chain_chomp.inc.c +++ b/src/game/behaviors/chain_chomp.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + /** * Behavior for bhvChainChomp, bhvChainChompChainPart, bhvWoodenPost, and bhvChainChompGate. @@ -54,7 +58,7 @@ static void chain_chomp_act_uninitialized(void) { s32 i; #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 3000.0f) { + if (o->oDistanceToMario < 30 * configDrawDistance) { #endif segments = mem_pool_alloc(gObjectMemoryPool, 5 * sizeof(struct ChainSegment)); if (segments != NULL) { @@ -364,7 +368,7 @@ static void chain_chomp_act_move(void) { // Unload chain if mario is far enough #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->oForwardVel = o->oVelY = 0.0f; } else { diff --git a/src/game/behaviors/cloud.inc.c b/src/game/behaviors/cloud.inc.c index c1d708bf..ec5f7a90 100644 --- a/src/game/behaviors/cloud.inc.c +++ b/src/game/behaviors/cloud.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + /** * Behavior for bhvCloud and bhvCloudPart. @@ -48,7 +52,7 @@ static void cloud_act_spawn_parts(void) { */ static void cloud_act_fwoosh_hidden(void) { #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 2000.0f) { + if (o->oDistanceToMario < 20 * configDrawDistance) { #endif cur_obj_unhide(); o->oAction = CLOUD_ACT_SPAWN_PARTS; @@ -63,7 +67,7 @@ static void cloud_act_fwoosh_hidden(void) { */ static void cloud_fwoosh_update(void) { #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario > 2500.0f) { + if (o->oDistanceToMario > 25 * configDrawDistance) { o->oAction = CLOUD_ACT_UNLOAD; } else { #endif diff --git a/src/game/behaviors/coin.inc.c b/src/game/behaviors/coin.inc.c index 9b7099de..5370f2d6 100644 --- a/src/game/behaviors/coin.inc.c +++ b/src/game/behaviors/coin.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + // coin.c.inc struct ObjectHitbox sYellowCoinHitbox = { @@ -185,7 +189,7 @@ void bhv_coin_formation_loop(void) { switch (o->oAction) { case 0: #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 2000.0f) { + if (o->oDistanceToMario < 20 * configDrawDistance) { #endif for (bitIndex = 0; bitIndex < 8; bitIndex++) { if (!(o->oCoinUnkF4 & (1 << bitIndex))) @@ -198,7 +202,7 @@ void bhv_coin_formation_loop(void) { break; case 1: #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario > 2100.0f) + if (o->oDistanceToMario > 21 * configDrawDistance) o->oAction++; #endif break; diff --git a/src/game/behaviors/enemy_lakitu.inc.c b/src/game/behaviors/enemy_lakitu.inc.c index cacd732f..72553dcc 100644 --- a/src/game/behaviors/enemy_lakitu.inc.c +++ b/src/game/behaviors/enemy_lakitu.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + /** * Behavior for bhvEnemyLakitu. @@ -25,7 +29,7 @@ static struct ObjectHitbox sEnemyLakituHitbox = { */ static void enemy_lakitu_act_uninitialized(void) { #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 2000.0f) { + if (o->oDistanceToMario < 20 * configDrawDistance) { #endif spawn_object_relative_with_scale(CLOUD_BP_LAKITU_CLOUD, 0, 0, 0, 2.0f, o, MODEL_MIST, bhvCloud); diff --git a/src/game/behaviors/fish.inc.c b/src/game/behaviors/fish.inc.c index d169ecf7..f9572725 100644 --- a/src/game/behaviors/fish.inc.c +++ b/src/game/behaviors/fish.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + /** * @file fish.inc.c * 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. */ #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < minDistToMario || gCurrLevelNum == LEVEL_SA) { + if (o->oDistanceToMario < minDistToMario * configDrawDistance / 100 || gCurrLevelNum == LEVEL_SA) { #endif for (i = 0; i < schoolQuantity; i++) { fishObject = spawn_object(o, model, bhvFish); @@ -64,7 +68,7 @@ void fish_act_spawn(void) { void fish_act_respawn(void) { #ifndef NODRAWINGDISTANCE if (gCurrLevelNum != LEVEL_SA) { - if (gMarioObject->oPosY - o->oPosY > 2000.0f) { + if (gMarioObject->oPosY - o->oPosY > 20 * configDrawDistance) { o->oAction = FISH_ACT_RESPAWN; } } diff --git a/src/game/behaviors/goomba.inc.c b/src/game/behaviors/goomba.inc.c index bf47dda1..6fce18b3 100644 --- a/src/game/behaviors/goomba.inc.c +++ b/src/game/behaviors/goomba.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + /** * Behavior for bhvGoomba and bhvGoombaTripletSpawner, @@ -79,7 +83,7 @@ void bhv_goomba_triplet_spawner_update(void) { // spawn them if (o->oAction == GOOMBA_TRIPLET_SPAWNER_ACT_UNLOADED) { #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 3000.0f) { + if (o->oDistanceToMario < 30 * configDrawDistance) { #endif // The spawner is capable of spawning more than 3 goombas, but this // is not used in the game @@ -102,7 +106,7 @@ void bhv_goomba_triplet_spawner_update(void) { o->oAction += 1; #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 // will detect this and unload themselves o->oAction = GOOMBA_TRIPLET_SPAWNER_ACT_UNLOADED; diff --git a/src/game/behaviors/heave_ho.inc.c b/src/game/behaviors/heave_ho.inc.c index 1a247607..1da0b243 100644 --- a/src/game/behaviors/heave_ho.inc.c +++ b/src/game/behaviors/heave_ho.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + // heave_ho.c.inc 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) { #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 if (find_water_level(o->oPosX, o->oPosZ) < (o->oPosY - 50.0f)) { #endif diff --git a/src/game/behaviors/king_bobomb.inc.c b/src/game/behaviors/king_bobomb.inc.c index 7942b2bb..6aec3d15 100644 --- a/src/game/behaviors/king_bobomb.inc.c +++ b/src/game/behaviors/king_bobomb.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + // king_bobomb.c.inc // Copy of geo_update_projectile_pos_from_parent @@ -296,7 +300,7 @@ void king_bobomb_move(void) { cur_obj_call_action_function(sKingBobombActions); exec_anim_sound_state(sKingBobombSoundStates); #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 5000.0f) + if (o->oDistanceToMario < 50 * configDrawDistance) #endif cur_obj_enable_rendering(); #ifndef NODRAWINGDISTANCE diff --git a/src/game/behaviors/lll_floating_wood_piece.inc.c b/src/game/behaviors/lll_floating_wood_piece.inc.c index 7994e2d9..9e28fca4 100644 --- a/src/game/behaviors/lll_floating_wood_piece.inc.c +++ b/src/game/behaviors/lll_floating_wood_piece.inc.c @@ -1,5 +1,9 @@ // lll_floating_wood_piece.c.inc +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + void bhv_lll_wood_piece_loop(void) { if (o->oTimer == 0) o->oPosY -= 100.0f; @@ -15,7 +19,7 @@ void bhv_lll_floating_wood_bridge_loop(void) { switch (o->oAction) { case 0: #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 2500.0f) { + if (o->oDistanceToMario < 25 * configDrawDistance) { #endif for (i = 1; i < 4; i++) { 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; case 1: #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario > 2600.0f) + if (o->oDistanceToMario > 26 * configDrawDistance) o->oAction = 2; #endif break; diff --git a/src/game/behaviors/lll_rotating_hex_flame.inc.c b/src/game/behaviors/lll_rotating_hex_flame.inc.c index fc707330..2c6bad00 100644 --- a/src/game/behaviors/lll_rotating_hex_flame.inc.c +++ b/src/game/behaviors/lll_rotating_hex_flame.inc.c @@ -1,5 +1,9 @@ // lll_rotating_hex_flame.c.inc +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + void bhv_lll_rotating_hex_flame_loop(void) { f32 sp24 = o->oLllRotatingHexFlameUnkF4; f32 sp20 = o->oLllRotatingHexFlameUnkF8; @@ -31,7 +35,7 @@ void fire_bar_spawn_flames(s16 a0) { void fire_bar_act_0(void) { #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 3000.0f) + if (o->oDistanceToMario < 30 * configDrawDistance) #endif o->oAction = 1; } @@ -48,7 +52,7 @@ void fire_bar_act_2(void) { o->oAngleVelYaw = -0x100; o->oMoveAngleYaw += o->oAngleVelYaw; #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario > 3200.0f) + if (o->oDistanceToMario > 32 * configDrawDistance) o->oAction = 3; #endif } diff --git a/src/game/behaviors/piranha_plant.inc.c b/src/game/behaviors/piranha_plant.inc.c index 328f4518..f59d27ce 100644 --- a/src/game/behaviors/piranha_plant.inc.c +++ b/src/game/behaviors/piranha_plant.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + /** * Behavior for bhvPiranhaPlant. * This controls Piranha Plants, which alternate between sleeping, attacking, @@ -331,7 +335,7 @@ void bhv_piranha_plant_loop(void) { #ifndef NODRAWINGDISTANCE // In WF, hide all Piranha Plants once high enough up. if (gCurrLevelNum == LEVEL_WF) { - if (gMarioObject->oPosY > 3400.0f) + if (gMarioObject->oPosY > 34 * configDrawDistance) cur_obj_hide(); else cur_obj_unhide(); diff --git a/src/game/behaviors/pokey.inc.c b/src/game/behaviors/pokey.inc.c index cfcc92c2..b19db8e6 100644 --- a/src/game/behaviors/pokey.inc.c +++ b/src/game/behaviors/pokey.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + /** * Behavior for bhvPokey and bhvPokeyBodyPart. @@ -152,7 +156,7 @@ static void pokey_act_uninitialized(void) { s16 partModel; #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 2000.0f) { + if (o->oDistanceToMario < 20 * configDrawDistance) { #endif partModel = MODEL_POKEY_HEAD; @@ -190,7 +194,7 @@ static void pokey_act_wander(void) { if (o->oPokeyNumAliveBodyParts == 0) { obj_mark_for_deletion(o); #ifndef NODRAWINGDISTANCE - } else if (o->oDistanceToMario > 2500.0f) { + } else if (o->oDistanceToMario > 25 * configDrawDistance) { o->oAction = POKEY_ACT_UNLOAD_PARTS; o->oForwardVel = 0.0f; #endif diff --git a/src/game/behaviors/sl_walking_penguin.inc.c b/src/game/behaviors/sl_walking_penguin.inc.c index 59428acb..0599a16c 100644 --- a/src/game/behaviors/sl_walking_penguin.inc.c +++ b/src/game/behaviors/sl_walking_penguin.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + // sl_walking_penguin.c.inc struct SLWalkingPenguinStep { @@ -98,7 +102,7 @@ void bhv_sl_walking_penguin_loop(void) { cur_obj_move_standard(-78); #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 play_penguin_walking_sound(PENGUIN_WALK_BIG); diff --git a/src/game/behaviors/snufit.inc.c b/src/game/behaviors/snufit.inc.c index 2acf442f..a740e277 100644 --- a/src/game/behaviors/snufit.inc.c +++ b/src/game/behaviors/snufit.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + /** * Behavior file for bhvSnufit and bhvSnufitBalls. * 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 ((o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM) #ifndef NODRAWINGDISTANCE - || (o->oTimer != 0 && o->oDistanceToMario > 1500.0f) + || (o->oTimer != 0 && o->oDistanceToMario > 15 * configDrawDistance) #endif ){ obj_mark_for_deletion(o); diff --git a/src/game/behaviors/triplet_butterfly.inc.c b/src/game/behaviors/triplet_butterfly.inc.c index 5f971854..6309b488 100644 --- a/src/game/behaviors/triplet_butterfly.inc.c +++ b/src/game/behaviors/triplet_butterfly.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + struct TripletButterflyActivationData { s32 model; const BehaviorScript *behavior; @@ -55,7 +59,7 @@ static void triplet_butterfly_act_init(void) { static void triplet_butterfly_act_wander(void) { #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario > 1500.0f) { + if (o->oDistanceToMario > 15 * configDrawDistance) { obj_mark_for_deletion(o); } else { #endif diff --git a/src/game/behaviors/water_bomb_cannon.inc.c b/src/game/behaviors/water_bomb_cannon.inc.c index fb82e43c..ae242fa8 100644 --- a/src/game/behaviors/water_bomb_cannon.inc.c +++ b/src/game/behaviors/water_bomb_cannon.inc.c @@ -1,5 +1,9 @@ // water_bomb_cannon.inc.c +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + void bhv_bubble_cannon_barrel_loop(void) { struct Object *val04; @@ -39,7 +43,7 @@ void bhv_bubble_cannon_barrel_loop(void) { void water_bomb_cannon_act_0(void) { #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 2000.0f) { + if (o->oDistanceToMario < 20 * configDrawDistance) { #endif spawn_object(o, MODEL_CANNON_BARREL, bhvCannonBarrelBubbles); cur_obj_unhide(); @@ -53,7 +57,7 @@ void water_bomb_cannon_act_0(void) { void water_bomb_cannon_act_1(void) { #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario > 2500.0f) { + if (o->oDistanceToMario > 25 * configDrawDistance) { o->oAction = 2; } else if (o->oBehParams2ndByte == 0) { #else diff --git a/src/game/behaviors/whirlpool.inc.c b/src/game/behaviors/whirlpool.inc.c index 5aebebd2..04f9c6cf 100644 --- a/src/game/behaviors/whirlpool.inc.c +++ b/src/game/behaviors/whirlpool.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + // whirlpool.c.inc static struct ObjectHitbox sWhirlpoolHitbox = { @@ -36,7 +40,7 @@ void whirpool_orient_graph(void) { void bhv_whirlpool_loop(void) { #ifndef NODRAWINGDISTANCE - if (o->oDistanceToMario < 5000.0f) { + if (o->oDistanceToMario < 50 * configDrawDistance) { #endif o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; diff --git a/src/game/behaviors/whomp.inc.c b/src/game/behaviors/whomp.inc.c index 1f3bcb7f..34c5a59f 100644 --- a/src/game/behaviors/whomp.inc.c +++ b/src/game/behaviors/whomp.inc.c @@ -1,3 +1,7 @@ +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif + // whomp.c.inc 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 // indicating whether this is a normal or king whomp 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 - cur_obj_hide_if_mario_far_away_y(1000.0f); + cur_obj_hide_if_mario_far_away_y(10 * configDrawDistance); #endif load_object_collision_model(); } diff --git a/src/game/obj_behaviors.c b/src/game/obj_behaviors.c index 601c45f1..369853ba 100644 --- a/src/game/obj_behaviors.c +++ b/src/game/obj_behaviors.c @@ -27,6 +27,9 @@ #include "obj_behaviors.h" #include "object_helpers.h" #include "object_list_processor.h" +#ifndef NODRAWINGDISTANCE +#include "pc/configfile.h" +#endif #include "rendering_graph_node.h" #include "save_file.h" #include "spawn_object.h" @@ -531,7 +534,7 @@ void set_object_visibility(struct Object *obj, s32 dist) { f32 objZ = obj->oPosZ; #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 obj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; #ifndef NODRAWINGDISTANCE diff --git a/src/game/options_menu.c b/src/game/options_menu.c index 56ebdebe..e6e4ca29 100644 --- a/src/game/options_menu.c +++ b/src/game/options_menu.c @@ -85,6 +85,7 @@ static const u8 optsVideoStr[][32] = { { TEXT_OPT_AUTO }, { TEXT_OPT_HUD }, { TEXT_OPT_THREEPT }, + { TEXT_OPT_DRAWDIST }, { TEXT_OPT_APPLY }, }; @@ -261,8 +262,11 @@ static struct Option optsVideo[] = { DEF_OPT_TOGGLE( optsVideoStr[5], &configWindow.vsync ), DEF_OPT_CHOICE( optsVideoStr[1], &configFiltering, filterChoices ), 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[9], optvideo_apply ), + DEF_OPT_BUTTON( optsVideoStr[10], optvideo_apply ), }; static struct Option optsAudio[] = { diff --git a/src/pc/configfile.c b/src/pc/configfile.c index 7411d4f8..2c7ce62c 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -90,6 +90,9 @@ bool configCameraMouse = false; #endif bool configSkipIntro = 0; bool configHUD = true; +#ifndef NODRAWINGDISTANCE +unsigned int configDrawDistance = 100; +#endif #ifdef DISCORDRPC bool configDiscordRPC = true; #endif @@ -102,6 +105,9 @@ static const struct ConfigOption options[] = { {.name = "window_h", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.h}, {.name = "vsync", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.vsync}, {.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 = "music_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMusicVolume}, {.name = "sfx_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configSfxVolume}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index b92ae7be..e20abf3a 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -55,6 +55,9 @@ extern bool configCameraMouse; extern bool configCameraAnalog; #endif extern bool configHUD; +#ifndef NODRAWINGDISTANCE +extern unsigned int configDrawDistance; +#endif extern bool configSkipIntro; #ifdef DISCORDRPC extern bool configDiscordRPC;