From 7fbd8d53b1932e40676a120cfd84868f3758465b Mon Sep 17 00:00:00 2001 From: Ian C Date: Thu, 12 May 2005 00:59:39 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r2, which included commits to RCS files with non-trunk default branches. --- .Xbit.c.swp | Bin 0 -> 57397 bytes .Xbit.h.swo | Bin 0 -> 32821 bytes .Xbit.h.swp | Bin 0 -> 28672 bytes .lunar.c.swp | Bin 0 -> 49206 bytes LEVELS/README | 61 ++ LEVELS/lunar.desc | 12 + LEVELS/lunar1 | 40 ++ LEVELS/lunar10 | 72 ++ LEVELS/lunar2 | 63 ++ LEVELS/lunar3 | 76 ++ LEVELS/lunar4 | 83 +++ LEVELS/lunar5 | 94 +++ LEVELS/lunar6 | 57 ++ LEVELS/lunar7 | 153 ++++ LEVELS/lunar8 | 182 +++++ LEVELS/lunar9 | 58 ++ LICENSE | 341 +++++++++ Makefile | 61 ++ README | 99 +++ Xbit.c | 1860 ++++++++++++++++++++++++++++++++++++++++++++++++ Xbit.h | 594 ++++++++++++++++ fontset.h | 2020 +++++++++++++++++++++++++++++++++++++++++++++++++++++ icon | 27 + ledit.c | 547 +++++++++++++++ lunar.c | 1843 ++++++++++++++++++++++++++++++++++++++++++++++++ 25 files changed, 8343 insertions(+) create mode 100644 .Xbit.c.swp create mode 100644 .Xbit.h.swo create mode 100644 .Xbit.h.swp create mode 100644 .lunar.c.swp create mode 100644 LEVELS/README create mode 100644 LEVELS/lunar.desc create mode 100644 LEVELS/lunar1 create mode 100644 LEVELS/lunar10 create mode 100644 LEVELS/lunar2 create mode 100644 LEVELS/lunar3 create mode 100644 LEVELS/lunar4 create mode 100644 LEVELS/lunar5 create mode 100644 LEVELS/lunar6 create mode 100644 LEVELS/lunar7 create mode 100644 LEVELS/lunar8 create mode 100644 LEVELS/lunar9 create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README create mode 100644 Xbit.c create mode 100644 Xbit.h create mode 100644 fontset.h create mode 100644 icon create mode 100644 ledit.c create mode 100644 lunar.c diff --git a/.Xbit.c.swp b/.Xbit.c.swp new file mode 100644 index 0000000..808e18f Binary files /dev/null and b/.Xbit.c.swp differ diff --git a/.Xbit.h.swo b/.Xbit.h.swo new file mode 100644 index 0000000..f8eebe7 Binary files /dev/null and b/.Xbit.h.swo differ diff --git a/.Xbit.h.swp b/.Xbit.h.swp new file mode 100644 index 0000000..b52482c Binary files /dev/null and b/.Xbit.h.swp differ diff --git a/.lunar.c.swp b/.lunar.c.swp new file mode 100644 index 0000000..ad8cb4a Binary files /dev/null and b/.lunar.c.swp differ diff --git a/LEVELS/README b/LEVELS/README new file mode 100644 index 0000000..766579b --- /dev/null +++ b/LEVELS/README @@ -0,0 +1,61 @@ +Level definitions made up of : +------------------------------ + +lunar.desc - Level description file + - Level file + + +Format of level description file : +---------------------------------- + +Name of level set + + + + ..... + ..... + + + +Format of level files : +----------------------- + +Name of level + (M=Mountain, P=Pad, + X=Asteroid c/wise, Y=Asteroid a/cwise, O=Mine) + (integer X,Y) + (integer X,Y) + (integer X,Y) + ............ + (integer X,Y) +-666,-666 (end polygon marker) + + ............ + ............ + + +TIPS: +----- + +1. Remember the lander starts out at (0,0) + +2. Make the outside of the level the _inside_ of a large polygon - if you don't + want to be able to drift out into space! + +3. Asteroids are the same as mountains, but rotate to cause hassle - you could + always make the outside of the level an asteriod if you wanted!! + +4. The _centre_ of an asteroid doesn't have to be it's real centre - this way + you can generate orbitting objects. + +5. Mines cause engine damage and disappear once hit. + +6. The vector routines aren't particularly flash!! Don't get carried away! + +7. Use ledit to make the levels - it _will_ stop your hair falling out! :-) + +8. Current limits are (double check with code) + + Max levels - 32 + Max objetcs per level - 64 + Max lines per object - 32 diff --git a/LEVELS/lunar.desc b/LEVELS/lunar.desc new file mode 100644 index 0000000..4feada7 --- /dev/null +++ b/LEVELS/lunar.desc @@ -0,0 +1,12 @@ +THE NODDYBOX LEVELS +10 +lunar1 +lunar2 +lunar3 +lunar4 +lunar5 +lunar6 +lunar7 +lunar8 +lunar9 +lunar10 diff --git a/LEVELS/lunar1 b/LEVELS/lunar1 new file mode 100644 index 0000000..e953de7 --- /dev/null +++ b/LEVELS/lunar1 @@ -0,0 +1,40 @@ +GENTLE INTRODUCTION +M Object #0 +42,57 +36,24 +36,-645 +-555,-645 +-555,24 +-456,-42 +-372,-165 +-351,-225 +-315,-294 +-288,-336 +-276,-315 +-267,-279 +-240,-330 +-234,-396 +-213,-426 +-198,-408 +-180,-375 +-177,-330 +-183,-264 +-168,-174 +-120,-126 +-120,-75 +-99,-39 +-63,-3 +-57,6 +-666,-666 +P Object #1 +-170,-369 +-29,-7 +25,-7 +25,1 +10,11 +4,7 +-1,1 +-6,7 +-10,13 +-29,-1 +-666,-666 diff --git a/LEVELS/lunar10 b/LEVELS/lunar10 new file mode 100644 index 0000000..270e401 --- /dev/null +++ b/LEVELS/lunar10 @@ -0,0 +1,72 @@ +THE HORSESHOE +Y Object #0 +0,0 +0,-287 +-21,-266 +-50,-215 +-64,-141 +-60,-103 +-55,-21 +-52,61 +-58,145 +-50,194 +-45,235 +-44,253 +-65,254 +-112,252 +-127,194 +-134,59 +-142,-136 +-134,-231 +-84,-286 +-10,-320 +51,-318 +106,-296 +145,-233 +181,2 +203,161 +188,225 +184,251 +153,258 +128,227 +119,184 +112,90 +103,-189 +73,-233 +-666,-666 +M Object #1 +0,0 +189,327 +450,180 +492,0 +534,-294 +468,-528 +288,-774 +234,-879 +105,-906 +-210,-876 +-435,-717 +-483,-429 +-498,-204 +-489,123 +-414,228 +-228,336 +-30,348 +-18,444 +-12,588 +-33,747 +-72,867 +183,867 +111,777 +69,624 +63,492 +75,387 +87,363 +-666,-666 +P Object #2 +46,863 +-27,4 +-27,-6 +22,-6 +22,4 +-666,-666 diff --git a/LEVELS/lunar2 b/LEVELS/lunar2 new file mode 100644 index 0000000..ce1dea0 --- /dev/null +++ b/LEVELS/lunar2 @@ -0,0 +1,63 @@ +ROUND THE BEND +M Object #0 +1,1 +-269,-266 +256,-265 +251,82 +-71,176 +-74,240 +285,367 +273,455 +-7,559 +-111,543 +-159,489 +-191,349 +-205,279 +-161,177 +-137,133 +-117,109 +-59,91 +-37,71 +-55,27 +-77,-45 +-111,-81 +-141,-115 +-225,-135 +-303,-149 +-315,-191 +-321,-225 +-321,-241 +-315,-245 +-666,-666 +Y Object #1 +-116,402 +-16,-26 +22,-30 +28,-20 +32,-6 +32,10 +26,24 +0,24 +-12,14 +-22,4 +-32,-4 +-666,-666 +X Object #2 +-10,502 +-32,2 +-22,-18 +10,-20 +16,-18 +22,-2 +18,8 +6,20 +-10,22 +-24,14 +-666,-666 +P Object #3 +92,514 +-5,12 +32,-3 +32,-9 +-6,-9 +-666,-666 diff --git a/LEVELS/lunar3 b/LEVELS/lunar3 new file mode 100644 index 0000000..a805932 --- /dev/null +++ b/LEVELS/lunar3 @@ -0,0 +1,76 @@ +THE TUMBLER +Y Object #0 +0,3 +0,-198 +57,-174 +156,-117 +183,18 +162,93 +135,144 +144,177 +192,186 +228,126 +258,66 +264,15 +255,-75 +216,-180 +129,-228 +-33,-258 +-84,-255 +-192,-189 +-234,-93 +-231,63 +-213,141 +-171,177 +-141,156 +-150,-9 +-156,-87 +-141,-135 +-666,-666 +X Object #1 +6,147 +-144,-426 +-216,-372 +-300,-303 +-342,-210 +-348,3 +-315,213 +-267,300 +-171,354 +-24,360 +177,366 +294,258 +354,69 +375,-33 +372,-207 +315,-306 +324,-393 +384,-390 +486,-324 +552,-174 +552,132 +495,255 +348,378 +120,510 +-192,489 +-351,357 +-459,156 +-495,-114 +-486,-381 +-309,-477 +-225,-507 +-666,-666 +M Object #2 +0,189 +-690,-783 +795,-783 +792,795 +-693,795 +-666,-666 +P Object #3 +-6,969 +-45,15 +-22,-8 +27,-8 +50,15 +-666,-666 diff --git a/LEVELS/lunar4 b/LEVELS/lunar4 new file mode 100644 index 0000000..11b08ce --- /dev/null +++ b/LEVELS/lunar4 @@ -0,0 +1,83 @@ +THE CANYON +M Object #0 +180,516 +-585,-579 +585,-579 +585,555 +-585,555 +-666,-666 +M Object #1 +-244,513 +129,-576 +99,-387 +159,-357 +198,-261 +204,-237 +210,-150 +207,-111 +192,-90 +222,0 +252,30 +288,87 +288,132 +258,219 +246,252 +279,321 +309,390 +315,432 +321,480 +309,513 +285,543 +273,555 +-162,555 +-162,-576 +-666,-666 +M Object #2 +489,516 +-372,-579 +-435,-414 +-456,-375 +-462,-258 +-480,-210 +-465,-171 +-432,-108 +-408,-66 +-414,-15 +-327,93 +-306,129 +-309,234 +-339,276 +-354,366 +-318,420 +-300,489 +-243,555 +279,555 +276,-579 +-666,-666 +Y Object #3 +112,732 +-18,-9 +-12,-27 +21,-30 +21,-21 +21,-6 +24,6 +18,15 +12,21 +-6,21 +-18,12 +-666,-666 +O Object #4 +104,906 +3,-12 +15,0 +0,15 +-15,0 +-666,-666 +P Object #5 +135,1066 +-23,-4 +19,-4 +19,4 +-23,4 +-666,-666 diff --git a/LEVELS/lunar5 b/LEVELS/lunar5 new file mode 100644 index 0000000..82069ac --- /dev/null +++ b/LEVELS/lunar5 @@ -0,0 +1,94 @@ +1.. 2.. 3.. GO! +M Object #0 +0,6 +-48,-3 +-99,-168 +-270,-303 +-381,-450 +-168,-477 +-24,-462 +-3,-267 +78,-147 +222,-411 +375,-444 +468,-339 +513,-189 +402,-90 +309,27 +195,141 +15,132 +-24,159 +-198,204 +-219,240 +-258,279 +-591,198 +-489,-45 +-624,-255 +-684,-366 +-798,-489 +-855,-585 +-687,-663 +-582,-666 +-492,-642 +-468,-564 +-516,-399 +-564,-399 +-666,-666 +X Object #1 +-318,54 +-42,-6 +-15,-36 +42,-66 +63,-81 +138,-96 +174,-114 +177,-102 +162,-84 +144,-66 +126,-48 +99,-30 +60,12 +33,24 +18,36 +-9,45 +-27,51 +-60,60 +-75,60 +-117,48 +-111,33 +-99,21 +-84,9 +-666,-666 +P Object #2 +-542,-385 +-16,-14 +21,-14 +21,-9 +-16,-9 +-666,-666 +O Object #3 +-664,-524 +20,-14 +15,10 +5,14 +-3,16 +-16,4 +-14,-2 +-1,-18 +-666,-666 +O Object #4 +-509,-517 +-15,-4 +9,-9 +1,13 +-23,17 +-666,-666 +O Object #5 +-646,-411 +-12,-19 +13,-17 +19,9 +16,15 +2,15 +-10,6 +-666,-666 diff --git a/LEVELS/lunar6 b/LEVELS/lunar6 new file mode 100644 index 0000000..416d5fd --- /dev/null +++ b/LEVELS/lunar6 @@ -0,0 +1,57 @@ +THE OVERHANG +M Object #0 +0,3 +-111,-243 +57,-225 +159,-237 +249,-240 +282,-189 +276,-156 +120,-147 +-15,-153 +-192,-141 +-237,-96 +-177,12 +6,90 +252,87 +420,51 +444,-54 +423,-159 +366,-243 +252,-303 +159,-315 +69,-321 +12,-291 +-51,-306 +-111,-315 +-135,-294 +-141,-264 +-129,-243 +-666,-666 +Y Object #1 +225,-30 +-36,-63 +-12,-36 +15,-60 +33,-69 +45,-27 +30,-3 +39,15 +36,36 +15,51 +9,72 +-12,66 +-51,42 +-72,21 +-36,15 +-36,-6 +-60,-39 +-69,-57 +-666,-666 +P Object #2 +-84,-242 +-8,4 +-8,-2 +21,-2 +21,7 +-666,-666 diff --git a/LEVELS/lunar7 b/LEVELS/lunar7 new file mode 100644 index 0000000..e2c0c81 --- /dev/null +++ b/LEVELS/lunar7 @@ -0,0 +1,153 @@ +TAKE YOUR PICK... +M Object #0 +3,3 +3,-456 +267,3 +174,303 +105,405 +9,408 +-18,393 +24,300 +57,252 +75,195 +90,150 +78,105 +30,48 +-45,45 +-102,3 +-105,-45 +-54,-60 +0,-72 +51,-114 +66,-192 +39,-252 +-81,-327 +-129,-345 +-252,-375 +-249,-486 +-234,-540 +-165,-537 +-132,-501 +-108,-441 +-102,-411 +-96,-381 +-75,-372 +-51,-393 +-666,-666 +P Object #1 +-231,-357 +-7,-12 +-7,-19 +37,-19 +37,-2 +-666,-666 +O Object #2 +-197,-475 +-9,-17 +12,-12 +16,6 +5,11 +-10,8 +-11,4 +-13,-1 +-666,-666 +O Object #3 +-143,-430 +13,15 +-11,9 +-16,-13 +-14,-20 +6,-19 +11,-4 +-666,-666 +O Object #4 +-215,-425 +-1,-23 +23,-15 +21,2 +-5,5 +-6,5 +-11,-5 +-666,-666 +O Object #5 +114,258 +-3,-13 +12,-4 +7,5 +-7,10 +-9,-4 +-666,-666 +O Object #6 +170,167 +-6,-13 +14,-5 +7,6 +-1,8 +-13,2 +-666,-666 +O Object #7 +101,195 +17,-8 +3,13 +-6,13 +-11,-8 +-8,-18 +-666,-666 +O Object #8 +161,239 +-15,-8 +7,-9 +15,5 +11,9 +-14,9 +-666,-666 +O Object #9 +105,302 +4,-17 +20,-2 +17,14 +-8,12 +-9,9 +-10,-10 +-666,-666 +O Object #10 +63,295 +-7,-12 +-10,5 +0,7 +14,-3 +12,-11 +-666,-666 +O Object #11 +104,335 +-18,14 +13,7 +7,-9 +-10,-13 +-16,-9 +-666,-666 +O Object #12 +83,361 +-19,12 +-19,-10 +4,-11 +14,10 +12,12 +-666,-666 +O Object #13 +33,338 +21,-6 +19,-2 +9,9 +-2,10 +-5,2 +-5,-13 +8,-23 +-666,-666 +P Object #14 +51,407 +-8,3 +-8,-6 +26,-6 +26,2 +-666,-666 diff --git a/LEVELS/lunar8 b/LEVELS/lunar8 new file mode 100644 index 0000000..8a7011c --- /dev/null +++ b/LEVELS/lunar8 @@ -0,0 +1,182 @@ +THE ASTEROID FIELD +M Object #0 +3,357 +-45,-393 +261,-345 +330,-237 +426,-69 +432,78 +396,156 +372,207 +264,321 +174,348 +0,348 +-87,348 +-231,276 +-297,171 +-339,123 +-372,-24 +-378,-123 +-366,-210 +-318,-318 +-213,-357 +-180,-384 +-666,-666 +X Object #1 +-156,66 +6,-36 +36,-6 +9,54 +3,60 +-9,48 +-36,12 +-36,-12 +-36,-12 +-36,-18 +-666,-666 +Y Object #2 +147,102 +-9,-42 +33,42 +33,51 +-57,39 +-63,12 +-57,-15 +-666,-666 +X Object #3 +-3,129 +3,-36 +48,15 +-15,51 +-48,-12 +-51,-24 +-666,-666 +Y Object #4 +-249,228 +33,-27 +60,-21 +-9,42 +-33,-6 +-39,-27 +-666,-666 +X Object #5 +156,276 +-42,-48 +27,-30 +30,27 +-30,39 +-51,36 +-666,-666 +Y Object #6 +-24,288 +9,-51 +78,-9 +36,57 +0,48 +-45,15 +-54,-30 +-666,-666 +X Object #7 +-219,342 +45,-27 +51,-15 +39,42 +-3,30 +-27,-3 +-33,-24 +-9,-54 +-666,-666 +X Object #8 +57,483 +-18,-87 +51,-3 +33,30 +-72,21 +-75,15 +-666,-666 +Y Object #9 +-108,417 +-6,-36 +24,-18 +36,42 +-36,42 +-36,42 +-39,-24 +-666,-666 +X Object #10 +210,423 +-3,-84 +24,-27 +51,21 +30,39 +3,33 +-18,24 +-30,-6 +-666,-666 +Y Object #11 +183,570 +-9,-54 +21,-30 +30,15 +24,30 +-12,36 +-39,9 +-45,-12 +-36,-36 +-666,-666 +M Object #12 +303,228 +-33,-99 +-54,-24 +-36,78 +-27,93 +18,168 +9,243 +-9,291 +-39,327 +-27,363 +24,288 +45,210 +51,156 +51,123 +51,48 +36,-51 +3,-75 +-12,-108 +-33,-126 +-666,-666 +M Object #13 +-138,555 +-168,-150 +-126,-75 +-57,21 +-51,30 +0,60 +48,81 +78,60 +84,27 +102,0 +45,-36 +15,-45 +-27,-39 +-66,-78 +-117,-144 +-135,-159 +-156,-168 +-666,-666 +P Object #14 +56,705 +-15,0 +-15,-9 +15,-9 +15,0 +-666,-666 +O Object #15 +-195,615 +-12,-18 +18,-12 +30,12 +9,15 +-15,12 +-18,-6 +-666,-666 diff --git a/LEVELS/lunar9 b/LEVELS/lunar9 new file mode 100644 index 0000000..4ec547d --- /dev/null +++ b/LEVELS/lunar9 @@ -0,0 +1,58 @@ +get ready to RUN!!! +X Object #0 +-327,153 +-36,0 +69,-21 +144,-27 +339,-21 +441,-12 +462,-3 +396,18 +303,24 +213,21 +123,21 +30,24 +-9,21 +-666,-666 +M Object #1 +-327,156 +477,0 +471,-105 +423,-258 +339,-330 +81,-405 +-24,-405 +-138,-372 +-285,-267 +-357,-111 +-372,-6 +-351,141 +-288,204 +36,276 +330,354 +627,294 +669,150 +753,-3 +798,-198 +852,-285 +987,-420 +1041,-426 +1191,-426 +1212,-453 +1179,-531 +1101,-549 +981,-573 +729,-369 +615,-171 +576,15 +513,123 +405,258 +315,297 +-666,-666 +P Object #2 +789,-279 +-34,9 +-25,0 +11,0 +20,9 +-666,-666 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..abd3cf7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,341 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..08ff199 --- /dev/null +++ b/Makefile @@ -0,0 +1,61 @@ +# lunar - Simple X11 Lunar Lander +# +# Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# ------------------------------------------------------------------------- +# +# $Id: Makefile,v 1.1.1.1 2005-05-12 00:59:39 ianc Exp $ +# + + +# Paths to X11 includes and libraries. Edit as appropriate for your system +# +DIRS=-L/usr/X11R6/lib -I/usr/X11R6/include + + +# Add on -lsocket for solaris 2 (and perhaps other SysV's) +# +LIB=-lXext -lX11 -lm + + +# Makfile +# +OPTS=-O +OBJ=lunar +EDIT=ledit +CC=cc + + +ALL: $(OBJ) $(EDIT) + +$(OBJ): Xbit.o $(OBJ).o + $(CC) $(OPTS) $(DIRS) -o $(OBJ) $(OBJ).o Xbit.o $(LIB) + +$(EDIT): Xbit.o $(EDIT).o + $(CC) $(OPTS) $(DIRS) -o $(EDIT) $(EDIT).o Xbit.o $(LIB) + +Xbit.o: Xbit.c Xbit.h fontset.h + $(CC) $(OPTS) $(DIRS) -c Xbit.c + +$(OBJ).o: Xbit.h $(OBJ).c + $(CC) $(OPTS) $(DIRS) -c $(OBJ).c + +$(EDIT).o: Xbit.h $(EDIT).c + $(CC) $(OPTS) $(DIRS) -c $(EDIT).c + +clean: + -rm -f Xbit.o $(OBJ).o $(OBJ) $(EDIT).o $(EDIT) diff --git a/README b/README new file mode 100644 index 0000000..3f8f739 --- /dev/null +++ b/README @@ -0,0 +1,99 @@ + Lunar Lander 1.3 + Presented by Noddybox 95-05 + +You should find in the archive : + +README This file +Makefile Simple bog standard make file for lunar and ledit +lunar.c Main code +ledit.c Lever editor +LEVELS/* Example level files. See LEVELS/README for info. + Feel free to add more with ledit! +Xbit.[ch] Library routines for easy X11 Xlib access +fontset.h XImage font definitions for Xbit library +icon Icon for Xbit library + + +BUILD INSTRUCTIONS +------------------ + +Though written under FreeBSD, it should compile OK on most flavours of unix. + + +USAGE +----- + +lunar [-noshm] [scale] - Use scale to magnify and impact overly fast servers. + Use -noshm as well if your server is still too fast + to disable MIT-SHM usage. (Note shm usage will be + disabled if your server doesn't support it anyway). + + +ledit + + +LUNAR LANDER KEYS +----------------- + +Z Rotate left +C Rotate right +A Fine rotate left +D Fine rotate right +. Thrust +Q Quit (from title page), or quit back to title page +P Pause while playing +[ Zoom out of vector display +] Zoom into vector display + + +LEDIT KEYS +---------- + +Cursor left/right Previous/next object +Cursor up/down Zoom in/out +C Create new object, origin at mouse position +D Delete last object +O Set origin to mouse position +1-5 Set object type +G Set centre of screen to mouse position +H Reset centre of screen +S Save level +MB1 Add point to current object at mouse position +MB2 Delete last point in current object + +Note : 'Star effect' shows where the lander will start off. Colur coding of + objects is : + + White - Mountain + Red - Mine + Yellow - Asteroid (spinning clockwise) + Blue - Asteroid (spinning anti-clockwise) + Green - Landing pad + Cyan - Origin of current object + Flashing - Current object + + +INSTRUCTIONS +------------ + +The object of the game is to land the lander on the green landing pad, gently +enough so you don't make a crater, and the right way up! + +Everything else will either kill or hurt you. The game is up once your fuel +has reached zero. You lose 50 fuel units every time you crash, and are +refuelled with 200 units every time you land. + +Feel free to play with ledit, and improve on my dubious levels! + + +NOTES +----- + +lunar switches off auto repeat to enhance the keyboard reading when running. +Auto repeat is re-enabled when you exit the game cleanly from the title page. + +If you kill it mid-game, auto repeat will still be off. It can be re-enabled +from the shell with 'xset r on'. + + +Have Fun. diff --git a/Xbit.c b/Xbit.c new file mode 100644 index 0000000..7c2322e --- /dev/null +++ b/Xbit.c @@ -0,0 +1,1860 @@ +/* + + Xbit - Simple xlib interface + + Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + + This is a bit messy as it based on very old K&R code. + +*/ +static char rcs_id[]="$Id$"; + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "Xbit.h" + +#include "icon" + +#define WARN(x) fprintf(stderr,"%s(%d) : Warning:%s\n",__FILE__,__LINE__,x); +#define WARN1(x,y) fprintf(stderr,"%s(%d) : Warning:%s %s\n",__FILE__,__LINE__,x,y); + + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#define ABS(x) ((x) < 0 ? (-(x)) : (x)) + + +/* GLOBALS +*/ + +#define MAXPM 256 + +typedef struct WEntry +{ + Window w; + Pixmap pm[MAXPM]; + int used_MIT_SHM; + XShmSegmentInfo + shm_info; + int pmi; + int buffer; + int use_pm; + int multi; + int multino; + ulong multicls; + GC gc; + int ox; + int oy; + int ww; + int wh; + int pw; + int ph; + int func; + int lastuserfunc; + ulong lastfg; + int spline_thresh; + struct WEntry *next; +} WEntry; + + +static WEntry *whead=NULL; +static WEntry *wtail=NULL; + +static WEntry *current=NULL; + +static WEntry *stack[128]; +static int sttop; + +static Display *display=NULL; +static XVisualInfo vinfo; +static int screen; + +static int use_shm=True; + +static ulong xb_black; +static ulong xb_white; + +/* Buffer for Xprintf() and XIprintf() +*/ +static char prbuf[1024]; + +/* Definitions for XImage 8x8 charset +*/ +#include "fontset.h" + + +/* Put globals +*/ +static int no_plots; +static XPoint points[MAX_PUTPLOTS]; + + +/* Set write mode +*/ +#define WM(c) do {if ((c)!=current->func) { \ + XSetFunction(display,current->gc,c); \ + current->func=c; } } while(0) + + +/* Set foreground funcrion +*/ +#define FG(c) do {if ((c)!=current->lastfg) { \ + XSetForeground(display,current->gc,c); \ + current->lastfg=c; } } while(0) + + +/* Stack current windows +*/ +#define PUSHW do {stack[sttop++]=current;} while(0) +#define POPW do {current=stack[--sttop];} while(0) + + +/* ------------- FUNCTIONS ------------- */ + +static void CreateWEntry(Window w, GC g, int ww, int wh) +{ + WEntry *new; + + if (!(new=malloc(sizeof(WEntry)))) + { + fprintf(stderr,"%s(%d) : FATAL:%s\n",__FILE__,__LINE__, + "Couldn't malloc() WEntry"); + exit(1); + } + + if (!whead) + { + whead=new; + wtail=new; + } + else + { + wtail->next=new; + wtail=new; + } + + new->next=NULL; + + new->w=w; + new->gc=g; + + new->pm[0]=0; + new->pm[1]=0; + new->pmi=0; + new->buffer=True; + new->use_pm=True; + new->multi=False; + new->ox=0; + new->oy=0; + new->ww=ww; + new->wh=wh; + new->pw=0; + new->ph=0; + new->func=GXcopy; + new->lastuserfunc=GXcopy; + new->lastfg=-1; + new->spline_thresh=1; + new->used_MIT_SHM=False; +} + + +XImage *CreateXImage(void) +{ + XImage *img; + char *p; + + if (!use_shm) + { + if (!(p=malloc(current->pw*current->ph*(vinfo.bits_per_rgb/8)))) + { + fprintf(stderr,"%s(%d) : FATAL:%s\n",__FILE__,__LINE__, + "Couldn't malloc() XImage data"); + exit(1); + } + + img=XCreateImage + (display, + vinfo.visual, + vinfo.depth, /* Image depth */ + ZPixmap, /* Image format */ + 0, /* Offset */ + p, /* Data */ + current->pw, /* Width */ + current->ph, /* Height */ + 8, /* Bitmap pad */ + 0); + } + else + { + img=XShmCreateImage(display, + vinfo.visual, + vinfo.depth, + ZPixmap, + NULL, + &(current->shm_info), + current->pw, + current->ph); + + if (!img) + return(NULL); + + current->used_MIT_SHM=True; + + /* Get shared memory for image + */ + current->shm_info.shmid=shmget(IPC_PRIVATE, + img->bytes_per_line*img->height, + IPC_CREAT|0777); + + if (current->shm_info.shmid<0) + { + WARN("Couldn't get MITSHM mem"); + exit(1); + } + + current->shm_info.shmaddr=shmat(current->shm_info.shmid,0,0); + img->data=current->shm_info.shmaddr; + + current->shm_info.readOnly=False; + + /* Try and attached shared memory + */ + if (!XShmAttach(display,&(current->shm_info))) + { + WARN("Failed to attach MITSHM block"); + exit(1); + } + + XSync(display,False); + } + + ClsXImage(img); + return img; +} + + +void ClsXImage(XImage *img) +{ + memset(img->data,0,img->bytes_per_line*img->height); +} + + +void DestroyXImage(XImage *img) +{ + if (current->used_MIT_SHM) + { + XShmDetach(display,&(current->shm_info)); + + if (current->shm_info.shmaddr) + shmdt(current->shm_info.shmaddr); + + if (current->shm_info.shmid>=0) + shmctl(current->shm_info.shmid,IPC_RMID,0); + + current->used_MIT_SHM=False; + } + + XDestroyImage(img); + XSync(display,False); +} + + +void SetCurrentWin(Window w) +{ + WEntry *l; + + l=whead; + + while(l) + { + if (l->w==w) + { + current=l; + return; + } + + l=l->next; + } + + WARN("Asked for non-existant window"); +} + + +Window OpenWin (int argc, + char **argv, + char *title, + int wx, int wy, int ww, int wh, + int pw, int ph, + unsigned long ev, + XSizeHints *hints, + ulong *black, ulong *white) +{ + Window window; + GC gc; + char *display_name=NULL; + Pixmap icon_pixmap; + int i,j,k; + + if (!display) + { + if ((display=XOpenDisplay(display_name))==NULL) + { + fprintf(stderr,"%s: can't connect to %s\n", + argv[0], XDisplayName(display_name)); + exit(-1); + } + + /* Try and find shared memory extension + */ + use_shm=XQueryExtension(display,"MIT-SHM",&i,&j,&k); + + /* Find a nice 8-bit visual for us to use... + */ + if (!XMatchVisualInfo(display,DefaultScreen(display),8, + PseudoColor,&vinfo)) + if (!XMatchVisualInfo(display,DefaultScreen(display),16, + TrueColor,&vinfo)) + if (!XMatchVisualInfo(display,DefaultScreen(display),24, + TrueColor,&vinfo)) + if (!XMatchVisualInfo(display,DefaultScreen(display),32, + TrueColor,&vinfo)) + { + WARN("no visual found!\n"); + exit(1); + } + } + + screen=DefaultScreen(display); + + xb_black=BlackPixel(display,screen); + xb_white=WhitePixel(display,screen); + *black=xb_black; + *white=xb_white; + + window=XCreateWindow(display, + RootWindow(display,screen), + wx,wy,ww,wh,1, + vinfo.depth, + InputOutput, + vinfo.visual, + 0,NULL); + + icon_pixmap=XCreateBitmapFromData( + display, + window, + icon_bits, + icon_width,icon_height); + + XSetStandardProperties( + display, + window, + title, + title, + icon_pixmap, + argv,argc, + hints); + + XSelectInput (display,window,ev); + + gc=XCreateGC(display,window,0,NULL); + + XSetForeground(display,gc,*black); + XSetBackground(display,gc,*white); + XSetPlaneMask(display,gc,AllPlanes); + XSetGraphicsExposures(display,gc,False); + + XMapWindow (display,window); + + CreateWEntry(window,gc,ww,wh); + SetCurrentWin(window); + + Resize(pw,ph); + + return window; +} + + +Window OpenRootWin (ulong *black,ulong *white,int *w,int *h,int pw,int ph) +{ + Window window; + GC gc; + char *display_name=NULL; + int i,j,k; + + if (!display) + { + int depth; + + if ((display=XOpenDisplay(display_name))==NULL) + { + fprintf(stderr,"can't connect to %s\n",XDisplayName(display_name)); + exit(-1); + } + + screen=DefaultScreen(display); + + depth=DefaultDepth(display,screen); + + /* Try and find shared memory extension + */ + use_shm=XQueryExtension(display,"MIT-SHM",&i,&j,&k); + + /* Find a visual for us to use... + */ + if (!XMatchVisualInfo(display,DefaultScreen(display),depth, + depth==8 ? PseudoColor:TrueColor,&vinfo)) + { + WARN("no visual to match the root window!"); + exit(1); + } + } + + xb_black=BlackPixel(display,screen); + xb_white=WhitePixel(display,screen); + *black=xb_black; + *white=xb_white; + + window=RootWindow(display,screen); + + gc=XCreateGC(display,window,0,NULL); + + XSetForeground(display,gc,*black); + XSetBackground(display,gc,*white); + XSetPlaneMask(display,gc,AllPlanes); + + XMapWindow (display,window); + + *w=DisplayWidth(display,screen); + *h=DisplayHeight(display,screen); + + CreateWEntry(window,gc,*w,*h); + SetCurrentWin(window); + + Resize(pw,ph); + + return window; +} + + +XFontStruct *XUseFont(const char *n) +{ + XFontStruct *ft; + + if (ft=XLoadQueryFont(display,n)) + XSetFont(display,current->gc,ft->fid); + else + WARN1("couldn't load font:",n); + + return ft; +} + + +void XUseCursor(const char *bm, const char *mask, XColor fg, XColor bg) +{ + Pixmap b,m; + Cursor curs; + int bmw,bmh,bmx,bmy; + int maskw,maskh,maskx,masky; + + if (XReadBitmapFile(display,current->w,bm,&bmw,&bmh,&b,&bmx,&bmy) + ==BitmapOpenFailed) + { + WARN1("Couldn't read in cursor file:",bm); + return; + } + + if (XReadBitmapFile(display,current->w,mask,&maskw,&maskh,&m,&maskx,&masky) + ==BitmapOpenFailed) + { + WARN1("Couldn't read in mask file:",bm); + return; + } + + curs=XCreatePixmapCursor(display,b,m,&fg,&bg,bmx,bmy); + + XDefineCursor(display,current->w,curs); + + XFreePixmap(display,b); + XFreePixmap(display,m); +} + + +void LoadBitmap(const char *fn,int x,int y, int resize) +{ + Pixmap bm; + int w,h,hx,hy; + int cw,ch; + + if (!current->use_pm) + { + WARN("Need pixmaps to load in bitmap"); + } + + if (XReadBitmapFile(display,current->w,fn,&w,&h,&bm,&hx,&hy) + ==BitmapOpenFailed) + { + WARN1("Couldn't read in bitmap file:",fn); + return; + } + + if ((w!=current->pw)||(h!=current->ph)) + { + if (resize) + { + Resize(w+x,h+y); + cw=w; + ch=h; + } + else + { + cw=current->pw-x; + ch=current->ph-y; + } + } + + XCopyPlane(display,bm,current->pm[current->pmi], + current->gc,0,0,cw,ch,x,y,1L); + + XFreePixmap(display,bm); +} + + +Pixmap GetBitmap(const char *fn, int *w, int *h, int *hx, int *hy) +{ + Pixmap bm,ret; + + if (XReadBitmapFile(display,current->w,fn,w,h,&bm,hx,hy) + ==BitmapOpenFailed) + { + WARN1("Couldn't read in bitmap file:",fn); + return(0); + } + + ret=XCreatePixmap(display,current->w,*w,*h,DefaultDepth(display,0)); + + XCopyPlane(display,bm,ret,current->gc,0,0,*w,*h,0,0,1L); + + XFreePixmap(display,bm); + + return ret; +} + + +void DrawXImage(XImage *img) +{ + if (use_shm) + XShmPutImage (display, + current->pm[0], + current->gc, + img, + 0,0, + 0,0, + current->pw,current->ph, + False); + else + XPutImage (display, + current->pm[0], + current->gc, + img, + 0,0, + 0,0, + current->pw,current->ph); +} + + +void Resize(int w,int h) +{ + int f; + + if (www) + w=current->ww; + + if (hwh) + h=current->wh; + + current->pw=w; + current->ph=h; + + if (!current->use_pm) + return; + + if (current->multi) + { + WM(GXcopy); + FG(current->multicls); + for(f=0;fmultino;f++) + { + XFreePixmap(display,current->pm[f]); + current->pm[f]=XCreatePixmap(display,current->w,w,h, + DefaultDepth(display,0)); + XFillRectangle(display,current->pm[f], + current->gc,0,0,current->pw,current->ph); + } + WM(current->lastuserfunc); + return; + } + + if (current->pm[0]) + { + XFreePixmap(display,current->pm[0]); + + if (current->buffer) + XFreePixmap(display,current->pm[1]); + } + + current->pmi=0; + + current->pm[0]=XCreatePixmap(display,current->w,w,h, + DefaultDepth(display,0)); + + if (current->buffer) + current->pm[1]=XCreatePixmap(display,current->w,w,h, + DefaultDepth(display,0)); +} + + +void Redraw(int x,int y) +{ + if ((x+current->ww)>current->pw) + x=current->pw-current->ww; + + if ((y+current->wh)>current->ph) + y=current->ph-current->wh; + + current->ox=x; + current->oy=y; + + if (!current->use_pm) + { + XSync(display,False); + return; + } + + WM(GXcopy); + + if (current->buffer) + { + XCopyArea(display,current->pm[current->pmi^1],current->w, + current->gc,x,y,current->ww,current->wh,0,0); + XSync(display,False); + } + else + { + XCopyArea(display,current->pm[current->pmi],current->w, + current->gc,x,y,current->ww,current->wh,0,0); + XSync(display,False); + } + + WM(current->lastuserfunc); +} + + +Pixmap GetCurrentPixmap(void) + +{ + if (!current->use_pm) + return(0); + + return current->pm[current->pmi]; +} + +GC GetCurrentGC(void) + +{ + return current->gc; +} + + +void DisableDoubleBuffer(void) + +{ + current->pmi=0; + XFreePixmap(display,current->pm[1]); + current->buffer=False; +} + + +void DisablePixmap(void) + +{ + current->pmi=0; + + if (current->use_pm) + XFreePixmap(display,current->pm[0]); + + if (current->buffer) + XFreePixmap(display,current->pm[1]); + + current->buffer=False; + current->use_pm=False; + current->pm[0]=current->w; +} + + +void DisableShm(void) +{ + use_shm=False; +} + + +void EnableBuffers(int no, ulong clscol) +{ + int f; + + current->pmi=0; + + if (current->use_pm) + XFreePixmap(display,current->pm[0]); + + if (current->buffer) + XFreePixmap(display,current->pm[1]); + + current->buffer=False; + current->use_pm=True; + current->multi=True; + + if (no>MAXPM) + current->multino=MAXPM; + else + current->multino=no; + + current->multicls=clscol; + + WM(GXcopy); + FG(current->multicls); + for(f=0;fmultino;f++) + { + current->pm[f]=XCreatePixmap(display,current->w,current->ww,current->wh, + DefaultDepth(display,0)); + XFillRectangle(display,current->pm[f], + current->gc,0,0,current->pw,current->ph); + } + + WM(current->lastuserfunc); +} + + +void Pageflip(void) +{ + if (current->buffer) + current->pmi=current->pmi^1; + + if (current->multi) + if ((++current->pmi)>=current->multino) + current->pmi=0; +} + + +void SetAsBackdrop(void) +{ + XSetWindowBackgroundPixmap (display, current->w, current->pm[current->pmi]); + XSync(display,False); +} + + +void XUseFunction(int f) +{ + WM(f); + current->lastuserfunc=f; +} + + +void XSetLineStyle(unsigned int w, int ls, int cs, int js) +{ + XSetLineAttributes(display,current->gc,w,ls,cs,js); +} + + +void XCls(ulong c) +{ + if (current->use_pm) + { + WM(GXcopy); + FG(c); + XFillRectangle(display,current->pm[current->pmi], + current->gc,0,0,current->pw,current->ph); + WM(current->lastuserfunc); + } + else + { + /* + XSetBackground(display,current->gc,c); + XClearWindow(display,current->pm[0]); + */ + WM(GXcopy); + FG(c); + XFillRectangle(display,current->pm[current->pmi], + current->gc,0,0,current->pw,current->ph); + WM(current->lastuserfunc); + } +} + + +void XPlot(int x,int y, ulong c) +{ + FG(c); + XDrawPoint(display,current->pm[current->pmi],current->gc,x,y); +} + + +void XLine(int x1,int y1,int x2,int y2, ulong c) +{ + FG(c); + XDrawLine(display,current->pm[current->pmi],current->gc,x1,y1,x2,y2); +} + + +void SetSplineThresh(int t) +{ + current->spline_thresh=t; +} + + +static void XDoSpline(int x0,int y0,int x1,int y1,int x2,int y2,ulong c) +{ + int xa, ya, xb, yb, xc, yc, xp, yp; + + if ((x0==x1==x2)&&(y0==y1==y2)) + { + XPlot(x0,y0,c); + return; + } + + if ((x0==x1)&&(y0==y1)) + { + XLine(x1,y1,x2,y2,c); + return; + } + + if ((x0==x2)&&(y0==y2)) + { + XLine(x0,y0,x1,y1,c); + return; + } + + if ((x1==x2)&&(y1==y2)) + { + XLine(x0,y0,x2,y2,c); + return; + } + + xa = ( x0 + x1 ) / 2; + ya = ( y0 + y1 ) / 2; + xc = ( x1 + x2 ) / 2; + yc = ( y1 + y2 ) / 2; + xb = ( xa + xc ) / 2; + yb = ( ya + yc ) / 2; + + xp = ( x0 + xb ) / 2; + yp = ( y0 + yb ) / 2; + + if ( ABS( xa - xp ) + ABS( ya - yp ) > current->spline_thresh ) + XDoSpline(x0,y0,xa,ya,xb,yb,c); + else + XDrawLine(display,current->pm[current->pmi],current->gc,x0,y0,xb,yb); + + xp = ( x2 + xb ) / 2; + yp = ( y2 + yb ) / 2; + if ( ABS( xc - xp ) + ABS( yc - yp ) > current->spline_thresh ) + XDoSpline(xb,yb,xc,yc,x2,y2,c); + else + XDrawLine(display,current->pm[current->pmi],current->gc,xb,yb,x2,y2); +} + + +void XSpline(int x1,int y1,int x2,int y2,int x3,int y3,ulong c) +{ + FG(c); + + if ((x1==x2==x3)&&(y1==y2==y3)) + { + XPlot(x1,y1,c); + return; + } + + if ((x1==x2)&&(y1==y2)) + { + XLine(x2,y2,x3,y3,c); + return; + } + + if ((x1==x3)&&(y1==y3)) + { + XLine(x1,y1,x2,y2,c); + return; + } + + if ((x2==x3)&&(y2==y3)) + { + XLine(x1,y1,x3,y3,c); + return; + } + + XDoSpline(x1,y1,x2,y2,x3,y3,c); +} + + +void XPrint(int x,int y, const char *s, ulong c) + +{ + FG(c); + XDrawString(display,current->pm[current->pmi],current->gc,x,y,s,strlen(s)); +} + + +void Xprintf(int x, int y, ulong colour, const char *fmt, ...) +{ + va_list va; + + va_start(va,fmt); + vsprintf(prbuf,fmt,va); + va_end(va); + + FG(colour); + XDrawString(display,current->pm[current->pmi],current->gc, + x,y,prbuf,strlen(prbuf)); +} + + +void XISetFont(XImageFont n) +{ + switch(n) + { + case XI_FONT1: + xifont=xifont1; + break; + case XI_FONT2: + xifont=xifont2; + break; + } +} + + +static void XIPlot(XImage *img,int x,int y, ulong c) +{ + if ((y<0)||(y>=img->height)||(x<0)||(x>=img->width)) + return; + + XPutPixel(img,x,y,c); +} + + +void XIprintf(XImage *img, int x, int y, int sx, int sy, ulong col, + const char *fmt, ...) +{ + int f,px,py,psx,psy,ch; + char *data; + va_list arg; + + va_start(arg,fmt); + vsprintf(prbuf,fmt,arg); + va_end(arg); + + if ((sx==1)&&(sy==1)) + { + for(f=0;f=0)&&(y+pyheight)) + for(px=0;px=0)&&(x+pxwidth)) + if (xifont[ch].data[py][px]) + XPutPixel(img,x+px,y+py,col); + + x+=XIFONTW; + } + } + else + { + for(f=0;fpm[current->pmi],current->gc,x,y,w,h); +} + + +void XFillBox(int x,int y,int w,int h,ulong c) +{ + FG(c); + XFillRectangle(display,current->pm[current->pmi],current->gc,x,y,w,h); +} + + +void XCircle(int x,int y,int rx,int ry,int a1,int a2,ulong c) +{ + FG(c); + XDrawArc(display,current->pm[current->pmi],current->gc,x,y,rx,ry,a1,a2); +} + + +void XFillCircle(int x,int y,int rx,int ry,int a1,int a2,ulong c) +{ + FG(c); + XFillArc(display,current->pm[current->pmi],current->gc,x,y,rx,ry,a1,a2); +} + + +void XStartPlots(void) +{ + no_plots=0; +} + + +void XAddPlot(int x,int y) +{ + points[no_plots].x=x; + points[no_plots].y=y; + + no_plots++; +} + + +void XPutPlots(ulong c) +{ + FG(c); + XDrawPoints(display,current->pm[current->pmi],current->gc, + points,no_plots,CoordModeOrigin); +} + + +void XPutPlotsAsLines(ulong c) +{ + FG(c); + XDrawLines(display,current->pm[current->pmi],current->gc, + points,no_plots,CoordModeOrigin); +} + + +void XFillPoly(XPoint *xp,int n,int shape,ulong c) +{ + FG(c); + XFillPolygon(display,current->pm[current->pmi],current->gc,xp,n, + shape,CoordModeOrigin); +} + + +void XScroll(int dx,int dy) +{ + int destx,desty,srcx,srcy; + int w,h; + + if (dx>=0) + { + destx=0; + srcx=dx; + w=current->pw-dx; + } + + if (dx<0) + { + destx=-(dx); + srcx=0; + w=current->pw+dx; + } + + if (dy>=0) + { + desty=0; + srcy=dy; + h=current->ph-dy; + } + + if (dy<0) + { + desty=-(dy); + srcy=0; + h=current->ph+dy; + } + + WM(GXcopy); + XCopyArea(display,current->pm[current->pmi],current->pm[current->pmi], + current->gc,srcx,srcy,current->pw-dx,current->ph,destx,desty); + WM(current->lastuserfunc); +} + + +void XCopy(int sx,int sy,int w,int h,int dx,int dy) +{ + WM(GXcopy); + XCopyArea(display,current->pm[current->pmi],current->pm[current->pmi], + current->gc,sx,sy,current->pw,current->ph,dx,dy); + WM(current->lastuserfunc); +} + + +void XPut(Pixmap spm,int sx,int sy,int w,int h,int dx,int dy) +{ + WM(GXcopy); + XCopyArea(display,spm,current->pm[current->pmi], + current->gc,sx,sy,w,h,dx,dy); + WM(current->lastuserfunc); +} + + +void XGet(Pixmap dpm,int sx,int sy,int w,int h,int dx,int dy) +{ + WM(GXcopy); + XCopyArea(display,dpm,current->pm[current->pmi], + current->gc,sx,sy,w,h,dx,dy); + WM(current->lastuserfunc); +} + + +void ScreenCopy(void) +{ + if (current->buffer) + { + WM(GXcopy); + XCopyArea(display,current->pm[current->pmi^1], + current->pm[current->pmi],current->gc,0,0, + current->pw,current->ph,0,0); + WM(current->lastuserfunc); + } +} + + +Display *GetDisplay(void) +{ + return display; +} + + + +void XFinished(void) +{ + XCloseDisplay(display); +} + + +void XDoTillButtonPress(XVoidCallback func) +{ + XEvent event; + int ignore=True; + + while (True) + if (XPending(display)) + { + XNextEvent(display,&event); + + switch (event.type) + { + case Expose: + if (event.xexpose.count) + break; + Redraw(current->ox,current->oy); + break; + + case ButtonPress: + if (event.xbutton.button) + if (!ignore) + return; + break; + } + } + else + if (func) + switch (func()) + { + case XFUNCCONT: + ignore=False; + break; + + case XFUNCIGNORE: + ignore=True; + break; + + case XFUNCSTOP: + return; + break; + } + +} + + +void XDoMouse(XButtonCallback button, XMoveCallBack move, XVoidCallback process) +{ + XEvent event; + + while (True) + if ((XPending(display))||(!process)) + { + XNextEvent(display,&event); + + switch (event.type) + { + case Expose: + if (event.xexpose.count) + break; + Redraw(current->ox,current->oy); + break; + + case MotionNotify: + if (move) + switch(move(event.xmotion.window, + event.xmotion.x,event.xmotion.y)) + { + case XFUNCSTOP: + return; + break; + } + break; + + case ButtonPress: + if (button) + switch(button(event.xbutton.window,XPRESS, + event.xbutton.button, + event.xbutton.x,event.xbutton.y)) + { + case XFUNCSTOP: + return; + break; + } + break; + } + } + else + if (process) + switch (process()) + { + case XFUNCCONT: + case XFUNCIGNORE: + break; + + case XFUNCSTOP: + return; + break; + } + +} + + +static int IsMoveWin(Window w, XWindowMoveCallBack call[] ,int *i) +{ + int f; + + if (!call) + { + return(False); + } + + f=0; + + while(call[f].w) + { + if (call[f].w==w) + { + *i=f; + return call[f].func ? True:False; + } + else + { + f++; + } + } + + return False; +} + + +static int IsButtonWin(Window w, XWindowButtonCallback call[] ,int *i) +{ + int f; + + if (!call) + { + return(False); + } + + f=0; + + while(call[f].w) + { + if (call[f].w==w) + { + *i=f; + return call[f].func ? True:False; + } + else + { + f++; + } + } + + return False; +} + + +static int IsKeyWin(Window w, XWindowKeyCallback call[] ,int *i) +{ + int f; + + if (!call) + { + return(False); + } + + f=0; + + while(call[f].w) + { + if (call[f].w==w) + { + *i=f; + return call[f].func ? True:False; + } + else + { + f++; + } + } + + return False; +} + + +void XDoWindows(XWindowButtonCallback button[], + XWindowMoveCallBack move[], + XWindowKeyCallback key[], + XVoidCallback process) +{ + int i; + XEvent event; + + while (True) + if ((XPending(display))||(!process)) + { + XNextEvent(display,&event); + + switch (event.type) + { + case Expose: + if (event.xexpose.count) + break; + + PUSHW; + SetCurrentWin(event.xexpose.window); + Redraw(current->ox,current->oy); + POPW; + + break; + + case MotionNotify: + if (IsMoveWin(event.xmotion.window,move,&i)) + { + switch(move[i].func(event.xmotion.window, + event.xmotion.x, + event.xmotion.y)) + { + case XFUNCSTOP: + return; + break; + } + } + break; + + case ButtonPress: + if (IsButtonWin(event.xbutton.window,button,&i)) + { + switch(button[i].func + (event.xbutton.window, + XPRESS, + event.xbutton.button, + event.xbutton.x,event.xbutton.y)) + { + case XFUNCSTOP: + return; + break; + } + } + break; + + case ButtonRelease: + if (IsButtonWin(event.xbutton.window,button,&i)) + { + switch(button[i].func + (event.xbutton.window, + XRELEASE, + event.xbutton.button, + event.xbutton.x,event.xbutton.y)) + { + case XFUNCSTOP: + return; + break; + } + } + break; + + case KeyPress: + if (IsKeyWin(event.xkey.window,key,&i)) + { + switch(key[i].func(event.xkey.window, + XPRESS, + &event)) + { + case XFUNCSTOP: + return; + break; + } + } + break; + + case KeyRelease: + if (IsKeyWin(event.xkey.window,key,&i)) + { + switch(key[i].func(event.xkey.window, + XRELEASE, + &event)) + { + case XFUNCSTOP: + return; + break; + } + } + break; + + default: + break; + } + } + else + if (process) + { + switch (process()) + { + case XFUNCCONT: + case XFUNCIGNORE: + break; + + case XFUNCSTOP: + return; + break; + } + } +} + + +/* Sprite routines */ +void LoadSprite(const char *fn, XSprite *spr, const XColor xc[256]) +{ + Pixmap piximg,pixmask,pixsave; + int fd,x,y; + char magic[11]; + unsigned char *data,*p; + unsigned short us; + GC gc; + + if ((fd=open(fn,O_RDONLY))==-1) + { + WARN1("Couldn't open sprite file",fn); + return; + } + + read(fd,magic,11); + + if (strncmp(magic,"XbitSprite",10)) + { + WARN1(fn,"is not a sprite file!"); + close(fd); + return; + } + + spr->x=spr->y=0; + + read(fd,&us,sizeof(unsigned short)); + spr->w=ntohs(us); + read(fd,&us,sizeof(unsigned short)); + spr->h=ntohs(us); + + if (!(data=malloc(spr->w*spr->h))) + { + WARN("Couldn't grab memory for sprite image"); + close(fd); + return; + } + + if (read(fd,data,spr->w*spr->h)!=spr->w*spr->h) + { + WARN("Couldn't load sprite image"); + close(fd); + free(data); + return; + } + + close(fd); + + gc=XCreateGC(display,current->w,0,NULL); + + XSetPlaneMask(display,gc,AllPlanes); + XSetGraphicsExposures(display,gc,False); + + piximg=XCreatePixmap(display,current->w,spr->w,spr->h,vinfo.depth); + pixmask=XCreatePixmap(display,current->w,spr->w,spr->h,vinfo.depth); + pixsave=XCreatePixmap(display,current->w,spr->w,spr->h,vinfo.depth); + + p=data; + + for(y=0;yh;y++) + { + for(x=0;xw;x++) + { + XSetForeground(display,gc,xc[*p].pixel); + XDrawPoint(display,piximg,gc,x,y); + + if (*p) + XSetForeground(display,gc,xb_white); + else + XSetForeground(display,gc,xb_black); + + XDrawPoint(display,pixmask,gc,x,y); + + p++; + } + } + + spr->data=piximg; + spr->mask=pixmask; + spr->save=pixsave; + + free(data); +} + + +void XDrawSprites(XSprite *spr[],int no, XSpriteControl ctl) +{ + int f; + + WM(GXcopy); + + if (!(ctl&XSPRNOSAVE)) + for(f=0;fbuffer) + { + spr[f]->lx=spr[f]->x; + spr[f]->ly=spr[f]->y; + XCopyArea(display,current->pm[current->pmi^1], + spr[f]->save,current->gc,spr[f]->x,spr[f]->y, + spr[f]->w,spr[f]->h,0,0); + } + else + { + spr[f]->lx=spr[f]->x; + spr[f]->ly=spr[f]->y; + XCopyArea(display,current->pm[current->pmi], + spr[f]->save,current->gc,spr[f]->x,spr[f]->y, + spr[f]->w,spr[f]->h,0,0); + } + + WM(GXand); + for(f=0;fbuffer) + XCopyArea(display,spr[f]->mask,current->pm[current->pmi^1], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y); + else + XCopyArea(display,spr[f]->mask,current->pm[current->pmi], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y); + + WM(GXor); + for(f=0;fbuffer) + XCopyArea(display,spr[f]->data,current->pm[current->pmi^1], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y); + else + XCopyArea(display,spr[f]->data,current->pm[current->pmi], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y); + + WM(current->lastuserfunc); +} + + +void XEraseSprites(XSprite *spr[],int no) +{ + int f; + + WM(GXcopy); + + for(f=0;fbuffer) + XCopyArea(display,spr[f]->save,current->pm[current->pmi^1], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->lx,spr[f]->ly); + else + XCopyArea(display,spr[f]->save,current->pm[current->pmi], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->lx,spr[f]->ly); + + WM(current->lastuserfunc); +} + + +void LoadColormap(const char *fn, XColor xc[256]) +{ + int fd,f; + unsigned short us; + + if ((fd=open(fn,O_RDONLY))==-1) + { + WARN1("Couldn't open cmap",fn); + return; + } + + for(f=0;f<256;f++) + { + xc[f].pixel=f; + xc[f].flags=DoRed|DoGreen|DoBlue; + read(fd,&us,sizeof(unsigned short)); + xc[f].red=ntohs(us); + read(fd,&us,sizeof(unsigned short)); + xc[f].green=ntohs(us); + read(fd,&us,sizeof(unsigned short)); + xc[f].blue=ntohs(us); + } +} + + +void AllocColors(int no,ulong pix[],const char *name[]) +{ + int f,col; + XColor xc; + + for(f=0;f(0x8000*3)) + { + WARN("defaulting to white"); + pix[f]=WhitePixel(display,screen); + } + else + { + WARN("defaulting to black"); + pix[f]=BlackPixel(display,screen); + } + } + } + else + { + WARN1("not a color ",name[f]); + pix[f]=WhitePixel(display,screen); + } + } +} + + +void AllocColorsRGB(int no, ulong pix[], const Colour col[]) +{ + int f; + XColor xc; + + for(f=0;f(0x8000*3)) + { + WARN("defaulting to white"); + pix[f]=WhitePixel(display,screen); + } + else + { + WARN("defaulting to black"); + pix[f]=BlackPixel(display,screen); + } + } + } +} + + +void LoadSpriteDataSet (const char *cmapfn, + const char *sprfn[], + SpriteDataSet *set) +{ + int f,r,fd; + char magic[11]; + XColor xcol[256]; + Colour col[256]; + SpriteData *spr; + int no; + int used[256]; + unsigned short us; + unsigned char byte; + + + /* Allocate referenced table + */ + for(f=0;f<256;f++) + used[f]=-1; + + /* Count and allocate referenced sprites + */ + no=0; + while(sprfn[no]) + no++; + + /* Load in colourmap + */ + LoadColormap(cmapfn,xcol); + + set->no_col=0; + set->no_spr=no; + + /* Load in sprites and sort out colour usage + */ + spr=malloc(sizeof(SpriteData)*no); + + for(f=0;fno_col].r=xcol[byte].red; + col[set->no_col].g=xcol[byte].green; + col[set->no_col].b=xcol[byte].blue; + + used[byte]=set->no_col++; + } + + spr[f].data[r]=used[byte]; + } + + close(fd); + } + + /* Got all sprites - allocate and remap colours + */ + AllocColoursRGB(set->no_col,set->pix,col); + + /* Remap sprites + */ + for(f=0;fpix[spr[f].data[r]]; + + /* Set up return, all done + */ + set->spr=spr; +} + + +/* END OF FILE */ diff --git a/Xbit.h b/Xbit.h new file mode 100644 index 0000000..0804b55 --- /dev/null +++ b/Xbit.h @@ -0,0 +1,594 @@ +/* + + lunar - Simple X11 Lunar Lander + + Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + +*/ + +#ifndef XBIT_H +#define XBIT_H "$Id$" + + +/* + Version 2 of the Bitmap manipulation library for X + + Now supports : + + Multiple windows + Pixmaps bigger than the window + Mutiple pixmap buffers (upto a maxim of 256 per window) + XImage print routines + Better XImage support, defaulting to shared memory usage. + + IMPORTANT NOTES ON MIT-SHM SUPPORT : + + 1. Only call CreateXImage() ONCE per window. + + 2. If you wish resources to be freed properly on completion, it + is important that DestroyXImage() is called before exiting + with the window the XImage was created in relation to set + as the current window. + + 3. Allow the user to toggle MIT-SHM from a switch, as if the + server supports it, but using it is failing for some other + reason, then your program will be unable to run. + +*/ +#include +#include + + +/* Just as I'm a lazy typer +*/ +typedef unsigned char uchar; +typedef unsigned long ulong; + + +/* Maximums for PutPlots() +*/ +#define MAX_PUTPLOTS 4096 + + +/* Types and constants +*/ +#define MIN_ANG 0 +#define MAX_ANG 23040 + +typedef enum +{ + XFUNCCONT, + XFUNCIGNORE, + XFUNCSTOP +} XFuncControl; + +typedef struct +{ + int x,y; + unsigned short w,h; + int lx,ly; /* This field is 'private' */ + Pixmap data; /* This field is 'private' */ + Pixmap mask; /* This field is 'private' */ + Pixmap save; /* This field is 'private' */ +} XSprite; + +typedef enum +{ + XSPRSAVE, + XSPRNOSAVE +} XSpriteControl; + + +typedef struct +{ + int r,g,b; +} Colour; + +typedef Colour Color; + + +typedef enum +{ + XPRESS, + XRELEASE +} XPressRelease; + + +typedef XFuncControl (*XVoidCallback)(void); +typedef XFuncControl (*XMoveCallBack)(Window w, int x, int y); +typedef XFuncControl (*XButtonCallback)(Window w, XPressRelease mode, + int button, int x, int y); +typedef XFuncControl (*XKeyCallback)(Window w, XPressRelease mode, + XEvent *event); + +typedef struct +{ + Window w; + XMoveCallBack func; +} XWindowMoveCallBack; + +typedef struct +{ + Window w; + XButtonCallback func; +} XWindowButtonCallback; + +typedef struct +{ + Window w; + XKeyCallback func; +} XWindowKeyCallback; + + +/* XImage font defs +*/ +typedef enum +{ + XI_FONT1, + XI_FONT2 +} XImageFont; + + +/* Portable sprite data definitions - allows sprite data and colormap data to + be read from a list of files, returning + an array of RGB triplets defining the + colormap, and array of pixels + corresponding to those colours and a + series of sprite images with converted + pixel values. This means you can use + data normally read in just for the + XSprite routines on any format of display + mechanism. +*/ +#define SPRD_AT(spr,x,y) (*(spr.data+(x)+((y)*(spr.w)))) + +typedef struct +{ + int w,h; /* Width, height */ + ulong *data; /* Data */ +} SpriteData; + +typedef struct +{ + int no_col; /* No of colours used by sprites */ + ulong pix[256]; /* Array of pixel values */ + int no_spr; + SpriteData *spr; /* Array of sprite data */ +} SpriteDataSet; + + +/* Function Prototypes +*/ + +Window OpenWin + ( + int argc, + char *argv[], + char *title, + int Win_X, + int Win_Y, + int Win_Width, + int Win_Height, + int Pix_Width, + int Pix_Height, + unsigned long event_mask, + XSizeHints *hints, + ulong *black, + ulong *white + ); + +Window OpenRootWin + ( + ulong *black, ulong *white, + int *w, int *h, int Pix_Width, int Pix_Height + ); + +void SetCurrentWin + ( + Window w + ); + +XImage *CreateXImage(void); + +void ClsXImage + ( + XImage *img + ); + +void DestroyXImage + ( + XImage *img + ); + +XFontStruct + *XUseFont + ( + const char *font_name + ); + +void XUseCursor + ( + const char *bitmap_filename, + const char *mask_filename, + XColor fg, + XColor bg + ); + +void SetAsBackdrop(void); + +void DisableDoubleBuffer(void); + +void DisablePixmap(void); + +void DisableShm(void); + +void EnableBuffers + ( + int no, + ulong clscol + ); + +void LoadBitmap + ( + const char *fn, + int x, + int y, + int resize + ); + +Pixmap GetBitmap + ( + const char *fn, + int *width, + int *height, + int *hot_x, + int *hot_y + ); + +/* These 2 are for manipulating your own XImage structures +*/ +Pixmap GetCurrentPixmap(void); +GC GetCurrentGC(void); + +void Redraw + ( + int off_x, + int off_y + ); + +void DrawXImage + ( + XImage *img + ); + +/* Note that if this used with EnableBuffers() on, this will move to the next + buffer +*/ +void Pageflip(void); + +void Resize + ( + int pix_w, + int pix_h + ); + +void XSetLineStyle + ( + unsigned int line_width, + int line_style, + int cap_style, + int join_style + ); + +void XUseFunction + ( + int GC_function + ); + +void XCls + ( + ulong colour + ); + +void XPlot + ( + int x, + int y, + ulong colour + ); + +void XLine + ( + int x1, + int y1, + int x2, + int y2, + ulong colour + ); + +void SetSplineThresh + ( + int thresh + ); + +void XSpline + ( + int x1, + int y1, + int x2, + int y2, + int x3, + int y3, + ulong colour + ); + +void XPrint + ( + int x, + int y, + const char *string, + ulong colour + ); + +void Xprintf + ( + int x, + int y, + ulong colour, + const char *fmt, + ... + ); + +void XISetFont + ( + XImageFont font_no + ); + +void XIprintf + ( + XImage *img, + int x, + int y, + int scale_x, + int scale_y, + ulong colour, + const char *fmt, + ... + ); + +void XBox + ( + int x, + int y, + int w, + int h, + ulong colour + ); + +void XFillBox + ( + int x, + int y, + int w, + int h, + ulong colour + ); + +void XCircle + ( + int x, + int y, + int rx, + int ry, + int ang1, + int ang2, + ulong colour + ); + +void XFillCircle + ( + int x, + int y, + int rx, + int ry, + int ang1, + int ang2, + ulong colour + ); + +void XStartPlots(void); + +void XAddPlot + ( + int x, + int y + ); + +void XPutPlots + ( + ulong col + ); + +void XPutPlotsAsLines + ( + ulong col + ); + +void XFillPoly + ( + XPoint xp[], + int no_points, + int shape, + ulong col + ); + +void XScroll + ( + int dx, + int dy + ); + +void XCopy + ( + int srcx, + int srcy, + int w, + int h, + int destx, + int desty + ); + +void XPut + ( + Pixmap src, + int srcx, + int srcy, + int w, + int h, + int destx, + int desty + ); + +void XGet + ( + Pixmap dest, + int srcx, + int srcy, + int w, + int h, + int destx, + int desty + ); + +void ScreenCopy(void); + +Display *GetDisplay(void); + +void XFinished(void); + +/* The following event routines expect mouse events to be set in the + event mask */ + +void XDoTillButtonPress + ( + XVoidCallback func + ); + +void XDoMouse + ( + XButtonCallback mouse_button, + XMoveCallBack mouse_movement, + XVoidCallback process + ); + +void XDoWindows + ( + XWindowButtonCallback mouse_button[], + XWindowMoveCallBack mouse_movement[], + XWindowKeyCallback key_press[], + XFuncControl (*process) () + ); + + +/* Sprite routines */ +void LoadSprite + ( + const char *filename, + XSprite *sprite, + const XColor xc[256] + ); + + +void XDrawSprites + ( + XSprite *sprites[], + int no, + XSpriteControl control + ); + +void XEraseSprites + ( + XSprite *sprites[], + int no + ); + +void LoadColormap + ( + const char *filename, + XColor xc[256] + ); + +#define AllocColors AllocColours +void AllocColours + ( + int no, + ulong pixels[], + const char *colname[] + ); + +#define AllocColorsRGB AllocColoursRGB +void AllocColoursRGB + ( + int no, + ulong pixels[], + const Colour cols[] + ); + +void LoadSpriteDataSet + ( + const char *cmap_filename, + const char *sprite_filenames[], + SpriteDataSet *set + ); + + +/* + + File Formats: + + NB: all ushorts are stored in network format. See ntohs(3). + + Colormap: + + red.ushort - Red component color 0 + green.ushort - Red component color 0 + blue.ushort - Red component color 0 + ... + ... + red.ushort - Red component color 255 + green.ushort - Red component color 255 + blue.ushort - Red component color 255 + + + Sprite: + + "XbitSprite" - Magic string (NULL terminated) + width.ushort - width of sprite + height.ushort - height of sprite + byte.uchar - Pixel value for (0,0) + byte.uchar - Pixel value for (1,0) + ... + ... + byte.uchar - Pixel value for (width-1,height-1) + +*/ + +#endif + +/* END OF FILE */ diff --git a/fontset.h b/fontset.h new file mode 100644 index 0000000..d7eb76f --- /dev/null +++ b/fontset.h @@ -0,0 +1,2020 @@ +#ifndef XIFONTW + +#define XIFONTW 8 +#define XIFONTH 8 + +#define NULLCHARDEF {{ \ + {1,1,1,1,1,1,1,0,}, \ + {1,0,0,0,0,0,1,0,}, \ + {1,0,1,1,1,0,1,0,}, \ + {1,0,1,0,1,0,1,0,}, \ + {1,0,1,1,1,0,1,0,}, \ + {1,0,0,0,0,0,1,0,}, \ + {1,1,1,1,1,1,1,0,}, \ + {0,0,0,0,0,0,0,0,}, \ + }} + +typedef struct + { + char data[XIFONTH][XIFONTW]; + } FontChar; + +FontChar xifont1[128] = + { + NULLCHARDEF, /* 00 */ + NULLCHARDEF, /* 01 */ + NULLCHARDEF, /* 02 */ + NULLCHARDEF, /* 03 */ + NULLCHARDEF, /* 04 */ + NULLCHARDEF, /* 05 */ + NULLCHARDEF, /* 06 */ + NULLCHARDEF, /* 07 */ + NULLCHARDEF, /* 08 */ + NULLCHARDEF, /* 09 */ + NULLCHARDEF, /* 0a */ + NULLCHARDEF, /* 0b */ + NULLCHARDEF, /* 0c */ + NULLCHARDEF, /* 0d */ + NULLCHARDEF, /* 0e */ + NULLCHARDEF, /* 0f */ + NULLCHARDEF, /* 10 */ + NULLCHARDEF, /* 11 */ + NULLCHARDEF, /* 12 */ + NULLCHARDEF, /* 13 */ + NULLCHARDEF, /* 14 */ + NULLCHARDEF, /* 15 */ + NULLCHARDEF, /* 16 */ + NULLCHARDEF, /* 17 */ + NULLCHARDEF, /* 18 */ + NULLCHARDEF, /* 19 */ + NULLCHARDEF, /* 1a */ + NULLCHARDEF, /* 1b */ + NULLCHARDEF, /* 1c */ + NULLCHARDEF, /* 1d */ + NULLCHARDEF, /* 1e */ + NULLCHARDEF, /* 1f */ + + {{ /* 20 ' ' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 21 '!' */ + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 22 '"' */ + {0,1,1,0,0,1,1,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 23 '#' */ + {0,1,1,0,1,1,0,0,}, + {0,1,1,0,1,1,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 24 '$' */ + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,1,1,1,0,}, + {0,1,0,1,1,0,0,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,1,1,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 25 '%' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,1,1,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 26 '&' */ + {0,1,1,1,1,0,0,0,}, + {1,1,0,0,1,1,0,0,}, + {1,1,0,0,1,1,0,0,}, + {0,1,1,1,1,0,0,0,}, + {1,1,0,0,1,0,1,0,}, + {1,1,0,0,0,1,0,0,}, + {0,1,1,1,1,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 27 ''' */ + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 28 '(' */ + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 29 ')' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2a '*' */ + {0,0,0,0,0,0,0,0,}, + {0,1,0,1,0,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,0,1,0,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2b '+' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2c ',' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + }}, + {{ /* 2d '-' */ + {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,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2e '.' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2f '/' */ + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + }}, + {{ /* 30 '0' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 31 '1' */ + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 32 '2' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 33 '3' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 34 '4' */ + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,1,1,1,0,0,0,}, + {1,1,0,1,1,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 35 '5' */ + {1,1,1,1,1,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 36 '6' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 37 '7' */ + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 38 '8' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 39 '9' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3a ':' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3b ';' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3c '<' */ + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3d '=' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3e '<' */ + {0,1,1,0,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3f '?' */ + {0,0,1,1,1,1,0,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 40 '@' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,0,0,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 41 'A' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 42 'B' */ + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 43 'C' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 44 'D' */ + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 45 'E' */ + {1,1,1,1,1,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 46 'F' */ + {1,1,1,1,1,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 47 'G' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 48 'H' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 49 'I' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4a 'J' */ + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4b 'K' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4c 'L' */ + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4d 'M' */ + {1,1,0,0,0,1,1,0,}, + {1,1,1,0,1,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4e 'N' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,0,0,1,1,0,}, + {1,1,1,1,0,1,1,0,}, + {1,1,0,1,1,1,1,0,}, + {1,1,0,0,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4f 'O' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 50 'P' */ + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 51 'Q' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,1,1,1,1,0,}, + {1,1,0,0,1,1,0,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 52 'R' */ + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 53 'S' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 54 'T' */ + {0,1,1,1,1,1,1,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 55 'U' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 56 'V' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 57 'W' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,1,0,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 58 'X' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 59 'Y' */ + {0,1,1,0,0,1,1,0,}, + {0,1,1,0,0,1,1,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5a 'Z' */ + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5b '[' */ + {0,0,1,1,1,1,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5c '\' */ + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + }}, + {{ /* 5d ']' */ + {0,0,1,1,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5e '^' */ + {0,0,0,1,0,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5f '_' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,1,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 60 '`' */ + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 61 'a' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 62 'b' */ + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 63 'c' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 66 'd' */ + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 66 'e' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 66 'f' */ + {0,0,1,1,1,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 67 'g' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 68 'h' */ + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 69 'i' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6a 'j' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6b 'k' */ + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,1,1,0,0,}, + {1,1,0,1,1,0,0,0,}, + {1,1,1,1,0,0,0,0,}, + {1,1,0,1,1,0,0,0,}, + {1,1,0,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6c 'l' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6d 'm' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,1,1,0,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6e 'n' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6f 'o' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 70 'p' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + }}, + {{ /* 71 'q' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + }}, + {{ /* 72 'r' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,1,1,1,0,0,}, + {1,1,1,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 73 's' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 74 't' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 75 'u' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 76 'v' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 77 'w' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 78 'x' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 79 'y' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,1,1,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7a 'z' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7b '{' */ + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7c '|' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7d '}' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7e '~' */ + {0,0,1,1,0,0,1,1,}, + {0,1,1,1,1,1,1,0,}, + {1,1,0,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7f DEL */ + {0,1,1,0,1,1,0,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + }; + + + +FontChar xifont2[128] = + { + NULLCHARDEF, /* 00 */ + NULLCHARDEF, /* 01 */ + NULLCHARDEF, /* 02 */ + NULLCHARDEF, /* 03 */ + NULLCHARDEF, /* 04 */ + NULLCHARDEF, /* 05 */ + NULLCHARDEF, /* 06 */ + NULLCHARDEF, /* 07 */ + NULLCHARDEF, /* 08 */ + NULLCHARDEF, /* 09 */ + NULLCHARDEF, /* 0a */ + NULLCHARDEF, /* 0b */ + NULLCHARDEF, /* 0c */ + NULLCHARDEF, /* 0d */ + NULLCHARDEF, /* 0e */ + NULLCHARDEF, /* 0f */ + NULLCHARDEF, /* 10 */ + NULLCHARDEF, /* 11 */ + NULLCHARDEF, /* 12 */ + NULLCHARDEF, /* 13 */ + NULLCHARDEF, /* 14 */ + NULLCHARDEF, /* 15 */ + NULLCHARDEF, /* 16 */ + NULLCHARDEF, /* 17 */ + NULLCHARDEF, /* 18 */ + NULLCHARDEF, /* 19 */ + NULLCHARDEF, /* 1a */ + NULLCHARDEF, /* 1b */ + NULLCHARDEF, /* 1c */ + NULLCHARDEF, /* 1d */ + NULLCHARDEF, /* 1e */ + NULLCHARDEF, /* 1f */ + + {{ /* 20 ' ' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 21 '!' */ + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 22 '"' */ + {0,0,1,0,0,1,0,0,}, + {0,0,1,0,0,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 23 '#' */ + {0,0,1,0,1,0,0,0,}, + {0,0,1,0,1,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,1,0,1,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 24 '$' */ + {0,0,0,1,0,0,0,0,}, + {0,0,1,1,1,1,0,0,}, + {0,1,0,1,0,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,0,1,0,0,}, + {0,1,1,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 25 '%' */ + {0,1,0,0,0,0,1,0,}, + {1,0,1,0,0,1,0,0,}, + {0,1,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,1,0,0,}, + {0,1,0,0,1,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 26 '&' */ + {0,1,1,1,0,0,0,0,}, + {1,0,0,0,1,0,0,0,}, + {1,0,0,0,1,0,0,0,}, + {0,1,1,1,0,0,0,0,}, + {1,0,0,0,1,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {0,1,1,1,1,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 27 ''' */ + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 28 '(' */ + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 29 ')' */ + {0,0,1,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2a '*' */ + {1,0,0,1,0,0,1,0,}, + {0,1,0,1,0,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,0,1,0,1,0,0,}, + {1,0,0,1,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2b '+' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2c ',' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + }}, + {{ /* 2d '-' */ + {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,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2e '.' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2f '/' */ + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 30 '0' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 31 '1' */ + {0,0,0,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 32 '2' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 33 '3' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 34 '4' */ + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,1,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 35 '5' */ + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 36 '6' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 37 '7' */ + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 38 '8' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 39 '9' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3a ':' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3b ';' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3c '<' */ + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3d '=' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3e '<' */ + {0,0,1,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3f '?' */ + {0,0,1,1,1,1,0,0,}, + {0,1,0,0,0,0,1,0,}, + {0,0,0,0,1,1,1,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 40 '@' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,1,1,0,0,1,0,}, + {1,0,1,0,1,0,1,0,}, + {1,0,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 41 'A' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 42 'B' */ + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 43 'C' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 44 'D' */ + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 45 'E' */ + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 46 'F' */ + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 47 'G' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 48 'H' */ + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 49 'I' */ + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4a 'J' */ + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4b 'K' */ + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {1,0,0,0,1,0,0,0,}, + {1,1,1,1,0,0,0,0,}, + {1,0,0,0,1,0,0,0,}, + {1,0,0,0,0,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4c 'L' */ + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4d 'M' */ + {1,0,0,0,0,0,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,0,1,0,1,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4e 'N' */ + {1,0,0,0,0,0,1,0,}, + {1,1,0,0,0,0,1,0,}, + {1,0,1,0,0,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,0,0,1,0,1,0,}, + {1,0,0,0,0,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4f 'O' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 50 'P' */ + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 51 'Q' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,1,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {0,1,1,1,1,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 52 'R' */ + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 53 'S' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 54 'T' */ + {1,1,1,1,1,1,1,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 55 'U' */ + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 56 'V' */ + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 57 'W' */ + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,1,0,1,0,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 58 'X' */ + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,1,0,0,0,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 59 'Y' */ + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5a 'Z' */ + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5b '[' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5c '\' */ + {1,0,0,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5d ']' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5e '^' */ + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5f '_' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,1,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 60 '`' */ + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 61 'a' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 62 'b' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 63 'c' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 64 'd' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 65 'e' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 66 'f' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 67 'g' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 68 'h' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 69 'i' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6a 'j' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6b 'k' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {1,1,1,1,1,0,0,0,}, + {1,0,0,0,0,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6c 'l' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6d 'm' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,0,1,0,1,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6e 'n' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,0,0,0,1,0,}, + {1,0,1,0,0,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,0,0,1,0,1,0,}, + {1,0,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6f 'o' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 70 'p' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 71 'q' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,1,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {0,1,1,1,1,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 72 'r' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 73 's' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 74 't' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 75 'u' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 76 'v' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 77 'w' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,1,0,1,0,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 78 'x' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,0,0,0,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 79 'y' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7a 'z' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7b '{' */ + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7c '|' */ + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7d '}' */ + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7e '~' */ + {0,0,1,0,0,0,0,0,}, + {0,1,0,1,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7f DEL */ + {0,1,1,0,1,1,0,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + }; + +FontChar *xifont=xifont1; + +#endif diff --git a/icon b/icon new file mode 100644 index 0000000..e44294c --- /dev/null +++ b/icon @@ -0,0 +1,27 @@ +#define icon_width 48 +#define icon_height 48 +static unsigned char icon_bits[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x07, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xf8, + 0x13, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x7e, 0x0e, 0x3e, 0xff, 0xff, + 0x63, 0x3c, 0x0e, 0x3c, 0xff, 0xff, 0xe3, 0x18, 0xcf, 0x24, 0xf8, 0xff, + 0xe3, 0x81, 0xcf, 0x24, 0xf8, 0xff, 0xe3, 0xc3, 0x0f, 0x3e, 0xff, 0xff, + 0xe3, 0xc3, 0x0f, 0x26, 0xff, 0xff, 0xe3, 0x81, 0xcf, 0x24, 0xff, 0xff, + 0xe3, 0x18, 0xcf, 0x24, 0xff, 0xff, 0x63, 0x3c, 0x0e, 0x24, 0xf0, 0xff, + 0x63, 0x7e, 0x0e, 0x66, 0xf0, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0x0f, 0x00, 0xf0, 0xff, + 0xe3, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xd5, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x15, 0xeb, 0xac, 0xed, 0xff, + 0xe3, 0xd5, 0x52, 0x4b, 0xed, 0xff, 0xe3, 0xd5, 0xfa, 0xe8, 0xed, 0xff, + 0xe3, 0xd5, 0x7a, 0xeb, 0xe3, 0xff, 0xe3, 0x15, 0xfb, 0xe8, 0xef, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xed, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xf3, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; diff --git a/ledit.c b/ledit.c new file mode 100644 index 0000000..1a5c26c --- /dev/null +++ b/ledit.c @@ -0,0 +1,547 @@ +/* + + lunar - Simple X11 Lunar Lander + + Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + +*/ +static char rcs_id[]="$Id$"; + +#include +#include +#include +#include +#include + +#include +#include + +#include "Xbit.h" + +#define WINX 100 +#define WINY 100 +#define WINW 640 +#define WINH 640 + +#define RND(x) (rand()%(x)) + +XSizeHints size_hints; +int black,white; +Display *disp; +Window window; +Colormap cm; +XFontStruct *font; + +XFuncControl Key(); +XFuncControl Mouse(); +XFuncControl Motion(); +XFuncControl Process(); + +XCallBack key[2]={{0,Key},{0,NULL}}; +XCallBack mouse[2]={{0,Mouse},{0,NULL}}; +XCallBack motion[2]={{0,Motion},{0,NULL}}; + + +#define NOCOL 7 +char *colnames[NOCOL]= + {"black","white","red","yellow","blue","green","cyan"}; +int pix[NOCOL]; + +#define BLACK pix[0] +#define WHITE pix[1] +#define RED pix[2] +#define YELLOW pix[3] +#define BLUE pix[4] +#define GREEN pix[5] +#define CYAN pix[6] + +typedef struct + { + int x,y; + } Pt; + +#define MNT 1 +#define MINE 2 +#define ASTCW 3 +#define ASTACW 4 +#define PAD 5 + +char *ty_type[]={"BUG?!","MNT","MINE","ASTCW","ASTACW","PAD"}; +char ty_code[]={'?','M','O','X','Y','P'}; + +int CONST =3; +#define STOMX(x) (((x)-WINW/2)*CONST+gx) +#define STOMY(y) (((y)-WINH/2)*CONST+gy) + +#define MTOSX(x) (((x-gx)/CONST)+(WINW/2)) +#define MTOSY(y) (((y-gy)/CONST)+(WINH/2)) + +#define MAXLINE 32 +typedef struct + { + int ty; + Pt o; + int no; + Pt p[MAXLINE]; + } Obj; + + +#define MAXOBJ 64 + +Obj obj[MAXOBJ]; +int no; +int cur; +char *fname; +char *title="LEVEL TITLE"; +int mx,my; +int gx=0,gy=0; + + +int main(argc,argv) +int argc; +char *argv[]; + +{ + unsigned long evmask; + + srand(getpid()); + + size_hints.flags=PPosition|PSize|PMinSize|PMaxSize; + size_hints.x=WINX; + size_hints.y=WINY; + size_hints.width=size_hints.min_width=WINW; + size_hints.height=size_hints.min_height=WINH; + size_hints.max_width=WINW; + size_hints.max_height=WINH; + + evmask=ButtonPressMask|ButtonReleaseMask| + KeyPressMask|KeyReleaseMask|PointerMotionMask; + + motion[0].w=mouse[0].w=key[0].w=window= + OpenWin(argc,argv,argv[0], + WINX,WINY,WINW,WINH, + WINW,WINH, + evmask, + &size_hints,&black,&white); + + if (argc>1) + { + fname=argv[1]; + ReadFile(); + } + else + { + fprintf(stderr,"Must supply a level file\n"); + exit(1); + } + + if (argc>2) + CONST=atoi(argv[2]); + + DisableDoubleBuffer(); + + disp=GetDisplay(); + + AllocColors(NOCOL,pix,colnames); + + XDoWindows(mouse,motion,key,Process); +} + + +XFuncControl Key(w,m,e) +Window w; +int m; +XEvent *e; + +{ + KeySym k; + + if (m==XPRESS) + return; + + switch(k=XLookupKeysym(e,ShiftMapIndex)) + { + case XK_G: /* Set centre */ + case XK_g: + gx=STOMX(e->xkey.x); + gy=STOMY(e->xkey.y); + break; + + case XK_H: /* Clear centre */ + case XK_h: + gx=0; + gy=0; + break; + + case XK_C: /* Create poly */ + case XK_c: + if (noxkey.x); + obj[no].o.y=STOMY(e->xkey.y); + cur=no++; + } + break; + + case XK_O: /* Set origin */ + case XK_o: + if (no) + { + obj[cur].o.x=STOMX(e->xkey.x); + obj[cur].o.y=STOMY(e->xkey.y); + } + break; + + case XK_D: /* Delete poly */ + case XK_d: + if (no) + if (cur==(--no)) + cur--; + break; + + case XK_Left: /* Prev poly */ + if (no) + if (cur) + cur--; + break; + + case XK_Right: /* Prev poly */ + if (no) + if (cur<(no-1)) + cur++; + break; + + case XK_Up: /* Scale up */ + if (CONST>1) + CONST--; + break; + + case XK_Down: /* Scale down */ + CONST++; + break; + + case XK_S: /* Save */ + case XK_s: + WriteFile(); + break; + + case XK_Q: /* Quit */ + case XK_q: + return (XFUNCSTOP); + break; + + case XK_1: + case XK_2: + case XK_3: + case XK_4: + case XK_5: + if (no) + obj[cur].ty=k-XK_0; + break; + + default: + break; + } + + return(XFUNCCONT); +} + + +XFuncControl Mouse(w,m,b,x,y) +Window w; +int m; +int b,x,y; + +{ + int mapx,mapy; + + if ((m==XPRESS)||(cur==-1)) + return (XFUNCCONT); + + switch(b) + { + case 1: /* Add point */ + if (obj[cur].no +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "Xbit.h" + +#define WINX 100 +#define WINY 100 +#define WINW 320 +#define WINWH 160 +#define WINH 200 +#define WINHH 100 + +#define RND(x) (rand()%(x)) + +#define ITOF(x) ((x)<<8) +#define FTOI(x) ((x)>>8) + +#define ABS(x) ((x)<0 ? (-(x)) : (x)) +#define SGN(x) ((x) ? ((x)/ABS(x)) : (0)) +#define DABS(x) ((x)<0.0 ? (-(x)) : (x)) + +#define AT(p,x,y) *((p)+(x)+(y)*WINW) + +#define HISCFILE "hisc.ll" +#define LEVELDIR "LEVELS/" + +#define CH(x,y) ((x)*SCALE),((y)*SCALE),SCALE,SCALE +#define CHSC(x,y,sx,sy) ((x)*SCALE),((y)*SCALE),SCALE*sx,SCALE*sy + +static XSizeHints size_hints; +static ulong black,white; +static Display *disp; +static Window top,sub; +static Colormap cm; +static XFontStruct *font; +static XImage *img; +static uchar *coll_data; + +static double si[3600],co[3600]; + +static XFuncControl Key(Window w, XPressRelease s, XEvent *e); +static XFuncControl ProcessTitle(void),ProcessIntro(void),ProcessGame(void), + ProcessGameOver(void),ProcessHiScore(void); + +/* Hiscore +*/ +#define NOHI 3 + +typedef struct +{ + char name[4]; + int score; + int no; +} HiSc; + +static HiSc hisc[NOHI]= + { + {"N.B",100,1}, + {"N.B",100,1}, + {"N.B",100,1}, + }; + +/* Keycontrols +*/ +static XWindowKeyCallback + key[2]= + { + {0,Key}, + {0,NULL} + }; + +#define NONE -1 +#define FINE_LEFT 0 +#define FINE_RIGHT 1 +#define THRUST 2 +#define LEFT 3 +#define RIGHT 4 +#define QUIT 5 +#define SCALE_UP 6 +#define SCALE_DOWN 7 +#define PAUSE 8 + +static int inkey=NONE; +static KeySym last_keysym; +static int keymap[PAUSE+1]= + {False,False,False,False,False, + False,False,False,False}; + + +/* Collision data codes - NB : order is important for Vector collisions - a + collision of '4' will override a collision + with '3' +*/ +#define CNONE 0 +#define CPAD 1 +#define CASTEROID 2 +#define CMOUNTAIN 3 +#define ISCMINE(c) ((c)&(0x80)) +#define CMINE(x) ((x)+0x80) + + +/* Colour vars +*/ +#define NOCOLS 8 +#define RNDCOL pix[(RND(NOCOLS-2)+2)] +#define RGB(r,g,b) {(r)*255,(g)*255,(b)*255} + +static ulong pix[NOCOLS]; +static Colour cols[NOCOLS]= + { + RGB(0,0,0), /* BLACK */ + RGB(255,255,255), /* WHITE */ + RGB(255,100,100), /* RED */ + RGB(100,255,100), /* GREEN */ + RGB(100,100,255), /* BLUE */ + RGB(255,255,0), /* YELLOW */ + RGB(0,255,255), /* CYAN */ + RGB(165,42,42) /* BROWN */ + }; + +#define IBLACK 0 +#define IWHITE 1 +#define IRED 2 +#define IGREEN 3 +#define IBLUE 4 +#define IYELLOW 5 +#define ICYAN 6 +#define IBROWN 7 + +#define BLACK pix[IBLACK] +#define WHITE pix[IWHITE] +#define RED pix[IRED] +#define GREEN pix[IGREEN] +#define BLUE pix[IBLUE] +#define YELLOW pix[IYELLOW] +#define CYAN pix[ICYAN] +#define BROWN pix[IBROWN] + + +/* 2D Vector defs +*/ +#define VECPT 32 +#define VECLN 32 + +typedef struct + { + double x,y; + } VecPt; + + +typedef struct + { + int p1,p2; + } VecLine; + + +typedef struct + { + VecPt pos; + int ang; + int no_pt; + VecPt pt[VECPT]; + int no_ln; + VecLine ln[VECLN]; + VecPt work[VECPT]; + ulong colour; + int collcode; + int coll[VECLN]; + } VecObject; + + +/* Lander vector object +*/ +static VecObject base_lander= + { + {0.0,0.0}, /* pos */ + 0, /* ang */ + + 7, /* no_pt */ + { /* pt[] */ + { 0.0, -10.0}, + {-10.0, 10.0}, + { 10.0, 10.0}, + { -7.0, 10.0}, + { 7.0, 10.0}, + {-10.0, 20.0}, + { 10.0, 20.0}, + }, + + 5, /* no_ln */ + { /* ln[] */ + {0,1}, + {1,2}, + {2,0}, + {3,5}, + {4,6}, + }, + + { /* work[] */ + {0.0,0.0}, + }, + + IWHITE, /* colour */ + CNONE, /* collcode */ + {0,}, /* coll */ + }; + +static VecObject lander; + + +/* Particle definitions +*/ +#define NOPLIST 4 +#define PSHORT 0 +#define PMID 1 +#define PLONG 2 +#define PULTRA 3 + +typedef struct + { + double x,y; + } ParticlePt; + +typedef struct part + { + int life; + ParticlePt p; + ParticlePt i; + struct part *next; + } Particle; + +static Particle *p_head[NOPLIST]; +static Particle *p_tail[NOPLIST]; + + +/* Now we are using MIT-SHM structures, there should be more than enough + power for some background stars to give the player a visual cue of bearing +*/ +#define NOBDSTAR 50 +typedef struct + { + double x,y; + } BdStar; + +static BdStar bdrop[NOBDSTAR]; + + +/* Level data - should improve this really... Using up 3Mb statically for + level definitions is probably a bit _too_ much! :-} +*/ +#define MAXLEVEL 32 +#define MAXLEVPOLY 64 + +#define MOUNTAIN 0 +#define ASTEROIDCW 1 +#define ASTEROIDACW 2 +#define PAD 3 +#define MINE 4 + +typedef struct + { + int no; + char *name; + int type[MAXLEVPOLY]; + int draw[MAXLEVPOLY]; + VecObject v[MAXLEVPOLY]; + } LevelDef; + +static int no_levels; +static char *level_set; +static LevelDef levdata[MAXLEVEL]; +static LevelDef level; + + +/* Damage vars +*/ +#define DAMAGE_NONE 0 +#define DAMAGE_LEFT 1 +#define DAMAGE_RIGHT 2 +#define DAMAGE_MAIN 3 + +static int damage; + +/* Control vars +*/ +static int FUEL =500; +static int SCORE =0; +static int FONT =1; +static int LEVEL =0; +static int SHOWVEC =0; +static double GRAVITY =0.1; +static double MAXGRAV =8.0; +static double JET =0.5; + +static int SCALE =1; +static void POKEIMG_S(XImage *img, int x, int y, ulong col); +static void POKEIMG_NS(XImage *img, int x, int y, ulong col); +static void (*POKEIMG)(XImage *img, int x, int y, ulong col); + +static int quit=False; +static int do_intro; +static int score,rot,fuel,landing,lev; +static double shipxi,shipyi; +static int offx,offy; + + +/* Protos +*/ +static void ClearKeys(void); +static void DefineLevel(void); +static void DrawObject(VecObject *o); +static void ClearParticles(void); +static void InitBdrop(void); +static int Paused(int k); +static void ReadScores(void); +static void WriteScores(void); +static void ReadLevels(void); + + +int main(int argc,char *argv[]) +{ + int f,r,x,y,arg,noshm; + unsigned long evmask; + + arg=1; + noshm=False; + + if (argc>arg) + if (!strcmp(argv[arg],"-noshm")) + { + noshm=True; + arg++; + } + + if (argc>arg) + { + SCALE=atoi(argv[arg]); + + if (SCALE<1) + { + fprintf(stderr,"scale param must be +ve\n"); + exit(1); + } + } + + if (SCALE==1) + POKEIMG=POKEIMG_NS; + else + POKEIMG=POKEIMG_S; + + for(f=0;f<3600;f++) + { + si[f]=sin(M_PI/1800.0*f); + co[f]=cos(M_PI/1800.0*f); + } + + for(f=0;f0); + + if (score>-1) + { + ClearKeys(); + XDoWindows(NULL,NULL,key,ProcessGameOver); + + ReadScores(); + if (score>hisc[NOHI-1].score) + { + XDoWindows(NULL,NULL,key,ProcessHiScore); + WriteScores(); + } + } + + ClearKeys(); + XDoWindows(NULL,NULL,key,ProcessTitle); + } + + XAutoRepeatOn(disp); + DestroyXImage(img); + XCloseDisplay(disp); +} + + +/* ----------------------------------------------- KEY AND UTILITY +*/ +static XFuncControl Key(Window w, XPressRelease s, XEvent *e) +{ + if (s==XRELEASE) + { + last_keysym=XK_VoidSymbol; + + switch(XLookupKeysym((XKeyEvent *)e,ShiftMapIndex)) + { + case XK_A: + case XK_a: + keymap[FINE_LEFT]=False; + break; + + case XK_D: + case XK_d: + keymap[FINE_RIGHT]=False; + break; + + case XK_Z: + case XK_z: + keymap[LEFT]=False; + break; + + case XK_C: + case XK_c: + keymap[RIGHT]=False; + break; + + case XK_period: + keymap[THRUST]=False; + break; + + case XK_P: + case XK_p: + keymap[PAUSE]=False; + break; + + case XK_Q: + case XK_q: + keymap[QUIT]=False; + break; + + case XK_bracketleft: + keymap[SCALE_DOWN]=False; + break; + + case XK_bracketright: + keymap[SCALE_UP]=False; + break; + + default: + keymap[NONE]=False; + break; + } + } + + if (s==XPRESS) + { + inkey=NONE; + + switch(last_keysym=XLookupKeysym((XKeyEvent *)e,ShiftMapIndex)) + { + case XK_A: + case XK_a: + inkey=FINE_LEFT; + break; + + case XK_D: + case XK_d: + inkey=FINE_RIGHT; + break; + + case XK_Z: + case XK_z: + inkey=LEFT; + break; + + case XK_C: + case XK_c: + inkey=RIGHT; + break; + + case XK_period: + inkey=THRUST; + break; + + case XK_P: + case XK_p: + inkey=PAUSE; + break; + + case XK_Q: + case XK_q: + inkey=QUIT; + break; + + case XK_bracketleft: + inkey=SCALE_DOWN; + break; + + case XK_bracketright: + inkey=SCALE_UP; + break; + + default: + inkey=NONE; + break; + } + + if (inkey!=NONE) + keymap[inkey]=True; + } + + return XFUNCCONT; +} + + +static int GetKey(void) +{ + int k=inkey; + + if ((inkey=SCALE_UP)||(inkey=SCALE_UP)||(inkey==PAUSE)|| + (inkey==QUIT)||(inkey=THRUST)) + inkey=NONE; + + return k; +} + + +static KeySym RawKey(void) + +{ + KeySym k=last_keysym; + + last_keysym=XK_VoidSymbol; + return k; +} + + +static void ClearKeys(void) +{ + int f; + + inkey=NONE; + + for(f=0;f<5;f++) + keymap[f]=False; +} + + +/* ----------------------------------------------- GRAPHICS UTILS +*/ +static void Cls(void) +{ + ClsXImage(img); + memset(coll_data,CNONE,WINW*WINH); +} + + +static void Update(void) +{ + DrawXImage(img); + XSync(disp,False); +} + + +static void Centre(int y, ulong c, const char *s) +{ + XIprintf(img,CH(WINWH-strlen(s)*4,y),c,"%s",s); +} + + +static void POKEIMG_NS(XImage *img,int x,int y,ulong c) +{ + XPutPixel(img,x,y,c); +} + + +static void POKEIMG_S(XImage *img,int x,int y,ulong c) +{ + int sx,sy; + + for(sx=0;sx=0)&&(x=0)&&(y3599) + level.v[f].ang-=3600; + break; + case ASTEROIDACW: + if ((level.v[f].ang-=20)<0) + level.v[f].ang+=3600; + break; + case PAD: + break; + case MINE: + break; + } + + DrawObject(&level.v[f]); + } +} + + +/* ----------------------------------------------- VECTOR OBJECT +*/ +static int vecscale=0; + +#define SetScale(s) vecscale=(s) + + +static void LinePlot(int x,int y,ulong c,int col,int *retcoll) +{ + if ((x<0)||(x>=WINW)||(y<0)||(y>=WINH)) + return; + + POKEIMG(img,x,y,c); + + if (AT(coll_data,x,y)>*retcoll) + *retcoll=AT(coll_data,x,y); + + if (col!=CNONE) + AT(coll_data,x,y)=col; +} + + +static void Line(VecPt *p1,VecPt *p2, ulong c, int collcode, int *coll) +{ + int f; + int dx,dy,ix,iy,incrE,incrNE,d,x,y,ymode; + int p1x,p1y,p2x,p2y; + + p1x=(int)p1->x; + p1y=(int)p1->y; + p2x=(int)p2->x; + p2y=(int)p2->y; + + if ((p1x<0)&&(p2x<0)) + return; + + if ((p1x>=WINW)&&(p2x>=WINW)) + return; + + if ((p1y<0)&&(p2y<0)) + return; + + if ((p1y>=WINH)&&(p2y>=WINH)) + return; + + dx=p2x-p1x; + dy=p2y-p1y; + + ix=SGN(dx); + iy=SGN(dy); + + dx=ABS(dx); + dy=ABS(dy); + + if (dy>dx) + { + ymode=True; + d=dx*2-dy; + incrE=dx*2; + incrNE=(dx-dy)*2; + } + else + { + ymode=False; + d=dy*2-dx; + incrE=dy*2; + incrNE=(dy-dx)*2; + } + + x=p1x; + y=p1y; + + LinePlot(x,y,c,collcode,coll); + + if (ymode) + while(y!=p2y) + { + if (d<=0) + { + d+=incrE; + y+=iy; + } + else + { + d+=incrNE; + y+=iy; + x+=ix; + } + + LinePlot(x,y,c,collcode,coll); + } + else + while(x!=p2x) + { + if (d<=0) + { + d+=incrE; + x+=ix; + } + else + { + d+=incrNE; + y+=iy; + x+=ix; + } + + LinePlot(x,y,c,collcode,coll); + } +} + + +static void Rotate(VecPt *p1,VecPt *p2,int a) +{ + double dx,dy,dco,dsi; + + dco=co[a]; + dsi=si[a]; + + dx=p1->x; + dy=p1->y; + + p2->x=(dco*dx+(-dsi)*dy); + p2->y=(dsi*dx+dco*dy); +} + + +static void Scale(VecPt *p) +{ + p->x/=vecscale; + p->y/=vecscale; +} + + +static void DrawObject(VecObject *o) +{ + int f; + + if (o->ang) + for(f=0;fno_pt;f++) + { + Rotate((o->pt)+f,(o->work)+f,o->ang); + o->work[f].x+=o->pos.x; + o->work[f].y+=o->pos.y; + + if (vecscale) + Scale(o->work+f); + + o->work[f].x+=WINWH; + o->work[f].y+=WINHH; + } + else + for(f=0;fno_pt;f++) + { + o->work[f].x=o->pt[f].x+o->pos.x; + o->work[f].y=o->pt[f].y+o->pos.y; + + if (vecscale) + Scale(o->work+f); + + o->work[f].x+=WINWH; + o->work[f].y+=WINHH; + } + + for(f=0;fno_ln;f++) + { + o->coll[f]=CNONE; + Line(&o->work[o->ln[f].p1], + &o->work[o->ln[f].p2], + o->colour, + o->collcode, + &o->coll[f]); + } +} + + +/* ----------------------------------------------- PARTICLE ROUTINES +*/ +static void ClearParticles(void) +{ + Particle *p; + int f; + + for(f=0;fnext; + free(p); + } + p_tail[f]=NULL; + } +} + + +static void AddParticle(int ang,int rad,int list,int weight) +{ + Particle *new; + + if (new=(Particle *)malloc(sizeof(Particle))) + { + new->next=NULL; + + switch(list) + { + case PSHORT: + new->life=3; + break; + + case PMID: + new->life=7; + break; + + case PLONG: + new->life=20; + break; + + case PULTRA: + new->life=40; + break; + + default: + free(new); + return; + } + + new->p.x=-(double)rad*si[ang]; + new->p.y=(double)rad*co[ang]; + new->i.x=-si[ang]/weight; + new->i.y=co[ang]/weight; + + if (p_head[list]) + { + p_tail[list]->next=new; + p_tail[list]=new; + } + else + p_head[list]=p_tail[list]=new; + } +} + + +static void DrawParticles(void) +{ + Particle *p; + int f; + + for(f=0;flife)) + { + if (!(p_head[f]=p->next)) + p_tail[f]=NULL; + free(p); + } + + p=p_head[f]; + while(p) + { + p->life--; + p->p.x+=p->i.x+shipxi; + p->p.y+=p->i.y+shipyi; + if (vecscale) + Plot(WINWH+(int)p->p.x/vecscale, + WINHH+(int)p->p.y/vecscale,RNDCOL); + else + Plot(WINWH+(int)p->p.x,WINHH+(int)p->p.y,RNDCOL); + p=p->next; + } + } +} + + +static int NoParticles(void) +{ + int f,ret; + + ret=True; + + for(f=0;f=(double)WINW) + bdrop[f].x-=(double)WINW; + + + if (bdrop[f].y<0.0) + bdrop[f].y+=(double)WINH; + + if (bdrop[f].y>=(double)WINH) + bdrop[f].y-=(double)WINH; + + Plot((int)bdrop[f].x,(int)bdrop[f].y,YELLOW); + } +} + + +/* ----------------------------------------------- TITLE SCREEN +*/ +static void DoDebugMenu(void) +{ + static int debug_menu=False; + KeySym k; + int f; + + if ((k=RawKey())=='r') + debug_menu=!debug_menu; + + if (debug_menu) + { + Cls (); + + for(f=0;f<128;f++) + XIprintf(img,CH((f%40)*8,(f/40)*8),CYAN,"%c",f); + + XIprintf(img,CH(0,150),CYAN, + "(y/u) LEVEL %2d : %s",LEVEL,levdata[LEVEL].name); + XIprintf(img,CH(0,160),CYAN, + "(s) SHOW VECTOR : %5d",SHOWVEC); + XIprintf(img,CH(0,170),CYAN, + "(f) FONT : %5d",FONT); + XIprintf(img,CH(0,180),CYAN, + "(h) SCORE : %5d",SCORE); + XIprintf(img,CH(0,190),CYAN, + "(l) FUEL : %5d",FUEL); + + XIprintf(img,CH(0,100),CYAN,"(x) SET TO DEFAULTS"); + XIprintf(img,CH(0,108),CYAN,"(o) SET TO DEBUG"); + XIprintf(img,CH(0,116),CYAN,"(w) SET TO SMALLER DEBUG"); + + switch(k) + { + case 'u': + if (--LEVEL==-1) + LEVEL=no_levels-1; + break; + case 'y': + if (++LEVEL==no_levels) + LEVEL=0; + break; + case 'f': + FONT^=1; + XISetFont(FONT); + break; + case 'h': + SCORE=hisc[0].score; + break; + case 'l': + if ((FUEL+=500)>10000) + FUEL=0; + break; + case 's': + SHOWVEC=!SHOWVEC; + break; + case 'x': + SCORE=0; + FUEL=500; + break; + case 'o': + FUEL=10000; + SCORE=hisc[0].score; + break; + case 'w': + FUEL=100; + SCORE=hisc[0].score; + break; + } + } +} + + +static XFuncControl ProcessTitle(void) +{ + static unsigned int ctr=0; + char s[80]; + int f,k; + + ctr++; + + Cls(); + + for(f=0;f<10;f++) + Centre(15+f,((ctr+f)%(NOCOLS-2))+2,"LUNAR LANDER"); + + Centre(25,WHITE,"LUNAR LANDER"); + + Centre(45,RED,level_set); + Centre(46,YELLOW,level_set); + Centre(47,WHITE,level_set); + + if ((ctr/100)%2) + { + Centre(70,RNDCOL,"TOP PILOTS"); + for(f=0;f-2.0)) + { + *land=True; + landing++; + score+=fuel; + fuel+=200; + lev=(lev+1)%no_levels; + do_intro=True; + + for(r=0;r<500;r++) + { + AddParticle(2700-RND(500),RND(10)+10,PULTRA,1); + AddParticle(900+RND(500),RND(10)+10,PULTRA,1); + } + + shipxi=0.0; + shipyi=0.0; + return; + } + else + { + for(r=0;r3599) + lander.ang-=3600; + + for(f=0;f<5;f++) + { + na=(lander.ang+800+RND(200))%3600; + AddParticle(na,8+RND(3),PSHORT,10); + } + } + } + else if ((keymap[LEFT])&&(damage3599) + lander.ang-=3600; + + for(f=0;f<5;f++) + { + na=(lander.ang+800+RND(200))%3600; + AddParticle(na,8+RND(3),PMID,10); + } + } + } + + if ((keymap[THRUST])&&(fuel>0)&&(damageMAXGRAV) + shipxi=MAXGRAV; + + if (shipyi<-MAXGRAV) + shipyi=-MAXGRAV; + + if (shipyi>MAXGRAV) + shipyi=MAXGRAV; + } + + DrawBdrop(); + DrawParticles(); + DrawLevel(); + + if (!dead) + { + DrawObject(&lander); + + if ((ctr/10)%2) + { + if (damage==DAMAGE_NONE) + dmg=NULL; + else if (damage==DAMAGE_LEFT) + dmg="LEFT THRUSTER DAMAGED"; + else if (damage==DAMAGE_RIGHT) + dmg="BOTH SIDE THRUSTERS DAMAGED"; + else + dmg="ALL THRUSTERS DAMAGED!"; + + if(dmg) + Centre(48,WHITE,dmg); + } + } + + XIprintf(img,CH(0,0),WHITE,"Fuel : %4d",fuel); + + if (SHOWVEC) + XIprintf(img,CH(0,WINH-8),WHITE,"xi: %2.3f yi: %2.3f ang: %4d", + shipxi,shipyi,lander.ang); + + /* Check collisions + */ + if ((!landed)&&(!dead)) + CheckCollisions(&landed,&dead); + + Update(); + + if (k==SCALE_UP) + { + if (--scale<2) + scale=0; + + InitBdrop(); + SetScale(scale); + } + + if (k==SCALE_DOWN) + { + if (scale) + scale++; + else + scale=2; + + InitBdrop(); + SetScale(scale); + } + + if (k==QUIT) + { + score=-1; + fuel=0; + first=True; + return XFUNCSTOP; + } + + if ((dead)&&(NoParticles())) + { + first=True; + return XFUNCSTOP; + } + + if ((landed)&&(NoParticles())) + { + first=True; + return XFUNCSTOP; + } + + return XFUNCCONT; +} + + +/* ----------------------------------------------- PAUSE CODE +*/ +static void DoPause(void) +{ + static unsigned int c=0; + + c++; + + if ((c/10)%2) + Centre(WINH/4,WHITE,"PAUSED"); + else + Centre(WINH/4,YELLOW,"PAUSED"); + + Update(); +} + + +static int Paused(int k) +{ + static int paused=False; + + if (k==PAUSE) + paused=!paused; + + if (paused) + DoPause(); + + return paused; +} + + +/* ----------------------------------------------- GAME OVER +*/ +static XFuncControl ProcessGameOver(void) +{ + static int ctr=0; + + Cls (); + + ctr++; + + if ((ctr/10)%2) + Centre(120,WHITE,"GAME OVER"); + + Update(); + + if (GetKey()==NONE) + return XFUNCCONT; + else + return XFUNCSTOP; +} + + +/* ----------------------------------------------- HI SCORES +*/ +static void ReadScores(void) +{ + int fd,f; + + if ((fd=open(HISCFILE,O_RDONLY))==-1) + return; + + for(f=0;f-1;f--) + if (hisc[f].scorepos;f--) + hisc[f]=hisc[f-1]; + + strcpy(hisc[pos].name,""); + hisc[pos].score=score; + hisc[pos].no=landing; + first=False; + } + + Cls(); + + Centre(16,WHITE,"CONGRATULATIONS!"); + Centre(30,YELLOW,"ENTER YOUR INITIALS"); + Centre(40,YELLOW,"FOR THE TOP PILOTS"); + + hisc[pos].name[len]=*let; + hisc[pos].name[len+1]=0; + + for(f=0;fMAXLEVEL)) + err("illegal no of levels"); + + for(f=0;f