mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
Formatting change
git-svn-id: https://svn.eduke32.com/eduke32@331 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
757da2432b
commit
37dea75dc6
44 changed files with 13087 additions and 12209 deletions
|
@ -40,7 +40,7 @@ void hlineasm4(long cnt, long skiploadincs, long paloffs, unsigned long by, unsi
|
|||
|
||||
palptr = (char *)&ghlinepal[paloffs];
|
||||
if (!skiploadincs) { gbxinc = asm1; gbyinc = asm2; }
|
||||
for(;cnt>=0;cnt--)
|
||||
for (;cnt>=0;cnt--)
|
||||
{
|
||||
*((char *)p) = palptr[gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))]];
|
||||
bx -= gbxinc;
|
||||
|
@ -63,7 +63,7 @@ void slopevlin(long p, long i, long slopaloffs, long cnt, long bx, long by)
|
|||
|
||||
bz = asm3; bzinc = (asm1>>3);
|
||||
slopalptr = (long *)slopaloffs;
|
||||
for(;cnt>0;cnt--)
|
||||
for (;cnt>0;cnt--)
|
||||
{
|
||||
i = krecip(bz>>6); bz += bzinc;
|
||||
u = bx+globalx3*i;
|
||||
|
@ -81,7 +81,7 @@ void vlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufpl
|
|||
{
|
||||
gbuf = (char *)bufplc;
|
||||
gpal = (char *)paloffs;
|
||||
for(;cnt>=0;cnt--)
|
||||
for (;cnt>=0;cnt--)
|
||||
{
|
||||
*((char *)p) = gpal[gbuf[vplc>>glogy]];
|
||||
p += bpl;
|
||||
|
@ -96,7 +96,7 @@ void mvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufp
|
|||
|
||||
gbuf = (char *)bufplc;
|
||||
gpal = (char *)paloffs;
|
||||
for(;cnt>=0;cnt--)
|
||||
for (;cnt>=0;cnt--)
|
||||
{
|
||||
ch = gbuf[vplc>>glogy]; if (ch != 255) *((char *)p) = gpal[ch];
|
||||
p += bpl;
|
||||
|
@ -113,7 +113,7 @@ void tvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufp
|
|||
gpal = (char *)paloffs;
|
||||
if (transmode)
|
||||
{
|
||||
for(;cnt>=0;cnt--)
|
||||
for (;cnt>=0;cnt--)
|
||||
{
|
||||
ch = gbuf[vplc>>glogy];
|
||||
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
|
||||
|
@ -123,7 +123,7 @@ void tvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufp
|
|||
}
|
||||
else
|
||||
{
|
||||
for(;cnt>=0;cnt--)
|
||||
for (;cnt>=0;cnt--)
|
||||
{
|
||||
ch = gbuf[vplc>>glogy];
|
||||
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
|
||||
|
@ -141,7 +141,7 @@ void mhline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned lon
|
|||
|
||||
gbuf = (char *)bufplc;
|
||||
gpal = (char *)asm3;
|
||||
for(cntup16>>=16;cntup16>0;cntup16--)
|
||||
for (cntup16>>=16;cntup16>0;cntup16--)
|
||||
{
|
||||
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
|
||||
if (ch != 255) *((char *)p) = gpal[ch];
|
||||
|
@ -160,7 +160,7 @@ void thline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned lon
|
|||
gpal = (char *)asm3;
|
||||
if (transmode)
|
||||
{
|
||||
for(cntup16>>=16;cntup16>0;cntup16--)
|
||||
for (cntup16>>=16;cntup16>0;cntup16--)
|
||||
{
|
||||
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
|
||||
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
|
||||
|
@ -171,7 +171,7 @@ void thline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned lon
|
|||
}
|
||||
else
|
||||
{
|
||||
for(cntup16>>=16;cntup16>0;cntup16--)
|
||||
for (cntup16>>=16;cntup16>0;cntup16--)
|
||||
{
|
||||
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
|
||||
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
|
||||
|
@ -194,7 +194,7 @@ void setupspritevline(long paloffs, long bxinc, long byinc, long ysiz)
|
|||
void spritevline(long bx, long by, long cnt, long bufplc, long p)
|
||||
{
|
||||
gbuf = (char *)bufplc;
|
||||
for(;cnt>1;cnt--)
|
||||
for (;cnt>1;cnt--)
|
||||
{
|
||||
(*(char *)p) = gpal[gbuf[(bx>>16)*glogy+(by>>16)]];
|
||||
bx += gbxinc;
|
||||
|
@ -216,7 +216,7 @@ void mspritevline(long bx, long by, long cnt, long bufplc, long p)
|
|||
char ch;
|
||||
|
||||
gbuf = (char *)bufplc;
|
||||
for(;cnt>1;cnt--)
|
||||
for (;cnt>1;cnt--)
|
||||
{
|
||||
ch = gbuf[(bx>>16)*glogy+(by>>16)];
|
||||
if (ch != 255) (*(char *)p) = gpal[ch];
|
||||
|
@ -240,7 +240,7 @@ void tspritevline(long bx, long by, long cnt, long bufplc, long p)
|
|||
gbuf = (char *)bufplc;
|
||||
if (transmode)
|
||||
{
|
||||
for(;cnt>1;cnt--)
|
||||
for (;cnt>1;cnt--)
|
||||
{
|
||||
ch = gbuf[(bx>>16)*glogy+(by>>16)];
|
||||
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
|
||||
|
@ -251,7 +251,7 @@ void tspritevline(long bx, long by, long cnt, long bufplc, long p)
|
|||
}
|
||||
else
|
||||
{
|
||||
for(;cnt>1;cnt--)
|
||||
for (;cnt>1;cnt--)
|
||||
{
|
||||
ch = gbuf[(bx>>16)*glogy+(by>>16)];
|
||||
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
|
||||
|
@ -271,7 +271,7 @@ void drawslab (long dx, long v, long dy, long vi, long vptr, long p)
|
|||
|
||||
while (dy > 0)
|
||||
{
|
||||
for(x=0;x<dx;x++) *(char *)(p+x) = gpal[(long)(*(char *)((v>>16)+vptr))];
|
||||
for (x=0;x<dx;x++) *(char *)(p+x) = gpal[(long)(*(char *)((v>>16)+vptr))];
|
||||
p += bpl; v += vi; dy--;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -23,7 +23,7 @@ static long kzipopen(char *filnam)
|
|||
char newst[BMAX_PATH+4];
|
||||
|
||||
newst[0] = '|';
|
||||
for(i=0;filnam[i] && (i < sizeof(newst)-2);i++) newst[i+1] = filnam[i];
|
||||
for (i=0;filnam[i] && (i < sizeof(newst)-2);i++) newst[i+1] = filnam[i];
|
||||
newst[i+1] = 0;
|
||||
return(kzopen(newst));
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ static long cachesize = 0;
|
|||
long cachecount = 0;
|
||||
char zerochar = 0;
|
||||
long cachestart = 0, cacnum = 0, agecount = 0;
|
||||
typedef struct { long *hand, leng; char *lock; } cactype;
|
||||
typedef struct { long *hand, leng; char *lock ; } cactype;
|
||||
cactype cac[MAXCACHEOBJECTS];
|
||||
static long lockrecip[200];
|
||||
|
||||
|
@ -83,7 +83,7 @@ void initcache(long dacachestart, long dacachesize)
|
|||
{
|
||||
long i;
|
||||
|
||||
for(i=1;i<200;i++) lockrecip[i] = (1<<28)/(200-i);
|
||||
for (i=1;i<200;i++) lockrecip[i] = (1<<28)/(200-i);
|
||||
|
||||
cachestart = dacachestart;
|
||||
cachesize = dacachesize;
|
||||
|
@ -115,13 +115,13 @@ void allocache(long *newhandle, long newbytes, char *newlockptr)
|
|||
|
||||
//Find best place
|
||||
bestval = 0x7fffffff; o1 = cachesize;
|
||||
for(z=cacnum-1;z>=0;z--)
|
||||
for (z=cacnum-1;z>=0;z--)
|
||||
{
|
||||
o1 -= cac[z].leng;
|
||||
o2 = o1+newbytes; if (o2 > cachesize) continue;
|
||||
|
||||
daval = 0;
|
||||
for(i=o1,zz=z;i<o2;i+=cac[zz++].leng)
|
||||
for (i=o1,zz=z;i<o2;i+=cac[zz++].leng)
|
||||
{
|
||||
if (*cac[zz].lock == 0) continue;
|
||||
if (*cac[zz].lock >= 200) { daval = 0x7fffffff; break; }
|
||||
|
@ -141,7 +141,7 @@ void allocache(long *newhandle, long newbytes, char *newlockptr)
|
|||
reportandexit("CACHE SPACE ALL LOCKED UP!");
|
||||
|
||||
//Suck things out
|
||||
for(sucklen=-newbytes,suckz=bestz;sucklen<0;sucklen+=cac[suckz++].leng)
|
||||
for (sucklen=-newbytes,suckz=bestz;sucklen<0;sucklen+=cac[suckz++].leng)
|
||||
if (*cac[suckz].lock) *cac[suckz].hand = 0;
|
||||
|
||||
//Remove all blocks except 1
|
||||
|
@ -167,7 +167,7 @@ void allocache(long *newhandle, long newbytes, char *newlockptr)
|
|||
if (*cac[bestz].lock == 0) { cac[bestz].leng += sucklen; return; }
|
||||
|
||||
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];
|
||||
cac[bestz].leng = sucklen;
|
||||
cac[bestz].lock = &zerochar;
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ void suckcache(long *suckptr)
|
|||
long i;
|
||||
|
||||
//Can't exit early, because invalid pointer might be same even though lock = 0
|
||||
for(i=0;i<cacnum;i++)
|
||||
for (i=0;i<cacnum;i++)
|
||||
if ((long)(*cac[i].hand) == (long)suckptr)
|
||||
{
|
||||
if (*cac[i].lock) *cac[i].hand = 0;
|
||||
|
@ -205,7 +205,7 @@ void agecache(void)
|
|||
|
||||
if (agecount >= cacnum) agecount = cacnum-1;
|
||||
if (agecount < 0) return;
|
||||
for(cnt=(cacnum>>4);cnt>=0;cnt--)
|
||||
for (cnt=(cacnum>>4);cnt>=0;cnt--)
|
||||
{
|
||||
ch = (*cac[agecount].lock);
|
||||
if (((ch-2)&255) < 198)
|
||||
|
@ -221,7 +221,7 @@ static void reportandexit(char *errormessage)
|
|||
|
||||
//setvmode(0x3);
|
||||
j = 0;
|
||||
for(i=0;i<cacnum;i++)
|
||||
for (i=0;i<cacnum;i++)
|
||||
{
|
||||
Bprintf("%ld- ",i);
|
||||
if (cac[i].hand) Bprintf("ptr: 0x%lx, ",*cac[i].hand);
|
||||
|
@ -424,7 +424,7 @@ long initgroupfile(char *filename)
|
|||
#ifdef WITHKPLIB
|
||||
char *zfn;
|
||||
searchpath_t *sp = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
// on Windows, translate all backslashes (0x5c) to forward slashes (0x2f)
|
||||
|
@ -477,7 +477,7 @@ if (i < 0) { free(zfn); return -1; }
|
|||
Bread(groupfil[numgroupfiles],gfilelist[numgroupfiles],gnumfiles[numgroupfiles]<<4);
|
||||
|
||||
j = 0;
|
||||
for(i=0;i<gnumfiles[numgroupfiles];i++)
|
||||
for (i=0;i<gnumfiles[numgroupfiles];i++)
|
||||
{
|
||||
k = B_LITTLE32(*((long *)&gfilelist[numgroupfiles][(i<<4)+12]));
|
||||
gfilelist[numgroupfiles][(i<<4)+12] = 0;
|
||||
|
@ -494,7 +494,7 @@ void uninitsinglegroupfile(long grphandle)
|
|||
{
|
||||
long i, grpnum = -1;
|
||||
|
||||
for(i=numgroupfiles-1;i>=0;i--)
|
||||
for (i=numgroupfiles-1;i>=0;i--)
|
||||
if (groupfil[i] != -1 && groupfil[i] == grphandle)
|
||||
{
|
||||
kfree(gfilelist[i]);
|
||||
|
@ -522,7 +522,7 @@ void uninitsinglegroupfile(long grphandle)
|
|||
}
|
||||
|
||||
// fix up the open files that need attention
|
||||
for(i=0;i<MAXOPENFILES;i++) {
|
||||
for (i=0;i<MAXOPENFILES;i++) {
|
||||
if (filegrp[i] >= 254) // external file (255) or ZIPped file (254)
|
||||
continue;
|
||||
else if (filegrp[i] == grpnum) // close file in group we closed
|
||||
|
@ -536,7 +536,7 @@ void uninitgroupfile(void)
|
|||
{
|
||||
long i;
|
||||
|
||||
for(i=numgroupfiles-1;i>=0;i--)
|
||||
for (i=numgroupfiles-1;i>=0;i--)
|
||||
if (groupfil[i] != -1)
|
||||
{
|
||||
kfree(gfilelist[i]);
|
||||
|
@ -547,7 +547,7 @@ void uninitgroupfile(void)
|
|||
numgroupfiles = 0;
|
||||
|
||||
// JBF 20040111: "close" any files open in groups
|
||||
for(i=0;i<MAXOPENFILES;i++) {
|
||||
for (i=0;i<MAXOPENFILES;i++) {
|
||||
if (filegrp[i] < 254) // JBF 20040130: not external or ZIPped
|
||||
filehan[i] = -1;
|
||||
}
|
||||
|
@ -596,17 +596,17 @@ long kopen4load(char *filename, char searchfirst)
|
|||
}
|
||||
#endif
|
||||
|
||||
for(k=numgroupfiles-1;k>=0;k--)
|
||||
for (k=numgroupfiles-1;k>=0;k--)
|
||||
{
|
||||
if (searchfirst == 1) k = 0;
|
||||
if (groupfil[k] >= 0)
|
||||
{
|
||||
for(i=gnumfiles[k]-1;i>=0;i--)
|
||||
for (i=gnumfiles[k]-1;i>=0;i--)
|
||||
{
|
||||
gfileptr = (char *)&gfilelist[k][i<<4];
|
||||
|
||||
bad = 0;
|
||||
for(j=0;j<13;j++)
|
||||
for (j=0;j<13;j++)
|
||||
{
|
||||
if (!filename[j]) break;
|
||||
if (toupperlookup[filename[j]] != toupperlookup[gfileptr[j]])
|
||||
|
@ -688,13 +688,16 @@ long klseek(long handle, long offset, long whence)
|
|||
|
||||
if (groupfil[groupnum] != -1)
|
||||
{
|
||||
switch(whence)
|
||||
switch (whence)
|
||||
{
|
||||
case BSEEK_SET: filepos[handle] = offset; break;
|
||||
case BSEEK_END: i = filehan[handle];
|
||||
case BSEEK_SET:
|
||||
filepos[handle] = offset; break;
|
||||
case BSEEK_END:
|
||||
i = filehan[handle];
|
||||
filepos[handle] = (gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i])+offset;
|
||||
break;
|
||||
case BSEEK_CUR: filepos[handle] += offset; break;
|
||||
case BSEEK_CUR:
|
||||
filepos[handle] += offset; break;
|
||||
}
|
||||
return(filepos[handle]);
|
||||
}
|
||||
|
@ -902,7 +905,8 @@ CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int type)
|
|||
case -1: goto failure;
|
||||
//case 1: initprintf("%s:%s dropped for lower priority\n", d,dirent->name); break;
|
||||
//case 0: initprintf("%s:%s accepted\n", d,dirent->name); break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
Bclosedir(dir);
|
||||
|
@ -970,10 +974,12 @@ CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int type)
|
|||
|
||||
// the entry is in the clear
|
||||
switch (klistaddentry(&rec, buf, ftype, CACHE1D_SOURCE_ZIP)) {
|
||||
case -1: goto failure;
|
||||
case -1:
|
||||
goto failure;
|
||||
//case 1: initprintf("<ZIP>:%s dropped for lower priority\n", buf); break;
|
||||
//case 0: initprintf("<ZIP>:%s accepted\n", buf); break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -985,15 +991,17 @@ CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int type)
|
|||
buf[12] = 0;
|
||||
for (i=0;i<MAXGROUPFILES;i++) {
|
||||
if (groupfil[i] == -1) continue;
|
||||
for(j=gnumfiles[i]-1;j>=0;j--)
|
||||
for (j=gnumfiles[i]-1;j>=0;j--)
|
||||
{
|
||||
Bmemcpy(buf,&gfilelist[i][j<<4],12);
|
||||
if (!Bwildmatch(buf,mask)) continue;
|
||||
switch (klistaddentry(&rec, buf, CACHE1D_FIND_FILE, CACHE1D_SOURCE_GRP)) {
|
||||
case -1: goto failure;
|
||||
case -1:
|
||||
goto failure;
|
||||
//case 1: initprintf("<GRP>:%s dropped for lower priority\n", workspace); break;
|
||||
//case 0: initprintf("<GRP>:%s accepted\n", workspace); break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1052,7 +1060,7 @@ if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
|
|||
copybufbyte(lzwbuf4,ptr,(long)dasizeof);
|
||||
k += (long)dasizeof;
|
||||
|
||||
for(i=1;i<count;i++)
|
||||
for (i=1;i<count;i++)
|
||||
{
|
||||
if (k >= kgoal)
|
||||
{
|
||||
|
@ -1060,7 +1068,7 @@ if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
|
|||
if (kread(fil,lzwbuf5,(long)leng) != leng) return -1;
|
||||
k = 0; kgoal = lzwuncompress(lzwbuf5,(long)leng,lzwbuf4);
|
||||
}
|
||||
for(j=0;j<dasizeof;j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
|
||||
for (j=0;j<dasizeof;j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
|
||||
k += dasizeof;
|
||||
ptr += dasizeof;
|
||||
}
|
||||
|
@ -1091,7 +1099,7 @@ if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
|
|||
copybufbyte(lzwbuf4,ptr,(long)dasizeof);
|
||||
k += (long)dasizeof;
|
||||
|
||||
for(i=1;i<count;i++)
|
||||
for (i=1;i<count;i++)
|
||||
{
|
||||
if (k >= kgoal)
|
||||
{
|
||||
|
@ -1099,7 +1107,7 @@ if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
|
|||
if (Bfread(lzwbuf5,(long)leng,1,fil) != 1) return -1;
|
||||
k = 0; kgoal = lzwuncompress(lzwbuf5,(long)leng,lzwbuf4);
|
||||
}
|
||||
for(j=0;j<dasizeof;j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
|
||||
for (j=0;j<dasizeof;j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
|
||||
k += dasizeof;
|
||||
ptr += dasizeof;
|
||||
}
|
||||
|
@ -1132,9 +1140,9 @@ if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
|
|||
Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(long)leng);
|
||||
}
|
||||
|
||||
for(i=1;i<count;i++)
|
||||
for (i=1;i<count;i++)
|
||||
{
|
||||
for(j=0;j<dasizeof;j++) lzwbuf4[j+k] = ((ptr[j+dasizeof]-ptr[j])&255);
|
||||
for (j=0;j<dasizeof;j++) lzwbuf4[j+k] = ((ptr[j+dasizeof]-ptr[j])&255);
|
||||
k += dasizeof;
|
||||
if (k > LZWSIZE-dasizeof)
|
||||
{
|
||||
|
@ -1176,9 +1184,9 @@ if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
|
|||
Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(long)leng,1,fil);
|
||||
}
|
||||
|
||||
for(i=1;i<count;i++)
|
||||
for (i=1;i<count;i++)
|
||||
{
|
||||
for(j=0;j<dasizeof;j++) lzwbuf4[j+k] = ((ptr[j+dasizeof]-ptr[j])&255);
|
||||
for (j=0;j<dasizeof;j++) lzwbuf4[j+k] = ((ptr[j+dasizeof]-ptr[j])&255);
|
||||
k += dasizeof;
|
||||
if (k > LZWSIZE-dasizeof)
|
||||
{
|
||||
|
@ -1201,7 +1209,7 @@ static long lzwcompress(char *lzwinbuf, long uncompleng, char *lzwoutbuf)
|
|||
long bytecnt1, bitcnt, numbits, oneupnumbits;
|
||||
short *shortptr;
|
||||
|
||||
for(i=255;i>=0;i--) { lzwbuf1[i] = i; lzwbuf3[i] = (i+1)&255; }
|
||||
for (i=255;i>=0;i--) { lzwbuf1[i] = i; lzwbuf3[i] = (i+1)&255; }
|
||||
clearbuf(lzwbuf2,256>>1,0xffffffff);
|
||||
clearbuf(lzwoutbuf,((uncompleng+15)+3)>>2,0L);
|
||||
|
||||
|
@ -1253,7 +1261,7 @@ static long lzwcompress(char *lzwinbuf, long uncompleng, char *lzwoutbuf)
|
|||
return((bitcnt+7)>>3);
|
||||
}
|
||||
shortptr[1] = (short)0;
|
||||
for(i=0;i<uncompleng;i++) lzwoutbuf[i+4] = lzwinbuf[i];
|
||||
for (i=0;i<uncompleng;i++) lzwoutbuf[i+4] = lzwinbuf[i];
|
||||
return(uncompleng+4);
|
||||
}
|
||||
|
||||
|
@ -1270,7 +1278,7 @@ static long lzwuncompress(char *lzwinbuf, long compleng, char *lzwoutbuf)
|
|||
copybuf(lzwinbuf+4,lzwoutbuf,((compleng-4)+3)>>2);
|
||||
return((long)B_LITTLE16(shortptr[0])); //uncompleng
|
||||
}
|
||||
for(i=255;i>=0;i--) { lzwbuf2[i] = i; lzwbuf3[i] = i; }
|
||||
for (i=255;i>=0;i--) { lzwbuf2[i] = i; lzwbuf3[i] = i; }
|
||||
currstr = 256; bitcnt = (4<<3); outbytecnt = 0;
|
||||
numbits = 8; oneupnumbits = (1<<8);
|
||||
do
|
||||
|
@ -1283,11 +1291,11 @@ static long lzwuncompress(char *lzwinbuf, long compleng, char *lzwoutbuf)
|
|||
|
||||
lzwbuf3[currstr] = dat;
|
||||
|
||||
for(leng=0;dat>=256;leng++,dat=lzwbuf3[dat])
|
||||
for (leng=0;dat>=256;leng++,dat=lzwbuf3[dat])
|
||||
lzwbuf1[leng] = lzwbuf2[dat];
|
||||
|
||||
lzwoutbuf[outbytecnt++] = dat;
|
||||
for(i=leng-1;i>=0;i--) lzwoutbuf[outbytecnt++] = lzwbuf1[i];
|
||||
for (i=leng-1;i>=0;i--) lzwoutbuf[outbytecnt++] = lzwbuf1[i];
|
||||
|
||||
lzwbuf2[currstr-1] = dat; lzwbuf2[currstr] = dat;
|
||||
currstr++;
|
||||
|
|
|
@ -95,9 +95,12 @@ bssize_t Bread(int fd, void *buf, bsize_t count)
|
|||
int Blseek(int fildes, int offset, int whence)
|
||||
{
|
||||
switch (whence) {
|
||||
case BSEEK_SET: whence=SEEK_SET; break;
|
||||
case BSEEK_CUR: whence=SEEK_CUR; break;
|
||||
case BSEEK_END: whence=SEEK_END; break;
|
||||
case BSEEK_SET:
|
||||
whence=SEEK_SET; break;
|
||||
case BSEEK_CUR:
|
||||
whence=SEEK_CUR; break;
|
||||
case BSEEK_END:
|
||||
whence=SEEK_END; break;
|
||||
}
|
||||
return lseek(fildes,offset,whence);
|
||||
}
|
||||
|
@ -686,7 +689,7 @@ long Bwildmatch (const char *i, const char *j)
|
|||
{
|
||||
if (*j == '*')
|
||||
{
|
||||
for(k=i,j++;*k;k++) if (Bwildmatch(k,j)) return(1);
|
||||
for (k=i,j++;*k;k++) if (Bwildmatch(k,j)) return(1);
|
||||
continue;
|
||||
}
|
||||
if (!*i) return(0);
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
static long vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400},
|
||||
{360,400},{640,350},{640,400},{640,480},{800,600},
|
||||
{1024,768},{1280,1024},{1600,1200}};
|
||||
{1024,768},{1280,1024},{1600,1200}
|
||||
};
|
||||
|
||||
static int readconfig(BFILE *fp, const char *key, char *value, unsigned len)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -15,132 +15,132 @@ struct _dynamicgtksyms dynamicgtksyms;
|
|||
|
||||
int dynamicgtk_init(void)
|
||||
{
|
||||
int err = 0;
|
||||
const char *failsym = NULL;
|
||||
int err = 0;
|
||||
const char *failsym = NULL;
|
||||
|
||||
if (handle) return 1;
|
||||
if (handle) return 1;
|
||||
|
||||
handle = dlopen("libgtk-x11-2.0.so", RTLD_NOW|RTLD_GLOBAL);
|
||||
if (!handle) return 0;
|
||||
|
||||
memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms));
|
||||
handle = dlopen("libgtk-x11-2.0.so", RTLD_NOW|RTLD_GLOBAL);
|
||||
if (!handle) return 0;
|
||||
|
||||
do {
|
||||
GETDLSYM(g_object_get_data)
|
||||
GETDLSYM(g_object_set_data)
|
||||
GETDLSYM(g_object_set_data_full)
|
||||
GETDLSYM(g_object_unref)
|
||||
GETDLSYM(g_signal_connect_data)
|
||||
GETDLSYM(g_signal_handlers_block_matched)
|
||||
GETDLSYM(g_signal_handlers_unblock_matched)
|
||||
GETDLSYM(g_type_check_instance_cast)
|
||||
GETDLSYM(gdk_pixbuf_from_pixdata)
|
||||
GETDLSYM(gdk_pixbuf_new_from_data)
|
||||
GETDLSYM(gtk_accel_group_new)
|
||||
GETDLSYM(gtk_alignment_new)
|
||||
GETDLSYM(gtk_box_get_type)
|
||||
GETDLSYM(gtk_box_pack_start)
|
||||
GETDLSYM(gtk_button_box_get_type)
|
||||
GETDLSYM(gtk_button_box_set_layout)
|
||||
GETDLSYM(gtk_button_new)
|
||||
GETDLSYM(gtk_cell_layout_get_type)
|
||||
GETDLSYM(gtk_cell_layout_pack_start)
|
||||
GETDLSYM(gtk_cell_layout_set_attributes)
|
||||
GETDLSYM(gtk_cell_renderer_text_new)
|
||||
GETDLSYM(gtk_check_button_new_with_mnemonic)
|
||||
GETDLSYM(gtk_combo_box_get_active_iter)
|
||||
GETDLSYM(gtk_combo_box_get_model)
|
||||
GETDLSYM(gtk_combo_box_get_type)
|
||||
GETDLSYM(gtk_combo_box_new_text)
|
||||
GETDLSYM(gtk_combo_box_new_with_model)
|
||||
GETDLSYM(gtk_combo_box_set_active_iter)
|
||||
GETDLSYM(gtk_container_add)
|
||||
GETDLSYM(gtk_container_foreach)
|
||||
GETDLSYM(gtk_container_get_type)
|
||||
GETDLSYM(gtk_container_set_border_width)
|
||||
GETDLSYM(gtk_dialog_get_type)
|
||||
GETDLSYM(gtk_dialog_run)
|
||||
GETDLSYM(gtk_fixed_get_type)
|
||||
GETDLSYM(gtk_fixed_new)
|
||||
GETDLSYM(gtk_fixed_put)
|
||||
GETDLSYM(gtk_hbox_new)
|
||||
GETDLSYM(gtk_hbutton_box_new)
|
||||
GETDLSYM(gtk_image_new_from_pixbuf)
|
||||
GETDLSYM(gtk_image_new_from_stock)
|
||||
GETDLSYM(gtk_init_check)
|
||||
GETDLSYM(gtk_label_get_type)
|
||||
GETDLSYM(gtk_label_new)
|
||||
GETDLSYM(gtk_label_new_with_mnemonic)
|
||||
GETDLSYM(gtk_label_set_mnemonic_widget)
|
||||
GETDLSYM(gtk_list_store_append)
|
||||
GETDLSYM(gtk_list_store_clear)
|
||||
GETDLSYM(gtk_list_store_get_type)
|
||||
GETDLSYM(gtk_list_store_new)
|
||||
GETDLSYM(gtk_list_store_set)
|
||||
GETDLSYM(gtk_main)
|
||||
GETDLSYM(gtk_main_iteration_do)
|
||||
GETDLSYM(gtk_main_quit)
|
||||
GETDLSYM(gtk_message_dialog_new)
|
||||
GETDLSYM(gtk_misc_get_type)
|
||||
GETDLSYM(gtk_misc_set_alignment)
|
||||
GETDLSYM(gtk_notebook_get_nth_page)
|
||||
GETDLSYM(gtk_notebook_get_type)
|
||||
GETDLSYM(gtk_notebook_new)
|
||||
GETDLSYM(gtk_notebook_set_current_page)
|
||||
GETDLSYM(gtk_notebook_set_tab_label)
|
||||
GETDLSYM(gtk_object_get_type)
|
||||
GETDLSYM(gtk_scrolled_window_get_type)
|
||||
GETDLSYM(gtk_scrolled_window_new)
|
||||
GETDLSYM(gtk_scrolled_window_set_policy)
|
||||
GETDLSYM(gtk_text_buffer_backspace)
|
||||
GETDLSYM(gtk_text_buffer_create_mark)
|
||||
GETDLSYM(gtk_text_buffer_delete_mark)
|
||||
GETDLSYM(gtk_text_buffer_get_end_iter)
|
||||
GETDLSYM(gtk_text_buffer_insert)
|
||||
GETDLSYM(gtk_text_view_get_buffer)
|
||||
GETDLSYM(gtk_text_view_get_type)
|
||||
GETDLSYM(gtk_text_view_new)
|
||||
GETDLSYM(gtk_text_view_scroll_to_mark)
|
||||
GETDLSYM(gtk_text_view_set_cursor_visible)
|
||||
GETDLSYM(gtk_text_view_set_editable)
|
||||
GETDLSYM(gtk_text_view_set_left_margin)
|
||||
GETDLSYM(gtk_text_view_set_right_margin)
|
||||
GETDLSYM(gtk_text_view_set_wrap_mode)
|
||||
GETDLSYM(gtk_toggle_button_get_active)
|
||||
GETDLSYM(gtk_toggle_button_get_type)
|
||||
GETDLSYM(gtk_toggle_button_set_active)
|
||||
GETDLSYM(gtk_tree_model_get)
|
||||
GETDLSYM(gtk_tree_model_get_type)
|
||||
GETDLSYM(gtk_vbox_new)
|
||||
GETDLSYM(gtk_widget_add_accelerator)
|
||||
GETDLSYM(gtk_widget_destroy)
|
||||
GETDLSYM(gtk_widget_ref)
|
||||
GETDLSYM(gtk_widget_set_sensitive)
|
||||
GETDLSYM(gtk_widget_set_size_request)
|
||||
GETDLSYM(gtk_widget_show)
|
||||
GETDLSYM(gtk_widget_unref)
|
||||
GETDLSYM(gtk_window_add_accel_group)
|
||||
GETDLSYM(gtk_window_get_type)
|
||||
GETDLSYM(gtk_window_new)
|
||||
GETDLSYM(gtk_window_set_default_icon)
|
||||
GETDLSYM(gtk_window_set_position)
|
||||
GETDLSYM(gtk_window_set_resizable)
|
||||
GETDLSYM(gtk_window_set_title)
|
||||
GETDLSYM(gtk_window_set_type_hint)
|
||||
} while (0);
|
||||
memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms));
|
||||
|
||||
if (err) {
|
||||
//printf("Failed fetching symbol %s from GTK lib\n", failsym);
|
||||
dlclose(handle);
|
||||
handle = NULL;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
do {
|
||||
GETDLSYM(g_object_get_data)
|
||||
GETDLSYM(g_object_set_data)
|
||||
GETDLSYM(g_object_set_data_full)
|
||||
GETDLSYM(g_object_unref)
|
||||
GETDLSYM(g_signal_connect_data)
|
||||
GETDLSYM(g_signal_handlers_block_matched)
|
||||
GETDLSYM(g_signal_handlers_unblock_matched)
|
||||
GETDLSYM(g_type_check_instance_cast)
|
||||
GETDLSYM(gdk_pixbuf_from_pixdata)
|
||||
GETDLSYM(gdk_pixbuf_new_from_data)
|
||||
GETDLSYM(gtk_accel_group_new)
|
||||
GETDLSYM(gtk_alignment_new)
|
||||
GETDLSYM(gtk_box_get_type)
|
||||
GETDLSYM(gtk_box_pack_start)
|
||||
GETDLSYM(gtk_button_box_get_type)
|
||||
GETDLSYM(gtk_button_box_set_layout)
|
||||
GETDLSYM(gtk_button_new)
|
||||
GETDLSYM(gtk_cell_layout_get_type)
|
||||
GETDLSYM(gtk_cell_layout_pack_start)
|
||||
GETDLSYM(gtk_cell_layout_set_attributes)
|
||||
GETDLSYM(gtk_cell_renderer_text_new)
|
||||
GETDLSYM(gtk_check_button_new_with_mnemonic)
|
||||
GETDLSYM(gtk_combo_box_get_active_iter)
|
||||
GETDLSYM(gtk_combo_box_get_model)
|
||||
GETDLSYM(gtk_combo_box_get_type)
|
||||
GETDLSYM(gtk_combo_box_new_text)
|
||||
GETDLSYM(gtk_combo_box_new_with_model)
|
||||
GETDLSYM(gtk_combo_box_set_active_iter)
|
||||
GETDLSYM(gtk_container_add)
|
||||
GETDLSYM(gtk_container_foreach)
|
||||
GETDLSYM(gtk_container_get_type)
|
||||
GETDLSYM(gtk_container_set_border_width)
|
||||
GETDLSYM(gtk_dialog_get_type)
|
||||
GETDLSYM(gtk_dialog_run)
|
||||
GETDLSYM(gtk_fixed_get_type)
|
||||
GETDLSYM(gtk_fixed_new)
|
||||
GETDLSYM(gtk_fixed_put)
|
||||
GETDLSYM(gtk_hbox_new)
|
||||
GETDLSYM(gtk_hbutton_box_new)
|
||||
GETDLSYM(gtk_image_new_from_pixbuf)
|
||||
GETDLSYM(gtk_image_new_from_stock)
|
||||
GETDLSYM(gtk_init_check)
|
||||
GETDLSYM(gtk_label_get_type)
|
||||
GETDLSYM(gtk_label_new)
|
||||
GETDLSYM(gtk_label_new_with_mnemonic)
|
||||
GETDLSYM(gtk_label_set_mnemonic_widget)
|
||||
GETDLSYM(gtk_list_store_append)
|
||||
GETDLSYM(gtk_list_store_clear)
|
||||
GETDLSYM(gtk_list_store_get_type)
|
||||
GETDLSYM(gtk_list_store_new)
|
||||
GETDLSYM(gtk_list_store_set)
|
||||
GETDLSYM(gtk_main)
|
||||
GETDLSYM(gtk_main_iteration_do)
|
||||
GETDLSYM(gtk_main_quit)
|
||||
GETDLSYM(gtk_message_dialog_new)
|
||||
GETDLSYM(gtk_misc_get_type)
|
||||
GETDLSYM(gtk_misc_set_alignment)
|
||||
GETDLSYM(gtk_notebook_get_nth_page)
|
||||
GETDLSYM(gtk_notebook_get_type)
|
||||
GETDLSYM(gtk_notebook_new)
|
||||
GETDLSYM(gtk_notebook_set_current_page)
|
||||
GETDLSYM(gtk_notebook_set_tab_label)
|
||||
GETDLSYM(gtk_object_get_type)
|
||||
GETDLSYM(gtk_scrolled_window_get_type)
|
||||
GETDLSYM(gtk_scrolled_window_new)
|
||||
GETDLSYM(gtk_scrolled_window_set_policy)
|
||||
GETDLSYM(gtk_text_buffer_backspace)
|
||||
GETDLSYM(gtk_text_buffer_create_mark)
|
||||
GETDLSYM(gtk_text_buffer_delete_mark)
|
||||
GETDLSYM(gtk_text_buffer_get_end_iter)
|
||||
GETDLSYM(gtk_text_buffer_insert)
|
||||
GETDLSYM(gtk_text_view_get_buffer)
|
||||
GETDLSYM(gtk_text_view_get_type)
|
||||
GETDLSYM(gtk_text_view_new)
|
||||
GETDLSYM(gtk_text_view_scroll_to_mark)
|
||||
GETDLSYM(gtk_text_view_set_cursor_visible)
|
||||
GETDLSYM(gtk_text_view_set_editable)
|
||||
GETDLSYM(gtk_text_view_set_left_margin)
|
||||
GETDLSYM(gtk_text_view_set_right_margin)
|
||||
GETDLSYM(gtk_text_view_set_wrap_mode)
|
||||
GETDLSYM(gtk_toggle_button_get_active)
|
||||
GETDLSYM(gtk_toggle_button_get_type)
|
||||
GETDLSYM(gtk_toggle_button_set_active)
|
||||
GETDLSYM(gtk_tree_model_get)
|
||||
GETDLSYM(gtk_tree_model_get_type)
|
||||
GETDLSYM(gtk_vbox_new)
|
||||
GETDLSYM(gtk_widget_add_accelerator)
|
||||
GETDLSYM(gtk_widget_destroy)
|
||||
GETDLSYM(gtk_widget_ref)
|
||||
GETDLSYM(gtk_widget_set_sensitive)
|
||||
GETDLSYM(gtk_widget_set_size_request)
|
||||
GETDLSYM(gtk_widget_show)
|
||||
GETDLSYM(gtk_widget_unref)
|
||||
GETDLSYM(gtk_window_add_accel_group)
|
||||
GETDLSYM(gtk_window_get_type)
|
||||
GETDLSYM(gtk_window_new)
|
||||
GETDLSYM(gtk_window_set_default_icon)
|
||||
GETDLSYM(gtk_window_set_position)
|
||||
GETDLSYM(gtk_window_set_resizable)
|
||||
GETDLSYM(gtk_window_set_title)
|
||||
GETDLSYM(gtk_window_set_type_hint)
|
||||
} while (0);
|
||||
|
||||
if (err) {
|
||||
//printf("Failed fetching symbol %s from GTK lib\n", failsym);
|
||||
dlclose(handle);
|
||||
handle = NULL;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dynamicgtk_uninit(void)
|
||||
{
|
||||
if (handle) dlclose(handle);
|
||||
handle = NULL;
|
||||
memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms));
|
||||
if (handle) dlclose(handle);
|
||||
handle = NULL;
|
||||
memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms));
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,12 +6,12 @@
|
|||
|
||||
#if defined USE_OPENGL
|
||||
|
||||
#ifdef RENDERTYPESDL
|
||||
#ifdef RENDERTYPESDL
|
||||
# ifdef __APPLE__
|
||||
# include <SDL/SDL.h>
|
||||
# else
|
||||
#include "SDL.h"
|
||||
#endif
|
||||
#include "SDL.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void (APIENTRY * bglClearColor)( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
|
||||
|
@ -57,7 +57,7 @@ void (APIENTRY * bglBegin)( GLenum mode );
|
|||
void (APIENTRY * bglEnd)( void );
|
||||
void (APIENTRY * bglVertex2f)( GLfloat x, GLfloat y );
|
||||
void (APIENTRY * bglVertex2i)( GLint x, GLint y );
|
||||
void (APIENTRY * bglVertex3f)( GLfloat x, GLfloat y, GLfloat z );
|
||||
void (APIENTRY * bglVertex3f)( GLfloat x, GLfloat y, GLfloat z );
|
||||
void (APIENTRY * bglVertex3d)( GLdouble x, GLdouble y, GLdouble z );
|
||||
void (APIENTRY * bglVertex3fv)( const GLfloat *v );
|
||||
void (APIENTRY * bglVertex3dv)( const GLdouble *v );
|
||||
|
@ -160,7 +160,7 @@ int loadgldriver(const char *driver)
|
|||
#endif
|
||||
|
||||
if (!driver) {
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
driver = "OPENGL32.DLL";
|
||||
#elif defined __APPLE__
|
||||
driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
|
||||
|
|
|
@ -66,11 +66,11 @@ extern struct sdlappicon sdlappicon;
|
|||
void gtkbuild_init(int *argc, char ***argv)
|
||||
{
|
||||
#ifndef LINKED_GTK
|
||||
gtkenabled = dynamicgtk_init();
|
||||
if (gtkenabled < 0) {
|
||||
gtkenabled = 0;
|
||||
return;
|
||||
}
|
||||
gtkenabled = dynamicgtk_init();
|
||||
if (gtkenabled < 0) {
|
||||
gtkenabled = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
gtkenabled = gtk_init_check(argc, argv);
|
||||
if (!gtkenabled) return;
|
||||
|
@ -84,10 +84,10 @@ void gtkbuild_init(int *argc, char ***argv)
|
|||
|
||||
void gtkbuild_exit(int r)
|
||||
{
|
||||
if (gtkenabled) {
|
||||
if (appicon) g_object_unref((gpointer)appicon);
|
||||
}
|
||||
if (gtkenabled) {
|
||||
if (appicon) g_object_unref((gpointer)appicon);
|
||||
}
|
||||
#ifndef LINKED_GTK
|
||||
dynamicgtk_uninit();
|
||||
dynamicgtk_uninit();
|
||||
#endif
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modifica-
|
||||
* tion, are permitted provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
*
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modifica-
|
||||
* tion, are permitted provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
*
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
|
|
|
@ -24,7 +24,7 @@ child = (long *)malloc((ucompleng+256)*sizeof(long)); if (!child) { free(nodev);
|
|||
sibry = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibry) { free(sibly); free(child); free(nodev); return(0); }
|
||||
#endif
|
||||
|
||||
for(i=255;i>=0;i--) { nodev[i] = i; child[i] = -1; }
|
||||
for (i=255;i>=0;i--) { nodev[i] = i; child[i] = -1; }
|
||||
memset(compbuf,0,ucompleng+15);
|
||||
|
||||
cptr = ucompbuf; eptr = &ucompbuf[ucompleng];
|
||||
|
@ -32,7 +32,7 @@ child = (long *)malloc((ucompleng+256)*sizeof(long)); if (!child) { free(nodev);
|
|||
numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1);
|
||||
do
|
||||
{
|
||||
for(i=cptr[0];i>=0;i=j)
|
||||
for (i=cptr[0];i>=0;i=j)
|
||||
{
|
||||
cptr++; if (cptr >= eptr) goto lzwcompbreak2b;
|
||||
j = child[i]; if (j < 0) { child[i] = numnodes; break; }
|
||||
|
@ -45,12 +45,14 @@ child = (long *)malloc((ucompleng+256)*sizeof(long)); if (!child) { free(nodev);
|
|||
else { if (sibry[j] < 0) { sibry[j] = numnodes; goto lzwcompbreak2a; } j = sibry[j]; }
|
||||
}
|
||||
#else
|
||||
for(;nodev[j]!=cptr[0];j=sibly[j])
|
||||
for (;nodev[j]!=cptr[0];j=sibly[j])
|
||||
if (sibly[j] < 0) { sibly[j] = numnodes; goto lzwcompbreak2a; }
|
||||
#endif
|
||||
}
|
||||
lzwcompbreak2a: nodev[numnodes] = cptr[0];
|
||||
lzwcompbreak2b: child[numnodes] = sibly[numnodes] = -1;
|
||||
lzwcompbreak2a:
|
||||
nodev[numnodes] = cptr[0];
|
||||
lzwcompbreak2b:
|
||||
child[numnodes] = sibly[numnodes] = -1;
|
||||
#if USENEW
|
||||
sibry[numnodes] = -1;
|
||||
#endif
|
||||
|
@ -94,13 +96,13 @@ suffix = (unsigned char *)malloc(totnodes*sizeof(char)); if (!suffix) { free(pre
|
|||
prefix[numnodes] = dat;
|
||||
|
||||
ucompbuf++;
|
||||
for(leng=0;dat>=256;dat=prefix[dat]) {
|
||||
for (leng=0;dat>=256;dat=prefix[dat]) {
|
||||
if ((long)ucompbuf+leng-ucomp > ucompleng) goto bail;
|
||||
ucompbuf[leng++] = suffix[dat];
|
||||
}
|
||||
|
||||
ucptr = &ucompbuf[leng-1];
|
||||
for(i=(leng>>1)-1;i>=0;i--) { ch = ucompbuf[i]; ucompbuf[i] = ucptr[-i]; ucptr[-i] = ch; }
|
||||
for (i=(leng>>1)-1;i>=0;i--) { ch = ucompbuf[i]; ucompbuf[i] = ucptr[-i]; ucptr[-i] = ch; }
|
||||
ucompbuf[-1] = dat; ucompbuf += leng;
|
||||
|
||||
suffix[numnodes-1] = suffix[numnodes] = dat;
|
||||
|
|
|
@ -206,7 +206,7 @@ static void freeallmodels ()
|
|||
|
||||
if (models)
|
||||
{
|
||||
for(i=0;i<nextmodelid;i++) mdfree(models[i]);
|
||||
for (i=0;i<nextmodelid;i++) mdfree(models[i]);
|
||||
free(models); models = NULL;
|
||||
nummodelsalloced = 0;
|
||||
nextmodelid = 0;
|
||||
|
@ -227,26 +227,26 @@ static void clearskins ()
|
|||
mdmodel *m;
|
||||
int i, j;
|
||||
|
||||
for(i=0;i<nextmodelid;i++)
|
||||
for (i=0;i<nextmodelid;i++)
|
||||
{
|
||||
m = models[i];
|
||||
if (m->mdnum == 1) {
|
||||
voxmodel *v = (voxmodel*)m;
|
||||
for(j=0;j<MAXPALOOKUPS;j++) {
|
||||
for (j=0;j<MAXPALOOKUPS;j++) {
|
||||
if (v->texid[j]) bglDeleteTextures(1,(GLuint*)&v->texid[j]);
|
||||
v->texid[j] = 0;
|
||||
}
|
||||
} else if (m->mdnum == 2 || m->mdnum == 3) {
|
||||
md2model *m2 = (md2model*)m;
|
||||
mdskinmap_t *sk;
|
||||
for(j=0;j<m2->numskins*(HICEFFECTMASK+1);j++)
|
||||
for (j=0;j<m2->numskins*(HICEFFECTMASK+1);j++)
|
||||
{
|
||||
if (m2->texid[j]) bglDeleteTextures(1,(GLuint*)&m2->texid[j]);
|
||||
m2->texid[j] = 0;
|
||||
}
|
||||
|
||||
for(sk=m2->skinmap;sk;sk=sk->next)
|
||||
for(j=0;j<(HICEFFECTMASK+1);j++)
|
||||
for (sk=m2->skinmap;sk;sk=sk->next)
|
||||
for (j=0;j<(HICEFFECTMASK+1);j++)
|
||||
{
|
||||
if (sk->texid[j]) bglDeleteTextures(1,(GLuint*)&sk->texid[j]);
|
||||
sk->texid[j] = 0;
|
||||
|
@ -254,10 +254,10 @@ static void clearskins ()
|
|||
}
|
||||
}
|
||||
|
||||
for(i=0;i<MAXVOXELS;i++)
|
||||
for (i=0;i<MAXVOXELS;i++)
|
||||
{
|
||||
voxmodel *v = (voxmodel*)voxmodels[i]; if (!v) continue;
|
||||
for(j=0;j<MAXPALOOKUPS;j++) {
|
||||
for (j=0;j<MAXPALOOKUPS;j++) {
|
||||
if (v->texid[j]) bglDeleteTextures(1,(GLuint*)&v->texid[j]);
|
||||
v->texid[j] = 0;
|
||||
}
|
||||
|
@ -313,26 +313,26 @@ static long framename2index (mdmodel *vm, const char *nam)
|
|||
{
|
||||
int i = 0;
|
||||
|
||||
switch(vm->mdnum)
|
||||
switch (vm->mdnum)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
md2model *m = (md2model *)vm;
|
||||
md2frame_t *fr;
|
||||
for (i=0;i<m->numframes;i++)
|
||||
{
|
||||
md2model *m = (md2model *)vm;
|
||||
md2frame_t *fr;
|
||||
for(i=0;i<m->numframes;i++)
|
||||
{
|
||||
fr = (md2frame_t *)&m->frames[i*m->framebytes];
|
||||
if (!Bstrcmp(fr->name, nam)) break;
|
||||
}
|
||||
fr = (md2frame_t *)&m->frames[i*m->framebytes];
|
||||
if (!Bstrcmp(fr->name, nam)) break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
md3model *m = (md3model *)vm;
|
||||
for(i=0;i<m->numframes;i++)
|
||||
if (!Bstrcmp(m->head.frames[i].nam,nam)) break;
|
||||
}
|
||||
break;
|
||||
{
|
||||
md3model *m = (md3model *)vm;
|
||||
for (i=0;i<m->numframes;i++)
|
||||
if (!Bstrcmp(m->head.frames[i].nam,nam)) break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return(i);
|
||||
}
|
||||
|
@ -500,8 +500,8 @@ static int daskinloader (long filh, long *fptr, long *bpl, long *sizx, long *siz
|
|||
if (tsizx == 0 || tsizy == 0) { free(picfil); return -1; }
|
||||
|
||||
if (!glinfo.texnpot) {
|
||||
for(xsiz=1;xsiz<tsizx;xsiz+=xsiz);
|
||||
for(ysiz=1;ysiz<tsizy;ysiz+=ysiz);
|
||||
for (xsiz=1;xsiz<tsizx;xsiz+=xsiz);
|
||||
for (ysiz=1;ysiz<tsizy;ysiz+=ysiz);
|
||||
} else {
|
||||
xsiz = tsizx;
|
||||
ysiz = tsizy;
|
||||
|
@ -516,11 +516,11 @@ static int daskinloader (long filh, long *fptr, long *bpl, long *sizx, long *siz
|
|||
free(picfil);
|
||||
|
||||
cptr = &britable[gammabrightness ? 0 : curbrightness][0];
|
||||
for(y=0,j=0;y<tsizy;y++,j+=xsiz)
|
||||
for (y=0,j=0;y<tsizy;y++,j+=xsiz)
|
||||
{
|
||||
coltype *rpptr = &pic[j], tcol;
|
||||
|
||||
for(x=0;x<tsizx;x++)
|
||||
for (x=0;x<tsizx;x++)
|
||||
{
|
||||
tcol.b = cptr[rpptr[x].b];
|
||||
tcol.g = cptr[rpptr[x].g];
|
||||
|
@ -545,7 +545,7 @@ static int daskinloader (long filh, long *fptr, long *bpl, long *sizx, long *siz
|
|||
}
|
||||
}
|
||||
if (!glinfo.bgra) {
|
||||
for(j=xsiz*ysiz-1;j>=0;j--) {
|
||||
for (j=xsiz*ysiz-1;j>=0;j--) {
|
||||
swapchar(&pic[j].r, &pic[j].b);
|
||||
}
|
||||
}
|
||||
|
@ -769,8 +769,8 @@ static long mdloadskin (md2model *m, int number, int pal, int surf)
|
|||
if (m->mdnum == 2)
|
||||
{
|
||||
long *lptr;
|
||||
for(lptr=m->glcmds;(i=*lptr++);)
|
||||
for(i=labs(i);i>0;i--,lptr+=3)
|
||||
for (lptr=m->glcmds;(i=*lptr++);)
|
||||
for (i=labs(i);i>0;i--,lptr+=3)
|
||||
{
|
||||
((float *)lptr)[0] *= fx;
|
||||
((float *)lptr)[1] *= fy;
|
||||
|
@ -784,7 +784,7 @@ static long mdloadskin (md2model *m, int number, int pal, int surf)
|
|||
for (surfi=0;surfi<m3->head.numsurfs;surfi++)
|
||||
{
|
||||
s = &m3->head.surfs[surfi];
|
||||
for(i=s->numverts-1;i>=0;i--)
|
||||
for (i=s->numverts-1;i>=0;i--)
|
||||
{
|
||||
s->uv[i].u *= fx;
|
||||
s->uv[i].v *= fy;
|
||||
|
@ -934,7 +934,7 @@ if ((head.id != 0x32504449) || (head.vers != 8)) { free(m); return(0); } //"IDP2
|
|||
#endif
|
||||
|
||||
strcpy(st,filnam);
|
||||
for(i=strlen(st)-1;i>0;i--)
|
||||
for (i=strlen(st)-1;i>0;i--)
|
||||
if ((st[i] == '/') || (st[i] == '\\')) { i++; break; }
|
||||
if (i<0) i=0;
|
||||
st[i] = 0;
|
||||
|
@ -1102,7 +1102,7 @@ int partition(unsigned short *indexes, float *depths, int f, int l) {
|
|||
|
||||
void quicksort(unsigned short *indexes, float *depths, int first, int last) {
|
||||
int pivIndex = 0;
|
||||
if(first < last) {
|
||||
if (first < last) {
|
||||
pivIndex = partition(indexes,depths,first, last);
|
||||
quicksort(indexes,depths,first,(pivIndex-1));
|
||||
quicksort(indexes,depths,(pivIndex+1),last);
|
||||
|
@ -1169,7 +1169,7 @@ if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { free(m); return(0); }
|
|||
}
|
||||
#endif
|
||||
|
||||
for(surfi=0;surfi<m->head.numsurfs;surfi++)
|
||||
for (surfi=0;surfi<m->head.numsurfs;surfi++)
|
||||
{
|
||||
s = &m->head.surfs[surfi];
|
||||
klseek(fil,ofsurf,SEEK_SET); kread(fil,s,sizeof(md3surf_t));
|
||||
|
@ -1194,7 +1194,7 @@ if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { free(m); return(0); }
|
|||
s->tris = (md3tri_t *)malloc(leng[0]+leng[1]+leng[2]+leng[3]);
|
||||
if (!s->tris)
|
||||
{
|
||||
for(surfi--;surfi>=0;surfi--) free(m->head.surfs[surfi].tris);
|
||||
for (surfi--;surfi>=0;surfi--) free(m->head.surfs[surfi].tris);
|
||||
if (m->head.tags) free(m->head.tags); free(m->head.frames); free(m); return(0);
|
||||
}
|
||||
s->shaders = (md3shader_t *)(((long)s->tris )+leng[0]);
|
||||
|
@ -1234,19 +1234,19 @@ if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { free(m); return(0); }
|
|||
|
||||
#if 0
|
||||
strcpy(st,filnam);
|
||||
for(i=0,j=0;st[i];i++) if ((st[i] == '/') || (st[i] == '\\')) j = i+1;
|
||||
for (i=0,j=0;st[i];i++) if ((st[i] == '/') || (st[i] == '\\')) j = i+1;
|
||||
st[j] = '*'; st[j+1] = 0;
|
||||
kzfindfilestart(st); bsc = -1;
|
||||
while (kzfindfile(st))
|
||||
{
|
||||
if (st[0] == '\\') continue;
|
||||
|
||||
for(i=0,j=0;st[i];i++) if (st[i] == '.') j = i+1;
|
||||
for (i=0,j=0;st[i];i++) if (st[i] == '.') j = i+1;
|
||||
if ((!stricmp(&st[j],"JPG")) || (!stricmp(&st[j],"PNG")) || (!stricmp(&st[j],"GIF")) ||
|
||||
(!stricmp(&st[j],"PCX")) || (!stricmp(&st[j],"TGA")) || (!stricmp(&st[j],"BMP")) ||
|
||||
(!stricmp(&st[j],"CEL")))
|
||||
{
|
||||
for(i=0;st[i];i++) if (st[i] != filnam[i]) break;
|
||||
for (i=0;st[i];i++) if (st[i] != filnam[i]) break;
|
||||
if (i > bsc) { bsc = i; strcpy(bst,st); }
|
||||
}
|
||||
}
|
||||
|
@ -1315,7 +1315,7 @@ static int md3draw (md3model *m, spritetype *tspr)
|
|||
|
||||
// floor aligned
|
||||
k1 = tspr->y;
|
||||
if((globalorientation&48)==32)
|
||||
if ((globalorientation&48)==32)
|
||||
{
|
||||
m0.z = -m0.z; m1.z = -m1.z; a0.z = -a0.z;
|
||||
m0.y = -m0.y; m1.y = -m1.y; a0.y = -a0.y;
|
||||
|
@ -1349,7 +1349,7 @@ static int md3draw (md3model *m, spritetype *tspr)
|
|||
mat[14] += a0.y*mat[2] + a0.z*mat[6] + a0.x*mat[10];
|
||||
|
||||
// floor aligned
|
||||
if((globalorientation&48)==32)
|
||||
if ((globalorientation&48)==32)
|
||||
{
|
||||
f = mat[4]; mat[4] = mat[8]*16.0; mat[8] = -f*(1.0/16.0);
|
||||
f = mat[5]; mat[5] = mat[9]*16.0; mat[9] = -f*(1.0/16.0);
|
||||
|
@ -1421,13 +1421,13 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
|
|||
k2 = (float)sintable[(spriteext[tspr->owner].roll+512)&2047] / 16384.0;
|
||||
k3 = (float)sintable[spriteext[tspr->owner].roll&2047] / 16384.0;
|
||||
}
|
||||
for(surfi=0;surfi<m->head.numsurfs;surfi++)
|
||||
for (surfi=0;surfi<m->head.numsurfs;surfi++)
|
||||
{
|
||||
s = &m->head.surfs[surfi];
|
||||
v0 = &s->xyzn[m->cframe*s->numverts];
|
||||
v1 = &s->xyzn[m->nframe*s->numverts];
|
||||
|
||||
for(i=s->numverts-1;i>=0;i--)
|
||||
for (i=s->numverts-1;i>=0;i--)
|
||||
{
|
||||
if (spriteext[tspr->owner].pitch || spriteext[tspr->owner].roll)
|
||||
{
|
||||
|
@ -1515,7 +1515,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
|
|||
indexes[i] = i;
|
||||
}*/
|
||||
|
||||
for(i=s->numtris-1;i>=0;i--)
|
||||
for (i=s->numtris-1;i>=0;i--)
|
||||
{
|
||||
// Matrix multiplication - ugly but clear
|
||||
fp.x = (vertlist[s->tris[i].i[0]].x * mat[0]) + (vertlist[s->tris[i].i[0]].y * mat[4]) + (vertlist[s->tris[i].i[0]].z * mat[8]) + mat[12];
|
||||
|
@ -1567,8 +1567,8 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
|
|||
quicksort(indexes, maxdepths, 0, s->numtris - 1);
|
||||
|
||||
bglBegin(GL_TRIANGLES);
|
||||
for(i=s->numtris-1;i>=0;i--)
|
||||
for(j=0;j<3;j++)
|
||||
for (i=s->numtris-1;i>=0;i--)
|
||||
for (j=0;j<3;j++)
|
||||
{
|
||||
k = s->tris[indexes[i]].i[j];
|
||||
bglTexCoord2f(s->uv[k].u,s->uv[k].v);
|
||||
|
@ -1582,8 +1582,8 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
|
|||
else
|
||||
{
|
||||
bglBegin(GL_TRIANGLES);
|
||||
for(i=s->numtris-1;i>=0;i--)
|
||||
for(j=0;j<3;j++)
|
||||
for (i=s->numtris-1;i>=0;i--)
|
||||
for (j=0;j<3;j++)
|
||||
{
|
||||
k = s->tris[i].i[j];
|
||||
bglTexCoord2f(s->uv[k].u,s->uv[k].v);
|
||||
|
@ -1616,12 +1616,12 @@ static void md3free (md3model *m)
|
|||
|
||||
if (!m) return;
|
||||
|
||||
for(anim=m->animations; anim; anim=nanim)
|
||||
for (anim=m->animations; anim; anim=nanim)
|
||||
{
|
||||
nanim = anim->next;
|
||||
free(anim);
|
||||
}
|
||||
for(sk=m->skinmap; sk; sk=nsk)
|
||||
for (sk=m->skinmap; sk; sk=nsk)
|
||||
{
|
||||
nsk = sk->next;
|
||||
free(sk->fn);
|
||||
|
@ -1630,7 +1630,7 @@ static void md3free (md3model *m)
|
|||
|
||||
if (m->head.surfs)
|
||||
{
|
||||
for(surfi=m->head.numsurfs-1;surfi>=0;surfi--)
|
||||
for (surfi=m->head.numsurfs-1;surfi>=0;surfi--)
|
||||
{
|
||||
s = &m->head.surfs[surfi];
|
||||
if (s->tris) free(s->tris);
|
||||
|
@ -1675,7 +1675,7 @@ unsigned gloadtex (long *picbuf, long xsiz, long ysiz, long is8bit, long dapal)
|
|||
cptr = (unsigned char*)&britable[gammabrightness ? 0 : curbrightness][0];
|
||||
if (!is8bit)
|
||||
{
|
||||
for(i=xsiz*ysiz-1;i>=0;i--)
|
||||
for (i=xsiz*ysiz-1;i>=0;i--)
|
||||
{
|
||||
pic2[i].b = cptr[pic[i].r];
|
||||
pic2[i].g = cptr[pic[i].g];
|
||||
|
@ -1686,7 +1686,7 @@ unsigned gloadtex (long *picbuf, long xsiz, long ysiz, long is8bit, long dapal)
|
|||
else
|
||||
{
|
||||
if (palookup[dapal] == 0) dapal = 0;
|
||||
for(i=xsiz*ysiz-1;i>=0;i--)
|
||||
for (i=xsiz*ysiz-1;i>=0;i--)
|
||||
{
|
||||
pic2[i].b = cptr[palette[(long)palookup[dapal][pic[i].a]*3+2]*4];
|
||||
pic2[i].g = cptr[palette[(long)palookup[dapal][pic[i].a]*3+1]*4];
|
||||
|
@ -1707,7 +1707,7 @@ unsigned gloadtex (long *picbuf, long xsiz, long ysiz, long is8bit, long dapal)
|
|||
static long getvox (long x, long y, long z)
|
||||
{
|
||||
z += x*yzsiz + y*zsiz;
|
||||
for(x=vcolhashead[(z*214013)&vcolhashsizm1];x>=0;x=vcol[x].n)
|
||||
for (x=vcolhashead[(z*214013)&vcolhashsizm1];x>=0;x=vcol[x].n)
|
||||
if (vcol[x].p == z) return(vcol[x].c);
|
||||
return(0x808080);
|
||||
}
|
||||
|
@ -1728,7 +1728,7 @@ static void setzrange0 (long *lptr, long z0, long z1)
|
|||
long z, ze;
|
||||
if (!((z0^z1)&~31)) { lptr[z0>>5] &= ((~(-1<<SHIFTMOD32(z0)))|(-1<<SHIFTMOD32(z1))); return; }
|
||||
z = (z0>>5); ze = (z1>>5);
|
||||
lptr[z] &=~(-1<<SHIFTMOD32(z0)); for(z++;z<ze;z++) lptr[z] = 0;
|
||||
lptr[z] &=~(-1<<SHIFTMOD32(z0)); for (z++;z<ze;z++) lptr[z] = 0;
|
||||
lptr[z] &= (-1<<SHIFTMOD32(z1));
|
||||
}
|
||||
|
||||
|
@ -1738,7 +1738,7 @@ static void setzrange1 (long *lptr, long z0, long z1)
|
|||
long z, ze;
|
||||
if (!((z0^z1)&~31)) { lptr[z0>>5] |= ((~(-1<<SHIFTMOD32(z1)))&(-1<<SHIFTMOD32(z0))); return; }
|
||||
z = (z0>>5); ze = (z1>>5);
|
||||
lptr[z] |= (-1<<SHIFTMOD32(z0)); for(z++;z<ze;z++) lptr[z] = -1;
|
||||
lptr[z] |= (-1<<SHIFTMOD32(z0)); for (z++;z<ze;z++) lptr[z] = -1;
|
||||
lptr[z] |=~(-1<<SHIFTMOD32(z1));
|
||||
}
|
||||
|
||||
|
@ -1747,19 +1747,19 @@ static long isrectfree (long x0, long y0, long dx, long dy)
|
|||
#if 0
|
||||
long i, j, x;
|
||||
i = y0*gvox->mytexx + x0;
|
||||
for(dy=0;dy;dy--,i+=gvox->mytexx)
|
||||
for(x=0;x<dx;x++) { j = i+x; if (zbit[j>>5]&(1<<SHIFTMOD32(j))) return(0); }
|
||||
for (dy=0;dy;dy--,i+=gvox->mytexx)
|
||||
for (x=0;x<dx;x++) { j = i+x; if (zbit[j>>5]&(1<<SHIFTMOD32(j))) return(0); }
|
||||
#else
|
||||
long i, c, m, m1, x;
|
||||
|
||||
i = y0*mytexo5 + (x0>>5); dx += x0-1; c = (dx>>5) - (x0>>5);
|
||||
m = ~pow2m1[x0&31]; m1 = pow2m1[(dx&31)+1];
|
||||
if (!c) { for(m&=m1;dy;dy--,i+=mytexo5) if (zbit[i]&m) return(0); }
|
||||
if (!c) { for (m&=m1;dy;dy--,i+=mytexo5) if (zbit[i]&m) return(0); }
|
||||
else
|
||||
{ for(;dy;dy--,i+=mytexo5)
|
||||
{ for (;dy;dy--,i+=mytexo5)
|
||||
{
|
||||
if (zbit[i]&m) return(0);
|
||||
for(x=1;x<c;x++) if (zbit[i+x]) return(0);
|
||||
for (x=1;x<c;x++) if (zbit[i+x]) return(0);
|
||||
if (zbit[i+x]&m1) return(0);
|
||||
}
|
||||
}
|
||||
|
@ -1772,19 +1772,19 @@ static void setrect (long x0, long y0, long dx, long dy)
|
|||
#if 0
|
||||
long i, j, y;
|
||||
i = y0*gvox->mytexx + x0;
|
||||
for(y=0;y<dy;y++,i+=gvox->mytexx)
|
||||
for(x=0;x<dx;x++) { j = i+x; zbit[j>>5] |= (1<<SHIFTMOD32(j)); }
|
||||
for (y=0;y<dy;y++,i+=gvox->mytexx)
|
||||
for (x=0;x<dx;x++) { j = i+x; zbit[j>>5] |= (1<<SHIFTMOD32(j)); }
|
||||
#else
|
||||
long i, c, m, m1, x;
|
||||
|
||||
i = y0*mytexo5 + (x0>>5); dx += x0-1; c = (dx>>5) - (x0>>5);
|
||||
m = ~pow2m1[x0&31]; m1 = pow2m1[(dx&31)+1];
|
||||
if (!c) { for(m&=m1;dy;dy--,i+=mytexo5) zbit[i] |= m; }
|
||||
if (!c) { for (m&=m1;dy;dy--,i+=mytexo5) zbit[i] |= m; }
|
||||
else
|
||||
{ for(;dy;dy--,i+=mytexo5)
|
||||
{ for (;dy;dy--,i+=mytexo5)
|
||||
{
|
||||
zbit[i] |= m;
|
||||
for(x=1;x<c;x++) zbit[i+x] = -1;
|
||||
for (x=1;x<c;x++) zbit[i+x] = -1;
|
||||
zbit[i+x] |= m1;
|
||||
}
|
||||
}
|
||||
|
@ -1815,45 +1815,57 @@ static void addquad (long x0, long y0, long z0, long x1, long y1, long z1, long
|
|||
if (x < y) { z = x; x = y; y = z; i += 3; }
|
||||
z = shcnt[y*shcntp+x]++;
|
||||
lptr = &gvox->mytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx+(shp[z].x+VOXBORDWIDTH)];
|
||||
switch(face)
|
||||
switch (face)
|
||||
{
|
||||
case 0: ny = y1; x2 = x0; x0 = x1; x1 = x2; break;
|
||||
case 1: ny = y0; y0++; y1++; y2++; break;
|
||||
case 2: nz = z1; y0 = y2; y2 = y1; y1 = y0; z0++; z1++; z2++; break;
|
||||
case 3: nz = z0; break;
|
||||
case 4: nx = x1; y2 = y0; y0 = y1; y1 = y2; x0++; x1++; x2++; break;
|
||||
case 5: nx = x0; break;
|
||||
case 0:
|
||||
ny = y1; x2 = x0; x0 = x1; x1 = x2; break;
|
||||
case 1:
|
||||
ny = y0; y0++; y1++; y2++; break;
|
||||
case 2:
|
||||
nz = z1; y0 = y2; y2 = y1; y1 = y0; z0++; z1++; z2++; break;
|
||||
case 3:
|
||||
nz = z0; break;
|
||||
case 4:
|
||||
nx = x1; y2 = y0; y0 = y1; y1 = y2; x0++; x1++; x2++; break;
|
||||
case 5:
|
||||
nx = x0; break;
|
||||
}
|
||||
for(yy=0;yy<y;yy++,lptr+=gvox->mytexx)
|
||||
for(xx=0;xx<x;xx++)
|
||||
for (yy=0;yy<y;yy++,lptr+=gvox->mytexx)
|
||||
for (xx=0;xx<x;xx++)
|
||||
{
|
||||
switch(face)
|
||||
switch (face)
|
||||
{
|
||||
case 0: if (i < 3) { nx = x1+x-1-xx; nz = z1+yy; } //back
|
||||
case 0:
|
||||
if (i < 3) { nx = x1+x-1-xx; nz = z1+yy; } //back
|
||||
else { nx = x1+y-1-yy; nz = z1+xx; } break;
|
||||
case 1: if (i < 3) { nx = x0+xx; nz = z0+yy; } //front
|
||||
case 1:
|
||||
if (i < 3) { nx = x0+xx; nz = z0+yy; } //front
|
||||
else { nx = x0+yy; nz = z0+xx; } break;
|
||||
case 2: if (i < 3) { nx = x1-x+xx; ny = y1-1-yy; } //bot
|
||||
case 2:
|
||||
if (i < 3) { nx = x1-x+xx; ny = y1-1-yy; } //bot
|
||||
else { nx = x1-1-yy; ny = y1-1-xx; } break;
|
||||
case 3: if (i < 3) { nx = x0+xx; ny = y0+yy; } //top
|
||||
case 3:
|
||||
if (i < 3) { nx = x0+xx; ny = y0+yy; } //top
|
||||
else { nx = x0+yy; ny = y0+xx; } break;
|
||||
case 4: if (i < 3) { ny = y1+x-1-xx; nz = z1+yy; } //right
|
||||
case 4:
|
||||
if (i < 3) { ny = y1+x-1-xx; nz = z1+yy; } //right
|
||||
else { ny = y1+y-1-yy; nz = z1+xx; } break;
|
||||
case 5: if (i < 3) { ny = y0+xx; nz = z0+yy; } //left
|
||||
case 5:
|
||||
if (i < 3) { ny = y0+xx; nz = z0+yy; } //left
|
||||
else { ny = y0+yy; nz = z0+xx; } break;
|
||||
}
|
||||
lptr[xx] = getvox(nx,ny,nz);
|
||||
}
|
||||
|
||||
//Extend borders horizontally
|
||||
for(yy=VOXBORDWIDTH;yy<y+VOXBORDWIDTH;yy++)
|
||||
for(xx=0;xx<VOXBORDWIDTH;xx++)
|
||||
for (yy=VOXBORDWIDTH;yy<y+VOXBORDWIDTH;yy++)
|
||||
for (xx=0;xx<VOXBORDWIDTH;xx++)
|
||||
{
|
||||
lptr = &gvox->mytex[(shp[z].y+yy)*gvox->mytexx+shp[z].x];
|
||||
lptr[xx] = lptr[VOXBORDWIDTH]; lptr[xx+x+VOXBORDWIDTH] = lptr[x-1+VOXBORDWIDTH];
|
||||
}
|
||||
//Extend borders vertically
|
||||
for(yy=0;yy<VOXBORDWIDTH;yy++)
|
||||
for (yy=0;yy<VOXBORDWIDTH;yy++)
|
||||
{
|
||||
memcpy(&gvox->mytex[(shp[z].y+yy)*gvox->mytexx+shp[z].x],
|
||||
&gvox->mytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx+shp[z].x],
|
||||
|
@ -1867,7 +1879,7 @@ if (x < y) { z = x; x = y; y = z; i += 3; }
|
|||
qptr->v[0].x = x0; qptr->v[0].y = y0; qptr->v[0].z = z0;
|
||||
qptr->v[1].x = x1; qptr->v[1].y = y1; qptr->v[1].z = z1;
|
||||
qptr->v[2].x = x2; qptr->v[2].y = y2; qptr->v[2].z = z2;
|
||||
for(j=0;j<3;j++) { qptr->v[j].u = shp[z].x+VOXBORDWIDTH; qptr->v[j].v = shp[z].y+VOXBORDWIDTH; }
|
||||
for (j=0;j<3;j++) { qptr->v[j].u = shp[z].x+VOXBORDWIDTH; qptr->v[j].v = shp[z].y+VOXBORDWIDTH; }
|
||||
if (i < 3) qptr->v[1].u += x; else qptr->v[1].v += y;
|
||||
qptr->v[2].u += x; qptr->v[2].v += y;
|
||||
|
||||
|
@ -1908,14 +1920,14 @@ if (x < y) { z = x; x = y; y = z; }
|
|||
memset(shcntmal,0,i); shcnt = &shcntmal[-shcntp-1];
|
||||
gmaxx = gmaxy = garea = 0;
|
||||
|
||||
if (pow2m1[32] != -1) { for(i=0;i<32;i++) pow2m1[i] = (1<<i)-1; pow2m1[32] = -1; }
|
||||
for(i=0;i<7;i++) gvox->qfacind[i] = -1;
|
||||
if (pow2m1[32] != -1) { for (i=0;i<32;i++) pow2m1[i] = (1<<i)-1; pow2m1[32] = -1; }
|
||||
for (i=0;i<7;i++) gvox->qfacind[i] = -1;
|
||||
|
||||
i = ((max(ysiz,zsiz)+1)<<2);
|
||||
bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); }
|
||||
by0 = (long *)(((long)bx0)+i);
|
||||
|
||||
for(cnt=0;cnt<2;cnt++)
|
||||
for (cnt=0;cnt<2;cnt++)
|
||||
{
|
||||
if (!cnt) daquad = cntquad;
|
||||
else daquad = addquad;
|
||||
|
@ -1923,10 +1935,10 @@ bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); }
|
|||
|
||||
memset(by0,-1,(max(ysiz,zsiz)+1)<<2); v = 0;
|
||||
|
||||
for(i=-1;i<=1;i+=2)
|
||||
for(y=0;y<ysiz;y++)
|
||||
for(x=0;x<=xsiz;x++)
|
||||
for(z=0;z<=zsiz;z++)
|
||||
for (i=-1;i<=1;i+=2)
|
||||
for (y=0;y<ysiz;y++)
|
||||
for (x=0;x<=xsiz;x++)
|
||||
for (z=0;z<=zsiz;z++)
|
||||
{
|
||||
ov = v; v = (isolid(x,y,z) && (!isolid(x,y+i,z)));
|
||||
if ((by0[z] >= 0) && ((by0[z] != oz) || (v >= ov)))
|
||||
|
@ -1934,10 +1946,10 @@ bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); }
|
|||
if (v > ov) oz = z; else if ((v < ov) && (by0[z] != oz)) { bx0[z] = x; by0[z] = oz; }
|
||||
}
|
||||
|
||||
for(i=-1;i<=1;i+=2)
|
||||
for(z=0;z<zsiz;z++)
|
||||
for(x=0;x<=xsiz;x++)
|
||||
for(y=0;y<=ysiz;y++)
|
||||
for (i=-1;i<=1;i+=2)
|
||||
for (z=0;z<zsiz;z++)
|
||||
for (x=0;x<=xsiz;x++)
|
||||
for (y=0;y<=ysiz;y++)
|
||||
{
|
||||
ov = v; v = (isolid(x,y,z) && (!isolid(x,y,z-i)));
|
||||
if ((by0[y] >= 0) && ((by0[y] != oz) || (v >= ov)))
|
||||
|
@ -1945,10 +1957,10 @@ bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); }
|
|||
if (v > ov) oz = y; else if ((v < ov) && (by0[y] != oz)) { bx0[y] = x; by0[y] = oz; }
|
||||
}
|
||||
|
||||
for(i=-1;i<=1;i+=2)
|
||||
for(x=0;x<xsiz;x++)
|
||||
for(y=0;y<=ysiz;y++)
|
||||
for(z=0;z<=zsiz;z++)
|
||||
for (i=-1;i<=1;i+=2)
|
||||
for (x=0;x<xsiz;x++)
|
||||
for (y=0;y<=ysiz;y++)
|
||||
for (z=0;z<=zsiz;z++)
|
||||
{
|
||||
ov = v; v = (isolid(x,y,z) && (!isolid(x-i,y,z)));
|
||||
if ((by0[z] >= 0) && ((by0[z] != oz) || (v >= ov)))
|
||||
|
@ -1962,18 +1974,19 @@ bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); }
|
|||
if (!shp) { free(bx0); free(gvox); return(0); }
|
||||
|
||||
sc = 0;
|
||||
for(y=gmaxy;y;y--)
|
||||
for(x=gmaxx;x>=y;x--)
|
||||
for (y=gmaxy;y;y--)
|
||||
for (x=gmaxx;x>=y;x--)
|
||||
{
|
||||
i = shcnt[y*shcntp+x]; shcnt[y*shcntp+x] = sc; //shcnt changes from counter to head index
|
||||
for(;i>0;i--) { shp[sc].x = x; shp[sc].y = y; sc++; }
|
||||
for (;i>0;i--) { shp[sc].x = x; shp[sc].y = y; sc++; }
|
||||
}
|
||||
|
||||
for(gvox->mytexx=32;gvox->mytexx<(gmaxx+(VOXBORDWIDTH<<1));gvox->mytexx<<=1);
|
||||
for(gvox->mytexy=32;gvox->mytexy<(gmaxy+(VOXBORDWIDTH<<1));gvox->mytexy<<=1);
|
||||
for (gvox->mytexx=32;gvox->mytexx<(gmaxx+(VOXBORDWIDTH<<1));gvox->mytexx<<=1);
|
||||
for (gvox->mytexy=32;gvox->mytexy<(gmaxy+(VOXBORDWIDTH<<1));gvox->mytexy<<=1);
|
||||
while (gvox->mytexx*gvox->mytexy*8 < garea*9) //This should be sufficient to fit most skins...
|
||||
{
|
||||
skindidntfit:;
|
||||
skindidntfit:
|
||||
;
|
||||
if (gvox->mytexx <= gvox->mytexy) gvox->mytexx <<= 1; else gvox->mytexy <<= 1;
|
||||
}
|
||||
mytexo5 = (gvox->mytexx>>5);
|
||||
|
@ -1983,7 +1996,7 @@ skindidntfit:;
|
|||
memset(zbit,0,i);
|
||||
|
||||
v = gvox->mytexx*gvox->mytexy;
|
||||
for(z=0;z<sc;z++)
|
||||
for (z=0;z<sc;z++)
|
||||
{
|
||||
dx = shp[z].x+(VOXBORDWIDTH<<1); dy = shp[z].y+(VOXBORDWIDTH<<1); i = v;
|
||||
do
|
||||
|
@ -2002,14 +2015,14 @@ skindidntfit:;
|
|||
|
||||
//Re-generate shp[].x/y (box sizes) from shcnt (now head indices) for next pass :/
|
||||
j = 0;
|
||||
for(y=gmaxy;y;y--)
|
||||
for(x=gmaxx;x>=y;x--)
|
||||
for (y=gmaxy;y;y--)
|
||||
for (x=gmaxx;x>=y;x--)
|
||||
{
|
||||
i = shcnt[y*shcntp+x];
|
||||
for(;j<i;j++) { shp[j].x = x0; shp[j].y = y0; }
|
||||
for (;j<i;j++) { shp[j].x = x0; shp[j].y = y0; }
|
||||
x0 = x; y0 = y;
|
||||
}
|
||||
for(;j<sc;j++) { shp[j].x = x0; shp[j].y = y0; }
|
||||
for (;j<sc;j++) { shp[j].x = x0; shp[j].y = y0; }
|
||||
|
||||
goto skindidntfit;
|
||||
}
|
||||
|
@ -2045,7 +2058,7 @@ static long loadvox (const char *filnam)
|
|||
zpiv = ((float)zsiz)*.5;
|
||||
|
||||
klseek(fil,-768,SEEK_END);
|
||||
for(i=0;i<256;i++)
|
||||
for (i=0;i<256;i++)
|
||||
{ kread(fil,c,3); pal[i] = (((long)c[0])<<18)+(((long)c[1])<<10)+(((long)c[2])<<2)+(i<<24); }
|
||||
pal[255] = -1;
|
||||
|
||||
|
@ -2060,20 +2073,20 @@ static long loadvox (const char *filnam)
|
|||
tbuf = (unsigned char *)malloc(zsiz*sizeof(char)); if (!tbuf) { kclose(fil); return(-1); }
|
||||
|
||||
klseek(fil,12,SEEK_SET);
|
||||
for(x=0;x<xsiz;x++)
|
||||
for(y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
|
||||
for (x=0;x<xsiz;x++)
|
||||
for (y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
|
||||
{
|
||||
kread(fil,tbuf,zsiz);
|
||||
for(z=zsiz-1;z>=0;z--)
|
||||
for (z=zsiz-1;z>=0;z--)
|
||||
{ if (tbuf[z] != 255) { i = j+z; vbit[i>>5] |= (1<<SHIFTMOD32(i)); } }
|
||||
}
|
||||
|
||||
klseek(fil,12,SEEK_SET);
|
||||
for(x=0;x<xsiz;x++)
|
||||
for(y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
|
||||
for (x=0;x<xsiz;x++)
|
||||
for (y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
|
||||
{
|
||||
kread(fil,tbuf,zsiz);
|
||||
for(z=0;z<zsiz;z++)
|
||||
for (z=0;z<zsiz;z++)
|
||||
{
|
||||
if (tbuf[z] == 255) continue;
|
||||
if ((!x) || (!y) || (!z) || (x == xsiz-1) || (y == ysiz-1) || (z == zsiz-1))
|
||||
|
@ -2113,14 +2126,14 @@ 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]);
|
||||
|
||||
klseek(fil,-768,SEEK_END);
|
||||
for(i=0;i<256;i++)
|
||||
for (i=0;i<256;i++)
|
||||
{ kread(fil,c,3); pal[i] = B_LITTLE32((((long)c[0])<<18)+(((long)c[1])<<10)+(((long)c[2])<<2)+(i<<24)); }
|
||||
|
||||
yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3);
|
||||
vbit = (long *)malloc(i); if (!vbit) { free(xyoffs); kclose(fil); return(-1); }
|
||||
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); }
|
||||
memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(long));
|
||||
|
||||
|
@ -2131,8 +2144,8 @@ vcolhashead = (long *)malloc((vcolhashsizm1+1)*sizeof(long)); if (!vcolhashead)
|
|||
kread(fil,tbuf,i); kclose(fil);
|
||||
|
||||
cptr = tbuf;
|
||||
for(x=0;x<xsiz;x++) //Set surface voxels to 1 else 0
|
||||
for(y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
|
||||
for (x=0;x<xsiz;x++) //Set surface voxels to 1 else 0
|
||||
for (y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
|
||||
{
|
||||
i = xyoffs[x*ysizp1+y+1] - xyoffs[x*ysizp1+y]; if (!i) continue;
|
||||
z1 = 0;
|
||||
|
@ -2142,7 +2155,7 @@ vcolhashead = (long *)malloc((vcolhashsizm1+1)*sizeof(long)); if (!vcolhashead)
|
|||
if (!(cptr[-1]&16)) setzrange1(vbit,j+z1,j+z0);
|
||||
i -= k+3; z1 = z0+k;
|
||||
setzrange1(vbit,j+z0,j+z1);
|
||||
for(z=z0;z<z1;z++) putvox(x,y,z,pal[*cptr++]);
|
||||
for (z=z0;z<z1;z++) putvox(x,y,z,pal[*cptr++]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2176,15 +2189,15 @@ kread(fil,&i,4); if (B_LITTLE32(i) != 0x6c78764b) { kclose(fil); return(-1); } /
|
|||
vbit = (long *)malloc(i); if (!vbit) { free(ylen); kclose(fil); return(-1); }
|
||||
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); }
|
||||
memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(long));
|
||||
|
||||
for(x=0;x<xsiz;x++)
|
||||
for(y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
|
||||
for (x=0;x<xsiz;x++)
|
||||
for (y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
|
||||
{
|
||||
z1 = zsiz;
|
||||
for(i=ylen[x*ysiz+y];i>0;i--)
|
||||
for (i=ylen[x*ysiz+y];i>0;i--)
|
||||
{
|
||||
kread(fil,c,8); //b,g,r,a,z_lo,z_hi,vis,dir
|
||||
z0 = B_LITTLE16(*(unsigned short *)&c[4]);
|
||||
|
@ -2230,16 +2243,16 @@ if ((i != 0x09072000) || (xsiz != 1024) || (ysiz != 1024)) { kclose(fil); return
|
|||
kclose(fil);
|
||||
|
||||
v = vbuf;
|
||||
for(y=0;y<ysiz;y++)
|
||||
for(x=0,j=y*zsiz;x<xsiz;x++,j+=yzsiz)
|
||||
for (y=0;y<ysiz;y++)
|
||||
for (x=0,j=y*zsiz;x<xsiz;x++,j+=yzsiz)
|
||||
{
|
||||
z = 0;
|
||||
while (1)
|
||||
{
|
||||
setzrange0(vbit,j+z,j+v[1]);
|
||||
for(z=v[1];z<=v[2];z++) putvox(x,y,z,(*(long *)&v[(z-v[1]+1)<<2])&0xffffff);
|
||||
for (z=v[1];z<=v[2];z++) putvox(x,y,z,(*(long *)&v[(z-v[1]+1)<<2])&0xffffff);
|
||||
if (!v[0]) break; z = v[2]-v[1]-v[0]+2; v += v[0]*4;
|
||||
for(z+=v[3];z<v[3];z++) putvox(x,y,z,(*(long *)&v[(z-v[3])<<2])&0xffffff);
|
||||
for (z+=v[3];z<v[3];z++) putvox(x,y,z,(*(long *)&v[(z-v[3])<<2])&0xffffff);
|
||||
}
|
||||
v += ((((long)v[2])-((long)v[1])+2)<<2);
|
||||
}
|
||||
|
@ -2399,7 +2412,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
|
|||
if (!m->texid[globalpal]) m->texid[globalpal] = gloadtex(m->mytex,m->mytexx,m->mytexy,m->is8bit,globalpal);
|
||||
else bglBindTexture(GL_TEXTURE_2D,m->texid[globalpal]);
|
||||
bglBegin(GL_QUADS);
|
||||
for(i=0,fi=0;i<m->qcnt;i++)
|
||||
for (i=0,fi=0;i<m->qcnt;i++)
|
||||
{
|
||||
if (i == m->qfacind[fi]) { f = clut[fi++]; bglColor4f(pc[0]*f,pc[1]*f,pc[2]*f,pc[3]*f); }
|
||||
vptr = &m->quad[i].v[0];
|
||||
|
@ -2408,7 +2421,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
|
|||
yy = vptr[0].y+vptr[2].y;
|
||||
zz = vptr[0].z+vptr[2].z;
|
||||
|
||||
for(j=0;j<4;j++)
|
||||
for (j=0;j<4;j++)
|
||||
{
|
||||
#if (VOXBORDWIDTH == 0)
|
||||
bglTexCoord2f(((float)vptr[j].u)*ru+uhack[vptr[j].u!=vptr[0].u],
|
||||
|
@ -2449,11 +2462,14 @@ mdmodel *mdload (const char *filnam)
|
|||
|
||||
fil = kopen4load((char *)filnam,0); if (fil < 0) return(0);
|
||||
kread(fil,&i,4); klseek(fil,0,SEEK_SET);
|
||||
switch(B_LITTLE32(i))
|
||||
switch (B_LITTLE32(i))
|
||||
{
|
||||
case 0x32504449: vm = (mdmodel*)md2load(fil,filnam); break; //IDP2
|
||||
case 0x33504449: vm = (mdmodel*)md3load(fil); break; //IDP3
|
||||
default: vm = (mdmodel*)0; break;
|
||||
case 0x32504449:
|
||||
vm = (mdmodel*)md2load(fil,filnam); break; //IDP2
|
||||
case 0x33504449:
|
||||
vm = (mdmodel*)md3load(fil); break; //IDP3
|
||||
default:
|
||||
vm = (mdmodel*)0; break;
|
||||
}
|
||||
kclose(fil);
|
||||
return(vm);
|
||||
|
|
|
@ -206,7 +206,7 @@ long netread (long *other, char *dabuf, long bufsiz) //0:no packets in buffer
|
|||
snatchip = (long)ip.sin_addr.s_addr; snatchport = (long)ip.sin_port;
|
||||
|
||||
(*other) = myconnectindex;
|
||||
for(i=0;i<MAXPLAYERS;i++)
|
||||
for (i=0;i<MAXPLAYERS;i++)
|
||||
if ((otherip[i] == snatchip) && (otherport[i] == snatchport))
|
||||
{ (*other) = i; break; }
|
||||
|
||||
|
@ -256,14 +256,14 @@ long isvalidipaddress (char *st)
|
|||
long i, bcnt, num;
|
||||
|
||||
bcnt = 0; num = 0;
|
||||
for(i=0;st[i];i++)
|
||||
for (i=0;st[i];i++)
|
||||
{
|
||||
if (st[i] == '.') { bcnt++; num = 0; continue; }
|
||||
if (st[i] == ':')
|
||||
{
|
||||
if (bcnt != 3) return(0);
|
||||
num = 0;
|
||||
for(i++;st[i];i++)
|
||||
for (i++;st[i];i++)
|
||||
{
|
||||
if ((st[i] >= '0') && (st[i] <= '9'))
|
||||
{ num = num*10+st[i]-'0'; if (num >= 65536) return(0); }
|
||||
|
@ -293,9 +293,9 @@ static long crctab16[256];
|
|||
static void initcrc16 ()
|
||||
{
|
||||
long i, j, k, a;
|
||||
for(j=0;j<256;j++)
|
||||
for (j=0;j<256;j++)
|
||||
{
|
||||
for(i=7,k=(j<<8),a=0;i>=0;i--,k=((k<<1)&65535))
|
||||
for (i=7,k=(j<<8),a=0;i>=0;i--,k=((k<<1)&65535))
|
||||
{
|
||||
if ((k^a)&0x8000) a = ((a<<1)&65535)^0x1021;
|
||||
else a = ((a<<1)&65535);
|
||||
|
@ -309,7 +309,7 @@ static unsigned short getcrc16 (char *buffer, long bufleng)
|
|||
long i, j;
|
||||
|
||||
j = 0;
|
||||
for(i=bufleng-1;i>=0;i--) updatecrc16(j,buffer[i]);
|
||||
for (i=bufleng-1;i>=0;i--) updatecrc16(j,buffer[i]);
|
||||
return((unsigned short)(j&65535));
|
||||
}
|
||||
|
||||
|
@ -332,11 +332,11 @@ static void initmultiplayers_reset(void)
|
|||
#endif
|
||||
|
||||
lastsendtims[0] = GetTickCount();
|
||||
for(i=1;i<MAXPLAYERS;i++) lastsendtims[i] = lastsendtims[0];
|
||||
for (i=1;i<MAXPLAYERS;i++) lastsendtims[i] = lastsendtims[0];
|
||||
numplayers = 1; myconnectindex = 0;
|
||||
|
||||
memset(otherip,0,sizeof(otherip));
|
||||
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
|
||||
|
@ -372,7 +372,7 @@ long initmultiplayersparms(long argc, char **argv)
|
|||
|
||||
netinit(portnum);
|
||||
|
||||
for(i=0;i<argc;i++)
|
||||
for (i=0;i<argc;i++)
|
||||
{
|
||||
//if (((argv[i][0] == '/') || (argv[i][0] == '-')) &&
|
||||
// ((argv[i][1] == 'N') || (argv[i][1] == 'n')) &&
|
||||
|
@ -412,7 +412,7 @@ long initmultiplayersparms(long argc, char **argv)
|
|||
if (isvalidipaddress(st))
|
||||
{
|
||||
if ((danetmode == 1) && (daindex == myconnectindex)) daindex++;
|
||||
for(j=0;st[j];j++) {
|
||||
for (j=0;st[j];j++) {
|
||||
if (st[j] == ':')
|
||||
{ otherport[daindex] = htons((unsigned short)atol(&st[j+1])); st[j] = 0; break; }
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ long initmultiplayersparms(long argc, char **argv)
|
|||
LPHOSTENT lph;
|
||||
unsigned short pt = htons(NETPORT);
|
||||
|
||||
for(j=0;st[j];j++)
|
||||
for (j=0;st[j];j++)
|
||||
if (st[j] == ':')
|
||||
{ pt = htons((unsigned short)atol(&st[j+1])); st[j] = 0; break; }
|
||||
if ((lph = gethostbyname(st)))
|
||||
|
@ -448,7 +448,7 @@ if ((danetmode == 255) && (daindex)) { numplayers = 2; danetmode = 0; } //an IP
|
|||
// printf("Player %d: %d.%d.%d.%d:%d\n",i,otherip[i]&255,(otherip[i]>>8)&255,(otherip[i]>>16)&255,((unsigned long)otherip[i])>>24,ntohs(otherport[i]));
|
||||
|
||||
connecthead = 0;
|
||||
for(i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
|
||||
for (i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
|
||||
connectpoint2[numplayers-1] = -1;
|
||||
|
||||
// return (((!danetmode) && (numplayers >= 2)) || (numplayers == 2));
|
||||
|
@ -471,7 +471,7 @@ long initmultiplayerscycle(void)
|
|||
tims = GetTickCount();
|
||||
if (myconnectindex == connecthead) //Player 0 only
|
||||
{
|
||||
for(i=numplayers-1;i>0;i--)
|
||||
for (i=numplayers-1;i>0;i--)
|
||||
if (!otherip[i]) break;
|
||||
if (!i) {
|
||||
nfIncCP(); //Addfaz NatFree
|
||||
|
@ -527,7 +527,7 @@ void initmultiplayers (long argc, char **argv, char damultioption, char dacomrat
|
|||
{
|
||||
otims = tims;
|
||||
sprintf(tbuf,"\rWait for players (%d/%d): ",myconnectindex,numplayers);
|
||||
for(i=0;i<numplayers;i++)
|
||||
for (i=0;i<numplayers;i++)
|
||||
{
|
||||
if (i == myconnectindex) { strcat(tbuf,"<me> "); continue; }
|
||||
if (!otherip[i]) { strcat(tbuf,"?.?.?.?:? "); continue; }
|
||||
|
@ -570,13 +570,13 @@ void dosendpackets (long other) //Host to send intially, client to send to other
|
|||
k = 2;
|
||||
*(long *)&pakbuf[k] = icnt0[other]; k += 4;
|
||||
memset(&pakbuf[k],0,32);
|
||||
for(i=icnt0[other];i<icnt0[other]+256;i++)
|
||||
for (i=icnt0[other];i<icnt0[other]+256;i++)
|
||||
if (ipak[other][i&(FIFSIZ-1)])
|
||||
pakbuf[((i-icnt0[other])>>3)+k] |= (1<<((i-icnt0[other])&7));
|
||||
k += 32;
|
||||
|
||||
while ((ocnt0[other] < ocnt1[other]) && (!opak[other][ocnt0[other]&(FIFSIZ-1)])) ocnt0[other]++;
|
||||
for(i=ocnt0[other];i<ocnt1[other];i++)
|
||||
for (i=ocnt0[other];i<ocnt1[other];i++)
|
||||
{
|
||||
j = *(short *)&pakmem[opak[other][i&(FIFSIZ-1)]]; if (!j) continue; //packet already acked
|
||||
if (k+6+j+4 > (long)sizeof(pakbuf)) break;
|
||||
|
@ -624,7 +624,7 @@ long getpacket (long *retother, char *bufptr)
|
|||
|
||||
if (netready)
|
||||
{
|
||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
||||
for (i=connecthead;i>=0;i=connectpoint2[i])
|
||||
{
|
||||
if (i != myconnectindex) dosendpackets(i);
|
||||
if ((!danetmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
|
||||
|
@ -657,7 +657,7 @@ long getpacket (long *retother, char *bufptr)
|
|||
//Master responds to slave with 0xab whenever it receives a 0xaa - even if during game!
|
||||
if ((pakbuf[k] == 0xaa) && (myconnectindex == connecthead))
|
||||
{
|
||||
for(other=1;other<numplayers;other++)
|
||||
for (other=1;other<numplayers;other++)
|
||||
{
|
||||
//Only send to others asking for a response
|
||||
if ((otherip[other]) && ((otherip[other] != snatchip) || (otherport[other] != snatchport))) continue;
|
||||
|
@ -699,7 +699,7 @@ long getpacket (long *retother, char *bufptr)
|
|||
numplayers = (long)pakbuf[k+2];
|
||||
|
||||
connecthead = 0;
|
||||
for(i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
|
||||
for (i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
|
||||
connectpoint2[numplayers-1] = -1;
|
||||
|
||||
otherip[connecthead] = snatchip;
|
||||
|
@ -721,7 +721,7 @@ long getpacket (long *retother, char *bufptr)
|
|||
else
|
||||
{
|
||||
if (ocnt0[other] < ic0) ocnt0[other] = ic0;
|
||||
for(i=ic0;i<min(ic0+256,ocnt1[other]);i++)
|
||||
for (i=ic0;i<min(ic0+256,ocnt1[other]);i++)
|
||||
if (pakbuf[((i-ic0)>>3)+k]&(1<<((i-ic0)&7)))
|
||||
opak[other][i&(FIFSIZ-1)] = 0;
|
||||
k += 32;
|
||||
|
@ -746,7 +746,7 @@ long getpacket (long *retother, char *bufptr)
|
|||
|
||||
//Return next valid packet from any player
|
||||
if (!bufptr) return(0);
|
||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
||||
for (i=connecthead;i>=0;i=connectpoint2[i])
|
||||
{
|
||||
if (i != myconnectindex)
|
||||
{
|
||||
|
@ -786,7 +786,7 @@ const char *getexternaladdress(void)
|
|||
char *host = "checkip.dyndns.org";
|
||||
char *req = "GET / HTTP/1.0\r\n\r\n";
|
||||
|
||||
if(ipaddr[0])
|
||||
if (ipaddr[0])
|
||||
return(ipaddr);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -812,18 +812,18 @@ const char *getexternaladdress(void)
|
|||
memset(&(dest_addr.sin_zero), '\0', 8);
|
||||
|
||||
sockfd = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if(sockfd == SOCKET_ERROR) {
|
||||
if (sockfd == SOCKET_ERROR) {
|
||||
initprintf("mmulti: socket() error in getexternaladdress() (%d)\n",errno);
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) {
|
||||
if (connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) {
|
||||
initprintf("mmulti: connect() error in getexternaladdress() (%d)\n",errno);
|
||||
return(0);
|
||||
}
|
||||
|
||||
bytes_sent = send(sockfd, req, strlen(req), 0);
|
||||
if(bytes_sent == SOCKET_ERROR) {
|
||||
if (bytes_sent == SOCKET_ERROR) {
|
||||
initprintf("mmulti: send() error in getexternaladdress() (%d)\n",errno);
|
||||
return(0);
|
||||
}
|
||||
|
@ -836,11 +836,11 @@ const char *getexternaladdress(void)
|
|||
WSACleanup();
|
||||
#endif
|
||||
|
||||
for(i=0;(unsigned)i<strlen(tempbuf);i++)
|
||||
for (i=0;(unsigned)i<strlen(tempbuf);i++)
|
||||
{
|
||||
if(isdigit(tempbuf[i]) && (isdigit(tempbuf[i+1]) || (tempbuf[i+1] == '.')) && (isdigit(tempbuf[i+2]) || (tempbuf[i+2] == '.')) && (isdigit(tempbuf[i+3]) || (tempbuf[i+3] == '.')))
|
||||
if (isdigit(tempbuf[i]) && (isdigit(tempbuf[i+1]) || (tempbuf[i+1] == '.')) && (isdigit(tempbuf[i+2]) || (tempbuf[i+2] == '.')) && (isdigit(tempbuf[i+3]) || (tempbuf[i+3] == '.')))
|
||||
{
|
||||
while(isdigit(tempbuf[i]) || (tempbuf[i] == '.'))
|
||||
while (isdigit(tempbuf[i]) || (tempbuf[i] == '.'))
|
||||
{
|
||||
ipaddr[j] = tempbuf[i];
|
||||
i++, j++;
|
||||
|
|
|
@ -110,7 +110,7 @@ static void _internal_drawosdchar(int x, int y, char ch, int shade, int pal)
|
|||
if (white<0) {
|
||||
// find the palette index closest to white
|
||||
k=0;
|
||||
for(i=0;i<256;i++)
|
||||
for (i=0;i<256;i++)
|
||||
{
|
||||
j = ((int)curpalette[i].r)+((int)curpalette[i].g)+((int)curpalette[i].b);
|
||||
if (j > k) { k = j; white = i; }
|
||||
|
@ -132,7 +132,7 @@ static void _internal_drawosdstr(int x, int y, char *ch, int len, int shade, int
|
|||
if (white<0) {
|
||||
// find the palette index closest to white
|
||||
k=0;
|
||||
for(i=0;i<256;i++)
|
||||
for (i=0;i<256;i++)
|
||||
{
|
||||
j = ((int)curpalette[i].r)+((int)curpalette[i].g)+((int)curpalette[i].b);
|
||||
if (j > k) { k = j; white = i; }
|
||||
|
@ -152,7 +152,7 @@ static void _internal_drawosdcursor(int x, int y, int type, int lastkeypress)
|
|||
if (white<0) {
|
||||
// find the palette index closest to white
|
||||
k=0;
|
||||
for(i=0;i<256;i++)
|
||||
for (i=0;i<256;i++)
|
||||
{
|
||||
j = ((int)palette[i*3])+((int)palette[i*3+1])+((int)palette[i*3+2]);
|
||||
if (j > k) { k = j; white = i; }
|
||||
|
@ -803,9 +803,12 @@ static char *strtoken(char *s, char **ptrptr, int *restart)
|
|||
break;
|
||||
} else if (*p == '\\') {
|
||||
switch (*(++p)) {
|
||||
case 'n': *p2 = '\n'; break;
|
||||
case 'r': *p2 = '\r'; break;
|
||||
default: *p2 = *p; break;
|
||||
case 'n':
|
||||
*p2 = '\n'; break;
|
||||
case 'r':
|
||||
*p2 = '\r'; break;
|
||||
default:
|
||||
*p2 = *p; break;
|
||||
}
|
||||
} else {
|
||||
*p2 = *p;
|
||||
|
@ -876,8 +879,10 @@ int OSD_Dispatch(const char *cmd)
|
|||
ofp.parms = (const char **)parms;
|
||||
ofp.raw = cmd;
|
||||
switch (symb->func(&ofp)) {
|
||||
case OSDCMD_OK: break;
|
||||
case OSDCMD_SHOWHELP: OSD_Printf("%s\n", symb->help); break;
|
||||
case OSDCMD_OK:
|
||||
break;
|
||||
case OSDCMD_SHOWHELP:
|
||||
OSD_Printf("%s\n", symb->help); break;
|
||||
}
|
||||
|
||||
state = wtp;
|
||||
|
|
|
@ -102,14 +102,14 @@ void polymer_glinit(void)
|
|||
|
||||
bglDisable(GL_FOG);
|
||||
|
||||
bglFogi(GL_FOG_MODE, GL_EXP);
|
||||
//glFogfv(GL_FOG_COLOR, fogColor);
|
||||
bglFogi(GL_FOG_MODE, GL_EXP);
|
||||
//glFogfv(GL_FOG_COLOR, fogColor);
|
||||
bglEnable(GL_FOG);
|
||||
|
||||
a = (1 - ((float)(visibility) / 512.0f)) / 10.0f;
|
||||
bglFogf(GL_FOG_DENSITY, 0.1f - a);
|
||||
bglFogf(GL_FOG_START, 0.0f);
|
||||
bglFogf(GL_FOG_END, 1000000.0f);
|
||||
bglFogf(GL_FOG_DENSITY, 0.1f - a);
|
||||
bglFogf(GL_FOG_START, 0.0f);
|
||||
bglFogf(GL_FOG_END, 1000000.0f);
|
||||
|
||||
bglEnable(GL_CULL_FACE);
|
||||
bglCullFace(GL_BACK);
|
||||
|
@ -215,7 +215,7 @@ void polymer_drawrooms(long daposx, long daposy, long daposz, sho
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
i = 0;
|
||||
while (i < numsectors)
|
||||
{
|
||||
|
@ -244,7 +244,7 @@ void polymer_drawrooms(long daposx, long daposy, long daposz, sho
|
|||
while (j < sec->wallnum)
|
||||
{
|
||||
if (((pr_frustumculling == 0) || polymer_portalinfrustum(sec->wallptr + j)) &&
|
||||
((pr_cliplanes == 0) || polymer_wallincliplanes(sec->wallptr + j)))
|
||||
((pr_cliplanes == 0) || polymer_wallincliplanes(sec->wallptr + j)))
|
||||
{
|
||||
polymer_drawwall(sec->wallptr + j);
|
||||
if ((wal->nextsector != -1) && (prsectors[wal->nextsector]) && (prsectors[wal->nextsector]->drawingstate == 0))
|
||||
|
@ -320,7 +320,7 @@ int polymer_initsector(short sectnum)
|
|||
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize geometry of sector %i : malloc failed.\n", sectnum);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
s->floorindices = s->ceilindices = NULL;
|
||||
|
||||
s->controlstate = s->drawingstate = 0;
|
||||
|
@ -450,7 +450,7 @@ int polymer_updatesector(short sectnum)
|
|||
}
|
||||
|
||||
if (picanm[curpicnum]&192) curpicnum += animateoffs(curpicnum,sectnum);
|
||||
|
||||
|
||||
if (!waloff[curpicnum])
|
||||
loadtile(curpicnum);
|
||||
|
||||
|
@ -734,7 +734,7 @@ void polymer_updatewall(short wallnum)
|
|||
}
|
||||
|
||||
if (wal->cstat & 4)
|
||||
yref = sec->floorz;
|
||||
yref = sec->floorz;
|
||||
else
|
||||
yref = sec->ceilingz;
|
||||
|
||||
|
@ -774,8 +774,8 @@ void polymer_updatewall(short wallnum)
|
|||
ns = prsectors[wal->nextsector];
|
||||
|
||||
if (((s->floorbuffer[((wallnum - sec->wallptr) * 5) + 1] != ns->floorbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]) ||
|
||||
(s->floorbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->floorbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) &&
|
||||
(s->floorbuffer[((wallnum - sec->wallptr) * 5) + 1] <= ns->floorbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]))
|
||||
(s->floorbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->floorbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) &&
|
||||
(s->floorbuffer[((wallnum - sec->wallptr) * 5) + 1] <= ns->floorbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]))
|
||||
{
|
||||
memcpy(w->wallbuffer, &s->floorbuffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3);
|
||||
memcpy(&w->wallbuffer[5], &s->floorbuffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3);
|
||||
|
@ -815,7 +815,7 @@ void polymer_updatewall(short wallnum)
|
|||
}
|
||||
|
||||
if ((!(wal->cstat & 2) && (wal->cstat & 4)) || ((wal->cstat & 2) && (wall[nwallnum].cstat & 4)))
|
||||
yref = sec->ceilingz;
|
||||
yref = sec->ceilingz;
|
||||
else
|
||||
yref = nsec->floorz;
|
||||
|
||||
|
@ -850,8 +850,8 @@ void polymer_updatewall(short wallnum)
|
|||
}
|
||||
|
||||
if (((s->ceilbuffer[((wallnum - sec->wallptr) * 5) + 1] != ns->ceilbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]) ||
|
||||
(s->ceilbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->ceilbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) &&
|
||||
(s->ceilbuffer[((wallnum - sec->wallptr) * 5) + 1] >= ns->ceilbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]))
|
||||
(s->ceilbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->ceilbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) &&
|
||||
(s->ceilbuffer[((wallnum - sec->wallptr) * 5) + 1] >= ns->ceilbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]))
|
||||
{
|
||||
if (w->overbuffer == NULL)
|
||||
w->overbuffer = calloc(4, sizeof(GLfloat) * 5);
|
||||
|
@ -888,7 +888,7 @@ void polymer_updatewall(short wallnum)
|
|||
}
|
||||
|
||||
if (wal->cstat & 4)
|
||||
yref = sec->ceilingz;
|
||||
yref = sec->ceilingz;
|
||||
else
|
||||
yref = nsec->ceilingz;
|
||||
|
||||
|
@ -1016,8 +1016,8 @@ int polymer_portalinfrustum(short wallnum)
|
|||
while (j < 4)
|
||||
{
|
||||
sqdist = frustum[(i * 4) + 0] * w->portal[(j * 3) + 0] +
|
||||
frustum[(i * 4) + 1] * w->portal[(j * 3) + 1] +
|
||||
frustum[(i * 4) + 2] * w->portal[(j * 3) + 2] +
|
||||
frustum[(i * 4) + 1] * w->portal[(j * 3) + 1] +
|
||||
frustum[(i * 4) + 2] * w->portal[(j * 3) + 2] +
|
||||
frustum[(i * 4) + 3];
|
||||
if (sqdist < 0)
|
||||
k++;
|
||||
|
@ -1050,7 +1050,7 @@ int polymer_wallincliplanes(short wallnum)
|
|||
walltype *wal;
|
||||
_point2d p1, p2;
|
||||
int i, j;
|
||||
|
||||
|
||||
wal = &wall[wallnum];
|
||||
|
||||
p1.x = wal->x;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -184,13 +184,13 @@ void copybufreverse(void *S, void *D, long c)
|
|||
void qinterpolatedown16(long bufptr, long num, long val, long add)
|
||||
{ // gee, I wonder who could have provided this...
|
||||
long i, *lptr = (long *)bufptr;
|
||||
for(i=0;i<num;i++) { lptr[i] = (val>>16); val += add; }
|
||||
for (i=0;i<num;i++) { lptr[i] = (val>>16); val += add; }
|
||||
}
|
||||
|
||||
void qinterpolatedown16short(long bufptr, long num, long val, long add)
|
||||
{ // ...maybe the same person who provided this too?
|
||||
long i; short *sptr = (short *)bufptr;
|
||||
for(i=0;i<num;i++) { sptr[i] = (short)(val>>16); val += add; }
|
||||
for (i=0;i<num;i++) { sptr[i] = (short)(val>>16); val += add; }
|
||||
}
|
||||
|
||||
void clearbuf(void *d, long c, long a)
|
||||
|
@ -232,13 +232,13 @@ void clearbufbyte(void *D, long c, long a)
|
|||
void copybufbyte(void *S, void *D, long c)
|
||||
{
|
||||
char *p = (char*)S, *q = (char*)D;
|
||||
while((c--) > 0) *(q++) = *(p++);
|
||||
while ((c--) > 0) *(q++) = *(p++);
|
||||
}
|
||||
|
||||
void copybufreverse(void *S, void *D, long c)
|
||||
{
|
||||
char *p = (char*)S, *q = (char*)D;
|
||||
while((c--) > 0) *(q++) = *(p--);
|
||||
while ((c--) > 0) *(q++) = *(p--);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -178,8 +178,8 @@ int scriptfile_getlinum (scriptfile *sf, char *ptr)
|
|||
|
||||
ind = ((long)ptr) - ((long)sf->textbuf);
|
||||
|
||||
for(stp=1;stp+stp<sf->linenum;stp+=stp); //stp = highest power of 2 less than sf->linenum
|
||||
for(i=0;stp;stp>>=1)
|
||||
for (stp=1;stp+stp<sf->linenum;stp+=stp); //stp = highest power of 2 less than sf->linenum
|
||||
for (i=0;stp;stp>>=1)
|
||||
if ((i+stp < sf->linenum) && (sf->lineoffs[i+stp] < ind)) i += stp;
|
||||
return(i+1); //i = index to highest lineoffs which is less than ind; convert to 1-based line numbers
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ void scriptfile_preparse (scriptfile *sf, char *tx, long flen)
|
|||
|
||||
//Count number of lines
|
||||
numcr = 1;
|
||||
for(i=0;i<flen;i++)
|
||||
for (i=0;i<flen;i++)
|
||||
{
|
||||
//detect all 4 types of carriage return (\r, \n, \r\n, \n\r :)
|
||||
cr=0;if (tx[i] == '\r') { i += (tx[i+1] == '\n'); cr = 1; }
|
||||
|
@ -203,7 +203,7 @@ void scriptfile_preparse (scriptfile *sf, char *tx, long flen)
|
|||
|
||||
//Preprocess file for comments (// and /*...*/, and convert all whitespace to single spaces)
|
||||
nflen = 0; ws = 0; cs = 0; numcr = 0; inquote = 0;
|
||||
for(i=0;i<flen;i++)
|
||||
for (i=0;i<flen;i++)
|
||||
{
|
||||
//detect all 4 types of carriage return (\r, \n, \r\n, \n\r :)
|
||||
cr=0;if (tx[i] == '\r') { i += (tx[i+1] == '\n'); cr = 1; }
|
||||
|
@ -236,9 +236,9 @@ void scriptfile_preparse (scriptfile *sf, char *tx, long flen)
|
|||
#if 0
|
||||
//for debugging only:
|
||||
printf("pre-parsed file:flen=%d,nflen=%d\n",flen,nflen);
|
||||
for(i=0;i<nflen;i++) { if (tx[i] < 32) printf("_"); else printf("%c",tx[i]); }
|
||||
for (i=0;i<nflen;i++) { if (tx[i] < 32) printf("_"); else printf("%c",tx[i]); }
|
||||
printf("[eof]\nnumlines=%d\n",sf->linenum);
|
||||
for(i=0;i<sf->linenum;i++) printf("line %d = byte %d\n",i,sf->lineoffs[i]);
|
||||
for (i=0;i<sf->linenum;i++) printf("line %d = byte %d\n",i,sf->lineoffs[i]);
|
||||
#endif
|
||||
flen = nflen;
|
||||
|
||||
|
@ -323,9 +323,9 @@ void scriptfile_close(scriptfile *sf)
|
|||
|
||||
int scriptfile_eof(scriptfile *sf)
|
||||
{
|
||||
skipoverws(sf);
|
||||
if (sf->textptr >= sf->eof) return 1;
|
||||
return 0;
|
||||
skipoverws(sf);
|
||||
if (sf->textptr >= sf->eof) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define SYMBTABSTARTSIZE 256
|
||||
|
@ -339,7 +339,7 @@ static char * getsymbtabspace(int reqd)
|
|||
|
||||
if (symbtablength + reqd > symbtaballoclength)
|
||||
{
|
||||
for(i=max(symbtaballoclength,SYMBTABSTARTSIZE);symbtablength+reqd>i;i<<=1);
|
||||
for (i=max(symbtaballoclength,SYMBTABSTARTSIZE);symbtablength+reqd>i;i<<=1);
|
||||
np = (char *)realloc(symbtab, i); if (!np) return NULL;
|
||||
symbtab = np; symbtaballoclength = i;
|
||||
}
|
||||
|
|
|
@ -663,7 +663,8 @@ void getvalidmodes(void)
|
|||
#ifdef USE_OPENGL
|
||||
16,24,32,
|
||||
#endif
|
||||
0 };
|
||||
0
|
||||
};
|
||||
static int defaultres[][2] = {
|
||||
{1280,1024},{1280,960},{1152,864},{1024,768},{800,600},{640,480},
|
||||
{640,400},{512,384},{480,360},{400,300},{320,240},{320,200},{0,0}
|
||||
|
@ -690,7 +691,7 @@ void getvalidmodes(void)
|
|||
validmodecnt++; \
|
||||
initprintf(" - %dx%d %d-bit %s\n", x, y, c, (f&1)?"fullscreen":"windowed"); \
|
||||
} \
|
||||
}
|
||||
}
|
||||
|
||||
#define CHECK(w,h) if ((w < maxx) && (h < maxy))
|
||||
|
||||
|
@ -788,10 +789,10 @@ int checkvideomode(int *x, int *y, int c, int fs, int forced)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ANY_WINDOWED_SIZE
|
||||
#ifdef ANY_WINDOWED_SIZE
|
||||
if (!forced && (fs&1) == 0 && (nearest < 0 || (validmode[nearest].xdim!=*x || validmode[nearest].ydim!=*y)))
|
||||
return 0x7fffffffl;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (nearest < 0) {
|
||||
// no mode that will match (eg. if no fullscreen modes)
|
||||
|
@ -1071,7 +1072,7 @@ void begindrawing(void)
|
|||
setvlinebpl(bytesperline);
|
||||
|
||||
j = 0;
|
||||
for(i=0;i<=ydim;i++) ylookup[i] = j, j += bytesperline;
|
||||
for (i=0;i<=ydim;i++) ylookup[i] = j, j += bytesperline;
|
||||
modechange=0;
|
||||
}
|
||||
}
|
||||
|
@ -1301,10 +1302,14 @@ int handleevents(void)
|
|||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
switch (ev.button.button) {
|
||||
case SDL_BUTTON_LEFT: j = 0; break;
|
||||
case SDL_BUTTON_RIGHT: j = 1; break;
|
||||
case SDL_BUTTON_MIDDLE: j = 2; break;
|
||||
default: j = ev.button.button; break;
|
||||
case SDL_BUTTON_LEFT:
|
||||
j = 0; break;
|
||||
case SDL_BUTTON_RIGHT:
|
||||
j = 1; break;
|
||||
case SDL_BUTTON_MIDDLE:
|
||||
j = 2; break;
|
||||
default:
|
||||
j = ev.button.button; break;
|
||||
}
|
||||
if (j<0) break;
|
||||
|
||||
|
@ -1338,28 +1343,28 @@ int handleevents(void)
|
|||
break;
|
||||
|
||||
case SDL_JOYHATMOTION: {
|
||||
int hatvals[16] = {
|
||||
-1, // centre
|
||||
0, // up 1
|
||||
9000, // right 2
|
||||
4500, // up+right 3
|
||||
18000, // down 4
|
||||
-1, // down+up!! 5
|
||||
13500, // down+right 6
|
||||
-1, // down+right+up!! 7
|
||||
27000, // left 8
|
||||
27500, // left+up 9
|
||||
-1, // left+right!! 10
|
||||
-1, // left+right+up!! 11
|
||||
22500, // left+down 12
|
||||
-1, // left+down+up!! 13
|
||||
-1, // left+down+right!! 14
|
||||
-1, // left+down+right+up!! 15
|
||||
};
|
||||
if (appactive && ev.jhat.hat < joynumhats)
|
||||
joyhat[ ev.jhat.hat ] = hatvals[ ev.jhat.value & 15 ];
|
||||
break;
|
||||
}
|
||||
int hatvals[16] = {
|
||||
-1, // centre
|
||||
0, // up 1
|
||||
9000, // right 2
|
||||
4500, // up+right 3
|
||||
18000, // down 4
|
||||
-1, // down+up!! 5
|
||||
13500, // down+right 6
|
||||
-1, // down+right+up!! 7
|
||||
27000, // left 8
|
||||
27500, // left+up 9
|
||||
-1, // left+right!! 10
|
||||
-1, // left+right+up!! 11
|
||||
22500, // left+down 12
|
||||
-1, // left+down+up!! 13
|
||||
-1, // left+down+right!! 14
|
||||
-1, // left+down+right+up!! 15
|
||||
};
|
||||
if (appactive && ev.jhat.hat < joynumhats)
|
||||
joyhat[ ev.jhat.hat ] = hatvals[ ev.jhat.value & 15 ];
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
case SDL_JOYBUTTONUP:
|
||||
|
|
|
@ -95,14 +95,22 @@ void initsb(char dadigistat, char damusistat, long dasamplerate, char danumspeak
|
|||
}
|
||||
|
||||
switch (FSOUND_GetOutput()) {
|
||||
case FSOUND_OUTPUT_NOSOUND: s = "No Sound"; break;
|
||||
case FSOUND_OUTPUT_WINMM: s = "WINMM"; break;
|
||||
case FSOUND_OUTPUT_DSOUND: s = "DirectSound"; break;
|
||||
case FSOUND_OUTPUT_OSS: s = "OSS"; break;
|
||||
case FSOUND_OUTPUT_ESD: s = "ESound"; break;
|
||||
case FSOUND_OUTPUT_ALSA: s = "ALSA"; break;
|
||||
case FSOUND_OUTPUT_ASIO: s = "ASIO"; break;
|
||||
default: s = "Other"; break;
|
||||
case FSOUND_OUTPUT_NOSOUND:
|
||||
s = "No Sound"; break;
|
||||
case FSOUND_OUTPUT_WINMM:
|
||||
s = "WINMM"; break;
|
||||
case FSOUND_OUTPUT_DSOUND:
|
||||
s = "DirectSound"; break;
|
||||
case FSOUND_OUTPUT_OSS:
|
||||
s = "OSS"; break;
|
||||
case FSOUND_OUTPUT_ESD:
|
||||
s = "ESound"; break;
|
||||
case FSOUND_OUTPUT_ALSA:
|
||||
s = "ALSA"; break;
|
||||
case FSOUND_OUTPUT_ASIO:
|
||||
s = "ASIO"; break;
|
||||
default:
|
||||
s = "Other"; break;
|
||||
}
|
||||
printOSD("Using FMOD \"%s\" output driver\n", s);
|
||||
|
||||
|
|
|
@ -60,14 +60,14 @@ static GdkPixbuf *load_banner(void)
|
|||
static void SetPage(int n)
|
||||
{
|
||||
if (!gtkenabled || !startwin) return;
|
||||
mode = n;
|
||||
mode = n;
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n);
|
||||
|
||||
// each control in the config page vertical layout plus the start button should be made (in)sensitive
|
||||
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
|
||||
gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n);
|
||||
// each control in the config page vertical layout plus the start button should be made (in)sensitive
|
||||
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
|
||||
gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n);
|
||||
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")),
|
||||
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
|
||||
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
|
||||
}
|
||||
|
||||
static void on_vmode2dcombo_changed(GtkComboBox *, gpointer);
|
||||
|
@ -169,8 +169,8 @@ static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer u
|
|||
|
||||
static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
|
||||
else quitevent++;
|
||||
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
|
||||
else quitevent++;
|
||||
}
|
||||
|
||||
static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
|
||||
|
@ -181,8 +181,8 @@ static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
|
|||
|
||||
static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
||||
{
|
||||
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
|
||||
else quitevent++;
|
||||
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
|
||||
else quitevent++;
|
||||
return TRUE; // FALSE would let the event go through. we want the game to decide when to close
|
||||
}
|
||||
|
||||
|
@ -375,9 +375,9 @@ static GtkWidget *create_window(void)
|
|||
gtk_widget_add_accelerator (cancelbutton, "grab_focus", accel_group,
|
||||
GDK_C, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (cancelbutton, "clicked", accel_group,
|
||||
GDK_Escape, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (cancelbutton, "clicked", accel_group,
|
||||
GDK_Escape, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
cancelbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
|
||||
gtk_widget_show (cancelbuttonalign);
|
||||
|
@ -403,9 +403,9 @@ static GtkWidget *create_window(void)
|
|||
gtk_widget_add_accelerator (startbutton, "grab_focus", accel_group,
|
||||
GDK_S, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (startbutton, "clicked", accel_group,
|
||||
GDK_Return, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (startbutton, "clicked", accel_group,
|
||||
GDK_Return, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
startbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
|
||||
gtk_widget_show (startbuttonalign);
|
||||
|
|
|
@ -112,10 +112,12 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
case IDCALWAYSSHOW:
|
||||
settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED;
|
||||
return TRUE;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -131,14 +133,14 @@ static void SetPage(int n)
|
|||
ShowWindow(pages[cur],SW_HIDE);
|
||||
SendMessage(tab, TCM_SETCURSEL, n, 0);
|
||||
ShowWindow(pages[n],SW_SHOW);
|
||||
mode = n;
|
||||
mode = n;
|
||||
|
||||
SetFocus(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL));
|
||||
}
|
||||
|
||||
static void EnableConfig(int n)
|
||||
{
|
||||
//EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
|
||||
//EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
|
||||
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC2DVMODE), n);
|
||||
|
@ -152,128 +154,128 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG: {
|
||||
HWND hwnd;
|
||||
RECT r, rdlg, chrome, rtab, rcancel, rstart;
|
||||
int xoffset = 0, yoffset = 0;
|
||||
HWND hwnd;
|
||||
RECT r, rdlg, chrome, rtab, rcancel, rstart;
|
||||
int xoffset = 0, yoffset = 0;
|
||||
|
||||
// Fetch the positions (in screen coordinates) of all the windows we need to tweak
|
||||
ZeroMemory(&chrome, sizeof(chrome));
|
||||
AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
|
||||
GetWindowRect(hwndDlg, &rdlg);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
// Fetch the positions (in screen coordinates) of all the windows we need to tweak
|
||||
ZeroMemory(&chrome, sizeof(chrome));
|
||||
AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
|
||||
GetWindowRect(hwndDlg, &rdlg);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
|
||||
// Knock off the non-client area of the main dialogue to give just the client area
|
||||
rdlg.left -= chrome.left; rdlg.top -= chrome.top;
|
||||
rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom;
|
||||
// Knock off the non-client area of the main dialogue to give just the client area
|
||||
rdlg.left -= chrome.left; rdlg.top -= chrome.top;
|
||||
rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom;
|
||||
|
||||
// Translate them to client-relative coordinates wrt the main dialogue window
|
||||
rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1;
|
||||
rtab.left -= rdlg.left; rtab.top -= rdlg.top;
|
||||
// Translate them to client-relative coordinates wrt the main dialogue window
|
||||
rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1;
|
||||
rtab.left -= rdlg.left; rtab.top -= rdlg.top;
|
||||
|
||||
rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1;
|
||||
rcancel.left -= rdlg.left; rcancel.top -= rdlg.top;
|
||||
rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1;
|
||||
rcancel.left -= rdlg.left; rcancel.top -= rdlg.top;
|
||||
|
||||
rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1;
|
||||
rstart.left -= rdlg.left; rstart.top -= rdlg.top;
|
||||
rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1;
|
||||
rstart.left -= rdlg.left; rstart.top -= rdlg.top;
|
||||
|
||||
// And then convert the main dialogue coordinates to just width/length
|
||||
rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1;
|
||||
rdlg.left = 0; rdlg.top = 0;
|
||||
// And then convert the main dialogue coordinates to just width/length
|
||||
rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1;
|
||||
rdlg.left = 0; rdlg.top = 0;
|
||||
|
||||
// Load the bitmap into the bitmap control and fetch its dimensions
|
||||
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
|
||||
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
|
||||
// Load the bitmap into the bitmap control and fetch its dimensions
|
||||
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
|
||||
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
|
||||
GetClientRect(hwnd, &r);
|
||||
xoffset = r.right;
|
||||
yoffset = r.bottom - rdlg.bottom;
|
||||
|
||||
// Shift and resize the controls that require it
|
||||
rtab.left += xoffset; rtab.bottom += yoffset;
|
||||
rcancel.left += xoffset; rcancel.top += yoffset;
|
||||
rstart.left += xoffset; rstart.top += yoffset;
|
||||
rdlg.right += xoffset;
|
||||
rdlg.bottom += yoffset;
|
||||
|
||||
// Move the controls to their new positions
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
|
||||
|
||||
// Move the main dialogue to the centre of the screen
|
||||
hdc = GetDC(NULL);
|
||||
rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
|
||||
rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
|
||||
ReleaseDC(NULL, hdc);
|
||||
MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left,
|
||||
rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE);
|
||||
|
||||
// Add tabs to the tab control
|
||||
{
|
||||
TCITEM tab;
|
||||
|
||||
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
|
||||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Configuration");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Messages");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
GetClientRect(hwnd, &r);
|
||||
xoffset = r.right;
|
||||
yoffset = r.bottom - rdlg.bottom;
|
||||
SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
|
||||
r.right -= r.left-1;
|
||||
r.bottom -= r.top-1;
|
||||
r.top += rtab.top;
|
||||
r.left += rtab.left;
|
||||
|
||||
// Shift and resize the controls that require it
|
||||
rtab.left += xoffset; rtab.bottom += yoffset;
|
||||
rcancel.left += xoffset; rcancel.top += yoffset;
|
||||
rstart.left += xoffset; rstart.top += yoffset;
|
||||
rdlg.right += xoffset;
|
||||
rdlg.bottom += yoffset;
|
||||
// Create the pages and position them in the tab control, but hide them
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
|
||||
// Move the controls to their new positions
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
|
||||
// Tell the editfield acting as the console to exclude the width of the scrollbar
|
||||
GetClientRect(pages[TAB_MESSAGES],&r);
|
||||
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
|
||||
r.left = r.top = 0;
|
||||
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
|
||||
|
||||
// Move the main dialogue to the centre of the screen
|
||||
hdc = GetDC(NULL);
|
||||
rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
|
||||
rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
|
||||
ReleaseDC(NULL, hdc);
|
||||
MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left,
|
||||
rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE);
|
||||
|
||||
// Add tabs to the tab control
|
||||
{
|
||||
TCITEM tab;
|
||||
|
||||
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
|
||||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Configuration");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Messages");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
GetClientRect(hwnd, &r);
|
||||
SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
|
||||
r.right -= r.left-1;
|
||||
r.bottom -= r.top-1;
|
||||
r.top += rtab.top;
|
||||
r.left += rtab.left;
|
||||
|
||||
// Create the pages and position them in the tab control, but hide them
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
|
||||
// Tell the editfield acting as the console to exclude the width of the scrollbar
|
||||
GetClientRect(pages[TAB_MESSAGES],&r);
|
||||
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
|
||||
r.left = r.top = 0;
|
||||
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
|
||||
|
||||
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
|
||||
}
|
||||
return FALSE;
|
||||
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY: {
|
||||
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||
int cur;
|
||||
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
|
||||
cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
switch (nmhdr->code) {
|
||||
case TCN_SELCHANGING: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGE: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||
int cur;
|
||||
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
|
||||
cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
switch (nmhdr->code) {
|
||||
case TCN_SELCHANGING: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGE: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CLOSE:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
|
||||
case WM_DESTROY:
|
||||
|
@ -292,11 +294,12 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case WIN_STARTWIN_CANCEL:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
case WIN_STARTWIN_START: done = 1; return TRUE;
|
||||
case WIN_STARTWIN_CANCEL:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
case WIN_STARTWIN_START:
|
||||
done = 1; return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
|
@ -305,7 +308,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
return (BOOL)GetSysColorBrush(COLOR_WINDOW);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -422,8 +426,10 @@ int startwin_run(void)
|
|||
|
||||
while (done < 0) {
|
||||
switch (GetMessage(&msg, NULL, 0,0)) {
|
||||
case 0: done = 1; break;
|
||||
case -1: return -1;
|
||||
case 0:
|
||||
done = 1; break;
|
||||
case -1:
|
||||
return -1;
|
||||
default:
|
||||
if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break;
|
||||
TranslateMessage(&msg);
|
||||
|
|
|
@ -910,7 +910,8 @@ static BOOL CALLBACK InitDirectInput_enum(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRe
|
|||
);
|
||||
*/
|
||||
break;
|
||||
default: d = "OTHER"; break;
|
||||
default:
|
||||
d = "OTHER"; break;
|
||||
}
|
||||
|
||||
initprintf(" * %s: %s\n", d, lpddi->tszProductName);
|
||||
|
@ -1494,40 +1495,74 @@ static void ShowDInputErrorBox(const char *m, HRESULT r)
|
|||
static const char * GetDInputError(HRESULT code)
|
||||
{
|
||||
switch (code) {
|
||||
case DI_OK: return "DI_OK";
|
||||
case DI_BUFFEROVERFLOW: return "DI_BUFFEROVERFLOW";
|
||||
case DI_DOWNLOADSKIPPED: return "DI_DOWNLOADSKIPPED";
|
||||
case DI_EFFECTRESTARTED: return "DI_EFFECTRESTARTED";
|
||||
case DI_POLLEDDEVICE: return "DI_POLLEDDEVICE";
|
||||
case DI_TRUNCATED: return "DI_TRUNCATED";
|
||||
case DI_TRUNCATEDANDRESTARTED: return "DI_TRUNCATEDANDRESTARTED";
|
||||
case DIERR_ACQUIRED: return "DIERR_ACQUIRED";
|
||||
case DIERR_ALREADYINITIALIZED: return "DIERR_ALREADYINITIALIZED";
|
||||
case DIERR_BADDRIVERVER: return "DIERR_BADDRIVERVER";
|
||||
case DIERR_BETADIRECTINPUTVERSION: return "DIERR_BETADIRECTINPUTVERSION";
|
||||
case DIERR_DEVICEFULL: return "DIERR_DEVICEFULL";
|
||||
case DIERR_DEVICENOTREG: return "DIERR_DEVICENOTREG";
|
||||
case DIERR_EFFECTPLAYING: return "DIERR_EFFECTPLAYING";
|
||||
case DIERR_HASEFFECTS: return "DIERR_HASEFFECTS";
|
||||
case DIERR_GENERIC: return "DIERR_GENERIC";
|
||||
case DIERR_HANDLEEXISTS: return "DIERR_HANDLEEXISTS";
|
||||
case DIERR_INCOMPLETEEFFECT: return "DIERR_INCOMPLETEEFFECT";
|
||||
case DIERR_INPUTLOST: return "DIERR_INPUTLOST";
|
||||
case DIERR_INVALIDPARAM: return "DIERR_INVALIDPARAM";
|
||||
case DIERR_MOREDATA: return "DIERR_MOREDATA";
|
||||
case DIERR_NOAGGREGATION: return "DIERR_NOAGGREGATION";
|
||||
case DIERR_NOINTERFACE: return "DIERR_NOINTERFACE";
|
||||
case DIERR_NOTACQUIRED: return "DIERR_NOTACQUIRED";
|
||||
case DIERR_NOTBUFFERED: return "DIERR_NOTBUFFERED";
|
||||
case DIERR_NOTDOWNLOADED: return "DIERR_NOTDOWNLOADED";
|
||||
case DIERR_NOTEXCLUSIVEACQUIRED: return "DIERR_NOTEXCLUSIVEACQUIRED";
|
||||
case DIERR_NOTFOUND: return "DIERR_NOTFOUND";
|
||||
case DIERR_NOTINITIALIZED: return "DIERR_NOTINITIALIZED";
|
||||
case DIERR_OLDDIRECTINPUTVERSION: return "DIERR_OLDDIRECTINPUTVERSION";
|
||||
case DIERR_OUTOFMEMORY: return "DIERR_OUTOFMEMORY";
|
||||
case DIERR_UNSUPPORTED: return "DIERR_UNSUPPORTED";
|
||||
case E_PENDING: return "E_PENDING";
|
||||
default: break;
|
||||
case DI_OK:
|
||||
return "DI_OK";
|
||||
case DI_BUFFEROVERFLOW:
|
||||
return "DI_BUFFEROVERFLOW";
|
||||
case DI_DOWNLOADSKIPPED:
|
||||
return "DI_DOWNLOADSKIPPED";
|
||||
case DI_EFFECTRESTARTED:
|
||||
return "DI_EFFECTRESTARTED";
|
||||
case DI_POLLEDDEVICE:
|
||||
return "DI_POLLEDDEVICE";
|
||||
case DI_TRUNCATED:
|
||||
return "DI_TRUNCATED";
|
||||
case DI_TRUNCATEDANDRESTARTED:
|
||||
return "DI_TRUNCATEDANDRESTARTED";
|
||||
case DIERR_ACQUIRED:
|
||||
return "DIERR_ACQUIRED";
|
||||
case DIERR_ALREADYINITIALIZED:
|
||||
return "DIERR_ALREADYINITIALIZED";
|
||||
case DIERR_BADDRIVERVER:
|
||||
return "DIERR_BADDRIVERVER";
|
||||
case DIERR_BETADIRECTINPUTVERSION:
|
||||
return "DIERR_BETADIRECTINPUTVERSION";
|
||||
case DIERR_DEVICEFULL:
|
||||
return "DIERR_DEVICEFULL";
|
||||
case DIERR_DEVICENOTREG:
|
||||
return "DIERR_DEVICENOTREG";
|
||||
case DIERR_EFFECTPLAYING:
|
||||
return "DIERR_EFFECTPLAYING";
|
||||
case DIERR_HASEFFECTS:
|
||||
return "DIERR_HASEFFECTS";
|
||||
case DIERR_GENERIC:
|
||||
return "DIERR_GENERIC";
|
||||
case DIERR_HANDLEEXISTS:
|
||||
return "DIERR_HANDLEEXISTS";
|
||||
case DIERR_INCOMPLETEEFFECT:
|
||||
return "DIERR_INCOMPLETEEFFECT";
|
||||
case DIERR_INPUTLOST:
|
||||
return "DIERR_INPUTLOST";
|
||||
case DIERR_INVALIDPARAM:
|
||||
return "DIERR_INVALIDPARAM";
|
||||
case DIERR_MOREDATA:
|
||||
return "DIERR_MOREDATA";
|
||||
case DIERR_NOAGGREGATION:
|
||||
return "DIERR_NOAGGREGATION";
|
||||
case DIERR_NOINTERFACE:
|
||||
return "DIERR_NOINTERFACE";
|
||||
case DIERR_NOTACQUIRED:
|
||||
return "DIERR_NOTACQUIRED";
|
||||
case DIERR_NOTBUFFERED:
|
||||
return "DIERR_NOTBUFFERED";
|
||||
case DIERR_NOTDOWNLOADED:
|
||||
return "DIERR_NOTDOWNLOADED";
|
||||
case DIERR_NOTEXCLUSIVEACQUIRED:
|
||||
return "DIERR_NOTEXCLUSIVEACQUIRED";
|
||||
case DIERR_NOTFOUND:
|
||||
return "DIERR_NOTFOUND";
|
||||
case DIERR_NOTINITIALIZED:
|
||||
return "DIERR_NOTINITIALIZED";
|
||||
case DIERR_OLDDIRECTINPUTVERSION:
|
||||
return "DIERR_OLDDIRECTINPUTVERSION";
|
||||
case DIERR_OUTOFMEMORY:
|
||||
return "DIERR_OUTOFMEMORY";
|
||||
case DIERR_UNSUPPORTED:
|
||||
return "DIERR_UNSUPPORTED";
|
||||
case E_PENDING:
|
||||
return "E_PENDING";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "Unknown error";
|
||||
}
|
||||
|
@ -1993,7 +2028,7 @@ void begindrawing(void)
|
|||
setvlinebpl(bytesperline);
|
||||
|
||||
j = 0;
|
||||
for(i=0;i<=ydim;i++) ylookup[i] = j, j += bytesperline;
|
||||
for (i=0;i<=ydim;i++) ylookup[i] = j, j += bytesperline;
|
||||
modechange=0;
|
||||
}
|
||||
|
||||
|
@ -3170,118 +3205,230 @@ static void ShowDDrawErrorBox(const char *m, HRESULT r)
|
|||
static const char * GetDDrawError(HRESULT code)
|
||||
{
|
||||
switch (code) {
|
||||
case DD_OK: return "DD_OK";
|
||||
case DDERR_ALREADYINITIALIZED: return "DDERR_ALREADYINITIALIZED";
|
||||
case DDERR_BLTFASTCANTCLIP: return "DDERR_BLTFASTCANTCLIP";
|
||||
case DDERR_CANNOTATTACHSURFACE: return "DDERR_CANNOTATTACHSURFACE";
|
||||
case DDERR_CANNOTDETACHSURFACE: return "DDERR_CANNOTDETACHSURFACE";
|
||||
case DDERR_CANTCREATEDC: return "DDERR_CANTCREATEDC";
|
||||
case DDERR_CANTDUPLICATE: return "DDERR_CANTDUPLICATE";
|
||||
case DDERR_CANTLOCKSURFACE: return "DDERR_CANTLOCKSURFACE";
|
||||
case DDERR_CANTPAGELOCK: return "DDERR_CANTPAGELOCK";
|
||||
case DDERR_CANTPAGEUNLOCK: return "DDERR_CANTPAGEUNLOCK";
|
||||
case DDERR_CLIPPERISUSINGHWND: return "DDERR_CLIPPERISUSINGHWND";
|
||||
case DDERR_COLORKEYNOTSET: return "DDERR_COLORKEYNOTSET";
|
||||
case DDERR_CURRENTLYNOTAVAIL: return "DDERR_CURRENTLYNOTAVAIL";
|
||||
case DDERR_DCALREADYCREATED: return "DDERR_DCALREADYCREATED";
|
||||
case DDERR_DEVICEDOESNTOWNSURFACE: return "DDERR_DEVICEDOESNTOWNSURFACE";
|
||||
case DDERR_DIRECTDRAWALREADYCREATED: return "DDERR_DIRECTDRAWALREADYCREATED";
|
||||
case DDERR_EXCEPTION: return "DDERR_EXCEPTION";
|
||||
case DDERR_EXCLUSIVEMODEALREADYSET: return "DDERR_EXCLUSIVEMODEALREADYSET";
|
||||
case DDERR_EXPIRED: return "DDERR_EXPIRED";
|
||||
case DDERR_GENERIC: return "DDERR_GENERIC";
|
||||
case DDERR_HEIGHTALIGN: return "DDERR_HEIGHTALIGN";
|
||||
case DDERR_HWNDALREADYSET: return "DDERR_HWNDALREADYSET";
|
||||
case DDERR_HWNDSUBCLASSED: return "DDERR_HWNDSUBCLASSED";
|
||||
case DDERR_IMPLICITLYCREATED: return "DDERR_IMPLICITLYCREATED";
|
||||
case DDERR_INCOMPATIBLEPRIMARY: return "DDERR_INCOMPATIBLEPRIMARY";
|
||||
case DDERR_INVALIDCAPS: return "DDERR_INVALIDCAPS";
|
||||
case DDERR_INVALIDCLIPLIST: return "DDERR_INVALIDCLIPLIST";
|
||||
case DDERR_INVALIDDIRECTDRAWGUID: return "DDERR_INVALIDDIRECTDRAWGUID";
|
||||
case DDERR_INVALIDMODE: return "DDERR_INVALIDMODE";
|
||||
case DDERR_INVALIDOBJECT: return "DDERR_INVALIDOBJECT";
|
||||
case DDERR_INVALIDPARAMS: return "DDERR_INVALIDPARAMS";
|
||||
case DDERR_INVALIDPIXELFORMAT: return "DDERR_INVALIDPIXELFORMAT";
|
||||
case DDERR_INVALIDPOSITION: return "DDERR_INVALIDPOSITION";
|
||||
case DDERR_INVALIDRECT: return "DDERR_INVALIDRECT";
|
||||
case DDERR_INVALIDSTREAM: return "DDERR_INVALIDSTREAM";
|
||||
case DDERR_INVALIDSURFACETYPE: return "DDERR_INVALIDSURFACETYPE";
|
||||
case DDERR_LOCKEDSURFACES: return "DDERR_LOCKEDSURFACES";
|
||||
case DDERR_MOREDATA: return "DDERR_MOREDATA";
|
||||
case DDERR_NO3D: return "DDERR_NO3D";
|
||||
case DDERR_NOALPHAHW: return "DDERR_NOALPHAHW";
|
||||
case DDERR_NOBLTHW: return "DDERR_NOBLTHW";
|
||||
case DDERR_NOCLIPLIST: return "DDERR_NOCLIPLIST";
|
||||
case DDERR_NOCLIPPERATTACHED: return "DDERR_NOCLIPPERATTACHED";
|
||||
case DDERR_NOCOLORCONVHW: return "DDERR_NOCOLORCONVHW";
|
||||
case DDERR_NOCOLORKEY: return "DDERR_NOCOLORKEY";
|
||||
case DDERR_NOCOLORKEYHW: return "DDERR_NOCOLORKEYHW";
|
||||
case DDERR_NOCOOPERATIVELEVELSET: return "DDERR_NOCOOPERATIVELEVELSET";
|
||||
case DDERR_NODC: return "DDERR_NODC";
|
||||
case DDERR_NODDROPSHW: return "DDERR_NODDROPSHW";
|
||||
case DDERR_NODIRECTDRAWHW: return "DDERR_NODIRECTDRAWHW";
|
||||
case DDERR_NODIRECTDRAWSUPPORT: return "DDERR_NODIRECTDRAWSUPPORT";
|
||||
case DDERR_NOEMULATION: return "DDERR_NOEMULATION";
|
||||
case DDERR_NOEXCLUSIVEMODE: return "DDERR_NOEXCLUSIVEMODE";
|
||||
case DDERR_NOFLIPHW: return "DDERR_NOFLIPHW";
|
||||
case DDERR_NOFOCUSWINDOW: return "DDERR_NOFOCUSWINDOW";
|
||||
case DDERR_NOGDI: return "DDERR_NOGDI";
|
||||
case DDERR_NOHWND: return "DDERR_NOHWND";
|
||||
case DDERR_NOMIPMAPHW: return "DDERR_NOMIPMAPHW";
|
||||
case DDERR_NOMIRRORHW: return "DDERR_NOMIRRORHW";
|
||||
case DDERR_NONONLOCALVIDMEM: return "DDERR_NONONLOCALVIDMEM";
|
||||
case DDERR_NOOPTIMIZEHW: return "DDERR_NOOPTIMIZEHW";
|
||||
case DDERR_NOOVERLAYDEST: return "DDERR_NOOVERLAYDEST";
|
||||
case DDERR_NOOVERLAYHW: return "DDERR_NOOVERLAYHW";
|
||||
case DDERR_NOPALETTEATTACHED: return "DDERR_NOPALETTEATTACHED";
|
||||
case DDERR_NOPALETTEHW: return "DDERR_NOPALETTEHW";
|
||||
case DDERR_NORASTEROPHW: return "DDERR_NORASTEROPHW";
|
||||
case DDERR_NOROTATIONHW: return "DDERR_NOROTATIONHW";
|
||||
case DDERR_NOSTRETCHHW: return "DDERR_NOSTRETCHHW";
|
||||
case DDERR_NOT4BITCOLOR: return "DDERR_NOT4BITCOLOR";
|
||||
case DDERR_NOT4BITCOLORINDEX: return "DDERR_NOT4BITCOLORINDEX";
|
||||
case DDERR_NOT8BITCOLOR: return "DDERR_NOT8BITCOLOR";
|
||||
case DDERR_NOTAOVERLAYSURFACE: return "DDERR_NOTAOVERLAYSURFACE";
|
||||
case DDERR_NOTEXTUREHW: return "DDERR_NOTEXTUREHW";
|
||||
case DDERR_NOTFLIPPABLE: return "DDERR_NOTFLIPPABLE";
|
||||
case DDERR_NOTFOUND: return "DDERR_NOTFOUND";
|
||||
case DDERR_NOTINITIALIZED: return "DDERR_NOTINITIALIZED";
|
||||
case DDERR_NOTLOADED: return "DDERR_NOTLOADED";
|
||||
case DDERR_NOTLOCKED: return "DDERR_NOTLOCKED";
|
||||
case DDERR_NOTPAGELOCKED: return "DDERR_NOTPAGELOCKED";
|
||||
case DDERR_NOTPALETTIZED: return "DDERR_NOTPALETTIZED";
|
||||
case DDERR_NOVSYNCHW: return "DDERR_NOVSYNCHW";
|
||||
case DDERR_NOZBUFFERHW: return "DDERR_NOZBUFFERHW";
|
||||
case DDERR_NOZOVERLAYHW: return "DDERR_NOZOVERLAYHW";
|
||||
case DDERR_OUTOFCAPS: return "DDERR_OUTOFCAPS";
|
||||
case DDERR_OUTOFMEMORY: return "DDERR_OUTOFMEMORY";
|
||||
case DDERR_OUTOFVIDEOMEMORY: return "DDERR_OUTOFVIDEOMEMORY";
|
||||
case DDERR_OVERLAPPINGRECTS: return "DDERR_OVERLAPPINGRECTS";
|
||||
case DDERR_OVERLAYCANTCLIP: return "DDERR_OVERLAYCANTCLIP";
|
||||
case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: return "DDERR_OVERLAYCOLORKEYONLYONEACTIVE";
|
||||
case DDERR_OVERLAYNOTVISIBLE: return "DDERR_OVERLAYNOTVISIBLE";
|
||||
case DDERR_PALETTEBUSY: return "DDERR_PALETTEBUSY";
|
||||
case DDERR_PRIMARYSURFACEALREADYEXISTS: return "DDERR_PRIMARYSURFACEALREADYEXISTS";
|
||||
case DDERR_REGIONTOOSMALL: return "DDERR_REGIONTOOSMALL";
|
||||
case DDERR_SURFACEALREADYATTACHED: return "DDERR_SURFACEALREADYATTACHED";
|
||||
case DDERR_SURFACEALREADYDEPENDENT: return "DDERR_SURFACEALREADYDEPENDENT";
|
||||
case DDERR_SURFACEBUSY: return "DDERR_SURFACEBUSY";
|
||||
case DDERR_SURFACEISOBSCURED: return "DDERR_SURFACEISOBSCURED";
|
||||
case DDERR_SURFACELOST: return "DDERR_SURFACELOST";
|
||||
case DDERR_SURFACENOTATTACHED: return "DDERR_SURFACENOTATTACHED";
|
||||
case DDERR_TOOBIGHEIGHT: return "DDERR_TOOBIGHEIGHT";
|
||||
case DDERR_TOOBIGSIZE: return "DDERR_TOOBIGSIZE";
|
||||
case DDERR_TOOBIGWIDTH: return "DDERR_TOOBIGWIDTH";
|
||||
case DDERR_UNSUPPORTED: return "DDERR_UNSUPPORTED";
|
||||
case DDERR_UNSUPPORTEDFORMAT: return "DDERR_UNSUPPORTEDFORMAT";
|
||||
case DDERR_UNSUPPORTEDMASK: return "DDERR_UNSUPPORTEDMASK";
|
||||
case DDERR_UNSUPPORTEDMODE: return "DDERR_UNSUPPORTEDMODE";
|
||||
case DDERR_VERTICALBLANKINPROGRESS: return "DDERR_VERTICALBLANKINPROGRESS";
|
||||
case DDERR_VIDEONOTACTIVE: return "DDERR_VIDEONOTACTIVE";
|
||||
case DDERR_WASSTILLDRAWING: return "DDERR_WASSTILLDRAWING";
|
||||
case DDERR_WRONGMODE: return "DDERR_WRONGMODE";
|
||||
case DDERR_XALIGN: return "DDERR_XALIGN";
|
||||
default: break;
|
||||
case DD_OK:
|
||||
return "DD_OK";
|
||||
case DDERR_ALREADYINITIALIZED:
|
||||
return "DDERR_ALREADYINITIALIZED";
|
||||
case DDERR_BLTFASTCANTCLIP:
|
||||
return "DDERR_BLTFASTCANTCLIP";
|
||||
case DDERR_CANNOTATTACHSURFACE:
|
||||
return "DDERR_CANNOTATTACHSURFACE";
|
||||
case DDERR_CANNOTDETACHSURFACE:
|
||||
return "DDERR_CANNOTDETACHSURFACE";
|
||||
case DDERR_CANTCREATEDC:
|
||||
return "DDERR_CANTCREATEDC";
|
||||
case DDERR_CANTDUPLICATE:
|
||||
return "DDERR_CANTDUPLICATE";
|
||||
case DDERR_CANTLOCKSURFACE:
|
||||
return "DDERR_CANTLOCKSURFACE";
|
||||
case DDERR_CANTPAGELOCK:
|
||||
return "DDERR_CANTPAGELOCK";
|
||||
case DDERR_CANTPAGEUNLOCK:
|
||||
return "DDERR_CANTPAGEUNLOCK";
|
||||
case DDERR_CLIPPERISUSINGHWND:
|
||||
return "DDERR_CLIPPERISUSINGHWND";
|
||||
case DDERR_COLORKEYNOTSET:
|
||||
return "DDERR_COLORKEYNOTSET";
|
||||
case DDERR_CURRENTLYNOTAVAIL:
|
||||
return "DDERR_CURRENTLYNOTAVAIL";
|
||||
case DDERR_DCALREADYCREATED:
|
||||
return "DDERR_DCALREADYCREATED";
|
||||
case DDERR_DEVICEDOESNTOWNSURFACE:
|
||||
return "DDERR_DEVICEDOESNTOWNSURFACE";
|
||||
case DDERR_DIRECTDRAWALREADYCREATED:
|
||||
return "DDERR_DIRECTDRAWALREADYCREATED";
|
||||
case DDERR_EXCEPTION:
|
||||
return "DDERR_EXCEPTION";
|
||||
case DDERR_EXCLUSIVEMODEALREADYSET:
|
||||
return "DDERR_EXCLUSIVEMODEALREADYSET";
|
||||
case DDERR_EXPIRED:
|
||||
return "DDERR_EXPIRED";
|
||||
case DDERR_GENERIC:
|
||||
return "DDERR_GENERIC";
|
||||
case DDERR_HEIGHTALIGN:
|
||||
return "DDERR_HEIGHTALIGN";
|
||||
case DDERR_HWNDALREADYSET:
|
||||
return "DDERR_HWNDALREADYSET";
|
||||
case DDERR_HWNDSUBCLASSED:
|
||||
return "DDERR_HWNDSUBCLASSED";
|
||||
case DDERR_IMPLICITLYCREATED:
|
||||
return "DDERR_IMPLICITLYCREATED";
|
||||
case DDERR_INCOMPATIBLEPRIMARY:
|
||||
return "DDERR_INCOMPATIBLEPRIMARY";
|
||||
case DDERR_INVALIDCAPS:
|
||||
return "DDERR_INVALIDCAPS";
|
||||
case DDERR_INVALIDCLIPLIST:
|
||||
return "DDERR_INVALIDCLIPLIST";
|
||||
case DDERR_INVALIDDIRECTDRAWGUID:
|
||||
return "DDERR_INVALIDDIRECTDRAWGUID";
|
||||
case DDERR_INVALIDMODE:
|
||||
return "DDERR_INVALIDMODE";
|
||||
case DDERR_INVALIDOBJECT:
|
||||
return "DDERR_INVALIDOBJECT";
|
||||
case DDERR_INVALIDPARAMS:
|
||||
return "DDERR_INVALIDPARAMS";
|
||||
case DDERR_INVALIDPIXELFORMAT:
|
||||
return "DDERR_INVALIDPIXELFORMAT";
|
||||
case DDERR_INVALIDPOSITION:
|
||||
return "DDERR_INVALIDPOSITION";
|
||||
case DDERR_INVALIDRECT:
|
||||
return "DDERR_INVALIDRECT";
|
||||
case DDERR_INVALIDSTREAM:
|
||||
return "DDERR_INVALIDSTREAM";
|
||||
case DDERR_INVALIDSURFACETYPE:
|
||||
return "DDERR_INVALIDSURFACETYPE";
|
||||
case DDERR_LOCKEDSURFACES:
|
||||
return "DDERR_LOCKEDSURFACES";
|
||||
case DDERR_MOREDATA:
|
||||
return "DDERR_MOREDATA";
|
||||
case DDERR_NO3D:
|
||||
return "DDERR_NO3D";
|
||||
case DDERR_NOALPHAHW:
|
||||
return "DDERR_NOALPHAHW";
|
||||
case DDERR_NOBLTHW:
|
||||
return "DDERR_NOBLTHW";
|
||||
case DDERR_NOCLIPLIST:
|
||||
return "DDERR_NOCLIPLIST";
|
||||
case DDERR_NOCLIPPERATTACHED:
|
||||
return "DDERR_NOCLIPPERATTACHED";
|
||||
case DDERR_NOCOLORCONVHW:
|
||||
return "DDERR_NOCOLORCONVHW";
|
||||
case DDERR_NOCOLORKEY:
|
||||
return "DDERR_NOCOLORKEY";
|
||||
case DDERR_NOCOLORKEYHW:
|
||||
return "DDERR_NOCOLORKEYHW";
|
||||
case DDERR_NOCOOPERATIVELEVELSET:
|
||||
return "DDERR_NOCOOPERATIVELEVELSET";
|
||||
case DDERR_NODC:
|
||||
return "DDERR_NODC";
|
||||
case DDERR_NODDROPSHW:
|
||||
return "DDERR_NODDROPSHW";
|
||||
case DDERR_NODIRECTDRAWHW:
|
||||
return "DDERR_NODIRECTDRAWHW";
|
||||
case DDERR_NODIRECTDRAWSUPPORT:
|
||||
return "DDERR_NODIRECTDRAWSUPPORT";
|
||||
case DDERR_NOEMULATION:
|
||||
return "DDERR_NOEMULATION";
|
||||
case DDERR_NOEXCLUSIVEMODE:
|
||||
return "DDERR_NOEXCLUSIVEMODE";
|
||||
case DDERR_NOFLIPHW:
|
||||
return "DDERR_NOFLIPHW";
|
||||
case DDERR_NOFOCUSWINDOW:
|
||||
return "DDERR_NOFOCUSWINDOW";
|
||||
case DDERR_NOGDI:
|
||||
return "DDERR_NOGDI";
|
||||
case DDERR_NOHWND:
|
||||
return "DDERR_NOHWND";
|
||||
case DDERR_NOMIPMAPHW:
|
||||
return "DDERR_NOMIPMAPHW";
|
||||
case DDERR_NOMIRRORHW:
|
||||
return "DDERR_NOMIRRORHW";
|
||||
case DDERR_NONONLOCALVIDMEM:
|
||||
return "DDERR_NONONLOCALVIDMEM";
|
||||
case DDERR_NOOPTIMIZEHW:
|
||||
return "DDERR_NOOPTIMIZEHW";
|
||||
case DDERR_NOOVERLAYDEST:
|
||||
return "DDERR_NOOVERLAYDEST";
|
||||
case DDERR_NOOVERLAYHW:
|
||||
return "DDERR_NOOVERLAYHW";
|
||||
case DDERR_NOPALETTEATTACHED:
|
||||
return "DDERR_NOPALETTEATTACHED";
|
||||
case DDERR_NOPALETTEHW:
|
||||
return "DDERR_NOPALETTEHW";
|
||||
case DDERR_NORASTEROPHW:
|
||||
return "DDERR_NORASTEROPHW";
|
||||
case DDERR_NOROTATIONHW:
|
||||
return "DDERR_NOROTATIONHW";
|
||||
case DDERR_NOSTRETCHHW:
|
||||
return "DDERR_NOSTRETCHHW";
|
||||
case DDERR_NOT4BITCOLOR:
|
||||
return "DDERR_NOT4BITCOLOR";
|
||||
case DDERR_NOT4BITCOLORINDEX:
|
||||
return "DDERR_NOT4BITCOLORINDEX";
|
||||
case DDERR_NOT8BITCOLOR:
|
||||
return "DDERR_NOT8BITCOLOR";
|
||||
case DDERR_NOTAOVERLAYSURFACE:
|
||||
return "DDERR_NOTAOVERLAYSURFACE";
|
||||
case DDERR_NOTEXTUREHW:
|
||||
return "DDERR_NOTEXTUREHW";
|
||||
case DDERR_NOTFLIPPABLE:
|
||||
return "DDERR_NOTFLIPPABLE";
|
||||
case DDERR_NOTFOUND:
|
||||
return "DDERR_NOTFOUND";
|
||||
case DDERR_NOTINITIALIZED:
|
||||
return "DDERR_NOTINITIALIZED";
|
||||
case DDERR_NOTLOADED:
|
||||
return "DDERR_NOTLOADED";
|
||||
case DDERR_NOTLOCKED:
|
||||
return "DDERR_NOTLOCKED";
|
||||
case DDERR_NOTPAGELOCKED:
|
||||
return "DDERR_NOTPAGELOCKED";
|
||||
case DDERR_NOTPALETTIZED:
|
||||
return "DDERR_NOTPALETTIZED";
|
||||
case DDERR_NOVSYNCHW:
|
||||
return "DDERR_NOVSYNCHW";
|
||||
case DDERR_NOZBUFFERHW:
|
||||
return "DDERR_NOZBUFFERHW";
|
||||
case DDERR_NOZOVERLAYHW:
|
||||
return "DDERR_NOZOVERLAYHW";
|
||||
case DDERR_OUTOFCAPS:
|
||||
return "DDERR_OUTOFCAPS";
|
||||
case DDERR_OUTOFMEMORY:
|
||||
return "DDERR_OUTOFMEMORY";
|
||||
case DDERR_OUTOFVIDEOMEMORY:
|
||||
return "DDERR_OUTOFVIDEOMEMORY";
|
||||
case DDERR_OVERLAPPINGRECTS:
|
||||
return "DDERR_OVERLAPPINGRECTS";
|
||||
case DDERR_OVERLAYCANTCLIP:
|
||||
return "DDERR_OVERLAYCANTCLIP";
|
||||
case DDERR_OVERLAYCOLORKEYONLYONEACTIVE:
|
||||
return "DDERR_OVERLAYCOLORKEYONLYONEACTIVE";
|
||||
case DDERR_OVERLAYNOTVISIBLE:
|
||||
return "DDERR_OVERLAYNOTVISIBLE";
|
||||
case DDERR_PALETTEBUSY:
|
||||
return "DDERR_PALETTEBUSY";
|
||||
case DDERR_PRIMARYSURFACEALREADYEXISTS:
|
||||
return "DDERR_PRIMARYSURFACEALREADYEXISTS";
|
||||
case DDERR_REGIONTOOSMALL:
|
||||
return "DDERR_REGIONTOOSMALL";
|
||||
case DDERR_SURFACEALREADYATTACHED:
|
||||
return "DDERR_SURFACEALREADYATTACHED";
|
||||
case DDERR_SURFACEALREADYDEPENDENT:
|
||||
return "DDERR_SURFACEALREADYDEPENDENT";
|
||||
case DDERR_SURFACEBUSY:
|
||||
return "DDERR_SURFACEBUSY";
|
||||
case DDERR_SURFACEISOBSCURED:
|
||||
return "DDERR_SURFACEISOBSCURED";
|
||||
case DDERR_SURFACELOST:
|
||||
return "DDERR_SURFACELOST";
|
||||
case DDERR_SURFACENOTATTACHED:
|
||||
return "DDERR_SURFACENOTATTACHED";
|
||||
case DDERR_TOOBIGHEIGHT:
|
||||
return "DDERR_TOOBIGHEIGHT";
|
||||
case DDERR_TOOBIGSIZE:
|
||||
return "DDERR_TOOBIGSIZE";
|
||||
case DDERR_TOOBIGWIDTH:
|
||||
return "DDERR_TOOBIGWIDTH";
|
||||
case DDERR_UNSUPPORTED:
|
||||
return "DDERR_UNSUPPORTED";
|
||||
case DDERR_UNSUPPORTEDFORMAT:
|
||||
return "DDERR_UNSUPPORTEDFORMAT";
|
||||
case DDERR_UNSUPPORTEDMASK:
|
||||
return "DDERR_UNSUPPORTEDMASK";
|
||||
case DDERR_UNSUPPORTEDMODE:
|
||||
return "DDERR_UNSUPPORTEDMODE";
|
||||
case DDERR_VERTICALBLANKINPROGRESS:
|
||||
return "DDERR_VERTICALBLANKINPROGRESS";
|
||||
case DDERR_VIDEONOTACTIVE:
|
||||
return "DDERR_VIDEONOTACTIVE";
|
||||
case DDERR_WASSTILLDRAWING:
|
||||
return "DDERR_WASSTILLDRAWING";
|
||||
case DDERR_WRONGMODE:
|
||||
return "DDERR_WRONGMODE";
|
||||
case DDERR_XALIGN:
|
||||
return "DDERR_XALIGN";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "Unknown error";
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -25,11 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
void endanimsounds(long fr)
|
||||
{
|
||||
switch(ud.volume_number)
|
||||
switch (ud.volume_number)
|
||||
{
|
||||
case 0:break;
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
switch(fr)
|
||||
switch (fr)
|
||||
{
|
||||
case 1:
|
||||
sound(WIND_AMBIENCE);
|
||||
|
@ -61,7 +62,7 @@ void endanimsounds(long fr)
|
|||
}
|
||||
break;
|
||||
case 2:
|
||||
switch(fr)
|
||||
switch (fr)
|
||||
{
|
||||
case 1:
|
||||
sound(WIND_REPEAT);
|
||||
|
@ -89,7 +90,7 @@ void endanimsounds(long fr)
|
|||
|
||||
void logoanimsounds(long fr)
|
||||
{
|
||||
switch(fr)
|
||||
switch (fr)
|
||||
{
|
||||
case 1:
|
||||
sound(FLY_BY);
|
||||
|
@ -102,7 +103,7 @@ void logoanimsounds(long fr)
|
|||
|
||||
void intro4animsounds(long fr)
|
||||
{
|
||||
switch(fr)
|
||||
switch (fr)
|
||||
{
|
||||
case 1:
|
||||
sound(INTRO4_B);
|
||||
|
@ -119,7 +120,7 @@ void intro4animsounds(long fr)
|
|||
|
||||
void first4animsounds(long fr)
|
||||
{
|
||||
switch(fr)
|
||||
switch (fr)
|
||||
{
|
||||
case 1:
|
||||
sound(INTRO4_1);
|
||||
|
@ -138,7 +139,7 @@ void first4animsounds(long fr)
|
|||
|
||||
void intro42animsounds(long fr)
|
||||
{
|
||||
switch(fr)
|
||||
switch (fr)
|
||||
{
|
||||
case 10:
|
||||
sound(INTRO4_6);
|
||||
|
@ -148,7 +149,7 @@ void intro42animsounds(long fr)
|
|||
|
||||
void endanimvol41(long fr)
|
||||
{
|
||||
switch(fr)
|
||||
switch (fr)
|
||||
{
|
||||
case 3:
|
||||
sound(DUKE_UNDERWATER);
|
||||
|
@ -161,7 +162,7 @@ void endanimvol41(long fr)
|
|||
|
||||
void endanimvol42(long fr)
|
||||
{
|
||||
switch(fr)
|
||||
switch (fr)
|
||||
{
|
||||
case 11:
|
||||
sound(DUKE_UNDERWATER);
|
||||
|
@ -180,7 +181,7 @@ void endanimvol42(long fr)
|
|||
|
||||
void endanimvol43(long fr)
|
||||
{
|
||||
switch(fr)
|
||||
switch (fr)
|
||||
{
|
||||
case 1:
|
||||
sound(BOSS4_DEADSPEECH);
|
||||
|
@ -203,17 +204,17 @@ void playanm(char *fn,char t)
|
|||
|
||||
// return;
|
||||
|
||||
if(t != 7 && t != 9 && t != 10 && t != 11)
|
||||
if (t != 7 && t != 9 && t != 10 && t != 11)
|
||||
KB_FlushKeyboardQueue();
|
||||
|
||||
if( KB_KeyWaiting() )
|
||||
if ( KB_KeyWaiting() )
|
||||
{
|
||||
FX_StopAllSounds();
|
||||
goto ENDOFANIMLOOP;
|
||||
}
|
||||
|
||||
handle = kopen4load(fn,0);
|
||||
if(handle == -1) return;
|
||||
if (handle == -1) return;
|
||||
length = kfilelength(handle);
|
||||
|
||||
walock[TILE_ANIM] = 219+t;
|
||||
|
@ -230,7 +231,7 @@ void playanm(char *fn,char t)
|
|||
numframes = ANIM_NumFrames();
|
||||
|
||||
palptr = ANIM_GetPalette();
|
||||
for(i=0;i<256;i++)
|
||||
for (i=0;i<256;i++)
|
||||
{
|
||||
/*
|
||||
j = (i<<2); k = j-i;
|
||||
|
@ -251,26 +252,26 @@ void playanm(char *fn,char t)
|
|||
|
||||
ototalclock = totalclock + 10;
|
||||
|
||||
for(i=1;i<numframes;i++)
|
||||
for (i=1;i<numframes;i++)
|
||||
{
|
||||
while(totalclock < ototalclock)
|
||||
while (totalclock < ototalclock)
|
||||
{
|
||||
extern char restorepalette;
|
||||
if( KB_KeyWaiting() )
|
||||
if ( KB_KeyWaiting() )
|
||||
goto ENDOFANIMLOOP;
|
||||
handleevents(); getpackets();
|
||||
if(restorepalette == 1)
|
||||
if (restorepalette == 1)
|
||||
setgamepalette(&ps[myconnectindex],tempbuf,2);
|
||||
}
|
||||
|
||||
if(t == 10) ototalclock += 14;
|
||||
else if(t == 9) ototalclock += 10;
|
||||
else if(t == 7) ototalclock += 18;
|
||||
else if(t == 6) ototalclock += 14;
|
||||
else if(t == 5) ototalclock += 9;
|
||||
else if(ud.volume_number == 3) ototalclock += 10;
|
||||
else if(ud.volume_number == 2) ototalclock += 10;
|
||||
else if(ud.volume_number == 1) ototalclock += 18;
|
||||
if (t == 10) ototalclock += 14;
|
||||
else if (t == 9) ototalclock += 10;
|
||||
else if (t == 7) ototalclock += 18;
|
||||
else if (t == 6) ototalclock += 14;
|
||||
else if (t == 5) ototalclock += 9;
|
||||
else if (ud.volume_number == 3) ototalclock += 10;
|
||||
else if (ud.volume_number == 2) ototalclock += 10;
|
||||
else if (ud.volume_number == 1) ototalclock += 18;
|
||||
else ototalclock += 10;
|
||||
|
||||
waloff[TILE_ANIM] = FP_OFF(ANIM_DrawFrame(i));
|
||||
|
@ -278,14 +279,14 @@ void playanm(char *fn,char t)
|
|||
rotatesprite(0<<16,0<<16,65536L,512,TILE_ANIM,0,0,2+4+8+16+64, 0,0,xdim-1,ydim-1);
|
||||
nextpage();
|
||||
|
||||
if(t == 8) endanimvol41(i);
|
||||
else if(t == 10) endanimvol42(i);
|
||||
else if(t == 11) endanimvol43(i);
|
||||
else if(t == 9) intro42animsounds(i);
|
||||
else if(t == 7) intro4animsounds(i);
|
||||
else if(t == 6) first4animsounds(i);
|
||||
else if(t == 5) logoanimsounds(i);
|
||||
else if(t < 4) endanimsounds(i);
|
||||
if (t == 8) endanimvol41(i);
|
||||
else if (t == 10) endanimvol42(i);
|
||||
else if (t == 11) endanimvol43(i);
|
||||
else if (t == 9) intro42animsounds(i);
|
||||
else if (t == 7) intro4animsounds(i);
|
||||
else if (t == 6) first4animsounds(i);
|
||||
else if (t == 5) logoanimsounds(i);
|
||||
else if (t < 4) endanimsounds(i);
|
||||
}
|
||||
|
||||
ENDOFANIMLOOP:
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -417,12 +417,12 @@ void CONFIG_SetupMouse( void )
|
|||
{
|
||||
Bsprintf(str,"MouseButton%ld",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString( scripthandle,"Controls", str,temp))
|
||||
if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseButtonClicked%ld",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString( scripthandle,"Controls", str,temp))
|
||||
if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
|
@ -431,17 +431,17 @@ void CONFIG_SetupMouse( void )
|
|||
{
|
||||
Bsprintf(str,"MouseAnalogAxes%ld",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if(CONFIG_AnalogNameToNum(temp) != -1 || temp[0] == 0)
|
||||
if (CONFIG_AnalogNameToNum(temp) != -1 || temp[0] == 0)
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%ld_0",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%ld_1",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseAnalogScale%ld",i);
|
||||
|
@ -489,12 +489,12 @@ void CONFIG_SetupJoystick( void )
|
|||
{
|
||||
Bsprintf(str,"JoystickButton%ld",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString( scripthandle,"Controls", str,temp))
|
||||
if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickButtonClicked%ld",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString( scripthandle,"Controls", str,temp))
|
||||
if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
|
@ -503,17 +503,17 @@ void CONFIG_SetupJoystick( void )
|
|||
{
|
||||
Bsprintf(str,"JoystickAnalogAxes%ld",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if(CONFIG_AnalogNameToNum(temp) != -1 || temp[0] == 0)
|
||||
if (CONFIG_AnalogNameToNum(temp) != -1 || temp[0] == 0)
|
||||
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickDigitalAxes%ld_0",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickDigitalAxes%ld_1",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0)
|
||||
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickAnalogScale%ld",i);
|
||||
|
@ -559,10 +559,10 @@ void readsavenames(void)
|
|||
{
|
||||
fn[4] = i+'0';
|
||||
if ((fil = Bfopen(fn,"rb")) == NULL ) continue;
|
||||
if(dfread(&j,sizeof(long),1,fil) != 1) { Bfclose(fil); continue; }
|
||||
if(dfread(g_szBuf,j,1,fil) != 1) { Bfclose(fil); continue; }
|
||||
if (dfread(&j,sizeof(long),1,fil) != 1) { Bfclose(fil); continue; }
|
||||
if (dfread(g_szBuf,j,1,fil) != 1) { Bfclose(fil); continue; }
|
||||
if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; }
|
||||
if(dummy != BYTEVERSION) { Bfclose(fil); continue; }
|
||||
if (dummy != BYTEVERSION) { Bfclose(fil); continue; }
|
||||
if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; }
|
||||
if (dfread(&ud.savegame[i][0],19,1,fil) != 1) { ud.savegame[i][0] = 0; }
|
||||
Bfclose(fil);
|
||||
|
@ -597,7 +597,7 @@ int32 CONFIG_ReadSetup( void )
|
|||
|
||||
if (scripthandle >= 0)
|
||||
{
|
||||
for(dummy = 0;dummy < 10;dummy++)
|
||||
for (dummy = 0;dummy < 10;dummy++)
|
||||
{
|
||||
commmacro[13] = dummy+'0';
|
||||
SCRIPT_GetString( scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
||||
|
@ -605,7 +605,7 @@ int32 CONFIG_ReadSetup( void )
|
|||
|
||||
SCRIPT_GetString( scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
|
||||
|
||||
while(Bstrlen(strip_color_codes(tempbuf)) > 10)
|
||||
while (Bstrlen(strip_color_codes(tempbuf)) > 10)
|
||||
tempbuf[Bstrlen(tempbuf)-1] = '\0';
|
||||
|
||||
Bstrncpy(myname,tempbuf,sizeof(myname)-1);
|
||||
|
@ -665,7 +665,7 @@ int32 CONFIG_ReadSetup( void )
|
|||
check_player_color((int *)&ud.color,-1);
|
||||
ps[0].palookup = ud.pcolor[0] = ud.color;
|
||||
SCRIPT_GetNumber( scripthandle, "Misc", "Team",&ud.team);
|
||||
if(ud.team > 1) ud.team = 0;
|
||||
if (ud.team > 1) ud.team = 0;
|
||||
ud.pteam[0] = ud.team;
|
||||
SCRIPT_GetNumber( scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime);
|
||||
SCRIPT_GetNumber( scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode);
|
||||
|
@ -677,7 +677,7 @@ int32 CONFIG_ReadSetup( void )
|
|||
|
||||
// weapon choices are defaulted in checkcommandline, which may override them
|
||||
if (!CommandWeaponChoice)
|
||||
for(i=0;i<10;i++)
|
||||
for (i=0;i<10;i++)
|
||||
{
|
||||
Bsprintf(buf,"WeaponChoice%ld",i);
|
||||
dummy = -1;
|
||||
|
@ -813,12 +813,12 @@ void CONFIG_WriteSetup( void )
|
|||
SCRIPT_PutNumber( scripthandle, "Sound Setup", "VoiceToggle",VoiceToggle,false,false);
|
||||
|
||||
// JBF 20031211
|
||||
for(dummy=0;dummy<NUMGAMEFUNCTIONS;dummy++) {
|
||||
for (dummy=0;dummy<NUMGAMEFUNCTIONS;dummy++) {
|
||||
SCRIPT_PutDoubleString( scripthandle, "KeyDefinitions", CONFIG_FunctionNumToName(dummy),
|
||||
KB_ScanCodeToString(KeyboardKeys[dummy][0]), KB_ScanCodeToString(KeyboardKeys[dummy][1]));
|
||||
}
|
||||
|
||||
for(dummy=0;dummy<10;dummy++)
|
||||
for (dummy=0;dummy<10;dummy++)
|
||||
{
|
||||
Bsprintf(buf,"WeaponChoice%ld",dummy);
|
||||
SCRIPT_PutNumber( scripthandle, "Misc",buf,ud.wchoice[myconnectindex][dummy],false,false);
|
||||
|
@ -882,7 +882,7 @@ void CONFIG_WriteSetup( void )
|
|||
{
|
||||
char commmacro[] = "CommbatMacro# ";
|
||||
|
||||
for(dummy = 0;dummy < 10;dummy++)
|
||||
for (dummy = 0;dummy < 10;dummy++)
|
||||
{
|
||||
commmacro[13] = dummy+'0';
|
||||
SCRIPT_PutString( scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -9,7 +9,8 @@
|
|||
#include "grpscan.h"
|
||||
|
||||
struct grpfile grpfiles[numgrpfiles] = {
|
||||
{ "Duke Nukem 3D", 0xBBC9CE44, 26524524, GAMEDUKE, NULL },
|
||||
{ "Duke Nukem 3D", 0xBBC9CE44, 26524524, GAMEDUKE, NULL }
|
||||
,
|
||||
{ "Duke Nukem 3D: Atomic Edition", 0xF514A6AC, 44348015, GAMEDUKE, NULL },
|
||||
{ "Duke Nukem 3D: Atomic Edition", 0xFD3DCFF1, 44356548, GAMEDUKE, NULL },
|
||||
{ "Duke Nukem 3D Shareware Version", 0x983AD923, 11035779, GAMEDUKE, NULL },
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -120,7 +120,7 @@ int osdcmd_map(const osdfuncparm_t *parm)
|
|||
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
||||
|
||||
strcpy(filename,parm->parms[0]);
|
||||
if( strchr(filename,'.') == 0)
|
||||
if ( strchr(filename,'.') == 0)
|
||||
strcat(filename,".map");
|
||||
|
||||
if ((i = kopen4load(filename,0)) < 0) {
|
||||
|
@ -370,9 +370,9 @@ int osdcmd_setvar(const osdfuncparm_t *parm)
|
|||
strcpy(varname,parm->parms[0]);
|
||||
varval = Batol(parm->parms[1]);
|
||||
|
||||
for(i=0;i<iGameVarCount;i++)
|
||||
if(aGameVars[i].szLabel != NULL)
|
||||
if(Bstrcmp(varname, aGameVars[i].szLabel) == 0)
|
||||
for (i=0;i<iGameVarCount;i++)
|
||||
if (aGameVars[i].szLabel != NULL)
|
||||
if (Bstrcmp(varname, aGameVars[i].szLabel) == 0)
|
||||
SetGameVarID(i, varval, ps[myconnectindex].i, myconnectindex);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
@ -466,7 +466,8 @@ struct cvarmappings {
|
|||
|
||||
{ "cl_weaponswitch", "cl_weaponswitch: enable/disable auto weapon switching", (void*)&ud.weaponswitch, CVAR_INT|256, 0, 0, 3 },
|
||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
{ "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void*)&glwidescreen, CVAR_BOOL, 0, 0, 1 },
|
||||
{ "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void*)&glwidescreen, CVAR_BOOL, 0, 0, 1 }
|
||||
,
|
||||
{ "r_projectionhack", "r_projectionhack: enable/disable projection hack", (void*)&glprojectionhacks, CVAR_BOOL, 0, 0, 1 },
|
||||
// polymer cvars
|
||||
{ "pr_cliplanes", "pr_cliplanes: toggles clipping behind map limits (recommended yet may decrease performance in complex maps)", (void*)&pr_cliplanes, CVAR_INT, 0, 0, 1 },
|
||||
|
@ -494,38 +495,39 @@ int osdcmd_cvar_set(const osdfuncparm_t *parm)
|
|||
case CVAR_INT:
|
||||
case CVAR_UNSIGNEDINT:
|
||||
case CVAR_BOOL:
|
||||
{
|
||||
int val;
|
||||
if (showval) {
|
||||
OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvar[i].name,*(int*)cvar[i].var,(char*)cvar[i].helpstr);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
{
|
||||
int val;
|
||||
if (showval) {
|
||||
OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvar[i].name,*(int*)cvar[i].var,(char*)cvar[i].helpstr);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
val = atoi(parm->parms[0]);
|
||||
if (cvar[i].type == CVAR_BOOL) val = val != 0;
|
||||
val = atoi(parm->parms[0]);
|
||||
if (cvar[i].type == CVAR_BOOL) val = val != 0;
|
||||
|
||||
if (val < cvar[i].min || val > cvar[i].max) {
|
||||
OSD_Printf("%s value out of range\n",cvar[i].name);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
*(int*)cvar[i].var = val;
|
||||
OSD_Printf("%s %d",cvar[i].name,val);
|
||||
} break;
|
||||
if (val < cvar[i].min || val > cvar[i].max) {
|
||||
OSD_Printf("%s value out of range\n",cvar[i].name);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
*(int*)cvar[i].var = val;
|
||||
OSD_Printf("%s %d",cvar[i].name,val);
|
||||
} break;
|
||||
case CVAR_STRING:
|
||||
{
|
||||
if (showval) {
|
||||
OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvar[i].name,(char*)cvar[i].var,(char*)cvar[i].helpstr);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
else {
|
||||
Bstrncpy((char*)cvar[i].var, parm->parms[0], cvar[i].extra-1);
|
||||
((char*)cvar[i].var)[cvar[i].extra-1] = 0;
|
||||
OSD_Printf("%s %s",cvar[i].name,(char*)cvar[i].var);
|
||||
}
|
||||
} break;
|
||||
default: break;
|
||||
{
|
||||
if (showval) {
|
||||
OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvar[i].name,(char*)cvar[i].var,(char*)cvar[i].helpstr);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
else {
|
||||
Bstrncpy((char*)cvar[i].var, parm->parms[0], cvar[i].extra-1);
|
||||
((char*)cvar[i].var)[cvar[i].extra-1] = 0;
|
||||
OSD_Printf("%s %s",cvar[i].name,(char*)cvar[i].var);
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(cvar[i].type&256)
|
||||
if (cvar[i].type&256)
|
||||
updatenames();
|
||||
}
|
||||
}
|
||||
|
@ -561,7 +563,7 @@ int osdcmd_give(const osdfuncparm_t *parm)
|
|||
int i;
|
||||
|
||||
if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) {
|
||||
if(ps[myconnectindex].dead_flag != 0) {
|
||||
if (ps[myconnectindex].dead_flag != 0) {
|
||||
OSD_Printf("give: Cannot give while dead.\n");
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
@ -653,7 +655,7 @@ int osdcmd_mpmap(const osdfuncparm_t *parm)
|
|||
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
||||
|
||||
strcpy(filename,parm->parms[0]);
|
||||
if( strchr(filename,'.') == 0)
|
||||
if ( strchr(filename,'.') == 0)
|
||||
strcat(filename,".map");
|
||||
|
||||
if ((i = kopen4load(filename,0)) < 0) {
|
||||
|
@ -679,7 +681,7 @@ int osdcmd_name(const osdfuncparm_t *parm)
|
|||
|
||||
Bstrcpy(tempbuf,parm->parms[0]);
|
||||
|
||||
while(Bstrlen(strip_color_codes(tempbuf)) > 10)
|
||||
while (Bstrlen(strip_color_codes(tempbuf)) > 10)
|
||||
tempbuf[Bstrlen(tempbuf)-1] = '\0';
|
||||
|
||||
Bstrncpy(myname,tempbuf,sizeof(myname)-1);
|
||||
|
|
|
@ -77,14 +77,14 @@ void GAME_clearbackground(int c, int r)
|
|||
xsiz = tilesizx[BGTILE]; tx2 = xdim/xsiz;
|
||||
ysiz = tilesizy[BGTILE]; ty2 = daydim/ysiz;
|
||||
|
||||
for(x=0;x<=tx2;x++)
|
||||
for(y=0;y<=ty2;y++)
|
||||
for (x=0;x<=tx2;x++)
|
||||
for (y=0;y<=ty2;y++)
|
||||
rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim);
|
||||
|
||||
xsiz = tilesizy[BORDTILE]; tx2 = xdim/xsiz;
|
||||
ysiz = tilesizx[BORDTILE];
|
||||
|
||||
for(x=0;x<=tx2;x++)
|
||||
for (x=0;x<=tx2;x++)
|
||||
rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -62,27 +62,27 @@ void cachespritenum(short i)
|
|||
char maxc;
|
||||
short j;
|
||||
|
||||
if(ud.monsters_off && badguy(&sprite[i])) return;
|
||||
if (ud.monsters_off && badguy(&sprite[i])) return;
|
||||
|
||||
maxc = 1;
|
||||
|
||||
if(spritecache[PN][0] == PN)
|
||||
for(j = PN; j <= spritecache[PN][1]; j++)
|
||||
if (spritecache[PN][0] == PN)
|
||||
for (j = PN; j <= spritecache[PN][1]; j++)
|
||||
tloadtile(j,1);
|
||||
|
||||
switch(dynamictostatic[PN])
|
||||
switch (dynamictostatic[PN])
|
||||
{
|
||||
case HYDRENT__STATIC:
|
||||
tloadtile(BROKEFIREHYDRENT,1);
|
||||
for(j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1);
|
||||
for (j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1);
|
||||
break;
|
||||
case TOILET__STATIC:
|
||||
tloadtile(TOILETBROKE,1);
|
||||
for(j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1);
|
||||
for (j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1);
|
||||
break;
|
||||
case STALL__STATIC:
|
||||
tloadtile(STALLBROKE,1);
|
||||
for(j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1);
|
||||
for (j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1);
|
||||
break;
|
||||
case RUBBERCAN__STATIC:
|
||||
maxc = 2;
|
||||
|
@ -99,13 +99,13 @@ void cachespritenum(short i)
|
|||
case LIZTROOPJETPACK__STATIC:
|
||||
case LIZTROOPONTOILET__STATIC:
|
||||
case LIZTROOPDUCKING__STATIC:
|
||||
for(j = LIZTROOP; j < (LIZTROOP+72); j++) tloadtile(j,1);
|
||||
for(j=HEADJIB1;j<LEGJIB1+3;j++) tloadtile(j,1);
|
||||
for (j = LIZTROOP; j < (LIZTROOP+72); j++) tloadtile(j,1);
|
||||
for (j=HEADJIB1;j<LEGJIB1+3;j++) tloadtile(j,1);
|
||||
maxc = 0;
|
||||
break;
|
||||
case WOODENHORSE__STATIC:
|
||||
maxc = 5;
|
||||
for(j = HORSEONSIDE; j < (HORSEONSIDE+4); j++) tloadtile(j,1);
|
||||
for (j = HORSEONSIDE; j < (HORSEONSIDE+4); j++) tloadtile(j,1);
|
||||
break;
|
||||
case NEWBEAST__STATIC:
|
||||
case NEWBEASTSTAYPUT__STATIC:
|
||||
|
@ -136,15 +136,15 @@ void cachespritenum(short i)
|
|||
case LIZMANSPITTING__STATIC:
|
||||
case LIZMANFEEDING__STATIC:
|
||||
case LIZMANJUMP__STATIC:
|
||||
for(j=LIZMANHEAD1;j<LIZMANLEG1+3;j++) tloadtile(j,1);
|
||||
for (j=LIZMANHEAD1;j<LIZMANLEG1+3;j++) tloadtile(j,1);
|
||||
maxc = 80;
|
||||
break;
|
||||
case APLAYER__STATIC:
|
||||
maxc = 0;
|
||||
if(ud.multimode > 1)
|
||||
if (ud.multimode > 1)
|
||||
{
|
||||
maxc = 5;
|
||||
for(j = 1420;j < 1420+106; j++) tloadtile(j,1);
|
||||
for (j = 1420;j < 1420+106; j++) tloadtile(j,1);
|
||||
}
|
||||
break;
|
||||
case ATOMICHEALTH__STATIC:
|
||||
|
@ -163,61 +163,69 @@ void cachespritenum(short i)
|
|||
maxc = 5;
|
||||
break;
|
||||
// caching of HUD sprites for weapons that may be in the level
|
||||
case CHAINGUNSPRITE__STATIC: for (j=CHAINGUN; j<=CHAINGUN+7; j++) tloadtile(j,1); break;
|
||||
case RPGSPRITE__STATIC: for (j=RPGGUN; j<=RPGGUN+2; j++) tloadtile(j,1); break;
|
||||
case FREEZESPRITE__STATIC: for (j=FREEZE; j<=FREEZE+5; j++) tloadtile(j,1); break;
|
||||
case CHAINGUNSPRITE__STATIC:
|
||||
for (j=CHAINGUN; j<=CHAINGUN+7; j++) tloadtile(j,1); break;
|
||||
case RPGSPRITE__STATIC:
|
||||
for (j=RPGGUN; j<=RPGGUN+2; j++) tloadtile(j,1); break;
|
||||
case FREEZESPRITE__STATIC:
|
||||
for (j=FREEZE; j<=FREEZE+5; j++) tloadtile(j,1); break;
|
||||
case GROWSPRITEICON__STATIC:
|
||||
case SHRINKERSPRITE__STATIC: for (j=SHRINKER-2; j<=SHRINKER+5; j++) tloadtile(j,1); break;
|
||||
case SHRINKERSPRITE__STATIC:
|
||||
for (j=SHRINKER-2; j<=SHRINKER+5; j++) tloadtile(j,1); break;
|
||||
case HBOMBAMMO__STATIC:
|
||||
case HEAVYHBOMB__STATIC: for (j=HANDREMOTE; j<=HANDREMOTE+5; j++) tloadtile(j,1); break;
|
||||
case TRIPBOMBSPRITE__STATIC: for (j=HANDHOLDINGLASER; j<=HANDHOLDINGLASER+4; j++) tloadtile(j,1); break;
|
||||
case SHOTGUNSPRITE__STATIC: tloadtile(SHOTGUNSHELL,1); for (j=SHOTGUN; j<=SHOTGUN+6; j++) tloadtile(j,1); break;
|
||||
case DEVISTATORSPRITE__STATIC: for (j=DEVISTATOR; j<=DEVISTATOR+1; j++) tloadtile(j,1); break;
|
||||
case HEAVYHBOMB__STATIC:
|
||||
for (j=HANDREMOTE; j<=HANDREMOTE+5; j++) tloadtile(j,1); break;
|
||||
case TRIPBOMBSPRITE__STATIC:
|
||||
for (j=HANDHOLDINGLASER; j<=HANDHOLDINGLASER+4; j++) tloadtile(j,1); break;
|
||||
case SHOTGUNSPRITE__STATIC:
|
||||
tloadtile(SHOTGUNSHELL,1); for (j=SHOTGUN; j<=SHOTGUN+6; j++) tloadtile(j,1); break;
|
||||
case DEVISTATORSPRITE__STATIC:
|
||||
for (j=DEVISTATOR; j<=DEVISTATOR+1; j++) tloadtile(j,1); break;
|
||||
|
||||
}
|
||||
|
||||
for(j = PN; j < (PN+maxc); j++) tloadtile(j,1);
|
||||
for (j = PN; j < (PN+maxc); j++) tloadtile(j,1);
|
||||
}
|
||||
|
||||
void cachegoodsprites(void)
|
||||
{
|
||||
short i,j;
|
||||
|
||||
for(i=0;i<MAXTILES;i++)
|
||||
for (i=0;i<MAXTILES;i++)
|
||||
{
|
||||
if(spriteflags[i] & SPRITE_FLAG_PROJECTILE)
|
||||
if (spriteflags[i] & SPRITE_FLAG_PROJECTILE)
|
||||
tloadtile(i,1);
|
||||
if(spritecache[i][0] == i && spritecache[i][2])
|
||||
for(j = i; j <= spritecache[i][1]; j++)
|
||||
if (spritecache[i][0] == i && spritecache[i][2])
|
||||
for (j = i; j <= spritecache[i][1]; j++)
|
||||
tloadtile(j,1);
|
||||
}
|
||||
tloadtile(BOTTOMSTATUSBAR,1);
|
||||
if( ud.multimode > 1)
|
||||
if ( ud.multimode > 1)
|
||||
tloadtile(FRAGBAR,1);
|
||||
|
||||
tloadtile(VIEWSCREEN,1);
|
||||
|
||||
for(i=STARTALPHANUM;i<ENDALPHANUM+1;i++) tloadtile(i,1);
|
||||
for(i=BIGALPHANUM; i<BIGALPHANUM+82; i++) tloadtile(i,1);
|
||||
for(i=MINIFONT;i<MINIFONT+63;i++) tloadtile(i,1);
|
||||
for (i=STARTALPHANUM;i<ENDALPHANUM+1;i++) tloadtile(i,1);
|
||||
for (i=BIGALPHANUM; i<BIGALPHANUM+82; i++) tloadtile(i,1);
|
||||
for (i=MINIFONT;i<MINIFONT+63;i++) tloadtile(i,1);
|
||||
|
||||
for(i=FOOTPRINTS;i<FOOTPRINTS+3;i++) tloadtile(i,1);
|
||||
for (i=FOOTPRINTS;i<FOOTPRINTS+3;i++) tloadtile(i,1);
|
||||
|
||||
for( i = BURNING; i < BURNING+14; i++) tloadtile(i,1);
|
||||
for( i = BURNING2; i < BURNING2+14; i++) tloadtile(i,1);
|
||||
for ( i = BURNING; i < BURNING+14; i++) tloadtile(i,1);
|
||||
for ( i = BURNING2; i < BURNING2+14; i++) tloadtile(i,1);
|
||||
|
||||
for( i = CRACKKNUCKLES; i < CRACKKNUCKLES+4; i++) tloadtile(i,1);
|
||||
for ( i = CRACKKNUCKLES; i < CRACKKNUCKLES+4; i++) tloadtile(i,1);
|
||||
|
||||
for( i = FIRSTGUN; i < FIRSTGUN+3 ; i++ ) tloadtile(i,1);
|
||||
for( i = FIRSTGUNRELOAD; i < FIRSTGUNRELOAD+8 ; i++ ) tloadtile(i,1);
|
||||
for ( i = FIRSTGUN; i < FIRSTGUN+3 ; i++ ) tloadtile(i,1);
|
||||
for ( i = FIRSTGUNRELOAD; i < FIRSTGUNRELOAD+8 ; i++ ) tloadtile(i,1);
|
||||
|
||||
for( i = EXPLOSION2; i < EXPLOSION2+21 ; i++ ) tloadtile(i,1);
|
||||
for ( i = EXPLOSION2; i < EXPLOSION2+21 ; i++ ) tloadtile(i,1);
|
||||
|
||||
tloadtile(BULLETHOLE,1);
|
||||
for( i = SMALLSMOKE; i < (SMALLSMOKE+4); i++) tloadtile(i,1);
|
||||
for ( i = SMALLSMOKE; i < (SMALLSMOKE+4); i++) tloadtile(i,1);
|
||||
|
||||
for( i = JIBS1; i < (JIBS5+5); i++) tloadtile(i,1);
|
||||
for( i = SCRAP1; i < (SCRAP1+19); i++) tloadtile(i,1);
|
||||
for ( i = JIBS1; i < (JIBS5+5); i++) tloadtile(i,1);
|
||||
for ( i = SCRAP1; i < (SCRAP1+19); i++) tloadtile(i,1);
|
||||
|
||||
for (i=RPG; i<RPG+7; i++) tloadtile(i,1);
|
||||
for (i=FREEZEBLAST; i<FREEZEBLAST+3; i++) tloadtile(i,1);
|
||||
|
@ -232,22 +240,22 @@ char getsound(unsigned short num)
|
|||
short fp;
|
||||
long l;
|
||||
|
||||
if(num >= NUM_SOUNDS || SoundToggle == 0) return 0;
|
||||
if (num >= NUM_SOUNDS || SoundToggle == 0) return 0;
|
||||
if (FXDevice < 0) return 0;
|
||||
|
||||
if (!sounds[num][0]) return 0;
|
||||
fp = kopen4load(sounds[num],loadfromgrouponly);
|
||||
if(fp == -1) return 0;
|
||||
if (fp == -1) return 0;
|
||||
|
||||
l = kfilelength( fp );
|
||||
soundsiz[num] = l;
|
||||
|
||||
if( (ud.level_number == 0 && ud.volume_number == 0 && (num == 189 || num == 232 || num == 99 || num == 233 || num == 17 ) ) ||
|
||||
if ( (ud.level_number == 0 && ud.volume_number == 0 && (num == 189 || num == 232 || num == 99 || num == 233 || num == 17 ) ) ||
|
||||
( l < 12288 ) )
|
||||
{
|
||||
Sound[num].lock = 199;
|
||||
allocache((long *)&Sound[num].ptr,l,(char *)&Sound[num].lock);
|
||||
if(Sound[num].ptr != NULL)
|
||||
if (Sound[num].ptr != NULL)
|
||||
kread( fp, Sound[num].ptr , l);
|
||||
}
|
||||
kclose( fp );
|
||||
|
@ -261,11 +269,11 @@ void precachenecessarysounds(void)
|
|||
if (FXDevice < 0) return;
|
||||
j = 0;
|
||||
|
||||
for(i=0;i<NUM_SOUNDS;i++)
|
||||
if(Sound[i].ptr == 0)
|
||||
for (i=0;i<NUM_SOUNDS;i++)
|
||||
if (Sound[i].ptr == 0)
|
||||
{
|
||||
j++;
|
||||
if( (j&7) == 0 )
|
||||
if ( (j&7) == 0 )
|
||||
{ handleevents(); getpackets(); }
|
||||
getsound(i);
|
||||
}
|
||||
|
@ -277,7 +285,7 @@ void cacheit(void)
|
|||
long tc;
|
||||
unsigned long starttime, endtime;
|
||||
|
||||
if(ud.recstat == 2)
|
||||
if (ud.recstat == 2)
|
||||
return;
|
||||
|
||||
starttime = getticks();
|
||||
|
@ -286,29 +294,29 @@ void cacheit(void)
|
|||
|
||||
cachegoodsprites();
|
||||
|
||||
for(i=0;i<numwalls;i++)
|
||||
for (i=0;i<numwalls;i++)
|
||||
{
|
||||
tloadtile(wall[i].picnum, 0);
|
||||
|
||||
if(wall[i].overpicnum >= 0) {
|
||||
if (wall[i].overpicnum >= 0) {
|
||||
tloadtile(wall[i].overpicnum, 0);
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<numsectors;i++)
|
||||
for (i=0;i<numsectors;i++)
|
||||
{
|
||||
tloadtile( sector[i].floorpicnum, 0 );
|
||||
tloadtile( sector[i].ceilingpicnum, 0 );
|
||||
if( sector[i].ceilingpicnum == LA) // JBF 20040509: if( waloff[sector[i].ceilingpicnum] == LA) WTF??!??!?!?
|
||||
if ( sector[i].ceilingpicnum == LA) // JBF 20040509: if( waloff[sector[i].ceilingpicnum] == LA) WTF??!??!?!?
|
||||
{
|
||||
tloadtile(LA+1, 0);
|
||||
tloadtile(LA+2, 0);
|
||||
}
|
||||
|
||||
j = headspritesect[i];
|
||||
while(j >= 0)
|
||||
while (j >= 0)
|
||||
{
|
||||
if(sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat&32768) == 0)
|
||||
if (sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat&32768) == 0)
|
||||
cachespritenum(j);
|
||||
j = nextspritesect[j];
|
||||
}
|
||||
|
@ -317,12 +325,12 @@ void cacheit(void)
|
|||
tc = totalclock;
|
||||
j = 0;
|
||||
|
||||
for(i=0;i<MAXTILES;i++) {
|
||||
for (i=0;i<MAXTILES;i++) {
|
||||
if (!(i&7) && !gotpic[i>>3]) {
|
||||
i+=7;
|
||||
continue;
|
||||
}
|
||||
if(gotpic[i>>3] & pow2char[i&7]) {
|
||||
if (gotpic[i>>3] & pow2char[i&7]) {
|
||||
if (waloff[i] == 0)
|
||||
loadtile((short)i);
|
||||
|
||||
|
@ -341,7 +349,7 @@ void cacheit(void)
|
|||
pc++;
|
||||
} else continue;
|
||||
|
||||
if((j&7) == 0) { handleevents(); getpackets(); }
|
||||
if ((j&7) == 0) { handleevents(); getpackets(); }
|
||||
if (totalclock - tc > TICRATE/4) {
|
||||
sprintf(tempbuf,"Loading textures ... %ld%%\n",min(100,100*pc/precachecount));
|
||||
dofrontscreens(tempbuf);
|
||||
|
@ -373,10 +381,10 @@ void vscrn(void)
|
|||
{
|
||||
long i, j, ss, x1, x2, y1, y2;
|
||||
|
||||
if(ud.screen_size < 0) ud.screen_size = 0;
|
||||
else if(ud.screen_size > 63) ud.screen_size = 64;
|
||||
if (ud.screen_size < 0) ud.screen_size = 0;
|
||||
else if (ud.screen_size > 63) ud.screen_size = 64;
|
||||
|
||||
if(ud.screen_size == 0) flushperms();
|
||||
if (ud.screen_size == 0) flushperms();
|
||||
|
||||
ss = max(ud.screen_size-8,0);
|
||||
|
||||
|
@ -387,8 +395,8 @@ void vscrn(void)
|
|||
if ( ud.screen_size > 0 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_FRAGBAR) && ud.multimode > 1)
|
||||
{
|
||||
j = 0;
|
||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
||||
if(i > j) j = i;
|
||||
for (i=connecthead;i>=0;i=connectpoint2[i])
|
||||
if (i > j) j = i;
|
||||
|
||||
if (j >= 1) y1 += 8;
|
||||
if (j >= 4) y1 += 8;
|
||||
|
@ -415,18 +423,18 @@ void pickrandomspot(short snum)
|
|||
|
||||
p = &ps[snum];
|
||||
|
||||
if( ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_FIXEDRESPAWN))
|
||||
if ( ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_FIXEDRESPAWN))
|
||||
{
|
||||
if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDMSPAWN)
|
||||
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDMSPAWN)
|
||||
{
|
||||
for(j=0;j<ud.multimode;j++)
|
||||
for (j=0;j<ud.multimode;j++)
|
||||
{
|
||||
if(j != snum && ps[j].team == ps[snum].team && sprite[ps[j].i].extra > 0)
|
||||
if (j != snum && ps[j].team == ps[snum].team && sprite[ps[j].i].extra > 0)
|
||||
{
|
||||
for(k=0;k<numplayersprites;k++)
|
||||
for (k=0;k<numplayersprites;k++)
|
||||
{
|
||||
dist = FindDistance2D(ps[j].posx-po[k].ox,ps[j].posy-po[k].oy);
|
||||
if(dist < pdist)
|
||||
if (dist < pdist)
|
||||
i = k, pdist = dist;
|
||||
}
|
||||
break;
|
||||
|
@ -495,7 +503,7 @@ void resetplayerstats(short snum)
|
|||
p->rapid_fire_hold = 0;
|
||||
p->toggle_key_flag = 0;
|
||||
p->access_spritenum = -1;
|
||||
if(ud.multimode > 1 && (gametype_flags[ud.coop] & GAMETYPE_FLAG_ACCESSATSTART))
|
||||
if (ud.multimode > 1 && (gametype_flags[ud.coop] & GAMETYPE_FLAG_ACCESSATSTART))
|
||||
p->got_access = 7;
|
||||
else p->got_access = 0;
|
||||
p->random_club_frame= 0;
|
||||
|
@ -505,7 +513,7 @@ void resetplayerstats(short snum)
|
|||
p->sbs = 0;
|
||||
p->palette = (char *) &palette[0];
|
||||
|
||||
if(p->steroids_amount < 400 )
|
||||
if (p->steroids_amount < 400 )
|
||||
{
|
||||
p->steroids_amount = 0;
|
||||
p->inven_icon = 0;
|
||||
|
@ -532,7 +540,7 @@ void resetplayerstats(short snum)
|
|||
|
||||
p->on_crane = -1;
|
||||
|
||||
if( (aplWeaponWorksLike[p->curr_weapon][snum] == PISTOL_WEAPON) &&
|
||||
if ( (aplWeaponWorksLike[p->curr_weapon][snum] == PISTOL_WEAPON) &&
|
||||
(aplWeaponReload[p->curr_weapon][snum] > aplWeaponTotalTime[p->curr_weapon][snum]) )
|
||||
p->kickback_pic = aplWeaponTotalTime[p->curr_weapon][snum]+1;
|
||||
else p->kickback_pic = 0;
|
||||
|
@ -608,7 +616,7 @@ void resetprestat(short snum,char g)
|
|||
p = &ps[snum];
|
||||
|
||||
spriteqloc = 0;
|
||||
for(i=0;i<spriteqamount;i++) spriteq[i] = -1;
|
||||
for (i=0;i<spriteqamount;i++) spriteq[i] = -1;
|
||||
|
||||
p->hbomb_on = 0;
|
||||
p->cheat_phase = 0;
|
||||
|
@ -647,12 +655,12 @@ void resetprestat(short snum,char g)
|
|||
numinterpolations = 0;
|
||||
startofdynamicinterpolations = 0;
|
||||
|
||||
if( ( (g&MODE_EOL) != MODE_EOL && numplayers < 2) || (!(gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && numplayers > 1) )
|
||||
if ( ( (g&MODE_EOL) != MODE_EOL && numplayers < 2) || (!(gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && numplayers > 1) )
|
||||
{
|
||||
resetweapons(snum);
|
||||
resetinventory(snum);
|
||||
}
|
||||
else if(p->curr_weapon == HANDREMOTE_WEAPON)
|
||||
else if (p->curr_weapon == HANDREMOTE_WEAPON)
|
||||
{
|
||||
p->ammo_amount[HANDBOMB_WEAPON]++;
|
||||
p->curr_weapon = HANDBOMB_WEAPON;
|
||||
|
@ -667,12 +675,12 @@ void setupbackdrop(short sky)
|
|||
{
|
||||
short i;
|
||||
|
||||
for(i=0;i<MAXPSKYTILES;i++) pskyoff[i]=0;
|
||||
for (i=0;i<MAXPSKYTILES;i++) pskyoff[i]=0;
|
||||
|
||||
if(parallaxyscale != 65536L)
|
||||
if (parallaxyscale != 65536L)
|
||||
parallaxyscale = 32768;
|
||||
|
||||
switch(dynamictostatic[sky])
|
||||
switch (dynamictostatic[sky])
|
||||
{
|
||||
case CLOUDYOCEAN__STATIC:
|
||||
parallaxyscale = 65536L;
|
||||
|
@ -707,43 +715,43 @@ void prelevel(char g)
|
|||
resetprestat(0,g);
|
||||
numclouds = 0;
|
||||
|
||||
for(i=0;i<numsectors;i++)
|
||||
for (i=0;i<numsectors;i++)
|
||||
{
|
||||
sector[i].extra = 256;
|
||||
|
||||
switch(sector[i].lotag)
|
||||
switch (sector[i].lotag)
|
||||
{
|
||||
case 20:
|
||||
case 22:
|
||||
if( sector[i].floorz > sector[i].ceilingz)
|
||||
if ( sector[i].floorz > sector[i].ceilingz)
|
||||
sector[i].lotag |= 32768;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(sector[i].ceilingstat&1)
|
||||
if (sector[i].ceilingstat&1)
|
||||
{
|
||||
if(waloff[sector[i].ceilingpicnum] == 0)
|
||||
if (waloff[sector[i].ceilingpicnum] == 0)
|
||||
{
|
||||
if(sector[i].ceilingpicnum == LA)
|
||||
for(j=0;j<5;j++)
|
||||
if (sector[i].ceilingpicnum == LA)
|
||||
for (j=0;j<5;j++)
|
||||
tloadtile(sector[i].ceilingpicnum+j, 0);
|
||||
}
|
||||
setupbackdrop(sector[i].ceilingpicnum);
|
||||
|
||||
if(sector[i].ceilingpicnum == CLOUDYSKIES && numclouds < 127)
|
||||
if (sector[i].ceilingpicnum == CLOUDYSKIES && numclouds < 127)
|
||||
clouds[numclouds++] = i;
|
||||
|
||||
if(ps[0].one_parallax_sectnum == -1)
|
||||
if (ps[0].one_parallax_sectnum == -1)
|
||||
ps[0].one_parallax_sectnum = i;
|
||||
}
|
||||
|
||||
if(sector[i].lotag == 32767) //Found a secret room
|
||||
if (sector[i].lotag == 32767) //Found a secret room
|
||||
{
|
||||
ps[0].max_secret_rooms++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(sector[i].lotag == -1)
|
||||
if (sector[i].lotag == -1)
|
||||
{
|
||||
ps[0].exitx = wall[sector[i].wallptr].x;
|
||||
ps[0].exity = wall[sector[i].wallptr].y;
|
||||
|
@ -752,17 +760,17 @@ void prelevel(char g)
|
|||
}
|
||||
|
||||
i = headspritestat[0];
|
||||
while(i >= 0)
|
||||
while (i >= 0)
|
||||
{
|
||||
nexti = nextspritestat[i];
|
||||
ResetActorGameVars(i);
|
||||
LoadActor(i, -1, -1);
|
||||
if(sprite[i].lotag == -1 && (sprite[i].cstat&16) )
|
||||
if (sprite[i].lotag == -1 && (sprite[i].cstat&16) )
|
||||
{
|
||||
ps[0].exitx = SX;
|
||||
ps[0].exity = SY;
|
||||
}
|
||||
else switch(dynamictostatic[PN])
|
||||
else switch (dynamictostatic[PN])
|
||||
{
|
||||
case GPSPEED__STATIC:
|
||||
sector[SECT].extra = SLT;
|
||||
|
@ -770,7 +778,7 @@ void prelevel(char g)
|
|||
break;
|
||||
|
||||
case CYCLER__STATIC:
|
||||
if(numcyclers >= MAXCYCLERS)
|
||||
if (numcyclers >= MAXCYCLERS)
|
||||
{
|
||||
Bsprintf(tempbuf,"\nToo many cycling sectors (%d max).",MAXCYCLERS);
|
||||
gameexit(tempbuf);
|
||||
|
@ -799,29 +807,29 @@ void prelevel(char g)
|
|||
i = nexti;
|
||||
}
|
||||
|
||||
for(i=0;i < MAXSPRITES;i++)
|
||||
for (i=0;i < MAXSPRITES;i++)
|
||||
{
|
||||
if(sprite[i].statnum < MAXSTATUS)
|
||||
if (sprite[i].statnum < MAXSTATUS)
|
||||
{
|
||||
if(PN == SECTOREFFECTOR && SLT == 14)
|
||||
if (PN == SECTOREFFECTOR && SLT == 14)
|
||||
continue;
|
||||
spawn(-1,i);
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i < MAXSPRITES;i++)
|
||||
if(sprite[i].statnum < MAXSTATUS)
|
||||
for (i=0;i < MAXSPRITES;i++)
|
||||
if (sprite[i].statnum < MAXSTATUS)
|
||||
{
|
||||
if( PN == SECTOREFFECTOR && SLT == 14 )
|
||||
if ( PN == SECTOREFFECTOR && SLT == 14 )
|
||||
spawn(-1,i);
|
||||
}
|
||||
|
||||
lotaglist = 0;
|
||||
|
||||
i = headspritestat[0];
|
||||
while(i >= 0)
|
||||
while (i >= 0)
|
||||
{
|
||||
switch(dynamictostatic[PN-1])
|
||||
switch (dynamictostatic[PN-1])
|
||||
{
|
||||
case DIPSWITCH__STATIC:
|
||||
case DIPSWITCH2__STATIC:
|
||||
|
@ -836,21 +844,21 @@ void prelevel(char g)
|
|||
case POWERSWITCH1__STATIC:
|
||||
case LOCKSWITCH1__STATIC:
|
||||
case POWERSWITCH2__STATIC:
|
||||
for(j=0;j<lotaglist;j++)
|
||||
if( SLT == lotags[j] )
|
||||
for (j=0;j<lotaglist;j++)
|
||||
if ( SLT == lotags[j] )
|
||||
break;
|
||||
|
||||
if( j == lotaglist )
|
||||
if ( j == lotaglist )
|
||||
{
|
||||
lotags[lotaglist] = SLT;
|
||||
lotaglist++;
|
||||
if(lotaglist > 64)
|
||||
if (lotaglist > 64)
|
||||
gameexit("\nToo many switches (64 max).");
|
||||
|
||||
j = headspritestat[3];
|
||||
while(j >= 0)
|
||||
while (j >= 0)
|
||||
{
|
||||
if(sprite[j].lotag == 12 && sprite[j].hitag == SLT)
|
||||
if (sprite[j].lotag == 12 && sprite[j].hitag == SLT)
|
||||
hittype[j].temp_data[0] = 1;
|
||||
j = nextspritestat[j];
|
||||
}
|
||||
|
@ -862,16 +870,16 @@ void prelevel(char g)
|
|||
|
||||
mirrorcnt = 0;
|
||||
|
||||
for( i = 0; i < numwalls; i++ )
|
||||
for ( i = 0; i < numwalls; i++ )
|
||||
{
|
||||
walltype *wal;
|
||||
wal = &wall[i];
|
||||
|
||||
if(wal->overpicnum == MIRROR && (wal->cstat&32) != 0)
|
||||
if (wal->overpicnum == MIRROR && (wal->cstat&32) != 0)
|
||||
{
|
||||
j = wal->nextsector;
|
||||
|
||||
if(mirrorcnt > 63)
|
||||
if (mirrorcnt > 63)
|
||||
gameexit("\nToo many mirrors (64 max.)");
|
||||
if ( (j >= 0) && sector[j].ceilingpicnum != MIRROR )
|
||||
{
|
||||
|
@ -884,7 +892,7 @@ void prelevel(char g)
|
|||
}
|
||||
}
|
||||
|
||||
if(numanimwalls >= MAXANIMWALLS)
|
||||
if (numanimwalls >= MAXANIMWALLS)
|
||||
{
|
||||
Bsprintf(tempbuf,"\nToo many 'anim' walls (%d max).",MAXANIMWALLS);
|
||||
gameexit(tempbuf);
|
||||
|
@ -896,7 +904,7 @@ void prelevel(char g)
|
|||
if ((wal->overpicnum > W_FORCEFIELD)&&(wal->overpicnum <= W_FORCEFIELD+2)) {
|
||||
switchpicnum = W_FORCEFIELD;
|
||||
}
|
||||
switch(dynamictostatic[switchpicnum])
|
||||
switch (dynamictostatic[switchpicnum])
|
||||
{
|
||||
case FANSHADOW__STATIC:
|
||||
case FANSPRITE__STATIC:
|
||||
|
@ -907,14 +915,14 @@ void prelevel(char g)
|
|||
|
||||
case W_FORCEFIELD__STATIC:
|
||||
if (wal->overpicnum==W_FORCEFIELD__STATIC)
|
||||
for(j=0;j<3;j++)
|
||||
for (j=0;j<3;j++)
|
||||
tloadtile(W_FORCEFIELD+j, 0);
|
||||
if(wal->shade > 31)
|
||||
if (wal->shade > 31)
|
||||
wal->cstat = 0;
|
||||
else wal->cstat |= 85+256;
|
||||
|
||||
|
||||
if(wal->lotag && wal->nextwall >= 0)
|
||||
if (wal->lotag && wal->nextwall >= 0)
|
||||
wall[wal->nextwall].lotag =
|
||||
wal->lotag;
|
||||
|
||||
|
@ -928,10 +936,10 @@ void prelevel(char g)
|
|||
|
||||
wal->extra = -1;
|
||||
|
||||
switch(dynamictostatic[wal->picnum])
|
||||
switch (dynamictostatic[wal->picnum])
|
||||
{
|
||||
case WATERTILE2__STATIC:
|
||||
for(j=0;j<3;j++)
|
||||
for (j=0;j<3;j++)
|
||||
tloadtile(wal->picnum+j, 0);
|
||||
break;
|
||||
|
||||
|
@ -950,7 +958,7 @@ void prelevel(char g)
|
|||
case SCREENBREAK6__STATIC:
|
||||
case SCREENBREAK7__STATIC:
|
||||
case SCREENBREAK8__STATIC:
|
||||
for(j=SCREENBREAK6;j<SCREENBREAK9;j++)
|
||||
for (j=SCREENBREAK6;j<SCREENBREAK9;j++)
|
||||
tloadtile(j, 0);
|
||||
animwall[numanimwalls].wallnum = i;
|
||||
animwall[numanimwalls].tag = -1;
|
||||
|
@ -963,9 +971,9 @@ void prelevel(char g)
|
|||
|
||||
wal->extra = wal->picnum;
|
||||
animwall[numanimwalls].tag = -1;
|
||||
if(ud.lockout)
|
||||
if (ud.lockout)
|
||||
{
|
||||
if(wal->picnum == FEMPIC1)
|
||||
if (wal->picnum == FEMPIC1)
|
||||
wal->picnum = BLANKSCREEN;
|
||||
else wal->picnum = SCREENBREAK6;
|
||||
}
|
||||
|
@ -1001,11 +1009,11 @@ void prelevel(char g)
|
|||
}
|
||||
|
||||
//Invalidate textures in sector behind mirror
|
||||
for(i=0;i<mirrorcnt;i++)
|
||||
for (i=0;i<mirrorcnt;i++)
|
||||
{
|
||||
startwall = sector[mirrorsector[i]].wallptr;
|
||||
endwall = startwall + sector[mirrorsector[i]].wallnum;
|
||||
for(j=startwall;j<endwall;j++)
|
||||
for (j=startwall;j<endwall;j++)
|
||||
{
|
||||
wall[j].picnum = MIRROR;
|
||||
wall[j].overpicnum = MIRROR;
|
||||
|
@ -1018,18 +1026,18 @@ void newgame(char vn,char ln,char sk)
|
|||
struct player_struct *p = &ps[0];
|
||||
short i;
|
||||
|
||||
if(globalskillsound >= 0 && FXDevice >= 0 && SoundToggle)
|
||||
while(issoundplaying(-1,globalskillsound)) { handleevents(); getpackets(); }
|
||||
if (globalskillsound >= 0 && FXDevice >= 0 && SoundToggle)
|
||||
while (issoundplaying(-1,globalskillsound)) { handleevents(); getpackets(); }
|
||||
else { handleevents(); getpackets(); }
|
||||
globalskillsound = -1;
|
||||
|
||||
waitforeverybody();
|
||||
ready2send = 0;
|
||||
|
||||
if( ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && (ud.coop&GAMETYPE_FLAG_SCORESHEET))
|
||||
if ( ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && (ud.coop&GAMETYPE_FLAG_SCORESHEET))
|
||||
dobonus(1);
|
||||
|
||||
if( ln == 0 && vn == 3 && ud.multimode < 2 && ud.lockout == 0)
|
||||
if ( ln == 0 && vn == 3 && ud.multimode < 2 && ud.lockout == 0)
|
||||
{
|
||||
playmusic(&env_music_fn[1][0]);
|
||||
|
||||
|
@ -1072,19 +1080,19 @@ void newgame(char vn,char ln,char sk)
|
|||
|
||||
ResetSystemDefaults();
|
||||
|
||||
if(ud.m_coop != 1)
|
||||
if (ud.m_coop != 1)
|
||||
{
|
||||
for(i=0;i<MAX_WEAPONS;i++)
|
||||
for (i=0;i<MAX_WEAPONS;i++)
|
||||
{
|
||||
if(aplWeaponWorksLike[i][0]==PISTOL_WEAPON)
|
||||
if (aplWeaponWorksLike[i][0]==PISTOL_WEAPON)
|
||||
{
|
||||
p->curr_weapon = i;
|
||||
p->gotweapon[i] = 1;
|
||||
p->ammo_amount[i] = 48;
|
||||
}
|
||||
else if(aplWeaponWorksLike[i][0]==KNEE_WEAPON)
|
||||
else if (aplWeaponWorksLike[i][0]==KNEE_WEAPON)
|
||||
p->gotweapon[i] = 1;
|
||||
else if(aplWeaponWorksLike[i][0]==HANDREMOTE_WEAPON)
|
||||
else if (aplWeaponWorksLike[i][0]==HANDREMOTE_WEAPON)
|
||||
p->gotweapon[i] = 1;
|
||||
}
|
||||
p->last_weapon = -1;
|
||||
|
@ -1092,12 +1100,12 @@ void newgame(char vn,char ln,char sk)
|
|||
}
|
||||
display_mirror = 0;
|
||||
|
||||
if(ud.multimode > 1 )
|
||||
if (ud.multimode > 1 )
|
||||
{
|
||||
if(numplayers < 2)
|
||||
if (numplayers < 2)
|
||||
{
|
||||
connecthead = 0;
|
||||
for(i=0;i<MAXPLAYERS;i++) connectpoint2[i] = i+1;
|
||||
for (i=0;i<MAXPLAYERS;i++) connectpoint2[i] = i+1;
|
||||
connectpoint2[ud.multimode-1] = -1;
|
||||
}
|
||||
}
|
||||
|
@ -1119,14 +1127,14 @@ void resetpspritevars(char g)
|
|||
EGS(ps[0].cursectnum,ps[0].posx,ps[0].posy,ps[0].posz,
|
||||
APLAYER,0,0,0,ps[0].ang,0,0,0,10);
|
||||
|
||||
if(ud.recstat != 2) for(i=0;i<MAXPLAYERS;i++)
|
||||
if (ud.recstat != 2) for (i=0;i<MAXPLAYERS;i++)
|
||||
{
|
||||
aimmode[i] = ps[i].aim_mode;
|
||||
autoaim[i] = ps[i].auto_aim;
|
||||
weaponswitch[i] = ps[i].weaponswitch;
|
||||
if(ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
|
||||
if (ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
|
||||
{
|
||||
for(j=0;j<MAX_WEAPONS;j++)
|
||||
for (j=0;j<MAX_WEAPONS;j++)
|
||||
{
|
||||
tsbar[i].ammo_amount[j] = ps[i].ammo_amount[j];
|
||||
tsbar[i].gotweapon[j] = ps[i].gotweapon[j];
|
||||
|
@ -1148,17 +1156,17 @@ void resetpspritevars(char g)
|
|||
|
||||
resetplayerstats(0);
|
||||
|
||||
for(i=1;i<MAXPLAYERS;i++)
|
||||
for (i=1;i<MAXPLAYERS;i++)
|
||||
memcpy(&ps[i],&ps[0],sizeof(ps[0]));
|
||||
|
||||
if(ud.recstat != 2) for(i=0;i<MAXPLAYERS;i++)
|
||||
if (ud.recstat != 2) for (i=0;i<MAXPLAYERS;i++)
|
||||
{
|
||||
ps[i].aim_mode = aimmode[i];
|
||||
ps[i].auto_aim = autoaim[i];
|
||||
ps[i].weaponswitch = weaponswitch[i];
|
||||
if(ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
|
||||
if (ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
|
||||
{
|
||||
for(j=0;j<MAX_WEAPONS;j++)
|
||||
for (j=0;j<MAX_WEAPONS;j++)
|
||||
{
|
||||
ps[i].ammo_amount[j] = tsbar[i].ammo_amount[j];
|
||||
ps[i].gotweapon[j] = tsbar[i].gotweapon[j];
|
||||
|
@ -1183,15 +1191,15 @@ void resetpspritevars(char g)
|
|||
which_palookup = 9;
|
||||
j = connecthead;
|
||||
i = headspritestat[10];
|
||||
while(i >= 0)
|
||||
while (i >= 0)
|
||||
{
|
||||
nexti = nextspritestat[i];
|
||||
s = &sprite[i];
|
||||
|
||||
if( numplayersprites == MAXPLAYERS)
|
||||
if ( numplayersprites == MAXPLAYERS)
|
||||
gameexit("\nToo many player sprites (max 16.)");
|
||||
|
||||
if(numplayersprites == 0)
|
||||
if (numplayersprites == 0)
|
||||
{
|
||||
firstx = ps[0].posx;
|
||||
firsty = ps[0].posy;
|
||||
|
@ -1204,7 +1212,7 @@ void resetpspritevars(char g)
|
|||
po[numplayersprites].os = s->sectnum;
|
||||
|
||||
numplayersprites++;
|
||||
if(j >= 0)
|
||||
if (j >= 0)
|
||||
{
|
||||
s->owner = i;
|
||||
s->shade = 0;
|
||||
|
@ -1214,7 +1222,7 @@ void resetpspritevars(char g)
|
|||
s->xoffset = 0;
|
||||
s->clipdist = 64;
|
||||
|
||||
if( (g&MODE_EOL) != MODE_EOL || ps[j].last_extra == 0)
|
||||
if ( (g&MODE_EOL) != MODE_EOL || ps[j].last_extra == 0)
|
||||
{
|
||||
ps[j].last_extra = max_player_health;
|
||||
s->extra = max_player_health;
|
||||
|
@ -1224,22 +1232,22 @@ void resetpspritevars(char g)
|
|||
|
||||
s->yvel = j;
|
||||
|
||||
if(!ud.pcolor[j] && ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM))
|
||||
if (!ud.pcolor[j] && ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM))
|
||||
{
|
||||
if(s->pal == 0)
|
||||
if (s->pal == 0)
|
||||
{
|
||||
int k;
|
||||
|
||||
for(k=0;k<MAXPLAYERS;k++) {
|
||||
if(which_palookup == ps[k].palookup) {
|
||||
for (k=0;k<MAXPLAYERS;k++) {
|
||||
if (which_palookup == ps[k].palookup) {
|
||||
which_palookup++;
|
||||
if( which_palookup >= 17 )
|
||||
if ( which_palookup >= 17 )
|
||||
which_palookup = 9;
|
||||
k=0;
|
||||
}
|
||||
}
|
||||
ud.pcolor[j] = s->pal = ps[j].palookup = which_palookup++;
|
||||
if( which_palookup >= 17 )
|
||||
if ( which_palookup >= 17 )
|
||||
which_palookup = 9;
|
||||
}
|
||||
else ud.pcolor[j] = ps[j].palookup = s->pal;
|
||||
|
@ -1248,12 +1256,14 @@ void resetpspritevars(char g)
|
|||
{
|
||||
int k = ud.pcolor[j];
|
||||
|
||||
if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
|
||||
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
|
||||
{
|
||||
switch(ud.pteam[j])
|
||||
switch (ud.pteam[j])
|
||||
{
|
||||
case 0: k = 3; break;
|
||||
case 1: k = 21; break;
|
||||
case 0:
|
||||
k = 3; break;
|
||||
case 1:
|
||||
k = 21; break;
|
||||
}
|
||||
ps[j].team = ud.pteam[j];
|
||||
}
|
||||
|
@ -1283,7 +1293,7 @@ void clearfrags(void)
|
|||
{
|
||||
short i;
|
||||
|
||||
for(i = 0;i<MAXPLAYERS;i++)
|
||||
for (i = 0;i<MAXPLAYERS;i++)
|
||||
ps[i].frag = ps[i].fraggedself = 0;
|
||||
clearbufbyte(&frags[0][0],(MAXPLAYERS*MAXPLAYERS)<<1,0L);
|
||||
}
|
||||
|
@ -1306,12 +1316,12 @@ void genspriteremaps(void)
|
|||
char *lookfn = "lookup.dat";
|
||||
|
||||
fp = kopen4load(lookfn,0);
|
||||
if(fp != -1)
|
||||
if (fp != -1)
|
||||
kread(fp,(char *)&numl,1);
|
||||
else
|
||||
gameexit("\nERROR: File 'LOOKUP.DAT' not found.");
|
||||
|
||||
for(j=0;j < numl;j++)
|
||||
for (j=0;j < numl;j++)
|
||||
{
|
||||
kread(fp,(signed char *)&look_pos,1);
|
||||
kread(fp,tempbuf,256);
|
||||
|
@ -1349,7 +1359,7 @@ void waitforeverybody()
|
|||
|
||||
if (numplayers < 2) return;
|
||||
packbuf[0] = 250;
|
||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
||||
for (i=connecthead;i>=0;i=connectpoint2[i])
|
||||
{
|
||||
if (i != myconnectindex) sendpacket(i,packbuf,1);
|
||||
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
|
||||
|
@ -1365,10 +1375,11 @@ void waitforeverybody()
|
|||
|
||||
getpackets();
|
||||
|
||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
||||
for (i=connecthead;i>=0;i=connectpoint2[i])
|
||||
{
|
||||
if (playerreadyflag[i] < playerreadyflag[myconnectindex]) break;
|
||||
if ((!networkmode) && (myconnectindex != connecthead)) { i = -1; break; } //slaves in M/S mode only wait for master
|
||||
|
||||
}
|
||||
if (i < 0) return;
|
||||
}
|
||||
|
@ -1378,7 +1389,7 @@ void dofrontscreens(char *statustext)
|
|||
{
|
||||
long i=0,j;
|
||||
|
||||
if(ud.recstat != 2)
|
||||
if (ud.recstat != 2)
|
||||
{
|
||||
if (!statustext) {
|
||||
//ps[myconnectindex].palette = palette;
|
||||
|
@ -1394,12 +1405,12 @@ void dofrontscreens(char *statustext)
|
|||
OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
|
||||
j = GetGameVarID(g_iReturnVarID, -1, -1);
|
||||
rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64,0,0,xdim-1,ydim-1);
|
||||
if(j > MAXTILES-1)
|
||||
if (j > MAXTILES-1)
|
||||
{
|
||||
nextpage();
|
||||
return;
|
||||
}
|
||||
if( boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0 )
|
||||
if ( boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0 )
|
||||
{
|
||||
menutext(160,90,0,0,"ENTERING USER MAP");
|
||||
gametextpal(160,90+10,boardfilename,14,2);
|
||||
|
@ -1435,7 +1446,7 @@ void dofrontscreens(char *statustext)
|
|||
OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
|
||||
j = GetGameVarID(g_iReturnVarID, -1, -1);
|
||||
rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64,0,0,xdim-1,ydim-1);
|
||||
if(j > MAXTILES-1)
|
||||
if (j > MAXTILES-1)
|
||||
{
|
||||
nextpage();
|
||||
return;
|
||||
|
@ -1497,7 +1508,7 @@ int enterlevel(char g)
|
|||
long l;
|
||||
char levname[BMAX_PATH];
|
||||
|
||||
if( (g&MODE_DEMO) != MODE_DEMO ) ud.recstat = ud.m_recstat;
|
||||
if ( (g&MODE_DEMO) != MODE_DEMO ) ud.recstat = ud.m_recstat;
|
||||
ud.respawn_monsters = ud.m_respawn_monsters;
|
||||
ud.respawn_items = ud.m_respawn_items;
|
||||
ud.respawn_inventory = ud.m_respawn_inventory;
|
||||
|
@ -1511,13 +1522,13 @@ int enterlevel(char g)
|
|||
Bmemset(votes,0,sizeof(votes));
|
||||
Bmemset(gotvote,0,sizeof(gotvote));
|
||||
|
||||
if( (g&MODE_DEMO) == 0 && ud.recstat == 2)
|
||||
if ( (g&MODE_DEMO) == 0 && ud.recstat == 2)
|
||||
ud.recstat = 0;
|
||||
|
||||
if (VOLUMEALL) Bsprintf(tempbuf,HEAD2);
|
||||
else Bsprintf(tempbuf,HEAD);
|
||||
|
||||
if( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 )
|
||||
if ( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 )
|
||||
{
|
||||
Bstrcpy(levname, boardfilename);
|
||||
Bsprintf(apptitle," - %s",levname);
|
||||
|
@ -1539,7 +1550,7 @@ int enterlevel(char g)
|
|||
|
||||
if (!VOLUMEONE) {
|
||||
|
||||
if( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 )
|
||||
if ( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 )
|
||||
{
|
||||
if ( loadboard( boardfilename,0,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1 )
|
||||
{
|
||||
|
@ -1603,34 +1614,34 @@ int enterlevel(char g)
|
|||
cachedebug = 0;
|
||||
automapping = 0;
|
||||
|
||||
if(ud.recstat != 2) MUSIC_StopSong();
|
||||
if (ud.recstat != 2) MUSIC_StopSong();
|
||||
|
||||
cacheit();
|
||||
|
||||
if(ud.recstat != 2)
|
||||
if (ud.recstat != 2)
|
||||
{
|
||||
music_select = (ud.volume_number*11) + ud.level_number;
|
||||
playmusic(&music_fn[0][music_select][0]);
|
||||
}
|
||||
|
||||
if( (g&MODE_GAME) || (g&MODE_EOL) )
|
||||
if ( (g&MODE_GAME) || (g&MODE_EOL) )
|
||||
ps[myconnectindex].gm = MODE_GAME;
|
||||
else if(g&MODE_RESTART)
|
||||
else if (g&MODE_RESTART)
|
||||
{
|
||||
if(ud.recstat == 2)
|
||||
if (ud.recstat == 2)
|
||||
ps[myconnectindex].gm = MODE_DEMO;
|
||||
else ps[myconnectindex].gm = MODE_GAME;
|
||||
}
|
||||
|
||||
if( (ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART )
|
||||
if ( (ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART )
|
||||
opendemowrite();
|
||||
|
||||
if (VOLUMEONE) {
|
||||
if(ud.level_number == 0 && ud.recstat != 2) FTA(40,&ps[myconnectindex]);
|
||||
if (ud.level_number == 0 && ud.recstat != 2) FTA(40,&ps[myconnectindex]);
|
||||
}
|
||||
|
||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
||||
switch(dynamictostatic[sector[sprite[ps[i].i].sectnum].floorpicnum])
|
||||
for (i=connecthead;i>=0;i=connectpoint2[i])
|
||||
switch (dynamictostatic[sector[sprite[ps[i].i].sectnum].floorpicnum])
|
||||
{
|
||||
case HURTRAIL__STATIC:
|
||||
case FLOORSLIME__STATIC:
|
||||
|
@ -1662,7 +1673,7 @@ int enterlevel(char g)
|
|||
|
||||
clearfifo();
|
||||
|
||||
for(i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
|
||||
for (i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
|
||||
|
||||
restorepalette = 1;
|
||||
|
||||
|
|
|
@ -35,13 +35,13 @@ int loadpheader(char spot,struct savehead *saveh)
|
|||
|
||||
walock[TILE_LOADSHOT] = 255;
|
||||
|
||||
if(kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
|
||||
if(kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt;
|
||||
g_szBuf[bv]=0;
|
||||
// AddLog(g_szBuf);
|
||||
|
||||
if (kdfread(&bv,4,1,fil) != 1) goto corrupt;
|
||||
if(bv != BYTEVERSION) {
|
||||
if (bv != BYTEVERSION) {
|
||||
FTA(114,&ps[myconnectindex]);
|
||||
kclose(fil);
|
||||
return 1;
|
||||
|
@ -80,7 +80,7 @@ int loadplayer(signed char spot)
|
|||
strcpy(fn, "egam0.sav");
|
||||
strcpy(mpfn, "egamA_00.sav");
|
||||
|
||||
if(spot < 0)
|
||||
if (spot < 0)
|
||||
{
|
||||
multiflag = 1;
|
||||
multiwhat = 0;
|
||||
|
@ -88,12 +88,12 @@ int loadplayer(signed char spot)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if( multiflag == 2 && multiwho != myconnectindex )
|
||||
if ( multiflag == 2 && multiwho != myconnectindex )
|
||||
{
|
||||
fnptr = mpfn;
|
||||
mpfn[4] = spot + 'A';
|
||||
|
||||
if(ud.multimode > 9)
|
||||
if (ud.multimode > 9)
|
||||
{
|
||||
mpfn[6] = (multiwho/10) + '0';
|
||||
mpfn[7] = (multiwho%10) + '0';
|
||||
|
@ -110,13 +110,13 @@ int loadplayer(signed char spot)
|
|||
|
||||
ready2send = 0;
|
||||
|
||||
if(kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
|
||||
if(kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt;
|
||||
g_szBuf[bv]=0;
|
||||
// AddLog(g_szBuf);
|
||||
|
||||
if (kdfread(&bv,4,1,fil) != 1) return -1;
|
||||
if(bv != BYTEVERSION)
|
||||
if (bv != BYTEVERSION)
|
||||
{
|
||||
FTA(114,&ps[myconnectindex]);
|
||||
kclose(fil);
|
||||
|
@ -126,7 +126,7 @@ int loadplayer(signed char spot)
|
|||
}
|
||||
|
||||
if (kdfread(&nump,sizeof(nump),1,fil) != 1) return -1;
|
||||
if(nump != ud.multimode)
|
||||
if (nump != ud.multimode)
|
||||
{
|
||||
kclose(fil);
|
||||
ototalclock = totalclock;
|
||||
|
@ -135,7 +135,7 @@ int loadplayer(signed char spot)
|
|||
return 1;
|
||||
} else ud.multimode = nump;
|
||||
|
||||
if(numplayers > 1)
|
||||
if (numplayers > 1)
|
||||
{
|
||||
pub = NUMPAGES;
|
||||
pus = NUMPAGES;
|
||||
|
@ -151,7 +151,7 @@ int loadplayer(signed char spot)
|
|||
clearsoundlocks();
|
||||
MUSIC_StopSong();
|
||||
|
||||
if(numplayers > 1) {
|
||||
if (numplayers > 1) {
|
||||
if (kdfread(&buf,19,1,fil) != 1) goto corrupt;
|
||||
} else {
|
||||
if (kdfread(&ud.savegame[spot][0],19,1,fil) != 1) goto corrupt;
|
||||
|
@ -210,23 +210,23 @@ int loadplayer(signed char spot)
|
|||
|
||||
if (kdfread(&scriptptrs[0],1,MAXSCRIPTSIZE,fil) != MAXSCRIPTSIZE) goto corrupt;
|
||||
if (kdfread(&script[0],4,MAXSCRIPTSIZE,fil) != MAXSCRIPTSIZE) goto corrupt;
|
||||
for(i=0;i<MAXSCRIPTSIZE;i++)
|
||||
if( scriptptrs[i] )
|
||||
for (i=0;i<MAXSCRIPTSIZE;i++)
|
||||
if ( scriptptrs[i] )
|
||||
{
|
||||
j = (long)script[i]+(long)&script[0];
|
||||
script[i] = j;
|
||||
}
|
||||
|
||||
if (kdfread(&actorscrptr[0],4,MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
for(i=0;i<MAXTILES;i++)
|
||||
if(actorscrptr[i])
|
||||
for (i=0;i<MAXTILES;i++)
|
||||
if (actorscrptr[i])
|
||||
{
|
||||
j = (long)actorscrptr[i]+(long)&script[0];
|
||||
actorscrptr[i] = (long *)j;
|
||||
}
|
||||
if (kdfread(&actorLoadEventScrptr[0],4,MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
for(i=0;i<MAXTILES;i++)
|
||||
if(actorLoadEventScrptr[i])
|
||||
for (i=0;i<MAXTILES;i++)
|
||||
if (actorLoadEventScrptr[i])
|
||||
{
|
||||
j = (long)actorLoadEventScrptr[i]+(long)&script[0];
|
||||
actorLoadEventScrptr[i] = (long *)j;
|
||||
|
@ -235,12 +235,12 @@ int loadplayer(signed char spot)
|
|||
if (kdfread(&scriptptrs[0],1,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
if (kdfread(&hittype[0],sizeof(struct weaponhit),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
|
||||
for(i=0;i<MAXSPRITES;i++)
|
||||
for (i=0;i<MAXSPRITES;i++)
|
||||
{
|
||||
j = (long)(&script[0]);
|
||||
if( scriptptrs[i]&1 ) T2 += j;
|
||||
if( scriptptrs[i]&2 ) T5 += j;
|
||||
if( scriptptrs[i]&4 ) T6 += j;
|
||||
if ( scriptptrs[i]&1 ) T2 += j;
|
||||
if ( scriptptrs[i]&2 ) T5 += j;
|
||||
if ( scriptptrs[i]&4 ) T6 += j;
|
||||
}
|
||||
|
||||
if (kdfread(&lockclock,sizeof(lockclock),1,fil) != 1) goto corrupt;
|
||||
|
@ -250,7 +250,7 @@ int loadplayer(signed char spot)
|
|||
if (kdfread(&animatecnt,sizeof(animatecnt),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&animatesect[0],2,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
||||
if (kdfread(&animateptr[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
||||
for(i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0]));
|
||||
for (i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0]));
|
||||
if (kdfread(&animategoal[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
||||
if (kdfread(&animatevel[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
||||
|
||||
|
@ -300,27 +300,27 @@ int loadplayer(signed char spot)
|
|||
|
||||
if (kdfread(&i,sizeof(long),1,fil) != 1) goto corrupt;
|
||||
|
||||
while(i != MAXQUOTES)
|
||||
while (i != MAXQUOTES)
|
||||
{
|
||||
if(fta_quotes[i] != NULL)
|
||||
if (fta_quotes[i] != NULL)
|
||||
Bfree(fta_quotes[i]);
|
||||
|
||||
fta_quotes[i] = Bcalloc(MAXQUOTELEN,sizeof(char));
|
||||
|
||||
if(kdfread((char *)fta_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
|
||||
if(kdfread(&i,sizeof(long),1,fil) != 1) goto corrupt;
|
||||
if (kdfread((char *)fta_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&i,sizeof(long),1,fil) != 1) goto corrupt;
|
||||
}
|
||||
|
||||
if (kdfread(&redefined_quote_count,sizeof(redefined_quote_count),1,fil) != 1) goto corrupt;
|
||||
|
||||
for(i=0;i<redefined_quote_count;i++)
|
||||
for (i=0;i<redefined_quote_count;i++)
|
||||
{
|
||||
if(redefined_quotes[i] != NULL)
|
||||
if (redefined_quotes[i] != NULL)
|
||||
Bfree(redefined_quotes[i]);
|
||||
|
||||
redefined_quotes[i] = Bcalloc(MAXQUOTELEN,sizeof(char));
|
||||
|
||||
if(kdfread((char *)redefined_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
|
||||
if (kdfread((char *)redefined_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
|
||||
}
|
||||
|
||||
if (kdfread(&dynamictostatic[0],sizeof(dynamictostatic[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
|
@ -329,11 +329,11 @@ int loadplayer(signed char spot)
|
|||
ud.m_noexits = ud.noexits;
|
||||
|
||||
|
||||
if(ReadGameVars(fil)) goto corrupt;
|
||||
if (ReadGameVars(fil)) goto corrupt;
|
||||
|
||||
kclose(fil);
|
||||
|
||||
if(ps[myconnectindex].over_shoulder_on != 0)
|
||||
if (ps[myconnectindex].over_shoulder_on != 0)
|
||||
{
|
||||
cameradist = 0;
|
||||
cameraclock = 0;
|
||||
|
@ -352,7 +352,7 @@ int loadplayer(signed char spot)
|
|||
ps[myconnectindex].gm = MODE_GAME;
|
||||
ud.recstat = 0;
|
||||
|
||||
if(ps[myconnectindex].jetpack_on)
|
||||
if (ps[myconnectindex].jetpack_on)
|
||||
spritesound(DUKE_JETPACK_IDLE,ps[myconnectindex].i);
|
||||
|
||||
restorepalette = 1;
|
||||
|
@ -361,16 +361,16 @@ int loadplayer(signed char spot)
|
|||
|
||||
FX_SetReverb(0);
|
||||
|
||||
if(ud.lockout == 0)
|
||||
if (ud.lockout == 0)
|
||||
{
|
||||
for(x=0;x<numanimwalls;x++)
|
||||
if( wall[animwall[x].wallnum].extra >= 0 )
|
||||
for (x=0;x<numanimwalls;x++)
|
||||
if ( wall[animwall[x].wallnum].extra >= 0 )
|
||||
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(x=0;x<numanimwalls;x++)
|
||||
switch(dynamictostatic[wall[animwall[x].wallnum].picnum])
|
||||
for (x=0;x<numanimwalls;x++)
|
||||
switch (dynamictostatic[wall[animwall[x].wallnum].picnum])
|
||||
{
|
||||
case FEMPIC1__STATIC:
|
||||
wall[animwall[x].wallnum].picnum = BLANKSCREEN;
|
||||
|
@ -386,9 +386,9 @@ int loadplayer(signed char spot)
|
|||
startofdynamicinterpolations = 0;
|
||||
|
||||
k = headspritestat[3];
|
||||
while(k >= 0)
|
||||
while (k >= 0)
|
||||
{
|
||||
switch(sprite[k].lotag)
|
||||
switch (sprite[k].lotag)
|
||||
{
|
||||
case 31:
|
||||
setinterpolation(§or[sprite[k].sectnum].floorz);
|
||||
|
@ -420,8 +420,8 @@ int loadplayer(signed char spot)
|
|||
k = nextspritestat[k];
|
||||
}
|
||||
|
||||
for(i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
|
||||
for(i = animatecnt-1;i>=0;i--)
|
||||
for (i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
|
||||
for (i = animatecnt-1;i>=0;i--)
|
||||
setinterpolation(animateptr[i]);
|
||||
|
||||
show_shareware = 0;
|
||||
|
@ -458,7 +458,7 @@ int saveplayer(signed char spot)
|
|||
strcpy(fn, "egam0.sav");
|
||||
strcpy(mpfn, "egamA_00.sav");
|
||||
|
||||
if(spot < 0)
|
||||
if (spot < 0)
|
||||
{
|
||||
multiflag = 1;
|
||||
multiwhat = 1;
|
||||
|
@ -468,12 +468,12 @@ int saveplayer(signed char spot)
|
|||
|
||||
waitforeverybody();
|
||||
|
||||
if( multiflag == 2 && multiwho != myconnectindex )
|
||||
if ( multiflag == 2 && multiwho != myconnectindex )
|
||||
{
|
||||
fnptr = mpfn;
|
||||
mpfn[4] = spot + 'A';
|
||||
|
||||
if(ud.multimode > 9)
|
||||
if (ud.multimode > 9)
|
||||
{
|
||||
mpfn[6] = (multiwho/10) + '0';
|
||||
mpfn[7] = multiwho + '0';
|
||||
|
@ -545,9 +545,9 @@ int saveplayer(signed char spot)
|
|||
dfwrite(&cloudx[0],sizeof(short)<<7,1,fil);
|
||||
dfwrite(&cloudy[0],sizeof(short)<<7,1,fil);
|
||||
|
||||
for(i=0;i<MAXSCRIPTSIZE;i++)
|
||||
for (i=0;i<MAXSCRIPTSIZE;i++)
|
||||
{
|
||||
if( (long)script[i] >= (long)(&script[0]) && (long)script[i] < (long)(&script[MAXSCRIPTSIZE]) )
|
||||
if ( (long)script[i] >= (long)(&script[0]) && (long)script[i] < (long)(&script[MAXSCRIPTSIZE]) )
|
||||
{
|
||||
scriptptrs[i] = 1;
|
||||
j = (long)script[i] - (long)&script[0];
|
||||
|
@ -559,61 +559,61 @@ int saveplayer(signed char spot)
|
|||
dfwrite(&scriptptrs[0],1,MAXSCRIPTSIZE,fil);
|
||||
dfwrite(&script[0],4,MAXSCRIPTSIZE,fil);
|
||||
|
||||
for(i=0;i<MAXSCRIPTSIZE;i++)
|
||||
if( scriptptrs[i] )
|
||||
for (i=0;i<MAXSCRIPTSIZE;i++)
|
||||
if ( scriptptrs[i] )
|
||||
{
|
||||
j = script[i]+(long)&script[0];
|
||||
script[i] = j;
|
||||
}
|
||||
|
||||
for(i=0;i<MAXTILES;i++)
|
||||
if(actorscrptr[i])
|
||||
for (i=0;i<MAXTILES;i++)
|
||||
if (actorscrptr[i])
|
||||
{
|
||||
j = (long)actorscrptr[i]-(long)&script[0];
|
||||
actorscrptr[i] = (long *)j;
|
||||
}
|
||||
dfwrite(&actorscrptr[0],4,MAXTILES,fil);
|
||||
for(i=0;i<MAXTILES;i++)
|
||||
if(actorscrptr[i])
|
||||
for (i=0;i<MAXTILES;i++)
|
||||
if (actorscrptr[i])
|
||||
{
|
||||
j = (long)actorscrptr[i]+(long)&script[0];
|
||||
actorscrptr[i] = (long *)j;
|
||||
}
|
||||
|
||||
for(i=0;i<MAXTILES;i++)
|
||||
if(actorLoadEventScrptr[i])
|
||||
for (i=0;i<MAXTILES;i++)
|
||||
if (actorLoadEventScrptr[i])
|
||||
{
|
||||
j = (long)actorLoadEventScrptr[i]-(long)&script[0];
|
||||
actorLoadEventScrptr[i] = (long *)j;
|
||||
}
|
||||
dfwrite(&actorLoadEventScrptr[0],4,MAXTILES,fil);
|
||||
for(i=0;i<MAXTILES;i++)
|
||||
if(actorLoadEventScrptr[i])
|
||||
for (i=0;i<MAXTILES;i++)
|
||||
if (actorLoadEventScrptr[i])
|
||||
{
|
||||
j = (long)actorLoadEventScrptr[i]+(long)&script[0];
|
||||
actorLoadEventScrptr[i] = (long *)j;
|
||||
}
|
||||
|
||||
|
||||
for(i=0;i<MAXSPRITES;i++)
|
||||
for (i=0;i<MAXSPRITES;i++)
|
||||
{
|
||||
scriptptrs[i] = 0;
|
||||
|
||||
if(actorscrptr[PN] == 0) continue;
|
||||
if (actorscrptr[PN] == 0) continue;
|
||||
|
||||
j = (long)&script[0];
|
||||
|
||||
if(T2 >= j && T2 < (long)(&script[MAXSCRIPTSIZE]) )
|
||||
if (T2 >= j && T2 < (long)(&script[MAXSCRIPTSIZE]) )
|
||||
{
|
||||
scriptptrs[i] |= 1;
|
||||
T2 -= j;
|
||||
}
|
||||
if(T5 >= j && T5 < (long)(&script[MAXSCRIPTSIZE]) )
|
||||
if (T5 >= j && T5 < (long)(&script[MAXSCRIPTSIZE]) )
|
||||
{
|
||||
scriptptrs[i] |= 2;
|
||||
T5 -= j;
|
||||
}
|
||||
if(T6 >= j && T6 < (long)(&script[MAXSCRIPTSIZE]) )
|
||||
if (T6 >= j && T6 < (long)(&script[MAXSCRIPTSIZE]) )
|
||||
{
|
||||
scriptptrs[i] |= 4;
|
||||
T6 -= j;
|
||||
|
@ -623,16 +623,16 @@ int saveplayer(signed char spot)
|
|||
dfwrite(&scriptptrs[0],1,MAXSPRITES,fil);
|
||||
dfwrite(&hittype[0],sizeof(struct weaponhit),MAXSPRITES,fil);
|
||||
|
||||
for(i=0;i<MAXSPRITES;i++)
|
||||
for (i=0;i<MAXSPRITES;i++)
|
||||
{
|
||||
if(actorscrptr[PN] == 0) continue;
|
||||
if (actorscrptr[PN] == 0) continue;
|
||||
j = (long)&script[0];
|
||||
|
||||
if(scriptptrs[i]&1)
|
||||
if (scriptptrs[i]&1)
|
||||
T2 += j;
|
||||
if(scriptptrs[i]&2)
|
||||
if (scriptptrs[i]&2)
|
||||
T5 += j;
|
||||
if(scriptptrs[i]&4)
|
||||
if (scriptptrs[i]&4)
|
||||
T6 += j;
|
||||
}
|
||||
|
||||
|
@ -641,9 +641,9 @@ int saveplayer(signed char spot)
|
|||
dfwrite(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil);
|
||||
dfwrite(&animatecnt,sizeof(animatecnt),1,fil);
|
||||
dfwrite(&animatesect[0],2,MAXANIMATES,fil);
|
||||
for(i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]-(long)(§or[0]));
|
||||
for (i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]-(long)(§or[0]));
|
||||
dfwrite(&animateptr[0],4,MAXANIMATES,fil);
|
||||
for(i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0]));
|
||||
for (i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0]));
|
||||
dfwrite(&animategoal[0],4,MAXANIMATES,fil);
|
||||
dfwrite(&animatevel[0],4,MAXANIMATES,fil);
|
||||
|
||||
|
@ -681,9 +681,9 @@ int saveplayer(signed char spot)
|
|||
|
||||
dfwrite(&spritecache[0],sizeof(spritecache[0]),MAXTILES,fil);
|
||||
|
||||
for(i=0;i<MAXQUOTES;i++)
|
||||
for (i=0;i<MAXQUOTES;i++)
|
||||
{
|
||||
if(fta_quotes[i] != NULL)
|
||||
if (fta_quotes[i] != NULL)
|
||||
{
|
||||
dfwrite(&i,sizeof(long),1,fil);
|
||||
dfwrite(fta_quotes[i],MAXQUOTELEN, 1, fil);
|
||||
|
@ -692,9 +692,9 @@ int saveplayer(signed char spot)
|
|||
dfwrite(&i,sizeof(long),1,fil);
|
||||
|
||||
dfwrite(&redefined_quote_count,sizeof(redefined_quote_count),1,fil);
|
||||
for(i=0;i<redefined_quote_count;i++)
|
||||
for (i=0;i<redefined_quote_count;i++)
|
||||
{
|
||||
if(redefined_quotes[i] != NULL)
|
||||
if (redefined_quotes[i] != NULL)
|
||||
dfwrite(redefined_quotes[i],MAXQUOTELEN, 1, fil);
|
||||
}
|
||||
|
||||
|
@ -706,7 +706,7 @@ int saveplayer(signed char spot)
|
|||
|
||||
fclose(fil);
|
||||
|
||||
if(ud.multimode < 2)
|
||||
if (ud.multimode < 2)
|
||||
{
|
||||
strcpy(fta_quotes[122],"GAME SAVED");
|
||||
FTA(122,&ps[myconnectindex]);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -203,15 +203,15 @@ void playmusic(char *fn)
|
|||
short fp;
|
||||
long l;
|
||||
|
||||
if(MusicToggle == 0) return;
|
||||
if(MusicDevice < 0) return;
|
||||
if (MusicToggle == 0) return;
|
||||
if (MusicDevice < 0) return;
|
||||
|
||||
fp = kopen4load(fn,0);
|
||||
|
||||
if(fp == -1) return;
|
||||
if (fp == -1) return;
|
||||
|
||||
l = kfilelength( fp );
|
||||
if(l >= (signed long)sizeof(MusicPtr))
|
||||
if (l >= (signed long)sizeof(MusicPtr))
|
||||
{
|
||||
kclose(fp);
|
||||
return;
|
||||
|
@ -226,11 +226,11 @@ char loadsound(unsigned short num)
|
|||
{
|
||||
long fp, l;
|
||||
|
||||
if(num >= NUM_SOUNDS || SoundToggle == 0) return 0;
|
||||
if (num >= NUM_SOUNDS || SoundToggle == 0) return 0;
|
||||
if (FXDevice < 0) return 0;
|
||||
|
||||
fp = kopen4load(sounds[num],loadfromgrouponly);
|
||||
if(fp == -1)
|
||||
if (fp == -1)
|
||||
{
|
||||
// Bsprintf(fta_quotes[113],"Sound %s(#%d) not found.",sounds[num],num);
|
||||
// FTA(113,&ps[myconnectindex]);
|
||||
|
@ -257,7 +257,7 @@ int xyzsound(short num,short i,long x,long y,long z)
|
|||
|
||||
// if(num != 358) return 0;
|
||||
|
||||
if( num >= NUM_SOUNDS ||
|
||||
if ( num >= NUM_SOUNDS ||
|
||||
FXDevice < 0 ||
|
||||
( (soundm[num]&8) && ud.lockout ) ||
|
||||
SoundToggle == 0 ||
|
||||
|
@ -266,21 +266,21 @@ int xyzsound(short num,short i,long x,long y,long z)
|
|||
(ps[myconnectindex].timebeforeexit > 0 && ps[myconnectindex].timebeforeexit <= 26*3) ||
|
||||
ps[myconnectindex].gm&MODE_MENU) return -1;
|
||||
|
||||
if( soundm[num]&128 )
|
||||
if ( soundm[num]&128 )
|
||||
{
|
||||
sound(num);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( soundm[num]&4 )
|
||||
if ( soundm[num]&4 )
|
||||
{
|
||||
if(VoiceToggle==0)
|
||||
if (VoiceToggle==0)
|
||||
return -1;
|
||||
else if (ud.multimode > 1 && PN == APLAYER && sprite[i].yvel != screenpeek && VoiceToggle!=2)
|
||||
return -1;
|
||||
for(j=0;j<NUM_SOUNDS;j++)
|
||||
for(k=0;k<Sound[j].num;k++)
|
||||
if( (Sound[j].num > 0) && (soundm[j]&4) )
|
||||
for (j=0;j<NUM_SOUNDS;j++)
|
||||
for (k=0;k<Sound[j].num;k++)
|
||||
if ( (Sound[j].num > 0) && (soundm[j]&4) )
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -292,54 +292,54 @@ int xyzsound(short num,short i,long x,long y,long z)
|
|||
|
||||
sndist = FindDistance3D((cx-x),(cy-y),(cz-z)>>4);
|
||||
|
||||
if( i >= 0 && (soundm[num]&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9 )
|
||||
if ( i >= 0 && (soundm[num]&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9 )
|
||||
sndist = divscale14(sndist,(SHT+1));
|
||||
|
||||
pitchs = soundps[num];
|
||||
pitche = soundpe[num];
|
||||
cx = klabs(pitche-pitchs);
|
||||
|
||||
if(cx)
|
||||
if (cx)
|
||||
{
|
||||
if( pitchs < pitche )
|
||||
if ( pitchs < pitche )
|
||||
pitch = pitchs + ( rand()%cx );
|
||||
else pitch = pitche + ( rand()%cx );
|
||||
}
|
||||
else pitch = pitchs;
|
||||
|
||||
sndist += soundvo[num];
|
||||
if(sndist < 0) sndist = 0;
|
||||
if( sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,SX,SY,SZ-(24<<8),SECT) )
|
||||
if (sndist < 0) sndist = 0;
|
||||
if ( sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,SX,SY,SZ-(24<<8),SECT) )
|
||||
sndist += sndist>>5;
|
||||
|
||||
switch(num)
|
||||
switch (num)
|
||||
{
|
||||
case PIPEBOMB_EXPLODE:
|
||||
case LASERTRIP_EXPLODE:
|
||||
case RPG_EXPLODE:
|
||||
if(sndist > (6144) )
|
||||
if (sndist > (6144) )
|
||||
sndist = 6144;
|
||||
if(sector[ps[screenpeek].cursectnum].lotag == 2)
|
||||
if (sector[ps[screenpeek].cursectnum].lotag == 2)
|
||||
pitch -= 1024;
|
||||
break;
|
||||
default:
|
||||
if(sector[ps[screenpeek].cursectnum].lotag == 2 && (soundm[num]&4) == 0)
|
||||
if (sector[ps[screenpeek].cursectnum].lotag == 2 && (soundm[num]&4) == 0)
|
||||
pitch = -768;
|
||||
if( sndist > 31444 && PN != MUSICANDSFX)
|
||||
if ( sndist > 31444 && PN != MUSICANDSFX)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ps[screenpeek].sound_pitch) pitch += ps[screenpeek].sound_pitch;
|
||||
|
||||
if( Sound[num].num > 0 && PN != MUSICANDSFX )
|
||||
if ( Sound[num].num > 0 && PN != MUSICANDSFX )
|
||||
{
|
||||
if( SoundOwner[num][0].i == i ) stopsound(num);
|
||||
else if( Sound[num].num > 1 ) stopsound(num);
|
||||
else if( badguy(&sprite[i]) && sprite[i].extra <= 0 ) stopsound(num);
|
||||
if ( SoundOwner[num][0].i == i ) stopsound(num);
|
||||
else if ( Sound[num].num > 1 ) stopsound(num);
|
||||
else if ( badguy(&sprite[i]) && sprite[i].extra <= 0 ) stopsound(num);
|
||||
}
|
||||
|
||||
if( PN == APLAYER && sprite[i].yvel == screenpeek )
|
||||
if ( PN == APLAYER && sprite[i].yvel == screenpeek )
|
||||
{
|
||||
sndang = 0;
|
||||
sndist = 0;
|
||||
|
@ -350,7 +350,7 @@ int xyzsound(short num,short i,long x,long y,long z)
|
|||
sndang &= 2047;
|
||||
}
|
||||
|
||||
if(Sound[num].ptr == 0) { if( loadsound(num) == 0 ) return 0; }
|
||||
if (Sound[num].ptr == 0) { if ( loadsound(num) == 0 ) return 0; }
|
||||
else
|
||||
{
|
||||
if (Sound[num].lock < 200)
|
||||
|
@ -358,20 +358,20 @@ int xyzsound(short num,short i,long x,long y,long z)
|
|||
else Sound[num].lock++;
|
||||
}
|
||||
|
||||
if( soundm[num]&16 ) sndist = 0;
|
||||
if ( soundm[num]&16 ) sndist = 0;
|
||||
|
||||
if(sndist < ((255-LOUDESTVOLUME)<<6) )
|
||||
if (sndist < ((255-LOUDESTVOLUME)<<6) )
|
||||
sndist = ((255-LOUDESTVOLUME)<<6);
|
||||
|
||||
if( soundm[num]&1 )
|
||||
if ( soundm[num]&1 )
|
||||
{
|
||||
unsigned short start;
|
||||
|
||||
if(Sound[num].num > 0) return -1;
|
||||
if (Sound[num].num > 0) return -1;
|
||||
|
||||
start = *(unsigned short *)(Sound[num].ptr + 0x14);
|
||||
|
||||
if(*Sound[num].ptr == 'C')
|
||||
if (*Sound[num].ptr == 'C')
|
||||
voice = FX_PlayLoopedVOC( Sound[num].ptr, start, start + soundsiz[num],
|
||||
pitch,sndist>>6,sndist>>6,0,soundpr[num],num);
|
||||
else
|
||||
|
@ -380,7 +380,7 @@ int xyzsound(short num,short i,long x,long y,long z)
|
|||
}
|
||||
else
|
||||
{
|
||||
if( *Sound[num].ptr == 'C')
|
||||
if ( *Sound[num].ptr == 'C')
|
||||
voice = FX_PlayVOC3D( Sound[ num ].ptr,pitch,sndang>>6,sndist>>6, soundpr[num], num );
|
||||
else
|
||||
voice = FX_PlayWAV3D( Sound[ num ].ptr,pitch,sndang>>6,sndist>>6, soundpr[num], num );
|
||||
|
@ -403,24 +403,24 @@ void sound(short num)
|
|||
long start;
|
||||
|
||||
if (FXDevice < 0) return;
|
||||
if(SoundToggle==0) return;
|
||||
if(VoiceToggle==0 && (soundm[num]&4) ) return;
|
||||
if( (soundm[num]&8) && ud.lockout ) return;
|
||||
if(FX_VoiceAvailable(soundpr[num]) == 0) return;
|
||||
if (SoundToggle==0) return;
|
||||
if (VoiceToggle==0 && (soundm[num]&4) ) return;
|
||||
if ( (soundm[num]&8) && ud.lockout ) return;
|
||||
if (FX_VoiceAvailable(soundpr[num]) == 0) return;
|
||||
|
||||
pitchs = soundps[num];
|
||||
pitche = soundpe[num];
|
||||
cx = klabs(pitche-pitchs);
|
||||
|
||||
if(cx)
|
||||
if (cx)
|
||||
{
|
||||
if( pitchs < pitche )
|
||||
if ( pitchs < pitche )
|
||||
pitch = pitchs + ( rand()%cx );
|
||||
else pitch = pitche + ( rand()%cx );
|
||||
}
|
||||
else pitch = pitchs;
|
||||
|
||||
if(Sound[num].ptr == 0) { if( loadsound(num) == 0 ) return; }
|
||||
if (Sound[num].ptr == 0) { if ( loadsound(num) == 0 ) return; }
|
||||
else
|
||||
{
|
||||
if (Sound[num].lock < 200)
|
||||
|
@ -428,9 +428,9 @@ if(Sound[num].ptr == 0) { if( loadsound(num) == 0 ) return; }
|
|||
else Sound[num].lock++;
|
||||
}
|
||||
|
||||
if( soundm[num]&1 )
|
||||
if ( soundm[num]&1 )
|
||||
{
|
||||
if(*Sound[num].ptr == 'C')
|
||||
if (*Sound[num].ptr == 'C')
|
||||
{
|
||||
start = (long)*(unsigned short *)(Sound[num].ptr + 0x14);
|
||||
voice = FX_PlayLoopedVOC( Sound[num].ptr, start, start + soundsiz[num],
|
||||
|
@ -445,19 +445,19 @@ if(Sound[num].ptr == 0) { if( loadsound(num) == 0 ) return; }
|
|||
}
|
||||
else
|
||||
{
|
||||
if(*Sound[num].ptr == 'C')
|
||||
if (*Sound[num].ptr == 'C')
|
||||
voice = FX_PlayVOC3D( Sound[ num ].ptr, pitch,0,255-LOUDESTVOLUME,soundpr[num], num );
|
||||
else
|
||||
voice = FX_PlayWAV3D( Sound[ num ].ptr, pitch,0,255-LOUDESTVOLUME,soundpr[num], num );
|
||||
}
|
||||
|
||||
if(voice > FX_Ok) return;
|
||||
if (voice > FX_Ok) return;
|
||||
Sound[num].lock--;
|
||||
}
|
||||
|
||||
int spritesound(unsigned short num, short i)
|
||||
{
|
||||
if(num >= NUM_SOUNDS) return -1;
|
||||
if (num >= NUM_SOUNDS) return -1;
|
||||
return xyzsound(num,i,SX,SY,SZ);
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ void stopspritesound(short num, short i)
|
|||
|
||||
void stopsound(short num)
|
||||
{
|
||||
if(Sound[num].num > 0)
|
||||
if (Sound[num].num > 0)
|
||||
{
|
||||
FX_StopSound(SoundOwner[num][Sound[num].num-1].voice);
|
||||
testcallback(num);
|
||||
|
@ -479,11 +479,11 @@ void stopenvsound(short num,short i)
|
|||
{
|
||||
short j, k;
|
||||
|
||||
if(Sound[num].num > 0)
|
||||
if (Sound[num].num > 0)
|
||||
{
|
||||
k = Sound[num].num;
|
||||
for(j=0;j<k;j++)
|
||||
if(SoundOwner[num][j].i == i)
|
||||
for (j=0;j<k;j++)
|
||||
if (SoundOwner[num][j].i == i)
|
||||
{
|
||||
FX_StopSound(SoundOwner[num][j].voice);
|
||||
break;
|
||||
|
@ -498,7 +498,7 @@ void pan3dsound(void)
|
|||
|
||||
numenvsnds = 0;
|
||||
|
||||
if(ud.camerasprite == -1)
|
||||
if (ud.camerasprite == -1)
|
||||
{
|
||||
cx = ps[screenpeek].oposx;
|
||||
cy = ps[screenpeek].oposy;
|
||||
|
@ -515,7 +515,7 @@ void pan3dsound(void)
|
|||
ca = sprite[ud.camerasprite].ang;
|
||||
}
|
||||
|
||||
for(j=0;j<NUM_SOUNDS;j++) for(k=0;k<Sound[j].num;k++)
|
||||
for (j=0;j<NUM_SOUNDS;j++) for (k=0;k<Sound[j].num;k++)
|
||||
{
|
||||
i = SoundOwner[j][k].i;
|
||||
|
||||
|
@ -523,7 +523,7 @@ void pan3dsound(void)
|
|||
sy = sprite[i].y;
|
||||
sz = sprite[i].z;
|
||||
|
||||
if( PN == APLAYER && sprite[i].yvel == screenpeek)
|
||||
if ( PN == APLAYER && sprite[i].yvel == screenpeek)
|
||||
{
|
||||
sndang = 0;
|
||||
sndist = 0;
|
||||
|
@ -533,38 +533,38 @@ void pan3dsound(void)
|
|||
sndang = 2048 + ca - getangle(cx-sx,cy-sy);
|
||||
sndang &= 2047;
|
||||
sndist = FindDistance3D((cx-sx),(cy-sy),(cz-sz)>>4);
|
||||
if( i >= 0 && (soundm[j]&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9 )
|
||||
if ( i >= 0 && (soundm[j]&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9 )
|
||||
sndist = divscale14(sndist,(SHT+1));
|
||||
}
|
||||
|
||||
sndist += soundvo[j];
|
||||
if(sndist < 0) sndist = 0;
|
||||
if (sndist < 0) sndist = 0;
|
||||
|
||||
if( sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,sx,sy,sz-(24<<8),SECT) )
|
||||
if ( sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,sx,sy,sz-(24<<8),SECT) )
|
||||
sndist += sndist>>5;
|
||||
|
||||
if(PN == MUSICANDSFX && SLT < 999)
|
||||
if (PN == MUSICANDSFX && SLT < 999)
|
||||
numenvsnds++;
|
||||
|
||||
switch(j)
|
||||
switch (j)
|
||||
{
|
||||
case PIPEBOMB_EXPLODE:
|
||||
case LASERTRIP_EXPLODE:
|
||||
case RPG_EXPLODE:
|
||||
if(sndist > (6144)) sndist = (6144);
|
||||
if (sndist > (6144)) sndist = (6144);
|
||||
break;
|
||||
default:
|
||||
if( sndist > 31444 && PN != MUSICANDSFX)
|
||||
if ( sndist > 31444 && PN != MUSICANDSFX)
|
||||
{
|
||||
stopsound(j);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(Sound[j].ptr == 0 && loadsound(j) == 0 ) continue;
|
||||
if( soundm[j]&16 ) sndist = 0;
|
||||
if (Sound[j].ptr == 0 && loadsound(j) == 0 ) continue;
|
||||
if ( soundm[j]&16 ) sndist = 0;
|
||||
|
||||
if(sndist < ((255-LOUDESTVOLUME)<<6) )
|
||||
if (sndist < ((255-LOUDESTVOLUME)<<6) )
|
||||
sndist = ((255-LOUDESTVOLUME)<<6);
|
||||
|
||||
FX_Pan3D(SoundOwner[j][k].voice,sndang>>6,sndist>>6);
|
||||
|
@ -575,25 +575,25 @@ void testcallback(unsigned long num)
|
|||
{
|
||||
short tempi,tempj,tempk;
|
||||
|
||||
if((long)num < 0)
|
||||
if ((long)num < 0)
|
||||
{
|
||||
if(lumplockbyte[-num] >= 200)
|
||||
if (lumplockbyte[-num] >= 200)
|
||||
lumplockbyte[-num]--;
|
||||
return;
|
||||
}
|
||||
|
||||
tempk = Sound[num].num;
|
||||
|
||||
if(tempk > 0)
|
||||
if (tempk > 0)
|
||||
{
|
||||
if( (soundm[num]&16) == 0)
|
||||
for(tempj=0;tempj<tempk;tempj++)
|
||||
if ( (soundm[num]&16) == 0)
|
||||
for (tempj=0;tempj<tempk;tempj++)
|
||||
{
|
||||
tempi = SoundOwner[num][tempj].i;
|
||||
if(sprite[tempi].picnum == MUSICANDSFX && sector[sprite[tempi].sectnum].lotag < 3 && sprite[tempi].lotag < 999)
|
||||
if (sprite[tempi].picnum == MUSICANDSFX && sector[sprite[tempi].sectnum].lotag < 3 && sprite[tempi].lotag < 999)
|
||||
{
|
||||
hittype[tempi].temp_data[0] = 0;
|
||||
if( (tempj + 1) < tempk )
|
||||
if ( (tempj + 1) < tempk )
|
||||
{
|
||||
SoundOwner[num][tempj].voice = SoundOwner[num][tempk-1].voice;
|
||||
SoundOwner[num][tempj].i = SoundOwner[num][tempk-1].i;
|
||||
|
@ -613,12 +613,12 @@ void clearsoundlocks(void)
|
|||
{
|
||||
long i;
|
||||
|
||||
for(i=0;i<NUM_SOUNDS;i++)
|
||||
if(Sound[i].lock >= 200)
|
||||
for (i=0;i<NUM_SOUNDS;i++)
|
||||
if (Sound[i].lock >= 200)
|
||||
Sound[i].lock = 199;
|
||||
|
||||
for(i=0;i<11;i++)
|
||||
if(lumplockbyte[i] >= 200)
|
||||
for (i=0;i<11;i++)
|
||||
if (lumplockbyte[i] >= 200)
|
||||
lumplockbyte[i] = 199;
|
||||
}
|
||||
|
||||
|
@ -630,8 +630,8 @@ int isspritemakingsound(short i, int num)
|
|||
|
||||
int issoundplaying(short i, int num)
|
||||
{
|
||||
if(i == -1) {
|
||||
if(Sound[num].lock == 200)
|
||||
if (i == -1) {
|
||||
if (Sound[num].lock == 200)
|
||||
return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
|
|
@ -157,10 +157,12 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
case IDCINPUTJOY:
|
||||
settings.usejoy = IsDlgButtonChecked(hwndDlg, IDCINPUTJOY) == BST_CHECKED;
|
||||
return TRUE;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -171,20 +173,22 @@ static INT_PTR CALLBACK GamePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
|
|||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDGDATA: {
|
||||
int i;
|
||||
if (HIWORD(wParam) != LBN_SELCHANGE) break;
|
||||
i = ListBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ListBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR) {
|
||||
strcpy(settings.selectedgrp, ((struct grpfile*)i)->name);
|
||||
settings.game = ((struct grpfile*)i)->game;
|
||||
}
|
||||
return TRUE;
|
||||
int i;
|
||||
if (HIWORD(wParam) != LBN_SELCHANGE) break;
|
||||
i = ListBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ListBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR) {
|
||||
strcpy(settings.selectedgrp, ((struct grpfile*)i)->name);
|
||||
settings.game = ((struct grpfile*)i)->game;
|
||||
}
|
||||
default: break;
|
||||
return TRUE;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -224,137 +228,137 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG: {
|
||||
HWND hwnd;
|
||||
RECT r, rdlg, chrome, rtab, rcancel, rstart;
|
||||
int xoffset = 0, yoffset = 0;
|
||||
HWND hwnd;
|
||||
RECT r, rdlg, chrome, rtab, rcancel, rstart;
|
||||
int xoffset = 0, yoffset = 0;
|
||||
|
||||
// Fetch the positions (in screen coordinates) of all the windows we need to tweak
|
||||
ZeroMemory(&chrome, sizeof(chrome));
|
||||
AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
|
||||
GetWindowRect(hwndDlg, &rdlg);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
// Fetch the positions (in screen coordinates) of all the windows we need to tweak
|
||||
ZeroMemory(&chrome, sizeof(chrome));
|
||||
AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
|
||||
GetWindowRect(hwndDlg, &rdlg);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
|
||||
// Knock off the non-client area of the main dialogue to give just the client area
|
||||
rdlg.left -= chrome.left; rdlg.top -= chrome.top;
|
||||
rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom;
|
||||
// Knock off the non-client area of the main dialogue to give just the client area
|
||||
rdlg.left -= chrome.left; rdlg.top -= chrome.top;
|
||||
rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom;
|
||||
|
||||
// Translate them to client-relative coordinates wrt the main dialogue window
|
||||
rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1;
|
||||
rtab.left -= rdlg.left; rtab.top -= rdlg.top;
|
||||
// Translate them to client-relative coordinates wrt the main dialogue window
|
||||
rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1;
|
||||
rtab.left -= rdlg.left; rtab.top -= rdlg.top;
|
||||
|
||||
rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1;
|
||||
rcancel.left -= rdlg.left; rcancel.top -= rdlg.top;
|
||||
rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1;
|
||||
rcancel.left -= rdlg.left; rcancel.top -= rdlg.top;
|
||||
|
||||
rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1;
|
||||
rstart.left -= rdlg.left; rstart.top -= rdlg.top;
|
||||
rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1;
|
||||
rstart.left -= rdlg.left; rstart.top -= rdlg.top;
|
||||
|
||||
// And then convert the main dialogue coordinates to just width/length
|
||||
rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1;
|
||||
rdlg.left = 0; rdlg.top = 0;
|
||||
// And then convert the main dialogue coordinates to just width/length
|
||||
rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1;
|
||||
rdlg.left = 0; rdlg.top = 0;
|
||||
|
||||
// Load the bitmap into the bitmap control and fetch its dimensions
|
||||
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
|
||||
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
|
||||
// Load the bitmap into the bitmap control and fetch its dimensions
|
||||
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
|
||||
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
|
||||
GetClientRect(hwnd, &r);
|
||||
xoffset = r.right;
|
||||
yoffset = r.bottom - rdlg.bottom;
|
||||
|
||||
// Shift and resize the controls that require it
|
||||
rtab.left += xoffset; rtab.bottom += yoffset;
|
||||
rcancel.left += xoffset; rcancel.top += yoffset;
|
||||
rstart.left += xoffset; rstart.top += yoffset;
|
||||
rdlg.right += xoffset;
|
||||
rdlg.bottom += yoffset;
|
||||
|
||||
// Move the controls to their new positions
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
|
||||
|
||||
// Move the main dialogue to the centre of the screen
|
||||
hdc = GetDC(NULL);
|
||||
rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
|
||||
rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
|
||||
ReleaseDC(NULL, hdc);
|
||||
MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left,
|
||||
rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE);
|
||||
|
||||
// Add tabs to the tab control
|
||||
{
|
||||
TCITEM tab;
|
||||
|
||||
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
|
||||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Configuration");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Game");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_GAME, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Messages");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
GetClientRect(hwnd, &r);
|
||||
xoffset = r.right;
|
||||
yoffset = r.bottom - rdlg.bottom;
|
||||
SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
|
||||
r.right -= r.left-1;
|
||||
r.bottom -= r.top-1;
|
||||
r.top += rtab.top;
|
||||
r.left += rtab.left;
|
||||
|
||||
// Shift and resize the controls that require it
|
||||
rtab.left += xoffset; rtab.bottom += yoffset;
|
||||
rcancel.left += xoffset; rcancel.top += yoffset;
|
||||
rstart.left += xoffset; rstart.top += yoffset;
|
||||
rdlg.right += xoffset;
|
||||
rdlg.bottom += yoffset;
|
||||
// Create the pages and position them in the tab control, but hide them
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
pages[TAB_GAME] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_GAME), hwndDlg, GamePageProc);
|
||||
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_GAME], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
|
||||
// Move the controls to their new positions
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
|
||||
// Tell the editfield acting as the console to exclude the width of the scrollbar
|
||||
GetClientRect(pages[TAB_MESSAGES],&r);
|
||||
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
|
||||
r.left = r.top = 0;
|
||||
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
|
||||
|
||||
// Move the main dialogue to the centre of the screen
|
||||
hdc = GetDC(NULL);
|
||||
rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
|
||||
rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
|
||||
ReleaseDC(NULL, hdc);
|
||||
MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left,
|
||||
rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE);
|
||||
|
||||
// Add tabs to the tab control
|
||||
// Set a tab stop in the game data listbox
|
||||
{
|
||||
TCITEM tab;
|
||||
|
||||
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
|
||||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Configuration");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Game");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_GAME, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Messages");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
GetClientRect(hwnd, &r);
|
||||
SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
|
||||
r.right -= r.left-1;
|
||||
r.bottom -= r.top-1;
|
||||
r.top += rtab.top;
|
||||
r.left += rtab.left;
|
||||
|
||||
// Create the pages and position them in the tab control, but hide them
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
pages[TAB_GAME] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_GAME), hwndDlg, GamePageProc);
|
||||
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_GAME], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
|
||||
// Tell the editfield acting as the console to exclude the width of the scrollbar
|
||||
GetClientRect(pages[TAB_MESSAGES],&r);
|
||||
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
|
||||
r.left = r.top = 0;
|
||||
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
|
||||
|
||||
// Set a tab stop in the game data listbox
|
||||
{
|
||||
DWORD tabs[1] = { 150 };
|
||||
ListBox_SetTabStops(GetDlgItem(pages[TAB_GAME], IDGDATA), 1, tabs);
|
||||
}
|
||||
|
||||
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
|
||||
SetWindowText(hwndDlg, apptitle);
|
||||
DWORD tabs[1] = { 150 };
|
||||
ListBox_SetTabStops(GetDlgItem(pages[TAB_GAME], IDGDATA), 1, tabs);
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
|
||||
SetWindowText(hwndDlg, apptitle);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY: {
|
||||
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||
int cur;
|
||||
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
|
||||
cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
switch (nmhdr->code) {
|
||||
case TCN_SELCHANGING: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGE: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||
int cur;
|
||||
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
|
||||
cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
switch (nmhdr->code) {
|
||||
case TCN_SELCHANGING: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGE: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CLOSE:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
|
@ -386,7 +390,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
case WIN_STARTWIN_START: done = 1; return TRUE;
|
||||
case WIN_STARTWIN_START:
|
||||
done = 1; return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
|
@ -395,7 +400,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
return (BOOL)GetSysColorBrush(COLOR_WINDOW);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -519,8 +525,10 @@ int startwin_run(void)
|
|||
|
||||
while (done < 0) {
|
||||
switch (GetMessage(&msg, NULL, 0,0)) {
|
||||
case 0: done = 1; break;
|
||||
case -1: return -1;
|
||||
case 0:
|
||||
done = 1; break;
|
||||
case -1:
|
||||
return -1;
|
||||
default:
|
||||
if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break;
|
||||
TranslateMessage(&msg);
|
||||
|
|
|
@ -20,14 +20,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
|
|||
strcpy(sCmdLine,lpCmdLine);
|
||||
szFileName[0] = '\0';
|
||||
|
||||
while(sCmdLine[i] == ' ') i++;
|
||||
while(i < (signed)strlen(sCmdLine))
|
||||
while (sCmdLine[i] == ' ') i++;
|
||||
while (i < (signed)strlen(sCmdLine))
|
||||
{
|
||||
if(sCmdLine[i] == '-' && sCmdLine[i+1] == 'n' && sCmdLine[i+2] == 'e' && sCmdLine[i+3] == 't')
|
||||
if (sCmdLine[i] == '-' && sCmdLine[i+1] == 'n' && sCmdLine[i+2] == 'e' && sCmdLine[i+3] == 't')
|
||||
{
|
||||
CmdLine[i-1] = '\0';
|
||||
i += 5;
|
||||
while(sCmdLine[i] != ' ' && i < (signed)strlen(sCmdLine))
|
||||
while (sCmdLine[i] != ' ' && i < (signed)strlen(sCmdLine))
|
||||
{
|
||||
szFileName[j] = sCmdLine[i];
|
||||
j++,i++;
|
||||
|
@ -40,8 +40,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
|
|||
CmdLine[i] = '\0';
|
||||
}
|
||||
|
||||
if(szFileName[0] != '\0' && CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s -rmnet %s",CmdLine,szFileName);
|
||||
else if(CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s",CmdLine);
|
||||
if (szFileName[0] != '\0' && CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s -rmnet %s",CmdLine,szFileName);
|
||||
else if (CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s",CmdLine);
|
||||
else sprintf(sCmdLine,"eduke32.exe");
|
||||
|
||||
szCmdLine = sCmdLine;
|
||||
|
|
Loading…
Reference in a new issue