Part 1 of 64-bit patch from Stephen Anthony

git-svn-id: https://svn.eduke32.com/eduke32@618 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-02-16 22:27:08 +00:00
parent 2f4028c265
commit fad541b377
16 changed files with 114 additions and 67 deletions

View file

@ -48,6 +48,7 @@ endif
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
RENDERTYPE=SDL RENDERTYPE=SDL
BUILDCFLAGS+= -DHAVE_INTTYPES
GTKCOMPAT32=0 GTKCOMPAT32=0
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64) ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
@ -57,16 +58,20 @@ ifeq ($(PLATFORM),LINUX)
BUILDCFLAGS+= -m32 BUILDCFLAGS+= -m32
#override WITHOUT_GTK=0 #override WITHOUT_GTK=0
GTKCOMPAT32=1 GTKCOMPAT32=1
else
override NOASM=1
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
RENDERTYPE ?= WIN RENDERTYPE ?= WIN
BUILDCFLAGS+= -DHAVE_INTTYPES
EXESUFFIX=.exe EXESUFFIX=.exe
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 #-lshfolder LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 #-lshfolder
endif endif
ifeq ($(PLATFORM),BSD) ifeq ($(PLATFORM),BSD)
RENDERTYPE=SDL RENDERTYPE=SDL
BUILDCFLAGS+= -DHAVE_INTTYPES
endif endif
ifeq ($(PLATFORM),BEOS) ifeq ($(PLATFORM),BEOS)
RENDERTYPE=SDL RENDERTYPE=SDL

View file

@ -5,6 +5,8 @@
#ifndef __baselayer_h__ #ifndef __baselayer_h__
#define __baselayer_h__ #define __baselayer_h__
#include "compat.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -22,7 +24,8 @@ extern int startwin_settitle(const char *);
extern int startwin_idle(void *); extern int startwin_idle(void *);
// video // video
extern int xres, yres, bpp, fullscreen, bytesperline, imageSize, frameplace; extern int xres, yres, bpp, fullscreen, bytesperline, imageSize;
extern intptr_t frameplace;
extern char offscreenrendering; extern char offscreenrendering;
extern void (*baselayer_onvideomodechange)(int); extern void (*baselayer_onvideomodechange)(int);

View file

@ -9,6 +9,8 @@
#ifndef __build_h__ #ifndef __build_h__
#define __build_h__ #define __build_h__
#include "compat.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -188,8 +190,9 @@ EXTERN spritetype *sprite;
EXTERN int spritesortcnt; EXTERN int spritesortcnt;
EXTERN spritetype *tsprite; EXTERN spritetype *tsprite;
EXTERN int xdim, ydim, ylookup[MAXYDIM+1], numpages; EXTERN int xdim, ydim, numpages;
EXTERN int yxaspect, viewingrange; EXTERN int yxaspect, viewingrange;
EXTERN intptr_t ylookup[MAXYDIM+1];
#define MAXVALIDMODES 256 #define MAXVALIDMODES 256
EXTERN int validmodecnt; EXTERN int validmodecnt;
@ -226,7 +229,8 @@ EXTERN short tilesizx[MAXTILES], tilesizy[MAXTILES];
EXTERN char picsiz[MAXTILES]; EXTERN char picsiz[MAXTILES];
EXTERN char walock[MAXTILES]; EXTERN char walock[MAXTILES];
EXTERN int pow2long[32]; EXTERN int pow2long[32];
EXTERN int numtiles, picanm[MAXTILES], waloff[MAXTILES]; EXTERN int numtiles, picanm[MAXTILES];
EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA
EXTERN int windowpos, windowx, windowy; EXTERN int windowpos, windowx, windowy;

View file

@ -3,13 +3,15 @@
#ifndef __cache1d_h__ #ifndef __cache1d_h__
#define __cache1d_h__ #define __cache1d_h__
#include "compat.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void initcache(int dacachestart, int dacachesize); void initcache(intptr_t dacachestart, int dacachesize);
void allocache(int *newhandle, int newbytes, char *newlockptr); void allocache(intptr_t *newhandle, int newbytes, char *newlockptr);
void suckcache(int *suckptr); void suckcache(intptr_t *suckptr);
void agecache(void); void agecache(void);
extern int pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode) extern int pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode)

