mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Game: fix displayed viewscreen when its x/yrepeat isn't evenly divisible by 4.
git-svn-id: https://svn.eduke32.com/eduke32@5312 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
3375bce927
commit
ff56964e1b
5 changed files with 40 additions and 13 deletions
|
@ -2235,7 +2235,9 @@ DETONATE:
|
|||
g_curViewscreen = -1;
|
||||
sprite[i].yvel = 0; // VIEWSCREEN_YVEL
|
||||
T1 = 0;
|
||||
walock[TILE_VIEWSCR] = 199;
|
||||
|
||||
for (int ii=0; ii < VIEWSCREENFACTOR; ii++)
|
||||
walock[TILE_VIEWSCR-ii] = 199;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,9 @@ enum {
|
|||
#define TILE_TILT (MAXTILES-2)
|
||||
#define TILE_ANIM (MAXTILES-4)
|
||||
#define TILE_VIEWSCR (MAXTILES-5)
|
||||
EDUKE32_STATIC_ASSERT(5 <= MAXTILES-MAXUSERTILES);
|
||||
// Reserved: TILE_VIEWSCR_1 (MAXTILES-6)
|
||||
// Reserved: TILE_VIEWSCR_2 (MAXTILES-7)
|
||||
EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES);
|
||||
|
||||
// sprites with these statnums should be considered for fixing
|
||||
#define ROTFIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \
|
||||
|
|
|
@ -7518,6 +7518,10 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
|
|||
continue;
|
||||
case VIEWSCREEN__STATIC:
|
||||
case VIEWSCREEN2__STATIC:
|
||||
{
|
||||
const int viewscrShift = G_GetViewscreenSizeShift(t);
|
||||
const int viewscrTile = TILE_VIEWSCR-viewscrShift;
|
||||
|
||||
if (g_curViewscreen >= 0 && actor[OW].t_data[0] == 1)
|
||||
{
|
||||
t->picnum = STATIC;
|
||||
|
@ -7525,7 +7529,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
|
|||
t->xrepeat += 10;
|
||||
t->yrepeat += 9;
|
||||
}
|
||||
else if (g_curViewscreen == i && display_mirror != 3 && waloff[TILE_VIEWSCR] && walock[TILE_VIEWSCR] > 200)
|
||||
else if (g_curViewscreen == i && display_mirror != 3 && waloff[viewscrTile] && walock[viewscrTile] > 200)
|
||||
{
|
||||
// this exposes a sprite sorting issue which needs to be debugged further...
|
||||
#if 0
|
||||
|
@ -7541,16 +7545,15 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
|
|||
updatesector(newt->x, newt->y, &newt->sectnum);
|
||||
}
|
||||
#endif
|
||||
|
||||
t->picnum = TILE_VIEWSCR;
|
||||
|
||||
t->picnum = viewscrTile;
|
||||
#if VIEWSCREENFACTOR > 0
|
||||
t->xrepeat = (t->xrepeat>>VIEWSCREENFACTOR) + (t->xrepeat & 1);
|
||||
t->yrepeat = (t->yrepeat>>VIEWSCREENFACTOR) + (t->yrepeat & 1);
|
||||
t->xrepeat >>= viewscrShift;
|
||||
t->yrepeat >>= viewscrShift;
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SHRINKSPARK__STATIC:
|
||||
t->picnum = SHRINKSPARK+((totalclock>>4)&3);
|
||||
|
|
|
@ -613,6 +613,23 @@ static inline int32_t G_GetMusicIdx(const char *str)
|
|||
return (ep * MAXLEVELS) + lev;
|
||||
}
|
||||
|
||||
static inline int G_GetViewscreenSizeShift(const tspritetype *tspr)
|
||||
{
|
||||
#if VIEWSCREENFACTOR == 0
|
||||
UNREFERENCED_PARAMETER(tspr);
|
||||
return VIEWSCREENFACTOR;
|
||||
#else
|
||||
static const int mask = (1<<VIEWSCREENFACTOR)-1;
|
||||
const int rem = (tspr->xrepeat & mask) | (tspr->yrepeat & mask);
|
||||
|
||||
for (int i=0; i < VIEWSCREENFACTOR; i++)
|
||||
if (rem & (1<<i))
|
||||
return i;
|
||||
|
||||
return VIEWSCREENFACTOR;
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void G_StartMusic(void);
|
||||
|
||||
#ifdef LUNATIC
|
||||
|
|
|
@ -404,12 +404,15 @@ void G_AnimateCamSprite(int32_t smoothratio)
|
|||
|
||||
if (OW >= 0 && dist(&sprite[ps->i], &sprite[i]) < VIEWSCREEN_ACTIVE_DISTANCE)
|
||||
{
|
||||
if (waloff[TILE_VIEWSCR] == 0)
|
||||
allocatepermanenttile(TILE_VIEWSCR, tilesiz[PN].x<<VIEWSCREENFACTOR, tilesiz[PN].y<<VIEWSCREENFACTOR);
|
||||
else
|
||||
walock[TILE_VIEWSCR] = 255;
|
||||
const int viewscrShift = G_GetViewscreenSizeShift((const tspritetype *)&sprite[i]);
|
||||
const int viewscrTile = TILE_VIEWSCR-viewscrShift;
|
||||
|
||||
G_SetupCamTile(OW, TILE_VIEWSCR, smoothratio);
|
||||
if (waloff[viewscrTile] == 0)
|
||||
allocatepermanenttile(viewscrTile, tilesiz[PN].x<<viewscrShift, tilesiz[PN].y<<viewscrShift);
|
||||
else
|
||||
walock[viewscrTile] = 255;
|
||||
|
||||
G_SetupCamTile(OW, viewscrTile, smoothratio);
|
||||
#ifdef POLYMER
|
||||
// Force texture update on viewscreen sprite in Polymer!
|
||||
if (getrendermode() == REND_POLYMER)
|
||||
|
|
Loading…
Reference in a new issue