Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Richard Gobeille
EDuke32
Commits
66e13e45
Commit
66e13e45
authored
Feb 27, 2021
by
Richard Gobeille
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Duke3d: WIP automatic vertical aiming feature
parent
7ad8a1e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
20 deletions
+24
-20
source/duke3d/src/menus.cpp
source/duke3d/src/menus.cpp
+2
-1
source/duke3d/src/player.cpp
source/duke3d/src/player.cpp
+22
-19
No files found.
source/duke3d/src/menus.cpp
View file @
66e13e45
...
...
@@ -982,7 +982,7 @@ static MenuRangeInt32_t MEO_JOYSTICK_VIEW_CENTERING = MAKE_MENURANGE(&ud.config.
static
MenuEntry_t
ME_JOYSTICK_VIEW_CENTERING
=
MAKE_MENUENTRY
(
"View centering"
,
&
MF_Redfont
,
&
MEF_BigSliders
,
&
MEO_JOYSTICK_VIEW_CENTERING
,
RangeInt32
);
static
MenuOption_t
MEO_JOYSTICK_VIEW_LEVELING
=
MAKE_MENUOPTION
(
&
MF_Redfont
,
&
MEOS_NoYes
,
&
ud
.
config
.
JoystickViewLeveling
);
static
MenuEntry_t
ME_JOYSTICK_VIEW_LEVELING
=
MAKE_MENUENTRY
(
"V
iew leveling
:"
,
&
MF_Redfont
,
&
MEF_BigOptionsRt
,
&
MEO_JOYSTICK_VIEW_LEVELING
,
Option
);
static
MenuEntry_t
ME_JOYSTICK_VIEW_LEVELING
=
MAKE_MENUENTRY
(
"V
ertical aim assist
:"
,
&
MF_Redfont
,
&
MEF_BigOptionsRt
,
&
MEO_JOYSTICK_VIEW_LEVELING
,
Option
);
static
MenuEntry_t
*
MEL_JOYSTICKSETUP
[]
=
{
&
ME_JOYSTICK_ENABLE
,
...
...
@@ -2303,6 +2303,7 @@ static void Menu_Pre(MenuID_t cm)
MenuEntry_DisableOnCondition
(
&
ME_JOYSTICK_EDITBUTTONS
,
!
CONTROL_JoyPresent
||
(
joystick
.
numButtons
==
0
&&
joystick
.
numHats
==
0
));
MenuEntry_DisableOnCondition
(
&
ME_JOYSTICK_EDITAXES
,
!
CONTROL_JoyPresent
||
joystick
.
numAxes
==
0
);
MenuEntry_DisableOnCondition
(
&
ME_JOYSTICK_DEFAULTS
,
!
joystick
.
isGameController
);
MenuEntry_DisableOnCondition
(
&
ME_JOYSTICK_VIEW_LEVELING
,
!
ud
.
config
.
JoystickViewCentering
);
break
;
#ifndef EDUKE32_RETAIL_MENU
...
...
source/duke3d/src/player.cpp
View file @
66e13e45
...
...
@@ -3055,11 +3055,6 @@ void P_GetInput(int const playerNum)
}
CONTROL_ProcessBinds
();
int
noAimMode
=
0
;
if
(
ud
.
config
.
JoystickViewLeveling
&&
CONTROL_LastSeenInput
==
LastSeenInput
::
Joystick
)
noAimMode
=
1
;
if
(
ud
.
mouseaiming
)
g_myAimMode
=
BUTTON
(
gamefunc_Mouse_Aiming
);
...
...
@@ -3157,7 +3152,7 @@ void P_GetInput(int const playerNum)
input
.
svel
-=
lrint
(
scaleToInterval
(
info
.
dx
*
keyMove
/
analogExtent
));
input
.
fvel
-=
lrint
(
scaleToInterval
(
info
.
dz
*
keyMove
/
analogExtent
));
if
(
ud
.
config
.
JoystickViewCentering
&&
!
input
.
q16avel
&&
!
input
.
q16horz
&&
input
.
fvel
&&
CONTROL_LastSeenInput
==
LastSeenInput
::
Joystick
)
if
(
CONTROL_LastSeenInput
==
LastSeenInput
::
Joystick
&&
ud
.
config
.
JoystickViewCentering
&&
!
input
.
q16avel
&&
!
input
.
q16horz
&&
input
.
fvel
)
{
if
(
pPlayer
->
q16horiz
>=
F16
(
99
)
&&
pPlayer
->
q16horiz
<=
F16
(
100
))
thisPlayer
.
horizRecenter
=
true
;
...
...
@@ -3288,9 +3283,6 @@ void P_GetInput(int const playerNum)
localInput
.
bits
|=
BUTTON
(
gamefunc_Quick_Kick
)
<<
SK_QUICK_KICK
;
localInput
.
bits
|=
BUTTON
(
gamefunc_TurnAround
)
<<
SK_TURNAROUND
;
if
(
!
noAimMode
)
localInput
.
bits
|=
(
g_myAimMode
<<
SK_AIMMODE
);
localInput
.
bits
|=
(
g_gameQuit
<<
SK_GAMEQUIT
);
localInput
.
bits
|=
KB_KeyPressed
(
sc_Pause
)
<<
SK_PAUSE
;
localInput
.
bits
|=
((
uint32_t
)
KB_KeyPressed
(
sc_Escape
))
<<
SK_ESCAPE
;
...
...
@@ -3370,9 +3362,6 @@ void P_GetInput(int const playerNum)
pPlayer
->
return_to_center
=
0
;
thisPlayer
.
horizRecenter
=
false
;
}
if
(
pPlayer
->
q16horizoff
>=
F16
(
-
0.1
)
&&
pPlayer
->
q16horizoff
<=
F16
(
0.1
))
pPlayer
->
q16horizoff
=
0
;
}
// calculates automatic view angle for playing without a mouse
...
...
@@ -3393,16 +3382,30 @@ void P_GetInput(int const playerNum)
}
}
if
(
pPlayer
->
q16horizoff
>
0
)
int32_t
Zvel
,
shootAng
;
if
(
CONTROL_LastSeenInput
==
LastSeenInput
::
Joystick
&&
ud
.
config
.
JoystickViewCentering
&&
ud
.
config
.
JoystickViewLeveling
&&
GetAutoAimAng
(
pPlayer
->
i
,
playerNum
,
0
,
8
<<
8
,
0
+
2
,
&
pPlayer
->
pos
,
256
,
&
Zvel
,
&
shootAng
)
!=
-
1
)
{
pPlayer
->
q16horizoff
=
fix16_ssub
(
pPlayer
->
q16horizoff
,
fix16_from_float
(
scaleToInterval
(
fix16_to_float
((
pPlayer
->
q16horizoff
>>
3
)
+
fix16_one
))));
pPlayer
->
q16horizoff
=
fix16_max
(
pPlayer
->
q16horizoff
,
0
);
if
(
pPlayer
->
q16horiz
==
F16
(
100
))
{
fix16_t
const
f
=
F16
(
100
)
-
pPlayer
->
q16horiz
-
pPlayer
->
q16horizoff
;
fix16_t
const
target
=
Blrintf
(
F16
(
128
)
*
tanf
((
Zvel
/
32.
f
)
*
(
fPI
/
512.
f
)));
fix16_t
const
scaled
=
fix16_from_float
(
scaleToInterval
(
1.5
));
if
(
f
>
target
+
scaled
)
pPlayer
->
q16horizoff
=
fix16_sadd
(
pPlayer
->
q16horizoff
,
scaled
);
else
if
(
f
<
target
-
scaled
)
pPlayer
->
q16horizoff
=
fix16_ssub
(
pPlayer
->
q16horizoff
,
scaled
);
}
}
else
if
(
pPlayer
->
q16horizoff
<
0
)
{
else
if
(
pPlayer
->
q16horizoff
>
F16
(
0.1
))
pPlayer
->
q16horizoff
=
fix16_ssub
(
pPlayer
->
q16horizoff
,
fix16_from_float
(
scaleToInterval
(
fix16_to_float
((
pPlayer
->
q16horizoff
>>
3
)
+
fix16_one
))));
else
if
(
pPlayer
->
q16horizoff
<
F16
(
-
0.1
))
pPlayer
->
q16horizoff
=
fix16_sadd
(
pPlayer
->
q16horizoff
,
fix16_from_float
(
scaleToInterval
(
fix16_to_float
((
-
pPlayer
->
q16horizoff
>>
3
)
+
fix16_one
))));
pPlayer
->
q16horizoff
=
fix16_min
(
pPlayer
->
q16horizoff
,
0
);
}
if
(
pPlayer
->
q16horizoff
>=
F16
(
-
0.1
)
&&
pPlayer
->
q16horizoff
<=
F16
(
0.1
))
pPlayer
->
q16horizoff
=
0
;
if
(
thisPlayer
.
horizSkew
)
pPlayer
->
q16horiz
=
fix16_sadd
(
pPlayer
->
q16horiz
,
fix16_from_float
(
scaleToInterval
(
thisPlayer
.
horizSkew
)));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment