- 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
This commit is contained in:
Rob Pearce 2009-03-20 18:55:55 +00:00
parent e00f108727
commit f96f3305dc
3 changed files with 38 additions and 25 deletions

View File

@ -4,14 +4,13 @@ hurryup 30
help help
endhelp endhelp
monsters monsters
0 17 15 0 15 25
134 18 15 134 18 15
171 5 7 23 17 20
172 5 11
158 32 20 158 32 20
1 29 6 1 29 6
7 34 14 7 34 14
23 17 20 171 12 15
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,
@ -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,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,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,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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
36,13,8 36,13,8
10,16,8
20,16,8 20,16,8
26,21,8 26,21,8
6,26,8 6,26,8

32
rc.c
View File

@ -4888,6 +4888,7 @@ int movesprite(sprite_t *s) {
s->falling = 0; s->falling = 0;
s->climbing = B_TRUE; s->climbing = B_TRUE;
s->moved = MV_WALK; s->moved = MV_WALK;
faceplayer(s);
} else { } else {
s->climbing = B_FALSE; s->climbing = B_FALSE;
// face a player // face a player
@ -4902,13 +4903,14 @@ int movesprite(sprite_t *s) {
s->falling = 0; s->falling = 0;
s->climbing = B_TRUE; s->climbing = B_TRUE;
s->moved = MV_WALK; s->moved = MV_WALK;
faceplayer(s);
} else { } else {
s->climbing = B_FALSE; s->climbing = B_FALSE;
faceplayer(s); 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 // start climbing
s->x = ladderx; // lock to ladder s->x = ladderx; // lock to ladder
s->y -= getspeed(s); s->y -= getspeed(s);
@ -4917,7 +4919,7 @@ int movesprite(sprite_t *s) {
s->climbing = B_TRUE; s->climbing = B_TRUE;
s->moved = MV_WALK; s->moved = MV_WALK;
s->timer3 = D_UP; 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); int ladderx = isonladder(s);
if (isladderbelow(s)) { if (isladderbelow(s)) {
s->y += getspeed(s); s->y += getspeed(s);
@ -5006,8 +5008,8 @@ int movesprite(sprite_t *s) {
if (globpowerup != PW_CAMERA) { if (globpowerup != PW_CAMERA) {
if ((playersalive()) && (!s->jumping) && (!s->jumptimer)) { if ((playersalive()) && (!s->jumping) && (!s->jumptimer)) {
sprite_t *abovep; sprite_t *abovep;
/* if player is above us...*/ /* if player is within 5 tiles above us...*/
abovep = isplayerabove(s); abovep = isplayerabovelt(s,TILEH*5);
if (abovep) { if (abovep) {
if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) { // if 2-3 tiles right if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) { // if 2-3 tiles right
/* jump right */ /* jump right */
@ -13753,7 +13755,7 @@ sprite_t *isplayerbelow(sprite_t *s) {
return NULL; return NULL;
} }
// is there a player more than "dis" pixels below? // 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 (globpowerup == PW_CAMERA) return NULL;
if (player && !player->dead && (player->y - s->y) >= dis ) return player; if (player && !player->dead && (player->y - s->y) >= dis ) return player;
@ -13771,13 +13773,23 @@ sprite_t *isplayerabove(sprite_t *s) {
return NULL; return NULL;
} }
//
// is there a player more than "dis" pixels above? // is there a player within "dis" pixels above?
sprite_t *isplayerabovedis(sprite_t *s,int dis) { sprite_t *isplayerabovelt(sprite_t *s,int dis) {
if (globpowerup == PW_CAMERA) return NULL; if (globpowerup == PW_CAMERA) return NULL;
if (player && !player->dead && (s->y - player->y) >= dis ) return player; if (player && !player->dead && (player->y < s->y) && ((s->y - player->y) <= dis )) return player;
if (player2 && !player2->dead && (s->y - player2->y) >= dis) return player2; 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; return NULL;
} }

5
rc.h
View File

@ -120,9 +120,10 @@ int playersalive(void);
int inintro(void); int inintro(void);
void faceplayer(sprite_t *s); void faceplayer(sprite_t *s);
sprite_t *isplayerbelow(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 *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 *isplayerright(sprite_t *s);
sprite_t *isplayerleft(sprite_t *s); sprite_t *isplayerleft(sprite_t *s);
sprite_t *isplayerahead(sprite_t *s); sprite_t *isplayerahead(sprite_t *s);