Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eidolon
SRB2
Commits
d0020e6c
Commit
d0020e6c
authored
5 years ago
by
Eidolon
Browse files
Options
Downloads
Patches
Plain Diff
Ensure viewsector is accurate to viewx/viewy
This fixes a potential crash in OpenGL when changing between levels.
parent
df5949d6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/r_fps.c
+14
-25
14 additions, 25 deletions
src/r_fps.c
src/r_fps.h
+0
-5
0 additions, 5 deletions
src/r_fps.h
with
14 additions
and
30 deletions
src/r_fps.c
+
14
−
25
View file @
d0020e6c
...
@@ -39,6 +39,16 @@ viewvars_t *newview = &p1view_new;
...
@@ -39,6 +39,16 @@ viewvars_t *newview = &p1view_new;
enum
viewcontext_e
viewcontext
=
VIEWCONTEXT_PLAYER1
;
enum
viewcontext_e
viewcontext
=
VIEWCONTEXT_PLAYER1
;
static
fixed_t
R_LerpFixed
(
fixed_t
from
,
fixed_t
to
,
fixed_t
frac
)
{
return
FixedMul
(
frac
,
to
-
from
);
}
static
angle_t
R_LerpAngle
(
angle_t
from
,
angle_t
to
,
fixed_t
frac
)
{
return
FixedMul
(
frac
,
to
-
from
);
}
// recalc necessary stuff for mouseaiming
// recalc necessary stuff for mouseaiming
// slopes are already calculated for the full possible view (which is 4*viewheight).
// slopes are already calculated for the full possible view (which is 4*viewheight).
// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
...
@@ -80,6 +90,8 @@ void R_InterpolateView(fixed_t frac)
...
@@ -80,6 +90,8 @@ void R_InterpolateView(fixed_t frac)
boolean
skybox
=
0
;
boolean
skybox
=
0
;
if
(
FIXED_TO_FLOAT
(
frac
)
<
0
)
if
(
FIXED_TO_FLOAT
(
frac
)
<
0
)
frac
=
0
;
frac
=
0
;
if
(
frac
>
FRACUNIT
)
frac
=
FRACUNIT
;
viewx
=
oldview
->
x
+
R_LerpFixed
(
oldview
->
x
,
newview
->
x
,
frac
);
viewx
=
oldview
->
x
+
R_LerpFixed
(
oldview
->
x
,
newview
->
x
,
frac
);
viewy
=
oldview
->
y
+
R_LerpFixed
(
oldview
->
y
,
newview
->
y
,
frac
);
viewy
=
oldview
->
y
+
R_LerpFixed
(
oldview
->
y
,
newview
->
y
,
frac
);
...
@@ -93,16 +105,8 @@ void R_InterpolateView(fixed_t frac)
...
@@ -93,16 +105,8 @@ void R_InterpolateView(fixed_t frac)
// this is gonna create some interesting visual errors for long distance teleports...
// this is gonna create some interesting visual errors for long distance teleports...
// might want to recalculate the view sector every frame instead...
// might want to recalculate the view sector every frame instead...
if
(
frac
>=
FRACUNIT
)
viewplayer
=
newview
->
player
;
{
viewsector
=
R_PointInSubsector
(
viewx
,
viewy
)
->
sector
;
viewplayer
=
newview
->
player
;
viewsector
=
newview
->
sector
;
}
else
{
viewplayer
=
oldview
->
player
;
viewsector
=
oldview
->
sector
;
}
// well, this ain't pretty
// well, this ain't pretty
if
(
newview
==
&
sky1view_new
||
newview
==
&
sky2view_new
)
if
(
newview
==
&
sky1view_new
||
newview
==
&
sky2view_new
)
...
@@ -152,18 +156,3 @@ void R_SetViewContext(enum viewcontext_e _viewcontext)
...
@@ -152,18 +156,3 @@ void R_SetViewContext(enum viewcontext_e _viewcontext)
break
;
break
;
}
}
}
}
fixed_t
R_LerpFixed
(
fixed_t
from
,
fixed_t
to
,
fixed_t
frac
)
{
return
FixedMul
(
frac
,
to
-
from
);
}
INT32
R_LerpInt32
(
INT32
from
,
INT32
to
,
fixed_t
frac
)
{
return
FixedInt
(
FixedMul
(
frac
,
(
to
*
FRACUNIT
)
-
(
from
*
FRACUNIT
)));
}
angle_t
R_LerpAngle
(
angle_t
from
,
angle_t
to
,
fixed_t
frac
)
{
return
FixedMul
(
frac
,
to
-
from
);
}
This diff is collapsed.
Click to expand it.
src/r_fps.h
+
0
−
5
View file @
d0020e6c
...
@@ -51,9 +51,4 @@ void R_UpdateViewInterpolation(void);
...
@@ -51,9 +51,4 @@ void R_UpdateViewInterpolation(void);
// Set the current view context (the viewvars pointed to by newview)
// Set the current view context (the viewvars pointed to by newview)
void
R_SetViewContext
(
enum
viewcontext_e
_viewcontext
);
void
R_SetViewContext
(
enum
viewcontext_e
_viewcontext
);
fixed_t
R_LerpFixed
(
fixed_t
from
,
fixed_t
to
,
fixed_t
frac
);
INT32
R_LerpInt32
(
INT32
from
,
INT32
to
,
fixed_t
frac
);
UINT32
R_LerpUInt32
(
UINT32
from
,
UINT32
to
,
fixed_t
frac
);
angle_t
R_LerpAngle
(
angle_t
from
,
angle_t
to
,
fixed_t
frac
);
#endif
#endif
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