AMFP Enhanced
C++ reference: the code this unofficial fork added
Toggle main menu visibility
Loading...
Searching...
No Matches
LuxPresets.h
Go to the documentation of this file.
1
/*
2
* AMFP-2026: Original / Modern presets for the 2026 options tab. Pure data, unit tested in
3
* tests/cpp/test_presets.cpp. The preset box only reflects the current values: picking a preset
4
* fills them in, changing any one of them afterwards shows Custom.
5
*/
6
#ifndef LUX_PRESETS_H
7
#define LUX_PRESETS_H
8
9
#include <cmath>
10
#include "
LuxComfort.h
"
11
#include "
LuxGuidance.h
"
12
#include "
LuxAutoSave.h
"
13
14
enum
eLuxPreset
15
{
16
eLuxPreset_Original
,
17
eLuxPreset_Modern
,
18
eLuxPreset_Custom
,
19
eLuxPreset_LastEnum
20
};
21
22
// HUD text size (hints, control prompts, objective line); subtitles keep their own size.
23
enum
eLuxHudText
{
eLuxHudText_Normal
,
eLuxHudText_Large
,
eLuxHudText_Larger
,
eLuxHudText_LastEnum
};
24
25
inline
float
LuxHudTextScale
(
int
alSize)
26
{
27
static
const
float
vScale[
eLuxHudText_LastEnum
] = { 1.0f, 1.2f, 1.4f };
28
return
alSize >= 0 && alSize <
eLuxHudText_LastEnum
? vScale[alSize] : 1.0f;
29
}
30
31
// New players start on Modern (user decision).
32
static
const
int
kLuxDefaultPreset
=
eLuxPreset_Modern
;
33
34
/** Modern's fog thickness: the cellar keeps 75 % of its brightness, the haze is gone. */
35
static
const
float
kLuxModernFogAmount
= 0.35f;
36
37
struct
cLuxPresetValues
38
{
39
bool
mbFixGuiAspect
;
40
bool
mbFixMouseScale
;
41
bool
mbReadableLoadingText
;
42
bool
mbSmoothShadows
;
43
bool
mbHDShadows
;
44
bool
mbControlsHud
;
45
bool
mbSmoothMouse
;
46
bool
mbJournalToast
;
// brief new hint / note rows
47
bool
mbPadLookAccel
;
// gamepad look acceleration
48
int
mlGuidance
;
// eLuxGuidance: objective line, stuck nudge, clue words
49
int
mlAutoSave
;
// eLuxAutoSave: extra autosaves (map change, timed)
50
bool
mbQuickTransitions
;
// shorter map-change fades, any key continues after a load
51
int
mlHudTextSize
;
// eLuxHudText
52
int
mlComfort
;
// eLuxComfortProfile (Custom never matches a preset)
53
int
mlTextureFilter
;
54
float
mfAnisotropy
;
55
int
mlShadowQuality
;
56
int
mlParallaxQuality
;
57
int
mlSSAOSamples
;
58
float
mfFogAmount
;
// global fog opacity, 1 = as the map has it (cWorld::SetFogAmount)
59
float
mfFogColor
;
// fog tint kept, 0 = neutral grey of the same brightness
60
};
61
62
inline
cLuxPresetValues
LuxPresetValues
(
int
alPreset)
63
{
64
cLuxPresetValues
v;
65
bool
bModern = alPreset ==
eLuxPreset_Modern
;
66
// Fixes and comfort: all on for Modern, stock for Original.
67
v.
mbFixGuiAspect
= bModern;
68
v.
mbFixMouseScale
= bModern;
69
v.
mbReadableLoadingText
= bModern;
70
v.
mbSmoothShadows
= bModern;
71
v.
mbHDShadows
= bModern;
72
v.
mbControlsHud
= bModern;
73
v.
mbSmoothMouse
= !bModern;
// stock smoothing lags the camera
74
v.
mbJournalToast
= bModern;
75
v.
mbPadLookAccel
= bModern;
76
v.
mlGuidance
= bModern ?
eLuxGuidance_Normal
:
eLuxGuidance_Off
;
77
v.
mlAutoSave
= bModern ?
eLuxAutoSave_Every10
:
eLuxAutoSave_Off
;
78
v.
mbQuickTransitions
= bModern;
79
v.
mlHudTextSize
= bModern ?
eLuxHudText_Large
:
eLuxHudText_Normal
;
80
v.
mlComfort
= bModern ?
eLuxComfort_Comfort
:
eLuxComfort_Original
;
// Comfort is the default (user decision)
81
// Graphics: stock defaults (LuxConfigHandler fallbacks) vs. the 2026 batch.
82
v.
mlTextureFilter
= bModern ? 2 : 1;
// trilinear : bilinear
83
v.
mfAnisotropy
= bModern ? 16.0f : 1.0f;
84
v.
mlShadowQuality
= bModern ? 2 : 1;
// high : medium
85
v.
mlParallaxQuality
= bModern ? 1 : 0;
// relief : simple
86
v.
mlSSAOSamples
= bModern ? 16 : 8;
87
v.
mfFogAmount
= bModern ?
kLuxModernFogAmount
: 1.0f;
// Modern: the blue haze thinned and neutral
88
v.
mfFogColor
= bModern ? 0.0f : 1.0f;
89
return
v;
90
}
91
92
inline
bool
LuxPresetMatches
(
const
cLuxPresetValues
& a,
const
cLuxPresetValues
& p,
float
afMaxAnisotropy)
93
{
94
float
fWantAniso = p.
mfAnisotropy
< afMaxAnisotropy ? p.
mfAnisotropy
: afMaxAnisotropy;
95
return
a.
mbFixGuiAspect
== p.
mbFixGuiAspect
&& a.
mbFixMouseScale
== p.
mbFixMouseScale
96
&& a.
mbReadableLoadingText
== p.
mbReadableLoadingText
&& a.
mbSmoothShadows
== p.
mbSmoothShadows
97
&& a.
mbHDShadows
== p.
mbHDShadows
&& a.
mbControlsHud
== p.
mbControlsHud
98
&& a.
mbSmoothMouse
== p.
mbSmoothMouse
99
&& a.
mbJournalToast
== p.
mbJournalToast
&& a.
mbPadLookAccel
== p.
mbPadLookAccel
100
&& a.
mlGuidance
== p.
mlGuidance
&& a.
mlAutoSave
== p.
mlAutoSave
&& a.
mbQuickTransitions
== p.
mbQuickTransitions
101
&& a.
mlHudTextSize
== p.
mlHudTextSize
102
&& a.
mlComfort
== p.
mlComfort
&& a.
mlTextureFilter
== p.
mlTextureFilter
103
&& a.
mfAnisotropy
== fWantAniso && a.
mlShadowQuality
== p.
mlShadowQuality
104
&& a.
mlParallaxQuality
== p.
mlParallaxQuality
&& a.
mlSSAOSamples
== p.
mlSSAOSamples
105
&& std::fabs(a.
mfFogAmount
- p.
mfFogAmount
) < 0.01f && std::fabs(a.
mfFogColor
- p.
mfFogColor
) < 0.01f;
106
}
107
108
/** afMaxAnisotropy: the highest anisotropy this GPU offers (Modern asks for 16x). */
109
inline
int
LuxDetectPreset
(
const
cLuxPresetValues
& aV,
float
afMaxAnisotropy = 16.0f)
110
{
111
if
(
LuxPresetMatches
(aV,
LuxPresetValues
(
eLuxPreset_Modern
), afMaxAnisotropy))
return
eLuxPreset_Modern
;
112
if
(
LuxPresetMatches
(aV,
LuxPresetValues
(
eLuxPreset_Original
), afMaxAnisotropy))
return
eLuxPreset_Original
;
113
return
eLuxPreset_Custom
;
114
}
115
116
#endif
LuxAutoSave.h
autosave and manual saves (Enhanced option "Autosave").
eLuxAutoSave_Off
@ eLuxAutoSave_Off
Definition
LuxAutoSave.h:22
eLuxAutoSave_Every10
@ eLuxAutoSave_Every10
Definition
LuxAutoSave.h:25
LuxComfort.h
the comfort pass (PLAN.md "Comfort pass").
eLuxComfort_Comfort
@ eLuxComfort_Comfort
Definition
LuxComfort.h:20
eLuxComfort_Original
@ eLuxComfort_Original
Definition
LuxComfort.h:18
LuxGuidance.h
gentle guidance, one Enhanced option with four levels (Modern = Normal): Off nothing extra (the origi...
eLuxGuidance_Normal
@ eLuxGuidance_Normal
Definition
LuxGuidance.h:22
eLuxGuidance_Off
@ eLuxGuidance_Off
Definition
LuxGuidance.h:20
LuxDetectPreset
int LuxDetectPreset(const cLuxPresetValues &aV, float afMaxAnisotropy=16.0f)
afMaxAnisotropy: the highest anisotropy this GPU offers (Modern asks for 16x).
Definition
LuxPresets.h:109
LuxHudTextScale
float LuxHudTextScale(int alSize)
Definition
LuxPresets.h:25
LuxPresetMatches
bool LuxPresetMatches(const cLuxPresetValues &a, const cLuxPresetValues &p, float afMaxAnisotropy)
Definition
LuxPresets.h:92
kLuxModernFogAmount
static const float kLuxModernFogAmount
Modern's fog thickness: the cellar keeps 75 % of its brightness, the haze is gone.
Definition
LuxPresets.h:35
kLuxDefaultPreset
static const int kLuxDefaultPreset
Definition
LuxPresets.h:32
eLuxHudText
eLuxHudText
Definition
LuxPresets.h:23
eLuxHudText_Normal
@ eLuxHudText_Normal
Definition
LuxPresets.h:23
eLuxHudText_LastEnum
@ eLuxHudText_LastEnum
Definition
LuxPresets.h:23
eLuxHudText_Large
@ eLuxHudText_Large
Definition
LuxPresets.h:23
eLuxHudText_Larger
@ eLuxHudText_Larger
Definition
LuxPresets.h:23
eLuxPreset
eLuxPreset
Definition
LuxPresets.h:15
eLuxPreset_Custom
@ eLuxPreset_Custom
Definition
LuxPresets.h:18
eLuxPreset_Modern
@ eLuxPreset_Modern
Definition
LuxPresets.h:17
eLuxPreset_Original
@ eLuxPreset_Original
Definition
LuxPresets.h:16
eLuxPreset_LastEnum
@ eLuxPreset_LastEnum
Definition
LuxPresets.h:19
LuxPresetValues
cLuxPresetValues LuxPresetValues(int alPreset)
Definition
LuxPresets.h:62
cLuxPresetValues
Definition
LuxPresets.h:38
cLuxPresetValues::mbControlsHud
bool mbControlsHud
Definition
LuxPresets.h:44
cLuxPresetValues::mbJournalToast
bool mbJournalToast
Definition
LuxPresets.h:46
cLuxPresetValues::mlSSAOSamples
int mlSSAOSamples
Definition
LuxPresets.h:57
cLuxPresetValues::mlParallaxQuality
int mlParallaxQuality
Definition
LuxPresets.h:56
cLuxPresetValues::mlTextureFilter
int mlTextureFilter
Definition
LuxPresets.h:53
cLuxPresetValues::mbSmoothMouse
bool mbSmoothMouse
Definition
LuxPresets.h:45
cLuxPresetValues::mlHudTextSize
int mlHudTextSize
Definition
LuxPresets.h:51
cLuxPresetValues::mbReadableLoadingText
bool mbReadableLoadingText
Definition
LuxPresets.h:41
cLuxPresetValues::mbQuickTransitions
bool mbQuickTransitions
Definition
LuxPresets.h:50
cLuxPresetValues::mfAnisotropy
float mfAnisotropy
Definition
LuxPresets.h:54
cLuxPresetValues::mbSmoothShadows
bool mbSmoothShadows
Definition
LuxPresets.h:42
cLuxPresetValues::mbFixGuiAspect
bool mbFixGuiAspect
Definition
LuxPresets.h:39
cLuxPresetValues::mbHDShadows
bool mbHDShadows
Definition
LuxPresets.h:43
cLuxPresetValues::mbFixMouseScale
bool mbFixMouseScale
Definition
LuxPresets.h:40
cLuxPresetValues::mlGuidance
int mlGuidance
Definition
LuxPresets.h:48
cLuxPresetValues::mlComfort
int mlComfort
Definition
LuxPresets.h:52
cLuxPresetValues::mfFogAmount
float mfFogAmount
Definition
LuxPresets.h:58
cLuxPresetValues::mfFogColor
float mfFogColor
Definition
LuxPresets.h:59
cLuxPresetValues::mbPadLookAccel
bool mbPadLookAccel
Definition
LuxPresets.h:47
cLuxPresetValues::mlShadowQuality
int mlShadowQuality
Definition
LuxPresets.h:55
cLuxPresetValues::mlAutoSave
int mlAutoSave
Definition
LuxPresets.h:49
Game
src
game
LuxPresets.h
Generated by
1.18.0