mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
rotatesprite hack from Fox
git-svn-id: https://svn.eduke32.com/eduke32@7321 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
7a8e368197
commit
8e50f47aa4
6 changed files with 23 additions and 0 deletions
|
@ -668,6 +668,9 @@ EXTERN int32_t xdim, ydim, numpages, upscalefactor;
|
||||||
EXTERN int32_t yxaspect, viewingrange;
|
EXTERN int32_t yxaspect, viewingrange;
|
||||||
EXTERN intptr_t *ylookup;
|
EXTERN intptr_t *ylookup;
|
||||||
|
|
||||||
|
EXTERN int32_t rotatesprite_y_offset;
|
||||||
|
EXTERN int32_t rotatesprite_yxaspect;
|
||||||
|
|
||||||
#ifndef GEKKO
|
#ifndef GEKKO
|
||||||
#define MAXVALIDMODES 256
|
#define MAXVALIDMODES 256
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -118,6 +118,8 @@ int32_t mouseReadAbs(vec2_t * const pResult, vec2_t const * const pInput)
|
||||||
pResult->x = scale(pInput->x, xwidth, xres) - ((xwidth>>1) - (320<<15));
|
pResult->x = scale(pInput->x, xwidth, xres) - ((xwidth>>1) - (320<<15));
|
||||||
pResult->y = scale(pInput->y, 200<<16, yres);
|
pResult->y = scale(pInput->y, 200<<16, yres);
|
||||||
|
|
||||||
|
pResult->y = divscale16(pResult->y - (200<<15), rotatesprite_yxaspect) + (200<<15) - rotatesprite_y_offset;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6379,6 +6379,8 @@ void dorotspr_handle_bit2(int32_t *sxptr, int32_t *syptr, int32_t *z, int32_t da
|
||||||
int32_t zoomsc, sx=*sxptr, sy=*syptr;
|
int32_t zoomsc, sx=*sxptr, sy=*syptr;
|
||||||
int32_t ouryxaspect = yxaspect, ourxyaspect = xyaspect;
|
int32_t ouryxaspect = yxaspect, ourxyaspect = xyaspect;
|
||||||
|
|
||||||
|
sy += rotatesprite_y_offset;
|
||||||
|
|
||||||
// screen center to s[xy], 320<<16 coords.
|
// screen center to s[xy], 320<<16 coords.
|
||||||
const int32_t normxofs = sx-(320<<15), normyofs = sy-(200<<15);
|
const int32_t normxofs = sx-(320<<15), normyofs = sy-(200<<15);
|
||||||
|
|
||||||
|
@ -6393,6 +6395,9 @@ void dorotspr_handle_bit2(int32_t *sxptr, int32_t *syptr, int32_t *z, int32_t da
|
||||||
ourxyaspect = (10<<16)/12;
|
ourxyaspect = (10<<16)/12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ouryxaspect = mulscale16(ouryxaspect, rotatesprite_yxaspect);
|
||||||
|
ourxyaspect = divscale16(ourxyaspect, rotatesprite_yxaspect);
|
||||||
|
|
||||||
// nasty hacks go here
|
// nasty hacks go here
|
||||||
if (!(dastat & RS_NOCLIP))
|
if (!(dastat & RS_NOCLIP))
|
||||||
{
|
{
|
||||||
|
@ -6414,6 +6419,7 @@ void dorotspr_handle_bit2(int32_t *sxptr, int32_t *syptr, int32_t *z, int32_t da
|
||||||
sx = ((twice_midcx+xbord)<<15) + scaledxofs;
|
sx = ((twice_midcx+xbord)<<15) + scaledxofs;
|
||||||
|
|
||||||
zoomsc = xdimenscale; //= scale(xdimen,yxaspect,320);
|
zoomsc = xdimenscale; //= scale(xdimen,yxaspect,320);
|
||||||
|
zoomsc = mulscale16(zoomsc, rotatesprite_yxaspect);
|
||||||
|
|
||||||
if ((dastat & RS_ALIGN_MASK) == RS_ALIGN_MASK)
|
if ((dastat & RS_ALIGN_MASK) == RS_ALIGN_MASK)
|
||||||
zoomsc = scale(zoomsc, ydim, oydim);
|
zoomsc = scale(zoomsc, ydim, oydim);
|
||||||
|
@ -7692,6 +7698,9 @@ int32_t engineInit(void)
|
||||||
|
|
||||||
xyaspect = -1;
|
xyaspect = -1;
|
||||||
|
|
||||||
|
rotatesprite_y_offset = 0;
|
||||||
|
rotatesprite_yxaspect = 65536;
|
||||||
|
|
||||||
showinvisibility = 0;
|
showinvisibility = 0;
|
||||||
|
|
||||||
for (i=1; i<1024; i++)
|
for (i=1; i<1024; i++)
|
||||||
|
|
|
@ -625,6 +625,8 @@ enum UserdefsLabel_t
|
||||||
USERDEFS_RETURN,
|
USERDEFS_RETURN,
|
||||||
USERDEFS_USERBYTEVERSION,
|
USERDEFS_USERBYTEVERSION,
|
||||||
USERDEFS_AUTOSAVE,
|
USERDEFS_AUTOSAVE,
|
||||||
|
USERDEFS_DRAW_Y,
|
||||||
|
USERDEFS_DRAW_YXASPECT,
|
||||||
USERDEFS_END
|
USERDEFS_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1344,6 +1344,8 @@ const memberlabel_t UserdefsLabels[]=
|
||||||
{ "return", USERDEFS_RETURN, LABEL_HASPARM2, MAX_RETURN_VALUES, -1 },
|
{ "return", USERDEFS_RETURN, LABEL_HASPARM2, MAX_RETURN_VALUES, -1 },
|
||||||
{ "userbyteversion", USERDEFS_USERBYTEVERSION, 0, 0, -1 },
|
{ "userbyteversion", USERDEFS_USERBYTEVERSION, 0, 0, -1 },
|
||||||
{ "autosave", USERDEFS_AUTOSAVE, 0, 0, -1 },
|
{ "autosave", USERDEFS_AUTOSAVE, 0, 0, -1 },
|
||||||
|
{ "draw_y", USERDEFS_DRAW_Y, 0, 0, -1 },
|
||||||
|
{ "draw_yxaspect", USERDEFS_DRAW_YXASPECT, 0, 0, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2)
|
int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2)
|
||||||
|
@ -1531,6 +1533,8 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2)
|
||||||
break;
|
break;
|
||||||
case USERDEFS_USERBYTEVERSION: labelNum = ud.userbytever; break;
|
case USERDEFS_USERBYTEVERSION: labelNum = ud.userbytever; break;
|
||||||
case USERDEFS_AUTOSAVE: labelNum = ud.autosave; break;
|
case USERDEFS_AUTOSAVE: labelNum = ud.autosave; break;
|
||||||
|
case USERDEFS_DRAW_Y: labelNum = rotatesprite_y_offset; break;
|
||||||
|
case USERDEFS_DRAW_YXASPECT: labelNum = rotatesprite_yxaspect; break;
|
||||||
|
|
||||||
default: EDUKE32_UNREACHABLE_SECTION(labelNum = -1; break);
|
default: EDUKE32_UNREACHABLE_SECTION(labelNum = -1; break);
|
||||||
}
|
}
|
||||||
|
@ -1730,6 +1734,8 @@ void __fastcall VM_SetUserdef(int const labelNum, int const lParm2, int32_t cons
|
||||||
break;
|
break;
|
||||||
case USERDEFS_USERBYTEVERSION: ud.userbytever = iSet; break;
|
case USERDEFS_USERBYTEVERSION: ud.userbytever = iSet; break;
|
||||||
case USERDEFS_AUTOSAVE: ud.autosave = iSet; break;
|
case USERDEFS_AUTOSAVE: ud.autosave = iSet; break;
|
||||||
|
case USERDEFS_DRAW_Y: rotatesprite_y_offset = iSet; break;
|
||||||
|
case USERDEFS_DRAW_YXASPECT: rotatesprite_yxaspect = iSet; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4357,6 +4357,7 @@ static int32_t xdim_from_320_16(int32_t x)
|
||||||
}
|
}
|
||||||
static int32_t ydim_from_200_16(int32_t y)
|
static int32_t ydim_from_200_16(int32_t y)
|
||||||
{
|
{
|
||||||
|
y = mulscale16(y + rotatesprite_y_offset - (200<<15), rotatesprite_yxaspect) + (200<<15);
|
||||||
return scale(y, ydim, 200<<16);
|
return scale(y, ydim, 200<<16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue