Whitespace

git-svn-id: https://svn.eduke32.com/eduke32@109 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-04-24 19:04:22 +00:00
parent fe5671e812
commit 0d411e468e
35 changed files with 29034 additions and 29034 deletions

View file

@ -25,16 +25,16 @@ static long bpl, transmode = 0;
static long glogx, glogy, gbxinc, gbyinc, gpinc; static long glogx, glogy, gbxinc, gbyinc, gpinc;
static char *gbuf, *gpal, *ghlinepal, *gtrans; static char *gbuf, *gpal, *ghlinepal, *gtrans;
//Global variable functions //Global variable functions
void setvlinebpl(long dabpl) { bpl = dabpl; } void setvlinebpl(long dabpl) { bpl = dabpl; }
void fixtransluscence(long datransoff) { gtrans = (char *)datransoff; } void fixtransluscence(long datransoff) { gtrans = (char *)datransoff; }
void settransnormal(void) { transmode = 0; } void settransnormal(void) { transmode = 0; }
void settransreverse(void) { transmode = 1; } void settransreverse(void) { transmode = 1; }
//Ceiling/floor horizontal line functions //Ceiling/floor horizontal line functions
void sethlinesizes(long logx, long logy, long bufplc) void sethlinesizes(long logx, long logy, long bufplc)
{ glogx = logx; glogy = logy; gbuf = (char *)bufplc; } { glogx = logx; glogy = logy; gbuf = (char *)bufplc; }
void setpalookupaddress(char *paladdr) { ghlinepal = paladdr; } void setpalookupaddress(char *paladdr) { ghlinepal = paladdr; }
void setuphlineasm4(long bxinc, long byinc) { gbxinc = bxinc; gbyinc = byinc; } void setuphlineasm4(long bxinc, long byinc) { gbxinc = bxinc; gbyinc = byinc; }
void hlineasm4(long cnt, long skiploadincs, long paloffs, unsigned long by, unsigned long bx, long p) void hlineasm4(long cnt, long skiploadincs, long paloffs, unsigned long by, unsigned long bx, long p)
@ -53,7 +53,7 @@ void hlineasm4(long cnt, long skiploadincs, long paloffs, unsigned long by, unsi
} }
//Sloped ceiling/floor vertical line functions //Sloped ceiling/floor vertical line functions
void setupslopevlin(long logylogx, long bufplc, long pinc) void setupslopevlin(long logylogx, long bufplc, long pinc)
{ {
glogx = (logylogx&255); glogy = (logylogx>>8); glogx = (logylogx&255); glogy = (logylogx>>8);
@ -78,7 +78,7 @@ void slopevlin(long p, long i, long slopaloffs, long cnt, long bx, long by)
} }
//Wall,face sprite/wall sprite vertical line functions //Wall,face sprite/wall sprite vertical line functions
void setupvlineasm(long neglogy) { glogy = neglogy; } void setupvlineasm(long neglogy) { glogy = neglogy; }
void vlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p) void vlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p)
{ {
@ -136,7 +136,7 @@ void tvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufp
} }
} }
//Floor sprite horizontal line functions //Floor sprite horizontal line functions
void msethlineshift(long logx, long logy) { glogx = logx; glogy = logy; } void msethlineshift(long logx, long logy) { glogx = logx; glogy = logy; }
void mhline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned long by, long p) void mhline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned long by, long p)
{ {
@ -186,7 +186,7 @@ void thline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned lon
} }
//Rotatesprite vertical line functions //Rotatesprite vertical line functions
void setupspritevline(long paloffs, long bxinc, long byinc, long ysiz) void setupspritevline(long paloffs, long bxinc, long byinc, long ysiz)
{ {
gpal = (char *)paloffs; gpal = (char *)paloffs;
@ -206,7 +206,7 @@ void spritevline(long bx, long by, long cnt, long bufplc, long p)
} }
} }
//Rotatesprite vertical line functions //Rotatesprite vertical line functions
void msetupspritevline(long paloffs, long bxinc, long byinc, long ysiz) void msetupspritevline(long paloffs, long bxinc, long byinc, long ysiz)
{ {
gpal = (char *)paloffs; gpal = (char *)paloffs;
@ -266,7 +266,7 @@ void tspritevline(long bx, long by, long cnt, long bufplc, long p)
} }
void setupdrawslab (long dabpl, long pal) void setupdrawslab (long dabpl, long pal)
{ bpl = dabpl; gpal = (char *)pal; } { bpl = dabpl; gpal = (char *)pal; }
void drawslab (long dx, long v, long dy, long vi, long vptr, long p) void drawslab (long dx, long v, long dy, long vi, long vptr, long p)
{ {

View file

@ -22,7 +22,7 @@ struct glinfo glinfo = {
0, // non-power-of-two textures 0, // non-power-of-two textures
0, // multisampling 0, // multisampling
0, // nvidia multisampling hint 0, // nvidia multisampling hint
}; };
#endif #endif
static int osdfunc_dumpbuildinfo(const osdfuncparm_t *parm) static int osdfunc_dumpbuildinfo(const osdfuncparm_t *parm)

View file

@ -21,11 +21,11 @@ static char tempbuf[256];
#define NUMOPTIONS 9 #define NUMOPTIONS 9
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0}; char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
char keys[NUMBUILDKEYS] = char keys[NUMBUILDKEYS] =
{ {
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
0x1e,0x2c,0xd1,0xc9,0x33,0x34, 0x1e,0x2c,0xd1,0xc9,0x33,0x34,
0x9c,0x1c,0xd,0xc,0xf,0x45 0x9c,0x1c,0xd,0xc,0xf,0x45
}; };
@ -109,7 +109,7 @@ int ExtInit(void)
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
// allowtaskswitching(0); // allowtaskswitching(0);
#endif #endif
return rv; return rv;
} }
@ -173,7 +173,7 @@ void ExtPreCheckKeys(void)
if (keystatus[0xcf]) hang = max(hang-8,-182); if (keystatus[0xcf]) hang = max(hang-8,-182);
if (keystatus[0xc7]) hang = min(hang+8,182); if (keystatus[0xc7]) hang = min(hang+8,182);
} }
if (keystatus[0x4c]) { hang = 0; horiz = 100; } if (keystatus[0x4c]) { hang = 0; horiz = 100; }
if (hang != 0) if (hang != 0)
{ {
walock[4094] = 255; walock[4094] = 255;
@ -527,7 +527,7 @@ void faketimerhandler(void)
sampletimer(); sampletimer();
} }
//Just thought you might want my getnumber16 code //Just thought you might want my getnumber16 code
/* /*
getnumber16(char namestart[80], short num, long maxnumber) getnumber16(char namestart[80], short num, long maxnumber)
{ {

View file

@ -57,11 +57,11 @@ void _printmessage16(char name[82]);
long vel, svel, angvel; long vel, svel, angvel;
char buildkeys[NUMBUILDKEYS] = char buildkeys[NUMBUILDKEYS] =
{ {
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
0x1e,0x2c,0xd1,0xc9,0x33,0x34, 0x1e,0x2c,0xd1,0xc9,0x33,0x34,
0x9c,0x1c,0xd,0xc,0xf,0x45 0x9c,0x1c,0xd,0xc,0xf,0x45
}; };
long posx, posy, posz, horiz = 100; long posx, posy, posz, horiz = 100;
long mousexsurp = 0, mouseysurp = 0; long mousexsurp = 0, mouseysurp = 0;
@ -135,7 +135,7 @@ static long fillist[640];
long mousx, mousy; long mousx, mousy;
static char scantoasc[128] = static char scantoasc[128] =
{ {
0,0,'1','2','3','4','5','6','7','8','9','0','-','=',0,0, 0,0,'1','2','3','4','5','6','7','8','9','0','-','=',0,0,
'q','w','e','r','t','y','u','i','o','p','[',']',0,0,'a','s', 'q','w','e','r','t','y','u','i','o','p','[',']',0,0,'a','s',
'd','f','g','h','j','k','l',';',39,'`',0,92,'z','x','c','v', 'd','f','g','h','j','k','l',';',39,'`',0,92,'z','x','c','v',
@ -144,9 +144,9 @@ static char scantoasc[128] =
'2','3','0','.',0,0,0,0,0,0,0,0,0,0,0,0, '2','3','0','.',0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
}; };
static char scantoascwithshift[128] = static char scantoascwithshift[128] =
{ {
0,0,'!','@','#','$','%','^','&','*','(',')','_','+',0,0, 0,0,'!','@','#','$','%','^','&','*','(',')','_','+',0,0,
'Q','W','E','R','T','Y','U','I','O','P','{','}',0,0,'A','S', 'Q','W','E','R','T','Y','U','I','O','P','{','}',0,0,'A','S',
'D','F','G','H','J','K','L',':',34,'~',0,'|','Z','X','C','V', 'D','F','G','H','J','K','L',':',34,'~',0,'|','Z','X','C','V',
@ -155,7 +155,7 @@ static char scantoascwithshift[128] =
'2','3','0','.',0,0,0,0,0,0,0,0,0,0,0,0, '2','3','0','.',0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
}; };
@ -2714,7 +2714,7 @@ void overheadeditor(void)
Bsprintf(tempbuf,"Mapster32"); Bsprintf(tempbuf,"Mapster32");
printext16(9L,ydim-STATUS2DSIZ+9L,4,-1,tempbuf,0); printext16(9L,ydim-STATUS2DSIZ+9L,4,-1,tempbuf,0);
printext16(8L,ydim-STATUS2DSIZ+8L,12,-1,tempbuf,0); printext16(8L,ydim-STATUS2DSIZ+8L,12,-1,tempbuf,0);
// printmessage16("Version: "VERSION); // printmessage16("Version: "VERSION);
if (totalclock < 30) printmessage16("Press F1 for help"); if (totalclock < 30) printmessage16("Press F1 for help");
drawline16(0,ydim-1-20,xdim-1,ydim-1-20,1); drawline16(0,ydim-1-20,xdim-1,ydim-1-20,1);
drawline16(256,ydim-1-20,256,ydim-1,1); drawline16(256,ydim-1-20,256,ydim-1,1);
@ -2789,7 +2789,7 @@ void overheadeditor(void)
if (searchy < 8) searchy = 8; if (searchy < 8) searchy = 8;
if (searchy > ydim-8-1) searchy = ydim-8-1; if (searchy > ydim-8-1) searchy = ydim-8-1;
/* if (keystatus[0x3b] > 0) posx--, keystatus[0x3b] = 0; /* if (keystatus[0x3b] > 0) posx--, keystatus[0x3b] = 0;
if (keystatus[0x3c] > 0) posx++, keystatus[0x3c] = 0; if (keystatus[0x3c] > 0) posx++, keystatus[0x3c] = 0;
if (keystatus[0x3d] > 0) posy--, keystatus[0x3d] = 0; if (keystatus[0x3d] > 0) posy--, keystatus[0x3d] = 0;
if (keystatus[0x3e] > 0) posy++, keystatus[0x3e] = 0; if (keystatus[0x3e] > 0) posy++, keystatus[0x3e] = 0;
@ -3020,7 +3020,7 @@ void overheadeditor(void)
ExtCheckKeys(); // TX 20050101, it makes more sense to have this here so keys can be overwritten with new functions in bstub.c ExtCheckKeys(); // TX 20050101, it makes more sense to have this here so keys can be overwritten with new functions in bstub.c
// Flip/mirror sector Ed Coolidge // Flip/mirror sector Ed Coolidge
if (keystatus[0x2d] > 0) // X (2D) if (keystatus[0x2d] > 0) // X (2D)
{ {
if (highlightsectorcnt > 0) if (highlightsectorcnt > 0)
@ -3051,8 +3051,8 @@ void overheadeditor(void)
{ {
dax = ((dax+(1024>>grid))&(0xffffffff<<(11-grid))); dax = ((dax+(1024>>grid))&(0xffffffff<<(11-grid)));
day = ((day+(1024>>grid))&(0xffffffff<<(11-grid))); day = ((day+(1024>>grid))&(0xffffffff<<(11-grid)));
// dax = ((dax+(GRIDMAX>>grid))&(0xffffffff-(GRIDMAX>>(grid-1))+1)); // dax = ((dax+(GRIDMAX>>grid))&(0xffffffff-(GRIDMAX>>(grid-1))+1));
// day = ((day+(GRIDMAX>>grid))&(0xffffffff-(GRIDMAX>>(grid-1))+1)); // day = ((day+(GRIDMAX>>grid))&(0xffffffff-(GRIDMAX>>(grid-1))+1));
} }
for(i=0;i<highlightsectorcnt;i++) for(i=0;i<highlightsectorcnt;i++)
@ -3063,14 +3063,14 @@ void overheadeditor(void)
long numtoswap = -1; long numtoswap = -1;
long w=0; long w=0;
walltype tempwall; walltype tempwall;
/* /*
if (k != 0) if (k != 0)
{ {
//mirror sector textures //mirror sector textures
sector[highlightsector[i]].ceilingstat ^= 0x10; sector[highlightsector[i]].ceilingstat ^= 0x10;
sector[highlightsector[i]].floorstat ^= 0x10; sector[highlightsector[i]].floorstat ^= 0x10;
} }
*/ */
//save position of wall at start of loop //save position of wall at start of loop
x3 = wall[startofloop].x; x3 = wall[startofloop].x;
y3 = wall[startofloop].y; y3 = wall[startofloop].y;
@ -3168,8 +3168,8 @@ void overheadeditor(void)
{ {
dax = ((dax+(1024>>grid))&(0xffffffff<<(11-grid))); dax = ((dax+(1024>>grid))&(0xffffffff<<(11-grid)));
day = ((day+(1024>>grid))&(0xffffffff<<(11-grid))); day = ((day+(1024>>grid))&(0xffffffff<<(11-grid)));
// dax = ((dax+(GRIDMAX>>grid))&(0xffffffff-(GRIDMAX>>(grid-1))+1)); // dax = ((dax+(GRIDMAX>>grid))&(0xffffffff-(GRIDMAX>>(grid-1))+1));
// day = ((day+(GRIDMAX>>grid))&(0xffffffff-(GRIDMAX>>(grid-1))+1)); // day = ((day+(GRIDMAX>>grid))&(0xffffffff-(GRIDMAX>>(grid-1))+1));
} }
for(i=0;i<highlightsectorcnt;i++) for(i=0;i<highlightsectorcnt;i++)
@ -3180,14 +3180,14 @@ void overheadeditor(void)
long numtoswap = -1; long numtoswap = -1;
long w=0; long w=0;
walltype tempwall; walltype tempwall;
/* /*
if (k != 0) if (k != 0)
{ {
//mirror sector textures //mirror sector textures
sector[highlightsector[i]].ceilingstat ^= 0x10; sector[highlightsector[i]].ceilingstat ^= 0x10;
sector[highlightsector[i]].floorstat ^= 0x10; sector[highlightsector[i]].floorstat ^= 0x10;
} }
*/ */
//save position of wall at start of loop //save position of wall at start of loop
x3 = wall[startofloop].x; x3 = wall[startofloop].x;
y3 = wall[startofloop].y; y3 = wall[startofloop].y;
@ -3254,7 +3254,7 @@ void overheadeditor(void)
asksave = 1; asksave = 1;
} }
} }
// end edit for sector flip // end edit for sector flip
if (keystatus[88] > 0) //F12 if (keystatus[88] > 0) //F12
{ {
@ -5388,7 +5388,7 @@ void overheadeditor(void)
else else
printmessage16("Arrow must be inside a sector before entering 3D mode."); printmessage16("Arrow must be inside a sector before entering 3D mode.");
} }
CANCEL: CANCEL:
if (keystatus[1] > 0) if (keystatus[1] > 0)
{ {
keystatus[1] = 0; keystatus[1] = 0;
@ -6251,7 +6251,7 @@ void clearmidstatbar16(void)
{ {
begindrawing(); begindrawing();
ydim16 = ydim; ydim16 = ydim;
// clearbuf((char *)(frameplace + (bytesperline*(ydim-STATUS2DSIZ+25L))),(bytesperline*(STATUS2DSIZ-1-(25<<1))) >> 2, 0x08080808l); // clearbuf((char *)(frameplace + (bytesperline*(ydim-STATUS2DSIZ+25L))),(bytesperline*(STATUS2DSIZ-1-(25<<1))) >> 2, 0x08080808l);
clearbuf((char *)(frameplace + (bytesperline*(ydim-STATUS2DSIZ+25L))),(bytesperline*(STATUS2DSIZ+2-(25<<1))) >> 2, 0x00000000l); clearbuf((char *)(frameplace + (bytesperline*(ydim-STATUS2DSIZ+25L))),(bytesperline*(STATUS2DSIZ+2-(25<<1))) >> 2, 0x00000000l);
drawline16(0,ydim-STATUS2DSIZ,0,ydim-1,7); drawline16(0,ydim-STATUS2DSIZ,0,ydim-1,7);
drawline16(xdim-1,ydim-STATUS2DSIZ,xdim-1,ydim-1,7); drawline16(xdim-1,ydim-STATUS2DSIZ,xdim-1,ydim-1,7);
@ -7114,7 +7114,7 @@ void showwalldata(short wallnum)
day = wall[wallnum].y-wall[wall[wallnum].point2].y; day = wall[wallnum].y-wall[wall[wallnum].point2].y;
dist = ksqrt(dax*dax+day*day); dist = ksqrt(dax*dax+day*day);
// TX 20050102 I'm not sure what unit dist<<4 is supposed to be, but dist itself is correct in terms of game coordinates as one would expect // TX 20050102 I'm not sure what unit dist<<4 is supposed to be, but dist itself is correct in terms of game coordinates as one would expect
Bsprintf(snotbuf,"Wall length: %ld",dist); Bsprintf(snotbuf,"Wall length: %ld",dist);
printext16(400,ydim-STATUS2DSIZ+96,11,-1,snotbuf,0); printext16(400,ydim-STATUS2DSIZ+96,11,-1,snotbuf,0);
@ -7196,7 +7196,7 @@ void keytimerstuff(void)
} }
if (keystatus[buildkeys[0]] > 0) vel = min(vel+8,127); if (keystatus[buildkeys[0]] > 0) vel = min(vel+8,127);
if (keystatus[buildkeys[1]] > 0) vel = max(vel-8,-128); if (keystatus[buildkeys[1]] > 0) vel = max(vel-8,-128);
/* if (keystatus[buildkeys[12]] > 0) svel = min(svel+8,127); /* if (keystatus[buildkeys[12]] > 0) svel = min(svel+8,127);
if (keystatus[buildkeys[13]] > 0) svel = max(svel-8,-128); */ if (keystatus[buildkeys[13]] > 0) svel = max(svel-8,-128); */
if (angvel < 0) angvel = min(angvel+12,0); if (angvel < 0) angvel = min(angvel+12,0);
@ -7259,7 +7259,7 @@ void printmessage256(char name[82])
printext256(0L,0L,whitecol,-1,snotbuf,0); printext256(0L,0L,whitecol,-1,snotbuf,0);
} }
//Find closest point (*dax, *day) on wall (dawall) to (x, y) //Find closest point (*dax, *day) on wall (dawall) to (x, y)
void getclosestpointonwall(long x, long y, long dawall, long *nx, long *ny) void getclosestpointonwall(long x, long y, long dawall, long *nx, long *ny)
{ {
walltype *wal; walltype *wal;

View file

@ -15,8 +15,8 @@
#ifdef WITHKPLIB #ifdef WITHKPLIB
#include "kplib.h" #include "kplib.h"
//Insert '|' in front of filename //Insert '|' in front of filename
//Doing this tells kzopen to load the file only if inside a .ZIP file //Doing this tells kzopen to load the file only if inside a .ZIP file
static long kzipopen(char *filnam) static long kzipopen(char *filnam)
{ {
unsigned int i; unsigned int i;
@ -164,7 +164,7 @@ void allocache(long *newhandle, long newbytes, char *newlockptr)
return; return;
} }
if (*cac[bestz].lock == 0) { cac[bestz].leng += sucklen; return; } if (*cac[bestz].lock == 0) { cac[bestz].leng += sucklen; return; }
cacnum++; if (cacnum > MAXCACHEOBJECTS) reportandexit("Too many objects in cache! (cacnum > MAXCACHEOBJECTS)"); cacnum++; if (cacnum > MAXCACHEOBJECTS) reportandexit("Too many objects in cache! (cacnum > MAXCACHEOBJECTS)");
for(z=cacnum-1;z>bestz;z--) cac[z] = cac[z-1]; for(z=cacnum-1;z>bestz;z--) cac[z] = cac[z-1];
@ -309,7 +309,7 @@ int findfrompath(const char *fn, char **where)
allocsiz += 1; // a nul allocsiz += 1; // a nul
pfn = (char *)malloc(allocsiz); pfn = (char *)malloc(allocsiz);
if (!pfn) { free(ffn); return -1; } if (!pfn) { free(ffn); return -1; }
strcpy(pfn, "./"); strcpy(pfn, "./");
strcat(pfn, ffn); strcat(pfn, ffn);
@ -377,7 +377,7 @@ BFILE* fopenfrompath(const char *fn, const char *mode)
#define MAXOPENFILES 64 //Warning: Fix filehan if this is changed #define MAXOPENFILES 64 //Warning: Fix filehan if this is changed
static char toupperlookup[256] = static char toupperlookup[256] =
{ {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
@ -394,7 +394,7 @@ static char toupperlookup[256] =
0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, 0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf,
0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef, 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
}; };
static long numgroupfiles = 0; static long numgroupfiles = 0;
static long gnumfiles[MAXGROUPFILES]; static long gnumfiles[MAXGROUPFILES];
@ -406,12 +406,12 @@ static long *gfileoffs[MAXGROUPFILES];
static char filegrp[MAXOPENFILES]; static char filegrp[MAXOPENFILES];
static long filepos[MAXOPENFILES]; static long filepos[MAXOPENFILES];
static long filehan[MAXOPENFILES] = static long filehan[MAXOPENFILES] =
{ {
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
}; };
#ifdef WITHKPLIB #ifdef WITHKPLIB
static char filenamsav[MAXOPENFILES][260]; static char filenamsav[MAXOPENFILES][260];
static long kzcurhand = -1; static long kzcurhand = -1;
@ -436,7 +436,7 @@ long initgroupfile(char *filename)
// check to see if the file passed is a ZIP and pass it on to kplib if it is // check to see if the file passed is a ZIP and pass it on to kplib if it is
i = Bopen(zfn,BO_BINARY|BO_RDONLY,BS_IREAD); i = Bopen(zfn,BO_BINARY|BO_RDONLY,BS_IREAD);
if (i < 0) { free(zfn); return -1; } if (i < 0) { free(zfn); return -1; }
Bread(i, buf, 4); Bread(i, buf, 4);
if (buf[0] == 0x50 && buf[1] == 0x4B && buf[2] == 0x03 && buf[3] == 0x04) { if (buf[0] == 0x50 && buf[1] == 0x4B && buf[2] == 0x03 && buf[3] == 0x04) {
@ -1021,7 +1021,7 @@ failure:
return NULL; return NULL;
} }
//Internal LZW variables //Internal LZW variables
#define LZWSIZE 16384 //Watch out for shorts! #define LZWSIZE 16384 //Watch out for shorts!
static char *lzwbuf1, *lzwbuf4, *lzwbuf5, lzwbuflock[5]; static char *lzwbuf1, *lzwbuf4, *lzwbuf5, lzwbuflock[5];
static short *lzwbuf2, *lzwbuf3; static short *lzwbuf2, *lzwbuf3;
@ -1042,7 +1042,7 @@ int kdfread(void *buffer, bsize_t dasizeof, bsize_t count, long fil)
if (lzwbuf4 == NULL) allocache((long *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); if (lzwbuf4 == NULL) allocache((long *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]);
if (lzwbuf5 == NULL) allocache((long *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); if (lzwbuf5 == NULL) allocache((long *)&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;
if (kread(fil,&leng,2) != 2) return -1; leng = B_LITTLE16(leng); if (kread(fil,&leng,2) != 2) return -1; leng = B_LITTLE16(leng);
@ -1081,7 +1081,7 @@ int dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
if (lzwbuf4 == NULL) allocache((long *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); if (lzwbuf4 == NULL) allocache((long *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]);
if (lzwbuf5 == NULL) allocache((long *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); if (lzwbuf5 == NULL) allocache((long *)&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;
if (Bfread(&leng,2,1,fil) != 1) return -1; leng = B_LITTLE16(leng); if (Bfread(&leng,2,1,fil) != 1) return -1; leng = B_LITTLE16(leng);
@ -1120,7 +1120,7 @@ void kdfwrite(void *buffer, bsize_t dasizeof, bsize_t count, long fil)
if (lzwbuf4 == NULL) allocache((long *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); if (lzwbuf4 == NULL) allocache((long *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]);
if (lzwbuf5 == NULL) allocache((long *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); if (lzwbuf5 == NULL) allocache((long *)&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;
copybufbyte(ptr,lzwbuf4,(long)dasizeof); copybufbyte(ptr,lzwbuf4,(long)dasizeof);
@ -1164,7 +1164,7 @@ void dfwrite(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
if (lzwbuf4 == NULL) allocache((long *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); if (lzwbuf4 == NULL) allocache((long *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]);
if (lzwbuf5 == NULL) allocache((long *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); if (lzwbuf5 == NULL) allocache((long *)&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;
copybufbyte(ptr,lzwbuf4,(long)dasizeof); copybufbyte(ptr,lzwbuf4,(long)dasizeof);

View file

@ -327,13 +327,13 @@ char *Bgethomedir(void)
#ifdef _WIN32 #ifdef _WIN32
TCHAR appdata[MAX_PATH]; TCHAR appdata[MAX_PATH];
//# if defined SHGetFolderPath //# if defined SHGetFolderPath
// if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, appdata))) // if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, appdata)))
//# if defined SHGetSpecialFolderPath //# if defined SHGetSpecialFolderPath
if (SUCCEEDED(SHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE))) if (SUCCEEDED(SHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE)))
//# else //# else
//# error Cannot find SHGetFolderPath or SHGetSpecialFolderPath. Perhaps your shlobj.h is ancient? //# error Cannot find SHGetFolderPath or SHGetSpecialFolderPath. Perhaps your shlobj.h is ancient?
//# endif //# endif
return strdup(appdata); return strdup(appdata);
return NULL; return NULL;
#else #else
@ -371,7 +371,7 @@ int Bcorrectfilename(char *filename, int removefn)
else tokarr[ntok++] = token; else tokarr[ntok++] = token;
} while (1); } while (1);
if (!trailslash && removefn) { ntok = max(0,ntok-1); trailslash = 1; } if (!trailslash && removefn) { ntok = max(0,ntok-1); trailslash = 1; }
if (ntok == 0 && trailslash && leadslash) trailslash = 0; if (ntok == 0 && trailslash && leadslash) trailslash = 0;
first = filename; first = filename;
@ -565,11 +565,11 @@ struct Bdirent* Breaddir(BDIR *dir)
} else { } else {
dirr->status++; dirr->status++;
} }
//# if defined(__WATCOMC__) || defined(__linux) || defined(__BEOS__) || defined(__QNX__) || defined(SKYOS) //# if defined(__WATCOMC__) || defined(__linux) || defined(__BEOS__) || defined(__QNX__) || defined(SKYOS)
dirr->info.namlen = strlen(de->d_name); dirr->info.namlen = strlen(de->d_name);
//# else //# else
// dirr->info.namlen = de->d_namlen; // dirr->info.namlen = de->d_namlen;
//# endif //# endif
dirr->info.name = de->d_name; dirr->info.name = de->d_name;
#endif #endif
dirr->info.mode = 0; dirr->info.mode = 0;
@ -633,9 +633,9 @@ char *Bstrtoken(char *s, char *delim, char **ptrptr, int chop)
} }
//Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher //Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher
//Given: string i and string j. string j can have wildcards //Given: string i and string j. string j can have wildcards
//Returns: 1:matches, 0:doesn't match //Returns: 1:matches, 0:doesn't match
long Bwildmatch (const char *i, const char *j) long Bwildmatch (const char *i, const char *j)
{ {
const char *k; const char *k;
@ -668,7 +668,7 @@ char *Bstrlwr(char *s)
{ {
char *t = s; char *t = s;
if (!s) return s; if (!s) return s;
while (*t) { *t = Btolower(*t); t++; } while (*t) { *t = Btolower(*t); t++; }
return s; return s;
} }
@ -676,7 +676,7 @@ char *Bstrupr(char *s)
{ {
char *t = s; char *t = s;
if (!s) return s; if (!s) return s;
while (*t) { *t = Btoupper(*t); t++; } while (*t) { *t = Btoupper(*t); t++; }
return s; return s;
} }
#endif #endif

View file

@ -106,7 +106,7 @@ int loadsetup(const char *fn)
if ((fp = Bfopen(fn, "rt")) == NULL) return -1; if ((fp = Bfopen(fn, "rt")) == NULL) return -1;
if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; } if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; }
if (readconfig(fp, "resolution", val, VL) > 0) { if (readconfig(fp, "resolution", val, VL) > 0) {
i = Batoi(val) & 0x0f; i = Batoi(val) & 0x0f;
if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; } if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; }
@ -120,10 +120,10 @@ int loadsetup(const char *fn)
if (readconfig(fp, "xdim3d", val, VL) > 0) xdimgame = Batoi(val); if (readconfig(fp, "xdim3d", val, VL) > 0) xdimgame = Batoi(val);
if (readconfig(fp, "ydim3d", val, VL) > 0) ydimgame = Batoi(val); if (readconfig(fp, "ydim3d", val, VL) > 0) ydimgame = Batoi(val);
if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4; if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4;
if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; } if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; } if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val); if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); } if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); }
if (readconfig(fp, "brightness", val, VL) > 0) brightness = min(max(Batoi(val),0),15); if (readconfig(fp, "brightness", val, VL) > 0) brightness = min(max(Batoi(val),0),15);
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
@ -176,7 +176,7 @@ int loadsetup(const char *fn)
if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); } if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); }
if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL); if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL);

