Whitespace

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

View file

@ -25,268 +25,268 @@ static long bpl, transmode = 0;
static long glogx, glogy, gbxinc, gbyinc, gpinc; static long glogx, glogy, gbxinc, gbyinc, gpinc;
static char *gbuf, *gpal, *ghlinepal, *gtrans; static char *gbuf, *gpal, *ghlinepal, *gtrans;
//Global variable functions //Global variable functions
void setvlinebpl(long dabpl) { bpl = dabpl; } void setvlinebpl(long dabpl) { bpl = dabpl; }
void fixtransluscence(long datransoff) { gtrans = (char *)datransoff; } void fixtransluscence(long datransoff) { gtrans = (char *)datransoff; }
void settransnormal(void) { transmode = 0; } void settransnormal(void) { transmode = 0; }
void settransreverse(void) { transmode = 1; } void settransreverse(void) { transmode = 1; }
//Ceiling/floor horizontal line functions //Ceiling/floor horizontal line functions
void sethlinesizes(long logx, long logy, long bufplc) void sethlinesizes(long logx, long logy, long bufplc)
{ glogx = logx; glogy = logy; gbuf = (char *)bufplc; } { glogx = logx; glogy = logy; gbuf = (char *)bufplc; }
void setpalookupaddress(char *paladdr) { ghlinepal = paladdr; } void setpalookupaddress(char *paladdr) { ghlinepal = paladdr; }
void setuphlineasm4(long bxinc, long byinc) { gbxinc = bxinc; gbyinc = byinc; } void setuphlineasm4(long bxinc, long byinc) { gbxinc = bxinc; gbyinc = byinc; }
void hlineasm4(long cnt, long skiploadincs, long paloffs, unsigned long by, unsigned long bx, long p) void hlineasm4(long cnt, long skiploadincs, long paloffs, unsigned long by, unsigned long bx, long p)
{ {
char *palptr; char *palptr;
palptr = (char *)&ghlinepal[paloffs]; palptr = (char *)&ghlinepal[paloffs];
if (!skiploadincs) { gbxinc = asm1; gbyinc = asm2; } 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))]]; *((char *)p) = palptr[gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))]];
bx -= gbxinc; bx -= gbxinc;
by -= gbyinc; by -= gbyinc;
p--; p--;
} }
} }
//Sloped ceiling/floor vertical line functions //Sloped ceiling/floor vertical line functions
void setupslopevlin(long logylogx, long bufplc, long pinc) void setupslopevlin(long logylogx, long bufplc, long pinc)
{ {
glogx = (logylogx&255); glogy = (logylogx>>8); glogx = (logylogx&255); glogy = (logylogx>>8);
gbuf = (char *)bufplc; gpinc = pinc; gbuf = (char *)bufplc; gpinc = pinc;
} }
void slopevlin(long p, long i, long slopaloffs, long cnt, long bx, long by) void slopevlin(long p, long i, long slopaloffs, long cnt, long bx, long by)
{ {
long *slopalptr, bz, bzinc; long *slopalptr, bz, bzinc;
unsigned long u, v; unsigned long u, v;
bz = asm3; bzinc = (asm1>>3); bz = asm3; bzinc = (asm1>>3);
slopalptr = (long *)slopaloffs; slopalptr = (long *)slopaloffs;
for(;cnt>0;cnt--) for(;cnt>0;cnt--)
{ {
i = krecip(bz>>6); bz += bzinc; i = krecip(bz>>6); bz += bzinc;
u = bx+globalx3*i; u = bx+globalx3*i;
v = by+globaly3*i; v = by+globaly3*i;
(*(char *)p) = *(char *)(slopalptr[0]+gbuf[((u>>(32-glogx))<<glogy)+(v>>(32-glogy))]); (*(char *)p) = *(char *)(slopalptr[0]+gbuf[((u>>(32-glogx))<<glogy)+(v>>(32-glogy))]);
slopalptr--; slopalptr--;
p += gpinc; p += gpinc;
} }
} }
//Wall,face sprite/wall sprite vertical line functions //Wall,face sprite/wall sprite vertical line functions
void setupvlineasm(long neglogy) { glogy = neglogy; } void setupvlineasm(long neglogy) { glogy = neglogy; }
void vlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p) void vlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p)
{ {
gbuf = (char *)bufplc; gbuf = (char *)bufplc;
gpal = (char *)paloffs; gpal = (char *)paloffs;
for(;cnt>=0;cnt--) for(;cnt>=0;cnt--)
{ {
*((char *)p) = gpal[gbuf[vplc>>glogy]]; *((char *)p) = gpal[gbuf[vplc>>glogy]];
p += bpl; p += bpl;
vplc += vinc; vplc += vinc;
} }
} }
void setupmvlineasm(long neglogy) { glogy = neglogy; } void setupmvlineasm(long neglogy) { glogy = neglogy; }
void mvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p) void mvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p)
{ {
char ch; char ch;
gbuf = (char *)bufplc; gbuf = (char *)bufplc;
gpal = (char *)paloffs; gpal = (char *)paloffs;
for(;cnt>=0;cnt--) for(;cnt>=0;cnt--)
{ {
ch = gbuf[vplc>>glogy]; if (ch != 255) *((char *)p) = gpal[ch]; ch = gbuf[vplc>>glogy]; if (ch != 255) *((char *)p) = gpal[ch];
p += bpl; p += bpl;
vplc += vinc; vplc += vinc;
} }
} }
void setuptvlineasm(long neglogy) { glogy = neglogy; } void setuptvlineasm(long neglogy) { glogy = neglogy; }
void tvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p) void tvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p)
{ {
char ch; char ch;
gbuf = (char *)bufplc; gbuf = (char *)bufplc;
gpal = (char *)paloffs; gpal = (char *)paloffs;
if (transmode) if (transmode)
{ {
for(;cnt>=0;cnt--) for(;cnt>=0;cnt--)
{ {
ch = gbuf[vplc>>glogy]; ch = gbuf[vplc>>glogy];
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)]; if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
p += bpl; p += bpl;
vplc += vinc; vplc += vinc;
} }
} }
else else
{ {
for(;cnt>=0;cnt--) for(;cnt>=0;cnt--)
{ {
ch = gbuf[vplc>>glogy]; ch = gbuf[vplc>>glogy];
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]]; if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
p += bpl; p += bpl;
vplc += vinc; vplc += vinc;
} }
} }
} }
//Floor sprite horizontal line functions //Floor sprite horizontal line functions
void msethlineshift(long logx, long logy) { glogx = logx; glogy = logy; } void msethlineshift(long logx, long logy) { glogx = logx; glogy = logy; }
void mhline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned long by, long p) void mhline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned long by, long p)
{ {
char ch; char ch;
gbuf = (char *)bufplc; gbuf = (char *)bufplc;
gpal = (char *)asm3; gpal = (char *)asm3;
for(cntup16>>=16;cntup16>0;cntup16--) for(cntup16>>=16;cntup16>0;cntup16--)
{ {
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))]; ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
if (ch != 255) *((char *)p) = gpal[ch]; if (ch != 255) *((char *)p) = gpal[ch];
bx += asm1; bx += asm1;
by += asm2; by += asm2;
p++; p++;
} }
} }
void tsethlineshift(long logx, long logy) { glogx = logx; glogy = logy; } void tsethlineshift(long logx, long logy) { glogx = logx; glogy = logy; }
void thline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned long by, long p) void thline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned long by, long p)
{ {
char ch; char ch;
gbuf = (char *)bufplc; gbuf = (char *)bufplc;
gpal = (char *)asm3; gpal = (char *)asm3;
if (transmode) if (transmode)
{ {
for(cntup16>>=16;cntup16>0;cntup16--) for(cntup16>>=16;cntup16>0;cntup16--)
{ {
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))]; ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)]; if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
bx += asm1; bx += asm1;
by += asm2; by += asm2;
p++; p++;
} }
} }
else else
{ {
for(cntup16>>=16;cntup16>0;cntup16--) for(cntup16>>=16;cntup16>0;cntup16--)
{ {
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))]; ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]]; if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
bx += asm1; bx += asm1;
by += asm2; by += asm2;
p++; p++;
} }
} }
} }
//Rotatesprite vertical line functions //Rotatesprite vertical line functions
void setupspritevline(long paloffs, long bxinc, long byinc, long ysiz) void setupspritevline(long paloffs, long bxinc, long byinc, long ysiz)
{ {
gpal = (char *)paloffs; gpal = (char *)paloffs;
gbxinc = bxinc; gbxinc = bxinc;
gbyinc = byinc; gbyinc = byinc;
glogy = ysiz; glogy = ysiz;
} }
void spritevline(long bx, long by, long cnt, long bufplc, long p) void spritevline(long bx, long by, long cnt, long bufplc, long p)
{ {
gbuf = (char *)bufplc; gbuf = (char *)bufplc;
for(;cnt>1;cnt--) for(;cnt>1;cnt--)
{ {
(*(char *)p) = gpal[gbuf[(bx>>16)*glogy+(by>>16)]]; (*(char *)p) = gpal[gbuf[(bx>>16)*glogy+(by>>16)]];
bx += gbxinc; bx += gbxinc;
by += gbyinc; by += gbyinc;
p += bpl; p += bpl;
} }
} }
//Rotatesprite vertical line functions //Rotatesprite vertical line functions
void msetupspritevline(long paloffs, long bxinc, long byinc, long ysiz) void msetupspritevline(long paloffs, long bxinc, long byinc, long ysiz)
{ {
gpal = (char *)paloffs; gpal = (char *)paloffs;
gbxinc = bxinc; gbxinc = bxinc;
gbyinc = byinc; gbyinc = byinc;
glogy = ysiz; glogy = ysiz;
} }
void mspritevline(long bx, long by, long cnt, long bufplc, long p) void mspritevline(long bx, long by, long cnt, long bufplc, long p)
{ {
char ch; char ch;
gbuf = (char *)bufplc; gbuf = (char *)bufplc;
for(;cnt>1;cnt--) for(;cnt>1;cnt--)
{ {
ch = gbuf[(bx>>16)*glogy+(by>>16)]; ch = gbuf[(bx>>16)*glogy+(by>>16)];
if (ch != 255) (*(char *)p) = gpal[ch]; if (ch != 255) (*(char *)p) = gpal[ch];
bx += gbxinc; bx += gbxinc;
by += gbyinc; by += gbyinc;
p += bpl; p += bpl;
} }
} }
void tsetupspritevline(long paloffs, long bxinc, long byinc, long ysiz) void tsetupspritevline(long paloffs, long bxinc, long byinc, long ysiz)
{ {
gpal = (char *)paloffs; gpal = (char *)paloffs;
gbxinc = bxinc; gbxinc = bxinc;
gbyinc = byinc; gbyinc = byinc;
glogy = ysiz; glogy = ysiz;
} }
void tspritevline(long bx, long by, long cnt, long bufplc, long p) void tspritevline(long bx, long by, long cnt, long bufplc, long p)
{ {
char ch; char ch;
gbuf = (char *)bufplc; gbuf = (char *)bufplc;
if (transmode) if (transmode)
{ {
for(;cnt>1;cnt--) for(;cnt>1;cnt--)
{ {
ch = gbuf[(bx>>16)*glogy+(by>>16)]; ch = gbuf[(bx>>16)*glogy+(by>>16)];
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)]; if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
bx += gbxinc; bx += gbxinc;
by += gbyinc; by += gbyinc;
p += bpl; p += bpl;
} }
} }
else else
{ {
for(;cnt>1;cnt--) for(;cnt>1;cnt--)
{ {
ch = gbuf[(bx>>16)*glogy+(by>>16)]; ch = gbuf[(bx>>16)*glogy+(by>>16)];
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]]; if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
bx += gbxinc; bx += gbxinc;
by += gbyinc; by += gbyinc;
p += bpl; p += bpl;
} }
} }
} }
void setupdrawslab (long dabpl, long pal) void setupdrawslab (long dabpl, long pal)
{ bpl = dabpl; gpal = (char *)pal; } { bpl = dabpl; gpal = (char *)pal; }
void drawslab (long dx, long v, long dy, long vi, long vptr, long p) void drawslab (long dx, long v, long dy, long vi, long vptr, long p)
{ {
long x; long x;
while (dy > 0) 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--; p += bpl; v += vi; dy--;
} }
} }
void stretchhline (long p0, long u, long cnt, long uinc, long rptr, long p) void stretchhline (long p0, long u, long cnt, long uinc, long rptr, long p)
{ {
p0 = p-(cnt<<2); p0 = p-(cnt<<2);
do do
{ {
p--; p--;
*(char *)p = *(char *)((u>>16)+rptr); u -= uinc; *(char *)p = *(char *)((u>>16)+rptr); u -= uinc;
} while (p > p0); } while (p > p0);
} }

View file

