Merge branch 'master' into debian

This commit is contained in:
Stefan Bühler 2021-09-15 15:34:14 +02:00
commit a3db4d96b2
10 changed files with 37 additions and 38 deletions

View File

@ -7,7 +7,7 @@ override CFLAGS += -D_REENTRANT $(shell sdl-config --cflags) $(DBG) $(WARNFLAGS)
all: sdlbomber
sdlbomber: announce.o bomber.o draw.o game.o gfx.o sound.o list.o network.o menu.o utils.o
gcc -o $@ $^ $(shell sdl-config --libs) -lavahi-common -lavahi-client $(DBG)
gcc $(LDFLAGS) -o $@ $^ $(shell sdl-config --libs) -lavahi-common -lavahi-client $(DBG)
matcher: matcher.c

View File

@ -279,7 +279,7 @@ int searchgames(void) {
avahi_threaded_poll_lock(threaded_poll);
if (NULL == (browser = avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, SERVICE_TYPE, NULL, 0, browse_callback, &gameversion))) {
if (NULL == (browser = avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, SERVICE_TYPE, NULL, 0, browse_callback, NULL))) {
fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_client_errno(client)));
avahi_threaded_poll_unlock(threaded_poll);
return 0;

12
draw.c
View File

@ -97,11 +97,11 @@ static int dopcxreal(char *name,gfxset *gs) {
memset(gs,0,sizeof(gfxset));
ileft=0;
sprintf(tname,DATADIR "/%s",name);
snprintf(tname,sizeof(tname),DATADIR "/%s",name);
ihand=open(tname,O_RDONLY);
if(ihand<0) {
char tname2[256];
sprintf(tname2,"%s.pcx",tname);
char tname2[260];
snprintf(tname2,sizeof(tname2),"%s.pcx",tname);
ihand=open(tname2,O_RDONLY);
if(ihand<0)
return 1;
@ -258,7 +258,7 @@ static void bigscrprintf(char *str,...) {
va_list ap;
va_start(ap, str);
vsprintf(output,str,ap);
vsnprintf(output,sizeof(output),str,ap);
p=output;
for(;;) {
p2=p;
@ -386,7 +386,7 @@ void loadgfx() {
gfxset *colorgs;
int err;
int i;
char name[256];
char name[267];
strcpy(walkingname,"walk");
strcpy(colorsetname,"pal");
@ -407,7 +407,7 @@ void loadgfx() {
colorgs=gs+1;
for(i=0;i<MAXSETS;++i) {
sprintf(name,"%s%d",colorsetname,i);
snprintf(name,sizeof(name),"%s%d",colorsetname,i);
err=dopcx(name,colorgs+i);
if(err) continue;
}

13
game.c
View File

@ -468,11 +468,12 @@ static void drawbombs(void) {
static void drawflames(void) {
flame *fl;
int xpos,ypos;
int color;
/* no player specific flame sprites yet */
/* int color; */
int fig;
list_for_each_entry(fl, &activeflames, list) {
color=fl->owner->color;
/* color=fl->owner->color; */
xpos=tovideox(fl->xpos);
ypos=tovideoy(fl->ypos);
fig=(fl->timer*10)/FLAMELIFE;
@ -747,9 +748,9 @@ static void applybonus(player *pl,bonustile *bonus) {
}
static void doplayer(player *pl) {
int last;
/* int last; */
int color;
int speed;
/* int speed; */
int px,py;
int there;
int flags;
@ -763,9 +764,9 @@ static void doplayer(player *pl) {
flags=pl->flags;
if(flags&FLG_DEAD) return;
color=pl->color;
last=pl->doing;
/* last=pl->doing; */
pl->doing=what;
speed=pl->speed;
/* speed=pl->speed; */
px=screentoarrayx(pl->xpos);
py=screentoarrayy(pl->ypos);
there=field[py][px];

8
gfx.c
View File

@ -158,12 +158,12 @@ static void gfxfetchsingle(figure *fig,gfxset *gs,int sourcex,int sourcey,int si
{
uchar *p,*p2;
int dx,dy;
uchar *map1;
/* uchar *map1; */
int gswidth;
int minx,miny,maxx,maxy;
int tx,ty;
map1=gs->gs_inout;
/* map1=gs->gs_inout; */
gswidth=gs->gs_xsize;
p=gs->gs_pic+sourcex+gswidth*sourcey;
minx=miny=maxx=maxy=-1;
@ -480,7 +480,7 @@ int checkbuttondown(int button)
return buttondown & (1<<button);
}
int anydown()
int anydown(void)
{
return numdown;
}
@ -498,7 +498,7 @@ int res=0;
}
return res;
}
int firstdown(vopid)
int firstdown(void)
{
return *downcodes;
}

26
gfx.h
View File

@ -28,38 +28,38 @@ void closegfx(void);
void greyrect(int x,int y,int xsize,int ysize);
void clearrect(int x,int y,int xsize,int ysize);
void solidfetch(gfxset *gs,solid *dest);
extern void dumpgfx();
extern void dumpgfx(void);
extern void createinout(struct gfxset *);
extern void getcolors();
extern void getcolors(void);
extern void gfxfetch(struct gfxset *,struct figure *,int);
extern void puttile(int destx,int desty,int source);
extern void store(int x,int y,int which);
extern void restore(int x,int y,int which);
extern void copyup();
extern void copyup(void);
extern void copyupxy(int x,int y);
extern void copyupxysize(int x,int y,int xsize,int ysize);
extern void getfigures();
extern void getfigures(void);
extern unsigned long getcolor(char *name); /* unsigned long */
extern int checkpressed(int code);
extern int checkdown(int code);
extern int checkbutton(int button);
extern int checkbuttondown(int button);
extern int anydown();
extern int firstdown();
extern void scaninput();
extern void fontinit();
extern int anydown(void);
extern int firstdown(void);
extern void scaninput(void);
extern void fontinit(void);
extern void writechar(int x,int y,uchar ch);
extern void clear();
extern void clear(void);
extern void drawbox(int x,int y,int size,int color);
extern void drawbox2(int x,int y,int sizex,int sizey,int color);
extern void drawfillrect(int x,int y,int size,int color);
extern void bigpixel(int x,int y,int color);
extern void invert(int x,int y);
extern int getmousex();
extern int getmousey();
extern int getmousex(void);
extern int getmousey(void);
extern void drawsquare(int x,int y,uchar *source);
extern void colormapon();
extern void colormapoff();
extern void colormapon(void);
extern void colormapoff(void);
extern void palette(uchar *pal);
extern void drawfigure(int x,int y,figure *fig);
extern void drawfigureany(int x,int y,figure *fig,solid *dest);

2
list.c
View File

@ -21,8 +21,6 @@ static genericlistitem *free_things;
static int count_used = 0;
static const int num = MAXTHINGS;
void alloc_things(void) {
int i;

4
menu.c
View File

@ -230,7 +230,7 @@ static void draw_host_game(void) {
for(i=0;i<MAXNETNODES;++i) {
if(!netnodes[i].used) continue;
name=netnodes[i].name;
sprintf(temp," %d %s",i+1,name);
snprintf(temp,sizeof(temp)," %d %s",i+1,name);
drawbigstring(M3X,M3Y+(i+2)*bigfontyspace,temp);
}
@ -288,7 +288,7 @@ static void drawjoinscreen(void) {
if(!netnodes[i].used) continue;
memmove(name,netnodes[i].name,16);
name[16]=0;
sprintf(temp," %d %s",i+1,name);
snprintf(temp,sizeof(temp)," %d %s",i+1,name);
drawbigstring(JX,JY+(i+1)*bigfontyspace,temp);
}
}

View File

@ -7,7 +7,7 @@
enum {
MAXNETNODES = 8
} maxnetnodesconst;
};
struct netnode {
struct sockaddr_in netname;

View File

@ -149,7 +149,7 @@ void soundclose(void) {
int readsound(int num) {
char name[256],*p1,*p2,ch;
int i,file,size,len;
int file,size,len;
p1=dirlist;
for(;;)
{
@ -173,7 +173,7 @@ int i,file,size,len;
p1=samples[num].data=malloc(len);
if(p1)
{
i=read(file,p1,size);
read(file,p1,size);
if(len-size) memset(p1+size,0,len-size);
while(size--) *p1++ ^= 0x80;
} else