started to work on smooth bombmovement

origin
patty21 23 years ago
parent 9a75a5bde2
commit fdef75cc02

@ -65,6 +65,31 @@ bomb_explode (int p, int b, int net)
};
void
bomb_move (_bomb *bomb)
{
_point npos;
if (bomb->pos.x==bomb->moveto.x) {
if (bomb->pos.y==bomb->moveto.y) {
bomb->moves=0;return;}
if (bomb->pos.y>bomb->moveto.y) {
npos.y=bomb->pos.y-bomb->moves; //move bomb up
npos.x=bomb->pos.x;
} else {
npos.y=bomb->pos.y+bomb->moves; // move bomb down
npos.x=bomb->pos.x;
}
} else {
if (bomb->pos.x>bomb->moveto.x) {
npos.x=bomb->pos.x-bomb->moves; //move bomb left
npos.y=bomb->pos.y;
} else {
npos.x=bomb->pos.x+bomb->moves; // move bomb right
npos.y=bomb->pos.y;
}
}
}
int
bomb_loop ()
{
@ -99,6 +124,7 @@ bomb_loop ()
}
draw_bomb (bomb);
}
// if (bomb->moves>0) bomb_move(bomb);
b++; // Count ticking Bombs for Return value
break;
case BS_exploding:

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.35 2003/06/02 23:32:35 stpohle Exp $ */
/* $Id: bomberclone.h,v 1.36 2003/06/04 19:53:52 patty21 Exp $ */
/* bomberclone.h */
#ifndef _BOMBERCLONE_H_
@ -60,6 +60,9 @@ struct __bomb {
unsigned char r; // range of the bomb
unsigned char state; // state of the bomb
int ex_nr; // explosion number
_point moveto; // destination to move the bomb to
int moves; // bomb moving speed
} typedef _bomb;
struct __special {

@ -127,8 +127,9 @@ special_push (int p_nr)
for (i = 0; bombs[i].x != -1; i++) {
b = &bman.players[bombs[i].x].bombs[bombs[i].y];
if (b->state != BS_exploding) {
b->pos.x = x1<<8;
b->pos.y = y1<<8;
b->moveto.x = x1<<8;
b->moveto.y = y1<<8;
b->moves=p->speed;
bman.bfield[x][y]=0;
bman.bfield[x1][y1]=1;
draw_stone(x,y);

Loading…
Cancel
Save