Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
SRB2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
262
Issues
262
List
Board
Labels
Milestones
Merge Requests
74
Merge Requests
74
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
STJr
SRB2
Commits
abfdac15
Commit
abfdac15
authored
May 27, 2019
by
Monster Iestyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed P_CheckSight to support slopes, both for normal planes and FOF planes
(Untested)
parent
ad400671
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
16 deletions
+52
-16
p_sight.c
src/p_sight.c
+52
-16
No files found.
src/p_sight.c
View file @
abfdac15
...
...
@@ -14,6 +14,7 @@
#include "doomdef.h"
#include "doomstat.h"
#include "p_local.h"
#include "p_slopes.h"
#include "r_main.h"
#include "r_state.h"
...
...
@@ -216,6 +217,10 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
const
sector_t
*
front
,
*
back
;
const
vertex_t
*
v1
,
*
v2
;
fixed_t
frac
;
fixed_t
frontf
,
backf
,
frontc
,
backc
;
#ifdef ESLOPE
fixed_t
fracx
,
fracy
;
#endif
// already checked other side?
if
(
line
->
validcount
==
validcount
)
...
...
@@ -250,37 +255,51 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
if
(
!
(
line
->
flags
&
ML_TWOSIDED
))
return
false
;
// calculate fractional intercept (how far along we are divided by how far we are from t2)
frac
=
P_InterceptVector2
(
&
los
->
strace
,
&
divl
);
front
=
seg
->
frontsector
;
back
=
seg
->
backsector
;
#ifdef ESLOPE
// calculate position at intercept
fracx
=
los
->
strace
.
x
+
FixedMul
(
los
->
strace
.
dx
,
frac
);
fracy
=
los
->
strace
.
y
+
FixedMul
(
los
->
strace
.
dy
,
frac
);
// calculate sector heights
frontf
=
(
front
->
f_slope
)
?
P_GetZAt
(
front
->
f_slope
,
fracx
,
fracy
)
:
front
->
floorheight
;
frontc
=
(
front
->
c_slope
)
?
P_GetZAt
(
front
->
c_slope
,
fracx
,
fracy
)
:
front
->
ceilingheight
;
backf
=
(
back
->
f_slope
)
?
P_GetZAt
(
back
->
f_slope
,
fracx
,
fracy
)
:
back
->
floorheight
;
backc
=
(
back
->
c_slope
)
?
P_GetZAt
(
back
->
c_slope
,
fracx
,
fracy
)
:
back
->
ceilingheight
;
#else
frontf
=
front
->
floorheight
;
frontc
=
front
->
ceilingheight
;
backf
=
back
->
floorheight
;
backc
=
back
->
ceilingheight
;
#endif
// crosses a two sided line
// no wall to block sight with?
if
((
front
=
seg
->
frontsector
)
->
floorheight
==
(
back
=
seg
->
backsector
)
->
floorheight
&&
front
->
ceilingheight
==
back
->
ceilingheight
&&
!
front
->
ffloors
&&
!
back
->
ffloors
)
if
(
frontf
==
backf
&&
frontc
==
backc
&&
!
front
->
ffloors
&
!
back
->
ffloors
)
// (and no FOFs)
continue
;
// possible occluder
// because of ceiling height differences
popentop
=
front
->
ceilingheight
<
back
->
ceilingheight
?
front
->
ceilingheight
:
back
->
ceilingheight
;
popentop
=
min
(
frontc
,
backc
);
// because of floor height differences
popenbottom
=
front
->
floorheight
>
back
->
floorheight
?
front
->
floorheight
:
back
->
floorheight
;
popenbottom
=
max
(
frontf
,
backf
);
// quick test for totally closed doors
if
(
popenbottom
>=
popentop
)
return
false
;
frac
=
P_InterceptVector2
(
&
los
->
strace
,
&
divl
);
if
(
front
->
floorheight
!=
back
->
floorheight
)
if
(
frontf
!=
backf
)
{
fixed_t
slope
=
FixedDiv
(
popenbottom
-
los
->
sightzstart
,
frac
);
if
(
slope
>
los
->
bottomslope
)
los
->
bottomslope
=
slope
;
}
if
(
front
->
ceilingheight
!=
back
->
ceilingheight
)
if
(
front
c
!=
backc
)
{
fixed_t
slope
=
FixedDiv
(
popentop
-
los
->
sightzstart
,
frac
);
if
(
slope
<
los
->
topslope
)
...
...
@@ -295,6 +314,7 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
{
ffloor_t
*
rover
;
fixed_t
topslope
,
bottomslope
;
fixed_t
topz
,
bottomz
;
// check front sector's FOFs first
for
(
rover
=
front
->
ffloors
;
rover
;
rover
=
rover
->
next
)
{
...
...
@@ -303,8 +323,16 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
{
continue
;
}
topslope
=
FixedDiv
(
*
rover
->
topheight
-
los
->
sightzstart
,
frac
);
bottomslope
=
FixedDiv
(
*
rover
->
bottomheight
-
los
->
sightzstart
,
frac
);
#ifdef ESLOPE
topz
=
(
*
rover
->
t_slope
)
?
P_GetZAt
(
*
rover
->
t_slope
,
fracx
,
fracy
)
:
*
rover
->
topheight
;
bottomz
=
(
*
rover
->
b_slope
)
?
P_GetZAt
(
*
rover
->
b_slope
,
fracx
,
fracy
)
:
*
rover
->
bottomheight
;
#else
topz
=
*
rover
->
topheight
;
bottomz
=
*
rover
->
bottomheight
;
#endif
topslope
=
FixedDiv
(
topz
-
los
->
sightzstart
,
frac
);
bottomslope
=
FixedDiv
(
bottomz
-
los
->
sightzstart
,
frac
);
if
(
topslope
>=
los
->
topslope
&&
bottomslope
<=
los
->
bottomslope
)
return
false
;
// view completely blocked
}
...
...
@@ -316,8 +344,16 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
{
continue
;
}
topslope
=
FixedDiv
(
*
rover
->
topheight
-
los
->
sightzstart
,
frac
);
bottomslope
=
FixedDiv
(
*
rover
->
bottomheight
-
los
->
sightzstart
,
frac
);
#ifdef ESLOPE
topz
=
(
*
rover
->
t_slope
)
?
P_GetZAt
(
*
rover
->
t_slope
,
fracx
,
fracy
)
:
*
rover
->
topheight
;
bottomz
=
(
*
rover
->
b_slope
)
?
P_GetZAt
(
*
rover
->
b_slope
,
fracx
,
fracy
)
:
*
rover
->
bottomheight
;
#else
topz
=
*
rover
->
topheight
;
bottomz
=
*
rover
->
bottomheight
;
#endif
topslope
=
FixedDiv
(
topz
-
los
->
sightzstart
,
frac
);
bottomslope
=
FixedDiv
(
bottomz
-
los
->
sightzstart
,
frac
);
if
(
topslope
>=
los
->
topslope
&&
bottomslope
<=
los
->
bottomslope
)
return
false
;
// view completely blocked
}
...
...
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