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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
SteelT
SRB2
Commits
a8fe12ae
Commit
a8fe12ae
authored
3 years ago
by
Hannu Hanhi
Browse files
Options
Downloads
Patches
Plain Diff
Hack that fixes software drop shadow crashes by bypassing incorrectly set variables
parent
e8c83f48
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/r_draw.h
+1
-0
1 addition, 0 deletions
src/r_draw.h
src/r_draw8.c
+33
-0
33 additions, 0 deletions
src/r_draw8.c
src/r_things.c
+6
-0
6 additions, 0 deletions
src/r_things.c
with
40 additions
and
0 deletions
src/r_draw.h
+
1
−
0
View file @
a8fe12ae
...
@@ -170,6 +170,7 @@ void R_DrawViewBorder(void);
...
@@ -170,6 +170,7 @@ void R_DrawViewBorder(void);
void
R_DrawColumn_8
(
void
);
void
R_DrawColumn_8
(
void
);
void
R_DrawShadeColumn_8
(
void
);
void
R_DrawShadeColumn_8
(
void
);
void
R_DrawTranslucentColumn_8
(
void
);
void
R_DrawTranslucentColumn_8
(
void
);
void
R_DrawDropShadowColumn_8
(
void
);
void
R_DrawTranslatedColumn_8
(
void
);
void
R_DrawTranslatedColumn_8
(
void
);
void
R_DrawTranslatedTranslucentColumn_8
(
void
);
void
R_DrawTranslatedTranslucentColumn_8
(
void
);
void
R_Draw2sMultiPatchColumn_8
(
void
);
void
R_Draw2sMultiPatchColumn_8
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/r_draw8.c
+
33
−
0
View file @
a8fe12ae
...
@@ -416,6 +416,39 @@ void R_DrawTranslucentColumn_8(void)
...
@@ -416,6 +416,39 @@ void R_DrawTranslucentColumn_8(void)
}
}
}
}
// Hack: A cut-down copy of R_DrawTranslucentColumn_8 that does not read texture
// data since something about calculating the texture reading address for drop shadows is broken.
// dc_texturemid and dc_iscale get wrong values for drop shadows, however those are not strictly
// needed for the current design of the shadows, so this function bypasses the issue
// by not using those variables at all.
void
R_DrawDropShadowColumn_8
(
void
)
{
register
INT32
count
;
register
UINT8
*
dest
;
count
=
dc_yh
-
dc_yl
+
1
;
if
(
count
<=
0
)
// Zero length, column does not exceed a pixel.
return
;
dest
=
&
topleft
[
dc_yl
*
vid
.
width
+
dc_x
];
{
#define DSCOLOR 31 // palette index for the color of the shadow
register
const
UINT8
*
transmap_offset
=
dc_transmap
+
(
dc_colormap
[
DSCOLOR
]
<<
8
);
#undef DSCOLOR
while
((
count
-=
2
)
>=
0
)
{
*
dest
=
*
(
transmap_offset
+
(
*
dest
));
dest
+=
vid
.
width
;
*
dest
=
*
(
transmap_offset
+
(
*
dest
));
dest
+=
vid
.
width
;
}
if
(
count
&
1
)
*
dest
=
*
(
transmap_offset
+
(
*
dest
));
}
}
/** \brief The R_DrawTranslatedTranslucentColumn_8 function
/** \brief The R_DrawTranslatedTranslucentColumn_8 function
Spiffy function. Not only does it colormap a sprite, but does translucency as well.
Spiffy function. Not only does it colormap a sprite, but does translucency as well.
Uber-kudos to Cyan Helkaraxe
Uber-kudos to Cyan Helkaraxe
...
...
This diff is collapsed.
Click to expand it.
src/r_things.c
+
6
−
0
View file @
a8fe12ae
...
@@ -837,6 +837,12 @@ static void R_DrawVisSprite(vissprite_t *vis)
...
@@ -837,6 +837,12 @@ static void R_DrawVisSprite(vissprite_t *vis)
else
if
(
vis
->
mobj
->
sprite
==
SPR_PLAY
)
// Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
else
if
(
vis
->
mobj
->
sprite
==
SPR_PLAY
)
// Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
colfunc
=
colfuncs
[
COLDRAWFUNC_TRANS
];
colfunc
=
colfuncs
[
COLDRAWFUNC_TRANS
];
// Hack: Use a special column function for drop shadows that bypasses
// invalid memory access crashes caused by R_ProjectDropShadow putting wrong values
// in dc_texturemid and dc_iscale when the shadow is sloped.
if
(
vis
->
cut
&
SC_SHADOW
)
colfunc
=
R_DrawDropShadowColumn_8
;
if
(
vis
->
extra_colormap
&&
!
(
vis
->
renderflags
&
RF_NOCOLORMAPS
))
if
(
vis
->
extra_colormap
&&
!
(
vis
->
renderflags
&
RF_NOCOLORMAPS
))
{
{
if
(
!
dc_colormap
)
if
(
!
dc_colormap
)
...
...
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