Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/text_options_strings.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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")

Expand Down
5 changes: 4 additions & 1 deletion src/engine/behavior_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion src/engine/surface_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/game/behaviors/bub.inc.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions src/game/behaviors/chain_chomp.inc.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif


/**
* Behavior for bhvChainChomp, bhvChainChompChainPart, bhvWoodenPost, and bhvChainChompGate.
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 6 additions & 2 deletions src/game/behaviors/cloud.inc.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif


/**
* Behavior for bhvCloud and bhvCloudPart.
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/game/behaviors/coin.inc.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif

// coin.c.inc

struct ObjectHitbox sYellowCoinHitbox = {
Expand Down Expand Up @@ -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)))
Expand All @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion src/game/behaviors/enemy_lakitu.inc.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif


/**
* Behavior for bhvEnemyLakitu.
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 6 additions & 2 deletions src/game/behaviors/fish.inc.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/game/behaviors/goomba.inc.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif


/**
* Behavior for bhvGoomba and bhvGoombaTripletSpawner,
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion src/game/behaviors/heave_ho.inc.c
Original file line number Diff line number Diff line change
@@ -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 },
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/game/behaviors/king_bobomb.inc.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif

// king_bobomb.c.inc

// Copy of geo_update_projectile_pos_from_parent
Expand Down Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/game/behaviors/lll_floating_wood_piece.inc.c
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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,
Expand All @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions src/game/behaviors/lll_rotating_hex_flame.inc.c
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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
}
Expand Down
6 changes: 5 additions & 1 deletion src/game/behaviors/piranha_plant.inc.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif

/**
* Behavior for bhvPiranhaPlant.
* This controls Piranha Plants, which alternate between sleeping, attacking,
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions src/game/behaviors/pokey.inc.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif


/**
* Behavior for bhvPokey and bhvPokeyBodyPart.
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/game/behaviors/sl_walking_penguin.inc.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef NODRAWINGDISTANCE
#include "pc/configfile.h"
#endif

// sl_walking_penguin.c.inc

struct SLWalkingPenguinStep {
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 5 additions & 1 deletion src/game/behaviors/snufit.inc.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand Down
Loading