From bbb53f630401e24e5105db67ea85e4836fd244a5 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Fri, 20 Mar 2009 01:35:13 +0000 Subject: [PATCH] - Added new monster: moth - Fixed bug where the player would get stuck after falling/jumping onto the top of a ladder --- Makefile | 5 +- data/levels/level99.dat | 4 +- data/sprites/moth.png | Bin 0 -> 1396 bytes data/sprites/moth1.png | Bin 0 -> 1351 bytes data/sprites/mothcaught.png | Bin 0 -> 1393 bytes data/sprites/mothdead.png | Bin 0 -> 1368 bytes data/sprites/mothfire0.png | Bin 0 -> 674 bytes data/sprites/mothfire1.png | Bin 0 -> 686 bytes data/sprites/mothfire2.png | Bin 0 -> 687 bytes data/sprites/mothfire3.png | Bin 0 -> 694 bytes defs.h | 15 ++- rc.c | 182 +++++++++++++++++++++++++++++++++++- rc.h | 1 + shared.c | 58 +++++++++++- shared.h | 2 + website/img/moth.png | Bin 0 -> 2023 bytes website/img/mothfire.png | Bin 0 -> 1136 bytes website/info.html | 4 +- 18 files changed, 260 insertions(+), 11 deletions(-) create mode 100644 data/sprites/moth.png create mode 100644 data/sprites/moth1.png create mode 100644 data/sprites/mothcaught.png create mode 100644 data/sprites/mothdead.png create mode 100644 data/sprites/mothfire0.png create mode 100644 data/sprites/mothfire1.png create mode 100644 data/sprites/mothfire2.png create mode 100644 data/sprites/mothfire3.png create mode 100644 website/img/moth.png create mode 100644 website/img/mothfire.png diff --git a/Makefile b/Makefile index f560530..a71063c 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,5 @@ -rc: rc.c rc.h +rc: rc.c rc.h shared.c shared.h defs.h gcc -Wall -DREV=`./getsvnrev.sh` -orc -g rc.c shared.c `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf -lSDL_mixer + +edit: edit.c edit.h shared.c shared.h defs.h + gcc -D__EDITOR -Wall -DREV=`./getsvnrev.sh` -oedit -g edit.c shared.c `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf -lSDL_mixer diff --git a/data/levels/level99.dat b/data/levels/level99.dat index 786927e..fc97ed9 100644 --- a/data/levels/level99.dat +++ b/data/levels/level99.dat @@ -4,9 +4,9 @@ hurryup 10 help endhelp monsters -134 18 15 0 17 15 -171 4 7 +134 18 15 +172 17 28 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/data/sprites/moth.png b/data/sprites/moth.png new file mode 100644 index 0000000000000000000000000000000000000000..014f2a6b955db4926b1ce7661b338c6f195309b4 GIT binary patch literal 1396 zcmV-)1&jKLP)Px#24YJ`L;&po(*Pyy%;!G<000SaNLh0L02U_CX>@2HM@dakSAh-}000EfNklo3;!+G~5)^MS!c9`N}CUQa&B zn>x9FL#HL%Ss>Z6qnu!jd58U9FMMP%8kMt^lx7(5-=RBun|*_Q zbt`}V;qdauNd588{)gVWaZT*+YTey*wN^Bdz7T5;GLg8#&h}){1_t}dq2s59D2hPJ zFqxxqRZFB2O!@4QybDdOT;usOJHJ11RIE9$Xz3-et^>fO`r7S>YwBk9 z4F#C#bHYxBr6^4YXA~$xF?5gs0L}98mu3~vss`3-7U+fso-!GENP@%M({kaHq(;B6 zaQZ|Hc}Hs(PM?S`_iSFkMSZJz-V`p*$s`vWILd0~6|-c}8P1^7go-l&pn=@9NWx5q zU5Z5`1VocfHrlFp+--Ab31nkWf9So6%K4oQ=YHAfng2@Jt*cEJof(|NWmXXn@Omhr zArNGRk_nC^LlepyOms5Sf;J5 z0sv-yWfj7SKDbIfV~R?P(!JfiTK`}x+dVMMxt)?ha87{tZaca<18|BocoPeSW+B?l zNXcy^5Q|ZHVmkf&yvcNi!##EGqKYFQxBvaIst`N4|K9d?KIMFzOk|{=PTt%w~kA<0uV`qeo1|nuV#KvV? zzj=`WKq8rFj)Z*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30u4qm zO%S-F1VOeL7}fr9LsJL3ABg*Wx^0bdwXGApRVykoea$U|6yZ%~5|FEOXm`WuX^$?$ z9vlV$aOPWHn!m6@>%MTtCx#>ZcnUy{s{rEY)Op43^pZ;N8xIK{EKVQ(3WDMI@oSfT zc=gJv{aK0=y(Kn?r8M|^Oc^8?W}9F(o%mnD^RK-Pg$0hCHMJ|w-RQa1KO>*YWjPv3 zX4-%kII4PirEl%Jn#lcr*P{Xe0NU-Xp9qiM;?lu-iM1f<*Y;agm;q|Ls*SgzV zAd*qZ-;RBMAT-=`Xk?;u<~{LGPk~c_0uK*GrBfBZ zn8>`p!=pR$o$0h@0LwCo1@lWa3{(^5dSVsWdFqd_zjy7>STwl#RkLp6%|=$!L6ft< zvWzgjz)A16>>#R(mcFI8Mme$s_wdyw&4-(tmFZQexEE)MOYW4oJtj zq((B3%_{m7Po>JBVpR~zhw}uMAP7n_p){l8Tr=iy=55imY%&^=Bwe2(E19C$Sjdr} zSS}?Sj2Z|?sAzf-K6g&(gsveQPBKup+RG%||>ovP7^gcvlBj0E&qB|^C) z*9Hh-fOIt-i)me1pz2lk;-i7_yO2XDK^@UoYqswH>)(SP0!fm9hy}w##SXfZV3>1f zI;6UW!;KHU&v(`=fU1?X@XWf;8XnCI$8qov@3|ijO$I2L00000NkvXXu0mjfB~^Jq literal 0 HcmV?d00001 diff --git a/data/sprites/mothdead.png b/data/sprites/mothdead.png new file mode 100644 index 0000000000000000000000000000000000000000..da43aa2de128d1a7dc4bf25f5969a8fe382265ac GIT binary patch literal 1368 zcmV-e1*iInP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L02U_CX>@2HM@dakSAh-}000EDNkl#*)bMQ@7gMVgLXiR|0&=!xQB5dEht>&>J^y zC}Y83K}n_PicOmc3rS**Bn=WFG%ra%Z>p%+cCfx)+Yt<2De8K@oTlIUroLX_I1U6M z59r|VaAx4)L!1l-6*ZfsbXBEIcDrG3ZiYI$9se~x{{GgcrnSFBBJXBKMo`82^#u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4$hC&?Gnj3jAvm-mSO$3jg zEnU9z@b_#Yu8Z+wGCjIS{dMG^zIZsU;c3q5-uU_DF4R{%6iQAuGOR?B7s^urngE#L zXLKWDPVC+}aAJ!gri=hbe7xATDs_giDR5}aH+kw}1WV< zY-2c_F{lcccAI`|P8&c&Rhh&2rf`}zq2B1A`qQ1CyB$6+{fzplbSfCDTOF-s6WR`~ zgG&VmZ{9U=|Iza7zESnut&DjZfCd2R$zUusVO*+Iy@m3358tZZdI82_>e`>=&5U{c zz+UyF84?3Rz^hvwty1+CaxYeLhU7&>Fw8w(h614X++;#;m|I1DFevhVje|f4NDiqJ z49W52xz)3;^xrZZR$zt%i~xtGbt}g?As`8g=;qb33I8>J0I$QjBK4H#+W-In07*qo IM6N<$f^&Hv!~g&Q literal 0 HcmV?d00001 diff --git a/data/sprites/mothfire1.png b/data/sprites/mothfire1.png new file mode 100644 index 0000000000000000000000000000000000000000..df014424a174cb9deb0f090da6e12a2f97ec2935 GIT binary patch literal 686 zcmV;f0#W^mP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L02U_CX>@2HM@dakSAh-}0006BNkl8Yg`gA7suhaNgNTr2gjn3fxxTLmYq>vMzCtH`oXxwQz0UacRAI146b10!%u^_y zFi(ZGTpa-0BH6O&^fOg-Uh8!oI_S5bNzCWRws*{&y?pCO|9Y>e@7OALceX3OnPgsT z-E8|7iI$x2Tv>yYM;!jQqxECK(<}A^kO4@gvbCtvrsqSR`!_DS0z)^~mPc(?t?21q zeti0q`Ka&u_s0%}V*nTcW|ui*BEq6?CX4}JquA#4EGsWJ{nCpMFB&ERs3n)B5CFKx zAJz?PPaCSk;W8iCNG^|wHp9eBXismp(SvvcB8=vIg`r5 zSlmSDRrc<#R{3y?DmA4uB$dXq01yGJ?%b<%CFTm@99FZu)?LqxZN4w%X;8*r- zXp+p)P-Y&080e|p(i?Q15Jk>?ZzR>P#d5Rb?^xC6*miESd5(5D_V^mbHiyE?1R{eG z5_5&{$dg|W28L6U0Ca;9gbHES?GmP(D=kxYg}-XGF1#Gi6OPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L02U_CX>@2HM@dakSAh-}0006CNklFKYMMP+jQvgWt%(15!j+ zBqRtP(&Yjnu!GFZYS2L>41`2N9o7`3z3%U?gKtA9I{3iD1JCn(pXbZ-ec*s5S@96y z2pDSP;4M$My+!Y~AC?=05W>uf&86kSOf2eU z2WUPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L02U_CX>@2HM@dakSAh-}0006JNklOM<00Mh39>E-{*Z_2`~aypk;W- z*>&rNbI9#d{3fI9)OEd~)%0?{(8#`cU7UF~Q_KLrfGq`Z0taGK-g^Tf`$)OGll%C& z^5$ZA?a`-1Wx-^U*1fI!IzvHQxUbjhdO2TO0k#1;V^iMA)#Z*%G~yWr0)P)VDB>^> zh(oV^1f`^en;-%rOTatpvFPz1JsKO(fnrOLXmT`iqEWw}|c z?tGOJ^S)Q;sAsPI7zZ|h5>N+p{y_p%zyY)+=6vHw)Md9z@h4N&xad+5q8%aBMP3(N zF`25y-7dv18x4|edbX4Xv|XK=p$kr%o-L(~2FWI~N61=DFNX&m0dY@Nc-oEsK8@i) zM?kCTWjSAHWP7^JL2*xuD3C?5Byv@7&Yo^_Fkfh76;)3;RgI5Ld{QL_U`iSwI{%) cwAUy93kHGLF~fe)id == P_KINGRAT) && (s->timer1 == KRS_WALK))) { if ((!s->falling) && (!s->jumping)) { if (!s->climbing && !s->dropping) { - if (!isonladder(s)) { + if (!isonladder(s) ) { if ((s->id == P_KINGFLY) || ((s->id == P_FLY) && (s->owner))) { // don't adjust } else { adjustheight(s); } + } else if (!s->climbing) { // on ladder but not climbing + adjustheight(s); } } } @@ -5029,6 +5031,133 @@ int movesprite(sprite_t *s) { movex(s, s->jumpdir*getspeed(s), B_TRUE); faceplayer(s); } + } else if (s->id == P_MOTH) { + /* timer1 tracks state, timer2 tracks previous direction + timer3 is current direction + */ + if (s->timer1 == MS_FLY) { + if (s->timer3 == D_NONE) { + int tx,ty; + int d; + int maxdist = -99; + int newdir = D_NONE; + tiletype_t *tt; + + // get current pos + tt = gettileat(s->x,s->y-2,&tx,&ty); + // pick a direction + // scan each direction... + for (d = 0; d < 4; d++) { + int xm,ym,dir; + if (d == 0) { + dir = D_UP; + xm = 0; ym = -1; + } else if (d == 1) { + dir = D_RIGHT; + xm = 1; ym = 0; + } else if (d == 2) { + dir = D_DOWN; + xm = 0; ym = 1; + } else { // ie. d == 3 + dir = D_LEFT; + xm = -1; ym = 0; + } + // are we allowed to go this dir? + if ((dir != s->timer2) && (dir != oppositedir(s->timer2))) { + int curx,cury,hitwall=B_FALSE; + int dist = 0; + curx = tx; + cury = ty; + // check distance until wall + while (!hitwall) { + curx += xm; + cury += ym; + tt = gettilexy(curx, cury); + + if (tt->solid) hitwall = 1; + if (curx < 0) hitwall = 2; + if (cury < 0) hitwall = 3; + if (curx >= LEVELW) hitwall = 4; + if (cury >= LEVELH) hitwall = 5; + dist++; + } + if (dist > maxdist) { + newdir = dir; + maxdist = dist; + } + } + } + // update our direction + s->timer2 = s->timer3; // old dir + s->timer3 = newdir; // current dir + } else { // we DO have a current direction + tiletype_t *tt; + if (s->timer3 == D_UP) { + tt = gettileat(s->x, s->y - s->img->h - getspeed(s), NULL, NULL); + if (tt->solid) { + // hit a wall + s->timer1 = MS_PAUSE1; + s->timer2 = s->timer3; // old dir + s->timer3 = MOTH_PAUSE; + } else { + s->moved = MV_FLY; + s->y -= getspeed(s); + } + } else if (s->timer3 == D_DOWN) { + tt = gettileat(s->x, s->y + getspeed(s), NULL, NULL); + if (tt->solid) { + // hit a wall + s->timer1 = MS_PAUSE1; + s->timer2 = s->timer3; // old dir + s->timer3 = MOTH_PAUSE; + } else { + s->moved = MV_FLY; + s->y += getspeed(s); + } + } else { // right or left + s->dir = s->timer3; + if (movex(s, s->dir * getspeed(s), B_TRUE)) { + // hit a wall + s->timer1 = MS_PAUSE1; + s->timer2 = s->timer3; // old dir + s->timer3 = MOTH_PAUSE; + } else { + s->moved = MV_FLY; + } + } + } + } else if (s->timer1 == MS_PAUSE1) { + s->moved = MV_FLY; + // wait for countdown... + s->timer3--; + if ((s->timer3 == MOTH_FIRESPACE*2) || (s->timer3 == MOTH_FIRESPACE) || (s->timer3 == 0)) { + sprite_t *ss,*target = NULL; + // closest player + target = getclosestplayer(s); + if (target) { + double ang; + // get angle towards target + ang = atan2(target->y - s->y, target->x - s->x); + // shoot + ss = addsprite(P_MOTHFIRE,s->x,s->y - s->img->h/2,"mothfire" ); + ss->xs = cos(ang) * getspeed(ss); + ss->ys = sin(ang) * getspeed(ss); + } + } + if (s->timer3 == 0) { + // go to next state + s->timer1 = MS_PAUSE2; + s->timer3 = MOTH_PAUSE; + } + } else if (s->timer1 == MS_PAUSE2) { + s->moved = MV_FLY; + s->timer3--; + if (s->timer3 == 0) { + // go to next state + s->timer1 = MS_FLY; + s->timer3 = D_NONE; + } + } } else if (s->id == P_SNAKE) { /* timer1 loopsfrom 0 - 19 @@ -5628,6 +5757,20 @@ int movesprite(sprite_t *s) { } else if (s->x <= TILEW) { s->dead = D_FINAL; } + } else if (s->id == P_MOTHFIRE) { + // move + s->x += s->xs; + s->y += s->ys; + // die if it leaves screen + if (s->x >= (640-TILEW)) { + s->dead = D_FINAL; + } else if (s->x <= TILEW) { + s->dead = D_FINAL; + } else if (s->y >= (480-TILEH)) { + s->dead = D_FINAL; + } else if (s->y <= TILEH) { + s->dead = D_FINAL; + } } else if (s->id == P_RAYGUNBULLET) { s->x += s->xs; if (s->x >= (640-TILEW)) { @@ -6760,8 +6903,13 @@ double getspeed(sprite_t *s ) { else speed = 1.5; } } else if (id == P_SPIDER) { - if (s->angry) speed = 2; - else speed = 1.5; + if (s->angry) speed = 2.5; + else speed = 2.5; + } else if (id == P_MOTH) { + if (s->angry) speed = 3; + else speed = 2.5; + } else if (id == P_MOTHFIRE) { + speed = 2.5; } else if (id == P_KINGRAT) { speed = 1.5; } else if (id == P_KINGANT) { @@ -8542,7 +8690,7 @@ int movex(sprite_t *s,double amt,int onpurpose) { s->xs = 0; return NM_SIDE; } - if (tt2->solid == S_SLOPE && (!candoslopes(s->id))) { + if ((tt2->solid == S_SLOPE) && (!candoslopes(s->id))) { s->xs = 0; return NM_SIDE; } @@ -13497,6 +13645,32 @@ void doplayermovement(sprite_t *pl) { } } + +sprite_t *getclosestplayer(sprite_t *s) { + double xdiff1,xdiff2,ydiff1,ydiff2,diff1,diff2; + sprite_t *closest = NULL; + // closest player + if (player && !player->dead) { + xdiff1 = abs(player->x - s->x); + ydiff1 = abs(player->y - s->y); + diff1 = xdiff1 + ydiff1; + closest = player; + } else { + diff1 = 9999; + } + + if (player2 && !player2->dead) { + xdiff2 = abs(player2->x - s->x); + ydiff2 = abs(player2->y - s->y); + diff2 = xdiff2 + ydiff2; + if (closest == NULL) closest = player2; + else if (closest == player) { + if (diff2 > diff1) closest = player2; + } + } + return closest; +} + double getxdisttoplayer(sprite_t *s, sprite_t **pl) { double xdiff1,xdiff2,xdiff = 9999; if (globpowerup == PW_CAMERA) return 9999; diff --git a/rc.h b/rc.h index 0d6a060..cde44f4 100644 --- a/rc.h +++ b/rc.h @@ -113,6 +113,7 @@ void swimup(sprite_t *pl); void swimdown(sprite_t *pl); double getdistance(double x1, double y1, double x2, double y2); void doplayermovement(sprite_t *pl); +sprite_t *getclosestplayer(sprite_t *s); double getxdisttoplayer(sprite_t *s, sprite_t **pl); double getydisttoplayer(sprite_t *s); int playersalive(void); diff --git a/shared.c b/shared.c index f44303a..29f4eb8 100644 --- a/shared.c +++ b/shared.c @@ -843,7 +843,7 @@ void setdefaults(sprite_t *s) { s->lives = 1; } - // special for bosses + // special for bosses/other monsters if (s->id == P_KINGRAT) { s->timer1 = 0; s->timer2 = KR_WALKTIME; @@ -862,6 +862,10 @@ void setdefaults(sprite_t *s) { s->timer1 = KAS_WALK1; s->timer2 = KA_WALKTIME; s->timer3 = KA_SHOOTTIME; + } else if (s->id == P_MOTH) { + s->timer1 = MS_FLY; + s->timer2 = D_NONE; + s->timer3 = D_NONE; } if (isboss(s->id)) { s->lives = getbosshealth(s->id); // health @@ -875,6 +879,7 @@ void setdefaults(sprite_t *s) { case P_BLACKCLOUD: case P_SPIDER: case P_KINGFLY: + case P_MOTH: s->flies = B_TRUE; break; case P_FLY: @@ -1046,6 +1051,36 @@ tiletype_t *gettileat(int pixx,int pixy, int *tilex,int *tiley) { return gettile(tid); } +int oppositedir(int dir) { + if (dir == D_RIGHT) return D_LEFT; + if (dir == D_LEFT) return D_RIGHT; + if (dir == D_UP) return D_DOWN; + if (dir == D_DOWN) return D_UP; + + return D_NONE; +} + +tiletype_t *gettilexy(int tilex,int tiley) { + int tx,ty; + int tid; + + tx = tilex; + ty = tiley; + + if (tx >= LEVELW) tx = LEVELW-1; + if (ty >= LEVELH) ty = LEVELH-1; + + if (ty < 0) ty = 0; + if (tx < 0) tx = 0; + + // return layer2 if it exists + tid = curlevel->map2[ty*LEVELW+tx]; + if (tid == T_BLANK) { + tid = curlevel->map[ty*LEVELW+tx]; + } + return gettile(tid); +} + int loadtiletypes(char *filename) { char fullfile[BUFLEN]; tiletype_t *t = NULL; @@ -1417,6 +1452,14 @@ int loadimagesets(void) { loadspriteimage(P_WSPIDER,F_CLIMB2, "sprites/whitespiderclimb1.png"); imageset[P_WSPIDER].numimages = 10; + loadspriteimage(P_MOTH,F_WALK1, "sprites/moth.png"); + loadspriteimage(P_MOTH,F_JUMP, "sprites/moth1.png"); + loadspriteimage(P_MOTH,F_FALL, "sprites/moth1.png"); + loadspriteimage(P_MOTH,F_CAUGHT, "sprites/mothcaught.png"); + loadspriteimage(P_MOTH,F_DEAD, "sprites/mothdead.png"); + /* next 3 are auto generated */ + imageset[P_MOTH].numimages = 8; + loadspriteimage(P_SPIDER,F_WALK1, "sprites/newspider.png"); loadspriteimage(P_SPIDER,F_JUMP, "sprites/newspiderjump.png"); @@ -1906,6 +1949,14 @@ int loadimagesets(void) { loadspriteimage(P_BIGFIREBALL,1, "sprites/bigfire2.png"); imageset[P_BIGFIREBALL].numimages = 2; + loadspriteimage(P_MOTHFIRE,0, "sprites/mothfire0.png"); + loadspriteimage(P_MOTHFIRE,1, "sprites/mothfire1.png"); + loadspriteimage(P_MOTHFIRE,2, "sprites/mothfire2.png"); + loadspriteimage(P_MOTHFIRE,3, "sprites/mothfire3.png"); + loadspriteimage(P_MOTHFIRE,4, "sprites/mothfire2.png"); + loadspriteimage(P_MOTHFIRE,5, "sprites/mothfire1.png"); + imageset[P_MOTHFIRE].numimages = 6; + // manual angry image for black cloud @@ -2787,6 +2838,7 @@ int isbullet(int id) { if (id == P_SPIT) return B_TRUE; if (id == P_FIREBALL) return B_TRUE; if (id == P_BIGFIREBALL) return B_TRUE; + if (id == P_MOTHFIRE) return B_TRUE; return B_FALSE; } @@ -3246,6 +3298,7 @@ int ismonster(int id) { case P_ANT1: case P_ANT2: case P_ANT3: + case P_MOTH: return MT_MONSTER; case P_BLACKCLOUD: case P_KINGRAT: @@ -3761,6 +3814,7 @@ void setfruitinfo(void) { setinfo(P_SPIDER, "Redback", "Redback spiders will lurk quietly on the ceiling, crawling back and forth. If they notice a player nearby however they will swiftly pounce down onto their prey!", "spider.png"); setinfo(P_WSPIDER, "Whitetail", "Whitetail spiders are more intelligent than other monsters - they are aware of nearby players and will use the landscape to track them down!", "whitespider.png"); + setinfo(P_MOTH, "Moth", "The moth moves in straight lines until it hits a wall. Although simplistic in their movement, moths have the ability to fire a burst of hypno-rays to take out an unwary player!", "moth.png"); setinfo(P_FROG, "Frog", "Green frogs will continually bounce around, making them more difficult to catch. They are also excellent swimmers.", "frog.png"); @@ -3847,6 +3901,8 @@ void dumpinfo(void) { printf(""); } else if (i == P_WSPIDER) { printf(""); + } else if (i == P_MOTH) { + printf(""); } printf("
%s%s\n", diff --git a/shared.h b/shared.h index 14a2a5a..55ef9fa 100644 --- a/shared.h +++ b/shared.h @@ -10,6 +10,7 @@ void setdefaults(sprite_t *s); int loadtiletypes(char *filename); sprite_t *addsprite(int id,int x, int y, char *name); tiletype_t *gettileat(int pixx,int pixy, int *tilex, int *tiley); +tiletype_t *gettilexy(int tilex,int tiley); int loadimagesets(void); int isbullet(int id); void flip(void); @@ -71,6 +72,7 @@ int getnumplayers(void); int isbadpowerup(int id); int iswinpowerup(int id); int isabilitypowerup(int id); +int oppositedir(int dir); // for doco void setfruitinfo(void); void setinfo(int id, char *name, char *desc, char *file); diff --git a/website/img/moth.png b/website/img/moth.png new file mode 100644 index 0000000000000000000000000000000000000000..d76cb94185c053f997eda0ba7863773dd021136b GIT binary patch literal 2023 zcmVPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L02U_CX>@2HM@dakSAh-}000LT%5FoZerF9#yb)#L^qGfHN$!NPKBhI_Y;ymowPHo@o>-#wTb3C1% zT!-{=r6W7J{=V}&zwdlc1Z#T`_npFxJ=d)R-QYV|!$#;jfYY@qK-Zz1-o)WW9V>K6 zKFW~K-^fQHT?HswqdcwiZpF!vpcD(Ah!ggN4LqMi@^YB_KNWO%0((?sP6SDqLd<a`uI~{$YgU>c4C{Y+6Et*WcjW3=0MZs_r~+1sYz#UE^W_D{&(AXG`3U#P!Iq5Cl6EGdg@HyX;{jY$--7Vj^n934DkYZNGbYsQlPT;-c7{ukkk~>@QD*a&_gOTXw9KVdv|`N zG1An%uX`)BM4O)8*S!@!zpr<1t5khN351M0+T-ZW;{ntVR_(B^fD}+@*|6kQfcctL zsuR_bQT0;Egw_?0>eliy!ZI}jQPM~!Ck7+QAny6csrjQj@7$Ih_}8WTr)~MkZZr3T zOvY?j7jeN{Qfc0DVJWA`om=9rL@*kh$e8S|c>qumfcZXBy%%G%%P+LF#JUjj!i_qX zh)sZ~5`?b?U~@u&c*y?j(CCQStk}@erv3Q#q#nRQ6$-^NM05o?AsHqYifDaX2=@<7 zr)CxkRmPaL7GR=7)PgSo0HtqWY`RI;mo=H}X>DtSrbH5XNU@A!8P>IESW_@0bSy9C zO=v)t)Z7}S*^-3{rbnCGTD%Rnug8Yr(l_2oz4gb}`roFM)Sb(yhL=9ahp zA+=CET`60!nML*P|4dzc@tga1e@P((kwD1#>z}h2fke}@d7M!(O2jprW60%9=y9f8 z!5sFby5-N%>48Z2!n6m`-PxawTIrSM|;VfLAcA zaUc>5^=GBOpLcQ9h@(pr3wZmMX7^WrICWger4E<)sj#jAN9z=RZvSxl7yBRTkcx&^ zl?j&a*}l=}+}!F_ZTo7~c1)vU6{gY)7XiRp%$Gmd&=P@B*k%O`q9)*ZSBUTQ@p#P$m=88I+pJ{BvqH zlV%%Q08o)-rMj^-_Oa%+xU>1Tn0N0-Bcw4%@bhmBANyb-H_z@^5dccu5+e@`82PsWjJEX!4+Sc>Rs?)R^pd6ffZ0DzG#6f-@$IwFk$*KzGqX=0`@ z`j?ZVuMZ54kFk(ZW`Jq{4F<021B})yr)!B^Wf48ha$+N^DnjfXVM=%t)ea}I&{4ZK zwL@G5fC5`Z2H5lgxT4q;OXXV4Rbd;|z}PG=Vju70!AZgaOvYH5>9mBvTerdC8;#nA zm;tG9=69J=nRlF3z+pko;LK?Yv26uFsZOg#xoQ`2 zU-#u_R>UQzbiOU zUDj6X_>s^iitVDLO~q^BH$A9Vh0vQB%me@c literal 0 HcmV?d00001 diff --git a/website/img/mothfire.png b/website/img/mothfire.png new file mode 100644 index 0000000000000000000000000000000000000000..33a3f717c9c5c82d77bdab769c225b146bd7f876 GIT binary patch literal 1136 zcmV-$1dscPP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L02U_CX>@2HM@dakSAh-}000BaNkl77YvP(pci|{N-!%B5;I{lNFR!zGV9e>A9@Iipa&n4 zK(HHB7L^fn6ErG(=t59Nn^9q?sCn6S*4;U$mosuYomtl~s)e63J9B2f@BjYGIfvl) ze#GTIo39V0I+r8?X7fdW{03o`DiKc#z+{$tsd~-kq5x5hqN(0x!YCRPV@h!q0X1nP zE(9E-(#YIMc#?p70hj;+b=Bs&{WaM&!9{w$H$%%}jM-L$qT!B2-LBO`(7WKnpI?^E;nLySVIeNg*e(Y_7`W{jSKfoS>e^ zNqM;G&i4fSDK|8?B*{o8{tNBny#i~Zkk$q;4Ip;4W8!^ghGvLPa00pjJZmRZH5(!j z6>Hk&&nN(!0F00sX;mJ}3eHSaHX|#>A~lufS^ycGsO&ivl<|Zr%z~&zqb?4);<$wX z14D^$=|VURjRBFra1m5&cqqxWy*imBa^c!UINsl$k z=cfTk=j9h@tPhmbR%h+)d2Mx_Y#!+ZFeVVCLK9LFP=a&sf&g+ZoLzcg!+LL7-{<(d z`(2S|r_YVPTAAzdhAPa0vQ0*D-iov}&tF=P>yCfB%=?8y!07`qUMZ?xz*H-rL%V+J3&dPxof|U%0000
Queen AntAfter an ant has eaten enough, they become a Queen. Queens are just as fast as soldiers and can also breath fire. Furthermore, they are only one meal away from spawning additional ants!
WhitetailWhitetail spiders are more intelligent than other monsters - they are aware of nearby players and will use the landscape to track them down! - Bosses + +
MothThe moth moves in straight lines until it hits a wall. Although simplistic in their movement, moths have the ability to fire a burst of hypno-rays to take out an unwary player! +Bosses
Cloud of DoomThis unkillable cloud will appear if you spend too much time on one level. Beware, as the only way to defeat the cloud of doom is to complete the level before it grows too large to handle!
King RatThis mighty creature is the ruler of the rats, and impervious to the player's net. It can only be harmed by slamming another monster into it! King Rat will roam the level searching for a player, and upon spotting them will charge at high speed.
King SnailThe absolute ruler of the snail kingdom is far too large and heavy to catch in a net. In addition, its shell provides protection against all attacks, leaving only its head vulnerable. While King Snail is too proud to chase down enemies itself, it can use its snail army to destroy its foes.