ref: 6a1e6c5279b0978dd20a35921097b1874747ab0b
parent: e11ebae69dc3485eab5921e3b04829e99466cb8a
author: fabien sanglard <[email protected]>
date: Sat Dec 22 11:55:35 EST 2012
Created a tile module.
--- a/Engine/src/build.h
+++ b/Engine/src/build.h
@@ -16,8 +16,8 @@
#define MAXSECTORS 1024
#define MAXWALLS 8192
#define MAXSPRITES 4096
-
#define MAXTILES 9216
+
#define MAXSTATUS 1024
#define MAXPLAYERS 16
#define MAXXDIM 1600
@@ -177,22 +177,8 @@
EXTERN short prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
-// The dimension of the tile in texels unit. The sizes can be obtained for
-// any tile by doing a tilesizx * tilesizy
-//EXTERN short tilesizx[MAXTILES], tilesizy[MAXTILES];
-typedef struct dimensions_s{
- short width;
- short height;
-} dimensions_t;
-dimensions_t tilesDimension[MAXTILES];
-// An array of locks for each pic: Used to check if a texture is in RAM or in the GRP.
-EXTERN uint8_t walock[MAXTILES];
-EXTERN int32_t numtiles, picanm[MAXTILES];
-//The wall texture data.
-EXTERN uint8_t* waloff[MAXTILES];
-
/*
* These variables are for auto-mapping with the draw2dscreen function.
* When you load a new board, these bits are all set to 0 - since
@@ -213,8 +199,7 @@
EXTERN uint8_t show2dsprite[(MAXSPRITES+7)>>3];
EXTERN uint8_t automapping;
-//Bitvector marking picture used for rendition.
-EXTERN uint8_t gotpic[(MAXTILES+7)>>3];
+
//This is the bit vector that marks visited sector during portal flooding. Size is hence (MAXSECTORS / 8)
EXTERN uint8_t visitedSectors[(MAXSECTORS+7)>>3];
--- a/Engine/src/cache.c
+++ b/Engine/src/cache.c
@@ -16,7 +16,7 @@
#include "platform.h"
#include "display.h"
-#include "pragmas.h"
+#include "fixedPoint_math.h"
#include "cache.h"
#include "build.h"
--- a/Engine/src/display.c
+++ b/Engine/src/display.c
@@ -39,7 +39,7 @@
#include "SDL.h"
#include "build.h"
#include "display.h"
-#include "pragmas.h"
+#include "fixedPoint_math.h"
#include "engine.h"
//#include "engine_protos.h"
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -19,9 +19,6 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
-
-#include "pragmas.h"
-
#include "platform.h"
#if !PLATFORM_MACOSX
@@ -31,6 +28,7 @@
#include "build.h"
#include "engine.h"
+#include "tiles.h"
int32_t stereowidth = 23040, stereopixelwidth = 28, ostereopixelwidth = -1;
int32_t stereomode = 0, visualpage, activepage, whiteband, blackband;
@@ -71,8 +69,8 @@
* !!! can be made static again. --ryan.
*/
uint8_t permanentlock = 255;
-int32_t artversion, mapversion;
-uint8_t *pic = NULL;
+int32_t mapversion;
+
uint8_t picsiz[MAXTILES], tilefilenum[MAXTILES];
int32_t lastageclock;
int32_t tilefileoffs[MAXTILES];
@@ -178,7 +176,7 @@
//FCS: (down-most pixel +1 on column x that can still be drawn to)
short dmost[MAXXDIM+1];
-static int16_t bakumost[MAXXDIM+1], bakdmost[MAXXDIM+1];
+int16_t bakumost[MAXXDIM+1], bakdmost[MAXXDIM+1];
short uplc[MAXXDIM+1], dplc[MAXXDIM+1];
static int16_t uwall[MAXXDIM+1], dwall[MAXXDIM+1];
static int32_t swplc[MAXXDIM+1], lplc[MAXXDIM+1];
@@ -277,8 +275,7 @@
int32_t searchx = -1, searchy; /* search input */
short searchsector, searchwall, searchstat; /* search output */
-static char artfilename[20];
-static int32_t numtilefiles, artfil = -1, artfilnum, artfilplc;
+int32_t numtilefiles, artfil = -1, artfilnum, artfilplc;
static uint8_t inpreparemirror = 0;
static int32_t mirrorsx1, mirrorsy1, mirrorsx2, mirrorsy2;
@@ -314,15 +311,6 @@
return((reciptable[(i>>12)&2047]>>(((i-0x3f800000)>>23)&31))^(i>>31));
}
-//1. Lock a picture in the cache system.
-//2. Mark it as used in the bitvector tracker.
-static __inline void setgotpic(int32_t tilenume)
-{
- if (walock[tilenume] < 200)
- walock[tilenume] = 199;
-
- gotpic[tilenume>>3] |= pow2char[tilenume&7];
-}
static __inline int32_t getclipmask(int32_t a, int32_t b, int32_t c, int32_t d)
@@ -719,38 +707,7 @@
}
-/*
- FCS: If a texture is animated, this will return the offset to add to tilenum
- in order to retrieve the texture to display.
-*/
-static int animateoffs(int16_t tilenum)
-{
- int32_t i, k, offs;
- offs = 0;
-
- i = (totalclocklock>>((picanm[tilenum]>>24)&15));
-
- if ((picanm[tilenum]&63) > 0){
- switch(picanm[tilenum]&192)
- {
- case 64:
- k = (i%((picanm[tilenum]&63)<<1));
- if (k < (picanm[tilenum]&63))
- offs = k;
- else
- offs = (((picanm[tilenum]&63)<<1)-k);
- break;
- case 128:
- offs = (i%((picanm[tilenum]&63)+1));
- break;
- case 192:
- offs = -(i%((picanm[tilenum]&63)+1));
- }
- }
-
- return(offs);
-}
/* renders non-parallaxed ceilings. --ryan. */
@@ -780,17 +737,17 @@
setgotpic(globalpicnum);
//Check the tile dimension are valid.
- if ((tilesDimension[globalpicnum].width <= 0) ||
- (tilesDimension[globalpicnum].height <= 0))
+ if ((tiles[globalpicnum].dim.width <= 0) ||
+ (tiles[globalpicnum].dim.height <= 0))
return;
- if (picanm[globalpicnum]&192)
+ if (tiles[globalpicnum].animFlags&192)
globalpicnum += animateoffs(globalpicnum);
- if (waloff[globalpicnum] == 0)
+ if (tiles[globalpicnum].data == NULL)
loadtile(globalpicnum);
- globalbufplc = waloff[globalpicnum];
+ globalbufplc = tiles[globalpicnum].data;
globalshade = (int32_t)sec->ceilingshade;
globvis = globalcisibility;
@@ -1017,20 +974,20 @@
//This tile has unvalid dimensions ( negative)
- if ((tilesDimension[globalpicnum].width <= 0) ||
- (tilesDimension[globalpicnum].height <= 0))
+ if ((tiles[globalpicnum].dim.width <= 0) ||
+ (tiles[globalpicnum].dim.height <= 0))
return;
//If this is an animated texture: Animate it.
- if (picanm[globalpicnum]&192)
+ if (tiles[globalpicnum].animFlags&192)
globalpicnum += animateoffs(globalpicnum);
//If the texture is not in RAM: Load it !!
- if (waloff[globalpicnum] == 0)
+ if (tiles[globalpicnum].data == NULL)
loadtile(globalpicnum);
//Check where is the texture in RAM
- globalbufplc = waloff[globalpicnum];
+ globalbufplc = tiles[globalpicnum].data;
//Retrieve the shade of the sector (illumination level).
globalshade = (int32_t)sec->floorshade;
@@ -1280,8 +1237,8 @@
int32_t y1ve[4], y2ve[4], u4, d4, z, tileWidth, tsizy;
uint8_t bad;
- tileWidth = tilesDimension[globalpicnum].width;
- tsizy = tilesDimension[globalpicnum].height;
+ tileWidth = tiles[globalpicnum].dim.width;
+ tsizy = tiles[globalpicnum].dim.height;
setgotpic(globalpicnum);
@@ -1294,7 +1251,7 @@
if ((dwal[x1] < 0) && (dwal[x2] < 0))
return;
- if (waloff[globalpicnum] == 0)
+ if (tiles[globalpicnum].data == NULL)
loadtile(globalpicnum);
xnice = (pow2long[picsiz[globalpicnum]&15] == tileWidth);
@@ -1341,7 +1298,7 @@
vince[0] = swal[x]*globalyscale;
vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1);
- vlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],x+frameoffset+ylookup[y1ve[0]]);
+ vlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+tiles[globalpicnum].data,x+frameoffset+ylookup[y1ve[0]]);
}
for(; x<=x2-3; x+=4)
@@ -1367,7 +1324,7 @@
i *= tsizy;
else
i <<= tsizy;
- bufplce[z] = waloff[globalpicnum]+i;
+ bufplce[z] = tiles[globalpicnum].data+i;
vince[z] = swal[x+z]*globalyscale;
vplce[z] = globalzd + vince[z]*(y1ve[z]-globalhoriz+1);
@@ -1453,7 +1410,7 @@
vince[0] = swal[x]*globalyscale;
vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1);
- vlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],x+frameoffset+ylookup[y1ve[0]]);
+ vlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+tiles[globalpicnum].data,x+frameoffset+ylookup[y1ve[0]]);
}
faketimerhandler();
}
@@ -1470,8 +1427,8 @@
uint8_t* p;
uint8_t bad;
- tileWidth = tilesDimension[globalpicnum].width;
- tileHeight = tilesDimension[globalpicnum].height;
+ tileWidth = tiles[globalpicnum].dim.width;
+ tileHeight = tiles[globalpicnum].dim.height;
setgotpic(globalpicnum);
if ((tileWidth <= 0) || (tileHeight <= 0))
@@ -1481,7 +1438,7 @@
if ((dwal[x1] < 0) && (dwal[x2] < 0))
return;
- if (waloff[globalpicnum] == 0)
+ if (tiles[globalpicnum].data == NULL)
loadtile(globalpicnum);
startx = x1;
@@ -1524,7 +1481,7 @@
vince[0] = swal[x]*globalyscale;
vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1);
- mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],p+ylookup[y1ve[0]]);
+ mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+tiles[globalpicnum].data,p+ylookup[y1ve[0]]);
}
for(; x<=x2-3; x+=4,p+=4)
{
@@ -1549,7 +1506,7 @@
else
i <<= tileHeight;
- bufplce[z] = waloff[globalpicnum]+i;
+ bufplce[z] = tiles[globalpicnum].data+i;
vince[z] = swal[dax]*globalyscale;
vplce[z] = globalzd + vince[z]*(y1ve[z]-globalhoriz+1);
@@ -1616,7 +1573,7 @@
vince[0] = swal[x]*globalyscale;
vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1);
- mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],p+ylookup[y1ve[0]]);
+ mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+tiles[globalpicnum].data,p+ylookup[y1ve[0]]);
}
faketimerhandler();
}
@@ -1660,12 +1617,16 @@
}
if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
- if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum);
+
+ if (tiles[globalpicnum].animFlags&192)
+ globalpicnum += animateoffs(globalpicnum);
+
globalshiftval = (picsiz[globalpicnum]>>4);
- if (pow2long[globalshiftval] != tilesDimension[globalpicnum].height)
+
+ if (pow2long[globalshiftval] != tiles[globalpicnum].dim.height)
globalshiftval++;
globalshiftval = 32-globalshiftval;
- globalzd = (((tilesDimension[globalpicnum].height>>1)+parallaxyoffs)<<globalshiftval)+(globalypanning<<24);
+ globalzd = (((tiles[globalpicnum].dim.height>>1)+parallaxyoffs)<<globalshiftval)+(globalypanning<<24);
globalyscale = (8<<(globalshiftval-19));
/*if (globalorientation&256) globalyscale = -globalyscale, globalzd = -globalzd;*/
@@ -1800,15 +1761,16 @@
daz = sec->floorz;
}
- if ((picanm[globalpicnum]&192) != 0)
+ if ((tiles[globalpicnum].animFlags&192) != 0)
globalpicnum += animateoffs(globalpicnum);
+
setgotpic(globalpicnum);
- if ((tilesDimension[globalpicnum].width <= 0) ||
- (tilesDimension[globalpicnum].height <= 0))
+ if ((tiles[globalpicnum].dim.width <= 0) ||
+ (tiles[globalpicnum].dim.height <= 0))
return;
- if (waloff[globalpicnum] == 0)
+ if (tiles[globalpicnum].data == NULL)
loadtile(globalpicnum);
wal = &wall[sec->wallptr];
@@ -1909,7 +1871,7 @@
globvis = mulscale16(globvis,xdimscale);
j =(int32_t) FP_OFF(palookup[globalpal]);
- setupslopevlin(((int32_t)(picsiz[globalpicnum]&15))+(((int32_t)(picsiz[globalpicnum]>>4))<<8),waloff[globalpicnum],-ylookup[1]);
+ setupslopevlin(((int32_t)(picsiz[globalpicnum]&15))+(((int32_t)(picsiz[globalpicnum]>>4))<<8),tiles[globalpicnum].data,-ylookup[1]);
l = (globalzd>>16);
@@ -2360,11 +2322,11 @@
globalxpanning = (int32_t)wal->xpanning;
globalypanning = (int32_t)wal->ypanning;
globalshiftval = (picsiz[globalpicnum]>>4);
- if (pow2long[globalshiftval] != tilesDimension[globalpicnum].height) globalshiftval++;
+ if (pow2long[globalshiftval] != tiles[globalpicnum].dim.height) globalshiftval++;
globalshiftval = 32-globalshiftval;
//Animated
- if (picanm[globalpicnum]&192)
+ if (tiles[globalpicnum].animFlags&192)
globalpicnum += animateoffs(globalpicnum);
globalshade = (int32_t)wal->shade;
@@ -2449,7 +2411,10 @@
if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
globalxpanning = (int32_t)wal->xpanning;
globalypanning = (int32_t)wal->ypanning;
- if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum);
+
+ if (tiles[globalpicnum].animFlags&192)
+ globalpicnum += animateoffs(globalpicnum);
+
globalshade = (int32_t)wal->shade;
globalpal = (int32_t)wal->pal;
wallnum = thewall[z];
@@ -2458,10 +2423,15 @@
else{
globalorientation = (int32_t)wal->cstat;
globalpicnum = wal->picnum;
- if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
+
+ if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES)
+ globalpicnum = 0;
+
globalxpanning = (int32_t)wal->xpanning;
globalypanning = (int32_t)wal->ypanning;
- if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum);
+
+ if (tiles[globalpicnum].animFlags&192)
+ globalpicnum += animateoffs(globalpicnum);
globalshade = (int32_t)wal->shade;
globalpal = (int32_t)wal->pal;
}
@@ -2470,7 +2440,7 @@
globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
globalshiftval = (picsiz[globalpicnum]>>4);
- if (pow2long[globalshiftval] != tilesDimension[globalpicnum].height)
+ if (pow2long[globalshiftval] != tiles[globalpicnum].dim.height)
globalshiftval++;
globalshiftval = 32-globalshiftval;
@@ -2564,7 +2534,7 @@
globalxpanning = (int32_t)wal->xpanning;
globalypanning = (int32_t)wal->ypanning;
- if (picanm[globalpicnum]&192)
+ if (tiles[globalpicnum].animFlags&192)
globalpicnum += animateoffs(globalpicnum);
globalshade = (int32_t)wal->shade;
@@ -2574,7 +2544,7 @@
globalpal = (int32_t)wal->pal;
globalshiftval = (picsiz[globalpicnum]>>4);
- if (pow2long[globalshiftval] != tilesDimension[globalpicnum].height)
+ if (pow2long[globalshiftval] != tiles[globalpicnum].dim.height)
globalshiftval++;
globalshiftval = 32-globalshiftval;
@@ -3100,10 +3070,10 @@
i = lwall[x]+globalxpanning;
- if (i >= tilesDimension[globalpicnum].width)
- i %= tilesDimension[globalpicnum].width;
+ if (i >= tiles[globalpicnum].dim.width)
+ i %= tiles[globalpicnum].dim.width;
- bufplc = waloff[globalpicnum]+i*tilesDimension[globalpicnum].height;
+ bufplc = tiles[globalpicnum].data+i*tiles[globalpicnum].dim.height;
p = ylookup[y1v]+x+frameoffset;
@@ -3149,14 +3119,14 @@
vplce[1] = globalzd + vince[1]*(y1ve[1]-globalhoriz+1);
i = lwall[x] + globalxpanning;
- if (i >= tilesDimension[globalpicnum].width)
- i %= tilesDimension[globalpicnum].width;
- bufplce[0] = waloff[globalpicnum]+i*tilesDimension[globalpicnum].height;
+ if (i >= tiles[globalpicnum].dim.width)
+ i %= tiles[globalpicnum].dim.width;
+ bufplce[0] = tiles[globalpicnum].data+i*tiles[globalpicnum].dim.height;
i = lwall[x2] + globalxpanning;
- if (i >= tilesDimension[globalpicnum].width)
- i %= tilesDimension[globalpicnum].width;
- bufplce[1] = waloff[globalpicnum]+i*tilesDimension[globalpicnum].height;
+ if (i >= tiles[globalpicnum].dim.width)
+ i %= tiles[globalpicnum].dim.width;
+ bufplce[1] = tiles[globalpicnum].data+i*tiles[globalpicnum].dim.height;
y1 = max(y1ve[0],y1ve[1]);
@@ -3200,11 +3170,11 @@
setgotpic(globalpicnum);
//Tile dimensions are invalid
- if ((tilesDimension[globalpicnum].width <= 0) ||
- (tilesDimension[globalpicnum].height <= 0))
+ if ((tiles[globalpicnum].dim.width <= 0) ||
+ (tiles[globalpicnum].dim.height <= 0))
return;
- if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
+ if (tiles[globalpicnum].data == NULL) loadtile(globalpicnum);
x = x1;
while ((startumost[x+windowx1] > startdmost[x+windowx1]) && (x <= x2)) x++;
@@ -3679,7 +3649,8 @@
for(i=0; i<MAXPALOOKUPS; i++)
palookup[i] = NULL;
- clearbuf(&waloff[0],MAXTILES,0L);
+ for(i=0 ; i < MAXTILES ; i++)
+ tiles[i].data = NULL;
clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L);
@@ -3792,8 +3763,8 @@
short tileWidht, tileHeight;
- tileWidht = tilesDimension[picnum].width;
- tileHeight = tilesDimension[picnum].height;
+ tileWidht = tiles[picnum].dim.width;
+ tileHeight = tiles[picnum].dim.height;
if (dastat&16) {
xoff = 0;
@@ -3800,8 +3771,8 @@
yoff = 0;
}
else{
- xoff = (int32_t)((int8_t )((picanm[picnum]>>8)&255))+(tileWidht>>1);
- yoff = (int32_t)((int8_t )((picanm[picnum]>>16)&255))+(tileHeight>>1);
+ xoff = (int32_t)((int8_t )((tiles[picnum].animFlags>>8)&255))+(tileWidht>>1);
+ yoff = (int32_t)((int8_t )((tiles[picnum].animFlags>>16)&255))+(tileHeight>>1);
}
if (dastat&4)
@@ -3901,9 +3872,11 @@
nextv = v;
}
- if (waloff[picnum] == 0) loadtile(picnum);
+ if (tiles[picnum].data == NULL)
+ loadtile(picnum);
+
setgotpic(picnum);
- bufplc = waloff[picnum];
+ bufplc = tiles[picnum].data;
palookupoffs = palookup[dapalnum] + (getpalookup(0L,(int32_t)dashade)<<8);
@@ -4324,180 +4297,7 @@
}
-void loadtile(short tilenume)
-{
- uint8_t *ptr;
- int32_t i, tileFilesize;
- if ((uint32_t)tilenume >= (uint32_t)MAXTILES)
- return;
-
- tileFilesize = tilesDimension[tilenume].width * tilesDimension[tilenume].height;
-
- if (tileFilesize <= 0)
- return;
-
- i = tilefilenum[tilenume];
- if (i != artfilnum){
- if (artfil != -1)
- kclose(artfil);
- artfilnum = i;
- artfilplc = 0L;
-
- artfilename[7] = (i%10)+48;
- artfilename[6] = ((i/10)%10)+48;
- artfilename[5] = ((i/100)%10)+48;
- artfil = TCkopen4load(artfilename,0);
- faketimerhandler();
- }
-
- if (waloff[tilenume] == 0){
- walock[tilenume] = 199;
- allocache(&waloff[tilenume],tileFilesize,(uint8_t *) &walock[tilenume]);
- }
-
- if (artfilplc != tilefileoffs[tilenume])
- {
- klseek(artfil,tilefileoffs[tilenume]-artfilplc,SEEK_CUR);
- faketimerhandler();
- }
- ptr = waloff[tilenume];
- kread(artfil,ptr,tileFilesize);
- faketimerhandler();
- artfilplc = tilefileoffs[tilenume]+tileFilesize;
-}
-
-
-uint8_t* allocatepermanenttile(short tilenume, int32_t width, int32_t height)
-{
- int32_t j;
- uint32_t tileDataSize;
-
- //Check dimensions are correct.
- if ((width <= 0) || (height <= 0) || ((uint32_t)tilenume >= (uint32_t)MAXTILES))
- return(0);
-
- tileDataSize = width * height;
-
- walock[tilenume] = 255;
- allocache(&waloff[tilenume],tileDataSize,(uint8_t *) &walock[tilenume]);
-
- tilesDimension[tilenume].width = width;
- tilesDimension[tilenume].height = height;
- picanm[tilenume] = 0;
-
- j = 15;
- while ((j > 1) && (pow2long[j] > width))
- j--;
- picsiz[tilenume] = ((uint8_t )j);
-
- j = 15;
- while ((j > 1) && (pow2long[j] > height))
- j--;
- picsiz[tilenume] += ((uint8_t )(j<<4));
-
- return(waloff[tilenume]);
-}
-
-
-int loadpics(char *filename, char * gamedir)
-
-{
- int32_t offscount, localtilestart, localtileend, dasiz;
- short fil, i, j, k;
- //uint8_t fullpathartfilename[512];
-
- strcpy(artfilename,filename);
-
- for(i=0; i<MAXTILES; i++)
- {
- tilesDimension[i].width = 0;
- tilesDimension[i].height = 0;
- picanm[i] = 0L;
- }
-
- artsize = 0L;
-
- numtilefiles = 0;
- do
- {
- k = numtilefiles;
-
- artfilename[7] = (k%10)+48;
- artfilename[6] = ((k/10)%10)+48;
- artfilename[5] = ((k/100)%10)+48;
-
-
-
- if ((fil = TCkopen4load(artfilename,0)) != -1)
- {
- kread32(fil,&artversion);
- if (artversion != 1) return(-1);
-
- kread32(fil,&numtiles);
- kread32(fil,&localtilestart);
- kread32(fil,&localtileend);
-
- /*kread(fil,&tilesizx[localtilestart],(localtileend-localtilestart+1)<<1);*/
- for (i = localtilestart; i <= localtileend; i++)
- kread16(fil,&tilesDimension[i].width);
-
- /*kread(fil,&tilesizy[localtilestart],(localtileend-localtilestart+1)<<1);*/
- for (i = localtilestart; i <= localtileend; i++)
- kread16(fil,&tilesDimension[i].height);
-
- /*kread(fil,&picanm[localtilestart],(localtileend-localtilestart+1)<<2);*/
- for (i = localtilestart; i <= localtileend; i++)
- kread32(fil,&picanm[i]);
-
- offscount = 4+4+4+4+((localtileend-localtilestart+1)<<3);
- for(i=localtilestart; i<=localtileend; i++)
- {
- tilefilenum[i] = k;
- tilefileoffs[i] = offscount;
- dasiz = tilesDimension[i].width*tilesDimension[i].height;
- offscount += dasiz;
- artsize += ((dasiz+15)&0xfffffff0);
- }
- kclose(fil);
-
- numtilefiles++;
-
- }
- }
- while (k != numtilefiles);
- printf("Art files loaded\n");
- clearbuf(&gotpic[0],(int32_t)((MAXTILES+31)>>5),0L);
-
- /* try dpmi_DETERMINEMAXREALALLOC! */
-
- cachesize = max(artsize,1048576);
- while ((pic = (uint8_t *)kkmalloc(cachesize)) == NULL)
- {
- cachesize -= 65536L;
- if (cachesize < 65536) return(-1);
- }
- initcache(((int32_t)FP_OFF(pic)+15)&0xfffffff0,(cachesize-((-(int32_t)FP_OFF(pic))&15))&0xfffffff0);
-
- for(i=0; i<MAXTILES; i++)
- {
- j = 15;
- while ((j > 1) && (pow2long[j] > tilesDimension[i].width)) j--;
- picsiz[i] = ((uint8_t )j);
- j = 15;
- while ((j > 1) && (pow2long[j] > tilesDimension[i].height)) j--;
- picsiz[i] += ((uint8_t )(j<<4));
- }
-
- artfil = -1;
- artfilnum = -1;
- artfilplc = 0L;
-
- return(0);
-}
-
-
-
int clipinsidebox(int32_t x, int32_t y, short wallnum, int32_t walldist)
{
walltype *wal;
@@ -4742,49 +4542,9 @@
}
-void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz,
- int32_t tilenume2, int32_t sx2, int32_t sy2)
-{
- uint8_t *ptr1, *ptr2, dat;
- int32_t xsiz1, ysiz1, xsiz2, ysiz2, i, j, x1, y1, x2, y2;
- xsiz1 = tilesDimension[tilenume1].width;
- ysiz1 = tilesDimension[tilenume1].height;
- xsiz2 = tilesDimension[tilenume2].width;
- ysiz2 = tilesDimension[tilenume2].height;
-
- if ((xsiz1 > 0) && (ysiz1 > 0) && (xsiz2 > 0) && (ysiz2 > 0))
- {
- if (waloff[tilenume1] == 0) loadtile((short) tilenume1);
- if (waloff[tilenume2] == 0) loadtile((short) tilenume2);
- x1 = sx1;
- for(i=0; i<xsiz; i++)
- {
- y1 = sy1;
- for(j=0; j<ysiz; j++)
- {
- x2 = sx2+i;
- y2 = sy2+j;
- if ((x2 >= 0) && (y2 >= 0) && (x2 < xsiz2) && (y2 < ysiz2))
- {
- ptr1 = (uint8_t *) (waloff[tilenume1] + x1*ysiz1 + y1);
- ptr2 = (uint8_t *) (waloff[tilenume2] + x2*ysiz2 + y2);
- dat = *ptr1;
- if (dat != 255)
- *ptr2 = *ptr1;
- }
- y1++;
- if (y1 >= ysiz1) y1 = 0;
- }
- x1++;
- if (x1 >= xsiz1) x1 = 0;
- }
- }
-}
-
-
static void drawmaskwall(short damaskwallcnt)
{
int32_t i, j, k, x, z, sectnum, z1, z2, lx, rx;
@@ -4817,8 +4577,10 @@
globalpicnum = 0;
globalxpanning = (int32_t)wal->xpanning;
globalypanning = (int32_t)wal->ypanning;
- if (picanm[globalpicnum]&192)
+
+ if (tiles[globalpicnum].animFlags&192)
globalpicnum += animateoffs(globalpicnum);
+
globalshade = (int32_t)wal->shade;
globvis = globalvisibility;
if (sec->visibility != 0)
@@ -4825,7 +4587,7 @@
globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
globalpal = (int32_t)wal->pal;
globalshiftval = (picsiz[globalpicnum]>>4);
- if (pow2long[globalshiftval] != tilesDimension[globalpicnum].height)
+ if (pow2long[globalshiftval] != tiles[globalpicnum].dim.height)
globalshiftval++;
globalshiftval = 32-globalshiftval;
@@ -4894,6 +4656,9 @@
}
+
+
+
static void ceilspritehline (int32_t x2, int32_t y)
{
int32_t x1, v, bx, by;
@@ -4987,10 +4752,10 @@
if ((cstat&48) != 48)
{
- if (picanm[tilenum]&192)
+ if (tiles[tilenum].animFlags&192)
tilenum += animateoffs(tilenum);
- if ((tilesDimension[tilenum].width <= 0) || (tilesDimension[tilenum].height <= 0) || (spritenum < 0))
+ if ((tiles[tilenum].dim.width <= 0) || (tiles[tilenum].dim.height <= 0) || (spritenum < 0))
return;
}
if ((tspr->xrepeat <= 0) || (tspr->yrepeat <= 0)) return;
@@ -5011,8 +4776,8 @@
settrans(TRANS_NORMAL);
}
- 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);
+ xoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>8)&255))+((int32_t)tspr->xoffset);
+ yoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>16)&255))+((int32_t)tspr->yoffset);
if ((cstat&48) == 0)
{
@@ -5023,13 +4788,13 @@
xv = mulscale16(((int32_t)tspr->xrepeat)<<16,xyaspect);
- spriteDim.width = tilesDimension[tilenum].width;
- spriteDim.height = tilesDimension[tilenum].height;
+ spriteDim.width = tiles[tilenum].dim.width;
+ spriteDim.height = tiles[tilenum].dim.height;
xsiz = mulscale30(siz,xv * spriteDim.width);
ysiz = mulscale14(siz,tspr->yrepeat * spriteDim.height);
- if (((tilesDimension[tilenum].width>>11) >= xsiz) || (spriteDim.height >= (ysiz>>1)))
+ if (((tiles[tilenum].dim.width>>11) >= xsiz) || (spriteDim.height >= (ysiz>>1)))
return; /* Watch out for divscale overflow */
x1 = xb-(xsiz>>1);
@@ -5179,7 +4944,7 @@
globvis = globalvisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
globalshiftval = (picsiz[globalpicnum]>>4);
- if (pow2long[globalshiftval] != tilesDimension[globalpicnum].height)
+ if (pow2long[globalshiftval] != tiles[globalpicnum].dim.height)
globalshiftval++;
globalshiftval = 32-globalshiftval;
@@ -5204,8 +4969,8 @@
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
- spriteDim.width = tilesDimension[tilenum].width;
- spriteDim.height = tilesDimension[tilenum].height;
+ spriteDim.width = tiles[tilenum].dim.width;
+ spriteDim.height = tiles[tilenum].dim.height;
xv = tspr->xrepeat*sintable[(tspr->ang+2560+1536)&2047];
yv = tspr->xrepeat*sintable[(tspr->ang+2048+1536)&2047];
@@ -5334,7 +5099,7 @@
globvis = globalvisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
globalshiftval = (picsiz[globalpicnum]>>4);
- if (pow2long[globalshiftval] != tilesDimension[globalpicnum].height) globalshiftval++;
+ if (pow2long[globalshiftval] != tiles[globalpicnum].dim.height) globalshiftval++;
globalshiftval = 32-globalshiftval;
globalyscale = divscale(512,tspr->yrepeat,globalshiftval-19);
globalzd = (((globalposz-z1)*globalyscale)<<8);
@@ -5480,8 +5245,8 @@
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
- spriteDim.width = tilesDimension[tilenum].width;
- spriteDim.height = tilesDimension[tilenum].height;
+ spriteDim.width = tiles[tilenum].dim.width;
+ spriteDim.height = tiles[tilenum].dim.height;
/* Rotate center point */
dax = tspr->x-globalposx;
@@ -5790,9 +5555,11 @@
if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES)
globalpicnum = 0;
- if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
+ if (tiles[globalpicnum].data == NULL)
+ loadtile(globalpicnum);
+
setgotpic(globalpicnum);
- globalbufplc = waloff[globalpicnum];
+ globalbufplc = tiles[globalpicnum].data;
globvis = mulscale16(globalhisibility,viewingrange);
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
@@ -5905,9 +5672,9 @@
spritesz[k] = tspriteptr[k]->z;
if ((tspriteptr[k]->cstat&48) != 32)
{
- yoff = (int32_t)((int8_t )((picanm[tspriteptr[k]->picnum]>>16)&255))+((int32_t)tspriteptr[k]->yoffset);
+ yoff = (int32_t)((int8_t )((tiles[tspriteptr[k]->picnum].animFlags>>16)&255))+((int32_t)tspriteptr[k]->yoffset);
spritesz[k] -= ((yoff*tspriteptr[k]->yrepeat)<<2);
- yspan = (tilesDimension[tspriteptr[k]->picnum].height*tspriteptr[k]->yrepeat<<2);
+ yspan = (tiles[tspriteptr[k]->picnum].dim.height*tspriteptr[k]->yrepeat<<2);
if (!(tspriteptr[k]->cstat&128))
spritesz[k] -= (yspan>>1);
if (klabs(spritesz[k]-globalposz) < (yspan>>1))
@@ -6562,9 +6329,14 @@
intz = zs+scale(vz,topt,bot);
- i = (tilesDimension[spr->picnum].height*spr->yrepeat<<2);
- if (cstat&128) z1 += (i>>1);
- if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ i = (tiles[spr->picnum].dim.height*spr->yrepeat<<2);
+
+ if (cstat&128)
+ z1 += (i>>1);
+
+ if (tiles[spr->picnum].animFlags&0x00ff0000)
+ z1 -= ((int32_t)((int8_t )((tiles[spr->picnum].animFlags>>16)&255))*spr->yrepeat<<2);
+
if ((intz > z1) || (intz < z1-i)) continue;
topu = vx*(y1-ys) - vy*(x1-xs);
@@ -6571,7 +6343,7 @@
offx = scale(vx,topu,bot);
offy = scale(vy,topu,bot);
dist = offx*offx + offy*offy;
- i = tilesDimension[spr->picnum].width*spr->xrepeat;
+ i = tiles[spr->picnum].dim.width*spr->xrepeat;
i *= i;
if (dist > (i>>7)) continue;
intx = xs + scale(vx,topt,bot);
@@ -6592,13 +6364,13 @@
* Given: (x1, y1) starts out as the center point
*/
tilenum = spr->picnum;
- xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
+ xoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>8)&255))+((int32_t)spr->xoffset);
if ((cstat&4) > 0) xoff = -xoff;
k = spr->ang;
l = spr->xrepeat;
dax = sintable[k&2047]*l;
day = sintable[(k+1536)&2047]*l;
- l = tilesDimension[tilenum].width;
+ l = tiles[tilenum].dim.width;
k = (l>>1)+xoff;
x1 -= mulscale16(dax,k);
x2 = x1+mulscale16(dax,l);
@@ -6612,14 +6384,14 @@
if (klabs(intx-xs)+klabs(inty-ys) > klabs((*hitx)-xs)+klabs((*hity)-ys)) continue;
- k = ((tilesDimension[spr->picnum].height*spr->yrepeat)<<2);
+ k = ((tiles[spr->picnum].dim.height*spr->yrepeat)<<2);
if (cstat&128)
daz = spr->z+(k>>1);
else
daz = spr->z;
- if (picanm[spr->picnum]&0x00ff0000)
- daz -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ if (tiles[spr->picnum].animFlags&0x00ff0000)
+ daz -= ((int32_t)((int8_t )((tiles[spr->picnum].animFlags>>16)&255))*spr->yrepeat<<2);
if ((intz < daz) && (intz > daz-k))
{
@@ -6644,8 +6416,8 @@
if (klabs(intx-xs)+klabs(inty-ys) > klabs((*hitx)-xs)+klabs((*hity)-ys)) continue;
tilenum = spr->picnum;
- 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);
+ xoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>8)&255))+((int32_t)spr->xoffset);
+ yoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>16)&255))+((int32_t)spr->yoffset);
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
@@ -6652,9 +6424,9 @@
ang = spr->ang;
cosang = sintable[(ang+512)&2047];
sinang = sintable[ang];
- xspan = tilesDimension[tilenum].width;
+ xspan = tiles[tilenum].dim.width;
xrepeat = spr->xrepeat;
- yspan = tilesDimension[tilenum].height;
+ yspan = tiles[tilenum].dim.height;
yrepeat = spr->yrepeat;
dax = ((xspan>>1)+xoff)*xrepeat;
@@ -6810,9 +6582,11 @@
if (bot != 0)
{
intz = zs+scale(vz,topt,bot);
- i = tilesDimension[spr->picnum].height*spr->yrepeat;
- if (spr->cstat&128) z1 += (i<<1);
- if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ i = tiles[spr->picnum].dim.height*spr->yrepeat;
+ if (spr->cstat&128)
+ z1 += (i<<1);
+ if (tiles[spr->picnum].animFlags&0x00ff0000)
+ z1 -= ((int32_t)((int8_t )((tiles[spr->picnum].animFlags>>16)&255))*spr->yrepeat<<2);
if ((intz <= z1) && (intz >= z1-(i<<2)))
{
topu = vx*(y1-ys) - vy*(x1-xs);
@@ -6820,7 +6594,7 @@
offx = scale(vx,topu,bot);
offy = scale(vy,topu,bot);
dist = offx*offx + offy*offy;
- i = (tilesDimension[spr->picnum].width*spr->xrepeat);
+ i = (tiles[spr->picnum].dim.width*spr->xrepeat);
i *= i;
if (dist <= (i>>7))
{
@@ -7124,12 +6898,14 @@
case 0:
if ((x1 >= xmin) && (x1 <= xmax) && (y1 >= ymin) && (y1 <= ymax))
{
- k = ((tilesDimension[spr->picnum].height*spr->yrepeat)<<2);
+ k = ((tiles[spr->picnum].dim.height*spr->yrepeat)<<2);
if (cstat&128) daz = spr->z+(k>>1);
else daz = spr->z;
- 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))
- {
+
+ if (tiles[spr->picnum].animFlags&0x00ff0000)
+ daz -= ((int32_t)((int8_t )((tiles[spr->picnum].animFlags>>16)&255))*spr->yrepeat<<2);
+
+ if (((*z) < daz+ceildist) && ((*z) > daz-k-flordist)){
bsz = (spr->clipdist<<2)+walldist;
if (gx < 0) bsz = -bsz;
addclipline(x1-bsz,y1-bsz,x1-bsz,y1+bsz,(short)j+49152);
@@ -7140,10 +6916,15 @@
}
break;
case 16:
- k = ((tilesDimension[spr->picnum].height*spr->yrepeat)<<2);
- if (cstat&128) daz = spr->z+(k>>1);
- else daz = spr->z;
- if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ k = ((tiles[spr->picnum].dim.height*spr->yrepeat)<<2);
+
+ if (cstat&128)
+ daz = spr->z+(k>>1);
+ else
+ daz = spr->z;
+
+ if (tiles[spr->picnum].animFlags&0x00ff0000)
+ daz -= ((int32_t)((int8_t )((tiles[spr->picnum].animFlags>>16)&255))*spr->yrepeat<<2);
daz2 = daz-k;
daz += ceildist;
daz2 -= flordist;
@@ -7154,13 +6935,13 @@
* Given: (x1, y1) starts out as the center point
*/
tilenum = spr->picnum;
- xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
+ xoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>8)&255))+((int32_t)spr->xoffset);
if ((cstat&4) > 0) xoff = -xoff;
k = spr->ang;
l = spr->xrepeat;
dax = sintable[k&2047]*l;
day = sintable[(k+1536)&2047]*l;
- l = tilesDimension[tilenum].width;
+ l = tiles[tilenum].dim.width;
k = (l>>1)+xoff;
x1 -= mulscale16(dax,k);
x2 = x1+mulscale16(dax,l);
@@ -7202,8 +6983,8 @@
if (((*z) > spr->z) == ((cstat&8)==0)) continue;
tilenum = spr->picnum;
- 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);
+ xoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>8)&255))+((int32_t)spr->xoffset);
+ yoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>16)&255))+((int32_t)spr->yoffset);
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
@@ -7210,9 +6991,9 @@
k = spr->ang;
cosang = sintable[(k+512)&2047];
sinang = sintable[k];
- xspan = tilesDimension[tilenum].width;
+ xspan = tiles[tilenum].dim.width;
xrepeat = spr->xrepeat;
- yspan = tilesDimension[tilenum].height;
+ yspan = tiles[tilenum].dim.height;
yrepeat = spr->yrepeat;
dax = ((xspan>>1)+xoff)*xrepeat;
@@ -7977,10 +7758,10 @@
if ((klabs(x1-x) <= k) && (klabs(y1-y) <= k))
{
daz = spr->z;
- k = ((tilesDimension[spr->picnum].height*spr->yrepeat)<<1);
+ k = ((tiles[spr->picnum].dim.height*spr->yrepeat)<<1);
if (cstat&128)
daz += k;
- if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+ if (tiles[spr->picnum].animFlags&0x00ff0000) daz -= ((int32_t)((int8_t )((tiles[spr->picnum].animFlags>>16)&255))*spr->yrepeat<<2);
daz2 = daz - (k<<1);
clipyou = 1;
}
@@ -7987,13 +7768,13 @@
break;
case 16:
tilenum = spr->picnum;
- xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
+ xoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>8)&255))+((int32_t)spr->xoffset);
if ((cstat&4) > 0) xoff = -xoff;
k = spr->ang;
l = spr->xrepeat;
dax = sintable[k&2047]*l;
day = sintable[(k+1536)&2047]*l;
- l = tilesDimension[tilenum].width;
+ l = tiles[tilenum].dim.width;
k = (l>>1)+xoff;
x1 -= mulscale16(dax,k);
x2 = x1+mulscale16(dax,l);
@@ -8002,10 +7783,13 @@
if (clipinsideboxline(x,y,x1,y1,x2,y2,walldist+1) != 0)
{
daz = spr->z;
- k = ((tilesDimension[spr->picnum].height*spr->yrepeat)<<1);
+ k = ((tiles[spr->picnum].dim.height*spr->yrepeat)<<1);
if (cstat&128)
daz += k;
- if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t )((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
+
+ if (tiles[spr->picnum].animFlags&0x00ff0000)
+ daz -= ((int32_t)((int8_t )((tiles[spr->picnum].animFlags>>16)&255))*spr->yrepeat<<2);
+
daz2 = daz-(k<<1);
clipyou = 1;
}
@@ -8018,8 +7802,8 @@
if ((z > daz) == ((cstat&8)==0)) continue;
tilenum = spr->picnum;
- 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);
+ xoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>8)&255))+((int32_t)spr->xoffset);
+ yoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>16)&255))+((int32_t)spr->yoffset);
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
@@ -8026,9 +7810,9 @@
ang = spr->ang;
cosang = sintable[(ang+512)&2047];
sinang = sintable[ang];
- xspan = tilesDimension[tilenum].width;
+ xspan = tiles[tilenum].dim.width;
xrepeat = spr->xrepeat;
- yspan = tilesDimension[tilenum].height;
+ yspan = tiles[tilenum].dim.height;
yrepeat = spr->yrepeat;
dax = ((xspan>>1)+xoff)*xrepeat;
@@ -8174,11 +7958,11 @@
if (z <= 16)
return;
- if (picanm[picnum]&192)
+ if (tiles[picnum].animFlags&192)
picnum += animateoffs(picnum);
//Does the tile has negative dimensions ?
- if ((tilesDimension[picnum].width <= 0) || (tilesDimension[picnum].height <= 0))
+ if ((tiles[picnum].dim.width <= 0) || (tiles[picnum].dim.height <= 0))
return;
if (((dastat&128) == 0) || (numpages < 2) || (beforedrawrooms != 0))
@@ -8217,10 +8001,10 @@
if (per2->sy != per->sy) continue;
if (per2->z != per->z) continue;
if (per2->a != per->a) continue;
- if (tilesDimension[per2->picnum].width > tilesDimension[per->picnum].width)
+ if (tiles[per2->picnum].dim.width > tiles[per->picnum].dim.width)
continue;
- if (tilesDimension[per2->picnum].height > tilesDimension[per->picnum].height)
+ if (tiles[per2->picnum].dim.height > tiles[per->picnum].dim.height)
continue;
if (per2->cx1 < per->cx1) continue;
if (per2->cy1 < per->cy1) continue;
@@ -8241,9 +8025,9 @@
if (per2->cy2 > per->cy2) continue;
if ((per2->sx>>16) < (per->sx>>16)) continue;
if ((per2->sy>>16) < (per->sy>>16)) continue;
- if ((per2->sx>>16)+tilesDimension[per2->picnum].width > (per->sx>>16)+tilesDimension[per->picnum].width)
+ if ((per2->sx>>16)+tiles[per2->picnum].dim.width > (per->sx>>16)+tiles[per->picnum].dim.width)
continue;
- if ((per2->sy>>16)+tilesDimension[per2->picnum].height > (per->sy>>16)+tilesDimension[per->picnum].height)
+ if ((per2->sy>>16)+tiles[per2->picnum].dim.height > (per->sy>>16)+tiles[per->picnum].dim.height)
continue;
per2->pagesleft = 0;
}
@@ -8852,12 +8636,17 @@
if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
setgotpic(globalpicnum);
- if ((tilesDimension[globalpicnum].width <= 0) ||
- (tilesDimension[globalpicnum].height <= 0)) continue;
+ if ((tiles[globalpicnum].dim.width <= 0) ||
+ (tiles[globalpicnum].dim.height <= 0)) continue;
- if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs(globalpicnum);
- if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
- globalbufplc = waloff[globalpicnum];
+ if ((tiles[globalpicnum].animFlags&192) != 0)
+ globalpicnum += animateoffs(globalpicnum);
+
+ if (tiles[globalpicnum].data == NULL)
+ loadtile(globalpicnum);
+
+ globalbufplc = tiles[globalpicnum].data;
+
globalshade = max(min(sec->floorshade,numpalookups-1),0);
globvis = globalhisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t )(sec->visibility+16)));
@@ -8948,17 +8737,20 @@
npoints = 0;
tilenum = spr->picnum;
- 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;
+ xoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>8)&255))+((int32_t)spr->xoffset);
+ yoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>16)&255))+((int32_t)spr->yoffset);
+
+ if ((spr->cstat&4) > 0)
+ xoff = -xoff;
+ if ((spr->cstat&8) > 0)
+ yoff = -yoff;
k = spr->ang;
cosang = sintable[(k+512)&2047];
sinang = sintable[k];
- xspan = tilesDimension[tilenum].width;
+ xspan = tiles[tilenum].dim.width;
xrepeat = spr->xrepeat;
- yspan = tilesDimension[tilenum].height;
+ yspan = tiles[tilenum].dim.height;
yrepeat = spr->yrepeat;
ox = ((xspan>>1)+xoff)*xrepeat;
@@ -9028,13 +8820,17 @@
globalpicnum = 0;
setgotpic(globalpicnum);
- if ((tilesDimension[globalpicnum].width <= 0) ||
- (tilesDimension[globalpicnum].height <= 0))
+ if ((tiles[globalpicnum].dim.width <= 0) ||
+ (tiles[globalpicnum].dim.height <= 0))
continue;
- if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs(globalpicnum);
- if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
- globalbufplc = waloff[globalpicnum];
+ if ((tiles[globalpicnum].animFlags&192) != 0)
+ globalpicnum += animateoffs(globalpicnum);
+
+ if (tiles[globalpicnum].data == NULL)
+ loadtile(globalpicnum);
+
+ globalbufplc = tiles[globalpicnum].data;
if ((sector[spr->sectnum].ceilingstat&1) > 0)
globalshade = ((int32_t)sector[spr->sectnum].ceilingshade);
else
@@ -9152,46 +8948,12 @@
}
/* MUST USE RESTOREFORDRAWROOMS AFTER DRAWING */
-static int32_t setviewcnt = 0;
-static int32_t bakvidoption[4];
-static int32_t bakframeplace[4], bakxsiz[4], bakysiz[4];
-static int32_t bakwindowx1[4], bakwindowy1[4];
-static int32_t bakwindowx2[4], bakwindowy2[4];
+int32_t setviewcnt = 0;
+int32_t bakvidoption[4];
+int32_t bakframeplace[4], bakxsiz[4], bakysiz[4];
+int32_t bakwindowx1[4], bakwindowy1[4];
+int32_t bakwindowx2[4], bakwindowy2[4];
-/*
-
- */
-void setviewtotile(short tilenume, int32_t tileWidth, int32_t tileHeight)
-{
- int32_t i, j;
-
- /* DRAWROOMS TO TILE BACKUP&SET CODE */
- tilesDimension[tilenume].width = tileWidth;
- tilesDimension[tilenume].height = tileHeight;
- bakxsiz[setviewcnt] = tileWidth;
- bakysiz[setviewcnt] = tileHeight;
- bakvidoption[setviewcnt] = vidoption;
- vidoption = 2;
- bakframeplace[setviewcnt] = frameplace;
- frameplace = waloff[tilenume];
- bakwindowx1[setviewcnt] = windowx1;
- bakwindowy1[setviewcnt] = windowy1;
- bakwindowx2[setviewcnt] = windowx2;
- bakwindowy2[setviewcnt] = windowy2;
- copybufbyte(&startumost[windowx1],&bakumost[windowx1],(windowx2-windowx1+1)*sizeof(bakumost[0]));
- copybufbyte(&startdmost[windowx1],&bakdmost[windowx1],(windowx2-windowx1+1)*sizeof(bakdmost[0]));
- setview(0,0,tileHeight-1,tileWidth-1);
- setaspect(65536,65536);
- j = 0;
- for(i=0; i<=tileWidth; i++) {
- ylookup[i] = j;
- j += tileWidth;
- }
- setBytesPerLine(tileHeight);
- setviewcnt++;
-}
-
-
void setviewback(void)
{
int32_t i, j, k;
@@ -9215,38 +8977,7 @@
}
-void squarerotatetile(short tilenume)
-{
- int32_t i, j, k;
- uint8_t *ptr1, *ptr2;
- dimensions_t tileDim;
-
- tileDim.width = tilesDimension[tilenume].width;
- tileDim.height = tilesDimension[tilenume].height;
-
- /* supports square tiles only for rotation part */
- if (tileDim.width == tileDim.height)
- {
- k = (tileDim.width<<1);
- for(i=tileDim.width-1; i>=0; i--)
- {
- ptr1 = (uint8_t *) (waloff[tilenume]+i*(tileDim.width+1));
- ptr2 = ptr1;
- if ((i&1) != 0) {
- ptr1--;
- ptr2 -= tileDim.width;
- swapchar(ptr1,ptr2);
- }
- for(j=(i>>1)-1; j>=0; j--)
- {
- ptr1 -= 2;
- ptr2 -= k;
- swapchar2(ptr1,ptr2,tileDim.width);
- }
- }
- }
-}
void preparemirror(int32_t dax, int32_t day, int32_t daz,
--- a/Engine/src/engine.h
+++ b/Engine/src/engine.h
@@ -135,6 +135,8 @@
#include "cache.h"
#include "filesystem.h"
#include "display.h"
+#include "fixedPoint_math.h"
+#include "tiles.h"
#ifdef __cplusplus
}
--- a/Engine/src/filesystem.c
+++ b/Engine/src/filesystem.c
@@ -10,7 +10,7 @@
#include "platform.h"
#include "cache.h"
-#include "pragmas.h"
+#include "fixedPoint_math.h"
#include "../../Game/src/global.h"
char game_dir[512];
--- /dev/null
+++ b/Engine/src/fixedPoint_math.c
@@ -1,0 +1,54 @@
+// converted from asm to c by Jonof
+
+#include <stdio.h>
+#include "platform.h"
+#include "fixedPoint_math.h"
+
+void clearbuf(void *d, int32_t c, int32_t a)
+{
+ int32_t *p = (int32_t*)d;
+ while ((c--) > 0) *(p++) = a;
+}
+
+void clearbufbyte(void *D, int32_t c, int32_t a)
+{ // Cringe City
+ uint8_t *p = (uint8_t *)D;
+ int32_t m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l };
+ int32_t n[4] = { 0,8,16,24 };
+ int32_t z=0;
+ while ((c--) > 0) {
+ *(p++) = (uint8_t )((a & m[z])>>n[z]);
+ z=(z+1)&3;
+ }
+}
+
+void copybuf(void *s, void *d, int32_t c)
+{
+ int32_t *p = (int32_t*)s, *q = (int32_t*)d;
+ while ((c--) > 0) *(q++) = *(p++);
+}
+
+void copybufbyte(void *S, void *D, int32_t c)
+{
+ uint8_t *p = (uint8_t *)S, *q = (uint8_t *)D;
+ while((c--) > 0) *(q++) = *(p++);
+}
+
+void copybufreverse(void *S, void *D, int32_t c)
+{
+ uint8_t *p = (uint8_t *)S, *q = (uint8_t *)D;
+ while((c--) > 0) *(q++) = *(p--);
+}
+
+void qinterpolatedown16(int32_t* bufptr, int32_t num, int32_t val, int32_t add)
+{ // gee, I wonder who could have provided this...
+ int32_t i, *lptr = bufptr;
+ for(i=0;i<num;i++) { lptr[i] = (val>>16); val += add; }
+}
+
+void qinterpolatedown16short(int32_t* bufptr, int32_t num, int32_t val, int32_t add)
+{ // ...maybe the same person who provided this too?
+ int32_t i; short *sptr = (short *)bufptr;
+ for(i=0;i<num;i++) { sptr[i] = (short)(val>>16); val += add; }
+}
+
--- /dev/null
+++ b/Engine/src/fixedPoint_math.h
@@ -1,0 +1,167 @@
+/*
+ * "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
+ * Ken Silverman's official web site: "http://www.advsys.net/ken"
+ * See the included license file "BUILDLIC.TXT" for license info.
+ * This file has been modified from Ken Silverman's original release
+ */
+
+#ifndef __PRAGMAS_H__
+#define __PRAGMAS_H__
+
+#include "platform.h"
+
+static __inline void swapchar(uint8_t *p1, uint8_t *p2)
+{ uint8_t tmp = *p1; *p1 = *p2; *p2 = tmp; }
+static __inline void swapshort(short *p1, short *p2)
+{ short tmp = *p1; *p1 = *p2; *p2 = tmp; }
+static __inline void swaplong(int32_t *p1, int32_t *p2)
+{ int32_t tmp = *p1; *p1 = *p2; *p2 = tmp; }
+static __inline void swapchar2(uint8_t *p1, uint8_t *p2, int xsiz)
+{
+ swapchar(p1, p2);
+ swapchar(p1 + 1, p2 + xsiz);
+}
+
+static __inline int32_t msqrtasm(uint32_t input)
+{
+ uint32_t a,b;
+
+ a = 0x40000000l; // mov eax, 0x40000000
+ b = 0x20000000l; // mov ebx, 0x20000000
+
+ do { // begit:
+ if (input >= a) { // cmp ecx, eax / jl skip
+ input -= a; // sub ecx, eax
+ a += b*4; // lea eax, [eax+ebx*4]
+ } // skip:
+ a -= b; // sub eax, ebx
+ a >>= 1; // shr eax, 1
+ b >>= 2; // shr ebx, 2
+ }
+ while (b); // jnz begit
+
+ if (input >= a) // cmp ecx, eax
+ a++; // sbb eax, -1
+
+ a >>= 1; // shr eax, 1
+
+ return a;
+}
+
+void vlin16first (int32_t i1, int32_t i2);
+
+static inline int32_t sqr (int32_t input1) { return input1*input1; }
+
+/* internal use:32x32 = 64bit */
+static inline int64_t mul32_64(int32_t i1,int32_t i2)
+{
+ return (int64_t)i1*i2;
+}
+static inline int scale (int32_t input1, int32_t input2, int32_t input3)
+{
+ return (int)(mul32_64(input1,input2)/(int64_t)input3);
+}
+static inline int mulscale (int32_t input1, int32_t input2, int32_t input3)
+{
+ return (int)(mul32_64(input1,input2)>>input3);
+}
+static inline int dmulscale (int32_t input1, int32_t input2, int32_t input3,int32_t input4,int32_t input5)
+{
+ return (int)((mul32_64(input1,input2) + mul32_64(input3,input4))>>input5);
+}
+static inline int tmulscale(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6,int32_t shift)
+{
+ return (int)((mul32_64(i1,i2) + mul32_64(i3,i4) + mul32_64(i5,i6))>>shift);
+}
+static inline int32_t divscale(int32_t i1, int32_t i2, int32_t i3)
+{
+ return (int32_t)(((int64_t)i1<<i3)/i2);
+}
+
+#define DEFFUNCS \
+DEFFUN(1)\
+DEFFUN(2)\
+DEFFUN(3)\
+DEFFUN(4)\
+DEFFUN(5)\
+DEFFUN(6)\
+DEFFUN(7)\
+DEFFUN(8)\
+DEFFUN(9)\
+DEFFUN(10)\
+DEFFUN(11)\
+DEFFUN(12)\
+DEFFUN(13)\
+DEFFUN(14)\
+DEFFUN(15)\
+DEFFUN(16)\
+DEFFUN(17)\
+DEFFUN(18)\
+DEFFUN(19)\
+DEFFUN(20)\
+DEFFUN(21)\
+DEFFUN(22)\
+DEFFUN(23)\
+DEFFUN(24)\
+DEFFUN(25)\
+DEFFUN(26)\
+DEFFUN(27)\
+DEFFUN(28)\
+DEFFUN(29)\
+DEFFUN(30)\
+DEFFUN(31)\
+DEFFUN(32)
+
+#define DEFFUN(N) \
+static __inline int32_t mulscale##N(int32_t input1, int32_t input2) \
+{ return mulscale(input1,input2,N); }
+DEFFUNCS
+#undef DEFFUN
+
+#define DEFFUN(N) \
+static __inline int32_t dmulscale##N(int32_t input1, int32_t input2,int32_t input3,int32_t input4) \
+{ return dmulscale(input1,input2,input3,input4,N); }
+DEFFUNCS
+#undef DEFFUN
+
+#define DEFFUN(N) \
+static __inline int32_t tmulscale##N(int32_t i1, int32_t i2,int32_t i3,int32_t i4,int32_t i5,int32_t i6) \
+{ return tmulscale(i1,i2,i3,i4,i5,i6,N); }
+DEFFUNCS
+#undef DEFFUN
+
+#define DEFFUN(N) \
+static __inline int32_t divscale##N(int32_t input1, int32_t input2) \
+{ return divscale(input1,input2,N); }
+DEFFUNCS
+#undef DEFFUN
+
+static inline int ksgn(int32_t i1)
+{
+ if (i1 < 0) return -1;
+ else if (i1 > 0) return 1;
+ else return 0;
+}
+
+static inline int sgn(int32_t i1) { return ksgn(i1); }
+static inline int klabs (int32_t i1)
+{
+ if (i1 < 0) i1 = -i1;
+ return i1;
+}
+static inline int mul3 (int32_t i1) { return i1*3; }
+static inline int mul5 (int32_t i1) { return i1*5; }
+static inline int mul9 (int32_t i1) { return i1*9; }
+
+void copybufreverse(void *S, void *D, int32_t c);
+void copybuf(void *s, void *d, int32_t c);
+void clearbuf(void *d, int32_t c, int32_t a);
+void clearbufbyte(void *D, int32_t c, int32_t a);
+void copybufbyte(void *S, void *D, int32_t c);
+
+void qinterpolatedown16 (int32_t* bufptr, int32_t num, int32_t val, int32_t add);
+void qinterpolatedown16short (int32_t* bufptr, int32_t num, int32_t val, int32_t add);
+
+#endif /* !defined _INCLUDE_PRAGMAS_H_ */
+
+
--- a/Engine/src/pragmas.c
+++ /dev/null
@@ -1,54 +1,0 @@
-// converted from asm to c by Jonof
-
-#include <stdio.h>
-#include "platform.h"
-#include "pragmas.h"
-
-void clearbuf(void *d, int32_t c, int32_t a)
-{
- int32_t *p = (int32_t*)d;
- while ((c--) > 0) *(p++) = a;
-}
-
-void clearbufbyte(void *D, int32_t c, int32_t a)
-{ // Cringe City
- uint8_t *p = (uint8_t *)D;
- int32_t m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l };
- int32_t n[4] = { 0,8,16,24 };
- int32_t z=0;
- while ((c--) > 0) {
- *(p++) = (uint8_t )((a & m[z])>>n[z]);
- z=(z+1)&3;
- }
-}
-
-void copybuf(void *s, void *d, int32_t c)
-{
- int32_t *p = (int32_t*)s, *q = (int32_t*)d;
- while ((c--) > 0) *(q++) = *(p++);
-}
-
-void copybufbyte(void *S, void *D, int32_t c)
-{
- uint8_t *p = (uint8_t *)S, *q = (uint8_t *)D;
- while((c--) > 0) *(q++) = *(p++);
-}
-
-void copybufreverse(void *S, void *D, int32_t c)
-{
- uint8_t *p = (uint8_t *)S, *q = (uint8_t *)D;
- while((c--) > 0) *(q++) = *(p--);
-}
-
-void qinterpolatedown16(int32_t* bufptr, int32_t num, int32_t val, int32_t add)
-{ // gee, I wonder who could have provided this...
- int32_t i, *lptr = bufptr;
- for(i=0;i<num;i++) { lptr[i] = (val>>16); val += add; }
-}
-
-void qinterpolatedown16short(int32_t* bufptr, int32_t num, int32_t val, int32_t add)
-{ // ...maybe the same person who provided this too?
- int32_t i; short *sptr = (short *)bufptr;
- for(i=0;i<num;i++) { sptr[i] = (short)(val>>16); val += add; }
-}
-
--- a/Engine/src/pragmas.h
+++ /dev/null
@@ -1,167 +1,0 @@
-/*
- * "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
- * Ken Silverman's official web site: "http://www.advsys.net/ken"
- * See the included license file "BUILDLIC.TXT" for license info.
- * This file has been modified from Ken Silverman's original release
- */
-
-#ifndef __PRAGMAS_H__
-#define __PRAGMAS_H__
-
-#include "platform.h"
-
-static __inline void swapchar(uint8_t *p1, uint8_t *p2)
-{ uint8_t tmp = *p1; *p1 = *p2; *p2 = tmp; }
-static __inline void swapshort(short *p1, short *p2)
-{ short tmp = *p1; *p1 = *p2; *p2 = tmp; }
-static __inline void swaplong(int32_t *p1, int32_t *p2)
-{ int32_t tmp = *p1; *p1 = *p2; *p2 = tmp; }
-static __inline void swapchar2(uint8_t *p1, uint8_t *p2, int xsiz)
-{
- swapchar(p1, p2);
- swapchar(p1 + 1, p2 + xsiz);
-}
-
-static __inline int32_t msqrtasm(uint32_t input)
-{
- uint32_t a,b;
-
- a = 0x40000000l; // mov eax, 0x40000000
- b = 0x20000000l; // mov ebx, 0x20000000
-
- do { // begit:
- if (input >= a) { // cmp ecx, eax / jl skip
- input -= a; // sub ecx, eax
- a += b*4; // lea eax, [eax+ebx*4]
- } // skip:
- a -= b; // sub eax, ebx
- a >>= 1; // shr eax, 1
- b >>= 2; // shr ebx, 2
- }
- while (b); // jnz begit
-
- if (input >= a) // cmp ecx, eax
- a++; // sbb eax, -1
-
- a >>= 1; // shr eax, 1
-
- return a;
-}
-
-void vlin16first (int32_t i1, int32_t i2);
-
-static inline int32_t sqr (int32_t input1) { return input1*input1; }
-
-/* internal use:32x32 = 64bit */
-static inline int64_t mul32_64(int32_t i1,int32_t i2)
-{
- return (int64_t)i1*i2;
-}
-static inline int scale (int32_t input1, int32_t input2, int32_t input3)
-{
- return (int)(mul32_64(input1,input2)/(int64_t)input3);
-}
-static inline int mulscale (int32_t input1, int32_t input2, int32_t input3)
-{
- return (int)(mul32_64(input1,input2)>>input3);
-}
-static inline int dmulscale (int32_t input1, int32_t input2, int32_t input3,int32_t input4,int32_t input5)
-{
- return (int)((mul32_64(input1,input2) + mul32_64(input3,input4))>>input5);
-}
-static inline int tmulscale(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6,int32_t shift)
-{
- return (int)((mul32_64(i1,i2) + mul32_64(i3,i4) + mul32_64(i5,i6))>>shift);
-}
-static inline int32_t divscale(int32_t i1, int32_t i2, int32_t i3)
-{
- return (int32_t)(((int64_t)i1<<i3)/i2);
-}
-
-#define DEFFUNCS \
-DEFFUN(1)\
-DEFFUN(2)\
-DEFFUN(3)\
-DEFFUN(4)\
-DEFFUN(5)\
-DEFFUN(6)\
-DEFFUN(7)\
-DEFFUN(8)\
-DEFFUN(9)\
-DEFFUN(10)\
-DEFFUN(11)\
-DEFFUN(12)\
-DEFFUN(13)\
-DEFFUN(14)\
-DEFFUN(15)\
-DEFFUN(16)\
-DEFFUN(17)\
-DEFFUN(18)\
-DEFFUN(19)\
-DEFFUN(20)\
-DEFFUN(21)\
-DEFFUN(22)\
-DEFFUN(23)\
-DEFFUN(24)\
-DEFFUN(25)\
-DEFFUN(26)\
-DEFFUN(27)\
-DEFFUN(28)\
-DEFFUN(29)\
-DEFFUN(30)\
-DEFFUN(31)\
-DEFFUN(32)
-
-#define DEFFUN(N) \
-static __inline int32_t mulscale##N(int32_t input1, int32_t input2) \
-{ return mulscale(input1,input2,N); }
-DEFFUNCS
-#undef DEFFUN
-
-#define DEFFUN(N) \
-static __inline int32_t dmulscale##N(int32_t input1, int32_t input2,int32_t input3,int32_t input4) \
-{ return dmulscale(input1,input2,input3,input4,N); }
-DEFFUNCS
-#undef DEFFUN
-
-#define DEFFUN(N) \
-static __inline int32_t tmulscale##N(int32_t i1, int32_t i2,int32_t i3,int32_t i4,int32_t i5,int32_t i6) \
-{ return tmulscale(i1,i2,i3,i4,i5,i6,N); }
-DEFFUNCS
-#undef DEFFUN
-
-#define DEFFUN(N) \
-static __inline int32_t divscale##N(int32_t input1, int32_t input2) \
-{ return divscale(input1,input2,N); }
-DEFFUNCS
-#undef DEFFUN
-
-static inline int ksgn(int32_t i1)
-{
- if (i1 < 0) return -1;
- else if (i1 > 0) return 1;
- else return 0;
-}
-
-static inline int sgn(int32_t i1) { return ksgn(i1); }
-static inline int klabs (int32_t i1)
-{
- if (i1 < 0) i1 = -i1;
- return i1;
-}
-static inline int mul3 (int32_t i1) { return i1*3; }
-static inline int mul5 (int32_t i1) { return i1*5; }
-static inline int mul9 (int32_t i1) { return i1*9; }
-
-void copybufreverse(void *S, void *D, int32_t c);
-void copybuf(void *s, void *d, int32_t c);
-void clearbuf(void *d, int32_t c, int32_t a);
-void clearbufbyte(void *D, int32_t c, int32_t a);
-void copybufbyte(void *S, void *D, int32_t c);
-
-void qinterpolatedown16 (int32_t* bufptr, int32_t num, int32_t val, int32_t add);
-void qinterpolatedown16short (int32_t* bufptr, int32_t num, int32_t val, int32_t add);
-
-#endif /* !defined _INCLUDE_PRAGMAS_H_ */
-
-
--- /dev/null
+++ b/Engine/src/tiles.c
@@ -1,0 +1,383 @@
+//
+// tiles.c
+// Duke3D
+//
+// Created by fabien sanglard on 12-12-22.
+// Copyright (c) 2012 fabien sanglard. All rights reserved.
+//
+
+#include "tiles.h"
+#include "engine.h"
+#include "draw.h"
+#include "filesystem.h"
+
+
+tile_t tiles[MAXTILES];
+
+int32_t numTiles;
+
+int32_t artversion;
+
+uint8_t *pic = NULL;
+
+//Those are from engine.c
+extern int32_t setviewcnt;
+extern int32_t bakvidoption[4];
+extern int32_t bakframeplace[4], bakxsiz[4], bakysiz[4];
+extern int32_t bakwindowx1[4], bakwindowy1[4];
+extern int32_t bakwindowx2[4], bakwindowy2[4];
+extern uint8_t picsiz[MAXTILES], tilefilenum[MAXTILES];
+extern int16_t bakumost[MAXXDIM+1], bakdmost[MAXXDIM+1];
+extern int32_t numtilefiles, artfil , artfilnum, artfilplc;
+extern int32_t pow2long[32];
+extern int32_t artsize , cachesize ;
+extern int32_t tilefileoffs[MAXTILES];
+extern int32_t totalclocklock;
+
+
+
+
+
+
+void setviewtotile(short tilenume, int32_t tileWidth, int32_t tileHeight)
+{
+ int32_t i, j;
+
+ /* DRAWROOMS TO TILE BACKUP&SET CODE */
+ tiles[tilenume].dim.width = tileWidth;
+ tiles[tilenume].dim.height = tileHeight;
+ bakxsiz[setviewcnt] = tileWidth;
+ bakysiz[setviewcnt] = tileHeight;
+ bakvidoption[setviewcnt] = vidoption;
+ vidoption = 2;
+ bakframeplace[setviewcnt] = frameplace;
+ frameplace = tiles[tilenume].data;
+ bakwindowx1[setviewcnt] = windowx1;
+ bakwindowy1[setviewcnt] = windowy1;
+ bakwindowx2[setviewcnt] = windowx2;
+ bakwindowy2[setviewcnt] = windowy2;
+ copybufbyte(&startumost[windowx1],&bakumost[windowx1],(windowx2-windowx1+1)*sizeof(bakumost[0]));
+ copybufbyte(&startdmost[windowx1],&bakdmost[windowx1],(windowx2-windowx1+1)*sizeof(bakdmost[0]));
+ setview(0,0,tileHeight-1,tileWidth-1);
+ setaspect(65536,65536);
+ j = 0;
+ for(i=0; i<=tileWidth; i++) {
+ ylookup[i] = j;
+ j += tileWidth;
+ }
+ setBytesPerLine(tileHeight);
+ setviewcnt++;
+}
+
+
+
+
+void squarerotatetile(short tilenume)
+{
+ int32_t i, j, k;
+ uint8_t *ptr1, *ptr2;
+
+ dimensions_t tileDim;
+
+ tileDim.width = tiles[tilenume].dim.width;
+ tileDim.height = tiles[tilenume].dim.height;
+
+ /* supports square tiles only for rotation part */
+ if (tileDim.width == tileDim.height)
+ {
+ k = (tileDim.width<<1);
+ for(i=tileDim.width-1; i>=0; i--)
+ {
+ ptr1 = (uint8_t *) (tiles[tilenume].data+i*(tileDim.width+1));
+ ptr2 = ptr1;
+ if ((i&1) != 0) {
+ ptr1--;
+ ptr2 -= tileDim.width;
+ swapchar(ptr1,ptr2);
+ }
+ for(j=(i>>1)-1; j>=0; j--)
+ {
+ ptr1 -= 2;
+ ptr2 -= k;
+ swapchar2(ptr1,ptr2,tileDim.width);
+ }
+ }
+ }
+}
+
+
+
+//1. Lock a picture in the cache system.
+//2. Mark it as used in the bitvector tracker.
+void setgotpic(int32_t tilenume)
+{
+ if (tiles[tilenume].lock < 200)
+ tiles[tilenume].lock = 199;
+
+ gotpic[tilenume>>3] |= pow2char[tilenume&7];
+}
+
+
+
+
+
+void loadtile(short tilenume)
+{
+ uint8_t *ptr;
+ int32_t i, tileFilesize;
+ char artfilename[20];
+
+
+
+ if ((uint32_t)tilenume >= (uint32_t)MAXTILES)
+ return;
+
+ tileFilesize = tiles[tilenume].dim.width * tiles[tilenume].dim.height;
+
+ if (tileFilesize <= 0)
+ return;
+
+ i = tilefilenum[tilenume];
+ if (i != artfilnum){
+ if (artfil != -1)
+ kclose(artfil);
+ artfilnum = i;
+ artfilplc = 0L;
+
+ artfilename[7] = (i%10)+48;
+ artfilename[6] = ((i/10)%10)+48;
+ artfilename[5] = ((i/100)%10)+48;
+ artfil = TCkopen4load(artfilename,0);
+ faketimerhandler();
+ }
+
+ if (tiles[tilenume].data == NULL){
+ tiles[tilenume].lock = 199;
+ allocache(&tiles[tilenume].data,tileFilesize,(uint8_t *) &tiles[tilenume].lock);
+ }
+
+ if (artfilplc != tilefileoffs[tilenume])
+ {
+ klseek(artfil,tilefileoffs[tilenume]-artfilplc,SEEK_CUR);
+ faketimerhandler();
+ }
+ ptr = tiles[tilenume].data;
+
+ kread(artfil,ptr,tileFilesize);
+ faketimerhandler();
+ artfilplc = tilefileoffs[tilenume]+tileFilesize;
+}
+
+
+
+uint8_t* allocatepermanenttile(short tilenume, int32_t width, int32_t height)
+{
+ int32_t j;
+ uint32_t tileDataSize;
+
+ //Check dimensions are correct.
+ if ((width <= 0) || (height <= 0) || ((uint32_t)tilenume >= (uint32_t)MAXTILES))
+ return(0);
+
+ tileDataSize = width * height;
+
+ tiles[tilenume].lock = 255;
+ allocache(&tiles[tilenume].data,tileDataSize,(uint8_t *) &tiles[tilenume].lock);
+
+ tiles[tilenume].dim.width = width;
+ tiles[tilenume].dim.height = height;
+ tiles[tilenume].animFlags = 0;
+
+ j = 15;
+ while ((j > 1) && (pow2long[j] > width))
+ j--;
+ picsiz[tilenume] = ((uint8_t )j);
+
+ j = 15;
+ while ((j > 1) && (pow2long[j] > height))
+ j--;
+ picsiz[tilenume] += ((uint8_t )(j<<4));
+
+ return(tiles[tilenume].data);
+}
+
+
+
+int loadpics(char *filename, char * gamedir)
+
+{
+ int32_t offscount, localtilestart, localtileend, dasiz;
+ short fil, i, j, k;
+ char artfilename[512];
+
+ strcpy(artfilename,filename);
+
+ for(i=0; i<MAXTILES; i++)
+ {
+ tiles[i].dim.width = 0;
+ tiles[i].dim.height = 0;
+ tiles[i].animFlags = 0L;
+ }
+
+ artsize = 0L;
+
+ numtilefiles = 0;
+ do
+ {
+ k = numtilefiles;
+
+ artfilename[7] = (k%10)+48;
+ artfilename[6] = ((k/10)%10)+48;
+ artfilename[5] = ((k/100)%10)+48;
+
+
+
+ if ((fil = TCkopen4load(artfilename,0)) != -1)
+ {
+ kread32(fil,&artversion);
+ if (artversion != 1) return(-1);
+
+ kread32(fil,&numTiles);
+ kread32(fil,&localtilestart);
+ kread32(fil,&localtileend);
+
+ /*kread(fil,&tilesizx[localtilestart],(localtileend-localtilestart+1)<<1);*/
+ for (i = localtilestart; i <= localtileend; i++)
+ kread16(fil,&tiles[i].dim.width);
+
+ /*kread(fil,&tilesizy[localtilestart],(localtileend-localtilestart+1)<<1);*/
+ for (i = localtilestart; i <= localtileend; i++)
+ kread16(fil,&tiles[i].dim.height);
+
+ /*kread(fil,&picanm[localtilestart],(localtileend-localtilestart+1)<<2);*/
+ for (i = localtilestart; i <= localtileend; i++)
+ kread32(fil,&tiles[i].animFlags);
+
+ offscount = 4+4+4+4+((localtileend-localtilestart+1)<<3);
+ for(i=localtilestart; i<=localtileend; i++)
+ {
+ tilefilenum[i] = k;
+ tilefileoffs[i] = offscount;
+ dasiz = tiles[i].dim.width*tiles[i].dim.height;
+ offscount += dasiz;
+ artsize += ((dasiz+15)&0xfffffff0);
+ }
+ kclose(fil);
+
+ numtilefiles++;
+
+ }
+ }
+ while (k != numtilefiles);
+ printf("Art files loaded\n");
+ clearbuf(&gotpic[0],(int32_t)((MAXTILES+31)>>5),0L);
+
+ /* try dpmi_DETERMINEMAXREALALLOC! */
+
+ cachesize = max(artsize,1048576);
+ while ((pic = (uint8_t *)kkmalloc(cachesize)) == NULL)
+ {
+ cachesize -= 65536L;
+ if (cachesize < 65536) return(-1);
+ }
+ initcache(((int32_t)FP_OFF(pic)+15)&0xfffffff0,(cachesize-((-(int32_t)FP_OFF(pic))&15))&0xfffffff0);
+
+ for(i=0; i<MAXTILES; i++)
+ {
+ j = 15;
+ while ((j > 1) && (pow2long[j] > tiles[i].dim.width)) j--;
+ picsiz[i] = ((uint8_t )j);
+ j = 15;
+ while ((j > 1) && (pow2long[j] > tiles[i].dim.height)) j--;
+ picsiz[i] += ((uint8_t )(j<<4));
+ }
+
+ artfil = -1;
+ artfilnum = -1;
+ artfilplc = 0L;
+
+ return(0);
+}
+
+
+
+
+void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz,
+ int32_t tilenume2, int32_t sx2, int32_t sy2)
+{
+ uint8_t *ptr1, *ptr2, dat;
+ int32_t xsiz1, ysiz1, xsiz2, ysiz2, i, j, x1, y1, x2, y2;
+
+ xsiz1 = tiles[tilenume1].dim.width;
+ ysiz1 = tiles[tilenume1].dim.height;
+ xsiz2 = tiles[tilenume2].dim.width;
+ ysiz2 = tiles[tilenume2].dim.height;
+
+ if ((xsiz1 > 0) && (ysiz1 > 0) && (xsiz2 > 0) && (ysiz2 > 0))
+ {
+ if (tiles[tilenume1].data == NULL)
+ loadtile((short) tilenume1);
+
+ if (tiles[tilenume2].data == NULL)
+ loadtile((short) tilenume2);
+
+ x1 = sx1;
+ for(i=0; i<xsiz; i++)
+ {
+ y1 = sy1;
+ for(j=0; j<ysiz; j++)
+ {
+ x2 = sx2+i;
+ y2 = sy2+j;
+ if ((x2 >= 0) && (y2 >= 0) && (x2 < xsiz2) && (y2 < ysiz2))
+ {
+ ptr1 = (uint8_t *) (tiles[tilenume1].data + x1*ysiz1 + y1);
+ ptr2 = (uint8_t *) (tiles[tilenume2].data + x2*ysiz2 + y2);
+ dat = *ptr1;
+ if (dat != 255)
+ *ptr2 = *ptr1;
+ }
+
+ y1++;
+ if (y1 >= ysiz1) y1 = 0;
+ }
+ x1++;
+ if (x1 >= xsiz1) x1 = 0;
+ }
+ }
+}
+
+
+
+/*
+ FCS: If a texture is animated, this will return the offset to add to tilenum
+ in order to retrieve the texture to display.
+ */
+int animateoffs(int16_t tilenum)
+{
+ int32_t i, k, offs;
+
+ offs = 0;
+
+ i = (totalclocklock>>((tiles[tilenum].animFlags>>24)&15));
+
+ if ((tiles[tilenum].animFlags&63) > 0){
+ switch(tiles[tilenum].animFlags&192)
+ {
+ case 64:
+ k = (i%((tiles[tilenum].animFlags&63)<<1));
+ if (k < (tiles[tilenum].animFlags&63))
+ offs = k;
+ else
+ offs = (((tiles[tilenum].animFlags&63)<<1)-k);
+ break;
+ case 128:
+ offs = (i%((tiles[tilenum].animFlags&63)+1));
+ break;
+ case 192:
+ offs = -(i%((tiles[tilenum].animFlags&63)+1));
+ }
+ }
+
+ return(offs);
+}
\ No newline at end of file
--- /dev/null
+++ b/Engine/src/tiles.h
@@ -1,0 +1,71 @@
+//
+// tiles.h
+// Duke3D
+//
+// Created by fabien sanglard on 12-12-22.
+// Copyright (c) 2012 fabien sanglard. All rights reserved.
+//
+
+#ifndef Duke3D_tiles_h
+#define Duke3D_tiles_h
+
+#include "build.h"
+
+
+
+/*
+// The dimension of the tile in texels unit. The sizes can be obtained for
+// any tile by doing a tilesizx * tilesizy
+//EXTERN short tilesizx[MAXTILES], tilesizy[MAXTILES];
+typedef struct dimensions_s{
+ short width;
+ short height;
+} dimensions_t;
+dimensions_t tiles[MAXTILES];
+
+// An array of locks for each pic: Used to check if a texture is in RAM or in the GRP.
+EXTERN uint8_t walock[MAXTILES];
+EXTERN int32_t numtiles, picanm[MAXTILES];
+
+//The wall texture data.
+EXTERN uint8_t* waloff[MAXTILES];
+*/
+
+
+
+
+typedef struct dimensions_s{
+ short width;
+ short height;
+} dimensions_t;
+
+typedef struct tile_s{
+ dimensions_t dim;
+ uint8_t lock;
+ int32_t animFlags;
+ uint8_t* data;
+} tile_t;
+
+
+EXTERN tile_t tiles[MAXTILES];
+
+void setviewtotile(short tilenume, int32_t tileWidth, int32_t tileHeight);
+void squarerotatetile(short tilenume);
+
+void loadtile(short tilenume);
+uint8_t* allocatepermanenttile(short tilenume, int32_t width, int32_t height);
+int loadpics(char *filename, char * gamedir);
+void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz,int32_t tilenume2, int32_t sx2, int32_t sy2);
+
+
+//Bitvector marking picture used for rendition.
+EXTERN uint8_t gotpic[(MAXTILES+7)>>3];
+void setgotpic(int32_t tilenume);
+
+
+
+int animateoffs(int16_t tilenum);
+
+EXTERN uint8_t *pic ;
+
+#endif
--- a/Game/src/actors.c
+++ b/Game/src/actors.c
@@ -644,7 +644,7 @@
dasectnum = sprite[spritenum].sectnum;
daz = sprite[spritenum].z;
- h = ((tilesDimension[sprite[spritenum].picnum].height * sprite[spritenum].yrepeat)<<1);
+ h = ((tiles[sprite[spritenum].picnum].dim.height * sprite[spritenum].yrepeat)<<1);
daz -= h;
if( bg )
--- a/Game/src/duke3d.h
+++ b/Game/src/duke3d.h
@@ -178,7 +178,7 @@
#include "names.h"
#include "../../Engine/src/engine.h"
-#include "pragmas.h"
+#include "fixedPoint_math.h"
//#define TICRATE (120)
//#define TICSPERFRAME (TICRATE/26)
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -170,7 +170,7 @@
if(*t >= '0' && *t <= '9')
newx += 8;
- else newx += tilesDimension[ac].width;
+ else newx += tiles[ac].dim.width;
t++;
}
@@ -190,7 +190,7 @@
if(*t >= '0' && *t <= '9')
x += 8;
- else x += tilesDimension[ac].width;
+ else x += tiles[ac].dim.width;
t++;
}
@@ -219,7 +219,7 @@
if(*t >= '0' && *t <= '9')
newx += 8;
- else newx += tilesDimension[ac].width;
+ else newx += tiles[ac].dim.width;
t++;
}
@@ -238,7 +238,7 @@
rotatesprite(x<<16,y<<16,65536L,0,ac,s,p,2+8+16,0,0,xdim-1,ydim-1);
if(*t >= '0' && *t <= '9')
x += 8;
- else x += tilesDimension[ac].width;
+ else x += tiles[ac].dim.width;
t++;
}
@@ -268,7 +268,7 @@
if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break;
- newx += tilesDimension[ac].width;
+ newx += tiles[ac].dim.width;
t++;
cnt++;
@@ -294,7 +294,7 @@
else
rotatesprite(x<<16,y<<16,65536L,0,ac,s,0,2+8+16,0,0,xdim-1,ydim-1);
- x += tilesDimension[ac].width;
+ x += tiles[ac].dim.width;
t++;
cnt++;
@@ -1674,7 +1674,7 @@
for(k=0;k<i;k++)
{
p = DIGITALNUM+*(b+k)-'0';
- j += tilesDimension[p].width+1;
+ j += tiles[p].dim.width+1;
}
c = x-(j>>1);
@@ -1683,7 +1683,7 @@
{
p = DIGITALNUM+*(b+k)-'0';
rotatesprite((c+j)<<16,y<<16,65536L,0,p,s,0,cs,0,0,xdim-1,ydim-1);
- j += tilesDimension[p].width+1;
+ j += tiles[p].dim.width+1;
}
}
@@ -3276,9 +3276,10 @@
if(screencapt)
{
- walock[MAXTILES-1] = 254;
- if (waloff[MAXTILES-1] == 0)
- allocache((int32_t *)&waloff[MAXTILES-1],100*160,&walock[MAXTILES-1]);
+ tiles[MAXTILES-1].lock = 254;
+ if (tiles[MAXTILES-1].data == NULL)
+ allocache(&tiles[MAXTILES-1].data,100*160,&tiles[MAXTILES-1].lock);
+
setviewtotile(MAXTILES-1,100L,160L);
}
else if( ( ud.screen_tilting && p->rotscrnang ) || ud.detail==0 )
@@ -3285,9 +3286,9 @@
{
if (ud.screen_tilting) tang = p->rotscrnang; else tang = 0;
- walock[MAXTILES-2] = 255;
- if (waloff[MAXTILES-2] == 0)
- allocache(&waloff[MAXTILES-2],320L*320L,&walock[MAXTILES-2]);
+ tiles[MAXTILES-2].lock = 255;
+ if (tiles[MAXTILES-2].data == NULL)
+ allocache(&tiles[MAXTILES-2].data,320L*320L,&tiles[MAXTILES-2].lock);
if ((tang&1023) == 0)
setviewtotile(MAXTILES-2,200L>>(1-ud.detail),320L>>(1-ud.detail));
else
@@ -3409,7 +3410,7 @@
if(screencapt == 1)
{
setviewback();
- walock[MAXTILES-1] = 1;
+ tiles[MAXTILES-1].lock = 1;
screencapt = 0;
}
else if( ( ud.screen_tilting && p->rotscrnang) || ud.detail==0 )
@@ -3416,12 +3417,12 @@
{
if (ud.screen_tilting) tang = p->rotscrnang; else tang = 0;
setviewback();
- picanm[MAXTILES-2] &= 0xff0000ff;
+ tiles[MAXTILES-2].animFlags &= 0xff0000ff;
i = (tang&511); if (i > 256) i = 512-i;
i = sintable[i+512]*8 + sintable[i]*5L;
if ((1-ud.detail) == 0) i >>= 1;
rotatesprite(160<<16,100<<16,i,tang+512,MAXTILES-2,0,0,4+2+64,windowx1,windowy1,windowx2,windowy2);
- walock[MAXTILES-2] = 199;
+ tiles[MAXTILES-2].lock = 199;
}
}
@@ -5935,7 +5936,7 @@
t->picnum += k + ( *(int32_t *)t4 ) + l * t3;
if(l > 0)
- while(tilesDimension[t->picnum].width == 0 && t->picnum > 0 )
+ while(tiles[t->picnum].dim.width == 0 && t->picnum > 0 )
t->picnum -= l; //Hack, for actors
if( hittype[i].dispicnum >= 0)
@@ -6839,7 +6840,7 @@
cmenu(350);
screencapt = 1;
displayrooms(myconnectindex,65536);
- savetemp("duke3d.tmp",waloff[MAXTILES-1],160*100);
+ savetemp("duke3d.tmp",tiles[MAXTILES-1].data,160*100);
screencapt = 0;
FX_StopAllSounds();
clearsoundlocks();
@@ -6911,7 +6912,7 @@
}
screencapt = 1;
displayrooms(myconnectindex,65536);
- savetemp("duke3d.tmp",waloff[MAXTILES-1],160*100);
+ savetemp("duke3d.tmp",tiles[MAXTILES-1].data,160*100);
screencapt = 0;
if( lastsavedpos >= 0 )
{
@@ -7736,7 +7737,7 @@
readsavenames();
- tilesDimension[MIRROR].width = tilesDimension[MIRROR].height = 0;
+ tiles[MIRROR].dim.width = tiles[MIRROR].dim.height = 0;
for(i=0;i<MAXPLAYERS;i++) playerreadyflag[i] = 0;
initmultiplayers(0,0,0);
@@ -9479,7 +9480,7 @@
// FIX_00058: Save/load game crash in both single and multiplayer
screencapt = 1;
displayrooms(myconnectindex,65536);
- savetemp("duke3d.tmp",waloff[MAXTILES-1],160*100);
+ savetemp("duke3d.tmp",tiles[MAXTILES-1].data,160*100);
screencapt = 0;
saveplayer( multipos );
--- a/Game/src/gamedef.c
+++ b/Game/src/gamedef.c
@@ -2297,7 +2297,7 @@
if( ( g_sp->picnum == APLAYER && g_sp->yrepeat < 36 ) ||
*insptr < g_sp->yrepeat ||
- ((g_sp->yrepeat*(tilesDimension[g_sp->picnum].height+8))<<2) < (hittype[g_i].floorz - hittype[g_i].ceilingz) )
+ ((g_sp->yrepeat*(tiles[g_sp->picnum].dim.height+8))<<2) < (hittype[g_i].floorz - hittype[g_i].ceilingz) )
{
j = ((*insptr)-g_sp->yrepeat)<<1;
if( klabs(j) ) g_sp->yrepeat += ksgn(j);
--- a/Game/src/menues.c
+++ b/Game/src/menues.c
@@ -190,7 +190,7 @@
if ((fil = TCkopen4load(fn,0)) == -1) return(-1);
- walock[MAXTILES-3] = 255;
+ tiles[MAXTILES-3].lock = 255;
kdfread(&bv,4,1,fil);
if(bv != BYTEVERSION)
@@ -207,11 +207,11 @@
kdfread(ln,sizeof(int32),1,fil);
kdfread(psk,sizeof(int32),1,fil);
- if (waloff[MAXTILES-3] == 0)
- allocache(&waloff[MAXTILES-3],160*100,&walock[MAXTILES-3]);
- tilesDimension[MAXTILES-3].width = 100;
- tilesDimension[MAXTILES-3].height = 160;
- kdfread((uint8_t *)waloff[MAXTILES-3],160,100,fil);
+ if (tiles[MAXTILES-3].data == NULL)
+ allocache(&tiles[MAXTILES-3].data,160*100,&tiles[MAXTILES-3].lock);
+ tiles[MAXTILES-3].dim.width = 100;
+ tiles[MAXTILES-3].dim.height = 160;
+ kdfread(tiles[MAXTILES-3].data,160,100,fil);
kclose(fil);
return(0);
}
@@ -317,14 +317,15 @@
ud.m_player_skill = ud.player_skill;
//Fake read because lseek won't work with compression
- walock[MAXTILES-3] = 1;
- if (waloff[MAXTILES-3] == 0)
- allocache(&waloff[MAXTILES-3],160*100,&walock[MAXTILES-3]);
+ tiles[MAXTILES-3].lock = 1;
- tilesDimension[MAXTILES-3].width = 100;
- tilesDimension[MAXTILES-3].height = 160;
+ if (tiles[MAXTILES-3].data == NULL)
+ allocache(&tiles[MAXTILES-3].data,160*100,&tiles[MAXTILES-3].lock);
- kdfread((uint8_t *)waloff[MAXTILES-3],160,100,fil);
+ tiles[MAXTILES-3].dim.width = 100;
+ tiles[MAXTILES-3].dim.height = 160;
+
+ kdfread((uint8_t *)tiles[MAXTILES-3].data,160,100,fil);
kdfread(&numwalls,2,1,fil);
kdfread(&wall[0],sizeof(walltype),MAXWALLS,fil);
@@ -609,7 +610,7 @@
dfwrite(&ud.volume_number,sizeof(ud.volume_number),1,fil);
dfwrite(&ud.level_number,sizeof(ud.level_number),1,fil);
dfwrite(&ud.player_skill,sizeof(ud.player_skill),1,fil);
- dfwrite((uint8_t *)waloff[MAXTILES-1],160,100,fil);
+ dfwrite(tiles[MAXTILES-1].data,160,100,fil);
dfwrite(&numwalls,2,1,fil);
dfwrite(&wall[0],sizeof(walltype),MAXWALLS,fil);
@@ -882,7 +883,7 @@
rotatesprite(((320>>1)-(centre>>1)-70)<<16,(y+(probey*i)-4)<<16,spriteSize,0,SPINNINGNUKEICON+((totalclock>>3)%7),sh,0,10,0,0,xdim-1,ydim-1);
}
else
- rotatesprite((x-tilesDimension[BIGFNTCURSOR].width-4)<<16,(y+(probey*i)-4)<<16,spriteSize,0,SPINNINGNUKEICON+(((totalclock>>3))%7),sh,0,10,0,0,xdim-1,ydim-1);
+ rotatesprite((x-tiles[BIGFNTCURSOR].dim.width-4)<<16,(y+(probey*i)-4)<<16,spriteSize,0,SPINNINGNUKEICON+(((totalclock>>3))%7),sh,0,10,0,0,xdim-1,ydim-1);
if( KB_KeyPressed(sc_Space) || KB_KeyPressed( sc_kpad_Enter ) || KB_KeyPressed( sc_Enter ) || (LMB))// && !onbar) )
{
@@ -968,7 +969,7 @@
continue;
}
- centre += tilesDimension[ac].width-1;
+ centre += tiles[ac].dim.width-1;
i++;
}
}
@@ -1020,7 +1021,7 @@
rotatesprite(x<<16,y<<16,65536L,0,ac,s,p,10+16,0,0,xdim-1,ydim-1);
- x += tilesDimension[ac].width;
+ x += tiles[ac].dim.width;
t++;
}
return (x);
@@ -1078,7 +1079,7 @@
break;
}
- centre += tilesDimension[ac].width-1;
+ centre += tiles[ac].dim.width-1;
i++;
}
}
@@ -1122,7 +1123,7 @@
rotatesprite(x<<16,y<<16,65536L,0,ac,s,p,10+16,0,0,xdim-1,ydim-1);
- x += tilesDimension[ac].width;
+ x += tiles[ac].dim.width;
t++;
}
return (x);
@@ -1458,7 +1459,7 @@
if( (ps[myconnectindex].gm&MODE_MENU) == 0 )
{
- walock[MAXTILES-3] = 1;
+ tiles[MAXTILES-3].lock = 1;
return;
}
@@ -3287,7 +3288,7 @@
cmenu(351);
screencapt = 1;
displayrooms(myconnectindex,65536);
- savetemp("duke3d.tmp",waloff[MAXTILES-1],160*100);
+ savetemp("duke3d.tmp",tiles[MAXTILES-1].data,160*100);
screencapt = 0;
break;
@@ -4298,12 +4299,12 @@
{
x1 = sprx; y1 = spry;
tilenum = spr->picnum;
- xoff = (int32_t)((int8_t )((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
+ xoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>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;
- l = tilesDimension[tilenum].width;
+ l = tiles[tilenum].dim.width;
k = (l>>1)+xoff;
x1 -= mulscale16(dax,k);
x2 = x1+mulscale16(dax,l);
@@ -4327,8 +4328,8 @@
case 32:
tilenum = spr->picnum;
- 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);
+ xoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>8)&255))+((int32_t)spr->xoffset);
+ yoff = (int32_t)((int8_t )((tiles[tilenum].animFlags>>16)&255))+((int32_t)spr->yoffset);
if ((spr->cstat&4) > 0) xoff = -xoff;
if ((spr->cstat&8) > 0) yoff = -yoff;
@@ -4335,9 +4336,9 @@
k = spr->ang;
cosang = sintable[(k+512)&2047];
sinang = sintable[k];
- xspan = tilesDimension[tilenum].width;
+ xspan = tiles[tilenum].dim.width;
xrepeat = spr->xrepeat;
- yspan = tilesDimension[tilenum].height;
+ yspan = tiles[tilenum].dim.height;
yrepeat = spr->yrepeat;
dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat;
@@ -4398,9 +4399,9 @@
//if ((show2dwall[j>>3]&(1<<(j&7))) == 0) continue;
- if (tilesDimension[wal->picnum].width == 0)
+ if (tiles[wal->picnum].dim.width == 0)
continue;
- if (tilesDimension[wal->picnum].height== 0)
+ if (tiles[wal->picnum].dim.height== 0)
continue;
if (j == k)
@@ -4652,17 +4653,17 @@
length = kfilelength(handle);
- walock[MAXTILES-3-t] = 219+t;
+ tiles[MAXTILES-3-t].lock = 219+t;
if(anim == 0 || lastanimhack != (MAXTILES-3-t))
- allocache((int32_t *)&anim,length+sizeof(anim_t),&walock[MAXTILES-3-t]);
+ allocache((int32_t *)&anim,length+sizeof(anim_t),&tiles[MAXTILES-3-t].lock);
animbuf = (uint8_t *)(FP_OFF(anim)+sizeof(anim_t));
lastanimhack = (MAXTILES-3-t);
- tilesDimension[MAXTILES-3-t].width = 200;
- tilesDimension[MAXTILES-3-t].height = 320;
+ tiles[MAXTILES-3-t].dim.width = 200;
+ tiles[MAXTILES-3-t].dim.height = 320;
kread(handle,animbuf,length);
kclose(handle);
@@ -4703,7 +4704,7 @@
else if(ud.volume_number == 1) ototalclock += 18;
else ototalclock += 10;
- waloff[MAXTILES-3-t] = FP_OFF(ANIM_DrawFrame(i));
+ tiles[MAXTILES-3-t].data = FP_OFF(ANIM_DrawFrame(i));
rotatesprite(0<<16,0<<16,65536L,512,MAXTILES-3-t,0,0,2+4+8+16+64, 0,0,xdim-1,ydim-1);
nextpage();
@@ -4720,6 +4721,6 @@
ENDOFANIMLOOP:
ANIM_FreeAnim ();
- walock[MAXTILES-3-t] = 1;
+ tiles[MAXTILES-3-t].lock = 1;
}
--- a/Game/src/player.c
+++ b/Game/src/player.c
@@ -339,7 +339,7 @@
sa = s->ang;
sx = s->x;
sy = s->y;
- sz = s->z-((s->yrepeat*tilesDimension[s->picnum].height)<<1)+(4<<8);
+ sz = s->z-((s->yrepeat*tiles[s->picnum].dim.height)<<1)+(4<<8);
if(s->picnum != ROTATEGUN)
{
sz -= (7<<8);
@@ -497,7 +497,7 @@
j = aim( s, AUTO_AIM_ANGLE, ps[p].auto_aim!= 0 );
if(j >= 0)
{
- dal = ((sprite[j].xrepeat*tilesDimension[sprite[j].picnum].height)<<1)+(5<<8);
+ dal = ((sprite[j].xrepeat*tiles[sprite[j].picnum].dim.height)<<1)+(5<<8);
switch(sprite[j].picnum)
{
case GREENSLIME:
@@ -726,7 +726,7 @@
j = aim( s, AUTO_AIM_ANGLE, ps[p].auto_aim==2 );
if(j >= 0)
{
- dal = ((sprite[j].xrepeat*tilesDimension[sprite[j].picnum].height)<<1)-(12<<8);
+ dal = ((sprite[j].xrepeat*tiles[sprite[j].picnum].dim.height)<<1)-(12<<8);
zvel = ((sprite[j].z-sz-dal)*vel ) / ldist(&sprite[ps[p].i], &sprite[j]) ;
sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
}
@@ -814,7 +814,7 @@
j = aim( s, 48, ps[p].auto_aim==2);
if(j >= 0)
{
- dal = ((sprite[j].xrepeat*tilesDimension[sprite[j].picnum].height)<<1)+(8<<8);
+ dal = ((sprite[j].xrepeat*tiles[sprite[j].picnum].dim.height)<<1)+(8<<8);
zvel = ( (sprite[j].z-sz-dal)*vel ) / ldist(&sprite[ps[p].i], &sprite[j]);
if( sprite[j].picnum != RECON )
sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
@@ -995,7 +995,7 @@
j = aim( s, AUTO_AIM_ANGLE, ps[p].auto_aim==2);
if(j >= 0)
{
- dal = ((sprite[j].xrepeat*tilesDimension[sprite[j].picnum].height)<<1)+(5<<8);
+ dal = ((sprite[j].xrepeat*tiles[sprite[j].picnum].dim.height)<<1)+(5<<8);
switch(sprite[j].picnum)
{
case GREENSLIME:
@@ -1086,7 +1086,7 @@
j = aim( s, AUTO_AIM_ANGLE, ps[p].auto_aim==2);
if(j >= 0)
{
- dal = ((sprite[j].xrepeat*tilesDimension[sprite[j].picnum].height)<<1);
+ dal = ((sprite[j].xrepeat*tiles[sprite[j].picnum].dim.height)<<1);
zvel = ( (sprite[j].z-sz-dal-(4<<8))*768) / (ldist( &sprite[ps[p].i], &sprite[j]));
sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
}
@@ -1227,13 +1227,13 @@
{
if(ud.screen_size > 4)
{
- rotatesprite(43<<16,(200-8-(tilesDimension[SCUBAMASK].height)<<16),65536,0,SCUBAMASK,0,p,2+16,windowx1,windowy1,windowx2,windowy2);
- rotatesprite((320-43)<<16,(200-8-(tilesDimension[SCUBAMASK].height)<<16),65536,1024,SCUBAMASK,0,p,2+4+16,windowx1,windowy1,windowx2,windowy2);
+ rotatesprite(43<<16,(200-8-(tiles[SCUBAMASK].dim.height)<<16),65536,0,SCUBAMASK,0,p,2+16,windowx1,windowy1,windowx2,windowy2);
+ rotatesprite((320-43)<<16,(200-8-(tiles[SCUBAMASK].dim.height)<<16),65536,1024,SCUBAMASK,0,p,2+4+16,windowx1,windowy1,windowx2,windowy2);
}
else
{
- rotatesprite(43<<16,(200-(tilesDimension[SCUBAMASK].height)<<16),65536,0,SCUBAMASK,0,p,2+16,windowx1,windowy1,windowx2,windowy2);
- rotatesprite((320-43)<<16,(200-(tilesDimension[SCUBAMASK].height)<<16),65536,1024,SCUBAMASK,0,p,2+4+16,windowx1,windowy1,windowx2,windowy2);
+ rotatesprite(43<<16,(200-(tiles[SCUBAMASK].dim.height)<<16),65536,0,SCUBAMASK,0,p,2+16,windowx1,windowy1,windowx2,windowy2);
+ rotatesprite((320-43)<<16,(200-(tiles[SCUBAMASK].dim.height)<<16),65536,1024,SCUBAMASK,0,p,2+4+16,windowx1,windowy1,windowx2,windowy2);
}
}
}
--- a/Game/src/premap.c
+++ b/Game/src/premap.c
@@ -51,17 +51,17 @@
case HYDRENT:
tloadtile(BROKEFIREHYDRENT);
for(j = TOILETWATER; j < (TOILETWATER+4); j++)
- if(waloff[j] == 0) tloadtile(j);
+ if(tiles[j].data == NULL) tloadtile(j);
break;
case TOILET:
tloadtile(TOILETBROKE);
for(j = TOILETWATER; j < (TOILETWATER+4); j++)
- if(waloff[j] == 0) tloadtile(j);
+ if(tiles[j].data == NULL) tloadtile(j);
break;
case STALL:
tloadtile(STALLBROKE);
for(j = TOILETWATER; j < (TOILETWATER+4); j++)
- if(waloff[j] == 0) tloadtile(j);
+ if(tiles[j].data == NULL) tloadtile(j);
break;
case RUBBERCAN:
maxc = 2;
@@ -79,10 +79,10 @@
case LIZTROOPONTOILET:
case LIZTROOPDUCKING:
for(j = LIZTROOP; j < (LIZTROOP+72); j++)
- if(waloff[j] == 0)
+ if(tiles[j].data == NULL)
tloadtile(j);
for(j=HEADJIB1;j<LEGJIB1+3;j++)
- if(waloff[j] == 0)
+ if(tiles[j].data == NULL)
tloadtile(j);
maxc = 0;
break;
@@ -89,7 +89,7 @@
case WOODENHORSE:
maxc = 5;
for(j = HORSEONSIDE; j < (HORSEONSIDE+4); j++)
- if(waloff[j] == 0)
+ if(tiles[j].data == NULL)
tloadtile(j);
break;
case NEWBEAST:
@@ -122,7 +122,7 @@
case LIZMANFEEDING:
case LIZMANJUMP:
for(j=LIZMANHEAD1;j<LIZMANLEG1+3;j++)
- if(waloff[j] == 0)
+ if(tiles[j].data == NULL)
tloadtile(j);
maxc = 80;
break;
@@ -132,7 +132,7 @@
{
maxc = 5;
for(j = 1420;j < 1420+106; j++)
- if(waloff[j] == -1)
+ if(tiles[j].data == -1)
tloadtile(j);
}
break;
@@ -154,7 +154,7 @@
}
for(j = PN; j < (PN+maxc); j++)
- if(waloff[j] == 0)
+ if(tiles[j].data == NULL)
tloadtile(j);
}
@@ -164,14 +164,14 @@
if(ud.screen_size >= 8)
{
- if(waloff[BOTTOMSTATUSBAR] == 0)
+ if(tiles[BOTTOMSTATUSBAR].data == NULL)
tloadtile(BOTTOMSTATUSBAR);
if( ud.multimode > 1)
{
- if(waloff[FRAGBAR] == 0)
+ if(tiles[FRAGBAR].data == NULL)
tloadtile(FRAGBAR);
for(i=MINIFONT;i<MINIFONT+63;i++)
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
}
}
@@ -179,55 +179,55 @@
tloadtile(VIEWSCREEN);
for(i=STARTALPHANUM;i<ENDALPHANUM+1;i++)
- if (waloff[i] == 0)
+ if (tiles[i].data == NULL)
tloadtile(i);
for(i=FOOTPRINTS;i<FOOTPRINTS+3;i++)
- if (waloff[i] == 0)
+ if (tiles[i].data == NULL)
tloadtile(i);
for( i = BIGALPHANUM; i < BIGALPHANUM+82; i++)
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
for( i = BURNING; i < BURNING+14; i++)
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
for( i = BURNING2; i < BURNING2+14; i++)
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
for( i = CRACKKNUCKLES; i < CRACKKNUCKLES+4; i++)
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
for( i = FIRSTGUN; i < FIRSTGUN+3 ; i++ )
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
for( i = EXPLOSION2; i < EXPLOSION2+21 ; i++ )
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
tloadtile(BULLETHOLE);
for( i = FIRSTGUNRELOAD; i < FIRSTGUNRELOAD+8 ; i++ )
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
tloadtile(FOOTPRINTS);
for( i = JIBS1; i < (JIBS5+5); i++)
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
for( i = SCRAP1; i < (SCRAP1+19); i++)
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
for( i = SMALLSMOKE; i < (SMALLSMOKE+4); i++)
- if(waloff[i] == 0)
+ if(tiles[i].data == NULL)
tloadtile(i);
}
@@ -284,22 +284,22 @@
cachegoodsprites();
for(i=0;i<numwalls;i++)
- if( waloff[wall[i].picnum] == 0 )
+ if( tiles[wall[i].picnum].data == NULL)
{
- if(waloff[wall[i].picnum] == 0)
+ if(tiles[wall[i].picnum].data == NULL)
tloadtile(wall[i].picnum);
- if(wall[i].overpicnum >= 0 && waloff[wall[i].overpicnum] == 0 )
+ if(wall[i].overpicnum >= 0 && tiles[wall[i].overpicnum].data == NULL )
tloadtile(wall[i].overpicnum);
}
for(i=0;i<numsectors;i++)
{
- if( waloff[sector[i].floorpicnum] == 0 )
+ if( tiles[sector[i].floorpicnum].data == NULL )
tloadtile( sector[i].floorpicnum );
- if( waloff[sector[i].ceilingpicnum] == 0 )
+ if( tiles[sector[i].ceilingpicnum].data == NULL )
{
tloadtile( sector[i].ceilingpicnum );
- if( waloff[sector[i].ceilingpicnum] == LA)
+ if( tiles[sector[i].ceilingpicnum].data == LA)
{
tloadtile(LA+1);
tloadtile(LA+2);
@@ -310,7 +310,7 @@
while(j >= 0)
{
if(sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat&32768) == 0)
- if(waloff[sprite[j].picnum] == 0)
+ if(tiles[sprite[j].picnum].data == NULL)
cachespritenum(j);
j = nextspritesect[j];
}
@@ -325,7 +325,7 @@
j = 0;
for(i=0;i<MAXTILES;i++)
- if( (gotpic[i>>3]&(1<<(i&7))) && waloff[i] == 0)
+ if( (gotpic[i>>3]&(1<<(i&7))) && tiles[i].data == NULL)
{
loadtile((short)i);
j++;
@@ -340,10 +340,10 @@
void xyzmirror(short i,short tileId)
{
- if (waloff[tileId] == 0)
+ if (tiles[tileId].data == NULL)
loadtile(tileId);
- setviewtotile(tileId,tilesDimension[tileId].height,tilesDimension[tileId].width);
+ setviewtotile(tileId,tiles[tileId].dim.height,tiles[tileId].dim.width);
drawrooms(SX,SY,SZ,SA,100+sprite[i].shade,SECT);
display_mirror = 1; animatesprites(SX,SY,SA,65536L); display_mirror = 0;
@@ -694,11 +694,11 @@
if(sector[i].ceilingstat&1)
{
- if(waloff[sector[i].ceilingpicnum] == 0)
+ if(tiles[sector[i].ceilingpicnum].data == NULL)
{
if(sector[i].ceilingpicnum == LA)
for(j=0;j<5;j++)
- if(waloff[sector[i].ceilingpicnum+j] == 0)
+ if(tiles[sector[i].ceilingpicnum+j].data == NULL)
tloadtile(sector[i].ceilingpicnum+j);
}
setupbackdrop(sector[i].ceilingpicnum);
@@ -873,7 +873,7 @@
break;
case W_FORCEFIELD:
- if(waloff[W_FORCEFIELD] == 0)
+ if(tiles[W_FORCEFIELD].data == NULL)
for(j=0;j<3;j++)
tloadtile(W_FORCEFIELD+j);
case W_FORCEFIELD+1:
@@ -901,13 +901,13 @@
{
case WATERTILE2:
for(j=0;j<3;j++)
- if(waloff[wal->picnum+j] == 0)
+ if(tiles[wal->picnum+j].data == NULL)
tloadtile(wal->picnum+j);
break;
case TECHLIGHT2:
case TECHLIGHT4:
- if(waloff[wal->picnum] == 0)
+ if(tiles[wal->picnum].data == NULL)
tloadtile(wal->picnum);
break;
case W_TECHWALL1:
@@ -921,7 +921,7 @@
case SCREENBREAK6:
case SCREENBREAK7:
case SCREENBREAK8:
- if(waloff[SCREENBREAK6] == 0)
+ if(tiles[SCREENBREAK6].data == NULL)
for(j=SCREENBREAK6;j<SCREENBREAK9;j++)
tloadtile(j);
animwall[numanimwalls].wallnum = i;
--- a/xcode/Duke3D.xcodeproj/project.pbxproj
+++ b/xcode/Duke3D.xcodeproj/project.pbxproj
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 2D058BD01686520B00E283DC /* tiles.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D058BCF1686520B00E283DC /* tiles.c */; };
2D2A07CA168286D500064107 /* filesystem.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D2A07C9168286D400064107 /* filesystem.c */; };
2D4FB6FF167D430F00915887 /* sdl_midi.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D4FB6FE167D430F00915887 /* sdl_midi.c */; };
2D7B621D1678885A00E35E54 /* draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D7B61F11678885A00E35E54 /* draw.c */; };
@@ -20,7 +21,7 @@
2D7B62251678885A00E35E54 /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D7B620D1678885A00E35E54 /* unix.c */; };
2D7B62261678885A00E35E54 /* win32.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D7B620E1678885A00E35E54 /* win32.c */; };
2D7B62271678885A00E35E54 /* engine.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D7B62101678885A00E35E54 /* engine.c */; };
- 2D7B622C1678885A00E35E54 /* pragmas.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D7B621A1678885A00E35E54 /* pragmas.c */; };
+ 2D7B622C1678885A00E35E54 /* fixedPoint_math.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D7B621A1678885A00E35E54 /* fixedPoint_math.c */; };
2D7B622D1678885A00E35E54 /* display.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D7B621C1678885A00E35E54 /* display.c */; };
2D7B623616788ACE00E35E54 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D7B623416788AB200E35E54 /* Cocoa.framework */; };
2D7B623716788AE200E35E54 /* SDL_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D7B623216788AAB00E35E54 /* SDL_mixer.framework */; };
@@ -71,6 +72,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 2D058BCD168651F700E283DC /* tiles.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = tiles.h; path = ../../Engine/src/tiles.h; sourceTree = "<group>"; };
+ 2D058BCF1686520B00E283DC /* tiles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tiles.c; path = ../../Engine/src/tiles.c; sourceTree = "<group>"; };
2D2A07B8167EFA4900064107 /* music.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = music.h; path = ../../Game/src/audiolib/music.h; sourceTree = "<group>"; };
2D2A07BA167EFB5500064107 /* premap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = premap.h; path = ../../Game/src/premap.h; sourceTree = "<group>"; };
2D2A07BB167F1ABA00064107 /* global.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = global.h; path = ../../Game/src/global.h; sourceTree = "<group>"; };
@@ -105,8 +108,8 @@
2D7B62111678885A00E35E54 /* engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = engine.h; path = ../../Engine/src/engine.h; sourceTree = "<group>"; };
2D7B62121678885A00E35E54 /* icon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = icon.h; path = ../../Engine/src/icon.h; sourceTree = "<group>"; };
2D7B62191678885A00E35E54 /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform.h; path = ../../Engine/src/platform.h; sourceTree = "<group>"; };
- 2D7B621A1678885A00E35E54 /* pragmas.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pragmas.c; path = ../../Engine/src/pragmas.c; sourceTree = "<group>"; };
- 2D7B621B1678885A00E35E54 /* pragmas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pragmas.h; path = ../../Engine/src/pragmas.h; sourceTree = "<group>"; };
+ 2D7B621A1678885A00E35E54 /* fixedPoint_math.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fixedPoint_math.c; path = ../../Engine/src/fixedPoint_math.c; sourceTree = "<group>"; };
+ 2D7B621B1678885A00E35E54 /* fixedPoint_math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fixedPoint_math.h; path = ../../Engine/src/fixedPoint_math.h; sourceTree = "<group>"; };
2D7B621C1678885A00E35E54 /* display.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = display.c; path = ../../Engine/src/display.c; sourceTree = "<group>"; };
2D7B622F1678895A00E35E54 /* macos_compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macos_compat.h; path = ../../Engine/src/macos_compat.h; sourceTree = "<group>"; };
2D7B623016788A9B00E35E54 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = "<absolute>"; };
@@ -205,7 +208,8 @@
2D7B62121678885A00E35E54 /* icon.h */,
2D7B622F1678895A00E35E54 /* macos_compat.h */,
2D7B62191678885A00E35E54 /* platform.h */,
- 2D7B621B1678885A00E35E54 /* pragmas.h */,
+ 2D7B621B1678885A00E35E54 /* fixedPoint_math.h */,
+ 2D058BCD168651F700E283DC /* tiles.h */,
);
name = headers;
sourceTree = "<group>";
@@ -220,7 +224,8 @@
2D7B61F71678885A00E35E54 /* enet */,
2D7B62101678885A00E35E54 /* engine.c */,
2D2A07C9168286D400064107 /* filesystem.c */,
- 2D7B621A1678885A00E35E54 /* pragmas.c */,
+ 2D7B621A1678885A00E35E54 /* fixedPoint_math.c */,
+ 2D058BCF1686520B00E283DC /* tiles.c */,
);
name = implementations;
sourceTree = "<group>";
@@ -471,7 +476,7 @@
2D7B62251678885A00E35E54 /* unix.c in Sources */,
2D7B62261678885A00E35E54 /* win32.c in Sources */,
2D7B62271678885A00E35E54 /* engine.c in Sources */,
- 2D7B622C1678885A00E35E54 /* pragmas.c in Sources */,
+ 2D7B622C1678885A00E35E54 /* fixedPoint_math.c in Sources */,
2D7B622D1678885A00E35E54 /* display.c in Sources */,
2D7B626E16788F9B00E35E54 /* actors.c in Sources */,
2D7B626F16788F9B00E35E54 /* animlib.c in Sources */,
@@ -505,6 +510,7 @@
2D7C17E0167ADE2000E1BBA1 /* pitch.c in Sources */,
2D4FB6FF167D430F00915887 /* sdl_midi.c in Sources */,
2D2A07CA168286D500064107 /* filesystem.c in Sources */,
+ 2D058BD01686520B00E283DC /* tiles.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};