2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <netdb.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stdarg.h>
|
2009-08-08 19:45:49 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/time.h>
|
2021-09-15 17:20:06 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
2009-08-08 19:45:49 +00:00
|
|
|
|
|
|
|
#include "bomber.h"
|
|
|
|
#include "draw.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "gfx.h"
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
#ifndef DATADIR
|
|
|
|
#define DATADIR "data"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define NUMCHARACTERS 50
|
|
|
|
|
|
|
|
static figure font[NUMCHARACTERS];
|
|
|
|
static figure bigfont[NUMCHARACTERS];
|
|
|
|
|
|
|
|
gfxset gfxsets[NUMGFX];
|
|
|
|
static char walkingname[256];
|
|
|
|
static char colorsetname[256];
|
|
|
|
static char backgroundname[256];
|
|
|
|
static char blocksname[256];
|
|
|
|
static char blocksxname[256];
|
|
|
|
static char bombs1name[256];
|
|
|
|
static char bombs2name[256];
|
|
|
|
static char flamesname[256];
|
|
|
|
static char tilesname[256];
|
|
|
|
static char deathname[256];
|
|
|
|
static char fontname[256];
|
|
|
|
static char bigfontname[256];
|
|
|
|
|
|
|
|
figure blocks[3];
|
|
|
|
figure blocksx[9];
|
|
|
|
figure bombs1[MAXSETS][NUMBOMBFRAMES];
|
|
|
|
figure bombs2[MAXSETS][NUMBOMBFRAMES];
|
|
|
|
figure flamefigs[MAXSETS][NUMFLAMEFRAMES];
|
|
|
|
figure tiles[15];
|
|
|
|
figure death[NUMDEATHFRAMES];
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
int fontxsize, fontysize;
|
|
|
|
int bigfontxsize, bigfontysize, bigfontyspace;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
static int textx, texty;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
static const unsigned char* remapstring = (const unsigned char*) "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.:!?\177/\\*-,>< =";
|
2009-08-08 19:45:49 +00:00
|
|
|
static char asciiremap[256];
|
|
|
|
|
|
|
|
/* On screen array variables */
|
2021-09-15 17:20:06 +00:00
|
|
|
int arraynumx = 15;
|
|
|
|
int arraynumy = 11;
|
|
|
|
int arraystartx = 20;
|
|
|
|
int arraystarty = 70;
|
|
|
|
int arrayspacex = 40;
|
|
|
|
int arrayspacey = 36;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
|
|
|
static sprite sprites[MAXSPRITES];
|
2021-09-15 17:20:06 +00:00
|
|
|
static int spritesused = 0;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
|
|
|
#define IBUFFLEN 1024
|
2021-09-15 17:20:06 +00:00
|
|
|
int ileft = 0, ihand = 0, byteswide;
|
|
|
|
unsigned char ibuff[IBUFFLEN], *itake;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
static void freegfxset(gfxset* gs) {
|
|
|
|
if (gs->gs_pic) free(gs->gs_pic);
|
|
|
|
gs->gs_pic = 0;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int myci() {
|
|
|
|
if (!ileft) {
|
2021-09-15 17:20:06 +00:00
|
|
|
ileft = read(ihand, ibuff, IBUFFLEN);
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
if (!ileft) return -1;
|
|
|
|
itake = ibuff;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
ileft--;
|
|
|
|
return *itake++;
|
|
|
|
}
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
static int dopcxreal(char* name, gfxset* gs) {
|
|
|
|
int xs, ys;
|
|
|
|
int i, j, k;
|
2009-08-08 19:45:49 +00:00
|
|
|
int totalsize;
|
2021-09-15 17:20:06 +00:00
|
|
|
int width, height;
|
|
|
|
unsigned char *bm, *lp;
|
2009-08-08 19:45:49 +00:00
|
|
|
char tname[256];
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
memset(gs, 0, sizeof(gfxset));
|
|
|
|
ileft = 0;
|
|
|
|
snprintf(tname, sizeof(tname), DATADIR "/%s", name);
|
|
|
|
ihand = open(tname, O_RDONLY);
|
|
|
|
if (ihand < 0) {
|
2021-09-15 13:07:35 +00:00
|
|
|
char tname2[260];
|
2021-09-15 17:20:06 +00:00
|
|
|
snprintf(tname2, sizeof(tname2), "%s.pcx", tname);
|
|
|
|
ihand = open(tname2, O_RDONLY);
|
|
|
|
if (ihand < 0) return 1;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
2021-09-15 17:20:06 +00:00
|
|
|
if (myci() != 10) {
|
|
|
|
close(ihand);
|
|
|
|
return 2;
|
|
|
|
} // 10=zsoft .pcx
|
|
|
|
if (myci() != 5) {
|
|
|
|
close(ihand);
|
|
|
|
return 3;
|
|
|
|
} // version 3.0
|
|
|
|
if (myci() != 1) {
|
|
|
|
close(ihand);
|
|
|
|
return 4;
|
|
|
|
} // encoding method
|
|
|
|
if (myci() != 8) {
|
|
|
|
close(ihand);
|
|
|
|
return 5;
|
|
|
|
} // bpp
|
|
|
|
xs = myci();
|
|
|
|
xs |= myci() << 8;
|
|
|
|
ys = myci();
|
|
|
|
ys |= myci() << 8;
|
|
|
|
width = myci();
|
|
|
|
width |= myci() << 8;
|
|
|
|
height = myci();
|
|
|
|
height |= myci() << 8;
|
|
|
|
width = width + 1 - xs;
|
|
|
|
height = height + 1 - ys;
|
|
|
|
for (i = 0; i < 48 + 4; ++i) myci();
|
2009-08-08 19:45:49 +00:00
|
|
|
myci();
|
2021-09-15 17:20:06 +00:00
|
|
|
if (myci() != 1) {
|
|
|
|
close(ihand);
|
|
|
|
return 6;
|
|
|
|
} // # of planes
|
|
|
|
byteswide = myci();
|
|
|
|
byteswide |= myci() << 8;
|
|
|
|
i = myci();
|
|
|
|
i |= myci() << 8;
|
|
|
|
// if(i!=1) {close(ihand);return 7;} // 1=color/bw,2=grey
|
|
|
|
for (i = 0; i < 58; ++i) myci();
|
|
|
|
totalsize = height * byteswide;
|
|
|
|
bm = malloc(totalsize + 1);
|
|
|
|
if (!bm) {
|
|
|
|
close(ihand);
|
|
|
|
return 8;
|
|
|
|
} // no memory
|
|
|
|
gs->gs_pic = bm;
|
|
|
|
gs->gs_xsize = width;
|
|
|
|
gs->gs_ysize = height;
|
|
|
|
while (height--) {
|
|
|
|
lp = bm;
|
|
|
|
i = byteswide;
|
|
|
|
while (i > 0) {
|
|
|
|
j = myci();
|
|
|
|
if (j < 0xc0) {
|
|
|
|
*lp++ = j;
|
2009-08-08 19:45:49 +00:00
|
|
|
--i;
|
|
|
|
} else {
|
2021-09-15 17:20:06 +00:00
|
|
|
j &= 0x3f;
|
|
|
|
k = myci();
|
|
|
|
while (j-- && i) {
|
|
|
|
*lp++ = k;
|
2009-08-08 19:45:49 +00:00
|
|
|
--i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-09-15 17:20:06 +00:00
|
|
|
bm += width;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
2021-09-15 17:20:06 +00:00
|
|
|
lseek(ihand, -0x300, SEEK_END);
|
|
|
|
read(ihand, gs->gs_colormap, 0x300);
|
2009-08-08 19:45:49 +00:00
|
|
|
close(ihand);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
static int dopcx(char* name, gfxset* gs) {
|
2009-08-08 19:45:49 +00:00
|
|
|
int err;
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
err = dopcxreal(name, gs);
|
|
|
|
if (err) printf("Error loading \"%s\":code %d\n", name, err);
|
2009-08-08 19:45:49 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
static void getgroup(char* name, gfxset* colorgs, figure* fig, int count) {
|
2009-08-08 19:45:49 +00:00
|
|
|
int err;
|
|
|
|
int i;
|
|
|
|
gfxset gs;
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
err = dopcx(name, &gs);
|
|
|
|
if (err) exit(1000 + err);
|
2009-08-08 19:45:49 +00:00
|
|
|
createinout(&gs);
|
2021-09-15 17:20:06 +00:00
|
|
|
for (i = 0; i < MAXSETS; ++i, fig += count, ++colorgs) {
|
|
|
|
if (!colorgs->gs_pic) continue;
|
|
|
|
memmove(gs.gs_colormap, colorgs->gs_colormap, sizeof(gs.gs_colormap));
|
2009-08-08 19:45:49 +00:00
|
|
|
createinout(&gs);
|
2021-09-15 17:20:06 +00:00
|
|
|
gfxfetch(&gs, fig, count);
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
freegfxset(&gs);
|
|
|
|
}
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
static void getsingle(char* name, figure* fig, int count) {
|
2009-08-08 19:45:49 +00:00
|
|
|
gfxset gs;
|
|
|
|
int err;
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
err = dopcx(name, &gs);
|
|
|
|
if (err) exit(1000 + err);
|
2009-08-08 19:45:49 +00:00
|
|
|
createinout(&gs);
|
2021-09-15 17:20:06 +00:00
|
|
|
gfxfetch(&gs, fig, count);
|
2009-08-08 19:45:49 +00:00
|
|
|
freegfxset(&gs);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void texthome(void) {
|
2021-09-15 17:20:06 +00:00
|
|
|
textx = texty = 10;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
void drawstring(int xpos, int ypos, const char* str) {
|
2009-08-18 12:05:12 +00:00
|
|
|
char ch;
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
while ((ch = *str++)) {
|
|
|
|
drawfigure(xpos, ypos, font + asciiremap[toupper(ch)]);
|
|
|
|
xpos += fontxsize;
|
2009-08-18 12:05:12 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
void drawbigstring(int xpos, int ypos, const char* str) {
|
2009-08-08 19:45:49 +00:00
|
|
|
char ch;
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
while ('\0' != (ch = *str++)) {
|
|
|
|
drawfigure(xpos, ypos, bigfont + asciiremap[toupper(ch)]);
|
|
|
|
xpos += bigfontxsize;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
void centerbig(int y, const char* str) {
|
2009-08-08 19:45:49 +00:00
|
|
|
int w;
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
w = strlen(str) * bigfontxsize;
|
|
|
|
drawbigstring((IXSIZE - w) >> 1, y, str);
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static void scrprintf(char *str,...) {
|
|
|
|
// char output[256],*p,*p2;
|
|
|
|
// va_list ap;
|
2021-09-15 17:20:06 +00:00
|
|
|
//
|
2009-08-08 19:45:49 +00:00
|
|
|
// va_start(ap, str);
|
2021-09-15 17:20:06 +00:00
|
|
|
//
|
2009-08-08 19:45:49 +00:00
|
|
|
// vsprintf(output,str,ap);
|
|
|
|
// p=output;
|
|
|
|
// for(;;) {
|
|
|
|
// p2=p;
|
|
|
|
// while(*p2 && *p2!='\n') ++p2;
|
|
|
|
// if(*p2) {
|
|
|
|
// *p2=0;
|
|
|
|
// drawstring(textx,texty,p);
|
|
|
|
// texty+=fontysize;
|
|
|
|
// textx=10;
|
|
|
|
// p=p2+1;
|
|
|
|
// } else {
|
|
|
|
// drawstring(textx,texty,p);
|
|
|
|
// textx+=fontxsize*(p2-p);
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// copyup();
|
|
|
|
// }
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
static void bigscrprintf(char* str, ...) {
|
|
|
|
char output[256], *p, *p2;
|
2009-08-08 19:45:49 +00:00
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, str);
|
2021-09-15 17:20:06 +00:00
|
|
|
vsnprintf(output, sizeof(output), str, ap);
|
|
|
|
p = output;
|
|
|
|
for (;;) {
|
|
|
|
p2 = p;
|
|
|
|
while (*p2 && *p2 != '\n') ++p2;
|
|
|
|
if (*p2) {
|
|
|
|
*p2 = 0;
|
|
|
|
drawbigstring(textx, texty, p);
|
|
|
|
texty += bigfontysize;
|
|
|
|
textx = 10;
|
|
|
|
p = p2 + 1;
|
2009-08-08 19:45:49 +00:00
|
|
|
} else {
|
2021-09-15 17:20:06 +00:00
|
|
|
drawbigstring(textx, texty, p);
|
|
|
|
textx += bigfontxsize * (p2 - p);
|
2009-08-08 19:45:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
copyup();
|
|
|
|
}
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
void addsprite(int x, int y, figure* fig) {
|
|
|
|
sprite* sp;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
if (spritesused == MAXSPRITES) return;
|
|
|
|
sp = sprites + spritesused++;
|
|
|
|
sp->flags = 0;
|
|
|
|
sp->xpos = x;
|
|
|
|
sp->ypos = y;
|
|
|
|
sp->fig = fig;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void plotsprites(void) {
|
|
|
|
int i;
|
2021-09-15 17:20:06 +00:00
|
|
|
sprite* sp;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
sp = sprites;
|
|
|
|
for (i = 0; i < spritesused; ++i) {
|
|
|
|
drawfigure(sp->xpos, sp->ypos, sp->fig);
|
2009-08-08 19:45:49 +00:00
|
|
|
++sp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void erasesprites(void) {
|
|
|
|
int i;
|
2021-09-15 17:20:06 +00:00
|
|
|
sprite* sp;
|
|
|
|
figure* fig;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
sp = sprites;
|
|
|
|
for (i = 0; i < spritesused; ++i) {
|
|
|
|
fig = sp->fig;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
solidcopy(&background, sp->xpos + fig->xdelta, sp->ypos + fig->ydelta, fig->xsize, fig->ysize);
|
2009-08-08 19:45:49 +00:00
|
|
|
++sp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void clearsprites(void) {
|
|
|
|
int i;
|
2021-09-15 17:20:06 +00:00
|
|
|
sprite* sp;
|
|
|
|
figure* fig;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
sp = sprites;
|
|
|
|
for (i = 0; i < spritesused; ++i) {
|
|
|
|
fig = sp->fig;
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
clearrect(sp->xpos + fig->xdelta, sp->ypos + fig->ydelta, fig->xsize, fig->ysize);
|
2009-08-08 19:45:49 +00:00
|
|
|
++sp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void clearspritelist(void) {
|
2021-09-15 17:20:06 +00:00
|
|
|
spritesused = 0;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int tovideox(int x) {
|
2021-09-15 17:20:06 +00:00
|
|
|
return (x >> FRACTION) + arraystartx;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int tovideoy(int y) {
|
2021-09-15 17:20:06 +00:00
|
|
|
return (y >> FRACTION) + arraystarty;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int screentoarrayx(int x) {
|
2021-09-15 17:20:06 +00:00
|
|
|
x += arrayspacex << (FRACTION + 2);
|
|
|
|
return ((x >> FRACTION) + (arrayspacex >> 1)) / arrayspacex - 4;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int screentoarrayy(int y) {
|
2021-09-15 17:20:06 +00:00
|
|
|
y += arrayspacey << (FRACTION + 2);
|
|
|
|
return ((y >> FRACTION) + (arrayspacey >> 1)) / arrayspacey - 4;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int arraytoscreenx(int x) {
|
2021-09-15 17:20:06 +00:00
|
|
|
return arrayspacex * x << FRACTION;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int arraytoscreeny(int y) {
|
2021-09-15 17:20:06 +00:00
|
|
|
return arrayspacey * y << FRACTION;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void loadfonts(void) {
|
2021-09-15 17:20:06 +00:00
|
|
|
int i, j;
|
|
|
|
const unsigned char* p;
|
|
|
|
|
|
|
|
getsingle(fontname, font, NUMCHARACTERS);
|
|
|
|
getsingle(bigfontname, bigfont, NUMCHARACTERS);
|
|
|
|
fontxsize = 8;
|
|
|
|
fontysize = 12;
|
|
|
|
bigfontxsize = 16;
|
|
|
|
bigfontysize = 24;
|
|
|
|
bigfontyspace = 32;
|
|
|
|
p = remapstring;
|
|
|
|
j = 0;
|
|
|
|
while (*p && *p != ' ') ++p, ++j;
|
|
|
|
memset(asciiremap, j, sizeof(asciiremap));
|
|
|
|
p = remapstring;
|
|
|
|
i = 0;
|
|
|
|
while (*p && i < NUMCHARACTERS) asciiremap[(int) *p++] = i++;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loadgfx() {
|
2021-09-15 17:20:06 +00:00
|
|
|
gfxset* gs;
|
|
|
|
gfxset* colorgs;
|
2009-08-08 19:45:49 +00:00
|
|
|
int err;
|
|
|
|
int i;
|
2021-09-15 13:07:35 +00:00
|
|
|
char name[267];
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
strcpy(walkingname, "walk");
|
|
|
|
strcpy(colorsetname, "pal");
|
|
|
|
strcpy(backgroundname, "field0");
|
|
|
|
strcpy(blocksname, "blocks3");
|
|
|
|
strcpy(blocksxname, "blocks3x");
|
|
|
|
strcpy(bombs1name, "bomb1");
|
|
|
|
strcpy(bombs2name, "bomb2");
|
|
|
|
strcpy(flamesname, "flames");
|
|
|
|
strcpy(tilesname, "tiles");
|
|
|
|
strcpy(deathname, "death1");
|
|
|
|
strcpy(fontname, "font");
|
|
|
|
strcpy(bigfontname, "bigfont");
|
|
|
|
|
|
|
|
gs = malloc((MAXSETS + 1) * sizeof(gfxset));
|
|
|
|
if (!gs) nomem("loadgfx");
|
|
|
|
colorgs = gs + 1;
|
|
|
|
|
|
|
|
for (i = 0; i < MAXSETS; ++i) {
|
|
|
|
snprintf(name, sizeof(name), "%s%d", colorsetname, i);
|
|
|
|
err = dopcx(name, colorgs + i);
|
|
|
|
if (err) continue;
|
2009-08-08 19:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
loadfonts();
|
|
|
|
texthome();
|
|
|
|
bigscrprintf("Loading graphics...\n");
|
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
err = dopcx(backgroundname, gs);
|
|
|
|
if (err) exit(1000 + err);
|
2009-08-08 19:45:49 +00:00
|
|
|
createinout(gs);
|
2021-09-15 17:20:06 +00:00
|
|
|
solidfetch(gs, &background);
|
|
|
|
solidfetch(gs, &backgroundoriginal);
|
2009-08-08 19:45:49 +00:00
|
|
|
freegfxset(gs);
|
|
|
|
|
|
|
|
bigscrprintf("Loading blocks\n");
|
2021-09-15 17:20:06 +00:00
|
|
|
getsingle(blocksname, blocks, 3);
|
2009-08-08 19:45:49 +00:00
|
|
|
bigscrprintf("Loading block explosions\n");
|
2021-09-15 17:20:06 +00:00
|
|
|
getsingle(blocksxname, blocksx, 9);
|
2009-08-08 19:45:49 +00:00
|
|
|
bigscrprintf("Loading walking figures\n");
|
2021-09-15 17:20:06 +00:00
|
|
|
getgroup(walkingname, colorgs, walking[0], NUMWALKFRAMES);
|
2009-08-08 19:45:49 +00:00
|
|
|
bigscrprintf("Loading normal bombs\n");
|
2021-09-15 17:20:06 +00:00
|
|
|
getgroup(bombs1name, colorgs, bombs1[0], NUMBOMBFRAMES);
|
2009-08-08 19:45:49 +00:00
|
|
|
bigscrprintf("Loading controlled bombs\n");
|
2021-09-15 17:20:06 +00:00
|
|
|
getgroup(bombs2name, colorgs, bombs2[0], NUMBOMBFRAMES);
|
2009-08-08 19:45:49 +00:00
|
|
|
bigscrprintf("Loading flames\n");
|
2021-09-15 17:20:06 +00:00
|
|
|
// getgroup(flamesname,colorgs,flamefigs[0],NUMFLAMEFRAMES);
|
|
|
|
getsingle(flamesname, flamefigs[0], NUMFLAMEFRAMES);
|
2009-08-08 19:45:49 +00:00
|
|
|
bigscrprintf("Loading bonus tiles\n");
|
2021-09-15 17:20:06 +00:00
|
|
|
getsingle(tilesname, tiles, 15);
|
2009-08-08 19:45:49 +00:00
|
|
|
bigscrprintf("Loading death sequence\n");
|
2021-09-15 17:20:06 +00:00
|
|
|
getsingle(deathname, death, NUMDEATHFRAMES);
|
2009-08-08 19:45:49 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
for (i = 0; i < MAXSETS; ++i) freegfxset(colorgs + i);
|
2009-08-08 19:45:49 +00:00
|
|
|
free(gs);
|
|
|
|
bigscrprintf("Done loading graphics\n");
|
|
|
|
}
|
2009-08-09 22:02:13 +00:00
|
|
|
|
2021-09-15 17:20:06 +00:00
|
|
|
void failure(char* str, ...) {
|
2009-08-09 22:02:13 +00:00
|
|
|
char output[256];
|
|
|
|
va_list ap;
|
|
|
|
int len;
|
|
|
|
long now;
|
|
|
|
|
|
|
|
va_start(ap, str);
|
|
|
|
|
|
|
|
len = vsnprintf(output, sizeof(output), str, ap);
|
|
|
|
if (len >= 256) len = 255; /* truncated string */
|
|
|
|
clear();
|
2021-09-15 17:20:06 +00:00
|
|
|
drawbigstring((IXSIZE - len * bigfontxsize) / 2, (IYSIZE - bigfontysize) / 2, output);
|
2009-08-09 22:02:13 +00:00
|
|
|
copyup();
|
|
|
|
|
|
|
|
now = longtime();
|
2021-09-15 17:20:06 +00:00
|
|
|
while (!exitflag && longtime() - now < 3) {
|
2009-08-09 22:02:13 +00:00
|
|
|
scaninput();
|
|
|
|
if (anydown()) {
|
|
|
|
takedown();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|