mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Draw the flat on-screen CHAINGUN in a way inspired by 3688, preventing seam.
Specifically, in GL modes, and if the CHAINGUN is not replaced by a model, - draw the upper part twice: first, two screen pixels * weapon scale lower, then at the original position - reverse the previous order: draw the upper part first, then the lower part This is much preferable to the previous engine-side hack, and to my eye, it looks perfect now. git-svn-id: https://svn.eduke32.com/eduke32@3695 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
dac18a99e9
commit
08b10ca03c
2 changed files with 24 additions and 40 deletions
|
@ -1053,6 +1053,8 @@ static void fixtransparency(int32_t dapicnum, coltype *dapic, int32_t daxsiz, in
|
||||||
coltype *wpptr;
|
coltype *wpptr;
|
||||||
int32_t j, x, y, r, g, b, dox, doy, naxsiz2;
|
int32_t j, x, y, r, g, b, dox, doy, naxsiz2;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(dapicnum);
|
||||||
|
|
||||||
dox = daxsiz2-1; doy = daysiz2-1;
|
dox = daxsiz2-1; doy = daysiz2-1;
|
||||||
if (dameth&4) { dox = min(dox,daxsiz); doy = min(doy,daysiz); }
|
if (dameth&4) { dox = min(dox,daxsiz); doy = min(doy,daysiz); }
|
||||||
else { daxsiz = daxsiz2; daysiz = daysiz2; } //Make repeating textures duplicate top/left parts
|
else { daxsiz = daxsiz2; daysiz = daysiz2; } //Make repeating textures duplicate top/left parts
|
||||||
|
@ -1066,23 +1068,6 @@ static void fixtransparency(int32_t dapicnum, coltype *dapic, int32_t daxsiz, in
|
||||||
wpptr = &dapic[y*daxsiz2+dox];
|
wpptr = &dapic[y*daxsiz2+dox];
|
||||||
for (x=dox; x>=0; x--,wpptr--)
|
for (x=dox; x>=0; x--,wpptr--)
|
||||||
{
|
{
|
||||||
// HACK for on-screen lower part of chaingun sprite to prevent a subtexel
|
|
||||||
// transparent horizontal line between the bottom and top parts with linear
|
|
||||||
// filtering.
|
|
||||||
if (dapicnum==2536 && tilesizx[2536]==211 && tilesizy[2536]==55) // CHAINGUN
|
|
||||||
{
|
|
||||||
if (doy>=3 && y==2 && x>=78 && x<=157)
|
|
||||||
{
|
|
||||||
const coltype *onedown = &dapic[(y+1)*daxsiz2+x];
|
|
||||||
if (wpptr->a==0 && onedown->a!=0)
|
|
||||||
Bmemcpy(wpptr, onedown, sizeof(coltype));
|
|
||||||
// Remove the comment to see what texels are affected:
|
|
||||||
//wpptr->r=255; wpptr->g = wpptr->b = 0; wpptr->a = 255;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// END HACK
|
|
||||||
|
|
||||||
if (wpptr->a) continue;
|
if (wpptr->a) continue;
|
||||||
|
|
||||||
r = g = b = j = 0;
|
r = g = b = j = 0;
|
||||||
|
|
|
@ -1743,6 +1743,8 @@ static inline int32_t weapsc(int32_t sc)
|
||||||
return scale(sc, ud.weaponscale, 100);
|
return scale(sc, ud.weaponscale, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t g_dts_yadd;
|
||||||
|
|
||||||
static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p)
|
static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p)
|
||||||
{
|
{
|
||||||
int32_t ang = 0;
|
int32_t ang = 0;
|
||||||
|
@ -1796,7 +1798,7 @@ static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shad
|
||||||
y += (224-weapsc(224));
|
y += (224-weapsc(224));
|
||||||
#endif
|
#endif
|
||||||
rotatesprite(weapsc(x<<16) + ((xoff-weapsc(xoff))<<16),
|
rotatesprite(weapsc(x<<16) + ((xoff-weapsc(xoff))<<16),
|
||||||
weapsc(y<<16) + ((200-weapsc(200))<<16) + yofs,
|
weapsc((y<<16) + g_dts_yadd) + ((200-weapsc(200))<<16) + yofs,
|
||||||
weapsc(65536L),ang,tilenum,shade,p,(2|orientation),
|
weapsc(65536L),ang,tilenum,shade,p,(2|orientation),
|
||||||
wx[0],wy[0], wx[1],wy[1]);
|
wx[0],wy[0], wx[1],wy[1]);
|
||||||
}
|
}
|
||||||
|
@ -1829,36 +1831,33 @@ static void G_DrawWeaponTile(int32_t x, int32_t y, int32_t tilenum, int32_t shad
|
||||||
|
|
||||||
switch (ud.drawweapon)
|
switch (ud.drawweapon)
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
return;
|
|
||||||
case 1:
|
case 1:
|
||||||
|
#ifdef USE_OPENGL
|
||||||
|
if (getrendermode()>=REND_POLYMOST)
|
||||||
|
if (tilenum >= CHAINGUN+1 && tilenum <= CHAINGUN+4)
|
||||||
|
if (!usemodels || md_tilehasmodel(tilenum,p) < 0)
|
||||||
|
{
|
||||||
|
// HACK: Draw the upper part of the chaingun two screen
|
||||||
|
// pixels (not texels; multiplied by weapon scale) lower
|
||||||
|
// first, preventing ugly horizontal seam.
|
||||||
|
g_dts_yadd = (65536*2*200)/ydim;
|
||||||
|
G_DrawTileScaled(x,y,tilenum,shadef[slot],orientation,p);
|
||||||
|
g_dts_yadd = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
G_DrawTileScaled(x,y,tilenum,shadef[slot],orientation,p);
|
G_DrawTileScaled(x,y,tilenum,shadef[slot],orientation,p);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
const DukePlayer_t *const ps = g_player[screenpeek].ps;
|
const DukePlayer_t *const ps = g_player[screenpeek].ps;
|
||||||
const int32_t sc = scale(65536,ud.statusbarscale,100);
|
const int32_t sc = scale(65536,ud.statusbarscale,100);
|
||||||
|
|
||||||
switch (hudweap.cur)
|
if ((unsigned)hudweap.cur < MAX_WEAPONS && hudweap.cur != KNEE_WEAPON)
|
||||||
{
|
|
||||||
case PISTOL_WEAPON:
|
|
||||||
case CHAINGUN_WEAPON:
|
|
||||||
case RPG_WEAPON:
|
|
||||||
case FREEZE_WEAPON:
|
|
||||||
case SHRINKER_WEAPON:
|
|
||||||
case GROW_WEAPON:
|
|
||||||
case DEVISTATOR_WEAPON:
|
|
||||||
case TRIPBOMB_WEAPON:
|
|
||||||
case HANDREMOTE_WEAPON:
|
|
||||||
case HANDBOMB_WEAPON:
|
|
||||||
case SHOTGUN_WEAPON:
|
|
||||||
rotatesprite_win(160<<16,(180+(ps->weapon_pos*ps->weapon_pos))<<16,
|
rotatesprite_win(160<<16,(180+(ps->weapon_pos*ps->weapon_pos))<<16,
|
||||||
sc,0,hudweap.cur==GROW_WEAPON?GROWSPRITEICON:WeaponPickupSprites[hudweap.cur],
|
sc,0,hudweap.cur==GROW_WEAPON?GROWSPRITEICON:WeaponPickupSprites[hudweap.cur],
|
||||||
0,0,2);
|
0,0,2);
|
||||||
return;
|
return;
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2365,9 +2364,6 @@ void P_DisplayWeapon(int32_t snum)
|
||||||
weapon_xoffset += 1-(rand()&3);
|
weapon_xoffset += 1-(rand()&3);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DrawWeaponTile(weapon_xoffset+168-(p->look_ang>>1),looking_arc+260-gun_pos,
|
|
||||||
CHAINGUN,gs,o,pal,0);
|
|
||||||
|
|
||||||
switch (*kb)
|
switch (*kb)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -2401,6 +2397,9 @@ void P_DisplayWeapon(int32_t snum)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G_DrawWeaponTile(weapon_xoffset+168-(p->look_ang>>1),looking_arc+260-gun_pos,
|
||||||
|
CHAINGUN,gs,o,pal,0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue