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

View file

@ -10,37 +10,37 @@
#ifdef USE_OPENGL
struct glinfo glinfo = {
"Unknown", // vendor
"Unknown", // renderer
"0.0.0", // version
"", // extensions
"Unknown", // vendor
"Unknown", // renderer
"0.0.0", // version
"", // extensions
1.0, // max anisotropy
0, // brga texture format
0, // clamp-to-edge support
0, // texture compression
0, // non-power-of-two textures
0, // multisampling
0, // nvidia multisampling hint
};
1.0, // max anisotropy
0, // brga texture format
0, // clamp-to-edge support
0, // texture compression
0, // non-power-of-two textures
0, // multisampling
0, // nvidia multisampling hint
};
#endif
static int osdfunc_dumpbuildinfo(const osdfuncparm_t *parm)
{
OSD_Printf(
"Build engine compilation:\n"
" CFLAGS: %s\n"
" LIBS: %s\n"
" Host: %s\n"
" Compiler: %s\n"
" Built: %s\n",
_engine_cflags,
_engine_libs,
_engine_uname,
_engine_compiler,
_engine_date);
OSD_Printf(
"Build engine compilation:\n"
" CFLAGS: %s\n"
" LIBS: %s\n"
" Host: %s\n"
" Compiler: %s\n"
" Built: %s\n",
_engine_cflags,
_engine_libs,
_engine_uname,
_engine_compiler,
_engine_date);
return OSDCMD_OK;
return OSDCMD_OK;
}
static void onvideomodechange(int newmode) { }
@ -48,159 +48,159 @@ void (*baselayer_onvideomodechange)(int) = onvideomodechange;
static int osdfunc_setrendermode(const osdfuncparm_t *parm)
{
int m;
char *p;
int m;
char *p;
char *modestrs[] = {
"classic software", "polygonal flat-shaded software",
"polygonal textured software", "polygonal OpenGL"
};
char *modestrs[] = {
"classic software", "polygonal flat-shaded software",
"polygonal textured software", "polygonal OpenGL"
};
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
m = Bstrtol(parm->parms[0], &p, 10);
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
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);
OSD_Printf("Rendering method changed to %s\n", modestrs[ getrendermode() ] );
setrendermode(m);
OSD_Printf("Rendering method changed to %s\n", modestrs[ getrendermode() ] );
return OSDCMD_OK;
return OSDCMD_OK;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef DEBUGGINGAIDS
static int osdcmd_hicsetpalettetint(const osdfuncparm_t *parm)
{
long pal, cols[3], eff;
char *p;
long pal, cols[3], eff;
char *p;
if (parm->numparms != 5) return OSDCMD_SHOWHELP;
if (parm->numparms != 5) return OSDCMD_SHOWHELP;
pal = Batol(parm->parms[0]);
cols[0] = Batol(parm->parms[1]);
cols[1] = Batol(parm->parms[2]);
cols[2] = Batol(parm->parms[3]);
eff = Batol(parm->parms[4]);
pal = Batol(parm->parms[0]);
cols[0] = Batol(parm->parms[1]);
cols[1] = Batol(parm->parms[2]);
cols[2] = Batol(parm->parms[3]);
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
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;
}
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"
);
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 (!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);
}
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;
return OSDCMD_OK;
}
#endif
static int osdcmd_vars(const osdfuncparm_t *parm)
{
int showval = (parm->numparms < 1);
int showval = (parm->numparms < 1);
if (!Bstrcasecmp(parm->name, "screencaptureformat")) {
const char *fmts[2][2] = { {"TGA", "PCX"}, {"0", "1"} };
if (showval) { OSD_Printf("captureformat is %s\n", fmts[captureformat]); }
else {
int i,j;
for (j=0; j<2; j++)
for (i=0; i<2; i++)
if (!Bstrcasecmp(parm->parms[0], fmts[j][i])) break;
if (j == 2) return OSDCMD_SHOWHELP;
captureformat = i;
}
return OSDCMD_OK;
}
if (!Bstrcasecmp(parm->name, "screencaptureformat")) {
const char *fmts[2][2] = { {"TGA", "PCX"}, {"0", "1"} };
if (showval) { OSD_Printf("captureformat is %s\n", fmts[captureformat]); }
else {
int i,j;
for (j=0; j<2; j++)
for (i=0; i<2; i++)
if (!Bstrcasecmp(parm->parms[0], fmts[j][i])) break;
if (j == 2) return OSDCMD_SHOWHELP;
captureformat = i;
}
return OSDCMD_OK;
}
#ifdef SUPERBUILD
else if (!Bstrcasecmp(parm->name, "novoxmips")) {
if (showval) { OSD_Printf("novoxmips is %d\n", novoxmips); }
else { novoxmips = (atoi(parm->parms[0]) != 0); }
}
else if (!Bstrcasecmp(parm->name, "usevoxels")) {
if (showval) { OSD_Printf("usevoxels is %d\n", usevoxels); }
else { usevoxels = (atoi(parm->parms[0]) != 0); }
}
else if (!Bstrcasecmp(parm->name, "novoxmips")) {
if (showval) { OSD_Printf("novoxmips is %d\n", novoxmips); }
else { novoxmips = (atoi(parm->parms[0]) != 0); }
}
else if (!Bstrcasecmp(parm->name, "usevoxels")) {
if (showval) { OSD_Printf("usevoxels is %d\n", usevoxels); }
else { usevoxels = (atoi(parm->parms[0]) != 0); }
}
#endif
return OSDCMD_SHOWHELP;
return OSDCMD_SHOWHELP;
}
int baselayer_init(void)
{
#ifdef POLYMOST
OSD_RegisterFunction("setrendermode","setrendermode <number>: sets the engine's rendering mode.\n"
"Mode numbers are:\n"
" 0 - Classic Build software\n"
" 1 - Polygonal flat-shaded software\n"
" 2 - Polygonal textured software\n"
OSD_RegisterFunction("setrendermode","setrendermode <number>: sets the engine's rendering mode.\n"
"Mode numbers are:\n"
" 0 - Classic Build software\n"
" 1 - Polygonal flat-shaded software\n"
" 2 - Polygonal textured software\n"
#ifdef USE_OPENGL
" 3 - Polygonal OpenGL\n"
" 3 - Polygonal OpenGL\n"
#endif
,
osdfunc_setrendermode);
,
osdfunc_setrendermode);
#endif
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("dumpbuildinfo","dumpbuildinfo: outputs engine compilation information",osdfunc_dumpbuildinfo);
OSD_RegisterFunction("screencaptureformat","screencaptureformat: sets the output format for screenshots (TGA or PCX)",osdcmd_vars);
#ifdef SUPERBUILD
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("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);
#endif
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef DEBUGGINGAIDS
OSD_RegisterFunction("hicsetpalettetint","hicsetpalettetint: sets palette tinting values",osdcmd_hicsetpalettetint);
OSD_RegisterFunction("hicsetpalettetint","hicsetpalettetint: sets palette tinting values",osdcmd_hicsetpalettetint);
#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
return 0;
return 0;
}

View file

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

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

File diff suppressed because it is too large Load diff

View file

@ -41,278 +41,278 @@
int Brand(void)
{
return rand();
return rand();
}
void *Bmalloc(bsize_t size)
{
return malloc(size);
return malloc(size);
}
void Bfree(void *ptr)
{
free(ptr);
free(ptr);
}
int Bopen(const char *pathname, int flags, unsigned mode)
{
int n=0,o=0;
int n=0,o=0;
if (flags&BO_BINARY) n|=O_BINARY; else n|=O_TEXT;
if ((flags&BO_RDWR)==BO_RDWR) n|=O_RDWR;
else if ((flags&BO_RDWR)==BO_WRONLY) n|=O_WRONLY;
else if ((flags&BO_RDWR)==BO_RDONLY) n|=O_RDONLY;
if (flags&BO_APPEND) n|=O_APPEND;
if (flags&BO_CREAT) n|=O_CREAT;
if (flags&BO_TRUNC) n|=O_TRUNC;
if (mode&BS_IREAD) o|=S_IREAD;
if (mode&BS_IWRITE) o|=S_IWRITE;
if (mode&BS_IEXEC) o|=S_IEXEC;
if (flags&BO_BINARY) n|=O_BINARY; else n|=O_TEXT;
if ((flags&BO_RDWR)==BO_RDWR) n|=O_RDWR;
else if ((flags&BO_RDWR)==BO_WRONLY) n|=O_WRONLY;
else if ((flags&BO_RDWR)==BO_RDONLY) n|=O_RDONLY;
if (flags&BO_APPEND) n|=O_APPEND;
if (flags&BO_CREAT) n|=O_CREAT;
if (flags&BO_TRUNC) n|=O_TRUNC;
if (mode&BS_IREAD) o|=S_IREAD;
if (mode&BS_IWRITE) o|=S_IWRITE;
if (mode&BS_IEXEC) o|=S_IEXEC;
return open(pathname,n,o);
return open(pathname,n,o);
}
int Bclose(int fd)
{
return close(fd);
return close(fd);
}
bssize_t Bwrite(int fd, const void *buf, bsize_t count)
{
return write(fd,buf,count);
return write(fd,buf,count);
}
bssize_t Bread(int fd, void *buf, bsize_t count)
{
return read(fd,buf,count);
return read(fd,buf,count);
}
int Blseek(int fildes, int offset, int whence)
{
switch (whence) {
case BSEEK_SET: whence=SEEK_SET; break;
case BSEEK_CUR: whence=SEEK_CUR; break;
case BSEEK_END: whence=SEEK_END; break;
}
return lseek(fildes,offset,whence);
switch (whence) {
case BSEEK_SET: whence=SEEK_SET; break;
case BSEEK_CUR: whence=SEEK_CUR; break;
case BSEEK_END: whence=SEEK_END; break;
}
return lseek(fildes,offset,whence);
}
BFILE *Bfopen(const char *path, const char *mode)
{
return (BFILE*)fopen(path,mode);
return (BFILE*)fopen(path,mode);
}
int Bfclose(BFILE *stream)
{
return fclose((FILE*)stream);
return fclose((FILE*)stream);
}
void Brewind(BFILE *stream)
{
rewind((FILE*)stream);
rewind((FILE*)stream);
}
int Bfgetc(BFILE *stream)
{
return fgetc((FILE*)stream);
return fgetc((FILE*)stream);
}
char *Bfgets(char *s, int size, BFILE *stream)
{
return fgets(s,size,(FILE*)stream);
return fgets(s,size,(FILE*)stream);
}
int Bfputc(int c, BFILE *stream)
{
return fputc(c,(FILE*)stream);
return fputc(c,(FILE*)stream);
}
int Bfputs(const char *s, BFILE *stream)
{
return fputs(s,(FILE*)stream);
return fputs(s,(FILE*)stream);
}
bsize_t Bfread(void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream)
{
return fread(ptr,size,nmemb,(FILE*)stream);
return fread(ptr,size,nmemb,(FILE*)stream);
}
bsize_t Bfwrite(const void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream)
{
return fwrite(ptr,size,nmemb,(FILE*)stream);
return fwrite(ptr,size,nmemb,(FILE*)stream);
}
char *Bstrdup(const char *s)
{
return strdup(s);
return strdup(s);
}
char *Bstrcpy(char *dest, const char *src)
{
return strcpy(dest,src);
return strcpy(dest,src);
}
char *Bstrncpy(char *dest, const char *src, bsize_t n)
{
return strncpy(dest,src,n);
return strncpy(dest,src,n);
}
int Bstrcmp(const char *s1, const char *s2)
{
return strcmp(s1,s2);
return strcmp(s1,s2);
}
int Bstrncmp(const char *s1, const char *s2, bsize_t n)
{
return strncmp(s1,s2,n);
return strncmp(s1,s2,n);
}
int Bstrcasecmp(const char *s1, const char *s2)
{
#ifdef _MSC_VER
return stricmp(s1,s2);
return stricmp(s1,s2);
#else
return strcasecmp(s1,s2);
return strcasecmp(s1,s2);
#endif
}
int Bstrncasecmp(const char *s1, const char *s2, bsize_t n)
{
#ifdef _MSC_VER
return strnicmp(s1,s2,n);
return strnicmp(s1,s2,n);
#else
return strncasecmp(s1,s2,n);
return strncasecmp(s1,s2,n);
#endif
}
char *Bstrcat(char *dest, const char *src)
{
return strcat(dest,src);
return strcat(dest,src);
}
char *Bstrncat(char *dest, const char *src, bsize_t n)
{
return strncat(dest,src,n);
return strncat(dest,src,n);
}
bsize_t Bstrlen(const char *s)
{
return strlen(s);
return strlen(s);
}
char *Bstrchr(const char *s, int c)
{
return strchr(s,c);
return strchr(s,c);
}
char *Bstrrchr(const char *s, int c)
{
return strrchr(s,c);
return strrchr(s,c);
}
int Batoi(const char *nptr)
{
return atoi(nptr);
return atoi(nptr);
}
long Batol(const char *nptr)
{
return atol(nptr);
return atol(nptr);
}
long int Bstrtol(const char *nptr, char **endptr, int base)
{
return strtol(nptr,endptr,base);
return strtol(nptr,endptr,base);
}
unsigned long int Bstrtoul(const char *nptr, char **endptr, int base)
{
return strtoul(nptr,endptr,base);
return strtoul(nptr,endptr,base);
}
void *Bmemcpy(void *dest, const void *src, bsize_t n)
{
return memcpy(dest,src,n);
return memcpy(dest,src,n);
}
void *Bmemmove(void *dest, const void *src, bsize_t n)
{
return memmove(dest,src,n);
return memmove(dest,src,n);
}
void *Bmemchr(const void *s, int c, bsize_t n)
{
return memchr(s,c,n);
return memchr(s,c,n);
}
void *Bmemset(void *s, int c, bsize_t n)
{
return memset(s,c,n);
return memset(s,c,n);
}
int Bprintf(const char *format, ...)
{
va_list ap;
int r;
va_list ap;
int r;
va_start(ap,format);
va_start(ap,format);
#ifdef _MSC_VER
r = _vprintf(format,ap);
r = _vprintf(format,ap);
#else
r = vprintf(format,ap);
r = vprintf(format,ap);
#endif
va_end(ap);
return r;
va_end(ap);
return r;
}
int Bsprintf(char *str, const char *format, ...)
{
va_list ap;
int r;
va_list ap;
int r;
va_start(ap,format);
va_start(ap,format);
#ifdef _MSC_VER
r = _vsprintf(str,format,ap);
r = _vsprintf(str,format,ap);
#else
r = vsprintf(str,format,ap);
r = vsprintf(str,format,ap);
#endif
va_end(ap);
return r;
va_end(ap);
return r;
}
int Bsnprintf(char *str, bsize_t size, const char *format, ...)
{
va_list ap;
int r;
va_list ap;
int r;
va_start(ap,format);
va_start(ap,format);
#ifdef _MSC_VER
r = _vsnprintf(str,size,format,ap);
r = _vsnprintf(str,size,format,ap);
#else
r = vsnprintf(str,size,format,ap);
r = vsnprintf(str,size,format,ap);
#endif
va_end(ap);
return r;
va_end(ap);
return r;
}
int Bvsnprintf(char *str, bsize_t size, const char *format, va_list ap)
{
#ifdef _MSC_VER
return _vsnprintf(str,size,format,ap);
return _vsnprintf(str,size,format,ap);
#else
return vsnprintf(str,size,format,ap);
return vsnprintf(str,size,format,ap);
#endif
}
char *Bgetenv(const char *name)
{
return getenv(name);
return getenv(name);
}
char *Bgetcwd(char *buf, bsize_t size)
{
return getcwd(buf,size);
return getcwd(buf,size);
}
#endif // __compat_h_macrodef__
@ -325,359 +325,359 @@ char *Bgetcwd(char *buf, bsize_t size)
char *Bgethomedir(void)
{
#ifdef _WIN32
TCHAR appdata[MAX_PATH];
TCHAR appdata[MAX_PATH];
//# if defined SHGetFolderPath
// if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, appdata)))
//# if defined SHGetSpecialFolderPath
if (SUCCEEDED(SHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE)))
//# else
//# error Cannot find SHGetFolderPath or SHGetSpecialFolderPath. Perhaps your shlobj.h is ancient?
//# endif
return strdup(appdata);
return NULL;
//# if defined SHGetFolderPath
// if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, appdata)))
//# if defined SHGetSpecialFolderPath
if (SUCCEEDED(SHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE)))
//# else
//# error Cannot find SHGetFolderPath or SHGetSpecialFolderPath. Perhaps your shlobj.h is ancient?
//# endif
return strdup(appdata);
return NULL;
#else
char *e = getenv("HOME");
if (!e) return NULL;
return strdup(e);
char *e = getenv("HOME");
if (!e) return NULL;
return strdup(e);
#endif
}
int Bcorrectfilename(char *filename, int removefn)
{
char *fn;
char *tokarr[64], *first, *next, *token;
int i, ntok = 0, leadslash = 0, trailslash = 0;
char *fn;
char *tokarr[64], *first, *next, *token;
int i, ntok = 0, leadslash = 0, trailslash = 0;
fn = strdup(filename);
if (!fn) return -1;
fn = strdup(filename);
if (!fn) return -1;
for (first=fn; *first; first++) {
for (first=fn; *first; first++) {
#ifdef _WIN32
if (*first == '\\') *first = '/';
if (*first == '\\') *first = '/';
#endif
}
leadslash = (*fn == '/');
trailslash = (first>fn && first[-1] == '/');
}
leadslash = (*fn == '/');
trailslash = (first>fn && first[-1] == '/');
first = fn;
do {
token = Bstrtoken(first, "/", &next, 1);
first = NULL;
if (!token) break;
else if (token[0] == 0) continue;
else if (token[0] == '.' && token[1] == 0) continue;
else if (token[0] == '.' && token[1] == '.' && token[2] == 0) ntok = max(0,ntok-1);
else tokarr[ntok++] = token;
} while (1);
first = fn;
do {
token = Bstrtoken(first, "/", &next, 1);
first = NULL;
if (!token) break;
else if (token[0] == 0) continue;
else if (token[0] == '.' && token[1] == 0) continue;
else if (token[0] == '.' && token[1] == '.' && token[2] == 0) ntok = max(0,ntok-1);
else tokarr[ntok++] = token;
} while (1);
if (!trailslash && removefn) { ntok = max(0,ntok-1); trailslash = 1; }
if (ntok == 0 && trailslash && leadslash) trailslash = 0;
if (!trailslash && removefn) { ntok = max(0,ntok-1); trailslash = 1; }
if (ntok == 0 && trailslash && leadslash) trailslash = 0;
first = filename;
if (leadslash) *(first++) = '/';
for (i=0; i<ntok; i++) {
if (i>0) *(first++) = '/';
for (token=tokarr[i]; *token; token++)
*(first++) = *token;
}
if (trailslash) *(first++) = '/';
*(first++) = 0;
first = filename;
if (leadslash) *(first++) = '/';
for (i=0; i<ntok; i++) {
if (i>0) *(first++) = '/';
for (token=tokarr[i]; *token; token++)
*(first++) = *token;
}
if (trailslash) *(first++) = '/';
*(first++) = 0;
Bfree(fn);
return 0;
return 0;
}
int Bcanonicalisefilename(char *filename, int removefn)
{
char cwd[BMAX_PATH], fn[BMAX_PATH], *p;
char *fnp = filename;
char cwd[BMAX_PATH], fn[BMAX_PATH], *p;
char *fnp = filename;
#ifdef _WIN32
int drv = 0;
int drv = 0;
#endif
#ifdef _WIN32
{
if (filename[0] && filename[1] == ':') {
// filename is prefixed with a drive
drv = toupper(filename[0])-'A' + 1;
fnp += 2;
}
if (!_getdcwd(drv, cwd, sizeof(cwd))) return -1;
for (p=cwd; *p; p++) if (*p == '\\') *p = '/';
}
{
if (filename[0] && filename[1] == ':') {
// filename is prefixed with a drive
drv = toupper(filename[0])-'A' + 1;
fnp += 2;
}
if (!_getdcwd(drv, cwd, sizeof(cwd))) return -1;
for (p=cwd; *p; p++) if (*p == '\\') *p = '/';
}
#else
if (!getcwd(cwd,sizeof(cwd))) return -1;
if (!getcwd(cwd,sizeof(cwd))) return -1;
#endif
p = strrchr(cwd,'/'); if (!p || p[1]) strcat(cwd, "/");
p = strrchr(cwd,'/'); if (!p || p[1]) strcat(cwd, "/");
strcpy(fn, fnp);
strcpy(fn, fnp);
#ifdef _WIN32
for (p=fn; *p; p++) if (*p == '\\') *p = '/';
for (p=fn; *p; p++) if (*p == '\\') *p = '/';
#endif
if (fn[0] != '/') {
// we are dealing with a path relative to the current directory
strcpy(filename, cwd);
strcat(filename, fn);
} else {
if (fn[0] != '/') {
// we are dealing with a path relative to the current directory
strcpy(filename, cwd);
strcat(filename, fn);
} else {
#ifdef _WIN32
filename[0] = cwd[0];
filename[1] = ':';
filename[2] = 0;
filename[0] = cwd[0];
filename[1] = ':';
filename[2] = 0;
#else
filename[0] = 0;
filename[0] = 0;
#endif
strcat(filename, fn);
}
fnp = filename;
strcat(filename, fn);
}
fnp = filename;
#ifdef _WIN32
fnp += 2; // skip the drive
fnp += 2; // skip the drive
#endif
return Bcorrectfilename(fnp,1);
return Bcorrectfilename(fnp,1);
}
char *Bgetsystemdrives(void)
{
#ifdef _WIN32
char *str, *p;
DWORD drv, mask;
int number=0;
char *str, *p;
DWORD drv, mask;
int number=0;
drv = GetLogicalDrives();
if (drv == 0) return NULL;
drv = GetLogicalDrives();
if (drv == 0) return NULL;
for (mask=1; mask<0x8000000l; mask<<=1) {
if ((drv&mask) == 0) continue;
number++;
}
for (mask=1; mask<0x8000000l; mask<<=1) {
if ((drv&mask) == 0) continue;
number++;
}
str = p = (char *)malloc(1 + (3*number));
if (!str) return NULL;
str = p = (char *)malloc(1 + (3*number));
if (!str) return NULL;
number = 0;
for (mask=1; mask<0x8000000l; mask<<=1, number++) {
if ((drv&mask) == 0) continue;
*(p++) = 'A' + number;
*(p++) = ':';
*(p++) = 0;
}
*(p++) = 0;
number = 0;
for (mask=1; mask<0x8000000l; mask<<=1, number++) {
if ((drv&mask) == 0) continue;
*(p++) = 'A' + number;
*(p++) = ':';
*(p++) = 0;
}
*(p++) = 0;
return str;
return str;
#else
// Perhaps have Unix OS's put /, /home/user, and /mnt/* in the "drives" list?
return NULL;
// Perhaps have Unix OS's put /, /home/user, and /mnt/* in the "drives" list?
return NULL;
#endif
}
long Bfilelength(int fd)
{
struct stat st;
if (fstat(fd, &st) < 0) return -1;
return(long)(st.st_size);
struct stat st;
if (fstat(fd, &st) < 0) return -1;
return(long)(st.st_size);
}
typedef struct {
#ifdef _MSC_VER
long dir;
struct _finddata_t fid;
long dir;
struct _finddata_t fid;
#else
DIR *dir;
DIR *dir;
#endif
struct Bdirent info;
int status;
char name[1];
struct Bdirent info;
int status;
char name[1];
} BDIR_real;
BDIR* Bopendir(const char *name)
{
BDIR_real *dirr;
BDIR_real *dirr;
#ifdef _MSC_VER
char *t,*tt;
t = (char*)malloc(strlen(name)+1+4);
if (!t) return NULL;
char *t,*tt;
t = (char*)malloc(strlen(name)+1+4);
if (!t) return NULL;
#endif
dirr = (BDIR_real*)malloc(sizeof(BDIR_real) + strlen(name));
if (!dirr) {
dirr = (BDIR_real*)malloc(sizeof(BDIR_real) + strlen(name));
if (!dirr) {
#ifdef _MSC_VER
free(t);
free(t);
#endif
return NULL;
}
return NULL;
}
#ifdef _MSC_VER
strcpy(t,name);
tt = t+strlen(name)-1;
while (*tt == ' ' && tt>t) tt--;
if (*tt != '/' && *tt != '\\') *(++tt) = '/';
*(++tt) = '*';
*(++tt) = '.';
*(++tt) = '*';
*(++tt) = 0;
strcpy(t,name);
tt = t+strlen(name)-1;
while (*tt == ' ' && tt>t) tt--;
if (*tt != '/' && *tt != '\\') *(++tt) = '/';
*(++tt) = '*';
*(++tt) = '.';
*(++tt) = '*';
*(++tt) = 0;
dirr->dir = _findfirst(t,&dirr->fid);
free(t);
if (dirr->dir == -1) {
free(dirr);
return NULL;
}
dirr->dir = _findfirst(t,&dirr->fid);
free(t);
if (dirr->dir == -1) {
free(dirr);
return NULL;
}
#else
dirr->dir = opendir(name);
if (dirr->dir == NULL) {
free(dirr);
return NULL;
}
dirr->dir = opendir(name);
if (dirr->dir == NULL) {
free(dirr);
return NULL;
}
#endif
dirr->status = 0;
strcpy(dirr->name, name);
dirr->status = 0;
strcpy(dirr->name, name);
return (BDIR*)dirr;
return (BDIR*)dirr;
}
struct Bdirent* Breaddir(BDIR *dir)
{
BDIR_real *dirr = (BDIR_real*)dir;
struct dirent *de;
struct stat st;
char *fn;
BDIR_real *dirr = (BDIR_real*)dir;
struct dirent *de;
struct stat st;
char *fn;
#ifdef _MSC_VER
if (dirr->status > 0) {
if (_findnext(dirr->dir,&dirr->fid) != 0) {
dirr->status = -1;
return NULL;
}
}
dirr->info.namlen = strlen(dirr->fid.name);
dirr->info.name = dirr->fid.name;
dirr->status++;
if (dirr->status > 0) {
if (_findnext(dirr->dir,&dirr->fid) != 0) {
dirr->status = -1;
return NULL;
}
}
dirr->info.namlen = strlen(dirr->fid.name);
dirr->info.name = dirr->fid.name;
dirr->status++;
#else
de = readdir(dirr->dir);
if (de == NULL) {
dirr->status = -1;
return NULL;
} else {
dirr->status++;
}
//# if defined(__WATCOMC__) || defined(__linux) || defined(__BEOS__) || defined(__QNX__) || defined(SKYOS)
dirr->info.namlen = strlen(de->d_name);
//# else
// dirr->info.namlen = de->d_namlen;
//# endif
dirr->info.name = de->d_name;
de = readdir(dirr->dir);
if (de == NULL) {
dirr->status = -1;
return NULL;
} else {
dirr->status++;
}
//# if defined(__WATCOMC__) || defined(__linux) || defined(__BEOS__) || defined(__QNX__) || defined(SKYOS)
dirr->info.namlen = strlen(de->d_name);
//# else
// dirr->info.namlen = de->d_namlen;
//# endif
dirr->info.name = de->d_name;
#endif
dirr->info.mode = 0;
dirr->info.size = 0;
dirr->info.mtime = 0;
dirr->info.mode = 0;
dirr->info.size = 0;
dirr->info.mtime = 0;
fn = (char *)malloc(strlen(dirr->name) + 1 + dirr->info.namlen + 1);
if (fn) {
sprintf(fn,"%s/%s",dirr->name,dirr->info.name);
if (!stat(fn, &st)) {
dirr->info.mode = st.st_mode;
dirr->info.size = st.st_size;
dirr->info.mtime = st.st_mtime;
}
free(fn);
}
fn = (char *)malloc(strlen(dirr->name) + 1 + dirr->info.namlen + 1);
if (fn) {
sprintf(fn,"%s/%s",dirr->name,dirr->info.name);
if (!stat(fn, &st)) {
dirr->info.mode = st.st_mode;
dirr->info.size = st.st_size;
dirr->info.mtime = st.st_mtime;
}
free(fn);
}
return &dirr->info;
return &dirr->info;
}
int Bclosedir(BDIR *dir)
{
BDIR_real *dirr = (BDIR_real*)dir;
BDIR_real *dirr = (BDIR_real*)dir;
#ifdef _MSC_VER
_findclose(dirr->dir);
_findclose(dirr->dir);
#else
closedir(dirr->dir);
closedir(dirr->dir);
#endif
free(dirr);
free(dirr);
return 0;
return 0;
}
char *Bstrtoken(char *s, char *delim, char **ptrptr, int chop)
{
char *p, *start;
char *p, *start;
if (!ptrptr) return NULL;
if (!ptrptr) return NULL;
if (s) p = s;
else p = *ptrptr;
if (s) p = s;
else p = *ptrptr;
if (!p) return NULL;
if (!p) return NULL;
while (*p != 0 && strchr(delim, *p)) p++;
if (*p == 0) {
*ptrptr = NULL;
return NULL;
}
start = p;
while (*p != 0 && !strchr(delim, *p)) p++;
if (*p == 0) *ptrptr = NULL;
else {
if (chop) *(p++) = 0;
*ptrptr = p;
}
while (*p != 0 && strchr(delim, *p)) p++;
if (*p == 0) {
*ptrptr = NULL;
return NULL;
}
start = p;
while (*p != 0 && !strchr(delim, *p)) p++;
if (*p == 0) *ptrptr = NULL;
else {
if (chop) *(p++) = 0;
*ptrptr = p;
}
return start;
return start;
}
//Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher
//Given: string i and string j. string j can have wildcards
//Returns: 1:matches, 0:doesn't match
//Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher
//Given: string i and string j. string j can have wildcards
//Returns: 1:matches, 0:doesn't match
long Bwildmatch (const char *i, const char *j)
{
const char *k;
char c0, c1;
const char *k;
char c0, c1;
if (!*j) return(1);
do
{
if (*j == '*')
{
for(k=i,j++;*k;k++) if (Bwildmatch(k,j)) return(1);
continue;
}
if (!*i) return(0);
if (*j == '?') { i++; j++; continue; }
c0 = *i; if ((c0 >= 'a') && (c0 <= 'z')) c0 -= 32;
c1 = *j; if ((c1 >= 'a') && (c1 <= 'z')) c1 -= 32;
if (!*j) return(1);
do
{
if (*j == '*')
{
for(k=i,j++;*k;k++) if (Bwildmatch(k,j)) return(1);
continue;
}
if (!*i) return(0);
if (*j == '?') { i++; j++; continue; }
c0 = *i; if ((c0 >= 'a') && (c0 <= 'z')) c0 -= 32;
c1 = *j; if ((c1 >= 'a') && (c1 <= 'z')) c1 -= 32;
#ifdef _WIN32
if (c0 == '/') c0 = '\\';
if (c1 == '/') c1 = '\\';
if (c0 == '/') c0 = '\\';
if (c1 == '/') c1 = '\\';
#endif
if (c0 != c1) return(0);
i++; j++;
} while (*j);
return(!*i);
if (c0 != c1) return(0);
i++; j++;
} while (*j);
return(!*i);
}
#if !defined(_WIN32)
char *Bstrlwr(char *s)
{
char *t = s;
if (!s) return s;
while (*t) { *t = Btolower(*t); t++; }
return s;
char *t = s;
if (!s) return s;
while (*t) { *t = Btolower(*t); t++; }
return s;
}
char *Bstrupr(char *s)
{
char *t = s;
if (!s) return s;
while (*t) { *t = Btoupper(*t); t++; }
return s;
char *t = s;
if (!s) return s;
while (*t) { *t = Btoupper(*t); t++; }
return s;
}
#endif
@ -688,28 +688,28 @@ char *Bstrupr(char *s)
unsigned int Bgetsysmemsize(void)
{
#ifdef _WIN32
MEMORYSTATUS memst;
GlobalMemoryStatus(&memst);
return (unsigned int)memst.dwTotalPhys;
MEMORYSTATUS memst;
GlobalMemoryStatus(&memst);
return (unsigned int)memst.dwTotalPhys;
#elif (defined(_SC_PAGE_SIZE) || defined(_SC_PAGESIZE)) && defined(_SC_PHYS_PAGES)
unsigned int siz = 0x7fffffff;
long scpagesiz, scphyspages;
unsigned int siz = 0x7fffffff;
long scpagesiz, scphyspages;
#ifdef _SC_PAGE_SIZE
scpagesiz = sysconf(_SC_PAGE_SIZE);
scpagesiz = sysconf(_SC_PAGE_SIZE);
#else
scpagesiz = sysconf(_SC_PAGESIZE);
scpagesiz = sysconf(_SC_PAGESIZE);
#endif
scphyspages = sysconf(_SC_PHYS_PAGES);
if (scpagesiz >= 0 && scphyspages >= 0)
siz = (unsigned int)min(longlong(0x7fffffff), (int64)scpagesiz * (int64)scphyspages);
scphyspages = sysconf(_SC_PHYS_PAGES);
if (scpagesiz >= 0 && scphyspages >= 0)
siz = (unsigned int)min(longlong(0x7fffffff), (int64)scpagesiz * (int64)scphyspages);
//initprintf("Bgetsysmemsize(): %d pages of %d bytes, %d bytes of system memory\n",
// scphyspages, scpagesiz, siz);
//initprintf("Bgetsysmemsize(): %d pages of %d bytes, %d bytes of system memory\n",
// scphyspages, scpagesiz, siz);
return siz;
return siz;
#else
return 0x7fffffff;
return 0x7fffffff;
#endif
}