@ -10,37 +10,37 @@
#ifdef USE_OPENGL #ifdef USE_OPENGL
struct glinfo glinfo = { struct glinfo glinfo = {
"Unknown", // vendor "Unknown", // vendor
"Unknown", // renderer "Unknown", // renderer
"0.0.0", // version "0.0.0", // version
"", // extensions "", // extensions
1.0, // max anisotropy 1.0, // max anisotropy
0, // brga texture format 0, // brga texture format
0, // clamp-to-edge support 0, // clamp-to-edge support
0, // texture compression 0, // texture compression
0, // non-power-of-two textures 0, // non-power-of-two textures
0, // multisampling 0, // multisampling
0, // nvidia multisampling hint 0, // nvidia multisampling hint
}; };
#endif #endif
static int osdfunc_dumpbuildinfo(const osdfuncparm_t *parm) static int osdfunc_dumpbuildinfo(const osdfuncparm_t *parm)
{ {
OSD_Printf( OSD_Printf(
"Build engine compilation:\n" "Build engine compilation:\n"
" CFLAGS: %s\n" " CFLAGS: %s\n"
" LIBS: %s\n" " LIBS: %s\n"
" Host: %s\n" " Host: %s\n"
" Compiler: %s\n" " Compiler: %s\n"
" Built: %s\n", " Built: %s\n",
_engine_cflags, _engine_cflags,
_engine_libs, _engine_libs,
_engine_uname, _engine_uname,
_engine_compiler, _engine_compiler,
_engine_date); _engine_date);
return OSDCMD_OK; return OSDCMD_OK;
} }
static void onvideomodechange(int newmode) { } static void onvideomodechange(int newmode) { }
@ -48,159 +48,159 @@ void (*baselayer_onvideomodechange)(int) = onvideomodechange;
static int osdfunc_setrendermode(const osdfuncparm_t *parm) static int osdfunc_setrendermode(const osdfuncparm_t *parm)
{ {
int m; int m;
char *p; char *p;
char *modestrs[] = { char *modestrs[] = {
"classic software", "polygonal flat-shaded software", "classic software", "polygonal flat-shaded software",
"polygonal textured software", "polygonal OpenGL" "polygonal textured software", "polygonal OpenGL"
}; };
if (parm->numparms != 1) return OSDCMD_SHOWHELP; if (parm->numparms != 1) return OSDCMD_SHOWHELP;
m = Bstrtol(parm->parms[0], &p, 10); m = Bstrtol(parm->parms[0], &p, 10);
if (m < 0 || m > 3) return OSDCMD_SHOWHELP; if (m < 0 || m > 3) return OSDCMD_SHOWHELP;
setrendermode(m); setrendermode(m);
OSD_Printf("Rendering method changed to %s\n", modestrs[ getrendermode() ] ); OSD_Printf("Rendering method changed to %s\n", modestrs[ getrendermode() ] );
return OSDCMD_OK; return OSDCMD_OK;
} }
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS
static int osdcmd_hicsetpalettetint(const osdfuncparm_t *parm) static int osdcmd_hicsetpalettetint(const osdfuncparm_t *parm)
{ {
long pal, cols[3], eff; long pal, cols[3], eff;
char *p; char *p;
if (parm->numparms != 5) return OSDCMD_SHOWHELP; if (parm->numparms != 5) return OSDCMD_SHOWHELP;
pal = Batol(parm->parms[0]); pal = Batol(parm->parms[0]);
cols[0] = Batol(parm->parms[1]); cols[0] = Batol(parm->parms[1]);
cols[1] = Batol(parm->parms[2]); cols[1] = Batol(parm->parms[2]);
cols[2] = Batol(parm->parms[3]); cols[2] = Batol(parm->parms[3]);
eff = Batol(parm->parms[4]); eff = Batol(parm->parms[4]);
hicsetpalettetint(pal,cols[0],cols[1],cols[2],eff); hicsetpalettetint(pal,cols[0],cols[1],cols[2],eff);
return OSDCMD_OK; return OSDCMD_OK;
} }
#endif #endif
static int osdcmd_glinfo(const osdfuncparm_t *parm) static int osdcmd_glinfo(const osdfuncparm_t *parm)
{ {
char *s,*t,*u,i; char *s,*t,*u,i;
if (bpp == 8) {
OSD_Printf("glinfo: Not in OpenGL mode.\n");
return OSDCMD_OK;
}
OSD_Printf("OpenGL Information:\n"
" Version: %s\n"
" Vendor: %s\n"
" Renderer: %s\n"
" Maximum anisotropy: %.1f%s\n"
" BGRA textures: %s\n"
" Non-x^2 textures: %s\n"
" Texure compression: %s\n"
" Clamp-to-edge: %s\n"
" Multisampling: %s\n"
" Nvidia multisample hint: %s\n"
" Extensions:\n",
glinfo.version,
glinfo.vendor,
glinfo.renderer,
glinfo.maxanisotropy, glinfo.maxanisotropy>1.0?"":" (no anisotropic filtering)",
glinfo.bgra ? "supported": "not supported",
glinfo.texnpot ? "supported": "not supported",
glinfo.texcompr ? "supported": "not supported",
glinfo.clamptoedge ? "supported": "not supported",
glinfo.multisample ? "supported": "not supported",
glinfo.nvmultisamplehint ? "supported": "not supported"
);
s = Bstrdup(glinfo.extensions); if (bpp == 8) {
if (!s) OSD_Printf(glinfo.extensions); OSD_Printf("glinfo: Not in OpenGL mode.\n");
else { return OSDCMD_OK;
i = 0; t = u = s; }
while (*t) {
if (*t == ' ') { OSD_Printf("OpenGL Information:\n"
if (i&1) { " Version: %s\n"
*t = 0; " Vendor: %s\n"
OSD_Printf(" %s\n",u); " Renderer: %s\n"
u = t+1; " Maximum anisotropy: %.1f%s\n"
} " BGRA textures: %s\n"
i++; " Non-x^2 textures: %s\n"
} " Texure compression: %s\n"
t++; " Clamp-to-edge: %s\n"
} " Multisampling: %s\n"
if (i&1) OSD_Printf(" %s\n",u); " Nvidia multisample hint: %s\n"
Bfree(s); " Extensions:\n",
} glinfo.version,
glinfo.vendor,
return OSDCMD_OK; glinfo.renderer,
glinfo.maxanisotropy, glinfo.maxanisotropy>1.0?"":" (no anisotropic filtering)",
glinfo.bgra ? "supported": "not supported",
glinfo.texnpot ? "supported": "not supported",
glinfo.texcompr ? "supported": "not supported",
glinfo.clamptoedge ? "supported": "not supported",
glinfo.multisample ? "supported": "not supported",
glinfo.nvmultisamplehint ? "supported": "not supported"
);
s = Bstrdup(glinfo.extensions);
if (!s) OSD_Printf(glinfo.extensions);
else {
i = 0; t = u = s;
while (*t) {
if (*t == ' ') {
if (i&1) {
*t = 0;
OSD_Printf(" %s\n",u);
u = t+1;
}
i++;
}
t++;
}
if (i&1) OSD_Printf(" %s\n",u);
Bfree(s);
}
return OSDCMD_OK;
} }
#endif #endif
static int osdcmd_vars(const osdfuncparm_t *parm) static int osdcmd_vars(const osdfuncparm_t *parm)
{ {
int showval = (parm->numparms < 1); int showval = (parm->numparms < 1);
if (!Bstrcasecmp(parm->name, "screencaptureformat")) { if (!Bstrcasecmp(parm->name, "screencaptureformat")) {
const char *fmts[2][2] = { {"TGA", "PCX"}, {"0", "1"} }; const char *fmts[2][2] = { {"TGA", "PCX"}, {"0", "1"} };
if (showval) { OSD_Printf("captureformat is %s\n", fmts[captureformat]); } if (showval) { OSD_Printf("captureformat is %s\n", fmts[captureformat]); }
else { else {
int i,j; int i,j;
for (j=0; j<2; j++) for (j=0; j<2; j++)
for (i=0; i<2; i++) for (i=0; i<2; i++)
if (!Bstrcasecmp(parm->parms[0], fmts[j][i])) break; if (!Bstrcasecmp(parm->parms[0], fmts[j][i])) break;
if (j == 2) return OSDCMD_SHOWHELP; if (j == 2) return OSDCMD_SHOWHELP;
captureformat = i; captureformat = i;
} }
return OSDCMD_OK; return OSDCMD_OK;
} }
#ifdef SUPERBUILD #ifdef SUPERBUILD
else if (!Bstrcasecmp(parm->name, "novoxmips")) { else if (!Bstrcasecmp(parm->name, "novoxmips")) {
if (showval) { OSD_Printf("novoxmips is %d\n", novoxmips); } if (showval) { OSD_Printf("novoxmips is %d\n", novoxmips); }
else { novoxmips = (atoi(parm->parms[0]) != 0); } else { novoxmips = (atoi(parm->parms[0]) != 0); }
} }
else if (!Bstrcasecmp(parm->name, "usevoxels")) { else if (!Bstrcasecmp(parm->name, "usevoxels")) {
if (showval) { OSD_Printf("usevoxels is %d\n", usevoxels); } if (showval) { OSD_Printf("usevoxels is %d\n", usevoxels); }
else { usevoxels = (atoi(parm->parms[0]) != 0); } else { usevoxels = (atoi(parm->parms[0]) != 0); }
} }
#endif #endif
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
int baselayer_init(void) int baselayer_init(void)
{ {
#ifdef POLYMOST #ifdef POLYMOST
OSD_RegisterFunction("setrendermode","setrendermode <number>: sets the engine's rendering mode.\n" OSD_RegisterFunction("setrendermode","setrendermode <number>: sets the engine's rendering mode.\n"
"Mode numbers are:\n" "Mode numbers are:\n"
" 0 - Classic Build software\n" " 0 - Classic Build software\n"
" 1 - Polygonal flat-shaded software\n" " 1 - Polygonal flat-shaded software\n"
" 2 - Polygonal textured software\n" " 2 - Polygonal textured software\n"
#ifdef USE_OPENGL #ifdef USE_OPENGL
" 3 - Polygonal OpenGL\n" " 3 - Polygonal OpenGL\n"
#endif #endif
, ,
osdfunc_setrendermode); osdfunc_setrendermode);
#endif #endif
OSD_RegisterFunction("dumpbuildinfo","dumpbuildinfo: outputs engine compilation information",osdfunc_dumpbuildinfo); OSD_RegisterFunction("dumpbuildinfo","dumpbuildinfo: outputs engine compilation information",osdfunc_dumpbuildinfo);
OSD_RegisterFunction("screencaptureformat","screencaptureformat: sets the output format for screenshots (TGA or PCX)",osdcmd_vars); OSD_RegisterFunction("screencaptureformat","screencaptureformat: sets the output format for screenshots (TGA or PCX)",osdcmd_vars);
#ifdef SUPERBUILD #ifdef SUPERBUILD
OSD_RegisterFunction("novoxmips","novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",osdcmd_vars); OSD_RegisterFunction("novoxmips","novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",osdcmd_vars);
OSD_RegisterFunction("usevoxels","usevoxels: enable/disable automatic sprite->voxel rendering",osdcmd_vars); OSD_RegisterFunction("usevoxels","usevoxels: enable/disable automatic sprite->voxel rendering",osdcmd_vars);
#endif #endif
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS
OSD_RegisterFunction("hicsetpalettetint","hicsetpalettetint: sets palette tinting values",osdcmd_hicsetpalettetint); OSD_RegisterFunction("hicsetpalettetint","hicsetpalettetint: sets palette tinting values",osdcmd_hicsetpalettetint);
#endif #endif
OSD_RegisterFunction("glinfo","glinfo: shows OpenGL information about the current OpenGL mode",osdcmd_glinfo); OSD_RegisterFunction("glinfo","glinfo: shows OpenGL information about the current OpenGL mode",osdcmd_glinfo);
#endif #endif
return 0; return 0;
} }

View file

@ -21,11 +21,11 @@ static char tempbuf[256];
#define NUMOPTIONS 9 #define NUMOPTIONS 9
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0}; char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
char keys[NUMBUILDKEYS] = char keys[NUMBUILDKEYS] =
{ {
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
0x1e,0x2c,0xd1,0xc9,0x33,0x34, 0x1e,0x2c,0xd1,0xc9,0x33,0x34,
0x9c,0x1c,0xd,0xc,0xf,0x45 0x9c,0x1c,0xd,0xc,0xf,0x45
}; };
@ -67,145 +67,145 @@ int ExtPreInit(int *argc,char ***argv)
int ExtInit(void) int ExtInit(void)
{ {
long i, rv = 0; long i, rv = 0;
/*printf("------------------------------------------------------------------------------\n"); /*printf("------------------------------------------------------------------------------\n");
printf(" BUILD.EXE copyright(c) 1996 by Ken Silverman. You are granted the\n"); printf(" BUILD.EXE copyright(c) 1996 by Ken Silverman. You are granted the\n");
printf(" right to use this software for your personal use only. This is a\n"); printf(" right to use this software for your personal use only. This is a\n");
printf(" special version to be used with \"Happy Fun KenBuild\" and may not work\n"); printf(" special version to be used with \"Happy Fun KenBuild\" and may not work\n");
printf(" properly with other Build engine games. Please refer to license.doc\n"); printf(" properly with other Build engine games. Please refer to license.doc\n");
printf(" for distribution rights\n"); printf(" for distribution rights\n");
printf("------------------------------------------------------------------------------\n"); printf("------------------------------------------------------------------------------\n");
getch(); getch();
*/ */
initgroupfile("stuff.dat"); initgroupfile("stuff.dat");
bpp = 8; bpp = 8;
if (loadsetup("build.cfg") < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1; if (loadsetup("build.cfg") < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1;
Bmemcpy((void *)buildkeys,(void *)keys,NUMBUILDKEYS); //Trick to make build use setup.dat keys Bmemcpy((void *)buildkeys,(void *)keys,NUMBUILDKEYS); //Trick to make build use setup.dat keys
if (option[4] > 0) option[4] = 0; if (option[4] > 0) option[4] = 0;
if (initengine()) { if (initengine()) {
wm_msgbox("Build Engine Initialisation Error", wm_msgbox("Build Engine Initialisation Error",
"There was a problem initialising the Build engine: %s", engineerrstr); "There was a problem initialising the Build engine: %s", engineerrstr);
return -1; return -1;
} }
initinput(); initinput();
initmouse(); initmouse();
//You can load your own palette lookup tables here if you just //You can load your own palette lookup tables here if you just
//copy the right code! //copy the right code!
for(i=0;i<256;i++) for(i=0;i<256;i++)
tempbuf[i] = ((i+32)&255); //remap colors for screwy palette sectors tempbuf[i] = ((i+32)&255); //remap colors for screwy palette sectors
makepalookup(16,tempbuf,0,0,0,1); makepalookup(16,tempbuf,0,0,0,1);
kensplayerheight = 32; kensplayerheight = 32;
zmode = 0; zmode = 0;
defaultspritecstat = 0; defaultspritecstat = 0;
pskyoff[0] = 0; pskyoff[1] = 0; pskybits = 1; pskyoff[0] = 0; pskyoff[1] = 0; pskybits = 1;
#ifdef SUPERBUILD #ifdef SUPERBUILD
tiletovox[PLAYER] = nextvoxid++; tiletovox[PLAYER] = nextvoxid++;
tiletovox[BROWNMONSTER] = nextvoxid++; tiletovox[BROWNMONSTER] = nextvoxid++;
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
// allowtaskswitching(0); // allowtaskswitching(0);
#endif #endif
return rv; return rv;
} }
void ExtUnInit(void) void ExtUnInit(void)
{ {
uninitgroupfile(); uninitgroupfile();
writesetup("build.cfg"); writesetup("build.cfg");
} }
void ExtSetupSpecialSpriteCols(void) void ExtSetupSpecialSpriteCols(void)
{ {
return; return;
} }
//static long daviewingrange, daaspect, horizval1, horizval2; //static long daviewingrange, daaspect, horizval1, horizval2;
void ExtPreCheckKeys(void) void ExtPreCheckKeys(void)
{ {
long /*cosang, sinang, dx, dy, mindx,*/ i, j, k; long /*cosang, sinang, dx, dy, mindx,*/ i, j, k;
if (keystatus[0x3e]) //F4 - screen re-size if (keystatus[0x3e]) //F4 - screen re-size
{ {
keystatus[0x3e] = 0; keystatus[0x3e] = 0;
//cycle through all vesa modes, then screen-buffer mode //cycle through all vesa modes, then screen-buffer mode
if (keystatus[0x2a]|keystatus[0x36]) { if (keystatus[0x2a]|keystatus[0x36]) {
setgamemode(!fullscreen, xdim, ydim, bpp); setgamemode(!fullscreen, xdim, ydim, bpp);
} else { } else {
//cycle through all modes //cycle through all modes
j=-1; j=-1;
// work out a mask to select the mode // work out a mask to select the mode
for (i=0; i<validmodecnt; i++) for (i=0; i<validmodecnt; i++)
if ((validmode[i].xdim == xdim) && if ((validmode[i].xdim == xdim) &&
(validmode[i].ydim == ydim) && (validmode[i].ydim == ydim) &&
(validmode[i].fs == fullscreen) && (validmode[i].fs == fullscreen) &&
(validmode[i].bpp == bpp)) (validmode[i].bpp == bpp))
{ j=i; break; } { j=i; break; }
for (k=0; k<validmodecnt; k++)
if (validmode[k].fs == fullscreen && validmode[k].bpp == bpp) break;
if (j==-1) j=k; for (k=0; k<validmodecnt; k++)
else { if (validmode[k].fs == fullscreen && validmode[k].bpp == bpp) break;
j++;
if (j==validmodecnt) j=k; if (j==-1) j=k;
} else {
setgamemode(fullscreen,validmode[j].xdim,validmode[j].ydim,bpp); j++;
} if (j==validmodecnt) j=k;
} }
setgamemode(fullscreen,validmode[j].xdim,validmode[j].ydim,bpp);
}
}
#if 0 #if 0
if (keystatus[0x2a]|keystatus[0x36]) if (keystatus[0x2a]|keystatus[0x36])
{ {
if (keystatus[0xcf]) hang = max(hang-1,-182); if (keystatus[0xcf]) hang = max(hang-1,-182);
if (keystatus[0xc7]) hang = min(hang+1,182); if (keystatus[0xc7]) hang = min(hang+1,182);
} }
else else
{ {
if (keystatus[0xcf]) hang = max(hang-8,-182); if (keystatus[0xcf]) hang = max(hang-8,-182);
if (keystatus[0xc7]) hang = min(hang+8,182); if (keystatus[0xc7]) hang = min(hang+8,182);
} }
if (keystatus[0x4c]) { hang = 0; horiz = 100; } if (keystatus[0x4c]) { hang = 0; horiz = 100; }
if (hang != 0) if (hang != 0)
{ {
walock[4094] = 255; walock[4094] = 255;
// JBF 20031117: scale each dimension by a factor of 1.2, and work out // JBF 20031117: scale each dimension by a factor of 1.2, and work out
// the aspect of the screen. Anywhere you see 'i' below was the value // the aspect of the screen. Anywhere you see 'i' below was the value
// '200' before I changed it. NOTE: This whole trick crashes in resolutions // '200' before I changed it. NOTE: This whole trick crashes in resolutions
// above 800x600. I'm not sure why, and fixing it is not something I intend // above 800x600. I'm not sure why, and fixing it is not something I intend
// to do in a real big hurry. // to do in a real big hurry.
dx = (xdim + (xdim >> 3) + (xdim >> 4) + (xdim >> 6)) & (~7); dx = (xdim + (xdim >> 3) + (xdim >> 4) + (xdim >> 6)) & (~7);
dy = (ydim + (ydim >> 3) + (ydim >> 4) + (ydim >> 6)) & (~7); dy = (ydim + (ydim >> 3) + (ydim >> 4) + (ydim >> 6)) & (~7);
i = scale(320,ydim,xdim); i = scale(320,ydim,xdim);
if (waloff[4094] == 0) allocache(&waloff[4094],/*240L*384L*/dx*dy,&walock[4094]);
setviewtotile(4094,/*240L,384L*/dy,dx);
cosang = sintable[(hang+512)&2047]; if (waloff[4094] == 0) allocache(&waloff[4094],/*240L*384L*/dx*dy,&walock[4094]);
sinang = sintable[hang&2047]; setviewtotile(4094,/*240L,384L*/dy,dx);
dx = dmulscale1(320,cosang,i,sinang); mindx = dx; cosang = sintable[(hang+512)&2047];
dy = dmulscale1(-i,cosang,320,sinang); sinang = sintable[hang&2047];
horizval1 = dy*(320>>1)/dx-1;
dx = dmulscale1(320,cosang,-i,sinang); mindx = min(dx,mindx); dx = dmulscale1(320,cosang,i,sinang); mindx = dx;
dy = dmulscale1(i,cosang,320,sinang); dy = dmulscale1(-i,cosang,320,sinang);
horizval2 = dy*(320>>1)/dx+1; horizval1 = dy*(320>>1)/dx-1;
daviewingrange = scale(65536,16384*(xdim>>1),mindx-16); dx = dmulscale1(320,cosang,-i,sinang); mindx = min(dx,mindx);
daaspect = scale(daviewingrange,scale(320,tilesizx[4094],tilesizy[4094]),horizval2+6-horizval1); dy = dmulscale1(i,cosang,320,sinang);
setaspect(daviewingrange,scale(daaspect,ydim*320,xdim*i)); horizval2 = dy*(320>>1)/dx+1;
horiz = 100-divscale15(horizval1+horizval2,daviewingrange);
} daviewingrange = scale(65536,16384*(xdim>>1),mindx-16);
daaspect = scale(daviewingrange,scale(320,tilesizx[4094],tilesizy[4094]),horizval2+6-horizval1);
setaspect(daviewingrange,scale(daaspect,ydim*320,xdim*i));
horiz = 100-divscale15(horizval1+horizval2,daviewingrange);
}
#endif #endif
} }
@ -214,109 +214,109 @@ void ExtPreCheckKeys(void)
extern char *voxoff[][MAXVOXMIPS]; extern char *voxoff[][MAXVOXMIPS];
void ExtAnalyzeSprites(void) void ExtAnalyzeSprites(void)
{ {
long i, *longptr; long i, *longptr;
spritetype *tspr; spritetype *tspr;
for(i=0,tspr=&tsprite[0];i<spritesortcnt;i++,tspr++) for(i=0,tspr=&tsprite[0];i<spritesortcnt;i++,tspr++)
{ {
if (usevoxels && tiletovox[tspr->picnum] >= 0) if (usevoxels && tiletovox[tspr->picnum] >= 0)
{ {
switch(tspr->picnum) switch(tspr->picnum)
{ {
case PLAYER: case PLAYER:
if (!voxoff[ tiletovox[PLAYER] ][0]) { if (!voxoff[ tiletovox[PLAYER] ][0]) {
if (qloadkvx(tiletovox[PLAYER],"voxel000.kvx")) { if (qloadkvx(tiletovox[PLAYER],"voxel000.kvx")) {
tiletovox[PLAYER] = -1; tiletovox[PLAYER] = -1;
break; break;
} }
} }
//tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum]; //tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum];
longptr = (long *)voxoff[ tiletovox[PLAYER] ][0]; longptr = (long *)voxoff[ tiletovox[PLAYER] ][0];
tspr->xrepeat = scale(tspr->xrepeat,56,longptr[2]); tspr->xrepeat = scale(tspr->xrepeat,56,longptr[2]);
tspr->yrepeat = scale(tspr->yrepeat,56,longptr[2]); tspr->yrepeat = scale(tspr->yrepeat,56,longptr[2]);
tspr->shade -= 6; tspr->shade -= 6;
break; break;
case BROWNMONSTER: case BROWNMONSTER:
if (!voxoff[ tiletovox[BROWNMONSTER] ][0]) { if (!voxoff[ tiletovox[BROWNMONSTER] ][0]) {
if (qloadkvx(tiletovox[BROWNMONSTER],"voxel001.kvx")) { if (qloadkvx(tiletovox[BROWNMONSTER],"voxel001.kvx")) {
tiletovox[BROWNMONSTER] = -1; tiletovox[BROWNMONSTER] = -1;
break; break;
} }
} }
//tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum]; //tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum];
break; break;
} }
} }
tspr->shade += 6; tspr->shade += 6;
if (sector[tspr->sectnum].ceilingstat&1) if (sector[tspr->sectnum].ceilingstat&1)
tspr->shade += sector[tspr->sectnum].ceilingshade; tspr->shade += sector[tspr->sectnum].ceilingshade;
else else
tspr->shade += sector[tspr->sectnum].floorshade; tspr->shade += sector[tspr->sectnum].floorshade;
} }
} }
#endif #endif
void ExtCheckKeys(void) void ExtCheckKeys(void)
{ {
long i;//, p, y, dx, dy, cosang, sinang, bufplc, tsizy, tsizyup15; long i;//, p, y, dx, dy, cosang, sinang, bufplc, tsizy, tsizyup15;
long j; long j;
if (qsetmode == 200) //In 3D mode if (qsetmode == 200) //In 3D mode
{ {
#if 0 #if 0
if (hang != 0) if (hang != 0)
{ {
bufplc = waloff[4094]+(mulscale16(horiz-100,xdimenscale)+(tilesizx[4094]>>1))*tilesizy[4094]; bufplc = waloff[4094]+(mulscale16(horiz-100,xdimenscale)+(tilesizx[4094]>>1))*tilesizy[4094];
setviewback(); setviewback();
cosang = sintable[(hang+512)&2047]; cosang = sintable[(hang+512)&2047];
sinang = sintable[hang&2047]; sinang = sintable[hang&2047];
dx = dmulscale1(xdim,cosang,ydim,sinang); dx = dmulscale1(xdim,cosang,ydim,sinang);
dy = dmulscale1(-ydim,cosang,xdim,sinang); dy = dmulscale1(-ydim,cosang,xdim,sinang);
begindrawing(); begindrawing();
tsizy = tilesizy[4094]; tsizy = tilesizy[4094];
tsizyup15 = (tsizy<<15); tsizyup15 = (tsizy<<15);
dx = mulscale14(dx,daviewingrange); dx = mulscale14(dx,daviewingrange);
dy = mulscale14(dy,daaspect); dy = mulscale14(dy,daaspect);
sinang = mulscale14(sinang,daviewingrange); sinang = mulscale14(sinang,daviewingrange);
cosang = mulscale14(cosang,daaspect); cosang = mulscale14(cosang,daaspect);
p = ylookup[windowy1]+frameplace+windowx2+1; p = ylookup[windowy1]+frameplace+windowx2+1;
for(y=windowy1;y<=windowy2;y++) for(y=windowy1;y<=windowy2;y++)
{ {
i = divscale16(tsizyup15,dx); i = divscale16(tsizyup15,dx);
stretchhline(0,(xdim>>1)*i+tsizyup15,xdim>>2,i,mulscale32(i,dy)*tsizy+bufplc,p); stretchhline(0,(xdim>>1)*i+tsizyup15,xdim>>2,i,mulscale32(i,dy)*tsizy+bufplc,p);
dx -= sinang; dy += cosang; p += ylookup[1]; dx -= sinang; dy += cosang; p += ylookup[1];
} }
walock[4094] = 1; walock[4094] = 1;
Bsprintf(tempbuf,"%d",(hang*180)>>10); Bsprintf(tempbuf,"%d",(hang*180)>>10);
printext256(0L,8L,31,-1,tempbuf,1); printext256(0L,8L,31,-1,tempbuf,1);
enddrawing(); enddrawing();
} }
#endif #endif
if (keystatus[0xa]) setaspect(viewingrange+(viewingrange>>8),yxaspect+(yxaspect>>8)); if (keystatus[0xa]) setaspect(viewingrange+(viewingrange>>8),yxaspect+(yxaspect>>8));
if (keystatus[0xb]) setaspect(viewingrange-(viewingrange>>8),yxaspect-(yxaspect>>8)); if (keystatus[0xb]) setaspect(viewingrange-(viewingrange>>8),yxaspect-(yxaspect>>8));
if (keystatus[0xc]) setaspect(viewingrange,yxaspect-(yxaspect>>8)); if (keystatus[0xc]) setaspect(viewingrange,yxaspect-(yxaspect>>8));
if (keystatus[0xd]) setaspect(viewingrange,yxaspect+(yxaspect>>8)); if (keystatus[0xd]) setaspect(viewingrange,yxaspect+(yxaspect>>8));
//if (keystatus[0x38]) setrollangle(rollangle+=((keystatus[0x2a]|keystatus[0x36])*6+2)); //if (keystatus[0x38]) setrollangle(rollangle+=((keystatus[0x2a]|keystatus[0x36])*6+2));
//if (keystatus[0xb8]) setrollangle(rollangle-=((keystatus[0x2a]|keystatus[0x36])*6+2)); //if (keystatus[0xb8]) setrollangle(rollangle-=((keystatus[0x2a]|keystatus[0x36])*6+2));
//if (keystatus[0x1d]|keystatus[0x9d]) setrollangle(rollangle=0); //if (keystatus[0x1d]|keystatus[0x9d]) setrollangle(rollangle=0);
begindrawing(); begindrawing();
i = frameval[framecnt&(AVERAGEFRAMES-1)]; i = frameval[framecnt&(AVERAGEFRAMES-1)];
j = frameval[framecnt&(AVERAGEFRAMES-1)] = getticks(); framecnt++; j = frameval[framecnt&(AVERAGEFRAMES-1)] = getticks(); framecnt++;
if (i != j) averagefps = ((mul3(averagefps)+((AVERAGEFRAMES*1000)/(j-i)) )>>2); if (i != j) averagefps = ((mul3(averagefps)+((AVERAGEFRAMES*1000)/(j-i)) )>>2);
Bsprintf(tempbuf,"%ld",averagefps); Bsprintf(tempbuf,"%ld",averagefps);
printext256(0L,0L,31,-1,tempbuf,1); printext256(0L,0L,31,-1,tempbuf,1);
enddrawing(); enddrawing();
editinput(); editinput();
} }
else else
{ {
} }
} }
void ExtCleanUp(void) void ExtCleanUp(void)
@ -329,9 +329,9 @@ void ExtPreLoadMap(void)
void ExtLoadMap(const char *mapname) void ExtLoadMap(const char *mapname)
{ {
char title[256]; char title[256];
Bsprintf(title, "BUILD by Ken Silverman - %s", mapname); Bsprintf(title, "BUILD by Ken Silverman - %s", mapname);
wm_setapptitle(title); wm_setapptitle(title);
} }
void ExtPreSaveMap(void) void ExtPreSaveMap(void)
@ -344,44 +344,44 @@ void ExtSaveMap(const char *mapname)
const char *ExtGetSectorCaption(short sectnum) const char *ExtGetSectorCaption(short sectnum)
{ {
if ((sector[sectnum].lotag|sector[sectnum].hitag) == 0) if ((sector[sectnum].lotag|sector[sectnum].hitag) == 0)
{ {
tempbuf[0] = 0; tempbuf[0] = 0;
} }
else else
{ {
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)sector[sectnum].hitag, Bsprintf(tempbuf,"%hu,%hu",(unsigned short)sector[sectnum].hitag,
(unsigned short)sector[sectnum].lotag); (unsigned short)sector[sectnum].lotag);
} }
return(tempbuf); return(tempbuf);
} }
const char *ExtGetWallCaption(short wallnum) const char *ExtGetWallCaption(short wallnum)
{ {
if ((wall[wallnum].lotag|wall[wallnum].hitag) == 0) if ((wall[wallnum].lotag|wall[wallnum].hitag) == 0)
{ {
tempbuf[0] = 0; tempbuf[0] = 0;
} }
else else
{ {
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)wall[wallnum].hitag, Bsprintf(tempbuf,"%hu,%hu",(unsigned short)wall[wallnum].hitag,
(unsigned short)wall[wallnum].lotag); (unsigned short)wall[wallnum].lotag);
} }
return(tempbuf); return(tempbuf);
} }
const char *ExtGetSpriteCaption(short spritenum) const char *ExtGetSpriteCaption(short spritenum)
{ {
if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0) if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0)
{ {
tempbuf[0] = 0; tempbuf[0] = 0;
} }
else else
{ {
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)sprite[spritenum].hitag, Bsprintf(tempbuf,"%hu,%hu",(unsigned short)sprite[spritenum].hitag,
(unsigned short)sprite[spritenum].lotag); (unsigned short)sprite[spritenum].lotag);
} }
return(tempbuf); return(tempbuf);
} }
//printext16 parameters: //printext16 parameters:
@ -402,132 +402,132 @@ const char *ExtGetSpriteCaption(short spritenum)
void ExtShowSectorData(short sectnum) //F5 void ExtShowSectorData(short sectnum) //F5
{ {
int i; int i;
if (qsetmode == 200) //In 3D mode if (qsetmode == 200) //In 3D mode
{ {
} }
else else
{ {
begindrawing(); begindrawing();
clearmidstatbar16(); //Clear middle of status bar clearmidstatbar16(); //Clear middle of status bar
Bsprintf(tempbuf,"Sector %d",sectnum); Bsprintf(tempbuf,"Sector %d",sectnum);
printext16(8,ydim16+32,11,-1,tempbuf,0); printext16(8,ydim16+32,11,-1,tempbuf,0);
printext16(8,ydim16+48,11,-1,"8*8 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",0); printext16(8,ydim16+48,11,-1,"8*8 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",0);
printext16(8,ydim16+56,11,-1,"3*5 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",1); printext16(8,ydim16+56,11,-1,"3*5 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",1);
i=ydim16; ydim16=ydim; i=ydim16; ydim16=ydim;
drawline16(320,i+68,344,i+80,4); //Draw house drawline16(320,i+68,344,i+80,4); //Draw house
drawline16(344,i+80,344,i+116,4); drawline16(344,i+80,344,i+116,4);
drawline16(344,i+116,296,i+116,4); drawline16(344,i+116,296,i+116,4);
drawline16(296,i+116,296,i+80,4); drawline16(296,i+116,296,i+80,4);
drawline16(296,i+80,320,i+68,4); drawline16(296,i+80,320,i+68,4);
ydim16=i; ydim16=i;
enddrawing(); enddrawing();
} }
} }
void ExtShowWallData(short wallnum) //F6 void ExtShowWallData(short wallnum) //F6
{ {
if (qsetmode == 200) //In 3D mode if (qsetmode == 200) //In 3D mode
{ {
} }
else else
{ {
begindrawing(); begindrawing();
clearmidstatbar16(); //Clear middle of status bar clearmidstatbar16(); //Clear middle of status bar
Bsprintf(tempbuf,"Wall %d",wallnum); Bsprintf(tempbuf,"Wall %d",wallnum);
printext16(8,ydim16+32,11,-1,tempbuf,0); printext16(8,ydim16+32,11,-1,tempbuf,0);
enddrawing(); enddrawing();
} }
} }
void ExtShowSpriteData(short spritenum) //F6 void ExtShowSpriteData(short spritenum) //F6
{ {
if (qsetmode == 200) //In 3D mode if (qsetmode == 200) //In 3D mode
{ {
} }
else else
{ {
begindrawing(); begindrawing();
clearmidstatbar16(); //Clear middle of status bar clearmidstatbar16(); //Clear middle of status bar
Bsprintf(tempbuf,"Sprite %d",spritenum); Bsprintf(tempbuf,"Sprite %d",spritenum);
printext16(8,ydim16+32,11,-1,tempbuf,0); printext16(8,ydim16+32,11,-1,tempbuf,0);
enddrawing(); enddrawing();
} }
} }
void ExtEditSectorData(short sectnum) //F7 void ExtEditSectorData(short sectnum) //F7
{ {
short nickdata; short nickdata;
if (qsetmode == 200) //In 3D mode if (qsetmode == 200) //In 3D mode
{ {
//Ceiling //Ceiling
if (searchstat == 1) if (searchstat == 1)
sector[searchsector].ceilingpicnum++; //Just a stupid example sector[searchsector].ceilingpicnum++; //Just a stupid example
//Floor //Floor
if (searchstat == 2) if (searchstat == 2)
sector[searchsector].floorshade++; //Just a stupid example sector[searchsector].floorshade++; //Just a stupid example
} }
else //In 2D mode else //In 2D mode
{ {
Bsprintf(tempbuf,"Sector (%d) Nick's variable: ",sectnum); Bsprintf(tempbuf,"Sector (%d) Nick's variable: ",sectnum);
nickdata = 0; nickdata = 0;
nickdata = getnumber16(tempbuf,nickdata,65536L,0); nickdata = getnumber16(tempbuf,nickdata,65536L,0);
printmessage16(""); //Clear message box (top right of status bar) printmessage16(""); //Clear message box (top right of status bar)
ExtShowSectorData(sectnum); ExtShowSectorData(sectnum);
} }
} }
void ExtEditWallData(short wallnum) //F8 void ExtEditWallData(short wallnum) //F8
{ {
short nickdata; short nickdata;
if (qsetmode == 200) //In 3D mode if (qsetmode == 200) //In 3D mode
{ {
} }
else else
{ {
Bsprintf(tempbuf,"Wall (%d) Nick's variable: ",wallnum); Bsprintf(tempbuf,"Wall (%d) Nick's variable: ",wallnum);
nickdata = 0; nickdata = 0;
nickdata = getnumber16(tempbuf,nickdata,65536L,0); nickdata = getnumber16(tempbuf,nickdata,65536L,0);
printmessage16(""); //Clear message box (top right of status bar) printmessage16(""); //Clear message box (top right of status bar)
ExtShowWallData(wallnum); ExtShowWallData(wallnum);
} }
} }
void ExtEditSpriteData(short spritenum) //F8 void ExtEditSpriteData(short spritenum) //F8
{ {
short nickdata; short nickdata;
if (qsetmode == 200) //In 3D mode if (qsetmode == 200) //In 3D mode
{ {
} }
else else
{ {
Bsprintf(tempbuf,"Sprite (%d) Nick's variable: ",spritenum); Bsprintf(tempbuf,"Sprite (%d) Nick's variable: ",spritenum);
nickdata = 0; nickdata = 0;
nickdata = getnumber16(tempbuf,nickdata,65536L,0); nickdata = getnumber16(tempbuf,nickdata,65536L,0);
printmessage16(""); printmessage16("");
printmessage16(""); //Clear message box (top right of status bar) printmessage16(""); //Clear message box (top right of status bar)
ExtShowSpriteData(spritenum); ExtShowSpriteData(spritenum);
} }
} }
void faketimerhandler(void) void faketimerhandler(void)
{ {
sampletimer(); sampletimer();
} }
//Just thought you might want my getnumber16 code //Just thought you might want my getnumber16 code
/* /*
getnumber16(char namestart[80], short num, long maxnumber) getnumber16(char namestart[80], short num, long maxnumber)
{ {

File diff suppressed because it is too large Load diff

View file

@ -19,160 +19,160 @@
static void PopulateVideoModeLists(int fs, HWND list2d, HWND list3d) static void PopulateVideoModeLists(int fs, HWND list2d, HWND list3d)
{ {
int i,j; int i,j;
char buf[64]; char buf[64];
ComboBox_ResetContent(list2d); ComboBox_ResetContent(list2d);
ComboBox_ResetContent(list3d); ComboBox_ResetContent(list3d);
for (i=0; i<validmodecnt; i++) { for (i=0; i<validmodecnt; i++) {
if (validmode[i].fs != fs) continue; if (validmode[i].fs != fs) continue;
// all modes get added to the 3D mode list // all modes get added to the 3D mode list
Bsprintf(buf, "%ldx%ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp); Bsprintf(buf, "%ldx%ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
j = ComboBox_AddString(list3d, buf); j = ComboBox_AddString(list3d, buf);
ComboBox_SetItemData(list3d, j, i); ComboBox_SetItemData(list3d, j, i);
if (xdimgame == validmode[i].xdim && ydimgame == validmode[i].ydim && bppgame == validmode[i].bpp) if (xdimgame == validmode[i].xdim && ydimgame == validmode[i].ydim && bppgame == validmode[i].bpp)
ComboBox_SetCurSel(list3d, j); ComboBox_SetCurSel(list3d, j);
// only 8-bit modes get used for 2D // only 8-bit modes get used for 2D
if (validmode[i].bpp != 8) continue; if (validmode[i].bpp != 8) continue;
Bsprintf(buf, "%ldx%ld", validmode[i].xdim, validmode[i].ydim); Bsprintf(buf, "%ldx%ld", validmode[i].xdim, validmode[i].ydim);
j = ComboBox_AddString(list2d, buf); j = ComboBox_AddString(list2d, buf);
ComboBox_SetItemData(list2d, j, i); ComboBox_SetItemData(list2d, j, i);
if (xdim2d == validmode[i].xdim && ydim2d == validmode[i].ydim && 8 == validmode[i].bpp) if (xdim2d == validmode[i].xdim && ydim2d == validmode[i].ydim && 8 == validmode[i].bpp)
ComboBox_SetCurSel(list2d, j); ComboBox_SetCurSel(list2d, j);
} }
} }
static INT_PTR CALLBACK LaunchWindowProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK LaunchWindowProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
switch (uMsg) { switch (uMsg) {
case WM_INITDIALOG: { case WM_INITDIALOG: {
char buf[64]; char buf[64];
if (lParam) { if (lParam) {
long *saferect = (long*)lParam; long *saferect = (long*)lParam;
RECT unresized, playbutton, exitbutton; RECT unresized, playbutton, exitbutton;
int dx, dy; int dx, dy;
GetWindowRect(hwndDlg, &unresized); GetWindowRect(hwndDlg, &unresized);
GetWindowRect(GetDlgItem(hwndDlg, IDOK), &playbutton); GetWindowRect(GetDlgItem(hwndDlg, IDOK), &playbutton);
GetWindowRect(GetDlgItem(hwndDlg, IDCANCEL), &exitbutton); GetWindowRect(GetDlgItem(hwndDlg, IDCANCEL), &exitbutton);
playbutton.right = 1 + playbutton.right - playbutton.left; playbutton.right = 1 + playbutton.right - playbutton.left;
playbutton.bottom = 1 + playbutton.bottom - playbutton.top; playbutton.bottom = 1 + playbutton.bottom - playbutton.top;
exitbutton.right = 1 + exitbutton.right - exitbutton.left; exitbutton.right = 1 + exitbutton.right - exitbutton.left;
exitbutton.bottom = 1 + exitbutton.bottom - exitbutton.top; exitbutton.bottom = 1 + exitbutton.bottom - exitbutton.top;
playbutton.left = playbutton.left - unresized.left;
playbutton.top = playbutton.top - unresized.top;
exitbutton.left = exitbutton.left - unresized.left;
exitbutton.top = exitbutton.top - unresized.top;
dx = saferect[2] - (unresized.right - unresized.left); playbutton.left = playbutton.left - unresized.left;
dy = saferect[3] - (unresized.bottom - unresized.top); playbutton.top = playbutton.top - unresized.top;
exitbutton.left = exitbutton.left - unresized.left;
exitbutton.top = exitbutton.top - unresized.top;
playbutton.left += dx; exitbutton.left += dx; dx = saferect[2] - (unresized.right - unresized.left);
playbutton.top += dy; exitbutton.top += dy; dy = saferect[3] - (unresized.bottom - unresized.top);
// reposition the dialog, play and exit buttons playbutton.left += dx; exitbutton.left += dx;
MoveWindow(hwndDlg, saferect[0], saferect[1], saferect[2], saferect[3], FALSE); playbutton.top += dy; exitbutton.top += dy;
MoveWindow(GetDlgItem(hwndDlg, IDOK),
playbutton.left, playbutton.top, playbutton.right, playbutton.bottom, FALSE);
MoveWindow(GetDlgItem(hwndDlg, IDCANCEL),
exitbutton.left, exitbutton.top, exitbutton.right, exitbutton.bottom, FALSE);
}
// populate the controls // reposition the dialog, play and exit buttons
Button_SetCheck(GetDlgItem(hwndDlg, IDCFULLSCREEN), fullscreen ? BST_CHECKED : BST_UNCHECKED); MoveWindow(hwndDlg, saferect[0], saferect[1], saferect[2], saferect[3], FALSE);
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDC2DVMODE), GetDlgItem(hwndDlg, IDC3DVMODE)); MoveWindow(GetDlgItem(hwndDlg, IDOK),
playbutton.left, playbutton.top, playbutton.right, playbutton.bottom, FALSE);
MoveWindow(GetDlgItem(hwndDlg, IDCANCEL),
exitbutton.left, exitbutton.top, exitbutton.right, exitbutton.bottom, FALSE);
ShowWindow(hwndDlg, SW_SHOW); }
/*
if (GetDlgCtrlID((HWND)wParam) != IDOK) { // populate the controls
SetFocus(GetDlgItem(hwndDlg, IDOK)); Button_SetCheck(GetDlgItem(hwndDlg, IDCFULLSCREEN), fullscreen ? BST_CHECKED : BST_UNCHECKED);
return FALSE; PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDC2DVMODE), GetDlgItem(hwndDlg, IDC3DVMODE));
}
*/ ShowWindow(hwndDlg, SW_SHOW);
return TRUE; /*
} if (GetDlgCtrlID((HWND)wParam) != IDOK) {
case WM_COMMAND: SetFocus(GetDlgItem(hwndDlg, IDOK));
switch (LOWORD(wParam)) { return FALSE;
case IDCFULLSCREEN: }
fullscreen = Button_GetCheck((HWND)lParam) == BST_CHECKED ? 1:0; */
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDC2DVMODE), return TRUE;
GetDlgItem(hwndDlg, IDC3DVMODE)); }
break; case WM_COMMAND:
case IDC2DVMODE: switch (LOWORD(wParam)) {
if (HIWORD(wParam) == CBN_SELCHANGE) { case IDCFULLSCREEN:
int i; fullscreen = Button_GetCheck((HWND)lParam) == BST_CHECKED ? 1:0;
i = ComboBox_GetCurSel((HWND)lParam); PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDC2DVMODE),
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i); GetDlgItem(hwndDlg, IDC3DVMODE));
if (i != CB_ERR) { break;
xdim2d = validmode[i].xdim; case IDC2DVMODE:
ydim2d = validmode[i].ydim; if (HIWORD(wParam) == CBN_SELCHANGE) {
} int i;
} i = ComboBox_GetCurSel((HWND)lParam);
break; if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
case IDC3DVMODE: if (i != CB_ERR) {
if (HIWORD(wParam) == CBN_SELCHANGE) { xdim2d = validmode[i].xdim;
int i; ydim2d = validmode[i].ydim;
i = ComboBox_GetCurSel((HWND)lParam); }
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i); }
if (i != CB_ERR) { break;
xdimgame = validmode[i].xdim; case IDC3DVMODE:
ydimgame = validmode[i].ydim; if (HIWORD(wParam) == CBN_SELCHANGE) {
bppgame = validmode[i].bpp; int i;
} i = ComboBox_GetCurSel((HWND)lParam);
} if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
break; if (i != CB_ERR) {
case IDCANCEL: xdimgame = validmode[i].xdim;
quitevent = 1; // fall through ydimgame = validmode[i].ydim;
case IDOK: bppgame = validmode[i].bpp;
DestroyWindow(hwndDlg); }
return TRUE; }
default: break; break;
} case IDCANCEL:
break; quitevent = 1; // fall through
default: break; case IDOK:
} DestroyWindow(hwndDlg);
return FALSE; return TRUE;
default: break;
}
break;
default: break;
}
return FALSE;
} }
int DoLaunchWindow(int initval) int DoLaunchWindow(int initval)
{ {
HWND hwndStart, hwndLaunch; HWND hwndStart, hwndLaunch;
MSG msg; MSG msg;
long saferect[4]; long saferect[4];
int x; int x;
// only show config window if no config is loaded, or if it is, only if left control is held // only show config window if no config is loaded, or if it is, only if left control is held
if (initval == 0 /*&& !GetAsyncKeyState(VK_CONTROL)*/) return 0; if (initval == 0 /*&& !GetAsyncKeyState(VK_CONTROL)*/) return 0;
if (win_getstartupwin((long*)&hwndStart, saferect, NULL)) return 0; if (win_getstartupwin((long*)&hwndStart, saferect, NULL)) return 0;
hwndLaunch = CreateDialogParam((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(2000), hwndStart, LaunchWindowProc, (LPARAM)saferect); hwndLaunch = CreateDialogParam((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(2000), hwndStart, LaunchWindowProc, (LPARAM)saferect);
if (hwndLaunch) { if (hwndLaunch) {
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),FALSE); EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),FALSE);
#if 0 #if 0
while (GetMessage(&msg, NULL, 0, 0) > 0) { while (GetMessage(&msg, NULL, 0, 0) > 0) {
if (!IsWindow(hwndLaunch) || quitevent) break; if (!IsWindow(hwndLaunch) || quitevent) break;
if (IsDialogMessage(hwndStart, &msg) /*|| IsDialogMessage(hwndLaunch, &msg)*/) continue; if (IsDialogMessage(hwndStart, &msg) /*|| IsDialogMessage(hwndLaunch, &msg)*/) continue;
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
#else #else
while (IsWindow(hwndLaunch) && !quitevent) { while (IsWindow(hwndLaunch) && !quitevent) {
x = win_getstartupcommand(); x = win_getstartupcommand();
if (x != 0) LaunchWindowProc(hwndLaunch, WM_COMMAND, x, 0); if (x != 0) LaunchWindowProc(hwndLaunch, WM_COMMAND, x, 0);
handleevents(); handleevents();
} }
#endif #endif
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),TRUE); EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),TRUE);
} }
if (quitevent) return 1; if (quitevent) return 1;
return 0; return 0;
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -12,45 +12,45 @@
#include "baselayer.h" #include "baselayer.h"
static long vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400}, 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}, {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) static int readconfig(BFILE *fp, const char *key, char *value, unsigned len)
{ {
char buf[1000], *k, *v, *eq; char buf[1000], *k, *v, *eq;
int x=0; int x=0;
if (len < 1) return 0; if (len < 1) return 0;
Brewind(fp); Brewind(fp);
while (1) { while (1) {
if (!Bfgets(buf, 1000, fp)) return 0; if (!Bfgets(buf, 1000, fp)) return 0;
if (buf[0] == ';') continue; if (buf[0] == ';') continue;
eq = Bstrchr(buf, '='); eq = Bstrchr(buf, '=');
if (!eq) continue; if (!eq) continue;
k = buf; k = buf;
v = eq+1; v = eq+1;
while (*k == ' ' || *k == '\t') k++; while (*k == ' ' || *k == '\t') k++;
*(eq--) = 0; *(eq--) = 0;
while ((*eq == ' ' || *eq == '\t') && eq>=k) *(eq--) = 0; while ((*eq == ' ' || *eq == '\t') && eq>=k) *(eq--) = 0;
if (Bstrcasecmp(k, key)) continue; if (Bstrcasecmp(k, key)) continue;
while (*v == ' ' || *k == '\t') v++;
eq = v + Bstrlen(v)-1;
while ((*eq == ' ' || *eq == '\t' || *eq == '\r' || *eq == '\n') && eq>=v) *(eq--) = 0; while (*v == ' ' || *k == '\t') v++;
eq = v + Bstrlen(v)-1;
value[--len] = 0; while ((*eq == ' ' || *eq == '\t' || *eq == '\r' || *eq == '\n') && eq>=v) *(eq--) = 0;
do value[x] = v[x]; while (v[x++] != 0 && len-- > 0);
return x-1; value[--len] = 0;
} do value[x] = v[x]; while (v[x++] != 0 && len-- > 0);
return x-1;
}
} }
extern short brightness; extern short brightness;
@ -99,35 +99,35 @@ extern double msens;
int loadsetup(const char *fn) int loadsetup(const char *fn)
{ {
BFILE *fp; BFILE *fp;
#define VL 32 #define VL 32
char val[VL]; char val[VL];
int i; int i;
if ((fp = Bfopen(fn, "rt")) == NULL) return -1; if ((fp = Bfopen(fn, "rt")) == NULL) return -1;
if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; } if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; }
if (readconfig(fp, "resolution", val, VL) > 0) { if (readconfig(fp, "resolution", val, VL) > 0) {
i = Batoi(val) & 0x0f; i = Batoi(val) & 0x0f;
if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; } if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; }
} }
if (readconfig(fp, "2dresolution", val, VL) > 0) { if (readconfig(fp, "2dresolution", val, VL) > 0) {
i = Batoi(val) & 0x0f; i = Batoi(val) & 0x0f;
if ((unsigned)i<13) { xdim2d = vesares[i][0]; ydim2d = vesares[i][1]; } if ((unsigned)i<13) { xdim2d = vesares[i][0]; ydim2d = vesares[i][1]; }
} }
if (readconfig(fp, "xdim2d", val, VL) > 0) xdim2d = Batoi(val); if (readconfig(fp, "xdim2d", val, VL) > 0) xdim2d = Batoi(val);
if (readconfig(fp, "ydim2d", val, VL) > 0) ydim2d = Batoi(val); if (readconfig(fp, "ydim2d", val, VL) > 0) ydim2d = Batoi(val);
if (readconfig(fp, "xdim3d", val, VL) > 0) xdimgame = Batoi(val); if (readconfig(fp, "xdim3d", val, VL) > 0) xdimgame = Batoi(val);
if (readconfig(fp, "ydim3d", val, VL) > 0) ydimgame = Batoi(val); if (readconfig(fp, "ydim3d", val, VL) > 0) ydimgame = Batoi(val);
if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4; if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4;
if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; } if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; } if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val); if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); } if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); }
if (readconfig(fp, "brightness", val, VL) > 0) brightness = min(max(Batoi(val),0),15); if (readconfig(fp, "brightness", val, VL) > 0) brightness = min(max(Batoi(val),0),15);
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val); if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val);
#endif #endif
glusetexcache = glusetexcachecompression = -1; glusetexcache = glusetexcachecompression = -1;
if (readconfig(fp, "glusetexcache", val, VL) > 0) { if (readconfig(fp, "glusetexcache", val, VL) > 0) {
@ -142,166 +142,166 @@ int loadsetup(const char *fn)
{ {
i=wm_ynbox("Texture caching", i=wm_ynbox("Texture caching",
"Would you like to enable the on-disk texture cache? " "Would you like to enable the on-disk texture cache? "
"This feature may use up to 200 megabytes of disk " "This feature may use up to 200 megabytes of disk "
"space if you have a great deal of high resolution " "space if you have a great deal of high resolution "
"textures and skins, but textures will load exponentially " "textures and skins, but textures will load exponentially "
"faster after the first time they are loaded."); "faster after the first time they are loaded.");
if (i) i = 'y'; if (i) i = 'y';
if(i == 'y' || i == 'Y' ) if(i == 'y' || i == 'Y' )
glusetexcompr = glusetexcache = glusetexcachecompression = 1; glusetexcompr = glusetexcache = glusetexcachecompression = 1;
else glusetexcache = glusetexcachecompression = 0; else glusetexcache = glusetexcachecompression = 0;
} }
option[0] = 1; // vesa all the way... option[0] = 1; // vesa all the way...
option[1] = 1; // sound all the way... option[1] = 1; // sound all the way...
option[4] = 0; // no multiplayer option[4] = 0; // no multiplayer
option[5] = 0; option[5] = 0;
if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keybackward", val, VL) > 0) keys[1] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keybackward", val, VL) > 0) keys[1] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyturnleft", val, VL) > 0) keys[2] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyturnleft", val, VL) > 0) keys[2] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyturnright", val, VL) > 0) keys[3] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyturnright", val, VL) > 0) keys[3] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyrun", val, VL) > 0) keys[4] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyrun", val, VL) > 0) keys[4] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keystrafe", val, VL) > 0) keys[5] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystrafe", val, VL) > 0) keys[5] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyfire", val, VL) > 0) keys[6] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyfire", val, VL) > 0) keys[6] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyuse", val, VL) > 0) keys[7] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyuse", val, VL) > 0) keys[7] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keystandhigh", val, VL) > 0) keys[8] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystandhigh", val, VL) > 0) keys[8] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keystandlow", val, VL) > 0) keys[9] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystandlow", val, VL) > 0) keys[9] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keylookup", val, VL) > 0) keys[10] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keylookup", val, VL) > 0) keys[10] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keylookdown", val, VL) > 0) keys[11] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keylookdown", val, VL) > 0) keys[11] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keystrafeleft", val, VL) > 0) keys[12] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystrafeleft", val, VL) > 0) keys[12] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keystraferight", val, VL) > 0) keys[13] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystraferight", val, VL) > 0) keys[13] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "key2dmode", val, VL) > 0) keys[14] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dmode", val, VL) > 0) keys[14] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyviewcycle", val, VL) > 0) keys[15] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyviewcycle", val, VL) > 0) keys[15] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); } if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); }
if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL); if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL);
Bfclose(fp); Bfclose(fp);
return 0; return 0;
} }
int writesetup(const char *fn) int writesetup(const char *fn)
{ {
BFILE *fp; BFILE *fp;
fp = Bfopen(fn,"wt"); fp = Bfopen(fn,"wt");
if (!fp) return -1; if (!fp) return -1;
Bfprintf(fp, Bfprintf(fp,
"; Video mode selection\n" "; Video mode selection\n"
"; 0 - Windowed\n" "; 0 - Windowed\n"
"; 1 - Fullscreen\n" "; 1 - Fullscreen\n"
"fullscreen = %ld\n" "fullscreen = %ld\n"
"\n" "\n"
"; Video resolution\n" "; Video resolution\n"
"xdim2d = %ld\n" "xdim2d = %ld\n"
"ydim2d = %ld\n" "ydim2d = %ld\n"
"xdim3d = %ld\n" "xdim3d = %ld\n"
"ydim3d = %ld\n" "ydim3d = %ld\n"
"\n" "\n"
"; 3D-mode colour depth\n" "; 3D-mode colour depth\n"
"bpp = %ld\n" "bpp = %ld\n"
"\n" "\n"
"; OpenGL mode options\n" "; OpenGL mode options\n"
"glusetexcache = %ld\n" "glusetexcache = %ld\n"
"glusetexcachecompression = %ld\n" "glusetexcachecompression = %ld\n"
"\n" "\n"
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
"; Maximum OpenGL mode refresh rate (Windows only, in Hertz)\n" "; Maximum OpenGL mode refresh rate (Windows only, in Hertz)\n"
"maxrefreshfreq = %d\n" "maxrefreshfreq = %d\n"
"\n" "\n"
#endif #endif
"; 3D mode brightness setting\n" "; 3D mode brightness setting\n"
"; 0 - lowest\n" "; 0 - lowest\n"
"; 15 - highest\n" "; 15 - highest\n"
"brightness = %d\n" "brightness = %d\n"
"\n" "\n"
"; Sound sample frequency\n" "; Sound sample frequency\n"
"; 0 - 6 KHz\n" "; 0 - 6 KHz\n"
"; 1 - 8 KHz\n" "; 1 - 8 KHz\n"
"; 2 - 11.025 KHz\n" "; 2 - 11.025 KHz\n"
"; 3 - 16 KHz\n" "; 3 - 16 KHz\n"
"; 4 - 22.05 KHz\n" "; 4 - 22.05 KHz\n"
"; 5 - 32 KHz\n" "; 5 - 32 KHz\n"
"; 6 - 44.1 KHz\n" "; 6 - 44.1 KHz\n"
"samplerate = %d\n" "samplerate = %d\n"
"\n" "\n"
"; Music playback\n" "; Music playback\n"
"; 0 - Off\n" "; 0 - Off\n"
"; 1 - On\n" "; 1 - On\n"
"music = %d\n" "music = %d\n"
"\n" "\n"
"; Enable mouse\n" "; Enable mouse\n"
"; 0 - No\n" "; 0 - No\n"
"; 1 - Yes\n" "; 1 - Yes\n"
"mouse = %d\n" "mouse = %d\n"
"\n" "\n"
"; Mouse sensitivity\n" "; Mouse sensitivity\n"
"mousesensitivity = %g\n" "mousesensitivity = %g\n"
"\n" "\n"
"; Key Settings\n" "; Key Settings\n"
"; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n" "; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n"
"; +---------------------------------------------------------------------------------------------+\n" "; +---------------------------------------------------------------------------------------------+\n"
"; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 |\n" "; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 |\n"
"; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL |\n" "; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL |\n"
"; | |\n" "; | |\n"
"; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A |\n" "; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A |\n"
"; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- |\n" "; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- |\n"
"; | |\n" "; | |\n"
"; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E |\n" "; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E |\n"
"; |TAB Q W E R T Y U I O P [ ] \\ DEL END PGDN KP7 KP8 KP9 KP+ |\n" "; |TAB Q W E R T Y U I O P [ ] \\ DEL END PGDN KP7 KP8 KP9 KP+ |\n"
"; | |\n" "; | |\n"
"; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D |\n" "; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D |\n"
"; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C |\n" "; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C |\n"
"; | KPENTER|\n" "; | KPENTER|\n"
"; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 |\n" "; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 |\n"
"; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 |\n" "; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 |\n"
"; | |\n" "; | |\n"
"; | 1D 38 39 B8 9D CB D0 CD 52 53 |\n" "; | 1D 38 39 B8 9D CB D0 CD 52 53 |\n"
"; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. |\n" "; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. |\n"
"; +---------------------------------------------------------------------------------------------+\n" "; +---------------------------------------------------------------------------------------------+\n"
"\n" "\n"
"keyforward = %X\n" "keyforward = %X\n"
"keybackward = %X\n" "keybackward = %X\n"
"keyturnleft = %X\n" "keyturnleft = %X\n"
"keyturnright = %X\n" "keyturnright = %X\n"
"keyrun = %X\n" "keyrun = %X\n"
"keystrafe = %X\n" "keystrafe = %X\n"
"keyfire = %X\n" "keyfire = %X\n"
"keyuse = %X\n" "keyuse = %X\n"
"keystandhigh = %X\n" "keystandhigh = %X\n"
"keystandlow = %X\n" "keystandlow = %X\n"
"keylookup = %X\n" "keylookup = %X\n"
"keylookdown = %X\n" "keylookdown = %X\n"
"keystrafeleft = %X\n" "keystrafeleft = %X\n"
"keystraferight = %X\n" "keystraferight = %X\n"
"key2dmode = %X\n" "key2dmode = %X\n"
"keyviewcycle = %X\n" "keyviewcycle = %X\n"
"key2dzoomin = %X\n" "key2dzoomin = %X\n"
"key2dzoomout = %X\n" "key2dzoomout = %X\n"
"keychat = %X\n" "keychat = %X\n"
"keyconsole = %X\n" "keyconsole = %X\n"
"\n", "\n",
fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame, fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame,
glusetexcache, glusetexcachecompression, glusetexcache, glusetexcachecompression,
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
maxrefreshfreq, maxrefreshfreq,
#endif #endif
brightness, option[7]>>4, option[2], brightness, option[7]>>4, option[2],
option[3], msens, option[3], msens,
keys[0], keys[1], keys[2], keys[3], keys[4], keys[5], keys[0], keys[1], keys[2], keys[3], keys[4], keys[5],
keys[6], keys[7], keys[8], keys[9], keys[10], keys[11], keys[6], keys[7], keys[8], keys[9], keys[10], keys[11],
keys[12], keys[13], keys[14], keys[15], keys[16], keys[17], keys[12], keys[13], keys[14], keys[15], keys[16], keys[17],
keys[18], keys[19] keys[18], keys[19]
); );
Bfclose(fp); Bfclose(fp);
return 0; return 0;
} }

