- 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:
parent
9b5fc464a3
commit
0fbde13339
|
@ -8,7 +8,8 @@ monsters
|
|||
134 35 22
|
||||
23 12 19
|
||||
6 20 10
|
||||
12 24 19
|
||||
133 18 19
|
||||
133 26 19
|
||||
endmonsters
|
||||
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,
|
||||
|
|
129
rc.c
129
rc.c
|
@ -3006,10 +3006,6 @@ int movesprite(sprite_t *s) {
|
|||
int xdiff ,absxdiff;
|
||||
tiletype_t *tunder;
|
||||
|
||||
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
/* distance to closest player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
|
@ -3031,12 +3027,14 @@ int movesprite(sprite_t *s) {
|
|||
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, 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;
|
||||
|
@ -3046,6 +3044,9 @@ int movesprite(sprite_t *s) {
|
|||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
/* either move or turn around */
|
||||
|
@ -3109,9 +3110,7 @@ int movesprite(sprite_t *s) {
|
|||
int move = B_FALSE;
|
||||
int xdiff, absxdiff;
|
||||
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
|
||||
/* distance to closest player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
|
@ -3133,6 +3132,10 @@ int movesprite(sprite_t *s) {
|
|||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
// always move
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
/* either move or turn around */
|
||||
|
@ -3192,12 +3195,8 @@ int movesprite(sprite_t *s) {
|
|||
if (!s->falling) {
|
||||
int move = B_FALSE;
|
||||
int xdiff, absxdiff;
|
||||
sprite_t *target = NULL;
|
||||
|
||||
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
sprite_t *target;
|
||||
/* distance to closest player */
|
||||
xdiff = getxdisttoplayer(s, &target);
|
||||
if (target != NULL) {
|
||||
|
@ -3213,14 +3212,14 @@ int movesprite(sprite_t *s) {
|
|||
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))) {
|
||||
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;
|
||||
|
@ -3229,6 +3228,9 @@ int movesprite(sprite_t *s) {
|
|||
move = B_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
/* either move or turn around */
|
||||
|
@ -3931,9 +3933,6 @@ printf("setting target to y = %d\n",ss->timer2);
|
|||
int xdiff, absxdiff;
|
||||
|
||||
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
/* distance to player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
|
@ -3948,12 +3947,14 @@ printf("setting target to y = %d\n",ss->timer2);
|
|||
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, 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;
|
||||
|
@ -3961,6 +3962,9 @@ printf("setting target to y = %d\n",ss->timer2);
|
|||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
/* either move or turn around */
|
||||
|
@ -4022,9 +4026,6 @@ printf("setting target to y = %d\n",ss->timer2);
|
|||
int xdiff, absxdiff,ydiff;
|
||||
|
||||
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
/* distance to player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
|
@ -4055,6 +4056,9 @@ printf("setting target to y = %d\n",ss->timer2);
|
|||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
/* shoot */
|
||||
|
@ -4301,12 +4305,19 @@ printf("setting target to y = %d\n",ss->timer2);
|
|||
if (s->flies == F_FLYVERT) {
|
||||
ymod = sin(((double)timer * (double)3.6) * (M_PI/180));
|
||||
//ymod *= 0.8;
|
||||
// XXX
|
||||
xmod = 0;
|
||||
if (s->ys * (ymod) > 0) absys = 1;
|
||||
else absys = -1;
|
||||
} else if (s->flies == F_FLYHORZ) {
|
||||
xmod = sin(((double)timer * (double)3.6) * (M_PI/180));
|
||||
// XXX
|
||||
ymod = 0;
|
||||
if (s->xs * (xmod) > 0) 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
|
||||
if (player) {
|
||||
playerdist = getdistance(player->x,player->y,s->x,s->y);
|
||||
playerdist1 = getdistance(player->x,player->y,s->x,s->y);
|
||||
} else {
|
||||
playerdist = 9999;
|
||||
playerdist1 = 9999;
|
||||
}
|
||||
if (player2) {
|
||||
playerdist2 = getdistance(player2->x,player2->y,s->x,s->y);
|
||||
|
@ -4531,13 +4542,16 @@ printf("setting target to y = %d\n",ss->timer2);
|
|||
} else {
|
||||
int move = B_FALSE;
|
||||
int xdiff;
|
||||
sprite_t *pp ;
|
||||
sprite_t *pp = NULL;
|
||||
|
||||
/* walk back and forwards */
|
||||
|
||||
/* drop if player is close */
|
||||
xdiff = getxdisttoplayer(s, &pp);
|
||||
xdiff = abs(xdiff);
|
||||
|
||||
if (pp) {
|
||||
|
||||
if ((pp->y > s->y) && (xdiff <= (TILEW*2)) && (s->timer1 == 0)) {
|
||||
s->timer1 = 200;
|
||||
s->flies = B_FALSE;
|
||||
|
@ -4568,6 +4582,7 @@ printf("setting target to y = %d\n",ss->timer2);
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (s->id == P_SPIT) {
|
||||
if (movex(s, s->xs, B_TRUE)) {
|
||||
s->dead = D_FINAL;
|
||||
|
@ -5013,7 +5028,8 @@ void dotileeffects(sprite_t *s) {
|
|||
finished = B_TRUE;
|
||||
} else if (tt->id == T_TRAMPUP) {
|
||||
/* 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?
|
||||
if (s->ontramp) {
|
||||
// a different one?
|
||||
|
@ -5072,18 +5088,19 @@ void dotileeffects(sprite_t *s) {
|
|||
|
||||
// initial transition to a new level
|
||||
void drawlevel(void) {
|
||||
int x,y;
|
||||
int x,y,i;
|
||||
int dstx[2],dsty[2],xdis[2],ydis[2];
|
||||
double turns;
|
||||
double pspeed[2];
|
||||
double dist[2];
|
||||
SDL_Rect area,dst;
|
||||
int speed = 16;
|
||||
SDL_Surface *playerbg, *playerbg2;
|
||||
SDL_Surface *cloudbg,*cloudbg2;
|
||||
SDL_Surface *playerbg = NULL, *playerbg2 = NULL;
|
||||
SDL_Surface *cloudbg = NULL,*cloudbg2 = NULL;
|
||||
int got1p = B_FALSE,got2p = B_FALSE;
|
||||
|
||||
sprite_t tempcloud, tempcloud2;
|
||||
sprite_t *cloud, *cloud2;
|
||||
sprite_t *cloud = NULL, *cloud2 = NULL;
|
||||
|
||||
|
||||
if (temps) {
|
||||
|
@ -5098,9 +5115,17 @@ void drawlevel(void) {
|
|||
|
||||
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
|
||||
if (player && player->lives > 0) {
|
||||
if (got1p) {
|
||||
cloud = &tempcloud;
|
||||
cloud->id = P_PINKCLOUD;
|
||||
cloud->iceimg = NULL;
|
||||
|
@ -5123,9 +5148,8 @@ void drawlevel(void) {
|
|||
screen->format->Gmask,screen->format->Bmask,
|
||||
screen->format->Amask);
|
||||
SDL_DisplayFormat(cloudbg);
|
||||
|
||||
}
|
||||
if (player2 && player2->lives > 0) {
|
||||
if (got2p) {
|
||||
cloud2 = &tempcloud2;
|
||||
cloud2->id = P_PINKCLOUD;
|
||||
cloud2->iceimg = NULL;
|
||||
|
@ -5151,6 +5175,7 @@ void drawlevel(void) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
// draw the full level onto the temporary surface
|
||||
for (x = 0; x < LEVELW; x++) {
|
||||
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
|
||||
if (player) {
|
||||
dstx[0] = (curlevel->p1x * TILEW) + (TILEW/2);
|
||||
|
@ -8039,9 +8074,9 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
|
|||
playfx(FX_WAND);
|
||||
sprintf(tempm, "Weaken monsters!");
|
||||
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) {
|
||||
if (ismonster(s2->id)) {
|
||||
if (ismonster(s2->id) && !s2->dead) {
|
||||
// don't get ones which we just created!
|
||||
if (!strstr(s2->name, "created")) {
|
||||
int newtype = -1;
|
||||
|
@ -10208,8 +10243,13 @@ if (cheat) {
|
|||
|
||||
void swimup(sprite_t *pl) {
|
||||
int pnum;
|
||||
if (pl == player) pnum = 0;
|
||||
if (pl == player2) pnum = 1;
|
||||
if (pl == player) {
|
||||
pnum = 0;
|
||||
} else if (pl == player2) {
|
||||
pnum = 1;
|
||||
} else return; // only valid for players
|
||||
|
||||
|
||||
pl->falling = B_FALSE;
|
||||
if (!isroofabove(pl)) {
|
||||
// is there water above us too?
|
||||
|
@ -10261,10 +10301,14 @@ void swimdown(sprite_t *pl) {
|
|||
void trytojump(sprite_t *pl) {
|
||||
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 == player) pnum = 0;
|
||||
if (pl == player2) pnum = 1;
|
||||
|
||||
// can't jump while slamming
|
||||
if (pl->slamming) return;
|
||||
|
@ -11959,13 +12003,16 @@ double getdistance(double x1, double y1, double x2, double y2) {
|
|||
void doplayermovement(sprite_t *pl) {
|
||||
int pnum;
|
||||
|
||||
if (pl == player) {
|
||||
pnum = 0;
|
||||
} else if (pl == player2) {
|
||||
pnum = 1;
|
||||
} else return; // only valid for players
|
||||
|
||||
if (!pl) return;
|
||||
|
||||
if (pl->caughtby) return;
|
||||
|
||||
if (pl == player) pnum = 0;
|
||||
if (pl == player2) pnum = 1;
|
||||
|
||||
|
||||
if (pl->powerup == PW_GUNNER) {
|
||||
// move crosshairs
|
||||
|
@ -12121,7 +12168,7 @@ void doplayermovement(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;
|
||||
|
||||
/* distance to closest player */
|
||||
|
|
Loading…
Reference in New Issue