Fixed: Redraw Menuitems only if changes were made.

Fixed: Logo is now shown after change of resolution.
* Changed: Download-Screen shows now a progress bar.
origin
patty21 22 years ago
parent 9e36f8c675
commit 3a83061d2c

@ -5,7 +5,7 @@ dnl Please disable it in the Anjuta project configuration
AC_INIT(configure.in) AC_INIT(configure.in)
AC_CANONICAL_TARGET AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(bomberclone, 0.11.1) AM_INIT_AUTOMAKE(bomberclone, 0.11.2)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)

@ -1,4 +1,4 @@
/* $Id: menu.h,v 1.4 2004/01/04 03:22:49 stpohle Exp $ /* $Id: menu.h,v 1.5 2004/02/02 23:30:34 patty21 Exp $
* GUI for menuhandling * GUI for menuhandling
*/ */
@ -34,7 +34,7 @@ struct __menuitem {
int type; int type;
int len; int len;
int id; int id;
char changed;
char label[MENU_TITLELEN]; char label[MENU_TITLELEN];
_keybinput keybi; _keybinput keybi;
int state; int state;

@ -1,4 +1,4 @@
/* $Id: network.h,v 1.14 2004/02/01 02:47:33 stpohle Exp $ /* $Id: network.h,v 1.15 2004/02/02 23:30:34 patty21 Exp $
* network.h file... for everything what have to do with the network stuff * network.h file... for everything what have to do with the network stuff
*/ */
@ -111,7 +111,7 @@ extern void net_game_send_respawn (int pl_nr);
extern void net_game_fillsockaddr (); extern void net_game_fillsockaddr ();
extern void net_game_send_ill (int p_nr); extern void net_game_send_ill (int p_nr);
extern void net_delplayer (int pl_nr); extern void net_delplayer (int pl_nr);
extern void draw_netupdatestate (); extern void draw_netupdatestate (char st);
extern void net_send_servermode (); extern void net_send_servermode ();
extern void net_send_players (); extern void net_send_players ();
extern int net_check_timeout (int pl_nr); extern int net_check_timeout (int pl_nr);

@ -396,13 +396,15 @@ config_video ()
gfx.res.x = x; gfx.res.x = x;
gfx.res.y = y; gfx.res.y = y;
gfx_init (); gfx_init ();
break; draw_logo ();
break;
case (2): // new color depth case (2): // new color depth
gfx_shutdown (); gfx_shutdown ();
sscanf (selbpp->text, "%d", &x); sscanf (selbpp->text, "%d", &x);
gfx.bpp = x; gfx.bpp = x;
gfx_init (); gfx_init ();
break; draw_logo ();
break;
default: default:
done = 1; done = 1;
break; break;

@ -1,4 +1,4 @@
/* $Id: menu.c,v 1.37 2004/01/24 23:47:28 stpohle Exp $ /* $Id: menu.c,v 1.38 2004/02/02 23:30:34 patty21 Exp $
* Menuhandling */ * Menuhandling */
#include "basic.h" #include "basic.h"
@ -396,7 +396,6 @@ int menu_loop () {
break; break;
} }
else if (event.key.keysym.sym == SDLK_ESCAPE) { else if (event.key.keysym.sym == SDLK_ESCAPE) {
done = 1;
return -1; return -1;
break; break;
} }
@ -435,10 +434,11 @@ int menu_loop () {
menu_looprunning = 0; menu_looprunning = 0;
if (reorder) if (reorder) {
menu.focus->changed=1;
return -2; return -2;
}
return menu.focus->id; return menu.focus->id;
}; };