View file

@ -12,45 +12,45 @@
#include "baselayer.h"
static long vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400},
{360,400},{640,350},{640,400},{640,480},{800,600},
{1024,768},{1280,1024},{1600,1200}};
{360,400},{640,350},{640,400},{640,480},{800,600},
{1024,768},{1280,1024},{1600,1200}};
static int readconfig(BFILE *fp, const char *key, char *value, unsigned len)
{
char buf[1000], *k, *v, *eq;
int x=0;
char buf[1000], *k, *v, *eq;
int x=0;
if (len < 1) return 0;
if (len < 1) return 0;
Brewind(fp);
Brewind(fp);
while (1) {
if (!Bfgets(buf, 1000, fp)) return 0;
while (1) {
if (!Bfgets(buf, 1000, fp)) return 0;
if (buf[0] == ';') continue;
if (buf[0] == ';') continue;
eq = Bstrchr(buf, '=');
if (!eq) continue;
eq = Bstrchr(buf, '=');
if (!eq) continue;
k = buf;
v = eq+1;
k = buf;
v = eq+1;
while (*k == ' ' || *k == '\t') k++;
*(eq--) = 0;
while ((*eq == ' ' || *eq == '\t') && eq>=k) *(eq--) = 0;
while (*k == ' ' || *k == '\t') 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 (*v == ' ' || *k == '\t') v++;
eq = v + Bstrlen(v)-1;
while ((*eq == ' ' || *eq == '\t' || *eq == '\r' || *eq == '\n') && eq>=v) *(eq--) = 0;
while ((*eq == ' ' || *eq == '\t' || *eq == '\r' || *eq == '\n') && eq>=v) *(eq--) = 0;
value[--len] = 0;
do value[x] = v[x]; while (v[x++] != 0 && len-- > 0);
value[--len] = 0;
do value[x] = v[x]; while (v[x++] != 0 && len-- > 0);
return x-1;
}
return x-1;
}
}
extern short brightness;
@ -99,35 +99,35 @@ extern double msens;
int loadsetup(const char *fn)
{
BFILE *fp;
BFILE *fp;
#define VL 32
char val[VL];
int i;
char val[VL];
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, "resolution", val, VL) > 0) {
i = Batoi(val) & 0x0f;
if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; }
}
if (readconfig(fp, "2dresolution", val, VL) > 0) {
i = Batoi(val) & 0x0f;
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, "ydim2d", val, VL) > 0) ydim2d = 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, "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, "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, "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, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; }
if (readconfig(fp, "resolution", val, VL) > 0) {
i = Batoi(val) & 0x0f;
if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; }
}
if (readconfig(fp, "2dresolution", val, VL) > 0) {
i = Batoi(val) & 0x0f;
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, "ydim2d", val, VL) > 0) ydim2d = 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, "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, "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, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); }
if (readconfig(fp, "brightness", val, VL) > 0) brightness = min(max(Batoi(val),0),15);
#ifdef RENDERTYPEWIN
if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val);
if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val);
#endif
glusetexcache = glusetexcachecompression = -1;
if (readconfig(fp, "glusetexcache", val, VL) > 0) {
@ -142,166 +142,166 @@ int loadsetup(const char *fn)
{
i=wm_ynbox("Texture caching",
"Would you like to enable the on-disk texture cache? "
"This feature may use up to 200 megabytes of disk "
"space if you have a great deal of high resolution "
"textures and skins, but textures will load exponentially "
"faster after the first time they are loaded.");
"This feature may use up to 200 megabytes of disk "
"space if you have a great deal of high resolution "
"textures and skins, but textures will load exponentially "
"faster after the first time they are loaded.");
if (i) i = 'y';
if(i == 'y' || i == 'Y' )
glusetexcompr = glusetexcache = glusetexcachecompression = 1;
else glusetexcache = glusetexcachecompression = 0;
}
option[0] = 1; // vesa all the way...
option[1] = 1; // sound all the way...
option[4] = 0; // no multiplayer
option[5] = 0;
option[0] = 1; // vesa all the way...
option[1] = 1; // sound all the way...
option[4] = 0; // no multiplayer
option[5] = 0;
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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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)
{
BFILE *fp;
BFILE *fp;
fp = Bfopen(fn,"wt");
if (!fp) return -1;
fp = Bfopen(fn,"wt");
if (!fp) return -1;
Bfprintf(fp,
"; Video mode selection\n"
"; 0 - Windowed\n"
"; 1 - Fullscreen\n"
"fullscreen = %ld\n"
"\n"
"; Video resolution\n"
"xdim2d = %ld\n"
"ydim2d = %ld\n"
"xdim3d = %ld\n"
"ydim3d = %ld\n"
"\n"
"; 3D-mode colour depth\n"
"bpp = %ld\n"
"\n"
"; OpenGL mode options\n"
"glusetexcache = %ld\n"
"glusetexcachecompression = %ld\n"
"\n"
Bfprintf(fp,
"; Video mode selection\n"
"; 0 - Windowed\n"
"; 1 - Fullscreen\n"
"fullscreen = %ld\n"
"\n"
"; Video resolution\n"
"xdim2d = %ld\n"
"ydim2d = %ld\n"
"xdim3d = %ld\n"
"ydim3d = %ld\n"
"\n"
"; 3D-mode colour depth\n"
"bpp = %ld\n"
"\n"
"; OpenGL mode options\n"
"glusetexcache = %ld\n"
"glusetexcachecompression = %ld\n"
"\n"
#ifdef RENDERTYPEWIN
"; Maximum OpenGL mode refresh rate (Windows only, in Hertz)\n"
"maxrefreshfreq = %d\n"
"\n"
"; Maximum OpenGL mode refresh rate (Windows only, in Hertz)\n"
"maxrefreshfreq = %d\n"
"\n"
#endif
"; 3D mode brightness setting\n"
"; 0 - lowest\n"
"; 15 - highest\n"
"brightness = %d\n"
"\n"
"; Sound sample frequency\n"
"; 0 - 6 KHz\n"
"; 1 - 8 KHz\n"
"; 2 - 11.025 KHz\n"
"; 3 - 16 KHz\n"
"; 4 - 22.05 KHz\n"
"; 5 - 32 KHz\n"
"; 6 - 44.1 KHz\n"
"samplerate = %d\n"
"\n"
"; Music playback\n"
"; 0 - Off\n"
"; 1 - On\n"
"music = %d\n"
"\n"
"; Enable mouse\n"
"; 0 - No\n"
"; 1 - Yes\n"
"mouse = %d\n"
"\n"
"; Mouse sensitivity\n"
"mousesensitivity = %g\n"
"\n"
"; Key Settings\n"
"; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n"
"; +---------------------------------------------------------------------------------------------+\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"
"; | |\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"
"; | |\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"
"; | |\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"
"; | KPENTER|\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"
"; | |\n"
"; | 1D 38 39 B8 9D CB D0 CD 52 53 |\n"
"; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. |\n"
"; +---------------------------------------------------------------------------------------------+\n"
"\n"
"keyforward = %X\n"
"keybackward = %X\n"
"keyturnleft = %X\n"
"keyturnright = %X\n"
"keyrun = %X\n"
"keystrafe = %X\n"
"keyfire = %X\n"
"keyuse = %X\n"
"keystandhigh = %X\n"
"keystandlow = %X\n"
"keylookup = %X\n"
"keylookdown = %X\n"
"keystrafeleft = %X\n"
"keystraferight = %X\n"
"key2dmode = %X\n"
"keyviewcycle = %X\n"
"key2dzoomin = %X\n"
"key2dzoomout = %X\n"
"keychat = %X\n"
"keyconsole = %X\n"
"\n",
"; 3D mode brightness setting\n"
"; 0 - lowest\n"
"; 15 - highest\n"
"brightness = %d\n"
"\n"
"; Sound sample frequency\n"
"; 0 - 6 KHz\n"
"; 1 - 8 KHz\n"
"; 2 - 11.025 KHz\n"
"; 3 - 16 KHz\n"
"; 4 - 22.05 KHz\n"
"; 5 - 32 KHz\n"
"; 6 - 44.1 KHz\n"
"samplerate = %d\n"
"\n"
"; Music playback\n"
"; 0 - Off\n"
"; 1 - On\n"
"music = %d\n"
"\n"
"; Enable mouse\n"
"; 0 - No\n"
"; 1 - Yes\n"
"mouse = %d\n"
"\n"
"; Mouse sensitivity\n"
"mousesensitivity = %g\n"
"\n"
"; Key Settings\n"
"; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n"
"; +---------------------------------------------------------------------------------------------+\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"
"; | |\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"
"; | |\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"
"; | |\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"
"; | KPENTER|\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"
"; | |\n"
"; | 1D 38 39 B8 9D CB D0 CD 52 53 |\n"
"; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. |\n"
"; +---------------------------------------------------------------------------------------------+\n"
"\n"
"keyforward = %X\n"
"keybackward = %X\n"
"keyturnleft = %X\n"
"keyturnright = %X\n"
"keyrun = %X\n"
"keystrafe = %X\n"
"keyfire = %X\n"
"keyuse = %X\n"
"keystandhigh = %X\n"
"keystandlow = %X\n"
"keylookup = %X\n"
"keylookdown = %X\n"
"keystrafeleft = %X\n"
"keystraferight = %X\n"
"key2dmode = %X\n"
"keyviewcycle = %X\n"
"key2dzoomin = %X\n"
"key2dzoomout = %X\n"
"keychat = %X\n"
"keyconsole = %X\n"
"\n",
fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame,
glusetexcache, glusetexcachecompression,
fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame,
glusetexcache, glusetexcachecompression,
#ifdef RENDERTYPEWIN
maxrefreshfreq,
maxrefreshfreq,
#endif
brightness, option[7]>>4, option[2],
option[3], msens,
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[12], keys[13], keys[14], keys[15], keys[16], keys[17],
keys[18], keys[19]
);
brightness, option[7]>>4, option[2],
option[3], msens,
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[12], keys[13], keys[14], keys[15], keys[16], keys[17],
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)
{
unsigned long i,j,k;
unsigned long i,j,k;
// algorithm and polynomial same as that used by infozip's zip
for (i=0; i<256; i++) {
j = i;
for (k=8; k; k--)
j = (j&1) ? (0xedb88320L ^ (j>>1)) : (j>>1);
crc32table[i] = j;
}
// algorithm and polynomial same as that used by infozip's zip
for (i=0; i<256; i++) {
j = i;
for (k=8; k; k--)
j = (j&1) ? (0xedb88320L ^ (j>>1)) : (j>>1);
crc32table[i] = j;
}
}
unsigned long crc32once(unsigned char *blk, unsigned long len)
{
unsigned long crc;
unsigned long crc;
crc32init(&crc);
crc32block(&crc, blk, len);
return crc32finish(&crc);
crc32init(&crc);
crc32block(&crc, blk, len);
return crc32finish(&crc);
}
void crc32init(unsigned long *crcvar)
{
if (!crcvar) return;
*crcvar = 0xffffffffl;
if (!crcvar) return;
*crcvar = 0xffffffffl;
}
void crc32block(unsigned long *crcvar, unsigned char *blk, unsigned long len)
{
unsigned long crc = *crcvar;
while (len--) crc = crc32table[(crc ^ *(blk++)) & 0xffl] ^ (crc >> 8);
*crcvar = crc;
unsigned long crc = *crcvar;
while (len--) crc = crc32table[(crc ^ *(blk++)) & 0xffl] ^ (crc >> 8);
*crcvar = crc;
}
unsigned long crc32finish(unsigned long *crcvar)
{
*crcvar = *crcvar ^ 0xffffffffl;
return *crcvar;
*crcvar = *crcvar ^ 0xffffffffl;
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)
{
int i,j;
char buf[64];
int i,j;
char buf[64];
ComboBox_ResetContent(list3d);
for (i=0; i<validmodecnt; i++) {
if (validmode[i].fs != fs) continue;
ComboBox_ResetContent(list3d);
for (i=0; i<validmodecnt; i++) {
if (validmode[i].fs != fs) continue;
Bsprintf(buf, "%ldx%ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
j = ComboBox_AddString(list3d, buf);
ComboBox_SetItemData(list3d, j, i);
if (xdimgame == validmode[i].xdim && ydimgame == validmode[i].ydim && bppgame == validmode[i].bpp)
ComboBox_SetCurSel(list3d, j);
}
Bsprintf(buf, "%ldx%ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
j = ComboBox_AddString(list3d, buf);
ComboBox_SetItemData(list3d, j, i);
if (xdimgame == validmode[i].xdim && ydimgame == validmode[i].ydim && bppgame == validmode[i].bpp)
ComboBox_SetCurSel(list3d, j);
}
}
static INT_PTR CALLBACK LaunchWindowProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG: {
char buf[64];
switch (uMsg) {
case WM_INITDIALOG: {
char buf[64];
if (lParam) {
long *saferect = (long*)lParam;
RECT unresized, playbutton, exitbutton;
int dx, dy;
if (lParam) {
long *saferect = (long*)lParam;
RECT unresized, playbutton, exitbutton;
int dx, dy;
GetWindowRect(hwndDlg, &unresized);
GetWindowRect(GetDlgItem(hwndDlg, IDOK), &playbutton);
GetWindowRect(GetDlgItem(hwndDlg, IDCANCEL), &exitbutton);
GetWindowRect(hwndDlg, &unresized);
GetWindowRect(GetDlgItem(hwndDlg, IDOK), &playbutton);
GetWindowRect(GetDlgItem(hwndDlg, IDCANCEL), &exitbutton);
playbutton.right = 1 + playbutton.right - playbutton.left;
playbutton.bottom = 1 + playbutton.bottom - playbutton.top;
exitbutton.right = 1 + exitbutton.right - exitbutton.left;
exitbutton.bottom = 1 + exitbutton.bottom - exitbutton.top;
playbutton.right = 1 + playbutton.right - playbutton.left;
playbutton.bottom = 1 + playbutton.bottom - playbutton.top;
exitbutton.right = 1 + exitbutton.right - exitbutton.left;
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;
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);
dy = saferect[3] - (unresized.bottom - unresized.top);
dx = saferect[2] - (unresized.right - unresized.left);
dy = saferect[3] - (unresized.bottom - unresized.top);
playbutton.left += dx; exitbutton.left += dx;
playbutton.top += dy; exitbutton.top += dy;
playbutton.left += dx; exitbutton.left += dx;
playbutton.top += dy; exitbutton.top += dy;
// reposition the dialog, play and exit buttons
MoveWindow(hwndDlg, saferect[0], saferect[1], saferect[2], saferect[3], FALSE);
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);
// reposition the dialog, play and exit buttons
MoveWindow(hwndDlg, saferect[0], saferect[1], saferect[2], saferect[3], FALSE);
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
Button_SetCheck(GetDlgItem(hwndDlg, IDCFULLSCREEN), fullscreen ? BST_CHECKED : BST_UNCHECKED);
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDCVMODE));
// populate the controls
Button_SetCheck(GetDlgItem(hwndDlg, IDCFULLSCREEN), fullscreen ? BST_CHECKED : BST_UNCHECKED);
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDCVMODE));
ShowWindow(hwndDlg, SW_SHOW);
if (GetDlgCtrlID((HWND)wParam) != IDOK) {
SetFocus(GetDlgItem(hwndDlg, IDOK));
return FALSE;
}
return TRUE;
}
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDCFULLSCREEN:
fullscreen = Button_GetCheck((HWND)lParam) == BST_CHECKED ? 1:0;
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDCVMODE));
break;
case IDCVMODE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
int i;
i = ComboBox_GetCurSel((HWND)lParam);
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
if (i != CB_ERR) {
xdimgame = validmode[i].xdim;
ydimgame = validmode[i].ydim;
bppgame = validmode[i].bpp;
}
}
break;
case IDCANCEL:
quitevent = 1; // fall through
case IDOK:
DestroyWindow(hwndDlg);
return TRUE;
default: break;
}
break;
default: break;
}
return FALSE;
ShowWindow(hwndDlg, SW_SHOW);
if (GetDlgCtrlID((HWND)wParam) != IDOK) {
SetFocus(GetDlgItem(hwndDlg, IDOK));
return FALSE;
}
return TRUE;
}
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDCFULLSCREEN:
fullscreen = Button_GetCheck((HWND)lParam) == BST_CHECKED ? 1:0;
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDCVMODE));
break;
case IDCVMODE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
int i;
i = ComboBox_GetCurSel((HWND)lParam);
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
if (i != CB_ERR) {
xdimgame = validmode[i].xdim;
ydimgame = validmode[i].ydim;
bppgame = validmode[i].bpp;
}
}
break;
case IDCANCEL:
quitevent = 1; // fall through
case IDOK:
DestroyWindow(hwndDlg);
return TRUE;
default: break;
}
break;
default: break;
}
return FALSE;
}
int DoLaunchWindow(int initval)
{
HWND hwndStart, hwndLaunch;
MSG msg;
long saferect[4];
HWND hwndStart, hwndLaunch;
MSG msg;
long saferect[4];
// 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;
// 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 (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);
if (hwndLaunch) {
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),FALSE);
while (GetMessage(&msg, NULL, 0, 0) > 0) {
if (!IsWindow(hwndLaunch) || quitevent) break;
if (IsDialogMessage(hwndStart, &msg) /*|| IsDialogMessage(hwndLaunch, &msg)*/) continue;
hwndLaunch = CreateDialogParam((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(2000), hwndStart, LaunchWindowProc, (LPARAM)saferect);
if (hwndLaunch) {
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),FALSE);
while (GetMessage(&msg, NULL, 0, 0) > 0) {
if (!IsWindow(hwndLaunch) || quitevent) break;
if (IsDialogMessage(hwndStart, &msg) /*|| IsDialogMessage(hwndLaunch, &msg)*/) continue;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),TRUE);
}
if (quitevent) return 1;
return 0;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),TRUE);
}
if (quitevent) return 1;
return 0;
}

