Merge branch 'upstream'
This commit is contained in:
commit
5ff78a2b4b
13
bomber.h
13
bomber.h
@ -9,7 +9,6 @@ extern int xcolors[256];
|
|||||||
#define IXSIZE 640
|
#define IXSIZE 640
|
||||||
#define IYSIZE 480
|
#define IYSIZE 480
|
||||||
|
|
||||||
|
|
||||||
#define MYF1 0x180
|
#define MYF1 0x180
|
||||||
#define MYF2 0x181
|
#define MYF2 0x181
|
||||||
#define MYF3 0x182
|
#define MYF3 0x182
|
||||||
@ -36,9 +35,7 @@ extern int xcolors[256];
|
|||||||
#define MYSHIFTED 0x40
|
#define MYSHIFTED 0x40
|
||||||
#define MYALTED 0x200
|
#define MYALTED 0x200
|
||||||
|
|
||||||
|
typedef struct gfxset {
|
||||||
typedef struct gfxset
|
|
||||||
{
|
|
||||||
uchar gs_colormap[768];
|
uchar gs_colormap[768];
|
||||||
uchar gs_inout[256];
|
uchar gs_inout[256];
|
||||||
uchar *gs_pic;
|
uchar *gs_pic;
|
||||||
@ -46,15 +43,13 @@ typedef struct gfxset
|
|||||||
int gs_ysize;
|
int gs_ysize;
|
||||||
} gfxset;
|
} gfxset;
|
||||||
|
|
||||||
typedef struct figure
|
typedef struct figure {
|
||||||
{
|
|
||||||
int xsize,ysize;
|
int xsize,ysize;
|
||||||
int xdelta,ydelta;
|
int xdelta,ydelta;
|
||||||
uchar *graphics;
|
uchar *graphics;
|
||||||
} figure;
|
} figure;
|
||||||
|
|
||||||
typedef struct solid
|
typedef struct solid {
|
||||||
{
|
|
||||||
int xsize,ysize;
|
int xsize,ysize;
|
||||||
uchar *graphics;
|
uchar *graphics;
|
||||||
} solid;
|
} solid;
|
||||||
@ -179,7 +174,7 @@ enum tile_types {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define ACT_INVALID 0x88
|
// #define ACT_INVALID 0x88
|
||||||
#define ACT_NONE 0
|
#define ACT_NONE 0
|
||||||
#define ACT_UP 1
|
#define ACT_UP 1
|
||||||
#define ACT_DOWN 2
|
#define ACT_DOWN 2
|
||||||
|
9
menu.c
9
menu.c
@ -173,8 +173,9 @@ static void addexit(char *item,...) {
|
|||||||
|
|
||||||
/* game menues */
|
/* game menues */
|
||||||
|
|
||||||
char *densities[]={"PACKED","HIGH","MEDIUM","LOW"};
|
static const char *densities[]={"PACKED","HIGH","MEDIUM","LOW"};
|
||||||
char *generosities[]={"LOW","MEDIUM","HIGH","RIDICULOUS"};
|
static const char *generosities[]={"LOW","MEDIUM","HIGH","RIDICULOUS"};
|
||||||
|
static const char *dis_en_abled[]={"DISABLED","ENABLED"};
|
||||||
|
|
||||||
static void config_menu(void) {
|
static void config_menu(void) {
|
||||||
int sel;
|
int sel;
|
||||||
@ -187,6 +188,7 @@ static void config_menu(void) {
|
|||||||
additem("GENEROSITY: %s",generosities[configopts.generosity]);
|
additem("GENEROSITY: %s",generosities[configopts.generosity]);
|
||||||
additem("INITIAL FLAME LENGTH: %d",configopts.flames+1);
|
additem("INITIAL FLAME LENGTH: %d",configopts.flames+1);
|
||||||
additem("INITIAL NUMBER OF BOMBS: %d",configopts.bombs+1);
|
additem("INITIAL NUMBER OF BOMBS: %d",configopts.bombs+1);
|
||||||
|
additem("SOUND: %s", dis_en_abled[sound_enabled]);
|
||||||
sel=domenu(MENU_CONFIG, NULL);
|
sel=domenu(MENU_CONFIG, NULL);
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -207,6 +209,9 @@ static void config_menu(void) {
|
|||||||
configopts.bombs+=menudelta;
|
configopts.bombs+=menudelta;
|
||||||
configopts.bombs&=7;
|
configopts.bombs&=7;
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
sound_enabled = 1 - sound_enabled;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
32
network.c
32
network.c
@ -10,7 +10,7 @@
|
|||||||
#define MAXMSG 4096
|
#define MAXMSG 4096
|
||||||
|
|
||||||
int udpsocket;
|
int udpsocket;
|
||||||
const unsigned char gameversion[4]={0xda,0x01,0x00,0x08};
|
const unsigned char gameversion[4]={0xda,0x01,0x00,0x09};
|
||||||
|
|
||||||
struct netnode netnodes[MAXNETNODES];
|
struct netnode netnodes[MAXNETNODES];
|
||||||
|
|
||||||
@ -294,14 +294,18 @@ int networktraffic(void) {
|
|||||||
if (myaction == ACT_QUIT) {
|
if (myaction == ACT_QUIT) {
|
||||||
for (i = 1; i < MAXNETNODES; ++i) {
|
for (i = 1; i < MAXNETNODES; ++i) {
|
||||||
if (netnodes[i].used)
|
if (netnodes[i].used)
|
||||||
actions[i]=ACT_QUIT;
|
actions[i] = ACT_QUIT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
now=gtime();
|
for (i = 1; i < MAXNETNODES; ++i) {
|
||||||
for(;;) {
|
if (netnodes[i].used)
|
||||||
if(gtime()-now>15) break;
|
actions[i] &= ACT_MASK; /* only keep direction */
|
||||||
length=getmsg(5);
|
}
|
||||||
if(length>0 && *mesg!=PKT_MYDATA) fprintf(stderr, "Strange packet %d\n", (int) *mesg);
|
now = gtime();
|
||||||
|
for (;;) {
|
||||||
|
if (gtime() - now > 15) break;
|
||||||
|
length = getmsg(5);
|
||||||
|
if (length > 0 && *mesg != PKT_MYDATA) fprintf(stderr, "Strange packet %d\n", (int) *mesg);
|
||||||
/* check for unexpected old packets...
|
/* check for unexpected old packets...
|
||||||
* for example JOIN on frame 0, respond with BEGIN if player already in game
|
* for example JOIN on frame 0, respond with BEGIN if player already in game
|
||||||
* respond with uninvite INVITE on JOIN from others
|
* respond with uninvite INVITE on JOIN from others
|
||||||
@ -312,7 +316,7 @@ int networktraffic(void) {
|
|||||||
count = readuint32(mesg+5);
|
count = readuint32(mesg+5);
|
||||||
if (count > latestcounts[whosent]) {
|
if (count > latestcounts[whosent]) {
|
||||||
latestcounts[whosent] = count;
|
latestcounts[whosent] = count;
|
||||||
actions[whosent] = mesg[9];
|
actions[whosent] = (actions[whosent] & ~ACT_MASK) | mesg[9]; /* don't drop "action" keys */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,8 +326,8 @@ int networktraffic(void) {
|
|||||||
for (i = 1; i < MAXNETNODES; ++i) {
|
for (i = 1; i < MAXNETNODES; ++i) {
|
||||||
if(netnodes[i].used) {
|
if(netnodes[i].used) {
|
||||||
sendactions(i); /* send actions to every active node */
|
sendactions(i); /* send actions to every active node */
|
||||||
if (actions[i]==ACT_QUIT)
|
if (actions[i] == ACT_QUIT)
|
||||||
netnodes[i].used=0; /* remove disconnected clients */
|
netnodes[i].used = 0; /* remove disconnected clients */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return actioncount;
|
return actioncount;
|
||||||
@ -334,7 +338,7 @@ int networktraffic(void) {
|
|||||||
++mydatacount;
|
++mydatacount;
|
||||||
sendmine(mydatacount);
|
sendmine(mydatacount);
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
/* if we got already one packet we only wait 3msec, otherwise 30msec */
|
/* if we got already one packet we only wait 3msec, otherwise 30msec */
|
||||||
long cur = gtime();
|
long cur = gtime();
|
||||||
if (count >= 0 && cur - now > 3) break;
|
if (count >= 0 && cur - now > 3) break;
|
||||||
@ -342,13 +346,13 @@ int networktraffic(void) {
|
|||||||
|
|
||||||
length = getmsg(count >= 0 ? 3 : 20);
|
length = getmsg(count >= 0 ? 3 : 20);
|
||||||
|
|
||||||
if (MAXNETNODES*ACTIONHIST+9 != length) continue;
|
if (MAXNETNODES * ACTIONHIST + 9 != length) continue;
|
||||||
if (!isvalidmsg_from_master()) continue;
|
if (!isvalidmsg_from_master()) continue;
|
||||||
|
|
||||||
i = readuint32(mesg+5);
|
i = readuint32(mesg + 5);
|
||||||
if (i < actioncount) continue;
|
if (i < actioncount) continue;
|
||||||
count = actioncount = i;
|
count = actioncount = i;
|
||||||
memcpy(actionblock,mesg+9,MAXNETNODES*ACTIONHIST);
|
memcpy(actionblock, mesg + 9, MAXNETNODES * ACTIONHIST);
|
||||||
}
|
}
|
||||||
return actioncount;
|
return actioncount;
|
||||||
}
|
}
|
||||||
|
8
sound.c
8
sound.c
@ -11,6 +11,8 @@
|
|||||||
#define DATADIR "data"
|
#define DATADIR "data"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int sound_enabled = 1;
|
||||||
|
|
||||||
static char dirlist[]=DATADIR;
|
static char dirlist[]=DATADIR;
|
||||||
|
|
||||||
static int readsound(int num);
|
static int readsound(int num);
|
||||||
@ -181,6 +183,8 @@ int i,file,size,len;
|
|||||||
}
|
}
|
||||||
|
|
||||||
void playsound(int n) {
|
void playsound(int n) {
|
||||||
soundcommands[soundput]=n;
|
if (sound_enabled) {
|
||||||
soundput=(soundput+1)&(MAXSOUNDCOMMANDS-1);
|
soundcommands[soundput]=n;
|
||||||
|
soundput=(soundput+1)&(MAXSOUNDCOMMANDS-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user