View file

@ -5,6 +5,13 @@
#ifndef __compat_h__ #ifndef __compat_h__
#define __compat_h__ #define __compat_h__
// This gives us access to 'intptr_t' and 'uintptr_t', which are
// abstractions to the size of a pointer on a given platform
// (ie, they're guaranteed to be the same size as a pointer)
#ifdef HAVE_INTTYPES
# include <inttypes.h>
#endif
// Define this to rewrite all 'B' versions to library functions. This // Define this to rewrite all 'B' versions to library functions. This
// is for platforms which give us a standard sort of C library so we // is for platforms which give us a standard sort of C library so we
// link directly. Platforms like PalmOS which don't have a standard C // link directly. Platforms like PalmOS which don't have a standard C

View file

@ -79,7 +79,8 @@ extern char vgacompatible;
extern char picsiz[MAXTILES]; extern char picsiz[MAXTILES];
extern int startposx, startposy, startposz; extern int startposx, startposy, startposz;
extern short startang, startsectnum; extern short startang, startsectnum;
extern int frameplace, ydim16, halfxdim16, midydim16; extern int ydim16, halfxdim16, midydim16;
extern intptr_t frameplace;
int xdim2d = 640, ydim2d = 480, xdimgame = 640, ydimgame = 480, bppgame = 8; int xdim2d = 640, ydim2d = 480, xdimgame = 640, ydimgame = 480, bppgame = 8;
int forcesetup = 1; int forcesetup = 1;

View file

