From 186d4aa387351e0bcfec1fb60c9dbeea9a7d39b9 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Wed, 11 Mar 2009 01:46:48 +0000 Subject: [PATCH] Fixed serious bug with whitetail spider --- data/levels/level419.dat | 4 ++-- data/levels/level609.dat | 2 +- data/levels/level611.dat | 21 ++++++++-------- data/levels/level614.dat | 4 ++-- data/levels/level99.dat | 3 ++- rc.c | 52 ++++++++++++++++++++++++++++------------ rc.h | 1 + shared.c | 21 ++++++++-------- 8 files changed, 67 insertions(+), 41 deletions(-) diff --git a/data/levels/level419.dat b/data/levels/level419.dat index 6410068..f38ddaa 100644 --- a/data/levels/level419.dat +++ b/data/levels/level419.dat @@ -33,9 +33,9 @@ monsters 15 9 24 16 16 4 16 18 4 -158 20 4 -158 12 4 158 3 4 +171 20 4 +171 3 14 endmonsters exitdir -1 74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74, diff --git a/data/levels/level609.dat b/data/levels/level609.dat index 8d5695e..14ea387 100644 --- a/data/levels/level609.dat +++ b/data/levels/level609.dat @@ -7,7 +7,6 @@ monsters 0 19 28 134 21 28 23 19 4 -6 33 15 1 33 22 1 11 22 49 31 28 @@ -56,6 +55,7 @@ monsters 17 15 16 17 8 7 17 10 7 +171 29 16 endmonsters exitdir -2 90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90, diff --git a/data/levels/level611.dat b/data/levels/level611.dat index 4df648a..ed3c08d 100644 --- a/data/levels/level611.dat +++ b/data/levels/level611.dat @@ -11,12 +11,8 @@ monsters 6 34 7 6 3 19 6 7 1 -1 11 11 1 20 22 -1 7 25 -1 30 16 1 19 2 -1 15 16 158 30 2 158 10 2 16 25 6 @@ -39,6 +35,9 @@ monsters 15 13 16 16 27 22 16 23 22 +171 11 11 +171 7 25 +171 29 16 endmonsters exitdir -2 90,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,90, @@ -49,15 +48,15 @@ exitdir -2 90,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,7,0,0,0,0,0,0,0,0,0,0,0,90, 90,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,7,0,0,0,0,0,0,0,0,0,0,0,90, 90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,89,89,89,89,89,89,89,89,89,89,89,89,89,0,0,0,0,0,0,0,0,0,0,90, +90,89,89,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,0,0,0,0,0,0,0,0,0,0,0,90, 90,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,0,0,0,0,0,0,0,0,0,0,0,90, -90,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,0,0,0,0,0,0,0,0,0,0,0,90, -90,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,0,0,0,0,0,0,0,0,0,0,0,90, +90,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,0,0,0,0,0,0,0,89,89,89,89,90, 90,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,0,0,0,0,0,0,0,0,0,0,0,90, 90,0,0,0,0,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,0,0,0,0,0,0,0,0,0,0,0,0,0,90, 90,0,0,0,0,93,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,92,0,0,0,0,0,0,0,0,0,0,0,0,0,90, -90,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,90, +90,0,0,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90, 90,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,90, 90,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,90, 90,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,90, layer2 27,3,8 17,7,8 +8,12,8 +8,13,7 16,17,8 28,17,8 diff --git a/data/levels/level614.dat b/data/levels/level614.dat index 14b1d55..4d8460e 100644 --- a/data/levels/level614.dat +++ b/data/levels/level614.dat @@ -8,10 +8,8 @@ monsters 134 25 18 23 25 13 7 19 5 -18 2 3 18 35 7 18 4 27 -18 33 23 6 31 10 133 35 25 133 5 22 @@ -31,6 +29,8 @@ monsters 17 4 27 17 4 7 17 35 7 +18 33 23 +18 2 3 endmonsters exitdir -2 33,87,87,87,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,87,87,87,32, diff --git a/data/levels/level99.dat b/data/levels/level99.dat index 166eb69..afa111e 100644 --- a/data/levels/level99.dat +++ b/data/levels/level99.dat @@ -4,9 +4,10 @@ hurryup 10 help endhelp monsters +0 38 28 134 18 15 171 3 25 -0 38 28 +171 16 20 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, diff --git a/rc.c b/rc.c index d328f4c..7828cd0 100644 --- a/rc.c +++ b/rc.c @@ -4862,12 +4862,16 @@ printf("setting target to y = %d\n",ss->timer2); } } else { // down if (isonladder(s)) { - // climb down - s->y += getspeed(s); - s->jumping = 0; - s->falling = 0; - s->climbing = B_TRUE; - s->moved = MV_WALK; + if (isladderbelow(s)) { + // climb down + s->y += getspeed(s); + s->jumping = 0; + s->falling = 0; + s->climbing = B_TRUE; + s->moved = MV_WALK; + } else { + s->climbing = B_FALSE; + } } } } else if (ladderx && isplayerabove(s)) { // if we are at the bottom of a ladder @@ -4881,15 +4885,20 @@ printf("setting target to y = %d\n",ss->timer2); s->timer3 = D_UP; } else if (isonladder(s) && isplayerbelow(s)) { // is we are at top of ladder int ladderx = isonladder(s); - s->y += getspeed(s); - s->jumping = 0; - s->falling = 0; - s->climbing = B_TRUE; - s->moved = MV_WALK; - // lock to centre of ladder - s->x = ladderx; - s->timer3 = D_DOWN; + if (isladderbelow(s)) { + s->y += getspeed(s); + s->jumping = 0; + s->falling = 0; + s->climbing = B_TRUE; + s->moved = MV_WALK; + // lock to centre of ladder + s->x = ladderx; + s->timer3 = D_DOWN; + } else { + s->climbing = B_FALSE; + } } else { + s->climbing = B_FALSE; // walk tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL); /* if there's a hole in front of us */ @@ -7446,7 +7455,7 @@ int isonladder(sprite_t *s) { return (tx*TILEW)+(TILEW/2); } - // if ladder bove and climbing + // if ladder above and climbing if (isladderabove(s) && s->climbing) { return isladderabove(s); } @@ -7467,6 +7476,19 @@ int isladderabove(sprite_t *s) { return B_FALSE; } +// return the x position of the middle of the ladder if so +int isladderbelow(sprite_t *s) { + tiletype_t *tthere; + int tx; + //tthere = gettileat(s->x,s->y-TILEH, NULL,NULL); + tthere = gettileat(s->x,s->y, &tx,NULL); + if (isladder(tthere->id)) { + return (tx*TILEW)+(TILEW/2); + } + + return B_FALSE; +} + int isinwater(sprite_t *s) { return isinwaterpoint(s->x, s->y - s->img->h/2); } diff --git a/rc.h b/rc.h index 374a324..9e95ae6 100644 --- a/rc.h +++ b/rc.h @@ -24,6 +24,7 @@ int isongroundpoint(sprite_t *s, int x, int y); int isonladder(sprite_t *s); int isonbridge(sprite_t *s); int isladderabove(sprite_t *s); +int isladderbelow(sprite_t *s); int dofruiteffect(sprite_t *pp, sprite_t *s); void checkcollide(sprite_t *s); void checkcollideplatform(sprite_t *s); diff --git a/shared.c b/shared.c index f66783a..c9fc4e3 100644 --- a/shared.c +++ b/shared.c @@ -1220,6 +1220,7 @@ int loadtiletypes(char *filename) { int loadimagesets(void) { int p,i; + SDL_Surface *tempsurf; SDL_Surface *tempimg; SDL_Surface *reds; SDL_Surface *origi; @@ -1412,8 +1413,7 @@ int loadimagesets(void) { /* next 3 are auto generated */ loadspriteimage(P_WSPIDER,F_CLIMB1, "sprites/whitespiderclimb.png"); loadspriteimage(P_WSPIDER,F_CLIMB2, "sprites/whitespiderclimb1.png"); - loadspriteimage(P_WSPIDER,F_SHOOT, "sprites/whitespiderclimb1.png"); // TO WORK AROUND A BUG!! - imageset[P_WSPIDER].numimages = 11; + imageset[P_WSPIDER].numimages = 10; loadspriteimage(P_SPIDER,F_WALK1, "sprites/newspider.png"); @@ -1926,9 +1926,9 @@ int loadimagesets(void) { SDL_FreeSurface(reds); // Convert the reddened image to the screen format - temps = SDL_DisplayFormat(imageset[P_BLACKCLOUD].img[MAXFRAMES*2]); + tempsurf = SDL_DisplayFormat(imageset[P_BLACKCLOUD].img[MAXFRAMES*2]); SDL_FreeSurface(imageset[P_BLACKCLOUD].img[MAXFRAMES*2]); - imageset[P_BLACKCLOUD].img[MAXFRAMES*2] = temps; + imageset[P_BLACKCLOUD].img[MAXFRAMES*2] = tempsurf; // Make the background red bits completely transparent SDL_SetColorKey(imageset[P_BLACKCLOUD].img[MAXFRAMES*2], @@ -1996,27 +1996,27 @@ int loadimagesets(void) { } // take a copy of the original image - temps = rotozoomSurfaceXY(origi, 0, 1,1,0); + tempsurf = rotozoomSurfaceXY(origi, 0, 1,1,0); redarea.x = 0; redarea.y = 0; redarea.w = 1; redarea.h = 1; temparea.w = 1; temparea.h = 1; - for (y = 0; y < temps->h; y++) { - for (x = 0; x < temps->w; x++) { + for (y = 0; y < tempsurf->h; y++) { + for (x = 0; x < tempsurf->w; x++) { - getpixelrgb(temps , x, y, &tempcol); + getpixelrgb(tempsurf , x, y, &tempcol); // if pixel isn't transparent... if (tempcol.unused > 0 ) { temparea.x = x; temparea.y = y; // make this pixel redder - SDL_BlitSurface(reds, &redarea, temps, &temparea); + SDL_BlitSurface(reds, &redarea, tempsurf, &temparea); } } } - imageset[p].img[MAXFRAMES*2+i] = temps; + imageset[p].img[MAXFRAMES*2+i] = tempsurf; // free red image surface SDL_FreeSurface(reds); @@ -2333,6 +2333,7 @@ void drawsprite(sprite_t *s) { s->img = imageset[s->id].img[frame]; } + // zapper lightning bolt if ((s->id == P_ZAPPER) && (s->timer4 > 0)) { if (s->zapping) {