- bugfix: Magic wand now only affects monsters which are alive

- bugfix: trampolines now no longer affect monsters
- Fixed warnings when compiling with optimisation
This commit is contained in:
Rob Pearce 2008-12-21 23:49:56 +00:00
parent 9b5fc464a3
commit 0fbde13339
3 changed files with 227 additions and 173 deletions

View File

@ -8,7 +8,8 @@ monsters
134 35 22 134 35 22
23 12 19 23 12 19
6 20 10 6 20 10
12 24 19 133 18 19
133 26 19
endmonsters endmonsters
exitdir 1 exitdir 1
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,

391
rc.c
View File

@ -3006,46 +3006,47 @@ int movesprite(sprite_t *s) {
int xdiff ,absxdiff; int xdiff ,absxdiff;
tiletype_t *tunder; tiletype_t *tunder;
/* distance to closest player */
xdiff = getxdisttoplayer(s, NULL);
absxdiff = abs(xdiff);
if (globpowerup == PW_CAMERA) { // tile in front and below
move = B_TRUE; tt = gettileat(s->x + s->dir*getspeed(s) + (s->dir * (s->img->w/2)),s->y + (TILEH/2),NULL,NULL);
} else { // tile below
/* distance to closest player */ tunder = gettileat(s->x ,s->y + 1,NULL,NULL);
xdiff = getxdisttoplayer(s, NULL); /* if there's a hole in front of us and below*/
absxdiff = abs(xdiff); if (tt->solid == S_NOTSOLID) {
// we're on a slope
// tile in front and below if (tunder->solid == S_SLOPE) {
tt = gettileat(s->x + s->dir*getspeed(s) + (s->dir * (s->img->w/2)),s->y + (TILEH/2),NULL,NULL); move = B_TRUE;
// tile below } else {
tunder = gettileat(s->x ,s->y + 1,NULL,NULL); if (s->angry || boss) {
/* if there's a hole in front of us and below*/ if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
if (tt->solid == S_NOTSOLID) { /* if player is below, fall off */
// we're on a slope if (xdiff <= (TILEW*8)) {
if (tunder->solid == S_SLOPE) { move = B_TRUE;
move = B_TRUE; }
} else { } else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
if (s->angry || boss) { if (globpowerup != PW_CAMERA) {
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
/* if player is below, fall off */
if (xdiff <= (TILEW*8)) {
move = B_TRUE;
}
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
/* if player is at same level and close, jump */ /* if player is at same level and close, jump */
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) { if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
jump(s,D_RIGHT); jump(s,D_RIGHT);
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) { } else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
jump(s,D_LEFT); jump(s,D_LEFT);
} }
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
// if near bottom of the screen and can fall through...
move = B_TRUE;
} }
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
// if near bottom of the screen and can fall through...
move = B_TRUE;
} }
} }
} else {
move = B_TRUE;
} }
} else {
move = B_TRUE;
}
if (globpowerup == PW_CAMERA) {
move = B_TRUE;
} }
/* either move or turn around */ /* either move or turn around */
@ -3109,30 +3110,32 @@ int movesprite(sprite_t *s) {
int move = B_FALSE; int move = B_FALSE;
int xdiff, absxdiff; int xdiff, absxdiff;
if (globpowerup == PW_CAMERA) {
move = B_TRUE;
} else {
/* distance to closest player */
xdiff = getxdisttoplayer(s, NULL);
absxdiff = abs(xdiff);
tt = gettileat(s->x + s->dir+getspeed(s) + (s->dir * (s->img->w/2)),s->y,NULL,NULL); /* distance to closest player */
/* if there's a hole in front of us */ xdiff = getxdisttoplayer(s, NULL);
if (tt->solid == S_NOTSOLID) { absxdiff = abs(xdiff);
if (s->angry || boss) {
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) { tt = gettileat(s->x + s->dir+getspeed(s) + (s->dir * (s->img->w/2)),s->y,NULL,NULL);
/* if player is below, fall off */ /* if there's a hole in front of us */
if (xdiff <= (TILEW*8)) { if (tt->solid == S_NOTSOLID) {
move = B_TRUE; if (s->angry || boss) {
} if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) { /* if player is below, fall off */
// if near bottom of the screen and can fall through... if (xdiff <= (TILEW*8)) {
move = B_TRUE; move = B_TRUE;
} }
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
// if near bottom of the screen and can fall through...
move = B_TRUE;
} }
} else {
move = B_TRUE;
} }
} else {
move = B_TRUE;
}
if (globpowerup == PW_CAMERA) {
// always move
move = B_TRUE;
} }
/* either move or turn around */ /* either move or turn around */
@ -3192,43 +3195,42 @@ int movesprite(sprite_t *s) {
if (!s->falling) { if (!s->falling) {
int move = B_FALSE; int move = B_FALSE;
int xdiff, absxdiff; int xdiff, absxdiff;
sprite_t *target = NULL;
/* distance to closest player */
xdiff = getxdisttoplayer(s, &target);
if (target != NULL) {
absxdiff = abs(xdiff);
xdiff = target->x - s->x;
tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL);
/* if there's a hole in front of us */
if (tt->solid == S_NOTSOLID) {
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
/* if player is below and nearby, fall off */
if (xdiff <= (TILEW*16)) {
move = B_TRUE;
}
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
if (globpowerup != PW_CAMERA) {
/* if player is at same level and close, try to jump over the gap */
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*9))) {
jump(s,D_RIGHT);
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*9))) {
jump(s,D_LEFT);
}
}
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
// if near bottom of the screen and can fall through...
move = B_TRUE;
}
} else {
move = B_TRUE;
}
}
if (globpowerup == PW_CAMERA) { if (globpowerup == PW_CAMERA) {
move = B_TRUE; move = B_TRUE;
} else {
sprite_t *target;
/* distance to closest player */
xdiff = getxdisttoplayer(s, &target);
if (target != NULL) {
absxdiff = abs(xdiff);
xdiff = target->x - s->x;
tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL);
/* if there's a hole in front of us */
if (tt->solid == S_NOTSOLID) {
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
/* if player is below and nearby, fall off */
if (xdiff <= (TILEW*16)) {
move = B_TRUE;
}
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
/* if player is at same level and close, try to jump over the gap */
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*9))) {
printf("jr\n");
jump(s,D_RIGHT);
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*9))) {
printf("jl\n");
jump(s,D_LEFT);
}
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
// if near bottom of the screen and can fall through...
move = B_TRUE;
}
} else {
move = B_TRUE;
}
}
} }
/* either move or turn around */ /* either move or turn around */
@ -3931,36 +3933,38 @@ printf("setting target to y = %d\n",ss->timer2);
int xdiff, absxdiff; int xdiff, absxdiff;
if (globpowerup == PW_CAMERA) { /* distance to player */
move = B_TRUE; xdiff = getxdisttoplayer(s, NULL);
} else { absxdiff = abs(xdiff);
/* distance to player */
xdiff = getxdisttoplayer(s, NULL);
absxdiff = abs(xdiff);
tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL); tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL);
/* if there's a hole in front of us */ /* if there's a hole in front of us */
if (tt->solid == S_NOTSOLID) { if (tt->solid == S_NOTSOLID) {
double ycutoff = s->y + (TILEH/2); double ycutoff = s->y + (TILEH/2);
if ((player && (player->y >= ycutoff)) || (player2 && (player2->y >= ycutoff ))) { if ((player && (player->y >= ycutoff)) || (player2 && (player2->y >= ycutoff ))) {
/* if player is below and nearby, fall off */ /* if player is below and nearby, fall off */
if (xdiff <= (TILEW*16)) { if (xdiff <= (TILEW*16)) {
move = B_TRUE; move = B_TRUE;
} }
} else if ((player && (player->y == s->y)) || (player2 && (player2->y == s->y ))) { } else if ((player && (player->y == s->y)) || (player2 && (player2->y == s->y ))) {
if (globpowerup != PW_CAMERA) {
/* if player is at same level and close, jump */ /* if player is at same level and close, jump */
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) { if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
jump(s,D_RIGHT); jump(s,D_RIGHT);
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) { } else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
jump(s,D_LEFT); jump(s,D_LEFT);
} }
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
// if near bottom of the screen and can fall through...
move = B_TRUE;
} }
} else { } else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
// if near bottom of the screen and can fall through...
move = B_TRUE; move = B_TRUE;
} }
} else {
move = B_TRUE;
}
if (globpowerup == PW_CAMERA) {
move = B_TRUE;
} }
/* either move or turn around */ /* either move or turn around */
@ -4022,39 +4026,39 @@ printf("setting target to y = %d\n",ss->timer2);
int xdiff, absxdiff,ydiff; int xdiff, absxdiff,ydiff;
if (globpowerup == PW_CAMERA) { /* distance to player */
move = B_TRUE; xdiff = getxdisttoplayer(s, NULL);
} else { absxdiff = abs(xdiff);
/* distance to player */
xdiff = getxdisttoplayer(s, NULL);
absxdiff = abs(xdiff);
tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL); tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL);
/* if there's a hole in front of us */ /* if there's a hole in front of us */
if (tt->solid == S_NOTSOLID) { if (tt->solid == S_NOTSOLID) {
if (s->angry) { if (s->angry) {
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) { if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
/* if player is below, fall off */ /* if player is below, fall off */
if (xdiff <= (TILEW*8)) { if (xdiff <= (TILEW*8)) {
move = B_TRUE;
}
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
if (s->angry) {
/* if player is at same level and close, jump */
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
jump(s,D_RIGHT);
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
jump(s,D_LEFT);
}
}
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
// if near bottom of the screen and can fall through...
move = B_TRUE; move = B_TRUE;
} }
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
if (s->angry) {
/* if player is at same level and close, jump */
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
jump(s,D_RIGHT);
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
jump(s,D_LEFT);
}
}
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
// if near bottom of the screen and can fall through...
move = B_TRUE;
} }
} else {
move = B_TRUE;
} }
} else {
move = B_TRUE;
}
if (globpowerup == PW_CAMERA) {
move = B_TRUE;
} }
/* shoot */ /* shoot */
@ -4301,12 +4305,19 @@ printf("setting target to y = %d\n",ss->timer2);
if (s->flies == F_FLYVERT) { if (s->flies == F_FLYVERT) {
ymod = sin(((double)timer * (double)3.6) * (M_PI/180)); ymod = sin(((double)timer * (double)3.6) * (M_PI/180));
//ymod *= 0.8; //ymod *= 0.8;
// XXX
xmod = 0;
if (s->ys * (ymod) > 0) absys = 1; if (s->ys * (ymod) > 0) absys = 1;
else absys = -1; else absys = -1;
} else if (s->flies == F_FLYHORZ) { } else if (s->flies == F_FLYHORZ) {
xmod = sin(((double)timer * (double)3.6) * (M_PI/180)); xmod = sin(((double)timer * (double)3.6) * (M_PI/180));
// XXX
ymod = 0;
if (s->xs * (xmod) > 0) absxs = 1; if (s->xs * (xmod) > 0) absxs = 1;
else absxs = -1; else absxs = -1;
} else {
xmod = 0;
ymod = 0;
} }
@ -4390,9 +4401,9 @@ printf("setting target to y = %d\n",ss->timer2);
// take off if player is close // take off if player is close
if (player) { if (player) {
playerdist = getdistance(player->x,player->y,s->x,s->y); playerdist1 = getdistance(player->x,player->y,s->x,s->y);
} else { } else {
playerdist = 9999; playerdist1 = 9999;
} }
if (player2) { if (player2) {
playerdist2 = getdistance(player2->x,player2->y,s->x,s->y); playerdist2 = getdistance(player2->x,player2->y,s->x,s->y);
@ -4531,39 +4542,43 @@ printf("setting target to y = %d\n",ss->timer2);
} else { } else {
int move = B_FALSE; int move = B_FALSE;
int xdiff; int xdiff;
sprite_t *pp ; sprite_t *pp = NULL;
/* walk back and forwards */ /* walk back and forwards */
/* drop if player is close */ /* drop if player is close */
xdiff = getxdisttoplayer(s, &pp); xdiff = getxdisttoplayer(s, &pp);
xdiff = abs(xdiff); xdiff = abs(xdiff);
if ((pp->y > s->y) && (xdiff <= (TILEW*2)) && (s->timer1 == 0)) { if (pp) {
s->timer1 = 200;
s->flies = B_FALSE;
s->falling = B_TRUE;
s->fallspeed = 8;
} else {
int tx,ty;
s->flies = B_TRUE;
/* if there's a hole in front of us */ if ((pp->y > s->y) && (xdiff <= (TILEW*2)) && (s->timer1 == 0)) {
tt = gettileat(s->x + s->dir*((s->img->w/2)+2),s->y - s->img->h - 4,&tx,&ty); s->timer1 = 200;
if (tt->solid == S_NOTSOLID) { s->flies = B_FALSE;
move = B_FALSE; s->falling = B_TRUE;
s->fallspeed = 8;
} else { } else {
move = B_TRUE; int tx,ty;
} s->flies = B_TRUE;
/* either move or turn around */ /* if there's a hole in front of us */
if (move) { tt = gettileat(s->x + s->dir*((s->img->w/2)+2),s->y - s->img->h - 4,&tx,&ty);
rv = movex(s, s->dir*getspeed(s), B_TRUE); if (tt->solid == S_NOTSOLID) {
if (rv) { move = B_FALSE;
/* if we couldn't move (hit a wall), turn */ } else {
move = B_TRUE;
}
/* either move or turn around */
if (move) {
rv = movex(s, s->dir*getspeed(s), B_TRUE);
if (rv) {
/* if we couldn't move (hit a wall), turn */
s->dir = -s->dir;
}
} else {
s->dir = -s->dir; s->dir = -s->dir;
} }
} else {
s->dir = -s->dir;
} }
} }
} }
@ -5013,7 +5028,8 @@ void dotileeffects(sprite_t *s) {
finished = B_TRUE; finished = B_TRUE;
} else if (tt->id == T_TRAMPUP) { } else if (tt->id == T_TRAMPUP) {
/* tile changes to trampoline down */ /* tile changes to trampoline down */
if (!isfruit(s->id) && !iseffect(s->id) && !isbullet(s->id)) { //if (!isfruit(s->id) && !iseffect(s->id) && !isbullet(s->id)) {
if (isplayer(s)) {
// are we on a trampoline already? // are we on a trampoline already?
if (s->ontramp) { if (s->ontramp) {
// a different one? // a different one?
@ -5072,18 +5088,19 @@ void dotileeffects(sprite_t *s) {
// initial transition to a new level // initial transition to a new level
void drawlevel(void) { void drawlevel(void) {
int x,y; int x,y,i;
int dstx[2],dsty[2],xdis[2],ydis[2]; int dstx[2],dsty[2],xdis[2],ydis[2];
double turns; double turns;
double pspeed[2]; double pspeed[2];
double dist[2]; double dist[2];
SDL_Rect area,dst; SDL_Rect area,dst;
int speed = 16; int speed = 16;
SDL_Surface *playerbg, *playerbg2; SDL_Surface *playerbg = NULL, *playerbg2 = NULL;
SDL_Surface *cloudbg,*cloudbg2; SDL_Surface *cloudbg = NULL,*cloudbg2 = NULL;
int got1p = B_FALSE,got2p = B_FALSE;
sprite_t tempcloud, tempcloud2; sprite_t tempcloud, tempcloud2;
sprite_t *cloud, *cloud2; sprite_t *cloud = NULL, *cloud2 = NULL;
if (temps) { if (temps) {
@ -5098,9 +5115,17 @@ void drawlevel(void) {
SDL_DisplayFormat(temps); SDL_DisplayFormat(temps);
if (player && player->lives > 0) got1p = B_TRUE;
if (player2 && player2->lives > 0) got2p = B_TRUE;
if (!got1p && !got2p) {
// ERROR!!
printf("trying to transition level with no players!!\n ");
return;
}
// init clouds // init clouds
if (player && player->lives > 0) { if (got1p) {
cloud = &tempcloud; cloud = &tempcloud;
cloud->id = P_PINKCLOUD; cloud->id = P_PINKCLOUD;
cloud->iceimg = NULL; cloud->iceimg = NULL;
@ -5123,9 +5148,8 @@ void drawlevel(void) {
screen->format->Gmask,screen->format->Bmask, screen->format->Gmask,screen->format->Bmask,
screen->format->Amask); screen->format->Amask);
SDL_DisplayFormat(cloudbg); SDL_DisplayFormat(cloudbg);
} }
if (player2 && player2->lives > 0) { if (got2p) {
cloud2 = &tempcloud2; cloud2 = &tempcloud2;
cloud2->id = P_PINKCLOUD; cloud2->id = P_PINKCLOUD;
cloud2->iceimg = NULL; cloud2->iceimg = NULL;
@ -5151,6 +5175,7 @@ void drawlevel(void) {
} }
// draw the full level onto the temporary surface // draw the full level onto the temporary surface
for (x = 0; x < LEVELW; x++) { for (x = 0; x < LEVELW; x++) {
for (y = 0; y < LEVELH; y++) { for (y = 0; y < LEVELH; y++) {
@ -5159,6 +5184,16 @@ void drawlevel(void) {
} }
// initialise values so we don't accidentally use them
// uninitialied...
for (i = 0; i < 2; i++) {
dstx[i] = 0;
dsty[i] = 0;
xdis[i] = 0;
ydis[i] = 0;
pspeed[i] = 1;
}
// figure out where the players' new start positions are // figure out where the players' new start positions are
if (player) { if (player) {
dstx[0] = (curlevel->p1x * TILEW) + (TILEW/2); dstx[0] = (curlevel->p1x * TILEW) + (TILEW/2);
@ -8039,9 +8074,9 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
playfx(FX_WAND); playfx(FX_WAND);
sprintf(tempm, "Weaken monsters!"); sprintf(tempm, "Weaken monsters!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
// turn all flowers into explosions // turn all live monsters into weaker versions
for (s2 = sprite; s2 ; s2 = s2->next) { for (s2 = sprite; s2 ; s2 = s2->next) {
if (ismonster(s2->id)) { if (ismonster(s2->id) && !s2->dead) {
// don't get ones which we just created! // don't get ones which we just created!
if (!strstr(s2->name, "created")) { if (!strstr(s2->name, "created")) {
int newtype = -1; int newtype = -1;
@ -10208,8 +10243,13 @@ if (cheat) {
void swimup(sprite_t *pl) { void swimup(sprite_t *pl) {
int pnum; int pnum;
if (pl == player) pnum = 0; if (pl == player) {
if (pl == player2) pnum = 1; pnum = 0;
} else if (pl == player2) {
pnum = 1;
} else return; // only valid for players
pl->falling = B_FALSE; pl->falling = B_FALSE;
if (!isroofabove(pl)) { if (!isroofabove(pl)) {
// is there water above us too? // is there water above us too?
@ -10261,10 +10301,14 @@ void swimdown(sprite_t *pl) {
void trytojump(sprite_t *pl) { void trytojump(sprite_t *pl) {
int pnum; int pnum;
if (pl == player) {
pnum = 0;
} else if (pl == player2) {
pnum = 1;
} else return; // only valid for players
if (pl->caughtby) return; if (pl->caughtby) return;
if (pl == player) pnum = 0;
if (pl == player2) pnum = 1;
// can't jump while slamming // can't jump while slamming
if (pl->slamming) return; if (pl->slamming) return;
@ -11959,13 +12003,16 @@ double getdistance(double x1, double y1, double x2, double y2) {
void doplayermovement(sprite_t *pl) { void doplayermovement(sprite_t *pl) {
int pnum; int pnum;
if (pl == player) {
pnum = 0;
} else if (pl == player2) {
pnum = 1;
} else return; // only valid for players
if (!pl) return; if (!pl) return;
if (pl->caughtby) return; if (pl->caughtby) return;
if (pl == player) pnum = 0;
if (pl == player2) pnum = 1;
if (pl->powerup == PW_GUNNER) { if (pl->powerup == PW_GUNNER) {
// move crosshairs // move crosshairs
@ -12121,7 +12168,7 @@ void doplayermovement(sprite_t *pl) {
} }
double getxdisttoplayer(sprite_t *s, sprite_t **pl) { double getxdisttoplayer(sprite_t *s, sprite_t **pl) {
double xdiff1,xdiff2,xdiff; double xdiff1,xdiff2,xdiff = 9999;
if (globpowerup == PW_CAMERA) return 9999; if (globpowerup == PW_CAMERA) return 9999;
/* distance to closest player */ /* distance to closest player */

View File

@ -2222,6 +2222,12 @@ void drawsprite(sprite_t *s) {
SDL_Color col; SDL_Color col;
double zapx,zapy; double zapx,zapy;
// initialise
col.r = 0;
col.g = 0;
col.b = 0;
col.unused = 0;
switch (timer % 4) { switch (timer % 4) {
case 0: col.r = 255; col.g = 255; col.b = 255; break; case 0: col.r = 255; col.g = 255; col.b = 255; break;
case 1: col.r = 0; col.g = 0; col.b = 0; break; case 1: col.r = 0; col.g = 0; col.b = 0; break;