View file

@ -65,7 +65,7 @@ enum {
typedef struct { char *text; int tokenid; } tokenlist; typedef struct { char *text; int tokenid; } tokenlist;
static tokenlist basetokens[] = static tokenlist basetokens[] =
{ {
{ "include", T_INCLUDE }, { "include", T_INCLUDE },
{ "#include", T_INCLUDE }, { "#include", T_INCLUDE },
{ "define", T_DEFINE }, { "define", T_DEFINE },
@ -104,7 +104,7 @@ static tokenlist basetokens[] =
{ "2dcol", T_2DCOL }, { "2dcol", T_2DCOL },
{ "fogpal", T_FOGPAL }, { "fogpal", T_FOGPAL },
{ "loadgrp", T_LOADGRP }, { "loadgrp", T_LOADGRP },
}; };
static tokenlist modeltokens[] = { static tokenlist modeltokens[] = {
{ "scale", T_SCALE }, { "scale", T_SCALE },
@ -114,7 +114,7 @@ static tokenlist modeltokens[] = {
{ "anim", T_ANIM }, { "anim", T_ANIM },
{ "skin", T_SKIN }, { "skin", T_SKIN },
{ "hud", T_HUD }, { "hud", T_HUD },
}; };
static tokenlist modelframetokens[] = { static tokenlist modelframetokens[] = {
{ "frame", T_FRAME }, { "frame", T_FRAME },
@ -122,21 +122,21 @@ static tokenlist modelframetokens[] = {
{ "tile", T_TILE }, { "tile", T_TILE },
{ "tile0", T_TILE0 }, { "tile0", T_TILE0 },
{ "tile1", T_TILE1 }, { "tile1", T_TILE1 },
}; };
static tokenlist modelanimtokens[] = { static tokenlist modelanimtokens[] = {
{ "frame0", T_FRAME0 }, { "frame0", T_FRAME0 },
{ "frame1", T_FRAME1 }, { "frame1", T_FRAME1 },
{ "fps", T_FPS }, { "fps", T_FPS },
{ "flags", T_FLAGS }, { "flags", T_FLAGS },
}; };
static tokenlist modelskintokens[] = { static tokenlist modelskintokens[] = {
{ "pal", T_PAL }, { "pal", T_PAL },
{ "file", T_FILE }, { "file", T_FILE },
{ "surf", T_SURF }, { "surf", T_SURF },
{ "surface",T_SURF }, { "surface",T_SURF },
}; };
static tokenlist modelhudtokens[] = { static tokenlist modelhudtokens[] = {
{ "tile", T_TILE }, { "tile", T_TILE },
@ -150,14 +150,14 @@ static tokenlist modelhudtokens[] = {
{ "nobob", T_NOBOB }, { "nobob", T_NOBOB },
{ "flipped",T_FLIPPED}, { "flipped",T_FLIPPED},
{ "nodepth",T_NODEPTH}, { "nodepth",T_NODEPTH},
}; };
static tokenlist voxeltokens[] = { static tokenlist voxeltokens[] = {
{ "tile", T_TILE }, { "tile", T_TILE },
{ "tile0", T_TILE0 }, { "tile0", T_TILE0 },
{ "tile1", T_TILE1 }, { "tile1", T_TILE1 },
{ "scale", T_SCALE }, { "scale", T_SCALE },
}; };
static tokenlist skyboxtokens[] = { static tokenlist skyboxtokens[] = {
{ "tile" ,T_TILE }, { "tile" ,T_TILE },
@ -168,7 +168,7 @@ static tokenlist skyboxtokens[] = {
{ "lf" ,T_LEFT },{ "left" ,T_LEFT },{ "lt" ,T_LEFT }, { "lf" ,T_LEFT },{ "left" ,T_LEFT },{ "lt" ,T_LEFT },
{ "up" ,T_TOP },{ "top" ,T_TOP },{ "ceiling",T_TOP },{ "ceil" ,T_TOP }, { "up" ,T_TOP },{ "top" ,T_TOP },{ "ceiling",T_TOP },{ "ceil" ,T_TOP },
{ "dn" ,T_BOTTOM },{ "bottom" ,T_BOTTOM },{ "floor" ,T_BOTTOM },{ "down" ,T_BOTTOM } { "dn" ,T_BOTTOM },{ "bottom" ,T_BOTTOM },{ "floor" ,T_BOTTOM },{ "down" ,T_BOTTOM }
}; };
static tokenlist tinttokens[] = { static tokenlist tinttokens[] = {
{ "pal", T_PAL }, { "pal", T_PAL },
@ -176,16 +176,16 @@ static tokenlist tinttokens[] = {
{ "green", T_GREEN },{ "g", T_GREEN }, { "green", T_GREEN },{ "g", T_GREEN },
{ "blue", T_BLUE },{ "b", T_BLUE }, { "blue", T_BLUE },{ "b", T_BLUE },
{ "flags", T_FLAGS } { "flags", T_FLAGS }
}; };
static tokenlist texturetokens[] = { static tokenlist texturetokens[] = {
{ "pal", T_PAL }, { "pal", T_PAL },
}; };
static tokenlist texturetokens_pal[] = { static tokenlist texturetokens_pal[] = {
{ "file", T_FILE },{ "name", T_FILE }, { "file", T_FILE },{ "name", T_FILE },
{ "alphacut", T_ALPHACUT }, { "alphacut", T_ALPHACUT },
{ "nocompress",T_NOCOMPRESS }, { "nocompress",T_NOCOMPRESS },
}; };
static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens) static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens)
{ {
@ -214,7 +214,7 @@ extern char vgapal16[4*256];
static const char *skyfaces[6] = { static const char *skyfaces[6] = {
"front face", "right face", "back face", "front face", "right face", "back face",
"left face", "top face", "bottom face" "left face", "top face", "bottom face"
}; };
static int defsparser(scriptfile *script) static int defsparser(scriptfile *script)
{ {

View file

@ -56,7 +56,7 @@ long usevoxels = 1;
long novoxmips = 0; long novoxmips = 0;
long editorgridextent = 131072; long editorgridextent = 131072;
//These variables need to be copied into BUILD //These variables need to be copied into BUILD
#define MAXXSIZ 256 #define MAXXSIZ 256
#define MAXYSIZ 256 #define MAXYSIZ 256
#define MAXZSIZ 255 #define MAXZSIZ 255
@ -77,7 +77,7 @@ static long oxdimen = -1, oviewingrange = -1, oxyaspect = -1;
long curbrightness = 0, gammabrightness = 0; long curbrightness = 0, gammabrightness = 0;
//Textured Map variables //Textured Map variables
static char globalpolytype; static char globalpolytype;
static short *dotp1[MAXYDIM], *dotp2[MAXYDIM]; static short *dotp1[MAXYDIM], *dotp2[MAXYDIM];
@ -102,7 +102,7 @@ static short radarang[1280], radarang2[MAXXDIM];
static unsigned short sqrtable[4096], shlookup[4096+256]; static unsigned short sqrtable[4096], shlookup[4096+256];
char pow2char[8] = {1,2,4,8,16,32,64,128}; char pow2char[8] = {1,2,4,8,16,32,64,128};
long pow2long[32] = long pow2long[32] =
{ {
1L,2L,4L,8L, 1L,2L,4L,8L,
16L,32L,64L,128L, 16L,32L,64L,128L,
256L,512L,1024L,2048L, 256L,512L,1024L,2048L,
@ -111,7 +111,7 @@ long pow2long[32] =
1048576L,2097152L,4194304L,8388608L, 1048576L,2097152L,4194304L,8388608L,
16777216L,33554432L,67108864L,134217728L, 16777216L,33554432L,67108864L,134217728L,
268435456L,536870912L,1073741824L,2147483647L 268435456L,536870912L,1073741824L,2147483647L
}; };
long reciptable[2048], fpuasm; long reciptable[2048], fpuasm;
char britable[16][256]; // JBF 20040207: full 8bit precision char britable[16][256]; // JBF 20040207: full 8bit precision
@ -234,7 +234,7 @@ unsigned long nsqrtasm(unsigned long);
modify exact [eax ebx ecx] modify exact [eax ebx ecx]
long msqrtasm(unsigned long); long msqrtasm(unsigned long);
//0x007ff000 is (11<<13), 0x3f800000 is (127<<23) //0x007ff000 is (11<<13), 0x3f800000 is (127<<23)
#pragma aux krecipasm =\ #pragma aux krecipasm =\
"mov fpuasm, eax",\ "mov fpuasm, eax",\
"fild dword ptr fpuasm",\ "fild dword ptr fpuasm",\
@ -350,7 +350,7 @@ static inline long msqrtasm(long c)
} }
} }
//0x007ff000 is (11<<13), 0x3f800000 is (127<<23) //0x007ff000 is (11<<13), 0x3f800000 is (127<<23)
static inline long krecipasm(long a) static inline long krecipasm(long a)
{ {
_asm { _asm {
@ -372,7 +372,7 @@ static inline long krecipasm(long a)
xor eax, ebx xor eax, ebx
pop ebx pop ebx
} }
} }
static inline void setgotpic(long a) static inline void setgotpic(long a)
{ {
@ -415,7 +415,7 @@ static inline long getclipmask(long a, long b, long c, long d)
xor eax, ebx xor eax, ebx
pop ebx pop ebx
} }
} }
static inline long getkensmessagecrc(void *b) static inline long getkensmessagecrc(void *b)
{ {
@ -460,7 +460,7 @@ static inline long getkensmessagecrc(void *b)
: "=a" (__r) : "a" (__a) : "ebx", "ecx", "cc"); \ : "=a" (__r) : "a" (__a) : "ebx", "ecx", "cc"); \
__r; }) __r; })
// edx is blown by this code somehow?! // edx is blown by this code somehow?!
#define msqrtasm(c) \ #define msqrtasm(c) \
({ long __r, __c=(c); \ ({ long __r, __c=(c); \
__asm__ __volatile__ ( \ __asm__ __volatile__ ( \
@ -642,12 +642,12 @@ short numscans, numhits, numbunches;
static short posfil, capturecount = 0, hitcnt; static short posfil, capturecount = 0, hitcnt;
char vgapal16[4*256] = char vgapal16[4*256] =
{ {
00,00,00,00, 42,00,00,00, 00,42,00,00, 42,42,00,00, 00,00,42,00, 00,00,00,00, 42,00,00,00, 00,42,00,00, 42,42,00,00, 00,00,42,00,
42,00,42,00, 00,21,42,00, 42,42,42,00, 21,21,21,00, 63,21,21,00, 42,00,42,00, 00,21,42,00, 42,42,42,00, 21,21,21,00, 63,21,21,00,
21,63,21,00, 63,63,21,00, 21,21,63,00, 63,21,63,00, 21,63,63,00, 21,63,21,00, 63,63,21,00, 21,21,63,00, 63,21,63,00, 21,63,63,00,
63,63,63,00 63,63,63,00
}; };
short editstatus = 0; short editstatus = 0;
short searchit; short searchit;
@ -1587,7 +1587,7 @@ static void ceilscan(long x1, long x2, long sectnum)
globaly1 = mulscale16(globaly1,viewingrangerecip); globaly1 = mulscale16(globaly1,viewingrangerecip);
globalxshift = (8-(picsiz[globalpicnum]&15)); globalxshift = (8-(picsiz[globalpicnum]&15));
globalyshift = (8-(picsiz[globalpicnum]>>4)); globalyshift = (8-(picsiz[globalpicnum]>>4));
if (globalorientation&8) { globalxshift++; globalyshift++; } if (globalorientation&8) { globalxshift++; globalyshift++; }
if ((globalorientation&0x4) > 0) if ((globalorientation&0x4) > 0)
{ {
@ -1758,7 +1758,7 @@ static void florscan(long x1, long x2, long sectnum)
globaly1 = mulscale16(globaly1,viewingrangerecip); globaly1 = mulscale16(globaly1,viewingrangerecip);
globalxshift = (8-(picsiz[globalpicnum]&15)); globalxshift = (8-(picsiz[globalpicnum]&15));
globalyshift = (8-(picsiz[globalpicnum]>>4)); globalyshift = (8-(picsiz[globalpicnum]>>4));
if (globalorientation&8) { globalxshift++; globalyshift++; } if (globalorientation&8) { globalxshift++; globalyshift++; }
if ((globalorientation&0x4) > 0) if ((globalorientation&0x4) > 0)
{ {
@ -2058,7 +2058,7 @@ static void transmaskvline2(long x)
short y1ve[2], y2ve[2]; short y1ve[2], y2ve[2];
if ((x < 0) || (x >= xdimen)) return; if ((x < 0) || (x >= xdimen)) return;
if (x == xdimen-1) { transmaskvline(x); return; } if (x == xdimen-1) { transmaskvline(x); return; }
x2 = x+1; x2 = x+1;
@ -2916,7 +2916,7 @@ static void drawvox(long dasprx, long daspry, long dasprz, long dasprang,
if (novoxmips) i = 0; if (novoxmips) i = 0;
davoxptr = (char *)voxoff[daindex][i]; davoxptr = (char *)voxoff[daindex][i];
if (!davoxptr && i > 0) { davoxptr = (char *)voxoff[daindex][0]; i = 0; } if (!davoxptr && i > 0) { davoxptr = (char *)voxoff[daindex][0]; i = 0; }
if (!davoxptr) return; if (!davoxptr) return;
if (voxscale[daindex] == 65536) if (voxscale[daindex] == 65536)
@ -4453,8 +4453,8 @@ static long clippoly(long npoints, long clipstat)
// //
// clippoly4 (internal) // clippoly4 (internal)
// //
//Assume npoints=4 with polygon on &nrx1,&nry1 //Assume npoints=4 with polygon on &nrx1,&nry1
//JBF 20031206: Thanks to Ken's hunting, s/(rx1|ry1|rx2|ry2)/n\1/ in this function //JBF 20031206: Thanks to Ken's hunting, s/(rx1|ry1|rx2|ry2)/n\1/ in this function
static long clippoly4(long cx1, long cy1, long cx2, long cy2) static long clippoly4(long cx1, long cy1, long cx2, long cy2)
{ {
long n, nn, z, zz, x, x1, x2, y, y1, y2, t; long n, nn, z, zz, x, x1, x2, y, y1, y2, t;
@ -4510,7 +4510,7 @@ static long clippoly4(long cx1, long cy1, long cx2, long cy2)
// //
// dorotatesprite (internal) // dorotatesprite (internal)
// //
//JBF 20031206: Thanks to Ken's hunting, s/(rx1|ry1|rx2|ry2)/n\1/ in this function //JBF 20031206: Thanks to Ken's hunting, s/(rx1|ry1|rx2|ry2)/n\1/ in this function
static void dorotatesprite(long sx, long sy, long z, short a, short picnum, signed char dashade, char dapalnum, char dastat, long cx1, long cy1, long cx2, long cy2, long uniqid) static void dorotatesprite(long sx, long sy, long z, short a, short picnum, signed char dashade, char dapalnum, char dastat, long cx1, long cy1, long cx2, long cy2, long uniqid)
{ {
long cosang, sinang, v, nextv, dax1, dax2, oy, bx, by, ny1, ny2; long cosang, sinang, v, nextv, dax1, dax2, oy, bx, by, ny1, ny2;
@ -4531,7 +4531,7 @@ static void dorotatesprite(long sx, long sy, long z, short a, short picnum, sign
if (cy2 > yres-1) cy2 = yres-1; if (cy2 > yres-1) cy2 = yres-1;
xsiz = tilesizx[picnum]; ysiz = tilesizy[picnum]; xsiz = tilesizx[picnum]; ysiz = tilesizy[picnum];
if (dastat&16) { xoff = 0; yoff = 0; } if (dastat&16) { xoff = 0; yoff = 0; }
else else
{ {
xoff = (long)((signed char)((picanm[picnum]>>8)&255))+(xsiz>>1); xoff = (long)((signed char)((picanm[picnum]>>8)&255))+(xsiz>>1);
@ -4646,7 +4646,7 @@ static void dorotatesprite(long sx, long sy, long z, short a, short picnum, sign
by = dmulscale16(x,yv2,y,yv); by = dmulscale16(x,yv2,y,yv);
if (dastat&4) { yv = -yv; yv2 = -yv2; by = (ysiz<<16)-1-by; } if (dastat&4) { yv = -yv; yv2 = -yv2; by = (ysiz<<16)-1-by; }
/* if (origbuffermode == 0) /* if (origbuffermode == 0)
{ {
if (dastat&128) if (dastat&128)
{ {
@ -4963,7 +4963,7 @@ static void dorotatesprite(long sx, long sy, long z, short a, short picnum, sign
#endif #endif
/* if ((dastat&128) && (origbuffermode == 0)) /* if ((dastat&128) && (origbuffermode == 0))
{ {
buffermode = obuffermode; buffermode = obuffermode;
setactivepage(activepage); setactivepage(activepage);
@ -5565,7 +5565,7 @@ void uninitengine(void)
uninitsystem(); uninitsystem();
if (artfil != -1) kclose(artfil); if (artfil != -1) kclose(artfil);
if (transluc != NULL) { kkfree(transluc); transluc = NULL; } if (transluc != NULL) { kkfree(transluc); transluc = NULL; }
if (pic != NULL) { kkfree(pic); pic = NULL; } if (pic != NULL) { kkfree(pic); pic = NULL; }
if (lookups != NULL) if (lookups != NULL)
{ {
@ -6843,7 +6843,7 @@ long loadoldboard(char *filename, char fromwhere, long *daposx, long *daposy, lo
} }
kread(fil,&numwalls,2); numwalls = B_LITTLE16(numwalls); kread(fil,&numwalls,2); numwalls = B_LITTLE16(numwalls);
if (numwalls > MAXWALLS) { kclose(fil); return(-1); } if (numwalls > MAXWALLS) { kclose(fil); return(-1); }
for (i=0; i<numwalls; i++) { for (i=0; i<numwalls; i++) {
switch (mapversion) { switch (mapversion) {
case 5: kread(fil,&v5wall,sizeof(struct walltypev5)); case 5: kread(fil,&v5wall,sizeof(struct walltypev5));
@ -6882,7 +6882,7 @@ long loadoldboard(char *filename, char fromwhere, long *daposx, long *daposy, lo
} }
kread(fil,&numsprites,2); numsprites = B_LITTLE16(numsprites); kread(fil,&numsprites,2); numsprites = B_LITTLE16(numsprites);
if (numsprites > MAXSPRITES) { kclose(fil); return(-1); } if (numsprites > MAXSPRITES) { kclose(fil); return(-1); }
for (i=0; i<numsprites; i++) { for (i=0; i<numsprites; i++) {
switch (mapversion) { switch (mapversion) {
case 5: kread(fil,&v5spr,sizeof(struct spritetypev5)); case 5: kread(fil,&v5spr,sizeof(struct spritetypev5));
@ -7159,8 +7159,8 @@ long setgamemode(char davidoption, long daxdim, long daydim, long dabpp)
return(0); return(0);
strcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI. (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!"); strcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI. (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!");
// if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4) // if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4)
// { printOSD("Nice try.\n"); exit(0); } // { printOSD("Nice try.\n"); exit(0); }
//if (checkvideomode(&daxdim, &daydim, dabpp, davidoption)<0) return (-1); //if (checkvideomode(&daxdim, &daydim, dabpp, davidoption)<0) return (-1);
@ -7205,7 +7205,7 @@ long setgamemode(char davidoption, long daxdim, long daydim, long dabpp)
clearallviews(0L); clearallviews(0L);
setbrightness((char)curbrightness,(char *)&palette[0],0); setbrightness((char)curbrightness,(char *)&palette[0],0);
if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); } if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); }
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
if (rendmode == 3) { if (rendmode == 3) {
@ -9529,7 +9529,7 @@ char getpixel(long x, long y)
} }
//MUST USE RESTOREFORDRAWROOMS AFTER DRAWING //MUST USE RESTOREFORDRAWROOMS AFTER DRAWING
// //
// setviewtotile // setviewtotile
@ -9653,7 +9653,7 @@ void completemirror(void)
#endif #endif
//Can't reverse with uninitialized data //Can't reverse with uninitialized data
if (inpreparemirror) { inpreparemirror = 0; return; } if (inpreparemirror) { inpreparemirror = 0; return; }
if (mirrorsx1 > 0) mirrorsx1--; if (mirrorsx1 > 0) mirrorsx1--;
if (mirrorsx2 < windowx2-windowx1-1) mirrorsx2++; if (mirrorsx2 < windowx2-windowx1-1) mirrorsx2++;
if (mirrorsx2 < mirrorsx1) return; if (mirrorsx2 < mirrorsx1) return;

View file

@ -125,11 +125,11 @@ static long fvel2, svel2, avel2;
#define NUMKEYS 19 #define NUMKEYS 19
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0}; char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0};
char keys[NUMKEYS] = char keys[NUMKEYS] =
{ {
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
0x1e,0x2c,0xd1,0xc9,0x33,0x34, 0x1e,0x2c,0xd1,0xc9,0x33,0x34,
0x9c,0x1c,0xd,0xc,0xf 0x9c,0x1c,0xd,0xc,0xf
}; };
long xdimgame = 320, ydimgame = 200, bppgame = 8, xdim2d = 640, ydim2d = 480; // JBF 20050318: config.c expects to find these long xdimgame = 320, ydimgame = 200, bppgame = 8, xdim2d = 640, ydim2d = 480; // JBF 20050318: config.c expects to find these
static long digihz[8] = {6000,8000,11025,16000,22050,32000,44100,48000}; static long digihz[8] = {6000,8000,11025,16000,22050,32000,44100,48000};
@ -146,7 +146,7 @@ static long lavadropx[LAVAMAXDROPS], lavadropy[LAVAMAXDROPS];
static long lavadropsiz[LAVAMAXDROPS], lavadropsizlookup[LAVAMAXDROPS]; static long lavadropsiz[LAVAMAXDROPS], lavadropsizlookup[LAVAMAXDROPS];
static long lavaradx[24][96], lavarady[24][96], lavaradcnt[32]; static long lavaradx[24][96], lavarady[24][96], lavaradcnt[32];
//Shared player variables //Shared player variables
static long posx[MAXPLAYERS], posy[MAXPLAYERS], posz[MAXPLAYERS]; static long posx[MAXPLAYERS], posy[MAXPLAYERS], posz[MAXPLAYERS];
static long horiz[MAXPLAYERS], zoom[MAXPLAYERS], hvel[MAXPLAYERS]; static long horiz[MAXPLAYERS], zoom[MAXPLAYERS], hvel[MAXPLAYERS];
static short ang[MAXPLAYERS], cursectnum[MAXPLAYERS], ocursectnum[MAXPLAYERS]; static short ang[MAXPLAYERS], cursectnum[MAXPLAYERS], ocursectnum[MAXPLAYERS];
@ -162,7 +162,7 @@ static char revolvedoorstat[MAXPLAYERS];
static short revolvedoorang[MAXPLAYERS], revolvedoorrotang[MAXPLAYERS]; static short revolvedoorang[MAXPLAYERS], revolvedoorrotang[MAXPLAYERS];
static long revolvedoorx[MAXPLAYERS], revolvedoory[MAXPLAYERS]; static long revolvedoorx[MAXPLAYERS], revolvedoory[MAXPLAYERS];
//ENGINE CONTROLLED MULTIPLAYER VARIABLES: //ENGINE CONTROLLED MULTIPLAYER VARIABLES:
extern long numplayers, myconnectindex; extern long numplayers, myconnectindex;
extern long connecthead, connectpoint2[MAXPLAYERS]; //Player linked list variables (indeces, not connection numbers) extern long connecthead, connectpoint2[MAXPLAYERS]; //Player linked list variables (indeces, not connection numbers)
@ -173,15 +173,15 @@ static long nummoves;
#define NUMSTATS 13 #define NUMSTATS 13
static signed char statrate[NUMSTATS] = {-1,0,-1,0,0,0,1,3,0,3,15,-1,-1}; static signed char statrate[NUMSTATS] = {-1,0,-1,0,0,0,1,3,0,3,15,-1,-1};
//Input structures //Input structures
static char networkmode; //0 is 2(n-1) mode, 1 is n(n-1) mode static char networkmode; //0 is 2(n-1) mode, 1 is n(n-1) mode
static long locselectedgun, locselectedgun2; static long locselectedgun, locselectedgun2;
static input loc, oloc, loc2; static input loc, oloc, loc2;
static input ffsync[MAXPLAYERS], osync[MAXPLAYERS], ssync[MAXPLAYERS]; static input ffsync[MAXPLAYERS], osync[MAXPLAYERS], ssync[MAXPLAYERS];
//Input faketimerhandler -> movethings fifo //Input faketimerhandler -> movethings fifo
static long movefifoplc, movefifoend[MAXPLAYERS]; static long movefifoplc, movefifoend[MAXPLAYERS];
static input baksync[MOVEFIFOSIZ][MAXPLAYERS]; static input baksync[MOVEFIFOSIZ][MAXPLAYERS];
//Game recording variables //Game recording variables
static long reccnt, recstat = 1; static long reccnt, recstat = 1;
static input recsync[16384][2]; static input recsync[16384][2];
@ -197,9 +197,9 @@ static long myxbak[MOVEFIFOSIZ], myybak[MOVEFIFOSIZ], myzbak[MOVEFIFOSIZ];
static long myhorizbak[MOVEFIFOSIZ]; static long myhorizbak[MOVEFIFOSIZ];
static short myangbak[MOVEFIFOSIZ]; static short myangbak[MOVEFIFOSIZ];
//MULTI.OBJ sync state variables //MULTI.OBJ sync state variables
extern char syncstate; extern char syncstate;
//GAME.C sync state variables //GAME.C sync state variables
static char syncstat, syncval[MOVEFIFOSIZ], othersyncval[MOVEFIFOSIZ]; static char syncstat, syncval[MOVEFIFOSIZ], othersyncval[MOVEFIFOSIZ];
static long syncvaltottail, syncvalhead, othersyncvalhead, syncvaltail; static long syncvaltottail, syncvalhead, othersyncvalhead, syncvaltail;
@ -221,7 +221,7 @@ extern long cachecount;
static char playerreadyflag[MAXPLAYERS]; static char playerreadyflag[MAXPLAYERS];
//Miscellaneous variables //Miscellaneous variables
static char packbuf[MAXXDIM]; static char packbuf[MAXXDIM];
static char tempbuf[MAXXDIM], boardfilename[80]; static char tempbuf[MAXXDIM], boardfilename[80];
static short tempshort[MAXSECTORS]; static short tempshort[MAXSECTORS];
@ -233,10 +233,10 @@ static long lockclock, neartagdist, neartaghitdist;
extern long pageoffset, ydim16; extern long pageoffset, ydim16;
static long globhiz, globloz, globhihit, globlohit; static long globhiz, globloz, globhihit, globlohit;
//Over the shoulder mode variables //Over the shoulder mode variables
static long cameradist = -1, cameraang = 0, cameraclock = 0; static long cameradist = -1, cameraang = 0, cameraclock = 0;
//Board animation variables //Board animation variables
#define MAXMIRRORS 64 #define MAXMIRRORS 64
static short mirrorwall[MAXMIRRORS], mirrorsector[MAXMIRRORS], mirrorcnt; static short mirrorwall[MAXMIRRORS], mirrorsector[MAXMIRRORS], mirrorcnt;
static short floormirrorsector[64], floormirrorcnt; static short floormirrorsector[64], floormirrorcnt;
@ -262,7 +262,7 @@ static long subwayx[4], subwaygoalstop[4], subwayvel[4], subwaypausetime[4];
static short waterfountainwall[MAXPLAYERS], waterfountaincnt[MAXPLAYERS]; static short waterfountainwall[MAXPLAYERS], waterfountaincnt[MAXPLAYERS];
static short slimesoundcnt[MAXPLAYERS]; static short slimesoundcnt[MAXPLAYERS];
//Variables that let you type messages to other player //Variables that let you type messages to other player
static char getmessage[162], getmessageleng; static char getmessage[162], getmessageleng;
static long getmessagetimeoff; static long getmessagetimeoff;
static char typemessage[162], typemessageleng = 0, typemode = 0; static char typemessage[162], typemessageleng = 0, typemode = 0;
@ -291,15 +291,15 @@ static char scantoascwithshift[128] =
}; };
*/ */
//These variables are for animating x, y, or z-coordinates of sectors, //These variables are for animating x, y, or z-coordinates of sectors,
//walls, or sprites (They are NOT to be used for changing the [].picnum's) //walls, or sprites (They are NOT to be used for changing the [].picnum's)
//See the setanimation(), and getanimategoal() functions for more details. //See the setanimation(), and getanimategoal() functions for more details.
#define MAXANIMATES 512 #define MAXANIMATES 512
static long *animateptr[MAXANIMATES], animategoal[MAXANIMATES]; static long *animateptr[MAXANIMATES], animategoal[MAXANIMATES];
static long animatevel[MAXANIMATES], animateacc[MAXANIMATES], animatecnt = 0; static long animatevel[MAXANIMATES], animateacc[MAXANIMATES], animatecnt = 0;
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
//These parameters are in exact order of sprite structure in BUILD.H //These parameters are in exact order of sprite structure in BUILD.H
#define spawnsprite(newspriteindex2,x2,y2,z2,cstat2,shade2,pal2, \ #define spawnsprite(newspriteindex2,x2,y2,z2,cstat2,shade2,pal2, \
clipdist2,xrepeat2,yrepeat2,xoffset2,yoffset2,picnum2,ang2, \ clipdist2,xrepeat2,yrepeat2,xoffset2,yoffset2,picnum2,ang2, \
xvel2,yvel2,zvel2,owner2,sectnum2,statnum2,lotag2,hitag2,extra2) \ xvel2,yvel2,zvel2,owner2,sectnum2,statnum2,lotag2,hitag2,extra2) \
@ -605,7 +605,7 @@ long app_main(long argc, char *argv[])
OSD_DispatchQueued(); OSD_DispatchQueued();
// backslash (useful only with KDM) // backslash (useful only with KDM)
// if (keystatus[0x2b]) { keystatus[0x2b] = 0; preparesndbuf(); } // if (keystatus[0x2b]) { keystatus[0x2b] = 0; preparesndbuf(); }
if ((networkmode == 1) || (myconnectindex != connecthead)) if ((networkmode == 1) || (myconnectindex != connecthead))
while (fakemovefifoplc != movefifoend[myconnectindex]) fakedomovethings(); while (fakemovefifoplc != movefifoend[myconnectindex]) fakedomovethings();
@ -2738,9 +2738,9 @@ void statuslistcode(void)
if ((sprite[hitobject&4095].lotag == 5) && (sprite[i].picnum == GRABBER)) { // Basketball hoop (Andy's addition) if ((sprite[hitobject&4095].lotag == 5) && (sprite[i].picnum == GRABBER)) { // Basketball hoop (Andy's addition)
wsayfollow("niceshot.wav",3840L+(krand()&127)-64,256L,&sprite[i].x,&sprite[i].y,0); wsayfollow("niceshot.wav",3840L+(krand()&127)-64,256L,&sprite[i].x,&sprite[i].y,0);
switch (krand() & 63) { switch (krand() & 63) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9:
sprite[i].picnum = COIN; break; sprite[i].picnum = COIN; break;
case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 10: case 11: case 12: case 13: case 14: case 15: case 16:
sprite[i].picnum = DIAMONDS; break; sprite[i].picnum = DIAMONDS; break;
case 17: case 18: case 19: case 17: case 18: case 19:
sprite[i].picnum = COINSTACK; break; sprite[i].picnum = COINSTACK; break;
@ -4074,18 +4074,18 @@ void drawscreen(short snum, long dasmoothratio)
if (syncstat != 0) printext256(68L,84L,31,0,"OUT OF SYNC!",0); if (syncstat != 0) printext256(68L,84L,31,0,"OUT OF SYNC!",0);
if (syncstate != 0) printext256(68L,92L,31,0,"Missed Network packet!",0); if (syncstate != 0) printext256(68L,92L,31,0,"Missed Network packet!",0);
// //Uncomment this to test cache locks // //Uncomment this to test cache locks
//extern long cacnum; //extern long cacnum;
//typedef struct { long *hand, leng; char *lock; } cactype; //typedef struct { long *hand, leng; char *lock; } cactype;
//extern cactype cac[]; //extern cactype cac[];
// //
// j = 0; // j = 0;
// for(i=0;i<cacnum;i++) // for(i=0;i<cacnum;i++)
// if ((*cac[i].lock) >= 200) // if ((*cac[i].lock) >= 200)
// { // {
// Bsprintf(tempbuf,"Locked- %ld: Leng:%ld, Lock:%ld",i,cac[i].leng,*cac[i].lock); // Bsprintf(tempbuf,"Locked- %ld: Leng:%ld, Lock:%ld",i,cac[i].leng,*cac[i].lock);
// printext256(0L,j,31,-1,tempbuf,1); j += 6; // printext256(0L,j,31,-1,tempbuf,1); j += 6;
// } // }
nextpage(); // send completed frame to display nextpage(); // send completed frame to display
@ -4332,7 +4332,7 @@ void fakedomovethings(void)
fakemovefifoplc = (fakemovefifoplc+1)&(MOVEFIFOSIZ-1); fakemovefifoplc = (fakemovefifoplc+1)&(MOVEFIFOSIZ-1);
} }
//Prediction correction //Prediction correction
void fakedomovethingscorrect(void) void fakedomovethingscorrect(void)
{ {
long i; long i;
@ -4554,12 +4554,12 @@ void getinput(void)
oldmousebstatus &= ~1; //Allow continous fire with mouse for chain gun oldmousebstatus &= ~1; //Allow continous fire with mouse for chain gun
//PRIVATE KEYS: //PRIVATE KEYS:
/* if (keystatus[0xb7]) //Printscreen /* if (keystatus[0xb7]) //Printscreen
{ {
keystatus[0xb7] = 0; keystatus[0xb7] = 0;
printscreeninterrupt(); printscreeninterrupt();
} }
*/ */
if (keystatus[0x2f]) //V if (keystatus[0x2f]) //V
{ {
keystatus[0x2f] = 0; keystatus[0x2f] = 0;
@ -4940,7 +4940,7 @@ inline long addlava(long b)
add al, byte ptr [ebx+1] add al, byte ptr [ebx+1]
add al, dl add al, dl
} }
} }
#elif defined(__GNUC__) && defined(__i386__) #elif defined(__GNUC__) && defined(__i386__)
inline long addlava(long b) inline long addlava(long b)
{ {
@ -6031,10 +6031,10 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang)
} }
} }
//New movesprite using getzrange. Note that I made the getzrange //New movesprite using getzrange. Note that I made the getzrange
//parameters global (&globhiz,&globhihit,&globloz,&globlohit) so they //parameters global (&globhiz,&globhihit,&globloz,&globlohit) so they
//don't need to be passed everywhere. Also this should make this //don't need to be passed everywhere. Also this should make this
//movesprite function compatible with the older movesprite functions. //movesprite function compatible with the older movesprite functions.
long movesprite(short spritenum, long dx, long dy, long dz, long ceildist, long flordist, long clipmask) long movesprite(short spritenum, long dx, long dy, long dz, long ceildist, long flordist, long clipmask)
{ {
long daz, zoffs, tempint; long daz, zoffs, tempint;

View file

@ -55,7 +55,7 @@ static unsigned short SSWAPIL (unsigned short a) { return((a>>8)+(a<<8)); }
#include <dirent.h> #include <dirent.h>
typedef long long __int64; typedef long long __int64;
static __inline long _lrotl (long i, int sh) static __inline long _lrotl (long i, int sh)
{ return((i>>(-sh))|(i<<sh)); } { return((i>>(-sh))|(i<<sh)); }
static __inline long filelength (int h) static __inline long filelength (int h)
{ {
struct stat st; struct stat st;
@ -88,7 +88,7 @@ static __inline long filelength (int h)
#define _inline inline #define _inline inline
#endif #endif
//use GCC-specific extension to force symbol name to be something in particular to override underscoring. //use GCC-specific extension to force symbol name to be something in particular to override underscoring.
#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM) #if defined(__GNUC__) && defined(__i386__) && !defined(NOASM)
#define ASMNAME(x) asm(x) #define ASMNAME(x) asm(x)
#else #else
@ -98,7 +98,7 @@ static __inline long filelength (int h)
static long frameplace, bytesperline, xres, yres, globxoffs, globyoffs; static long frameplace, bytesperline, xres, yres, globxoffs, globyoffs;
static const long pow2mask[32] = static const long pow2mask[32] =
{ {
0x00000000,0x00000001,0x00000003,0x00000007, 0x00000000,0x00000001,0x00000003,0x00000007,
0x0000000f,0x0000001f,0x0000003f,0x0000007f, 0x0000000f,0x0000001f,0x0000003f,0x0000007f,
0x000000ff,0x000001ff,0x000003ff,0x000007ff, 0x000000ff,0x000001ff,0x000003ff,0x000007ff,
@ -107,9 +107,9 @@ static const long pow2mask[32] =
0x000fffff,0x001fffff,0x003fffff,0x007fffff, 0x000fffff,0x001fffff,0x003fffff,0x007fffff,
0x00ffffff,0x01ffffff,0x03ffffff,0x07ffffff, 0x00ffffff,0x01ffffff,0x03ffffff,0x07ffffff,
0x0fffffff,0x1fffffff,0x3fffffff,0x7fffffff, 0x0fffffff,0x1fffffff,0x3fffffff,0x7fffffff,
}; };
static const long pow2long[32] = static const long pow2long[32] =
{ {
0x00000001,0x00000002,0x00000004,0x00000008, 0x00000001,0x00000002,0x00000004,0x00000008,
0x00000010,0x00000020,0x00000040,0x00000080, 0x00000010,0x00000020,0x00000040,0x00000080,
0x00000100,0x00000200,0x00000400,0x00000800, 0x00000100,0x00000200,0x00000400,0x00000800,
@ -118,11 +118,11 @@ static const long pow2long[32] =
0x00100000,0x00200000,0x00400000,0x00800000, 0x00100000,0x00200000,0x00400000,0x00800000,
0x01000000,0x02000000,0x04000000,0x08000000, 0x01000000,0x02000000,0x04000000,0x08000000,
0x10000000,0x20000000,0x40000000,0x80000000, 0x10000000,0x20000000,0x40000000,0x80000000,
}; };
//Hack for peekbits,getbits,suckbits (to prevent lots of duplicate code) //Hack for peekbits,getbits,suckbits (to prevent lots of duplicate code)
// 0: PNG: do 12-byte chunk_header removal hack // 0: PNG: do 12-byte chunk_header removal hack
// !=0: ZIP: use 64K buffer (olinbuf) // !=0: ZIP: use 64K buffer (olinbuf)
static long zipfilmode; static long zipfilmode;
typedef struct typedef struct
{ {
@ -168,7 +168,7 @@ unsigned char coltype, bitdepth;
// * 16-bit color depth // * 16-bit color depth
// * Some useless ancillary chunks, like: gAMA(gamma) & pHYs(aspect ratio) // * Some useless ancillary chunks, like: gAMA(gamma) & pHYs(aspect ratio)
//.PNG specific variables: //.PNG specific variables:
static long bakcol = 0xff808080, bakr = 0x80, bakg = 0x80, bakb = 0x80; //this used to be public... static long bakcol = 0xff808080, bakr = 0x80, bakg = 0x80, bakb = 0x80; //this used to be public...
static long gslidew = 0, gslider = 0, xm, xmn[4], xr0, xr1, xplc, yplc, nfplace; static long gslidew = 0, gslider = 0, xm, xmn[4], xr0, xr1, xplc, yplc, nfplace;
static long clen[320], cclen[19], bitpos, filt, xsiz, ysiz; static long clen[320], cclen[19], bitpos, filt, xsiz, ysiz;
@ -180,7 +180,7 @@ static unsigned char slidebuf[32768], opixbuf0[4], opixbuf1[4];
static unsigned char pnginited = 0, olinbuf[65536] ASMNAME("olinbuf"); //WARNING:max xres is: 65536/bpp-1 static unsigned char pnginited = 0, olinbuf[65536] ASMNAME("olinbuf"); //WARNING:max xres is: 65536/bpp-1
static long gotcmov = -2, abstab10[1024] ASMNAME("abstab10"); static long gotcmov = -2, abstab10[1024] ASMNAME("abstab10");
//Variables to speed up dynamic Huffman decoding: //Variables to speed up dynamic Huffman decoding:
#define LOGQHUFSIZ0 9 #define LOGQHUFSIZ0 9
#define LOGQHUFSIZ1 6 #define LOGQHUFSIZ1 6
static long qhufval0[1<<LOGQHUFSIZ0], qhufval1[1<<LOGQHUFSIZ1]; static long qhufval0[1<<LOGQHUFSIZ0], qhufval1[1<<LOGQHUFSIZ1];
@ -324,7 +324,7 @@ static _inline void cpuid (long a, long *s)
static inline unsigned long bswap (unsigned long a) static inline unsigned long bswap (unsigned long a)
{ {
__asm__ __volatile__ ("bswap %0" : "+r" (a) : : "cc" ); __asm__ __volatile__ ("bswap %0" : "+r" (a) : : "cc" );
return a; return a;
} }
@ -362,8 +362,8 @@ static inline void cpuid (long a, long *s)
#endif #endif
//Bit numbers of return value: //Bit numbers of return value:
//0:FPU, 4:RDTSC, 15:CMOV, 22:MMX+, 23:MMX, 25:SSE, 26:SSE2, 30:3DNow!+, 31:3DNow! //0:FPU, 4:RDTSC, 15:CMOV, 22:MMX+, 23:MMX, 25:SSE, 26:SSE2, 30:3DNow!+, 31:3DNow!
static long getcputype () static long getcputype ()
{ {
long i, cpb[4], cpid[4]; long i, cpb[4], cpid[4];
@ -433,7 +433,7 @@ static long hufgetsym (long *hitab, long *hbmax)
return(hitab[hbmax[n]+v]); return(hitab[hbmax[n]+v]);
} }
//This did not result in a speed-up on P4-3.6Ghz (02/22/2005) //This did not result in a speed-up on P4-3.6Ghz (02/22/2005)
//static long hufgetsym_skipb (long *hitab, long *hbmax, long n, long addit) //static long hufgetsym_skipb (long *hitab, long *hbmax, long n, long addit)
//{ //{
// long v; // long v;
@ -486,10 +486,10 @@ static void qhufgencode (long *hitab, long *hbmax, long *qhval, unsigned char *q
//return(k); //return(k);
} }
//inbuf[inum] : Bit length of each symbol //inbuf[inum] : Bit length of each symbol
//inum : Number of indices //inum : Number of indices
//hitab[inum] : Indices from size-ordered list to original symbol //hitab[inum] : Indices from size-ordered list to original symbol
//hbmax[0-31] : Highest index (+1) of n-bit symbol //hbmax[0-31] : Highest index (+1) of n-bit symbol
static void hufgencode (long *inbuf, long inum, long *hitab, long *hbmax) static void hufgencode (long *inbuf, long inum, long *hitab, long *hbmax)
{ {
long i, tbuf[31]; long i, tbuf[31];
@ -547,7 +547,7 @@ static long initpass () //Interlaced images have 7 "passes", non-interlaced have
xr0 = ixsiz-xr0; xr0 = ixsiz-xr0;
xr1 = ixsiz-xr1; xr1 = ixsiz-xr1;
if (coltype == 4) { xr0 = xr0*2; xr1 = xr1*2; } if (coltype == 4) { xr0 = xr0*2; xr1 = xr1*2; }
else if (coltype == 2) { xr0 = xr0*3-2; xr1 = xr1*3-2; } else if (coltype == 2) { xr0 = xr0*3-2; xr1 = xr1*3-2; }
else if (coltype == 6) { xr0 = xr0*4-2; xr1 = xr1*4-2; } else if (coltype == 6) { xr0 = xr0*4-2; xr1 = xr1*4-2; }
else else
@ -605,7 +605,7 @@ static inline void pal8hlineasm (long x, long xr1, long p, long ixstp)
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)
//NOTE: cmov now has correctly ordered registers (thx to bug fix in 11.0c!) //NOTE: cmov now has correctly ordered registers (thx to bug fix in 11.0c!)
long Paeth686 (long, long, long); long Paeth686 (long, long, long);
#pragma aux Paeth686 =\ #pragma aux Paeth686 =\
".686"\ ".686"\
@ -624,7 +624,7 @@ long Paeth686 (long, long, long);
modify exact [ecx edx esi edi]\ modify exact [ecx edx esi edi]\
value [ecx] value [ecx]
//Note: "cmove eax,?" may be faster than "jne ?:and eax,?" but who cares //Note: "cmove eax,?" may be faster than "jne ?:and eax,?" but who cares
void rgbhlineasm (long, long, long, long); void rgbhlineasm (long, long, long, long);
#pragma aux rgbhlineasm =\ #pragma aux rgbhlineasm =\
"sub ecx, edx"\ "sub ecx, edx"\
@ -723,7 +723,7 @@ static _inline void rgbhlineasm (long c, long d, long t, long b)
jnz short begit2 jnz short begit2
endit: endit:
} }
} }
static _inline void pal8hlineasm (long c, long d, long t, long b) static _inline void pal8hlineasm (long c, long d, long t, long b)
{ {
@ -744,7 +744,7 @@ static _inline void pal8hlineasm (long c, long d, long t, long b)
jnz short begit jnz short begit
endit: endit:
} }
} }
#elif defined(__GNUC__) && defined(__i386__) #elif defined(__GNUC__) && defined(__i386__)
@ -761,7 +761,7 @@ static inline long Paeth686 (long a, long b, long c)
return c; return c;
} }
//Note: "cmove eax,?" may be faster than "jne ?:and eax,?" but who cares //Note: "cmove eax,?" may be faster than "jne ?:and eax,?" but who cares
static inline void rgbhlineasm (long c, long d, long t, long b) static inline void rgbhlineasm (long c, long d, long t, long b)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
@ -1187,10 +1187,10 @@ static long kpngrend (const char *kfilebuf, long kfilength,
//============================= KPNGILIB ends ================================ //============================= KPNGILIB ends ================================
//============================ KPEGILIB begins =============================== //============================ KPEGILIB begins ===============================
//11/01/2000: This code was originally from KPEG.C //11/01/2000: This code was originally from KPEG.C
// All non 32-bit color drawing was removed // All non 32-bit color drawing was removed
// "Motion" JPG code was removed // "Motion" JPG code was removed
// A lot of parameters were added to kpeg() for library usage // A lot of parameters were added to kpeg() for library usage
static long kpeginited = 0; static long kpeginited = 0;
static long clipxdim, clipydim; static long clipxdim, clipydim;
@ -1514,7 +1514,7 @@ static long kpegrend (const char *kfilebuf, long kfilength,
//printf("fileoffs=%08x, marker=%02x,leng=%d",((long)kfileptr)-((long)kfilebuf)-2,marker,leng); //printf("fileoffs=%08x, marker=%02x,leng=%d",((long)kfileptr)-((long)kfilebuf)-2,marker,leng);
switch(marker) switch(marker)
{ {
case 0xc0: case 0xc1: case 0xc2: case 0xc0: case 0xc1: case 0xc2:
//processit! //processit!
kfileptr++; //numbits = *kfileptr++; kfileptr++; //numbits = *kfileptr++;
@ -1894,7 +1894,7 @@ static long kgifrend (const char *kfilebuf, long kfilelength,
(kfilebuf[2] != 'F') || (kfilebuf[12])) return(-1); (kfilebuf[2] != 'F') || (kfilebuf[12])) return(-1);
paleng = (1<<((kfilebuf[10]&7)+1)); paleng = (1<<((kfilebuf[10]&7)+1));
ptr = (unsigned char *)&kfilebuf[13]; ptr = (unsigned char *)&kfilebuf[13];
if (kfilebuf[10]&128) { cptr = ptr; ptr += paleng*3; } if (kfilebuf[10]&128) { cptr = ptr; ptr += paleng*3; }
transcol = -1; transcol = -1;
while ((chunkind = *ptr++) == '!') while ((chunkind = *ptr++) == '!')
{ //! 0xf9 leng flags ?? ?? transcol { //! 0xf9 leng flags ?? ?? transcol
@ -1908,7 +1908,7 @@ static long kgifrend (const char *kfilebuf, long kfilelength,
yoff = SSWAPIB(*(unsigned short *)&ptr[2]); yoff = SSWAPIB(*(unsigned short *)&ptr[2]);
xspan = SSWAPIB(*(unsigned short *)&ptr[4]); xspan = SSWAPIB(*(unsigned short *)&ptr[4]);
yspan = SSWAPIB(*(unsigned short *)&ptr[6]); ptr += 9; yspan = SSWAPIB(*(unsigned short *)&ptr[6]); ptr += 9;
if (ptr[-1]&64) { yinc = 8; ilacefirst = 1; } if (ptr[-1]&64) { yinc = 8; ilacefirst = 1; }
else { yinc = 1; ilacefirst = 0; } else { yinc = 1; ilacefirst = 0; }
if (ptr[-1]&128) if (ptr[-1]&128)
{ {
@ -2017,10 +2017,10 @@ static long kgifrend (const char *kfilebuf, long kfilelength,
//=============================== GIF ends ================================== //=============================== GIF ends ==================================
//============================== CEL begins ================================= //============================== CEL begins =================================
// //old .CEL format: // //old .CEL format:
//short id = 0x9119, xdim, ydim, xoff, yoff, id = 0x0008; //short id = 0x9119, xdim, ydim, xoff, yoff, id = 0x0008;
//long imagebytes, filler[4]; //long imagebytes, filler[4];
//char pal6bit[256][3], image[ydim][xdim]; //char pal6bit[256][3], image[ydim][xdim];
static long kcelrend (const char *buf, long fleng, static long kcelrend (const char *buf, long fleng,
long daframeplace, long dabytesperline, long daxres, long dayres, long daframeplace, long dabytesperline, long daxres, long dayres,
long daglobxoffs, long daglobyoffs) long daglobxoffs, long daglobyoffs)
@ -2089,11 +2089,11 @@ static long ktgarend (const char *header, long fleng,
{ {
case 1: coltype = 0; bitdepth = 8; palcol[0] = LSWAPIB(0xff000000); case 1: coltype = 0; bitdepth = 8; palcol[0] = LSWAPIB(0xff000000);
for(i=1;i<256;i++) palcol[i] = palcol[i-1]+LSWAPIB(0x10101); break; for(i=1;i<256;i++) palcol[i] = palcol[i-1]+LSWAPIB(0x10101); break;
case 2: case 3: coltype = 2; break; case 2: case 3: coltype = 2; break;
case 4: coltype = 6; break; case 4: coltype = 6; break;
} }
if (!(header[17]&16)) { x0 = 0; x1 = xsiz; xi = 1; } if (!(header[17]&16)) { x0 = 0; x1 = xsiz; xi = 1; }
else { x0 = xsiz-1; x1 = -1; xi =-1; } else { x0 = xsiz-1; x1 = -1; xi =-1; }
if (header[17]&32) { y0 = 0; y1 = ysiz; yi = 1; pi = dabytesperline; } if (header[17]&32) { y0 = 0; y1 = ysiz; yi = 1; pi = dabytesperline; }
else { y0 = ysiz-1; y1 = -1; yi =-1; pi =-dabytesperline; } else { y0 = ysiz-1; y1 = -1; yi =-1; pi =-dabytesperline; }
@ -2136,24 +2136,24 @@ static long ktgarend (const char *header, long fleng,
//============================== TARGA ends ================================= //============================== TARGA ends =================================
//============================== BMP begins ================================= //============================== BMP begins =================================
//TODO: handle BI_RLE8 and BI_RLE4 (compression types 1&2 respectively) //TODO: handle BI_RLE8 and BI_RLE4 (compression types 1&2 respectively)
// ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ // ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
// ³ 0(2): "BM" ³ // ³ 0(2): "BM" ³
// ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿³ 10(4): rastoff³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ // ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿³ 10(4): rastoff³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
// ³headsiz=12 (OS/2 1.x)³³ 14(4): headsiz³ ³ All new formats: ³ // ³headsiz=12 (OS/2 1.x)³³ 14(4): headsiz³ ³ All new formats: ³
//ÚÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÁÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÁÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ //ÚÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÁÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÁÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ 18(2): xsiz ³ 18(4): xsiz ³ //³ 18(2): xsiz ³ 18(4): xsiz ³
//³ 20(2): ysiz ³ 22(4): ysiz ³ //³ 20(2): ysiz ³ 22(4): ysiz ³
//³ 22(2): planes (always 1) ³ 26(2): planes (always 1) ³ //³ 22(2): planes (always 1) ³ 26(2): planes (always 1) ³
//³ 24(2): cdim (1,4,8,24) ³ 28(2): cdim (1,4,8,16,24,32) ³ //³ 24(2): cdim (1,4,8,24) ³ 28(2): cdim (1,4,8,16,24,32) ³
//³ if (cdim < 16) ³ 30(4): compression (0,1,2,3!?,4) ³ //³ if (cdim < 16) ³ 30(4): compression (0,1,2,3!?,4) ³
//³ 26(rastoff-14-headsiz): pal(bgr) ³ 34(4): (bitmap data size+3)&3 ³ //³ 26(rastoff-14-headsiz): pal(bgr) ³ 34(4): (bitmap data size+3)&3 ³
//³ ³ 46(4): N colors (0=2^cdim) ³ //³ ³ 46(4): N colors (0=2^cdim) ³
//³ ³ if (cdim < 16) ³ //³ ³ if (cdim < 16) ³
//³ ³ 14+headsiz(rastoff-14-headsiz): pal(bgr0) ³ //³ ³ 14+headsiz(rastoff-14-headsiz): pal(bgr0) ³
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ //ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
// ³ rastoff(?): bitmap data ³ // ³ rastoff(?): bitmap data ³
// ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ // ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
static long kbmprend (const char *buf, long fleng, static long kbmprend (const char *buf, long fleng,
long daframeplace, long dabytesperline, long daxres, long dayres, long daframeplace, long dabytesperline, long daxres, long dayres,
long daglobxoffs, long daglobyoffs) long daglobxoffs, long daglobyoffs)
@ -2227,7 +2227,7 @@ static long kbmprend (const char *buf, long fleng,
} }
cptrinc = (((xsiz*cdim+31)>>3)&~3); cptr = &buf[rastoff]; cptrinc = (((xsiz*cdim+31)>>3)&~3); cptr = &buf[rastoff];
if (ysiz < 0) { ysiz = -ysiz; } else { cptr = &cptr[(ysiz-1)*cptrinc]; cptrinc = -cptrinc; } if (ysiz < 0) { ysiz = -ysiz; } else { cptr = &cptr[(ysiz-1)*cptrinc]; cptrinc = -cptrinc; }
x0 = daglobxoffs; x1 = xsiz+daglobxoffs; x0 = daglobxoffs; x1 = xsiz+daglobxoffs;
y0 = daglobyoffs; y1 = ysiz+daglobyoffs; y0 = daglobyoffs; y1 = ysiz+daglobyoffs;
@ -2264,7 +2264,7 @@ static long kbmprend (const char *buf, long fleng,
return(0); return(0);
} }
//Note: currently only supports 8 and 24 bit PCX //Note: currently only supports 8 and 24 bit PCX
static long kpcxrend (const char *buf, long fleng, static long kpcxrend (const char *buf, long fleng,
long daframeplace, long dabytesperline, long daxres, long dayres, long daframeplace, long dabytesperline, long daxres, long dayres,
long daglobxoffs, long daglobyoffs) long daglobxoffs, long daglobyoffs)
@ -2458,9 +2458,9 @@ long kprender (const char *buf, long leng, long frameptr, long bpl,
//==================== External picture interface ends ======================= //==================== External picture interface ends =======================
//Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher //Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher
//Given: string i and string j. string j can have wildcards //Given: string i and string j. string j can have wildcards
//Returns: 1:matches, 0:doesn't match //Returns: 1:matches, 0:doesn't match
static long wildmatch (const char *i, const char *j) static long wildmatch (const char *i, const char *j)
{ {
const char *k; const char *k;
@ -2486,7 +2486,7 @@ static long wildmatch (const char *i, const char *j)
return(!*i); return(!*i);
} }
//Same as: stricmp(st0,st1) except: '/' == '\' //Same as: stricmp(st0,st1) except: '/' == '\'
static long filnamcmp (const char *st0, const char *st1) static long filnamcmp (const char *st0, const char *st1)
{ {
long i; long i;
@ -2506,15 +2506,15 @@ static long filnamcmp (const char *st0, const char *st1)
//===================== ZIP decompression code begins ======================== //===================== ZIP decompression code begins ========================
//format: (used by kzaddstack/kzopen to cache file name&start info) //format: (used by kzaddstack/kzopen to cache file name&start info)
//[char zipnam[?]\0] //[char zipnam[?]\0]
//[next hashindex/-1][next index/-1][zipnam index][zipseek][char filnam[?]\0] //[next hashindex/-1][next index/-1][zipnam index][zipseek][char filnam[?]\0]
//[next hashindex/-1][next index/-1][zipnam index][zipseek][char filnam[?]\0] //[next hashindex/-1][next index/-1][zipnam index][zipseek][char filnam[?]\0]
//... //...
//[char zipnam[?]\0] //[char zipnam[?]\0]
//[next hashindex/-1][next index/-1][zipnam index][zipseek][char filnam[?]\0] //[next hashindex/-1][next index/-1][zipnam index][zipseek][char filnam[?]\0]
//[next hashindex/-1][next index/-1][zipnam index][zipseek][char filnam[?]\0] //[next hashindex/-1][next index/-1][zipnam index][zipseek][char filnam[?]\0]
//... //...
#define KZHASHINITSIZE 8192 #define KZHASHINITSIZE 8192
static char *kzhashbuf = 0; static char *kzhashbuf = 0;
static long kzhashead[256], kzhashpos, kzlastfnam, kzhashsiz; static long kzhashead[256], kzhashpos, kzlastfnam, kzhashsiz;
@ -2575,7 +2575,7 @@ void kzuninit ()
kzhashpos = kzhashsiz = 0; kzhashpos = kzhashsiz = 0;
} }
//Load ZIP directory into memory (hash) to allow fast access later //Load ZIP directory into memory (hash) to allow fast access later
long kzaddstack (const char *zipnam) long kzaddstack (const char *zipnam)
{ {
FILE *fil; FILE *fil;
@ -2585,7 +2585,7 @@ long kzaddstack (const char *zipnam)
fil = fopen(zipnam,"rb"); if (!fil) return(-1); fil = fopen(zipnam,"rb"); if (!fil) return(-1);
//Write ZIP filename to hash //Write ZIP filename to hash
i = strlen(zipnam)+1; if (!kzcheckhashsiz(i)) { fclose(fil); return(-1); } i = strlen(zipnam)+1; if (!kzcheckhashsiz(i)) { fclose(fil); return(-1); }
strcpy(&kzhashbuf[kzhashpos],zipnam); strcpy(&kzhashbuf[kzhashpos],zipnam);
zipnamoffs = kzhashpos; kzhashpos += i; zipnamoffs = kzhashpos; kzhashpos += i;
@ -2847,7 +2847,7 @@ static void putbuf4zip (const unsigned char *buf, long uncomp0, long uncomp1)
if (i0 < i1) memcpy(&gzbufptr[i0],&buf[i0-uncomp0],i1-i0); if (i0 < i1) memcpy(&gzbufptr[i0],&buf[i0-uncomp0],i1-i0);
} }
//returns number of bytes copied //returns number of bytes copied
long kzread (void *buffer, long leng) long kzread (void *buffer, long leng)
{ {
long i, j, k, bfinal, btype, hlit, hdist; long i, j, k, bfinal, btype, hlit, hdist;
@ -3053,8 +3053,8 @@ long kzfilelength ()
return(kzfs.leng); return(kzfs.leng);
} }
//WARNING: kzseek(<-32768,SEEK_CUR); or: //WARNING: kzseek(<-32768,SEEK_CUR); or:
// kzseek(0,SEEK_END); can make next kzread very slow!!! // kzseek(0,SEEK_END); can make next kzread very slow!!!
long kzseek (long offset, long whence) long kzseek (long offset, long whence)
{ {
if (!kzfs.fil) return(-1); if (!kzfs.fil) return(-1);
@ -3062,7 +3062,7 @@ long kzseek (long offset, long whence)
{ {
case SEEK_CUR: kzfs.pos += offset; break; case SEEK_CUR: kzfs.pos += offset; break;
case SEEK_END: kzfs.pos = kzfs.leng+offset; break; case SEEK_END: kzfs.pos = kzfs.leng+offset; break;
case SEEK_SET: default: kzfs.pos = offset; case SEEK_SET: default: kzfs.pos = offset;
} }
if (kzfs.pos < 0) kzfs.pos = 0; if (kzfs.pos < 0) kzfs.pos = 0;
if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng; if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng;
@ -3110,7 +3110,7 @@ void kpzload (const char *filnam, long *pic, long *bpl, long *xsiz, long *ysiz)
kpgetdim(buf,leng,xsiz,ysiz); kpgetdim(buf,leng,xsiz,ysiz);
(*bpl) = ((*xsiz)<<2); (*bpl) = ((*xsiz)<<2);
(*pic) = (long)malloc((*ysiz)*(*bpl)); if (!(*pic)) { free(buf); return; } (*pic) = (long)malloc((*ysiz)*(*bpl)); if (!(*pic)) { free(buf); return; }
if (kprender(buf,leng,*pic,*bpl,*xsiz,*ysiz,0,0) < 0) { free(buf); free((void *)*pic); (*pic) = 0; return; } if (kprender(buf,leng,*pic,*bpl,*xsiz,*ysiz,0,0) < 0) { free(buf); free((void *)*pic); (*pic) = 0; return; }
free(buf); free(buf);
} }

View file

@ -18,7 +18,7 @@ long lzwcompress (unsigned char *ucompbuf, long ucompleng, unsigned char *compbu
unsigned char *nodev, *cptr, *eptr; unsigned char *nodev, *cptr, *eptr;
nodev = (unsigned char *)malloc((ucompleng+256)*sizeof(char)); if (!nodev) return(0); nodev = (unsigned char *)malloc((ucompleng+256)*sizeof(char)); if (!nodev) return(0);
child = (long *)malloc((ucompleng+256)*sizeof(long)); if (!child) { free(nodev); return(0); } child = (long *)malloc((ucompleng+256)*sizeof(long)); if (!child) { free(nodev); return(0); }
sibly = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibly) { free(child); free(nodev); return(0); } sibly = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibly) { free(child); free(nodev); return(0); }
#if USENEW #if USENEW
sibry = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibry) { free(sibly); free(child); free(nodev); return(0); } sibry = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibry) { free(sibly); free(child); free(nodev); return(0); }
@ -68,7 +68,7 @@ lzwcompbreak2b: child[numnodes] = sibly[numnodes] = -1;
free(child); free(nodev); free(child); free(nodev);
lptr = (long *)compbuf; lptr = (long *)compbuf;
if (((bitcnt+7)>>3) < ucompleng) { lptr[0] = LSWAPIB(numnodes); return((bitcnt+7)>>3); } if (((bitcnt+7)>>3) < ucompleng) { lptr[0] = LSWAPIB(numnodes); return((bitcnt+7)>>3); }
memcpy(compbuf,ucompbuf,ucompleng); return(ucompleng); memcpy(compbuf,ucompbuf,ucompleng); return(ucompleng);
} }
@ -83,7 +83,7 @@ long lzwuncompress (unsigned char *compbuf, long compleng, unsigned char *ucompb
totnodes = LSWAPIB(((long *)compbuf)[0]); if (totnodes <= 0 || totnodes >= ucompleng+256) return 0; totnodes = LSWAPIB(((long *)compbuf)[0]); if (totnodes <= 0 || totnodes >= ucompleng+256) return 0;
prefix = (long *)malloc(totnodes*sizeof(long)); if (!prefix) return 0; prefix = (long *)malloc(totnodes*sizeof(long)); if (!prefix) return 0;
suffix = (unsigned char *)malloc(totnodes*sizeof(char)); if (!suffix) { free(prefix); return 0; } suffix = (unsigned char *)malloc(totnodes*sizeof(char)); if (!suffix) { free(prefix); return 0; }
numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1); numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1);
do do

View file

@ -56,7 +56,7 @@ static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; };
/* F, G and H are basic MD4 functions. /* F, G and H are basic MD4 functions.
*/ */

View file

@ -33,11 +33,11 @@ typedef struct _mdskinmap_t
} mdskinmap_t; } mdskinmap_t;
//This MD2 code is based on the source code from David Henry (tfc_duke(at)hotmail.com) //This MD2 code is based on the source code from David Henry (tfc_duke(at)hotmail.com)
// Was at http://tfc.duke.free.fr/us/tutorials/models/md2.htm // Was at http://tfc.duke.free.fr/us/tutorials/models/md2.htm
// Available from http://web.archive.org/web/20030816010242/http://tfc.duke.free.fr/us/tutorials/models/md2.htm // Available from http://web.archive.org/web/20030816010242/http://tfc.duke.free.fr/us/tutorials/models/md2.htm
// Now at http://tfc.duke.free.fr/coding/md2.html (in French) // Now at http://tfc.duke.free.fr/coding/md2.html (in French)
//He probably wouldn't recognize it if he looked at it though :) //He probably wouldn't recognize it if he looked at it though :)
typedef struct { float x, y, z; } point3d; typedef struct { float x, y, z; } point3d;
typedef struct typedef struct
@ -171,7 +171,7 @@ typedef struct
} tile2model_t; } tile2model_t;
static tile2model_t tile2model[MAXTILES]; static tile2model_t tile2model[MAXTILES];
//Move this to appropriate place! //Move this to appropriate place!
typedef struct { float xadd, yadd, zadd; short angadd, flags; } hudtyp; typedef struct { float xadd, yadd, zadd; short angadd, flags; } hudtyp;
hudtyp hudmem[2][MAXTILES]; //~320KB ... ok for now ... could replace with dynamic alloc hudtyp hudmem[2][MAXTILES]; //~320KB ... ok for now ... could replace with dynamic alloc
@ -648,7 +648,7 @@ failure:
} }
// --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF // --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF
//Note: even though it says md2model, it works for both md2model&md3model //Note: even though it says md2model, it works for both md2model&md3model
static long mdloadskin (md2model *m, int number, int pal, int surf) static long mdloadskin (md2model *m, int number, int pal, int surf)
{ {
long i,j, fptr=0, bpl, xsiz, ysiz, osizx, osizy, texfmt = GL_RGBA, intexfmt = GL_RGBA; long i,j, fptr=0, bpl, xsiz, ysiz, osizx, osizy, texfmt = GL_RGBA, intexfmt = GL_RGBA;
@ -806,7 +806,7 @@ static long mdloadskin (md2model *m, int number, int pal, int surf)
return(*texidx); return(*texidx);
} }
//Note: even though it says md2model, it works for both md2model&md3model //Note: even though it says md2model, it works for both md2model&md3model
static void updateanimation (md2model *m, spritetype *tspr) static void updateanimation (md2model *m, spritetype *tspr)
{ {
mdanim_t *anim; mdanim_t *anim;
@ -817,7 +817,7 @@ static void updateanimation (md2model *m, spritetype *tspr)
for (anim = m->animations; for (anim = m->animations;
anim && anim->startframe != m->cframe; anim && anim->startframe != m->cframe;
anim = anim->next) ; anim = anim->next) ;
if (!anim) { m->interpol = 0; return; } if (!anim) { m->interpol = 0; return; }
if (((long)spriteext[tspr->owner].mdanimcur) != anim->startframe || if (((long)spriteext[tspr->owner].mdanimcur) != anim->startframe ||
(spriteext[tspr->owner].flags & SPREXT_NOMDANIM)) (spriteext[tspr->owner].flags & SPREXT_NOMDANIM))
@ -840,7 +840,7 @@ static void updateanimation (md2model *m, spritetype *tspr)
if (anim->flags&MDANIM_ONESHOT) if (anim->flags&MDANIM_ONESHOT)
{ if (i > j-65536) i = j-65536; } { if (i > j-65536) i = j-65536; }
else { if (i >= j) { i -= j; if (i >= j) i %= j; } } else { if (i >= j) { i -= j; if (i >= j) i %= j; } }
m->cframe = (i>>16)+anim->startframe; m->cframe = (i>>16)+anim->startframe;
m->nframe = m->cframe+1; if (m->nframe > anim->endframe) m->nframe = anim->startframe; m->nframe = m->cframe+1; if (m->nframe > anim->endframe) m->nframe = anim->startframe;
@ -897,7 +897,7 @@ static md2model *md2load (int fil, const char *filnam)
head.ofsframes = B_LITTLE32(head.ofsframes); head.ofsglcmds = B_LITTLE32(head.ofsglcmds); head.ofsframes = B_LITTLE32(head.ofsframes); head.ofsglcmds = B_LITTLE32(head.ofsglcmds);
head.ofseof = B_LITTLE32(head.ofseof); head.ofseof = B_LITTLE32(head.ofseof);
if ((head.id != 0x32504449) || (head.vers != 8)) { free(m); return(0); } //"IDP2" if ((head.id != 0x32504449) || (head.vers != 8)) { free(m); return(0); } //"IDP2"
m->numskins = head.numskins; m->numskins = head.numskins;
m->numframes = head.numframes; m->numframes = head.numframes;
@ -937,7 +937,7 @@ static md2model *md2load (int fil, const char *filnam)
if ((st[i] == '/') || (st[i] == '\\')) { i++; break; } if ((st[i] == '/') || (st[i] == '\\')) { i++; break; }
if (i<0) i=0; if (i<0) i=0;
st[i] = 0; st[i] = 0;
m->basepath = (char *)malloc(i+1); if (!m->basepath) { free(m->glcmds); free(m->frames); free(m); return(0); } m->basepath = (char *)malloc(i+1); if (!m->basepath) { free(m->glcmds); free(m->frames); free(m); return(0); }
strcpy(m->basepath, st); strcpy(m->basepath, st);
m->skinfn = (char *)calloc(m->numskins,64); if (!m->skinfn) { free(m->basepath); free(m->glcmds); free(m->frames); free(m); return(0); } m->skinfn = (char *)calloc(m->numskins,64); if (!m->skinfn) { free(m->basepath); free(m->glcmds); free(m->frames); free(m); return(0); }
@ -961,11 +961,11 @@ static int md2draw (md2model *m, spritetype *tspr)
long i, *lptr; long i, *lptr;
float f, g, k0, k1, k2, k3, k4, k5, k6, k7, mat[16], pc[4]; float f, g, k0, k1, k2, k3, k4, k5, k6, k7, mat[16], pc[4];
// if ((tspr->cstat&48) == 32) return 0; // if ((tspr->cstat&48) == 32) return 0;
updateanimation(m,tspr); updateanimation(m,tspr);
// -------- Unnecessarily clean (lol) code to generate translation/rotation matrix for MD2 --------- // -------- Unnecessarily clean (lol) code to generate translation/rotation matrix for MD2 ---------
//create current&next frame's vertex list from whole list //create current&next frame's vertex list from whole list
f0 = (md2frame_t *)&m->frames[m->cframe*m->framebytes]; f0 = (md2frame_t *)&m->frames[m->cframe*m->framebytes];
@ -1043,9 +1043,9 @@ static int md2draw (md2model *m, spritetype *tspr)
//Mirrors //Mirrors
if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; } if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; }
// ------ Unnecessarily clean (lol) code to generate translation/rotation matrix for MD2 ends ------ // ------ Unnecessarily clean (lol) code to generate translation/rotation matrix for MD2 ends ------
// PLAG: Cleaner model rotation code // PLAG: Cleaner model rotation code
if (spriteext[tspr->owner].pitch || spriteext[tspr->owner].roll) if (spriteext[tspr->owner].pitch || spriteext[tspr->owner].roll)
{ {
if (spriteext[tspr->owner].xoff) if (spriteext[tspr->owner].xoff)
@ -1097,7 +1097,7 @@ static int md2draw (md2model *m, spritetype *tspr)
} }
bglMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation bglMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat); mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat);
// PLAG: End // PLAG: End
i = mdloadskin(m,tile2model[tspr->picnum].skinnum,globalpal,0); if (!i) return 0; i = mdloadskin(m,tile2model[tspr->picnum].skinnum,globalpal,0); if (!i) return 0;
@ -1120,11 +1120,11 @@ static int md2draw (md2model *m, spritetype *tspr)
pc[0] *= (float)hictinting[globalpal].r / 255.0; pc[0] *= (float)hictinting[globalpal].r / 255.0;
pc[1] *= (float)hictinting[globalpal].g / 255.0; pc[1] *= (float)hictinting[globalpal].g / 255.0;
pc[2] *= (float)hictinting[globalpal].b / 255.0; pc[2] *= (float)hictinting[globalpal].b / 255.0;
if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } else pc[3] = 1.0; if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } else pc[3] = 1.0;
if (m->usesalpha) //Sprites with alpha in texture if (m->usesalpha) //Sprites with alpha in texture
{ {
// bglEnable(GL_BLEND);// bglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // bglEnable(GL_BLEND);// bglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
// bglEnable(GL_ALPHA_TEST); bglAlphaFunc(GL_GREATER,0.32); // bglEnable(GL_ALPHA_TEST); bglAlphaFunc(GL_GREATER,0.32);
float al = 0.32; float al = 0.32;
if (alphahackarray[globalpicnum] != 0) if (alphahackarray[globalpicnum] != 0)
al=alphahackarray[globalpicnum]; al=alphahackarray[globalpicnum];
@ -1226,7 +1226,7 @@ static md3model *md3load (int fil)
m->head.tags = (md3tag_t*)B_LITTLE32((long)m->head.tags); m->head.surfs = (md3surf_t*)B_LITTLE32((long)m->head.surfs); m->head.tags = (md3tag_t*)B_LITTLE32((long)m->head.tags); m->head.surfs = (md3surf_t*)B_LITTLE32((long)m->head.surfs);
m->head.eof = B_LITTLE32(m->head.eof); m->head.eof = B_LITTLE32(m->head.eof);
if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { free(m); return(0); } //"IDP3" if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { free(m); return(0); } //"IDP3"
m->numskins = m->head.numskins; //<- dead code? m->numskins = m->head.numskins; //<- dead code?
m->numframes = m->head.numframes; m->numframes = m->head.numframes;
@ -1360,7 +1360,7 @@ static int md3draw (md3model *m, spritetype *tspr)
unsigned short tempus; unsigned short tempus;
// if ((tspr->cstat&48) == 32) return 0; // if ((tspr->cstat&48) == 32) return 0;
updateanimation((md2model *)m,tspr); updateanimation((md2model *)m,tspr);
@ -1436,7 +1436,7 @@ static int md3draw (md3model *m, spritetype *tspr)
//Mirrors //Mirrors
if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; } if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; }
//------------ //------------
//bit 10 is an ugly hack in game.c\animatesprites telling MD2SPRITE //bit 10 is an ugly hack in game.c\animatesprites telling MD2SPRITE
//to use Z-buffer hacks to hide overdraw problems with the shadows //to use Z-buffer hacks to hide overdraw problems with the shadows
if (tspr->cstat&1024) if (tspr->cstat&1024)
@ -1455,12 +1455,12 @@ static int md3draw (md3model *m, spritetype *tspr)
pc[0] *= (float)hictinting[globalpal].r / 255.0; pc[0] *= (float)hictinting[globalpal].r / 255.0;
pc[1] *= (float)hictinting[globalpal].g / 255.0; pc[1] *= (float)hictinting[globalpal].g / 255.0;
pc[2] *= (float)hictinting[globalpal].b / 255.0; pc[2] *= (float)hictinting[globalpal].b / 255.0;
if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } else pc[3] = 1.0; if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } else pc[3] = 1.0;
if (m->usesalpha) //Sprites with alpha in texture if (m->usesalpha) //Sprites with alpha in texture
{ {
// bglEnable(GL_BLEND);// bglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // bglEnable(GL_BLEND);// bglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
// bglEnable(GL_ALPHA_TEST); bglAlphaFunc(GL_GREATER,0.32); // bglEnable(GL_ALPHA_TEST); bglAlphaFunc(GL_GREATER,0.32);
// float al = 0.32; // float al = 0.32;
// PLAG : default cutoff removed // PLAG : default cutoff removed
float al = 0.0; float al = 0.0;
if (alphahackarray[globalpicnum] != 0) if (alphahackarray[globalpicnum] != 0)
@ -1474,9 +1474,9 @@ static int md3draw (md3model *m, spritetype *tspr)
if (tspr->cstat&2) bglEnable(GL_BLEND); else bglDisable(GL_BLEND); if (tspr->cstat&2) bglEnable(GL_BLEND); else bglDisable(GL_BLEND);
} }
bglColor4f(pc[0],pc[1],pc[2],pc[3]); bglColor4f(pc[0],pc[1],pc[2],pc[3]);
//------------ //------------
// PLAG: Cleaner model rotation code // PLAG: Cleaner model rotation code
if (spriteext[tspr->owner].pitch || spriteext[tspr->owner].roll) if (spriteext[tspr->owner].pitch || spriteext[tspr->owner].roll)
{ {
if (spriteext[tspr->owner].xoff) if (spriteext[tspr->owner].xoff)
@ -1534,13 +1534,13 @@ static int md3draw (md3model *m, spritetype *tspr)
} }
bglMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation bglMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat); mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat);
// PLAG: End // PLAG: End
i = mdloadskin((md2model *)m,tile2model[tspr->picnum].skinnum,globalpal,surfi); if (!i) continue; i = mdloadskin((md2model *)m,tile2model[tspr->picnum].skinnum,globalpal,surfi); if (!i) continue;
//i = mdloadskin((md2model *)m,tile2model[tspr->picnum].skinnum,surfi); //hack for testing multiple surfaces per MD3 //i = mdloadskin((md2model *)m,tile2model[tspr->picnum].skinnum,surfi); //hack for testing multiple surfaces per MD3
bglBindTexture(GL_TEXTURE_2D, i); bglBindTexture(GL_TEXTURE_2D, i);
//PLAG: delayed polygon-level sorted rendering //PLAG: delayed polygon-level sorted rendering
if (m->usesalpha && !(tspr->cstat & 1024)) if (m->usesalpha && !(tspr->cstat & 1024))
{ {
indexes = malloc(sizeof(unsigned short) * s->numtris); indexes = malloc(sizeof(unsigned short) * s->numtris);
@ -1667,7 +1667,7 @@ static int md3draw (md3model *m, spritetype *tspr)
bglEnd(); bglEnd();
} }
} }
//------------ //------------
if (m->usesalpha) bglDisable(GL_ALPHA_TEST); if (m->usesalpha) bglDisable(GL_ALPHA_TEST);
bglDisable(GL_CULL_FACE); bglDisable(GL_CULL_FACE);
@ -1723,7 +1723,7 @@ static void md3free (md3model *m)
//---------------------------------------- MD3 LIBRARY ENDS ---------------------------------------- //---------------------------------------- MD3 LIBRARY ENDS ----------------------------------------
//--------------------------------------- VOX LIBRARY BEGINS --------------------------------------- //--------------------------------------- VOX LIBRARY BEGINS ---------------------------------------
//For loading/conversion only //For loading/conversion only
static long xsiz, ysiz, zsiz, yzsiz, *vbit = 0; //vbit: 1 bit per voxel: 0=air,1=solid static long xsiz, ysiz, zsiz, yzsiz, *vbit = 0; //vbit: 1 bit per voxel: 0=air,1=solid
static float xpiv, ypiv, zpiv; //Might want to use more complex/unique names! static float xpiv, ypiv, zpiv; //Might want to use more complex/unique names!
static long *vcolhashead = 0, vcolhashsizm1; static long *vcolhashead = 0, vcolhashsizm1;
@ -1735,7 +1735,7 @@ static long *shcntmal, *shcnt = 0, shcntp;
static long mytexo5, *zbit, gmaxx, gmaxy, garea, pow2m1[33]; static long mytexo5, *zbit, gmaxx, gmaxy, garea, pow2m1[33];
static voxmodel *gvox; static voxmodel *gvox;
//pitch must equal xsiz*4 //pitch must equal xsiz*4
unsigned gloadtex (long *picbuf, long xsiz, long ysiz, long is8bit, long dapal) unsigned gloadtex (long *picbuf, long xsiz, long ysiz, long is8bit, long dapal)
{ {
unsigned rtexid; unsigned rtexid;
@ -1795,7 +1795,7 @@ static void putvox (long x, long y, long z, long col)
vcol[vnum].n = vcolhashead[z]; vcolhashead[z] = vnum++; vcol[vnum].n = vcolhashead[z]; vcolhashead[z] = vnum++;
} }
//Set all bits in vbit from (x,y,z0) to (x,y,z1-1) to 0's //Set all bits in vbit from (x,y,z0) to (x,y,z1-1) to 0's
static void setzrange0 (long *lptr, long z0, long z1) static void setzrange0 (long *lptr, long z0, long z1)
{ {
long z, ze; long z, ze;
@ -1805,7 +1805,7 @@ static void setzrange0 (long *lptr, long z0, long z1)
lptr[z] &= (-1<<SHIFTMOD32(z1)); lptr[z] &= (-1<<SHIFTMOD32(z1));
} }
//Set all bits in vbit from (x,y,z0) to (x,y,z1-1) to 1's //Set all bits in vbit from (x,y,z0) to (x,y,z1-1) to 1's
static void setzrange1 (long *lptr, long z0, long z1) static void setzrange1 (long *lptr, long z0, long z1)
{ {
long z, ze; long z, ze;
@ -1870,7 +1870,7 @@ static void cntquad (long x0, long y0, long z0, long x1, long y1, long z1, long
x = labs(x2-x0); y = labs(y2-y0); z = labs(z2-z0); x = labs(x2-x0); y = labs(y2-y0); z = labs(z2-z0);
if (!x) x = z; else if (!y) y = z; if (!x) x = z; else if (!y) y = z;
if (x < y) { z = x; x = y; y = z; } if (x < y) { z = x; x = y; y = z; }
shcnt[y*shcntp+x]++; shcnt[y*shcntp+x]++;
if (x > gmaxx) gmaxx = x; if (x > gmaxx) gmaxx = x;
if (y > gmaxy) gmaxy = y; if (y > gmaxy) gmaxy = y;
@ -1885,7 +1885,7 @@ static void addquad (long x0, long y0, long z0, long x1, long y1, long z1, long
x = labs(x2-x0); y = labs(y2-y0); z = labs(z2-z0); x = labs(x2-x0); y = labs(y2-y0); z = labs(z2-z0);
if (!x) { x = y; y = z; i = 0; } else if (!y) { y = z; i = 1; } else i = 2; if (!x) { x = y; y = z; i = 0; } else if (!y) { y = z; i = 1; } else i = 2;
if (x < y) { z = x; x = y; y = z; i += 3; } if (x < y) { z = x; x = y; y = z; i += 3; }
z = shcnt[y*shcntp+x]++; z = shcnt[y*shcntp+x]++;
lptr = &gvox->mytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx+(shp[z].x+VOXBORDWIDTH)]; lptr = &gvox->mytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx+(shp[z].x+VOXBORDWIDTH)];
switch(face) switch(face)
@ -1975,7 +1975,7 @@ static voxmodel *vox2poly ()
//x is largest dimension, y is 2nd largest dimension //x is largest dimension, y is 2nd largest dimension
x = xsiz; y = ysiz; z = zsiz; x = xsiz; y = ysiz; z = zsiz;
if ((x < y) && (x < z)) x = z; else if (y < z) y = z; if ((x < y) && (x < z)) x = z; else if (y < z) y = z;
if (x < y) { z = x; x = y; y = z; } if (x < y) { z = x; x = y; y = z; }
shcntp = x; i = x*y*sizeof(long); shcntp = x; i = x*y*sizeof(long);
shcntmal = (long *)malloc(i); if (!shcntmal) { free(gvox); return(0); } shcntmal = (long *)malloc(i); if (!shcntmal) { free(gvox); return(0); }
memset(shcntmal,0,i); shcnt = &shcntmal[-shcntp-1]; memset(shcntmal,0,i); shcnt = &shcntmal[-shcntp-1];
@ -1985,7 +1985,7 @@ static voxmodel *vox2poly ()
for(i=0;i<7;i++) gvox->qfacind[i] = -1; for(i=0;i<7;i++) gvox->qfacind[i] = -1;
i = ((max(ysiz,zsiz)+1)<<2); i = ((max(ysiz,zsiz)+1)<<2);
bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); } bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); }
by0 = (long *)(((long)bx0)+i); by0 = (long *)(((long)bx0)+i);
for(cnt=0;cnt<2;cnt++) for(cnt=0;cnt<2;cnt++)
@ -2182,7 +2182,7 @@ static long loadkvx (const char *filnam)
klseek(fil,(xsiz+1)<<2,SEEK_CUR); klseek(fil,(xsiz+1)<<2,SEEK_CUR);
ysizp1 = ysiz+1; ysizp1 = ysiz+1;
i = xsiz*ysizp1*sizeof(short); i = xsiz*ysizp1*sizeof(short);
xyoffs = (unsigned short *)malloc(i); if (!xyoffs) { kclose(fil); return(-1); } xyoffs = (unsigned short *)malloc(i); if (!xyoffs) { kclose(fil); return(-1); }
kread(fil,xyoffs,i); for (i=i/sizeof(short)-1; i>=0; i--) xyoffs[i] = B_LITTLE16(xyoffs[i]); kread(fil,xyoffs,i); for (i=i/sizeof(short)-1; i>=0; i--) xyoffs[i] = B_LITTLE16(xyoffs[i]);
klseek(fil,-768,SEEK_END); klseek(fil,-768,SEEK_END);
@ -2194,7 +2194,7 @@ static long loadkvx (const char *filnam)
memset(vbit,0,i); memset(vbit,0,i);
for(vcolhashsizm1=4096;vcolhashsizm1<(mip1leng>>1);vcolhashsizm1<<=1); vcolhashsizm1--; //approx to numvoxs! for(vcolhashsizm1=4096;vcolhashsizm1<(mip1leng>>1);vcolhashsizm1<<=1); vcolhashsizm1--; //approx to numvoxs!
vcolhashead = (long *)malloc((vcolhashsizm1+1)*sizeof(long)); if (!vcolhashead) { free(xyoffs); kclose(fil); return(-1); } vcolhashead = (long *)malloc((vcolhashsizm1+1)*sizeof(long)); if (!vcolhashead) { free(xyoffs); kclose(fil); return(-1); }
memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(long)); memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(long));
klseek(fil,28+((xsiz+1)<<2)+((ysizp1*xsiz)<<1),SEEK_SET); klseek(fil,28+((xsiz+1)<<2)+((ysizp1*xsiz)<<1),SEEK_SET);
@ -2229,7 +2229,7 @@ static long loadkv6 (const char *filnam)
unsigned char c[8]; unsigned char c[8];
fil = kopen4load((char *)filnam,0); if (fil < 0) return(-1); fil = kopen4load((char *)filnam,0); if (fil < 0) return(-1);
kread(fil,&i,4); if (B_LITTLE32(i) != 0x6c78764b) { kclose(fil); return(-1); } //Kvxl kread(fil,&i,4); if (B_LITTLE32(i) != 0x6c78764b) { kclose(fil); return(-1); } //Kvxl
kread(fil,&xsiz,4); xsiz = B_LITTLE32(xsiz); kread(fil,&xsiz,4); xsiz = B_LITTLE32(xsiz);
kread(fil,&ysiz,4); ysiz = B_LITTLE32(ysiz); kread(fil,&ysiz,4); ysiz = B_LITTLE32(ysiz);
kread(fil,&zsiz,4); zsiz = B_LITTLE32(zsiz); kread(fil,&zsiz,4); zsiz = B_LITTLE32(zsiz);
@ -2246,11 +2246,11 @@ static long loadkv6 (const char *filnam)
klseek(fil,32,SEEK_SET); klseek(fil,32,SEEK_SET);
yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3); yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3);
vbit = (long *)malloc(i); if (!vbit) { free(ylen); kclose(fil); return(-1); } vbit = (long *)malloc(i); if (!vbit) { free(ylen); kclose(fil); return(-1); }
memset(vbit,0,i); memset(vbit,0,i);
for(vcolhashsizm1=4096;vcolhashsizm1<numvoxs;vcolhashsizm1<<=1); vcolhashsizm1--; for(vcolhashsizm1=4096;vcolhashsizm1<numvoxs;vcolhashsizm1<<=1); vcolhashsizm1--;
vcolhashead = (long *)malloc((vcolhashsizm1+1)*sizeof(long)); if (!vcolhashead) { free(ylen); kclose(fil); return(-1); } vcolhashead = (long *)malloc((vcolhashsizm1+1)*sizeof(long)); if (!vcolhashead) { free(ylen); kclose(fil); return(-1); }
memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(long)); memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(long));
for(x=0;x<xsiz;x++) for(x=0;x<xsiz;x++)
@ -2271,7 +2271,7 @@ static long loadkv6 (const char *filnam)
} }
#if 0 #if 0
//While this code works, it's way too slow and can only cause trouble. //While this code works, it's way too slow and can only cause trouble.
static long loadvxl (const char *filnam) static long loadvxl (const char *filnam)
{ {
long i, j, x, y, z, fil; long i, j, x, y, z, fil;
@ -2281,7 +2281,7 @@ static long loadvxl (const char *filnam)
kread(fil,&i,4); kread(fil,&i,4);
kread(fil,&xsiz,4); kread(fil,&xsiz,4);
kread(fil,&ysiz,4); kread(fil,&ysiz,4);
if ((i != 0x09072000) || (xsiz != 1024) || (ysiz != 1024)) { kclose(fil); return(-1); } if ((i != 0x09072000) || (xsiz != 1024) || (ysiz != 1024)) { kclose(fil); return(-1); }
zsiz = 256; zsiz = 256;
klseek(fil,96,SEEK_CUR); //skip pos&orient klseek(fil,96,SEEK_CUR); //skip pos&orient
xpiv = ((float)xsiz)*.5; xpiv = ((float)xsiz)*.5;
@ -2335,7 +2335,7 @@ static voxmodel *voxload (const char *filnam)
voxmodel *vm; voxmodel *vm;
i = strlen(filnam)-4; if (i < 0) return(0); i = strlen(filnam)-4; if (i < 0) return(0);
if (!Bstrcasecmp(&filnam[i],".vox")) { ret = loadvox(filnam); is8bit = 1; } if (!Bstrcasecmp(&filnam[i],".vox")) { ret = loadvox(filnam); is8bit = 1; }
else if (!Bstrcasecmp(&filnam[i],".kvx")) { ret = loadkvx(filnam); is8bit = 1; } else if (!Bstrcasecmp(&filnam[i],".kvx")) { ret = loadkvx(filnam); is8bit = 1; }
else if (!Bstrcasecmp(&filnam[i],".kv6")) { ret = loadkv6(filnam); is8bit = 0; } else if (!Bstrcasecmp(&filnam[i],".kv6")) { ret = loadkv6(filnam); is8bit = 0; }
//else if (!Bstrcasecmp(&filnam[i],".vxl")) { ret = loadvxl(filnam); is8bit = 0; } //else if (!Bstrcasecmp(&filnam[i],".vxl")) { ret = loadvxl(filnam); is8bit = 0; }
@ -2359,7 +2359,7 @@ static voxmodel *voxload (const char *filnam)
return(vm); return(vm);
} }
//Draw voxel model as perfect cubes //Draw voxel model as perfect cubes
static int voxdraw (voxmodel *m, spritetype *tspr) static int voxdraw (voxmodel *m, spritetype *tspr)
{ {
point3d fp, m0, a0; point3d fp, m0, a0;
@ -2422,9 +2422,9 @@ static int voxdraw (voxmodel *m, spritetype *tspr)
mat[14] += a0.y*mat[2] + a0.z*mat[6] + a0.x*mat[10]; mat[14] += a0.y*mat[2] + a0.z*mat[6] + a0.x*mat[10];
//Mirrors //Mirrors
if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; } if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; }
//------------ //------------
//bit 10 is an ugly hack in game.c\animatesprites telling MD2SPRITE //bit 10 is an ugly hack in game.c\animatesprites telling MD2SPRITE
//to use Z-buffer hacks to hide overdraw problems with the shadows //to use Z-buffer hacks to hide overdraw problems with the shadows
if (tspr->cstat&1024) if (tspr->cstat&1024)
@ -2443,9 +2443,9 @@ static int voxdraw (voxmodel *m, spritetype *tspr)
pc[0] *= (float)hictinting[globalpal].r / 255.0; pc[0] *= (float)hictinting[globalpal].r / 255.0;
pc[1] *= (float)hictinting[globalpal].g / 255.0; pc[1] *= (float)hictinting[globalpal].g / 255.0;
pc[2] *= (float)hictinting[globalpal].b / 255.0; pc[2] *= (float)hictinting[globalpal].b / 255.0;
if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } else pc[3] = 1.0; if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } else pc[3] = 1.0;
if (tspr->cstat&2) bglEnable(GL_BLEND); else bglDisable(GL_BLEND); if (tspr->cstat&2) bglEnable(GL_BLEND); else bglDisable(GL_BLEND);
//------------ //------------
//transform to Build coords //transform to Build coords
memcpy(omat,mat,sizeof(omat)); memcpy(omat,mat,sizeof(omat));
@ -2497,7 +2497,7 @@ static int voxdraw (voxmodel *m, spritetype *tspr)
} }
bglEnd(); bglEnd();
//------------ //------------
bglDisable(GL_CULL_FACE); bglDisable(GL_CULL_FACE);
bglPopAttrib(); bglPopAttrib();
if (tspr->cstat&1024) if (tspr->cstat&1024)

