ref: 83636a68d4045a4c107d99dda1c81ab5f1bcd59f
parent: e9379d17f01bce87e474f57cab1dee6e0d9b03f9
author: Fabien Sanglard <[email protected]>
date: Mon Dec 17 11:45:00 EST 2012
Changed (long) cast to (int32_t) cast.
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -730,10 +730,10 @@
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
globalbufplc = waloff[globalpicnum];
- globalshade = (long)sec->ceilingshade;
+ globalshade = (int32_t)sec->ceilingshade;
globvis = globalcisibility;
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
- globalorientation = (long)sec->ceilingstat;
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
+ globalorientation = (int32_t)sec->ceilingstat;
if ((globalorientation&64) == 0)
@@ -796,8 +796,8 @@
globaly2 <<= globalyshift;
globalxpanning <<= globalxshift;
globalypanning <<= globalyshift;
- globalxpanning += (((long)sec->ceilingxpanning)<<24);
- globalypanning += (((long)sec->ceilingypanning)<<24);
+ globalxpanning += (((int32_t)sec->ceilingxpanning)<<24);
+ globalypanning += (((int32_t)sec->ceilingypanning)<<24);
globaly1 = (-globalx1-globaly1)*halfxdimen;
globalx2 = (globalx2-globaly2)*halfxdimen;
@@ -938,12 +938,12 @@
globalbufplc = waloff[globalpicnum];
- globalshade = (long)sec->floorshade;
+ globalshade = (int32_t)sec->floorshade;
globvis = globalcisibility;
if (sec->visibility != 0){
- globvis = mulscale4(globvis,(long)((sec->visibility+16)));
+ globvis = mulscale4(globvis,(int32_t)((sec->visibility+16)));
}
- globalorientation = (long)sec->floorstat;
+ globalorientation = (int32_t)sec->floorstat;
if ((globalorientation&64) == 0)
@@ -1006,8 +1006,8 @@
globaly2 <<= globalyshift;
globalxpanning <<= globalxshift;
globalypanning <<= globalyshift;
- globalxpanning += (((long)sec->floorxpanning)<<24);
- globalypanning += (((long)sec->floorypanning)<<24);
+ globalxpanning += (((int32_t)sec->floorxpanning)<<24);
+ globalypanning += (((int32_t)sec->floorypanning)<<24);
globaly1 = (-globalx1-globaly1)*halfxdimen;
globalx2 = (globalx2-globaly2)*halfxdimen;
@@ -1174,7 +1174,7 @@
if (ynice)
tsizy = (picsiz[globalpicnum]>>4);
- fpalookup = (long)FP_OFF(palookup[globalpal]);
+ fpalookup = (int32_t)FP_OFF(palookup[globalpal]);
setupvlineasm(globalshiftval);
@@ -1190,7 +1190,7 @@
if (y2ve[0] <= y1ve[0])
continue;
- palookupoffse[0] = fpalookup+(getpalookup((long)mulscale16(swal[x],globvis),globalshade)<<8);
+ palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
bufplce[0] = lwal[x] + globalxpanning;
@@ -1242,8 +1242,8 @@
if (bad == 15) continue;
- palookupoffse[0] = fpalookup+(getpalookup((long)mulscale16(swal[x],globvis),globalshade)<<8);
- palookupoffse[3] = fpalookup+(getpalookup((long)mulscale16(swal[x+3],globvis),globalshade)<<8);
+ palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
+ palookupoffse[3] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+3],globvis),globalshade)<<8);
if ((palookupoffse[0] == palookupoffse[3]) && ((bad&0x9) == 0))
{
@@ -1252,8 +1252,8 @@
}
else
{
- palookupoffse[1] = fpalookup+(getpalookup((long)mulscale16(swal[x+1],globvis),globalshade)<<8);
- palookupoffse[2] = fpalookup+(getpalookup((long)mulscale16(swal[x+2],globvis),globalshade)<<8);
+ palookupoffse[1] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+1],globvis),globalshade)<<8);
+ palookupoffse[2] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+2],globvis),globalshade)<<8);
}
u4 = max(max(y1ve[0],y1ve[1]),max(y1ve[2],y1ve[3]));
@@ -1287,7 +1287,7 @@
y2ve[0] = min(dwal[x],dmost[x]);
if (y2ve[0] <= y1ve[0]) continue;
- palookupoffse[0] = fpalookup+(getpalookup((long)mulscale16(swal[x],globvis),globalshade)<<8);
+ palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
bufplce[0] = lwal[x] + globalxpanning;
if (bufplce[0] >= tsizx) {
@@ -1331,7 +1331,7 @@
ynice = (pow2long[picsiz[globalpicnum]>>4] == tsizy);
if (ynice) tsizy = (picsiz[globalpicnum]>>4);
- fpalookup = (long)FP_OFF(palookup[globalpal]);
+ fpalookup = (int32_t)FP_OFF(palookup[globalpal]);
setupmvlineasm(globalshiftval);
@@ -1346,7 +1346,7 @@
y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1);
if (y2ve[0] <= y1ve[0]) continue;
- palookupoffse[0] = fpalookup+(getpalookup((long)mulscale16(swal[x],globvis),globalshade)<<8);
+ palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
bufplce[0] = lwal[x] + globalxpanning;
if (bufplce[0] >= tsizx) {
@@ -1387,8 +1387,8 @@
}
if (bad == 15) continue;
- palookupoffse[0] = fpalookup+(getpalookup((long)mulscale16(swal[x],globvis),globalshade)<<8);
- palookupoffse[3] = fpalookup+(getpalookup((long)mulscale16(swal[x+3],globvis),globalshade)<<8);
+ palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
+ palookupoffse[3] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+3],globvis),globalshade)<<8);
if ((palookupoffse[0] == palookupoffse[3]) && ((bad&0x9) == 0))
{
@@ -1397,8 +1397,8 @@
}
else
{
- palookupoffse[1] = fpalookup+(getpalookup((long)mulscale16(swal[x+1],globvis),globalshade)<<8);
- palookupoffse[2] = fpalookup+(getpalookup((long)mulscale16(swal[x+2],globvis),globalshade)<<8);
+ palookupoffse[1] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+1],globvis),globalshade)<<8);
+ palookupoffse[2] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+2],globvis),globalshade)<<8);
}
u4 = max(max(y1ve[0],y1ve[1]),max(y1ve[2],y1ve[3]));
@@ -1432,7 +1432,7 @@
y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1);
if (y2ve[0] <= y1ve[0]) continue;
- palookupoffse[0] = fpalookup+(getpalookup((long)mulscale16(swal[x],globvis),globalshade)<<8);
+ palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
bufplce[0] = lwal[x] + globalxpanning;
if (bufplce[0] >= tsizx) {
@@ -1466,15 +1466,15 @@
globalhoriz = mulscale16(globalhoriz-(ydimen>>1),parallaxyscale) + (ydimen>>1);
globvis = globalpisibility;
/* globalorientation = 0L; */
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
if (dastat == 0)
{
globalpal = sec->ceilingpal;
globalpicnum = sec->ceilingpicnum;
- globalshade = (long)sec->ceilingshade;
- globalxpanning = (long)sec->ceilingxpanning;
- globalypanning = (long)sec->ceilingypanning;
+ globalshade = (int32_t)sec->ceilingshade;
+ globalxpanning = (int32_t)sec->ceilingxpanning;
+ globalypanning = (int32_t)sec->ceilingypanning;
topptr = umost;
botptr = uplc;
}
@@ -1482,9 +1482,9 @@
{
globalpal = sec->floorpal;
globalpicnum = sec->floorpicnum;
- globalshade = (long)sec->floorshade;
- globalxpanning = (long)sec->floorxpanning;
- globalypanning = (long)sec->floorypanning;
+ globalshade = (int32_t)sec->floorshade;
+ globalxpanning = (int32_t)sec->floorxpanning;
+ globalypanning = (int32_t)sec->floorypanning;
topptr = dplc;
botptr = dmost;
}
@@ -1522,13 +1522,13 @@
else
{
for(j=xb1[z]; j<=xb2[z]; j++)
- lplc[j] = ((((long)radarang2[j]+globalang)&2047)>>k);
+ lplc[j] = ((((int32_t)radarang2[j]+globalang)&2047)>>k);
}
if (parallaxtype == 2)
{
n = mulscale16(xdimscale,viewingrange);
for(j=xb1[z]; j<=xb2[z]; j++)
- swplc[j] = mulscale14(sintable[((long)radarang2[j]+512)&2047],n);
+ swplc[j] = mulscale14(sintable[((int32_t)radarang2[j]+512)&2047],n);
}
else
clearbuf(&swplc[xb1[z]],xb2[z]-xb1[z]+1,mulscale16(xdimscale,viewingrange));
@@ -1718,24 +1718,24 @@
if (dastat == 0)
{
- globalx1 += (((long)sec->ceilingxpanning)<<24);
- globaly1 += (((long)sec->ceilingypanning)<<24);
+ globalx1 += (((int32_t)sec->ceilingxpanning)<<24);
+ globaly1 += (((int32_t)sec->ceilingypanning)<<24);
}
else
{
- globalx1 += (((long)sec->floorxpanning)<<24);
- globaly1 += (((long)sec->floorypanning)<<24);
+ globalx1 += (((int32_t)sec->floorxpanning)<<24);
+ globaly1 += (((int32_t)sec->floorypanning)<<24);
}
asm1 = -(globalzd>>(16-BITSOFPRECISION));
globvis = globalvisibility;
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
globvis = mulscale13(globvis,daz);
globvis = mulscale16(globvis,xdimscale);
- j =(long) FP_OFF(palookup[globalpal]);
+ j =(int32_t) FP_OFF(palookup[globalpal]);
- setupslopevlin(((long)(picsiz[globalpicnum]&15))+(((long)(picsiz[globalpicnum]>>4))<<8),waloff[globalpicnum],-ylookup[1]);
+ setupslopevlin(((int32_t)(picsiz[globalpicnum]&15))+(((int32_t)(picsiz[globalpicnum]>>4))<<8),waloff[globalpicnum],-ylookup[1]);
l = (globalzd>>16);
@@ -1768,12 +1768,12 @@
nptr2 = (int32_t *)&slopalookup[y2+(shoffs>>15)];
while (nptr1 <= mptr1)
{
- *mptr1-- = j + (getpalookup((long)mulscale24(krecipasm(m1),globvis),globalshade)<<8);
+ *mptr1-- = j + (getpalookup((int32_t)mulscale24(krecipasm(m1),globvis),globalshade)<<8);
m1 -= l;
}
while (nptr2 >= mptr2)
{
- *mptr2++ = j + (getpalookup((long)mulscale24(krecipasm(m2),globvis),globalshade)<<8);
+ *mptr2++ = j + (getpalookup((int32_t)mulscale24(krecipasm(m2),globvis),globalshade)<<8);
m2 += l;
}
@@ -1780,7 +1780,7 @@
globalx3 = (globalx2>>10);
globaly3 = (globaly2>>10);
asm3 = mulscale16(y2,globalzd) + (globalzx>>6);
- slopevlin(ylookup[y2]+x+frameoffset,krecipasm(asm3>>3),(long)nptr2,y2-y1+1,globalx1,globaly1);
+ slopevlin(ylookup[y2]+x+frameoffset,krecipasm(asm3>>3),(int32_t)nptr2,y2-y1+1,globalx1,globaly1);
if ((x&15) == 0) faketimerhandler();
}
@@ -2191,19 +2191,19 @@
searchit = 1;
}
- globalorientation = (long)wal->cstat;
+ globalorientation = (int32_t)wal->cstat;
globalpicnum = wal->picnum;
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
- globalxpanning = (long)wal->xpanning;
- globalypanning = (long)wal->ypanning;
+ globalxpanning = (int32_t)wal->xpanning;
+ globalypanning = (int32_t)wal->ypanning;
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)(wallnum+16384));
- globalshade = (long)wal->shade;
+ globalshade = (int32_t)wal->shade;
globvis = globalvisibility;
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
- globalpal = (long)wal->pal;
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
+ globalpal = (int32_t)wal->pal;
globalyscale = (wal->yrepeat<<(globalshiftval-19));
if ((globalorientation&4) == 0)
globalzd = (((globalposz-nextsec->ceilingz)*globalyscale)<<8);
@@ -2289,30 +2289,30 @@
{
wallnum = wal->nextwall;
wal = &wall[wallnum];
- globalorientation = (long)wal->cstat;
+ globalorientation = (int32_t)wal->cstat;
globalpicnum = wal->picnum;
if ((uint32_t)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
- globalxpanning = (long)wal->xpanning;
- globalypanning = (long)wal->ypanning;
+ globalxpanning = (int32_t)wal->xpanning;
+ globalypanning = (int32_t)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)(wallnum+16384));
- globalshade = (long)wal->shade;
- globalpal = (long)wal->pal;
+ globalshade = (int32_t)wal->shade;
+ globalpal = (int32_t)wal->pal;
wallnum = thewall[z];
wal = &wall[wallnum];
}
else
{
- globalorientation = (long)wal->cstat;
+ globalorientation = (int32_t)wal->cstat;
globalpicnum = wal->picnum;
if ((uint32_t)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
- globalxpanning = (long)wal->xpanning;
- globalypanning = (long)wal->ypanning;
+ globalxpanning = (int32_t)wal->xpanning;
+ globalypanning = (int32_t)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)(wallnum+16384));
- globalshade = (long)wal->shade;
- globalpal = (long)wal->pal;
+ globalshade = (int32_t)wal->shade;
+ globalpal = (int32_t)wal->pal;
}
globvis = globalvisibility;
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
@@ -2399,17 +2399,17 @@
}
if ((nextsectnum < 0) || (wal->cstat&32)) /* White/1-way wall */
{
- globalorientation = (long)wal->cstat;
+ globalorientation = (int32_t)wal->cstat;
if (nextsectnum < 0) globalpicnum = wal->picnum;
else globalpicnum = wal->overpicnum;
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
- globalxpanning = (long)wal->xpanning;
- globalypanning = (long)wal->ypanning;
+ globalxpanning = (int32_t)wal->xpanning;
+ globalypanning = (int32_t)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)(wallnum+16384));
- globalshade = (long)wal->shade;
+ globalshade = (int32_t)wal->shade;
globvis = globalvisibility;
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
- globalpal = (long)wal->pal;
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
+ globalpal = (int32_t)wal->pal;
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
@@ -2484,8 +2484,8 @@
j = (x&65535);
k = (x>>16);
x += xinc;
- if (j != 0) j = mulscale16((long)radarang[k+1]-(long)radarang[k],j);
- radarang2[i] = (short)(((long)radarang[k]+j)>>6);
+ if (j != 0) j = mulscale16((int32_t)radarang[k+1]-(int32_t)radarang[k],j);
+ radarang2[i] = (short)(((int32_t)radarang[k]+j)>>6);
}
#ifdef SUPERBUILD
for(i=1; i<16384; i++) distrecip[i] = divscale20(xdimen,i);
@@ -2704,7 +2704,7 @@
xdimen = (windowx2-windowx1+1)+(stereopixelwidth<<1);
halfxdimen = (xdimen>>1);
xdimenrecip = divscale32(1L,xdimen);
- setaspect((long)divscale16(xdimen,windowx2-windowx1+1),yxaspect);
+ setaspect((int32_t)divscale16(xdimen,windowx2-windowx1+1),yxaspect);
}
if ((!(activepage&1)) ^ inpreparemirror)
@@ -2731,7 +2731,7 @@
}
globalposx += mulscale24(singlobalang,i);
globalposy -= mulscale24(cosglobalang,i);
- if (vidoption == 6) frameplace = (long)FP_OFF(screen)+(activepage&1)*65536;
+ if (vidoption == 6) frameplace = (int32_t)FP_OFF(screen)+(activepage&1)*65536;
}
if ((xyaspect != oxyaspect) || (xdimen != oxdimen) || (viewingrange != oviewingrange))
@@ -2740,7 +2740,7 @@
frameoffset = frameplace+viewoffset;
//Clear the bit vector that keep track of what sector has been flooded in.
- clearbufbyte(visitedSectors,(long)((numsectors+7)>>3),0L);
+ clearbufbyte(visitedSectors,(int32_t)((numsectors+7)>>3),0L);
//Clear the occlusion array.
shortptr1 = (short *)&startumost[windowx1];
@@ -2841,7 +2841,7 @@
{
// tempbuf is used to mark which bunches have been elected as "closest".
// if tempbug[x] == 1 then it should be skipped.
- clearbuf(&tempbuf[0],(long)((numbunches+3)>>2),0L);
+ clearbuf(&tempbuf[0],(int32_t)((numbunches+3)>>2),0L);
/* Almost works, but not quite :( */
closest = 0;
@@ -2914,7 +2914,7 @@
y2v--;
if (y2v < y1v) return;
- palookupoffs = (long)FP_OFF(palookup[globalpal]) + (getpalookup((long)mulscale16(swall[x],globvis),globalshade)<<8);
+ palookupoffs = (int32_t)FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x],globvis),globalshade)<<8);
vinc = swall[x]*globalyscale;
vplc = globalzd + vinc*(y1v-globalhoriz+1);
@@ -2956,8 +2956,8 @@
return;
}
- palookupoffse[0] = (long)FP_OFF(palookup[globalpal]) + (getpalookup((long)mulscale16(swall[x],globvis),globalshade)<<8);
- palookupoffse[1] = (long)FP_OFF(palookup[globalpal]) + (getpalookup((long)mulscale16(swall[x2],globvis),globalshade)<<8);
+ 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);
setuptvlineasm2(globalshiftval,palookupoffse[0],palookupoffse[1]);
@@ -3061,9 +3061,9 @@
initspritelists();
- clearbuf(&show2dsector[0],(long)((MAXSECTORS+3)>>5),0L);
- clearbuf(&show2dsprite[0],(long)((MAXSPRITES+3)>>5),0L);
- clearbuf(&show2dwall[0],(long)((MAXWALLS+3)>>5),0L);
+ clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L);
+ clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L);
+ clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L);
kread32(fil,daposx);
kread32(fil,daposy);
@@ -3425,7 +3425,7 @@
globalpal = 0;
setpalookupaddress(globalpalwritten);
- fixtransluscence((long)FP_OFF(transluc));
+ fixtransluscence((int32_t)FP_OFF(transluc));
kread(fil,palookup[globalpal],numpalookups<<8);
@@ -3502,11 +3502,11 @@
for(i=0; i<MAXPALOOKUPS; i++) palookup[i] = NULL;
- clearbuf(&waloff[0],(long)MAXTILES,0L);
+ clearbuf(&waloff[0],(int32_t)MAXTILES,0L);
- clearbuf(&show2dsector[0],(long)((MAXSECTORS+3)>>5),0L);
- clearbuf(&show2dsprite[0],(long)((MAXSPRITES+3)>>5),0L);
- clearbuf(&show2dwall[0],(long)((MAXWALLS+3)>>5),0L);
+ clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L);
+ clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L);
+ clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L);
automapping = 0;
validmodecnt = 0;
@@ -3721,7 +3721,7 @@
setgotpic(picnum);
bufplc = waloff[picnum];
- palookupoffs = (long) FP_OFF(palookup[dapalnum]) + (getpalookup(0L,(long)dashade)<<8);
+ palookupoffs = (int32_t) FP_OFF(palookup[dapalnum]) + (getpalookup(0L,(int32_t)dashade)<<8);
i = divscale32(1L,z);
xv = mulscale14(sinang,i);
@@ -4257,7 +4257,7 @@
{
tilefilenum[i] = k;
tilefileoffs[i] = offscount;
- dasiz = (long)(tilesizx[i]*tilesizy[i]);
+ dasiz = (int32_t)(tilesizx[i]*tilesizy[i]);
offscount += dasiz;
artsize += ((dasiz+15)&0xfffffff0);
}
@@ -4269,7 +4269,7 @@
}
while (k != numtilefiles);
printf("Art files loaded\n");
- clearbuf(&gotpic[0],(long)((MAXTILES+31)>>5),0L);
+ clearbuf(&gotpic[0],(int32_t)((MAXTILES+31)>>5),0L);
/* try dpmi_DETERMINEMAXREALALLOC! */
@@ -4279,7 +4279,7 @@
cachesize -= 65536L;
if (cachesize < 65536) return(-1);
}
- initcache(((long)FP_OFF(pic)+15)&0xfffffff0,(cachesize-((-(long)FP_OFF(pic))&15))&0xfffffff0);
+ initcache(((int32_t)FP_OFF(pic)+15)&0xfffffff0,(cachesize-((-(int32_t)FP_OFF(pic))&15))&0xfffffff0);
for(i=0; i<MAXTILES; i++)
{
@@ -4595,23 +4595,23 @@
z2 = min(nsec->floorz,sec->floorz);
wallmost(uwall,z,sectnum,(uint8_t )0);
- wallmost(uplc,z,(long)wal->nextsector,(uint8_t )0);
+ wallmost(uplc,z,(int32_t)wal->nextsector,(uint8_t )0);
for(x=xb1[z]; x<=xb2[z]; x++) if (uplc[x] > uwall[x]) uwall[x] = uplc[x];
wallmost(dwall,z,sectnum,(uint8_t )1);
- wallmost(dplc,z,(long)wal->nextsector,(uint8_t )1);
+ wallmost(dplc,z,(int32_t)wal->nextsector,(uint8_t )1);
for(x=xb1[z]; x<=xb2[z]; x++) if (dplc[x] < dwall[x]) dwall[x] = dplc[x];
prepwall(z,wal);
- globalorientation = (long)wal->cstat;
+ globalorientation = (int32_t)wal->cstat;
globalpicnum = wal->overpicnum;
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
- globalxpanning = (long)wal->xpanning;
- globalypanning = (long)wal->ypanning;
+ globalxpanning = (int32_t)wal->xpanning;
+ globalypanning = (int32_t)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)(thewall[z]+16384));
- globalshade = (long)wal->shade;
+ globalshade = (int32_t)wal->shade;
globvis = globalvisibility;
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
- globalpal = (long)wal->pal;
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
+ globalpal = (int32_t)wal->pal;
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
@@ -4699,7 +4699,7 @@
asm1 = mulscale14(globalx2,v);
asm2 = mulscale14(globaly2,v);
- asm3 = (long)FP_OFF(palookup[globalpal]) + (getpalookup((long)mulscale28(klabs(v),globvis),globalshade)<<8);
+ asm3 = (int32_t)FP_OFF(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);
@@ -4796,8 +4796,8 @@
settrans(TRANS_NORMAL);
}
- xoff = (long)((int8_t )((picanm[tilenum]>>8)&255))+((long)tspr->xoffset);
- yoff = (long)((int8_t )((picanm[tilenum]>>16)&255))+((long)tspr->yoffset);
+ xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)tspr->xoffset);
+ yoff = (int32_t)((int8_t )((picanm[tilenum]>>16)&255))+((int32_t)tspr->yoffset);
if ((cstat&48) == 0)
{
@@ -4806,7 +4806,7 @@
siz = divscale19(xdimenscale,yp);
- xv = mulscale16(((long)tspr->xrepeat)<<16,xyaspect);
+ xv = mulscale16(((int32_t)tspr->xrepeat)<<16,xyaspect);
xspan = tilesizx[tilenum];
yspan = tilesizy[tilenum];
@@ -4899,7 +4899,7 @@
if ((yp <= yb1[j]) && (yp <= yb2[j]))
continue;
- if (spritewallfront(tspr,(long)thewall[j]) && ((yp <= yb1[j]) || (yp <= yb2[j])))
+ if (spritewallfront(tspr,(int32_t)thewall[j]) && ((yp <= yb1[j]) || (yp <= yb2[j])))
continue;
dalx2 = max(xb1[j],lx);
@@ -4961,7 +4961,7 @@
globalxpanning = 0L;
globalypanning = 0L;
globvis = globalvisibility;
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
@@ -5113,7 +5113,7 @@
globalxpanning = 0L;
globalypanning = 0L;
globvis = globalvisibility;
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
@@ -5130,8 +5130,8 @@
if (((sec->floorstat&1) == 0) && (z2 > sec->floorz))
z2 = sec->floorz;
- owallmost(uwall,(long)(MAXWALLSB-1),z1-globalposz);
- owallmost(dwall,(long)(MAXWALLSB-1),z2-globalposz);
+ owallmost(uwall,(int32_t)(MAXWALLSB-1),z1-globalposz);
+ owallmost(dwall,(int32_t)(MAXWALLSB-1),z2-globalposz);
for(i=xb1[MAXWALLSB-1]; i<=xb2[MAXWALLSB-1]; i++)
{
swall[i] = (krecipasm(hplc)<<2);
@@ -5466,8 +5466,8 @@
ysi[z] = scale(ryi[z],xdimen<<15,rzi[z]) + (globalhoriz<<16);
if (xsi[z] < 0) xsi[z] = 0;
if (xsi[z] > (xdimen<<16)) xsi[z] = (xdimen<<16);
- if (ysi[z] < ((long)0<<16)) ysi[z] = ((long)0<<16);
- if (ysi[z] > ((long)ydimen<<16)) ysi[z] = ((long)ydimen<<16);
+ if (ysi[z] < ((int32_t)0<<16)) ysi[z] = ((int32_t)0<<16);
+ if (ysi[z] > ((int32_t)ydimen<<16)) ysi[z] = ((int32_t)ydimen<<16);
if (xsi[z] < lmax) lmax = xsi[z], lpoint = z;
if (xsi[z] > rmax) rmax = xsi[z], rpoint = z;
}
@@ -5576,7 +5576,7 @@
globalbufplc = waloff[globalpicnum];
globvis = mulscale16(globalhisibility,viewingrange);
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
x = picsiz[globalpicnum];
y = ((x>>4)&15);
@@ -5686,7 +5686,7 @@
spritesz[k] = tspriteptr[k]->z;
if ((tspriteptr[k]->cstat&48) != 32)
{
- yoff = (long)((int8_t )((picanm[tspriteptr[k]->picnum]>>16)&255))+((long)tspriteptr[k]->yoffset);
+ yoff = (int32_t)((int8_t )((picanm[tspriteptr[k]->picnum]>>16)&255))+((int32_t)tspriteptr[k]->yoffset);
spritesz[k] -= ((yoff*tspriteptr[k]->yrepeat)<<2);
yspan = (tilesizy[tspriteptr[k]->picnum]*tspriteptr[k]->yrepeat<<2);
if (!(tspriteptr[k]->cstat&128)) spritesz[k] -= (yspan>>1);
@@ -5717,7 +5717,7 @@
while ((spritesortcnt > 0) && (maskwallcnt > 0)) /* While BOTH > 0 */
{
j = maskwall[maskwallcnt-1];
- if (spritewallfront(tspriteptr[spritesortcnt-1],(long)thewall[j]) == 0)
+ if (spritewallfront(tspriteptr[spritesortcnt-1],(int32_t)thewall[j]) == 0)
drawsprite(--spritesortcnt);
else
{
@@ -5726,7 +5726,7 @@
gap = 0;
for(i=spritesortcnt-2; i>=0; i--)
if ((xb1[j] <= (spritesx[i]>>8)) && ((spritesx[i]>>8) <= xb2[j]))
- if (spritewallfront(tspriteptr[i],(long)thewall[j]) == 0)
+ if (spritewallfront(tspriteptr[i],(int32_t)thewall[j]) == 0)
{
drawsprite(i);
tspriteptr[i]->owner = -1;
@@ -6330,7 +6330,7 @@
i = (tilesizy[spr->picnum]*spr->yrepeat<<2);
if (cstat&128) z1 += (i>>1);
- if (picanm[spr->picnum]&0x00ff0000) z1 -= ((long)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if ((intz > z1) || (intz < z1-i)) continue;
topu = vx*(y1-ys) - vy*(x1-xs);
@@ -6358,7 +6358,7 @@
* Given: (x1, y1) starts out as the center point
*/
tilenum = spr->picnum;
- xoff = (long)((int8_t )((picanm[tilenum]>>8)&255))+((long)spr->xoffset);
+ xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
if ((cstat&4) > 0) xoff = -xoff;
k = spr->ang;
l = spr->xrepeat;
@@ -6381,7 +6381,7 @@
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
if (cstat&128) daz = spr->z+(k>>1);
else daz = spr->z;
- if (picanm[spr->picnum]&0x00ff0000) daz -= ((long)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if ((intz < daz) && (intz > daz-k))
{
*hitsect = dasector;
@@ -6405,8 +6405,8 @@
if (klabs(intx-xs)+klabs(inty-ys) > klabs((*hitx)-xs)+klabs((*hity)-ys)) continue;
tilenum = spr->picnum;
- xoff = (long)((int8_t )((picanm[tilenum]>>8)&255))+((long)spr->xoffset);
- yoff = (long)((int8_t )((picanm[tilenum]>>16)&255))+((long)spr->yoffset);
+ xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
+ yoff = (int32_t)((int8_t )((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
@@ -6573,7 +6573,7 @@
intz = zs+scale(vz,topt,bot);
i = tilesizy[spr->picnum]*spr->yrepeat;
if (spr->cstat&128) z1 += (i<<1);
- if (picanm[spr->picnum]&0x00ff0000) z1 -= ((long)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if ((intz <= z1) && (intz >= z1-(i<<2)))
{
topu = vx*(y1-ys) - vy*(x1-xs);
@@ -6888,7 +6888,7 @@
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
if (cstat&128) daz = spr->z+(k>>1);
else daz = spr->z;
- if (picanm[spr->picnum]&0x00ff0000) daz -= ((long)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (((*z) < daz+ceildist) && ((*z) > daz-k-flordist))
{
bsz = (spr->clipdist<<2)+walldist;
@@ -6904,7 +6904,7 @@
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
if (cstat&128) daz = spr->z+(k>>1);
else daz = spr->z;
- if (picanm[spr->picnum]&0x00ff0000) daz -= ((long)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
daz2 = daz-k;
daz += ceildist;
daz2 -= flordist;
@@ -6915,7 +6915,7 @@
* Given: (x1, y1) starts out as the center point
*/
tilenum = spr->picnum;
- xoff = (long)((int8_t )((picanm[tilenum]>>8)&255))+((long)spr->xoffset);
+ xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
if ((cstat&4) > 0) xoff = -xoff;
k = spr->ang;
l = spr->xrepeat;
@@ -6963,8 +6963,8 @@
if (((*z) > spr->z) == ((cstat&8)==0)) continue;
tilenum = spr->picnum;
- xoff = (long)((int8_t )((picanm[tilenum]>>8)&255))+((long)spr->xoffset);
- yoff = (long)((int8_t )((picanm[tilenum]>>16)&255))+((long)spr->yoffset);
+ xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
+ yoff = (int32_t)((int8_t )((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
@@ -7471,7 +7471,7 @@
tempint = (mul5(200+yp1)<<7)+(320+xp1);
- setcolor16((long)col);
+ setcolor16((int32_t)col);
drawpixel16(tempint-2-1280);
drawpixel16(tempint-1-1280);
@@ -7523,7 +7523,7 @@
tempint = (mul5(200+yp1)<<7)+(320+xp1);
- setcolor16((long)col);
+ setcolor16((int32_t)col);
drawpixel16(tempint-1-1280);
drawpixel16(tempint+0-1280);
drawpixel16(tempint+1-1280);
@@ -7796,7 +7796,7 @@
daz = spr->z;
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
if (cstat&128) daz += k;
- if (picanm[spr->picnum]&0x00ff0000) daz -= ((long)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
daz2 = daz - (k<<1);
clipyou = 1;
}
@@ -7803,7 +7803,7 @@
break;
case 16:
tilenum = spr->picnum;
- xoff = (long)((int8_t )((picanm[tilenum]>>8)&255))+((long)spr->xoffset);
+ xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
if ((cstat&4) > 0) xoff = -xoff;
k = spr->ang;
l = spr->xrepeat;
@@ -7820,7 +7820,7 @@
daz = spr->z;
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
if (cstat&128) daz += k;
- if (picanm[spr->picnum]&0x00ff0000) daz -= ((long)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
daz2 = daz-(k<<1);
clipyou = 1;
}
@@ -7833,8 +7833,8 @@
if ((z > daz) == ((cstat&8)==0)) continue;
tilenum = spr->picnum;
- xoff = (long)((int8_t )((picanm[tilenum]>>8)&255))+((long)spr->xoffset);
- yoff = (long)((int8_t )((picanm[tilenum]>>16)&255))+((long)spr->yoffset);
+ xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
+ yoff = (int32_t)((int8_t )((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
@@ -7930,7 +7930,7 @@
xdimenrecip = divscale32(1L,xdimen);
ydimen = (y2-y1)+1;
- setaspect(65536L,(long)divscale16(ydim*320L,xdim*200L));
+ setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L));
for(i=0; i<windowx1; i++) {
startumost[i] = 1, startdmost[i] = 0;
@@ -7951,7 +7951,7 @@
xdimen = (windowx2-windowx1+1)+(stereopixelwidth<<1);
halfxdimen = (xdimen>>1);
xdimenrecip = divscale32(1L,xdimen);
- setaspect((long)divscale16(xdimen,windowx2-windowx1+1),yxaspect);
+ setaspect((int32_t)divscale16(xdimen,windowx2-windowx1+1),yxaspect);
}
}
@@ -8154,9 +8154,9 @@
for(j=0; j<256; j++)
{
ptr = (uint8_t *)&palette[remapbuf[j]*3];
- *ptr2++ = getclosestcol((long)ptr[0]+mulscale16(r-ptr[0],palscale),
- (long)ptr[1]+mulscale16(g-ptr[1],palscale),
- (long)ptr[2]+mulscale16(b-ptr[2],palscale));
+ *ptr2++ = getclosestcol((int32_t)ptr[0]+mulscale16(r-ptr[0],palscale),
+ (int32_t)ptr[1]+mulscale16(g-ptr[1],palscale),
+ (int32_t)ptr[2]+mulscale16(b-ptr[2],palscale));
}
}
}
@@ -8178,7 +8178,7 @@
{
int32_t i, j, k;
- curbrightness = min(max((long)dabrightness,0),15);
+ curbrightness = min(max((int32_t)dabrightness,0),15);
k = 0;
if (vidoption == 6)
@@ -8607,7 +8607,7 @@
totalarea += (windowx2+1-windowx1)*(windowy2+1-windowy1);
//This seems to be dead code.
- //clearbuf(visitedSectors,(long)((numsectors+31)>>5),0L);
+ //clearbuf(visitedSectors,(int32_t)((numsectors+31)>>5),0L);
cx1 = (windowx1<<12);
cy1 = (windowy1<<12);
@@ -8660,7 +8660,7 @@
//This seems to be dead code.
//visitedSectors[s>>3] |= pow2char[s&7];
- globalorientation = (long)sec->floorstat;
+ globalorientation = (int32_t)sec->floorstat;
if ((globalorientation&1) != 0) continue;
if (palookup[sec->floorpal] != globalpalwritten)
@@ -8677,7 +8677,7 @@
globalbufplc = waloff[globalpicnum];
globalshade = max(min(sec->floorshade,numpalookups-1),0);
globvis = globalhisibility;
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
globalpolytype = 0;
if ((globalorientation&64) == 0)
{
@@ -8737,8 +8737,8 @@
asm2 = (globalx2<<globalyshift);
globalx1 <<= globalxshift;
globaly2 <<= globalyshift;
- globalposx = (globalposx<<(20+globalxshift))+(((long)sec->floorxpanning)<<24);
- globalposy = (globalposy<<(20+globalyshift))-(((long)sec->floorypanning)<<24);
+ globalposx = (globalposx<<(20+globalxshift))+(((int32_t)sec->floorxpanning)<<24);
+ globalposy = (globalposy<<(20+globalyshift))-(((int32_t)sec->floorypanning)<<24);
fillpolygon(npoints);
}
@@ -8762,8 +8762,8 @@
npoints = 0;
tilenum = spr->picnum;
- xoff = (long)((int8_t )((picanm[tilenum]>>8)&255))+((long)spr->xoffset);
- yoff = (long)((int8_t )((picanm[tilenum]>>16)&255))+((long)spr->yoffset);
+ xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
+ yoff = (int32_t)((int8_t )((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
if ((spr->cstat&4) > 0) xoff = -xoff;
if ((spr->cstat&8) > 0) yoff = -yoff;
@@ -8845,13 +8845,13 @@
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
globalbufplc = waloff[globalpicnum];
if ((sector[spr->sectnum].ceilingstat&1) > 0)
- globalshade = ((long)sector[spr->sectnum].ceilingshade);
+ globalshade = ((int32_t)sector[spr->sectnum].ceilingshade);
else
- globalshade = ((long)sector[spr->sectnum].floorshade);
+ globalshade = ((int32_t)sector[spr->sectnum].floorshade);
globalshade = max(min(globalshade+spr->shade+6,numpalookups-1),0);
- asm3 = (long) FP_OFF(palookup[spr->pal]+(globalshade<<8));
+ asm3 = (int32_t) FP_OFF(palookup[spr->pal]+(globalshade<<8));
globvis = globalhisibility;
- if (sec->visibility != 0) globvis = mulscale4(globvis,(long)((uint8_t )(sec->visibility+16)));
+ if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
globalpolytype = ((spr->cstat&2)>>1)+1;
/* relative alignment stuff */
@@ -8915,7 +8915,7 @@
dacol += (dacol<<16);
if (vidoption == 6)
{
- p = (long) FP_OFF(screen)+ylookup[windowy1]+windowx1;
+ p = (int32_t) FP_OFF(screen)+ylookup[windowy1]+windowx1;
for(y=windowy1; y<=windowy2; y++)
{
clearbufbyte((void *)p,dx,dacol);
@@ -8965,7 +8965,7 @@
void plotpixel(int32_t x, int32_t y, uint8_t col)
{
- drawpixel(ylookup[y]+x+frameplace,(long)col);
+ drawpixel(ylookup[y]+x+frameplace,(int32_t)col);
}
--- a/Engine/src/macos_compat.h
+++ b/Engine/src/macos_compat.h
@@ -20,7 +20,7 @@
#undef FP_OFF
#endif
-#define FP_OFF(x) ((long) (x))
+#define FP_OFF(x) ((int32_t) (x))
#ifndef max
#define max(x, y) (((x) > (y)) ? (x) : (y))
--- a/Engine/src/sdl_driver.c
+++ b/Engine/src/sdl_driver.c
@@ -499,12 +499,12 @@
activepage = visualpage = 0;
if (renderer == RENDERER_OPENGL3D)
- frameplace = (long) NULL;
+ frameplace = (int32_t) NULL;
else
// FIX_00083: Sporadic crash on fullscreen/window mode toggle
// frameoffset wasn't always updated fast enought. Build were using the old
// pointer of frameoffset.
- frameoffset = frameplace = (long) ( ((Uint8 *) surface->pixels) );
+ frameoffset = frameplace = (int32_t) ( ((Uint8 *) surface->pixels) );
if (screen != NULL)
{
@@ -523,7 +523,7 @@
case 6: xdim = 320; ydim = 200; i = 131072; break;
default: assert(0);
}
- j = ydim*4*sizeof(long); /* Leave room for horizlookup&horizlookup2 */
+ j = ydim*4*sizeof(int32_t); /* Leave room for horizlookup&horizlookup2 */
// screenalloctype = 0;
// if ((screen = (uint8_t *)kkmalloc(i+(j<<1))) == NULL)
@@ -535,7 +535,7 @@
/* !!! FIXME: Should screen get allocated above if in opengl3d mode? */
// if (renderer == RENDERER_OPENGL3D)
-// frameplace = (long) NULL;
+// frameplace = (int32_t) NULL;
// else
// {
// frameplace = FP_OFF(screen);
@@ -1600,8 +1600,7 @@
for (i = 0; i < validmodecnt; i++)
{
- sprintf(numbuf, " (%ldx%ld)",
- (long) validmodexdim[i], (long) validmodeydim[i]);
+ sprintf(numbuf, " (%dx%d)",(int32_t) validmodexdim[i], (int32_t) validmodeydim[i]);
if ( (strlen(buffer) + strlen(numbuf)) >= (sizeof (buffer) - 1) )
strcpy(buffer + (sizeof (buffer) - 5), " ...");
@@ -1865,7 +1864,7 @@
void drawpixel16(int32_t offset)
{
- drawpixel(((long) surface->pixels + offset), drawpixel_color);
+ drawpixel(((int32_t) surface->pixels + offset), drawpixel_color);
} /* drawpixel16 */
@@ -2192,7 +2191,7 @@
timerfreq = t;
timerticspersec = tickspersecond;
TIMER_GetPlatformTicks(&t);
- timerlastsample = (long)(t*timerticspersec / timerfreq);
+ timerlastsample = (int32_t)(t*timerticspersec / timerfreq);
usertimercallback = NULL;
@@ -2223,7 +2222,7 @@
TIMER_GetPlatformTicks(&i);
- n = (long)(i*timerticspersec / timerfreq) - timerlastsample;
+ n = (int32_t)(i*timerticspersec / timerfreq) - timerlastsample;
if (n>0) {
totalclock += n;
timerlastsample += n;
--- a/Game/src/DbgHelp.h
+++ b/Game/src/DbgHelp.h
@@ -371,7 +371,7 @@
LPADDRESS64 a64
)
{
- a64->Offset = (ULONG64)(LONG64)(LONG)a32->Offset;
+ a64->Offset = (ULONG64)(LONG64)(int32_t)a32->Offset;
a64->Segment = a32->Segment;
a64->Mode = a32->Mode;
}
--- a/Game/src/actors.c
+++ b/Game/src/actors.c
@@ -693,7 +693,7 @@
clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype);
else
retval =
- clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),(long)(sprite[spritenum].clipdist<<2),(4<<8),(4<<8),cliptype);
+ clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),(int32_t)(sprite[spritenum].clipdist<<2),(4<<8),(4<<8),cliptype);
}
if( dasectnum >= 0)
@@ -6486,9 +6486,9 @@
if( t[0] == 0 ) break;
if( s->ang == 1536 )
- l = (long) &sc->ceilingz;
+ l = (int32_t) &sc->ceilingz;
else
- l = (long) &sc->floorz;
+ l = (int32_t) &sc->floorz;
if( t[0] == 1 ) //Decide if the s->sectnum should go up or down
{
@@ -6858,7 +6858,7 @@
break;
case 29:
s->hitag += 64;
- l = mulscale12((long)s->yvel,sintable[s->hitag&2047]);
+ l = mulscale12((int32_t)s->yvel,sintable[s->hitag&2047]);
sc->floorz = s->z + l;
break;
case 31: // True Drop Floor
--- a/Game/src/config.c
+++ b/Game/src/config.c
@@ -847,7 +847,7 @@
SCRIPT_PutNumber( scripthandle, "Controls", "MouseAimingFlipped",ud.mouseflip,false,false);
SCRIPT_PutNumber( scripthandle, "Controls","MouseAiming",MouseAiming,false,false);
SCRIPT_PutNumber( scripthandle, "Controls","GameMouseAiming",(int32) ps[myconnectindex].aim_mode,false,false);
- SCRIPT_PutNumber( scripthandle, "Controls","AimingFlag",(long) myaimmode,false,false);
+ SCRIPT_PutNumber( scripthandle, "Controls","AimingFlag",(int32_t) myaimmode,false,false);
// FIX_00016: Build in Keyboard/mouse setup. Mouse now faster.
for(i=0; i<MAXMOUSEBUTTONS; i++)
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -513,7 +513,7 @@
{
if (playerquitflag[i] == 0) continue;
if (i == myconnectindex)
- otherminlag = (long)((int8_t )packbuf[j]);
+ otherminlag = (int32_t)((int8_t )packbuf[j]);
j++;
}
@@ -535,10 +535,10 @@
if (l&1) nsyn[i].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (l&2) nsyn[i].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (l&4) nsyn[i].avel = (int8_t )packbuf[j++];
- if (l&8) nsyn[i].bits = ((nsyn[i].bits&0xffffff00)|((long)packbuf[j++]));
- if (l&16) nsyn[i].bits = ((nsyn[i].bits&0xffff00ff)|((long)packbuf[j++])<<8);
- if (l&32) nsyn[i].bits = ((nsyn[i].bits&0xff00ffff)|((long)packbuf[j++])<<16);
- if (l&64) nsyn[i].bits = ((nsyn[i].bits&0x00ffffff)|((long)packbuf[j++])<<24);
+ if (l&8) nsyn[i].bits = ((nsyn[i].bits&0xffffff00)|((int32_t)packbuf[j++]));
+ if (l&16) nsyn[i].bits = ((nsyn[i].bits&0xffff00ff)|((int32_t)packbuf[j++])<<8);
+ if (l&32) nsyn[i].bits = ((nsyn[i].bits&0xff00ffff)|((int32_t)packbuf[j++])<<16);
+ if (l&64) nsyn[i].bits = ((nsyn[i].bits&0x00ffffff)|((int32_t)packbuf[j++])<<24);
if (l&128) nsyn[i].horz = (int8_t )packbuf[j++];
if (nsyn[i].bits&(1<<26)) playerquitflag[i] = 0;
@@ -577,10 +577,10 @@
if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (k&4) nsyn[other].avel = (int8_t )packbuf[j++];
- if (k&8) nsyn[other].bits = ((nsyn[other].bits&0xffffff00)|((long)packbuf[j++]));
- if (k&16) nsyn[other].bits = ((nsyn[other].bits&0xffff00ff)|((long)packbuf[j++])<<8);
- if (k&32) nsyn[other].bits = ((nsyn[other].bits&0xff00ffff)|((long)packbuf[j++])<<16);
- if (k&64) nsyn[other].bits = ((nsyn[other].bits&0x00ffffff)|((long)packbuf[j++])<<24);
+ if (k&8) nsyn[other].bits = ((nsyn[other].bits&0xffffff00)|((int32_t)packbuf[j++]));
+ if (k&16) nsyn[other].bits = ((nsyn[other].bits&0xffff00ff)|((int32_t)packbuf[j++])<<8);
+ if (k&32) nsyn[other].bits = ((nsyn[other].bits&0xff00ffff)|((int32_t)packbuf[j++])<<16);
+ if (k&64) nsyn[other].bits = ((nsyn[other].bits&0x00ffffff)|((int32_t)packbuf[j++])<<24);
if (k&128) nsyn[other].horz = (int8_t )packbuf[j++];
movefifoend[other]++;
@@ -705,7 +705,7 @@
{
if (i == myconnectindex)
{
- otherminlag = (long)((int8_t )packbuf[j]);
+ otherminlag = (int32_t)((int8_t )packbuf[j]);
}
j++;
@@ -719,10 +719,10 @@
if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (k&4) nsyn[other].avel = (int8_t )packbuf[j++];
- if (k&8) nsyn[other].bits = ((nsyn[other].bits&0xffffff00)|((long)packbuf[j++]));
- if (k&16) nsyn[other].bits = ((nsyn[other].bits&0xffff00ff)|((long)packbuf[j++])<<8);
- if (k&32) nsyn[other].bits = ((nsyn[other].bits&0xff00ffff)|((long)packbuf[j++])<<16);
- if (k&64) nsyn[other].bits = ((nsyn[other].bits&0x00ffffff)|((long)packbuf[j++])<<24);
+ if (k&8) nsyn[other].bits = ((nsyn[other].bits&0xffffff00)|((int32_t)packbuf[j++]));
+ if (k&16) nsyn[other].bits = ((nsyn[other].bits&0xffff00ff)|((int32_t)packbuf[j++])<<8);
+ if (k&32) nsyn[other].bits = ((nsyn[other].bits&0xff00ffff)|((int32_t)packbuf[j++])<<16);
+ if (k&64) nsyn[other].bits = ((nsyn[other].bits&0x00ffffff)|((int32_t)packbuf[j++])<<24);
if (k&128) nsyn[other].horz = (int8_t )packbuf[j++];
movefifoend[other]++;
@@ -2753,15 +2753,15 @@
{
if (screenpeek == myconnectindex && numplayers > 1)
{
- cposx = omyx+mulscale16((long)(myx-omyx),smoothratio);
- cposy = omyy+mulscale16((long)(myy-omyy),smoothratio);
- cang = omyang+mulscale16((long)(((myang+1024-omyang)&2047)-1024),smoothratio);
+ cposx = omyx+mulscale16((int32_t)(myx-omyx),smoothratio);
+ cposy = omyy+mulscale16((int32_t)(myy-omyy),smoothratio);
+ cang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio);
}
else
{
- cposx = pp->oposx+mulscale16((long)(pp->posx-pp->oposx),smoothratio);
- cposy = pp->oposy+mulscale16((long)(pp->posy-pp->oposy),smoothratio);
- cang = pp->oang+mulscale16((long)(((pp->ang+1024-pp->oang)&2047)-1024),smoothratio);
+ cposx = pp->oposx+mulscale16((int32_t)(pp->posx-pp->oposx),smoothratio);
+ cposy = pp->oposy+mulscale16((int32_t)(pp->posy-pp->oposy),smoothratio);
+ cang = pp->oang+mulscale16((int32_t)(((pp->ang+1024-pp->oang)&2047)-1024),smoothratio);
}
}
else
@@ -3249,7 +3249,7 @@
if(s->yvel < 0) s->yvel = -100;
else if(s->yvel > 199) s->yvel = 300;
- cang = hittype[ud.camerasprite].tempang+mulscale16((long)(((s->ang+1024-hittype[ud.camerasprite].tempang)&2047)-1024),smoothratio);
+ cang = hittype[ud.camerasprite].tempang+mulscale16((int32_t)(((s->ang+1024-hittype[ud.camerasprite].tempang)&2047)-1024),smoothratio);
se40code(s->x,s->y,s->z,cang,s->yvel,smoothratio);
@@ -3303,20 +3303,20 @@
if ( (snum == myconnectindex) && (numplayers > 1) )
{
- cposx = omyx+mulscale16((long)(myx-omyx),smoothratio);
- cposy = omyy+mulscale16((long)(myy-omyy),smoothratio);
- cposz = omyz+mulscale16((long)(myz-omyz),smoothratio);
- cang = omyang+mulscale16((long)(((myang+1024-omyang)&2047)-1024),smoothratio);
- choriz = omyhoriz+omyhorizoff+mulscale16((long)(myhoriz+myhorizoff-omyhoriz-omyhorizoff),smoothratio);
+ cposx = omyx+mulscale16((int32_t)(myx-omyx),smoothratio);
+ cposy = omyy+mulscale16((int32_t)(myy-omyy),smoothratio);
+ cposz = omyz+mulscale16((int32_t)(myz-omyz),smoothratio);
+ cang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio);
+ choriz = omyhoriz+omyhorizoff+mulscale16((int32_t)(myhoriz+myhorizoff-omyhoriz-omyhorizoff),smoothratio);
sect = mycursectnum;
}
else
{
- cposx = p->oposx+mulscale16((long)(p->posx-p->oposx),smoothratio);
- cposy = p->oposy+mulscale16((long)(p->posy-p->oposy),smoothratio);
- cposz = p->oposz+mulscale16((long)(p->posz-p->oposz),smoothratio);
- cang = p->oang+mulscale16((long)(((p->ang+1024-p->oang)&2047)-1024),smoothratio);
- choriz = p->ohoriz+p->ohorizoff+mulscale16((long)(p->horiz+p->horizoff-p->ohoriz-p->ohorizoff),smoothratio);
+ cposx = p->oposx+mulscale16((int32_t)(p->posx-p->oposx),smoothratio);
+ cposy = p->oposy+mulscale16((int32_t)(p->posy-p->oposy),smoothratio);
+ cposz = p->oposz+mulscale16((int32_t)(p->posz-p->oposz),smoothratio);
+ cang = p->oang+mulscale16((int32_t)(((p->ang+1024-p->oang)&2047)-1024),smoothratio);
+ choriz = p->ohoriz+p->ohorizoff+mulscale16((int32_t)(p->horiz+p->horizoff-p->ohoriz-p->ohorizoff),smoothratio);
}
cang += p->look_ang;
@@ -3332,7 +3332,7 @@
}
else if( p->over_shoulder_on == 0 )
- cposz += p->opyoff+mulscale16((long)(p->pyoff-p->opyoff),smoothratio);
+ cposz += p->opyoff+mulscale16((int32_t)(p->pyoff-p->opyoff),smoothratio);
else view(p,&cposx,&cposy,&cposz,§,cang,choriz);
cz = hittype[p->i].ceilingz;
@@ -5697,10 +5697,10 @@
t->cstat |= 2;
if ( screenpeek == myconnectindex && numplayers >= 2 )
{
- t->x = omyx+mulscale16((long)(myx-omyx),smoothratio);
- t->y = omyy+mulscale16((long)(myy-omyy),smoothratio);
- t->z = omyz+mulscale16((long)(myz-omyz),smoothratio)+(40<<8);
- t->ang = omyang+mulscale16((long)(((myang+1024-omyang)&2047)-1024),smoothratio);
+ t->x = omyx+mulscale16((int32_t)(myx-omyx),smoothratio);
+ t->y = omyy+mulscale16((int32_t)(myy-omyy),smoothratio);
+ t->z = omyz+mulscale16((int32_t)(myz-omyz),smoothratio)+(40<<8);
+ t->ang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio);
t->sectnum = mycursectnum;
}
}
@@ -7459,7 +7459,7 @@
while (string[i] != 0)
{
character = string[i];
- printchrasm(0xb8000+(long)pos,1L,((long)attribute<<8)+(long)character);
+ printchrasm(0xb8000+(int32_t)pos,1L,((int32_t)attribute<<8)+(int32_t)character);
i++;
pos+=2;
}
@@ -8584,7 +8584,7 @@
}
}
- kread(recfilep,&ud.reccnt,sizeof(long));
+ kread(recfilep,&ud.reccnt,sizeof(int32_t));
kread(recfilep,&ver,sizeof(uint8_t ));
printf("%s has version = %d\n", fname, ver);
@@ -8770,7 +8770,7 @@
dfwrite(recsync,sizeof(input)*ud.multimode,ud.reccnt/ud.multimode,frecfilep);
fseek(frecfilep,SEEK_SET,0L);
- fwrite(&totalreccnt,sizeof(long),1,frecfilep);
+ fwrite(&totalreccnt,sizeof(int32_t),1,frecfilep);
ud.recstat = ud.m_recstat = 0;
}
fclose(frecfilep);
--- a/Game/src/gamedef.c
+++ b/Game/src/gamedef.c
@@ -483,7 +483,7 @@
{
getlabel();
scriptptr--;
- labelcode[labelcnt] = (long) scriptptr;
+ labelcode[labelcnt] = (int32_t) scriptptr;
labelcnt++;
parsing_state = 1;
@@ -628,7 +628,7 @@
break;
}
if(i == labelcnt)
- labelcode[labelcnt++] = (long) scriptptr;
+ labelcode[labelcnt++] = (int32_t) scriptptr;
for(j=0;j<2;j++)
{
if(keyword() >= 0) break;
@@ -786,7 +786,7 @@
}
if(i == labelcnt)
- labelcode[labelcnt++] = (long) scriptptr;
+ labelcode[labelcnt++] = (int32_t) scriptptr;
for(j=0;j<3;j++)
{
@@ -840,7 +840,7 @@
}
if(i == labelcnt)
- labelcode[labelcnt++] = (long) scriptptr;
+ labelcode[labelcnt++] = (int32_t) scriptptr;
for(j=0;j<5;j++)
{
@@ -1017,7 +1017,7 @@
tempscrptr = scriptptr;
scriptptr++; //Leave a spot for the fail location
parsecommand(readfromGRP);
- *tempscrptr = (long) scriptptr;
+ *tempscrptr = (int32_t) scriptptr;
}
else
{
@@ -1098,7 +1098,7 @@
parsecommand(readfromGRP);
- *tempscrptr = (long) scriptptr;
+ *tempscrptr = (int32_t) scriptptr;
checking_ifelse++;
return 0;
@@ -1585,7 +1585,7 @@
total_lines = 0;
passone(readfromGRP); //Tokenize
- *script = (long) scriptptr;
+ *script = (int32_t) scriptptr;
if(warning|error)
printf("Found %hhd warning(s), %c error(s).\n",warning,error);
@@ -1597,8 +1597,8 @@
else
{
total_lines += line_number;
- printf("Code Size:%ld bytes(%d labels).\n",(long)((scriptptr-script)<<2)-4,labelcnt);
- ud.conSize[0] = (long)(scriptptr-script)-1;
+ printf("Code Size:%ld bytes(%d labels).\n",(int32_t)((scriptptr-script)<<2)-4,labelcnt);
+ ud.conSize[0] = (int32_t)(scriptptr-script)-1;
// FIX_00062: Better support and identification for GRP and CON files for 1.3/1.3d/1.4/1.5
if( ud.conSize[0] == 16208 && labelcnt == 1794 && conVersion == 15)
@@ -2870,7 +2870,7 @@
j = 0;
}
- parseifelse((long) j);
+ parseifelse((int32_t) j);
}
break;
--- a/Game/src/global.c
+++ b/Game/src/global.c
@@ -730,7 +730,7 @@
b3 = (l>>16)&255;
b4 = (l>>24)&255;
- return ((long)b1<<24) + ((long)b2<<16) + ((long)b3<<8) + b4;
+ return ((int32_t)b1<<24) + ((int32_t)b2<<16) + ((int32_t)b3<<8) + b4;
}
int32_t Keepint32_t (int32_t l)
--- a/Game/src/menues.c
+++ b/Game/src/menues.c
@@ -337,8 +337,8 @@
kdfread(po,sizeof(po),1,fil);
kdfread(&numanimwalls,sizeof(numanimwalls),1,fil);
kdfread(&animwall,sizeof(animwall),1,fil);
- kdfread(&msx[0],sizeof(long),sizeof(msx)/sizeof(long),fil);
- kdfread(&msy[0],sizeof(long),sizeof(msy)/sizeof(long),fil);
+ kdfread(&msx[0],sizeof(int32_t),sizeof(msx)/sizeof(int32_t),fil);
+ kdfread(&msy[0],sizeof(int32_t),sizeof(msy)/sizeof(int32_t),fil);
kdfread((short *)&spriteqloc,sizeof(short),1,fil);
kdfread((short *)&spriteqamount,sizeof(short),1,fil);
kdfread((short *)&spriteq[0],sizeof(short),spriteqamount,fil);
@@ -359,7 +359,7 @@
for(i=0;i<MAXSCRIPTSIZE;i++)
if( scriptptrs[i] )
{
- j = (long)script[i]+(long)&script[0];
+ j = (int32_t)script[i]+(int32_t)&script[0];
script[i] = j;
}
@@ -367,7 +367,7 @@
for(i=0;i<MAXTILES;i++)
if(actorscrptr[i])
{
- j = (long)actorscrptr[i]+(long)&script[0];
+ j = (int32_t)actorscrptr[i]+(int32_t)&script[0];
actorscrptr[i] = (int32_t *)j;
}
@@ -376,7 +376,7 @@
for(i=0;i<MAXSPRITES;i++)
{
- j = (long)(&script[0]);
+ j = (int32_t)(&script[0]);
if( scriptptrs[i]&1 ) T2 += j;
if( scriptptrs[i]&2 ) T5 += j;
if( scriptptrs[i]&4 ) T6 += j;
@@ -389,7 +389,7 @@
kdfread(&animatecnt,sizeof(animatecnt),1,fil);
kdfread(&animatesect[0],2,MAXANIMATES,fil);
kdfread(&animateptr[0],4,MAXANIMATES,fil);
- for(i = animatecnt-1;i>=0;i--) animateptr[i] = (int32_t *)((long)animateptr[i]+(long)(§or[0]));
+ for(i = animatecnt-1;i>=0;i--) animateptr[i] = (int32_t *)((int32_t)animateptr[i]+(int32_t)(§or[0]));
kdfread(&animategoal[0],4,MAXANIMATES,fil);
kdfread(&animatevel[0],4,MAXANIMATES,fil);
@@ -622,8 +622,8 @@
dfwrite(po,sizeof(po),1,fil);
dfwrite(&numanimwalls,sizeof(numanimwalls),1,fil);
dfwrite(&animwall,sizeof(animwall),1,fil);
- dfwrite(&msx[0],sizeof(long),sizeof(msx)/sizeof(long),fil);
- dfwrite(&msy[0],sizeof(long),sizeof(msy)/sizeof(long),fil);
+ dfwrite(&msx[0],sizeof(int32_t),sizeof(msx)/sizeof(int32_t),fil);
+ dfwrite(&msy[0],sizeof(int32_t),sizeof(msy)/sizeof(int32_t),fil);
dfwrite(&spriteqloc,sizeof(short),1,fil);
dfwrite(&spriteqamount,sizeof(short),1,fil);
dfwrite(&spriteq[0],sizeof(short),spriteqamount,fil);
@@ -641,10 +641,10 @@
for(i=0;i<MAXSCRIPTSIZE;i++)
{
- if( (long)script[i] >= (long)(&script[0]) && (long)script[i] < (long)(&script[MAXSCRIPTSIZE]) )
+ if( (int32_t)script[i] >= (int32_t)(&script[0]) && (int32_t)script[i] < (int32_t)(&script[MAXSCRIPTSIZE]) )
{
scriptptrs[i] = 1;
- j = (long)script[i] - (long)&script[0];
+ j = (int32_t)script[i] - (int32_t)&script[0];
script[i] = j;
}
else scriptptrs[i] = 0;
@@ -656,7 +656,7 @@
for(i=0;i<MAXSCRIPTSIZE;i++)
if( scriptptrs[i] )
{
- j = script[i]+(long)&script[0];
+ j = script[i]+(int32_t)&script[0];
script[i] = j;
}
@@ -663,7 +663,7 @@
for(i=0;i<MAXTILES;i++)
if(actorscrptr[i])
{
- j = (long)actorscrptr[i]-(long)&script[0];
+ j = (int32_t)actorscrptr[i]-(int32_t)&script[0];
actorscrptr[i] = (int32_t *)j;
}
dfwrite(&actorscrptr[0],4,MAXTILES,fil);
@@ -670,7 +670,7 @@
for(i=0;i<MAXTILES;i++)
if(actorscrptr[i])
{
- j = (long)actorscrptr[i]+(long)&script[0];
+ j = (int32_t)actorscrptr[i]+(int32_t)&script[0];
actorscrptr[i] = (int32_t *)j;
}
@@ -680,19 +680,19 @@
if(actorscrptr[PN] == 0) continue;
- j = (long)&script[0];
+ j = (int32_t)&script[0];
- if(T2 >= j && T2 < (long)(&script[MAXSCRIPTSIZE]) )
+ if(T2 >= j && T2 < (int32_t)(&script[MAXSCRIPTSIZE]) )
{
scriptptrs[i] |= 1;
T2 -= j;
}
- if(T5 >= j && T5 < (long)(&script[MAXSCRIPTSIZE]) )
+ if(T5 >= j && T5 < (int32_t)(&script[MAXSCRIPTSIZE]) )
{
scriptptrs[i] |= 2;
T5 -= j;
}
- if(T6 >= j && T6 < (long)(&script[MAXSCRIPTSIZE]) )
+ if(T6 >= j && T6 < (int32_t)(&script[MAXSCRIPTSIZE]) )
{
scriptptrs[i] |= 4;
T6 -= j;
@@ -705,7 +705,7 @@
for(i=0;i<MAXSPRITES;i++)
{
if(actorscrptr[PN] == 0) continue;
- j = (long)&script[0];
+ j = (int32_t)&script[0];
if(scriptptrs[i]&1)
T2 += j;
@@ -720,9 +720,9 @@
dfwrite(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil);
dfwrite(&animatecnt,sizeof(animatecnt),1,fil);
dfwrite(&animatesect[0],2,MAXANIMATES,fil);
- for(i = animatecnt-1;i>=0;i--) animateptr[i] = (int32_t *)((long)animateptr[i]-(long)(§or[0]));
+ for(i = animatecnt-1;i>=0;i--) animateptr[i] = (int32_t *)((int32_t)animateptr[i]-(int32_t)(§or[0]));
dfwrite(&animateptr[0],4,MAXANIMATES,fil);
- for(i = animatecnt-1;i>=0;i--) animateptr[i] = (int32_t *)((long)animateptr[i]+(long)(§or[0]));
+ for(i = animatecnt-1;i>=0;i--) animateptr[i] = (int32_t *)((int32_t)animateptr[i]+(int32_t)(§or[0]));
dfwrite(&animategoal[0],4,MAXANIMATES,fil);
dfwrite(&animatevel[0],4,MAXANIMATES,fil);
@@ -4180,9 +4180,9 @@
for(i=0;i<(256*3);i+=3)
{
- temparray[i ] =ps[myconnectindex].palette[i+0]+((((long)r-(long)ps[myconnectindex].palette[i+0])*(long)(e&127))>>6);
- temparray[i+1] =ps[myconnectindex].palette[i+1]+((((long)g-(long)ps[myconnectindex].palette[i+1])*(long)(e&127))>>6);
- temparray[i+2] =ps[myconnectindex].palette[i+2]+((((long)b-(long)ps[myconnectindex].palette[i+2])*(long)(e&127))>>6);
+ temparray[i ] =ps[myconnectindex].palette[i+0]+((((int32_t)r-(int32_t)ps[myconnectindex].palette[i+0])*(int32_t)(e&127))>>6);
+ temparray[i+1] =ps[myconnectindex].palette[i+1]+((((int32_t)g-(int32_t)ps[myconnectindex].palette[i+1])*(int32_t)(e&127))>>6);
+ temparray[i+2] =ps[myconnectindex].palette[i+2]+((((int32_t)b-(int32_t)ps[myconnectindex].palette[i+2])*(int32_t)(e&127))>>6);
}
setbrightness(ud.brightness>>2,temparray);
@@ -4292,7 +4292,7 @@
{
x1 = sprx; y1 = spry;
tilenum = spr->picnum;
- xoff = (long)((int8_t )((picanm[tilenum]>>8)&255))+((long)spr->xoffset);
+ xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
if ((spr->cstat&4) > 0) xoff = -xoff;
k = spr->ang; l = spr->xrepeat;
dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l;
@@ -4317,8 +4317,8 @@
case 32:
tilenum = spr->picnum;
- xoff = (long)((int8_t )((picanm[tilenum]>>8)&255))+((long)spr->xoffset);
- yoff = (long)((int8_t )((picanm[tilenum]>>16)&255))+((long)spr->yoffset);
+ xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
+ yoff = (int32_t)((int8_t )((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
if ((spr->cstat&4) > 0) xoff = -xoff;
if ((spr->cstat&8) > 0) yoff = -yoff;
--- a/Game/src/player.c
+++ b/Game/src/player.c
@@ -1822,7 +1822,7 @@
loc.svel = svel = 0;
loc.avel = angvel = 0;
loc.horz = horiz = 0;
- loc.bits = (((long)gamequit)<<26);
+ loc.bits = (((int32_t)gamequit)<<26);
info.dz = info.dyaw = 0;
return;
}
@@ -1937,7 +1937,7 @@
loc.bits |= myaimmode<<23;
loc.bits |= ACTION(gamefunc_Holo_Duke)<<24;
loc.bits |= ACTION(gamefunc_Jetpack)<<25;
- loc.bits |= (((long)gamequit)<<26);
+ loc.bits |= (((int32_t)gamequit)<<26);
loc.bits |= ACTION(gamefunc_Inventory_Right)<<27;
loc.bits |= ACTION(gamefunc_TurnAround)<<28;
loc.bits |= ACTION(gamefunc_Open)<<29;
@@ -4201,7 +4201,7 @@
hitscan(sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].sectnum,
mulscale14(sprite[j].xvel,sintable[(sprite[j].ang+512)&2047]),
mulscale14(sprite[j].xvel,sintable[sprite[j].ang&2047]),
- (long)sprite[j].zvel,
+ (int32_t)sprite[j].zvel,
&dasect,&dawall,&daspr,&x3,&y3,&z3,CLIPMASK1);
}
}
--- a/Game/src/premap.c
+++ b/Game/src/premap.c
@@ -1300,7 +1300,7 @@
{
kread(fp,(int8_t *)&look_pos,1);
kread(fp,tempbuf,256);
- makepalookup((long)look_pos,(uint8_t*)tempbuf,0,0,0,1);
+ makepalookup((int32_t)look_pos,(uint8_t*)tempbuf,0,0,0,1);
}
kread(fp,&waterpal[0],768);
--- a/Game/src/rts.c
+++ b/Game/src/rts.c
@@ -225,7 +225,7 @@
if (lumpcache[lump] == NULL)
{
lumplockbyte[lump] = 200;
- allocache((int32_t *)&lumpcache[lump],(long)RTS_SoundLength(lump-1),&lumplockbyte[lump]);
+ allocache((int32_t *)&lumpcache[lump],(int32_t)RTS_SoundLength(lump-1),&lumplockbyte[lump]);
RTS_ReadLump(lump, lumpcache[lump]);
}
else
--- a/Game/src/sounds.c
+++ b/Game/src/sounds.c
@@ -466,13 +466,13 @@
{
if(*Sound[num].ptr == 'C')
{
- start = (long)*(unsigned short *)(Sound[num].ptr + 0x14);
+ start = (int32_t)*(unsigned short *)(Sound[num].ptr + 0x14);
voice = FX_PlayLoopedVOC( Sound[num].ptr, start, start + soundsiz[num],
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,soundpr[num],num);
}
else
{
- start = (long)*(unsigned short *)(Sound[num].ptr + 0x14);
+ start = (int32_t)*(unsigned short *)(Sound[num].ptr + 0x14);
voice = FX_PlayLoopedWAV( Sound[num].ptr, start, start + soundsiz[num],
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,soundpr[num],num);
}