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 all: sdlbomber
sdlbomber: announce.o bomber.o draw.o game.o gfx.o sound.o list.o network.o menu.o utils.o 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 matcher: matcher.c

View File

@ -279,7 +279,7 @@ int searchgames(void) {
avahi_threaded_poll_lock(threaded_poll); 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))); fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_client_errno(client)));
avahi_threaded_poll_unlock(threaded_poll); avahi_threaded_poll_unlock(threaded_poll);
return 0; return 0;

12
draw.c
View File

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

13
game.c
View File

@ -468,11 +468,12 @@ static void drawbombs(void) {
static void drawflames(void) { static void drawflames(void) {
flame *fl; flame *fl;
int xpos,ypos; int xpos,ypos;
int color; /* no player specific flame sprites yet */
/* int color; */
int fig; int fig;
list_for_each_entry(fl, &activeflames, list) { list_for_each_entry(fl, &activeflames, list) {
color=fl->owner->color; /* color=fl->owner->color; */
xpos=tovideox(fl->xpos); xpos=tovideox(fl->xpos);
ypos=tovideoy(fl->ypos); ypos=tovideoy(fl->ypos);
fig=(fl->timer*10)/FLAMELIFE; fig=(fl->timer*10)/FLAMELIFE;
@ -747,9 +748,9 @@ static void applybonus(player *pl,bonustile *bonus) {
} }
static void doplayer(player *pl) { static void doplayer(player *pl) {
int last; /* int last; */
int color; int color;
int speed; /* int speed; */
int px,py; int px,py;
int there; int there;
int flags; int flags;
@ -763,9 +764,9 @@ static void doplayer(player *pl) {
flags=pl->flags; flags=pl->flags;
if(flags&FLG_DEAD) return; if(flags&FLG_DEAD) return;
color=pl->color; color=pl->color;
last=pl->doing; /* last=pl->doing; */
pl->doing=what; pl->doing=what;
speed=pl->speed; /* speed=pl->speed; */
px=screentoarrayx(pl->xpos); px=screentoarrayx(pl->xpos);
py=screentoarrayy(pl->ypos); py=screentoarrayy(pl->ypos);
there=field[py][px]; 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; uchar *p,*p2;
int dx,dy; int dx,dy;
uchar *map1; /* uchar *map1; */
int gswidth; int gswidth;
int minx,miny,maxx,maxy; int minx,miny,maxx,maxy;
int tx,ty; int tx,ty;
map1=gs->gs_inout; /* map1=gs->gs_inout; */
gswidth=gs->gs_xsize; gswidth=gs->gs_xsize;
p=gs->gs_pic+sourcex+gswidth*sourcey; p=gs->gs_pic+sourcex+gswidth*sourcey;
minx=miny=maxx=maxy=-1; minx=miny=maxx=maxy=-1;
@ -480,7 +480,7 @@ int checkbuttondown(int button)
return buttondown & (1<<button); return buttondown & (1<<button);
} }
int anydown() int anydown(void)
{ {
return numdown; return numdown;
} }
@ -498,7 +498,7 @@ int res=0;
} }
return res; return res;
} }
int firstdown(vopid) int firstdown(void)
{ {
return *downcodes; 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 greyrect(int x,int y,int xsize,int ysize);
void clearrect(int x,int y,int xsize,int ysize); void clearrect(int x,int y,int xsize,int ysize);
void solidfetch(gfxset *gs,solid *dest); void solidfetch(gfxset *gs,solid *dest);
extern void dumpgfx(); extern void dumpgfx(void);
extern void createinout(struct gfxset *); extern void createinout(struct gfxset *);
extern void getcolors(); extern void getcolors(void);
extern void gfxfetch(struct gfxset *,struct figure *,int); extern void gfxfetch(struct gfxset *,struct figure *,int);
extern void puttile(int destx,int desty,int source); extern void puttile(int destx,int desty,int source);
extern void store(int x,int y,int which); extern void store(int x,int y,int which);
extern void restore(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 copyupxy(int x,int y);
extern void copyupxysize(int x,int y,int xsize,int ysize); 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 unsigned long getcolor(char *name); /* unsigned long */
extern int checkpressed(int code); extern int checkpressed(int code);
extern int checkdown(int code); extern int checkdown(int code);
extern int checkbutton(int button); extern int checkbutton(int button);
extern int checkbuttondown(int button); extern int checkbuttondown(int button);
extern int anydown(); extern int anydown(void);
extern int firstdown(); extern int firstdown(void);
extern void scaninput(); extern void scaninput(void);
extern void fontinit(); extern void fontinit(void);
extern void writechar(int x,int y,uchar ch); 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 drawbox(int x,int y,int size,int color);
extern void drawbox2(int x,int y,int sizex,int sizey,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 drawfillrect(int x,int y,int size,int color);
extern void bigpixel(int x,int y,int color); extern void bigpixel(int x,int y,int color);
extern void invert(int x,int y); extern void invert(int x,int y);
extern int getmousex(); extern int getmousex(void);
extern int getmousey(); extern int getmousey(void);
extern void drawsquare(int x,int y,uchar *source); extern void drawsquare(int x,int y,uchar *source);
extern void colormapon(); extern void colormapon(void);
extern void colormapoff(); extern void colormapoff(void);
extern void palette(uchar *pal); extern void palette(uchar *pal);
extern void drawfigure(int x,int y,figure *fig); extern void drawfigure(int x,int y,figure *fig);
extern void drawfigureany(int x,int y,figure *fig,solid *dest); 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 int count_used = 0;
static const int num = MAXTHINGS;
void alloc_things(void) { void alloc_things(void) {
int i; int i;

4
menu.c
View File

@ -230,7 +230,7 @@ static void draw_host_game(void) {
for(i=0;i<MAXNETNODES;++i) { for(i=0;i<MAXNETNODES;++i) {
if(!netnodes[i].used) continue; if(!netnodes[i].used) continue;
name=netnodes[i].name; 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); drawbigstring(M3X,M3Y+(i+2)*bigfontyspace,temp);
} }
@ -288,7 +288,7 @@ static void drawjoinscreen(void) {
if(!netnodes[i].used) continue; if(!netnodes[i].used) continue;
memmove(name,netnodes[i].name,16); memmove(name,netnodes[i].name,16);
name[16]=0; 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); drawbigstring(JX,JY+(i+1)*bigfontyspace,temp);
} }
} }

View File

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

View File

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