|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: field.c,v 1.23 2003/06/01 22:57:10 stpohle Exp $ */
|
|
|
|
|
/* $Id: field.c,v 1.24 2003/06/01 23:08:34 stpohle Exp $ */
|
|
|
|
|
/* field.c - procedures which are needed to control the field */
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
@ -42,14 +42,6 @@ draw_stone (int x, int y)
|
|
|
|
|
/* animate the stone if needed only for exploding stone */
|
|
|
|
|
if (stone->type == FT_stone && stone->frame > 0) {
|
|
|
|
|
field_animation_add (x, y);
|
|
|
|
|
if (stone->frameto == 0)
|
|
|
|
|
if (stone->frame < gfx.field[stone->type].frames) {
|
|
|
|
|
stone->frame++;
|
|
|
|
|
stone->frameto = ANI_STONETIMEOUT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stone->frameto > 0)
|
|
|
|
|
stone->frameto--;
|
|
|
|
|
|
|
|
|
|
if (stone->frame < gfx.field[FT_stone].frames) {
|
|
|
|
|
src.y = stone->frame * gfx.block.y;
|
|
|
|
@ -70,14 +62,6 @@ draw_stone (int x, int y)
|
|
|
|
|
else if (stone->type >= FT_death) {
|
|
|
|
|
field_animation_add (x, y);
|
|
|
|
|
|
|
|
|
|
if (stone->frameto-- <= 0 || stone->frameto > ANI_STONETIMEOUT) {
|
|
|
|
|
stone->frameto = ANI_STONETIMEOUT;
|
|
|
|
|
stone->frame++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stone->frame >= gfx.powerup.frames)
|
|
|
|
|
stone->frame = 0;
|
|
|
|
|
|
|
|
|
|
srcimg = gfx.powerup.image;
|
|
|
|
|
src.y = stone->frame * gfx.block.y;
|
|
|
|
|
}
|
|
|
|
@ -441,15 +425,39 @@ field_new (char *filename)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* run this to every game cycle for the animations on the field */
|
|
|
|
|
void field_animation () {
|
|
|
|
|
void
|
|
|
|
|
field_animation ()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_FILEDANIMATION; i++)
|
|
|
|
|
if (fieldani[i].x >= 0 && fieldani[i].x < bman.fieldsize.x && fieldani[i].y >= 0 && fieldani[i].y < bman.fieldsize.y) {
|
|
|
|
|
if (fieldani[i].x >= 0 && fieldani[i].x < bman.fieldsize.x && fieldani[i].y >= 0
|
|
|
|
|
&& fieldani[i].y < bman.fieldsize.y) {
|
|
|
|
|
/* check if there is a need to animate this */
|
|
|
|
|
if ((bman.field[fieldani[i].x][fieldani[i].y].type == FT_stone && bman.field[fieldani[i].x][fieldani[i].y].frame > 0) ||
|
|
|
|
|
(bman.field[fieldani[i].x][fieldani[i].y].type >= FT_death)) {
|
|
|
|
|
if ((bman.field[fieldani[i].x][fieldani[i].y].type == FT_stone
|
|
|
|
|
&& bman.field[fieldani[i].x][fieldani[i].y].frame > 0)
|
|
|
|
|
|| (bman.field[fieldani[i].x][fieldani[i].y].type >= FT_death)) {
|
|
|
|
|
/* animate this stone */
|
|
|
|
|
|
|
|
|
|
if (bman.field[fieldani[i].x][fieldani[i].y].type == FT_stone) {
|
|
|
|
|
if (bman.field[fieldani[i].x][fieldani[i].y].frameto == 0)
|
|
|
|
|
if (bman.field[fieldani[i].x][fieldani[i].y].frame < gfx.field[FT_stone].frames) {
|
|
|
|
|
bman.field[fieldani[i].x][fieldani[i].y].frame++;
|
|
|
|
|
bman.field[fieldani[i].x][fieldani[i].y].frameto = ANI_STONETIMEOUT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bman.field[fieldani[i].x][fieldani[i].y].frameto > 0)
|
|
|
|
|
bman.field[fieldani[i].x][fieldani[i].y].frameto--;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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;
|
|
|
|
|
bman.field[fieldani[i].x][fieldani[i].y].frame++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bman.field[fieldani[i].x][fieldani[i].y].frame >= gfx.powerup.frames)
|
|
|
|
|
bman.field[fieldani[i].x][fieldani[i].y].frame = 0;
|
|
|
|
|
}
|
|
|
|
|
draw_stone (fieldani[i].x, fieldani[i].y);
|
|
|
|
|
field_update (fieldani[i].x, fieldani[i].y);
|
|
|
|
|
}
|
|
|
|
@ -462,8 +470,12 @@ void field_animation () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* add a new field to the animation data */
|
|
|
|
|
void field_animation_add (int x, int y) {
|
|
|
|
|
int i, j = -1, d = -1;
|
|
|
|
|
void
|
|
|
|
|
field_animation_add (int x, int y)
|
|
|
|
|
{
|
|
|
|
|
int i,
|
|
|
|
|
j = -1,
|
|
|
|
|
d = -1;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_FILEDANIMATION; i++) {
|
|
|
|
|
if (fieldani[i].x == x && fieldani[i].y == y)
|
|
|
|
|