From 9cab0704cf5939e1e993dcaa86f8f6634b8e0cfc Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Thu, 23 Oct 2008 01:18:49 +0000 Subject: [PATCH] Fixed bug with boxing glove facing the wrong way Added new tile type: metal More troublshooting code for catching bug --- data/green.tiles | 6 ++++ data/levels.dat | 1 + data/newtiles/metal.png | Bin 0 -> 766 bytes data/world1/level110.dat | 65 +++++++++++++++++++++++++++++++++++++++ rc.c | 14 ++++++--- shared.c | 26 +++++++++++----- shared.h | 2 +- 7 files changed, 100 insertions(+), 14 deletions(-) create mode 100644 data/newtiles/metal.png create mode 100644 data/world1/level110.dat diff --git a/data/green.tiles b/data/green.tiles index d233814..294f455 100644 --- a/data/green.tiles +++ b/data/green.tiles @@ -351,3 +351,9 @@ id 5 solid 0 file newtiles/railleft.png end + +tile land +id 4 +solid 1 +file newtiles/metal.png +end diff --git a/data/levels.dat b/data/levels.dat index 164ef4d..be3d052 100644 --- a/data/levels.dat +++ b/data/levels.dat @@ -30,5 +30,6 @@ 101,level101.dat,Sand Castle 102,level102.dat,Diving Pool 18,level8.5.dat,Look out above... +110,level110.dat,Portrait Gallery #1 109,level109.dat,THE END SO FAR 99,level99.dat,TEST LEVEL diff --git a/data/newtiles/metal.png b/data/newtiles/metal.png new file mode 100644 index 0000000000000000000000000000000000000000..e3b33a243174709bd0430079c44dcf68c0c3d3e0 GIT binary patch literal 766 zcmVOwtM!pF>BOB5Y#9F3d7GZ`+eZ|Z{Mj(bwdvqud+(r zi5tJ4PEkCVj?(vInqH`7QmTaB4$4F!2oj8t5G5<7Up`fNvHEXi*sA|Myz@iN zv~I@3<*zw>_-*R11K;2Gu6u)l%{k|s3(kcQnyF(&KJB)JfFB07zw)pw!}Y6oPSU%F ziEX#ntF@}CZOh=iff$>XQKd=2k>mCceo)kWdOw17S&yb;Lg3Yowpwug>O++dUFYXN zPqhRH!5AZ|D(Az2)nYgq?SdW4^W%F&S}jFWVbQ>$>&*V0aRI2RW?7bF&w#q<=gNe5xL0O|NN?bA9XI*;Q#;t07*qoM6N<$g0X*dod5s; literal 0 HcmV?d00001 diff --git a/data/world1/level110.dat b/data/world1/level110.dat new file mode 100644 index 0000000..a38f151 --- /dev/null +++ b/data/world1/level110.dat @@ -0,0 +1,65 @@ +bgfile beach1.png +bg 0 +hurryup 60 +help +endhelp +monsters +0 2 23 +23 10 3 +12 20 18 +1 31 19 +1 9 19 +6 19 3 +1 36 11 +1 4 11 +49 32 7 +49 4 7 +60 30 26 +60 6 27 +18 11 28 +18 33 28 +1 33 15 +1 6 15 +endmonsters +exitdir 1 +44,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,44, +44,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,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,33,33,0,0,0,0,0,0,0,0,0,33,33,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,33,33,33,0,0,0,0,0,0,0,0,0,33,33,33,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,23,23,33,33,33,0,0,0,0,0,0,0,0,0,0,0,33,33,33,23,23,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,33,33,33,0,0,0,10,56,56,56,9,0,0,0,33,33,33,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,33,33,33,33,0,56,56,56,56,56,56,56,0,33,33,33,33,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,33,33,33,56,56,56,56,56,56,56,56,56,33,33,33,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,23,23,23,23,23,23,23,23,23,23,0,0,56,56,56,56,56,56,56,56,56,56,56,56,56,0,0,23,23,23,23,23,23,23,23,23,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,56,56,56,56,56,56,56,56,56,56,56,56,56,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,56,56,56,56,56,56,56,56,56,56,56,56,56,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,56,56,56,56,56,56,56,56,56,56,56,56,56,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,23,23,23,23,23,23,23,23,23,0,0,0,0,53,53,33,33,33,33,53,33,33,33,33,53,53,0,0,0,23,23,23,23,23,23,23,23,23,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,53,53,33,33,33,33,53,33,33,33,33,53,53,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,53,53,33,27,33,33,53,33,33,27,33,53,53,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,53,53,33,27,33,33,53,33,33,27,33,53,53,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,23,23,23,23,23,23,23,23,0,0,0,53,53,33,33,33,33,53,33,33,33,33,53,53,0,0,23,23,23,23,23,23,23,23,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,53,53,53,53,53,53,53,53,53,53,53,53,53,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,53,53,53,53,53,53,53,53,53,53,53,53,53,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,53,53,53,53,53,53,53,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,23,23,23,23,23,23,23,23,0,0,0,0,0,53,53,53,33,53,53,53,0,0,0,0,23,23,23,23,23,23,23,23,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,53,53,33,53,53,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,33,33,33,33,33,33,33,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,33,33,33,33,33,33,33,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,33,33,33,33,33,33,33,33,33,23,23,23,23,23,23,23,23,23,23,23,23,23,23,44, +44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,33,33,33,33,33,33,33,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44, +44,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,33,33,33,33,33,33,33,33,33,16,16,16,16,16,16,16,16,16,16,16,16,16,16,44, +44,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,33,33,33,33,33,33,33,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,44, +44,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,33,33,33,33,33,33,33,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,44, +44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44, +layer2 +19,19,28 +20,19,28 +21,19,28 +17,28,15 +18,28,15 +19,28,15 +20,28,15 +21,28,15 +22,28,15 +23,28,15 diff --git a/rc.c b/rc.c index e7e3db3..e0bba3a 100644 --- a/rc.c +++ b/rc.c @@ -1347,19 +1347,20 @@ void checkcollide(sprite_t *s) { /* check for colission with our net */ if (s->netting ) { - if ((isnettable(s2->id) && !s2->invuln) || (s->netsticky && isfruit(s2->id))){ + if ((isnettable(s2) && !s2->invuln) || (s->netsticky && isfruit(s2->id))){ if ((s->x + s->netlen*s->netdir) > s2->x) { xdiff = (s->x + s->netlen*s->netdir) - s2->x; } else { xdiff = s2->x - (s->x + s->netlen*s->netdir); } - //if (xdiff < 0) xdiff = -xdiff; + if (xdiff < 0) xdiff = -xdiff; + if (s->netystart > (s2->y - s2->img->h/2)) { ydiff = s->netystart - (s2->y - s2->img->h/2); } else { ydiff = (s2->y - s2->img->h/2) - s->netystart; } - //if (ydiff < 0) ydiff = -ydiff; + if (ydiff < 0) ydiff = -ydiff; ythresh = s2->img->h; // check... @@ -1382,8 +1383,6 @@ void checkcollide(sprite_t *s) { if ((xdiff <= s2->img->w/2) && (ydiff <= ythresh)) { // we hit something! - printf("caught: s='%s',%0.0f,%0.0f s2='%s',%0.0f,%0.0f\n", - s->name, s->x, s->y, s2->name,s2->x,s2->y); if (s->netsticky && isfruit(s2->id)) { getfruit(s, s2, 1); @@ -1423,6 +1422,11 @@ void checkcollide(sprite_t *s) { // otherwise we caught it if we have enough nets if (s->netcaught < s->netmax) { + + printf("caught: ydiff=%0.0f,ythresh=%0.0f,s='%s',%0.0f,%0.0f s2='%s',%0.0f,%0.0f\n", + ydiff,ythresh, + s->name, s->x, s->y, s2->name,s2->x,s2->y); + s2->caughtby = s; s2->jumping = B_FALSE; s2->falling = 0; diff --git a/shared.c b/shared.c index 311e330..20ac0fb 100644 --- a/shared.c +++ b/shared.c @@ -1222,6 +1222,8 @@ int loadimagesets(void) { loadspriteimage(P_GLOVE,F_WALK1, "sprites/glove.png"); imageset[P_GLOVE].numimages = 1; + // manually do flipped images + imageset[P_GLOVE].img[MAXFRAMES] = rotozoomSurfaceXY(imageset[P_GLOVE].img[0], 0, -1,1,0); loadspriteimage(P_DIAMOND,F_WALK1, "sprites/diamond.png"); imageset[P_DIAMOND].numimages = 1; @@ -1686,6 +1688,10 @@ void drawsprite(sprite_t *s) { if (s->dir == -1) { frame += MAXFRAMES; } + } else if (s->id == P_GLOVE) { + if (s->dir == -1) { + frame += MAXFRAMES; + } } else if ((s->id == P_WINGLEFT) || (s->id == P_WINGRIGHT)) { if (player->dir == -1) { frame += MAXFRAMES; @@ -2573,6 +2579,8 @@ int randompowerup(void) { int num; num = rand() % 31; +return P_BOXING; + switch (num) { case 0: default: @@ -2674,14 +2682,16 @@ int isboss(int monid) { } } -int isnettable(int monid) { - if (ismonster(monid)) { - switch (monid) { - case P_BLACKCLOUD: - case P_KINGRAT: - return B_FALSE; - default: - return B_TRUE; +int isnettable(sprite_t *s) { + if (ismonster(s->id)) { + if (ismonster(s->id)) { + switch (s->id) { + case P_BLACKCLOUD: + case P_KINGRAT: + return B_FALSE; + default: + return B_TRUE; + } } } diff --git a/shared.h b/shared.h index 353238c..b2691c5 100644 --- a/shared.h +++ b/shared.h @@ -47,7 +47,7 @@ int loadlevellist(void); int savelevellist(void); int ispermenant(int pid); int isbosslevel(int lev); -int isnettable(int monid); +int isnettable(sprite_t *s); int isboss(int monid); int getbosshealth(int mid); void getpixelrgb(SDL_Surface *where, int x, int y, SDL_Color *clr);