From f96f3305dc03e5d8bc39465eb99c19a66015ee3b Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Fri, 20 Mar 2009 18:55:55 +0000 Subject: [PATCH] - Fixed bugs with whitetail spider: - wasn't changing direction to face players after climbing ladders - was jumping instead of climbing ladders when players were far above --- data/levels/level99.dat | 26 +++++++++++++------------- rc.c | 32 ++++++++++++++++++++++---------- rc.h | 5 +++-- 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/data/levels/level99.dat b/data/levels/level99.dat index f17614e..9575eeb 100644 --- a/data/levels/level99.dat +++ b/data/levels/level99.dat @@ -4,14 +4,13 @@ hurryup 30 help endhelp monsters -0 17 15 +0 15 25 134 18 15 -171 5 7 -172 5 11 +23 17 20 158 32 20 1 29 6 7 34 14 -23 17 20 +171 12 15 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, @@ -31,21 +30,22 @@ 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,1,0,0,0,0,7,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,1,1,0,0,0,0,7,0,0,4, 4,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,0,0,0,0,7,0,0,4, -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,7,0,0,4, -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,7,0,0,4, -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,7,0,0,4, -4,0,0,0,0,0,0,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0,0,0,7,0,0,4, +4,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,1,0,0,0,0,7,0,0,4, +4,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,1,0,0,0,0,7,0,0,4, 4,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,7,0,0,4, 4,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,4, 4,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,4, 4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4, layer2 36,13,8 +10,16,8 20,16,8 26,21,8 6,26,8 diff --git a/rc.c b/rc.c index 902bc68..0e229e5 100644 --- a/rc.c +++ b/rc.c @@ -4888,6 +4888,7 @@ int movesprite(sprite_t *s) { s->falling = 0; s->climbing = B_TRUE; s->moved = MV_WALK; + faceplayer(s); } else { s->climbing = B_FALSE; // face a player @@ -4902,13 +4903,14 @@ int movesprite(sprite_t *s) { s->falling = 0; s->climbing = B_TRUE; s->moved = MV_WALK; + faceplayer(s); } else { s->climbing = B_FALSE; faceplayer(s); } } } - } else if (ladderx && isplayerabovedis(s,TILEW)) { // if we are at the bottom of a ladder + } else if (ladderx && isplayerabovegt(s,TILEW)) { // if we are at the bottom of a ladder // start climbing s->x = ladderx; // lock to ladder s->y -= getspeed(s); @@ -4917,7 +4919,7 @@ int movesprite(sprite_t *s) { s->climbing = B_TRUE; s->moved = MV_WALK; s->timer3 = D_UP; - } else if (isonladder(s) && isplayerbelowdis(s,TILEW)) { // are we at top of ladder + } else if (isonladder(s) && isplayerbelowgt(s,TILEW)) { // are we at top of ladder int ladderx = isonladder(s); if (isladderbelow(s)) { s->y += getspeed(s); @@ -5006,8 +5008,8 @@ int movesprite(sprite_t *s) { if (globpowerup != PW_CAMERA) { if ((playersalive()) && (!s->jumping) && (!s->jumptimer)) { sprite_t *abovep; - /* if player is above us...*/ - abovep = isplayerabove(s); + /* if player is within 5 tiles above us...*/ + abovep = isplayerabovelt(s,TILEH*5); if (abovep) { if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) { // if 2-3 tiles right /* jump right */ @@ -13753,7 +13755,7 @@ sprite_t *isplayerbelow(sprite_t *s) { return NULL; } // is there a player more than "dis" pixels below? -sprite_t *isplayerbelowdis(sprite_t *s,int dis) { +sprite_t *isplayerbelowgt(sprite_t *s,int dis) { if (globpowerup == PW_CAMERA) return NULL; if (player && !player->dead && (player->y - s->y) >= dis ) return player; @@ -13771,13 +13773,23 @@ sprite_t *isplayerabove(sprite_t *s) { return NULL; } - -// is there a player more than "dis" pixels above? -sprite_t *isplayerabovedis(sprite_t *s,int dis) { +// +// is there a player within "dis" pixels above? +sprite_t *isplayerabovelt(sprite_t *s,int dis) { if (globpowerup == PW_CAMERA) return NULL; - if (player && !player->dead && (s->y - player->y) >= dis ) return player; - if (player2 && !player2->dead && (s->y - player2->y) >= dis) return player2; + if (player && !player->dead && (player->y < s->y) && ((s->y - player->y) <= dis )) return player; + if (player2 && !player2->dead && (player->y < s->y) && ((s->y - player2->y) <= dis)) return player2; + + return NULL; +} + +// is there a player more than "dis" pixels above? +sprite_t *isplayerabovegt(sprite_t *s,int dis) { + if (globpowerup == PW_CAMERA) return NULL; + + if (player && !player->dead && ((s->y - player->y) >= dis )) return player; + if (player2 && !player2->dead && ((s->y - player2->y) >= dis)) return player2; return NULL; } diff --git a/rc.h b/rc.h index cde44f4..e853b8b 100644 --- a/rc.h +++ b/rc.h @@ -120,9 +120,10 @@ int playersalive(void); int inintro(void); void faceplayer(sprite_t *s); sprite_t *isplayerbelow(sprite_t *s); -sprite_t *isplayerbelowdis(sprite_t *s,int dis); +sprite_t *isplayerbelowgt(sprite_t *s,int dis); sprite_t *isplayerabove(sprite_t *s); -sprite_t *isplayerabovedis(sprite_t *s,int dis); +sprite_t *isplayerabovegt(sprite_t *s,int dis); +sprite_t *isplayerabovelt(sprite_t *s,int dis); sprite_t *isplayerright(sprite_t *s); sprite_t *isplayerleft(sprite_t *s); sprite_t *isplayerahead(sprite_t *s);