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
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kaldrum
SRB2
Commits
0952d313
Commit
0952d313
authored
1 year ago
by
sphere
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-1x1-floorsprite-draw' into 'next'
Fix floorsprite rendering with 1x1 images Closes
#1052
See merge request
!2141
parents
0f914a4e
27021d29
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/r_splats.c
+60
-22
60 additions, 22 deletions
src/r_splats.c
with
60 additions
and
22 deletions
src/r_splats.c
+
60
−
22
View file @
0952d313
...
@@ -314,9 +314,7 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
...
@@ -314,9 +314,7 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
fixed_t
planeheight
=
0
;
fixed_t
planeheight
=
0
;
fixed_t
step
;
fixed_t
step
;
int
spanfunctype
=
SPANDRAWFUNC_SPRITE
;
int
spanfunctype
;
prepare_rastertab
();
#define RASTERPARAMS(vnum1, vnum2, tv1, tv2, tc, dir) \
#define RASTERPARAMS(vnum1, vnum2, tv1, tv2, tc, dir) \
x1 = verts[vnum1].x; \
x1 = verts[vnum1].x; \
...
@@ -367,21 +365,15 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
...
@@ -367,21 +365,15 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
if (ry1 > maxy) \
if (ry1 > maxy) \
maxy = ry1;
maxy = ry1;
// do segment a -> top of texture
RASTERPARAMS
(
3
,
2
,
0
,
pSplat
->
width
-
1
,
0
,
0
);
// do segment b -> right side of texture
RASTERPARAMS
(
2
,
1
,
0
,
pSplat
->
width
-
1
,
pSplat
->
height
-
1
,
0
);
// do segment c -> bottom of texture
RASTERPARAMS
(
1
,
0
,
pSplat
->
width
-
1
,
0
,
pSplat
->
height
-
1
,
0
);
// do segment d -> left side of texture
RASTERPARAMS
(
0
,
3
,
pSplat
->
width
-
1
,
0
,
0
,
1
);
ds_source
=
(
UINT8
*
)
pSplat
->
pic
;
ds_source
=
(
UINT8
*
)
pSplat
->
pic
;
ds_flatwidth
=
pSplat
->
width
;
ds_flatwidth
=
pSplat
->
width
;
ds_flatheight
=
pSplat
->
height
;
ds_flatheight
=
pSplat
->
height
;
ds_powersoftwo
=
false
;
if
(
R_CheckPowersOfTwo
())
ds_powersoftwo
=
ds_solidcolor
=
false
;
if
(
R_CheckSolidColorFlat
())
ds_solidcolor
=
true
;
else
if
(
R_CheckPowersOfTwo
())
{
{
R_SetFlatVars
(
ds_flatwidth
*
ds_flatheight
);
R_SetFlatVars
(
ds_flatwidth
*
ds_flatheight
);
ds_powersoftwo
=
true
;
ds_powersoftwo
=
true
;
...
@@ -392,9 +384,8 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
...
@@ -392,9 +384,8 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
R_SetTiltedSpan
(
0
);
R_SetTiltedSpan
(
0
);
R_SetScaledSlopePlane
(
pSplat
->
slope
,
vis
->
viewpoint
.
x
,
vis
->
viewpoint
.
y
,
vis
->
viewpoint
.
z
,
pSplat
->
xscale
,
pSplat
->
yscale
,
-
pSplat
->
verts
[
0
].
x
,
pSplat
->
verts
[
0
].
y
,
vis
->
viewpoint
.
angle
,
pSplat
->
angle
);
R_SetScaledSlopePlane
(
pSplat
->
slope
,
vis
->
viewpoint
.
x
,
vis
->
viewpoint
.
y
,
vis
->
viewpoint
.
z
,
pSplat
->
xscale
,
pSplat
->
yscale
,
-
pSplat
->
verts
[
0
].
x
,
pSplat
->
verts
[
0
].
y
,
vis
->
viewpoint
.
angle
,
pSplat
->
angle
);
R_CalculateSlopeVectors
();
R_CalculateSlopeVectors
();
spanfunctype
=
SPANDRAWFUNC_TILTEDSPRITE
;
}
}
else
else
if
(
!
ds_solidcolor
)
{
{
planeheight
=
abs
(
pSplat
->
z
-
vis
->
viewpoint
.
z
);
planeheight
=
abs
(
pSplat
->
z
-
vis
->
viewpoint
.
z
);
...
@@ -429,23 +420,70 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
...
@@ -429,23 +420,70 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
ds_colormap
=
&
vis
->
extra_colormap
->
colormap
[
ds_colormap
-
colormaps
];
ds_colormap
=
&
vis
->
extra_colormap
->
colormap
[
ds_colormap
-
colormaps
];
}
}
if
(
vis
->
transmap
)
ds_transmap
=
vis
->
transmap
;
// Determine which R_DrawWhatever to use
// Solid color
if
(
ds_solidcolor
)
{
{
ds_transmap
=
vis
->
transmap
;
UINT16
px
=
*
(
UINT16
*
)
ds_source
;
// Uh, it's not visible.
if
(
!
(
px
&
0xFF00
))
return
;
// Pixel color is contained in the lower 8 bits (upper 8 are the opacity), so advance the pointer
ds_source
++
;
if
(
pSplat
->
slope
)
{
if
(
ds_transmap
)
spanfunctype
=
SPANDRAWFUNC_TILTEDTRANSSOLID
;
else
spanfunctype
=
SPANDRAWFUNC_TILTEDSOLID
;
}
else
{
if
(
ds_transmap
)
spanfunctype
=
SPANDRAWFUNC_TRANSSOLID
;
else
spanfunctype
=
SPANDRAWFUNC_SOLID
;
}
}
// Transparent
else
if
(
ds_transmap
)
{
if
(
pSplat
->
slope
)
if
(
pSplat
->
slope
)
spanfunctype
=
SPANDRAWFUNC_TILTEDTRANSSPRITE
;
spanfunctype
=
SPANDRAWFUNC_TILTEDTRANSSPRITE
;
else
else
spanfunctype
=
SPANDRAWFUNC_TRANSSPRITE
;
spanfunctype
=
SPANDRAWFUNC_TRANSSPRITE
;
}
}
// Opaque
else
else
ds_transmap
=
NULL
;
{
if
(
pSplat
->
slope
)
spanfunctype
=
SPANDRAWFUNC_TILTEDSPRITE
;
else
spanfunctype
=
SPANDRAWFUNC_SPRITE
;
}
if
(
ds_powersoftwo
)
if
(
ds_powersoftwo
||
ds_solidcolor
)
spanfunc
=
spanfuncs
[
spanfunctype
];
spanfunc
=
spanfuncs
[
spanfunctype
];
else
else
spanfunc
=
spanfuncs_npo2
[
spanfunctype
];
spanfunc
=
spanfuncs_npo2
[
spanfunctype
];
prepare_rastertab
();
// do segment a -> top of texture
RASTERPARAMS
(
3
,
2
,
0
,
pSplat
->
width
-
1
,
0
,
0
);
// do segment b -> right side of texture
RASTERPARAMS
(
2
,
1
,
0
,
pSplat
->
width
-
1
,
pSplat
->
height
-
1
,
0
);
// do segment c -> bottom of texture
RASTERPARAMS
(
1
,
0
,
pSplat
->
width
-
1
,
0
,
pSplat
->
height
-
1
,
0
);
// do segment d -> left side of texture
RASTERPARAMS
(
0
,
3
,
pSplat
->
width
-
1
,
0
,
0
,
1
);
if
(
maxy
>=
vid
.
height
)
if
(
maxy
>=
vid
.
height
)
maxy
=
vid
.
height
-
1
;
maxy
=
vid
.
height
-
1
;
...
@@ -500,7 +538,7 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
...
@@ -500,7 +538,7 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
if
(
x2
<
x1
)
if
(
x2
<
x1
)
continue
;
continue
;
if
(
!
pSplat
->
slope
)
if
(
!
ds_solidcolor
&&
!
pSplat
->
slope
)
{
{
fixed_t
xstep
,
ystep
;
fixed_t
xstep
,
ystep
;
fixed_t
distance
,
span
;
fixed_t
distance
,
span
;
...
@@ -549,7 +587,7 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
...
@@ -549,7 +587,7 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
rastertab
[
y
].
maxx
=
INT32_MIN
;
rastertab
[
y
].
maxx
=
INT32_MIN
;
}
}
if
(
pSplat
->
angle
&&
!
pSplat
->
slope
)
if
(
!
ds_solidcolor
&&
pSplat
->
angle
&&
!
pSplat
->
slope
)
memset
(
cachedheight
,
0
,
sizeof
(
cachedheight
));
memset
(
cachedheight
,
0
,
sizeof
(
cachedheight
));
}
}
...
...
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