Skip to content

Commit 04f4837

Browse files
committed
Remove mask from inner column loop
Top 7 bits are actually used for the column, so integer wrapping takes care of the mask.
1 parent bc1c2c2 commit 04f4837

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/r_draw.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,20 @@ const int fuzzoffset[FUZZTABLE] =
9898
// put your effort.
9999
//
100100

101+
#define COLEXTRABITS 9
102+
#define COLBITS (FRACBITS + COLEXTRABITS)
103+
101104
static void R_DrawColumnKernel (byte* dst,
102105
const byte* const src,
103106
const lighttable_t* const colormap,
104-
fixed_t frac,
105-
const fixed_t fracstep,
107+
unsigned int frac,
108+
const unsigned int fracstep,
106109
const int count)
107110
{
108111
for (int i = count; i >= 0; --i)
109112
{
110113
// Current texture index. All wall textures are 128 high.
111-
int idx = (frac >> FRACBITS) & 127;
114+
int idx = (frac >> COLBITS);
112115

113116
// Re-map color indices from wall texture column using a
114117
// lighting/special effects LUT.
@@ -225,8 +228,6 @@ void R_DrawColumn (void)
225228
{
226229
int count;
227230
byte* dest;
228-
fixed_t frac;
229-
fixed_t fracstep;
230231

231232
count = dc_yh - dc_yl;
232233
if (count < 0)
@@ -244,8 +245,8 @@ void R_DrawColumn (void)
244245

245246
// Determine scaling,
246247
// which is the only mapping to be done.
247-
fracstep = dc_iscale;
248-
frac = dc_texturemid + (dc_yl-centery)*fracstep;
248+
const unsigned int fracstep = dc_iscale << COLEXTRABITS;
249+
unsigned int frac = (dc_texturemid + (dc_yl - centery)*dc_iscale) << COLEXTRABITS;
249250

250251
R_DrawColumnKernel (dest, dc_source, dc_colormap, frac, fracstep, count);
251252
}

0 commit comments

Comments
 (0)