View file

@ -249,17 +249,17 @@ static void initmultiplayers_reset(void)
for(i=0;i<MAXPLAYERS;i++) otherport[i] = htons(NETPORT); for(i=0;i<MAXPLAYERS;i++) otherport[i] = htons(NETPORT);
} }
// Multiplayer command line summary. Assume myconnectindex always = 0 for 192.168.1.2 // Multiplayer command line summary. Assume myconnectindex always = 0 for 192.168.1.2
// //
// /n0 (mast/slav) 2 player: 3 player: // /n0 (mast/slav) 2 player: 3 player:
// 192.168.1.2 game /n0 game /n0:3 // 192.168.1.2 game /n0 game /n0:3
// 192.168.1.100 game /n0 192.168.1.2 game /n0 192.168.1.2 // 192.168.1.100 game /n0 192.168.1.2 game /n0 192.168.1.2
// 192.168.1.4 game /n0 192.168.1.2 // 192.168.1.4 game /n0 192.168.1.2
// //
// /n1 (peer-peer) 2 player: 3 player: // /n1 (peer-peer) 2 player: 3 player:
// 192.168.1.2 game /n1 192.168.1.100 game /n1 192.168.1.100 192.168.1.4 // 192.168.1.2 game /n1 192.168.1.100 game /n1 192.168.1.100 192.168.1.4
// 192.168.1.100 game 192.168.1.2 /n1 game 192.168.1.2 /n1 192.168.1.4 // 192.168.1.100 game 192.168.1.2 /n1 game 192.168.1.2 /n1 192.168.1.4
// 192.168.1.4 game 192.168.1.2 192.168.1.100 /n1 // 192.168.1.4 game 192.168.1.2 192.168.1.100 /n1
long initmultiplayersparms(long argc, char **argv) long initmultiplayersparms(long argc, char **argv)
{ {
long i, j, daindex, portnum = NETPORT; long i, j, daindex, portnum = NETPORT;
@ -350,7 +350,7 @@ long initmultiplayersparms(long argc, char **argv)
} }
free(st); free(st);
} }
if ((danetmode == 255) && (daindex)) { numplayers = 2; danetmode = 0; } //an IP w/o /n# defaults to /n0 if ((danetmode == 255) && (daindex)) { numplayers = 2; danetmode = 0; } //an IP w/o /n# defaults to /n0
if ((numplayers >= 2) && (daindex) && (!danetmode)) myconnectindex = 1; if ((numplayers >= 2) && (daindex) && (!danetmode)) myconnectindex = 1;
if (daindex > numplayers) numplayers = daindex; if (daindex > numplayers) numplayers = daindex;
@ -518,8 +518,8 @@ void sendpacket (long other, char *bufptr, long messleng)
dosendpackets(other); dosendpackets(other);
} }
//passing bufptr == 0 enables receive&sending raw packets but does not return any received packets //passing bufptr == 0 enables receive&sending raw packets but does not return any received packets
//(used as hack for player collection) //(used as hack for player collection)
long getpacket (long *retother, char *bufptr) long getpacket (long *retother, char *bufptr)
{ {
long i, j, k, ic0, crc16ofs, messleng, other; long i, j, k, ic0, crc16ofs, messleng, other;

View file

@ -295,7 +295,7 @@ void OSD_SetFunctions(
void (*clearbg)(int,int), void (*clearbg)(int,int),
int (*gtime)(void), int (*gtime)(void),
void (*showosd)(int) void (*showosd)(int)
) )
{ {
drawosdchar = drawchar; drawosdchar = drawchar;
drawosdstr = drawstr; drawosdstr = drawstr;
@ -324,7 +324,7 @@ void OSD_SetParameters(
int promptshade, int promptpal, int promptshade, int promptpal,
int editshade, int editpal, int editshade, int editpal,
int textshade, int textpal int textshade, int textpal
) )
{ {
osdpromptshade = promptshade; osdpromptshade = promptshade;
osdpromptpal = promptpal; osdpromptpal = promptpal;

View file

@ -111,7 +111,7 @@ static struct glfiltermodes {
{"GL_LINEAR_MIPMAP_NEAREST",GL_LINEAR_MIPMAP_NEAREST,GL_LINEAR}, {"GL_LINEAR_MIPMAP_NEAREST",GL_LINEAR_MIPMAP_NEAREST,GL_LINEAR},
{"GL_NEAREST_MIPMAP_LINEAR",GL_NEAREST_MIPMAP_LINEAR,GL_NEAREST}, {"GL_NEAREST_MIPMAP_LINEAR",GL_NEAREST_MIPMAP_LINEAR,GL_NEAREST},
{"GL_LINEAR_MIPMAP_LINEAR",GL_LINEAR_MIPMAP_LINEAR,GL_LINEAR} {"GL_LINEAR_MIPMAP_LINEAR",GL_LINEAR_MIPMAP_LINEAR,GL_LINEAR}
}; };
#define numglfiltermodes (sizeof(glfiltermodes)/sizeof(glfiltermodes[0])) #define numglfiltermodes (sizeof(glfiltermodes)/sizeof(glfiltermodes[0]))
long glanisotropy = 1; // 0 = maximum supported by card long glanisotropy = 1; // 0 = maximum supported by card
@ -166,7 +166,7 @@ static inline void ftol (float f, long *a)
#if 0 //(__GNUC__ >= 3) #if 0 //(__GNUC__ >= 3)
"flds %1; fistpl %0;" "flds %1; fistpl %0;"
#else #else
"flds %1; fistpl (%0);" "flds %1; fistpl (%0);"
#endif #endif
: "=r" (a) : "m" (f) : "memory","cc"); : "=r" (a) : "m" (f) : "memory","cc");
} }
@ -177,7 +177,7 @@ static inline void dtol (double d, long *a)
#if 0 //(__GNUC__ >= 3) #if 0 //(__GNUC__ >= 3)
"fldl %1; fistpl %0;" "fldl %1; fistpl %0;"
#else #else
"fldl %1; fistpl (%0);" "fldl %1; fistpl (%0);"
#endif #endif
: "=r" (a) : "m" (d) : "memory","cc"); : "=r" (a) : "m" (d) : "memory","cc");
} }
@ -208,13 +208,13 @@ void drawline2d (float x0, float y0, float x1, float y1, char col)
dx = x1-x0; dy = y1-y0; if ((dx == 0) && (dy == 0)) return; dx = x1-x0; dy = y1-y0; if ((dx == 0) && (dy == 0)) return;
fxres = (float)xdimen; fyres = (float)ydimen; fxres = (float)xdimen; fyres = (float)ydimen;
if (x0 >= fxres) { if (x1 >= fxres) return; y0 += (fxres-x0)*dy/dx; x0 = fxres; } if (x0 >= fxres) { if (x1 >= fxres) return; y0 += (fxres-x0)*dy/dx; x0 = fxres; }
else if (x0 < 0) { if (x1 < 0) return; y0 += ( 0-x0)*dy/dx; x0 = 0; } else if (x0 < 0) { if (x1 < 0) return; y0 += ( 0-x0)*dy/dx; x0 = 0; }
if (x1 >= fxres) { y1 += (fxres-x1)*dy/dx; x1 = fxres; } if (x1 >= fxres) { y1 += (fxres-x1)*dy/dx; x1 = fxres; }
else if (x1 < 0) { y1 += ( 0-x1)*dy/dx; x1 = 0; } else if (x1 < 0) { y1 += ( 0-x1)*dy/dx; x1 = 0; }
if (y0 >= fyres) { if (y1 >= fyres) return; x0 += (fyres-y0)*dx/dy; y0 = fyres; } if (y0 >= fyres) { if (y1 >= fyres) return; x0 += (fyres-y0)*dx/dy; y0 = fyres; }
else if (y0 < 0) { if (y1 < 0) return; x0 += ( 0-y0)*dx/dy; y0 = 0; } else if (y0 < 0) { if (y1 < 0) return; x0 += ( 0-y0)*dx/dy; y0 = 0; }
if (y1 >= fyres) { x1 += (fyres-y1)*dx/dy; y1 = fyres; } if (y1 >= fyres) { x1 += (fyres-y1)*dx/dy; y1 = fyres; }
else if (y1 < 0) { x1 += ( 0-y1)*dx/dy; y1 = 0; } else if (y1 < 0) { x1 += ( 0-y1)*dx/dy; y1 = 0; }
if (fabs(dx) > fabs(dy)) if (fabs(dx) > fabs(dy))
@ -415,9 +415,9 @@ void gltexinvalidate (long dapicnum, long dapalnum, long dameth)
{ pth->flags |= 128; } { pth->flags |= 128; }
} }
//Make all textures "dirty" so they reload, but not re-allocate //Make all textures "dirty" so they reload, but not re-allocate
//This should be much faster than polymost_glreset() //This should be much faster than polymost_glreset()
//Use this for palette effects ... but not ones that change every frame! //Use this for palette effects ... but not ones that change every frame!
void gltexinvalidateall () void gltexinvalidateall ()
{ {
long j; long j;
@ -492,7 +492,7 @@ void gltexapplyprops (void)
static float glox1, gloy1, glox2, gloy2; static float glox1, gloy1, glox2, gloy2;
//Use this for both initialization and uninitialization of OpenGL. //Use this for both initialization and uninitialization of OpenGL.
static int gltexcacnum = -1; static int gltexcacnum = -1;
void polymost_glreset () void polymost_glreset ()
{ {
@ -1247,10 +1247,10 @@ int gloadtile_hi(long dapic, long facen, hicreplctyp *hicr, long dameth, pthtyp
#endif #endif
//(dpx,dpy) specifies an n-sided polygon. The polygon must be a convex clockwise loop. //(dpx,dpy) specifies an n-sided polygon. The polygon must be a convex clockwise loop.
// n must be <= 8 (assume clipping can double number of vertices) // n must be <= 8 (assume clipping can double number of vertices)
//method: 0:solid, 1:masked(255 is transparent), 2:transluscent #1, 3:transluscent #2 //method: 0:solid, 1:masked(255 is transparent), 2:transluscent #1, 3:transluscent #2
// +4 means it's a sprite, so wraparound isn't needed // +4 means it's a sprite, so wraparound isn't needed
static long pow2xsplit = 0, skyclamphack = 0; static long pow2xsplit = 0, skyclamphack = 0;
void drawpoly (double *dpx, double *dpy, long n, long method) void drawpoly (double *dpx, double *dpy, long n, long method)
@ -1863,12 +1863,12 @@ void drawpoly (double *dpx, double *dpy, long n, long method)
} }
} }
/*Init viewport boundary (must be 4 point convex loop): /*Init viewport boundary (must be 4 point convex loop):
// (px[0],py[0]).----.(px[1],py[1]) // (px[0],py[0]).----.(px[1],py[1])
// / \ // / \
// / \ // / \
// (px[3],py[3]).--------------.(px[2],py[2]) // (px[3],py[3]).--------------.(px[2],py[2])
*/ */
void initmosts (double *px, double *py, long n) void initmosts (double *px, double *py, long n)
{ {
long i, j, k, imin; long i, j, k, imin;
@ -3495,9 +3495,9 @@ void polymost_drawmaskwall (long damaskwallcnt)
//Clip to close parallel-screen plane //Clip to close parallel-screen plane
oxp0 = xp0; oyp0 = yp0; oxp0 = xp0; oyp0 = yp0;
if (yp0 < SCISDIST) { t0 = (SCISDIST-yp0)/(yp1-yp0); xp0 = (xp1-xp0)*t0+xp0; yp0 = SCISDIST; } if (yp0 < SCISDIST) { t0 = (SCISDIST-yp0)/(yp1-yp0); xp0 = (xp1-xp0)*t0+xp0; yp0 = SCISDIST; }
else t0 = 0.f; else t0 = 0.f;
if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; yp1 = SCISDIST; } if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; yp1 = SCISDIST; }
else { t1 = 1.f; } else { t1 = 1.f; }
getzsofslope(sectnum,(long)((wal2->x-wal->x)*t0+wal->x),(long)((wal2->y-wal->y)*t0+wal->y),&cz[0],&fz[0]); getzsofslope(sectnum,(long)((wal2->x-wal->x)*t0+wal->x),(long)((wal2->y-wal->y)*t0+wal->y),&cz[0],&fz[0]);
@ -3655,7 +3655,7 @@ void polymost_drawsprite (long snum)
} }
method = 1+4; method = 1+4;
if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; }
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (!nofog && rendmode == 3) { if (!nofog && rendmode == 3) {
@ -3943,18 +3943,18 @@ void polymost_drawsprite (long snum)
} }
} }
//sx,sy center of sprite; screen coods*65536 //sx,sy center of sprite; screen coods*65536
//z zoom*65536. > is zoomed in //z zoom*65536. > is zoomed in
//a angle (0 is default) //a angle (0 is default)
//dastat&1 1:translucence //dastat&1 1:translucence
//dastat&2 1:auto-scale mode (use 320*200 coordinates) //dastat&2 1:auto-scale mode (use 320*200 coordinates)
//dastat&4 1:y-flip //dastat&4 1:y-flip
//dastat&8 1:don't clip to startumost/startdmost //dastat&8 1:don't clip to startumost/startdmost
//dastat&16 1:force point passed to be top-left corner, 0:Editart center //dastat&16 1:force point passed to be top-left corner, 0:Editart center
//dastat&32 1:reverse translucence //dastat&32 1:reverse translucence
//dastat&64 1:non-masked, 0:masked //dastat&64 1:non-masked, 0:masked
//dastat&128 1:draw all pages (permanent) //dastat&128 1:draw all pages (permanent)
//cx1,... clip window (actual screen coords) //cx1,... clip window (actual screen coords)
void polymost_dorotatesprite (long sx, long sy, long z, short a, short picnum, void polymost_dorotatesprite (long sx, long sy, long z, short a, short picnum,
signed char dashade, char dapalnum, char dastat, long cx1, long cy1, long cx2, long cy2, long uniqid) signed char dashade, char dapalnum, char dastat, long cx1, long cy1, long cx2, long cy2, long uniqid)
{ {
@ -4129,7 +4129,7 @@ void polymost_dorotatesprite (long sx, long sy, long z, short a, short picnum,
method |= 4; //Use OpenGL clamping - dorotatesprite never repeats method |= 4; //Use OpenGL clamping - dorotatesprite never repeats
xsiz = tilesizx[globalpicnum]; ysiz = tilesizy[globalpicnum]; xsiz = tilesizx[globalpicnum]; ysiz = tilesizy[globalpicnum];
if (dastat&16) { xoff = 0; yoff = 0; } if (dastat&16) { xoff = 0; yoff = 0; }
else else
{ {
xoff = (long)((signed char)((picanm[globalpicnum]>>8)&255))+(xsiz>>1); xoff = (long)((signed char)((picanm[globalpicnum]>>8)&255))+(xsiz>>1);
@ -4257,7 +4257,7 @@ static void drawtrap (float x0, float x1, float y0, float x2, float x3, float y1
if (y0 == y1) return; if (y0 == y1) return;
px[0] = x0; py[0] = y0; py[2] = y1; px[0] = x0; py[0] = y0; py[2] = y1;
if (x0 == x1) { px[1] = x3; py[1] = y1; px[2] = x2; n = 3; } if (x0 == x1) { px[1] = x3; py[1] = y1; px[2] = x2; n = 3; }
else if (x2 == x3) { px[1] = x1; py[1] = y0; px[2] = x3; n = 3; } else if (x2 == x3) { px[1] = x1; py[1] = y0; px[2] = x3; n = 3; }
else { px[1] = x1; py[1] = y0; px[2] = x3; px[3] = x2; py[3] = y1; n = 4; } else { px[1] = x1; py[1] = y0; px[2] = x3; px[3] = x2; py[3] = y1; n = 4; }

View file

@ -364,7 +364,7 @@ int scriptfile_addsymbolvalue(char *name, int val)
{ {
int x; int x;
char *sp; char *sp;
// if (scriptfile_getsymbolvalue(name, &x)) return -1; // already exists // if (scriptfile_getsymbolvalue(name, &x)) return -1; // already exists
if (symbtab) { if (symbtab) {
char *scanner = symbtab; char *scanner = symbtab;

View file

@ -1077,7 +1077,7 @@ void enddrawing(void)
} }
if (!frameplace) return; if (!frameplace) return;
if (lockcount > 1) { lockcount--; return; } if (lockcount > 1) { lockcount--; return; }
if (!offscreenrendering) frameplace = 0; if (!offscreenrendering) frameplace = 0;
if (lockcount == 0) return; if (lockcount == 0) return;
lockcount = 0; lockcount = 0;

View file

@ -135,7 +135,7 @@ void setears(long daposx, long daposy, long daxvect, long dayvect)
void wsayfollow(char *dafilename, long dafreq, long davol, long *daxplc, long *dayplc, char followstat) void wsayfollow(char *dafilename, long dafreq, long davol, long *daxplc, long *dayplc, char followstat)
{ {
/* /*
dafilename: dafilename:
filename filename
@ -154,7 +154,7 @@ void wsayfollow(char *dafilename, long dafreq, long davol, long *daxplc, long *d
followstat: followstat:
0 = position is fixed in space 0 = position is fixed in space
1 = position follows an object 1 = position follows an object
*/ */
unsigned char ch1, ch2; unsigned char ch1, ch2;
long i, wavnum, bad, oldest=0, free=-1, ox, oy, x, y, vo; long i, wavnum, bad, oldest=0, free=-1, ox, oy, x, y, vo;
unsigned int oldestpos=0; unsigned int oldestpos=0;

View file

@ -618,7 +618,7 @@ void initprintf(const char *f, ...)
//int i = 0; //int i = 0;
static int newline = 0;//1; static int newline = 0;//1;
// int overwriteline = -1; // int overwriteline = -1;
va_start(va, f); va_start(va, f);
Bvsnprintf(buf, 1024, f, va); Bvsnprintf(buf, 1024, f, va);
@ -763,7 +763,7 @@ static struct {
{ "keyboard", &lpDID[KEYBOARD], &c_dfDIKeyboard }, { "keyboard", &lpDID[KEYBOARD], &c_dfDIKeyboard },
{ "mouse", &lpDID[MOUSE], &c_dfDIMouse }, { "mouse", &lpDID[MOUSE], &c_dfDIMouse },
{ "joystick", &lpDID[JOYSTICK], &c_dfDIJoystick } { "joystick", &lpDID[JOYSTICK], &c_dfDIJoystick }
}; };
static struct _joydef { static struct _joydef {
const char *name; const char *name;
unsigned ofs; // directinput 'dwOfs' value unsigned ofs; // directinput 'dwOfs' value
@ -784,7 +784,7 @@ struct _joydevicedefn {
struct _joydevicefeature joyfeatures_C20A046D[] = { // Logitech WingMan RumblePad USB struct _joydevicefeature joyfeatures_C20A046D[] = { // Logitech WingMan RumblePad USB
{ 0, "Left Stick X" }, { 4, "Left Stick Y" }, { 8, "Right Stick X" }, { 0, "Left Stick X" }, { 4, "Left Stick Y" }, { 8, "Right Stick X" },
{ 20, "Right Stick Y" }, { 24, "Throttle" }, { 20, "Right Stick Y" }, { 24, "Throttle" },
}; };
struct _joydevicefeature joyfeatures_C218046D[] = { // Logitech RumblePad 2 USB struct _joydevicefeature joyfeatures_C218046D[] = { // Logitech RumblePad 2 USB
{ 0, "Left Stick X" }, { 4, "Left Stick Y" }, { 8, "Right Stick X" }, { 0, "Left Stick X" }, { 4, "Left Stick Y" }, { 8, "Right Stick X" },
{ 20, "Right Stick Y" }, { 32, "D-Pad" }, { 48, "Button 1" }, { 20, "Right Stick Y" }, { 32, "D-Pad" }, { 48, "Button 1" },
@ -792,12 +792,12 @@ struct _joydevicefeature joyfeatures_C218046D[] = { // Logitech RumblePad 2 USB
{ 52, "Button 5" }, { 53, "Button 6" }, { 54, "Button 7" }, { 52, "Button 5" }, { 53, "Button 6" }, { 54, "Button 7" },
{ 55, "Button 8" }, { 56, "Button 9" }, { 57, "Button 10" }, { 55, "Button 8" }, { 56, "Button 9" }, { 57, "Button 10" },
{ 58, "Left Stick Press" }, { 59, "Right Stick Press" }, { 58, "Left Stick Press" }, { 59, "Right Stick Press" },
}; };
#define featurecount(x) (sizeof(x)/sizeof(struct _joydevicefeature)) #define featurecount(x) (sizeof(x)/sizeof(struct _joydevicefeature))
static struct _joydevicedefn *thisjoydef = NULL, joyfeatures[] = { static struct _joydevicedefn *thisjoydef = NULL, joyfeatures[] = {
{ 0xC20A046D, featurecount(joyfeatures_C20A046D), joyfeatures_C20A046D }, // Logitech WingMan RumblePad USB { 0xC20A046D, featurecount(joyfeatures_C20A046D), joyfeatures_C20A046D }, // Logitech WingMan RumblePad USB
{ 0xC218046D, featurecount(joyfeatures_C218046D), joyfeatures_C218046D }, // Logitech RumblePad 2 USB { 0xC218046D, featurecount(joyfeatures_C218046D), joyfeatures_C218046D }, // Logitech RumblePad 2 USB
}; };
#undef featurecount #undef featurecount
// I don't see any pressing need to store the key-up events yet // I don't see any pressing need to store the key-up events yet
@ -994,7 +994,7 @@ void getjoydeadzone(int axis, unsigned short *dead, unsigned short *satur)
HRESULT result; HRESULT result;
if (!dead || !satur) return; if (!dead || !satur) return;
if (!lpDID[JOYSTICK]) { *dead = *satur = 0; return; } if (!lpDID[JOYSTICK]) { *dead = *satur = 0; return; }
if (axis >= joynumaxes) { *dead = *satur = 0; return; } if (axis >= joynumaxes) { *dead = *satur = 0; return; }
memset(&dipdw, 0, sizeof(dipdw)); memset(&dipdw, 0, sizeof(dipdw));
@ -1203,14 +1203,14 @@ static BOOL InitDirectInput(void)
// create a new DirectInput object // create a new DirectInput object
initprintf(" - Creating DirectInput object\n"); initprintf(" - Creating DirectInput object\n");
result = aDirectInputCreateA(hInstance, DIRECTINPUT_VERSION, &lpDI, NULL); result = aDirectInputCreateA(hInstance, DIRECTINPUT_VERSION, &lpDI, NULL);
if FAILED(result) { HorribleDInputDeath("DirectInputCreateA() failed", result); } if FAILED(result) { HorribleDInputDeath("DirectInputCreateA() failed", result); }
else if (result != DI_OK) initprintf(" Created DirectInput object with warning: %s\n",GetDInputError(result)); else if (result != DI_OK) initprintf(" Created DirectInput object with warning: %s\n",GetDInputError(result));
// enumerate devices to make us look fancy // enumerate devices to make us look fancy
initprintf(" - Enumerating attached input devices\n"); initprintf(" - Enumerating attached input devices\n");
inputdevices = 0; inputdevices = 0;
result = IDirectInput_EnumDevices(lpDI, 0, InitDirectInput_enum, NULL, DIEDFL_ATTACHEDONLY); result = IDirectInput_EnumDevices(lpDI, 0, InitDirectInput_enum, NULL, DIEDFL_ATTACHEDONLY);
if FAILED(result) { HorribleDInputDeath("Failed enumerating attached input devices", result); } if FAILED(result) { HorribleDInputDeath("Failed enumerating attached input devices", result); }
else if (result != DI_OK) initprintf(" Enumerated input devices with warning: %s\n",GetDInputError(result)); else if (result != DI_OK) initprintf(" Enumerated input devices with warning: %s\n",GetDInputError(result));
if (!(inputdevices & (1<<KEYBOARD))) { if (!(inputdevices & (1<<KEYBOARD))) {
ShowErrorBox("No keyboard detected!"); ShowErrorBox("No keyboard detected!");
@ -1950,7 +1950,7 @@ static int syscolouridx[NUM_SYS_COLOURS] = {
COLOR_3DLIGHT, COLOR_3DLIGHT,
COLOR_INFOTEXT, COLOR_INFOTEXT,
COLOR_INFOBK // 25 COLOR_INFOBK // 25
}; };
static DWORD syscolours[NUM_SYS_COLOURS]; static DWORD syscolours[NUM_SYS_COLOURS];
static char system_colours_saved = 0, bw_colours_set = 0; static char system_colours_saved = 0, bw_colours_set = 0;
@ -2268,7 +2268,7 @@ void enddrawing(void)
} }
if (!frameplace) return; if (!frameplace) return;
if (lockcount > 1) { lockcount--; return; } if (lockcount > 1) { lockcount--; return; }
if (!offscreenrendering) frameplace = 0; if (!offscreenrendering) frameplace = 0;
lockcount = 0; lockcount = 0;
} }
@ -3385,11 +3385,11 @@ static void SetBWSystemColours(void)
{ {
#define WHI RGB(255,255,255) #define WHI RGB(255,255,255)
#define BLA RGB(0,0,0) #define BLA RGB(0,0,0)
static COLORREF syscoloursbw[NUM_SYS_COLOURS] = { static COLORREF syscoloursbw[NUM_SYS_COLOURS] = {
WHI, BLA, BLA, WHI, WHI, WHI, WHI, BLA, BLA, WHI, WHI, BLA, BLA, WHI, WHI, WHI, WHI, BLA, BLA, WHI,
WHI, WHI, WHI, BLA, WHI, WHI, BLA, BLA, BLA, BLA, WHI, WHI, WHI, BLA, WHI, WHI, BLA, BLA, BLA, BLA,
BLA, BLA, WHI, BLA, WHI BLA, BLA, WHI, BLA, WHI
}; };
#undef WHI #undef WHI
#undef BLA #undef BLA
if (!system_colours_saved || bw_colours_set) return; if (!system_colours_saved || bw_colours_set) return;
@ -3629,10 +3629,10 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
if (appactive) { if (appactive) {
setpalette(0,0,0); setpalette(0,0,0);
SetBWSystemColours(); SetBWSystemColours();
// initprintf("Resetting palette.\n"); // initprintf("Resetting palette.\n");
} else { } else {
RestoreSystemColours(); RestoreSystemColours();
// initprintf("Resetting system colours.\n"); // initprintf("Resetting system colours.\n");
} }
} }