View file

@ -62,43 +62,43 @@ static unsigned long crc32table[256];
void initcrc32table(void) void initcrc32table(void)
{ {
unsigned long i,j,k; unsigned long i,j,k;
// algorithm and polynomial same as that used by infozip's zip // algorithm and polynomial same as that used by infozip's zip
for (i=0; i<256; i++) { for (i=0; i<256; i++) {
j = i; j = i;
for (k=8; k; k--) for (k=8; k; k--)
j = (j&1) ? (0xedb88320L ^ (j>>1)) : (j>>1); j = (j&1) ? (0xedb88320L ^ (j>>1)) : (j>>1);
crc32table[i] = j; crc32table[i] = j;
} }
} }
unsigned long crc32once(unsigned char *blk, unsigned long len) unsigned long crc32once(unsigned char *blk, unsigned long len)
{ {
unsigned long crc; unsigned long crc;
crc32init(&crc); crc32init(&crc);
crc32block(&crc, blk, len); crc32block(&crc, blk, len);
return crc32finish(&crc); return crc32finish(&crc);
} }
void crc32init(unsigned long *crcvar) void crc32init(unsigned long *crcvar)
{ {
if (!crcvar) return; if (!crcvar) return;
*crcvar = 0xffffffffl; *crcvar = 0xffffffffl;
} }
void crc32block(unsigned long *crcvar, unsigned char *blk, unsigned long len) void crc32block(unsigned long *crcvar, unsigned char *blk, unsigned long len)
{ {
unsigned long crc = *crcvar; unsigned long crc = *crcvar;
while (len--) crc = crc32table[(crc ^ *(blk++)) & 0xffl] ^ (crc >> 8); while (len--) crc = crc32table[(crc ^ *(blk++)) & 0xffl] ^ (crc >> 8);
*crcvar = crc; *crcvar = crc;
} }
unsigned long crc32finish(unsigned long *crcvar) unsigned long crc32finish(unsigned long *crcvar)
{ {
*crcvar = *crcvar ^ 0xffffffffl; *crcvar = *crcvar ^ 0xffffffffl;
return *crcvar; return *crcvar;
} }

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

View file

@ -18,127 +18,127 @@
static void PopulateVideoModeLists(int fs, HWND list3d) static void PopulateVideoModeLists(int fs, HWND list3d)
{ {
int i,j; int i,j;
char buf[64]; char buf[64];
ComboBox_ResetContent(list3d); ComboBox_ResetContent(list3d);
for (i=0; i<validmodecnt; i++) { for (i=0; i<validmodecnt; i++) {
if (validmode[i].fs != fs) continue; if (validmode[i].fs != fs) continue;
Bsprintf(buf, "%ldx%ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp); Bsprintf(buf, "%ldx%ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
j = ComboBox_AddString(list3d, buf); j = ComboBox_AddString(list3d, buf);
ComboBox_SetItemData(list3d, j, i); ComboBox_SetItemData(list3d, j, i);
if (xdimgame == validmode[i].xdim && ydimgame == validmode[i].ydim && bppgame == validmode[i].bpp) if (xdimgame == validmode[i].xdim && ydimgame == validmode[i].ydim && bppgame == validmode[i].bpp)
ComboBox_SetCurSel(list3d, j); ComboBox_SetCurSel(list3d, j);
} }
} }
static INT_PTR CALLBACK LaunchWindowProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK LaunchWindowProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
switch (uMsg) { switch (uMsg) {
case WM_INITDIALOG: { case WM_INITDIALOG: {
char buf[64]; char buf[64];
if (lParam) { if (lParam) {
long *saferect = (long*)lParam; long *saferect = (long*)lParam;
RECT unresized, playbutton, exitbutton; RECT unresized, playbutton, exitbutton;
int dx, dy; int dx, dy;
GetWindowRect(hwndDlg, &unresized); GetWindowRect(hwndDlg, &unresized);
GetWindowRect(GetDlgItem(hwndDlg, IDOK), &playbutton); GetWindowRect(GetDlgItem(hwndDlg, IDOK), &playbutton);
GetWindowRect(GetDlgItem(hwndDlg, IDCANCEL), &exitbutton); GetWindowRect(GetDlgItem(hwndDlg, IDCANCEL), &exitbutton);
playbutton.right = 1 + playbutton.right - playbutton.left; playbutton.right = 1 + playbutton.right - playbutton.left;
playbutton.bottom = 1 + playbutton.bottom - playbutton.top; playbutton.bottom = 1 + playbutton.bottom - playbutton.top;
exitbutton.right = 1 + exitbutton.right - exitbutton.left; exitbutton.right = 1 + exitbutton.right - exitbutton.left;
exitbutton.bottom = 1 + exitbutton.bottom - exitbutton.top; exitbutton.bottom = 1 + exitbutton.bottom - exitbutton.top;
playbutton.left = playbutton.left - unresized.left;
playbutton.top = playbutton.top - unresized.top;
exitbutton.left = exitbutton.left - unresized.left;
exitbutton.top = exitbutton.top - unresized.top;
dx = saferect[2] - (unresized.right - unresized.left); playbutton.left = playbutton.left - unresized.left;
dy = saferect[3] - (unresized.bottom - unresized.top); playbutton.top = playbutton.top - unresized.top;
exitbutton.left = exitbutton.left - unresized.left;
exitbutton.top = exitbutton.top - unresized.top;
playbutton.left += dx; exitbutton.left += dx; dx = saferect[2] - (unresized.right - unresized.left);
playbutton.top += dy; exitbutton.top += dy; dy = saferect[3] - (unresized.bottom - unresized.top);
// reposition the dialog, play and exit buttons playbutton.left += dx; exitbutton.left += dx;
MoveWindow(hwndDlg, saferect[0], saferect[1], saferect[2], saferect[3], FALSE); playbutton.top += dy; exitbutton.top += dy;
MoveWindow(GetDlgItem(hwndDlg, IDOK),
playbutton.left, playbutton.top, playbutton.right, playbutton.bottom, FALSE);
MoveWindow(GetDlgItem(hwndDlg, IDCANCEL),
exitbutton.left, exitbutton.top, exitbutton.right, exitbutton.bottom, FALSE);
}
// populate the controls // reposition the dialog, play and exit buttons
Button_SetCheck(GetDlgItem(hwndDlg, IDCFULLSCREEN), fullscreen ? BST_CHECKED : BST_UNCHECKED); MoveWindow(hwndDlg, saferect[0], saferect[1], saferect[2], saferect[3], FALSE);
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDCVMODE)); MoveWindow(GetDlgItem(hwndDlg, IDOK),
playbutton.left, playbutton.top, playbutton.right, playbutton.bottom, FALSE);
MoveWindow(GetDlgItem(hwndDlg, IDCANCEL),
exitbutton.left, exitbutton.top, exitbutton.right, exitbutton.bottom, FALSE);
ShowWindow(hwndDlg, SW_SHOW); }
if (GetDlgCtrlID((HWND)wParam) != IDOK) {
SetFocus(GetDlgItem(hwndDlg, IDOK)); // populate the controls
return FALSE; Button_SetCheck(GetDlgItem(hwndDlg, IDCFULLSCREEN), fullscreen ? BST_CHECKED : BST_UNCHECKED);
} PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDCVMODE));
return TRUE;
} ShowWindow(hwndDlg, SW_SHOW);
case WM_COMMAND: if (GetDlgCtrlID((HWND)wParam) != IDOK) {
switch (LOWORD(wParam)) { SetFocus(GetDlgItem(hwndDlg, IDOK));
case IDCFULLSCREEN: return FALSE;
fullscreen = Button_GetCheck((HWND)lParam) == BST_CHECKED ? 1:0; }
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDCVMODE)); return TRUE;
break; }
case IDCVMODE: case WM_COMMAND:
if (HIWORD(wParam) == CBN_SELCHANGE) { switch (LOWORD(wParam)) {
int i; case IDCFULLSCREEN:
i = ComboBox_GetCurSel((HWND)lParam); fullscreen = Button_GetCheck((HWND)lParam) == BST_CHECKED ? 1:0;
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i); PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDCVMODE));
if (i != CB_ERR) { break;
xdimgame = validmode[i].xdim; case IDCVMODE:
ydimgame = validmode[i].ydim; if (HIWORD(wParam) == CBN_SELCHANGE) {
bppgame = validmode[i].bpp; int i;
} i = ComboBox_GetCurSel((HWND)lParam);
} if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
break; if (i != CB_ERR) {
case IDCANCEL: xdimgame = validmode[i].xdim;
quitevent = 1; // fall through ydimgame = validmode[i].ydim;
case IDOK: bppgame = validmode[i].bpp;
DestroyWindow(hwndDlg); }
return TRUE; }
default: break; break;
} case IDCANCEL:
break; quitevent = 1; // fall through
default: break; case IDOK:
} DestroyWindow(hwndDlg);
return FALSE; return TRUE;
default: break;
}
break;
default: break;
}
return FALSE;
} }
int DoLaunchWindow(int initval) int DoLaunchWindow(int initval)
{ {
HWND hwndStart, hwndLaunch; HWND hwndStart, hwndLaunch;
MSG msg; MSG msg;
long saferect[4]; long saferect[4];
// only show config window if no config is loaded, or if it is, only if left control is held // only show config window if no config is loaded, or if it is, only if left control is held
if (initval == 0 && !GetAsyncKeyState(VK_CONTROL)) return 0; if (initval == 0 && !GetAsyncKeyState(VK_CONTROL)) return 0;
if (win_getstartupwin((long*)&hwndStart, saferect, NULL)) return 0; if (win_getstartupwin((long*)&hwndStart, saferect, NULL)) return 0;
hwndLaunch = CreateDialogParam((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(2000), hwndStart, LaunchWindowProc, (LPARAM)saferect); hwndLaunch = CreateDialogParam((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(2000), hwndStart, LaunchWindowProc, (LPARAM)saferect);
if (hwndLaunch) { if (hwndLaunch) {
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),FALSE); EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),FALSE);
while (GetMessage(&msg, NULL, 0, 0) > 0) { while (GetMessage(&msg, NULL, 0, 0) > 0) {
if (!IsWindow(hwndLaunch) || quitevent) break; if (!IsWindow(hwndLaunch) || quitevent) break;
if (IsDialogMessage(hwndStart, &msg) /*|| IsDialogMessage(hwndLaunch, &msg)*/) continue; if (IsDialogMessage(hwndStart, &msg) /*|| IsDialogMessage(hwndLaunch, &msg)*/) continue;
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),TRUE); EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),TRUE);
} }
if (quitevent) return 1; if (quitevent) return 1;
return 0; return 0;
} }

View file

