From db29b739a21fcb6cff142b0efa400b3da747bc46 Mon Sep 17 00:00:00 2001 From: stpohle Date: Mon, 5 May 2003 20:40:04 +0000 Subject: [PATCH] Animated Fire --- src/basic.h | 3 +- src/bomb.c | 73 +++++++++++- src/bomberclone.h | 10 +- src/configuration.c | 3 +- src/field.c | 11 +- src/game.c | 1 + src/gfx.c | 280 +++++++++++++++++++++++--------------------- src/gfx.h | 6 +- src/packets.c | 3 +- src/player.c | 10 +- 10 files changed, 244 insertions(+), 156 deletions(-) diff --git a/src/basic.h b/src/basic.h index b10d714..a39588c 100644 --- a/src/basic.h +++ b/src/basic.h @@ -28,7 +28,8 @@ #define MIN_FIELDSIZE_Y 9 -#define ANI_FIRETIMEOUT 20 +#define EXPLOSIONTIMEOUT 20 +#define ANI_FIRETIMEOUT 2 #define ANI_BOMBTIMEOUT 1 #define ANI_PLAYERTIMEOUT 1 #define ANI_PLAYERILLTIMEOUT 1 diff --git a/src/bomb.c b/src/bomb.c index b55a6a7..67b537c 100644 --- a/src/bomb.c +++ b/src/bomb.c @@ -40,7 +40,7 @@ draw_bomb (_bomb * bomb) bomb->frameto = ANI_BOMBTIMEOUT; bomb->frame++; }; - if (bomb->frame < 0 || bomb->frame >= gfx.bomb.frames || bomb->frameto > 20) { + if (bomb->frame < 0 || bomb->frame >= gfx.bomb.frames || bomb->frameto > ANI_BOMBTIMEOUT) { bomb->frame = 0; bomb->frameto = ANI_BOMBTIMEOUT; } @@ -71,7 +71,7 @@ bomb_explode (int p, int b) if (bomb->ex_nr == -1) bomb->ex_nr = bman.last_ex_nr++; // set bomb explosion id - bomb->to = ANI_FIRETIMEOUT; /* set the timeout for the fireexplosion */ + bomb->to = EXPLOSIONTIMEOUT; /* set the timeout for the fireexplosion */ bomb->state = BS_exploding; for (d = 0; d < 4; d++) { bomb->firer[d] = 0; @@ -152,13 +152,17 @@ get_bomb_on (int x, int y, _point bombs[]) bombs[i].x = bombs[i].y = -1; }; - +/* if frame == -1 we will draw the framenumber in + the field.ex data */ void draw_fire (int x, int y, int d, int frame) { SDL_Rect src, dest; + if (frame == -1) // no giving frame + frame = bman.field[x][y].ex[d].frame; + src.w = src.w = gfx.block.x; dest.h = src.h = gfx.block.y; @@ -207,7 +211,9 @@ restore_explosion (_bomb * bomb) _y = bomb->pos.y; for (i = 0; i < bomb->firer[d]; i++) { - bman.field[_x][_y].ex[d]--; + if (--bman.field[_x][_y].ex[d].count == 0) // there was only one explosion so + bman.field[_x][_y].ex[d].frame = 0; // reset the framenumber + if (i == 0 && d == 3) draw_stone (_x, _y); if (i > 0) @@ -292,6 +298,56 @@ explosion_check_field (int x, int y, int p, int b) }; +/* draw the explosion as far as she got */ +void +draw_explosion (_bomb * bomb) +{ + int d, + r, + dx, + dy; + _point p; + + bomb->frameto--; + if (bomb->frameto < 0 || bomb->frameto > ANI_FIRETIMEOUT) + bomb->frameto = ANI_FIRETIMEOUT; + + for (d = 0; d < 4; d++) { + switch (d) { + case (left): + dx = -1; + dy = 0; + break; + case (right): + dx = 1; + dy = 0; + break; + case (up): + dx = 0; + dy = -1; + break; + default: + dx = 0; + dy = 1; + break; + } + p.x = bomb->pos.x; + p.y = bomb->pos.y; + + for (r = 0; r < bomb->firer[d]; r++) { + if (bomb->frameto == 0) { + bman.field[p.x][p.y].ex[d].frame++; + if (bman.field[p.x][p.y].ex[d].frame >= gfx.fire.frames) + bman.field[p.x][p.y].ex[d].frame = 0; + } + draw_fire (p.x, p.y, d, -1); + p.x += dx; + p.y += dy; + } + } +} + +/* check the fields and all this */ void do_explosion (int p, int b) { @@ -327,8 +383,10 @@ do_explosion (int p, int b) if (explosion_check_field (bomb->pos.x + dx, bomb->pos.y + dy, p, b) == BS_off && bomb->firerst[d] == -1) { bomb->firer[d]++; - bman.field[bomb->pos.x + dx][bomb->pos.y + dy].ex[d]++; - draw_fire (bomb->pos.x + dx, bomb->pos.y + dy, d, 0); + bman.field[bomb->pos.x + dx][bomb->pos.y + dy].ex[d].count++; + bman.field[bomb->pos.x + dx][bomb->pos.y + dy].ex[d].frame = bomb->firer[d]; + /* if we have a slow pc we can enable this and disable the drawing animation */ + // draw_fire (bomb->pos.x + dx, bomb->pos.y + dy, d, gfx.fire.frames>>1); } else { bomb->firerst[d] = bomb->firer[d]; @@ -336,4 +394,7 @@ do_explosion (int p, int b) } } } + /* with a slow pc disable this --- maybe option over a config menu */ + if (bomb->state == BS_exploding) + draw_explosion (bomb); }; diff --git a/src/bomberclone.h b/src/bomberclone.h index cbfcc06..25f443f 100644 --- a/src/bomberclone.h +++ b/src/bomberclone.h @@ -1,4 +1,4 @@ -/* $Id: bomberclone.h,v 1.8 2003/05/05 04:14:55 stpohle Exp $ */ +/* $Id: bomberclone.h,v 1.9 2003/05/05 20:40:04 stpohle Exp $ */ /* bomberclone.h */ #ifndef _BOMBERCLONE_H_ @@ -85,12 +85,18 @@ struct __player { } typedef _player; +struct __ex_field { + unsigned char count; + unsigned char frame; +} typedef _ex_field; + + struct __field { unsigned char type; int frame; // frame (frame > 0 && FS_stone) int frameto; // frame to unsigned char special; // to save special stones - signed char ex[4]; // count up every explosion there is on this field for ever direction + _ex_field ex[4]; // count up every explosion there is on this field for ever direction int ex_nr; // number to identify the explosion. } typedef _field; diff --git a/src/configuration.c b/src/configuration.c index 3119335..ca2e5cf 100644 --- a/src/configuration.c +++ b/src/configuration.c @@ -43,9 +43,10 @@ game_init () gfx.res.x = 640; gfx.res.y = 480; gfx.bpp = 16; + sprintf (gfx.tileset,"default"); bman.fieldsize.x = 25; bman.fieldsize.y = 17; - sprintf (bman.datapath, "data/bomberclone.gfx"); + sprintf (bman.datapath, "data"); bman.fieldpath[0] = 0; }; diff --git a/src/field.c b/src/field.c index ef2169a..f58f2e8 100644 --- a/src/field.c +++ b/src/field.c @@ -1,4 +1,4 @@ -/* $Id: field.c,v 1.10 2003/05/05 16:33:57 stpohle Exp $ */ +/* $Id: field.c,v 1.11 2003/05/05 20:40:04 stpohle Exp $ */ /* field.c - procedures which are needed to control the field */ #include @@ -56,9 +56,9 @@ draw_stone (int x, int y) // draw explosions if there is any for (d = 0, i = 0; d < 4; d++) - if (stone->ex[d] > 0) { + if (stone->ex[d].count > 0) { i = 1; // mark that there is already an explosion - draw_fire (x, y, d, 0); + draw_fire (x, y, d, -1); } if (i == 0) // we don't have to do this anymore because this was happend in draw_fire @@ -115,7 +115,7 @@ field_load (FILE * map) break; } for (d = 0; d < 4; d++) - bman.field[i][sizey].ex[d] = 0; + bman.field[i][sizey].ex[d].frame = bman.field[i][sizey].ex[d].count = 0; bman.field[i][sizey].ex_nr = -1; bman.field[i][sizey].frame = 0; bman.field[i][sizey].frameto = 0; @@ -252,7 +252,6 @@ void field_set_playerposition (int usermap) { } for (i = 0; i < MAX_PLAYERS; i++) { - printf ("Playerpos [%d,%d]\n", PLX, PLY); PLX = PLX << 8; PLY = PLY << 8; } @@ -306,7 +305,7 @@ field_new (char *filename) } for (d = 0; d < 4; d++) - bman.field[x][y].ex[d] = 0; + bman.field[x][y].ex[d].frame = bman.field[x][y].ex[d].count = 0; bman.field[x][y].ex_nr = -1; bman.field[x][y].frame = 0; bman.field[x][y].frameto = 0; diff --git a/src/game.c b/src/game.c index 788bd85..955c6c6 100644 --- a/src/game.c +++ b/src/game.c @@ -88,6 +88,7 @@ game_draw_info () sprintf (text, "%s%3d ", text, bman.players[i].net.pkgopt.send_set); text[strlen(text)+1] = 0; text[strlen(text)] = ']'; + sprintf (text, "%s gfx_Rects:%d", text, UpdateRects_nr); draw_text (0, gfx.res.y - gfx.font.size.y, text, 1); gfx_AddUpdateRect (0, gfx.res.y - gfx.font.size.y, gfx.res.x, gfx.font.size.y); } diff --git a/src/gfx.c b/src/gfx.c index 93e42a6..8395ae6 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -289,7 +289,7 @@ void gfx_load_players (int sx, int sy) { /* loading the player images */ for (j = i = 0; i < MAX_PLAYERS; i++) { - sprintf (filename, "%s/player%d.bmp", bman.datapath, j); + sprintf (filename, "%s/player/player%d.bmp", bman.datapath, j); j++; tmpimage = SDL_LoadBMP (filename); if (tmpimage == NULL) { @@ -325,131 +325,23 @@ void gfx_load_players (int sx, int sy) { SDL_FreeSurface (tmpimage); } } -} - -/* load the images with teh right scaleing */ -void gfx_game_init () { - int i, - r, - g, - b; - - char filename[255]; - SDL_Surface *tmpimage, *tmpimage1; - float sfkt; - - d_printf ("GFX Init\n"); - - menu_displaytext ("Please Wait", "Loading GFX Data", 64, 64, 128); - - /* Calculate the Best Size of the Images */ - gfx.block.x = gfx.res.x / (bman.fieldsize.x+1); - gfx.block.y = (gfx.res.y - 80) / (bman.fieldsize.y+1); - - if (gfx.block.x < gfx.block.y) - gfx.block.y = gfx.block.x; - else - gfx.block.x = gfx.block.y; - - /* create Table of points */ - scale (gfx.postab, gfx.block.x, 256); - - sfkt = ((float) gfx.block.x) / ((float) GFX_IMGSIZE); - - /* calculating the best offset for the field on the screen */ - gfx.offset.x = (gfx.res.x - (gfx.block.x * bman.fieldsize.x)) / 2; - gfx.offset.y = gfx.res.y - (gfx.block.y * bman.fieldsize.y); - - /* load the fire */ - sprintf (filename, "%s/fire.bmp", bman.datapath); - tmpimage = SDL_LoadBMP (filename); - if (tmpimage == NULL) { - printf ("Can't load image: %s\n", SDL_GetError ()); - exit (1); - } - gfx.fire.frames = tmpimage->h / GFX_IMGSIZE; - tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.fire.frames * gfx.block.y); - SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, - SDL_MapRGB (tmpimage1->format, 255, 0, 255)); - gfx.fire.image = SDL_DisplayFormat (tmpimage1); - SDL_FreeSurface (tmpimage); - SDL_FreeSurface (tmpimage1); - - - /* load the bomb */ - sprintf (filename, "%s/bomb.bmp", bman.datapath); - tmpimage = SDL_LoadBMP (filename); - if (tmpimage == NULL) { - printf ("Can't load image: %s\n", SDL_GetError ()); - exit (1); - } - gfx.bomb.frames = tmpimage->h / GFX_IMGSIZE; - tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.bomb.frames * gfx.block.y); - getRGBpixel (tmpimage1, 0, 0, &r, &g, &b); - SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, r, g, b)); - gfx.bomb.image = SDL_DisplayFormat (tmpimage1); - SDL_FreeSurface (tmpimage); - SDL_FreeSurface (tmpimage1); /* load the illnessthing */ - sprintf (filename, "%s/playersick.bmp", bman.datapath); + sprintf (filename, "%s/player/playersick.bmp", bman.datapath); tmpimage = SDL_LoadBMP (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); exit (1); } gfx.ill.frames = tmpimage->h / (2*GFX_IMGSIZE); - tmpimage1 = scale_image (tmpimage, (tmpimage->w / (2*GFX_IMGSIZE)) * (2 * gfx.block.x), gfx.ill.frames * (2*gfx.block.y)); + tmpimage1 = scale_image (tmpimage, (tmpimage->w / (2*GFX_IMGSIZE)) * (2 * sx), gfx.ill.frames * (2*sy)); getRGBpixel (tmpimage1, 0, 0, &r, &g, &b); SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, r, g, b)); gfx.ill.image = SDL_DisplayFormat (tmpimage1); SDL_FreeSurface (tmpimage); SDL_FreeSurface (tmpimage1); - /* loading the field images */ - for (i = 0; i < FT_max; i++) { - switch (i) { - case (FT_nothing): - sprintf (filename, "%s/background.bmp", bman.datapath); - break; - case (FT_stone): - sprintf (filename, "%s/stone.bmp", bman.datapath); - break; - case (FT_block): - sprintf (filename, "%s/block.bmp", bman.datapath); - break; - case (FT_death): - sprintf (filename, "%s/fielddeath.bmp", bman.datapath); - break; - case (FT_bomb): - sprintf (filename, "%s/fieldbomb.bmp", bman.datapath); - break; - case (FT_fire): - sprintf (filename, "%s/fieldfire.bmp", bman.datapath); - break; - case (FT_shoe): - sprintf (filename, "%s/fieldshoe.bmp", bman.datapath); - break; - } - - tmpimage = SDL_LoadBMP (filename); - if (tmpimage == NULL) { - printf ("Can't load image: %s\n", SDL_GetError ()); - exit (1); - } - gfx.field[i].frames = tmpimage->h / GFX_IMGSIZE; - tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.field[i].frames * gfx.block.y); - SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, 255, 255, 255)); - gfx.field[i].image = SDL_DisplayFormat (tmpimage1); - SDL_FreeSurface (tmpimage); - SDL_FreeSurface (tmpimage1); - } - - /* loading the player images */ - gfx_load_players (gfx.block.x, gfx.block.y); - - UpdateRects_nr = 0; } /* frees the player images */ @@ -464,34 +356,28 @@ void gfx_free_players () { SDL_FreeSurface (gfx.players[i].smal_image); gfx.players[i].smal_image = NULL; } + + SDL_FreeSurface (gfx.ill.image); } -void gfx_game_shutdown () { - int i; +/* load the images with the right scaleing */ +void gfx_game_init () { + menu_displaytext ("Loading..", "Please Wait", 32, 128, 32); - menu_displaytext ("Please Wait", "Freeing GFX Data", 64, 128, 64); - - for (i = 0; i < FT_max; i++) { - if (gfx.field[i].image != NULL) - SDL_FreeSurface (gfx.field[i].image); - gfx.field[i].image = NULL; - } + gfx_load_tileset (gfx.tileset); + gfx_load_players (gfx.block.x,gfx.block.y); +} + + +void gfx_game_shutdown () { + menu_displaytext ("Freeing..", "Please Wait", 32, 128, 32); gfx_free_players (); - - if (gfx.bomb.image != NULL) - SDL_FreeSurface (gfx.bomb.image); - - if (gfx.fire.image != NULL) - SDL_FreeSurface (gfx.fire.image); - - gfx.bomb.image = NULL; - gfx.fire.image = NULL; + gfx_free_tileset (); }; - /* init the whole GFX Part */ void gfx_init () { if (gfx.fullscreen) @@ -523,7 +409,7 @@ gfx_loaddata () SDL_Surface *tmpimage, *tmpimage1; /* load the font */ - sprintf (filename, "%s/font.bmp", bman.datapath); + sprintf (filename, "%s/gfx/font.bmp", bman.datapath); tmpimage = SDL_LoadBMP (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); @@ -537,7 +423,7 @@ gfx_loaddata () SDL_FreeSurface (tmpimage); /* load the font */ - sprintf (filename, "%s/font1.bmp", bman.datapath); + sprintf (filename, "%s/gfx/font1.bmp", bman.datapath); tmpimage = SDL_LoadBMP (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); @@ -551,7 +437,7 @@ gfx_loaddata () SDL_FreeSurface (tmpimage); /* load the logo */ - sprintf (filename, "%s/logo.bmp", bman.datapath); + sprintf (filename, "%s/gfx/logo.bmp", bman.datapath); tmpimage = SDL_LoadBMP (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); @@ -564,9 +450,8 @@ gfx_loaddata () gfx.logo = SDL_DisplayFormat (tmpimage1); SDL_FreeSurface (tmpimage1); - /* load the menuselector */ - sprintf (filename, "%s/menuselect.bmp", bman.datapath); + sprintf (filename, "%s/gfx/menuselect.bmp", bman.datapath); tmpimage = SDL_LoadBMP (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); @@ -763,3 +648,128 @@ SDL_Surface *gfx_copyscreen (SDL_Rect *wnd) { SDL_BlitSurface (gfx.screen, wnd, res, &dest); return res; }; + + +void gfx_load_tileset (char *tileset) { + int i, + r, + g, + b; + + char filename[255]; + SDL_Surface *tmpimage, *tmpimage1; + float sfkt; + + d_printf ("Loading Tileset\n"); + + /* Calculate the Best Size of the Images */ + gfx.block.x = gfx.res.x / (bman.fieldsize.x+1); + gfx.block.y = (gfx.res.y - 80) / (bman.fieldsize.y+1); + + if (gfx.block.x < gfx.block.y) + gfx.block.y = gfx.block.x; + else + gfx.block.x = gfx.block.y; + + /* create Table of points */ + scale (gfx.postab, gfx.block.x, 256); + + sfkt = ((float) gfx.block.x) / ((float) GFX_IMGSIZE); + + /* calculating the best offset for the field on the screen */ + gfx.offset.x = (gfx.res.x - (gfx.block.x * bman.fieldsize.x)) / 2; + gfx.offset.y = gfx.res.y - (gfx.block.y * bman.fieldsize.y); + + /* load the fire */ + sprintf (filename, "%s/tileset/%s/fire.bmp", bman.datapath,tileset); + tmpimage = SDL_LoadBMP (filename); + if (tmpimage == NULL) { + printf ("Can't load image: %s\n", SDL_GetError ()); + exit (1); + } + gfx.fire.frames = tmpimage->h / GFX_IMGSIZE; + tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.fire.frames * gfx.block.y); + getRGBpixel (tmpimage1, 0, 0, &r, &g, &b); + SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, r, g, b)); + gfx.fire.image = SDL_DisplayFormat (tmpimage1); + SDL_FreeSurface (tmpimage); + SDL_FreeSurface (tmpimage1); + + + /* load the bomb */ + sprintf (filename, "%s/tileset/%s/bomb.bmp", bman.datapath, tileset); + tmpimage = SDL_LoadBMP (filename); + if (tmpimage == NULL) { + printf ("Can't load image: %s\n", SDL_GetError ()); + exit (1); + } + gfx.bomb.frames = tmpimage->h / GFX_IMGSIZE; + tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.bomb.frames * gfx.block.y); + getRGBpixel (tmpimage1, 0, 0, &r, &g, &b); + SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, r, g, b)); + gfx.bomb.image = SDL_DisplayFormat (tmpimage1); + SDL_FreeSurface (tmpimage); + SDL_FreeSurface (tmpimage1); + + /* loading the field images */ + for (i = 0; i < FT_max; i++) { + switch (i) { + case (FT_nothing): + sprintf (filename, "%s/tileset/%s/background.bmp", bman.datapath, tileset); + break; + case (FT_stone): + sprintf (filename, "%s/tileset/%s/stone.bmp", bman.datapath, tileset); + break; + case (FT_block): + sprintf (filename, "%s/tileset/%s/block.bmp", bman.datapath, tileset); + break; + case (FT_death): + sprintf (filename, "%s/tileset/%s/fielddeath.bmp", bman.datapath, tileset); + break; + case (FT_bomb): + sprintf (filename, "%s/tileset/%s/fieldbomb.bmp", bman.datapath, tileset); + break; + case (FT_fire): + sprintf (filename, "%s/tileset/%s/fieldfire.bmp", bman.datapath, tileset); + break; + case (FT_shoe): + sprintf (filename, "%s/tileset/%s/fieldshoe.bmp", bman.datapath, tileset); + break; + } + + tmpimage = SDL_LoadBMP (filename); + if (tmpimage == NULL) { + printf ("Can't load image: %s\n", SDL_GetError ()); + exit (1); + } + gfx.field[i].frames = tmpimage->h / GFX_IMGSIZE; + tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.field[i].frames * gfx.block.y); + SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, 255, 255, 255)); + gfx.field[i].image = SDL_DisplayFormat (tmpimage1); + SDL_FreeSurface (tmpimage); + SDL_FreeSurface (tmpimage1); + } + + UpdateRects_nr = 0; +}; + + +void gfx_free_tileset () { + int i; + + for (i = 0; i < FT_max; i++) { + if (gfx.field[i].image != NULL) + SDL_FreeSurface (gfx.field[i].image); + gfx.field[i].image = NULL; + } + + if (gfx.bomb.image != NULL) + SDL_FreeSurface (gfx.bomb.image); + + if (gfx.fire.image != NULL) + SDL_FreeSurface (gfx.fire.image); + + gfx.bomb.image = NULL; + gfx.fire.image = NULL; +}; + diff --git a/src/gfx.h b/src/gfx.h index ee4d2d0..ab69b56 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -50,7 +50,9 @@ struct __gfx { _gfxani bomb; // bomb animation _gfxani ill; // sick animation above the player - _gfxani menuselect; // The Menu Select GFX (the bomb ?) + _gfxani menuselect; // The Menu Select GFX (the bomb ?) + + char tileset[255]; // pathname to the tileset SDL_Surface *logo; } typedef _gfx; @@ -80,6 +82,8 @@ extern void gfx_unlocksurface (SDL_Surface *surface); extern void redraw_logo_shaded (int x, int y, int w, int h, int c); extern void gfx_load_players (int sx, int sy); extern void gfx_free_players (); +extern void gfx_load_tileset (char *tileset); +extern void gfx_free_tileset (); extern SDL_Surface *makegray_image (SDL_Surface *org); extern SDL_Surface *gfx_copyscreen (SDL_Rect *wnd); diff --git a/src/packets.c b/src/packets.c index 9a5984f..940bb26 100644 --- a/src/packets.c +++ b/src/packets.c @@ -723,8 +723,7 @@ send_fieldline (_net_addr * addr, int line) bman.field[i][line].frameto = 0; bman.field[i][line].ex_nr = 0; for (j = 0; j < 4; j++) - bman.field[i][line].ex[j] = 0; - + bman.field[i][line].ex[j].frame = bman.field[i][line].ex[j].count = 0; } send_pkg ((struct pkg *) &f_dat, addr); }; diff --git a/src/player.c b/src/player.c index 225c4fa..d95fbce 100644 --- a/src/player.c +++ b/src/player.c @@ -65,8 +65,14 @@ restore_players_screen () for (i = 0; i < MAX_PLAYERS; i++) if ((PS_IS_used (bman.players[i].state)) && bman.players[i].old.x != -1) { - x = (bman.players[i].old.x >> 8) - 1; - xe = (bman.players[i].old.x >> 8) + 2; + if ((bman.players[i].old.x & 0xFF) > 128) { + x = (bman.players[i].old.x >> 8); + xe = (bman.players[i].old.x >> 8) + 2; + } + else { + x = (bman.players[i].old.x >> 8) - 1; + xe = (bman.players[i].old.x >> 8) +1; + } if (x < 0) x = 0; if (xe >= bman.fieldsize.x)