AMFP Enhanced
C++ reference: the code this unofficial fork added
Toggle main menu visibility
Loading...
Searching...
No Matches
LuxScriptedMotion.h
Go to the documentation of this file.
1
/*
2
* AMFP-2026: scaling for camera effects that map scripts trigger (image trail, radial blur,
3
* screen shake, FOV/aspect multiplier, roll), to reduce motion sickness. Pure functions,
4
* unit tested in tests/cpp/test_scripted_motion.cpp.
5
*/
6
#ifndef LUX_SCRIPTED_MOTION_H
7
#define LUX_SCRIPTED_MOTION_H
8
9
#include <cstring>
10
11
enum
eLuxScriptedMotion
12
{
13
eLuxScriptedMotion_Full
,
14
eLuxScriptedMotion_Reduced
,
15
eLuxScriptedMotion_Off
,
16
17
eLuxScriptedMotion_LastEnum
18
};
19
20
/** 1 = stock strength, 0 = no effect. Unknown levels fall back to stock. */
21
inline
float
LuxScriptedMotionScale
(
int
alLevel)
22
{
23
switch
(alLevel)
24
{
25
case
eLuxScriptedMotion_Reduced
:
return
0.35f;
26
case
eLuxScriptedMotion_Off
:
return
0.0f;
27
default
:
return
1.0f;
28
}
29
}
30
31
/** Effects whose neutral value is 0 (trail amount, blur size, shake amount, roll angle). */
32
inline
float
LuxScaleEffectAmount
(
float
afAmount,
float
afScale)
33
{
34
return
afAmount * afScale;
35
}
36
37
/** Effects whose neutral value is 1 (FOV and aspect multipliers). */
38
inline
float
LuxScaleEffectMul
(
float
afMul,
float
afScale)
39
{
40
return
1.0f + (afMul - 1.0f) * afScale;
41
}
42
43
static
const
char
*
const
gvLuxScriptedMotionNames
[
eLuxScriptedMotion_LastEnum
] = {
"Full"
,
"Reduced"
,
"Off"
};
44
45
inline
const
char
*
LuxScriptedMotionToString
(
int
alLevel)
46
{
47
if
(alLevel < 0 || alLevel >=
eLuxScriptedMotion_LastEnum
)
return
gvLuxScriptedMotionNames
[0];
48
return
gvLuxScriptedMotionNames
[alLevel];
49
}
50
51
inline
int
LuxScriptedMotionFromString
(
const
char
* asX)
52
{
53
for
(
int
i = 0; i <
eLuxScriptedMotion_LastEnum
; ++i)
54
if
(asX && std::strcmp(asX,
gvLuxScriptedMotionNames
[i]) == 0)
return
i;
55
return
eLuxScriptedMotion_Full
;
56
}
57
58
#endif
LuxScriptedMotionScale
float LuxScriptedMotionScale(int alLevel)
1 = stock strength, 0 = no effect.
Definition
LuxScriptedMotion.h:21
gvLuxScriptedMotionNames
static const char *const gvLuxScriptedMotionNames[eLuxScriptedMotion_LastEnum]
Definition
LuxScriptedMotion.h:43
LuxScaleEffectAmount
float LuxScaleEffectAmount(float afAmount, float afScale)
Effects whose neutral value is 0 (trail amount, blur size, shake amount, roll angle).
Definition
LuxScriptedMotion.h:32
eLuxScriptedMotion
eLuxScriptedMotion
Definition
LuxScriptedMotion.h:12
eLuxScriptedMotion_Full
@ eLuxScriptedMotion_Full
Definition
LuxScriptedMotion.h:13
eLuxScriptedMotion_LastEnum
@ eLuxScriptedMotion_LastEnum
Definition
LuxScriptedMotion.h:17
eLuxScriptedMotion_Off
@ eLuxScriptedMotion_Off
Definition
LuxScriptedMotion.h:15
eLuxScriptedMotion_Reduced
@ eLuxScriptedMotion_Reduced
Definition
LuxScriptedMotion.h:14
LuxScriptedMotionFromString
int LuxScriptedMotionFromString(const char *asX)
Definition
LuxScriptedMotion.h:51
LuxScaleEffectMul
float LuxScaleEffectMul(float afMul, float afScale)
Effects whose neutral value is 1 (FOV and aspect multipliers).
Definition
LuxScriptedMotion.h:38
LuxScriptedMotionToString
const char * LuxScriptedMotionToString(int alLevel)
Definition
LuxScriptedMotion.h:45
Game
src
game
LuxScriptedMotion.h
Generated by
1.18.0