#include "bomber.h" #include "menu.h" #include "draw.h" #include "gfx.h" #include "utils.h" #include "sound.h" #include "network.h" #include "announce.h" #include "game.h" unsigned char configopts[10]={2,1,0,2,0,0,0,0,0}; /* Generic menu */ int menuhistory[32]={0}; char menustring[1024]; char *menuput,*menuitems[40],*menutitle; int menunum; int menudelta; static void drawmenu(int selected) { int i,j; int tx,ty; clear(); j=strlen(menutitle)*bigfontxsize; drawbigstring((IXSIZE-j) >> 1,20,menutitle); ty=((IYSIZE-(bigfontysize*menunum))>>1)-(IYSIZE>>3); for(i=0;i> 1; if(i==selected) { greyrect(0,ty-1,tx-5,bigfontysize); greyrect(tx+j+3,ty-1,IXSIZE-(tx+j+3),bigfontysize); } drawbigstring(tx,ty,menuitems[i]); ty+=bigfontyspace; } } static int domenu(int whichmenu) { char redraw; int selected; int mcount=0; if(whichmenu>=0) selected=menuhistory[whichmenu]; else selected=0; redraw=1; clearspritelist(); while(!exitflag) { if(redraw) { drawmenu(selected); redraw=0; } mypause(); scaninput(); ++mcount; clearsprites(); clearspritelist(); addsprite(IXSIZE/2-50-20,IYSIZE-80,walking[2]+(30+mcount%15)); addsprite(IXSIZE/2+50-20,IYSIZE-80,walking[3]+(30+(mcount+7)%15)); plotsprites(); copyup(); if(anydown()) playsound(3); while(anydown()) switch(takedown()) { case MYLEFT: menudelta=-1; return selected; case MYRIGHT: case ' ': case 13: menudelta=1; return selected; case 'k': case MYUP: if(selected) --selected; else selected=menunum-1; if(whichmenu>=0) menuhistory[whichmenu]=selected; redraw=1; break; case 'j': case MYDOWN: ++selected; if(selected==menunum) selected=0; if(whichmenu>=0) menuhistory[whichmenu]=selected; redraw=1; break; case 0x1b: if(!whichmenu && selected) { selected=0; redraw=1; break; } menudelta=1; return 0; } } return 0; } static void menustart() { menunum=-1; menuput=menustring; *menuput=0; } static void additem(char *item,...) { char output[256]; va_list ap; va_start(ap, item); vsprintf(output,item,ap); if(menunum<0) menutitle=menuput; else menuitems[menunum]=menuput; ++menunum; strcpy(menuput,output); menuput+=strlen(output)+1; } /* end generic menu */ /* game menues */ static void drawjoinscreen(void) { int i; char name[17]; char temp[64]; #define JX (IXSIZE/3) #define JY (IYSIZE/4) clear(); centerbig(20,"JOIN NETWORK GAME"); drawbigstring(JX,JY,"SLOT NAME"); for(i=0;i