engine.c: add compilation switches for non-pow2 ysize functions, disable for now.

Previously, we used them in our builds for sprites, but MSVC builds don't have
the ASM ported to MASM, and thus the workaround of ignoring the linking errors
was not safe.

git-svn-id: https://svn.eduke32.com/eduke32@3031 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-09-28 15:20:03 +00:00
parent 99f9cfca7f
commit 52ed3e1a66

View file

@ -47,6 +47,7 @@
#include "engine_priv.h" #include "engine_priv.h"
#define CACHEAGETIME 16 #define CACHEAGETIME 16
//#define CLASSIC_NONPOW2_YSIZE
#if !defined DEBUG_MAIN_ARRAYS #if !defined DEBUG_MAIN_ARRAYS
const int32_t engine_main_arrays_are_static = 0; // for Lunatic const int32_t engine_main_arrays_are_static = 0; // for Lunatic
@ -2640,6 +2641,11 @@ skipitaddwall:
while (sectorbordercnt > 0); while (sectorbordercnt > 0);
} }
#undef NONPOW2_YSIZE_ASM
#if defined CLASSIC_NONPOW2_YSIZE && !defined ENGINE_USING_A_C
# define NONPOW2_YSIZE_ASM
#endif
// //
// maskwallscan (internal) // maskwallscan (internal)
@ -2686,7 +2692,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, i
p = x+frameoffset; p = x+frameoffset;
#ifndef ENGINE_USING_A_C #ifdef NONPOW2_YSIZE_ASM
if (globalshiftval==0) if (globalshiftval==0)
goto do_mvlineasm1; goto do_mvlineasm1;
#endif #endif
@ -2766,7 +2772,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, i
if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],pp+2); if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],pp+2);
if (y2ve[3] > d4) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],pp+3); if (y2ve[3] > d4) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],pp+3);
} }
#ifndef ENGINE_USING_A_C #ifdef NONPOW2_YSIZE_ASM
do_mvlineasm1: do_mvlineasm1:
#endif #endif
for (; x<=x2; x++,p++) for (; x<=x2; x++,p++)
@ -2784,7 +2790,7 @@ do_mvlineasm1:
vince[0] = (int64_t)swal[x]*globalyscale; vince[0] = (int64_t)swal[x]*globalyscale;
vplce[0] = globalzd + (uint32_t)vince[0]*(y1ve[0]-globalhoriz+1); vplce[0] = globalzd + (uint32_t)vince[0]*(y1ve[0]-globalhoriz+1);
#ifndef ENGINE_USING_A_C #ifdef NONPOW2_YSIZE_ASM
if (globalshiftval==0) if (globalshiftval==0)
mvlineasm1nonpow2(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],p+ylookup[y1ve[0]]); mvlineasm1nonpow2(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],p+ylookup[y1ve[0]]);
else else
@ -3676,7 +3682,7 @@ static void wallscan(int32_t x1, int32_t x2,
x = x1; x = x1;
while ((umost[x] > dmost[x]) && (x <= x2)) x++; while ((umost[x] > dmost[x]) && (x <= x2)) x++;
#ifndef ENGINE_USING_A_C #ifdef NONPOW2_YSIZE_ASM
if (globalshiftval==0) if (globalshiftval==0)
goto do_vlineasm1; goto do_vlineasm1;
#endif #endif
@ -3756,7 +3762,7 @@ static void wallscan(int32_t x1, int32_t x2,
if (y2ve[2] > d4) prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],p+2); if (y2ve[2] > d4) prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],p+2);
if (y2ve[3] > d4) prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],p+3); if (y2ve[3] > d4) prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],p+3);
} }
#ifndef ENGINE_USING_A_C #ifdef NONPOW2_YSIZE_ASM
do_vlineasm1: do_vlineasm1:
#endif #endif
for (; x<=x2; x++) for (; x<=x2; x++)
@ -3774,7 +3780,7 @@ do_vlineasm1:
vince[0] = (int64_t)swal[x]*globalyscale; vince[0] = (int64_t)swal[x]*globalyscale;
vplce[0] = globalzd + (uint32_t)vince[0]*(y1ve[0]-globalhoriz+1); vplce[0] = globalzd + (uint32_t)vince[0]*(y1ve[0]-globalhoriz+1);
#ifndef ENGINE_USING_A_C #ifdef NONPOW2_YSIZE_ASM
if (globalshiftval==0) if (globalshiftval==0)
vlineasm1nonpow2(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],x+frameoffset+ylookup[y1ve[0]]); vlineasm1nonpow2(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],x+frameoffset+ylookup[y1ve[0]]);
else else
@ -3813,7 +3819,7 @@ static void transmaskvline(int32_t x)
p = ylookup[y1v]+x+frameoffset; p = ylookup[y1v]+x+frameoffset;
#ifndef ENGINE_USING_A_C #ifdef NONPOW2_YSIZE_ASM
if (globalshiftval==0) if (globalshiftval==0)
tvlineasm1nonpow2(vinc,palookupoffs,y2v-y1v,vplc,bufplc,p); tvlineasm1nonpow2(vinc,palookupoffs,y2v-y1v,vplc,bufplc,p);
else else
@ -4527,12 +4533,10 @@ static void setup_globals_wall2(const walltype *wal, uint8_t secvisibility, int3
globvis = mulscale4(globvis, (int32_t)((uint8_t)(secvisibility+16))); globvis = mulscale4(globvis, (int32_t)((uint8_t)(secvisibility+16)));
globalshiftval = logtilesizy; globalshiftval = logtilesizy;
#if 1 #if !defined CLASSIC_NONPOW2_YSIZE
// before proper non-power-of-two tilesizy drawing // before proper non-power-of-two tilesizy drawing
if (pow2long[logtilesizy] != tilesizy[globalpicnum]) if (pow2long[logtilesizy] != tilesizy[globalpicnum])
globalshiftval++; globalshiftval++;
if (1)
#else #else
// non power-of-two y size textures! // non power-of-two y size textures!
if (pow2long[logtilesizy] == tsizy) if (pow2long[logtilesizy] == tsizy)
@ -4543,12 +4547,14 @@ static void setup_globals_wall2(const walltype *wal, uint8_t secvisibility, int3
globalshiftval = 32-globalshiftval; globalshiftval = 32-globalshiftval;
globalyscale = wal->yrepeat<<(globalshiftval-19); globalyscale = wal->yrepeat<<(globalshiftval-19);
} }
#if defined CLASSIC_NONPOW2_YSIZE
else else
{ {
globaltilesizy = tsizy; globaltilesizy = tsizy;
globalyscale = divscale13(wal->yrepeat, tsizy); globalyscale = divscale13(wal->yrepeat, tsizy);
globalshiftval = 0; globalshiftval = 0;
} }
#endif
if ((globalorientation&4) == 0) if ((globalorientation&4) == 0)
globalzd = (((int64_t)(globalposz-topzref)*globalyscale)<<8); globalzd = (((int64_t)(globalposz-topzref)*globalyscale)<<8);
@ -5382,12 +5388,10 @@ static void setup_globals_sprite1(const spritetype *tspr, const sectortype *sec,
tsizy = tilesizy[globalpicnum]; tsizy = tilesizy[globalpicnum];
globalshiftval = logtilesizy; globalshiftval = logtilesizy;
#if 0 #if !defined CLASSIC_NONPOW2_YSIZE
// before proper non-power-of-two tilesizy drawing // before proper non-power-of-two tilesizy drawing
if (pow2long[logtilesizy] != tilesizy[globalpicnum]) if (pow2long[logtilesizy] != tsizy)
globalshiftval++; globalshiftval++;
if (1)
#else #else
// non power-of-two y size textures! // non power-of-two y size textures!
if (pow2long[logtilesizy] == tsizy) if (pow2long[logtilesizy] == tsizy)
@ -5396,12 +5400,14 @@ static void setup_globals_sprite1(const spritetype *tspr, const sectortype *sec,
globalshiftval = 32-globalshiftval; globalshiftval = 32-globalshiftval;
globalyscale = divscale(512,tspr->yrepeat,globalshiftval-19); globalyscale = divscale(512,tspr->yrepeat,globalshiftval-19);
} }
#if defined CLASSIC_NONPOW2_YSIZE
else else
{ {
globaltilesizy = tsizy; globaltilesizy = tsizy;
globalyscale = (1<<22)/(tsizy*tspr->yrepeat); globalyscale = (1<<22)/(tsizy*tspr->yrepeat);
globalshiftval = 0; globalshiftval = 0;
} }
#endif
globalzd = ((int64_t)(globalposz-z1)*globalyscale)<<8; globalzd = ((int64_t)(globalposz-z1)*globalyscale)<<8;
if ((cstat&8) > 0) if ((cstat&8) > 0)