@ -79,7 +79,7 @@ void (APIENTRY * bglGetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
void (APIENTRY * bglFogf)( GLenum pname, GLfloat param ); void (APIENTRY * bglFogf)( GLenum pname, GLfloat param );
void (APIENTRY * bglFogi)( GLenum pname, GLint param ); void (APIENTRY * bglFogi)( GLenum pname, GLint param );
void (APIENTRY * bglFogfv)( GLenum pname, const GLfloat *params ); void (APIENTRY * bglFogfv)( GLenum pname, const GLfloat *params );
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
// Windows // Windows
HGLRC (WINAPI * bwglCreateContext)(HDC); HGLRC (WINAPI * bwglCreateContext)(HDC);
@ -101,20 +101,20 @@ char *gldriver = NULL;
static void * getproc_(const char *s, int *err, int fatal, int extension) static void * getproc_(const char *s, int *err, int fatal, int extension)
{ {
void *t; void *t;
#if defined RENDERTYPESDL #if defined RENDERTYPESDL
t = (void*)SDL_GL_GetProcAddress(s); t = (void*)SDL_GL_GetProcAddress(s);
#elif defined _WIN32 #elif defined _WIN32
if (extension) t = (void*)bwglGetProcAddress(s); if (extension) t = (void*)bwglGetProcAddress(s);
else t = (void*)GetProcAddress(hGLDLL,s); else t = (void*)GetProcAddress(hGLDLL,s);
#else #else
#error Need a dynamic loader for this platform... #error Need a dynamic loader for this platform...
#endif #endif
if (!t && fatal) { if (!t && fatal) {
initprintf("Failed to find %s in %s\n", s, gldriver); initprintf("Failed to find %s in %s\n", s, gldriver);
*err = 1; *err = 1;
} }
return t; return t;
} }
#define GETPROC(s) getproc_(s,&err,1,0) #define GETPROC(s) getproc_(s,&err,1,0)
#define GETPROCSOFT(s) getproc_(s,&err,0,0) #define GETPROCSOFT(s) getproc_(s,&err,0,0)
@ -123,229 +123,229 @@ static void * getproc_(const char *s, int *err, int fatal, int extension)
int loadgldriver(const char *driver) int loadgldriver(const char *driver)
{ {
void *t; void *t;
int err=0; int err=0;
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
if (hGLDLL) return 0; if (hGLDLL) return 0;
#endif #endif
if (!driver) { if (!driver) {
#ifdef _WIN32 #ifdef _WIN32
driver = "OPENGL32.DLL"; driver = "OPENGL32.DLL";
#else #else
driver = "libGL.so"; driver = "libGL.so";
#endif #endif
} }
initprintf("Loading %s\n",driver); initprintf("Loading %s\n",driver);
#if defined RENDERTYPESDL #if defined RENDERTYPESDL
if (SDL_GL_LoadLibrary(driver)) return -1; if (SDL_GL_LoadLibrary(driver)) return -1;
#elif defined _WIN32 #elif defined _WIN32
hGLDLL = LoadLibrary(driver); hGLDLL = LoadLibrary(driver);
if (!hGLDLL) return -1; if (!hGLDLL) return -1;
#endif #endif
gldriver = strdup(driver); gldriver = strdup(driver);
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
bwglCreateContext = GETPROC("wglCreateContext"); bwglCreateContext = GETPROC("wglCreateContext");
bwglDeleteContext = GETPROC("wglDeleteContext"); bwglDeleteContext = GETPROC("wglDeleteContext");
bwglGetProcAddress = GETPROC("wglGetProcAddress"); bwglGetProcAddress = GETPROC("wglGetProcAddress");
bwglMakeCurrent = GETPROC("wglMakeCurrent"); bwglMakeCurrent = GETPROC("wglMakeCurrent");
bwglSwapBuffers = GETPROC("wglSwapBuffers"); bwglSwapBuffers = GETPROC("wglSwapBuffers");
bwglChoosePixelFormat = GETPROC("wglChoosePixelFormat"); bwglChoosePixelFormat = GETPROC("wglChoosePixelFormat");
bwglDescribePixelFormat = GETPROC("wglDescribePixelFormat"); bwglDescribePixelFormat = GETPROC("wglDescribePixelFormat");
bwglGetPixelFormat = GETPROC("wglGetPixelFormat"); bwglGetPixelFormat = GETPROC("wglGetPixelFormat");
bwglSetPixelFormat = GETPROC("wglSetPixelFormat"); bwglSetPixelFormat = GETPROC("wglSetPixelFormat");
#endif #endif
bglClearColor = GETPROC("glClearColor"); bglClearColor = GETPROC("glClearColor");
bglClear = GETPROC("glClear"); bglClear = GETPROC("glClear");
bglColorMask = GETPROC("glColorMask"); bglColorMask = GETPROC("glColorMask");
bglAlphaFunc = GETPROC("glAlphaFunc"); bglAlphaFunc = GETPROC("glAlphaFunc");
bglBlendFunc = GETPROC("glBlendFunc"); bglBlendFunc = GETPROC("glBlendFunc");
bglCullFace = GETPROC("glCullFace"); bglCullFace = GETPROC("glCullFace");
bglFrontFace = GETPROC("glFrontFace"); bglFrontFace = GETPROC("glFrontFace");
bglPolygonOffset = GETPROC("glPolygonOffset"); bglPolygonOffset = GETPROC("glPolygonOffset");
bglPolygonMode = GETPROC("glPolygonMode"); bglPolygonMode = GETPROC("glPolygonMode");
bglEnable = GETPROC("glEnable"); bglEnable = GETPROC("glEnable");
bglDisable = GETPROC("glDisable"); bglDisable = GETPROC("glDisable");
bglGetFloatv = GETPROC("glGetFloatv"); bglGetFloatv = GETPROC("glGetFloatv");
bglGetIntegerv = GETPROC("glGetIntegerv"); bglGetIntegerv = GETPROC("glGetIntegerv");
bglPushAttrib = GETPROC("glPushAttrib"); bglPushAttrib = GETPROC("glPushAttrib");
bglPopAttrib = GETPROC("glPopAttrib"); bglPopAttrib = GETPROC("glPopAttrib");
bglGetError = GETPROC("glGetError"); bglGetError = GETPROC("glGetError");
bglGetString = GETPROC("glGetString"); bglGetString = GETPROC("glGetString");
bglHint = GETPROC("glHint"); bglHint = GETPROC("glHint");
// Depth // Depth
bglDepthFunc = GETPROC("glDepthFunc"); bglDepthFunc = GETPROC("glDepthFunc");
bglDepthMask = GETPROC("glDepthMask"); bglDepthMask = GETPROC("glDepthMask");
bglDepthRange = GETPROC("glDepthRange"); bglDepthRange = GETPROC("glDepthRange");
// Matrix // Matrix
bglMatrixMode = GETPROC("glMatrixMode"); bglMatrixMode = GETPROC("glMatrixMode");
bglOrtho = GETPROC("glOrtho"); bglOrtho = GETPROC("glOrtho");
bglFrustum = GETPROC("glFrustum"); bglFrustum = GETPROC("glFrustum");
bglViewport = GETPROC("glViewport"); bglViewport = GETPROC("glViewport");
bglPushMatrix = GETPROC("glPushMatrix"); bglPushMatrix = GETPROC("glPushMatrix");
bglPopMatrix = GETPROC("glPopMatrix"); bglPopMatrix = GETPROC("glPopMatrix");
bglLoadIdentity = GETPROC("glLoadIdentity"); bglLoadIdentity = GETPROC("glLoadIdentity");
bglLoadMatrixf = GETPROC("glLoadMatrixf"); bglLoadMatrixf = GETPROC("glLoadMatrixf");
// Drawing // Drawing
bglBegin = GETPROC("glBegin"); bglBegin = GETPROC("glBegin");
bglEnd = GETPROC("glEnd"); bglEnd = GETPROC("glEnd");
bglVertex2f = GETPROC("glVertex2f"); bglVertex2f = GETPROC("glVertex2f");
bglVertex2i = GETPROC("glVertex2i"); bglVertex2i = GETPROC("glVertex2i");
bglVertex3d = GETPROC("glVertex3d"); bglVertex3d = GETPROC("glVertex3d");
bglVertex3fv = GETPROC("glVertex3fv"); bglVertex3fv = GETPROC("glVertex3fv");
bglColor4f = GETPROC("glColor4f"); bglColor4f = GETPROC("glColor4f");
bglColor4ub = GETPROC("glColor4ub"); bglColor4ub = GETPROC("glColor4ub");
bglTexCoord2d = GETPROC("glTexCoord2d"); bglTexCoord2d = GETPROC("glTexCoord2d");
bglTexCoord2f = GETPROC("glTexCoord2f"); bglTexCoord2f = GETPROC("glTexCoord2f");
// Lighting // Lighting
bglShadeModel = GETPROC("glShadeModel"); bglShadeModel = GETPROC("glShadeModel");
// Raster funcs // Raster funcs
bglReadPixels = GETPROC("glReadPixels"); bglReadPixels = GETPROC("glReadPixels");
// Texture mapping // Texture mapping
bglTexEnvf = GETPROC("glTexEnvf"); bglTexEnvf = GETPROC("glTexEnvf");
bglGenTextures = GETPROC("glGenTextures"); bglGenTextures = GETPROC("glGenTextures");
bglDeleteTextures = GETPROC("glDeleteTextures"); bglDeleteTextures = GETPROC("glDeleteTextures");
bglBindTexture = GETPROC("glBindTexture"); bglBindTexture = GETPROC("glBindTexture");
bglTexImage2D = GETPROC("glTexImage2D"); bglTexImage2D = GETPROC("glTexImage2D");
bglTexSubImage2D = GETPROC("glTexSubImage2D"); bglTexSubImage2D = GETPROC("glTexSubImage2D");
bglTexParameterf = GETPROC("glTexParameterf"); bglTexParameterf = GETPROC("glTexParameterf");
bglTexParameteri = GETPROC("glTexParameteri"); bglTexParameteri = GETPROC("glTexParameteri");
bglGetTexLevelParameteriv = GETPROC("glGetTexLevelParameteriv"); bglGetTexLevelParameteriv = GETPROC("glGetTexLevelParameteriv");
// Fog // Fog
bglFogf = GETPROC("glFogf"); bglFogf = GETPROC("glFogf");
bglFogi = GETPROC("glFogi"); bglFogi = GETPROC("glFogi");
bglFogfv = GETPROC("glFogfv"); bglFogfv = GETPROC("glFogfv");
loadglextensions(); loadglextensions();
if (err) unloadgldriver(); if (err) unloadgldriver();
return err; return err;
} }
int loadglextensions(void) int loadglextensions(void)
{ {
int err = 0; int err = 0;
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
if (!hGLDLL) return 0; if (!hGLDLL) return 0;
#endif #endif
bglCompressedTexImage2DARB = GETPROCEXTSOFT("glCompressedTexImage2DARB"); bglCompressedTexImage2DARB = GETPROCEXTSOFT("glCompressedTexImage2DARB");
bglGetCompressedTexImageARB = GETPROCEXTSOFT("glGetCompressedTexImageARB"); bglGetCompressedTexImageARB = GETPROCEXTSOFT("glGetCompressedTexImageARB");
return err; return err;
} }
int unloadgldriver(void) int unloadgldriver(void)
{ {
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
if (!hGLDLL) return 0; if (!hGLDLL) return 0;
#endif #endif
free(gldriver); free(gldriver);
gldriver = NULL; gldriver = NULL;
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
FreeLibrary(hGLDLL); FreeLibrary(hGLDLL);
hGLDLL = NULL; hGLDLL = NULL;
#endif #endif
bglClearColor = NULL;
bglClear = NULL;
bglColorMask = NULL;
bglAlphaFunc = NULL;
bglBlendFunc = NULL;
bglCullFace = NULL;
bglFrontFace = NULL;
bglPolygonOffset = NULL;
bglPolygonMode = NULL;
bglEnable = NULL;
bglDisable = NULL;
bglGetFloatv = NULL;
bglGetIntegerv = NULL;
bglPushAttrib = NULL;
bglPopAttrib = NULL;
bglGetError = NULL;
bglGetString = NULL;
bglHint = NULL;
// Depth bglClearColor = NULL;
bglDepthFunc = NULL; bglClear = NULL;
bglDepthMask = NULL; bglColorMask = NULL;
bglDepthRange = NULL; bglAlphaFunc = NULL;
bglBlendFunc = NULL;
bglCullFace = NULL;
bglFrontFace = NULL;
bglPolygonOffset = NULL;
bglPolygonMode = NULL;
bglEnable = NULL;
bglDisable = NULL;
bglGetFloatv = NULL;
bglGetIntegerv = NULL;
bglPushAttrib = NULL;
bglPopAttrib = NULL;
bglGetError = NULL;
bglGetString = NULL;
bglHint = NULL;
// Matrix // Depth
bglMatrixMode = NULL; bglDepthFunc = NULL;
bglOrtho = NULL; bglDepthMask = NULL;
bglFrustum = NULL; bglDepthRange = NULL;
bglViewport = NULL;
bglPushMatrix = NULL;
bglPopMatrix = NULL;
bglLoadIdentity = NULL;
bglLoadMatrixf = NULL;
// Drawing // Matrix
bglBegin = NULL; bglMatrixMode = NULL;
bglEnd = NULL; bglOrtho = NULL;
bglVertex2f = NULL; bglFrustum = NULL;
bglVertex2i = NULL; bglViewport = NULL;
bglVertex3d = NULL; bglPushMatrix = NULL;
bglVertex3fv = NULL; bglPopMatrix = NULL;
bglColor4f = NULL; bglLoadIdentity = NULL;
bglColor4ub = NULL; bglLoadMatrixf = NULL;
bglTexCoord2d = NULL;
bglTexCoord2f = NULL;
// Lighting // Drawing
bglShadeModel = NULL; bglBegin = NULL;
bglEnd = NULL;
bglVertex2f = NULL;
bglVertex2i = NULL;
bglVertex3d = NULL;
bglVertex3fv = NULL;
bglColor4f = NULL;
bglColor4ub = NULL;
bglTexCoord2d = NULL;
bglTexCoord2f = NULL;
// Raster funcs // Lighting
bglReadPixels = NULL; bglShadeModel = NULL;
// Texture mapping // Raster funcs
bglTexEnvf = NULL; bglReadPixels = NULL;
bglGenTextures = NULL;
bglDeleteTextures = NULL; // Texture mapping
bglBindTexture = NULL; bglTexEnvf = NULL;
bglTexImage2D = NULL; bglGenTextures = NULL;
bglTexSubImage2D = NULL; bglDeleteTextures = NULL;
bglTexParameterf = NULL; bglBindTexture = NULL;
bglTexParameteri = NULL; bglTexImage2D = NULL;
bglGetTexLevelParameteriv = NULL; bglTexSubImage2D = NULL;
bglCompressedTexImage2DARB = NULL; bglTexParameterf = NULL;
bglGetCompressedTexImageARB = NULL; bglTexParameteri = NULL;
bglGetTexLevelParameteriv = NULL;
bglCompressedTexImage2DARB = NULL;
bglGetCompressedTexImageARB = NULL;
// Fog
bglFogf = NULL;
bglFogi = NULL;
bglFogfv = NULL;
// Fog
bglFogf = NULL;
bglFogi = NULL;
bglFogfv = NULL;
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
bwglCreateContext = NULL; bwglCreateContext = NULL;
bwglDeleteContext = NULL; bwglDeleteContext = NULL;
bwglGetProcAddress = NULL; bwglGetProcAddress = NULL;
bwglMakeCurrent = NULL; bwglMakeCurrent = NULL;
bwglSwapBuffers = NULL; bwglSwapBuffers = NULL;
bwglChoosePixelFormat = NULL; bwglChoosePixelFormat = NULL;
bwglDescribePixelFormat = NULL; bwglDescribePixelFormat = NULL;
bwglGetPixelFormat = NULL; bwglGetPixelFormat = NULL;
bwglSetPixelFormat = NULL; bwglSetPixelFormat = NULL;
#endif #endif
return 0; return 0;
} }
#else #else

View file

@ -31,182 +31,182 @@ static GdkPixbuf *appicon = NULL;
static gboolean on_startwin_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) static gboolean on_startwin_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data)
{ {
quitevent++; quitevent++;
return TRUE; // FALSE would let the event go through. we want the game to decide when to close return TRUE; // FALSE would let the event go through. we want the game to decide when to close
} }
void gtkbuild_create_startwin(void) void gtkbuild_create_startwin(void)
{ {
GtkWidget *banner, *label, *content, *scroll; GtkWidget *banner, *label, *content, *scroll;
GtkWidget *hbox1, *fixed1; GtkWidget *hbox1, *fixed1;
GdkPixbuf *startbanner_pixbuf; GdkPixbuf *startbanner_pixbuf;
if (!gtkenabled) return; if (!gtkenabled) return;
startwin = gtk_window_new (GTK_WINDOW_TOPLEVEL); startwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (startwin), apptitle); gtk_window_set_title (GTK_WINDOW (startwin), apptitle);
gtk_window_set_position (GTK_WINDOW (startwin), GTK_WIN_POS_CENTER); gtk_window_set_position (GTK_WINDOW (startwin), GTK_WIN_POS_CENTER);
gtk_window_set_resizable (GTK_WINDOW (startwin), FALSE); gtk_window_set_resizable (GTK_WINDOW (startwin), FALSE);
gtk_window_set_type_hint (GTK_WINDOW (startwin), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_type_hint (GTK_WINDOW (startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
hbox1 = gtk_hbox_new (FALSE, 0); hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox1); gtk_widget_show (hbox1);
gtk_container_add (GTK_CONTAINER (startwin), hbox1); gtk_container_add (GTK_CONTAINER (startwin), hbox1);
startbanner_pixbuf = gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL); startbanner_pixbuf = gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL);
banner = gtk_image_new_from_pixbuf(startbanner_pixbuf); banner = gtk_image_new_from_pixbuf(startbanner_pixbuf);
g_object_unref((gpointer)startbanner_pixbuf); g_object_unref((gpointer)startbanner_pixbuf);
gtk_widget_show (banner); gtk_widget_show (banner);
gtk_box_pack_start (GTK_BOX (hbox1), banner, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox1), banner, FALSE, FALSE, 0);
fixed1 = gtk_fixed_new (); fixed1 = gtk_fixed_new ();
gtk_widget_show (fixed1); gtk_widget_show (fixed1);
gtk_box_pack_start (GTK_BOX (hbox1), fixed1, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox1), fixed1, TRUE, TRUE, 0);
gtk_widget_set_size_request (fixed1, 390, -1); gtk_widget_set_size_request (fixed1, 390, -1);
label = gtk_label_new (startwin_labeltext); label = gtk_label_new (startwin_labeltext);
gtk_widget_show (label); gtk_widget_show (label);
gtk_fixed_put (GTK_FIXED (fixed1), label, 6, 6); gtk_fixed_put (GTK_FIXED (fixed1), label, 6, 6);
gtk_widget_set_size_request (label, 378, 16); gtk_widget_set_size_request (label, 378, 16);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
scroll = gtk_scrolled_window_new (NULL, NULL); scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scroll); gtk_widget_show (scroll);
gtk_fixed_put (GTK_FIXED (fixed1), scroll, 6, 28); gtk_fixed_put (GTK_FIXED (fixed1), scroll, 6, 28);
gtk_widget_set_size_request (scroll, 378, 248); gtk_widget_set_size_request (scroll, 378, 248);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
content = gtk_text_view_new (); content = gtk_text_view_new ();
gtk_widget_show (content); gtk_widget_show (content);
gtk_container_add (GTK_CONTAINER(scroll), content); gtk_container_add (GTK_CONTAINER(scroll), content);
//gtk_fixed_put (GTK_FIXED (fixed1), content, 6, 28); //gtk_fixed_put (GTK_FIXED (fixed1), content, 6, 28);
gtk_widget_set_size_request (content, 378, 248); gtk_widget_set_size_request (content, 378, 248);
gtk_text_view_set_editable (GTK_TEXT_VIEW (content), FALSE); gtk_text_view_set_editable (GTK_TEXT_VIEW (content), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (content), GTK_WRAP_WORD); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (content), GTK_WRAP_WORD);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (content), FALSE); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (content), FALSE);
g_signal_connect ((gpointer) startwin, "delete_event", g_signal_connect ((gpointer) startwin, "delete_event",
G_CALLBACK (on_startwin_delete_event), G_CALLBACK (on_startwin_delete_event),
NULL); NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */ /* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (startwin, startwin, "startwin"); GLADE_HOOKUP_OBJECT_NO_REF (startwin, startwin, "startwin");
GLADE_HOOKUP_OBJECT (startwin, banner, "banner"); GLADE_HOOKUP_OBJECT (startwin, banner, "banner");
GLADE_HOOKUP_OBJECT (startwin, label, "label"); GLADE_HOOKUP_OBJECT (startwin, label, "label");
GLADE_HOOKUP_OBJECT (startwin, scroll, "scroll"); GLADE_HOOKUP_OBJECT (startwin, scroll, "scroll");
GLADE_HOOKUP_OBJECT (startwin, content, "content"); GLADE_HOOKUP_OBJECT (startwin, content, "content");
g_signal_connect((gpointer)startwin, "destroy", G_CALLBACK(gtk_widget_destroyed), (gpointer)&startwin); g_signal_connect((gpointer)startwin, "destroy", G_CALLBACK(gtk_widget_destroyed), (gpointer)&startwin);
gtk_widget_show (startwin); gtk_widget_show (startwin);
gtk_main_iteration_do (FALSE); gtk_main_iteration_do (FALSE);
} }
void gtkbuild_settitle_startwin(const char *title) void gtkbuild_settitle_startwin(const char *title)
{ {
if (!gtkenabled || !startwin) return; if (!gtkenabled || !startwin) return;
gtk_window_set_title (GTK_WINDOW (startwin), title); gtk_window_set_title (GTK_WINDOW (startwin), title);
} }
void gtkbuild_puts_startwin(const char *str) void gtkbuild_puts_startwin(const char *str)
{ {
GtkWidget *textview; GtkWidget *textview;
GtkTextBuffer *textbuffer; GtkTextBuffer *textbuffer;
GtkTextIter enditer; GtkTextIter enditer;
GtkTextMark *mark; GtkTextMark *mark;
const char *aptr, *bptr; const char *aptr, *bptr;
if (!gtkenabled || !startwin || !str) return; if (!gtkenabled || !startwin || !str) return;
if (!(textview = lookup_widget(startwin, "content"))) return; if (!(textview = lookup_widget(startwin, "content"))) return;
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
gtk_text_buffer_get_end_iter(textbuffer, &enditer); gtk_text_buffer_get_end_iter(textbuffer, &enditer);
for (aptr = bptr = str; *aptr != 0; ) { for (aptr = bptr = str; *aptr != 0; ) {
switch (*bptr) { switch (*bptr) {
case '\b': case '\b':
if (bptr > aptr) if (bptr > aptr)
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1); gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
#if GTK_CHECK_VERSION(2,6,0) #if GTK_CHECK_VERSION(2,6,0)
gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE); gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
#else #else
{ {
GtkTextIter iter2 = enditer; GtkTextIter iter2 = enditer;
gtk_text_iter_backward_cursor_position(&iter2); gtk_text_iter_backward_cursor_position(&iter2);
//FIXME: this seems be deleting one too many chars somewhere! //FIXME: this seems be deleting one too many chars somewhere!
if (!gtk_text_iter_equal(&iter2, &enditer)) if (!gtk_text_iter_equal(&iter2, &enditer))
gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE); gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE);
} }
#endif #endif
aptr = ++bptr; aptr = ++bptr;
break; break;
case 0: case 0:
if (bptr > aptr) if (bptr > aptr)
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)); gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
aptr = bptr; aptr = bptr;
break; break;
case '\r': // FIXME case '\r': // FIXME
default: default:
bptr++; bptr++;
break; break;
} }
} }
mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1); mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1);
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0); gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0);
gtk_text_buffer_delete_mark(textbuffer, mark); gtk_text_buffer_delete_mark(textbuffer, mark);
} }
void gtkbuild_close_startwin(void) void gtkbuild_close_startwin(void)
{ {
if (!gtkenabled) return; if (!gtkenabled) return;
if (startwin) { if (startwin) {
gtk_widget_destroy (startwin); gtk_widget_destroy (startwin);
startwin = NULL; startwin = NULL;
} }
} }
void gtkbuild_update_startwin(void) void gtkbuild_update_startwin(void)
{ {
if (!gtkenabled) return; if (!gtkenabled) return;
gtk_main_iteration_do (FALSE); gtk_main_iteration_do (FALSE);
} }
int gtkbuild_msgbox(char *name, char *msg) int gtkbuild_msgbox(char *name, char *msg)
{ {
GtkWidget *dialog; GtkWidget *dialog;
if (!gtkenabled) return -1; if (!gtkenabled) return -1;
dialog = gtk_message_dialog_new(NULL, dialog = gtk_message_dialog_new(NULL,
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO, GTK_MESSAGE_INFO,
GTK_BUTTONS_OK, GTK_BUTTONS_OK,
msg); msg);
gtk_window_set_title(GTK_WINDOW(dialog), name); gtk_window_set_title(GTK_WINDOW(dialog), name);
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
return 1; return 1;
} }
int gtkbuild_ynbox(char *name, char *msg) int gtkbuild_ynbox(char *name, char *msg)
{ {
int r; int r;
GtkWidget *dialog; GtkWidget *dialog;
if (!gtkenabled) return -1; if (!gtkenabled) return -1;
dialog = gtk_message_dialog_new(NULL, dialog = gtk_message_dialog_new(NULL,
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO, GTK_MESSAGE_INFO,
GTK_BUTTONS_YES_NO, GTK_BUTTONS_YES_NO,
msg); msg);
gtk_window_set_title(GTK_WINDOW(dialog), name); gtk_window_set_title(GTK_WINDOW(dialog), name);
r = gtk_dialog_run(GTK_DIALOG(dialog)); r = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
if (r == GTK_RESPONSE_YES) return 1; if (r == GTK_RESPONSE_YES) return 1;
return 0; return 0;
} }
#ifdef RENDERTYPESDL #ifdef RENDERTYPESDL
@ -215,24 +215,24 @@ extern struct sdlappicon sdlappicon;
#endif #endif
void gtkbuild_init(int argc, char **argv) void gtkbuild_init(int argc, char **argv)
{ {
gtkenabled = gtk_init_check(argc, argv); gtkenabled = gtk_init_check(argc, argv);
if (!gtkenabled) return; if (!gtkenabled) return;
#ifdef RENDERTYPESDL #ifdef RENDERTYPESDL
appicon = gdk_pixbuf_new_from_data((const guchar *)sdlappicon.pixels, appicon = gdk_pixbuf_new_from_data((const guchar *)sdlappicon.pixels,
GDK_COLORSPACE_RGB, TRUE, 8, sdlappicon.width, sdlappicon.height, GDK_COLORSPACE_RGB, TRUE, 8, sdlappicon.width, sdlappicon.height,
sdlappicon.width*4, NULL, NULL); sdlappicon.width*4, NULL, NULL);
#endif #endif
if (appicon) gtk_window_set_default_icon(appicon); if (appicon) gtk_window_set_default_icon(appicon);
} }
void gtkbuild_exit(int r) void gtkbuild_exit(int r)
{ {
if (!gtkenabled) return; if (!gtkenabled) return;
if (appicon) g_object_unref((gpointer)appicon); if (appicon) g_object_unref((gpointer)appicon);
//gtk_exit(r); //gtk_exit(r);
} }
void *gtkbuild_get_app_icon(void) void *gtkbuild_get_app_icon(void)
{ {
return appicon; return appicon;
} }

View file

@ -10,15 +10,15 @@
static palette_t hictinting[MAXPALOOKUPS]; static palette_t hictinting[MAXPALOOKUPS];
struct hicskybox_t { struct hicskybox_t {
long ignore; long ignore;
char *face[6]; char *face[6];
}; };
typedef struct hicreplc_t { typedef struct hicreplc_t {
struct hicreplc_t *next; struct hicreplc_t *next;
char palnum, ignore, flags, filler; char palnum, ignore, flags, filler;
char *filename; char *filename;
float alphacut; float alphacut;
struct hicskybox_t *skybox; struct hicskybox_t *skybox;
} hicreplctyp; } hicreplctyp;
static hicreplctyp *hicreplc[MAXTILES]; static hicreplctyp *hicreplc[MAXTILES];
static char hicfirstinit = 0; static char hicfirstinit = 0;
@ -28,27 +28,27 @@ static char hicfirstinit = 0;
// //
static hicreplctyp * hicfindsubst(long picnum, long palnum, long skybox) static hicreplctyp * hicfindsubst(long picnum, long palnum, long skybox)
{ {
hicreplctyp *hr; hicreplctyp *hr;
if (!hicfirstinit) return NULL; if (!hicfirstinit) return NULL;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return NULL; if ((unsigned long)picnum >= (unsigned long)MAXTILES) return NULL;
do { do {
for (hr = hicreplc[picnum]; hr; hr = hr->next) { for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum) { if (hr->palnum == palnum) {
if (skybox) { if (skybox) {
if (hr->skybox && !hr->skybox->ignore) return hr; if (hr->skybox && !hr->skybox->ignore) return hr;
} else { } else {
if (!hr->ignore) return hr; if (!hr->ignore) return hr;
} }
} }
} }
if (!palnum) break; if (!palnum) break;
palnum = 0; palnum = 0;
} while (1); } while (1);
return NULL; // no replacement found return NULL; // no replacement found
} }
@ -58,36 +58,36 @@ static hicreplctyp * hicfindsubst(long picnum, long palnum, long skybox)
// //
void hicinit(void) void hicinit(void)
{ {
long i,j; long i,j;
hicreplctyp *hr, *next; hicreplctyp *hr, *next;
for (i=0;i<MAXPALOOKUPS;i++) { // all tints should be 100%
hictinting[i].r = hictinting[i].g = hictinting[i].b = 0xff;
hictinting[i].f = 0;
}
if (hicfirstinit) for (i=0;i<MAXPALOOKUPS;i++) { // all tints should be 100%
for (i=MAXTILES-1;i>=0;i--) { hictinting[i].r = hictinting[i].g = hictinting[i].b = 0xff;
for (hr=hicreplc[i]; hr; ) { hictinting[i].f = 0;
next = hr->next; }
if (hr->skybox) { if (hicfirstinit)
for (j=5;j>=0;j--) { for (i=MAXTILES-1;i>=0;i--) {
if (hr->skybox->face[j]) { for (hr=hicreplc[i]; hr; ) {
free(hr->skybox->face[j]); next = hr->next;
}
}
free(hr->skybox);
}
if (hr->filename) free(hr->filename);
free(hr);
hr = next; if (hr->skybox) {
} for (j=5;j>=0;j--) {
} if (hr->skybox->face[j]) {
memset(hicreplc,0,sizeof(hicreplc)); free(hr->skybox->face[j]);
}
hicfirstinit = 1; }
free(hr->skybox);
}
if (hr->filename) free(hr->filename);
free(hr);
hr = next;
}
}
memset(hicreplc,0,sizeof(hicreplc));
hicfirstinit = 1;
} }
@ -99,13 +99,13 @@ void hicinit(void)
// //
void hicsetpalettetint(long palnum, unsigned char r, unsigned char g, unsigned char b, unsigned char effect) void hicsetpalettetint(long palnum, unsigned char r, unsigned char g, unsigned char b, unsigned char effect)
{ {
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return; if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return;
if (!hicfirstinit) hicinit(); if (!hicfirstinit) hicinit();
hictinting[palnum].r = r; hictinting[palnum].r = r;
hictinting[palnum].g = g; hictinting[palnum].g = g;
hictinting[palnum].b = b; hictinting[palnum].b = b;
hictinting[palnum].f = effect & HICEFFECTMASK; hictinting[palnum].f = effect & HICEFFECTMASK;
} }
@ -115,44 +115,44 @@ void hicsetpalettetint(long palnum, unsigned char r, unsigned char g, unsigned c
// //
int hicsetsubsttex(long picnum, long palnum, char *filen, float alphacut, char flags) int hicsetsubsttex(long picnum, long palnum, char *filen, float alphacut, char flags)
{ {
hicreplctyp *hr, *hrn; hicreplctyp *hr, *hrn;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1; if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1; if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
if (!hicfirstinit) hicinit(); if (!hicfirstinit) hicinit();
for (hr = hicreplc[picnum]; hr; hr = hr->next) { for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum) if (hr->palnum == palnum)
break; break;
} }
if (!hr) { if (!hr) {
// no replacement yet defined // no replacement yet defined
hrn = (hicreplctyp *)calloc(1,sizeof(hicreplctyp)); hrn = (hicreplctyp *)calloc(1,sizeof(hicreplctyp));
if (!hrn) return -1; if (!hrn) return -1;
hrn->palnum = palnum; hrn->palnum = palnum;
} else hrn = hr; } else hrn = hr;
// store into hicreplc the details for this replacement // store into hicreplc the details for this replacement
if (hrn->filename) free(hrn->filename); if (hrn->filename) free(hrn->filename);
hrn->filename = strdup(filen); hrn->filename = strdup(filen);
if (!hrn->filename) { if (!hrn->filename) {
if (hrn->skybox) return -1; // don't free the base structure if there's a skybox defined if (hrn->skybox) return -1; // don't free the base structure if there's a skybox defined
if (hr == NULL) free(hrn); // not yet a link in the chain if (hr == NULL) free(hrn); // not yet a link in the chain
return -1; return -1;
} }
hrn->ignore = 0; hrn->ignore = 0;
hrn->alphacut = min(alphacut,1.0); hrn->alphacut = min(alphacut,1.0);
hrn->flags = flags; hrn->flags = flags;
if (hr == NULL) { if (hr == NULL) {
hrn->next = hicreplc[picnum]; hrn->next = hicreplc[picnum];
hicreplc[picnum] = hrn; hicreplc[picnum] = hrn;
} }
//printf("Replacement [%d,%d]: %s\n", picnum, palnum, hicreplc[i]->filename); //printf("Replacement [%d,%d]: %s\n", picnum, palnum, hicreplc[i]->filename);
return 0; return 0;
} }
@ -162,59 +162,59 @@ int hicsetsubsttex(long picnum, long palnum, char *filen, float alphacut, char f
// //
int hicsetskybox(long picnum, long palnum, char *faces[6]) int hicsetskybox(long picnum, long palnum, char *faces[6])
{ {
hicreplctyp *hr, *hrn; hicreplctyp *hr, *hrn;
long j; long j;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1; if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1; if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
for (j=5;j>=0;j--) if (!faces[j]) return -1; for (j=5;j>=0;j--) if (!faces[j]) return -1;
if (!hicfirstinit) hicinit(); if (!hicfirstinit) hicinit();
for (hr = hicreplc[picnum]; hr; hr = hr->next) { for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum) if (hr->palnum == palnum)
break; break;
} }
if (!hr) { if (!hr) {
// no replacement yet defined // no replacement yet defined
hrn = (hicreplctyp *)calloc(1,sizeof(hicreplctyp)); hrn = (hicreplctyp *)calloc(1,sizeof(hicreplctyp));
if (!hrn) return -1; if (!hrn) return -1;
hrn->palnum = palnum; hrn->palnum = palnum;
} else hrn = hr; } else hrn = hr;
if (!hrn->skybox) {
hrn->skybox = (struct hicskybox_t *)calloc(1,sizeof(struct hicskybox_t));
if (!hrn->skybox) {
if (hr == NULL) free(hrn); // not yet a link in the chain
return -1;
}
} else {
for (j=5;j>=0;j--) {
if (hrn->skybox->face[j])
free(hrn->skybox->face[j]);
}
}
// store each face's filename if (!hrn->skybox) {
for (j=0;j<6;j++) { hrn->skybox = (struct hicskybox_t *)calloc(1,sizeof(struct hicskybox_t));
hrn->skybox->face[j] = strdup(faces[j]); if (!hrn->skybox) {
if (!hrn->skybox->face[j]) { if (hr == NULL) free(hrn); // not yet a link in the chain
for (--j; j>=0; --j) // free any previous faces return -1;
free(hrn->skybox->face[j]); }
free(hrn->skybox); } else {
hrn->skybox = NULL; for (j=5;j>=0;j--) {
if (hr == NULL) free(hrn); if (hrn->skybox->face[j])
return -1; free(hrn->skybox->face[j]);
} }
} }
hrn->skybox->ignore = 0;
if (hr == NULL) {
hrn->next = hicreplc[picnum];
hicreplc[picnum] = hrn;
}
return 0; // store each face's filename
for (j=0;j<6;j++) {
hrn->skybox->face[j] = strdup(faces[j]);
if (!hrn->skybox->face[j]) {
for (--j; j>=0; --j) // free any previous faces
free(hrn->skybox->face[j]);
free(hrn->skybox);
hrn->skybox = NULL;
if (hr == NULL) free(hrn);
return -1;
}
}
hrn->skybox->ignore = 0;
if (hr == NULL) {
hrn->next = hicreplc[picnum];
hicreplc[picnum] = hrn;
}
return 0;
} }
@ -224,31 +224,31 @@ int hicsetskybox(long picnum, long palnum, char *faces[6])
// //
int hicclearsubst(long picnum, long palnum) int hicclearsubst(long picnum, long palnum)
{ {
hicreplctyp *hr, *hrn = NULL; hicreplctyp *hr, *hrn = NULL;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1; if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1; if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
if (!hicfirstinit) return 0; if (!hicfirstinit) return 0;
for (hr = hicreplc[picnum]; hr; hrn = hr, hr = hr->next) { for (hr = hicreplc[picnum]; hr; hrn = hr, hr = hr->next) {
if (hr->palnum == palnum) if (hr->palnum == palnum)
break; break;
} }
if (!hr) return 0; if (!hr) return 0;
if (hr->filename) free(hr->filename); if (hr->filename) free(hr->filename);
if (hr->skybox) { if (hr->skybox) {
int i; int i;
for (i=5;i>=0;i--) for (i=5;i>=0;i--)
if (hr->skybox->face[i]) if (hr->skybox->face[i])
free(hr->skybox->face[i]); free(hr->skybox->face[i]);
free(hr->skybox); free(hr->skybox);
} }
if (hrn) hrn->next = hr->next; if (hrn) hrn->next = hr->next;
else hicreplc[picnum] = hr->next; else hicreplc[picnum] = hr->next;
free(hr); free(hr);
return 0; return 0;
} }

File diff suppressed because it is too large Load diff

View file

@ -82,161 +82,161 @@
unsigned int unsigned int
lzf_compress (const void *const in_data, unsigned int in_len, lzf_compress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len void *out_data, unsigned int out_len
#if LZF_STATE_ARG #if LZF_STATE_ARG
, LZF_STATE *htab , LZF_STATE *htab
#endif #endif
) )
{ {
#if !LZF_STATE_ARG #if !LZF_STATE_ARG
LZF_STATE htab; LZF_STATE htab;
#endif #endif
const u8 **hslot; const u8 **hslot;
const u8 *ip = (const u8 *)in_data; const u8 *ip = (const u8 *)in_data;
u8 *op = (u8 *)out_data; u8 *op = (u8 *)out_data;
const u8 *in_end = ip + in_len; const u8 *in_end = ip + in_len;
u8 *out_end = op + out_len; u8 *out_end = op + out_len;
const u8 *ref; const u8 *ref;
unsigned int hval = FRST (ip); unsigned int hval = FRST (ip);
unsigned long off; unsigned long off;
int lit = 0; int lit = 0;
#if INIT_HTAB #if INIT_HTAB
# if USE_MEMCPY # if USE_MEMCPY
memset (htab, 0, sizeof (htab)); memset (htab, 0, sizeof (htab));
# else # else
for (hslot = htab; hslot < htab + HSIZE; hslot++) for (hslot = htab; hslot < htab + HSIZE; hslot++)
*hslot++ = ip; *hslot++ = ip;
# endif # endif
#endif #endif
for (;;) for (;;)
{ {
if (ip < in_end - 2) if (ip < in_end - 2)
{ {
hval = NEXT (hval, ip); hval = NEXT (hval, ip);
hslot = htab + IDX (hval); hslot = htab + IDX (hval);
ref = *hslot; *hslot = ip; ref = *hslot; *hslot = ip;
if (1 if (1
#if INIT_HTAB && !USE_MEMCPY #if INIT_HTAB && !USE_MEMCPY
&& ref < ip /* the next test will actually take care of this, but this is faster */ && ref < ip /* the next test will actually take care of this, but this is faster */
#endif #endif
&& (off = ip - ref - 1) < MAX_OFF && (off = ip - ref - 1) < MAX_OFF
&& ip + 4 < in_end && ip + 4 < in_end
&& ref > (u8 *)in_data && ref > (u8 *)in_data
#if STRICT_ALIGN #if STRICT_ALIGN
&& ref[0] == ip[0] && ref[0] == ip[0]
&& ref[1] == ip[1] && ref[1] == ip[1]
&& ref[2] == ip[2] && ref[2] == ip[2]
#else #else
&& *(u16 *)ref == *(u16 *)ip && *(u16 *)ref == *(u16 *)ip
&& ref[2] == ip[2] && ref[2] == ip[2]
#endif #endif
) )
{ {
/* match found at *ref++ */ /* match found at *ref++ */
unsigned int len = 2; unsigned int len = 2;
unsigned int maxlen = in_end - ip - len; unsigned int maxlen = in_end - ip - len;
maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; maxlen = maxlen > MAX_REF ? MAX_REF : maxlen;
if (op + lit + 1 + 3 >= out_end) if (op + lit + 1 + 3 >= out_end)
return 0; return 0;
do do
len++; len++;
while (len < maxlen && ref[len] == ip[len]); while (len < maxlen && ref[len] == ip[len]);
if (lit) if (lit)
{ {
*op++ = lit - 1; *op++ = lit - 1;
lit = -lit; lit = -lit;
do do
*op++ = ip[lit]; *op++ = ip[lit];
while (++lit); while (++lit);
} }
len -= 2; len -= 2;
ip++; ip++;
if (len < 7) if (len < 7)
{ {
*op++ = (off >> 8) + (len << 5); *op++ = (off >> 8) + (len << 5);
} }
else else
{ {
*op++ = (off >> 8) + ( 7 << 5); *op++ = (off >> 8) + ( 7 << 5);
*op++ = len - 7; *op++ = len - 7;
} }
*op++ = off; *op++ = off;
#if ULTRA_FAST || VERY_FAST #if ULTRA_FAST || VERY_FAST
ip += len; ip += len;
#if VERY_FAST && !ULTRA_FAST #if VERY_FAST && !ULTRA_FAST
--ip; --ip;
#endif #endif
hval = FRST (ip); hval = FRST (ip);
hval = NEXT (hval, ip); hval = NEXT (hval, ip);
htab[IDX (hval)] = ip; htab[IDX (hval)] = ip;
ip++; ip++;
#if VERY_FAST && !ULTRA_FAST #if VERY_FAST && !ULTRA_FAST
hval = NEXT (hval, ip); hval = NEXT (hval, ip);
htab[IDX (hval)] = ip; htab[IDX (hval)] = ip;
ip++; ip++;
#endif #endif
#else #else
do do
{ {
hval = NEXT (hval, ip); hval = NEXT (hval, ip);
htab[IDX (hval)] = ip; htab[IDX (hval)] = ip;
ip++; ip++;
} }
while (len--); while (len--);
#endif #endif
continue; continue;
} }
} }
else if (ip == in_end) else if (ip == in_end)
break; break;
/* one more literal byte we must copy */ /* one more literal byte we must copy */
lit++; lit++;
ip++; ip++;
if (lit == MAX_LIT) if (lit == MAX_LIT)
{ {
if (op + 1 + MAX_LIT >= out_end) if (op + 1 + MAX_LIT >= out_end)
return 0; return 0;
*op++ = MAX_LIT - 1; *op++ = MAX_LIT - 1;
#if USE_MEMCPY #if USE_MEMCPY
memcpy (op, ip - MAX_LIT, MAX_LIT); memcpy (op, ip - MAX_LIT, MAX_LIT);
op += MAX_LIT; op += MAX_LIT;
lit = 0; lit = 0;
#else #else
lit = -lit; lit = -lit;
do do
*op++ = ip[lit]; *op++ = ip[lit];
while (++lit); while (++lit);
#endif #endif
} }
} }
if (lit) if (lit)
{ {
if (op + lit + 1 >= out_end) if (op + lit + 1 >= out_end)
return 0; return 0;
*op++ = lit - 1; *op++ = lit - 1;
lit = -lit; lit = -lit;
do do
*op++ = ip[lit]; *op++ = ip[lit];
while (++lit); while (++lit);
} }
return op - (u8 *) out_data; return op - (u8 *) out_data;
} }

