|
|
@ -1,4 +1,4 @@
|
|
|
|
/* $Id: flyingitems.c,v 1.1 2004/01/25 23:02:20 stpohle Exp $ */
|
|
|
|
/* $Id: flyingitems.c,v 1.2 2004/01/26 05:39:38 stpohle Exp $ */
|
|
|
|
|
|
|
|
|
|
|
|
#include "bomberclone.h"
|
|
|
|
#include "bomberclone.h"
|
|
|
|
#include "flyingitems.h"
|
|
|
|
#include "flyingitems.h"
|
|
|
@ -41,6 +41,12 @@ void flitems_loop () {
|
|
|
|
_flyingitem **old = &flitems_first; // pointer of the preview next pointer
|
|
|
|
_flyingitem **old = &flitems_first; // pointer of the preview next pointer
|
|
|
|
|
|
|
|
|
|
|
|
for (; flitem != NULL; flitem = flitem->next) {
|
|
|
|
for (; flitem != NULL; flitem = flitem->next) {
|
|
|
|
|
|
|
|
/* restore the old position */
|
|
|
|
|
|
|
|
stonelist_add (floorf (flitem->pos.x), floorf (flitem->pos.y));
|
|
|
|
|
|
|
|
stonelist_add (floorf (flitem->pos.x), floorf (flitem->pos.y)+1);
|
|
|
|
|
|
|
|
stonelist_add (floorf (flitem->pos.x)+1, floorf (flitem->pos.y));
|
|
|
|
|
|
|
|
stonelist_add (floorf (flitem->pos.x)+1, floorf (flitem->pos.y)+1);
|
|
|
|
|
|
|
|
|
|
|
|
flitem->step += (2*timediff);
|
|
|
|
flitem->step += (2*timediff);
|
|
|
|
if (flitem->type == FT_nothing || flitem->step >= 1.0f) {
|
|
|
|
if (flitem->type == FT_nothing || flitem->step >= 1.0f) {
|
|
|
|
/* finished delete element and put it on the right place */
|
|
|
|
/* finished delete element and put it on the right place */
|
|
|
@ -55,10 +61,6 @@ void flitems_loop () {
|
|
|
|
flitem->next = NULL;
|
|
|
|
flitem->next = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { /* still moving draw item */
|
|
|
|
else { /* still moving draw item */
|
|
|
|
stonelist_add (floorf (flitem->pos.x), floorf (flitem->pos.y));
|
|
|
|
|
|
|
|
stonelist_add (floorf (flitem->pos.x), floorf (flitem->pos.y)+1);
|
|
|
|
|
|
|
|
stonelist_add (floorf (flitem->pos.x)+1, floorf (flitem->pos.y));
|
|
|
|
|
|
|
|
stonelist_add (floorf (flitem->pos.x)+1, floorf (flitem->pos.y)+1);
|
|
|
|
|
|
|
|
flitem->pos.x = (1.0f - flitem->step) * (flitem->from.x - flitem->to.x) + flitem->to.x;
|
|
|
|
flitem->pos.x = (1.0f - flitem->step) * (flitem->from.x - flitem->to.x) + flitem->to.x;
|
|
|
|
flitem->pos.y = (1.0f - flitem->step) * (flitem->from.y - flitem->to.y) + flitem->to.y;
|
|
|
|
flitem->pos.y = (1.0f - flitem->step) * (flitem->from.y - flitem->to.y) + flitem->to.y;
|
|
|
|
flitems_draw (flitem);
|
|
|
|
flitems_draw (flitem);
|
|
|
@ -119,6 +121,7 @@ _point flitems_randompos (int p_nr) {
|
|
|
|
|
|
|
|
|
|
|
|
/* check if the field is good */
|
|
|
|
/* check if the field is good */
|
|
|
|
check = (to.x > 0 && to.y > 0 && to.x < map.size.x-1 && to.y < map.size.y-1 &&
|
|
|
|
check = (to.x > 0 && to.y > 0 && to.x < map.size.x-1 && to.y < map.size.y-1 &&
|
|
|
|
|
|
|
|
flitems_checkfreepos (to) &&
|
|
|
|
(map.field[to.x][to.y].type == FT_nothing
|
|
|
|
(map.field[to.x][to.y].type == FT_nothing
|
|
|
|
|| (map.field[to.x][to.y].type == FT_stone && map.field[to.x][to.y].special == FT_nothing)));
|
|
|
|
|| (map.field[to.x][to.y].type == FT_stone && map.field[to.x][to.y].special == FT_nothing)));
|
|
|
|
} while ( !check && maxtry > 200);
|
|
|
|
} while ( !check && maxtry > 200);
|
|
|
@ -185,3 +188,14 @@ void flitems_draw (_flyingitem *flitem) {
|
|
|
|
gfx_blit (gfx.powerup[0].image, &src, gfx.screen, &dest, (((int)flitems->pos.y + 1.0)*256) + 255);
|
|
|
|
gfx_blit (gfx.powerup[0].image, &src, gfx.screen, &dest, (((int)flitems->pos.y + 1.0)*256) + 255);
|
|
|
|
gfx_blit (srci, &src, gfx.screen, &dest, (((int)flitems->pos.y + 1.0)*256) + 256);
|
|
|
|
gfx_blit (srci, &src, gfx.screen, &dest, (((int)flitems->pos.y + 1.0)*256) + 256);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* check if not a flying item is going to this position */
|
|
|
|
|
|
|
|
int flitems_checkfreepos (_point to) {
|
|
|
|
|
|
|
|
_flyingitem *item = flitems_first;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (item != NULL && ((int)item->to.x != to.x || (int)item->to.y != to.y))
|
|
|
|
|
|
|
|
item = item->next;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (item == NULL);
|
|
|
|
|
|
|
|
};
|
|
|
|