some animation problem fixed.. mostly the frames still wasn't all with float

origin
stpohle 22 years ago
parent e6c0221207
commit de3c0860d6

@ -1,4 +1,4 @@
/* $Id: map.h,v 1.4 2003/11/08 06:27:58 stpohle Exp $ */ /* $Id: map.h,v 1.5 2003/11/08 20:14:31 stpohle Exp $ */
/* map.h */ /* map.h */
#ifndef _MAP_H_ #ifndef _MAP_H_
@ -6,8 +6,8 @@
struct __ex_field { struct __ex_field {
unsigned char count; unsigned char count;
unsigned char frame; // we may have to change this.. because the frames float frame;
} typedef _ex_field; // might have all put to float. } typedef _ex_field;
struct __field { struct __field {

@ -80,7 +80,10 @@ struct pkg_field {
signed char mixframe; // data for the mixed frame signed char mixframe; // data for the mixed frame
Sint16 frame; // frame (frame > 0 && FS_stone) Sint16 frame; // frame (frame > 0 && FS_stone)
unsigned char special; // to save special stones, or the tunnel number unsigned char special; // to save special stones, or the tunnel number
_ex_field ex[4]; // count up every explosion there is on this field for ever direction struct {
unsigned char count;
unsigned char frame;
} ex[4]; // count up every explosion there is on this field for ever direction
Sint32 ex_nr; // number to identify the explosion. Sint32 ex_nr; // number to identify the explosion.
}; };

@ -1,4 +1,4 @@
/* $Id: bomb.c,v 1.49 2003/11/08 19:53:07 stpohle Exp $ */ /* $Id: bomb.c,v 1.50 2003/11/08 20:14:32 stpohle Exp $ */
/* everything what have to do with the bombs */ /* everything what have to do with the bombs */
#include "bomberclone.h" #include "bomberclone.h"
@ -20,7 +20,7 @@ draw_bomb (_bomb * bomb)
if (bomb->state != BS_trigger if (bomb->state != BS_trigger
|| ((bomb->state == BS_trigger) && (bomb->to < BOMB_TIMEOUT))) { || ((bomb->state == BS_trigger) && (bomb->to < BOMB_TIMEOUT))) {
/* check the framenumber */ /* check the framenumber */
bomb->frame += timefactor; bomb->frame += (timefactor/3.0);
if (bomb->frame < 0 || bomb->frame >= gfx.bomb.frames) if (bomb->frame < 0 || bomb->frame >= gfx.bomb.frames)
bomb->frame = 0.0f; bomb->frame = 0.0f;
} }
@ -277,7 +277,7 @@ draw_fire (int x, int y, int d, int frame)
dest.x = gfx.offset.x + x * gfx.block.x; dest.x = gfx.offset.x + x * gfx.block.x;
dest.y = gfx.offset.y + y * gfx.block.y; dest.y = gfx.offset.y + y * gfx.block.y;
src.y = (int)frame * src.w; src.y = frame * src.w;
src.x = d * src.w; src.x = d * src.w;
gfx_blit (gfx.fire.image, &src, gfx.screen, &dest, (y * 100)); gfx_blit (gfx.fire.image, &src, gfx.screen, &dest, (y * 100));

@ -1,4 +1,4 @@
/* $Id: field.c,v 1.49 2003/11/08 19:53:07 stpohle Exp $ */ /* $Id: field.c,v 1.50 2003/11/08 20:14:32 stpohle Exp $ */
/* field.c - procedures which are needed to control the field */ /* field.c - procedures which are needed to control the field */
#include "bomberclone.h" #include "bomberclone.h"
@ -133,7 +133,7 @@ draw_stone (int x, int y)
} }
else if (stone->type > FT_nothing && stone->type < FT_death) { else if (stone->type > FT_nothing && stone->type < FT_death) {
src.y = stone->frame * gfx.field[stone->type].h; src.y = (int)stone->frame * gfx.field[stone->type].h;
dest.h = src.h = gfx.field[stone->type].h; dest.h = src.h = gfx.field[stone->type].h;
dest.y -= (gfx.field[stone->type].h - gfx.field[stone->type].w); dest.y -= (gfx.field[stone->type].h - gfx.field[stone->type].w);
srcimg = gfx.field[stone->type].image; srcimg = gfx.field[stone->type].image;
@ -152,7 +152,7 @@ draw_stone (int x, int y)
srcimg = gfx.powerup[d].image; srcimg = gfx.powerup[d].image;
if (stone->frame >= gfx.powerup[d].frames) if (stone->frame >= gfx.powerup[d].frames)
stone->frame = 0; stone->frame = 0;
src.y = stone->frame * gfx.block.y; src.y = (int)stone->frame * gfx.block.y;
} }
if (srcimg != NULL && stone->type != FT_tunnel) if (srcimg != NULL && stone->type != FT_tunnel)
@ -171,7 +171,7 @@ draw_stone (int x, int y)
if (y < map.size.y - 1 if (y < map.size.y - 1
&& gfx.field[map.field[x][y + 1].type].h > gfx.field[map.field[x][y + 1].type].w) { && gfx.field[map.field[x][y + 1].type].h > gfx.field[map.field[x][y + 1].type].w) {
src.x = 0; src.x = 0;
src.y = map.field[x][y + 1].frame * gfx.field[map.field[x][y + 1].type].h; src.y = (int)map.field[x][y + 1].frame * gfx.field[map.field[x][y + 1].type].h;
dest.h = src.h = dest.h = src.h =
gfx.field[map.field[x][y + 1].type].h - gfx.field[map.field[x][y + 1].type].w; gfx.field[map.field[x][y + 1].type].h - gfx.field[map.field[x][y + 1].type].w;
dest.w = src.w = gfx.field[map.field[x][y + 1].type].w; dest.w = src.w = gfx.field[map.field[x][y + 1].type].w;
@ -189,8 +189,8 @@ draw_stone (int x, int y)
draw_fire (x, y, d, -1); draw_fire (x, y, d, -1);
} }
if (debug) // if (debug)
font_gfxdraw (dest.x, dest.y, (map.bfield[x][y] == 0) ? "0" : "1", 0, (y*256) + 10); // font_gfxdraw (dest.x, dest.y, (map.bfield[x][y] == 0) ? "0" : "1", 0, (y*256) + 10);
return; return;
}; };
@ -248,7 +248,7 @@ field_animation ()
/* animate this stone */ /* animate this stone */
if (stone->type == FT_stone) { if (stone->type == FT_stone) {
if (stone->frame < gfx.field[FT_stone].frames) if (stone->frame < gfx.field[FT_stone].frames)
stone->frame += timefactor; stone->frame += (timefactor/4.0f);
} }
else { /* animation is a powerup */ else { /* animation is a powerup */
/* select right powerup animation */ /* select right powerup animation */
@ -261,7 +261,7 @@ field_animation ()
/* do the animation of the FT_mixed */ /* do the animation of the FT_mixed */
oldframe = (int)stone->frame; oldframe = (int)stone->frame;
stone->frame += timefactor; stone->frame += (timefactor/4.0f);
if ((int)stone->frame != oldframe && stone->type == FT_mixed) { if ((int)stone->frame != oldframe && stone->type == FT_mixed) {
stone->mixframe++; stone->mixframe++;
if (stone->mixframe < FT_death || stone->mixframe >= FT_mixed) if (stone->mixframe < FT_death || stone->mixframe >= FT_mixed)

@ -324,6 +324,7 @@ void
send_field (_net_addr * addr, int x, int y, _field * field) send_field (_net_addr * addr, int x, int y, _field * field)
{ {
struct pkg_field f_dat; struct pkg_field f_dat;
int i;
d_printf ("send_field [%d,%d]\n", x, y); d_printf ("send_field [%d,%d]\n", x, y);
@ -337,8 +338,10 @@ send_field (_net_addr * addr, int x, int y, _field * field)
if (x < 0 || x >= map.size.x || y < 0 || y >= map.size.y) if (x < 0 || x >= map.size.x || y < 0 || y >= map.size.y)
return; return;
memcpy (&f_dat.ex, &map.field[x][y].ex, 4*sizeof (_ex_field)); for (i = 0; i < 4; i++) {
f_dat.ex[i].count = map.field[x][y].ex[i].count;
f_dat.ex[i].frame = (int)map.field[x][y].ex[i].frame;
}
f_dat.type = map.field[x][y].type; f_dat.type = map.field[x][y].type;
f_dat.mixframe = map.field[x][y].mixframe; f_dat.mixframe = map.field[x][y].mixframe;
f_dat.special = map.field[x][y].special; f_dat.special = map.field[x][y].special;
@ -352,6 +355,8 @@ send_field (_net_addr * addr, int x, int y, _field * field)
void void
do_field (struct pkg_field *f_dat, _net_addr * addr) do_field (struct pkg_field *f_dat, _net_addr * addr)
{ {
int i;
if (addr->pl_nr == -1) if (addr->pl_nr == -1)
return; return;
@ -360,7 +365,10 @@ do_field (struct pkg_field *f_dat, _net_addr * addr)
map.field[f_dat->x][f_dat->y].type = f_dat->type; map.field[f_dat->x][f_dat->y].type = f_dat->type;
map.field[f_dat->x][f_dat->y].mixframe = f_dat->mixframe; map.field[f_dat->x][f_dat->y].mixframe = f_dat->mixframe;
map.field[f_dat->x][f_dat->y].special = f_dat->special; map.field[f_dat->x][f_dat->y].special = f_dat->special;
memcpy (&map.field[f_dat->x][f_dat->y].ex, &f_dat->ex, 4*sizeof (_ex_field)); for (i = 0; i < 4; i++) {
map.field[f_dat->x][f_dat->y].ex[i].count = f_dat->ex[i].count;
map.field[f_dat->x][f_dat->y].ex[i].frame = f_dat->ex[i].frame;
}
map.field[f_dat->x][f_dat->y].frame = I16TOF (NTOH16 (f_dat->frame)); map.field[f_dat->x][f_dat->y].frame = I16TOF (NTOH16 (f_dat->frame));
map.field[f_dat->x][f_dat->y].ex_nr = NTOH32 (f_dat->ex_nr); map.field[f_dat->x][f_dat->y].ex_nr = NTOH32 (f_dat->ex_nr);
} }
@ -856,8 +864,10 @@ send_fieldline (_net_addr * addr, int line)
f_dat.special[i] = map.field[i][line].special; f_dat.special[i] = map.field[i][line].special;
map.field[i][line].frame = 0.0f; map.field[i][line].frame = 0.0f;
map.field[i][line].ex_nr = 0; map.field[i][line].ex_nr = 0;
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++) {
map.field[i][line].ex[j].frame = map.field[i][line].ex[j].count = 0; map.field[i][line].ex[j].frame = 0.0f;
map.field[i][line].ex[j].count = 0;
}
} }
send_pkg ((struct pkg *) &f_dat, addr); send_pkg ((struct pkg *) &f_dat, addr);
}; };
@ -890,8 +900,10 @@ do_fieldline (struct pkg_fieldline *f_dat, _net_addr * addr)
map.field[i][f_dat->line].type = f_dat->type[i]; map.field[i][f_dat->line].type = f_dat->type[i];
map.field[i][f_dat->line].special = f_dat->special[i]; map.field[i][f_dat->line].special = f_dat->special[i];
map.field[i][f_dat->line].frame = 0.0f; map.field[i][f_dat->line].frame = 0.0f;
for (d = 0; d < 4; d++) for (d = 0; d < 4; d++) {
map.field[i][f_dat->line].ex[d].frame = map.field[i][f_dat->line].ex[d].count = 0; map.field[i][f_dat->line].ex[d].frame = 0.0f;
map.field[i][f_dat->line].ex[d].count = 0;
}
} }
}; };

Loading…
Cancel
Save