View file

@ -45,72 +45,72 @@
# define SET_ERRNO(n) errno = (n) # define SET_ERRNO(n) errno = (n)
#endif #endif
unsigned int unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len, lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len) void *out_data, unsigned int out_len)
{ {
u8 const *ip = (const u8 *)in_data; u8 const *ip = (const u8 *)in_data;
u8 *op = (u8 *)out_data; u8 *op = (u8 *)out_data;
u8 const *const in_end = ip + in_len; u8 const *const in_end = ip + in_len;
u8 *const out_end = op + out_len; u8 *const out_end = op + out_len;
do do
{ {
unsigned int ctrl = *ip++; unsigned int ctrl = *ip++;
if (ctrl < (1 << 5)) /* literal run */ if (ctrl < (1 << 5)) /* literal run */
{ {
ctrl++; ctrl++;
if (op + ctrl > out_end) if (op + ctrl > out_end)
{ {
SET_ERRNO (E2BIG); SET_ERRNO (E2BIG);
return 0; return 0;
} }
#if USE_MEMCPY #if USE_MEMCPY
memcpy (op, ip, ctrl); memcpy (op, ip, ctrl);
op += ctrl; op += ctrl;
ip += ctrl; ip += ctrl;
#else #else
do do
*op++ = *ip++; *op++ = *ip++;
while (--ctrl); while (--ctrl);
#endif #endif
} }
else /* back reference */ else /* back reference */
{ {
unsigned int len = ctrl >> 5; unsigned int len = ctrl >> 5;
u8 *ref = op - ((ctrl & 0x1f) << 8) - 1; u8 *ref = op - ((ctrl & 0x1f) << 8) - 1;
if (len == 7) if (len == 7)
len += *ip++; len += *ip++;
ref -= *ip++;
if (op + len + 2 > out_end) ref -= *ip++;
if (op + len + 2 > out_end)
{ {
SET_ERRNO (E2BIG); SET_ERRNO (E2BIG);
return 0; return 0;
} }
if (ref < (u8 *)out_data) if (ref < (u8 *)out_data)
{ {
SET_ERRNO (EINVAL); SET_ERRNO (EINVAL);
return 0; return 0;
} }
*op++ = *ref++;
*op++ = *ref++;
do
*op++ = *ref++; *op++ = *ref++;
while (--len); *op++ = *ref++;
do
*op++ = *ref++;
while (--len);
} }
} }
while (op < out_end && ip < in_end); while (op < out_end && ip < in_end);
return op - (u8 *)out_data; return op - (u8 *)out_data;
} }

View file

@ -10,107 +10,107 @@ static unsigned short SSWAPIB (unsigned short a) { return((a>>8)+(a<<8)); }
#define USENEW 1 #define USENEW 1
long lzwcompress (unsigned char *ucompbuf, long ucompleng, unsigned char *compbuf) long lzwcompress (unsigned char *ucompbuf, long ucompleng, unsigned char *compbuf)
{ {
long i, j, numnodes, *lptr, bitcnt, nbits, oneupnbits, hmask, *child; long i, j, numnodes, *lptr, bitcnt, nbits, oneupnbits, hmask, *child;
long *sibly; long *sibly;
#if USENEW #if USENEW
long *sibry; long *sibry;
#endif #endif
unsigned char *nodev, *cptr, *eptr; unsigned char *nodev, *cptr, *eptr;
nodev = (unsigned char *)malloc((ucompleng+256)*sizeof(char)); if (!nodev) return(0); nodev = (unsigned char *)malloc((ucompleng+256)*sizeof(char)); if (!nodev) return(0);
child = (long *)malloc((ucompleng+256)*sizeof(long)); if (!child) { free(nodev); return(0); } child = (long *)malloc((ucompleng+256)*sizeof(long)); if (!child) { free(nodev); return(0); }
sibly = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibly) { free(child); free(nodev); return(0); } sibly = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibly) { free(child); free(nodev); return(0); }
#if USENEW #if USENEW
sibry = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibry) { free(sibly); free(child); free(nodev); return(0); } sibry = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibry) { free(sibly); free(child); free(nodev); return(0); }
#endif #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); memset(compbuf,0,ucompleng+15);
cptr = ucompbuf; eptr = &ucompbuf[ucompleng]; cptr = ucompbuf; eptr = &ucompbuf[ucompleng];
numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1); numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1);
do do
{ {
for(i=cptr[0];i>=0;i=j) for(i=cptr[0];i>=0;i=j)
{ {
cptr++; if (cptr >= eptr) goto lzwcompbreak2b; cptr++; if (cptr >= eptr) goto lzwcompbreak2b;
j = child[i]; if (j < 0) { child[i] = numnodes; break; } j = child[i]; if (j < 0) { child[i] = numnodes; break; }
#if USENEW #if USENEW
//This is about 2x faster when ucompbuf is more random, 5% slower when very compressible //This is about 2x faster when ucompbuf is more random, 5% slower when very compressible
while (cptr[0] != nodev[j]) while (cptr[0] != nodev[j])
{ {
if (cptr[0] < nodev[j]) if (cptr[0] < nodev[j])
{ if (sibly[j] < 0) { sibly[j] = numnodes; goto lzwcompbreak2a; } j = sibly[j]; } { if (sibly[j] < 0) { sibly[j] = numnodes; goto lzwcompbreak2a; } j = sibly[j]; }
else { if (sibry[j] < 0) { sibry[j] = numnodes; goto lzwcompbreak2a; } j = sibry[j]; } else { if (sibry[j] < 0) { sibry[j] = numnodes; goto lzwcompbreak2a; } j = sibry[j]; }
} }
#else #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; } if (sibly[j] < 0) { sibly[j] = numnodes; goto lzwcompbreak2a; }
#endif #endif
} }
lzwcompbreak2a: nodev[numnodes] = cptr[0]; lzwcompbreak2a: nodev[numnodes] = cptr[0];
lzwcompbreak2b: child[numnodes] = sibly[numnodes] = -1; lzwcompbreak2b: child[numnodes] = sibly[numnodes] = -1;
#if USENEW #if USENEW
sibry[numnodes] = -1; sibry[numnodes] = -1;
#endif #endif
lptr = (long *)&compbuf[bitcnt>>3]; lptr[0] |= LSWAPIB(i<<(bitcnt&7)); lptr = (long *)&compbuf[bitcnt>>3]; lptr[0] |= LSWAPIB(i<<(bitcnt&7));
bitcnt += nbits; if ((i&hmask) > ((numnodes-1)&hmask)) bitcnt--; bitcnt += nbits; if ((i&hmask) > ((numnodes-1)&hmask)) bitcnt--;
numnodes++; if (numnodes > oneupnbits) { nbits++; oneupnbits <<= 1; hmask = ((oneupnbits>>1)-1); } numnodes++; if (numnodes > oneupnbits) { nbits++; oneupnbits <<= 1; hmask = ((oneupnbits>>1)-1); }
} while ((cptr < eptr) && (bitcnt < (ucompleng<<3))); } while ((cptr < eptr) && (bitcnt < (ucompleng<<3)));
#if USENEW #if USENEW
free(sibry); free(sibry);
#endif #endif
free(sibly); free(sibly);
free(child); free(nodev); free(child); free(nodev);
lptr = (long *)compbuf; lptr = (long *)compbuf;
if (((bitcnt+7)>>3) < ucompleng) { lptr[0] = LSWAPIB(numnodes); return((bitcnt+7)>>3); } if (((bitcnt+7)>>3) < ucompleng) { lptr[0] = LSWAPIB(numnodes); return((bitcnt+7)>>3); }
memcpy(compbuf,ucompbuf,ucompleng); return(ucompleng); memcpy(compbuf,ucompbuf,ucompleng); return(ucompleng);
} }
long lzwuncompress (unsigned char *compbuf, long compleng, unsigned char *ucompbuf, long ucompleng) long lzwuncompress (unsigned char *compbuf, long compleng, unsigned char *ucompbuf, long ucompleng)
{ {
long i, dat, leng, bitcnt, *lptr, numnodes, totnodes, nbits, oneupnbits, hmask, *prefix; long i, dat, leng, bitcnt, *lptr, numnodes, totnodes, nbits, oneupnbits, hmask, *prefix;
unsigned char ch, *ucptr, *suffix; unsigned char ch, *ucptr, *suffix;
long ucomp = (long)ucompbuf; long ucomp = (long)ucompbuf;
if (compleng >= ucompleng) { memcpy(ucompbuf,compbuf,ucompleng); return ucompleng; } if (compleng >= ucompleng) { memcpy(ucompbuf,compbuf,ucompleng); return ucompleng; }
totnodes = LSWAPIB(((long *)compbuf)[0]); if (totnodes <= 0 || totnodes >= ucompleng+256) return 0; totnodes = LSWAPIB(((long *)compbuf)[0]); if (totnodes <= 0 || totnodes >= ucompleng+256) return 0;
prefix = (long *)malloc(totnodes*sizeof(long)); if (!prefix) return 0;
suffix = (unsigned char *)malloc(totnodes*sizeof(char)); if (!suffix) { free(prefix); return 0; }
numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1); prefix = (long *)malloc(totnodes*sizeof(long)); if (!prefix) return 0;
do suffix = (unsigned char *)malloc(totnodes*sizeof(char)); if (!suffix) { free(prefix); return 0; }
{
lptr = (long *)&compbuf[bitcnt>>3]; dat = ((LSWAPIB(lptr[0])>>(bitcnt&7))&(oneupnbits-1));
bitcnt += nbits; if ((dat&hmask) > ((numnodes-1)&hmask)) { dat &= hmask; bitcnt--; }
prefix[numnodes] = dat; numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1);
do
{
lptr = (long *)&compbuf[bitcnt>>3]; dat = ((LSWAPIB(lptr[0])>>(bitcnt&7))&(oneupnbits-1));
bitcnt += nbits; if ((dat&hmask) > ((numnodes-1)&hmask)) { dat &= hmask; bitcnt--; }
ucompbuf++; prefix[numnodes] = 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]; ucompbuf++;
for(i=(leng>>1)-1;i>=0;i--) { ch = ucompbuf[i]; ucompbuf[i] = ucptr[-i]; ucptr[-i] = ch; } for(leng=0;dat>=256;dat=prefix[dat]) {
ucompbuf[-1] = dat; ucompbuf += leng; if ((long)ucompbuf+leng-ucomp > ucompleng) goto bail;
ucompbuf[leng++] = suffix[dat];
}
suffix[numnodes-1] = suffix[numnodes] = dat; ucptr = &ucompbuf[leng-1];
for(i=(leng>>1)-1;i>=0;i--) { ch = ucompbuf[i]; ucompbuf[i] = ucptr[-i]; ucptr[-i] = ch; }
ucompbuf[-1] = dat; ucompbuf += leng;
numnodes++; if (numnodes > oneupnbits) { nbits++; oneupnbits <<= 1; hmask = ((oneupnbits>>1)-1); } suffix[numnodes-1] = suffix[numnodes] = dat;
} while (numnodes < totnodes);
numnodes++; if (numnodes > oneupnbits) { nbits++; oneupnbits <<= 1; hmask = ((oneupnbits>>1)-1); }
} while (numnodes < totnodes);
bail: bail:
free(suffix); free(prefix); free(suffix); free(prefix);
return (long)ucompbuf-ucomp; return (long)ucompbuf-ucomp;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View file