@ -37,16 +37,16 @@ static int kzipopen(char *filnam)
// Step 1: Allocate a nice BIG buffer, like from 1MB-4MB and // Step 1: Allocate a nice BIG buffer, like from 1MB-4MB and
// Call initcache(int cachestart, int cachesize) where // Call initcache(int cachestart, int cachesize) where
// //
// cachestart = (int)(pointer to start of BIG buffer) // cachestart = (intptr_t)(pointer to start of BIG buffer)
// cachesize = length of BIG buffer // cachesize = length of BIG buffer
// //
// Step 2: Call allocache(int *bufptr, int bufsiz, char *lockptr) // Step 2: Call allocache(intptr_t *bufptr, int bufsiz, char *lockptr)
// whenever you need to allocate a buffer, where: // whenever you need to allocate a buffer, where:
// //
// *bufptr = pointer to 4-byte pointer to buffer // *bufptr = pointer to multi-byte pointer to buffer
// Confused? Using this method, cache2d can remove // Confused? Using this method, cache2d can remove
// previously allocated things from the cache safely by // previously allocated things from the cache safely by
// setting the 4-byte pointer to 0. // setting the multi-byte pointer to 0.
// bufsiz = number of bytes to allocate // bufsiz = number of bytes to allocate
// *lockptr = pointer to locking char which tells whether // *lockptr = pointer to locking char which tells whether
// the region can be removed or not. If *lockptr = 0 then // the region can be removed or not. If *lockptr = 0 then
@ -64,8 +64,9 @@ static int kzipopen(char *filnam)
static int cachesize = 0; static int cachesize = 0;
int cachecount = 0; int cachecount = 0;
char zerochar = 0; char zerochar = 0;
int cachestart = 0, cacnum = 0, agecount = 0; intptr_t cachestart = 0;
typedef struct { int *hand, leng; char *lock ; } cactype; int cacnum = 0, agecount = 0;
typedef struct { intptr_t *hand, leng; char *lock ; } cactype;
cactype cac[MAXCACHEOBJECTS]; cactype cac[MAXCACHEOBJECTS];
static int lockrecip[200]; static int lockrecip[200];
@ -79,14 +80,25 @@ static void reportandexit(char *errormessage);
extern char pow2char[8]; extern char pow2char[8];
void initcache(int dacachestart, int dacachesize) void initcache(intptr_t dacachestart, int dacachesize)
{ {
int i; int i;
for (i=1;i<200;i++) lockrecip[i] = (1<<28)/(200-i); for (i=1;i<200;i++) lockrecip[i] = (1<<28)/(200-i);
cachestart = dacachestart; // The following code was relocated here from engine.c, since this
cachesize = dacachesize; // function is only ever called once (from there), and it seems to
// really belong here:
//
// initcache((FP_OFF(pic)+15)&0xfffffff0,(cachesize-((-FP_OFF(pic))&15))&0xfffffff0);
//
// I'm not sure why it's necessary, but the code is making sure the
// cache starts on a multiple of 16 bytes?? -- SA
//printf("BEFORE: cachestart = %x, cachesize = %d\n", dacachestart, dacachesize);
cachestart = ((uintptr_t)dacachestart+15)&~(uintptr_t)0xf;
cachesize = (dacachesize-((-(uintptr_t)(dacachestart))&0xf))&~(uintptr_t)0xf;
//printf("AFTER : cachestart = %x, cachesize = %d\n", cachestart, cachesize);
cac[0].leng = cachesize; cac[0].leng = cachesize;
cac[0].lock = &zerochar; cac[0].lock = &zerochar;
@ -95,16 +107,19 @@ void initcache(int dacachestart, int dacachesize)
initprintf("initcache(): Initialised with %d bytes\n", dacachesize); initprintf("initcache(): Initialised with %d bytes\n", dacachesize);
} }
void allocache(int *newhandle, int newbytes, char *newlockptr) void allocache(intptr_t *newhandle, int newbytes, char *newlockptr)
{ {
int i, /*j,*/ z, zz, bestz=0, daval, bestval, besto=0, o1, o2, sucklen, suckz; int i, /*j,*/ z, zz, bestz=0, daval, bestval, besto=0, o1, o2, sucklen, suckz;
newbytes = ((newbytes+15)&0xfffffff0); //printf(" ==> asking for %d bytes, ", newbytes);
// Make all requests a multiple of 16 bytes
newbytes = (newbytes+15)&0xfffffff0;
//printf("allocated %d bytes\n", newbytes);
if ((unsigned)newbytes > (unsigned)cachesize) if ((unsigned)newbytes > (unsigned)cachesize)
{ {
Bprintf("Cachesize: %d\n",cachesize); Bprintf("Cachesize: %d\n",cachesize);
Bprintf("*Newhandle: 0x%x, Newbytes: %d, *Newlock: %d\n",(int)newhandle,newbytes,*newlockptr); Bprintf("*Newhandle: 0x%x, Newbytes: %d, *Newlock: %d\n",(intptr_t)newhandle,newbytes,*newlockptr);
reportandexit("BUFFER TOO BIG TO FIT IN CACHE!"); reportandexit("BUFFER TOO BIG TO FIT IN CACHE!");
} }
@ -147,7 +162,7 @@ void allocache(int *newhandle, int newbytes, char *newlockptr)
//Remove all blocks except 1 //Remove all blocks except 1
suckz -= (bestz+1); cacnum -= suckz; suckz -= (bestz+1); cacnum -= suckz;
copybufbyte(&cac[bestz+suckz],&cac[bestz],(cacnum-bestz)*sizeof(cactype)); copybufbyte(&cac[bestz+suckz],&cac[bestz],(cacnum-bestz)*sizeof(cactype));
cac[bestz].hand = newhandle; *newhandle = cachestart+besto; cac[bestz].hand = newhandle; *newhandle = cachestart+(intptr_t)besto;
cac[bestz].leng = newbytes; cac[bestz].leng = newbytes;
cac[bestz].lock = newlockptr; cac[bestz].lock = newlockptr;
cachecount++; cachecount++;
@ -172,7 +187,7 @@ void allocache(int *newhandle, int newbytes, char *newlockptr)
cac[bestz].lock = &zerochar; cac[bestz].lock = &zerochar;
} }
void suckcache(int *suckptr) void suckcache(intptr_t *suckptr)
{ {
int i; int i;
@ -1096,11 +1111,11 @@ int kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int fil)
char *ptr; char *ptr;
lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200; lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200;
if (lzwbuf1 == NULL) allocache((int *)&lzwbuf1,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[0]); if (lzwbuf1 == NULL) allocache((intptr_t *)&lzwbuf1,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[0]);
if (lzwbuf2 == NULL) allocache((int *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]); if (lzwbuf2 == NULL) allocache((intptr_t *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]);
if (lzwbuf3 == NULL) allocache((int *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]); if (lzwbuf3 == NULL) allocache((intptr_t *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]);
if (lzwbuf4 == NULL) allocache((int *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); if (lzwbuf4 == NULL) allocache((intptr_t *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]);
if (lzwbuf5 == NULL) allocache((int *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); if (lzwbuf5 == NULL) allocache((intptr_t *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]);
if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
ptr = (char *)buffer; ptr = (char *)buffer;
@ -1135,11 +1150,11 @@ int dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
char *ptr; char *ptr;
lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200; lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200;
if (lzwbuf1 == NULL) allocache((int *)&lzwbuf1,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[0]); if (lzwbuf1 == NULL) allocache((intptr_t *)&lzwbuf1,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[0]);
if (lzwbuf2 == NULL) allocache((int *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]); if (lzwbuf2 == NULL) allocache((intptr_t *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]);
if (lzwbuf3 == NULL) allocache((int *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]); if (lzwbuf3 == NULL) allocache((intptr_t *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]);
if (lzwbuf4 == NULL) allocache((int *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); if (lzwbuf4 == NULL) allocache((intptr_t *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]);
if (lzwbuf5 == NULL) allocache((int *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); if (lzwbuf5 == NULL) allocache((intptr_t *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]);
if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
ptr = (char *)buffer; ptr = (char *)buffer;
@ -1174,11 +1189,11 @@ void kdfwrite(void *buffer, bsize_t dasizeof, bsize_t count, int fil)
char *ptr; char *ptr;
lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200; lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200;
if (lzwbuf1 == NULL) allocache((int *)&lzwbuf1,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[0]); if (lzwbuf1 == NULL) allocache((intptr_t *)&lzwbuf1,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[0]);
if (lzwbuf2 == NULL) allocache((int *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]); if (lzwbuf2 == NULL) allocache((intptr_t *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]);
if (lzwbuf3 == NULL) allocache((int *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]); if (lzwbuf3 == NULL) allocache((intptr_t *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]);
if (lzwbuf4 == NULL) allocache((int *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); if (lzwbuf4 == NULL) allocache((intptr_t *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]);
if (lzwbuf5 == NULL) allocache((int *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); if (lzwbuf5 == NULL) allocache((intptr_t *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]);
if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
ptr = (char *)buffer; ptr = (char *)buffer;
@ -1218,11 +1233,11 @@ void dfwrite(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
char *ptr; char *ptr;
lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200; lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200;
if (lzwbuf1 == NULL) allocache((int *)&lzwbuf1,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[0]); if (lzwbuf1 == NULL) allocache((intptr_t *)&lzwbuf1,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[0]);
if (lzwbuf2 == NULL) allocache((int *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]); if (lzwbuf2 == NULL) allocache((intptr_t *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]);
if (lzwbuf3 == NULL) allocache((int *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]); if (lzwbuf3 == NULL) allocache((intptr_t *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]);
if (lzwbuf4 == NULL) allocache((int *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); if (lzwbuf4 == NULL) allocache((intptr_t *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]);
if (lzwbuf5 == NULL) allocache((int *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); if (lzwbuf5 == NULL) allocache((intptr_t *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]);
if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
ptr = (char *)buffer; ptr = (char *)buffer;

View file

@ -70,7 +70,7 @@ static int lowrecip[1024], nytooclose, nytoofar;
static unsigned int distrecip[65536]; static unsigned int distrecip[65536];
#endif #endif
static int *lookups = NULL; static intptr_t *lookups = NULL;
static char lookupsalloctype = 255; static char lookupsalloctype = 255;
int dommxoverlay = 1, beforedrawrooms = 1, indrawroomsandmasks = 0; int dommxoverlay = 1, beforedrawrooms = 1, indrawroomsandmasks = 0;
@ -586,7 +586,8 @@ int /*viewoffset,*/ frameoffset;
static int nrx1[8], nry1[8], nrx2[8], nry2[8]; // JBF 20031206: Thanks Ken static int nrx1[8], nry1[8], nrx2[8], nry2[8]; // JBF 20031206: Thanks Ken
static int rxi[8], ryi[8], rzi[8], rxi2[8], ryi2[8], rzi2[8]; static int rxi[8], ryi[8], rzi[8], rxi2[8], ryi2[8], rzi2[8];
static int xsi[8], ysi[8], *horizlookup=0, *horizlookup2=0, horizycent; static int xsi[8], ysi[8], horizycent;
static intptr_t *horizlookup=0, *horizlookup2=0;
int globalposx, globalposy, globalposz, globalhoriz; int globalposx, globalposy, globalposz, globalhoriz;
short globalang, globalcursectnum; short globalang, globalcursectnum;
@ -604,7 +605,8 @@ int vplce[4], vince[4], palookupoffse[4], bufplce[4];
char globalxshift, globalyshift; char globalxshift, globalyshift;
int globalxpanning, globalypanning, globalshade; int globalxpanning, globalypanning, globalshade;
short globalpicnum, globalshiftval; short globalpicnum, globalshiftval;
int globalzd, globalbufplc, globalyscale, globalorientation; int globalzd, globalyscale, globalorientation;
intptr_t globalbufplc;
int globalx1, globaly1, globalx2, globaly2, globalx3, globaly3, globalzx; int globalx1, globaly1, globalx2, globaly2, globalx3, globaly3, globalzx;
int globalx, globaly, globalz; int globalx, globaly, globalz;
@ -1157,7 +1159,7 @@ static void hline(int xr, int yp)
asm2 = globaly2*r; asm2 = globaly2*r;
s = ((int)getpalookup((int)mulscale16(r,globvis),globalshade)<<8); s = ((int)getpalookup((int)mulscale16(r,globvis),globalshade)<<8);
hlineasm4(xr-xl,0L,s,globalx2*r+globalypanning,globaly1*r+globalxpanning, hlineasm4(xr-xl,0,s,globalx2*r+globalypanning,globaly1*r+globalxpanning,
ylookup[yp]+xr+frameoffset); ylookup[yp]+xr+frameoffset);
} }
@ -5220,9 +5222,9 @@ static void loadpalette(void)
kread(fil,&numpalookups,2); numpalookups = B_LITTLE16(numpalookups); kread(fil,&numpalookups,2); numpalookups = B_LITTLE16(numpalookups);
if ((palookup[0] = (char *)kkmalloc(numpalookups<<8)) == NULL) if ((palookup[0] = (char *)kkmalloc(numpalookups<<8)) == NULL)
allocache((int*)&palookup[0],numpalookups<<8,&permanentlock); allocache((intptr_t*)&palookup[0],numpalookups<<8,&permanentlock);
if ((transluc = (char *)kkmalloc(65536L)) == NULL) if ((transluc = (char *)kkmalloc(65536L)) == NULL)
allocache((int*)&transluc,65536,&permanentlock); allocache((intptr_t*)&transluc,65536,&permanentlock);
globalpalwritten = palookup[0]; globalpal = 0; globalpalwritten = palookup[0]; globalpal = 0;
setpalookupaddress(globalpalwritten); setpalookupaddress(globalpalwritten);
@ -7672,23 +7674,23 @@ int setgamemode(char davidoption, int daxdim, int daydim, int dabpp)
xdim = daxdim; ydim = daydim; xdim = daxdim; ydim = daydim;
j = ydim*4*sizeof(int); //Leave room for horizlookup&horizlookup2 j = ydim*4*sizeof(intptr_t); //Leave room for horizlookup&horizlookup2
if (lookups != NULL) if (lookups != NULL)
{ {
if (lookupsalloctype == 0) kkfree((void *)lookups); if (lookupsalloctype == 0) kkfree((void *)lookups);
if (lookupsalloctype == 1) suckcache((int *)lookups); if (lookupsalloctype == 1) suckcache(lookups);
lookups = NULL; lookups = NULL;
} }
lookupsalloctype = 0; lookupsalloctype = 0;
if ((lookups = (int *)kkmalloc(j<<1)) == NULL) if ((lookups = (intptr_t *)kkmalloc(j<<1)) == NULL)
{ {
allocache((int *)&lookups,j<<1,&permanentlock); allocache((intptr_t *)&lookups,j<<1,&permanentlock);
lookupsalloctype = 1; lookupsalloctype = 1;
} }
horizlookup = (int *)(lookups); horizlookup = lookups;
horizlookup2 = (int *)(FP_OFF(lookups)+j); horizlookup2 = (intptr_t *)((intptr_t)lookups+j); // FIXME_SA
horizycent = ((ydim*4)>>1); horizycent = ((ydim*4)>>1);
//Force drawrooms to call dosetaspect & recalculate stuff //Force drawrooms to call dosetaspect & recalculate stuff
@ -7875,7 +7877,7 @@ int loadpics(char *filename, int askedsize)
cachesize -= 65536L; cachesize -= 65536L;
if (cachesize < 65536) return(-1); if (cachesize < 65536) return(-1);
} }
initcache((FP_OFF(pic)+15)&0xfffffff0,(cachesize-((-FP_OFF(pic))&15))&0xfffffff0); initcache((intptr_t) pic, cachesize);
for (i=0;i<MAXTILES;i++) for (i=0;i<MAXTILES;i++)
{ {
@ -9809,7 +9811,7 @@ void makepalookup(int palnum, char *remapbuf, signed char r, signed char g, sign
{ {
//Allocate palookup buffer //Allocate palookup buffer
if ((palookup[palnum] = (char *)kkmalloc(numpalookups<<8)) == NULL) if ((palookup[palnum] = (char *)kkmalloc(numpalookups<<8)) == NULL)
allocache((int*)&palookup[palnum],numpalookups<<8,&permanentlock); allocache((intptr_t*)&palookup[palnum],numpalookups<<8,&permanentlock);
} }
if (dastat == 0) return; if (dastat == 0) return;

View file

@ -52,7 +52,8 @@ char quitevent=0, appactive=1;
// video // video
static SDL_Surface *sdl_surface; static SDL_Surface *sdl_surface;
int xres=-1, yres=-1, bpp=0, fullscreen=0, bytesperline, imageSize; int xres=-1, yres=-1, bpp=0, fullscreen=0, bytesperline, imageSize;
int frameplace=0, lockcount=0; intptr_t frameplace=0;
int lockcount=0;
char modechange=1; char modechange=1;
char offscreenrendering=0; char offscreenrendering=0;
char videomodereset = 0; char videomodereset = 0;
@ -459,7 +460,7 @@ void setjoypresscallback(void(*callback)(int, int)) { joypresscallback = callbac
int initmouse(void) int initmouse(void)
{ {
moustat=1; moustat=1;
grabmouse(1); grabmouse(1); // FIXME - SA
return 0; return 0;
} }
@ -1162,7 +1163,7 @@ void begindrawing(void)
if (offscreenrendering) return; if (offscreenrendering) return;
if (SDL_MUSTLOCK(sdl_surface)) SDL_LockSurface(sdl_surface); if (SDL_MUSTLOCK(sdl_surface)) SDL_LockSurface(sdl_surface);
frameplace = (int)sdl_surface->pixels; frameplace = (intptr_t)sdl_surface->pixels;
if (sdl_surface->pitch != bytesperline || modechange) if (sdl_surface->pitch != bytesperline || modechange)
{ {

View file

@ -9,7 +9,7 @@ POLYMOST = 1
USE_OPENGL = 1 USE_OPENGL = 1
NOASM = 0 NOASM = 0
LINKED_GTK = 0 LINKED_GTK = 0
BUILD32_ON_64 = 1 BUILD32_ON_64 = 0
# Debugging options # Debugging options
RELEASE?=1 RELEASE?=1

View file

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "duke3d.h" #include "duke3d.h"
#include "gamedef.h" #include "gamedef.h"
#include "compat.h"
extern int numenvsnds; extern int numenvsnds;
extern int actor_tog; extern int actor_tog;

View file

@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "duke3d.h" #include "duke3d.h"
#include "animlib.h" #include "animlib.h"
#include "mouse.h" #include "mouse.h"
#include "compat.h"
void endanimsounds(int fr) void endanimsounds(int fr)
{ {
@ -226,7 +227,7 @@ void playanm(const char *fn,char t)
walock[TILE_ANIM] = 219+t; walock[TILE_ANIM] = 219+t;
allocache((int *)&animbuf,length,&walock[TILE_ANIM]); allocache((intptr_t *)&animbuf,length,&walock[TILE_ANIM]);
tilesizx[TILE_ANIM] = 200; tilesizx[TILE_ANIM] = 200;
tilesizy[TILE_ANIM] = 320; tilesizy[TILE_ANIM] = 320;
@ -283,7 +284,7 @@ void playanm(const char *fn,char t)
else if (ud.volume_number == 1) ototalclock += 18; else if (ud.volume_number == 1) ototalclock += 18;
else ototalclock += 10; else ototalclock += 10;
waloff[TILE_ANIM] = FP_OFF(ANIM_DrawFrame(i)); waloff[TILE_ANIM] = (intptr_t)ANIM_DrawFrame(i);
invalidatetile(TILE_ANIM, 0, 1<<4); // JBF 20031228 invalidatetile(TILE_ANIM, 0, 1<<4); // JBF 20031228
rotatesprite(0<<16,0<<16,65536L,512,TILE_ANIM,0,0,2+4+8+16+64, 0,0,xdim-1,ydim-1); rotatesprite(0<<16,0<<16,65536L,512,TILE_ANIM,0,0,2+4+8+16+64, 0,0,xdim-1,ydim-1);
nextpage(); nextpage();

View file

@ -586,13 +586,15 @@ extern int screenpeek;
extern int current_menu; extern int current_menu;
extern int tempwallptr,animatecnt; extern int tempwallptr,animatecnt;
extern int lockclock,frameplace; extern int lockclock;
extern intptr_t frameplace;
extern char display_mirror,loadfromgrouponly,rtsplaying; extern char display_mirror,loadfromgrouponly,rtsplaying;
extern int groupfile; extern int groupfile;
extern int ototalclock; extern int ototalclock;
extern int *animateptr[MAXANIMATES], animategoal[MAXANIMATES]; extern int *animateptr[MAXANIMATES];
extern int animategoal[MAXANIMATES];
extern int animatevel[MAXANIMATES]; extern int animatevel[MAXANIMATES];
// extern int oanimateval[MAXANIMATES]; // extern int oanimateval[MAXANIMATES];
extern short neartagsector, neartagwall, neartagsprite; extern short neartagsector, neartagwall, neartagsprite;

View file

@ -4054,7 +4054,7 @@ void displayrooms(int snum,int smoothratio)
{ {
walock[TILE_SAVESHOT] = 199; walock[TILE_SAVESHOT] = 199;
if (waloff[TILE_SAVESHOT] == 0) if (waloff[TILE_SAVESHOT] == 0)
allocache((int *)&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]); allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]);
setviewtotile(TILE_SAVESHOT,200L,320L); setviewtotile(TILE_SAVESHOT,200L,320L);
} }
else if (getrendermode() == 0 && ((ud.screen_tilting && p->rotscrnang) || ud.detail==0)) else if (getrendermode() == 0 && ((ud.screen_tilting && p->rotscrnang) || ud.detail==0))

View file

@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "compat.h"
#define TICSPERFRAME 3 #define TICSPERFRAME 3
// #define VULGARITY // #define VULGARITY
@ -139,7 +141,8 @@ extern char custom2dcolors;
extern char mlook; extern char mlook;
int intro=0; int intro=0;
extern int frameplace, ydim16, halfxdim16, midydim16, zoom; extern int ydim16, halfxdim16, midydim16, zoom;
extern intptr_t frameplace;
extern char pow2char[8]; extern char pow2char[8];
static int acurpalette=0; static int acurpalette=0;

View file

@ -576,7 +576,7 @@ int saveplayer(int spot)
if (!waloff[TILE_SAVESHOT]) if (!waloff[TILE_SAVESHOT])
{ {
walock[TILE_SAVESHOT] = 254; walock[TILE_SAVESHOT] = 254;
allocache((int *)&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]); allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]);
clearbuf((void*)waloff[TILE_SAVESHOT],(200*320)/4,0); clearbuf((void*)waloff[TILE_SAVESHOT],(200*320)/4,0);
walock[TILE_SAVESHOT] = 1; walock[TILE_SAVESHOT] = 1;
} }