Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
bf2809b2
Commit
bf2809b2
authored
3 years ago
by
sphere
Browse files
Options
Downloads
Patches
Plain Diff
Fix crosshairs not displaying and refactor their code.
parent
93512ae9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1716
Fix crosshairs not displaying
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hu_stuff.c
+14
-63
14 additions, 63 deletions
src/hu_stuff.c
with
14 additions
and
63 deletions
src/hu_stuff.c
+
14
−
63
View file @
bf2809b2
...
...
@@ -1863,64 +1863,25 @@ static void HU_DrawChat_Old(void)
}
#endif
//
d
raw
the C
rosshair
,
at the exact center of the view.
//
//
D
raw
c
rosshair
s
at the exact center of the view.
//
In splitscreen, crosshairs are stretched vertically to compensate for V_PERPLAYER squishing them.
// Crosshairs are pre-cached at HU_Init
static
inline
void
HU_DrawCrosshair
(
void
)
static
inline
void
HU_DrawCrosshair
s
(
void
)
{
INT32
i
,
y
,
dupz
;
i
=
cv_crosshair
.
value
&
3
;
if
(
!
i
)
return
;
INT32
cross1
=
cv_crosshair
.
value
&
3
;
INT32
cross2
=
cv_crosshair2
.
value
&
3
;
if
(
(
netgame
||
multiplayer
)
&&
players
[
displayplayer
].
spectator
)
if
(
automapactive
||
demoplayback
)
return
;
#ifdef HWRENDER
if
(
rendermode
!=
render_soft
)
y
=
(
INT32
)
gl_basewindowcentery
;
else
#endif
y
=
viewwindowy
+
(
viewheight
>>
1
);
dupz
=
(
vid
.
dupx
<
vid
.
dupy
?
vid
.
dupx
:
vid
.
dupy
);
stplyr
=
((
stplyr
==
&
players
[
displayplayer
])
?
&
players
[
secondarydisplayplayer
]
:
&
players
[
displayplayer
]);
if
(
!
players
[
displayplayer
].
spectator
&&
(
!
camera
.
chase
||
ticcmd_ztargetfocus
[
0
])
&&
cross1
)
V_DrawStretchyFixedPatch
((
BASEVIDWIDTH
/
2
)
<<
FRACBITS
,
(
BASEVIDHEIGHT
/
2
)
<<
FRACBITS
,
FRACUNIT
,
splitscreen
?
2
*
FRACUNIT
:
FRACUNIT
,
V_TRANSLUCENT
|
V_PERPLAYER
,
crosshair
[
cross1
-
1
],
NULL
);
V_DrawFixedPatch
(
vid
.
width
<<
(
FRACBITS
-
1
),
y
<<
FRACBITS
,
FRACUNIT
/
dupz
,
V_TRANSLUCENT
,
crosshair
[
i
-
1
],
NULL
);
}
static
inline
void
HU_DrawCrosshair2
(
void
)
{
INT32
i
,
y
,
dupz
;
i
=
cv_crosshair2
.
value
&
3
;
if
(
!
i
)
return
;
if
((
netgame
||
multiplayer
)
&&
players
[
secondarydisplayplayer
].
spectator
)
return
;
#ifdef HWRENDER
if
(
rendermode
!=
render_soft
)
y
=
(
INT32
)
gl_basewindowcentery
;
else
#endif
y
=
viewwindowy
+
(
viewheight
>>
1
);
if
(
!
splitscreen
)
return
;
#ifdef HWRENDER
if
(
rendermode
!=
render_soft
)
y
+=
(
INT32
)
gl_viewheight
;
else
#endif
y
+=
viewheight
;
dupz
=
(
vid
.
dupx
<
vid
.
dupy
?
vid
.
dupx
:
vid
.
dupy
);
V_DrawFixedPatch
(
vid
.
width
<<
(
FRACBITS
-
1
),
y
<<
FRACBITS
,
FRACUNIT
/
dupz
,
V_TRANSLUCENT
,
crosshair
[
i
-
1
],
NULL
);
stplyr
=
((
stplyr
==
&
players
[
displayplayer
])
?
&
players
[
secondarydisplayplayer
]
:
&
players
[
displayplayer
]);
if
(
!
players
[
secondarydisplayplayer
].
spectator
&&
(
!
camera2
.
chase
||
ticcmd_ztargetfocus
[
1
])
&&
cross2
&&
splitscreen
)
V_DrawStretchyFixedPatch
((
BASEVIDWIDTH
/
2
)
<<
FRACBITS
,
(
BASEVIDHEIGHT
/
2
)
<<
FRACBITS
,
FRACUNIT
,
2
*
FRACUNIT
,
V_TRANSLUCENT
|
V_PERPLAYER
,
crosshair
[
cross2
-
1
],
NULL
);
}
static
void
HU_DrawCEcho
(
void
)
...
...
@@ -2114,19 +2075,9 @@ void HU_Drawer(void)
if
(
gamestate
!=
GS_LEVEL
)
return
;
// draw the crosshair
, not when viewing demos nor with chasecam
// draw the crosshair
if
(
LUA_HudEnabled
(
hud_crosshair
))
{
if
(
!
automapactive
&&
cv_crosshair
.
value
&&
!
demoplayback
&&
(
!
camera
.
chase
||
ticcmd_ztargetfocus
[
0
])
&&
!
players
[
displayplayer
].
spectator
)
HU_DrawCrosshair
();
if
(
!
automapactive
&&
cv_crosshair2
.
value
&&
!
demoplayback
&&
(
!
camera2
.
chase
||
ticcmd_ztargetfocus
[
1
])
&&
!
players
[
secondarydisplayplayer
].
spectator
)
HU_DrawCrosshair2
();
}
HU_DrawCrosshairs
();
// draw desynch text
if
(
hu_redownloadinggamestate
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment