mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Merge branch 'master' into next
This commit is contained in:
commit
f37a573834
2 changed files with 62 additions and 42 deletions
|
@ -112,10 +112,10 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
||||||
if (option & V_NOSCALESTART)
|
if (option & V_NOSCALESTART)
|
||||||
sdupx = sdupy = 2.0f;
|
sdupx = sdupy = 2.0f;
|
||||||
|
|
||||||
v[0].x = v[3].x = (x*sdupx-gpatch->leftoffset*pdupx)/vid.width - 1;
|
v[0].x = v[3].x = (x*sdupx-SHORT(gpatch->leftoffset)*pdupx)/vid.width - 1;
|
||||||
v[2].x = v[1].x = (x*sdupx+(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1;
|
v[2].x = v[1].x = (x*sdupx+(SHORT(gpatch->width)-SHORT(gpatch->leftoffset))*pdupx)/vid.width - 1;
|
||||||
v[0].y = v[1].y = 1-(y*sdupy-gpatch->topoffset*pdupy)/vid.height;
|
v[0].y = v[1].y = 1-(y*sdupy-SHORT(gpatch->topoffset)*pdupy)/vid.height;
|
||||||
v[2].y = v[3].y = 1-(y*sdupy+(gpatch->height-gpatch->topoffset)*pdupy)/vid.height;
|
v[2].y = v[3].y = 1-(y*sdupy+(SHORT(gpatch->height)-SHORT(gpatch->topoffset))*pdupy)/vid.height;
|
||||||
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
|
@ -179,18 +179,29 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||||
dupx = dupy = (dupx < dupy ? dupx : dupy);
|
dupx = dupy = (dupx < dupy ? dupx : dupy);
|
||||||
fscale = FIXED_TO_FLOAT(pscale);
|
fscale = FIXED_TO_FLOAT(pscale);
|
||||||
|
|
||||||
if (option & V_OFFSET)
|
// See my comments in v_video.c's V_DrawFixedPatch
|
||||||
|
// -- Monster Iestyn 29/10/18
|
||||||
{
|
{
|
||||||
cx -= (float)gpatch->leftoffset * dupx * fscale;
|
float offsetx = 0.0f, offsety = 0.0f;
|
||||||
cy -= (float)gpatch->topoffset * dupy * fscale;
|
|
||||||
}
|
// left offset
|
||||||
else
|
|
||||||
{
|
|
||||||
cy -= (float)gpatch->topoffset * fscale;
|
|
||||||
if (option & V_FLIP)
|
if (option & V_FLIP)
|
||||||
cx -= ((float)gpatch->width - (float)gpatch->leftoffset) * fscale;
|
offsetx = (float)(SHORT(gpatch->width) - SHORT(gpatch->leftoffset)) * fscale;
|
||||||
else
|
else
|
||||||
cx -= (float)gpatch->leftoffset * fscale;
|
offsetx = (float)SHORT(gpatch->leftoffset) * fscale;
|
||||||
|
|
||||||
|
// top offset
|
||||||
|
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
|
||||||
|
offsety = (float)SHORT(gpatch->topoffset) * fscale;
|
||||||
|
|
||||||
|
if ((option & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs
|
||||||
|
{
|
||||||
|
offsetx *= dupx;
|
||||||
|
offsety *= dupy;
|
||||||
|
}
|
||||||
|
|
||||||
|
cx -= offsetx;
|
||||||
|
cy -= offsety;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option & V_SPLITSCREEN)
|
if (option & V_SPLITSCREEN)
|
||||||
|
@ -237,13 +248,13 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||||
|
|
||||||
if (pscale != FRACUNIT)
|
if (pscale != FRACUNIT)
|
||||||
{
|
{
|
||||||
fwidth = (float)gpatch->width * fscale * dupx;
|
fwidth = (float)SHORT(gpatch->width) * fscale * dupx;
|
||||||
fheight = (float)gpatch->height * fscale * dupy;
|
fheight = (float)SHORT(gpatch->height) * fscale * dupy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fwidth = (float)gpatch->width * dupx;
|
fwidth = (float)SHORT(gpatch->width) * dupx;
|
||||||
fheight = (float)gpatch->height * dupy;
|
fheight = (float)SHORT(gpatch->height) * dupy;
|
||||||
}
|
}
|
||||||
|
|
||||||
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
|
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
|
||||||
|
@ -341,8 +352,8 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
dupx = dupy = (dupx < dupy ? dupx : dupy);
|
dupx = dupy = (dupx < dupy ? dupx : dupy);
|
||||||
fscale = FIXED_TO_FLOAT(pscale);
|
fscale = FIXED_TO_FLOAT(pscale);
|
||||||
|
|
||||||
cy -= (float)gpatch->topoffset * fscale;
|
cy -= (float)SHORT(gpatch->topoffset) * fscale;
|
||||||
cx -= (float)gpatch->leftoffset * fscale;
|
cx -= (float)SHORT(gpatch->leftoffset) * fscale;
|
||||||
|
|
||||||
if (!(option & V_NOSCALESTART))
|
if (!(option & V_NOSCALESTART))
|
||||||
{
|
{
|
||||||
|
@ -392,11 +403,11 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
if (fheight > h - sy)
|
if (fheight > h - sy)
|
||||||
fheight = h - sy;
|
fheight = h - sy;
|
||||||
|
|
||||||
if (fwidth > gpatch->width)
|
if (fwidth > SHORT(gpatch->width))
|
||||||
fwidth = gpatch->width;
|
fwidth = SHORT(gpatch->width);
|
||||||
|
|
||||||
if (fheight > gpatch->height)
|
if (fheight > SHORT(gpatch->height))
|
||||||
fheight = gpatch->height;
|
fheight = SHORT(gpatch->height);
|
||||||
|
|
||||||
if (pscale != FRACUNIT)
|
if (pscale != FRACUNIT)
|
||||||
{
|
{
|
||||||
|
@ -426,10 +437,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
v[0].sow = v[3].sow = ((sx)/(float)gpatch->width )*gpatch->max_s;
|
v[0].sow = v[3].sow = ((sx)/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||||
v[2].sow = v[1].sow = ((w )/(float)gpatch->width )*gpatch->max_s;
|
v[2].sow = v[1].sow = ((w )/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||||
v[0].tow = v[1].tow = ((sy)/(float)gpatch->height)*gpatch->max_t;
|
v[0].tow = v[1].tow = ((sy)/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||||
v[2].tow = v[3].tow = ((h )/(float)gpatch->height)*gpatch->max_t;
|
v[2].tow = v[3].tow = ((h )/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||||
|
|
||||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,6 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
{
|
{
|
||||||
UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t);
|
UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t);
|
||||||
UINT32 alphalevel = 0;
|
UINT32 alphalevel = 0;
|
||||||
boolean flip = false;
|
|
||||||
|
|
||||||
fixed_t col, ofs, colfrac, rowfrac, fdup;
|
fixed_t col, ofs, colfrac, rowfrac, fdup;
|
||||||
INT32 dupx, dupy;
|
INT32 dupx, dupy;
|
||||||
|
@ -406,22 +405,32 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
colfrac = FixedDiv(FRACUNIT, fdup);
|
colfrac = FixedDiv(FRACUNIT, fdup);
|
||||||
rowfrac = FixedDiv(FRACUNIT, fdup);
|
rowfrac = FixedDiv(FRACUNIT, fdup);
|
||||||
|
|
||||||
if (scrn & V_OFFSET) // Crosshair shit
|
// So it turns out offsets aren't scaled in V_NOSCALESTART unless V_OFFSET is applied ...poo, that's terrible
|
||||||
|
// For now let's just at least give V_OFFSET the ability to support V_FLIP
|
||||||
|
// I'll probably make a better fix for 2.2 where I don't have to worry about breaking existing support for stuff
|
||||||
|
// -- Monster Iestyn 29/10/18
|
||||||
{
|
{
|
||||||
y -= FixedMul((SHORT(patch->topoffset)*dupy)<<FRACBITS, pscale);
|
fixed_t offsetx = 0, offsety = 0;
|
||||||
x -= FixedMul((SHORT(patch->leftoffset)*dupx)<<FRACBITS, pscale);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
y -= FixedMul(SHORT(patch->topoffset)<<FRACBITS, pscale);
|
|
||||||
|
|
||||||
|
// left offset
|
||||||
if (scrn & V_FLIP)
|
if (scrn & V_FLIP)
|
||||||
{
|
offsetx = FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale) + 1;
|
||||||
flip = true;
|
|
||||||
x -= FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale) + 1;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
x -= FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
|
offsetx = FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
|
||||||
|
|
||||||
|
// top offset
|
||||||
|
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
|
||||||
|
offsety = FixedMul(SHORT(patch->topoffset)<<FRACBITS, pscale);
|
||||||
|
|
||||||
|
if ((scrn & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs
|
||||||
|
{
|
||||||
|
offsetx = FixedMul(offsetx, dupx<<FRACBITS);
|
||||||
|
offsety = FixedMul(offsety, dupy<<FRACBITS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subtract the offsets from x/y positions
|
||||||
|
x -= offsetx;
|
||||||
|
y -= offsety;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrn & V_SPLITSCREEN)
|
if (scrn & V_SPLITSCREEN)
|
||||||
|
@ -497,7 +506,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++offx, desttop++)
|
for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++offx, desttop++)
|
||||||
{
|
{
|
||||||
INT32 topdelta, prevdelta = -1;
|
INT32 topdelta, prevdelta = -1;
|
||||||
if (flip) // offx is measured from right edge instead of left
|
if (scrn & V_FLIP) // offx is measured from right edge instead of left
|
||||||
{
|
{
|
||||||
if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||||
break;
|
break;
|
||||||
|
@ -521,7 +530,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
prevdelta = topdelta;
|
prevdelta = topdelta;
|
||||||
source = (const UINT8 *)(column) + 3;
|
source = (const UINT8 *)(column) + 3;
|
||||||
dest = desttop;
|
dest = desttop;
|
||||||
if (flip)
|
if (scrn & V_FLIP)
|
||||||
dest = deststart + (destend - desttop);
|
dest = deststart + (destend - desttop);
|
||||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,fdup))*vid.width;
|
dest += FixedInt(FixedMul(topdelta<<FRACBITS,fdup))*vid.width;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue