From a39aeb1ed27aed71e223c685968035a610f1bcbd Mon Sep 17 00:00:00 2001 From: Ben Basha Date: Sun, 19 Feb 2006 21:24:46 +0000 Subject: [PATCH] Patch #1418787 brickmania for the H1xx series by Dominik Wenger with changes by Liberman Shachar and me. +fixed bug with the glue pad. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8742 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/SOURCES | 2 +- apps/plugins/bitmaps/native/SOURCES | 18 ++ .../native/brickmania_ball.160x128x2.bmp | Bin 0 -> 138 bytes .../native/brickmania_break.160x128x2.bmp | Bin 0 -> 2614 bytes .../native/brickmania_bricks.160x128x2.bmp | Bin 0 -> 468 bytes .../native/brickmania_gameover.160x128x2.bmp | Bin 0 -> 17320 bytes .../native/brickmania_help.160x128x2.bmp | Bin 0 -> 316 bytes .../native/brickmania_menu_bg.160x128x2.bmp | Bin 0 -> 3676 bytes .../native/brickmania_no_resume.160x128x2.bmp | Bin 0 -> 720 bytes .../native/brickmania_pads.160x128x2.bmp | Bin 0 -> 316 bytes .../native/brickmania_powerups.160x128x2.bmp | Bin 0 -> 412 bytes .../native/brickmania_quit.160x128x2.bmp | Bin 0 -> 348 bytes .../native/brickmania_resume.160x128x2.bmp | Bin 0 -> 636 bytes .../native/brickmania_sel_help.160x128x2.bmp | Bin 0 -> 316 bytes .../native/brickmania_sel_quit.160x128x2.bmp | Bin 0 -> 348 bytes .../brickmania_sel_resume.160x128x2.bmp | Bin 0 -> 636 bytes .../native/brickmania_sel_start.160x128x2.bmp | Bin 0 -> 780 bytes .../native/brickmania_start.160x128x2.bmp | Bin 0 -> 780 bytes apps/plugins/brickmania.c | 258 ++++++++++++++---- docs/CREDITS | 1 + 20 files changed, 225 insertions(+), 54 deletions(-) create mode 100644 apps/plugins/bitmaps/native/brickmania_ball.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_break.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_bricks.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_gameover.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_help.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_menu_bg.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_no_resume.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_pads.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_powerups.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_quit.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_resume.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_sel_help.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_sel_quit.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_sel_resume.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_sel_start.160x128x2.bmp create mode 100644 apps/plugins/bitmaps/native/brickmania_start.160x128x2.bmp diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 3e7ca5894c..3da7ad646b 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES @@ -36,7 +36,7 @@ solitaire.c bejeweled.c bounce.c /* H300 and iPod Color/Video only */ -#if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) && (LCD_DEPTH == 16) +#if ((LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) && (LCD_DEPTH == 16)) || ((LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH==2)) brickmania.c #endif calculator.c diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES index 5e35666a32..bf725c1a3b 100644 --- a/apps/plugins/bitmaps/native/SOURCES +++ b/apps/plugins/bitmaps/native/SOURCES @@ -60,6 +60,24 @@ brickmania_sel_quit.220x176x16.bmp brickmania_sel_start.220x176x16.bmp brickmania_start.220x176x16.bmp brickmania_break.220x176x16.bmp + +#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH == 2) +brickmania_ball.160x128x2.bmp +brickmania_bricks.160x128x2.bmp +brickmania_gameover.160x128x2.bmp +brickmania_help.160x128x2.bmp +brickmania_menu_bg.160x128x2.bmp +brickmania_no_resume.160x128x2.bmp +brickmania_pads.160x128x2.bmp +brickmania_powerups.160x128x2.bmp +brickmania_quit.160x128x2.bmp +brickmania_resume.160x128x2.bmp +brickmania_sel_help.160x128x2.bmp +brickmania_sel_resume.160x128x2.bmp +brickmania_sel_quit.160x128x2.bmp +brickmania_sel_start.160x128x2.bmp +brickmania_start.160x128x2.bmp +brickmania_break.160x128x2.bmp #endif #endif /* HAVE_LCD_BITMAP */ diff --git a/apps/plugins/bitmaps/native/brickmania_ball.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_ball.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..ddd4f212ce2e2a8b34e765b8ea4ea15e626694d1 GIT binary patch literal 138 zcmZ?r?P7p{G9aY^#H>)v$iM=Y5CM`mfPx?_02X0j`19uvLv(aBgQ}`3!=y=*82O4-&_QnUok9l#~?U7{mtvlx{7n literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_break.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_break.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..aabc5ba9a5a922315af22f7828b6353b30edb35a GIT binary patch literal 2614 zcmeHE%WcCj6mzfXtw4Z`&X|<_w}^(>x$MXnc@jNCBFu(RAE%FFtzE$o^eRRx< znQu8uIv!S2bN}jwBgl0GGxyKRij*3?yS(ZIJVqSSF3;|8U@SI++G6PaoD?ZCPTgmnQ5d>~N z&(6KGI0ajuz{~gF-AoruthJ(l_UIlRhW9YVaGIgH4Xi5jQT8Fnz^XFOev=GnMH?#+ zE2^zPlKnjQ%(I{7f6`*jv)@QS^$^e{&paPUIe^V2fF;j7`x%z}sD?mwaxneBXC4>< Dh!8DM literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_gameover.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_gameover.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..73afc2bfbb92b4967f69795f5eaed98270ef667c GIT binary patch literal 17320 zcmeI2!HpYN5Jc&Nb8rX_!0<&n*=NTfMc{)|5THZ^2}(l&=pda8C>Zr@Okk<}Zg!>bF1M|9;xmuN;5o=TClq;pd0bPaIFDzqtPQkNVjH9RB$p z>*L3dFJ8R(^y$<0X#TBwekU*AzJ2@U%NLISCp$MU*(Gn@ykRnqUYvRnG_K%gCm=lk zUYu?qp~RAAf|cN-(kNtU1YP2EWuKB}D$31PYd0^s;>oT87PY8Iok@-^Rnb27Ou?{t z$_vZOmoIBFBkXtNs`gr~62`Y$yLky;PrNDu>!O`9Bgl``2G#y)_cHvb-Uwr4_lGK0 z$Ue3&tMJahAR!pKdMydV+N$9qzSc{cGFQ;f)IOb;G^B0!phkB5Kw!=6xX%W~^|Ni~w&!6ADduIS9!fAkzKf7V-jD#IOxHQv9IhP=hc9LX~ z0vrX98fq1%s`AY4|4{AzfTPz-dJcV$phl^>z&p2j$4HUv)OI7;VF(CGE2m6XH4mE( zUn8GAd$x18X+7DOE27AWdyK}N+gv9QMqLdu)=X^N2cE@v$+p9oZTmd{FUN`KYIU7R zZwfyP0W9H~BTUnoJlS<%Uy1;|wJloueHi|}^p`GpC?D!&zS`wljDJ=Yg1MjZE@_8c zP7f8rKiZeIvn9+xNE>?DogjiDRu{g=&b{KE%NzEk z8ZlQ)I`Oi;SVu*i#%&HSv8vk;D#+|4QB@Tp&zG(R;U%qC7!Y&uUB~7n zWFZ#en50E>07rpy`0?L5WtG+)LJ_NLAAWdHsY0HWtbj+M=j~es!>mO+uXF725~x3- z2-aEVUe<=|*z|bTs}Nh8SKRYSw(-z*wi_ZmW}ZKPena7~B*r;=iRvfOD|*-f(Z70A zT@)S)KoVP)geTF4p6#K1^;0_r@hPh6AZIU$4GnPJB7lDA3gvMZs|sNXdl%h-erI~- zO62CJ_K-X#DqeaZ{9p~MF9v6SM&J{x`xlX+XKbeaT6Iy$Fae$$-c1gv2;x%J-@LS= zjJ|pLb)SKWFe|G9;*Kasg#>lVQJ}V+Vbz+!r~IaaJ15NQzBT!(Q0*M4IgqfFU^W9~ z>g`A5R1#g%u?{lvvZmbeq62p?7mZp-yL-7{(qhWp%SEFW((Ya^n6#L3_j1vwg|xeu z3nne5+`U{hY9a0J<$_6zDR(ayjao=MJ^VK_{v6WMUsD_f2zKC13Wp7XaF*6^xXTZ!@M|+aqU@HReOoy zVghM9IdQ4pw{^VP82i#M8*~r`FjnAbq6AGAmQWs^%}!^9F>5EB71l;G66T6>kH$B_ z`fe@&!TJ@lzMCWRb#uD@@;3>N?pFN8yanag&4@-E1<0+&K})2)-J? z7?ZDq=B1m=ICLXpHzUD?p^ia`cyU@6ah(c0-qZ5^5SMD4)6jM?fqc3QNurh_BxqIFo0s$qrE%JuOQS~&)pdfaunD7MR~QK{tja@`Ng{rgLXvURU7D9eAx;O( zn!9k8aIMT4q2pE+9eV(~Zsi;gaIg49-i=fGCuJWKpg(KCh!fYkw+yU!ko>9cRAH4Z_j!?R(UgEE`6 zIuqEQ1)<|+Ky9rJ@!d$0XI|o&X|DyR(}xcqUcY`_wP+5yc_H6efJg*A0ST2&Tacp` zo@t!})BlrULK;;<__yW{lB}U7IOv3WRoLXAR-01CZ8tt190Vw8z$qJa`}`6+d$(&N zh|-M=b=UGJ-)wM(m$wntDhR#jol&*uU@^X-EP31{7A2mkb)4M#7Ho zOEC}0zm1o6w7!ec6GCrZ*v7+4%JF6b_|Y7IOjGgyb1OO64Bj*XozOf2!Q-ZCf$SMG W{9JN5z%v@C1*ZbT93?+&w|@b9#b2fX literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_help.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_help.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..5295dfc10754783068a0dffc90811583c560f772 GIT binary patch literal 316 zcmb7;I}XAy5JV>u)ZBoYeqB-#SCKe~Z{q{`Ae@87rI}f9aFi-5&3NB_Y(Jj&2_6gm zMqQ~3HQ_`D-qh>-6%RhdGsmbvBl>Aw=#_%7n?HKp~2vkT! literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4526af9025391b915081c238679155a44ff6f0cf GIT binary patch literal 3676 zcmeH}QBK1!42J)@@QT*>0*U*=3sTeU1Uw>f15SWA6c31ta3iz>@H=edX;L17G{K@d zv77pv?WAq)AD?be+XMSs$}8oLGT@3m5IFy_muuQC+jWb#_cy#ezhL*d^V?7^?VKy1 zeS^!TGq5x6+~e!J8oxuc)Rns;c3tEJGV}~^0mh!Z73i98*>p{}XQ~(0pR9n^x2Tp} z%EYbg%6_2fx=U4?(qE#9&6cvvL6B_DW~Q_`c$>4B1=pHzg%23$L7s_FO&KB@EhEMd zBPVE!gxJVikfw-8H^h0v6HtJOiqMv_;WeM2+RhtGB&PZo_K+15_!9_0K0)9Rr7hnD z1HCKHPg|}o2+o_029on!ZRRojOcc~YuvxI)M1 z=iVHY9vOT+JIm!j$gM1Qpd-^O+}Hjc%HH#mautregCg7e3|g*T8&DU?#87$fDJsn)taZk571`xnP79}6wb<-i@M5}1{P zvakvWAZned45p_764@Yk^nkvXFK)bTT+@?5&&$RQDx*LXn literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_pads.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_pads.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..820fffc5f1856f301e6cf470d6fb30071e118e30 GIT binary patch literal 316 zcmY+8F%H5o3`Kt_%*aGp5p@?v60b~*kvK|k)kAR(PQXvoq~%LLw&VE4ulKXVqQvt~ zU+FX5;m8yC(w|c?1G2sMn5GHyJR_w%3Fv5>q5{2adhkInS|v*zTHmq0{mmbsD=iK= yQCKihXF=5kULnMRxJ$8funNy{H0(>}jaRVbS^Hij^N6n!BhPmGv0wM8^S}>RRVQZv literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_powerups.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_powerups.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c52d5348c8cd2e2b1cc08a3fa75351b3e027bf75 GIT binary patch literal 412 zcmY+8F%H5o3`M^YEKIS~sT1;q7?TSW#Dv7c4SFxsb8(qUeA@v*tM9KD|2V$fpMv;q ztVe23ohZSU6?m}!+NEf4jpK-ASuoEt)^+t5WVmX|FHJq%vsBO8`Gk~`5aP&bBh+~uHk(?oBobhDx3wxVE5#n_tTzd$n!a$ o?oqFP&etNR`rV(an(uG1|Bw5*S?0|09`}!Tov6Qkk~7B^-sg%UkN^Mx literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_quit.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_quit.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..b52635df29993b0c277af056704b22978415af04 GIT binary patch literal 348 zcmZ?rjbUT}11}({0mO1ZEC|Gm3@kvBfk6l;e}ff*ffNG>fBW{0p}oDGAw4~vVf*&& z4FCWCXK+CUWbus=W`Omh@r{jLjE$X5TtLD=d1n(K2Z(?oMDbmWogrGF`eByA^h5Xv O^I-B|nq>blFaQAGT~D9@ literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_resume.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_resume.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..fed63c07a986be65cf7fab79568fd743f859a600 GIT binary patch literal 636 zcmb`D!41MN3`GrsD??a5aApK6CnQ)SORzyk$|6jXYxs6T3#65hz_K0Lef@T#m)n-y z&d5i^6>&gpXopO6!uR{W1rD+(rBF(Va?TWEq*^P5@9bBOS>6V%>2ctJQwhwQb#O4Xm_qkXJEBa8oC){>)@1=9V T7i_%m0yMPN-tQCqJ4f^YU>1?p literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_sel_help.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_sel_help.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..0e898068444c75f08c20ee5cf74cbe0fee0d3e31 GIT binary patch literal 316 zcmb7;F%E?w5JZPWYj0q&q3{B9R)p#&UW9vbC(mI)i?b;I^JC>EGw^n234U7*YJKPn zHB%F1FwlX6+Q&;gpvpNT#t7#eQc5VLApF-07TxUfjlGp1Le~c8ym@fBEu-Au}_R!OYBzVabvu z4FCWCXK+CUWbu^{W`Omh@s*TZl$4xQTtLD=c_$Sh2Z(?oMDbmeoFH1D`eByA^h5Xv O^I-B|nq>blFaQ8iK1?70 literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_sel_resume.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_sel_resume.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6a2a89d71b3351f69a7be47f0a5a8c94927e371b GIT binary patch literal 636 zcmc(aK?=e!6hy}mx1J#kS-2LuFX68QJxdSZg?b|o(tVwus8qDjouB+PGkKZv%jFhO z>#Y5#zN!!E9in#Nr2G56wLb8krU}C^pzAt};&ZR+tzPjWi47Qa-toon~7hTU1_TN$ylxxsdfbP*%HWdD-)vbJ;k5 s8Bz^!RKM;;K)0|qJ zTJFhuRimA9W7?L=$!u;;0fE(2&khUSR5;bAl;3kLvkAriWu8tgL+;7HVGM85vvnt& S@XfgY)o$dEwX6ESFu*7EfUNWY literal 0 HcmV?d00001 diff --git a/apps/plugins/bitmaps/native/brickmania_start.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_start.160x128x2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..dcfc70a95044c40f8863bcf7f8677be35c09aacb GIT binary patch literal 780 zcmdT;xedcG47_|@ip)T$$Q*>L0O`GfmhnU`GestGtK3nF3>XNIG9h$2iaeg^_wxY} zH{MrbBre1bN8Z3=4?Is5BnZp0V45b(^NgG`N+}qAJKXH+1wDD%ik;);mPCV-=x34{ zYfO09ZBsH(jY4Td7HNG&>n$~E!?$TyUs_iiYrfrrBi$*vQY{x>vQxvjmb^%VHq$@S Zl69imq@*_1r(0+Hj`9cXYW9~I@B;FNx`qG% literal 0 HcmV?d00001 diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index 937c4e473c..ac6204ca8c 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c @@ -18,15 +18,11 @@ ****************************************************************************/ #include "plugin.h" +#include "gray.h" #include "configfile.h" /* Part of libplugin */ PLUGIN_HEADER -/* The time (in ms) for one iteration through the game loop - decrease this - to speed up the game - note that current_tick is (currently) only accurate - to 10ms. -*/ -#define CYCLETIME 30 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) @@ -83,9 +79,17 @@ extern const fb_data brickmania_powerups[]; /* purple, red, blue, pink, green, yellow orange */ extern const fb_data brickmania_bricks[]; + + /* TO DO: This needs adjusting correctly for larger than 220x176 LCDS */ #if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) +/* The time (in ms) for one iteration through the game loop - decrease this + to speed up the game - note that current_tick is (currently) only accurate + to 10ms. +*/ +#define CYCLETIME 30 + /* Offsets for LCDS > 220x176 */ #define XOFS ((LCD_WIDTH-220)/2) #define YOFS ((LCD_HEIGHT-176)/2) @@ -97,6 +101,7 @@ extern const fb_data brickmania_bricks[]; #define BRICK_WIDTH 21 #define BALL 5 #define LEFTMARGIN 5 +#define TOPMARGIN 30 #define BMPHEIGHT_help 19 #define BMPWIDTH_help 37 @@ -128,17 +133,89 @@ extern const fb_data brickmania_bricks[]; #define BMPHEIGHT_powerup 6 #define BMPWIDTH_powerup 10 -#define BMPXOFS_resume (62+XOFS) -#define BMPYOFS_resume (100+YOFS) -#define BMPXOFS_quit (93+XOFS) -#define BMPYOFS_quit (138+YOFS) +#define BMPHEIGHT_menu LCD_HEIGHT +#define BMPWIDTH_menu LCD_WIDTH + #define BMPXOFS_start (55+XOFS) #define BMPYOFS_start (78+YOFS) +#define BMPXOFS_resume (62+XOFS) +#define BMPYOFS_resume (100+YOFS) #define BMPXOFS_help (92+XOFS) #define BMPYOFS_help (118+YOFS) +#define BMPXOFS_quit (93+XOFS) +#define BMPYOFS_quit (138+YOFS) #define HIGHSCORE_XPOS (7+XOFS) #define HIGHSCORE_YPOS (56+YOFS) +#define STRINGPOS_finsh 140 +#define STRINGPOS_congrats 157 +#define STRINGPOS_navi 150 +#define STRINGPOS_flipsides 150 + +#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH==2) +/* The time (in ms) for one iteration through the game loop - decrease this + to speed up the game - note that current_tick is (currently) only accurate + to 10ms. +*/ +#define CYCLETIME 50 + +#define PAD_WIDTH 30 +#define PAD_HEIGHT 5 +#define PAD_POS_Y LCD_HEIGHT - 7 +#define BRICK_HEIGHT 7 +#define BRICK_WIDTH 15 +#define BALL 5 +#define LEFTMARGIN 5 +#define TOPMARGIN 21 + +#define BMPHEIGHT_help 15 +#define BMPWIDTH_help 30 + +#define BMPHEIGHT_sel_help 15 +#define BMPWIDTH_sel_help 30 + +#define BMPHEIGHT_resume 14 +#define BMPWIDTH_resume 78 + +#define BMPHEIGHT_no_resume 14 +#define BMPWIDTH_no_resume 78 + +#define BMPHEIGHT_quit 17 +#define BMPWIDTH_quit 30 + +#define BMPHEIGHT_sel_quit 17 +#define BMPWIDTH_sel_quit 30 + +#define BMPHEIGHT_sel_resume 14 +#define BMPWIDTH_sel_resume 78 + +#define BMPHEIGHT_sel_start 16 +#define BMPWIDTH_sel_start 88 + +#define BMPHEIGHT_start 16 +#define BMPWIDTH_start 88 + +#define BMPHEIGHT_powerup 6 +#define BMPWIDTH_powerup 10 + +#define BMPHEIGHT_menu 45 +#define BMPWIDTH_menu 160 + +#define BMPXOFS_start 34 +#define BMPYOFS_start 64 +#define BMPXOFS_resume 38 +#define BMPYOFS_resume 77 +#define BMPXOFS_help 64 +#define BMPYOFS_help 90 +#define BMPXOFS_quit 64 +#define BMPYOFS_quit 103 +#define HIGHSCORE_XPOS 7 +#define HIGHSCORE_YPOS 36 + +#define STRINGPOS_finsh 100 +#define STRINGPOS_congrats 110 +#define STRINGPOS_navi 100 +#define STRINGPOS_flipsides 100 #else #error Unsupported LCD Size @@ -524,7 +601,7 @@ void int_game(int new_game) brick[i*10+j].hits=levels[cur_level][i][j]>=10? levels[cur_level][i][j]/16-1:0; brick[i*10+j].hiteffect=0; - brick[i*10+j].powertop=30+i*10+BRICK_HEIGHT; + brick[i*10+j].powertop=TOPMARGIN+i*BRICK_HEIGHT+BRICK_HEIGHT; brick[i*10+j].used=(levels[cur_level][i][j]==0?0:1); brick[i*10+j].color=(levels[cur_level][i][j]>=10? levels[cur_level][i][j]%16:levels[cur_level][i][j])-1; @@ -569,8 +646,8 @@ int game_menu(int when) { int button,cur=0; char str[10]; - - rb->lcd_bitmap(brickmania_menu_bg,0,0,LCD_WIDTH,LCD_HEIGHT); + rb->lcd_clear_display(); + rb->lcd_bitmap(brickmania_menu_bg,0,0,BMPWIDTH_menu,BMPHEIGHT_menu); while (true) { for(i=0;ilcd_setfont(FONT_SYSFIXED); +#ifdef HAVE_LCD_COLOR rb->lcd_set_background(LCD_RGBPACK(0,0,140)); rb->lcd_set_foreground(LCD_WHITE); +#endif rb->lcd_putsxy(HIGHSCORE_XPOS, HIGHSCORE_YPOS, "High Score"); rb->snprintf(str, sizeof(str), "%d", highscore); rb->lcd_getstringsize("High Score", &sw, NULL); @@ -664,6 +743,11 @@ int game_menu(int when) case QUIT: return 3; break; + + default: + if(rb->default_event_handler(button) == SYS_USB_CONNECTED) + return 3; + break; } } } @@ -672,38 +756,59 @@ int help(int when) { int w,h; int button; + int xoffset=0; + int yoffset=0; + /* set the maximum x and y in the helpscreen + dont forget to update, if you change text */ + int maxY=160; + int maxX=210; while(true){ rb->lcd_setfont(FONT_SYSFIXED); +#ifdef HAVE_LCD_COLOR rb->lcd_set_background(LCD_BLACK); rb->lcd_clear_display(); rb->lcd_set_background(LCD_BLACK); rb->lcd_set_foreground(LCD_WHITE); +#else + rb->lcd_clear_display(); +#endif rb->lcd_getstringsize("BrickMania", &w, &h); - rb->lcd_putsxy(LCD_WIDTH/2-w/2, 1, "BrickMania"); + rb->lcd_putsxy(LCD_WIDTH/2-w/2+xoffset, 1+yoffset, "BrickMania"); +#ifdef HAVE_LCD_COLOR rb->lcd_set_foreground(LCD_RGBPACK(245,0,0)); - rb->lcd_putsxy(1, 1*(h+2),"Aim"); + rb->lcd_putsxy(1+xoffset, 1*(h+2)+yoffset,"Aim"); rb->lcd_set_foreground(LCD_WHITE); - rb->lcd_putsxy(1, 2*(h+2),"destroy all the bricks by bouncing"); - rb->lcd_putsxy(1, 3*(h+2),"the ball of them using the paddle."); - +#else + rb->lcd_putsxy(1+xoffset, 1*(h+2)+yoffset,"Aim"); +#endif + rb->lcd_putsxy(1+xoffset, 2*(h+2)+yoffset,"destroy all the bricks by bouncing"); + rb->lcd_putsxy(1+xoffset, 3*(h+2)+yoffset,"the ball of them using the paddle."); +#ifdef HAVE_LCD_COLOR rb->lcd_set_foreground(LCD_RGBPACK(245,0,0)); - rb->lcd_putsxy(1, 5*(h+2),"Controls"); + rb->lcd_putsxy(1+xoffset, 5*(h+2)+yoffset,"Controls"); rb->lcd_set_foreground(LCD_WHITE); - rb->lcd_putsxy(1, 6*(h+2),"< & > Move the paddle"); - rb->lcd_putsxy(1, 7*(h+2),"NAVI Releases the ball/Fire!"); - rb->lcd_putsxy(1, 8*(h+2),"STOP Opens menu/Quit"); - +#else + rb->lcd_putsxy(1+xoffset, 5*(h+2)+yoffset,"Controls"); + #endif + rb->lcd_putsxy(1+xoffset, 6*(h+2)+yoffset,"< & > Move the paddle"); + rb->lcd_putsxy(1+xoffset, 7*(h+2)+yoffset,"NAVI Releases the ball/Fire!"); + rb->lcd_putsxy(1+xoffset, 8*(h+2)+yoffset,"STOP Opens menu/Quit"); +#ifdef HAVE_LCD_COLOR rb->lcd_set_foreground(LCD_RGBPACK(245,0,0)); - rb->lcd_putsxy(1, 10*(h+2),"Specials"); + rb->lcd_putsxy(1+xoffset, 10*(h+2)+yoffset,"Specials"); rb->lcd_set_foreground(LCD_WHITE); - rb->lcd_putsxy(1, 11*(h+2),"N Normal:returns paddle to normal"); - rb->lcd_putsxy(1, 12*(h+2),"D DIE!:loses a life"); - rb->lcd_putsxy(1, 13*(h+2),"L Life:gains a life/power up"); - rb->lcd_putsxy(1, 14*(h+2),"F Fire:allows you to shoot bricks"); - rb->lcd_putsxy(1, 15*(h+2),"G Glue:ball sticks to paddle"); +#else + rb->lcd_putsxy(1+xoffset, 10*(h+2)+yoffset,"Specials"); +#endif + rb->lcd_putsxy(1+xoffset, 11*(h+2)+yoffset,"N Normal:returns paddle to normal"); + rb->lcd_putsxy(1+xoffset, 12*(h+2)+yoffset,"D DIE!:loses a life"); + rb->lcd_putsxy(1+xoffset, 13*(h+2)+yoffset,"L Life:gains a life/power up"); + rb->lcd_putsxy(1+xoffset, 14*(h+2)+yoffset,"F Fire:allows you to shoot bricks"); + rb->lcd_putsxy(1+xoffset, 15*(h+2)+yoffset,"G Glue:ball sticks to paddle"); + rb->lcd_putsxy(1+xoffset, 16*(h+2)+yoffset,"B Ball:Generates Another Ball"); rb->lcd_update(); button=rb->button_get(true); @@ -728,6 +833,31 @@ int help(int when) } return NULL; break; + case LEFT: + case LEFT | BUTTON_REPEAT: + if( xoffset<0) + xoffset+=2; + break; + case RIGHT: + case RIGHT | BUTTON_REPEAT: + if(xoffset+maxX > LCD_WIDTH) + xoffset-=2; + break; + case UP: + case UP | BUTTON_REPEAT: + if(yoffset <0) + yoffset+=2; + break; + case DOWN: + case DOWN | BUTTON_REPEAT: + if(yoffset+maxY > LCD_HEIGHT) + yoffset-=2; + break; + + default: + if(rb->default_event_handler(button) == SYS_USB_CONNECTED) + return 1; + break; } } return NULL; @@ -793,11 +923,15 @@ int game_loop(void){ end = *rb->current_tick + (CYCLETIME * HZ) / 1000; if (life >= 0) { +#ifdef HAVE_LCD_COLOR rb->lcd_set_background(LCD_BLACK); rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_clear_display(); rb->lcd_set_background(LCD_BLACK); rb->lcd_set_foreground(LCD_WHITE); +#else + rb->lcd_clear_display(); +#endif if (flip_sides) { if (*rb->current_tick>=sec_count){ @@ -809,7 +943,7 @@ int game_loop(void){ } rb->snprintf(s, sizeof(s), "%d", num_count); rb->lcd_getstringsize(s, &sw, NULL); - rb->lcd_putsxy(LCD_WIDTH/2-2, 150, s); + rb->lcd_putsxy(LCD_WIDTH/2-2, STRINGPOS_flipsides, s); } /* write life num */ @@ -828,7 +962,7 @@ int game_loop(void){ /* continue game */ if (con_game== 1 && start_game!=1) { rb->lcd_getstringsize("Press NAVI To Continue", &sw, NULL); - rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 150, "Press NAVI to continue"); + rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_navi, "Press NAVI to continue"); sec_count=*rb->current_tick+HZ; } @@ -911,7 +1045,7 @@ int game_loop(void){ brick[i*10+j].poweruse=1; brickx=LEFTMARGIN+j*BRICK_WIDTH; - bricky=30+i*8; + bricky=TOPMARGIN+i*BRICK_HEIGHT; if (pad_type==2) { for (k=0;k<=30;k++) { if (fire[k].top+7>0) { @@ -934,9 +1068,11 @@ int game_loop(void){ } if (brick[i*10+j].used==1){ - rb->lcd_bitmap_part(brickmania_bricks,0,BRICK_HEIGHT*brick[i*10+j].color,BRICK_WIDTH,LEFTMARGIN+j*BRICK_WIDTH, 30+i*8, BRICK_WIDTH, BRICK_HEIGHT); + rb->lcd_bitmap_part(brickmania_bricks,0,BRICK_HEIGHT*brick[i*10+j].color,BRICK_WIDTH,LEFTMARGIN+j*BRICK_WIDTH, TOPMARGIN+i*BRICK_HEIGHT, BRICK_WIDTH, BRICK_HEIGHT); +#ifdef HAVE_LCD_COLOR /* No transparent effect for greyscale lcds for now */ if (brick[i*10+j].hiteffect>0) - rb->lcd_bitmap_transparent_part(brickmania_break,0,BRICK_HEIGHT*brick[i*10+j].hiteffect,BRICK_WIDTH,LEFTMARGIN+j*BRICK_WIDTH, 30+i*8, BRICK_WIDTH, BRICK_HEIGHT); + rb->lcd_bitmap_transparent_part(brickmania_break,0,BRICK_HEIGHT*brick[i*10+j].hiteffect,BRICK_WIDTH,LEFTMARGIN+j*BRICK_WIDTH, TOPMARGIN+i*BRICK_HEIGHT, BRICK_WIDTH, BRICK_HEIGHT); +#endif } for(k=0;k= PAD_POS_Y && (ball[k].pos_x >= pad_pos_x && ball[k].pos_x <= pad_pos_x+PAD_WIDTH)) && + if ((ball[k].pos_y+BALL >= PAD_POS_Y && (ball[k].pos_x >= pad_pos_x && ball[k].pos_x <= pad_pos_x+PAD_WIDTH)) && start_game != 1 && !ball[k].glue) { - if ((ball[k].pos_x+3 >= pad_pos_x && ball[k].pos_x+3 <= pad_pos_x+5) || (ball[k].pos_x +2>= pad_pos_x+35 && ball[k].pos_x+2 <= pad_pos_x+40)) { - ball[k].y = 2*-1; - if (ball[k].pos_x != 0 && ball[k].pos_x+BALL!=LCD_WIDTH) - ball[k].x = pad_check(6,0,ball[k].pos_x+2<=pad_pos_x+(PAD_WIDTH/2)?0:1,k); - } else if ((ball[k].pos_x+3 >= pad_pos_x+5 && ball[k].pos_x+3 <= pad_pos_x+10) || (ball[k].pos_x+2 >= pad_pos_x+30 && ball[k].pos_x+2 <= pad_pos_x+35)) { - ball[k].y = 3*-1; - + + if ((ball[k].pos_x+3 >= pad_pos_x && ball[k].pos_x+3 <= pad_pos_x+(PAD_WIDTH/2/4)) || + (ball[k].pos_x +3>= pad_pos_x+(PAD_WIDTH-(PAD_WIDTH/2/4)) && ball[k].pos_x+3 <= pad_pos_x+PAD_WIDTH)) { + + ball[k].y = -2; + if (ball[k].pos_x != 0 && ball[k].pos_x+BALL!=LCD_WIDTH) + ball[k].x = pad_check(6,0,ball[k].pos_x+2<=pad_pos_x+(PAD_WIDTH/2)?0:1,k); + + } else if ((ball[k].pos_x+3 >= pad_pos_x+(PAD_WIDTH/2/4) && ball[k].pos_x+3 <= pad_pos_x+2*(PAD_WIDTH/2/4)) || + (ball[k].pos_x+3 >= pad_pos_x+(PAD_WIDTH-2*(PAD_WIDTH/2/4)) && ball[k].pos_x+3 <= pad_pos_x+(PAD_WIDTH-(PAD_WIDTH/2/4)) )) { + + ball[k].y = -3; if (ball[k].pos_x != 0 && ball[k].pos_x+BALL!=LCD_WIDTH) ball[k].x = pad_check(4,0,ball[k].pos_x+2<=pad_pos_x+(PAD_WIDTH/2)?0:1,k); - } else if ((ball[k].pos_x+3 >= pad_pos_x+10 && ball[k].pos_x+3 <= pad_pos_x+15) || (ball[k].pos_x+2 >= pad_pos_x+25 && ball[k].pos_x+2 <= pad_pos_x+30)) { - ball[k].y = 4*-1; - + + } else if ((ball[k].pos_x+3 >= pad_pos_x+2*(PAD_WIDTH/2/4) && ball[k].pos_x+3 <= pad_pos_x+3*(PAD_WIDTH/2/4)) || + (ball[k].pos_x+2 >= pad_pos_x+(PAD_WIDTH-3*(PAD_WIDTH/2/4)) && ball[k].pos_x+2 <= pad_pos_x+ ((PAD_WIDTH/2)-2*(PAD_WIDTH/2/4)) )) { + + ball[k].y = -4; if (ball[k].pos_x != 0 && ball[k].pos_x+BALL!=LCD_WIDTH) ball[k].x = pad_check(3,0,ball[k].pos_x+2<=pad_pos_x+(PAD_WIDTH/2)?0:1,k); - } else if ((ball[k].pos_x+3 >= pad_pos_x+13 && ball[k].pos_x+3 <= pad_pos_x+18) || (ball[k].pos_x+2 >= pad_pos_x+22 && ball[k].pos_x+2 <= pad_pos_x+25)) { - ball[k].y = 4*-1; + + } else if ((ball[k].pos_x+3 >= pad_pos_x+3*(PAD_WIDTH/2/4) && ball[k].pos_x+3 <= pad_pos_x+4*(PAD_WIDTH/2/4)-2) || + (ball[k].pos_x+2 >= pad_pos_x+(PAD_WIDTH/2+2) && ball[k].pos_x+2 <= pad_pos_x+(PAD_WIDTH-3*(PAD_WIDTH/2/4)) )) { + + ball[k].y = -4; if (ball[k].pos_x != 0 && ball[k].pos_x+BALL!=LCD_WIDTH) ball[k].x = pad_check(2,1,NULL,k); - } else { - ball[k].y = 4*-1; - } + + } else { + ball[k].y = -4; } + } if (!ball[k].glue) { ball[k].pos_x+=ball[k].tempx!=0?ball[k].tempx:ball[k].x; @@ -1112,7 +1259,7 @@ int game_loop(void){ ball[k].pos_y=PAD_POS_Y-BALL; ball[k].glue=true; } - } /* for k */ + } /* for k */ rb->lcd_update(); @@ -1124,9 +1271,9 @@ int game_loop(void){ sleep(2); } else { rb->lcd_getstringsize("Congratulations!", &sw, NULL); - rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 140, "Congratulations!"); + rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_congrats, "Congratulations!"); rb->lcd_getstringsize("You have finished the game!", &sw, NULL); - rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 157, "You have finished the game!"); + rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_finsh, "You have finished the game!"); vscore=score; rb->lcd_update(); if (score>highscore) { @@ -1203,7 +1350,7 @@ int game_loop(void){ for(k=0;kdefault_event_handler(button) == SYS_USB_CONNECTED) + return 1; + break; } } else { rb->lcd_bitmap(brickmania_gameover,LCD_WIDTH/2-55,LCD_HEIGHT-87,110,52); diff --git a/docs/CREDITS b/docs/CREDITS index 6b107cf16f..be32d52277 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -168,3 +168,4 @@ Seven Le Mesle Craig Bachelor Nikolaj Christensen Mikael Magnusson +Dominik Wenger