Mixed Powerup animation changed

origin
stpohle 23 years ago
parent ba8dfbcc86
commit 52778acba8

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.34 2003/06/01 22:57:10 stpohle Exp $ */ /* $Id: bomberclone.h,v 1.35 2003/06/02 23:32:35 stpohle Exp $ */
/* bomberclone.h */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -113,7 +113,8 @@ struct __ex_field {
struct __field { struct __field {
unsigned char type; unsigned char type;
int frame; // frame (frame > 0 && FS_stone) signed char mixframe; // data for the mixed frame
short int frame; // frame (frame > 0 && FS_stone)
int frameto; // frame to int frameto; // frame to
unsigned char special; // to save special stones unsigned char special; // to save special stones
_ex_field 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

@ -1,4 +1,4 @@
/* $Id: field.c,v 1.25 2003/06/02 21:21:17 stpohle Exp $ */ /* $Id: field.c,v 1.26 2003/06/02 23:32:36 stpohle Exp $ */
/* field.c - procedures which are needed to control the field */ /* field.c - procedures which are needed to control the field */
#include <stdlib.h> #include <stdlib.h>
@ -40,9 +40,9 @@ draw_stone (int x, int y)
} }
if (stone->type == FT_mixed) { if (stone->type == FT_mixed) {
i = 0; i = stone->mixframe;
while (i < FT_death || i == FT_mixed || i >= FT_max) if (i < FT_death || i >= FT_mixed)
i = s_random (FT_max - FT_death) + FT_death; i = FT_death;
} }
else else
i = stone->type; i = stone->type;
@ -69,18 +69,15 @@ draw_stone (int x, int y)
/* some powerup so we need to animate this too */ /* some powerup so we need to animate this too */
if (i == FT_death) if (i == FT_death)
d = PWUP_bad; d = PWUP_bad;
else if (i > FT_death && i < FT_sp_trigger) else
d = PWUP_good; d = PWUP_good;
else
d = PWUP_special;
if (i >= FT_death) { if (i >= FT_death) {
field_animation_add (x, y); field_animation_add (x, y);
srcimg = gfx.powerup[d].image; srcimg = gfx.powerup[d].image;
if (stone->frame >= gfx.powerup[d].frames) if ((stone->frame & 0xFF) >= gfx.powerup[d].frames)
stone->frame = 0; stone->frame = 0;
src.y = stone->frame * gfx.block.y; src.y = (stone->frame & 0xFF) * gfx.block.y;
} }
if (srcimg != NULL) if (srcimg != NULL)
@ -446,41 +443,48 @@ void
field_animation () field_animation ()
{ {
int i,j; int i,j;
_field *stone;
for (i = 0; i < MAX_FILEDANIMATION; i++) for (i = 0; i < MAX_FILEDANIMATION; i++)
if (fieldani[i].x >= 0 && fieldani[i].x < bman.fieldsize.x && fieldani[i].y >= 0 if (fieldani[i].x >= 0 && fieldani[i].x < bman.fieldsize.x && fieldani[i].y >= 0
&& fieldani[i].y < bman.fieldsize.y) { && fieldani[i].y < bman.fieldsize.y) {
/* check if there is a need to animate this */ /* check if there is a need to animate this */
if ((bman.field[fieldani[i].x][fieldani[i].y].type == FT_stone stone = &bman.field[fieldani[i].x][fieldani[i].y];
&& bman.field[fieldani[i].x][fieldani[i].y].frame > 0)
|| (bman.field[fieldani[i].x][fieldani[i].y].type >= FT_death)) { if ((stone->type == FT_stone && stone->frame > 0) || (stone->type >= FT_death)) {
/* animate this stone */ /* animate this stone */
if (stone->type == FT_stone) {
if (bman.field[fieldani[i].x][fieldani[i].y].type == FT_stone) { if (stone->frameto == 0)
if (bman.field[fieldani[i].x][fieldani[i].y].frameto == 0) if (stone->frame < gfx.field[FT_stone].frames) {
if (bman.field[fieldani[i].x][fieldani[i].y].frame < gfx.field[FT_stone].frames) { stone->frame++;
bman.field[fieldani[i].x][fieldani[i].y].frame++; stone->frameto = ANI_STONETIMEOUT;
bman.field[fieldani[i].x][fieldani[i].y].frameto = ANI_STONETIMEOUT;
} }
if (bman.field[fieldani[i].x][fieldani[i].y].frameto > 0) if (stone->frameto > 0)
bman.field[fieldani[i].x][fieldani[i].y].frameto--; stone->frameto--;
} }
else { /* animation is a powerup */ else { /* animation is a powerup */
/* select right powerup animation */ /* select right powerup animation */
if (bman.field[fieldani[i].x][fieldani[i].y].type == FT_death) if (stone->type == FT_death)
j = PWUP_bad; j = PWUP_bad;
else if (bman.field[fieldani[i].x][fieldani[i].y].type > FT_sp_trigger) else if (stone->type > FT_sp_trigger)
j = PWUP_special; j = PWUP_special;
else else
j = PWUP_good; j = PWUP_good;
if (bman.field[fieldani[i].x][fieldani[i].y].frameto-- <= 0 || bman.field[fieldani[i].x][fieldani[i].y].frameto > ANI_STONETIMEOUT) {
bman.field[fieldani[i].x][fieldani[i].y].frameto = ANI_STONETIMEOUT; /* do the animation of the FT_mixed */
bman.field[fieldani[i].x][fieldani[i].y].frame++; if (stone->frameto-- <= 0 || stone->frameto > ANI_STONETIMEOUT) {
stone->frameto = ANI_STONETIMEOUT;
stone->frame++;
if (stone->type == FT_mixed) {
stone->mixframe++;
if (stone->mixframe < FT_death || stone->mixframe >= FT_mixed)
stone->mixframe = FT_death;
}
} }
if (bman.field[fieldani[i].x][fieldani[i].y].frame >= gfx.powerup[j].frames) if (stone->frame >= gfx.powerup[j].frames)
bman.field[fieldani[i].x][fieldani[i].y].frame = 0; stone->frame = 0;
} }
draw_stone (fieldani[i].x, fieldani[i].y); draw_stone (fieldani[i].x, fieldani[i].y);
field_update (fieldani[i].x, fieldani[i].y); field_update (fieldani[i].x, fieldani[i].y);

Loading…
Cancel
Save