View file

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

View file

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

View file

@ -10,15 +10,15 @@
static palette_t hictinting[MAXPALOOKUPS];
struct hicskybox_t {
long ignore;
char *face[6];
long ignore;
char *face[6];
};
typedef struct hicreplc_t {
struct hicreplc_t *next;
char palnum, ignore, flags, filler;
char *filename;
float alphacut;
struct hicskybox_t *skybox;
struct hicreplc_t *next;
char palnum, ignore, flags, filler;
char *filename;
float alphacut;
struct hicskybox_t *skybox;
} hicreplctyp;
static hicreplctyp *hicreplc[MAXTILES];
static char hicfirstinit = 0;
@ -28,27 +28,27 @@ static char hicfirstinit = 0;
//
static hicreplctyp * hicfindsubst(long picnum, long palnum, long skybox)
{
hicreplctyp *hr;
hicreplctyp *hr;
if (!hicfirstinit) return NULL;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return NULL;
if (!hicfirstinit) return NULL;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return NULL;
do {
for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum) {
if (skybox) {
if (hr->skybox && !hr->skybox->ignore) return hr;
} else {
if (!hr->ignore) return hr;
}
}
}
do {
for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum) {
if (skybox) {
if (hr->skybox && !hr->skybox->ignore) return hr;
} else {
if (!hr->ignore) return hr;
}
}
}
if (!palnum) break;
palnum = 0;
} while (1);
if (!palnum) break;
palnum = 0;
} 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)
{
long i,j;
hicreplctyp *hr, *next;
long i,j;
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;
}
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=MAXTILES-1;i>=0;i--) {
for (hr=hicreplc[i]; hr; ) {
next = hr->next;
if (hicfirstinit)
for (i=MAXTILES-1;i>=0;i--) {
for (hr=hicreplc[i]; hr; ) {
next = hr->next;
if (hr->skybox) {
for (j=5;j>=0;j--) {
if (hr->skybox->face[j]) {
free(hr->skybox->face[j]);
}
}
free(hr->skybox);
}
if (hr->filename) free(hr->filename);
free(hr);
if (hr->skybox) {
for (j=5;j>=0;j--) {
if (hr->skybox->face[j]) {
free(hr->skybox->face[j]);
}
}
free(hr->skybox);
}
if (hr->filename) free(hr->filename);
free(hr);
hr = next;
}
}
memset(hicreplc,0,sizeof(hicreplc));
hr = next;
}
}
memset(hicreplc,0,sizeof(hicreplc));
hicfirstinit = 1;
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)
{
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return;
if (!hicfirstinit) hicinit();
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return;
if (!hicfirstinit) hicinit();
hictinting[palnum].r = r;
hictinting[palnum].g = g;
hictinting[palnum].b = b;
hictinting[palnum].f = effect & HICEFFECTMASK;
hictinting[palnum].r = r;
hictinting[palnum].g = g;
hictinting[palnum].b = b;
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)
{
hicreplctyp *hr, *hrn;
hicreplctyp *hr, *hrn;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
if (!hicfirstinit) hicinit();
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
if (!hicfirstinit) hicinit();
for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum)
break;
}
for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum)
break;
}
if (!hr) {
// no replacement yet defined
hrn = (hicreplctyp *)calloc(1,sizeof(hicreplctyp));
if (!hrn) return -1;
hrn->palnum = palnum;
} else hrn = hr;
if (!hr) {
// no replacement yet defined
hrn = (hicreplctyp *)calloc(1,sizeof(hicreplctyp));
if (!hrn) return -1;
hrn->palnum = palnum;
} else hrn = hr;
// store into hicreplc the details for this replacement
if (hrn->filename) free(hrn->filename);
// store into hicreplc the details for this replacement
if (hrn->filename) free(hrn->filename);
hrn->filename = strdup(filen);
if (!hrn->filename) {
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
return -1;
}
hrn->ignore = 0;
hrn->alphacut = min(alphacut,1.0);
hrn->flags = flags;
if (hr == NULL) {
hrn->next = hicreplc[picnum];
hicreplc[picnum] = hrn;
}
hrn->filename = strdup(filen);
if (!hrn->filename) {
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
return -1;
}
hrn->ignore = 0;
hrn->alphacut = min(alphacut,1.0);
hrn->flags = flags;
if (hr == NULL) {
hrn->next = hicreplc[picnum];
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])
{
hicreplctyp *hr, *hrn;
long j;
hicreplctyp *hr, *hrn;
long j;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
for (j=5;j>=0;j--) if (!faces[j]) return -1;
if (!hicfirstinit) hicinit();
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
for (j=5;j>=0;j--) if (!faces[j]) return -1;
if (!hicfirstinit) hicinit();
for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum)
break;
}
for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum)
break;
}
if (!hr) {
// no replacement yet defined
hrn = (hicreplctyp *)calloc(1,sizeof(hicreplctyp));
if (!hrn) return -1;
if (!hr) {
// no replacement yet defined
hrn = (hicreplctyp *)calloc(1,sizeof(hicreplctyp));
if (!hrn) return -1;
hrn->palnum = palnum;
} else hrn = hr;
hrn->palnum = palnum;
} 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]);
}
}
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
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;
}
// 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;
return 0;
}
@ -224,31 +224,31 @@ int hicsetskybox(long picnum, long palnum, char *faces[6])
//
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)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
if (!hicfirstinit) return 0;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
if (!hicfirstinit) return 0;
for (hr = hicreplc[picnum]; hr; hrn = hr, hr = hr->next) {
if (hr->palnum == palnum)
break;
}
for (hr = hicreplc[picnum]; hr; hrn = hr, hr = hr->next) {
if (hr->palnum == palnum)
break;
}
if (!hr) return 0;
if (!hr) return 0;
if (hr->filename) free(hr->filename);
if (hr->skybox) {
int i;
for (i=5;i>=0;i--)
if (hr->skybox->face[i])
free(hr->skybox->face[i]);
free(hr->skybox);
}
if (hr->filename) free(hr->filename);
if (hr->skybox) {
int i;
for (i=5;i>=0;i--)
if (hr->skybox->face[i])
free(hr->skybox->face[i]);
free(hr->skybox);
}
if (hrn) hrn->next = hr->next;
else hicreplc[picnum] = hr->next;
free(hr);
if (hrn) hrn->next = hr->next;
else hicreplc[picnum] = hr->next;
free(hr);
return 0;
return 0;
}

File diff suppressed because it is too large Load diff

View file

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

View file

