Polymodes/Lunatic: don't do y panning "correction" for nonpow2 ysize tiles.

git-svn-id: https://svn.eduke32.com/eduke32@3926 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-07-04 19:38:37 +00:00
parent e771c7faf3
commit 184a7322de
5 changed files with 34 additions and 32 deletions

View File

@ -611,6 +611,7 @@ typedef struct {
EXTERN int32_t guniqhudid;
EXTERN int32_t spritesortcnt;
extern int32_t g_loadedMapVersion;
#if !defined DEBUG_MAIN_ARRAYS
EXTERN spriteext_t *spriteext;

View File

@ -100,7 +100,6 @@ int32_t zoom = 768, gettilezoom = 1;
int32_t lastpm16time = 0;
extern int32_t mapversion;
extern int32_t g_loadedMapVersion;
int16_t highlight[MAXWALLS+MAXSPRITES];
int16_t highlightsector[MAXSECTORS], highlightsectorcnt = -1;

View File

@ -84,13 +84,13 @@ int32_t g_loadedMapVersion = -1; // -1: none (e.g. started new)
static int32_t get_mapversion(void);
// Handle nonpow2-ysize walls walls the old way?
// Handle nonpow2-ysize walls the old way?
static inline int32_t oldnonpow2(void)
{
#if !defined CLASSIC_NONPOW2_YSIZE_WALLS
return 1;
#else
return (mapversion < 10);
return (g_loadedMapVersion < 10);
#endif
}

View File

@ -2820,23 +2820,29 @@ static int32_t polymer_initwall(int16_t wallnum)
static float calc_ypancoef(char curypanning, int16_t curpicnum, int32_t dopancor)
{
float ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]);
if (ypancoef < tilesizy[curpicnum])
ypancoef *= 2;
if (dopancor)
#ifdef NEW_MAP_FORMAT
if (g_loadedMapVersion >= 10)
return curypanning / 256.0f;
#endif
{
int32_t yoffs;
float ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]);
ftol((ypancoef - tilesizy[curpicnum]) * (255.0f / ypancoef), &yoffs);
if (curypanning > 256 - yoffs)
curypanning -= yoffs;
if (ypancoef < tilesizy[curpicnum])
ypancoef *= 2;
if (dopancor)
{
int32_t yoffs;
ftol((ypancoef - tilesizy[curpicnum]) * (255.0f / ypancoef), &yoffs);
if (curypanning > 256 - yoffs)
curypanning -= yoffs;
}
ypancoef *= (float)curypanning / (256.0f * (float)tilesizy[curpicnum]);
return ypancoef;
}
ypancoef *= (float)curypanning / (256.0f * (float)tilesizy[curpicnum]);
return ypancoef;
}
static void polymer_updatewall(int16_t wallnum)

View File

@ -2249,31 +2249,27 @@ static void calc_ypanning(int32_t refposz, double ryp0, double ryp1,
{
int32_t i;
double t0, t1, t, fy;
int32_t yoffs; // for panning "correction"
t0 = ((float)(refposz-globalposz))*ryp0 + ghoriz;
t1 = ((float)(refposz-globalposz))*ryp1 + ghoriz;
t = ((gdx*x0 + gdo) * (float)yrepeat) / ((x1-x0) * ryp0 * 2048.f);
i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1;
#ifdef NEW_MAP_FORMAT
if (g_loadedMapVersion >= 10)
i = tilesizy[globalpicnum];
else
#endif
if (dopancor)
{
// Carry out panning "correction" to make it look like classic in some
// cases, but failing in the general case.
int32_t yoffs;
ftol((i-tilesizy[globalpicnum])*(255.f/i), &yoffs);
if (ypan>256-yoffs)
{
ypan-=yoffs;
}
}
else
{
// (1)
// not hacked yet
// (2)
// Still need a hack, depending on the wall(height,ypanning,yrepeat,tilesizy)
// it should do "ypan-=yoffs" or "ypan+=yoffs" or [nothing].
// Example: the film projector in the E1L1.map needs "ypan-=yoffs"
if (ypan > 256-yoffs)
ypan -= yoffs;
}
fy = (float)ypan * ((float)i) / 256.0;