tr2/option: add fov to the graphic options

Resolves #2728.
This commit is contained in:
Marcin Kurczewski 2025-04-13 00:13:00 +02:00
parent 3b53c07f82
commit 57a9fa668a
No known key found for this signature in database
GPG key ID: CC65E6FD28CAE42A
3 changed files with 28 additions and 0 deletions

View file

@ -474,8 +474,10 @@
"DETAIL_FLOAT_FMT": "%.1f",
"DETAIL_FOG_END": "Fog end",
"DETAIL_FOG_START": "Fog start",
"DETAIL_FOV": "Field of view",
"DETAIL_INTEGER_FMT": "%d",
"DETAIL_TITLE": "Graphic Options",
"DETAIL_USE_PSX_FOV": "Use PSX FOV",
"DETAIL_WATER_COLOR_B": "Water color (B)",
"DETAIL_WATER_COLOR_G": "Water color (G)",
"DETAIL_WATER_COLOR_R": "Water color (R)",

View file

@ -42,3 +42,5 @@ GS_DEFINE(OSD_HARDWARE_RENDERING, "Hardware rendering")
GS_DEFINE(OSD_SOFTWARE_RENDERING, "Software rendering")
GS_DEFINE(OSD_PERSPECTIVE_FILTER_ON, "Perspective correction: on")
GS_DEFINE(OSD_PERSPECTIVE_FILTER_OFF, "Perspective correction: off")
GS_DEFINE(DETAIL_FOV, "Field of view")
GS_DEFINE(DETAIL_USE_PSX_FOV, "Use PSX FOV")

View file

@ -104,6 +104,22 @@ static M_OPTION m_Options[] = {
.misc = 2,
},
{
.option_type = COT_INT32,
.label_id = GS_ID(DETAIL_FOV),
.target = &g_Config.visuals.fov,
.min_value = 30,
.max_value = 150,
.delta_slow = 1,
.delta_fast = 10,
},
{
.option_type = COT_BOOL,
.label_id = GS_ID(DETAIL_USE_PSX_FOV),
.target = &g_Config.visuals.use_psx_fov,
},
{
.target = nullptr,
},
@ -166,6 +182,9 @@ static char *M_FormatRowValue(const int32_t row_idx)
{
const M_OPTION *const option = &m_Options[row_idx];
switch (option->option_type) {
case COT_BOOL:
return String_Format(
"%s", *(bool *)option->target ? GS(MISC_ON) : GS(MISC_OFF));
case COT_INT32:
return String_Format(
GS(DETAIL_INTEGER_FMT), *(int32_t *)option->target);
@ -183,6 +202,8 @@ static bool M_CanChangeValue(const int32_t row_idx, const int32_t dir)
{
const M_OPTION *const option = &m_Options[row_idx];
switch (option->option_type) {
case COT_BOOL:
return true;
case COT_INT32:
if (dir < 0) {
return *(int32_t *)option->target > option->min_value;
@ -220,6 +241,9 @@ static bool M_RequestChangeValue(
delta *= dir;
switch (option->option_type) {
case COT_BOOL:
*(bool *)option->target = !*(bool *)option->target;
break;
case COT_INT32:
*(int32_t *)option->target += delta;
break;