@ -1,4 +1,4 @@
/* $Id: menulists.c,v 1.2 2003/12/26 02:20:10 stpohle Exp $ /* $Id: menulists.c,v 1.3 2004/02/02 23:30:35 patty21 Exp $
* Menuhandling: lists */ * Menuhandling: lists */
@ -42,6 +42,7 @@ void menu_create_list (char *name, int x, int y, int w, int h, _charlist *data,
menuitems[i].ptrdata = (char *) selected; menuitems[i].ptrdata = (char *) selected;
menuitems[i].list = data; menuitems[i].list = data;
menuitems[i].id = id; menuitems[i].id = id;
menuitems[i].changed=1;
strncpy (menuitems[i].label, name, MENU_TITLELEN); strncpy (menuitems[i].label, name, MENU_TITLELEN);
}; };
@ -276,9 +277,11 @@ void menu_draw_list (_menuitem *mi) {
dest.x = MENUOFFSET_X + mi->pos.x + mi->pos.w - menu.listimages[focus][5]->w; dest.x = MENUOFFSET_X + mi->pos.x + mi->pos.w - menu.listimages[focus][5]->w;
gfx_blit (menu.listimages[focus][5], NULL, gfx.screen, &dest, 10000); gfx_blit (menu.listimages[focus][5], NULL, gfx.screen, &dest, 10000);
} }
if (mi->changed) {
menu_draw_listbackground (mi, NULL); menu_draw_listbackground (mi, NULL);
menu_draw_listtext (mi); menu_draw_listtext (mi);
mi->changed=0;
}
}; };
@ -289,6 +292,7 @@ void menu_draw_list (_menuitem *mi) {
int menu_event_list (_menuitem *mi, SDL_Event *event) { int menu_event_list (_menuitem *mi, SDL_Event *event) {
switch (event->type) { switch (event->type) {
case (SDL_KEYDOWN): /* key was pressed */ case (SDL_KEYDOWN): /* key was pressed */
mi->changed=1;
if (event->key.keysym.sym == SDLK_LEFT) if (event->key.keysym.sym == SDLK_LEFT)
menu_focus_prev (); menu_focus_prev ();
else if (event->key.keysym.sym == SDLK_RIGHT) else if (event->key.keysym.sym == SDLK_RIGHT)
@ -302,7 +306,7 @@ int menu_event_list (_menuitem *mi, SDL_Event *event) {
break; break;
case (SDL_KEYUP): case (SDL_KEYUP):
keybinput_loop (&mi->keybi, event); keybinput_loop (&mi->keybi, event);
menu_draw_entry (mi); // menu_draw_entry (mi);
break; break;
} }

@ -1,4 +1,4 @@
/* $Id: network.c,v 1.59 2004/02/01 02:47:34 stpohle Exp $ */ /* $Id: network.c,v 1.60 2004/02/02 23:30:35 patty21 Exp $ */
/* /*
network routines. network routines.
*/ */
@ -8,6 +8,7 @@
#include "chat.h" #include "chat.h"
#include "packets.h" #include "packets.h"
#include "ogcache-client.h" #include "ogcache-client.h"
#include "menu.h"
int int
network_server_port (char *server, char *host, int hostlen, char *port, int portlen) network_server_port (char *server, char *host, int hostlen, char *port, int portlen)
@ -280,38 +281,71 @@ network_loop ()
this is needed to draw the whole uppdate of everything this is needed to draw the whole uppdate of everything
*/ */
void void
draw_netupdatestate () draw_netupdatestate (char st)
{ {
char text[255]; char text[255];
int y = 0, int y = 0,
i; z,
i,
j;
SDL_Rect src, SDL_Rect src,
dest; dest;
z=gfx.res.x-110;
for (i = 0; i < MAX_PLAYERS; i++) for (i = 0; i < MAX_PLAYERS; i++)
if (PS_IS_used (players[i].state)) { if (PS_IS_used (players[i].state)) {
y += 48; y += 48;
redraw_logo (0, y, gfx.res.x, y + 48); if (st) {
redraw_logo (0, y, gfx.res.x, y + 48);
if (players[i].gfx_nr != -1) { if (players[i].gfx_nr != -1) {
dest.w = src.w = players[i].gfx->smal_size.x; dest.w = src.w = players[i].gfx->smal_size.x;
dest.h = src.h = players[i].gfx->smal_size.y; dest.h = src.h = players[i].gfx->smal_size.y;
src.x = players[i].gfx->smal_size.x * down; src.x = players[i].gfx->smal_size.x * down;
src.y = 0; src.y = 0;
dest.x = 50; dest.x = 50;
dest.y = y; dest.y = y;
SDL_BlitSurface (players[i].gfx->smal_image, &src, gfx.screen, &dest); SDL_BlitSurface (players[i].gfx->smal_image, &src, gfx.screen, &dest);
gfx_blitupdaterectadd (&dest); gfx_blitupdaterectadd (&dest);
} }
dest.x = 70;
dest.y = y+20;
dest.w = menu.listimages[1][0]->w;
dest.h = menu.listimages[1][0]->h;
gfx_blit (menu.listimages[1][0], NULL, gfx.screen, &dest, 10000);
dest.x = z+70+6;
gfx_blit (menu.listimages[1][2], NULL, gfx.screen, &dest, 10000);
// draw the bottom left and right of the list
dest.y = y+36;
gfx_blit (menu.listimages[1][8], NULL, gfx.screen, &dest, 10000);
dest.x = 70;
gfx_blit (menu.listimages[1][6], NULL, gfx.screen, &dest, 10000);
//top & bottom
for (j=4;j<z;j+=4) {
dest.x=j+70;dest.y=y+20;
gfx_blit (menu.listimages[1][1], NULL, gfx.screen, &dest, 10000);
dest.y = y+36;
gfx_blit (menu.listimages[1][7], NULL, gfx.screen, &dest, 10000);
}
//left &right
for (j=4;j<16;j+=4) {
dest.x=70;dest.y=y+20+j;
gfx_blit (menu.listimages[1][3], NULL, gfx.screen, &dest, 10000);
dest.x = z+70+6;
gfx_blit (menu.listimages[1][5], NULL, gfx.screen, &dest, 10000);
}
}
else
redraw_logo(75,y+30,75+z-10,y+40);
if (players[i].net.net_istep == 0) if (players[i].net.net_istep == 0)
sprintf (text, "%s - State : READY", players[i].name); sprintf (text, "%s", players[i].name);
else else
sprintf (text, "%s - State : DOWNLOAD", players[i].name); sprintf (text, "%s", players[i].name);
font_draw (70, y, text, 0, 4); font_draw (80, y, text, 0, 4);
text[0] = 0; text[0] = 0;
if (players[i].net.net_istep == 3) if (players[i].net.net_istep == 3)
sprintf (text, "Getting Tunnel Data %d.", players[i].net.net_status); sprintf (text, "Getting Tunnel Data %d.", players[i].net.net_status);
@ -324,9 +358,10 @@ draw_netupdatestate ()
sprintf (text, "Getting Player Data %d of %d.", players[i].net.net_status, sprintf (text, "Getting Player Data %d of %d.", players[i].net.net_status,
MAX_PLAYERS); MAX_PLAYERS);
font_draw (70, y + 32, text, 0, 4); font_draw (80, y + 32, text, 0, 4);
} }
return; gfx_blitdraw ();
return;
} }
/* /*
@ -387,7 +422,7 @@ net_transmit_gamedata ()
else else
font_draw (100, 0, "Downloading Data", 1, 0); font_draw (100, 0, "Downloading Data", 1, 0);
SDL_Flip (gfx.screen); SDL_Flip (gfx.screen);
/* /*
prepare everything for the loop prepare everything for the loop
@ -407,6 +442,8 @@ net_transmit_gamedata ()
else else
net_istep = 3; net_istep = 3;
draw_netupdatestate (1);
SDL_Flip (gfx.screen);
while (!done && (bman.state == GS_update || (GT_MP_PTPS && net_istep != 0))) { while (!done && (bman.state == GS_update || (GT_MP_PTPS && net_istep != 0))) {
/* the network thing */ /* the network thing */
@ -505,8 +542,8 @@ net_transmit_gamedata ()
} }
/* do the grafik work */ /* do the grafik work */
draw_netupdatestate (); draw_netupdatestate (0);
SDL_Flip (gfx.screen); SDL_Flip (gfx.screen);
if (SDL_PollEvent (&event) != 0) if (SDL_PollEvent (&event) != 0)
switch (event.type) { switch (event.type) {

Loading…
Cancel
Save