@ -49,68 +49,68 @@ unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len)
{
u8 const *ip = (const u8 *)in_data;
u8 *op = (u8 *)out_data;
u8 const *const in_end = ip + in_len;
u8 *const out_end = op + out_len;
u8 const *ip = (const u8 *)in_data;
u8 *op = (u8 *)out_data;
u8 const *const in_end = ip + in_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);
return 0;
SET_ERRNO (E2BIG);
return 0;
}
#if USE_MEMCPY
memcpy (op, ip, ctrl);
op += ctrl;
ip += ctrl;
memcpy (op, ip, ctrl);
op += ctrl;
ip += ctrl;
#else
do
*op++ = *ip++;
while (--ctrl);
do
*op++ = *ip++;
while (--ctrl);
#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)
len += *ip++;
if (len == 7)
len += *ip++;
ref -= *ip++;
ref -= *ip++;
if (op + len + 2 > out_end)
if (op + len + 2 > out_end)
{
SET_ERRNO (E2BIG);
return 0;
SET_ERRNO (E2BIG);
return 0;
}
if (ref < (u8 *)out_data)
if (ref < (u8 *)out_data)
{
SET_ERRNO (EINVAL);
return 0;
SET_ERRNO (EINVAL);
return 0;
}
*op++ = *ref++;
*op++ = *ref++;
do
*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
long lzwcompress (unsigned char *ucompbuf, long ucompleng, unsigned char *compbuf)
{
long i, j, numnodes, *lptr, bitcnt, nbits, oneupnbits, hmask, *child;
long *sibly;
long i, j, numnodes, *lptr, bitcnt, nbits, oneupnbits, hmask, *child;
long *sibly;
#if USENEW
long *sibry;
long *sibry;
#endif
unsigned char *nodev, *cptr, *eptr;
unsigned char *nodev, *cptr, *eptr;
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); }
sibly = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibly) { free(child); free(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); }
sibly = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibly) { free(child); free(nodev); return(0); }
#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
for(i=255;i>=0;i--) { nodev[i] = i; child[i] = -1; }
memset(compbuf,0,ucompleng+15);
for(i=255;i>=0;i--) { nodev[i] = i; child[i] = -1; }
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);
do
{
for(i=cptr[0];i>=0;i=j)
{
cptr++; if (cptr >= eptr) goto lzwcompbreak2b;
j = child[i]; if (j < 0) { child[i] = numnodes; break; }
numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1);
do
{
for(i=cptr[0];i>=0;i=j)
{
cptr++; if (cptr >= eptr) goto lzwcompbreak2b;
j = child[i]; if (j < 0) { child[i] = numnodes; break; }
#if USENEW
//This is about 2x faster when ucompbuf is more random, 5% slower when very compressible
while (cptr[0] != nodev[j])
{
if (cptr[0] < nodev[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]; }
}
//This is about 2x faster when ucompbuf is more random, 5% slower when very compressible
while (cptr[0] != nodev[j])
{
if (cptr[0] < nodev[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
for(;nodev[j]!=cptr[0];j=sibly[j])
if (sibly[j] < 0) { sibly[j] = numnodes; goto lzwcompbreak2a; }
for(;nodev[j]!=cptr[0];j=sibly[j])
if (sibly[j] < 0) { sibly[j] = numnodes; goto lzwcompbreak2a; }
#endif
}
}
lzwcompbreak2a: nodev[numnodes] = cptr[0];
lzwcompbreak2b: child[numnodes] = sibly[numnodes] = -1;
#if USENEW
sibry[numnodes] = -1;
sibry[numnodes] = -1;
#endif
lptr = (long *)&compbuf[bitcnt>>3]; lptr[0] |= LSWAPIB(i<<(bitcnt&7));
bitcnt += nbits; if ((i&hmask) > ((numnodes-1)&hmask)) bitcnt--;
lptr = (long *)&compbuf[bitcnt>>3]; lptr[0] |= LSWAPIB(i<<(bitcnt&7));
bitcnt += nbits; if ((i&hmask) > ((numnodes-1)&hmask)) bitcnt--;
numnodes++; if (numnodes > oneupnbits) { nbits++; oneupnbits <<= 1; hmask = ((oneupnbits>>1)-1); }
} while ((cptr < eptr) && (bitcnt < (ucompleng<<3)));
numnodes++; if (numnodes > oneupnbits) { nbits++; oneupnbits <<= 1; hmask = ((oneupnbits>>1)-1); }
} while ((cptr < eptr) && (bitcnt < (ucompleng<<3)));
#if USENEW
free(sibry);
free(sibry);
#endif
free(sibly);
free(child); free(nodev);
free(sibly);
free(child); free(nodev);
lptr = (long *)compbuf;
if (((bitcnt+7)>>3) < ucompleng) { lptr[0] = LSWAPIB(numnodes); return((bitcnt+7)>>3); }
memcpy(compbuf,ucompbuf,ucompleng); return(ucompleng);
lptr = (long *)compbuf;
if (((bitcnt+7)>>3) < ucompleng) { lptr[0] = LSWAPIB(numnodes); return((bitcnt+7)>>3); }
memcpy(compbuf,ucompbuf,ucompleng); return(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;
unsigned char ch, *ucptr, *suffix;
long ucomp = (long)ucompbuf;
long i, dat, leng, bitcnt, *lptr, numnodes, totnodes, nbits, oneupnbits, hmask, *prefix;
unsigned char ch, *ucptr, *suffix;
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; }
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);
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--; }
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--; }
prefix[numnodes] = dat;
prefix[numnodes] = dat;
ucompbuf++;
for(leng=0;dat>=256;dat=prefix[dat]) {
if ((long)ucompbuf+leng-ucomp > ucompleng) goto bail;
ucompbuf[leng++] = suffix[dat];
}
ucompbuf++;
for(leng=0;dat>=256;dat=prefix[dat]) {
if ((long)ucompbuf+leng-ucomp > ucompleng) goto bail;
ucompbuf[leng++] = suffix[dat];
}
ucptr = &ucompbuf[leng-1];
for(i=(leng>>1)-1;i>=0;i--) { ch = ucompbuf[i]; ucompbuf[i] = ucptr[-i]; ucptr[-i] = ch; }
ucompbuf[-1] = dat; ucompbuf += leng;
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;
suffix[numnodes-1] = suffix[numnodes] = dat;
suffix[numnodes-1] = suffix[numnodes] = dat;
numnodes++; if (numnodes > oneupnbits) { nbits++; oneupnbits <<= 1; hmask = ((oneupnbits>>1)-1); }
} while (numnodes < totnodes);
numnodes++; if (numnodes > oneupnbits) { nbits++; oneupnbits <<= 1; hmask = ((oneupnbits>>1)-1); }
} while (numnodes < totnodes);
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
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,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
};
/* 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])
{
MD4_CTX ctx;
MD4_CTX ctx;
md4init(&ctx);
md4block(&ctx, block, len);
md4finish(digest, &ctx);
md4init(&ctx);
md4block(&ctx, block, len);
md4finish(digest, &ctx);
}
/* MD4 initialization. Begins an MD4 operation, writing a new context.
*/
void md4init (MD4_CTX *context)
{
context->count[0] = context->count[1] = 0;
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
/* Load magic initialization constants.
*/
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
}
/* 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)
{
unsigned int i, index, partLen;
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3))
< ((UINT4)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3))
< ((UINT4)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
partLen = 64 - index;
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
/* Transform as many times as possible.
*/
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
((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],
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)
{
unsigned char bits[8];
unsigned int index, padLen;
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
Encode (bits, context->count, 8);
/* Save number of bits */
Encode (bits, context->count, 8);
/* Pad out to 56 mod 64.
*/
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
md4block (context, PADDING, padLen);
/* Pad out to 56 mod 64.
*/
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
md4block (context, PADDING, padLen);
/* Append length (before padding) */
md4block (context, bits, 8);
/* Store state in digest */
Encode (digest, context->state, 16);
/* Append length (before padding) */
md4block (context, bits, 8);
/* Store state in digest */
Encode (digest, context->state, 16);
/* Zeroize sensitive information.
*/
MD4_memset ((POINTER)context, 0, sizeof (*context));
/* Zeroize sensitive information.
*/
MD4_memset ((POINTER)context, 0, sizeof (*context));
}
/* MD4 basic transformation. Transforms state based on block.
*/
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 */
FF (a, b, c, d, x[ 0], S11); /* 1 */
FF (d, a, b, c, x[ 1], S12); /* 2 */
FF (c, d, a, b, x[ 2], S13); /* 3 */
FF (b, c, d, a, x[ 3], S14); /* 4 */
FF (a, b, c, d, x[ 4], S11); /* 5 */
FF (d, a, b, c, x[ 5], S12); /* 6 */
FF (c, d, a, b, x[ 6], S13); /* 7 */
FF (b, c, d, a, x[ 7], S14); /* 8 */
FF (a, b, c, d, x[ 8], S11); /* 9 */
FF (d, a, b, c, x[ 9], S12); /* 10 */
FF (c, d, a, b, x[10], S13); /* 11 */
FF (b, c, d, a, x[11], S14); /* 12 */
FF (a, b, c, d, x[12], S11); /* 13 */
FF (d, a, b, c, x[13], S12); /* 14 */
FF (c, d, a, b, x[14], S13); /* 15 */
FF (b, c, d, a, x[15], S14); /* 16 */
/* Round 1 */
FF (a, b, c, d, x[ 0], S11); /* 1 */
FF (d, a, b, c, x[ 1], S12); /* 2 */
FF (c, d, a, b, x[ 2], S13); /* 3 */
FF (b, c, d, a, x[ 3], S14); /* 4 */
FF (a, b, c, d, x[ 4], S11); /* 5 */
FF (d, a, b, c, x[ 5], S12); /* 6 */
FF (c, d, a, b, x[ 6], S13); /* 7 */
FF (b, c, d, a, x[ 7], S14); /* 8 */
FF (a, b, c, d, x[ 8], S11); /* 9 */
FF (d, a, b, c, x[ 9], S12); /* 10 */
FF (c, d, a, b, x[10], S13); /* 11 */
FF (b, c, d, a, x[11], S14); /* 12 */
FF (a, b, c, d, x[12], S11); /* 13 */
FF (d, a, b, c, x[13], S12); /* 14 */
FF (c, d, a, b, x[14], S13); /* 15 */
FF (b, c, d, a, x[15], S14); /* 16 */
/* Round 2 */
GG (a, b, c, d, x[ 0], S21); /* 17 */
GG (d, a, b, c, x[ 4], S22); /* 18 */
GG (c, d, a, b, x[ 8], S23); /* 19 */
GG (b, c, d, a, x[12], S24); /* 20 */
GG (a, b, c, d, x[ 1], S21); /* 21 */
GG (d, a, b, c, x[ 5], S22); /* 22 */
GG (c, d, a, b, x[ 9], S23); /* 23 */
GG (b, c, d, a, x[13], S24); /* 24 */
GG (a, b, c, d, x[ 2], S21); /* 25 */
GG (d, a, b, c, x[ 6], S22); /* 26 */
GG (c, d, a, b, x[10], S23); /* 27 */
GG (b, c, d, a, x[14], S24); /* 28 */
GG (a, b, c, d, x[ 3], S21); /* 29 */
GG (d, a, b, c, x[ 7], S22); /* 30 */
GG (c, d, a, b, x[11], S23); /* 31 */
GG (b, c, d, a, x[15], S24); /* 32 */
/* Round 2 */
GG (a, b, c, d, x[ 0], S21); /* 17 */
GG (d, a, b, c, x[ 4], S22); /* 18 */
GG (c, d, a, b, x[ 8], S23); /* 19 */
GG (b, c, d, a, x[12], S24); /* 20 */
GG (a, b, c, d, x[ 1], S21); /* 21 */
GG (d, a, b, c, x[ 5], S22); /* 22 */
GG (c, d, a, b, x[ 9], S23); /* 23 */
GG (b, c, d, a, x[13], S24); /* 24 */
GG (a, b, c, d, x[ 2], S21); /* 25 */
GG (d, a, b, c, x[ 6], S22); /* 26 */
GG (c, d, a, b, x[10], S23); /* 27 */
GG (b, c, d, a, x[14], S24); /* 28 */
GG (a, b, c, d, x[ 3], S21); /* 29 */
GG (d, a, b, c, x[ 7], S22); /* 30 */
GG (c, d, a, b, x[11], S23); /* 31 */
GG (b, c, d, a, x[15], S24); /* 32 */
/* Round 3 */
HH (a, b, c, d, x[ 0], S31); /* 33 */
HH (d, a, b, c, x[ 8], S32); /* 34 */
HH (c, d, a, b, x[ 4], S33); /* 35 */
HH (b, c, d, a, x[12], S34); /* 36 */
HH (a, b, c, d, x[ 2], S31); /* 37 */
HH (d, a, b, c, x[10], S32); /* 38 */
HH (c, d, a, b, x[ 6], S33); /* 39 */
HH (b, c, d, a, x[14], S34); /* 40 */
HH (a, b, c, d, x[ 1], S31); /* 41 */
HH (d, a, b, c, x[ 9], S32); /* 42 */
HH (c, d, a, b, x[ 5], S33); /* 43 */
HH (b, c, d, a, x[13], S34); /* 44 */
HH (a, b, c, d, x[ 3], S31); /* 45 */
HH (d, a, b, c, x[11], S32); /* 46 */
HH (c, d, a, b, x[ 7], S33); /* 47 */
HH (b, c, d, a, x[15], S34); /* 48 */
/* Round 3 */
HH (a, b, c, d, x[ 0], S31); /* 33 */
HH (d, a, b, c, x[ 8], S32); /* 34 */
HH (c, d, a, b, x[ 4], S33); /* 35 */
HH (b, c, d, a, x[12], S34); /* 36 */
HH (a, b, c, d, x[ 2], S31); /* 37 */
HH (d, a, b, c, x[10], S32); /* 38 */
HH (c, d, a, b, x[ 6], S33); /* 39 */
HH (b, c, d, a, x[14], S34); /* 40 */
HH (a, b, c, d, x[ 1], S31); /* 41 */
HH (d, a, b, c, x[ 9], S32); /* 42 */
HH (c, d, a, b, x[ 5], S33); /* 43 */
HH (b, c, d, a, x[13], S34); /* 44 */
HH (a, b, c, d, x[ 3], S31); /* 45 */
HH (d, a, b, c, x[11], S32); /* 46 */
HH (c, d, a, b, x[ 7], S33); /* 47 */
HH (b, c, d, a, x[15], S34); /* 48 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
/* Zeroize sensitive information.
*/
MD4_memset ((POINTER)x, 0, sizeof (x));
/* Zeroize sensitive information.
*/
MD4_memset ((POINTER)x, 0, sizeof (x));
}
/* 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)
{
unsigned int i, j;
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
}
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
}
}
/* 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)
{
unsigned int i, j;
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}

File diff suppressed because it is too large Load diff

View file

@ -29,13 +29,13 @@
#include <sys/time.h>
static long GetTickCount(void)
{
struct timeval tv;
long ti;
if (gettimeofday(&tv,NULL) < 0) return 0;
// tv is sec.usec, GTC gives msec
ti = tv.tv_sec * 1000;
ti += tv.tv_usec / 1000;
return ti;
struct timeval tv;
long ti;
if (gettimeofday(&tv,NULL) < 0) return 0;
// tv is sec.usec, GTC gives msec
ti = tv.tv_sec * 1000;
ti += tv.tv_usec / 1000;
return ti;
}
#endif
@ -79,113 +79,113 @@ static long snatchip = 0, snatchport = 0, danetmode = 255, netready = 0;
void netuninit ()
{
if (mysock != (SOCKET)INVALID_HANDLE_VALUE) closesocket(mysock);
if (mysock != (SOCKET)INVALID_HANDLE_VALUE) closesocket(mysock);
#ifdef _WIN32
WSACleanup();
WSACleanup();
#endif
}
long netinit (long portnum)
{
LPHOSTENT lpHostEnt;
char hostnam[256];
struct sockaddr_in ip;
long i;
LPHOSTENT lpHostEnt;
char hostnam[256];
struct sockaddr_in ip;
long i;
#ifdef _WIN32
WSADATA ws;
WSADATA ws;
if (WSAStartup(0x101,&ws) == SOCKET_ERROR) return(0);
if (WSAStartup(0x101,&ws) == SOCKET_ERROR) return(0);
#endif
mysock = socket(AF_INET,SOCK_DGRAM,0); if (mysock == INVALID_SOCKET) return(0);
mysock = socket(AF_INET,SOCK_DGRAM,0); if (mysock == INVALID_SOCKET) return(0);
#ifdef __BEOS__
i = 1; if (setsockopt(mysock,SOL_SOCKET,SO_NONBLOCK,&i,sizeof(i)) < 0) return(0);
i = 1; if (setsockopt(mysock,SOL_SOCKET,SO_NONBLOCK,&i,sizeof(i)) < 0) return(0);
#else
i = 1; if (ioctlsocket(mysock,FIONBIO,(unsigned long *)&i) == SOCKET_ERROR) return(0);
i = 1; if (ioctlsocket(mysock,FIONBIO,(unsigned long *)&i) == SOCKET_ERROR) return(0);
#endif
ip.sin_family = AF_INET;
ip.sin_addr.s_addr = INADDR_ANY;
ip.sin_port = htons(portnum);
if (bind(mysock,(struct sockaddr *)&ip,sizeof(ip)) != SOCKET_ERROR)
{
myport = portnum;
if (gethostname(hostnam,sizeof(hostnam)) != SOCKET_ERROR)
if ((lpHostEnt = gethostbyname(hostnam)))
{
myip = ip.sin_addr.s_addr = *(long *)lpHostEnt->h_addr;
printf("mmulti: This machine's IP is %s\n", inet_ntoa(ip.sin_addr));
}
return(1);
}
return(0);
ip.sin_family = AF_INET;
ip.sin_addr.s_addr = INADDR_ANY;
ip.sin_port = htons(portnum);
if (bind(mysock,(struct sockaddr *)&ip,sizeof(ip)) != SOCKET_ERROR)
{
myport = portnum;
if (gethostname(hostnam,sizeof(hostnam)) != SOCKET_ERROR)
if ((lpHostEnt = gethostbyname(hostnam)))
{
myip = ip.sin_addr.s_addr = *(long *)lpHostEnt->h_addr;
printf("mmulti: This machine's IP is %s\n", inet_ntoa(ip.sin_addr));
}
return(1);
}
return(0);
}
long netsend (long other, char *dabuf, long bufsiz) //0:buffer full... can't send
{
struct sockaddr_in ip;
struct sockaddr_in ip;
if (!otherip[other]) return(0);
ip.sin_family = AF_INET;
ip.sin_addr.s_addr = otherip[other];
ip.sin_port = otherport[other];
return(sendto(mysock,dabuf,bufsiz,0,(struct sockaddr *)&ip,sizeof(struct sockaddr_in)) != SOCKET_ERROR);
if (!otherip[other]) return(0);
ip.sin_family = AF_INET;
ip.sin_addr.s_addr = otherip[other];
ip.sin_port = otherport[other];
return(sendto(mysock,dabuf,bufsiz,0,(struct sockaddr *)&ip,sizeof(struct sockaddr_in)) != SOCKET_ERROR);
}
long netread (long *other, char *dabuf, long bufsiz) //0:no packets in buffer
{
struct sockaddr_in ip;
long i;
struct sockaddr_in ip;
long i;
i = sizeof(ip);
if (recvfrom(mysock,dabuf,bufsiz,0,(struct sockaddr *)&ip,(int *)&i) == -1) return(0);
i = sizeof(ip);
if (recvfrom(mysock,dabuf,bufsiz,0,(struct sockaddr *)&ip,(int *)&i) == -1) return(0);
#if (SIMMIS > 0)
if ((rand()&255) < SIMMIS) return(0);
if ((rand()&255) < SIMMIS) return(0);
#endif
snatchip = (long)ip.sin_addr.s_addr; snatchport = (long)ip.sin_port;
snatchip = (long)ip.sin_addr.s_addr; snatchport = (long)ip.sin_port;
(*other) = myconnectindex;
for(i=0;i<MAXPLAYERS;i++)
if ((otherip[i] == snatchip) && (otherport[i] == snatchport))
{ (*other) = i; break; }
(*other) = myconnectindex;
for(i=0;i<MAXPLAYERS;i++)
if ((otherip[i] == snatchip) && (otherport[i] == snatchport))
{ (*other) = i; break; }
#if (SIMLAG > 1)
i = simlagcnt[*other]%(SIMLAG+1);
*(short *)&simlagfif[*other][i][0] = bufsiz; memcpy(&simlagfif[*other][i][2],dabuf,bufsiz);
simlagcnt[*other]++; if (simlagcnt[*other] < SIMLAG+1) return(0);
i = simlagcnt[*other]%(SIMLAG+1);
bufsiz = *(short *)&simlagfif[*other][i][0]; memcpy(dabuf,&simlagfif[*other][i][2],bufsiz);
i = simlagcnt[*other]%(SIMLAG+1);
*(short *)&simlagfif[*other][i][0] = bufsiz; memcpy(&simlagfif[*other][i][2],dabuf,bufsiz);
simlagcnt[*other]++; if (simlagcnt[*other] < SIMLAG+1) return(0);
i = simlagcnt[*other]%(SIMLAG+1);
bufsiz = *(short *)&simlagfif[*other][i][0]; memcpy(dabuf,&simlagfif[*other][i][2],bufsiz);
#endif
return(1);
return(1);
}
long isvalidipaddress (char *st)
{
long i, bcnt, num;
long i, bcnt, num;
bcnt = 0; num = 0;
for(i=0;st[i];i++)
{
if (st[i] == '.') { bcnt++; num = 0; continue; }
if (st[i] == ':')
{
if (bcnt != 3) return(0);
num = 0;
for(i++;st[i];i++)
{
if ((st[i] >= '0') && (st[i] <= '9'))
{ num = num*10+st[i]-'0'; if (num >= 65536) return(0); }
else return(0);
}
return(1);
}
if ((st[i] >= '0') && (st[i] <= '9'))
{ num = num*10+st[i]-'0'; if (num >= 256) return(0); }
bcnt = 0; num = 0;
for(i=0;st[i];i++)
{
if (st[i] == '.') { bcnt++; num = 0; continue; }
if (st[i] == ':')
{
if (bcnt != 3) return(0);
num = 0;
for(i++;st[i];i++)
{
if ((st[i] >= '0') && (st[i] <= '9'))
{ num = num*10+st[i]-'0'; if (num >= 65536) return(0); }
else return(0);
}
return(1);
}
if ((st[i] >= '0') && (st[i] <= '9'))
{ num = num*10+st[i]-'0'; if (num >= 256) return(0); }
}
return(bcnt == 3);
}
return(bcnt == 3);
}
//---------------------------------- Obsolete variables&functions ----------------------------------
@ -202,25 +202,25 @@ void sendlogoff () {}
static long crctab16[256];
static void initcrc16 ()
{
long i, j, k, a;
for(j=0;j<256;j++)
{
for(i=7,k=(j<<8),a=0;i>=0;i--,k=((k<<1)&65535))
{
if ((k^a)&0x8000) a = ((a<<1)&65535)^0x1021;
else a = ((a<<1)&65535);
}
crctab16[j] = (a&65535);
}
long i, j, k, a;
for(j=0;j<256;j++)
{
for(i=7,k=(j<<8),a=0;i>=0;i--,k=((k<<1)&65535))
{
if ((k^a)&0x8000) a = ((a<<1)&65535)^0x1021;
else a = ((a<<1)&65535);
}
crctab16[j] = (a&65535);
}
}
#define updatecrc16(crc,dat) crc = (((crc<<8)&65535)^crctab16[((((unsigned short)crc)>>8)&65535)^dat])
static unsigned short getcrc16 (char *buffer, long bufleng)
{
long i, j;
long i, j;
j = 0;
for(i=bufleng-1;i>=0;i--) updatecrc16(j,buffer[i]);
return((unsigned short)(j&65535));
j = 0;
for(i=bufleng-1;i>=0;i--) updatecrc16(j,buffer[i]);
return((unsigned short)(j&65535));
}
void uninitmultiplayers () { netuninit(); }
@ -228,145 +228,145 @@ void uninitmultiplayers () { netuninit(); }
long getpacket(long *, char *);
static void initmultiplayers_reset(void)
{
long i;
long i;
initcrc16();
memset(icnt0,0,sizeof(icnt0));
memset(ocnt0,0,sizeof(ocnt0));
memset(ocnt1,0,sizeof(ocnt1));
memset(ipak,0,sizeof(ipak));
//memset(opak,0,sizeof(opak)); //Don't need to init opak
//memset(pakmem,0,sizeof(pakmem)); //Don't need to init pakmem
initcrc16();
memset(icnt0,0,sizeof(icnt0));
memset(ocnt0,0,sizeof(ocnt0));
memset(ocnt1,0,sizeof(ocnt1));
memset(ipak,0,sizeof(ipak));
//memset(opak,0,sizeof(opak)); //Don't need to init opak
//memset(pakmem,0,sizeof(pakmem)); //Don't need to init pakmem
#if (SIMLAG > 1)
memset(simlagcnt,0,sizeof(simlagcnt));
memset(simlagcnt,0,sizeof(simlagcnt));
#endif
lastsendtims[0] = GetTickCount();
for(i=1;i<MAXPLAYERS;i++) lastsendtims[i] = lastsendtims[0];
numplayers = 1; myconnectindex = 0;
lastsendtims[0] = GetTickCount();
for(i=1;i<MAXPLAYERS;i++) lastsendtims[i] = lastsendtims[0];
numplayers = 1; myconnectindex = 0;
memset(otherip,0,sizeof(otherip));
for(i=0;i<MAXPLAYERS;i++) otherport[i] = htons(NETPORT);
memset(otherip,0,sizeof(otherip));
for(i=0;i<MAXPLAYERS;i++) otherport[i] = htons(NETPORT);
}
// Multiplayer command line summary. Assume myconnectindex always = 0 for 192.168.1.2
//
// /n0 (mast/slav) 2 player: 3 player:
// 192.168.1.2 game /n0 game /n0:3
// 192.168.1.100 game /n0 192.168.1.2 game /n0 192.168.1.2
// 192.168.1.4 game /n0 192.168.1.2
//
// /n1 (peer-peer) 2 player: 3 player:
// 192.168.1.2 game /n1 192.168.1.100 game /n1 192.168.1.100 192.168.1.4
// 192.168.1.100 game 192.168.1.2 /n1 game 192.168.1.2 /n1 192.168.1.4
// 192.168.1.4 game 192.168.1.2 192.168.1.100 /n1
// Multiplayer command line summary. Assume myconnectindex always = 0 for 192.168.1.2
//
// /n0 (mast/slav) 2 player: 3 player:
// 192.168.1.2 game /n0 game /n0:3
// 192.168.1.100 game /n0 192.168.1.2 game /n0 192.168.1.2
// 192.168.1.4 game /n0 192.168.1.2
//
// /n1 (peer-peer) 2 player: 3 player:
// 192.168.1.2 game /n1 192.168.1.100 game /n1 192.168.1.100 192.168.1.4
// 192.168.1.100 game 192.168.1.2 /n1 game 192.168.1.2 /n1 192.168.1.4
// 192.168.1.4 game 192.168.1.2 192.168.1.100 /n1
long initmultiplayersparms(long argc, char **argv)
{
long i, j, daindex, portnum = NETPORT;
char *st;
long i, j, daindex, portnum = NETPORT;
char *st;
initmultiplayers_reset();
danetmode = 255; daindex = 0;
initmultiplayers_reset();
danetmode = 255; daindex = 0;
// go looking for the port, if specified
for (i=0;i<argc;i++) {
if (argv[i][0] != '-' && argv[i][0] != '/') continue;
if ((argv[i][1] == 'p' || argv[i][1] == 'P') && argv[i][2]) {
char *p;
j = strtol(argv[i]+2, &p, 10);
if (!(*p) && j > 1024 && j<65535) portnum = j;
// go looking for the port, if specified
for (i=0;i<argc;i++) {
if (argv[i][0] != '-' && argv[i][0] != '/') continue;
if ((argv[i][1] == 'p' || argv[i][1] == 'P') && argv[i][2]) {
char *p;
j = strtol(argv[i]+2, &p, 10);
if (!(*p) && j > 1024 && j<65535) portnum = j;
printf("mmulti: Using port %ld\n", portnum);
}
}
printf("mmulti: Using port %ld\n", portnum);
}
}
netinit(portnum);
netinit(portnum);
for(i=0;i<argc;i++)
{
//if (((argv[i][0] == '/') || (argv[i][0] == '-')) &&
// ((argv[i][1] == 'N') || (argv[i][1] == 'n')) &&
// ((argv[i][2] == 'E') || (argv[i][2] == 'e')) &&
// ((argv[i][3] == 'T') || (argv[i][3] == 't')) &&
// (!argv[i][4]))
// { foundnet = 1; continue; }
//if (!foundnet) continue;
for(i=0;i<argc;i++)
{
//if (((argv[i][0] == '/') || (argv[i][0] == '-')) &&
// ((argv[i][1] == 'N') || (argv[i][1] == 'n')) &&
// ((argv[i][2] == 'E') || (argv[i][2] == 'e')) &&
// ((argv[i][3] == 'T') || (argv[i][3] == 't')) &&
// (!argv[i][4]))
// { foundnet = 1; continue; }
//if (!foundnet) continue;
if ((argv[i][0] == '-') || (argv[i][0] == '/')) {
if ((argv[i][1] == 'N') || (argv[i][1] == 'n') || (argv[i][1] == 'I') || (argv[i][1] == 'i'))
{
numplayers = 2;
if (argv[i][2] == '0')
{
danetmode = 0;
if ((argv[i][3] == ':') && (argv[i][4] >= '0') && (argv[i][4] <= '9'))
{
numplayers = (argv[i][4]-'0');
if ((argv[i][5] >= '0') && (argv[i][5] <= '9')) numplayers = numplayers*10+(argv[i][5]-'0');
printf("mmulti: %ld-player game\n", numplayers);
}
printf("mmulti: Master-slave mode\n");
}
else if (argv[i][2] == '1')
{
danetmode = 1;
myconnectindex = daindex; daindex++;
printf("mmulti: Peer-to-peer mode\n");
}
continue;
}
else if ((argv[i][1] == 'P') || (argv[i][1] == 'p')) continue;
}
if ((argv[i][0] == '-') || (argv[i][0] == '/')) {
if ((argv[i][1] == 'N') || (argv[i][1] == 'n') || (argv[i][1] == 'I') || (argv[i][1] == 'i'))
{
numplayers = 2;
if (argv[i][2] == '0')
{
danetmode = 0;
if ((argv[i][3] == ':') && (argv[i][4] >= '0') && (argv[i][4] <= '9'))
{
numplayers = (argv[i][4]-'0');
if ((argv[i][5] >= '0') && (argv[i][5] <= '9')) numplayers = numplayers*10+(argv[i][5]-'0');
printf("mmulti: %ld-player game\n", numplayers);
}
printf("mmulti: Master-slave mode\n");
}
else if (argv[i][2] == '1')
{
danetmode = 1;
myconnectindex = daindex; daindex++;
printf("mmulti: Peer-to-peer mode\n");
}
continue;
}
else if ((argv[i][1] == 'P') || (argv[i][1] == 'p')) continue;
}
st = strdup(argv[i]); if (!st) break;
if (isvalidipaddress(st))
{
if ((danetmode == 1) && (daindex == myconnectindex)) daindex++;
for(j=0;st[j];j++) {
if (st[j] == ':')
{ otherport[daindex] = htons((unsigned short)atol(&st[j+1])); st[j] = 0; break; }
}
otherip[daindex] = inet_addr(st);
printf("mmulti: Player %ld at %s:%d\n",daindex,st,ntohs(otherport[daindex]));
daindex++;
}
else
{
LPHOSTENT lph;
unsigned short pt = htons(NETPORT);
st = strdup(argv[i]); if (!st) break;
if (isvalidipaddress(st))
{
if ((danetmode == 1) && (daindex == myconnectindex)) daindex++;
for(j=0;st[j];j++) {
if (st[j] == ':')
{ otherport[daindex] = htons((unsigned short)atol(&st[j+1])); st[j] = 0; break; }
}
otherip[daindex] = inet_addr(st);
printf("mmulti: Player %ld at %s:%d\n",daindex,st,ntohs(otherport[daindex]));
daindex++;
}
else
{
LPHOSTENT lph;
unsigned short pt = htons(NETPORT);
for(j=0;st[j];j++)
if (st[j] == ':')
{ pt = htons((unsigned short)atol(&st[j+1])); st[j] = 0; break; }
if ((lph = gethostbyname(st)))
{
if ((danetmode == 1) && (daindex == myconnectindex)) daindex++;
otherip[daindex] = *(long *)lph->h_addr;
otherport[daindex] = pt;
printf("mmulti: Player %ld at %s:%d (%s)\n",daindex,
inet_ntoa(*(struct in_addr *)lph->h_addr),ntohs(pt),argv[i]);
daindex++;
} else printf("mmulti: Failed resolving %s\n",argv[i]);
}
free(st);
}
if ((danetmode == 255) && (daindex)) { numplayers = 2; danetmode = 0; } //an IP w/o /n# defaults to /n0
if ((numplayers >= 2) && (daindex) && (!danetmode)) myconnectindex = 1;
if (daindex > numplayers) numplayers = daindex;
for(j=0;st[j];j++)
if (st[j] == ':')
{ pt = htons((unsigned short)atol(&st[j+1])); st[j] = 0; break; }
if ((lph = gethostbyname(st)))
{
if ((danetmode == 1) && (daindex == myconnectindex)) daindex++;
otherip[daindex] = *(long *)lph->h_addr;
otherport[daindex] = pt;
printf("mmulti: Player %ld at %s:%d (%s)\n",daindex,
inet_ntoa(*(struct in_addr *)lph->h_addr),ntohs(pt),argv[i]);
daindex++;
} else printf("mmulti: Failed resolving %s\n",argv[i]);
}
free(st);
}
if ((danetmode == 255) && (daindex)) { numplayers = 2; danetmode = 0; } //an IP w/o /n# defaults to /n0
if ((numplayers >= 2) && (daindex) && (!danetmode)) myconnectindex = 1;
if (daindex > numplayers) numplayers = daindex;
//for(i=0;i<numplayers;i++)
// printf("Player %d: %d.%d.%d.%d:%d\n",i,otherip[i]&255,(otherip[i]>>8)&255,(otherip[i]>>16)&255,((unsigned long)otherip[i])>>24,ntohs(otherport[i]));
//for(i=0;i<numplayers;i++)
// printf("Player %d: %d.%d.%d.%d:%d\n",i,otherip[i]&255,(otherip[i]>>8)&255,(otherip[i]>>16)&255,((unsigned long)otherip[i])>>24,ntohs(otherport[i]));
connecthead = 0;
for(i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
connectpoint2[numplayers-1] = -1;
connecthead = 0;
for(i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
connectpoint2[numplayers-1] = -1;
return (((!danetmode) && (numplayers >= 2)) || (numplayers == 2));
return (((!danetmode) && (numplayers >= 2)) || (numplayers == 2));
}
long initmultiplayerscycle(void)
{
long i, k;
long i, k;
extern long totalclock;
#ifdef _WIN32
@ -375,275 +375,275 @@ long initmultiplayerscycle(void)
usleep(1);
#endif
getpacket(&i,0);
getpacket(&i,0);
tims = GetTickCount();
if (myconnectindex == connecthead)
{
for(i=numplayers-1;i>0;i--)
if (!otherip[i]) break;
if (!i) {
netready = 1;
return 0;
}
}
else
{
if (netready) return 0;
if (tims < lastsendtims[connecthead]) lastsendtims[connecthead] = tims;
if (tims >= lastsendtims[connecthead]+250) //1000/PAKRATE)
{
lastsendtims[connecthead] = tims;
tims = GetTickCount();
if (myconnectindex == connecthead)
{
for(i=numplayers-1;i>0;i--)
if (!otherip[i]) break;
if (!i) {
netready = 1;
return 0;
}
}
else
{
if (netready) return 0;
if (tims < lastsendtims[connecthead]) lastsendtims[connecthead] = tims;
if (tims >= lastsendtims[connecthead]+250) //1000/PAKRATE)
{
lastsendtims[connecthead] = tims;
// short crc16ofs; //offset of crc16
// long icnt0; //-1 (special packet for MMULTI.C's player collection)
// ...
// unsigned short crc16; //CRC16 of everything except crc16
k = 2;
*(long *)&pakbuf[k] = -1; k += 4;
pakbuf[k++] = 0xaa;
*(unsigned short *)&pakbuf[0] = (unsigned short)k;
*(unsigned short *)&pakbuf[k] = getcrc16(pakbuf,k); k += 2;
netsend(connecthead,pakbuf,k);
}
}
// short crc16ofs; //offset of crc16
// long icnt0; //-1 (special packet for MMULTI.C's player collection)
// ...
// unsigned short crc16; //CRC16 of everything except crc16
k = 2;
*(long *)&pakbuf[k] = -1; k += 4;
pakbuf[k++] = 0xaa;
*(unsigned short *)&pakbuf[0] = (unsigned short)k;
*(unsigned short *)&pakbuf[k] = getcrc16(pakbuf,k); k += 2;
netsend(connecthead,pakbuf,k);
}
}
return 1;
return 1;
}
void initmultiplayers (long argc, char **argv, char damultioption, char dacomrateoption, char dapriority)
{
long i, j, k, otims;
long i, j, k, otims;
if (initmultiplayersparms(argc,argv))
{
if (initmultiplayersparms(argc,argv))
{
#if 0
//Console code seems to crash Win98 upon quitting game
//it's not necessary and it's not portable anyway
char tbuf[1024];
unsigned long u;
HANDLE hconsout;
AllocConsole();
SetConsoleTitle("Multiplayer status...");
hconsout = GetStdHandle(STD_OUTPUT_HANDLE);
otims = 0;
//Console code seems to crash Win98 upon quitting game
//it's not necessary and it's not portable anyway
char tbuf[1024];
unsigned long u;
HANDLE hconsout;
AllocConsole();
SetConsoleTitle("Multiplayer status...");
hconsout = GetStdHandle(STD_OUTPUT_HANDLE);
otims = 0;
#endif
while (initmultiplayerscycle())
{
while (initmultiplayerscycle())
{
#if 0
if ((tims < otims) || (tims > otims+100))
{
otims = tims;
sprintf(tbuf,"\rWait for players (%d/%d): ",myconnectindex,numplayers);
for(i=0;i<numplayers;i++)
{
if (i == myconnectindex) { strcat(tbuf,"<me> "); continue; }
if (!otherip[i]) { strcat(tbuf,"?.?.?.?:? "); continue; }
sprintf(&tbuf[strlen(tbuf)],"%d.%d.%d.%d:%04x ",otherip[i]&255,(otherip[i]>>8)&255,(otherip[i]>>16)&255,(((unsigned long)otherip[i])>>24),otherport[i]);
}
WriteConsole(hconsout,tbuf,strlen(tbuf),&u,0);
}
}
FreeConsole();
if ((tims < otims) || (tims > otims+100))
{
otims = tims;
sprintf(tbuf,"\rWait for players (%d/%d): ",myconnectindex,numplayers);
for(i=0;i<numplayers;i++)
{
if (i == myconnectindex) { strcat(tbuf,"<me> "); continue; }
if (!otherip[i]) { strcat(tbuf,"?.?.?.?:? "); continue; }
sprintf(&tbuf[strlen(tbuf)],"%d.%d.%d.%d:%04x ",otherip[i]&255,(otherip[i]>>8)&255,(otherip[i]>>16)&255,(((unsigned long)otherip[i])>>24),otherport[i]);
}
WriteConsole(hconsout,tbuf,strlen(tbuf),&u,0);
}
}
FreeConsole();
#else
}
}
#endif
}
netready = 1;
}
netready = 1;
}
void dosendpackets (long other)
{
long i, j, k;
long i, j, k;
if (!otherip[other]) return;
if (!otherip[other]) return;
//Packet format:
// short crc16ofs; //offset of crc16
// long icnt0; //earliest unacked packet
// char ibits[32]; //ack status of packets icnt0<=i<icnt0+256
// while (short leng) //leng: !=0 for packet, 0 for no more packets
// {
// long ocnt; //index of following packet data
// char pak[leng]; //actual packet data :)
// }
// unsigned short crc16; //CRC16 of everything except crc16
//Packet format:
// short crc16ofs; //offset of crc16
// long icnt0; //earliest unacked packet
// char ibits[32]; //ack status of packets icnt0<=i<icnt0+256
// while (short leng) //leng: !=0 for packet, 0 for no more packets
// {
// long ocnt; //index of following packet data
// char pak[leng]; //actual packet data :)
// }
// unsigned short crc16; //CRC16 of everything except crc16
tims = GetTickCount();
if (tims < lastsendtims[other]) lastsendtims[other] = tims;
if (tims < lastsendtims[other]+1000/PAKRATE) return;
lastsendtims[other] = tims;
tims = GetTickCount();
if (tims < lastsendtims[other]) lastsendtims[other] = tims;
if (tims < lastsendtims[other]+1000/PAKRATE) return;
lastsendtims[other] = tims;
k = 2;
*(long *)&pakbuf[k] = icnt0[other]; k += 4;
memset(&pakbuf[k],0,32);
for(i=icnt0[other];i<icnt0[other]+256;i++)
if (ipak[other][i&(FIFSIZ-1)])
pakbuf[((i-icnt0[other])>>3)+k] |= (1<<((i-icnt0[other])&7));
k += 32;
k = 2;
*(long *)&pakbuf[k] = icnt0[other]; k += 4;
memset(&pakbuf[k],0,32);
for(i=icnt0[other];i<icnt0[other]+256;i++)
if (ipak[other][i&(FIFSIZ-1)])
pakbuf[((i-icnt0[other])>>3)+k] |= (1<<((i-icnt0[other])&7));
k += 32;
while ((ocnt0[other] < ocnt1[other]) && (!opak[other][ocnt0[other]&(FIFSIZ-1)])) ocnt0[other]++;
for(i=ocnt0[other];i<ocnt1[other];i++)
{
j = *(short *)&pakmem[opak[other][i&(FIFSIZ-1)]]; if (!j) continue; //packet already acked
if (k+6+j+4 > (long)sizeof(pakbuf)) break;
while ((ocnt0[other] < ocnt1[other]) && (!opak[other][ocnt0[other]&(FIFSIZ-1)])) ocnt0[other]++;
for(i=ocnt0[other];i<ocnt1[other];i++)
{
j = *(short *)&pakmem[opak[other][i&(FIFSIZ-1)]]; if (!j) continue; //packet already acked
if (k+6+j+4 > (long)sizeof(pakbuf)) break;
*(unsigned short *)&pakbuf[k] = (unsigned short)j; k += 2;
*(long *)&pakbuf[k] = i; k += 4;
memcpy(&pakbuf[k],&pakmem[opak[other][i&(FIFSIZ-1)]+2],j); k += j;
}
*(unsigned short *)&pakbuf[k] = 0; k += 2;
*(unsigned short *)&pakbuf[0] = (unsigned short)k;
*(unsigned short *)&pakbuf[k] = getcrc16(pakbuf,k); k += 2;
*(unsigned short *)&pakbuf[k] = (unsigned short)j; k += 2;
*(long *)&pakbuf[k] = i; k += 4;
memcpy(&pakbuf[k],&pakmem[opak[other][i&(FIFSIZ-1)]+2],j); k += j;
}
*(unsigned short *)&pakbuf[k] = 0; k += 2;
*(unsigned short *)&pakbuf[0] = (unsigned short)k;
*(unsigned short *)&pakbuf[k] = getcrc16(pakbuf,k); k += 2;
//printf("Send: "); for(i=0;i<k;i++) printf("%02x ",pakbuf[i]); printf("\n");
netsend(other,pakbuf,k);
//printf("Send: "); for(i=0;i<k;i++) printf("%02x ",pakbuf[i]); printf("\n");
netsend(other,pakbuf,k);
}
void sendpacket (long other, char *bufptr, long messleng)
{
long i, j;
long i, j;
if (numplayers < 2) return;
if (numplayers < 2) return;
if (pakmemi+messleng+2 > (long)sizeof(pakmem)) pakmemi = 1;
opak[other][ocnt1[other]&(FIFSIZ-1)] = pakmemi;
*(short *)&pakmem[pakmemi] = messleng;
memcpy(&pakmem[pakmemi+2],bufptr,messleng); pakmemi += messleng+2;
ocnt1[other]++;
if (pakmemi+messleng+2 > (long)sizeof(pakmem)) pakmemi = 1;
opak[other][ocnt1[other]&(FIFSIZ-1)] = pakmemi;
*(short *)&pakmem[pakmemi] = messleng;
memcpy(&pakmem[pakmemi+2],bufptr,messleng); pakmemi += messleng+2;
ocnt1[other]++;
//printf("Send: "); for(i=0;i<messleng;i++) printf("%02x ",bufptr[i]); printf("\n");
//printf("Send: "); for(i=0;i<messleng;i++) printf("%02x ",bufptr[i]); printf("\n");
dosendpackets(other);
dosendpackets(other);
}
//passing bufptr == 0 enables receive&sending raw packets but does not return any received packets
//(used as hack for player collection)
//passing bufptr == 0 enables receive&sending raw packets but does not return any received packets
//(used as hack for player collection)
long getpacket (long *retother, char *bufptr)
{
long i, j, k, ic0, crc16ofs, messleng, other;
long i, j, k, ic0, crc16ofs, messleng, other;
if (numplayers < 2) return(0);
if (numplayers < 2) return(0);
if (netready)
{
for(i=connecthead;i>=0;i=connectpoint2[i])
{
if (i != myconnectindex) dosendpackets(i);
if ((!danetmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
}
if (netready)
{
for(i=connecthead;i>=0;i=connectpoint2[i])
{
if (i != myconnectindex) dosendpackets(i);
if ((!danetmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
}
while (netread(&other,pakbuf,sizeof(pakbuf)))
{
//Packet format:
// short crc16ofs; //offset of crc16
// long icnt0; //earliest unacked packet
// char ibits[32]; //ack status of packets icnt0<=i<icnt0+256
// while (short leng) //leng: !=0 for packet, 0 for no more packets
// {
// long ocnt; //index of following packet data
// char pak[leng]; //actual packet data :)
// }
// unsigned short crc16; //CRC16 of everything except crc16
k = 0;
crc16ofs = (long)(*(unsigned short *)&pakbuf[k]); k += 2;
while (netread(&other,pakbuf,sizeof(pakbuf)))
{
//Packet format:
// short crc16ofs; //offset of crc16
// long icnt0; //earliest unacked packet
// char ibits[32]; //ack status of packets icnt0<=i<icnt0+256
// while (short leng) //leng: !=0 for packet, 0 for no more packets
// {
// long ocnt; //index of following packet data
// char pak[leng]; //actual packet data :)
// }
// unsigned short crc16; //CRC16 of everything except crc16
k = 0;
crc16ofs = (long)(*(unsigned short *)&pakbuf[k]); k += 2;
//printf("Recv: "); for(i=0;i<crc16ofs+2;i++) printf("%02x ",pakbuf[i]); printf("\n");
//printf("Recv: "); for(i=0;i<crc16ofs+2;i++) printf("%02x ",pakbuf[i]); printf("\n");
if ((crc16ofs+2 <= (long)sizeof(pakbuf)) && (getcrc16(pakbuf,crc16ofs) == (*(unsigned short *)&pakbuf[crc16ofs])))
{
ic0 = *(long *)&pakbuf[k]; k += 4;
if (ic0 == -1)
{
//Slave sends 0xaa to Master at initmultiplayers() and waits for 0xab response
//Master responds to slave with 0xab whenever it receives a 0xaa - even if during game!
if ((pakbuf[k] == 0xaa) && (myconnectindex == connecthead))
{
for(other=1;other<numplayers;other++)
{
//Only send to others asking for a response
if ((otherip[other]) && ((otherip[other] != snatchip) || (otherport[other] != snatchport))) continue;
otherip[other] = snatchip;
otherport[other] = snatchport;
if ((crc16ofs+2 <= (long)sizeof(pakbuf)) && (getcrc16(pakbuf,crc16ofs) == (*(unsigned short *)&pakbuf[crc16ofs])))
{
ic0 = *(long *)&pakbuf[k]; k += 4;
if (ic0 == -1)
{
//Slave sends 0xaa to Master at initmultiplayers() and waits for 0xab response
//Master responds to slave with 0xab whenever it receives a 0xaa - even if during game!
if ((pakbuf[k] == 0xaa) && (myconnectindex == connecthead))
{
for(other=1;other<numplayers;other++)
{
//Only send to others asking for a response
if ((otherip[other]) && ((otherip[other] != snatchip) || (otherport[other] != snatchport))) continue;
otherip[other] = snatchip;
otherport[other] = snatchport;
// short crc16ofs; //offset of crc16
// long icnt0; //-1 (special packet for MMULTI.C's player collection)
// ...
// unsigned short crc16; //CRC16 of everything except crc16
k = 2;
*(long *)&pakbuf[k] = -1; k += 4;
pakbuf[k++] = 0xab;
pakbuf[k++] = (char)other;
pakbuf[k++] = (char)numplayers;
*(unsigned short *)&pakbuf[0] = (unsigned short)k;
*(unsigned short *)&pakbuf[k] = getcrc16(pakbuf,k); k += 2;
netsend(other,pakbuf,k);
break;
}
}
else if ((pakbuf[k] == 0xab) && (myconnectindex != connecthead))
{
if (((unsigned long)pakbuf[k+1] < (unsigned long)pakbuf[k+2]) &&
((unsigned long)pakbuf[k+2] < (unsigned long)MAXPLAYERS))
{
myconnectindex = (long)pakbuf[k+1];
numplayers = (long)pakbuf[k+2];
// short crc16ofs; //offset of crc16
// long icnt0; //-1 (special packet for MMULTI.C's player collection)
// ...
// unsigned short crc16; //CRC16 of everything except crc16
k = 2;
*(long *)&pakbuf[k] = -1; k += 4;
pakbuf[k++] = 0xab;
pakbuf[k++] = (char)other;
pakbuf[k++] = (char)numplayers;
*(unsigned short *)&pakbuf[0] = (unsigned short)k;
*(unsigned short *)&pakbuf[k] = getcrc16(pakbuf,k); k += 2;
netsend(other,pakbuf,k);
break;
}
}
else if ((pakbuf[k] == 0xab) && (myconnectindex != connecthead))
{
if (((unsigned long)pakbuf[k+1] < (unsigned long)pakbuf[k+2]) &&
((unsigned long)pakbuf[k+2] < (unsigned long)MAXPLAYERS))
{
myconnectindex = (long)pakbuf[k+1];
numplayers = (long)pakbuf[k+2];
connecthead = 0;
for(i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
connectpoint2[numplayers-1] = -1;
connecthead = 0;
for(i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
connectpoint2[numplayers-1] = -1;
otherip[connecthead] = snatchip;
otherport[connecthead] = snatchport;
netready = 1;
}
}
}
else
{
if (ocnt0[other] < ic0) ocnt0[other] = ic0;
for(i=ic0;i<min(ic0+256,ocnt1[other]);i++)
if (pakbuf[((i-ic0)>>3)+k]&(1<<((i-ic0)&7)))
opak[other][i&(FIFSIZ-1)] = 0;
k += 32;
otherip[connecthead] = snatchip;
otherport[connecthead] = snatchport;
netready = 1;
}
}
}
else
{
if (ocnt0[other] < ic0) ocnt0[other] = ic0;
for(i=ic0;i<min(ic0+256,ocnt1[other]);i++)
if (pakbuf[((i-ic0)>>3)+k]&(1<<((i-ic0)&7)))
opak[other][i&(FIFSIZ-1)] = 0;
k += 32;
messleng = (long)(*(unsigned short *)&pakbuf[k]); k += 2;
while (messleng)
{
j = *(long *)&pakbuf[k]; k += 4;
if ((j >= icnt0[other]) && (!ipak[other][j&(FIFSIZ-1)]))
{
if (pakmemi+messleng+2 > (long)sizeof(pakmem)) pakmemi = 1;
ipak[other][j&(FIFSIZ-1)] = pakmemi;
*(short *)&pakmem[pakmemi] = messleng;
memcpy(&pakmem[pakmemi+2],&pakbuf[k],messleng); pakmemi += messleng+2;
}
k += messleng;
messleng = (long)(*(unsigned short *)&pakbuf[k]); k += 2;
}
}
}
}
messleng = (long)(*(unsigned short *)&pakbuf[k]); k += 2;
while (messleng)
{
j = *(long *)&pakbuf[k]; k += 4;
if ((j >= icnt0[other]) && (!ipak[other][j&(FIFSIZ-1)]))
{
if (pakmemi+messleng+2 > (long)sizeof(pakmem)) pakmemi = 1;
ipak[other][j&(FIFSIZ-1)] = pakmemi;
*(short *)&pakmem[pakmemi] = messleng;
memcpy(&pakmem[pakmemi+2],&pakbuf[k],messleng); pakmemi += messleng+2;
}
k += messleng;
messleng = (long)(*(unsigned short *)&pakbuf[k]); k += 2;
}
}
}
}
//Return next valid packet from any player
if (!bufptr) return(0);
for(i=connecthead;i>=0;i=connectpoint2[i])
{
if (i != myconnectindex)
{
j = ipak[i][icnt0[i]&(FIFSIZ-1)];
if (j)
{
messleng = *(short *)&pakmem[j]; memcpy(bufptr,&pakmem[j+2],messleng);
*retother = i; ipak[i][icnt0[i]&(FIFSIZ-1)] = 0; icnt0[i]++;
//printf("Recv: "); for(i=0;i<messleng;i++) printf("%02x ",bufptr[i]); printf("\n");
return(messleng);
}
}
if ((!danetmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
//Return next valid packet from any player
if (!bufptr) return(0);
for(i=connecthead;i>=0;i=connectpoint2[i])
{
if (i != myconnectindex)
{
j = ipak[i][icnt0[i]&(FIFSIZ-1)];
if (j)
{
messleng = *(short *)&pakmem[j]; memcpy(bufptr,&pakmem[j+2],messleng);
*retother = i; ipak[i][icnt0[i]&(FIFSIZ-1)] = 0; icnt0[i]++;
//printf("Recv: "); for(i=0;i<messleng;i++) printf("%02x ",bufptr[i]); printf("\n");
return(messleng);
}
}
if ((!danetmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
return(0);
return(0);
}

View file

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

File diff suppressed because it is too large Load diff

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)
{
long *p = (long*)d;
while ((c--) > 0) *(p++) = a;
long *p = (long*)d;
while ((c--) > 0) *(p++) = a;
}
void copybuf(void *s, void *d, long c)
{
long *p = (long*)s, *q = (long*)d;
while ((c--) > 0) *(q++) = *(p++);
long *p = (long*)s, *q = (long*)d;
while ((c--) > 0) *(q++) = *(p++);
}
void swapbuf4(void *a, void *b, long c)
{
long *p = (long*)a, *q = (long*)b;
long x, y;
while ((c--) > 0) {
x = *q;
y = *p;
*(q++) = y;
*(p++) = x;
}
long *p = (long*)a, *q = (long*)b;
long x, y;
while ((c--) > 0) {
x = *q;
y = *p;
*(q++) = y;
*(p++) = x;
}
}
void clearbufbyte(void *D, long c, long a)
{ // Cringe City
char *p = (char*)D;
long m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l };
long n[4] = { 0,8,16,24 };
long z=0;
while ((c--) > 0) {
*(p++) = (char)((a & m[z])>>n[z]);
z=(z+1)&3;
}
char *p = (char*)D;
long m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l };
long n[4] = { 0,8,16,24 };
long z=0;
while ((c--) > 0) {
*(p++) = (char)((a & m[z])>>n[z]);
z=(z+1)&3;
}
}
void copybufbyte(void *S, void *D, long c)
{
char *p = (char*)S, *q = (char*)D;
while((c--) > 0) *(q++) = *(p++);
char *p = (char*)S, *q = (char*)D;
while((c--) > 0) *(q++) = *(p++);
}
void copybufreverse(void *S, void *D, long c)
{
char *p = (char*)S, *q = (char*)D;
while((c--) > 0) *(q++) = *(p--);
char *p = (char*)S, *q = (char*)D;
while((c--) > 0) *(q++) = *(p--);
}
#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)
{
ASM (
"imull %%ebx\n\t"
"movl %%edx, %%ebx\n\t" // mov ebx, edx
"shrdl %%cl, %%edx, %%eax\n\t" // mov eax, edx, cl
"sarl %%cl, %%edx\n\t" // sar edx, cl
"xorl %%eax, %%edx\n\t" // xor edx, eax
"js 0f\n\t" // js checkit
"xorl %%eax, %%edx\n\t" // xor edx, eax
"jz 1f\n\t" // js skipboundit
"cmpl $0xffffffff, %%edx\n\t" // cmp edx, 0xffffffff
"je 1f\n\t" // je skipboundit
"0:\n\t" // checkit:
"movl %%ebx, %%eax\n\t" // mov eax, ebx
"sarl $31, %%eax\n\t" // sar eax, 31
"xorl $0x7fffffff, %%eax\n\t" // xor eax, 0x7fffffff
"1:" // skipboundit:
: "+a" (a), "+b" (b), "+c" (c) // input eax ebx ecx
:
: "edx", "cc"
);
return a;
ASM (
"imull %%ebx\n\t"
"movl %%edx, %%ebx\n\t" // mov ebx, edx
"shrdl %%cl, %%edx, %%eax\n\t" // mov eax, edx, cl
"sarl %%cl, %%edx\n\t" // sar edx, cl
"xorl %%eax, %%edx\n\t" // xor edx, eax
"js 0f\n\t" // js checkit
"xorl %%eax, %%edx\n\t" // xor edx, eax
"jz 1f\n\t" // js skipboundit
"cmpl $0xffffffff, %%edx\n\t" // cmp edx, 0xffffffff
"je 1f\n\t" // je skipboundit
"0:\n\t" // checkit:
"movl %%ebx, %%eax\n\t" // mov eax, ebx
"sarl $31, %%eax\n\t" // sar eax, 31
"xorl $0x7fffffff, %%eax\n\t" // xor eax, 0x7fffffff
"1:" // skipboundit:
: "+a" (a), "+b" (b), "+c" (c) // input eax ebx ecx
:
: "edx", "cc"
);
return a;
}
void clearbufbyte(void *D, long c, long a)
{
ASM (
"cmpl $4, %%ecx\n\t"
"jae 1f\n\t"
"testb $1, %%cl\n\t"
"jz 0f\n\t" // jz preskip
"stosb\n\t"
"0:\n\t" // preskip:
"shrl $1, %%ecx\n\t"
"rep\n\t"
"stosw\n\t"
"jmp 5f\n\t" // jmp endit
"1:\n\t" // intcopy:
"testl $1, %%edi\n\t"
"jz 2f\n\t" // jz skip1
"stosb\n\t"
"decl %%ecx\n\t"
"2:\n\t" // skip1:
"testl $2, %%edi\n\t"
"jz 3f\n\t" // jz skip2
"stosw\n\t"
"subl $2, %%ecx\n\t"
"3:\n\t" // skip2:
"movl %%ecx, %%ebx\n\t"
"shrl $2, %%ecx\n\t"
"rep\n\t"
"stosl\n\t"
"testb $2, %%bl\n\t"
"jz 4f\n\t" // jz skip3
"stosw\n\t"
"4:\n\t" // skip3:
"testb $1, %%bl\n\t"
"jz 5f\n\t" // jz endit
"stosb\n\t"
"5:" // endit
: "+D" (D), "+c" (c), "+a" (a) :
: "ebx", "memory", "cc"
);
ASM (
"cmpl $4, %%ecx\n\t"
"jae 1f\n\t"
"testb $1, %%cl\n\t"
"jz 0f\n\t" // jz preskip
"stosb\n\t"
"0:\n\t" // preskip:
"shrl $1, %%ecx\n\t"
"rep\n\t"
"stosw\n\t"
"jmp 5f\n\t" // jmp endit
"1:\n\t" // intcopy:
"testl $1, %%edi\n\t"
"jz 2f\n\t" // jz skip1
"stosb\n\t"
"decl %%ecx\n\t"
"2:\n\t" // skip1:
"testl $2, %%edi\n\t"
"jz 3f\n\t" // jz skip2
"stosw\n\t"
"subl $2, %%ecx\n\t"
"3:\n\t" // skip2:
"movl %%ecx, %%ebx\n\t"
"shrl $2, %%ecx\n\t"
"rep\n\t"
"stosl\n\t"
"testb $2, %%bl\n\t"
"jz 4f\n\t" // jz skip3
"stosw\n\t"
"4:\n\t" // skip3:
"testb $1, %%bl\n\t"
"jz 5f\n\t" // jz endit
"stosb\n\t"
"5:" // endit
: "+D" (D), "+c" (c), "+a" (a) :
: "ebx", "memory", "cc"
);
}
void copybufbyte(void *S, void *D, long c)
{
ASM (
"cmpl $4, %%ecx\n\t" // cmp ecx, 4
"jae 1f\n\t"
"testb $1, %%cl\n\t" // test cl, 1
"jz 0f\n\t"
"movsb\n\t"
"0:\n\t" // preskip:
"shrl $1, %%ecx\n\t" // shr ecx, 1
"rep\n\t"
"movsw\n\t"
"jmp 5f\n\t"
"1:\n\t" // intcopy:
"testl $1, %%edi\n\t" // test edi, 1
"jz 2f\n\t"
"movsb\n\t"
"decl %%ecx\n\t"
"2:\n\t" // skip1:
"testl $2, %%edi\n\t" // test edi, 2
"jz 3f\n\t"
"movsw\n\t"
"subl $2, %%ecx\n\t" // sub ecx, 2
"3:\n\t" // skip2:
"movl %%ecx, %%ebx\n\t" // mov ebx, ecx
"shrl $2, %%ecx\n\t" // shr ecx ,2
"rep\n\t"
"movsl\n\t"
"testb $2, %%bl\n\t" // test bl, 2
"jz 4f\n\t"
"movsw\n\t"
"4:\n\t" // skip3:
"testb $1, %%bl\n\t" // test bl, 1
"jz 5f\n\t"
"movsb\n\t"
"5:" // endit:
: "+c" (c), "+S" (S), "+D" (D) :
: "ebx", "memory", "cc"
);
ASM (
"cmpl $4, %%ecx\n\t" // cmp ecx, 4
"jae 1f\n\t"
"testb $1, %%cl\n\t" // test cl, 1
"jz 0f\n\t"
"movsb\n\t"
"0:\n\t" // preskip:
"shrl $1, %%ecx\n\t" // shr ecx, 1
"rep\n\t"
"movsw\n\t"
"jmp 5f\n\t"
"1:\n\t" // intcopy:
"testl $1, %%edi\n\t" // test edi, 1
"jz 2f\n\t"
"movsb\n\t"
"decl %%ecx\n\t"
"2:\n\t" // skip1:
"testl $2, %%edi\n\t" // test edi, 2
"jz 3f\n\t"
"movsw\n\t"
"subl $2, %%ecx\n\t" // sub ecx, 2
"3:\n\t" // skip2:
"movl %%ecx, %%ebx\n\t" // mov ebx, ecx
"shrl $2, %%ecx\n\t" // shr ecx ,2
"rep\n\t"
"movsl\n\t"
"testb $2, %%bl\n\t" // test bl, 2
"jz 4f\n\t"
"movsw\n\t"
"4:\n\t" // skip3:
"testb $1, %%bl\n\t" // test bl, 1
"jz 5f\n\t"
"movsb\n\t"
"5:" // endit:
: "+c" (c), "+S" (S), "+D" (D) :
: "ebx", "memory", "cc"
);
}
void copybufreverse(void *S, void *D, long c)
{
ASM (
"shrl $1, %%ecx\n\t"
"jnc 0f\n\t" // jnc skipit1
"movb (%%esi), %%al\n\t"
"decl %%esi\n\t"
"movb %%al, (%%edi)\n\t"
"incl %%edi\n\t"
"0:\n\t" // skipit1:
"shrl $1, %%ecx\n\t"
"jnc 1f\n\t" // jnc skipit2
"movw -1(%%esi), %%ax\n\t"
"subl $2, %%esi\n\t"
"rorw $8, %%ax\n\t"
"movw %%ax, (%%edi)\n\t"
"addl $2, %%edi\n\t"
"1:\n\t" // skipit2
"testl %%ecx, %%ecx\n\t"
"jz 3f\n\t" // jz endloop
"2:\n\t" // begloop
"movl -3(%%esi), %%eax\n\t"
"subl $4, %%esi\n\t"
"bswapl %%eax\n\t"
"movl %%eax, (%%edi)\n\t"
"addl $4, %%edi\n\t"
"decl %%ecx\n\t"
"jnz 2b\n\t" // jnz begloop
"3:"
: "+S" (S), "+D" (D), "+c" (c) :
: "eax", "memory", "cc"
);
ASM (
"shrl $1, %%ecx\n\t"
"jnc 0f\n\t" // jnc skipit1
"movb (%%esi), %%al\n\t"
"decl %%esi\n\t"
"movb %%al, (%%edi)\n\t"
"incl %%edi\n\t"
"0:\n\t" // skipit1:
"shrl $1, %%ecx\n\t"
"jnc 1f\n\t" // jnc skipit2
"movw -1(%%esi), %%ax\n\t"
"subl $2, %%esi\n\t"
"rorw $8, %%ax\n\t"
"movw %%ax, (%%edi)\n\t"
"addl $2, %%edi\n\t"
"1:\n\t" // skipit2
"testl %%ecx, %%ecx\n\t"
"jz 3f\n\t" // jz endloop
"2:\n\t" // begloop
"movl -3(%%esi), %%eax\n\t"
"subl $4, %%esi\n\t"
"bswapl %%eax\n\t"
"movl %%eax, (%%edi)\n\t"
"addl $4, %%edi\n\t"
"decl %%ecx\n\t"
"jnz 2b\n\t" // jnz begloop
"3:"
: "+S" (S), "+D" (D), "+c" (c) :
: "eax", "memory", "cc"
);
}
#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 *start;
char *start;
skipoverws(sf);
if (sf->textptr >= sf->eof) return NULL;
skipoverws(sf);
if (sf->textptr >= sf->eof) return NULL;
start = sf->ltextptr = sf->textptr;
skipovertoken(sf);
return start;
start = sf->ltextptr = sf->textptr;
skipovertoken(sf);
return start;
}
int scriptfile_getstring(scriptfile *sf, char **retst)
{
(*retst) = scriptfile_gettoken(sf);
if (*retst == NULL)
{
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return(-2);
}
return(0);
(*retst) = scriptfile_gettoken(sf);
if (*retst == NULL)
{
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return(-2);
}
return(0);
}
int scriptfile_getnumber(scriptfile *sf, int *num)
{
skipoverws(sf);
if (sf->textptr >= sf->eof)
{
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1;
}
skipoverws(sf);
if (sf->textptr >= sf->eof)
{
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1;
}
while ((sf->textptr[0] == '0') && (sf->textptr[1] >= '0') && (sf->textptr[1] <= '9'))
sf->textptr++; //hack to treat octal numbers like decimal
while ((sf->textptr[0] == '0') && (sf->textptr[1] >= '0') && (sf->textptr[1] <= '9'))
sf->textptr++; //hack to treat octal numbers like decimal
sf->ltextptr = sf->textptr;
(*num) = strtol((const char *)sf->textptr,&sf->textptr,0);
if (!ISWS(*sf->textptr) && *sf->textptr) {
char *p = sf->textptr;
skipovertoken(sf);
initprintf("Error on line %s:%d: expecting int, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p);
return -2;
}
return 0;
sf->ltextptr = sf->textptr;
(*num) = strtol((const char *)sf->textptr,&sf->textptr,0);
if (!ISWS(*sf->textptr) && *sf->textptr) {
char *p = sf->textptr;
skipovertoken(sf);
initprintf("Error on line %s:%d: expecting int, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p);
return -2;
}
return 0;
}
static double parsedouble(char *ptr, char **end)
{
int beforedecimal = 1, negative = 0, dig;
int exposgn = 0, expo = 0;
double num = 0.0, decpl = 0.1;
char *p;
int beforedecimal = 1, negative = 0, dig;
int exposgn = 0, expo = 0;
double num = 0.0, decpl = 0.1;
char *p;
p = ptr;
if (*p == '-') negative = 1, p++;
else if (*p == '+') p++;
for (;; p++) {
if (*p >= '0' && *p <= '9') {
dig = *p - '0';
if (beforedecimal) num = num * 10.0 + dig;
else if (exposgn) expo = expo*10 + dig;
else {
num += (double)dig * decpl;
decpl /= 10.0;
}
} else if (*p == '.') {
if (beforedecimal) beforedecimal = 0;
else break;
} else if ((*p == 'E') || (*p == 'e')) {
exposgn = 1;
if (p[1] == '-') { exposgn = -1; p++; }
else if (p[1] == '+') p++;
} else break;
}
p = ptr;
if (*p == '-') negative = 1, p++;
else if (*p == '+') p++;
for (;; p++) {
if (*p >= '0' && *p <= '9') {
dig = *p - '0';
if (beforedecimal) num = num * 10.0 + dig;
else if (exposgn) expo = expo*10 + dig;
else {
num += (double)dig * decpl;
decpl /= 10.0;
}
} else if (*p == '.') {
if (beforedecimal) beforedecimal = 0;
else break;
} else if ((*p == 'E') || (*p == 'e')) {
exposgn = 1;
if (p[1] == '-') { exposgn = -1; p++; }
else if (p[1] == '+') p++;
} else break;
}
if (end) *end = p;
if (exposgn) num *= pow(10.0,(double)(expo*exposgn));
return negative ? -num : num;
if (end) *end = p;
if (exposgn) num *= pow(10.0,(double)(expo*exposgn));
return negative ? -num : num;
}
int scriptfile_getdouble(scriptfile *sf, double *num)
{
skipoverws(sf);
if (sf->textptr >= sf->eof)
{
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1;
}
skipoverws(sf);
if (sf->textptr >= sf->eof)
{
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1;
}
sf->ltextptr = sf->textptr;
sf->ltextptr = sf->textptr;
// On Linux, locale settings interfere with interpreting x.y format numbers
//(*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);
(*num) = parsedouble(sf->textptr, &sf->textptr);
if (!ISWS(*sf->textptr) && *sf->textptr) {
char *p = sf->textptr;
skipovertoken(sf);
initprintf("Error on line %s:%d: expecting float, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p);
return -2;
}
return 0;
if (!ISWS(*sf->textptr) && *sf->textptr) {
char *p = sf->textptr;
skipovertoken(sf);
initprintf("Error on line %s:%d: expecting float, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p);
return -2;
}
return 0;
}
int scriptfile_getsymbol(scriptfile *sf, int *num)
{
char *t, *e;
int v;
char *t, *e;
int v;
t = scriptfile_gettoken(sf);
if (!t) return -1;
t = scriptfile_gettoken(sf);
if (!t) return -1;
v = Bstrtol(t, &e, 10);
if (*e) {
// looks like a string, so find it in the symbol table
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);
return -2; // not found
}
v = Bstrtol(t, &e, 10);
if (*e) {
// looks like a string, so find it in the symbol table
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);
return -2; // not found
}
*num = v;
return 0;
*num = v;
return 0;
}
int scriptfile_getbraces(scriptfile *sf, char **braceend)
{
int bracecnt;
char *bracestart;
int bracecnt;
char *bracestart;
skipoverws(sf);
if (sf->textptr >= sf->eof)
{
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1;
}
skipoverws(sf);
if (sf->textptr >= sf->eof)
{
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1;
}
if (sf->textptr[0] != '{') {
initprintf("Error on line %s:%d: expecting '{'\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1;
}
bracestart = ++sf->textptr; bracecnt = 1;
while (1)
{
if (sf->textptr >= sf->eof) return(0);
if (sf->textptr[0] == '{') bracecnt++;
if (sf->textptr[0] == '}') { bracecnt--; if (!bracecnt) break; }
sf->textptr++;
}
(*braceend) = sf->textptr;
sf->textptr = bracestart;
return 0;
if (sf->textptr[0] != '{') {
initprintf("Error on line %s:%d: expecting '{'\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return -1;
}
bracestart = ++sf->textptr; bracecnt = 1;
while (1)
{
if (sf->textptr >= sf->eof) return(0);
if (sf->textptr[0] == '{') bracecnt++;
if (sf->textptr[0] == '}') { bracecnt--; if (!bracecnt) break; }
sf->textptr++;
}
(*braceend) = sf->textptr;
sf->textptr = bracestart;
return 0;
}
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(i=0;stp;stp>>=1)
if ((i+stp < sf->linenum) && (sf->lineoffs[i+stp] < ind)) i += stp;
return(i+1); //i = index to highest lineoffs which is less than ind; convert to 1-based line numbers
for(stp=1;stp+stp<sf->linenum;stp+=stp); //stp = highest power of 2 less than sf->linenum
for(i=0;stp;stp>>=1)
if ((i+stp < sf->linenum) && (sf->lineoffs[i+stp] < ind)) i += stp;
return(i+1); //i = index to highest lineoffs which is less than ind; convert to 1-based line numbers
}
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
numcr = 1;
for(i=0;i<flen;i++)
{
//detect all 4 types of carriage return (\r, \n, \r\n, \n\r :)
cr=0;if (tx[i] == '\r') { i += (tx[i+1] == '\n'); cr = 1; }
else if (tx[i] == '\n') { i += (tx[i+1] == '\r'); cr = 1; }
if (cr) { numcr++; continue; }
}
//Count number of lines
numcr = 1;
for(i=0;i<flen;i++)
{
//detect all 4 types of carriage return (\r, \n, \r\n, \n\r :)
cr=0;if (tx[i] == '\r') { i += (tx[i+1] == '\n'); cr = 1; }
else if (tx[i] == '\n') { i += (tx[i+1] == '\r'); cr = 1; }
if (cr) { numcr++; continue; }
}
sf->linenum = numcr;
sf->lineoffs = (long *)malloc(sf->linenum*sizeof(long));
sf->linenum = numcr;
sf->lineoffs = (long *)malloc(sf->linenum*sizeof(long));
//Preprocess file for comments (// and /*...*/, and convert all whitespace to single spaces)
nflen = 0; ws = 0; cs = 0; numcr = 0; inquote = 0;
for(i=0;i<flen;i++)
{
//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; }
else if (tx[i] == '\n') { i += (tx[i+1] == '\r'); cr = 1; }
if (cr)
{
//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 :)
sf->lineoffs[numcr++] = nflen;
if (cs == 1) cs = 0;
ws = 1; continue; //strip CR/LF
}
//Preprocess file for comments (// and /*...*/, and convert all whitespace to single spaces)
nflen = 0; ws = 0; cs = 0; numcr = 0; inquote = 0;
for(i=0;i<flen;i++)
{
//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; }
else if (tx[i] == '\n') { i += (tx[i+1] == '\r'); cr = 1; }
if (cr)
{
//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 :)
sf->lineoffs[numcr++] = nflen;
if (cs == 1) cs = 0;
ws = 1; continue; //strip CR/LF
}
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)) { ws = 1; cs = 2; }
if ((tx[i] == '*') && (tx[i+1] == '/') && (cs == 2)) { cs = 0; i++; continue; }
if (cs) continue;
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)) { ws = 1; cs = 2; }
if ((tx[i] == '*') && (tx[i+1] == '/') && (cs == 2)) { cs = 0; i++; continue; }
if (cs) continue;
if (ws) { tx[nflen++] = 0; ws = 0; }
if (ws) { tx[nflen++] = 0; ws = 0; }
//quotes inside strings: \"
if ((tx[i] == '\\') && (tx[i+1] == '\"')) { i++; tx[nflen++] = '\"'; continue; }
if (tx[i] == '\"') { inquote ^= 1; continue; }
tx[nflen++] = tx[i];
}
tx[nflen++] = 0; sf->lineoffs[numcr] = nflen;
tx[nflen++] = 0;
//quotes inside strings: \"
if ((tx[i] == '\\') && (tx[i+1] == '\"')) { i++; tx[nflen++] = '\"'; continue; }
if (tx[i] == '\"') { inquote ^= 1; continue; }
tx[nflen++] = tx[i];
}
tx[nflen++] = 0; sf->lineoffs[numcr] = nflen;
tx[nflen++] = 0;
#if 0
//for debugging only:
printf("pre-parsed file:flen=%d,nflen=%d\n",flen,nflen);
for(i=0;i<nflen;i++) { if (tx[i] < 32) printf("_"); else printf("%c",tx[i]); }
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 debugging only:
printf("pre-parsed file:flen=%d,nflen=%d\n",flen,nflen);
for(i=0;i<nflen;i++) { if (tx[i] < 32) printf("_"); else printf("%c",tx[i]); }
printf("[eof]\nnumlines=%d\n",sf->linenum);
for(i=0;i<sf->linenum;i++) printf("line %d = byte %d\n",i,sf->lineoffs[i]);
#endif
flen = nflen;
flen = nflen;
sf->textbuf = sf->textptr = tx;
sf->textlength = nflen;
sf->eof = &sf->textbuf[nflen-1];
sf->textbuf = sf->textptr = tx;
sf->textlength = nflen;
sf->eof = &sf->textbuf[nflen-1];
}
scriptfile *scriptfile_fromfile(char *fn)
{
int fp;
scriptfile *sf;
char *tx;
unsigned int flen;
int fp;
scriptfile *sf;
char *tx;
unsigned int flen;
fp = kopen4load(fn,0);
if (fp<0) return NULL;
fp = kopen4load(fn,0);
if (fp<0) return NULL;
flen = kfilelength(fp);
tx = (char *) malloc(flen + 2);
if (!tx) {
kclose(fp);
return NULL;
}
flen = kfilelength(fp);
tx = (char *) malloc(flen + 2);
if (!tx) {
kclose(fp);
return NULL;
}
sf = (scriptfile*) malloc(sizeof(scriptfile));
if (!sf) {
kclose(fp);
free(tx);
return NULL;
}
sf = (scriptfile*) malloc(sizeof(scriptfile));
if (!sf) {
kclose(fp);
free(tx);
return NULL;
}
kread(fp, tx, flen);
tx[flen] = tx[flen+1] = 0;
kread(fp, tx, flen);
tx[flen] = tx[flen+1] = 0;
kclose(fp);
kclose(fp);
scriptfile_preparse(sf,tx,flen);
sf->filename = strdup(fn);
scriptfile_preparse(sf,tx,flen);
sf->filename = strdup(fn);
return sf;
return sf;
}
scriptfile *scriptfile_fromstring(char *string)
{
scriptfile *sf;
char *tx;
unsigned int flen;
scriptfile *sf;
char *tx;
unsigned int flen;
if (!string) return NULL;
if (!string) return NULL;
flen = strlen(string);
flen = strlen(string);
tx = (char *) malloc(flen + 2);
if (!tx) return NULL;
tx = (char *) malloc(flen + 2);
if (!tx) return NULL;
sf = (scriptfile*) malloc(sizeof(scriptfile));
if (!sf) {
free(tx);
return NULL;
}
sf = (scriptfile*) malloc(sizeof(scriptfile));
if (!sf) {
free(tx);
return NULL;
}
memcpy(tx, string, flen);
tx[flen] = tx[flen+1] = 0;
memcpy(tx, string, flen);
tx[flen] = tx[flen+1] = 0;
scriptfile_preparse(sf,tx,flen);
sf->filename = NULL;
scriptfile_preparse(sf,tx,flen);
sf->filename = NULL;
return sf;
return sf;
}
void scriptfile_close(scriptfile *sf)
{
if (!sf) return;
if (sf->lineoffs) free(sf->lineoffs);
if (sf->textbuf) free(sf->textbuf);
if (sf->filename) free(sf->filename);
sf->textbuf = NULL;
sf->filename = NULL;
free(sf);
if (!sf) return;
if (sf->lineoffs) free(sf->lineoffs);
if (sf->textbuf) free(sf->textbuf);
if (sf->filename) free(sf->filename);
sf->textbuf = NULL;
sf->filename = NULL;
free(sf);
}
@ -328,68 +328,68 @@ static char *symbtab = NULL;
static char * getsymbtabspace(int reqd)
{
char *pos,*np;
int i;
char *pos,*np;
int i;
if (symbtablength + reqd > symbtaballoclength)
{
for(i=max(symbtaballoclength,SYMBTABSTARTSIZE);symbtablength+reqd>i;i<<=1);
np = (char *)realloc(symbtab, i); if (!np) return NULL;
symbtab = np; symbtaballoclength = i;
}
if (symbtablength + reqd > symbtaballoclength)
{
for(i=max(symbtaballoclength,SYMBTABSTARTSIZE);symbtablength+reqd>i;i<<=1);
np = (char *)realloc(symbtab, i); if (!np) return NULL;
symbtab = np; symbtaballoclength = i;
}
pos = &symbtab[symbtablength];
symbtablength += reqd;
return pos;
pos = &symbtab[symbtablength];
symbtablength += reqd;
return pos;
}
int scriptfile_getsymbolvalue(char *name, int *val)
{
char *scanner = symbtab;
char *scanner = symbtab;
if (!symbtab) return 0;
while (scanner - symbtab < symbtablength) {
if (!Bstrcasecmp(name, scanner)) {
*val = *(int*)(scanner + strlen(scanner) + 1);
return 1;
}
if (!symbtab) return 0;
while (scanner - symbtab < symbtablength) {
if (!Bstrcasecmp(name, scanner)) {
*val = *(int*)(scanner + strlen(scanner) + 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 x;
char *sp;
// if (scriptfile_getsymbolvalue(name, &x)) return -1; // already exists
int x;
char *sp;
// if (scriptfile_getsymbolvalue(name, &x)) return -1; // already exists
if (symbtab) {
char *scanner = symbtab;
while (scanner - symbtab < symbtablength) {
if (!Bstrcasecmp(name, scanner)) {
*(int*)(scanner + strlen(scanner) + 1) = val;
return 1;
}
if (symbtab) {
char *scanner = symbtab;
while (scanner - symbtab < symbtablength) {
if (!Bstrcasecmp(name, scanner)) {
*(int*)(scanner + strlen(scanner) + 1) = val;
return 1;
}
scanner += strlen(scanner) + 1 + sizeof(int);
}
}
scanner += strlen(scanner) + 1 + sizeof(int);
}
}
sp = getsymbtabspace(strlen(name) + 1 + sizeof(int));
if (!sp) return 0;
strcpy(sp, name);
sp += strlen(name)+1;
*(int*)sp = val;
return 1; // added
sp = getsymbtabspace(strlen(name) + 1 + sizeof(int));
if (!sp) return 0;
strcpy(sp, name);
sp += strlen(name)+1;
*(int*)sp = val;
return 1; // added
}
void scriptfile_clearsymbols(void)
{
if (symbtab) free(symbtab);
symbtab = NULL;
symbtablength = 0;
symbtaballoclength = 0;
if (symbtab) free(symbtab);
symbtab = NULL;
symbtablength = 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
char smalltextfont[2048] = {
// 2048 bytes
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x24,
0x3C, 0x18, 0x00, 0x00, 0x00, 0x18, 0x24, 0x3C, 0x24, 0x18, 0x00, 0x00,
0x00, 0x28, 0x3C, 0x3C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x10, 0x38, 0x3C,
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, 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, 0x1C, 0x1C, 0x14, 0x14, 0x30, 0x00, 0x00,
0x00, 0x24, 0x18, 0x3C, 0x18, 0x24, 0x00, 0x00, 0x00, 0x20, 0x30, 0x38,
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, 0x28, 0x00, 0x00, 0x00, 0x1C, 0x34, 0x34, 0x14, 0x14, 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,
0x00, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10,
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, 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, 0x00, 0x00, 0x00, 0x00, 0x28, 0x3C, 0x28, 0x3C, 0x28, 0x00, 0x00,
0x00, 0x18, 0x30, 0x10, 0x18, 0x30, 0x00, 0x00, 0x00, 0x28, 0x08, 0x10,
0x20, 0x28, 0x00, 0x00, 0x00, 0x10, 0x28, 0x10, 0x30, 0x38, 0x00, 0x00,
0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x20,
0x20, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00,
0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38,
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, 0x10, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00,
0x00, 0x38, 0x28, 0x28, 0x28, 0x38, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10,
0x10, 0x10, 0x00, 0x00, 0x00, 0x38, 0x08, 0x38, 0x20, 0x38, 0x00, 0x00,
0x00, 0x38, 0x08, 0x38, 0x08, 0x38, 0x00, 0x00, 0x00, 0x28, 0x28, 0x38,
0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x08, 0x38, 0x00, 0x00,
0x00, 0x38, 0x20, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08,
0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x28, 0x38, 0x00, 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,
0x00, 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x38, 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,
0x30, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x38, 0x28, 0x28, 0x00, 0x00,
0x00, 0x30, 0x28, 0x30, 0x28, 0x30, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20,
0x20, 0x18, 0x00, 0x00, 0x00, 0x30, 0x28, 0x28, 0x28, 0x30, 0x00, 0x00,
0x00, 0x38, 0x20, 0x30, 0x20, 0x38, 0x00, 0x00, 0x00, 0x38, 0x20, 0x30,
0x20, 0x20, 0x00, 0x00, 0x00, 0x38, 0x20, 0x28, 0x28, 0x38, 0x00, 0x00,
0x00, 0x28, 0x28, 0x38, 0x28, 0x28, 0x00, 0x00, 0x00, 0x38, 0x10, 0x10,
0x10, 0x38, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x28, 0x18, 0x00, 0x00,
0x00, 0x28, 0x28, 0x30, 0x28, 0x28, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20,
0x20, 0x38, 0x00, 0x00, 0x00, 0x28, 0x38, 0x38, 0x28, 0x28, 0x00, 0x00,
0x00, 0x28, 0x38, 0x38, 0x38, 0x28, 0x00, 0x00, 0x00, 0x38, 0x28, 0x28,
0x28, 0x38, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x20, 0x20, 0x00, 0x00,
0x00, 0x38, 0x28, 0x28, 0x38, 0x18, 0x00, 0x00, 0x00, 0x38, 0x28, 0x30,
0x28, 0x28, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x08, 0x38, 0x00, 0x00,
0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28,
0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
0x00, 0x28, 0x28, 0x38, 0x38, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x10,
0x28, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x38, 0x10, 0x10, 0x00, 0x00,
0x00, 0x38, 0x08, 0x10, 0x20, 0x38, 0x00, 0x00, 0x00, 0x30, 0x20, 0x20,
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00,
0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x28, 0x18, 0x00, 0x00, 0x00, 0x20, 0x20, 0x38, 0x28, 0x38, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x00, 0x00, 0x00, 0x08, 0x08, 0x38,
0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00,
0x00, 0x08, 0x10, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x28,
0x18, 0x08, 0x30, 0x00, 0x00, 0x20, 0x20, 0x38, 0x28, 0x28, 0x00, 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,
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x20, 0x38,
0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x28, 0x28, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
0x28, 0x38, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x08, 0x00,
0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x10, 0x30, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x00, 0x00,
0x00, 0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x28, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x18, 0x00, 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,
0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28,
0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20, 0x20, 0x18, 0x30, 0x00,
0x00, 0x28, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18,
0x38, 0x18, 0x00, 0x00, 0x00, 0x38, 0x00, 0x18, 0x28, 0x18, 0x00, 0x00,
0x00, 0x28, 0x00, 0x18, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18,
0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x28, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x10, 0x00, 0x00, 0x38, 0x00, 0x18,
0x38, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x18, 0x38, 0x18, 0x00, 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,
0x00, 0x00, 0x30, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x28, 0x10, 0x28,
0x38, 0x28, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x38, 0x28, 0x00, 0x00,
0x00, 0x18, 0x00, 0x38, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
0x28, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x28, 0x3C, 0x28, 0x2C, 0x00, 0x00,
0x00, 0x38, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x38,
0x28, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00,
0x00, 0x38, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x28,
0x28, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x28, 0x18, 0x30, 0x00,
0x00, 0x28, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28,
0x28, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x20, 0x38, 0x10, 0x00, 0x00,
0x00, 0x18, 0x14, 0x30, 0x10, 0x3C, 0x00, 0x00, 0x00, 0x28, 0x10, 0x38,
0x38, 0x10, 0x00, 0x00, 0x00, 0x30, 0x28, 0x3C, 0x28, 0x2C, 0x00, 0x00,
0x00, 0x18, 0x10, 0x38, 0x10, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18,
0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x10, 0x10, 0x00, 0x00,
0x00, 0x18, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x18, 0x00, 0x28,
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, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x38, 0x00, 0x00,
0x00, 0x10, 0x00, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x00, 0x00, 0x00,
0x00, 0x20, 0x28, 0x10, 0x38, 0x18, 0x00, 0x00, 0x00, 0x20, 0x28, 0x18,
0x38, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0x14, 0x28, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x14,
0x28, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x00,
0x00, 0x14, 0x28, 0x14, 0x28, 0x14, 0x28, 0x00, 0x00, 0x34, 0x1C, 0x34,
0x1C, 0x34, 0x1C, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00,
0x00, 0x10, 0x10, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x30,
0x30, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x00,
0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x30,
0x30, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x38, 0x38, 0x18, 0x18, 0x00,
0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x38,
0x38, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x38, 0x38, 0x00, 0x00, 0x00,
0x00, 0x18, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x30,
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x10, 0x10, 0x10, 0x00,
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, 0x10, 0x10, 0x1C, 0x1C, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x1C,
0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x1C, 0x1C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1C, 0x1C, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x3C,
0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x18, 0x18, 0x00,
0x00, 0x18, 0x18, 0x1C, 0x1C, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3C,
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, 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, 0x00, 0x00, 0x10, 0x10, 0x1C, 0x1C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1C, 0x1C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1C,
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x10, 0x10, 0x10, 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,
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, 0x30, 0x28, 0x30, 0x28, 0x30, 0x20, 0x00, 0x00, 0x38, 0x28, 0x20,
0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x00, 0x00,
0x00, 0x38, 0x20, 0x10, 0x20, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x30, 0x20, 0x00, 0x00,
0x00, 0x00, 0x14, 0x28, 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x10, 0x28,
0x10, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x38, 0x28, 0x10, 0x00, 0x00,
0x00, 0x18, 0x24, 0x24, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x18, 0x10, 0x18,
0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, 0x00,
0x00, 0x04, 0x18, 0x3C, 0x18, 0x20, 0x00, 0x00, 0x00, 0x18, 0x20, 0x30,
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, 0x00, 0x00, 0x10, 0x08, 0x10, 0x00, 0x38, 0x00, 0x00,
0x00, 0x10, 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x20,
0x20, 0x20, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x28, 0x10, 0x00, 0x00,
0x00, 0x10, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38,
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, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x30, 0x10, 0x00, 0x00,
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, 0x00, 0x00
};
// 2048 bytes
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x24,
0x3C, 0x18, 0x00, 0x00, 0x00, 0x18, 0x24, 0x3C, 0x24, 0x18, 0x00, 0x00,
0x00, 0x28, 0x3C, 0x3C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x10, 0x38, 0x3C,
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, 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, 0x1C, 0x1C, 0x14, 0x14, 0x30, 0x00, 0x00,
0x00, 0x24, 0x18, 0x3C, 0x18, 0x24, 0x00, 0x00, 0x00, 0x20, 0x30, 0x38,
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, 0x28, 0x00, 0x00, 0x00, 0x1C, 0x34, 0x34, 0x14, 0x14, 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,
0x00, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10,
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, 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, 0x00, 0x00, 0x00, 0x00, 0x28, 0x3C, 0x28, 0x3C, 0x28, 0x00, 0x00,
0x00, 0x18, 0x30, 0x10, 0x18, 0x30, 0x00, 0x00, 0x00, 0x28, 0x08, 0x10,
0x20, 0x28, 0x00, 0x00, 0x00, 0x10, 0x28, 0x10, 0x30, 0x38, 0x00, 0x00,
0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x20,
0x20, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00,
0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38,
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, 0x10, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00,
0x00, 0x38, 0x28, 0x28, 0x28, 0x38, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10,
0x10, 0x10, 0x00, 0x00, 0x00, 0x38, 0x08, 0x38, 0x20, 0x38, 0x00, 0x00,
0x00, 0x38, 0x08, 0x38, 0x08, 0x38, 0x00, 0x00, 0x00, 0x28, 0x28, 0x38,
0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x08, 0x38, 0x00, 0x00,
0x00, 0x38, 0x20, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08,
0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x28, 0x38, 0x00, 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,
0x00, 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x38, 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,
0x30, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x38, 0x28, 0x28, 0x00, 0x00,
0x00, 0x30, 0x28, 0x30, 0x28, 0x30, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20,
0x20, 0x18, 0x00, 0x00, 0x00, 0x30, 0x28, 0x28, 0x28, 0x30, 0x00, 0x00,
0x00, 0x38, 0x20, 0x30, 0x20, 0x38, 0x00, 0x00, 0x00, 0x38, 0x20, 0x30,
0x20, 0x20, 0x00, 0x00, 0x00, 0x38, 0x20, 0x28, 0x28, 0x38, 0x00, 0x00,
0x00, 0x28, 0x28, 0x38, 0x28, 0x28, 0x00, 0x00, 0x00, 0x38, 0x10, 0x10,
0x10, 0x38, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x28, 0x18, 0x00, 0x00,
0x00, 0x28, 0x28, 0x30, 0x28, 0x28, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20,
0x20, 0x38, 0x00, 0x00, 0x00, 0x28, 0x38, 0x38, 0x28, 0x28, 0x00, 0x00,
0x00, 0x28, 0x38, 0x38, 0x38, 0x28, 0x00, 0x00, 0x00, 0x38, 0x28, 0x28,
0x28, 0x38, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x20, 0x20, 0x00, 0x00,
0x00, 0x38, 0x28, 0x28, 0x38, 0x18, 0x00, 0x00, 0x00, 0x38, 0x28, 0x30,
0x28, 0x28, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x08, 0x38, 0x00, 0x00,
0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28,
0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
0x00, 0x28, 0x28, 0x38, 0x38, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x10,
0x28, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x38, 0x10, 0x10, 0x00, 0x00,
0x00, 0x38, 0x08, 0x10, 0x20, 0x38, 0x00, 0x00, 0x00, 0x30, 0x20, 0x20,
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00,
0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x28, 0x18, 0x00, 0x00, 0x00, 0x20, 0x20, 0x38, 0x28, 0x38, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x00, 0x00, 0x00, 0x08, 0x08, 0x38,
0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00,
0x00, 0x08, 0x10, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x28,
0x18, 0x08, 0x30, 0x00, 0x00, 0x20, 0x20, 0x38, 0x28, 0x28, 0x00, 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,
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x20, 0x38,
0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x28, 0x28, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
0x28, 0x38, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x08, 0x00,
0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x10, 0x30, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x00, 0x00,
0x00, 0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x28, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x18, 0x00, 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,
0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28,
0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20, 0x20, 0x18, 0x30, 0x00,
0x00, 0x28, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18,
0x38, 0x18, 0x00, 0x00, 0x00, 0x38, 0x00, 0x18, 0x28, 0x18, 0x00, 0x00,
0x00, 0x28, 0x00, 0x18, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18,
0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x28, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x10, 0x00, 0x00, 0x38, 0x00, 0x18,
0x38, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x18, 0x38, 0x18, 0x00, 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,
0x00, 0x00, 0x30, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x28, 0x10, 0x28,
0x38, 0x28, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x38, 0x28, 0x00, 0x00,
0x00, 0x18, 0x00, 0x38, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
0x28, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x28, 0x3C, 0x28, 0x2C, 0x00, 0x00,
0x00, 0x38, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x38,
0x28, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00,
0x00, 0x38, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x28,
0x28, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x28, 0x18, 0x30, 0x00,
0x00, 0x28, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28,
0x28, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x20, 0x38, 0x10, 0x00, 0x00,
0x00, 0x18, 0x14, 0x30, 0x10, 0x3C, 0x00, 0x00, 0x00, 0x28, 0x10, 0x38,
0x38, 0x10, 0x00, 0x00, 0x00, 0x30, 0x28, 0x3C, 0x28, 0x2C, 0x00, 0x00,
0x00, 0x18, 0x10, 0x38, 0x10, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18,
0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x10, 0x10, 0x00, 0x00,
0x00, 0x18, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x18, 0x00, 0x28,
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, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x38, 0x00, 0x00,
0x00, 0x10, 0x00, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x00, 0x00, 0x00,
0x00, 0x20, 0x28, 0x10, 0x38, 0x18, 0x00, 0x00, 0x00, 0x20, 0x28, 0x18,
0x38, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0x14, 0x28, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x14,
0x28, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x00,
0x00, 0x14, 0x28, 0x14, 0x28, 0x14, 0x28, 0x00, 0x00, 0x34, 0x1C, 0x34,
0x1C, 0x34, 0x1C, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00,
0x00, 0x10, 0x10, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x30,
0x30, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x00,
0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x30,
0x30, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x38, 0x38, 0x18, 0x18, 0x00,
0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x38,
0x38, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x38, 0x38, 0x00, 0x00, 0x00,
0x00, 0x18, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x30,
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x10, 0x10, 0x10, 0x00,
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, 0x10, 0x10, 0x1C, 0x1C, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x1C,
0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x1C, 0x1C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1C, 0x1C, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x3C,
0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x18, 0x18, 0x00,
0x00, 0x18, 0x18, 0x1C, 0x1C, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3C,
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, 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, 0x00, 0x00, 0x10, 0x10, 0x1C, 0x1C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1C, 0x1C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1C,
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x10, 0x10, 0x10, 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,
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, 0x30, 0x28, 0x30, 0x28, 0x30, 0x20, 0x00, 0x00, 0x38, 0x28, 0x20,
0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x00, 0x00,
0x00, 0x38, 0x20, 0x10, 0x20, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x30, 0x20, 0x00, 0x00,
0x00, 0x00, 0x14, 0x28, 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x10, 0x28,
0x10, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x38, 0x28, 0x10, 0x00, 0x00,
0x00, 0x18, 0x24, 0x24, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x18, 0x10, 0x18,
0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, 0x00,
0x00, 0x04, 0x18, 0x3C, 0x18, 0x20, 0x00, 0x00, 0x00, 0x18, 0x20, 0x30,
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, 0x00, 0x00, 0x10, 0x08, 0x10, 0x00, 0x38, 0x00, 0x00,
0x00, 0x10, 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x20,
0x20, 0x20, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x28, 0x10, 0x00, 0x00,
0x00, 0x10, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38,
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, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x30, 0x10, 0x00, 0x00,
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, 0x00, 0x00
};

View file

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

View file

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