Add V_VFLIP

Ironman can now be shitty
This commit is contained in:
Sally Coolatta 2022-11-03 08:47:44 -04:00
parent 565a6de546
commit 29595f946b
5 changed files with 50 additions and 22 deletions

View file

@ -6690,6 +6690,7 @@ struct int_const_s const INT_CONST[] = {
{"V_OVERLAY",V_OVERLAY},
{"V_ALLOWLOWERCASE",V_ALLOWLOWERCASE},
{"V_FLIP",V_FLIP},
{"V_VFLIP",V_VFLIP},
{"V_SNAPTOTOP",V_SNAPTOTOP},
{"V_SNAPTOBOTTOM",V_SNAPTOBOTTOM},
{"V_SNAPTOLEFT",V_SNAPTOLEFT},

View file

@ -188,7 +188,10 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
offsetx = (float)(gpatch->leftoffset) * fscalew;
// top offset
offsety = (float)(gpatch->topoffset) * fscaleh;
if (option & V_VFLIP)
offsety = (float)(gpatch->height - gpatch->topoffset) * fscaleh;
else
offsety = (float)(gpatch->topoffset) * fscaleh;
cx -= offsetx;
cy -= offsety;
@ -249,8 +252,16 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
v[2].s = v[1].s = hwrPatch->max_s;
}
v[0].t = v[1].t = 0.0f;
v[2].t = v[3].t = hwrPatch->max_t;
if (option & V_VFLIP)
{
v[0].t = v[1].t = hwrPatch->max_t;
v[2].t = v[3].t = 0.0f;
}
else
{
v[0].t = v[1].t = 0.0f;
v[2].t = v[3].t = hwrPatch->max_t;
}
flags = PF_NoDepthTest;

View file

@ -1791,8 +1791,8 @@ static boolean K_drawKartPositionFaces(void)
&& !P_MobjWasRemoved(players[rankplayer[i]].mo)
&& !(((skin_t*)players[rankplayer[i]].mo->skin)->flags & SF_IRONMAN) )
{
flipflag = V_FLIP;
xoff = 16;
flipflag = V_FLIP|V_VFLIP; // blonic flip
xoff = yoff = 16;
} else
{
flipflag = 0;

View file

@ -593,10 +593,6 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
colfrac = FixedDiv(FRACUNIT, fdup);
rowfrac = FixedDiv(FRACUNIT, vdup);
// 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
{
fixed_t offsetx = 0, offsety = 0;
@ -607,15 +603,17 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
offsetx = FixedMul(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(patch->topoffset<<FRACBITS, vscale);
if (scrn & V_VFLIP)
offsety = FixedMul((patch->height - patch->topoffset)<<FRACBITS, vscale) + 1;
else
offsety = FixedMul(patch->topoffset<<FRACBITS, vscale);
// Subtract the offsets from x/y positions
x -= offsetx;
y -= offsety;
}
desttop = screens[scrn&V_PARAMMASK];
desttop = screens[scrn&V_SCREENMASK];
if (!desttop)
return;
@ -674,6 +672,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
if (x+offx >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
break;
}
column = (const column_t *)((const UINT8 *)(patch->columns) + (patch->columnofs[col>>FRACBITS]));
while (column->topdelta != 0xff)
@ -683,17 +682,31 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
topdelta += prevdelta;
prevdelta = topdelta;
source = (const UINT8 *)(column) + 3;
dest = desttop;
if (scrn & V_FLIP)
dest = deststart + (destend - desttop);
dest = deststart + (destend - dest);
dest += FixedInt(FixedMul(topdelta<<FRACBITS,vdup))*vid.width;
for (ofs = 0; dest < deststop && (ofs>>FRACBITS) < column->length; ofs += rowfrac)
if (scrn & V_VFLIP)
{
if (dest >= screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = patchdrawfunc(dest, source, ofs);
dest += vid.width;
for (ofs = (column->length << FRACBITS)-1; dest < deststop && ofs >= 0; ofs -= rowfrac)
{
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = patchdrawfunc(dest, source, ofs);
dest += vid.width;
}
}
else
{
for (ofs = 0; dest < deststop && ofs < (column->length << FRACBITS); ofs += rowfrac)
{
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = patchdrawfunc(dest, source, ofs);
dest += vid.width;
}
}
column = (const column_t *)((const UINT8 *)column + column->length + 4);
}
}
@ -752,7 +765,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
y -= FixedMul(patch->topoffset<<FRACBITS, pscale);
x -= FixedMul(patch->leftoffset<<FRACBITS, pscale);
desttop = screens[scrn&V_PARAMMASK];
desttop = screens[scrn&V_SCREENMASK];
if (!desttop)
return;
@ -804,7 +817,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
for (; dest < deststop && (ofs>>FRACBITS) < column->length && (((ofs>>FRACBITS) - sy) + topdelta) < h; ofs += rowfrac)
{
if (dest >= screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = patchdrawfunc(dest, source, ofs);
dest += vid.width;
}

View file

@ -81,11 +81,14 @@ void V_CubeApply(RGBA_t *input);
#define V_GetColor(color) (pLocalPalette[color&0xFF])
#define V_GetMasterColor(color) (pMasterPalette[color&0xFF])
// Bottom 8 bits are used for parameter (screen or character)
// Bottom 8 bits are used for parameter (character)
#define V_PARAMMASK 0x000000FF
// strings/characters only
#define V_STRINGDANCE 0x00000002
// Bottom bit is used for screen (patches)
#define V_SCREENMASK 0x0000000F
#define V_STRINGDANCE 0x00000002 // (strings/characters only) funny undertale
#define V_VFLIP 0x00000010 // (patches only) Vertical flip
// flags hacked in scrn (not supported by all functions (see src))
// patch scaling uses bits 9 and 10