From cc94db97eab9825cda0bcd07093b2ccc5841f4fb Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Fri, 21 Nov 2008 00:14:26 +0000 Subject: [PATCH] Added intro sequence --- data/levels/intro.dat | 107 ++++++++ data/map.dat | 1 + data/newtiles/castle.png | Bin 0 -> 921 bytes data/newtiles/castleback.png | Bin 0 -> 797 bytes data/newtiles/chairbackl.png | Bin 0 -> 588 bytes data/newtiles/chairbackr.png | Bin 0 -> 587 bytes data/newtiles/chairlegs.png | Bin 0 -> 609 bytes data/newtiles/cord.png | Bin 0 -> 428 bytes data/newtiles/light.png | Bin 0 -> 759 bytes data/newtiles/light2.png | Bin 0 -> 749 bytes data/newtiles/tableleg.png | Bin 0 -> 410 bytes data/tiledefs.dat | 54 ++++ defs.h | 23 +- edit.c | 6 + rc.c | 471 ++++++++++++++++++++++++++--------- rc.h | 2 + shared.c | 9 +- 17 files changed, 559 insertions(+), 114 deletions(-) create mode 100644 data/levels/intro.dat create mode 100644 data/newtiles/castle.png create mode 100644 data/newtiles/castleback.png create mode 100644 data/newtiles/chairbackl.png create mode 100644 data/newtiles/chairbackr.png create mode 100644 data/newtiles/chairlegs.png create mode 100644 data/newtiles/cord.png create mode 100644 data/newtiles/light.png create mode 100644 data/newtiles/light2.png create mode 100644 data/newtiles/tableleg.png diff --git a/data/levels/intro.dat b/data/levels/intro.dat new file mode 100644 index 0000000..316d3f7 --- /dev/null +++ b/data/levels/intro.dat @@ -0,0 +1,107 @@ +bgfile sky1.png +bg 0 +hurryup 30 +help +endhelp +monsters +0 5 15 +134 23 15 +23 36 20 +2 7 15 +2 19 15 +9 14 15 +9 8 15 +141 10 15 +143 12 15 +10 15 15 +11 17 15 +11 13 15 +140 16 15 +140 9 15 +142 11 15 +142 18 15 +143 21 15 +141 20 15 +15 37 12 +15 39 12 +endmonsters +exitdir 1 +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,74,0,74,0,74,0,74,0,0,0,0,0,0,0,0,0,0, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,74,0,74,0,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0, +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,0,0,0,0,0,0,0,0,0,0, +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,0,0,0,0,0,0,0,0,0,0, +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,0,0,0,0,0,0,0,0,0,0, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,74,0,0,0,0,0,0,0,0,0,0, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,74,0,0,0,0,0,0,0,0,0,0, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,74,0,0,0,0,0,0,0,0,0,0, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,74,0,0,0,0,0,0,0,0,0,0, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,74,0,0,0,0,0,0,0,0,0,0, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,0,0,0,0,0,0,0,0,0,0,0, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,0,0,0,0,0,0,0,0,0,0,0,0, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,0,0,0,0,0,0,0,0,0,35,1,1, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,0,0,0,0,0,0,0,0,0,0,42,4, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,0,0,0,0,0,0,0,0,0,0,4, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,0,0,0,0,0,0,0,0,0,0,4, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,0,0,0,0,0,0,0,0,0,0,4, +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,75,0,0,0,0,0,0,0,0,0,0,0,4, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,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, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,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, +layer2 +0,3,74 +0,4,74 +0,5,74 +0,6,74 +1,6,19 +14,6,80 +26,6,18 +0,7,74 +14,7,80 +0,8,74 +11,8,82 +12,8,82 +13,8,82 +14,8,81 +15,8,82 +16,8,82 +17,8,82 +0,9,74 +0,10,74 +6,10,82 +22,10,82 +0,11,74 +0,12,74 +0,16,74 +1,16,74 +5,16,78 +7,16,64 +8,16,62 +9,16,62 +10,16,62 +11,16,62 +12,16,62 +13,16,62 +14,16,62 +15,16,62 +16,16,62 +17,16,62 +18,16,62 +19,16,62 +20,16,62 +21,16,63 +23,16,79 +0,17,74 +1,17,74 +5,17,76 +8,17,77 +20,17,77 +23,17,76 diff --git a/data/map.dat b/data/map.dat index ce4b8bc..84ae105 100644 --- a/data/map.dat +++ b/data/map.dat @@ -55,3 +55,4 @@ 109,level109.dat,THE END SO FAR 99,level99.dat,TEST LEVEL 417,level417.dat,NEW LEVEL +0,intro.dat,INTRO diff --git a/data/newtiles/castle.png b/data/newtiles/castle.png new file mode 100644 index 0000000000000000000000000000000000000000..7fe9c4c575cb6b2c419839a0a5d13713fdf3427b GIT binary patch literal 921 zcmV;K17`e*P)WFU8GbZ8({Xk{QrNlj4iWF>9@00R931+3ZVqMbZ{Uu!1*fl@&x##FyUu0v`PiUVH7uyC5QZDhR$DEc8%t zFI`a&b**N*X?C;8W|DcI$usdF{yxI5@%0yX)?L?Sm1a~0tc)QwB~%56j~;XL*6a99 z$cmB*gE0mS*jn@O@CdQ#@3JZklZzQ%5MbFFzwM%=!D$Pcs>HGtmeQC!qe>!dt+A8@ zQ(=upL!w1UXCq)d9@DZNs112$$P!2s!|Cvt{`M9vuSabRLQ3Lj!DuqYy8qx8(kuhk zD5bG2!Di4!VmLV&0tH%2{(Ss|q*|esz|`P(U6QP#@x!;Duah*P<8ScgH~0AHgLeoQ zQ%qGb9?x+sh18PEaLL(t%E24AxR{Ue9EUtBv5GVy4KwDm7z`*N@H(8GO?df*>y(r@ zEuSk<&TRUSJddG-T3bkIu$pe0J%0lPJUaS~w(C(>1y={xh~f~9B#Y)CHF;5B+b+u1 zNI)r<#_jhG)>pUtND03`8T0Cm7n#rI*h-?c#XMZl_B={c^Xngf(GPlLMNYTZMF>IT zyRYu9XBQKcYLVtC{VQ8YY>Fc1$De-Y;LX>FmLcbpIs5y2%q~JGO5!XhTt---EEA4B#n9YY{n!^s7gb(AJFl98lQap;aV%j>G>Gn?;?dDPEvf&WjH#g z-}3>mn~J>1ku)e)1|bA>UDLSx*{5seH~`%H{sHg4eUmcHk(NM8jg%T&H(ACZ_YaS_ z{@gx}Eh(!CV+@w;wZMSWvRQ-)(K5vIeNK~vrV?anj#SXnHW)*k6$n$703>lt zR;*}u0!;l2Pp&qS(fuJ+OTz=dsNkA00000NkvXXu0mjf-L0Ls literal 0 HcmV?d00001 diff --git a/data/newtiles/castleback.png b/data/newtiles/castleback.png new file mode 100644 index 0000000000000000000000000000000000000000..23ad28d3cbb51f972dc4acddb2c5af7d93269d10 GIT binary patch literal 797 zcmV+&1LFLNP)WFU8GbZ8({Xk{QrNlj4iWF>9@00MzYL_t(I%QchBa$7|d zMb|mqeIJr#D@i4WIH?M$f)8N8j4BxM|05=h0>L4UWi07R_jdO=&A?&*z}jn9ZTa=* zAKTa^tW?~fUbtATIL{f}sny7(5ckuJRp&Sz8HWy4C5TY0Qi}1oKX7$%!REzCSu$Ci z&_z^11a$0sz!}EGX0t{_nDfHW512c{IN}X*DI8A=bFR2M{m|2;gna+*ZBrFa=MyPC zd6in|QpaJM7>6E!po)1#5X>DBp|wVQcC|)BWFU8GbZ8({Xk{QrNlj4iWF>9@00FQ`L_t(I%YBkNavMPm zL|+55OD-kS`05=ORFb)ao7h+ozx1s@d#PgaAN z3|0yx7|BNl&kp;=871ZjwifIcr`BLy#4dyV(E(jO4-6_vO~cJlbSg$oV=6((xbDE! zW9uR$@%sdGhhsn>n%i}sMj^ZD_ns29(|ceh+zc{ly^g-A~nJ97YeWFU8GbZ8({Xk{QrNlj4iWF>9@00FN_L_t(I%YD<$ZWBQe zMd5R+dd7|w0g6ai@f^GpkIkMSCB#3|T~#bh#!eRLT}x;6-ERH-@txk2Di{UU1d&7) z^VCokEs`>^06P~Osoaa5k~Vr`1~wT}fktAJs1%V!^9i%UE0{{WgxCWFxH)Z4V=M(7 zMkQv>Z7U>L29Uvx!KA`S?mY>?lA<-EeQklw!kTefirJD|PYl>MBQn`KOe9gzaS$8} zmPIrSP%%c}22OGas49ZM1cw37GJ3$vDDF4Lmsac)v~QbWK~%x1#FFCFiyp>y0t1et zIE(^=$>Gnii@~qI#@39b3V??>c$Bg4MU!zi2QM-{Z_drb9Q=*tVxTO-ot_Cmr)ZVj zG||iG6xU6sz_l9Ka3c|ighRqHKn6Fn*86pH4ETKlNo<>FB{8By2>>_I6GA{0Zs#}g z+PDd;WSk0jqqR)7X1LA!je3pJnTbrGNm>TO#WFU8GbZ8({Xk{QrNlj4iWF>9@00G5GL_t(I%axL`juSx) zhCh3}yV-DAL4-tff){`WBqR!oD<}{p4IKqEJO>X#K}|=&d(d1>Kc>C%Jr?(pbygUTpUD*DDAKAFOsJZxjPI0iA6^85#&4$^eW^uCx zeBaR3LawTPJ)b7#C&6ahCvP6#i&}%uzyc}?Ng$*21(FI=bsV@V%Ep7HHhgg01Dlu- z0hhmnQi2<%R0%8`QOFKg4kALrNh%COK?P7S&xKMPRY4Q<1N0kcO=xSO2>i-WrJ$*V zR-q9`1Zo1yIheJ|JUM_YH;Gz=-kq5`%S|F@XJSGZ&T^dqi5+9DjpJq%fE-FvMZAzv zawx6&p2;zCJI2~tfS@m<<+Vedgdr(?3Dyo>^Osp~KWN8T22wz!GM+>*luW3QbgZv2 z5deEef3AXpGL^zq3Y`V53g*7A51G#58lxP^;hX=JqZ0cfqk{wHza;J)v_~Xr20X@< vOiTfTxRNh{fr-lLEaCJBYa6=k?8s((M%z)C_U?uw1%G z^xdi49WA?9moDtk^z|^B?59?I*Wr2cue$qBi|##ku=)J=quW*4g8#c7*6lv}?C<9s zy-%VE`x>%%UN1Ue5`AgbZ%F38~VEXJIV)aMmQf&j=cnx)3&rPr3E{PR- z$rCGbS$1_nlOMB?s)>*z@5bo|em5&d7F60g-VgElWZE?U$Dd73T!(AiY}U$4)HqE$ zZ`t|YA@XC%Nny3vlqA9!ZPP)uIO`(T{|tCazh$N-9Eqk4x&buMCo=N4Gpwd$o(@lH_iUHtVoB;s1=c7WXgO UG-2g8U?4Jhy85}Sb4q9e0QbkOO#lD@ literal 0 HcmV?d00001 diff --git a/data/newtiles/light.png b/data/newtiles/light.png new file mode 100644 index 0000000000000000000000000000000000000000..c7407a4a147d26efcd52314370d63d4d3a0d00f0 GIT binary patch literal 759 zcmVWFU8GbZ8({Xk{QrNlj4iWF>9@00LV{L_t(I%Z-xXOH*+e z#^3k5owGS>oJn&K>E`f9uIaS?00Z%|Bx17aq7dpL`hf^`lNUh{gi_swMK?)7WLRB9 z5Y>fA1f|U%wN1AM&9yn*)^X>|v+cZHZG?Hq=k9&q4-XFyFM@`mk4})3Tf^EGH^paW z(0%#cwj9$kz-lu}qC(kN3=I~6v^Y%zm9HYDsG^h+si*>KaeA%8YAlYaY=NL8BPbgL zu)WDY3C3>SWB>qiHbq!v!W=V@m{xY4;M~BF3ILFk5rOff07I$3?L0wQ1>Q`;E6Z$0L;Y-q{USXII}>TtomnpHkx?i%mSq)0)vr5 zEw0jm@;j;Wyt=PE=S30onO`Ir0n~z0>0m2|006=9qr~Y6)S?W`=KRvoGj{0j9o066 zBP$M%T|Xt3cU)Zu)pw0B-SPGskR_e-!Bf8@o>YzLbvpZedO6fw@0iGyHqXDGN@c%O*ov)^L~Vi*|T@cLULMKyNbThX${G1g-BHy?SZC6bqb8EH4gA pQnA?3)_y~9x?f)$9{sSD{R22UAw~&yf{_3K002ovPDHLkV1oF6R?Ywb literal 0 HcmV?d00001 diff --git a/data/newtiles/light2.png b/data/newtiles/light2.png new file mode 100644 index 0000000000000000000000000000000000000000..cd5f18b4ba58b1ba9e511cce07a0a672510a7c0f GIT binary patch literal 749 zcmVWFU8GbZ8({Xk{QrNlj4iWF>9@00L1-L_t(I%axGbOH*+e z$G_*dbI#_haVBkpNTT+?a&0S4k_NrbZMq6q3DdO-xc$%`Ne!cpCYMK?)7WLRB9 z5Y>fA1hq9^YEE5)=GvT|vyMAw?&bWtn#SmmJ$K*d`8;2q=gUB+Vh@i&$*#iQ;z1%1 zfalWNzj8#+fT^}Xk@LvJ<1ktUJxt#~OQ-2aB96fwwvTZLk&^ zqnXG!E$f*Sf%{-T?LIj`r{e|aahnF5MW7p``bSxt%se=YKt+YZXxe(AlH1H6|0|{O zytb#TbFz$_^pg=xfL7QFv65o|V1Dc{sDe0LpBs8c5B%Aq_U5JNa=q8dPRivT zSKC4Bx<-iMXnPG*#o)UCBvhYBX(n-vo_RL47-_DnAJ3LH&b^yVOG`o$QL`S^7FmZBEPp}u{k z*-+XL{1Ove8){=6eZD*4m>6cw=G@TW)eoB?R+j(D#l1>Ad_1{0H>@bdVnbW|b;0F% fbz#{5zLNb7>t_!{D%y8N00000NkvXXu0mjf?3PuO literal 0 HcmV?d00001 diff --git a/data/newtiles/tableleg.png b/data/newtiles/tableleg.png new file mode 100644 index 0000000000000000000000000000000000000000..0f5e6dc53d9a408d3980092d5427289da99f0747 GIT binary patch literal 410 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=I50S^h-E752+Bfr9KMp1!W^H@HO^1dY!ve-Hr_k}YwKC~?lu%}vcKVQ?-=O)N=G zQ7F$W$xsN%NL6t6^bL5QqM8R(_|MbDF~s6@?<7M%Wv<3ar?yTMa zwa}>Uv+C*>>q@>zZjxqQx+6$c@mY7@pPdp`PrUXExjYPcn32Fye96`QpNHG`$pH+- z9$F91#c=CwdU0a^NzuKh4keaoopRH<{pO2S%4S!0JFcvyLUS()&)?kg@9nNd=hyH4 zaA=cZ!;c@I`k3B|F?Ad`-{8jm`=aJLo|8A!7Jr`kq)zfemZH}Vo{X&*YMe^WNiS{@ zXLCIA`Pc{fEeii;JBk!8KDKJ{S%t2Q2J3pGA56+DGOlg*OHKnrg2B_(&t;ucLK6UI Cx~QQ5 literal 0 HcmV?d00001 diff --git a/data/tiledefs.dat b/data/tiledefs.dat index 4f72ee0..5ec8288 100644 --- a/data/tiledefs.dat +++ b/data/tiledefs.dat @@ -487,3 +487,57 @@ file crightr0.png crightr1.png crightr2.png crightr3.png animspeed 4 animsync end + +tile castle +id 4 +solid 1 +file newtiles/castle.png +end + +tile castleback +id 5 +solid 0 +file newtiles/castleback.png +end + +tile chairlegs +id 17 +solid 2 +file newtiles/chairlegs.png +end + +tile tableleg +id 5 +solid 0 +file newtiles/tableleg.png +end + +tile chairbackl +id 5 +solid 0 +file newtiles/chairbackl.png +end + +tile chairbackr +id 5 +solid 0 +file newtiles/chairbackr.png +end + +tile cord +id 5 +solid 0 +file newtiles/cord.png +end + +tile light +id 5 +solid 0 +file newtiles/light.png +end + +tile light2 +id 5 +solid 0 +file newtiles/light2.png +end diff --git a/defs.h b/defs.h index bd61cb4..f65a679 100644 --- a/defs.h +++ b/defs.h @@ -59,6 +59,7 @@ #define TEXTSIZE_TITLE2 16 #define TEXTSIZE_CREDIT 14 #define TEXTSIZE_LEVEL2 22 +#define TEXTSIZE_YUM 24 #define TEXTSIZE_BIFF 26 #define TEXTSIZE_MULTI 26 #define TEXTSIZE_LEVEL 32 @@ -75,7 +76,23 @@ #define TT_NORM 0 #define TT_HELP 1 #define TT_HELPSHADOW 2 -#define TT_GAMEOVER 3 +#define TT_INTROTEXT 3 +#define TT_GAMEOVER 4 + + +// intro states +#define IS_START 0 +#define IS_YUM 1 +#define IS_YUMWAIT 2 +#define IS_JUMP 3 +#define IS_RATS 4 +#define IS_RATS2 5 +#define IS_FINISH 6 + +// intro variables +#define INTRO_RATSPEED 12 +#define INTRO_LEVELNUM 101 + #define GAMEOVERWAIT 3 // # of seconds to wait before going back to title @@ -89,6 +106,7 @@ #define HURRYDELAY 50 #define LIFEDELAY 50 #define CLOVERDELAY 50 +#define YUMDELAY 80 #define POKERMSGDELAY 80 #define LEVELWINDELAY 80 #define DIEDELAY 80 @@ -207,7 +225,7 @@ // Limits -#define MAXLEVELS 100 +#define MAXLEVELS 102 #define MAXMAPPINGS 50 #define MAXMONSTERSPERLEVEL 60 #define MAXLETTERHEIGHT 100 @@ -865,6 +883,7 @@ typedef struct sprite_s { // player and monster struct sprite_s *onplatform;// are we on platform? + int antigrav; // don't fall int lives; // only for player and bosses int swimming; // are we in the water? int falling; // are we falling? diff --git a/edit.c b/edit.c index b87a2da..517c74d 100644 --- a/edit.c +++ b/edit.c @@ -26,6 +26,8 @@ int selsprite = -1; int modified = B_FALSE; // has the current level been modified since last save? +int allowfruits = B_FALSE; + int curlevelnum; @@ -92,6 +94,9 @@ int main (int argc, char **argv) { } else if (!strcmp(argv[i], "-dump")) { dumpinfo(); exit(1); + } else if (!strcmp(argv[i], "-c")) { + printf("allowing fruits\n"); + allowfruits = B_TRUE; } else if (!strcmp(argv[i], "-l")) { if (++i >= argc) { printf("Missing level number.\n"); @@ -1134,6 +1139,7 @@ int isplacablesprite(int sid) { if (sid == P_POWERUPPOS) return B_TRUE; if (ismonster(sid) && (sid != P_BLACKCLOUD)) return B_TRUE; if (isfruit(sid) == FT_GEM) return B_TRUE; + if (allowfruits && (isfruit(sid) == FT_FRUIT)) return B_TRUE; return B_FALSE; } diff --git a/rc.c b/rc.c index fd3149e..52c89f7 100644 --- a/rc.c +++ b/rc.c @@ -36,6 +36,8 @@ SDL_Surface *credittext; int globpowerup; int globtimer; +int introstate; + TTF_Font *font[MAXLETTERHEIGHT]; char hiscoreserver[BUFLEN]; @@ -514,6 +516,14 @@ int main (int argc, char **argv) { } } + + /********************************************** + * Intro sequence + */ + if (inintro()) { + dointroseq(); + } + /********************************************** * Move onscreen text */ @@ -697,8 +707,10 @@ int main (int argc, char **argv) { // draw text drawtext(); - // draw score - drawscore(); + if (!inintro()) { + // draw score + drawscore(); + } // draw boss health if (boss) { @@ -1104,10 +1116,22 @@ void nextlevel(void) { /* in case we skipped the level due to a powerup etc */ levelcomplete = LV_NEXTLEV; + /* go to next level */ - curlevelnum++; + // this won't trigger on the first load of the intro + // becasue curlevelnum is decremented before this function + // is called. When the intro ENDs, the next line will + // be true. + if (curlevelnum == INTRO_LEVELNUM) { + curlevelnum = 1; + } else { + curlevelnum++; + } + if (!musicplaying || (curmusic == fastmusic)) { - playmusic(normalmusic); + if (curlevelnum != INTRO_LEVELNUM) { + playmusic(normalmusic); + } } // don't want the player flashing while scrolling @@ -1150,8 +1174,10 @@ void nextlevel(void) { drawlevel(); // now the player gets invincibility - makeinvuln(player); - makeinvuln(player2); + if (!inintro()) { + makeinvuln(player); + makeinvuln(player2); + } // phone is cancelled on boss levels if (haspowerupany(PW_PHONE)) { @@ -1195,21 +1221,24 @@ void nextlevel(void) { stopmusic(); playmusic(bossmusic); } else { - if (curmusic != normalmusic) { - stopmusic(); - playmusic(normalmusic); + if (curlevelnum != INTRO_LEVELNUM) { + if (curmusic != normalmusic) { + stopmusic(); + playmusic(normalmusic); + } } } level->iced = ICE_NONE; level->icey = -1; - sprintf(msg, "Level %d-%d",getcurworld(), getcurlevel()); - addoutlinetext(320,240-18,TEXTSIZE_LEVEL,msg,&white,&black,LEVELDELAY, TT_NORM); + if (!inintro()) { + sprintf(msg, "Level %d-%d",getcurworld(), getcurlevel()); + addoutlinetext(320,240-18,TEXTSIZE_LEVEL,msg,&white,&black,LEVELDELAY, TT_NORM); - - sprintf(msg, "\"%s\"", curlevel->name); - addoutlinetext(320,240+18,TEXTSIZE_LEVEL2,msg,&cyan,&black,LEVELDELAY, TT_NORM); + sprintf(msg, "\"%s\"", curlevel->name); + addoutlinetext(320,240+18,TEXTSIZE_LEVEL2,msg,&cyan,&black,LEVELDELAY, TT_NORM); + } /* reset player stats */ if (player && player->lives > 0) { @@ -1600,6 +1629,8 @@ void die(sprite_t *s) { void checklevelend(void) { sprite_t *s2; int mcount; + + if (inintro()) return; if (!levelcomplete) { mcount = 0; @@ -1945,6 +1976,12 @@ void checkcollide(sprite_t *s) { s2->willbecome = P_DIAMOND; } } + } else if (inintro() && (s->id == P_RAT)) { + // collect fruits + if (isfruit(s2->id)) { + s2->dead = D_FINAL; + puffin(-1, s2->x, s2->y, "nothing", 0); + } } } } // end for each sprite @@ -2715,104 +2752,113 @@ printf("jumping: %0.2f\n",s->jumpdir); s->dir = s->owner->dir; } } else if (s->id == P_RAT) { - if (!s->falling) { - int move = B_FALSE; - int xdiff ,absxdiff; - tiletype_t *tunder; + if (inintro()) { + // move right FAST + double xpoint; + xpoint = (curlevel->powerupx * TILEW) + (TILEW/2); + if (s->x <= xpoint) { + movex(s, s->speed); + } + } else { // not in intro sequence + if (!s->falling) { + int move = B_FALSE; + int xdiff ,absxdiff; + tiletype_t *tunder; - /* distance to closest player */ - xdiff = getxdisttoplayer(s); - absxdiff = abs(xdiff); + /* distance to closest player */ + xdiff = getxdisttoplayer(s); + absxdiff = abs(xdiff); - // tile in front and below - tt = gettileat(s->x + s->dir*getspeed(s) + (s->dir * (s->img->w/2)),s->y + (TILEH/2),NULL,NULL); - // tile below - tunder = gettileat(s->x ,s->y + 1,NULL,NULL); - /* if there's a hole in front of us and below*/ - if (tt->solid == S_NOTSOLID) { - // we're on a slope - if (tunder->solid == S_SLOPE) { - move = B_TRUE; - } else { - if (s->angry || boss) { - if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) { - /* if player is below, fall off */ - if (xdiff <= (TILEW*8)) { + // tile in front and below + tt = gettileat(s->x + s->dir*getspeed(s) + (s->dir * (s->img->w/2)),s->y + (TILEH/2),NULL,NULL); + // tile below + tunder = gettileat(s->x ,s->y + 1,NULL,NULL); + /* if there's a hole in front of us and below*/ + if (tt->solid == S_NOTSOLID) { + // we're on a slope + if (tunder->solid == S_SLOPE) { + move = B_TRUE; + } else { + if (s->angry || boss) { + if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) { + /* if player is below, fall off */ + if (xdiff <= (TILEW*8)) { + move = B_TRUE; + } + } else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) { + /* if player is at same level and close, jump */ + if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) { + jump(s,D_RIGHT); + } else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) { + jump(s,D_LEFT); + } + } else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) { + // if near bottom of the screen and can fall through... move = B_TRUE; } - } else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) { - /* if player is at same level and close, jump */ - if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) { - jump(s,D_RIGHT); - } else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) { - jump(s,D_LEFT); - } - } else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) { - // if near bottom of the screen and can fall through... - move = B_TRUE; } } + } else { + move = B_TRUE; } - } else { - move = B_TRUE; - } - - /* either move or turn around */ - if (move) { - rv = movex(s, s->dir*getspeed(s)); - if (rv) { - /* if we couldn't move (hit a wall), turn */ + + /* either move or turn around */ + if (move) { + rv = movex(s, s->dir*getspeed(s)); + if (rv) { + /* if we couldn't move (hit a wall), turn */ + s->dir = -s->dir; + } + } else { s->dir = -s->dir; } - } else { - s->dir = -s->dir; - } - if ((s->angry) || (boss)) { - if ((!s->jumping) && (!s->jumptimer)) { - - /* if player is above us, jump */ - if ( (player && (!player->dead) && (player->y < s->y)) || - (player2 && (!player2->dead) && (player2->y < s->y))) { - if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) { - /* jump right */ - jump(s, 1); - } else if ((xdiff <= -(TILEW*2)) && (xdiff >= -(TILEW*3))) { - /* jump left */ - jump(s, -1); - } else if ((player && (s->y - player->y <= (TILEH*6))) || - (player2 && (s->y - player2->y <= (TILEH*6)))) { - if ((xdiff >= 0) && (xdiff < (TILEW*2))) { - /* jump up */ - jump(s, 0); - } else if ((xdiff <= 0) && (xdiff > -(TILEW*2))) { - /* jump up */ - jump(s, 0); + if ((s->angry) || (boss)) { + if ((!s->jumping) && (!s->jumptimer)) { + + /* if player is above us, jump */ + if ( (player && (!player->dead) && (player->y < s->y)) || + (player2 && (!player2->dead) && (player2->y < s->y))) { + if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) { + /* jump right */ + jump(s, 1); + } else if ((xdiff <= -(TILEW*2)) && (xdiff >= -(TILEW*3))) { + /* jump left */ + jump(s, -1); + } else if ((player && (s->y - player->y <= (TILEH*6))) || + (player2 && (s->y - player2->y <= (TILEH*6)))) { + if ((xdiff >= 0) && (xdiff < (TILEW*2))) { + /* jump up */ + jump(s, 0); + } else if ((xdiff <= 0) && (xdiff > -(TILEW*2))) { + /* jump up */ + jump(s, 0); + } + } else { + /* jump whichever way we're facing */ + /* + s->jumpdir = s->dir; + s->jumping = 1; + s->jumpspeed = 5; + */ } - } else { - /* jump whichever way we're facing */ - /* - s->jumpdir = s->dir; - s->jumping = 1; - s->jumpspeed = 5; - */ } } } - } - } else { // falling - tiletype_t *tunder, *t2under; + } else { // falling + tiletype_t *tunder, *t2under; - // tile below - tunder = gettileat(s->x ,s->y,NULL,NULL); - t2under = gettileat(s->x ,s->y+s->img->h,NULL,NULL); - if ((tunder->solid == S_SLOPE) || (t2under->solid == S_SLOPE)) { - movex(s, s->dir*getspeed(s)); - } else if (s->jumpdir) { - movex(s, s->jumpdir*getspeed(s)); + // tile below + tunder = gettileat(s->x ,s->y,NULL,NULL); + t2under = gettileat(s->x ,s->y+s->img->h,NULL,NULL); + if ((tunder->solid == S_SLOPE) || (t2under->solid == S_SLOPE)) { + movex(s, s->dir*getspeed(s)); + } else if (s->jumpdir) { + movex(s, s->jumpdir*getspeed(s)); + } } - } + } // end if inintro } else if (s->id == P_SNAIL) { if (!s->falling) { int move = B_FALSE; @@ -4504,7 +4550,7 @@ void drawlevel(void) { } // draw player - if (curlevelnum != 1) { + if (curlevelnum != INTRO_LEVELNUM) { if (player && player->lives > 0) { drawsprite(player); drawsprite(cloud); @@ -4521,7 +4567,7 @@ void drawlevel(void) { SDL_framerateDelay(&manager); // remove players - if (curlevelnum != 1) { + if (curlevelnum != INTRO_LEVELNUM) { if (player && player->lives > 0) { area.x = player->x - player->img->w/2; area.y = player->y - player->img->h; @@ -4603,7 +4649,7 @@ void drawlevel(void) { // draw player - if (curlevelnum != 1) { + if (curlevelnum != INTRO_LEVELNUM) { if (player && player->lives > 0) { drawsprite(player); drawsprite(cloud); @@ -4620,7 +4666,7 @@ void drawlevel(void) { SDL_framerateDelay(&manager); // remove players - if (curlevelnum != 1) { + if (curlevelnum != INTRO_LEVELNUM) { if (player && player->lives > 0) { area.x = player->x - player->img->w/2; area.y = player->y - player->img->h; @@ -4701,7 +4747,7 @@ void drawlevel(void) { } // draw player - if (curlevelnum != 1) { + if (curlevelnum != INTRO_LEVELNUM) { if (player && player->lives > 0) { drawsprite(player); drawsprite(cloud); @@ -4719,7 +4765,7 @@ void drawlevel(void) { // remove players - if (curlevelnum != 1) { + if (curlevelnum != INTRO_LEVELNUM) { if (player && player->lives > 0) { area.x = player->x - player->img->w/2; area.y = player->y - player->img->h; @@ -4800,7 +4846,7 @@ void drawlevel(void) { } // draw player - if (curlevelnum != 1) { + if (curlevelnum != INTRO_LEVELNUM) { if (player && player->lives > 0) { drawsprite(player); drawsprite(cloud); @@ -4817,7 +4863,7 @@ void drawlevel(void) { SDL_framerateDelay(&manager); // remove players - if (curlevelnum != 1) { + if (curlevelnum != INTRO_LEVELNUM) { if (player && player->lives > 0) { area.x = player->x - player->img->w/2; area.y = player->y - player->img->h; @@ -4974,7 +5020,7 @@ void movetext(void) { if (t->state == 0) { t->size += TEXTSPEED; if (t->size >= t->maxsize) { - if (t->type == TT_HELP) { + if (t->type == TT_HELP) { // freeze oldlevelcomplete = levelcomplete; levelcomplete = LV_HELPFREEZE; @@ -4992,6 +5038,9 @@ void movetext(void) { gameovertime = gtime; } killtext(t); + if (t->type == TT_INTROTEXT) { + introstate = IS_JUMP; + } } } else { @@ -5697,6 +5746,12 @@ int isonground(sprite_t *s) { if (s->onplatform) { return B_TRUE; } + + // antigrav? + if (s->antigrav) { + return B_TRUE; + } + /* get tile below sprite's feet */ if (isongroundpoint(s, s->x, s->y)) { return B_TRUE; @@ -7829,11 +7884,14 @@ void moveallsprites(void) { void checkcollideall(void) { sprite_t *s; + /* check collisions for player and effects */ for (s = sprite ; s ; s = s->next) { if (isplayer(s)) { - if (s->powerup != PW_GUNNER) { - checkcollide(s); + if (!inintro()) { + if (s->powerup != PW_GUNNER) { + checkcollide(s); + } } } else if (needscollisions(s->id)) { if (isplatform(s->id)) { @@ -7843,6 +7901,8 @@ void checkcollideall(void) { } } else if ((s->id == P_BLACKCLOUD) && (globpowerup == PW_WHISTLE)) { checkcollide(s); + } else if (inintro() && s->id == P_RAT) { + checkcollide(s); } } } @@ -7873,8 +7933,13 @@ void checkwrap(sprite_t *s) { if (!iseffect(s->id)) { /* if we've fallen off the bottom... */ if (s->y > (480+s->img->h)) { - // move to top - s->y = -s->img->h; + if (inintro()) { + // die + s->dead = D_FINAL; + } else { + // move to top + s->y = -s->img->h; + } } /* if we've gone off the top */ if (s->y < -s->img->h) { @@ -9026,7 +9091,9 @@ if (cheat) { /* ************************************************************ Player movement ************************************************************/ - if ((!paused) && (!levelcomplete != LV_DOPOKER) ) { + + + if ((!inintro()) && !paused && (!levelcomplete != LV_DOPOKER) ) { // is cloud touching the player? if (levelcomplete == LV_CLOUD) { sprite_t *c; @@ -9678,7 +9745,7 @@ void dotitlescreen(void) { if ((htime > 0) && (htime % TTIME == 0)) { if (titlemode == TS_INSERTCOIN) { // INSERTCOIN -> NORMAL HISCORES - gethiscores(easymode()); + if (wanthiscores) gethiscores(easymode()); titlemode = TS_HISCORES; } else if (titlemode == TS_HISCORES) { // next time, get other hiscores @@ -9770,6 +9837,9 @@ void startgame(void) { curlevelnum = i; } } + } else { + // special intro level + curlevelnum = INTRO_LEVELNUM; } // allocate player @@ -9824,14 +9894,26 @@ void startgame(void) { gtime = 0; + curlevelnum-- ; // since nextlevel() will increment it + // start intro + introstate = IS_START; firstlevel = B_TRUE; - // start the first level nextlevel(); firstlevel = B_FALSE; + flip(); + // make players face the correct way + if (player) { + player->dir = D_RIGHT; + } + if (player2) { + player2->dir = D_LEFT; + } + + // start timer timer = 0; } @@ -10970,3 +11052,170 @@ SDL_Color *getbgcolour (int id) { return &black; } + +int inintro(void) { + if (curlevelnum == INTRO_LEVELNUM) return B_TRUE; + return B_FALSE; +} + +void dointroseq(void) { + if (introstate == IS_START) { + if (gtime >= 1) { + introstate = IS_YUM; + } + } else if (introstate == IS_YUM) { + if (player) { + addoutlinetext(player->x,player->y - (player->img->h*1.5),TEXTSIZE_YUM,"Yum!",&white,&black,YUMDELAY, TT_INTROTEXT); + } + if (player2) { + addoutlinetext(player2->x,player2->y - (player2->img->h*1.5),TEXTSIZE_YUM,"Yum!",&white,&black,YUMDELAY, TT_INTROTEXT); + } + + introstate = IS_YUMWAIT; // exits when yum text is gone + } else if (introstate == IS_JUMP) { + if (player) { + if (!player->jumping && !player->falling) { + jump(player, D_RIGHT); + player->jumpspeed = 7; + } else if (player->falling) { + movex(player, getspeed(player)/2); + } + } + if (player2) { + if (!player2->jumping && !player2->falling) { + jump(player2, D_LEFT); + player2->jumpspeed = 7; + } else if (player2->falling) { + movex(player2, -getspeed(player2)/2); + } + } + if ((player && player->falling) || (player2 && player2->falling)) { + sprite_t *newsp; + double startx,starty; + // add rats + startx = TILEW; + starty = (curlevel->p1y * TILEH) + TILEH-2; + puffin(-1, startx, starty, "nothing", 0); + newsp = addsprite(P_RAT, startx, starty, "intro_rat"); + newsp->speed = INTRO_RATSPEED; + newsp->antigrav = B_TRUE; + introstate = IS_RATS; + playfx(FX_BOSSCHARGE); + } + } else if ((introstate == IS_RATS) || (introstate == IS_RATS2)) { + sprite_t *s; + double xpoint; + // keep moving until we hit the ground + if (player) { + if (player->falling) { + movex(player, getspeed(player)); + + } + if (introstate == IS_RATS2) { + // look around + if (timer % 15 == 0) { + player->dir = -player->dir; + } + } + } + if (player2) { + if (player2->falling) { + movex(player2, -getspeed(player2)); + + } + if (introstate == IS_RATS2) { + // look around + if (timer % 15 == 0) { + player2->dir = -player2->dir; + } + } + } + // add more rats + if (introstate != IS_RATS2) { + if (countmonsters(P_RAT) <= 4) { + if (timer % 5 == 0) { + sprite_t *newsp; + double startx,starty; + // add rats + startx = TILEW; + starty = (curlevel->p1y * TILEH) + TILEH-2; + puffin(-1, startx, starty, "nothing", 0); + newsp = addsprite(P_RAT, startx, starty, "intro_rat"); + newsp->speed = INTRO_RATSPEED; + newsp->antigrav = B_TRUE; + } + } + } + // if rats are past p2 start point, they fall + xpoint = (curlevel->p2x * TILEW) + (TILEW/2); + for (s = sprite ; s ; s = s->next) { + if (ismonster(s->id)) { + if (s->x >= xpoint) { + s->antigrav = B_FALSE; + s->speed = (INTRO_RATSPEED / 2); + introstate = IS_RATS2; + } + } + } + // next state + if (countmonsters(-1) <= 0) { + introstate = IS_FINISH; + if (player) { + player->timer1 = 0; + player->timer2 = 0; + } + if (player2) { + player2->timer1 = 0; + player2->timer2 = 0; + } + } + } else if (introstate == IS_FINISH) { + int finished = B_FALSE; + // players jump up and down 3 times + if (player) { + if (isonground(player)) { + if (player->timer1 < 3) { + playfx(FX_JUMP); + player->jumping = 1; + player->jumpdir = 0; + player->jumpspeed = 2; + + player->timer1++; + finished = B_FALSE; + } + } else { + if ((player->falling) && (player->timer1 >= 3)) { + finished = B_TRUE; + } + } + } + if (player2) { + if (isonground(player2)) { + if (player2->timer1 < 3) { + playfx(FX_JUMP); + player2->jumping = 1; + player2->jumpdir = 0; + player2->jumpspeed = 2; + + player2->timer1++; + finished = B_FALSE; + } + } else { + if ((player2->falling) && (player2->timer1 >= 3)) { + finished = B_TRUE; + } + } + } + + if (finished) { + if (levelcomplete == LV_INPROGRESS) { + // clouds come in + levelcomplete = LV_FINAL; + // don't delay + levelcompletetime = gtime; + gtime += 10; + } + } + } + +} diff --git a/rc.h b/rc.h index 8886f7b..89d0c05 100644 --- a/rc.h +++ b/rc.h @@ -115,8 +115,10 @@ void doplayermovement(sprite_t *pl); double getxdisttoplayer(sprite_t *s); double getydisttoplayer(sprite_t *s); int playersalive(void); +int inintro(void); sprite_t *isplayerbelow(sprite_t *s); sprite_t *isplayerabove(sprite_t *s); sprite_t *isplayerright(sprite_t *s); SDL_Color *getcolour(int id); SDL_Color *getbgcolour(int id); +void dointroseq(void); diff --git a/shared.c b/shared.c index d1e6107..a617dfb 100644 --- a/shared.c +++ b/shared.c @@ -51,7 +51,12 @@ int loadlevel(int lnum, int wantmonsters) { printf("Loading level %d-%d (seq %d) %s...",getworld(lnum), getlevel(lnum), lnum,levelentry[lnum].filename); - sprintf(filename,"%s/%s/%s",datadir,DIR_LEVELS,levelentry[lnum].filename); + if (lnum == 101) { + // special case for intro + sprintf(filename,"%s/%s/intro.dat",datadir,DIR_LEVELS); + } else { + sprintf(filename,"%s/%s/%s",datadir,DIR_LEVELS,levelentry[lnum].filename); + } //filename = levelentry[lnum].filename; f = fopen(filename,"rt"); @@ -688,6 +693,8 @@ void setdefaults(sprite_t *s) { s->onplatform = NULL; + s->antigrav = B_FALSE; + s->hasbell = B_FALSE; s->gemboost = 1; s->powerup = 0;