config: clamp fog distances

This commit is contained in:
Marcin Kurczewski 2025-04-11 00:48:34 +02:00
parent 26f290e2b7
commit 741bdfe135
4 changed files with 18 additions and 5 deletions

View file

@ -204,6 +204,8 @@ void Config_DumpToJSON(JSON_OBJECT *root_obj)
void Config_Sanitize(void)
{
CLAMP(g_Config.gameplay.start_lara_hitpoints, 1, LARA_MAX_HITPOINTS);
CLAMP(g_Config.visuals.fog_start, 1, 100);
CLAMP(g_Config.visuals.fog_end, 1, 100);
CLAMP(g_Config.visuals.fov_value, 30, 150);
CLAMP(g_Config.gameplay.camera_speed, 1, 10);
CLAMP(g_Config.audio.music_volume, 0, 10);

View file

@ -137,6 +137,8 @@ void Config_Sanitize(void)
g_Config.rendering.fps = 30;
}
CLAMP(g_Config.visuals.fog_start, 1, 100);
CLAMP(g_Config.visuals.fog_end, 1, 100);
CLAMP(g_Config.visuals.fov, 30, 150);
CLAMP(g_Config.ui.bar_scale, 0.5, 2.0);
CLAMP(g_Config.ui.text_scale, 0.5, 2.0);

View file

@ -298,7 +298,7 @@ void Output_AddDynamicLight(
int32_t Output_GetFogStart(void)
{
return m_FogStart;
return MIN(m_FogStart, Output_GetFogEnd());
}
void Output_SetFogStart(const int32_t dist)

View file

@ -138,6 +138,17 @@ static bool M_CanChangeValue(const int32_t row_idx, const int32_t delta)
return false;
}
static void M_SyncRows(M_WIDGET *const self)
{
for (int32_t row_idx = 0; row_idx < self->row_count; row_idx++) {
M_ROW *const row = &self->rows[row_idx];
char *value_text = M_FormatRowValue(row_idx);
UI_Label_ChangeText(row->value_label, value_text);
Memory_Free(value_text);
}
M_DoLayout(self);
}
static bool M_RequestChangeValue(
M_WIDGET *const self, const int32_t row_idx, const int32_t delta)
{
@ -152,14 +163,12 @@ static bool M_RequestChangeValue(
default:
return false;
}
Config_Write();
M_ROW *const row = &self->rows[row_idx];
char *value_text = M_FormatRowValue(row_idx);
UI_Label_ChangeText(row->value_label, value_text);
UI_Label_SetVisible(row->arrow_left_label, M_CanChangeValue(row_idx, -1));
UI_Label_SetVisible(row->arrow_right_label, M_CanChangeValue(row_idx, +1));
Memory_Free(value_text);
Config_Write();
M_SyncRows(self);
return true;
}