mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
Polymodes: make flipping closer to classic.
This fixes cases A and B in test_tileoffsets.map. git-svn-id: https://svn.eduke32.com/eduke32@3778 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
64406cc25c
commit
946d207c56
2 changed files with 22 additions and 22 deletions
|
@ -3546,7 +3546,7 @@ static inline void polymer_scansprites(int16_t sectnum, spritetype* localtsprit
|
||||||
|
|
||||||
void polymer_updatesprite(int32_t snum)
|
void polymer_updatesprite(int32_t snum)
|
||||||
{
|
{
|
||||||
int32_t curpicnum, xsize, ysize, tilexoff, tileyoff, xoff, yoff, i, j, cs;
|
int32_t curpicnum, xsize, ysize, tilexoff, tileyoff, xoff, yoff, i, j;
|
||||||
spritetype *tspr = tspriteptr[snum];
|
spritetype *tspr = tspriteptr[snum];
|
||||||
float xratio, yratio, ang, f;
|
float xratio, yratio, ang, f;
|
||||||
float spos[3];
|
float spos[3];
|
||||||
|
@ -3554,12 +3554,13 @@ void polymer_updatesprite(int32_t snum)
|
||||||
uint8_t flipu, flipv;
|
uint8_t flipu, flipv;
|
||||||
_prsprite *s;
|
_prsprite *s;
|
||||||
|
|
||||||
|
const uint32_t cs = tspr->cstat;
|
||||||
|
const uint32_t alignmask = (cs & SPR_ALIGN_MASK);
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Updating sprite %i...\n", snum);
|
if (pr_verbosity >= 3) OSD_Printf("PR : Updating sprite %i...\n", snum);
|
||||||
|
|
||||||
if (tspr->owner < 0 || tspr->picnum < 0) return;
|
if (tspr->owner < 0 || tspr->picnum < 0) return;
|
||||||
|
|
||||||
cs = tspr->cstat;
|
|
||||||
|
|
||||||
if (prsprites[tspr->owner] == NULL)
|
if (prsprites[tspr->owner] == NULL)
|
||||||
{
|
{
|
||||||
prsprites[tspr->owner] = (_prsprite *) Bcalloc(sizeof(_prsprite), 1);
|
prsprites[tspr->owner] = (_prsprite *) Bcalloc(sizeof(_prsprite), 1);
|
||||||
|
@ -3661,27 +3662,25 @@ void polymer_updatesprite(int32_t snum)
|
||||||
inbuffer = vertsprite;
|
inbuffer = vertsprite;
|
||||||
|
|
||||||
{
|
{
|
||||||
// Initially set flipu and flipv.
|
const uint8_t xflip = !!(cs & SPR_XFLIP);
|
||||||
const uint8_t xflip = !!(tspr->cstat & SPR_XFLIP);
|
const uint8_t yflip = !!(cs & SPR_YFLIP);
|
||||||
const uint8_t yflip = !!(tspr->cstat & SPR_YFLIP);
|
const uint8_t flooraligned = (alignmask==SPR_FLOOR);
|
||||||
const uint8_t flooraligned = ((tspr->cstat & SPR_ALIGN_MASK)==SPR_FLOOR);
|
|
||||||
|
|
||||||
|
// Initially set flipu and flipv.
|
||||||
flipu = (xflip ^ flooraligned);
|
flipu = (xflip ^ flooraligned);
|
||||||
flipv = (yflip && !flooraligned);
|
flipv = (yflip && !flooraligned);
|
||||||
}
|
|
||||||
|
|
||||||
if (pr_billboardingmode && (tspr->cstat & SPR_ALIGN_MASK)==0)
|
if (pr_billboardingmode && alignmask==0)
|
||||||
{
|
{
|
||||||
// do surgery on the face tspr to make it look like a wall sprite
|
// do surgery on the face tspr to make it look like a wall sprite
|
||||||
tspr->cstat |= 16;
|
tspr->cstat |= 16;
|
||||||
tspr->ang = (viewangle + 1024) & 2047;
|
tspr->ang = (viewangle + 1024) & 2047;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flipu) {
|
if (flipu)
|
||||||
xoff = -xoff;
|
xoff = -xoff;
|
||||||
}
|
|
||||||
|
|
||||||
if (flipv) {
|
if (yflip && alignmask!=0)
|
||||||
yoff = -yoff;
|
yoff = -yoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3743,7 +3742,7 @@ void polymer_updatesprite(int32_t snum)
|
||||||
|
|
||||||
polymer_computeplane(&s->plane);
|
polymer_computeplane(&s->plane);
|
||||||
|
|
||||||
if ((cs & SPR_ALIGN_MASK) && (pr_vbos > 0))
|
if (alignmask && (pr_vbos > 0))
|
||||||
{
|
{
|
||||||
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, s->plane.vbo);
|
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, s->plane.vbo);
|
||||||
bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 4 * sizeof(GLfloat) * 5, s->plane.buffer);
|
bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 4 * sizeof(GLfloat) * 5, s->plane.buffer);
|
||||||
|
@ -3755,7 +3754,7 @@ void polymer_updatesprite(int32_t snum)
|
||||||
s->plane.vbo = 0;
|
s->plane.vbo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tspr->cstat & SPR_ALIGN_MASK)
|
if (alignmask)
|
||||||
{
|
{
|
||||||
int32_t curpriority = 0;
|
int32_t curpriority = 0;
|
||||||
|
|
||||||
|
|
|
@ -3835,7 +3835,8 @@ void polymost_drawsprite(int32_t snum)
|
||||||
case 0: //Face sprite
|
case 0: //Face sprite
|
||||||
//Project 3D to 2D
|
//Project 3D to 2D
|
||||||
if (globalorientation&4) xoff = -xoff;
|
if (globalorientation&4) xoff = -xoff;
|
||||||
if (globalorientation&8) yoff = -yoff;
|
// NOTE: yoff not negated not for y flipping, unlike wall and floor
|
||||||
|
// aligned sprites.
|
||||||
|
|
||||||
sx0 = (float)(tspr->x-globalposx);
|
sx0 = (float)(tspr->x-globalposx);
|
||||||
sy0 = (float)(tspr->y-globalposy);
|
sy0 = (float)(tspr->y-globalposy);
|
||||||
|
|
Loading…
Reference in a new issue