diff --git a/Engine/src/draw.c b/Engine/src/draw.c index 00ca069..56fdc5e 100644 --- a/Engine/src/draw.c +++ b/Engine/src/draw.c @@ -36,7 +36,7 @@ static int transrev = 0; /* --------------- WALLS RENDERING METHOD (USED TO BE HIGHLY OPTIMIZED ASSEMBLY) ----------------------------*/ extern int32_t asm1; -extern intptr_t asm2; +extern long asm2; extern uint8_t *asm3; extern int32_t asm4; @@ -90,9 +90,9 @@ void hlineasm4(int32_t numPixels, int32_t shade, uint32_t i4, uint32_t i5, uint8 static int32_t rmach_eax; static int32_t rmach_ebx; static int32_t rmach_ecx; -static int32_t rmach_edx; +static long rmach_edx; static int32_t rmach_esi; -void setuprhlineasm4(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6) +void setuprhlineasm4(int32_t i1, int32_t i2, int32_t i3, long i4, int32_t i5, int32_t i6) { rmach_eax = i1; rmach_ebx = i2; @@ -102,11 +102,11 @@ void setuprhlineasm4(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, } -void rhlineasm4(int32_t i1, uint8_t* texture, int32_t i3, uint32_t i4, uint32_t i5, int32_t dest) +void rhlineasm4(int32_t i1, uint8_t* texture, int32_t i3, uint32_t i4, uint32_t i5, uint8_t* dest) { uint32_t ebp = dest - i1; - uint32_t rmach6b = ebp-1; int32_t numPixels; + int32_t offset = i1 + 1; if (i1 <= 0) return; @@ -129,7 +129,7 @@ void rhlineasm4(int32_t i1, uint8_t* texture, int32_t i3, uint32_t i4, uint32_t i1 = ((i1&0xffffff00)|(((uint8_t *)i3)[rmach_edx])); if (pixelsAllowed-- > 0) - ((uint8_t *)rmach6b)[numPixels] = (i1&0xff); + dest[numPixels - offset] = (i1&0xff); texture -= ebp; numPixels--; @@ -139,9 +139,9 @@ void rhlineasm4(int32_t i1, uint8_t* texture, int32_t i3, uint32_t i4, uint32_t static int32_t rmmach_eax; static int32_t rmmach_ebx; static int32_t rmmach_ecx; -static int32_t rmmach_edx; +static long rmmach_edx; static int32_t setupTileHeight; -void setuprmhlineasm4(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t tileHeight, int32_t i6) +void setuprmhlineasm4(int32_t i1, int32_t i2, int32_t i3, long i4, int32_t tileHeight, int32_t i6) { rmmach_eax = i1; rmmach_ebx = i2; @@ -152,11 +152,11 @@ void setuprmhlineasm4(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t ti //FCS: ???? -void rmhlineasm4(int32_t i1, intptr_t shade, int32_t colorIndex, int32_t i4, int32_t i5, int32_t dest) +void rmhlineasm4(int32_t i1, uint8_t* shade, int32_t colorIndex, int32_t i4, int32_t i5, uint8_t* dest) { uint32_t ebp = dest - i1; - uint32_t rmach6b = ebp-1; int32_t numPixels; + int32_t offset = i1 + 1; if (i1 <= 0) return; @@ -183,7 +183,7 @@ void rmhlineasm4(int32_t i1, intptr_t shade, int32_t colorIndex, int32_t i4, int if (pixelsAllowed-- > 0) { i1 = ((i1&0xffffff00)|(((uint8_t *)colorIndex)[rmmach_edx])); - ((uint8_t *)rmach6b)[numPixels] = (i1&0xff); + dest[numPixels - offset] = (i1&0xff); } } @@ -295,9 +295,9 @@ int32_t tvlineasm1(int32_t i1, uint8_t * texture, int32_t numPixels, int32_t i4 static uint8_t tran2shr; -static uint32_t tran2pal_ebx; -static uint32_t tran2pal_ecx; -void setuptvlineasm2(int32_t i1, int32_t i2, int32_t i3) +static unsigned long tran2pal_ebx; +static unsigned long tran2pal_ecx; +void setuptvlineasm2(int32_t i1, long i2, long i3) { tran2shr = (i1&0x1f); tran2pal_ebx = i2; @@ -305,15 +305,15 @@ void setuptvlineasm2(int32_t i1, int32_t i2, int32_t i3) } /* */ -void tvlineasm2(uint32_t i1, uint32_t i2, uintptr_t i3, uintptr_t i4, uint32_t i5, uintptr_t i6) +void tvlineasm2(uint32_t i1, uint32_t i2, unsigned long i3, unsigned long i4, uint32_t i5, unsigned long i6) { uint32_t ebp = i1; uint32_t tran2inca = i2; uint32_t tran2incb = asm1; - uintptr_t tran2bufa = i3; - uintptr_t tran2bufb = i4; - uintptr_t tran2edi = asm2; - uintptr_t tran2edi1 = asm2 + 1; + unsigned long tran2bufa = i3; + unsigned long tran2bufb = i4; + unsigned long tran2edi = asm2; + unsigned long tran2edi1 = asm2 + 1; i6 -= asm2; @@ -400,7 +400,7 @@ void setupvlineasm(int32_t i1) } //FCS This is used to fill the inside of a wall (so it draws VERTICAL column, always). -void vlineasm4(int32_t columnIndex, intptr_t framebuffer) +void vlineasm4(int32_t columnIndex, long framebuffer) { if (!RENDER_DRAW_WALL_INSIDE) @@ -410,7 +410,7 @@ void vlineasm4(int32_t columnIndex, intptr_t framebuffer) int i; uint32_t temp; - uintptr_t index = (framebuffer + ylookup[columnIndex]); + unsigned long index = (framebuffer + ylookup[columnIndex]); uint8_t *dest= (uint8_t *)(-ylookup[columnIndex]); //uint8_t *dest= (uint8_t *)framebuffer; @@ -440,11 +440,11 @@ void setupmvlineasm(int32_t i1) } -void mvlineasm4(int32_t column, intptr_t framebufferOffset) +void mvlineasm4(int32_t column, long framebufferOffset) { int i; uint32_t temp; - uintptr_t index = (framebufferOffset + ylookup[column]); + unsigned long index = (framebufferOffset + ylookup[column]); uint8_t *dest = (uint8_t *)(-ylookup[column]); do { @@ -821,14 +821,14 @@ void tsethlineshift(int32_t i1, int32_t i2) -static intptr_t slopemach_ebx; +static long slopemach_ebx; static int32_t slopemach_ecx; -static int32_t slopemach_edx; +static long slopemach_edx; static uint8_t slopemach_ah1; static uint8_t slopemach_ah2; static float asm2_f; typedef union { unsigned int i; float f; } bitwisef2i; -void setupslopevlin(int32_t i1, intptr_t i2, int32_t i3) +void setupslopevlin(int32_t i1, long i2, int32_t i3) { bitwisef2i c; slopemach_ebx = i2; @@ -848,10 +848,11 @@ extern int32_t fpuasm; #define high32(a) ((int)(((__int64)a&(__int64)0xffffffff00000000)>>32)) //FCS: Render RENDER_SLOPPED_CEILING_AND_FLOOR -void slopevlin(intptr_t i1, uint32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6) +void slopevlin(long i1, uint32_t i2, long* i3, uint32_t index, int32_t i4, int32_t i5, int32_t i6) { bitwisef2i c; - uint32_t ecx,eax,ebx,edx,esi,edi; + unsigned long ecx,eax,ebx,edx,esi; + uint32_t edi; //This is so bad to cast asm3 to int then float :( !!! float a = (float)(int32_t) asm3 + asm2_f; i1 -= slopemach_ecx; @@ -898,8 +899,8 @@ void slopevlin(intptr_t i1, uint32_t i2, int32_t i3, int32_t i4, int32_t i5, int edi += eax; i1 += slopemach_ecx; edx = ((edx&0xffffff00)|((((uint8_t *)(ebx+edx))[slopemach_ebx]))); - ebx = *((uint32_t*)i3); // register trickery - i3 -= 4; + ebx = i3[index]; + index--; eax = ((eax&0xffffff00)|(*((uint8_t *)(ebx+edx)))); ebx = esi; diff --git a/Engine/src/draw.h b/Engine/src/draw.h index 0f2a656..4a94a25 100644 --- a/Engine/src/draw.h +++ b/Engine/src/draw.h @@ -27,17 +27,17 @@ extern uint8_t *transluc; extern uint8_t *globalpalwritten; extern int16_t globalshiftval; extern int32_t vplce[4], vince[4]; -extern intptr_t bufplce[4]; +extern long bufplce[4]; extern uint8_t* palookupoffse[4]; void sethlinesizes(int32_t,int32_t,uint8_t *); void hlineasm4(int32_t,int32_t,uint32_t,uint32_t,uint8_t*); -void setuprhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -void rhlineasm4(int32_t,uint8_t*,int32_t,uint32_t,uint32_t,int32_t); -void setuprmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -void rmhlineasm4(int32_t,intptr_t,int32_t,int32_t,int32_t,int32_t); +void setuprhlineasm4(int32_t,int32_t,int32_t,long,int32_t,int32_t); +void rhlineasm4(int32_t,uint8_t*,int32_t,uint32_t,uint32_t,uint8_t*); +void setuprmhlineasm4(int32_t,int32_t,int32_t,long,int32_t,int32_t); +void rmhlineasm4(int32_t,uint8_t*,int32_t,int32_t,int32_t,uint8_t*); void setBytesPerLine(int32_t); @@ -45,14 +45,14 @@ void setBytesPerLine(int32_t); int32_t prevlineasm1(int32_t,uint8_t* palette ,int32_t,int32_t,uint8_t *,uint8_t *); int32_t vlineasm1(int32_t,uint8_t*,int32_t,int32_t,uint8_t *,uint8_t*); -int32_t tvlineasm1(int32_t,uint8_t *,int32_t,int32_t,uint8_t *,uint8_t * dest); -void setuptvlineasm2(int32_t,int32_t,int32_t); -void tvlineasm2(uint32_t,uint32_t,uintptr_t,uintptr_t,uint32_t,uintptr_t); +int32_t tvlineasm1(int32_t,uint8_t*,int32_t,int32_t,uint8_t *,uint8_t * dest); +void setuptvlineasm2(int32_t,long,long); +void tvlineasm2(uint32_t,uint32_t,unsigned long,unsigned long,uint32_t,unsigned long); int32_t mvlineasm1(int32_t,uint8_t*,int32_t,int32_t,uint8_t* texture,uint8_t* dest); void setupvlineasm(int32_t); -void vlineasm4(int32_t,intptr_t); +void vlineasm4(int32_t,long); void setupmvlineasm(int32_t); -void mvlineasm4(int32_t,intptr_t); +void mvlineasm4(int32_t,long); void setupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); void spritevline(int32_t,uint32_t,int32_t,uint32_t,uint8_t*,uint8_t*); void msetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); @@ -65,8 +65,8 @@ void msethlineshift(int32_t,int32_t); void thline(uint8_t*,int32_t,int32_t,int32_t,int32_t,uint8_t *); void thlineskipmodify(int32_t,uint32_t,uint32_t,int32_t,int32_t,uint8_t *); void tsethlineshift(int32_t,int32_t); -void setupslopevlin(int32_t,intptr_t,int32_t); -void slopevlin(intptr_t,uint32_t,int32_t,int32_t,int32_t,int32_t); +void setupslopevlin(int32_t,long,int32_t); +void slopevlin(long,uint32_t,long*,uint32_t,int32_t,int32_t,int32_t); #define TRANS_NORMAL 0 diff --git a/Engine/src/engine.c b/Engine/src/engine.c index b910987..bd0fa00 100644 --- a/Engine/src/engine.c +++ b/Engine/src/engine.c @@ -62,7 +62,7 @@ static short *dotp1[MAXYDIM], *dotp2[MAXYDIM]; static char tempbuf[MAXWALLS]; int32_t ebpbak, espbak; -int32_t slopalookup[16384]; +long slopalookup[16384]; /* * !!! used to be static. If we ever put the original setgamemode() back, this @@ -191,11 +191,11 @@ uint8_t globparaceilclip, globparaflorclip; int32_t xyaspect, viewingrangerecip; int32_t asm1, asm4; -intptr_t asm2, asm3; +long asm2, asm3; int32_t vplce[4], vince[4]; -intptr_t bufplce[4]; +long bufplce[4]; uint8_t* palookupoffse[4]; @@ -1226,7 +1226,7 @@ static void wallscan(int32_t x1, int32_t x2, int32_t *swal, int32_t *lwal) { int32_t x, xnice, ynice; - intptr_t i; + long i; uint8_t* fpalookup; int32_t y1ve[4], y2ve[4], u4, d4, z, tileWidth, tsizy; uint8_t bad; @@ -1416,7 +1416,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int32_t *swal, int32_t *lwal) { int32_t x, startx, xnice, ynice; - intptr_t i; + long i; uint8_t* fpalookup; int32_t y1ve[4], y2ve[4], u4, d4, dax, z, tileWidth, tileHeight; uint8_t* p; @@ -1724,9 +1724,9 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum,uint8_t dastat #define BITSOFPRECISION 3 /* Don't forget to change this in A.ASM also! */ static void grouscan (int32_t dax1, int32_t dax2, int32_t sectnum, uint8_t dastat) { - int32_t i, j, l, x, y, dx, dy, wx, wy, y1, y2, daz; + int32_t i, l, x, y, dx, dy, wx, wy, y1, y2, daz; int32_t daslope, dasqr; - int32_t shoffs, shinc, m1, m2, *mptr1, *mptr2, *nptr1, *nptr2; + long shoffs, shinc, m1, m2, j, *mptr1, *mptr2, *nptr1, *nptr2; walltype *wal; sectortype *sec; @@ -1862,7 +1862,7 @@ static void grouscan (int32_t dax1, int32_t dax2, int32_t sectnum, uint8_t dast if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16))); globvis = mulscale13(globvis,daz); globvis = mulscale16(globvis,xdimscale); - j =(int32_t) FP_OFF(palookup[globalpal]); + j =palookup[globalpal]; setupslopevlin(((int32_t)(picsiz[globalpicnum]&15))+(((int32_t)(picsiz[globalpicnum]>>4))<<8),tiles[globalpicnum].data,-ylookup[1]); @@ -1880,7 +1880,7 @@ static void grouscan (int32_t dax1, int32_t dax2, int32_t sectnum, uint8_t dast if (globalzd > 0) m1 += (globalzd>>16); else m1 -= (globalzd>>16); m2 = m1+l; - mptr1 = (int32_t *)&slopalookup[y1+(shoffs>>15)]; + mptr1 = (long *)&slopalookup[y1+(shoffs>>15)]; mptr2 = mptr1+1; for(x=dax1; x<=dax2; x++) @@ -1895,8 +1895,8 @@ static void grouscan (int32_t dax1, int32_t dax2, int32_t sectnum, uint8_t dast } if (y1 <= y2) { - nptr1 = (int32_t *)&slopalookup[y1+(shoffs>>15)]; - nptr2 = (int32_t *)&slopalookup[y2+(shoffs>>15)]; + nptr1 = (long *)&slopalookup[y1+(shoffs>>15)]; + nptr2 = (long *)&slopalookup[y2+(shoffs>>15)]; while (nptr1 <= mptr1) { *mptr1-- = j + (getpalookup((int32_t)mulscale24(krecipasm(m1),globvis),globalshade)<<8); @@ -1911,7 +1911,7 @@ static void grouscan (int32_t dax1, int32_t dax2, int32_t sectnum, uint8_t dast globalx3 = (globalx2>>10); globaly3 = (globaly2>>10); asm3 = mulscale16(y2,globalzd) + (globalzx>>6); - slopevlin(ylookup[y2]+x+frameoffset,krecipasm(asm3>>3),(int32_t)nptr2,y2-y1+1,globalx1,globaly1); + slopevlin(ylookup[y2]+x+frameoffset,krecipasm(asm3>>3),slopalookup,y2+(shoffs>>15),y2-y1+1,globalx1,globaly1); if ((x&15) == 0) faketimerhandler(); } @@ -3047,8 +3047,8 @@ static int spritewallfront (spritetype *s, int32_t w) static void transmaskvline(int32_t x) { - int32_t vplc, vinc, i, palookupoffs; - intptr_t bufplc, p; + int32_t vplc, vinc, i; + long bufplc, p, palookupoffs; short y1v, y2v; if ((x < 0) || (x >= xdimen)) return; @@ -3058,7 +3058,7 @@ static void transmaskvline(int32_t x) y2v--; if (y2v < y1v) return; - palookupoffs = (int32_t)FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x],globvis),globalshade)<<8); + palookupoffs = (palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x],globvis),globalshade)<<8); vinc = swall[x]*globalyscale; vplc = globalzd + vinc*(y1v-globalhoriz+1); @@ -3080,7 +3080,7 @@ static void transmaskvline(int32_t x) static void transmaskvline2 (int32_t x) { int32_t y1, y2, x2; - intptr_t i; + long i; short y1ve[2], y2ve[2]; if ((x < 0) || (x >= xdimen)) return; @@ -3104,8 +3104,8 @@ static void transmaskvline2 (int32_t x) return; } - palookupoffse[0] = (int32_t)FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x],globvis),globalshade)<<8); - palookupoffse[1] = (int32_t)FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x2],globvis),globalshade)<<8); + palookupoffse[0] = (palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x],globvis),globalshade)<<8); + palookupoffse[1] = (palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x2],globvis),globalshade)<<8); setuptvlineasm2(globalshiftval,palookupoffse[0],palookupoffse[1]); @@ -3534,8 +3534,8 @@ static void initfastcolorlookup(int32_t rscale, int32_t gscale, int32_t bscale) j += 129-(i<<1); } - clearbufbyte((void *)FP_OFF(colhere),sizeof(colhere),0L); - clearbufbyte((void *)FP_OFF(colhead),sizeof(colhead),0L); + clearbufbyte((void *)colhere,sizeof(colhere),0L); + clearbufbyte((void *)colhead,sizeof(colhead),0L); pal1 = &palette[768-3]; for(i=255; i>=0; i--,pal1-=3) @@ -4773,7 +4773,7 @@ static void ceilspritehline (int32_t x2, int32_t y) asm1 = mulscale14(globalx2,v); asm2 = mulscale14(globaly2,v); - asm3 = (int32_t)FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale28(klabs(v),globvis),globalshade)<<8); + asm3 = (palookup[globalpal]) + (getpalookup((int32_t)mulscale28(klabs(v),globvis),globalshade)<<8); if ((globalorientation&2) == 0) mhline(globalbufplc,bx,(x2-x1)<<16,0L,by,ylookup[y]+x1+frameoffset); @@ -8217,8 +8217,8 @@ void makepalookup(int32_t palnum, uint8_t *remapbuf, int8_t r, { for(i=0; i<256; i++) { - ptr = (uint8_t *)(FP_OFF(palookup[0])+remapbuf[i]); - ptr2 = (uint8_t *)(FP_OFF(palookup[palnum])+i); + ptr = (uint8_t *)(palookup[0])+remapbuf[i]; + ptr2 = (uint8_t *)(palookup[palnum])+i; for(j=0; jsectnum].floorshade); globalshade = max(min(globalshade+spr->shade+6,numpalookups-1),0); - asm3 = (int32_t) FP_OFF(palookup[spr->pal]+(globalshade<<8)); + asm3 = palookup[spr->pal]+(globalshade<<8); globvis = globalhisibility; if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16))); globalpolytype = ((spr->cstat&2)>>1)+1; @@ -8994,7 +8995,8 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, short ang) void clearview(int32_t dacol) { - int32_t p, y, dx; + int32_t y, dx; + long p; if (qsetmode != 200) return; @@ -9107,7 +9109,7 @@ void preparemirror(int32_t dax, int32_t day, int32_t daz, void completemirror(void) { int32_t i, dy; - intptr_t p; + long p; /* Can't reverse with uninitialized data */ if (inpreparemirror) { diff --git a/Game/src/actors.c b/Game/src/actors.c index 08361b5..4f9f8c7 100644 --- a/Game/src/actors.c +++ b/Game/src/actors.c @@ -1516,7 +1516,8 @@ void movefallers(void) void movestandables(void) { short i, j, k, m, nexti, nextj, p, sect; - int32_t l=0, x, *t; + long l=0, *t; + int32_t x; spritetype *s; i = headspritestat[6]; @@ -3138,7 +3139,8 @@ void movetransports(void) void moveactors(void) { - int32_t x, m, l, *t; + long m, l, *t; + int32_t x; short a, i, j, nexti, nextj, sect, p; spritetype *s; uint16_t k; @@ -4395,7 +4397,8 @@ void moveactors(void) void moveexplosions(void) // STATNUM 5 { short i, j, nexti, sect, p; - int32_t l, x, *t; + long l, *t; + int32_t x; spritetype *s; i = headspritestat[5]; @@ -4927,7 +4930,8 @@ void moveexplosions(void) // STATNUM 5 void moveeffectors(void) //STATNUM 3 { - int32_t q=0, l, m, x, st, j, *t; + long q=0, l, st, j, *t; + int32_t x, m; short i, k, nexti, nextk, p, sh, nextj; spritetype *s; sectortype *sc; @@ -6492,17 +6496,17 @@ void moveeffectors(void) //STATNUM 3 if( t[0] == 1 ) //Decide if the s->sectnum should go up or down { - s->zvel = ksgn(s->z-*(int32_t *)l) * (SP<<4); + s->zvel = ksgn(s->z-*(long *)l) * (SP<<4); t[0]++; } if( sc->extra == 0 ) { - *(int32_t *)l += s->zvel; + *(long *)l += s->zvel; - if(klabs(*(int32_t *)l-s->z) < 1024) + if(klabs(*(long *)l-s->z) < 1024) { - *(int32_t *)l = s->z; + *(long *)l = s->z; KILLIT(i); //All done } } diff --git a/Game/src/audiolib/dpmi.h b/Game/src/audiolib/dpmi.h index c6893bc..1718d17 100644 --- a/Game/src/audiolib/dpmi.h +++ b/Game/src/audiolib/dpmi.h @@ -68,8 +68,8 @@ typedef struct uint32_t DPMI_GetRealModeVector( int num ); int DPMI_CallRealModeFunction( dpmi_regs *callregs ); -int DPMI_GetDOSMemory( void **ptr, int *descriptor, unsigned length ); -int DPMI_FreeDOSMemory( int descriptor ); +int DPMI_GetDOSMemory( void **ptr, long *descriptor, unsigned length ); +int DPMI_FreeDOSMemory( long descriptor ); int DPMI_LockMemory( void *address, unsigned length ); int DPMI_LockMemoryRegion( void *start, void *end ); int DPMI_UnlockMemory( void *address, unsigned length ); diff --git a/Game/src/audiolib/multivoc.c b/Game/src/audiolib/multivoc.c index beef67d..6e39844 100644 --- a/Game/src/audiolib/multivoc.c +++ b/Game/src/audiolib/multivoc.c @@ -117,7 +117,7 @@ static int MV_BuffShift; static int MV_TotalMemory; static int MV_FooMemory; -static int MV_BufferDescriptor; +static long MV_BufferDescriptor; static int MV_BufferEmpty[ NumberOfBuffers ]; char *MV_MixBuffer[ NumberOfBuffers + 1 ]; double *MV_FooBuffer = NULL; diff --git a/Game/src/audiolib/nodpmi.c b/Game/src/audiolib/nodpmi.c index 82187e7..9b36633 100644 --- a/Game/src/audiolib/nodpmi.c +++ b/Game/src/audiolib/nodpmi.c @@ -147,18 +147,18 @@ int DPMI_UnlockMemoryRegion return( status ); } -int DPMI_GetDOSMemory( void **ptr, int *descriptor, unsigned length ) +int DPMI_GetDOSMemory( void **ptr, long *descriptor, unsigned length ) { /* Lovely... */ *ptr = (void *)malloc(length); - *descriptor = (int) *ptr; + *descriptor = (long) *ptr; return (descriptor == 0) ? DPMI_Error : DPMI_Ok; } -int DPMI_FreeDOSMemory( int descriptor ) +int DPMI_FreeDOSMemory( long descriptor ) { free((void *)descriptor); diff --git a/Game/src/duke3d.h b/Game/src/duke3d.h index 9399329..f44a2b4 100644 --- a/Game/src/duke3d.h +++ b/Game/src/duke3d.h @@ -547,10 +547,10 @@ extern SOUNDOWNER SoundOwner[NUM_SOUNDS][4]; extern uint8_t playerreadyflag[MAXPLAYERS],playerquitflag[MAXPLAYERS]; extern char sounds[NUM_SOUNDS][14]; -extern int32_t script[MAXSCRIPTSIZE],*scriptptr,*insptr,*labelcode,labelcnt; +extern long script[MAXSCRIPTSIZE],*scriptptr,*insptr,*labelcode,labelcnt; extern char *label,*textptr,error,warning; extern uint8_t killit_flag; -extern int32_t *actorscrptr[MAXTILES],*parsing_actor; +extern long *actorscrptr[MAXTILES],*parsing_actor; extern uint8_t actortype[MAXTILES]; extern uint8_t *music_pointer; @@ -572,7 +572,7 @@ struct weaponhit short tempang,actorstayput,dispicnum; short timetosleep; int32_t floorz,ceilingz,lastvx,lastvy,bposx,bposy,bposz; - int32_t temp_data[6]; + long temp_data[6]; }; extern struct weaponhit hittype[MAXSPRITES]; diff --git a/Game/src/game.c b/Game/src/game.c index d80d954..45da981 100644 --- a/Game/src/game.c +++ b/Game/src/game.c @@ -5403,7 +5403,7 @@ short spawn( short j, short pn ) void animatesprites(int32_t x,int32_t y,short a,int32_t smoothratio) { short i, j, k, p, sect; - int32_t l, t1,t3,t4; + long l, t1,t3,t4; spritetype *s,*t; for(j=0;j < spritesortcnt; j++) @@ -5902,7 +5902,7 @@ void animatesprites(int32_t x,int32_t y,short a,int32_t smoothratio) // Lame fix. ok for w32. Doesn't work for other plateform. // How to make a differene between a timer and an address?? { - l = *(int32_t *)(t4+8); + l = *(long *)(t4+(sizeof(t4) * 2)); switch( l ) { @@ -5950,7 +5950,7 @@ void animatesprites(int32_t x,int32_t y,short a,int32_t smoothratio) break; } - t->picnum += k + ( *(int32_t *)t4 ) + l * t3; + t->picnum += k + ( *(long *)t4 ) + l * t3; if(l > 0) while(tiles[t->picnum].dim.width == 0 && t->picnum > 0 ) @@ -7717,7 +7717,7 @@ void compilecons(void) char userconfilename[512]; mymembuf = (char *)hittype; - labelcode = (int32_t *)§or[0]; + labelcode = (long *)§or[0]; label = (char *)sprite; sprintf(userconfilename, "%s", confilename); diff --git a/Game/src/gamedef.c b/Game/src/gamedef.c index 6b93c64..bf6f86e 100644 --- a/Game/src/gamedef.c +++ b/Game/src/gamedef.c @@ -37,7 +37,7 @@ static int32_t last_used_size; static short g_i,g_p; static int32_t g_x; -static int32_t *g_t; +static long *g_t; static spritetype *g_sp; #define NUMKEYWORDS 112 @@ -340,7 +340,7 @@ int32_t keyword(void) int32_t transword(void) //Returns its code # { - int32_t i, l; + long i, l; while( isaltok(*textptr) == 0 ) { @@ -445,7 +445,8 @@ void transnum(void) uint8_t parsecommand(int readfromGRP) { - int32_t i, j, k, *tempscrptr; + int32_t i; + long j, k, *tempscrptr; uint8_t done, temp_ifelse_check; int32_t tw; char *origtptr; @@ -483,7 +484,7 @@ uint8_t parsecommand(int readfromGRP) { getlabel(); scriptptr--; - labelcode[labelcnt] = (int32_t) scriptptr; + labelcode[labelcnt] = (long) scriptptr; labelcnt++; parsing_state = 1; @@ -628,7 +629,7 @@ uint8_t parsecommand(int readfromGRP) break; } if(i == labelcnt) - labelcode[labelcnt++] = (int32_t) scriptptr; + labelcode[labelcnt++] = (long) scriptptr; for(j=0;j<2;j++) { if(keyword() >= 0) break; @@ -786,7 +787,7 @@ uint8_t parsecommand(int readfromGRP) } if(i == labelcnt) - labelcode[labelcnt++] = (int32_t) scriptptr; + labelcode[labelcnt++] = (long) scriptptr; for(j=0;j<3;j++) { @@ -840,7 +841,7 @@ uint8_t parsecommand(int readfromGRP) } if(i == labelcnt) - labelcode[labelcnt++] = (int32_t) scriptptr; + labelcode[labelcnt++] = (long) scriptptr; for(j=0;j<5;j++) { @@ -1017,7 +1018,7 @@ uint8_t parsecommand(int readfromGRP) tempscrptr = scriptptr; scriptptr++; //Leave a spot for the fail location parsecommand(readfromGRP); - *tempscrptr = (int32_t) scriptptr; + *tempscrptr = (long) scriptptr; } else { @@ -1098,7 +1099,7 @@ uint8_t parsecommand(int readfromGRP) parsecommand(readfromGRP); - *tempscrptr = (int32_t) scriptptr; + *tempscrptr = (long) scriptptr; checking_ifelse++; return 0; @@ -1366,7 +1367,7 @@ uint8_t parsecommand(int readfromGRP) return 0; case 60: { - int32_t params[30]; + long params[30]; scriptptr--; for(j = 0; j < 30; j++) @@ -1585,7 +1586,7 @@ void loadefs(char *filenam, char *mptr, int readfromGRP) total_lines = 0; passone(readfromGRP); //Tokenize - *script = (int32_t) scriptptr; + *script = (long) scriptptr; if(warning|error) printf("Found %hhd warning(s), '%c' error(s).\n",warning,error); @@ -1764,9 +1765,10 @@ short furthestcanseepoint(short i,spritetype *ts,int32_t *dax,int32_t *day) void alterang(short a) { short aang, angdif, goalang,j; - int32_t ticselapsed, *moveptr; + long ticselapsed, *moveptr; + + moveptr = (long *)g_t[1]; - moveptr = (int32_t *)g_t[1]; ticselapsed = (g_t[0])&31; @@ -1831,10 +1833,12 @@ void alterang(short a) void move() { - int32_t l, *moveptr; + int32_t l; + long* moveptr; short a, goalang, angdif; int32_t daxvel; + a = g_sp->hitag; if(a == -1) a = 0; @@ -1898,7 +1902,7 @@ void move() return; } - moveptr = (int32_t *)g_t[1]; + moveptr = (long *)g_t[1]; if(a&geth) g_sp->xvel += (*moveptr-g_sp->xvel)>>1; if(a&getv) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)>>1; @@ -2037,7 +2041,7 @@ void parseifelse(int32_t condition) } else { - insptr = (int32_t *) *(insptr+1); + insptr = (long *) *(insptr+1); if(*insptr == 10) { insptr+=2; @@ -2187,9 +2191,9 @@ uint8_t parse(void) case 24: insptr++; g_t[5] = *insptr; - g_t[4] = *(int32_t *)(g_t[5]); // Action - g_t[1] = *(int32_t *)(g_t[5]+4); // move - g_sp->hitag = *(int32_t *)(g_t[5]+8); // Ai + g_t[4] = *(long *)(g_t[5]); // Action + g_t[1] = *(long *)(g_t[5]+sizeof(long)); // move + g_sp->hitag = *(int32_t *)(g_t[5]+(sizeof(long) * 2)); // Ai g_t[0] = g_t[2] = g_t[3] = 0; if(g_sp->hitag&random_angle) g_sp->ang = TRAND&2047; @@ -2224,7 +2228,7 @@ uint8_t parse(void) hittype[g_i].timetosleep = SLEEPTIME; break; case 10: - insptr = (int32_t *) *(insptr+1); + insptr = (long *) *(insptr+1); break; case 100: insptr++; @@ -2575,11 +2579,11 @@ uint8_t parse(void) break; case 17: { - int32_t *tempscrptr; + long *tempscrptr; tempscrptr = insptr+2; - insptr = (int32_t *) *(insptr+1); + insptr = (long *) *(insptr+1); while(1) if(parse()) break; insptr = tempscrptr; } @@ -3153,13 +3157,13 @@ void execute(short i,short p,int32_t x) if(g_t[4]) { g_sp->lotag += TICSPERFRAME; - if(g_sp->lotag > *(int32_t *)(g_t[4]+16) ) + if(g_sp->lotag > *(long *)(g_t[4]+(sizeof(long) * 4)) ) { g_t[2]++; g_sp->lotag = 0; - g_t[3] += *(int32_t *)( g_t[4]+12 ); + g_t[3] += *(long *)( g_t[4]+(sizeof(long) * 3) ); } - if( klabs(g_t[3]) >= klabs( *(int32_t *)(g_t[4]+4) * *(int32_t *)(g_t[4]+12) ) ) + if( klabs(g_t[3]) >= klabs( *(long *)(g_t[4]+sizeof(long)) * *(long *)(g_t[4]+(sizeof(long) * 3)) ) ) g_t[3] = 0; } diff --git a/Game/src/global.c b/Game/src/global.c index ddbdb1a..e5709a6 100644 --- a/Game/src/global.c +++ b/Game/src/global.c @@ -155,8 +155,8 @@ uint8_t playerreadyflag[MAXPLAYERS],ready2send; uint8_t playerquitflag[MAXPLAYERS]; int32_t vel, svel, angvel, horiz, ototalclock, respawnactortime=768, respawnitemtime=768, groupfile; -int32_t script[MAXSCRIPTSIZE],*scriptptr,*insptr,*labelcode,labelcnt; -int32_t *actorscrptr[MAXTILES],*parsing_actor; +long script[MAXSCRIPTSIZE],*scriptptr,*insptr,*labelcode,labelcnt; +long *actorscrptr[MAXTILES],*parsing_actor; char *label,*textptr,error,warning ; uint8_t killit_flag; uint8_t *music_pointer; diff --git a/Game/src/menues.c b/Game/src/menues.c index 6db8b7d..05922ec 100644 --- a/Game/src/menues.c +++ b/Game/src/menues.c @@ -223,8 +223,9 @@ int loadplayer(int8_t spot) char fn[] = "game0.sav"; char mpfn[] = "gameA_00.sav"; char *fnptr, scriptptrs[MAXSCRIPTSIZE]; - int32_t fil, bv, i, j, x; + int32_t fil, bv, i, x; int32 nump; + long j; if(spot < 0) { @@ -362,20 +363,20 @@ int loadplayer(int8_t spot) kdfread(&cloudy[0],sizeof(short)<<7,1,fil); kdfread(&scriptptrs[0],1,MAXSCRIPTSIZE,fil); - kdfread(&script[0],4,MAXSCRIPTSIZE,fil); + kdfread(&script[0],sizeof(script[0]),MAXSCRIPTSIZE,fil); for(i=0;i=0;i--) animateptr[i] = (int32_t *)((int32_t)animateptr[i]+(int32_t)(§or[0])); + for(i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0])); kdfread(&animategoal[0],4,MAXANIMATES,fil); kdfread(&animatevel[0],4,MAXANIMATES,fil); @@ -550,7 +551,8 @@ int loadplayer(int8_t spot) int saveplayer(int8_t spot) { - int32_t i, j; + int32_t i; + long j; char fn[] = "game0.sav"; char mpfn[] = "gameA_00.sav"; char *fnptr,scriptptrs[MAXSCRIPTSIZE]; @@ -648,37 +650,37 @@ int saveplayer(int8_t spot) for(i=0;i= (int32_t)(&script[0]) && (int32_t)script[i] < (int32_t)(&script[MAXSCRIPTSIZE]) ) + if( (long)script[i] >= (long)(&script[0]) && (long)script[i] < (long)(&script[MAXSCRIPTSIZE]) ) { scriptptrs[i] = 1; - j = (int32_t)script[i] - (int32_t)&script[0]; + j = (long)script[i] - (long)&script[0]; script[i] = j; } else scriptptrs[i] = 0; } dfwrite(&scriptptrs[0],1,MAXSCRIPTSIZE,fil); - dfwrite(&script[0],4,MAXSCRIPTSIZE,fil); + dfwrite(&script[0],sizeof(script[0]),MAXSCRIPTSIZE,fil); for(i=0;i= j && T2 < (int32_t)(&script[MAXSCRIPTSIZE]) ) + if(T2 >= j && T2 < (long)(&script[MAXSCRIPTSIZE]) ) { scriptptrs[i] |= 1; T2 -= j; } - if(T5 >= j && T5 < (int32_t)(&script[MAXSCRIPTSIZE]) ) + if(T5 >= j && T5 < (long)(&script[MAXSCRIPTSIZE]) ) { scriptptrs[i] |= 2; T5 -= j; } - if(T6 >= j && T6 < (int32_t)(&script[MAXSCRIPTSIZE]) ) + if(T6 >= j && T6 < (long)(&script[MAXSCRIPTSIZE]) ) { scriptptrs[i] |= 4; T6 -= j; @@ -712,7 +714,7 @@ int saveplayer(int8_t spot) for(i=0;i=0;i--) animateptr[i] = (int32_t *)((int32_t)animateptr[i]-(int32_t)(§or[0])); + for(i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]-(long)(§or[0])); dfwrite(&animateptr[0],4,MAXANIMATES,fil); - for(i = animatecnt-1;i>=0;i--) animateptr[i] = (int32_t *)((int32_t)animateptr[i]+(int32_t)(§or[0])); + for(i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0])); dfwrite(&animategoal[0],4,MAXANIMATES,fil); dfwrite(&animatevel[0],4,MAXANIMATES,fil); diff --git a/README.md b/README.md index 0b1b732..29d539f 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Contributors * **Project Initiator:** [Fabien Sanglard](https://github.com/fabiensanglard) * **Linux Integration:** [Juan Manuel Borges CaƱo](https://github.com/juanmabc) * **Autoconf/Automake Build System:** [darealshinji](https://github.com/darealshinji) - +* **64-bit Port:** [Rohit Nirmal](https://github.com/rohit-n) More Information ================