@ -53,10 +53,10 @@ static void Decode (UINT4 *, unsigned char *, unsigned int);
#define MD4_memset memset #define MD4_memset memset
static unsigned char PADDING[64] = { static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; };
/* F, G and H are basic MD4 functions. /* F, G and H are basic MD4 functions.
*/ */
@ -85,25 +85,25 @@ static unsigned char PADDING[64] = {
void md4once(unsigned char *block, unsigned int len, unsigned char digest[16]) void md4once(unsigned char *block, unsigned int len, unsigned char digest[16])
{ {
MD4_CTX ctx; MD4_CTX ctx;
md4init(&ctx); md4init(&ctx);
md4block(&ctx, block, len); md4block(&ctx, block, len);
md4finish(digest, &ctx); md4finish(digest, &ctx);
} }
/* MD4 initialization. Begins an MD4 operation, writing a new context. /* MD4 initialization. Begins an MD4 operation, writing a new context.
*/ */
void md4init (MD4_CTX *context) void md4init (MD4_CTX *context)
{ {
context->count[0] = context->count[1] = 0; context->count[0] = context->count[1] = 0;
/* Load magic initialization constants. /* Load magic initialization constants.
*/ */
context->state[0] = 0x67452301; context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89; context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe; context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476; context->state[3] = 0x10325476;
} }
/* MD4 block update operation. Continues an MD4 message-digest /* MD4 block update operation. Continues an MD4 message-digest
@ -112,35 +112,35 @@ void md4init (MD4_CTX *context)
*/ */
void md4block (MD4_CTX *context, unsigned char *input, unsigned int inputLen) void md4block (MD4_CTX *context, unsigned char *input, unsigned int inputLen)
{ {
unsigned int i, index, partLen; unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */ /* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F); index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */ /* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3)) if ((context->count[0] += ((UINT4)inputLen << 3))
< ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3))
context->count[1]++; context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29); context->count[1] += ((UINT4)inputLen >> 29);
partLen = 64 - index; partLen = 64 - index;
/* Transform as many times as possible. /* Transform as many times as possible.
*/ */
if (inputLen >= partLen) { if (inputLen >= partLen) {
MD4_memcpy
((POINTER)&context->buffer[index], (POINTER)input, partLen);
MD4Transform (context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD4Transform (context->state, &input[i]);
index = 0;
}
else
i = 0;
/* Buffer remaining input */
MD4_memcpy MD4_memcpy
((POINTER)&context->buffer[index], (POINTER)input, partLen);
MD4Transform (context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD4Transform (context->state, &input[i]);
index = 0;
}
else
i = 0;
/* Buffer remaining input */
MD4_memcpy
((POINTER)&context->buffer[index], (POINTER)&input[i], ((POINTER)&context->buffer[index], (POINTER)&input[i],
inputLen-i); inputLen-i);
} }
@ -150,98 +150,98 @@ void md4block (MD4_CTX *context, unsigned char *input, unsigned int inputLen)
*/ */
void md4finish (unsigned char digest[16], MD4_CTX *context) void md4finish (unsigned char digest[16], MD4_CTX *context)
{ {
unsigned char bits[8]; unsigned char bits[8];
unsigned int index, padLen; unsigned int index, padLen;
/* Save number of bits */ /* Save number of bits */
Encode (bits, context->count, 8); Encode (bits, context->count, 8);
/* Pad out to 56 mod 64. /* Pad out to 56 mod 64.
*/ */
index = (unsigned int)((context->count[0] >> 3) & 0x3f); index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index); padLen = (index < 56) ? (56 - index) : (120 - index);
md4block (context, PADDING, padLen); md4block (context, PADDING, padLen);
/* Append length (before padding) */ /* Append length (before padding) */
md4block (context, bits, 8); md4block (context, bits, 8);
/* Store state in digest */ /* Store state in digest */
Encode (digest, context->state, 16); Encode (digest, context->state, 16);
/* Zeroize sensitive information. /* Zeroize sensitive information.
*/ */
MD4_memset ((POINTER)context, 0, sizeof (*context)); MD4_memset ((POINTER)context, 0, sizeof (*context));
} }
/* MD4 basic transformation. Transforms state based on block. /* MD4 basic transformation. Transforms state based on block.
*/ */
static void MD4Transform (UINT4 state[4], unsigned char block[64]) static void MD4Transform (UINT4 state[4], unsigned char block[64])
{ {
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode (x, block, 64); Decode (x, block, 64);
/* Round 1 */ /* Round 1 */
FF (a, b, c, d, x[ 0], S11); /* 1 */ FF (a, b, c, d, x[ 0], S11); /* 1 */
FF (d, a, b, c, x[ 1], S12); /* 2 */ FF (d, a, b, c, x[ 1], S12); /* 2 */
FF (c, d, a, b, x[ 2], S13); /* 3 */ FF (c, d, a, b, x[ 2], S13); /* 3 */
FF (b, c, d, a, x[ 3], S14); /* 4 */ FF (b, c, d, a, x[ 3], S14); /* 4 */
FF (a, b, c, d, x[ 4], S11); /* 5 */ FF (a, b, c, d, x[ 4], S11); /* 5 */
FF (d, a, b, c, x[ 5], S12); /* 6 */ FF (d, a, b, c, x[ 5], S12); /* 6 */
FF (c, d, a, b, x[ 6], S13); /* 7 */ FF (c, d, a, b, x[ 6], S13); /* 7 */
FF (b, c, d, a, x[ 7], S14); /* 8 */ FF (b, c, d, a, x[ 7], S14); /* 8 */
FF (a, b, c, d, x[ 8], S11); /* 9 */ FF (a, b, c, d, x[ 8], S11); /* 9 */
FF (d, a, b, c, x[ 9], S12); /* 10 */ FF (d, a, b, c, x[ 9], S12); /* 10 */
FF (c, d, a, b, x[10], S13); /* 11 */ FF (c, d, a, b, x[10], S13); /* 11 */
FF (b, c, d, a, x[11], S14); /* 12 */ FF (b, c, d, a, x[11], S14); /* 12 */
FF (a, b, c, d, x[12], S11); /* 13 */ FF (a, b, c, d, x[12], S11); /* 13 */
FF (d, a, b, c, x[13], S12); /* 14 */ FF (d, a, b, c, x[13], S12); /* 14 */
FF (c, d, a, b, x[14], S13); /* 15 */ FF (c, d, a, b, x[14], S13); /* 15 */
FF (b, c, d, a, x[15], S14); /* 16 */ FF (b, c, d, a, x[15], S14); /* 16 */
/* Round 2 */ /* Round 2 */
GG (a, b, c, d, x[ 0], S21); /* 17 */ GG (a, b, c, d, x[ 0], S21); /* 17 */
GG (d, a, b, c, x[ 4], S22); /* 18 */ GG (d, a, b, c, x[ 4], S22); /* 18 */
GG (c, d, a, b, x[ 8], S23); /* 19 */ GG (c, d, a, b, x[ 8], S23); /* 19 */
GG (b, c, d, a, x[12], S24); /* 20 */ GG (b, c, d, a, x[12], S24); /* 20 */
GG (a, b, c, d, x[ 1], S21); /* 21 */ GG (a, b, c, d, x[ 1], S21); /* 21 */
GG (d, a, b, c, x[ 5], S22); /* 22 */ GG (d, a, b, c, x[ 5], S22); /* 22 */
GG (c, d, a, b, x[ 9], S23); /* 23 */ GG (c, d, a, b, x[ 9], S23); /* 23 */
GG (b, c, d, a, x[13], S24); /* 24 */ GG (b, c, d, a, x[13], S24); /* 24 */
GG (a, b, c, d, x[ 2], S21); /* 25 */ GG (a, b, c, d, x[ 2], S21); /* 25 */
GG (d, a, b, c, x[ 6], S22); /* 26 */ GG (d, a, b, c, x[ 6], S22); /* 26 */
GG (c, d, a, b, x[10], S23); /* 27 */ GG (c, d, a, b, x[10], S23); /* 27 */
GG (b, c, d, a, x[14], S24); /* 28 */ GG (b, c, d, a, x[14], S24); /* 28 */
GG (a, b, c, d, x[ 3], S21); /* 29 */ GG (a, b, c, d, x[ 3], S21); /* 29 */
GG (d, a, b, c, x[ 7], S22); /* 30 */ GG (d, a, b, c, x[ 7], S22); /* 30 */
GG (c, d, a, b, x[11], S23); /* 31 */ GG (c, d, a, b, x[11], S23); /* 31 */
GG (b, c, d, a, x[15], S24); /* 32 */ GG (b, c, d, a, x[15], S24); /* 32 */
/* Round 3 */ /* Round 3 */
HH (a, b, c, d, x[ 0], S31); /* 33 */ HH (a, b, c, d, x[ 0], S31); /* 33 */
HH (d, a, b, c, x[ 8], S32); /* 34 */ HH (d, a, b, c, x[ 8], S32); /* 34 */
HH (c, d, a, b, x[ 4], S33); /* 35 */ HH (c, d, a, b, x[ 4], S33); /* 35 */
HH (b, c, d, a, x[12], S34); /* 36 */ HH (b, c, d, a, x[12], S34); /* 36 */
HH (a, b, c, d, x[ 2], S31); /* 37 */ HH (a, b, c, d, x[ 2], S31); /* 37 */
HH (d, a, b, c, x[10], S32); /* 38 */ HH (d, a, b, c, x[10], S32); /* 38 */
HH (c, d, a, b, x[ 6], S33); /* 39 */ HH (c, d, a, b, x[ 6], S33); /* 39 */
HH (b, c, d, a, x[14], S34); /* 40 */ HH (b, c, d, a, x[14], S34); /* 40 */
HH (a, b, c, d, x[ 1], S31); /* 41 */ HH (a, b, c, d, x[ 1], S31); /* 41 */
HH (d, a, b, c, x[ 9], S32); /* 42 */ HH (d, a, b, c, x[ 9], S32); /* 42 */
HH (c, d, a, b, x[ 5], S33); /* 43 */ HH (c, d, a, b, x[ 5], S33); /* 43 */
HH (b, c, d, a, x[13], S34); /* 44 */ HH (b, c, d, a, x[13], S34); /* 44 */
HH (a, b, c, d, x[ 3], S31); /* 45 */ HH (a, b, c, d, x[ 3], S31); /* 45 */
HH (d, a, b, c, x[11], S32); /* 46 */ HH (d, a, b, c, x[11], S32); /* 46 */
HH (c, d, a, b, x[ 7], S33); /* 47 */ HH (c, d, a, b, x[ 7], S33); /* 47 */
HH (b, c, d, a, x[15], S34); /* 48 */ HH (b, c, d, a, x[15], S34); /* 48 */
state[0] += a; state[0] += a;
state[1] += b; state[1] += b;
state[2] += c; state[2] += c;
state[3] += d; state[3] += d;
/* Zeroize sensitive information. /* Zeroize sensitive information.
*/ */
MD4_memset ((POINTER)x, 0, sizeof (x)); MD4_memset ((POINTER)x, 0, sizeof (x));
} }
/* Encodes input (UINT4) into output (unsigned char). Assumes len is /* Encodes input (UINT4) into output (unsigned char). Assumes len is
@ -249,14 +249,14 @@ static void MD4Transform (UINT4 state[4], unsigned char block[64])
*/ */
static void Encode (unsigned char *output, UINT4 *input, unsigned int len) static void Encode (unsigned char *output, UINT4 *input, unsigned int len)
{ {
unsigned int i, j; unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) { for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff); output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
} }
} }
/* Decodes input (unsigned char) into output (UINT4). Assumes len is /* Decodes input (unsigned char) into output (UINT4). Assumes len is
@ -264,9 +264,9 @@ static void Encode (unsigned char *output, UINT4 *input, unsigned int len)
*/ */
static void Decode (UINT4 *output, unsigned char *input, unsigned int len) static void Decode (UINT4 *output, unsigned char *input, unsigned int len)
{ {
unsigned int i, j; unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -15,23 +15,23 @@ char syncstate = 0;
long isvalidipaddress (char *st) long isvalidipaddress (char *st)
{ {
return 0; return 0;
} }
long initmultiplayersparms(long argc, char **argv) long initmultiplayersparms(long argc, char **argv)
{ {
return 0; return 0;
} }
long initmultiplayerscycle(void) long initmultiplayerscycle(void)
{ {
return 0; return 0;
} }
void initmultiplayers(long argc, char **argv, char damultioption, char dacomrateoption, char dapriority) void initmultiplayers(long argc, char **argv, char damultioption, char dacomrateoption, char dapriority)
{ {
numplayers = 1; myconnectindex = 0; numplayers = 1; myconnectindex = 0;
connecthead = 0; connectpoint2[0] = -1; connecthead = 0; connectpoint2[0] = -1;
} }
void setpackettimeout(long datimeoutcount, long daresendagaincount) void setpackettimeout(long datimeoutcount, long daresendagaincount)
@ -52,7 +52,7 @@ void sendlogoff(void)
long getoutputcirclesize(void) long getoutputcirclesize(void)
{ {
return 0; return 0;
} }
void setsocket(short newsocket) void setsocket(short newsocket)
@ -65,7 +65,7 @@ void sendpacket(long other, char *bufptr, long messleng)
long getpacket (long *other, char *bufptr) long getpacket (long *other, char *bufptr)
{ {
return 0; return 0;
} }
void flushpackets(void) void flushpackets(void)

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,7 @@ void polymer_drawsector(short sectnum)
{ {
sectortype *sec; sectortype *sec;
walltype *wal; walltype *wal;
sec = &sector[sectnum]; sec = &sector[sectnum];
wal = &wall[sec->wallptr]; wal = &wall[sec->wallptr];
OSD_Printf("%i\n", sec->wallnum); OSD_Printf("%i\n", sec->wallnum);

File diff suppressed because it is too large Load diff

View file

@ -32,50 +32,50 @@ void qinterpolatedown16short(long bufptr, long num, long val, long add)
void clearbuf(void *d, long c, long a) void clearbuf(void *d, long c, long a)
{ {
long *p = (long*)d; long *p = (long*)d;
while ((c--) > 0) *(p++) = a; while ((c--) > 0) *(p++) = a;
} }
void copybuf(void *s, void *d, long c) void copybuf(void *s, void *d, long c)
{ {
long *p = (long*)s, *q = (long*)d; long *p = (long*)s, *q = (long*)d;
while ((c--) > 0) *(q++) = *(p++); while ((c--) > 0) *(q++) = *(p++);
} }
void swapbuf4(void *a, void *b, long c) void swapbuf4(void *a, void *b, long c)
{ {
long *p = (long*)a, *q = (long*)b; long *p = (long*)a, *q = (long*)b;
long x, y; long x, y;
while ((c--) > 0) { while ((c--) > 0) {
x = *q; x = *q;
y = *p; y = *p;
*(q++) = y; *(q++) = y;
*(p++) = x; *(p++) = x;
} }
} }
void clearbufbyte(void *D, long c, long a) void clearbufbyte(void *D, long c, long a)
{ // Cringe City { // Cringe City
char *p = (char*)D; char *p = (char*)D;
long m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l }; long m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l };
long n[4] = { 0,8,16,24 }; long n[4] = { 0,8,16,24 };
long z=0; long z=0;
while ((c--) > 0) { while ((c--) > 0) {
*(p++) = (char)((a & m[z])>>n[z]); *(p++) = (char)((a & m[z])>>n[z]);
z=(z+1)&3; z=(z+1)&3;
} }
} }
void copybufbyte(void *S, void *D, long c) void copybufbyte(void *S, void *D, long c)
{ {
char *p = (char*)S, *q = (char*)D; 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) void copybufreverse(void *S, void *D, long c)
{ {
char *p = (char*)S, *q = (char*)D; char *p = (char*)S, *q = (char*)D;
while((c--) > 0) *(q++) = *(p--); while((c--) > 0) *(q++) = *(p--);
} }
#elif defined(__GNUC__) && defined(__i386__) // NOASM #elif defined(__GNUC__) && defined(__i386__) // NOASM
@ -89,144 +89,144 @@ void copybufreverse(void *S, void *D, long c)
long boundmulscale(long a, long b, long c) long boundmulscale(long a, long b, long c)
{ {
ASM ( ASM (
"imull %%ebx\n\t" "imull %%ebx\n\t"
"movl %%edx, %%ebx\n\t" // mov ebx, edx "movl %%edx, %%ebx\n\t" // mov ebx, edx
"shrdl %%cl, %%edx, %%eax\n\t" // mov eax, edx, cl "shrdl %%cl, %%edx, %%eax\n\t" // mov eax, edx, cl
"sarl %%cl, %%edx\n\t" // sar edx, cl "sarl %%cl, %%edx\n\t" // sar edx, cl
"xorl %%eax, %%edx\n\t" // xor edx, eax "xorl %%eax, %%edx\n\t" // xor edx, eax
"js 0f\n\t" // js checkit "js 0f\n\t" // js checkit
"xorl %%eax, %%edx\n\t" // xor edx, eax "xorl %%eax, %%edx\n\t" // xor edx, eax
"jz 1f\n\t" // js skipboundit "jz 1f\n\t" // js skipboundit
"cmpl $0xffffffff, %%edx\n\t" // cmp edx, 0xffffffff "cmpl $0xffffffff, %%edx\n\t" // cmp edx, 0xffffffff
"je 1f\n\t" // je skipboundit "je 1f\n\t" // je skipboundit
"0:\n\t" // checkit: "0:\n\t" // checkit:
"movl %%ebx, %%eax\n\t" // mov eax, ebx "movl %%ebx, %%eax\n\t" // mov eax, ebx
"sarl $31, %%eax\n\t" // sar eax, 31 "sarl $31, %%eax\n\t" // sar eax, 31
"xorl $0x7fffffff, %%eax\n\t" // xor eax, 0x7fffffff "xorl $0x7fffffff, %%eax\n\t" // xor eax, 0x7fffffff
"1:" // skipboundit: "1:" // skipboundit:
: "+a" (a), "+b" (b), "+c" (c) // input eax ebx ecx : "+a" (a), "+b" (b), "+c" (c) // input eax ebx ecx
: :
: "edx", "cc" : "edx", "cc"
); );
return a; return a;
} }
void clearbufbyte(void *D, long c, long a) void clearbufbyte(void *D, long c, long a)
{ {
ASM ( ASM (
"cmpl $4, %%ecx\n\t" "cmpl $4, %%ecx\n\t"
"jae 1f\n\t" "jae 1f\n\t"
"testb $1, %%cl\n\t" "testb $1, %%cl\n\t"
"jz 0f\n\t" // jz preskip "jz 0f\n\t" // jz preskip
"stosb\n\t" "stosb\n\t"
"0:\n\t" // preskip: "0:\n\t" // preskip:
"shrl $1, %%ecx\n\t" "shrl $1, %%ecx\n\t"
"rep\n\t" "rep\n\t"
"stosw\n\t" "stosw\n\t"
"jmp 5f\n\t" // jmp endit "jmp 5f\n\t" // jmp endit
"1:\n\t" // intcopy: "1:\n\t" // intcopy:
"testl $1, %%edi\n\t" "testl $1, %%edi\n\t"
"jz 2f\n\t" // jz skip1 "jz 2f\n\t" // jz skip1
"stosb\n\t" "stosb\n\t"
"decl %%ecx\n\t" "decl %%ecx\n\t"
"2:\n\t" // skip1: "2:\n\t" // skip1:
"testl $2, %%edi\n\t" "testl $2, %%edi\n\t"
"jz 3f\n\t" // jz skip2 "jz 3f\n\t" // jz skip2
"stosw\n\t" "stosw\n\t"
"subl $2, %%ecx\n\t" "subl $2, %%ecx\n\t"
"3:\n\t" // skip2: "3:\n\t" // skip2:
"movl %%ecx, %%ebx\n\t" "movl %%ecx, %%ebx\n\t"
"shrl $2, %%ecx\n\t" "shrl $2, %%ecx\n\t"
"rep\n\t" "rep\n\t"
"stosl\n\t" "stosl\n\t"
"testb $2, %%bl\n\t" "testb $2, %%bl\n\t"
"jz 4f\n\t" // jz skip3 "jz 4f\n\t" // jz skip3
"stosw\n\t" "stosw\n\t"
"4:\n\t" // skip3: "4:\n\t" // skip3:
"testb $1, %%bl\n\t" "testb $1, %%bl\n\t"
"jz 5f\n\t" // jz endit "jz 5f\n\t" // jz endit
"stosb\n\t" "stosb\n\t"
"5:" // endit "5:" // endit
: "+D" (D), "+c" (c), "+a" (a) : : "+D" (D), "+c" (c), "+a" (a) :
: "ebx", "memory", "cc" : "ebx", "memory", "cc"
); );
} }
void copybufbyte(void *S, void *D, long c) void copybufbyte(void *S, void *D, long c)
{ {
ASM ( ASM (
"cmpl $4, %%ecx\n\t" // cmp ecx, 4 "cmpl $4, %%ecx\n\t" // cmp ecx, 4
"jae 1f\n\t" "jae 1f\n\t"
"testb $1, %%cl\n\t" // test cl, 1 "testb $1, %%cl\n\t" // test cl, 1
"jz 0f\n\t" "jz 0f\n\t"
"movsb\n\t" "movsb\n\t"
"0:\n\t" // preskip: "0:\n\t" // preskip:
"shrl $1, %%ecx\n\t" // shr ecx, 1 "shrl $1, %%ecx\n\t" // shr ecx, 1
"rep\n\t" "rep\n\t"
"movsw\n\t" "movsw\n\t"
"jmp 5f\n\t" "jmp 5f\n\t"
"1:\n\t" // intcopy: "1:\n\t" // intcopy:
"testl $1, %%edi\n\t" // test edi, 1 "testl $1, %%edi\n\t" // test edi, 1
"jz 2f\n\t" "jz 2f\n\t"
"movsb\n\t" "movsb\n\t"
"decl %%ecx\n\t" "decl %%ecx\n\t"
"2:\n\t" // skip1: "2:\n\t" // skip1:
"testl $2, %%edi\n\t" // test edi, 2 "testl $2, %%edi\n\t" // test edi, 2
"jz 3f\n\t" "jz 3f\n\t"
"movsw\n\t" "movsw\n\t"
"subl $2, %%ecx\n\t" // sub ecx, 2 "subl $2, %%ecx\n\t" // sub ecx, 2
"3:\n\t" // skip2: "3:\n\t" // skip2:
"movl %%ecx, %%ebx\n\t" // mov ebx, ecx "movl %%ecx, %%ebx\n\t" // mov ebx, ecx
"shrl $2, %%ecx\n\t" // shr ecx ,2 "shrl $2, %%ecx\n\t" // shr ecx ,2
"rep\n\t" "rep\n\t"
"movsl\n\t" "movsl\n\t"
"testb $2, %%bl\n\t" // test bl, 2 "testb $2, %%bl\n\t" // test bl, 2
"jz 4f\n\t" "jz 4f\n\t"
"movsw\n\t" "movsw\n\t"
"4:\n\t" // skip3: "4:\n\t" // skip3:
"testb $1, %%bl\n\t" // test bl, 1 "testb $1, %%bl\n\t" // test bl, 1
"jz 5f\n\t" "jz 5f\n\t"
"movsb\n\t" "movsb\n\t"
"5:" // endit: "5:" // endit:
: "+c" (c), "+S" (S), "+D" (D) : : "+c" (c), "+S" (S), "+D" (D) :
: "ebx", "memory", "cc" : "ebx", "memory", "cc"
); );
} }
void copybufreverse(void *S, void *D, long c) void copybufreverse(void *S, void *D, long c)
{ {
ASM ( ASM (
"shrl $1, %%ecx\n\t" "shrl $1, %%ecx\n\t"
"jnc 0f\n\t" // jnc skipit1 "jnc 0f\n\t" // jnc skipit1
"movb (%%esi), %%al\n\t" "movb (%%esi), %%al\n\t"
"decl %%esi\n\t" "decl %%esi\n\t"
"movb %%al, (%%edi)\n\t" "movb %%al, (%%edi)\n\t"
"incl %%edi\n\t" "incl %%edi\n\t"
"0:\n\t" // skipit1: "0:\n\t" // skipit1:
"shrl $1, %%ecx\n\t" "shrl $1, %%ecx\n\t"
"jnc 1f\n\t" // jnc skipit2 "jnc 1f\n\t" // jnc skipit2
"movw -1(%%esi), %%ax\n\t" "movw -1(%%esi), %%ax\n\t"
"subl $2, %%esi\n\t" "subl $2, %%esi\n\t"
"rorw $8, %%ax\n\t" "rorw $8, %%ax\n\t"
"movw %%ax, (%%edi)\n\t" "movw %%ax, (%%edi)\n\t"
"addl $2, %%edi\n\t" "addl $2, %%edi\n\t"
"1:\n\t" // skipit2 "1:\n\t" // skipit2
"testl %%ecx, %%ecx\n\t" "testl %%ecx, %%ecx\n\t"
"jz 3f\n\t" // jz endloop "jz 3f\n\t" // jz endloop
"2:\n\t" // begloop "2:\n\t" // begloop
"movl -3(%%esi), %%eax\n\t" "movl -3(%%esi), %%eax\n\t"
"subl $4, %%esi\n\t" "subl $4, %%esi\n\t"
"bswapl %%eax\n\t" "bswapl %%eax\n\t"
"movl %%eax, (%%edi)\n\t" "movl %%eax, (%%edi)\n\t"
"addl $4, %%edi\n\t" "addl $4, %%edi\n\t"
"decl %%ecx\n\t" "decl %%ecx\n\t"
"jnz 2b\n\t" // jnz begloop "jnz 2b\n\t" // jnz begloop
"3:" "3:"
: "+S" (S), "+D" (D), "+c" (c) : : "+S" (S), "+D" (D), "+c" (c) :
: "eax", "memory", "cc" : "eax", "memory", "cc"
); );
} }
#elif defined(__WATCOMC__) // __GNUC__ && __i386__ #elif defined(__WATCOMC__) // __GNUC__ && __i386__

View file

@ -18,307 +18,307 @@ static void skipovertoken(scriptfile *sf) { while ((sf->textptr < sf->eof) && (s
char *scriptfile_gettoken(scriptfile *sf) char *scriptfile_gettoken(scriptfile *sf)
{ {
char *start; char *start;
skipoverws(sf); skipoverws(sf);
if (sf->textptr >= sf->eof) return NULL; if (sf->textptr >= sf->eof) return NULL;
start = sf->ltextptr = sf->textptr; start = sf->ltextptr = sf->textptr;
skipovertoken(sf); skipovertoken(sf);
return start; return start;
} }
int scriptfile_getstring(scriptfile *sf, char **retst) int scriptfile_getstring(scriptfile *sf, char **retst)
{ {
(*retst) = scriptfile_gettoken(sf); (*retst) = scriptfile_gettoken(sf);
if (*retst == NULL) if (*retst == NULL)
{ {
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return(-2); return(-2);
} }
return(0); return(0);
} }
int scriptfile_getnumber(scriptfile *sf, int *num) int scriptfile_getnumber(scriptfile *sf, int *num)
{ {
skipoverws(sf); skipoverws(sf);
if (sf->textptr >= sf->eof) if (sf->textptr >= sf->eof)
{ {
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1; return -1;
} }
while ((sf->textptr[0] == '0') && (sf->textptr[1] >= '0') && (sf->textptr[1] <= '9')) while ((sf->textptr[0] == '0') && (sf->textptr[1] >= '0') && (sf->textptr[1] <= '9'))
sf->textptr++; //hack to treat octal numbers like decimal sf->textptr++; //hack to treat octal numbers like decimal
sf->ltextptr = sf->textptr; sf->ltextptr = sf->textptr;
(*num) = strtol((const char *)sf->textptr,&sf->textptr,0); (*num) = strtol((const char *)sf->textptr,&sf->textptr,0);
if (!ISWS(*sf->textptr) && *sf->textptr) { if (!ISWS(*sf->textptr) && *sf->textptr) {
char *p = sf->textptr; char *p = sf->textptr;
skipovertoken(sf); skipovertoken(sf);
initprintf("Error on line %s:%d: expecting int, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p); initprintf("Error on line %s:%d: expecting int, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p);
return -2; return -2;
} }
return 0; return 0;
} }
static double parsedouble(char *ptr, char **end) static double parsedouble(char *ptr, char **end)
{ {
int beforedecimal = 1, negative = 0, dig; int beforedecimal = 1, negative = 0, dig;
int exposgn = 0, expo = 0; int exposgn = 0, expo = 0;
double num = 0.0, decpl = 0.1; double num = 0.0, decpl = 0.1;
char *p; char *p;
p = ptr; p = ptr;
if (*p == '-') negative = 1, p++; if (*p == '-') negative = 1, p++;
else if (*p == '+') p++; else if (*p == '+') p++;
for (;; p++) { for (;; p++) {
if (*p >= '0' && *p <= '9') { if (*p >= '0' && *p <= '9') {
dig = *p - '0'; dig = *p - '0';
if (beforedecimal) num = num * 10.0 + dig; if (beforedecimal) num = num * 10.0 + dig;
else if (exposgn) expo = expo*10 + dig; else if (exposgn) expo = expo*10 + dig;
else { else {
num += (double)dig * decpl; num += (double)dig * decpl;
decpl /= 10.0; decpl /= 10.0;
} }
} else if (*p == '.') { } else if (*p == '.') {
if (beforedecimal) beforedecimal = 0; if (beforedecimal) beforedecimal = 0;
else break; else break;
} else if ((*p == 'E') || (*p == 'e')) { } else if ((*p == 'E') || (*p == 'e')) {
exposgn = 1; exposgn = 1;
if (p[1] == '-') { exposgn = -1; p++; } if (p[1] == '-') { exposgn = -1; p++; }
else if (p[1] == '+') p++; else if (p[1] == '+') p++;
} else break; } else break;
} }
if (end) *end = p; if (end) *end = p;
if (exposgn) num *= pow(10.0,(double)(expo*exposgn)); if (exposgn) num *= pow(10.0,(double)(expo*exposgn));
return negative ? -num : num; return negative ? -num : num;
} }
int scriptfile_getdouble(scriptfile *sf, double *num) int scriptfile_getdouble(scriptfile *sf, double *num)
{ {
skipoverws(sf); skipoverws(sf);
if (sf->textptr >= sf->eof) if (sf->textptr >= sf->eof)
{ {
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1; return -1;
} }
sf->ltextptr = sf->textptr;
// On Linux, locale settings interfere with interpreting x.y format numbers sf->ltextptr = sf->textptr;
//(*num) = strtod((const char *)sf->textptr,&sf->textptr);
(*num) = parsedouble(sf->textptr, &sf->textptr); // On Linux, locale settings interfere with interpreting x.y format numbers
//(*num) = strtod((const char *)sf->textptr,&sf->textptr);
if (!ISWS(*sf->textptr) && *sf->textptr) { (*num) = parsedouble(sf->textptr, &sf->textptr);
char *p = sf->textptr;
skipovertoken(sf); if (!ISWS(*sf->textptr) && *sf->textptr) {
initprintf("Error on line %s:%d: expecting float, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p); char *p = sf->textptr;
return -2; skipovertoken(sf);
} initprintf("Error on line %s:%d: expecting float, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p);
return 0; return -2;
}
return 0;
} }
int scriptfile_getsymbol(scriptfile *sf, int *num) int scriptfile_getsymbol(scriptfile *sf, int *num)
{ {
char *t, *e; char *t, *e;
int v; int v;
t = scriptfile_gettoken(sf); t = scriptfile_gettoken(sf);
if (!t) return -1; if (!t) return -1;
v = Bstrtol(t, &e, 10); v = Bstrtol(t, &e, 10);
if (*e) { if (*e) {
// looks like a string, so find it in the symbol table // looks like a string, so find it in the symbol table
if (scriptfile_getsymbolvalue(t, num)) return 0; if (scriptfile_getsymbolvalue(t, num)) return 0;
initprintf("Error on line %s:%d: expecting symbol, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),t); initprintf("Error on line %s:%d: expecting symbol, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),t);
return -2; // not found return -2; // not found
} }
*num = v; *num = v;
return 0; return 0;
} }
int scriptfile_getbraces(scriptfile *sf, char **braceend) int scriptfile_getbraces(scriptfile *sf, char **braceend)
{ {
int bracecnt; int bracecnt;
char *bracestart; char *bracestart;
skipoverws(sf); skipoverws(sf);
if (sf->textptr >= sf->eof) if (sf->textptr >= sf->eof)
{ {
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1; return -1;
} }
if (sf->textptr[0] != '{') { if (sf->textptr[0] != '{') {
initprintf("Error on line %s:%d: expecting '{'\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); initprintf("Error on line %s:%d: expecting '{'\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1; return -1;
} }
bracestart = ++sf->textptr; bracecnt = 1; bracestart = ++sf->textptr; bracecnt = 1;
while (1) while (1)
{ {
if (sf->textptr >= sf->eof) return(0); if (sf->textptr >= sf->eof) return(0);
if (sf->textptr[0] == '{') bracecnt++; if (sf->textptr[0] == '{') bracecnt++;
if (sf->textptr[0] == '}') { bracecnt--; if (!bracecnt) break; } if (sf->textptr[0] == '}') { bracecnt--; if (!bracecnt) break; }
sf->textptr++; sf->textptr++;
} }
(*braceend) = sf->textptr; (*braceend) = sf->textptr;
sf->textptr = bracestart; sf->textptr = bracestart;
return 0; return 0;
} }
int scriptfile_getlinum (scriptfile *sf, char *ptr) int scriptfile_getlinum (scriptfile *sf, char *ptr)
{ {
int i, stp, ind; int i, stp, ind;
//for(i=0;i<sf->linenum;i++) if (sf->lineoffs[i] >= ind) return(i+1); //brute force algo //for(i=0;i<sf->linenum;i++) if (sf->lineoffs[i] >= ind) return(i+1); //brute force algo
ind = ((long)ptr) - ((long)sf->textbuf); 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(stp=1;stp+stp<sf->linenum;stp+=stp); //stp = highest power of 2 less than sf->linenum
for(i=0;stp;stp>>=1) for(i=0;stp;stp>>=1)
if ((i+stp < sf->linenum) && (sf->lineoffs[i+stp] < ind)) i += stp; 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 return(i+1); //i = index to highest lineoffs which is less than ind; convert to 1-based line numbers
} }
void scriptfile_preparse (scriptfile *sf, char *tx, long flen) void scriptfile_preparse (scriptfile *sf, char *tx, long flen)
{ {
long i, cr, numcr, nflen, ws, cs, inquote; long i, cr, numcr, nflen, ws, cs, inquote;
//Count number of lines //Count number of lines
numcr = 1; 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 :) //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; } cr=0;if (tx[i] == '\r') { i += (tx[i+1] == '\n'); cr = 1; }
else if (tx[i] == '\n') { i += (tx[i+1] == '\r'); cr = 1; } else if (tx[i] == '\n') { i += (tx[i+1] == '\r'); cr = 1; }
if (cr) { numcr++; continue; } if (cr) { numcr++; continue; }
} }
sf->linenum = numcr; sf->linenum = numcr;
sf->lineoffs = (long *)malloc(sf->linenum*sizeof(long)); sf->lineoffs = (long *)malloc(sf->linenum*sizeof(long));
//Preprocess file for comments (// and /*...*/, and convert all whitespace to single spaces) //Preprocess file for comments (// and /*...*/, and convert all whitespace to single spaces)
nflen = 0; ws = 0; cs = 0; numcr = 0; inquote = 0; 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 :) //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; } cr=0;if (tx[i] == '\r') { i += (tx[i+1] == '\n'); cr = 1; }
else if (tx[i] == '\n') { i += (tx[i+1] == '\r'); cr = 1; } else if (tx[i] == '\n') { i += (tx[i+1] == '\r'); cr = 1; }
if (cr) if (cr)
{ {
//Remember line numbers by storing the byte index at the start of each line //Remember line numbers by storing the byte index at the start of each line
//Line numbers can be retrieved by doing a binary search on the byte index :) //Line numbers can be retrieved by doing a binary search on the byte index :)
sf->lineoffs[numcr++] = nflen; sf->lineoffs[numcr++] = nflen;
if (cs == 1) cs = 0; if (cs == 1) cs = 0;
ws = 1; continue; //strip CR/LF ws = 1; continue; //strip CR/LF
} }
if ((!inquote) && ((tx[i] == ' ') || (tx[i] == '\t'))) { ws = 1; continue; } //strip Space/Tab if ((!inquote) && ((tx[i] == ' ') || (tx[i] == '\t'))) { ws = 1; continue; } //strip Space/Tab
if ((tx[i] == '/') && (tx[i+1] == '/') && (!cs)) cs = 1; if ((tx[i] == '/') && (tx[i+1] == '/') && (!cs)) cs = 1;
if ((tx[i] == '/') && (tx[i+1] == '*') && (!cs)) { ws = 1; cs = 2; } if ((tx[i] == '/') && (tx[i+1] == '*') && (!cs)) { ws = 1; cs = 2; }
if ((tx[i] == '*') && (tx[i+1] == '/') && (cs == 2)) { cs = 0; i++; continue; } if ((tx[i] == '*') && (tx[i+1] == '/') && (cs == 2)) { cs = 0; i++; continue; }
if (cs) continue; if (cs) continue;
if (ws) { tx[nflen++] = 0; ws = 0; } if (ws) { tx[nflen++] = 0; ws = 0; }
//quotes inside strings: \" //quotes inside strings: \"
if ((tx[i] == '\\') && (tx[i+1] == '\"')) { i++; tx[nflen++] = '\"'; continue; } if ((tx[i] == '\\') && (tx[i+1] == '\"')) { i++; tx[nflen++] = '\"'; continue; }
if (tx[i] == '\"') { inquote ^= 1; continue; } if (tx[i] == '\"') { inquote ^= 1; continue; }
tx[nflen++] = tx[i]; tx[nflen++] = tx[i];
} }
tx[nflen++] = 0; sf->lineoffs[numcr] = nflen; tx[nflen++] = 0; sf->lineoffs[numcr] = nflen;
tx[nflen++] = 0; tx[nflen++] = 0;
#if 0 #if 0
//for debugging only: //for debugging only:
printf("pre-parsed file:flen=%d,nflen=%d\n",flen,nflen); 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); 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 #endif
flen = nflen; flen = nflen;
sf->textbuf = sf->textptr = tx; sf->textbuf = sf->textptr = tx;
sf->textlength = nflen; sf->textlength = nflen;
sf->eof = &sf->textbuf[nflen-1]; sf->eof = &sf->textbuf[nflen-1];
} }
scriptfile *scriptfile_fromfile(char *fn) scriptfile *scriptfile_fromfile(char *fn)
{ {
int fp; int fp;
scriptfile *sf; scriptfile *sf;
char *tx; char *tx;
unsigned int flen; unsigned int flen;
fp = kopen4load(fn,0); fp = kopen4load(fn,0);
if (fp<0) return NULL; if (fp<0) return NULL;
flen = kfilelength(fp); flen = kfilelength(fp);
tx = (char *) malloc(flen + 2); tx = (char *) malloc(flen + 2);
if (!tx) { if (!tx) {
kclose(fp); kclose(fp);
return NULL; return NULL;
} }
sf = (scriptfile*) malloc(sizeof(scriptfile)); sf = (scriptfile*) malloc(sizeof(scriptfile));
if (!sf) { if (!sf) {
kclose(fp); kclose(fp);
free(tx); free(tx);
return NULL; return NULL;
} }
kread(fp, tx, flen); kread(fp, tx, flen);
tx[flen] = tx[flen+1] = 0; tx[flen] = tx[flen+1] = 0;
kclose(fp); kclose(fp);
scriptfile_preparse(sf,tx,flen); scriptfile_preparse(sf,tx,flen);
sf->filename = strdup(fn); sf->filename = strdup(fn);
return sf; return sf;
} }
scriptfile *scriptfile_fromstring(char *string) scriptfile *scriptfile_fromstring(char *string)
{ {
scriptfile *sf; scriptfile *sf;
char *tx; char *tx;
unsigned int flen; unsigned int flen;
if (!string) return NULL; if (!string) return NULL;
flen = strlen(string); flen = strlen(string);
tx = (char *) malloc(flen + 2); tx = (char *) malloc(flen + 2);
if (!tx) return NULL; if (!tx) return NULL;
sf = (scriptfile*) malloc(sizeof(scriptfile)); sf = (scriptfile*) malloc(sizeof(scriptfile));
if (!sf) { if (!sf) {
free(tx); free(tx);
return NULL; return NULL;
} }
memcpy(tx, string, flen); memcpy(tx, string, flen);
tx[flen] = tx[flen+1] = 0; tx[flen] = tx[flen+1] = 0;
scriptfile_preparse(sf,tx,flen); scriptfile_preparse(sf,tx,flen);
sf->filename = NULL; sf->filename = NULL;
return sf; return sf;
} }
void scriptfile_close(scriptfile *sf) void scriptfile_close(scriptfile *sf)
{ {
if (!sf) return; if (!sf) return;
if (sf->lineoffs) free(sf->lineoffs); if (sf->lineoffs) free(sf->lineoffs);
if (sf->textbuf) free(sf->textbuf); if (sf->textbuf) free(sf->textbuf);
if (sf->filename) free(sf->filename); if (sf->filename) free(sf->filename);
sf->textbuf = NULL; sf->textbuf = NULL;
sf->filename = NULL; sf->filename = NULL;
free(sf); free(sf);
} }
@ -328,68 +328,68 @@ static char *symbtab = NULL;
static char * getsymbtabspace(int reqd) static char * getsymbtabspace(int reqd)
{ {
char *pos,*np; char *pos,*np;
int i; int i;
if (symbtablength + reqd > symbtaballoclength) 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; np = (char *)realloc(symbtab, i); if (!np) return NULL;
symbtab = np; symbtaballoclength = i; symbtab = np; symbtaballoclength = i;
} }
pos = &symbtab[symbtablength]; pos = &symbtab[symbtablength];
symbtablength += reqd; symbtablength += reqd;
return pos; return pos;
} }
int scriptfile_getsymbolvalue(char *name, int *val) int scriptfile_getsymbolvalue(char *name, int *val)
{ {
char *scanner = symbtab; char *scanner = symbtab;
if (!symbtab) return 0; if (!symbtab) return 0;
while (scanner - symbtab < symbtablength) { while (scanner - symbtab < symbtablength) {
if (!Bstrcasecmp(name, scanner)) { if (!Bstrcasecmp(name, scanner)) {
*val = *(int*)(scanner + strlen(scanner) + 1); *val = *(int*)(scanner + strlen(scanner) + 1);
return 1; return 1;
} }
scanner += strlen(scanner) + 1 + sizeof(int); scanner += strlen(scanner) + 1 + sizeof(int);
} }
return 0; return 0;
} }
int scriptfile_addsymbolvalue(char *name, int val) int scriptfile_addsymbolvalue(char *name, int val)
{ {
int x; int x;
char *sp; char *sp;
// if (scriptfile_getsymbolvalue(name, &x)) return -1; // already exists // if (scriptfile_getsymbolvalue(name, &x)) return -1; // already exists
if (symbtab) { if (symbtab) {
char *scanner = symbtab; char *scanner = symbtab;
while (scanner - symbtab < symbtablength) { while (scanner - symbtab < symbtablength) {
if (!Bstrcasecmp(name, scanner)) { if (!Bstrcasecmp(name, scanner)) {
*(int*)(scanner + strlen(scanner) + 1) = val; *(int*)(scanner + strlen(scanner) + 1) = val;
return 1; return 1;
} }
scanner += strlen(scanner) + 1 + sizeof(int); scanner += strlen(scanner) + 1 + sizeof(int);
} }
} }
sp = getsymbtabspace(strlen(name) + 1 + sizeof(int)); sp = getsymbtabspace(strlen(name) + 1 + sizeof(int));
if (!sp) return 0; if (!sp) return 0;
strcpy(sp, name); strcpy(sp, name);
sp += strlen(name)+1; sp += strlen(name)+1;
*(int*)sp = val; *(int*)sp = val;
return 1; // added return 1; // added
} }
void scriptfile_clearsymbols(void) void scriptfile_clearsymbols(void)
{ {
if (symbtab) free(symbtab); if (symbtab) free(symbtab);
symbtab = NULL; symbtab = NULL;
symbtablength = 0; symbtablength = 0;
symbtaballoclength = 0; symbtaballoclength = 0;
} }

