1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * robotfindskitten: A Zen simulation
12 * Copyright (C) 1997,2000 Leonard Richardson
13 * leonardr@segfault.org
14 * http://www.crummy.com/devel/
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or EXISTANCE OF KITTEN. See the GNU General
24 * Public License for more details.
26 * http://www.gnu.org/copyleft/gpl.html
28 * Ported to Rockbox 2007 by Jonas Häggqvist
32 #include "lib/pluginlib_actions.h"
34 /* This macros must always be included. Should be placed at the top by
35 convention, although the actual position doesn't matter */
38 /*Be sure to change MESSAGES when you change the array, or bad things
41 /*Also, take note that robotfindskitten.c and configure.in
42 currently have the version number hardcoded into them, and they
43 should reflect MESSAGES. */
45 /* Watch out for fenceposts.*/
46 #define MESSAGES (sizeof messages / sizeof (char*))
48 static char* messages
[] =
50 "\"I pity the fool who mistakes me for kitten!\", sez Mr. T.",
51 "That's just an old tin can.",
52 "It's an altar to the horse god.",
53 "A box of dancing mechanical pencils. They dance! They sing!",
54 "It's an old Duke Ellington record.",
55 "A box of fumigation pellets.",
56 "A digital clock. It's stuck at 2:17 PM.",
57 "That's just a charred human corpse.",
58 "I don't know what that is, but it's not kitten.",
59 "An empty shopping bag. Paper or plastic?",
60 "Could it be... a big ugly bowling trophy?",
61 "A coat hanger hovers in thin air. Odd.",
62 "Not kitten, just a packet of Kool-Aid(tm).",
63 "A freshly-baked pumpkin pie.",
64 "A lone, forgotten comma, sits here, sobbing.",
65 "ONE HUNDRED THOUSAND CARPET FIBERS!!!!!",
66 "It's Richard Nixon's nose!",
67 "It's Lucy Ricardo. \"Aaaah, Ricky!\", she says.",
68 "You stumble upon Bill Gates' stand-up act.",
69 "Just an autographed copy of the Kama Sutra.",
70 "It's the Will Rogers Highway. Who was Will Rogers, anyway?",
71 "It's another robot, more advanced in design than you but strangely immobile.",
72 "Leonard Richardson is here, asking people to lick him.",
73 "It's a stupid mask, fashioned after a beagle.",
74 "Your State Farm Insurance(tm) representative!",
75 "It's the local draft board.",
76 "Seven 1/4\" screws and a piece of plastic.",
78 "One of those stupid \"Homes of the Stars\" maps.",
79 "A signpost saying \"TO KITTEN\". It points in no particular direction.",
80 "A hammock stretched between a tree and a volleyball pole.",
81 "A Texas Instruments of Destruction calculator.",
82 "It's a dark, amphorous blob of matter.",
84 "It's a mighty zombie talking about some love and prosperity.",
85 "\"Dear robot, you may have already won our 10 MILLION DOLLAR prize...\"",
86 "It's just an object.",
87 "A mere collection of pixels.",
88 "A badly dented high-hat cymbal lies on its side here.",
89 "A marijuana brownie.",
91 "Daily hunger conditioner from Australasia",
93 "Why are you touching this when you should be finding kitten?",
94 "A glorious fan of peacock feathers.",
95 "It's some compromising photos of Babar the Elephant.",
96 "A copy of the Weekly World News. Watch out for the chambered nautilus!",
97 "It's the proverbial wet blanket.",
98 "A \"Get Out of Jail Free\" card.",
99 "An incredibly expensive \"Mad About You\" collector plate.",
100 "Paul Moyer's necktie.",
101 "A haircut and a real job. Now you know where to get one!",
102 "An automated robot-hater. It frowns disapprovingly at you.",
103 "An automated robot-liker. It smiles at you.",
104 "It's a black hole. Don't fall in!",
105 "Just a big brick wall.",
106 "You found kitten! No, just kidding.",
107 "Heart of Darkness brand pistachio nuts.",
108 "A smoking branding iron shaped like a 24-pin connector.",
109 "It's a Java applet.",
110 "An abandoned used-car lot.",
111 "A shameless plug for Crummy: http://www.crummy.com/",
112 "A shameless plug for the UCLA Linux Users Group: http://linux.ucla.edu/",
113 "A can of Spam Lite.",
114 "This is another fine mess you've gotten us into, Stanley.",
115 "It's scenery for \"Waiting for Godot\".",
116 "This grain elevator towers high above you.",
118 "It's the constellation Pisces.",
119 "It's a fly on the wall. Hi, fly!",
120 "This kind of looks like kitten, but it's not.",
121 "It's a banana! Oh, joy!",
122 "A helicopter has crashed here.",
123 "Carlos Tarango stands here, doing his best impression of Pat Smear.",
124 "A patch of mushrooms grows here.",
125 "A patch of grape jelly grows here.",
126 "A spindle, and a grindle, and a bucka-wacka-woom!",
127 "A geyser sprays water high into the air.",
128 "A toenail? What good is a toenail?",
129 "You've found the fish! Not that it does you much good in this game.",
130 "A Buttertonsils bar.",
131 "One of the few remaining discoes.",
132 "Ah, the uniform of a Revolutionary-era minuteman.",
133 "A punch bowl, filled with punch and lemon slices.",
134 "It's nothing but a G-thang, baby.",
135 "IT'S ALIVE! AH HA HA HA HA!",
136 "This was no boating accident!",
137 "Wait! This isn't the poker chip! You've been tricked! DAMN YOU, MENDEZ!",
138 "A livery stable! Get your livery!",
139 "It's a perpetual immobility machine.",
140 "\"On this spot in 1962, Henry Winkler was sick.\"",
141 "There's nothing here; it's just an optical illusion.",
142 "The World's Biggest Motzah Ball!",
143 "A tribe of cannibals lives here. They eat Malt-O-Meal for breakfast, you know.",
144 "This appears to be a rather large stack of trashy romance novels.",
145 "Look out! Exclamation points!",
146 "A herd of wild coffee mugs slumbers here.",
147 "It's a limbo bar! How low can you go?",
148 "It's the horizon. Now THAT'S weird.",
149 "A vase full of artificial flowers is stuck to the floor here.",
150 "A large snake bars your way.",
151 "A pair of saloon-style doors swing slowly back and forth here.",
152 "It's an ordinary bust of Beethoven... but why is it painted green?",
153 "It's TV's lovable wisecracking Crow! \"Bite me!\", he says.",
154 "Hey, look, it's war. What is it good for? Absolutely nothing. Say it again.",
155 "It's the amazing self-referential thing that's not kitten.",
156 "A flamboyant feather boa. Now you can dress up like Carol Channing!",
157 "\"Sure hope we get some rain soon,\" says Farmer Joe.",
158 "\"How in heck can I wash my neck if it ain't gonna rain no more?\" asks Farmer Al.",
159 "\"Topsoil's all gone, ma,\" weeps Lil' Greg.",
160 "This is a large brown bear. Oddly enough, it's currently peeing in the woods.",
161 "A team of arctic explorers is camped here.",
162 "This object here appears to be Louis Farrakhan's bow tie.",
163 "This is the world-famous Chain of Jockstraps.",
164 "A trash compactor, compacting away.",
165 "This toaster strudel is riddled with bullet holes!",
166 "It's a hologram of a crashed helicopter.",
167 "This is a television. On screen you see a robot strangely similar to yourself.",
168 "This balogna has a first name, it's R-A-N-C-I-D.",
169 "A salmon hatchery? Look again. It's merely a single salmon.",
170 "It's a rim shot. Ba-da-boom!",
171 "It's creepy and it's kooky, mysterious and spooky. It's also somewhat ooky.",
172 "This is an anagram.",
173 "This object is like an analogy.",
174 "It's a symbol. You see in it a model for all symbols everywhere.",
175 "The object pushes back at you.",
176 "A traffic signal. It appears to have been recently vandalized.",
177 "\"There is no kitten!\" cackles the old crone. You are shocked by her blasphemy.",
178 "This is a Lagrange point. Don't come too close now.",
179 "The dirty old tramp bemoans the loss of his harmonica.",
180 "Look, it's Fanny the Irishman!",
181 "What in blazes is this?",
182 "It's the instruction manual for a previous version of this game.",
183 "A brain cell. Oddly enough, it seems to be functioning.",
184 "Tea and/or crumpets.",
185 "This jukebox has nothing but Cliff Richards albums in it.",
186 "It's a Quaker Oatmeal tube, converted into a drum.",
187 "This is a remote control. Being a robot, you keep a wide berth.",
188 "It's a roll of industrial-strength copper wire.",
189 "Oh boy! Grub! Er, grubs.",
190 "A puddle of mud, where the mudskippers play.",
191 "Plenty of nothing.",
192 "Look at that, it's the Crudmobile.",
193 "Just Walter Mattheau and Jack Lemmon.",
194 "Two crepes, two crepes in a box.",
195 "An autographed copy of \"Primary Colors\", by Anonymous.",
196 "Another rabbit? That's three today!",
197 "It's a segmentation fault. Core dumped, by the way.",
198 "A historical marker showing the actual location of /dev/null.",
199 "Thar's Mobius Dick, the convoluted whale. Arrr!",
200 "It's a charcoal briquette, smoking away.",
201 "A pizza, melting in the sun.",
202 "It's a \"HOME ALONE 2: Lost in New York\" novelty cup.",
203 "A stack of 7 inch floppies wobbles precariously.",
204 "It's nothing but a corrupted floppy. Coaster anyone?",
205 "A section of glowing phosphor cells sings a song of radiation to you.",
206 "This TRS-80 III is eerily silent.",
207 "A toilet bowl occupies this space.",
208 "This peg-leg is stuck in a knothole!",
209 "It's a solitary vacuum tube.",
210 "This corroded robot is clutching a mitten.",
211 "\"Hi, I'm Anson Williams, TV's 'Potsy'.\"",
212 "This subwoofer was blown out in 1974.",
213 "Three half-pennies and a wooden nickel.",
214 "It's the missing chapter to \"A Clockwork Orange\".",
215 "It's a burrito stand flyer. \"Taqueria El Ranchito\".",
216 "This smiling family is happy because they eat LARD.",
217 "Roger Avery, persona un famoso de los Estados Unidos.",
218 "Ne'er but a potted plant.",
219 "A parrot, kipping on its back.",
220 "A forgotten telephone switchboard.",
221 "A forgotten telephone switchboard operator.",
222 "It's an automated robot-disdainer. It pretends you're not there.",
223 "It's a portable hole. A sign reads: \"Closed for the winter\".",
224 "Just a moldy loaf of bread.",
225 "A little glass tub of Carmex. ($.89) Too bad you have no lips.",
226 "A Swiss-Army knife. All of its appendages are out. (toothpick lost)",
227 "It's a zen simulation, trapped within an ASCII character.",
228 "It's a copy of \"The Rubaiyat of Spike Schudy\".",
229 "It's \"War and Peace\" (unabridged, very small print).",
230 "A willing, ripe tomato bemoans your inability to digest fruit.",
231 "A robot comedian. You feel amused.",
232 "It's KITT, the talking car.",
233 "Here's Pete Peterson. His batteries seem to have long gone dead.",
234 "\"Blup, blup, blup\", says the mud pot.",
235 "More grist for the mill.",
236 "Grind 'em up, spit 'em out, they're twigs.",
237 "The boom box cranks out an old Ethel Merman tune.",
238 "It's \"Finding kitten\", published by O'Reilly and Associates.",
239 "Pumpkin pie spice.",
240 "It's the Bass-Matic '76! Mmm, that's good bass!",
241 "\"Lend us a fiver 'til Thursday\", pleas Andy Capp.",
242 "It's a tape of '70s rock. All original hits! All original artists!",
243 "You've found the fabled America Online disk graveyard!",
244 "Empty jewelboxes litter the landscape.",
245 "It's the astounding meta-object.",
246 "Ed McMahon stands here, lost in thought. Seeing you, he bellows, \"YES SIR!\"",
248 "It's 1000 secrets the government doesn't want you to know!",
249 "The letters O and R.",
250 "A magical... magic thing.",
251 "It's a moment of silence.",
252 "It's Sirhan-Sirhan, looking guilty.",
253 "It's \"Chicken Soup for the Kitten-seeking Soulless Robot.\"",
254 "It is a set of wind-up chatter teeth.",
255 "It is a cloud shaped like an ox.",
256 "You see a snowflake here, melting slowly.",
257 "It's a big block of ice. Something seems to be frozen inside it.",
258 "Vladimir Lenin's casket rests here.",
259 "It's a copy of \"Zen and The Art of Robot Maintenance\".",
260 "This invisible box contains a pantomime horse.",
261 "A mason jar lies here open. It's label reads: \"do not open!\".",
262 "A train of thought chugs through here.",
263 "This jar of pickles expired in 1957.",
264 "Someone's identity disk lies here.",
265 "\"Yes!\" says the bit.",
266 "\"No!\" says the bit.",
267 "A dodecahedron bars your way.",
268 "Mr. Hooper is here, surfing.",
269 "It's a big smoking fish.",
270 "You have new mail in /var/spool/robot",
271 "Just a monitor with the blue element burnt out.",
272 "A pile of coaxial plumbing lies here.",
273 "It's a rotten old shoe.",
274 "It's a hundred-dollar bill.",
275 "It's a Dvorak keyboard.",
276 "It's a cardboard box full of 8-tracks.",
277 "Just a broken hard drive containg the archives of Nerth Pork.",
278 "A broken metronome sits here, it's needle off to one side.",
279 "A sign reads: \"Go home!\"",
280 "A sign reads: \"No robots allowed!\"",
281 "It's the handheld robotfindskitten game, by Tiger.",
282 "This particular monstrosity appears to be ENIAC.",
283 "This is a tasty-looking banana creme pie.",
284 "A wireframe model of a hot dog rotates in space here.",
285 "Just the empty husk of a locust.",
286 "You disturb a murder of crows.",
287 "It's a copy of the robotfindskitten EULA.",
289 "It's an autographed copy of \"Secondary Colors,\" by Bob Ross.",
290 "It is a marzipan dreadnought that appears to have melted and stuck.",
291 "It's a DVD of \"Crouching Monkey, Hidden Kitten\", region encoded for the moon.",
292 "It's Kieran Hervold. Damn dyslexia!",
293 "A non-descript box of crackers.",
294 "Carbonated Water, High Fructose Corn Syrup, Color, Phosphoric Acid, Flavors, Caffeine.",
295 "\"Move along! Nothing to see here!\"",
296 "It's the embalmed corpse of Vladimir Lenin.",
297 "A coupon for one free steak-fish at your local family diner.",
298 "A set of keys to a 2001 Rolls Royce. Worthless.",
299 "A gravestone stands here. \"Izchak Miller, ascended.\"",
300 "Someone has written \"ad aerarium\" on the ground here.",
301 "A large blue eye floats in midair.",
302 "This appears to be a statue of Perseus.",
303 "There is an opulent throne here.",
304 "It's a squad of Keystone Kops.",
305 "This seems to be junk mail addressed to the finder of the Eye of Larn.",
306 "A wondrous and intricate golden amulet. Too bad you have no neck.",
307 "The swampy ground around you seems to stink with disease.",
308 "An animate blob of acid. Being metallic, you keep well away.",
309 "It's a copy of Knuth with the chapter on kitten-search algorithms torn out.",
310 "A crowd of people, and at the center, a popular misconception.",
311 "It's a blind man. When you touch, he exclaims \"It's a kitten prospecting robot!\"",
312 "It's a lost wallet. It's owner didn't have pets, so you discard it.",
313 "This place is called Antarctica. There is no kitten here.",
314 "It's a mousetrap, baited with soap.",
315 "A book with \"Don't Panic\" in large friendly letters across the cover.",
316 "A compendium of haiku about metals.",
317 "A discredited cosmology, relic of a bygone era.",
318 "A hollow voice says \"Plugh\".",
319 "A knight who says \"Either I am an insane knave, or you will find kitten.\"",
320 "A neural net -- maybe it's trying to recognize kitten.",
322 "A statue of a girl holding a goose like the one in Gottingen, Germany.",
323 "A tetradrachm dated \"42 B.C.\"",
324 "A voice booms out \"Onward, kitten soldiers...\"",
325 "An eminently forgettable zahir.",
326 "Apparently, it's Edmund Burke.",
327 "For a moment, you feel something in your hands, but it disappears!",
328 "Here is a book about Robert Kennedy.",
329 "Hey, robot, leave those lists alone.",
330 "Ho hum. Another synthetic a posteriori.",
331 "It's Asimov's Laws of Robotics. You feel a strange affinity for them.",
332 "It's Bach's Mass in B-minor!",
334 "It's a synthetic a priori truth! Immanuel would be so pleased!",
335 "It's the Tiki Room.",
336 "Just some old play by a Czech playwright, and you can't read Czech.",
337 "Kitten is the letter 'Q'. Oh, wait, maybe not.",
338 "Quidquid Latine dictum sit, kitten non est.",
339 "Sutro Tower is visible at some distance through the fog.",
340 "The Digital Millennium Copyright Act of 1998.",
341 "The United States Court of Appeals for the Federal Circuit.",
342 "The non-kitten item like this but with \"false\" and \"true\" switched is true.",
343 "The non-kitten item like this but with \"true\" and \"false\" switched is false.",
344 "This is the chapter called \"A Map of the Cat?\" from Feynman's autobiography.",
345 "This is the forest primeval.",
346 "Werner's \"Pocket Field Guide to Things That Are Not Kitten\".",
347 "You found nettik, but that's backwards.",
348 "You have found some zinc, but you must not stop here, for you must find kitten.",
349 "\"50 Years Among the Non-Kitten Items\", by Ann Droyd.",
350 "\"Robot may not injure kitten, or, through inaction, ...\"",
351 "\"Address Allocation for Private Internets\" by Yakov Rekhter et al.",
352 "\"Mail Routing and the Domain System\" by Craig Partridge.",
353 "\"The Theory and Practice of Oligarchical Collectivism\" by Emmanuel Goldstein.",
354 "\"201 Kitten Verbs, Fully Conjugated\". You look for \"find\".",
355 "A card shark sits here, practicing his Faro shuffle. He ignores you.",
356 "A copy of DeCSS. They're a dime a dozen these days.",
357 "A demonic voice proclaims \"There is no kitten, only Zuul\". You flee.",
358 "A lotus. You make an interesting pair.",
359 "A milk carton, with a black and white picture of kitten on the side.",
360 "Any ordinary robot could see from a mile away that this wasn't kitten.",
361 "A stegosaurus, escaped from the stegosaurusfindsrobot game. It finds you.",
362 "Baling wire and chewing gum.",
363 "Chewing gum and baling wire.",
364 "Here is no kitten but only rock, rock and no kitten and the sandy road.",
365 "Hey, I bet you thought this was kitten.",
366 "It is an ancient mariner, and he stoppeth one of three.",
367 "It pleases you to be kind to what appears to be kitten -- but it's not!",
368 "It's a blatant plug for Ogg Vorbis, http://www.vorbis.com/",
369 "It's a business plan for a new startup, kitten.net.",
370 "It's a revised business plan for a new startup, my.kitten.net.",
372 "It seems to be a copy of \"A Tail of Two Kitties\".",
373 "It's the Donation of Constantine!",
374 "It's this message, nothing more.",
375 "Lysine, an essential amino acid. Well, maybe not for robots.",
377 "The score for a Czech composer's \"Kitten-Finding Symphony in C\".",
378 "This looks like Bradley's \"Appearance and Reality\", but it's really not.",
379 "This non-kitten item no verb.",
380 "You feel strangely unfulfilled.",
381 "You hit the non-kitten item. The non-kitten item fails to yowl.",
382 "You suddenly yearn for your distant homeland.",
383 "You've found the snows of yesteryear! So that's where they all went to.",
384 "Approaching. One car. J. Followed by. Two car. M, M. In five. Minutes.",
385 "Free Jon Johansen!",
386 "Free Dmitry Sklyarov!",
387 "One person shouts \"What do we want?\" The crowd answers \"Free Dmitry!\"",
388 "Judith Platt insults librarians.",
389 "This map is not the territory.",
390 "\"Go back to Libraria!\", says Pat Schroeder.",
391 "This is a porcelain kitten-counter. 0, 0, 0, 0, 0...",
392 "An old bootable business card, unfortunately cracked down the middle.",
393 "A kitten sink, for washing kitten (if only kitten liked water).",
394 "A kitten source (to match the kitten sink).",
395 "If it's one thing, it's not another.",
396 "If it's not one thing, it's another.",
399 "A hedgehog. It looks like it knows something important.",
400 "You've found... Oh wait, that's just a cat.",
401 "Robot should not be touching that.",
402 "Air Guitar!!! NA na NA na!!",
403 "An aromatherapy candle burns with healing light.",
404 "You find a bright shiny penny.",
405 "It's a free Jon Johansen!",
406 "It's a free Dmitry Sklyarov!",
407 "The rothe hits! The rothe hits!",
408 "It's an Internet chain letter about sodium laureth sulfate.",
409 "Ed Witten sits here, pondering string theory.",
410 "Something is written here in the dust. You read: \"rJbotf ndQkttten\".",
411 "We wish you a merry kitten, and a happy New Year!",
412 "Run away! Run away!",
413 "You can see right through this copy of Brin\'s \"Transparent Society\".",
414 "This copy of \"Steal This Book\" has been stolen from a bookstore.",
416 "This kit is the fourteenth in a series of kits named with Roman letters.",
417 "This is the tenth key you've found so far.",
418 "You find a fraud scheme in which loans are used as security for other loans.",
419 "It's the phrase \"and her\", written in ancient Greek.",
420 "It's the author of \"Randomness and Mathematical Proof\".",
421 "It's the crusty exoskeleton of an arthropod!",
422 "It's Emporer Shaddam the 4th's planet!",
423 "It's the triangle leg adjacent to an angle divided by the leg opposite it.",
424 "It's a bottle of nail polish remover.",
425 "You found netkit! Way to go, robot!",
426 "It's the ASCII Floating Head of Seth David Schoen!",
427 "A frosted pink party-cake, half eaten.",
428 "A bitchin' homemade tesla coil.",
429 "Conan O'Brian, sans jawbone.",
430 "It's either a mirror, or another soulless kitten-seeking robot.",
431 "Preoccupation with finding kitten prevents you from investigating further.",
432 "Fonzie sits here, mumbling incoherently about a shark and a pair of waterskis.",
433 "The ghost of your dance instructor, his face a paper-white mask of evil.",
434 "A bag of groceries taken off the shelf before the expiration date.",
435 "A book: Feng Shui, Zen: the art of randomly arranging items that are not kitten.",
436 "This might be the fountain of youth, but you'll never know.",
439 "A canister of pressurized whipped cream, sans whipped cream.",
440 "The non-kitten item bites!",
441 "A chain hanging from two posts reminds you of the Gateway Arch.",
442 "A mathematician calculates the halting probability of a Turing machine.",
443 "A number of short theatrical productions are indexed 1, 2, 3, ... n.",
444 "A technical university in Australia.",
445 "It is -- I just feel something wonderful is about to happen.",
446 "It's a Cat 5 cable.",
447 "It's a U.S. president.",
448 "It's a piece of cloth used to cover a stage in between performances.",
449 "The ionosphere seems charged with meaning.",
450 "This tomography is like, hella axial, man!",
451 "It's your favorite game -- robotfindscatan!",
452 "Just a man selling an albatross.",
453 "The intermission from a 1930s silent movie.",
454 "It's an inverted billiard ball!",
455 "The spectre of Sherlock Holmes wills you onwards.",
458 #define RFK_VERSION "v1.4142135.406"
460 /* Button definitions stolen from maze.c */
461 #if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
462 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
463 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
464 # undef __PLUGINLIB_ACTIONS_H__
465 # define RFK_QUIT (BUTTON_SELECT | BUTTON_MENU)
466 # define RFK_RIGHT BUTTON_RIGHT
467 # define RFK_LEFT BUTTON_LEFT
468 # define RFK_UP BUTTON_MENU
469 # define RFK_DOWN BUTTON_PLAY
470 # define RFK_RRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
471 # define RFK_RLEFT (BUTTON_LEFT | BUTTON_REPEAT)
472 # define RFK_RUP (BUTTON_MENU | BUTTON_REPEAT)
473 # define RFK_RDOWN (BUTTON_PLAY | BUTTON_REPEAT)
476 # define RFK_QUIT PLA_QUIT
477 # define RFK_RIGHT PLA_RIGHT
478 # define RFK_LEFT PLA_LEFT
479 # define RFK_UP PLA_UP
480 # define RFK_DOWN PLA_DOWN
481 # define RFK_RRIGHT PLA_RIGHT_REPEAT
482 # define RFK_RLEFT PLA_LEFT_REPEAT
483 # define RFK_RUP PLA_UP_REPEAT
484 # define RFK_RDOWN PLA_DOWN_REPEAT
487 /*Constants for our internal representation of the screen.*/
492 /* if SYSFONT_WIDTH is 0 (which it is during dependency generation) gcc
493 will abort (div by 0) and this plugin won't get any dependencies
495 #if SYSFONT_WIDTH < 1
496 #define SYSFONT_WIDTH 10
497 #define SYSFONT_HEIGHT 10
500 /*Screen dimensions.*/
502 #define X_MAX ((LCD_WIDTH/SYSFONT_WIDTH) - 1)
504 #define Y_MAX ((LCD_HEIGHT/SYSFONT_HEIGHT) - 1)
509 #define ROBOT_COLOR LCD_DARKGRAY
510 const unsigned colors
[NUM_COLORS
] = {
511 LCD_RGBPACK(255, 255, 0), /* Yellow */
512 LCD_RGBPACK(0, 255, 255), /* Cyan */
513 LCD_RGBPACK(255, 0, 255), /* Purple */
514 LCD_RGBPACK(0, 0, 255), /* Blue */
515 LCD_RGBPACK(255, 0, 0), /* Red */
516 LCD_RGBPACK(0, 255, 0), /* Green */
520 #define ROBOT_COLOR LCD_DARKGRAY
521 const unsigned colors
[NUM_COLORS
] = {
528 #define ROBOT_COLOR 0
529 const unsigned colors
[NUM_COLORS
] = {
532 #endif /* HAVE_LCD_COLOR */
534 /*Macros for generating numbers in different ranges*/
535 #define randx() (rb->rand() % X_MAX) + 1
536 #define randy() (rb->rand() % (Y_MAX-Y_MIN+1))+Y_MIN /*I'm feeling randy()!*/
537 #define randchar() rb->rand() % (126-'!'+1)+'!';
538 #define randcolor() rb->rand() % NUM_COLORS
539 #define randbold() (rb->rand() % 2 ? true:false)
541 /*Row constants for the animation*/
543 #define ANIMATION_MEET (X_MAX/3)*2
544 #define ANIMATION_LENGTH 4
546 /*This struct contains all the information we need to display an object
558 *Function definitions
561 /*Initialization and setup functions*/
562 static void initialize_arrays(void);
563 static void initialize_robot(void);
564 static void initialize_kitten(void);
565 static void initialize_bogus(void);
566 static void initialize_screen(void);
567 static void instructions(void);
568 static void finish(int sig
);
571 static void play_game(void);
572 static void process_input(int);
575 static void pause(void);
576 static int validchar(char);
577 static void play_animation(int);
579 /*Global variables. Bite me, it's fun.*/
580 struct screen_object robot
;
581 struct screen_object kitten
;
583 #if X_MAX*Y_MAX < 200
588 struct screen_object bogus
[NUM_BOGUS
];
589 unsigned short bogus_messages
[NUM_BOGUS
];
590 bool used_messages
[MESSAGES
];
594 /* This array contains our internal representation of the screen. The
595 array is bigger than it needs to be, as we don't need to keep track
596 of the first few rows of the screen. But that requires making an
597 offset function and using that everywhere. So not right now. */
598 int screen
[X_MAX
+ 1][Y_MAX
+ 1];
600 /* here is a global api struct pointer. while not strictly necessary,
601 it's nice not to have to pass the api pointer in all function calls
603 static const struct plugin_api
* rb
;
605 /******************************************************************************
607 * Begin meaty routines that do the dirty work.
609 *****************************************************************************/
611 MEM_FUNCTION_WRAPPERS(rb
)
613 static void drawchar(int x
, int y
, char c
)
616 rb
->snprintf(str
, sizeof(str
), "%c", c
);
617 rb
->lcd_putsxy(x
*SYSFONT_WIDTH
, y
*SYSFONT_HEIGHT
, str
);
620 static void draw(struct screen_object o
)
623 unsigned oldforeground
;
624 oldforeground
= rb
->lcd_get_foreground();
625 rb
->lcd_set_foreground(o
.color
);
626 drawchar(o
.x
, o
.y
, o
.character
);
627 rb
->lcd_set_foreground(oldforeground
);
629 drawchar(o
.x
, o
.y
, o
.character
);
633 static void message(char * str
)
635 rb
->lcd_puts_scroll(0, ADV_ROW
, str
);
638 static void refresh(void)
644 *play_game waits in a loop getting input and sending it to process_input
646 static void play_game()
650 int input
= 0; /* Not sure what a reasonable initial value is */
651 #ifdef __PLUGINLIB_ACTIONS_H__
652 const struct button_mapping
*plugin_contexts
[] = {generic_directions
, generic_actions
};
655 while (input
!= RFK_QUIT
&& exit_rfk
== false)
657 process_input(input
);
659 /*Redraw robot, where applicable. We're your station, robot.*/
660 if (!(old_x
== robot
.x
&& old_y
== robot
.y
))
662 /*Get rid of the old robot*/
663 drawchar(old_x
, old_y
, ' ');
664 screen
[old_x
][old_y
] = EMPTY
;
666 /*Meet the new robot, same as the old robot.*/
669 screen
[robot
.x
][robot
.y
] = ROBOT
;
674 #ifdef __PLUGINLIB_ACTIONS_H__
675 input
= pluginlib_getaction(rb
, TIMEOUT_BLOCK
, plugin_contexts
, 2);
677 input
= rb
->button_get(true);
685 *Given the keyboard input, process_input interprets it in terms of moving,
686 *touching objects, etc.
688 static void process_input(int input
)
690 int check_x
= robot
.x
;
691 int check_y
= robot
.y
;
713 /*Check for going off the edge of the screen.*/
714 if (check_y
< Y_MIN
|| check_y
> Y_MAX
|| check_x
< X_MIN
|| check_x
> X_MAX
)
716 return; /*Do nothing.*/
721 * disabled because it breaks the scrolling for some reason
723 /* rb->lcd_puts_scroll(0, ADV_ROW, " "); */
725 /*Check for collision*/
726 if (screen
[check_x
][check_y
] != EMPTY
)
728 switch (screen
[check_x
][check_y
])
731 /*We didn't move, or we're stuck in a
732 time warp or something.*/
734 case KITTEN
: /*Found it!*/
735 play_animation(input
);
736 /* Wait for the user to click something */
739 default: /*We hit a bogus object; print its message.*/
740 message(messages
[bogus_messages
[screen
[check_x
][check_y
]-2]]);
747 /*Otherwise, move the robot.*/
752 /*finish is called upon signal or progam exit*/
753 static void finish(int sig
)
759 /******************************************************************************
761 * Begin helper routines
763 *****************************************************************************/
770 button
= rb
->button_get(true);
772 while( ( button
== BUTTON_NONE
)
773 || ( button
& (BUTTON_REL
|BUTTON_REPEAT
) ) );
776 static int validchar(char a
)
788 static void play_animation(int input
)
791 struct screen_object left
;
792 struct screen_object right
;
793 /*The grand cinema scene.*/
794 rb
->lcd_puts_scroll(0, ADV_ROW
, " ");
796 if (input
== RFK_RIGHT
|| input
== RFK_DOWN
||
797 input
== RFK_RRIGHT
|| input
== RFK_RDOWN
)
808 left
.x
= ANIMATION_MEET
- ANIMATION_LENGTH
- 1;
809 right
.x
= ANIMATION_MEET
+ ANIMATION_LENGTH
;
811 for (counter
= ANIMATION_LENGTH
; counter
> 0; counter
--)
815 /* Clear the previous position (empty the first time) */
816 drawchar(left
.x
- 1, left
.y
, ' ');
817 drawchar(right
.x
+ 1, right
.y
, ' ');
824 message("You found kitten! Way to go, robot!");
829 /******************************************************************************
831 * Begin initialization routines (called before play begins).
833 *****************************************************************************/
835 static void instructions()
838 int y
= MARGIN
, space_w
, width
, height
;
839 unsigned short x
= MARGIN
, i
= 0;
840 #define WORDS (sizeof instructions / sizeof (char*))
841 static char* instructions
[] = {
843 /* Not sure if we want to include this? */
844 "robotfindskitten", RFK_VERSION
, "", "",
845 "By", "the", "illustrious", "Leonard", "Richardson", "(C)", "1997,", "2000", "",
846 "Written", "originally", "for", "the", "Nerth", "Pork", "robotfindskitten", "contest", "", "",
848 "In", "this", "game", "you", "are", "robot", "(#).", "Your", "job", "is", "to", "find", "kitten.", "This", "task", "is", "complicated", "by", "the", "existence", "of", "various", "things", "which", "are", "not", "kitten.", "Robot", "must", "touch", "items", "to", "determine", "if", "they", "are", "kitten", "or", "not.", "",
849 "The", "game", "ends", "when", "robotfindskitten.", "", "",
850 "Press", "any", "key", "to", "start",
852 rb
->lcd_clear_display();
853 rb
->lcd_getstringsize(" ", &space_w
, &height
);
854 for (i
= 0; i
< WORDS
; i
++) {
855 rb
->lcd_getstringsize(instructions
[i
], &width
, NULL
);
856 /* Skip to next line if the current one can't fit the word */
857 if (x
+ width
> LCD_WIDTH
- MARGIN
) {
861 /* .. or if the word is the empty string */
862 if (rb
->strcmp(instructions
[i
], "") == 0) {
867 /* We filled the screen */
868 if (y
+ height
> LCD_HEIGHT
- MARGIN
) {
871 rb
->lcd_clear_display();
873 rb
->lcd_putsxy(x
, y
, instructions
[i
]);
874 x
+= width
+ space_w
;
879 static void initialize_arrays()
881 unsigned int counter
, counter2
;
882 struct screen_object empty
;
884 /*Initialize the empty object.*/
888 empty
.color
= LCD_BLACK
;
893 empty
.character
= ' ';
895 for (counter
= 0; counter
<= X_MAX
; counter
++)
897 for (counter2
= 0; counter2
<= Y_MAX
; counter2
++)
899 screen
[counter
][counter2
] = EMPTY
;
903 /*Initialize the other arrays.*/
904 for (counter
= 0; counter
< MESSAGES
; counter
++)
906 used_messages
[counter
] = false;
908 for (counter
= 0; counter
< NUM_BOGUS
; counter
++)
910 bogus_messages
[counter
] = 0;
911 bogus
[counter
] = empty
;
915 /*initialize_robot initializes robot.*/
916 static void initialize_robot()
918 /*Assign a position to the player.*/
922 robot
.character
= '#';
923 robot
.color
= ROBOT_COLOR
;
925 screen
[robot
.x
][robot
.y
] = ROBOT
;
928 /*initialize kitten, well, initializes kitten.*/
929 static void initialize_kitten()
931 /*Assign the kitten a unique position.*/
935 } while (screen
[kitten
.x
][kitten
.y
] != EMPTY
);
937 /*Assign the kitten a character and a color.*/
939 kitten
.character
= randchar();
940 } while (!(validchar(kitten
.character
)));
941 screen
[kitten
.x
][kitten
.y
] = KITTEN
;
943 kitten
.color
= colors
[randcolor()];
944 kitten
.bold
= randbold();
947 /*initialize_bogus initializes all non-kitten objects to be used in this run.*/
948 static void initialize_bogus()
951 for (counter
= 0; counter
< NUM_BOGUS
; counter
++)
954 bogus
[counter
].color
= colors
[randcolor()];
955 bogus
[counter
].bold
= randbold();
957 /*Give it a character.*/
959 bogus
[counter
].character
= randchar();
960 } while (!(validchar(bogus
[counter
].character
)));
962 /*Give it a position.*/
964 bogus
[counter
].x
= randx();
965 bogus
[counter
].y
= randy();
966 } while (screen
[bogus
[counter
].x
][bogus
[counter
].y
] != EMPTY
);
968 screen
[bogus
[counter
].x
][bogus
[counter
].y
] = counter
+2;
970 /*Find a message for this object.*/
972 index
= rb
->rand() % MESSAGES
;
973 } while (used_messages
[index
] != false);
974 bogus_messages
[counter
] = index
;
975 used_messages
[index
] = true;
980 /*initialize_screen paints the screen.*/
981 static void initialize_screen()
987 *Print the status portion of the screen.
989 rb
->lcd_clear_display();
990 rb
->lcd_setfont(FONT_SYSFIXED
);
991 rb
->snprintf(buf
, sizeof(buf
), "robotfindskitten %s", RFK_VERSION
);
992 rb
->lcd_puts_scroll(0, 0, buf
);
995 /*Draw a line across the screen.*/
996 for (counter
= X_MIN
; counter
<= X_MAX
+ 1; counter
++)
998 drawchar(counter
, ADV_ROW
+1, '_');
1002 *Draw all the objects on the playing field.
1004 for (counter
= 0; counter
< NUM_BOGUS
; counter
++)
1006 draw(bogus
[counter
]);
1016 /* this is the plugin entry point */
1017 enum plugin_status
plugin_start(const struct plugin_api
* api
, const void* parameter
)
1024 rb
->srand(*rb
->current_tick
);
1026 initialize_arrays();
1029 * Now we initialize the various game objects.
1032 initialize_kitten();
1036 * Set up white-on-black screen on color targets
1039 rb
->lcd_set_backdrop(NULL
);
1040 rb
->lcd_set_foreground(LCD_WHITE
);
1041 rb
->lcd_set_background(LCD_BLACK
);
1049 initialize_screen();
1053 rb
->lcd_setfont(FONT_UI
);