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
Package registry
Model registry
Operate
Terraform modules
Analyze
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
Lach
SRB2
Commits
11aef0b3
Commit
11aef0b3
authored
6 years ago
by
Alam Ed Arias
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into float_equal
parents
15d06736
073ca103
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/rules
+2
-1
2 additions, 1 deletion
debian/rules
src/hardware/hw_bsp.c
+118
-128
118 additions, 128 deletions
src/hardware/hw_bsp.c
with
120 additions
and
129 deletions
debian/rules
+
2
−
1
View file @
11aef0b3
...
@@ -59,6 +59,7 @@ DBGNAME = debug/$(EXENAME)
...
@@ -59,6 +59,7 @@ DBGNAME = debug/$(EXENAME)
PKGDIR
=
usr/games/SRB2
PKGDIR
=
usr/games/SRB2
DBGDIR
=
usr/lib/debug/
$(
PKGDIR
)
DBGDIR
=
usr/lib/debug/
$(
PKGDIR
)
LINKDIR
=
usr/games
PIXMAPS_DIR
=
usr/share/pixmaps
PIXMAPS_DIR
=
usr/share/pixmaps
DESKTOP_DIR
=
usr/share/applications
DESKTOP_DIR
=
usr/share/applications
PREFIX
=
$(
shell
test
"
$(
CROSS_COMPILE_BUILD
)
"
!=
"
$(
CROSS_COMPILE_HOST
)
"
&&
echo
"PREFIX=
$(
CROSS_COMPILE_HOST
)
"
)
PREFIX
=
$(
shell
test
"
$(
CROSS_COMPILE_BUILD
)
"
!=
"
$(
CROSS_COMPILE_HOST
)
"
&&
echo
"PREFIX=
$(
CROSS_COMPILE_HOST
)
"
)
...
@@ -133,7 +134,7 @@ binary-arch:
...
@@ -133,7 +134,7 @@ binary-arch:
# dh_installcron
# dh_installcron
# dh_installinfo
# dh_installinfo
# dh_installman
# dh_installman
#
dh_link
dh_link
$(PKGDIR)/$(EXENAME)
$(LINKDIR)/$(EXENAME)
dh_compress
dh_compress
dh_fixperms
dh_fixperms
# dh_perl
# dh_perl
...
...
This diff is collapsed.
Click to expand it.
src/hardware/hw_bsp.c
+
118
−
128
View file @
11aef0b3
...
@@ -193,14 +193,14 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
...
@@ -193,14 +193,14 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
v2dy
=
bsp
->
dy
;
v2dy
=
bsp
->
dy
;
den
=
v2dy
*
v1dx
-
v2dx
*
v1dy
;
den
=
v2dy
*
v1dx
-
v2dx
*
v1dy
;
if
(
fabsf
((
float
)
den
)
<
1.0E-36
f
)
if
(
fabsf
((
float
)
den
)
<
1.0E-36
f
)
// avoid checking exactly for 0.0
return
NULL
;
// parallel
return
NULL
;
// parallel
// first check the frac along the polygon segment,
// first check the frac along the polygon segment,
// (do not accept hit with the extensions)
// (do not accept hit with the extensions)
num
=
(
v2x
-
v1x
)
*
v2dy
+
(
v1y
-
v2y
)
*
v2dx
;
num
=
(
v2x
-
v1x
)
*
v2dy
+
(
v1y
-
v2y
)
*
v2dx
;
frac
=
num
/
den
;
frac
=
num
/
den
;
if
(
frac
<
0
||
frac
>
1
)
if
(
frac
<
0
.
0
||
frac
>
1
.
0
)
return
NULL
;
return
NULL
;
// now get the frac along the BSP line
// now get the frac along the BSP line
...
@@ -217,29 +217,6 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
...
@@ -217,29 +217,6 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
return
&
pt
;
return
&
pt
;
}
}
#if 0
//Hurdler: it's not used anymore
static boolean NearVertice (polyvertex_t *p1, polyvertex_t *p2)
{
#if 1
float diff;
diff = p2->x - p1->x;
if (diff < -1.5f || diff > 1.5f)
return false;
diff = p2->y - p1->y;
if (diff < -1.5f || diff > 1.5f)
return false;
#else
if (p1->x != p2->x)
return false;
if (p1->y != p2->y)
return false;
#endif
// p1 and p2 are considered the same vertex
return
true
;
}
#endif
// if two vertice coords have a x and/or y difference
// if two vertice coords have a x and/or y difference
// of less or equal than 1 FRACUNIT, they are considered the same
// of less or equal than 1 FRACUNIT, they are considered the same
// point. Note: hardcoded value, 1.0f could be anything else.
// point. Note: hardcoded value, 1.0f could be anything else.
...
@@ -258,11 +235,18 @@ static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2)
...
@@ -258,11 +235,18 @@ static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2)
return
false
;
return
false
;
if
(
p1
->
y
!=
p2
->
y
)
if
(
p1
->
y
!=
p2
->
y
)
return
false
;
return
false
;
#el
se
#el
if 0
if
(
fabsf
(
p2
->
x
-
p1
->
x
)
>
1.0E-36
f
)
if
(
fabsf
(
p2
->
x
-
p1
->
x
)
>
1.0E-36
f
)
return
false
;
return
false
;
if
(
fabsf
(
p2
->
y
-
p1
->
y
)
>
1.0E-36
f
)
if
(
fabsf
(
p2
->
y
-
p1
->
y
)
>
1.0E-36
f
)
return
false
;
return
false
;
#else
#define DIVLINE_VERTEX_DIFF 0.45f
float
ep
=
DIVLINE_VERTEX_DIFF
;
if
(
fabsf
(
p2
->
x
-
p1
->
x
)
>
ep
)
return
false
;
if
(
fabsf
(
p2
->
y
-
p1
->
y
)
>
ep
)
return
false
;
#endif
#endif
// p1 and p2 are considered the same vertex
// p1 and p2 are considered the same vertex
return
true
;
return
true
;
...
@@ -299,57 +283,57 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
...
@@ -299,57 +283,57 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
// start & end points
// start & end points
pv
=
fracdivline
(
bsp
,
&
poly
->
pts
[
i
],
&
poly
->
pts
[
j
]);
pv
=
fracdivline
(
bsp
,
&
poly
->
pts
[
i
],
&
poly
->
pts
[
j
]);
if
(
pv
)
if
(
pv
==
NULL
)
continue
;
if
(
ps
<
0
)
{
{
if
(
ps
<
0
)
// first point
ps
=
i
;
vs
=
*
pv
;
fracs
=
bspfrac
;
}
else
{
//the partition line traverse a junction between two segments
// or the two points are so close, they can be considered as one
// thus, don't accept, since split 2 must be another vertex
if
(
SameVertice
(
pv
,
&
lastpv
))
{
{
// first point
if
(
pe
<
0
)
ps
=
i
;
{
vs
=
*
pv
;
ps
=
i
;
fracs
=
bspfrac
;
psonline
=
1
;
}
else
{
pe
=
i
;
peonline
=
1
;
}
}
}
else
else
{
{
//the partition line traverse a junction between two segments
if
(
pe
<
0
)
// or the two points are so close, they can be considered as one
// thus, don't accept, since split 2 must be another vertex
if
(
SameVertice
(
pv
,
&
lastpv
))
{
{
if
(
pe
<
0
)
pe
=
i
;
{
ve
=
*
pv
;
ps
=
i
;
frace
=
bspfrac
;
psonline
=
1
;
}
else
{
pe
=
i
;
peonline
=
1
;
}
}
}
else
else
{
{
if
(
pe
<
0
)
// a frac, not same vertice as last one
{
// we already got pt2 so pt 2 is not on the line,
pe
=
i
;
// so we probably got back to the start point
ve
=
*
pv
;
// which is on the line
frace
=
bspfrac
;
if
(
SameVertice
(
pv
,
&
vs
))
}
psonline
=
1
;
else
break
;
{
// a frac, not same vertice as last one
// we already got pt2 so pt 2 is not on the line,
// so we probably got back to the start point
// which is on the line
if
(
SameVertice
(
pv
,
&
vs
))
psonline
=
1
;
break
;
}
}
}
}
}
// remember last point intercept to detect identical points
lastpv
=
*
pv
;
}
}
// remember last point intercept to detect identical points
lastpv
=
*
pv
;
}
}
// no split: the partition line is either parallel and
// no split: the partition line is either parallel and
...
@@ -373,7 +357,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
...
@@ -373,7 +357,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
return
;
return
;
}
}
if
(
ps
>=
0
&&
pe
<
0
)
if
(
pe
<
0
)
{
{
//I_Error("SplitPoly: only one point for split line (%d %d)", ps, pe);
//I_Error("SplitPoly: only one point for split line (%d %d)", ps, pe);
*
frontpoly
=
poly
;
*
frontpoly
=
poly
;
...
@@ -392,7 +376,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
...
@@ -392,7 +376,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
*
backpoly
=
HWR_AllocPoly
(
2
+
nptback
);
*
backpoly
=
HWR_AllocPoly
(
2
+
nptback
);
else
else
*
backpoly
=
NULL
;
*
backpoly
=
NULL
;
if
(
nptfront
)
if
(
nptfront
>
0
)
*
frontpoly
=
HWR_AllocPoly
(
2
+
nptfront
);
*
frontpoly
=
HWR_AllocPoly
(
2
+
nptfront
);
else
else
*
frontpoly
=
NULL
;
*
frontpoly
=
NULL
;
...
@@ -487,42 +471,42 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
...
@@ -487,42 +471,42 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
pv
=
fracdivline
(
&
cutseg
,
&
poly
->
pts
[
i
],
&
poly
->
pts
[
j
]);
pv
=
fracdivline
(
&
cutseg
,
&
poly
->
pts
[
i
],
&
poly
->
pts
[
j
]);
if
(
pv
)
if
(
pv
==
NULL
)
continue
;
if
(
ps
<
0
)
{
ps
=
i
;
vs
=
*
pv
;
fracs
=
bspfrac
;
}
else
{
{
if
(
ps
<
0
)
//frac 1 on previous segment,
// 0 on the next,
//the split line goes through one of the convex poly
// vertices, happens quite often since the convex
// poly is already adjacent to the subsector segs
// on most borders
if
(
SameVertice
(
pv
,
&
vs
))
continue
;
if
(
fracs
<=
bspfrac
)
{
{
nump
=
2
+
poly
->
numpts
-
(
i
-
ps
);
pe
=
ps
;
ps
=
i
;
ps
=
i
;
vs
=
*
pv
;
ve
=
*
pv
;
fracs
=
bspfrac
;
}
}
else
else
{
{
//frac 1 on previous segment,
nump
=
2
+
(
i
-
ps
);
// 0 on the next,
pe
=
i
;
//the split line goes through one of the convex poly
ve
=
vs
;
// vertices, happens quite often since the convex
vs
=
*
pv
;
// poly is already adjacent to the subsector segs
// on most borders
if
(
SameVertice
(
pv
,
&
vs
))
continue
;
if
(
fracs
<=
bspfrac
)
{
nump
=
2
+
poly
->
numpts
-
(
i
-
ps
);
pe
=
ps
;
ps
=
i
;
ve
=
*
pv
;
}
else
{
nump
=
2
+
(
i
-
ps
);
pe
=
i
;
ve
=
vs
;
vs
=
*
pv
;
}
//found 2nd point
break
;
}
}
//found 2nd point
break
;
}
}
}
}
...
@@ -586,18 +570,42 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly)
...
@@ -586,18 +570,42 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly)
// search for the segs source of this divline
// search for the segs source of this divline
static
inline
void
SearchDivline
(
node_t
*
bsp
,
fdivline_t
*
divline
)
static
inline
void
SearchDivline
(
node_t
*
bsp
,
fdivline_t
*
divline
)
{
{
#if 0 // MAR - If you don't use the same partition line that the BSP uses, the front/back polys won't match the subsectors in the BSP!
#endif
divline
->
x
=
FIXED_TO_FLOAT
(
bsp
->
x
);
divline
->
x
=
FIXED_TO_FLOAT
(
bsp
->
x
);
divline
->
y
=
FIXED_TO_FLOAT
(
bsp
->
y
);
divline
->
y
=
FIXED_TO_FLOAT
(
bsp
->
y
);
divline
->
dx
=
FIXED_TO_FLOAT
(
bsp
->
dx
);
divline
->
dx
=
FIXED_TO_FLOAT
(
bsp
->
dx
);
divline
->
dy
=
FIXED_TO_FLOAT
(
bsp
->
dy
);
divline
->
dy
=
FIXED_TO_FLOAT
(
bsp
->
dy
);
}
}
#ifdef HWR_LOADING_SCREEN
//Hurdler: implement a loading status
//Hurdler: implement a loading status
static
size_t
ls_count
=
0
;
static
size_t
ls_count
=
0
;
static
UINT8
ls_percent
=
0
;
static
UINT8
ls_percent
=
0
;
static
void
loading_status
(
void
)
{
char
s
[
16
];
int
x
,
y
;
I_OsPolling
();
CON_Drawer
();
sprintf
(
s
,
"%d%%"
,
(
++
ls_percent
)
<<
1
);
x
=
BASEVIDWIDTH
/
2
;
y
=
BASEVIDHEIGHT
/
2
;
V_DrawFill
(
0
,
0
,
BASEVIDWIDTH
,
BASEVIDHEIGHT
,
31
);
// Black background to match fade in effect
//V_DrawPatchFill(W_CachePatchName("SRB2BACK",PU_CACHE)); // SRB2 background, ehhh too bright.
M_DrawTextBox
(
x
-
58
,
y
-
8
,
13
,
1
);
V_DrawString
(
x
-
50
,
y
,
V_YELLOWMAP
,
"Loading..."
);
V_DrawRightAlignedString
(
x
+
50
,
y
,
V_YELLOWMAP
,
s
);
// Is this really necessary at this point..?
V_DrawCenteredString
(
BASEVIDWIDTH
/
2
,
40
,
V_YELLOWMAP
,
"OPENGL MODE IS INCOMPLETE AND MAY"
);
V_DrawCenteredString
(
BASEVIDWIDTH
/
2
,
50
,
V_YELLOWMAP
,
"NOT DISPLAY SOME SURFACES."
);
V_DrawCenteredString
(
BASEVIDWIDTH
/
2
,
70
,
V_YELLOWMAP
,
"USE AT SONIC'S RISK."
);
I_UpdateNoVsync
();
}
#endif
// poly : the convex polygon that encloses all child subsectors
// poly : the convex polygon that encloses all child subsectors
static
void
WalkBSPNode
(
INT32
bspnum
,
poly_t
*
poly
,
UINT16
*
leafnode
,
fixed_t
*
bbox
)
static
void
WalkBSPNode
(
INT32
bspnum
,
poly_t
*
poly
,
UINT16
*
leafnode
,
fixed_t
*
bbox
)
{
{
...
@@ -635,38 +643,19 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
...
@@ -635,38 +643,19 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
}
}
else
else
{
{
HWR_SubsecPoly
(
bspnum
&
(
~
NF_SUBSECTOR
),
poly
);
HWR_SubsecPoly
(
bspnum
&
~
NF_SUBSECTOR
,
poly
);
//Hurdler: implement a loading status
//Hurdler: implement a loading status
#ifdef HWR_LOADING_SCREEN
#ifdef HWR_LOADING_SCREEN
if
(
ls_count
--
<=
0
)
if
(
ls_count
--
<=
0
)
{
{
char
s
[
16
];
int
x
,
y
;
I_OsPolling
();
ls_count
=
numsubsectors
/
50
;
ls_count
=
numsubsectors
/
50
;
CON_Drawer
();
loading_status
();
sprintf
(
s
,
"%d%%"
,
(
++
ls_percent
)
<<
1
);
x
=
BASEVIDWIDTH
/
2
;
y
=
BASEVIDHEIGHT
/
2
;
V_DrawFill
(
0
,
0
,
BASEVIDWIDTH
,
BASEVIDHEIGHT
,
31
);
// Black background to match fade in effect
//V_DrawPatchFill(W_CachePatchName("SRB2BACK",PU_CACHE)); // SRB2 background, ehhh too bright.
M_DrawTextBox
(
x
-
58
,
y
-
8
,
13
,
1
);
V_DrawString
(
x
-
50
,
y
,
V_YELLOWMAP
,
"Loading..."
);
V_DrawRightAlignedString
(
x
+
50
,
y
,
V_YELLOWMAP
,
s
);
// Is this really necessary at this point..?
V_DrawCenteredString
(
BASEVIDWIDTH
/
2
,
40
,
V_YELLOWMAP
,
"OPENGL MODE IS INCOMPLETE AND MAY"
);
V_DrawCenteredString
(
BASEVIDWIDTH
/
2
,
50
,
V_YELLOWMAP
,
"NOT DISPLAY SOME SURFACES."
);
V_DrawCenteredString
(
BASEVIDWIDTH
/
2
,
70
,
V_YELLOWMAP
,
"USE AT SONIC'S RISK."
);
I_UpdateNoVsync
();
}
}
#endif
#endif
}
}
M_ClearBox
(
bbox
);
M_ClearBox
(
bbox
);
poly
=
extrasubsectors
[
bspnum
&
~
NF_SUBSECTOR
].
planepoly
;
poly
=
extrasubsectors
[
bspnum
&
~
NF_SUBSECTOR
].
planepoly
;
for
(
i
=
0
,
pt
=
poly
->
pts
;
i
<
poly
->
numpts
;
i
++
,
pt
++
)
for
(
i
=
0
,
pt
=
poly
->
pts
;
i
<
poly
->
numpts
;
i
++
,
pt
++
)
M_AddToBox
(
bbox
,
FLOAT_TO_FIXED
(
pt
->
x
),
FLOAT_TO_FIXED
(
pt
->
y
));
M_AddToBox
(
bbox
,
FLOAT_TO_FIXED
(
pt
->
x
),
FLOAT_TO_FIXED
(
pt
->
y
));
...
@@ -698,14 +687,13 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
...
@@ -698,14 +687,13 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
if
(
backpoly
)
if
(
backpoly
)
{
{
// Correct back bbox to include floor/ceiling convex polygon
// Correct back bbox to include floor/ceiling convex polygon
WalkBSPNode
(
bsp
->
children
[
1
],
backpoly
,
&
bsp
->
children
[
1
],
WalkBSPNode
(
bsp
->
children
[
1
],
backpoly
,
&
bsp
->
children
[
1
],
bsp
->
bbox
[
1
]);
bsp
->
bbox
[
1
]);
// enlarge bbox with second
e
child
// enlarge bbox with second child
M_AddToBox
(
bbox
,
bsp
->
bbox
[
1
][
BOXLEFT
],
M_AddToBox
(
bbox
,
bsp
->
bbox
[
1
][
BOXLEFT
],
bsp
->
bbox
[
1
][
BOXTOP
]);
bsp
->
bbox
[
1
][
BOXTOP
]);
M_AddToBox
(
bbox
,
bsp
->
bbox
[
1
][
BOXRIGHT
],
M_AddToBox
(
bbox
,
bsp
->
bbox
[
1
][
BOXRIGHT
],
bsp
->
bbox
[
1
][
BOXBOTTOM
]);
bsp
->
bbox
[
1
][
BOXBOTTOM
]);
}
}
}
}
...
@@ -785,9 +773,9 @@ static void SearchSegInBSP(INT32 bspnum,polyvertex_t *p,poly_t *poly)
...
@@ -785,9 +773,9 @@ static void SearchSegInBSP(INT32 bspnum,polyvertex_t *p,poly_t *poly)
if
(
bspnum
&
NF_SUBSECTOR
)
if
(
bspnum
&
NF_SUBSECTOR
)
{
{
if
(
bspnum
!=-
1
)
if
(
bspnum
!=
-
1
)
{
{
bspnum
&=~
NF_SUBSECTOR
;
bspnum
&=
~
NF_SUBSECTOR
;
q
=
extrasubsectors
[
bspnum
].
planepoly
;
q
=
extrasubsectors
[
bspnum
].
planepoly
;
if
(
poly
==
q
||
!
q
)
if
(
poly
==
q
||
!
q
)
return
;
return
;
...
@@ -973,7 +961,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
...
@@ -973,7 +961,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
fixed_t
rootbbox
[
4
];
fixed_t
rootbbox
[
4
];
CONS_Debug
(
DBG_RENDER
,
"Creating polygons, please wait...
\n
"
);
CONS_Debug
(
DBG_RENDER
,
"Creating polygons, please wait...
\n
"
);
#ifdef HWR_LOADING_SCREEN
ls_count
=
ls_percent
=
0
;
// reset the loading status
ls_count
=
ls_percent
=
0
;
// reset the loading status
#endif
CON_Drawer
();
//let the user know what we are doing
CON_Drawer
();
//let the user know what we are doing
I_FinishUpdate
();
// page flip or blit buffer
I_FinishUpdate
();
// page flip or blit buffer
...
...
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