File diff suppressed because it is too large Load diff

View file

@ -4,176 +4,176 @@
// Generated by BIN2C.EXE by Jonathon Fowler // Generated by BIN2C.EXE by Jonathon Fowler
char smalltextfont[2048] = { char smalltextfont[2048] = {
// 2048 bytes // 2048 bytes
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x24,
0x3C, 0x18, 0x00, 0x00, 0x00, 0x18, 0x24, 0x3C, 0x24, 0x18, 0x00, 0x00, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x18, 0x24, 0x3C, 0x24, 0x18, 0x00, 0x00,
0x00, 0x28, 0x3C, 0x3C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x10, 0x38, 0x3C, 0x00, 0x28, 0x3C, 0x3C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x10, 0x38, 0x3C,
0x38, 0x10, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x3C, 0x00, 0x00, 0x38, 0x10, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x3C, 0x00, 0x00,
0x00, 0x18, 0x18, 0x3C, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3C, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x28, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x28, 0x38, 0x38, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x14, 0x14, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x14, 0x14, 0x30, 0x00, 0x00,
0x00, 0x24, 0x18, 0x3C, 0x18, 0x24, 0x00, 0x00, 0x00, 0x20, 0x30, 0x38, 0x00, 0x24, 0x18, 0x3C, 0x18, 0x24, 0x00, 0x00, 0x00, 0x20, 0x30, 0x38,
0x30, 0x20, 0x00, 0x00, 0x00, 0x08, 0x18, 0x38, 0x18, 0x08, 0x00, 0x00, 0x30, 0x20, 0x00, 0x00, 0x00, 0x08, 0x18, 0x38, 0x18, 0x08, 0x00, 0x00,
0x00, 0x10, 0x38, 0x10, 0x38, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x00, 0x10, 0x38, 0x10, 0x38, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28,
0x00, 0x28, 0x00, 0x00, 0x00, 0x1C, 0x34, 0x34, 0x14, 0x14, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x1C, 0x34, 0x34, 0x14, 0x14, 0x00, 0x00,
0x00, 0x1C, 0x30, 0x28, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x30, 0x28, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10, 0x38, 0x38, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10, 0x38, 0x38, 0x00, 0x00,
0x00, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10,
0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3C, 0x08, 0x00, 0x00, 0x00, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3C, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x3C, 0x28, 0x3C, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x3C, 0x28, 0x3C, 0x28, 0x00, 0x00,
0x00, 0x18, 0x30, 0x10, 0x18, 0x30, 0x00, 0x00, 0x00, 0x28, 0x08, 0x10, 0x00, 0x18, 0x30, 0x10, 0x18, 0x30, 0x00, 0x00, 0x00, 0x28, 0x08, 0x10,
0x20, 0x28, 0x00, 0x00, 0x00, 0x10, 0x28, 0x10, 0x30, 0x38, 0x00, 0x00, 0x20, 0x28, 0x00, 0x00, 0x00, 0x10, 0x28, 0x10, 0x30, 0x38, 0x00, 0x00,
0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x20, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x20,
0x20, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00,
0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00,
0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00,
0x00, 0x38, 0x28, 0x28, 0x28, 0x38, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x38, 0x28, 0x28, 0x28, 0x38, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10,
0x10, 0x10, 0x00, 0x00, 0x00, 0x38, 0x08, 0x38, 0x20, 0x38, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x38, 0x08, 0x38, 0x20, 0x38, 0x00, 0x00,
0x00, 0x38, 0x08, 0x38, 0x08, 0x38, 0x00, 0x00, 0x00, 0x28, 0x28, 0x38, 0x00, 0x38, 0x08, 0x38, 0x08, 0x38, 0x00, 0x00, 0x00, 0x28, 0x28, 0x38,
0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x08, 0x38, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x08, 0x38, 0x00, 0x00,
0x00, 0x38, 0x20, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x00, 0x38, 0x20, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08,
0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x28, 0x38, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x28, 0x38, 0x00, 0x00,
0x00, 0x38, 0x28, 0x38, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x38, 0x28, 0x38, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x20, 0x00, 0x00,
0x00, 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00,
0x38, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x10, 0x20, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x10, 0x20, 0x00, 0x00,
0x00, 0x30, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x30, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38,
0x30, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x38, 0x28, 0x28, 0x00, 0x00, 0x30, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x38, 0x28, 0x28, 0x00, 0x00,
0x00, 0x30, 0x28, 0x30, 0x28, 0x30, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20, 0x00, 0x30, 0x28, 0x30, 0x28, 0x30, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20,
0x20, 0x18, 0x00, 0x00, 0x00, 0x30, 0x28, 0x28, 0x28, 0x30, 0x00, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x30, 0x28, 0x28, 0x28, 0x30, 0x00, 0x00,
0x00, 0x38, 0x20, 0x30, 0x20, 0x38, 0x00, 0x00, 0x00, 0x38, 0x20, 0x30, 0x00, 0x38, 0x20, 0x30, 0x20, 0x38, 0x00, 0x00, 0x00, 0x38, 0x20, 0x30,
0x20, 0x20, 0x00, 0x00, 0x00, 0x38, 0x20, 0x28, 0x28, 0x38, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x38, 0x20, 0x28, 0x28, 0x38, 0x00, 0x00,
0x00, 0x28, 0x28, 0x38, 0x28, 0x28, 0x00, 0x00, 0x00, 0x38, 0x10, 0x10, 0x00, 0x28, 0x28, 0x38, 0x28, 0x28, 0x00, 0x00, 0x00, 0x38, 0x10, 0x10,
0x10, 0x38, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x28, 0x18, 0x00, 0x00, 0x10, 0x38, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x28, 0x18, 0x00, 0x00,
0x00, 0x28, 0x28, 0x30, 0x28, 0x28, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x00, 0x28, 0x28, 0x30, 0x28, 0x28, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20,
0x20, 0x38, 0x00, 0x00, 0x00, 0x28, 0x38, 0x38, 0x28, 0x28, 0x00, 0x00, 0x20, 0x38, 0x00, 0x00, 0x00, 0x28, 0x38, 0x38, 0x28, 0x28, 0x00, 0x00,
0x00, 0x28, 0x38, 0x38, 0x38, 0x28, 0x00, 0x00, 0x00, 0x38, 0x28, 0x28, 0x00, 0x28, 0x38, 0x38, 0x38, 0x28, 0x00, 0x00, 0x00, 0x38, 0x28, 0x28,
0x28, 0x38, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x20, 0x20, 0x00, 0x00, 0x28, 0x38, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x20, 0x20, 0x00, 0x00,
0x00, 0x38, 0x28, 0x28, 0x38, 0x18, 0x00, 0x00, 0x00, 0x38, 0x28, 0x30, 0x00, 0x38, 0x28, 0x28, 0x38, 0x18, 0x00, 0x00, 0x00, 0x38, 0x28, 0x30,
0x28, 0x28, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x08, 0x38, 0x00, 0x00, 0x28, 0x28, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x08, 0x38, 0x00, 0x00,
0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28,
0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
0x00, 0x28, 0x28, 0x38, 0x38, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x10, 0x00, 0x28, 0x28, 0x38, 0x38, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x10,
0x28, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x38, 0x10, 0x10, 0x00, 0x00, 0x28, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x38, 0x10, 0x10, 0x00, 0x00,
0x00, 0x38, 0x08, 0x10, 0x20, 0x38, 0x00, 0x00, 0x00, 0x30, 0x20, 0x20, 0x00, 0x38, 0x08, 0x10, 0x20, 0x38, 0x00, 0x00, 0x00, 0x30, 0x20, 0x20,
0x20, 0x30, 0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00,
0x00, 0x18, 0x08, 0x08, 0x08, 0x18, 0x00, 0x00, 0x00, 0x10, 0x28, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x18, 0x00, 0x00, 0x00, 0x10, 0x28, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00,
0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x28, 0x18, 0x00, 0x00, 0x00, 0x20, 0x20, 0x38, 0x28, 0x38, 0x00, 0x00, 0x28, 0x18, 0x00, 0x00, 0x00, 0x20, 0x20, 0x38, 0x28, 0x38, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x00, 0x00, 0x00, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x00, 0x00, 0x00, 0x08, 0x08, 0x38,
0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00, 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00,
0x00, 0x08, 0x10, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x28, 0x00, 0x08, 0x10, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x28,
0x18, 0x08, 0x30, 0x00, 0x00, 0x20, 0x20, 0x38, 0x28, 0x28, 0x00, 0x00, 0x18, 0x08, 0x30, 0x00, 0x00, 0x20, 0x20, 0x38, 0x28, 0x28, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x10, 0x10, 0x20, 0x00, 0x00, 0x20, 0x20, 0x28, 0x30, 0x28, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x20, 0x20, 0x28, 0x30, 0x28, 0x00, 0x00,
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x20, 0x38, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x20, 0x38,
0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x28, 0x28, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x28, 0x28, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
0x28, 0x38, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x08, 0x00, 0x28, 0x38, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x08, 0x00,
0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x10, 0x30, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10, 0x10, 0x00, 0x00, 0x10, 0x30, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x00, 0x00, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x00, 0x00,
0x00, 0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x28, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x18, 0x00, 0x00, 0x28, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x18, 0x00, 0x00,
0x00, 0x18, 0x10, 0x20, 0x10, 0x18, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x18, 0x10, 0x20, 0x10, 0x18, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
0x10, 0x10, 0x00, 0x00, 0x00, 0x30, 0x10, 0x08, 0x10, 0x30, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x30, 0x10, 0x08, 0x10, 0x30, 0x00, 0x00,
0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28,
0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20, 0x20, 0x18, 0x30, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20, 0x20, 0x18, 0x30, 0x00,
0x00, 0x28, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x28, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18,
0x38, 0x18, 0x00, 0x00, 0x00, 0x38, 0x00, 0x18, 0x28, 0x18, 0x00, 0x00, 0x38, 0x18, 0x00, 0x00, 0x00, 0x38, 0x00, 0x18, 0x28, 0x18, 0x00, 0x00,
0x00, 0x28, 0x00, 0x18, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18, 0x00, 0x28, 0x00, 0x18, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18,
0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x28, 0x18, 0x00, 0x00, 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x28, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x10, 0x00, 0x00, 0x38, 0x00, 0x18, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x10, 0x00, 0x00, 0x38, 0x00, 0x18,
0x38, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00, 0x38, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00,
0x00, 0x30, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x30, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00,
0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0x30, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x30, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x28, 0x10, 0x28,
0x38, 0x28, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x38, 0x28, 0x00, 0x00, 0x38, 0x28, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x38, 0x28, 0x00, 0x00,
0x00, 0x18, 0x00, 0x38, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x18, 0x00, 0x38, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
0x28, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x28, 0x3C, 0x28, 0x2C, 0x00, 0x00, 0x28, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x28, 0x3C, 0x28, 0x2C, 0x00, 0x00,
0x00, 0x38, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x38,
0x28, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x28, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00,
0x00, 0x38, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x28, 0x00, 0x38, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x28,
0x28, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x28, 0x18, 0x30, 0x00, 0x28, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x28, 0x18, 0x30, 0x00,
0x00, 0x28, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28,
0x28, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x20, 0x38, 0x10, 0x00, 0x00, 0x28, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x20, 0x38, 0x10, 0x00, 0x00,
0x00, 0x18, 0x14, 0x30, 0x10, 0x3C, 0x00, 0x00, 0x00, 0x28, 0x10, 0x38, 0x00, 0x18, 0x14, 0x30, 0x10, 0x3C, 0x00, 0x00, 0x00, 0x28, 0x10, 0x38,
0x38, 0x10, 0x00, 0x00, 0x00, 0x30, 0x28, 0x3C, 0x28, 0x2C, 0x00, 0x00, 0x38, 0x10, 0x00, 0x00, 0x00, 0x30, 0x28, 0x3C, 0x28, 0x2C, 0x00, 0x00,
0x00, 0x18, 0x10, 0x38, 0x10, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x10, 0x38, 0x10, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18,
0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x10, 0x10, 0x00, 0x00, 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x10, 0x10, 0x00, 0x00,
0x00, 0x18, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x18, 0x00, 0x28, 0x00, 0x18, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x18, 0x00, 0x28,
0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x28, 0x28, 0x00, 0x00, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x28, 0x28, 0x00, 0x00,
0x00, 0x38, 0x00, 0x28, 0x38, 0x28, 0x00, 0x00, 0x00, 0x18, 0x28, 0x18, 0x00, 0x38, 0x00, 0x28, 0x38, 0x28, 0x00, 0x00, 0x00, 0x18, 0x28, 0x18,
0x00, 0x38, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x38, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x38, 0x00, 0x00,
0x00, 0x10, 0x00, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x10, 0x00, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x00, 0x00, 0x00,
0x00, 0x20, 0x28, 0x10, 0x38, 0x18, 0x00, 0x00, 0x00, 0x20, 0x28, 0x18, 0x00, 0x20, 0x28, 0x10, 0x38, 0x18, 0x00, 0x00, 0x00, 0x20, 0x28, 0x18,
0x38, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x38, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0x14, 0x28, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x14, 0x00, 0x00, 0x14, 0x28, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x14,
0x28, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x00,
0x00, 0x14, 0x28, 0x14, 0x28, 0x14, 0x28, 0x00, 0x00, 0x34, 0x1C, 0x34, 0x00, 0x14, 0x28, 0x14, 0x28, 0x14, 0x28, 0x00, 0x00, 0x34, 0x1C, 0x34,
0x1C, 0x34, 0x1C, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x1C, 0x34, 0x1C, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00,
0x00, 0x10, 0x10, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x30, 0x00, 0x10, 0x10, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x30,
0x30, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x00, 0x30, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x00,
0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x30,
0x30, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x38, 0x38, 0x18, 0x18, 0x00, 0x30, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x38, 0x38, 0x18, 0x18, 0x00,
0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x38,
0x38, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x38, 0x38, 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x38, 0x38, 0x00, 0x00, 0x00,
0x00, 0x18, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x30, 0x00, 0x18, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x30,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x00,
0x00, 0x10, 0x10, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x3C, 0x00, 0x10, 0x10, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x10, 0x10, 0x10, 0x00,
0x00, 0x10, 0x10, 0x1C, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x10, 0x10, 0x1C, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x3C, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x3C, 0x10, 0x10, 0x10, 0x00,
0x00, 0x10, 0x10, 0x1C, 0x1C, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x1C, 0x00, 0x10, 0x10, 0x1C, 0x1C, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x1C,
0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x1C, 0x1C, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x1C, 0x1C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1C, 0x1C, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x3C,
0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x18, 0x18, 0x00,
0x00, 0x18, 0x18, 0x1C, 0x1C, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x18, 0x18, 0x1C, 0x1C, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3C,
0x3C, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00,
0x00, 0x10, 0x10, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3C, 0x00, 0x10, 0x10, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x10, 0x10, 0x00,
0x00, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x1C, 0x00, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x1C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1C, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1C, 0x1C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1C, 0x1C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1C,
0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x3C, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x3C, 0x18, 0x18, 0x18, 0x00,
0x00, 0x10, 0x10, 0x3C, 0x3C, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x30, 0x00, 0x10, 0x10, 0x3C, 0x3C, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x30,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x10, 0x10, 0x10, 0x00,
0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00,
0x00, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x00, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x00, 0x00, 0x3C, 0x3C, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x28, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x28, 0x34, 0x00, 0x00,
0x00, 0x30, 0x28, 0x30, 0x28, 0x30, 0x20, 0x00, 0x00, 0x38, 0x28, 0x20, 0x00, 0x30, 0x28, 0x30, 0x28, 0x30, 0x20, 0x00, 0x00, 0x38, 0x28, 0x20,
0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x00, 0x00,
0x00, 0x38, 0x20, 0x10, 0x20, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x38, 0x20, 0x10, 0x20, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x30, 0x20, 0x00, 0x00, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x30, 0x20, 0x00, 0x00,
0x00, 0x00, 0x14, 0x28, 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x10, 0x28, 0x00, 0x00, 0x14, 0x28, 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x10, 0x28,
0x10, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x38, 0x28, 0x10, 0x00, 0x00, 0x10, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x38, 0x28, 0x10, 0x00, 0x00,
0x00, 0x18, 0x24, 0x24, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x18, 0x10, 0x18, 0x00, 0x18, 0x24, 0x24, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x18, 0x10, 0x18,
0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, 0x00,
0x00, 0x04, 0x18, 0x3C, 0x18, 0x20, 0x00, 0x00, 0x00, 0x18, 0x20, 0x30, 0x00, 0x04, 0x18, 0x3C, 0x18, 0x20, 0x00, 0x00, 0x00, 0x18, 0x20, 0x30,
0x20, 0x18, 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00,
0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10,
0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x08, 0x10, 0x00, 0x38, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x08, 0x10, 0x00, 0x38, 0x00, 0x00,
0x00, 0x10, 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x20, 0x00, 0x10, 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x20,
0x20, 0x20, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x28, 0x10, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x28, 0x10, 0x00, 0x00,
0x00, 0x10, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x00, 0x10, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38,
0x30, 0x00, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x30, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x30, 0x10, 0x00, 0x00,
0x00, 0x30, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x38, 0x00, 0x30, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x38,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };

View file

@ -37,94 +37,94 @@ void loadwaves(void);
static unsigned int F_CALLBACKAPI f_open(const char *name) static unsigned int F_CALLBACKAPI f_open(const char *name)
{ {
return kopen4load((char *)name, 0) + 1; return kopen4load((char *)name, 0) + 1;
} }
static void F_CALLBACKAPI f_close(unsigned int handle) static void F_CALLBACKAPI f_close(unsigned int handle)
{ {
kclose(handle - 1); kclose(handle - 1);
} }
static int F_CALLBACKAPI f_read(void *buffer, int size, unsigned int handle) static int F_CALLBACKAPI f_read(void *buffer, int size, unsigned int handle)
{ {
return kread(handle - 1, buffer, size); return kread(handle - 1, buffer, size);
} }
static int F_CALLBACKAPI f_seek(unsigned int handle, int pos, signed char mode) static int F_CALLBACKAPI f_seek(unsigned int handle, int pos, signed char mode)
{ {
return klseek(handle - 1, pos, mode); return klseek(handle - 1, pos, mode);
} }
static int F_CALLBACKAPI f_tell(unsigned int handle) static int F_CALLBACKAPI f_tell(unsigned int handle)
{ {
return ktell(handle - 1); return ktell(handle - 1);
} }
void initsb(char dadigistat, char damusistat, long dasamplerate, char danumspeakers, char dabytespersample, char daintspersec, char daquality) void initsb(char dadigistat, char damusistat, long dasamplerate, char danumspeakers, char dabytespersample, char daintspersec, char daquality)
{ {
char *s; char *s;
int i,j; int i,j;
if (fmod_inited) return;
fmod_inited = 0;
if (dasamplerate < 6000) dasamplerate = 6000; if (fmod_inited) return;
else if (dasamplerate > 48000) dasamplerate = 48000; fmod_inited = 0;
musicstat = damusistat; if (dasamplerate < 6000) dasamplerate = 6000;
else if (dasamplerate > 48000) dasamplerate = 48000;
printOSD("Initialising FMOD...\n");
printOSD(" Linked version: %.02f\n", FMOD_VERSION);
printOSD(" DLL version: %.02f\n", FSOUND_GetVersion());
if (FSOUND_GetVersion() < FMOD_VERSION) { musicstat = damusistat;
printOSD(" ... Failure: FMOD DLL too old! Sound disabled.\n");
return;
}
printOSD(" Samplerate: %d hz\n", dasamplerate);
//FSOUND_SetOutput(FSOUND_OUTPUT_ASIO); printOSD("Initialising FMOD...\n");
printOSD(" Linked version: %.02f\n", FMOD_VERSION);
printOSD(" DLL version: %.02f\n", FSOUND_GetVersion());
if (FSOUND_Init(dasamplerate, NUMCHANNELS, 0)) { if (FSOUND_GetVersion() < FMOD_VERSION) {
printOSD(" ... Success\n"); printOSD(" ... Failure: FMOD DLL too old! Sound disabled.\n");
fmod_inited = 1; return;
} else { }
printOSD(" ... Failure: %s\n", FMOD_ErrorString(FSOUND_GetError()));
}
switch (FSOUND_GetOutput()) { printOSD(" Samplerate: %d hz\n", dasamplerate);
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);
FSOUND_File_SetCallbacks( //FSOUND_SetOutput(FSOUND_OUTPUT_ASIO);
(FSOUND_OPENCALLBACK)f_open,
(FSOUND_CLOSECALLBACK)f_close,
(FSOUND_READCALLBACK)f_read,
(FSOUND_SEEKCALLBACK)f_seek,
(FSOUND_TELLCALLBACK)f_tell);
//FSOUND_SetMemorySystem(fmod_cache, fmod_cachelen, NULL, NULL, NULL);
loadwaves(); if (FSOUND_Init(dasamplerate, NUMCHANNELS, 0)) {
printOSD(" ... Success\n");
fmod_inited = 1;
} else {
printOSD(" ... Failure: %s\n", FMOD_ErrorString(FSOUND_GetError()));
}
for (i=0; i<NUMCHANNELS; i++) channels[i] = -1; 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;
}
printOSD("Using FMOD \"%s\" output driver\n", s);
FSOUND_File_SetCallbacks(
(FSOUND_OPENCALLBACK)f_open,
(FSOUND_CLOSECALLBACK)f_close,
(FSOUND_READCALLBACK)f_read,
(FSOUND_SEEKCALLBACK)f_seek,
(FSOUND_TELLCALLBACK)f_tell);
//FSOUND_SetMemorySystem(fmod_cache, fmod_cachelen, NULL, NULL, NULL);
loadwaves();
for (i=0; i<NUMCHANNELS; i++) channels[i] = -1;
} }
void uninitsb(void) void uninitsb(void)
{ {
if (fmod_inited) { if (fmod_inited) {
FSOUND_Close(); FSOUND_Close();
fmod_inited = 0; fmod_inited = 0;
} }
} }
@ -135,189 +135,189 @@ void setears(long daposx, long daposy, long daxvect, long dayvect)
void wsayfollow(char *dafilename, long dafreq, long davol, long *daxplc, long *dayplc, char followstat) void wsayfollow(char *dafilename, long dafreq, long davol, long *daxplc, long *dayplc, char followstat)
{ {
/* /*
dafilename: dafilename:
filename filename
dafreq: dafreq:
4096 = Middle C 4096 = Middle C
8192 = +1 8ve 8192 = +1 8ve
davol: davol:
0-256 = volume 0-256 = volume
daxplc: daxplc:
dayplc: dayplc:
followstat: 0 = sound emination origin (fixed) followstat: 0 = sound emination origin (fixed)
followstat: 1 = pointer to sprite coordinates (dynamic) followstat: 1 = pointer to sprite coordinates (dynamic)
followstat: followstat:
0 = position is fixed in space 0 = position is fixed in space
1 = position follows an object 1 = position follows an object
*/ */
unsigned char ch1, ch2; unsigned char ch1, ch2;
long i, wavnum, bad, oldest=0, free=-1, ox, oy, x, y, vo; long i, wavnum, bad, oldest=0, free=-1, ox, oy, x, y, vo;
unsigned int oldestpos=0; unsigned int oldestpos=0;
int chan; int chan;
if (fmod_inited == 0) return; if (fmod_inited == 0) return;
for (wavnum=numwaves-1;wavnum>=0;wavnum--) { for (wavnum=numwaves-1;wavnum>=0;wavnum--) {
bad = 0; bad = 0;
i = 0; i = 0;
while ((dafilename[i] > 0) && (i < 16)) while ((dafilename[i] > 0) && (i < 16))
{ {
ch1 = dafilename[i]; if ((ch1 >= 97) && (ch1 <= 123)) ch1 -= 32; ch1 = dafilename[i]; if ((ch1 >= 97) && (ch1 <= 123)) ch1 -= 32;
ch2 = instname[wavnum][i]; if ((ch2 >= 97) && (ch2 <= 123)) ch2 -= 32; ch2 = instname[wavnum][i]; if ((ch2 >= 97) && (ch2 <= 123)) ch2 -= 32;
if (ch1 != ch2) {bad = 1; break;} if (ch1 != ch2) {bad = 1; break;}
i++; i++;
} }
if (bad != 0) continue; if (bad != 0) continue;
for (i=0; i<NUMCHANNELS; i++) { for (i=0; i<NUMCHANNELS; i++) {
if (!FSOUND_IsPlaying(channels[i])) { if (!FSOUND_IsPlaying(channels[i])) {
free = i; free = i;
break; break;
} }
if (i==0) continue; if (i==0) continue;
if (FSOUND_GetCurrentPosition(channels[i]) > oldestpos) {
oldest = i;
oldestpos = FSOUND_GetCurrentPosition(channels[i]);
}
}
if (free < 0) { if (FSOUND_GetCurrentPosition(channels[i]) > oldestpos) {
FSOUND_StopSound(channels[oldest]); oldest = i;
free = oldest; oldestpos = FSOUND_GetCurrentPosition(channels[i]);
} }
}
chan = FSOUND_PlaySoundEx(FSOUND_FREE, samples[wavnum], NULL, 1); if (free < 0) {
if (chan == -1) return; FSOUND_StopSound(channels[oldest]);
FSOUND_SetFrequency(chan, dafreq*11025/4096); free = oldest;
FSOUND_SetVolume(chan, davol); }
FSOUND_SetPaused(chan, 0); chan = FSOUND_PlaySoundEx(FSOUND_FREE, samples[wavnum], NULL, 1);
if (chan == -1) return;
channels[free] = chan; FSOUND_SetFrequency(chan, dafreq*11025/4096);
return; FSOUND_SetVolume(chan, davol);
}
FSOUND_SetPaused(chan, 0);
channels[free] = chan;
return;
}
} }
void wsay(char *dafilename, long dafreq, long volume1, long volume2) void wsay(char *dafilename, long dafreq, long volume1, long volume2)
{ {
unsigned char ch1, ch2; unsigned char ch1, ch2;
long i, j, bad, free=-1, oldest=0; long i, j, bad, free=-1, oldest=0;
unsigned int oldestpos=0; unsigned int oldestpos=0;
int chan; int chan;
if (fmod_inited == 0) return; if (fmod_inited == 0) return;
i = numwaves-1; i = numwaves-1;
do do
{ {
bad = 0; bad = 0;
j = 0; j = 0;
while ((dafilename[j] > 0) && (j < 16)) while ((dafilename[j] > 0) && (j < 16))
{ {
ch1 = dafilename[j]; if ((ch1 >= 97) && (ch1 <= 123)) ch1 -= 32; ch1 = dafilename[j]; if ((ch1 >= 97) && (ch1 <= 123)) ch1 -= 32;
ch2 = instname[i][j]; if ((ch2 >= 97) && (ch2 <= 123)) ch2 -= 32; ch2 = instname[i][j]; if ((ch2 >= 97) && (ch2 <= 123)) ch2 -= 32;
if (ch1 != ch2) {bad = 1; break;} if (ch1 != ch2) {bad = 1; break;}
j++; j++;
} }
if (bad == 0) if (bad == 0)
{ {
for (j=0; j<NUMCHANNELS; j++) { for (j=0; j<NUMCHANNELS; j++) {
if (!FSOUND_IsPlaying(channels[j])) { if (!FSOUND_IsPlaying(channels[j])) {
free = j; free = j;
break; break;
} }
if (j==0) continue; if (j==0) continue;
if (FSOUND_GetCurrentPosition(channels[j]) > oldestpos) {
oldest = j;
oldestpos = FSOUND_GetCurrentPosition(channels[j]);
}
}
if (free < 0) { if (FSOUND_GetCurrentPosition(channels[j]) > oldestpos) {
FSOUND_StopSound(channels[oldest]); oldest = j;
free = oldest; oldestpos = FSOUND_GetCurrentPosition(channels[j]);
} }
}
chan = FSOUND_PlaySoundEx(FSOUND_FREE, samples[i], NULL, 1); if (free < 0) {
if (chan == -1) return; FSOUND_StopSound(channels[oldest]);
FSOUND_SetFrequency(chan, dafreq*11025/4096); free = oldest;
FSOUND_SetVolume(chan, (volume1*volume2)>>1); }
// set pan
FSOUND_SetPaused(chan, 0);
channels[free] = chan; chan = FSOUND_PlaySoundEx(FSOUND_FREE, samples[i], NULL, 1);
if (chan == -1) return;
return; FSOUND_SetFrequency(chan, dafreq*11025/4096);
} FSOUND_SetVolume(chan, (volume1*volume2)>>1);
// set pan
FSOUND_SetPaused(chan, 0);
i--; channels[free] = chan;
} while (i >= 0);
return;
}
i--;
} while (i >= 0);
} }
void loadwaves(void) void loadwaves(void)
{ {
long fil, dawaversionum, i, tmp; long fil, dawaversionum, i, tmp;
long wavleng[MAXWAVES], repstart[MAXWAVES], repleng[MAXWAVES], finetune[MAXWAVES]; long wavleng[MAXWAVES], repstart[MAXWAVES], repleng[MAXWAVES], finetune[MAXWAVES];
char *p; char *p;
fil = kopen4load("WAVES.KWV", 0); fil = kopen4load("WAVES.KWV", 0);
if (fil != -1) { if (fil != -1) {
kread(fil, &dawaversionum, 4); dawaversionum = B_LITTLE32(dawaversionum); kread(fil, &dawaversionum, 4); dawaversionum = B_LITTLE32(dawaversionum);
if (dawaversionum != 0) { kclose(fil); return; } if (dawaversionum != 0) { kclose(fil); return; }
kread(fil, &numwaves, 4); numwaves = B_LITTLE32(numwaves); kread(fil, &numwaves, 4); numwaves = B_LITTLE32(numwaves);
for (i=0; i<numwaves; i++) { for (i=0; i<numwaves; i++) {
kread(fil, &instname[i][0], 16); kread(fil, &instname[i][0], 16);
kread(fil, &wavleng[i], 4); wavleng[i] = B_LITTLE32(wavleng[i]); kread(fil, &wavleng[i], 4); wavleng[i] = B_LITTLE32(wavleng[i]);
kread(fil, &repstart[i], 4); repstart[i] = B_LITTLE32(repstart[i]); kread(fil, &repstart[i], 4); repstart[i] = B_LITTLE32(repstart[i]);
kread(fil, &repleng[i], 4); repleng[i] = B_LITTLE32(repleng[i]); kread(fil, &repleng[i], 4); repleng[i] = B_LITTLE32(repleng[i]);
kread(fil, &finetune[i], 4); finetune[i] = B_LITTLE32(finetune[i]); kread(fil, &finetune[i], 4); finetune[i] = B_LITTLE32(finetune[i]);
} }
} else { } else {
dawaversionum = 0; dawaversionum = 0;
numwaves = 0; numwaves = 0;
} }
for (i=numwaves; i<MAXWAVES; i++) { for (i=numwaves; i<MAXWAVES; i++) {
memset(&instname[i][0], 0, 16); memset(&instname[i][0], 0, 16);
wavleng[i] = 0; wavleng[i] = 0;
repstart[i] = 0; repstart[i] = 0;
repleng[i] = 0; repleng[i] = 0;
finetune[i] = 0; finetune[i] = 0;
samples[i] = NULL; samples[i] = NULL;
} }
if (fil == -1) return; if (fil == -1) return;
for (i=0; i<numwaves; i++) { for (i=0; i<numwaves; i++) {
if (repleng[i]) tmp = FSOUND_LOOP_NORMAL; if (repleng[i]) tmp = FSOUND_LOOP_NORMAL;
else tmp = FSOUND_LOOP_OFF; else tmp = FSOUND_LOOP_OFF;
samples[i] = FSOUND_Sample_Alloc(FSOUND_FREE, wavleng[i], tmp, 11025, 255, 128, 1); samples[i] = FSOUND_Sample_Alloc(FSOUND_FREE, wavleng[i], tmp, 11025, 255, 128, 1);
if (!samples[i]) continue; if (!samples[i]) continue;
p = (char*)Bmalloc(wavleng[i]); p = (char*)Bmalloc(wavleng[i]);
kread(fil,p,wavleng[i]); kread(fil,p,wavleng[i]);
FSOUND_Sample_Upload(samples[i], p, FSOUND_8BITS | FSOUND_MONO | FSOUND_UNSIGNED); FSOUND_Sample_Upload(samples[i], p, FSOUND_8BITS | FSOUND_MONO | FSOUND_UNSIGNED);
Bfree(p); Bfree(p);
if (repleng[i]) FSOUND_Sample_SetLoopPoints(samples[i], repstart[i], repstart[i]+repleng[i]); if (repleng[i]) FSOUND_Sample_SetLoopPoints(samples[i], repstart[i], repstart[i]+repleng[i]);
} }
kclose(fil); kclose(fil);
printOSD("Loaded %d waves\n", numwaves); printOSD("Loaded %d waves\n", numwaves);
} }
@ -327,29 +327,29 @@ static int musicplaying = 0;
void loadsong(char *filename) void loadsong(char *filename)
{ {
if (!musicstat) return; if (!musicstat) return;
if (musicstream) return; if (musicstream) return;
#ifdef FMOD_PRE370 #ifdef FMOD_PRE370
musicstream = FSOUND_Stream_OpenFile(filename, FSOUND_LOOP_NORMAL, 0); musicstream = FSOUND_Stream_OpenFile(filename, FSOUND_LOOP_NORMAL, 0);
#else #else
musicstream = FSOUND_Stream_Open(filename, FSOUND_LOOP_NORMAL, 0, 0); musicstream = FSOUND_Stream_Open(filename, FSOUND_LOOP_NORMAL, 0, 0);
#endif #endif
} }
void musicon(void) void musicon(void)
{ {
if (!musicstat) return; if (!musicstat) return;
if (!musicstream || musicplaying) return; if (!musicstream || musicplaying) return;
FSOUND_Stream_Play(FSOUND_FREE, musicstream); FSOUND_Stream_Play(FSOUND_FREE, musicstream);
musicplaying = 1; musicplaying = 1;
} }
void musicoff(void) void musicoff(void)
{ {
if (!musicstat) return; if (!musicstat) return;
if (!musicstream || !musicplaying) return; if (!musicstream || !musicplaying) return;
FSOUND_Stream_Stop(musicstream); FSOUND_Stream_Stop(musicstream);
musicplaying = 0; musicplaying = 0;
} }
#endif #endif

