Classic: implement screen tilting by 180 degrees without quality loss.

BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4364 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-03-05 21:12:59 +00:00
parent c405a13bbd
commit 73b3199b7c
2 changed files with 99 additions and 58 deletions

View file

@ -2293,6 +2293,14 @@ void copybufreverse(const void *S, void *D, int32_t c);
#endif #endif
static inline void swapbufreverse(void *s, void *d, int32_t c)
{
uint8_t *src = (uint8_t*)s, *dst = (uint8_t*)d;
while (c--) {
swapchar(dst++, src--);
}
}
#ifdef EXTERNC #ifdef EXTERNC
} }
#endif #endif

View file

@ -4418,7 +4418,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
int32_t tiltcx, tiltcy, tiltcs=0; // JBF 20030807 int32_t tiltcx, tiltcy, tiltcs=0; // JBF 20030807
const int32_t vr = divscale22(1,sprite[p->i].yrepeat+28); const int32_t vr = divscale22(1,sprite[p->i].yrepeat+28);
const int32_t software_screen_tilting = int32_t software_screen_tilting =
(getrendermode() == REND_CLASSIC && ((ud.screen_tilting && p->rotscrnang (getrendermode() == REND_CLASSIC && ((ud.screen_tilting && p->rotscrnang
#ifdef SPLITSCREEN_MOD_HACKS #ifdef SPLITSCREEN_MOD_HACKS
&& !g_fakeMultiMode && !g_fakeMultiMode
@ -4452,6 +4452,12 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
int32_t oviewingrange = viewingrange; // save it from setaspect() int32_t oviewingrange = viewingrange; // save it from setaspect()
const int16_t tang = (ud.screen_tilting) ? p->rotscrnang : 0; const int16_t tang = (ud.screen_tilting) ? p->rotscrnang : 0;
if (tang == 1024)
{
software_screen_tilting = 2;
}
else
{
// To render a tilted screen in high quality, we need at least // To render a tilted screen in high quality, we need at least
// 640 pixels of *Y* dimension. // 640 pixels of *Y* dimension.
#if MAXYDIM >= 640 #if MAXYDIM >= 640
@ -4508,6 +4514,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
tmpvr = i>>1; tmpvr = i>>1;
tmpyx = (65536*ydim*8)/(xdim*5); tmpyx = (65536*ydim*8)/(xdim*5);
} }
}
else if (getrendermode() >= REND_POLYMOST && (ud.screen_tilting else if (getrendermode() >= REND_POLYMOST && (ud.screen_tilting
#ifdef SPLITSCREEN_MOD_HACKS #ifdef SPLITSCREEN_MOD_HACKS
&& !g_fakeMultiMode && !g_fakeMultiMode
@ -4681,6 +4688,31 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
{ {
const int16_t tang = (ud.screen_tilting) ? p->rotscrnang : 0; const int16_t tang = (ud.screen_tilting) ? p->rotscrnang : 0;
if (software_screen_tilting == 2) // tang == 1024
{
begindrawing();
{
const int32_t height = windowy2-windowy1+1;
const int32_t width = windowx2-windowx1+1;
uint8_t *f = (uint8_t *)(frameplace + ylookup[windowy1]);
int32_t x, y;
for (y=0; y < (height>>1); y++)
swapbufreverse(f + y*bytesperline + windowx2,
f + (height-1-y)*bytesperline + windowx1,
width);
f += (height>>1)*bytesperline + windowx1;
if (height&1)
for (x=0; x<(width>>1); x++)
swapchar(&f[x], &f[width-1-x]);
}
enddrawing();
}
else
{
setviewback(); setviewback();
picanm[TILE_TILT].xofs = picanm[TILE_TILT].yofs = 0; picanm[TILE_TILT].xofs = picanm[TILE_TILT].yofs = 0;
@ -4693,6 +4725,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
rotatesprite_win(160<<16,100<<16,i,tang+512,TILE_TILT,0,0,4+2+64+1024); rotatesprite_win(160<<16,100<<16,i,tang+512,TILE_TILT,0,0,4+2+64+1024);
walock[TILE_TILT] = 199; walock[TILE_TILT] = 199;
} }
}
else if (pixelDoubling) else if (pixelDoubling)
{ {
Bassert(g_halfScreen.xdimen!=0); Bassert(g_halfScreen.xdimen!=0);