diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 00d0630bc..6b6208313 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -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; diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 39bb3ebe3..bb7245dc5 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -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; diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index dc3d94fd8..27644e1eb 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -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 } diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 7306a093c..fccbc3085 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -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) diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 83a4cd3aa..e190d2400 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -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;