Skip to content

Commit

Permalink
Support unaligned patch columns
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Nov 5, 2023
1 parent 90bc313 commit 7f96d84
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions r_phase8.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,19 @@ void R_DrawVisSprite(vissprite_t *vis, unsigned short *spropening, int *fuzzpos,

for(; x < stopx; x++, xfrac += fracstep)
{
column_t *column = (column_t *)((byte *)patch + BIGSHORT(patch->columnofs[xfrac>>FRACBITS]));
byte *columnptr = ((byte *)patch + BIGSHORT(patch->columnofs[xfrac>>FRACBITS]));
int topclip = (spropening[x] >> 8);
int bottomclip = (spropening[x] & 0xff) - 1;

// column loop
// a post record has four bytes: topdelta length pixelofs*2
for(; column->topdelta != 0xff; column++)
for(; *columnptr != 0xff; columnptr += sizeof(column_t))
{
column_t *column = (column_t *)columnptr;
int top = column->topdelta * spryscale + sprtop;
int bottom = column->length * spryscale + top;
byte *dataofsofs = columnptr + offsetof(column_t, dataofs);
int dataofs = (dataofsofs[0] << 8) | dataofsofs[1];
int count;
fixed_t frac;

Expand Down Expand Up @@ -107,7 +110,7 @@ void R_DrawVisSprite(vissprite_t *vis, unsigned short *spropening, int *fuzzpos,
continue;

// CALICO: invoke column drawer
dcol(x, top, bottom, light, frac, iscale, pixels + BIGSHORT(column->dataofs), 128, fuzzpos);
dcol(x, top, bottom, light, frac, iscale, pixels + BIGSHORT(dataofs), 128, fuzzpos);
}
}
}
Expand Down

0 comments on commit 7f96d84

Please sign in to comment.