- [+] sprites are shooting to the top if you hit a

solid tile with your head while on a moving platform.
      you now die instead.
This commit is contained in:
Rob Pearce 2013-08-14 12:15:30 +00:00
parent b1cd328732
commit 1a3721f06d
2 changed files with 20 additions and 2 deletions

View File

@ -28,7 +28,7 @@ monsters
15 33 19
15 24 8
15 23 8
132 19 6 312 112 312 112 312 112 312 442
132 19 6 312 112 312 112 312 112 312 112 312 442
15 18 5
15 20 5
16 19 5

20
rc.c
View File

@ -5302,7 +5302,6 @@ int movesprite(sprite_t *s) {
dstx = s->wayx[s->curwaypoint];
dsty = s->wayy[s->curwaypoint];
rv = moveto(s,dstx,dsty,s->speed,s->speed);
// remember how far we moved
@ -5319,11 +5318,16 @@ int movesprite(sprite_t *s) {
for (s2 = sprite ; s2 ; s2 = s2->next) {
if (s2->onplatform == s) {
int ii,oldmoved;
int preroof = B_FALSE;
double dir,amt;
amt = abs(xdiff);
if (xdiff > 0) dir = 1;
else dir = -1;
if (isroofabove(s2) && (ydiff < 0)) {
preroof = B_TRUE;
}
oldmoved = s2->moved;
for (ii = 0; ii < amt; ii++) {
@ -5332,6 +5336,20 @@ int movesprite(sprite_t *s) {
}
s2->moved = oldmoved; // so that we don't animate
s2->y += ydiff;
// check if s2's head has hit something
if (preroof && isroofabove(s2) && (ydiff < 0)) {
if (isplayer(s2)) {
die(s2);
printf("DB: killed by head crush\n"); fflush(stdout);
} else if (isfruit(s2->id)) {
s2->dead = D_FINAL;
puffin(-1, s2->x, s2->y, "nothing", 0);
} else if (ismonster(s2->id)) {
s2->dead = D_FINAL;
puffin(-1, s2->x, s2->y, "nothing", 0);
}
}
}
}
} else {