static void showPics(W_Window win) { struct piclist *temp; int page; page = currpage->page; temp = motdPics; while (temp != NULL) { if (page == temp->page) { if (temp->thepic) W_DrawImage(win, temp->x, temp->y, 0, temp->thepic, foreColor); else { W_MakeLine(win, temp->x, temp->y, temp->x + temp->width - 1, temp->y + temp->height - 1, W_Grey); W_MakeLine(win, temp->x, temp->y + temp->height - 1, temp->x + temp->width - 1, temp->y, W_Grey); W_MakeLine(win, temp->x, temp->y, temp->x + temp->width - 1, temp->y, W_Grey); W_MakeLine(win, temp->x, temp->y, temp->x, temp->y + temp->height - 1, W_Grey); W_MakeLine(win, temp->x, temp->y + temp->height - 1, temp->x + temp->width - 1, temp->y + temp->height - 1, W_Grey); W_MakeLine(win, temp->x + temp->width - 1, temp->y + temp->height - 1, temp->x + temp->width - 1, temp->y, W_Grey); } } temp = temp->next; } }
void draw_score() { int basex; int i; #ifdef SOUND sprintf(scorestr, "Score: %07d Level: %02d %c", score, level, playSounds ? ' ':'Q'); #else sprintf(scorestr, "Sore: %07d Level: %02d", score, level); #endif basex = WINWIDTH/2 - ((strlen(scorestr)/2)*W_Textwidth); W_MaskText(shellWin, basex, 1, W_Grey, scorestr, strlen(scorestr), W_RegularFont); W_MaskText(shellWin, basex+1, 0, W_Yellow, scorestr, strlen(scorestr), W_RegularFont); for(i=0;i<((ships < 6) ? ships : 6);i++) { W_DrawImage(shellWin, i*(miniship->width+2), 0, 0, miniship, W_White); } if(ships>6) { sprintf(shipstr, "%d", ships); basex = 6*(miniship->width+2) + 2; W_MaskText(shellWin, basex, 1, W_Grey, shipstr, strlen(shipstr), W_RegularFont); W_MaskText(shellWin, basex+1, 0, W_Yellow, shipstr, strlen(shipstr), W_RegularFont); } }
void metainput(void) /* Wait for actions in the meta-server window. * * This is really the meta-server window's own little input() function. It is * needed so we don't have to use all the bull in the main input(). Plus to * use it I'd have to call mapAll() first and the client would read in the * default server and then call it up before I can select a server. */ { W_Event data; (void) SIGNAL(SIGCHLD, sigchld); while (W_IsMapped(metaWin)) { while (1) { W_Flush(); if (W_EventsPending()) break; if (ReadMetasRecv(W_Socket()) || metareap_needed) { metareap(); metaHeight = num_servers + N_OVERHEAD; metawindow(); W_Flush(); } refresh_cyclic(); } W_NextEvent(&data); switch ((int) data.type) { case W_EV_KEY: if (data.Window == metaList || data.Window == metaWin) if (key(&data)) return; if (data.Window == metaHelpWin) hide_help(); break; case W_EV_BUTTON: if (data.Window == metaList) if (button(&data)) return; if (data.Window == metaHelpWin) hide_help(); if (data.Window == metaWin && data.y < 200) W_NextScreenShot(metaWin, 0, 0); break; case W_EV_EXPOSE: if (data.Window == metaHelpWin) expo_help(); if (data.Window == metaWin) { W_DrawScreenShot(metaWin, 0, 0); W_DrawImage(200, 9, logo); } break; case W_EV_CLOSED: if (data.Window == metaWin) { fprintf(stderr, "you quit, by closing the server list window\n"); terminate(0); } break; default: break; } } }
void do_score() { static int lastscore, lastlevel, lastships; #ifdef SOUND static int lastsounds; #endif if (lastscore != score) { if ((score > 0) && (score >= nextBonus)) { ships++; extrax = 0 - extraImage->width/2; extray = WINHEIGHT/2; drawExtra = 1; if (nextBonus < BONUSSHIPSCORE) nextBonus = BONUSSHIPSCORE; else nextBonus += BONUSSHIPSCORE; } } #ifdef SOUND if (lastscore != score || lastlevel != level || lastships != ships || lastsounds != playSounds) #else if (lastscore != score || lastlevel != level || lastships != ships) #endif { W_ClearArea(shellWin, 0, 0, WINWIDTH, W_Textheight + 1); draw_score(); lastscore=score; lastlevel=level; lastships=ships; #ifdef SOUND lastsounds=playSounds; #endif } if (drawExtra) { extrax += 10; W_DrawImage(baseWin, extrax-(extraImage->width/2), extray-(extraImage->height/2), 0, extraImage, W_White); if((extrax-(int)extraImage->width/2) > WINWIDTH) drawExtra = 0; } }
void doHull(int dx, int dy, W_Image *ship_bits, struct player *j) { W_Image *image; if (j == me && vary_hull) { int hull_left = (100 * (me->p_ship->s_maxdamage - me->p_damage)) / me->p_ship->s_maxdamage, hull_num = 7; int hull_color; if (hull_left <= 16) { hull_num = 0; hull_color = W_Red; } else if (hull_left <= 28) { hull_num = 1; hull_color = W_Red; } else if (hull_left <= 40) { hull_num = 2; hull_color = W_Red; } else if (hull_left <= 52) { hull_num = 3; hull_color = W_Yellow; } else if (hull_left <= 64) { hull_num = 4; hull_color = W_Yellow; } else if (hull_left <= 76) { hull_num = 5; hull_color = W_Yellow; } else if (hull_left <= 88) { hull_num = 6; hull_color = W_Green; } else hull_color = W_Green /* playerColor (j) */ ; image = getImage(I_HULL); W_DrawImage(w, dx - image->width / 2 + 1, dy - image->height /2 + 1, hull_num, image, hull_color); } }
static void redrawTeam(W_Window win, int teamNo, int *lastnum) { char buf[BUFSIZ]; int num = numShips(teamNo); /* Only redraw if number of players has changed */ if (*lastnum == num) return; drawIcon(); W_ClearWindow(win); W_DrawImageNoClip(teamWin[teamNo], 0, 0, 0, teaminfo[teamNo].shield_logo, shipCol[teamNo + 1]); (void) sprintf(buf, "%d", num); W_MaskText(win, 5, 46, shipCol[teamNo + 1], buf, strlen(buf), W_BigFont); if (!(tournMask & (1 << teamNo))) W_DrawImage(win, 0, 0, 0, getImage(I_NOENTRY), W_Red); *lastnum = num; }