View file

@ -4,176 +4,176 @@
// Generated by BIN2C.EXE by Jonathon Fowler // Generated by BIN2C.EXE by Jonathon Fowler
char textfont[2048] = { char textfont[2048] = {
// 2048 bytes // 2048 bytes
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x81, 0xA5, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x81, 0xA5, 0x81,
0xBD, 0x99, 0x81, 0x7E, 0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E, 0xBD, 0x99, 0x81, 0x7E, 0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E,
0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00, 0x10, 0x38, 0x7C, 0xFE, 0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00, 0x10, 0x38, 0x7C, 0xFE,
0x7C, 0x38, 0x10, 0x00, 0x38, 0x7C, 0x38, 0xFE, 0xFE, 0x7C, 0x38, 0x7C, 0x7C, 0x38, 0x10, 0x00, 0x38, 0x7C, 0x38, 0xFE, 0xFE, 0x7C, 0x38, 0x7C,
0x10, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x7C, 0x00, 0x00, 0x18, 0x3C, 0x10, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x7C, 0x00, 0x00, 0x18, 0x3C,
0x3C, 0x18, 0x00, 0x00, 0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, 0x3C, 0x18, 0x00, 0x00, 0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF,
0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00, 0xFF, 0xC3, 0x99, 0xBD, 0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00, 0xFF, 0xC3, 0x99, 0xBD,
0xBD, 0x99, 0xC3, 0xFF, 0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78, 0xBD, 0x99, 0xC3, 0xFF, 0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78,
0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 0x3F, 0x33, 0x3F, 0x30, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 0x3F, 0x33, 0x3F, 0x30,
0x30, 0x70, 0xF0, 0xE0, 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0, 0x30, 0x70, 0xF0, 0xE0, 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0,
0x99, 0x5A, 0x3C, 0xE7, 0xE7, 0x3C, 0x5A, 0x99, 0x80, 0xE0, 0xF8, 0xFE, 0x99, 0x5A, 0x3C, 0xE7, 0xE7, 0x3C, 0x5A, 0x99, 0x80, 0xE0, 0xF8, 0xFE,
0xF8, 0xE0, 0x80, 0x00, 0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00, 0xF8, 0xE0, 0x80, 0x00, 0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00,
0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x66, 0x66, 0x66, 0x66, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x66, 0x66, 0x66, 0x66,
0x66, 0x00, 0x66, 0x00, 0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00, 0x66, 0x00, 0x66, 0x00, 0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00,
0x3E, 0x63, 0x38, 0x6C, 0x6C, 0x38, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x63, 0x38, 0x6C, 0x6C, 0x38, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00,
0x7E, 0x7E, 0x7E, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF, 0x7E, 0x7E, 0x7E, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF,
0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18,
0x7E, 0x3C, 0x18, 0x00, 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, 0x7E, 0x3C, 0x18, 0x00, 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00,
0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0,
0xC0, 0xFE, 0x00, 0x00, 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00, 0xC0, 0xFE, 0x00, 0x00, 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00,
0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x7E, 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x7E,
0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x30, 0x78, 0x78, 0x30, 0x30, 0x00, 0x30, 0x00, 0x6C, 0x6C, 0x6C, 0x00, 0x30, 0x78, 0x78, 0x30, 0x30, 0x00, 0x30, 0x00, 0x6C, 0x6C, 0x6C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00,
0x30, 0x7C, 0xC0, 0x78, 0x0C, 0xF8, 0x30, 0x00, 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x7C, 0xC0, 0x78, 0x0C, 0xF8, 0x30, 0x00, 0x00, 0xC6, 0xCC, 0x18,
0x30, 0x66, 0xC6, 0x00, 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00, 0x30, 0x66, 0xC6, 0x00, 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00,
0x60, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x60, 0x60, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x60,
0x60, 0x30, 0x18, 0x00, 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00, 0x60, 0x30, 0x18, 0x00, 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00,
0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x30, 0x30, 0xFC, 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x30, 0x30, 0xFC,
0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60,
0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x30, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x30, 0x30, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00,
0x7C, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0x7C, 0x00, 0x30, 0x70, 0x30, 0x30, 0x7C, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0x7C, 0x00, 0x30, 0x70, 0x30, 0x30,
0x30, 0x30, 0xFC, 0x00, 0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00, 0x30, 0x30, 0xFC, 0x00, 0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00,
0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00, 0x1C, 0x3C, 0x6C, 0xCC, 0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00, 0x1C, 0x3C, 0x6C, 0xCC,
0xFE, 0x0C, 0x1E, 0x00, 0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00, 0xFE, 0x0C, 0x1E, 0x00, 0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00,
0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00, 0xFC, 0xCC, 0x0C, 0x18, 0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00, 0xFC, 0xCC, 0x0C, 0x18,
0x30, 0x30, 0x30, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00, 0x30, 0x30, 0x30, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00,
0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00, 0x00, 0x30, 0x30, 0x00, 0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00, 0x00, 0x30, 0x30, 0x00,
0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x60, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x60,
0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00, 0x00, 0x00, 0xFC, 0x00,
0x00, 0xFC, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00,
0x78, 0xCC, 0x0C, 0x18, 0x30, 0x00, 0x30, 0x00, 0x7C, 0xC6, 0xDE, 0xDE, 0x78, 0xCC, 0x0C, 0x18, 0x30, 0x00, 0x30, 0x00, 0x7C, 0xC6, 0xDE, 0xDE,
0xDE, 0xC0, 0x78, 0x00, 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00, 0xDE, 0xC0, 0x78, 0x00, 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00,
0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, 0x3C, 0x66, 0xC0, 0xC0, 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, 0x3C, 0x66, 0xC0, 0xC0,
0xC0, 0x66, 0x3C, 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, 0xC0, 0x66, 0x3C, 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00,
0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, 0xFE, 0x62, 0x68, 0x78, 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, 0xFE, 0x62, 0x68, 0x78,
0x68, 0x60, 0xF0, 0x00, 0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3E, 0x00, 0x68, 0x60, 0xF0, 0x00, 0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3E, 0x00,
0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00, 0x78, 0x30, 0x30, 0x30, 0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00, 0x78, 0x30, 0x30, 0x30,
0x30, 0x30, 0x78, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00, 0x30, 0x30, 0x78, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00,
0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00, 0xF0, 0x60, 0x60, 0x60, 0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00, 0xF0, 0x60, 0x60, 0x60,
0x62, 0x66, 0xFE, 0x00, 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, 0x62, 0x66, 0xFE, 0x00, 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00,
0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00, 0x38, 0x6C, 0xC6, 0xC6,
0xC6, 0x6C, 0x38, 0x00, 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00, 0xC6, 0x6C, 0x38, 0x00, 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00,
0x78, 0xCC, 0xCC, 0xCC, 0xDC, 0x78, 0x1C, 0x00, 0xFC, 0x66, 0x66, 0x7C, 0x78, 0xCC, 0xCC, 0xCC, 0xDC, 0x78, 0x1C, 0x00, 0xFC, 0x66, 0x66, 0x7C,
0x6C, 0x66, 0xE6, 0x00, 0x78, 0xCC, 0xE0, 0x70, 0x1C, 0xCC, 0x78, 0x00, 0x6C, 0x66, 0xE6, 0x00, 0x78, 0xCC, 0xE0, 0x70, 0x1C, 0xCC, 0x78, 0x00,
0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0xCC, 0xCC, 0xCC, 0xCC,
0xCC, 0xCC, 0xFC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00, 0xCC, 0xCC, 0xFC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00,
0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0xEE, 0xC6, 0x00, 0xC6, 0xC6, 0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0xEE, 0xC6, 0x00, 0xC6, 0xC6, 0x6C, 0x38,
0x38, 0x6C, 0xC6, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00, 0x38, 0x6C, 0xC6, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00,
0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00, 0x78, 0x60, 0x60, 0x60, 0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00, 0x78, 0x60, 0x60, 0x60,
0x60, 0x60, 0x78, 0x00, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00, 0x60, 0x60, 0x78, 0x00, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00,
0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, 0x10, 0x38, 0x6C, 0xC6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C,
0x7C, 0xCC, 0x76, 0x00, 0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00, 0x7C, 0xCC, 0x76, 0x00, 0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00,
0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00, 0x1C, 0x0C, 0x0C, 0x7C, 0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00, 0x1C, 0x0C, 0x0C, 0x7C,
0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
0x38, 0x6C, 0x60, 0xF0, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x76, 0xCC, 0x38, 0x6C, 0x60, 0xF0, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x76, 0xCC,
0xCC, 0x7C, 0x0C, 0xF8, 0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00, 0xCC, 0x7C, 0x0C, 0xF8, 0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00,
0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, 0x0C, 0x00, 0x0C, 0x0C, 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, 0x0C, 0x00, 0x0C, 0x0C,
0x0C, 0xCC, 0xCC, 0x78, 0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00, 0x0C, 0xCC, 0xCC, 0x78, 0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00,
0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0xCC, 0xFE, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0xCC, 0xFE,
0xFE, 0xD6, 0xC6, 0x00, 0x00, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, 0xFE, 0xD6, 0xC6, 0x00, 0x00, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00,
0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0xDC, 0x66,
0x66, 0x7C, 0x60, 0xF0, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E, 0x66, 0x7C, 0x60, 0xF0, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E,
0x00, 0x00, 0xDC, 0x76, 0x66, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x7C, 0xC0, 0x00, 0x00, 0xDC, 0x76, 0x66, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x7C, 0xC0,
0x78, 0x0C, 0xF8, 0x00, 0x10, 0x30, 0x7C, 0x30, 0x30, 0x34, 0x18, 0x00, 0x78, 0x0C, 0xF8, 0x00, 0x10, 0x30, 0x7C, 0x30, 0x30, 0x34, 0x18, 0x00,
0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0xCC, 0xCC,
0xCC, 0x78, 0x30, 0x00, 0x00, 0x00, 0xC6, 0xD6, 0xFE, 0xFE, 0x6C, 0x00, 0xCC, 0x78, 0x30, 0x00, 0x00, 0x00, 0xC6, 0xD6, 0xFE, 0xFE, 0x6C, 0x00,
0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0xCC, 0xCC,
0xCC, 0x7C, 0x0C, 0xF8, 0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00, 0xCC, 0x7C, 0x0C, 0xF8, 0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00,
0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00, 0x18, 0x18, 0x18, 0x00, 0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00, 0x18, 0x18, 0x18, 0x00,
0x18, 0x18, 0x18, 0x00, 0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00, 0x18, 0x18, 0x18, 0x00, 0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00,
0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C,
0xC6, 0xC6, 0xFE, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x18, 0x0C, 0x78, 0xC6, 0xC6, 0xFE, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x18, 0x0C, 0x78,
0x00, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00, 0x1C, 0x00, 0x78, 0xCC, 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00, 0x1C, 0x00, 0x78, 0xCC,
0xFC, 0xC0, 0x78, 0x00, 0x7E, 0xC3, 0x3C, 0x06, 0x3E, 0x66, 0x3F, 0x00, 0xFC, 0xC0, 0x78, 0x00, 0x7E, 0xC3, 0x3C, 0x06, 0x3E, 0x66, 0x3F, 0x00,
0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00, 0xE0, 0x00, 0x78, 0x0C, 0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00, 0xE0, 0x00, 0x78, 0x0C,
0x7C, 0xCC, 0x7E, 0x00, 0x30, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00, 0x7C, 0xCC, 0x7E, 0x00, 0x30, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00,
0x00, 0x00, 0x78, 0xC0, 0xC0, 0x78, 0x0C, 0x38, 0x7E, 0xC3, 0x3C, 0x66, 0x00, 0x00, 0x78, 0xC0, 0xC0, 0x78, 0x0C, 0x38, 0x7E, 0xC3, 0x3C, 0x66,
0x7E, 0x60, 0x3C, 0x00, 0xCC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, 0x7E, 0x60, 0x3C, 0x00, 0xCC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
0xE0, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, 0xCC, 0x00, 0x70, 0x30, 0xE0, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, 0xCC, 0x00, 0x70, 0x30,
0x30, 0x30, 0x78, 0x00, 0x7C, 0xC6, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x30, 0x30, 0x78, 0x00, 0x7C, 0xC6, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00,
0xE0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, 0xC6, 0x38, 0x6C, 0xC6, 0xE0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, 0xC6, 0x38, 0x6C, 0xC6,
0xFE, 0xC6, 0xC6, 0x00, 0x30, 0x30, 0x00, 0x78, 0xCC, 0xFC, 0xCC, 0x00, 0xFE, 0xC6, 0xC6, 0x00, 0x30, 0x30, 0x00, 0x78, 0xCC, 0xFC, 0xCC, 0x00,
0x1C, 0x00, 0xFC, 0x60, 0x78, 0x60, 0xFC, 0x00, 0x00, 0x00, 0x7F, 0x0C, 0x1C, 0x00, 0xFC, 0x60, 0x78, 0x60, 0xFC, 0x00, 0x00, 0x00, 0x7F, 0x0C,
0x7F, 0xCC, 0x7F, 0x00, 0x3E, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCE, 0x00, 0x7F, 0xCC, 0x7F, 0x00, 0x3E, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCE, 0x00,
0x78, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0xCC, 0x00, 0x78, 0x78, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0xCC, 0x00, 0x78,
0xCC, 0xCC, 0x78, 0x00, 0x00, 0xE0, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0xE0, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00,
0x78, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00, 0x00, 0xE0, 0x00, 0xCC, 0x78, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00, 0x00, 0xE0, 0x00, 0xCC,
0xCC, 0xCC, 0x7E, 0x00, 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, 0xCC, 0xCC, 0x7E, 0x00, 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8,
0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00, 0xCC, 0x00, 0xCC, 0xCC,
0xCC, 0xCC, 0x78, 0x00, 0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18, 0xCC, 0xCC, 0x78, 0x00, 0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18,
0x38, 0x6C, 0x64, 0xF0, 0x60, 0xE6, 0xFC, 0x00, 0xCC, 0xCC, 0x78, 0xFC, 0x38, 0x6C, 0x64, 0xF0, 0x60, 0xE6, 0xFC, 0x00, 0xCC, 0xCC, 0x78, 0xFC,
0x30, 0xFC, 0x30, 0x30, 0xF8, 0xCC, 0xCC, 0xFA, 0xC6, 0xCF, 0xC6, 0xC7, 0x30, 0xFC, 0x30, 0x30, 0xF8, 0xCC, 0xCC, 0xFA, 0xC6, 0xCF, 0xC6, 0xC7,
0x0E, 0x1B, 0x18, 0x3C, 0x18, 0x18, 0xD8, 0x70, 0x1C, 0x00, 0x78, 0x0C, 0x0E, 0x1B, 0x18, 0x3C, 0x18, 0x18, 0xD8, 0x70, 0x1C, 0x00, 0x78, 0x0C,
0x7C, 0xCC, 0x7E, 0x00, 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, 0x7C, 0xCC, 0x7E, 0x00, 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
0x00, 0x1C, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x1C, 0x00, 0xCC, 0x00, 0x1C, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x1C, 0x00, 0xCC,
0xCC, 0xCC, 0x7E, 0x00, 0x00, 0xF8, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0x00, 0xCC, 0xCC, 0x7E, 0x00, 0x00, 0xF8, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0x00,
0xFC, 0x00, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00, 0x3C, 0x6C, 0x6C, 0x3E, 0xFC, 0x00, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00, 0x3C, 0x6C, 0x6C, 0x3E,
0x00, 0x7E, 0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00,
0x30, 0x00, 0x30, 0x60, 0xC0, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x00, 0x30, 0x60, 0xC0, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00, 0xFC,
0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0C, 0x0C, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0C, 0x0C, 0x00, 0x00,
0xC3, 0xC6, 0xCC, 0xDE, 0x33, 0x66, 0xCC, 0x0F, 0xC3, 0xC6, 0xCC, 0xDB, 0xC3, 0xC6, 0xCC, 0xDE, 0x33, 0x66, 0xCC, 0x0F, 0xC3, 0xC6, 0xCC, 0xDB,
0x37, 0x6F, 0xCF, 0x03, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x37, 0x6F, 0xCF, 0x03, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00,
0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, 0x00, 0xCC, 0x66, 0x33, 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, 0x00, 0xCC, 0x66, 0x33,
0x66, 0xCC, 0x00, 0x00, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x66, 0xCC, 0x00, 0x00, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88,
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0xDB, 0x77, 0xDB, 0xEE, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0xDB, 0x77, 0xDB, 0xEE,
0xDB, 0x77, 0xDB, 0xEE, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xDB, 0x77, 0xDB, 0xEE, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18,
0xF8, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36, 0xF8, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36, 0x00, 0x00, 0xF8, 0x18, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36, 0x00, 0x00, 0xF8, 0x18,
0xF8, 0x18, 0x18, 0x18, 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36, 0xF8, 0x18, 0x18, 0x18, 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0xFE, 0x06, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0xFE, 0x06,
0xF6, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, 0xF6, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00, 0x18, 0x18, 0xF8, 0x18, 0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00, 0x18, 0x18, 0xF8, 0x18,
0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18,
0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36,
0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF7, 0x00, 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF7, 0x00,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36,
0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x00, 0x00, 0xFF, 0x00, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x00, 0x00, 0xFF, 0x00,
0xFF, 0x00, 0x00, 0x00, 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00, 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36,
0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x3F, 0x00, 0x00, 0x00, 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x3F, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36, 0x3F, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36,
0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0xC8, 0xDC, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0xC8, 0xDC, 0x76, 0x00,
0x00, 0x78, 0xCC, 0xF8, 0xCC, 0xF8, 0xC0, 0xC0, 0x00, 0xFC, 0xCC, 0xC0, 0x00, 0x78, 0xCC, 0xF8, 0xCC, 0xF8, 0xC0, 0xC0, 0x00, 0xFC, 0xCC, 0xC0,
0xC0, 0xC0, 0xC0, 0x00, 0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x00,
0xFC, 0xCC, 0x60, 0x30, 0x60, 0xCC, 0xFC, 0x00, 0x00, 0x00, 0x7E, 0xD8, 0xFC, 0xCC, 0x60, 0x30, 0x60, 0xCC, 0xFC, 0x00, 0x00, 0x00, 0x7E, 0xD8,
0xD8, 0xD8, 0x70, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xC0, 0xD8, 0xD8, 0x70, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xC0,
0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x00, 0xFC, 0x30, 0x78, 0xCC, 0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x00, 0xFC, 0x30, 0x78, 0xCC,
0xCC, 0x78, 0x30, 0xFC, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x6C, 0x38, 0x00, 0xCC, 0x78, 0x30, 0xFC, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x6C, 0x38, 0x00,
0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x6C, 0xEE, 0x00, 0x1C, 0x30, 0x18, 0x7C, 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x6C, 0xEE, 0x00, 0x1C, 0x30, 0x18, 0x7C,
0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0x7E, 0x00, 0x00, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0x7E, 0x00, 0x00,
0x06, 0x0C, 0x7E, 0xDB, 0xDB, 0x7E, 0x60, 0xC0, 0x38, 0x60, 0xC0, 0xF8, 0x06, 0x0C, 0x7E, 0xDB, 0xDB, 0x7E, 0x60, 0xC0, 0x38, 0x60, 0xC0, 0xF8,
0xC0, 0x60, 0x38, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, 0xC0, 0x60, 0x38, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00,
0x00, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0x00, 0x30, 0x30, 0xFC, 0x30, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0x00, 0x30, 0x30, 0xFC, 0x30,
0x30, 0x00, 0xFC, 0x00, 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xFC, 0x00, 0x30, 0x00, 0xFC, 0x00, 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xFC, 0x00,
0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xFC, 0x00, 0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xFC, 0x00, 0x0E, 0x1B, 0x1B, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0x70, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0x70,
0x30, 0x30, 0x00, 0xFC, 0x00, 0x30, 0x30, 0x00, 0x00, 0x76, 0xDC, 0x00, 0x30, 0x30, 0x00, 0xFC, 0x00, 0x30, 0x30, 0x00, 0x00, 0x76, 0xDC, 0x00,
0x76, 0xDC, 0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x0F, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C, 0x18, 0x00, 0x00, 0x00, 0x0F, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C,
0x78, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x70, 0x18, 0x30, 0x60, 0x78, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x70, 0x18, 0x30, 0x60,
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };

File diff suppressed because it is too large Load diff

View file

@ -1738,10 +1738,10 @@ void coolgaugetext(short snum)
case 6: i = ((p->scuba_amount+63)>>6); break; case 6: i = ((p->scuba_amount+63)>>6); break;
case 7: i = (p->boot_amount>>1); break; case 7: i = (p->boot_amount>>1); break;
} }
invennum(284-30-o,200-6,(char)i,0,10+permbit); invennum(284-30-o,200-6,(char)i,0,10+permbit);
if (j > 0) minitext(288-30-o,180,"ON",0,10+16+permbit + 256); if (j > 0) minitext(288-30-o,180,"ON",0,10+16+permbit + 256);
else if ((unsigned long)j != 0x80000000) minitext(284-30-o,180,"OFF",2,10+16+permbit + 256); else if ((unsigned long)j != 0x80000000) minitext(284-30-o,180,"OFF",2,10+16+permbit + 256);
if (p->inven_icon >= 6) minitext(284-35-o,180,"AUTO",2,10+16+permbit + 256); if (p->inven_icon >= 6) minitext(284-35-o,180,"AUTO",2,10+16+permbit + 256);
} }
return; return;
} }