Skip to content

Commit

Permalink
only use the lower word of patch_t.columnofs
Browse files Browse the repository at this point in the history
  • Loading branch information
FrenkelS committed Mar 14, 2024
1 parent d45a1b2 commit 3fa5f74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion r_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ typedef struct
int16_t height;
int16_t leftoffset; // pixels to the left of origin
int16_t topoffset; // pixels below the origin
int32_t columnofs[8]; // only [width] used
int32_t columnofs[8]; // only [width] used, the upper word is always zero
// the [0] is &columnofs[width]
} patch_t;

Expand Down
8 changes: 4 additions & 4 deletions r_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ static void R_DrawVisSprite(const vissprite_t *vis)

while (dcvars.x < VIEWWINDOWWIDTH)
{
const column_t __far* column = (const column_t __far*) ((const byte __far*)patch + patch->columnofs[frac >> FRACBITS]);
const column_t __far* column = (const column_t __far*) ((const byte __far*)patch + (uint16_t)patch->columnofs[frac >> FRACBITS]);
R_DrawMaskedColumn(colfunc, &dcvars, column);

frac += vis->xiscale;
Expand Down Expand Up @@ -924,7 +924,7 @@ static void R_RenderMaskedSegRange(const drawseg_t *ds, int16_t x1, int16_t x2)
int16_t x_c;
R_GetColumn(texture, xc, &patch_num, &x_c);
const patch_t __far* patch = W_GetLumpByNum(patch_num);
const column_t __far* column = (const column_t __far*) ((const byte __far*)patch + patch->columnofs[x_c]);
const column_t __far* column = (const column_t __far*) ((const byte __far*)patch + (uint16_t)patch->columnofs[x_c]);

R_DrawMaskedColumn(R_DrawColumn, &dcvars, column);
Z_ChangeTagToCache(patch);
Expand Down Expand Up @@ -1571,7 +1571,7 @@ static const byte __far* R_ComposeColumn(const int16_t texture, const texture_t

if (xc < x2)
{
const column_t __far* patchcol = (const column_t __far*)((const byte __far*)realpatch + realpatch->columnofs[xc - x1]);
const column_t __far* patchcol = (const column_t __far*)((const byte __far*)realpatch + (uint16_t)realpatch->columnofs[xc - x1]);

R_DrawColumnInCache (patchcol, tmpCache, patch->originy, tex->height);
}
Expand Down Expand Up @@ -1602,7 +1602,7 @@ static void R_DrawSegTextureColumn(int16_t texture, int16_t texcolumn, draw_colu
R_DrawColumnFlat(texture, dcvars);
else
{
const column_t __far* column = (const column_t __far*) ((const byte __far*)patch + patch->columnofs[x_c]);
const column_t __far* column = (const column_t __far*) ((const byte __far*)patch + (uint16_t)patch->columnofs[x_c]);

dcvars->source = (const byte __far*)column + 3;
R_DrawColumn (dcvars);
Expand Down

0 comments on commit 3fa5f74

Please sign in to comment.