Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion prboom2/src/gl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,9 @@ void gld_DrawWeapon(int weaponlump, vissprite_t *vis, int lightlevel)
// More precise weapon drawing:
// Shotgun from DSV3_War looks correctly now. Especially during movement.
// There is no more line of graphics under certain weapons.
x1 = vis->x1;
//
// [AR] fix wide opengl weapons alignment
x1 = vis->gx1;
x2 = roundf(x1 + gltexture->realtexwidth * pspritexscale_f);
y1 = roundf(viewheight / 2.0 - vis->texturemid * pspriteyscale_f / FRACUNIT);
y2 = roundf(y1 + gltexture->realtexheight * pspriteyscale_f);
Expand Down
1 change: 1 addition & 0 deletions prboom2/src/r_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ typedef struct
typedef struct vissprite_s
{
short x1, x2;
short gx1; // [AR] opengl weapon alignment
fixed_t gx, gy; // for line side calculation
fixed_t gz, gzt; // global bottom / top for silhouette clipping
fixed_t startfrac; // horizontal position of x1
Expand Down
14 changes: 14 additions & 0 deletions prboom2/src/r_things.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,7 @@ static int PSpriteSY[NUMCLASSES][NUMWEAPONS] = {
static void R_DrawPSprite (pspdef_t *psp)
{
int x1, x2;
int gx1;
spritedef_t *sprdef;
spriteframe_t *sprframe;
int lump;
Expand Down Expand Up @@ -1118,6 +1119,9 @@ static void R_DrawPSprite (pspdef_t *psp)
tx -= patch->leftoffset<<FRACBITS;
x1 = (centerxfrac + FixedMul (tx,pspritexscale))>>FRACBITS;

// [AR] opengl weapon alignment
gx1 = x1;

tx += patch->width<<FRACBITS;
x2 = ((centerxfrac + FixedMul (tx, pspritexscale) ) >>FRACBITS) - 1;

Expand Down Expand Up @@ -1148,6 +1152,10 @@ static void R_DrawPSprite (pspdef_t *psp)

vis->x1 = x1 < 0 ? 0 : x1;
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;

// [AR] opengl weapon alignment
vis->gx1 = gx1;

// proff 11/06/98: Added for high-res
vis->scale = pspriteyscale;
vis->color = 0;
Expand Down Expand Up @@ -1217,6 +1225,8 @@ static void R_DrawPSprite (pspdef_t *psp)
{
int x1;
int x1_prev;
int gx1;
int gx1_prev;
int texturemid;
int texturemid_prev;
int lump;
Expand All @@ -1227,10 +1237,12 @@ static void R_DrawPSprite (pspdef_t *psp)
if (realframe)
{
psp_inter.x1 = psp_inter.x1_prev;
psp_inter.gx1 = psp_inter.gx1_prev;
psp_inter.texturemid = psp_inter.texturemid_prev;
}

psp_inter.x1_prev = vis->x1;
psp_inter.gx1_prev = vis->gx1;
psp_inter.texturemid_prev = vis->texturemid;

// Do not interpolate on the first tic of the level
Expand All @@ -1240,12 +1252,14 @@ static void R_DrawPSprite (pspdef_t *psp)
{
int deltax = vis->x2 - vis->x1;
vis->x1 = psp_inter.x1 + FixedMul (tic_vars.frac, (vis->x1 - psp_inter.x1));
vis->gx1 = psp_inter.gx1 + FixedMul(tic_vars.frac, (vis->gx1 - psp_inter.gx1));
vis->x2 = vis->x1 + deltax;
vis->texturemid = psp_inter.texturemid + FixedMul (tic_vars.frac, (vis->texturemid - psp_inter.texturemid));
}
else
{
psp_inter.x1 = vis->x1;
psp_inter.gx1 = vis->gx1;
psp_inter.texturemid = vis->texturemid;
psp_inter.lump=lump;
}
Expand Down
Loading