commit 64aec5d376679c0a9d1ca50f19af2951d33ea87c Author: Simon Morgan Date: Sat Aug 5 16:30:32 2017 +0100 Initial import diff --git a/License.txt b/License.txt new file mode 100644 index 0000000..5b6e7c6 --- /dev/null +++ b/License.txt @@ -0,0 +1,340 @@ + 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) + + 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) year 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/ReadMe.txt b/ReadMe.txt new file mode 100644 index 0000000..891a08b --- /dev/null +++ b/ReadMe.txt @@ -0,0 +1,42 @@ +SPACE TRADER 1.2.2 SOURCE CODE +****************************** + +This package contains the source code of Space Trader 1.2.2. The author and copyright holder of Space Trader is Pieter Spronck. The homepage for the game is http://www.spronck.net/picoverse/spacetrader. + +You should unzip the package with the option to create subdirectories on. + + +License +******* + +This code is distributed under the GNU General Public License. The GPL license is found in the file License.txt, included in the package, and can also be found on the Web at http://www.opensource.org/licenses/gpl-license.html or http://www.gnu.org/copyleft/gpl.html. + +In general, this license protects the author's copyright to his own code, but allows others to create their own programs based on this code, provided they distribute these programs under the same conditions as the original program, that is, also under the GPL license (which means, among other things, that you should release the program with source code). There are, of course, more details to the license, which you can look up in the complete license text. + +Please do not release a new version of Space Trader without consulting me. For the time being, I would prefer to remain the only person who releases Space Trader versions. You can, however, create new programs based on the Space Trader code, port Space Trader to another platform or translate it into another language (please, consult me before you do that, and be warned that I still intend to enhance the program), use parts of the code in your own programs, and experiment with changes which you can then email to me so I can incorporate them in a new release. + +In addition, if you do wish to make use of this code for another program, I'd like you to mention this somewhere in your program, and to inform me of your efforts, especially if you intend to distribute it. If nothing else, I might give you some advice on how to best use the code. Or, in case you intend to port it to another platform, I can inform you whether or not someone else is already creating such a port. + +Note that the in-game pictures, except for the program's icon, are copyrighted by Alexander Lawrence. You can contact him at al_virtual@yahoo.com. + + +Coding environment +****************** + +Space Trader is developed in C with CodeWarrior for the Palm, version 8.3. I used the 4.0 SDKs with the latest patches which include many warnings about OS 5.0 idiosyncracies. Any issues previous versions of the code had with OS 5.0 have been resolved for this release. For version 1.2.2 of Space Trader I found the Constructor had problems, so I used the Constructor version 1.9, which comes with CodeWarrior 9. I could not transfer all source codes to CodeWarrior 9, because they started to generate errors there. + +I use a tab setting of 4. + +In the Space Trader project file, three targets are defined: a color version, a grayscale version and a black & white version. Each of these targets creates a PRC file with the name SpaceTrader.prc. You should make each target separately and rename it to the appropriate name. I could have specified a different output name for each target, but then you would not be able to replace one with another on your Palm. If you want to add a new picture to the game, you must add the black & white version to the MerchantBW resource file, the grayscale version to the MerchantGray resource file, and the color version to the MerchantColor resource file. You must also add a BitmapFamily for the new picture to each of these resource files, and this BitmapFamily MUST have the same name and number in each of the files. Check the other BitmapFamilies for examples. + +The current code supports Palm OS 2.0 and higher. I have not used any functions that didn't exist in OS version 2.0. Of course, the color and grayscale versions need at least OS 3.5 to run. If you update the code, be very careful using functions not defined in the OS 2.0 feature set. As soon as you use such a function, you restrict the user base considerably. Also note that several control types (like graphic buttons) and fonts (like LargeBold) didn't exist in OS 2.0. + +If you create your own version of this program, you should definitely change the Creator ID, otherwise you will get into problems when Space Trader is installed on the same Palm where you install your own version. The Creator ID of Space Trader is "STra", and you need to change it inside the CodeWarrior Constructor (the ID exists in several places in the resource file and in the program code, and it must be changed in all those places). + + +Remarks +******* + +Space Trader is my first Palm program. I am not a Palm programming wizard and haven't studied this environment very deeply. It may be that I haven't used the best way to code certain things. + +Copyright (C) 2000, 2001, 2002, 2005 by Pieter Spronck. \ No newline at end of file diff --git a/Rsc/Merchant.rsrc b/Rsc/Merchant.rsrc new file mode 100644 index 0000000..e69de29 diff --git a/Rsc/MerchantBW.rsrc b/Rsc/MerchantBW.rsrc new file mode 100644 index 0000000..e69de29 diff --git a/Rsc/MerchantColor.rsrc b/Rsc/MerchantColor.rsrc new file mode 100644 index 0000000..e69de29 diff --git a/Rsc/MerchantGraphics.h b/Rsc/MerchantGraphics.h new file mode 100644 index 0000000..e7ea9cc --- /dev/null +++ b/Rsc/MerchantGraphics.h @@ -0,0 +1,432 @@ +// Header generated by Constructor for Palm OS (R) 1.6.2 +// +// Generated at 17:10:41 on maandag 27 januari 2003 +// +// Generated for file: C:\CW8\SourceCode\Space Trader\Rsc\Merchant16bits.rsrc +// +// THIS IS AN AUTOMATICALLY GENERATED HEADER FILE +// DO NOT EDIT - CHANGES MADE TO THIS FILE WILL BE LOST +// +// Palm App Name: "Untitled" +// +// Palm App Version: "1.0" + + +// Resource: PICT 3900 +#define VisitedSystemBitmap 3900 + +// Resource: PICT 4500 +#define WormholeBitmap 4500 + +// Resource: PICT 3500 +#define CurrentSystemBitmap 3500 + +// Resource: PICT 3300 +#define SystemBitmap 3300 + +// Resource: PICT 3700 +#define ShortRangeSystemBitmap 3700 + +// Resource: PICT 4100 +#define CurrentVisitedSystemBitmap 4100 + +// Resource: PICT 4300 +#define VisitedShortRangeSystemBitmap 4300 + +// Resource: PICT 4700 +#define SmallWormholeBitmap 4700 + +// Resource: PICT 5300 +#define FleaBitmap 5300 + +// Resource: PICT 5500 +#define FleaDamagedBitmap 5500 + +// Resource: PICT 6100 +#define GnatBitmap 6100 + +// Resource: PICT 6300 +#define GnatDamagedBitmap 6300 + +// Resource: PICT 6900 +#define FireflyBitmap 6900 + +// Resource: PICT 7100 +#define FireflyDamagedBitmap 7100 + +// Resource: PICT 7300 +#define FireflyShieldedBitmap 7300 + +// Resource: PICT 7500 +#define FireflyShDamBitmap 7500 + +// Resource: PICT 7700 +#define MosquitoBitmap 7700 + +// Resource: PICT 7900 +#define MosquitoDamagedBitmap 7900 + +// Resource: PICT 8100 +#define MosquitoShieldedBitmap 8100 + +// Resource: PICT 8300 +#define MosquitoShDamBitmap 8300 + +// Resource: PICT 8500 +#define BumblebeeBitmap 8500 + +// Resource: PICT 8700 +#define BumblebeeDamagedBitmap 8700 + +// Resource: PICT 8900 +#define BumblebeeShieldedBitmap 8900 + +// Resource: PICT 9100 +#define BumblebeeShDamBitmap 9100 + +// Resource: PICT 9300 +#define BeetleBitmap 9300 + +// Resource: PICT 9500 +#define BeetleDamagedBitmap 9500 + +// Resource: PICT 9700 +#define BeetleShieldedBitmap 9700 + +// Resource: PICT 9900 +#define BeetleShDamBitmap 9900 + +// Resource: PICT 10100 +#define HornetBitmap 10100 + +// Resource: PICT 10300 +#define HornetDamagedBitmap 10300 + +// Resource: PICT 10500 +#define HornetShieldedBitmap 10500 + +// Resource: PICT 10700 +#define HornetShDamBitmap 10700 + +// Resource: PICT 10900 +#define GrasshopperBitmap 10900 + +// Resource: PICT 11100 +#define GrasshopperDamagedBitmap 11100 + +// Resource: PICT 11300 +#define GrasshopperShieldedBitmap 11300 + +// Resource: PICT 11500 +#define GrasshopperShDamBitmap 11500 + +// Resource: PICT 11700 +#define TermiteBitmap 11700 + +// Resource: PICT 11900 +#define TermiteDamagedBitmap 11900 + +// Resource: PICT 12100 +#define TermiteShieldedBitmap 12100 + +// Resource: PICT 12300 +#define TermiteShDamBitmap 12300 + +// Resource: PICT 12500 +#define WaspBitmap 12500 + +// Resource: PICT 12700 +#define WaspDamagedBitmap 12700 + +// Resource: PICT 12900 +#define WaspShieldedBitmap 12900 + +// Resource: PICT 13100 +#define WaspShDamBitmap 13100 + +// Resource: PICT 13300 +#define MonsterBitmap 13300 + +// Resource: PICT 13500 +#define MonsterDamagedBitmap 13500 + +// Resource: PICT 14100 +#define DragonflyBitmap 14100 + +// Resource: PICT 14300 +#define DragonflyDamagedBitmap 14300 + +// Resource: PICT 14500 +#define DragonflyShieldedBitmap 14500 + +// Resource: PICT 14700 +#define DragonflyShDamBitmap 14700 + +// Resource: PICT 14900 +#define MantisBitmap 14900 + +// Resource: PICT 15100 +#define MantisDamagedBitmap 15100 + +// Resource: PICT 15300 +#define MantisShieldedBitmap 15300 + +// Resource: PICT 15500 +#define MantisShDamBitmap 15500 + +// Resource: PICT 16500 +#define RetireBitmap 16500 + +// Resource: PICT 16700 +#define DestroyedBitmap 16700 + +// Resource: PICT 5100 +#define UtopiaBitmap 5100 + +// Resource: PICT 4900 +#define SpaceTraderBitmap 4900 + +// Resource: PICT 16900 +#define PirateBitmap 16900 + +// Resource: PICT 17100 +#define PoliceBitmap 17100 + +// Resource: PICT 17300 +#define TraderBitmap 17300 + +// Resource: PICT 17500 +#define AlienBitmap 17500 + +// Resource: PICT 17700 +#define AttackBitmap 17700 + +// Resource: PICT 17900 +#define Attack2Bitmap 17900 + +// Resource: PICT 15700 +#define ScarabBitmap 15700 + +// Resource: PICT 18100 +#define SpecialBitmap 18100 + +// Resource: PICT 15900 +#define BottleBitmap 15900 + +// Resource: PICT 16100 +#define ScarabDamagedBitmap 16100 + +// Resource: PICT 18200 +#define AboutBitmap 18200 + + +// Resource: tbmf 7900 +#define BottleDamagedBitmapFamily 7900 + +// Resource: tbmf 7800 +#define BottleBitmapFamily 7800 + +// Resource: tbmf 11100 +#define Attack2BitmapFamily 11100 + +// Resource: tbmf 9500 +#define PirateBitmapFamily 9500 + +// Resource: tbmf 9600 +#define PoliceBitmapFamily 9600 + +// Resource: tbmf 9800 +#define AlienBitmapFamily 9800 + +// Resource: tbmf 9700 +#define TraderBitmapFamily 9700 + +// Resource: tbmf 11000 +#define AttackBitmapFamily 11000 + +// Resource: tbmf 9900 +#define SpecialBitmapFamily 9900 + +// Resource: tbmf 7400 +#define ScarabBitmapFamily 7400 + +// Resource: tbmf 7500 +#define ScarabDamagedBitmapFamily 7500 + +// Resource: tbmf 12000 +#define DestroyedBitmapFamily 12000 + +// Resource: tbmf 7300 +#define MantisShDamBitmapFamily 7300 + +// Resource: tbmf 7200 +#define MantisShieldedBitmapFamily 7200 + +// Resource: tbmf 7100 +#define MantisDamagedBitmapFamily 7100 + +// Resource: tbmf 7000 +#define MantisBitmapFamily 7000 + +// Resource: tbmf 6900 +#define DragonflyShDamBitmapFamily 6900 + +// Resource: tbmf 6800 +#define DragonflyShieldedBitmapFamily 6800 + +// Resource: tbmf 6700 +#define DragonflyDamagedBitmapFamily 6700 + +// Resource: tbmf 6600 +#define DragonflyBitmapFamily 6600 + +// Resource: tbmf 6300 +#define MonsterDamagedBitmapFamily 6300 + +// Resource: tbmf 6200 +#define MonsterBitmapFamily 6200 + +// Resource: tbmf 6100 +#define WaspShDamBitmapFamily 6100 + +// Resource: tbmf 6000 +#define WaspShieldedBitmapFamily 6000 + +// Resource: tbmf 5900 +#define WaspDamagedBitmapFamily 5900 + +// Resource: tbmf 5800 +#define WaspBitmapFamily 5800 + +// Resource: tbmf 5700 +#define TermiteShDamBitmapFamily 5700 + +// Resource: tbmf 5600 +#define TermiteShieldedBitmapFamily 5600 + +// Resource: tbmf 5500 +#define TermiteDamagedBitmapFamily 5500 + +// Resource: tbmf 5400 +#define TermiteBitmapFamily 5400 + +// Resource: tbmf 5300 +#define GrasshopperShDamBitmapFamily 5300 + +// Resource: tbmf 5200 +#define GrasshopperShieldedBitmapFamily 5200 + +// Resource: tbmf 5100 +#define GrasshopperDamagedBitmapFamily 5100 + +// Resource: tbmf 5000 +#define GrasshopperBitmapFamily 5000 + +// Resource: tbmf 4900 +#define HornetShDamBitmapFamily 4900 + +// Resource: tbmf 4800 +#define HornetShieldedBitmapFamily 4800 + +// Resource: tbmf 4700 +#define HornetDamagedBitmapFamily 4700 + +// Resource: tbmf 4600 +#define HornetBitmapFamily 4600 + +// Resource: tbmf 4500 +#define BeetleShDamBitmapFamily 4500 + +// Resource: tbmf 4400 +#define BeetleShieldedBitmapFamily 4400 + +// Resource: tbmf 4300 +#define BeetleDamagedBitmapFamily 4300 + +// Resource: tbmf 4200 +#define BeetleBitmapFamily 4200 + +// Resource: tbmf 4100 +#define BumblebeeShDamBitmapFamily 4100 + +// Resource: tbmf 4000 +#define BumblebeeShieldedBitmapFamily 4000 + +// Resource: tbmf 3900 +#define BumblebeeDamagedBitmapFamily 3900 + +// Resource: tbmf 3800 +#define BumblebeeBitmapFamily 3800 + +// Resource: tbmf 3700 +#define MosquitoShDamBitmapFamily 3700 + +// Resource: tbmf 3600 +#define MosquitoShieldedBitmapFamily 3600 + +// Resource: tbmf 3500 +#define MosquitoDamagedBitmapFamily 3500 + +// Resource: tbmf 3400 +#define MosquitoBitmapFamily 3400 + +// Resource: tbmf 3300 +#define FireflyShDamBitmapFamily 3300 + +// Resource: tbmf 3200 +#define FireflyShieldedBitmapFamily 3200 + +// Resource: tbmf 3100 +#define FireflyDamagedBitmapFamily 3100 + +// Resource: tbmf 3000 +#define FireflyBitmapFamily 3000 + +// Resource: tbmf 2700 +#define GnatDamagedBitmapFamily 2700 + +// Resource: tbmf 2600 +#define GnatBitmapFamily 2600 + +// Resource: tbmf 1100 +#define RetireBitmapFamily 1100 + +// Resource: tbmf 2300 +#define FleaDamagedBitmapFamily 2300 + +// Resource: tbmf 2200 +#define FleaBitmapFamily 2200 + +// Resource: tbmf 1800 +#define UtopiaBitmapFamily 1800 + +// Resource: tbmf 1500 +#define SpaceTraderBitmapFamily 1500 + +// Resource: tbmf 1700 +#define SmallWormholeBitmapFamily 1700 + +// Resource: tbmf 1600 +#define WormholeBitmapFamily 1600 + +// Resource: tbmf 2100 +#define VisitedShortRangeSystemBitmapFamily 2100 + +// Resource: tbmf 2000 +#define CurrentVisitedSystemBitmapFamily 2000 + +// Resource: tbmf 1900 +#define VisitedSystemBitmapFamily 1900 + +// Resource: tbmf 1400 +#define ShortRangeSystemBitmapFamily 1400 + +// Resource: tbmf 1300 +#define CurrentSystemBitmapFamily 1300 + +// Resource: tbmf 1200 +#define SystemBitmapFamily 1200 + +// Resource: tbmf 1000 +#define AboutBitmapFamily 1000 + diff --git a/Rsc/MerchantGray.rsrc b/Rsc/MerchantGray.rsrc new file mode 100644 index 0000000..e69de29 diff --git a/Rsc/MerchantRsc.h b/Rsc/MerchantRsc.h new file mode 100644 index 0000000..c6e63d9 --- /dev/null +++ b/Rsc/MerchantRsc.h @@ -0,0 +1,2423 @@ +// Header generated by Constructor for Palm OS (R) 1.9 +// +// Generated at 23:20:58 on Monday, 05 December, 2005 +// +// Generated for file: Merchant.rsrc +// +// THIS IS AN AUTOMATICALLY GENERATED HEADER FILE +// DO NOT EDIT - CHANGES MADE TO THIS FILE WILL BE LOST +// +// Palm App Name: "Space Trader" +// +// Palm App Version: "1.2.2" + + +// Resource: tFRM 1000 +#define MainForm 1000 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1200, Default Button ID = 0) +#define MainBitMapSpaceMerchantBitMap 1500 //(Left Origin = 0, Top Origin = 0, Bitmap Resource ID = 1500, Usable = 1) + +// Resource: tFRM 1400 +#define SystemInformationForm 1400 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define SystemInformationSpecialButton 1417 //(Left Origin = 122, Top Origin = 147, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SystemInformationMercenaryForHireButton 1418 //(Left Origin = 30, Top Origin = 147, Width = 88, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SystemInformationNewsButton 1419 //(Left Origin = 1, Top Origin = 147, Width = 25, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SystemInformationBButton 1450 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SystemInformationSButton 1451 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SystemInformationYButton 1452 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SystemInformationWButton 1453 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SystemInformationSystemNameLabel 1401 //(Left Origin = 80, Top Origin = 21, Usable = 1, Font = Standard) +#define SystemInformationUnnamed1402Label 1402 //(Left Origin = 0, Top Origin = 20, Usable = 1, Font = Bold) +#define SystemInformationUnnamed1403Label 1403 //(Left Origin = 0, Top Origin = 48, Usable = 1, Font = Bold) +#define SystemInformationTechLevelLabel 1404 //(Left Origin = 80, Top Origin = 48, Usable = 1, Font = Standard) +#define SystemInformationUnnamed1405Label 1405 //(Left Origin = 0, Top Origin = 62, Usable = 1, Font = Bold) +#define SystemInformationGovernmentLabel 1406 //(Left Origin = 80, Top Origin = 62, Usable = 1, Font = Standard) +#define SystemInformationUnnamed1407Label 1407 //(Left Origin = 0, Top Origin = 118, Usable = 1, Font = Standard) +#define SystemInformationStatusLabel 1408 //(Left Origin = 0, Top Origin = 130, Usable = 1, Font = Standard) +#define SystemInformationUnnamed1409Label 1409 //(Left Origin = 0, Top Origin = 76, Usable = 1, Font = Bold) +#define SystemInformationResourcesLabel 1410 //(Left Origin = 80, Top Origin = 76, Usable = 1, Font = Standard) +#define SystemInformationUnnamed1411Label 1411 //(Left Origin = 0, Top Origin = 34, Usable = 1, Font = Bold) +#define SystemInformationSizeLabel 1412 //(Left Origin = 80, Top Origin = 35, Usable = 1, Font = Standard) +#define SystemInformationUnnamed1413Label 1413 //(Left Origin = 0, Top Origin = 90, Usable = 1, Font = Bold) +#define SystemInformationPoliceLabel 1414 //(Left Origin = 80, Top Origin = 90, Usable = 1, Font = Standard) +#define SystemInformationUnnamed1415Label 1415 //(Left Origin = 0, Top Origin = 104, Usable = 1, Font = Bold) +#define SystemInformationPiratesLabel 1416 //(Left Origin = 80, Top Origin = 104, Usable = 1, Font = Standard) + +// Resource: tFRM 1200 +#define AboutForm 1200 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 15700, Menu Bar ID = 0, Default Button ID = 1206) +#define AboutUnnamed1206Button 1206 //(Left Origin = 61, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AboutUnnamed1207BitMap 1000 //(Left Origin = 3, Top Origin = 18, Bitmap Resource ID = 1000, Usable = 1) +#define AboutLabelAboutLabel 1201 //(Left Origin = 38, Top Origin = 18, Usable = 1, Font = Bold) +#define AboutLabelCopyrightLabel 1202 //(Left Origin = 38, Top Origin = 33, Usable = 1, Font = Standard) +#define AboutLabelAuthorLabel 1204 //(Left Origin = 39, Top Origin = 45, Usable = 1, Font = Standard) +#define AboutLabelEmailLabel 1205 //(Left Origin = 38, Top Origin = 111, Usable = 1, Font = Standard) +#define AboutWebLabel 1207 //(Left Origin = 38, Top Origin = 123, Usable = 1, Font = Standard) +#define AboutAdditionalLabel 1209 //(Left Origin = 38, Top Origin = 85, Usable = 1, Font = Standard) +#define AboutPictureCopyrightLabel 1210 //(Left Origin = 38, Top Origin = 59, Usable = 1, Font = Standard) +#define AboutAlexanderLabel 1211 //(Left Origin = 38, Top Origin = 71, Usable = 1, Font = Standard) +#define AboutSamLabel 1212 //(Left Origin = 38, Top Origin = 97, Usable = 1, Font = Standard) + +// Resource: tFRM 1300 +#define NewCommanderForm 1300 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 1400, Menu Bar ID = 1200, Default Button ID = 1301) +#define NewCommanderOKButton 1301 //(Left Origin = 60, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderDecPilotButton 1306 //(Left Origin = 60, Top Origin = 73, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderDecDifficultyButton 1307 //(Left Origin = 60, Top Origin = 40, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderIncPilotButton 1308 //(Left Origin = 94, Top Origin = 73, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderDecFighterButton 1310 //(Left Origin = 60, Top Origin = 88, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderIncFighterButton 1312 //(Left Origin = 94, Top Origin = 88, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderDecTraderButton 1314 //(Left Origin = 60, Top Origin = 103, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderIncDifficultyButton 1315 //(Left Origin = 124, Top Origin = 40, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderIncTraderButton 1316 //(Left Origin = 94, Top Origin = 103, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderDecEngineerButton 1318 //(Left Origin = 60, Top Origin = 118, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderIncEngineerButton 1320 //(Left Origin = 94, Top Origin = 118, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define NewCommanderEditNameField 1304 //(Left Origin = 46, Top Origin = 20, Width = 104, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 20, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0) +#define NewCommanderUnnamed1322GraffitiShift 1322 //(Left Origin = 144, Top Origin = 144) +#define NewCommanderLabelSkillLabel 1302 //(Left Origin = 8, Top Origin = 58, Usable = 1, Font = Standard) +#define NewCommanderLabelNameLabel 1303 //(Left Origin = 8, Top Origin = 20, Usable = 1, Font = Standard) +#define NewCommanderUnnamed1305Label 1305 //(Left Origin = 8, Top Origin = 73, Usable = 1, Font = Standard) +#define NewCommanderUnnamed1309Label 1309 //(Left Origin = 8, Top Origin = 88, Usable = 1, Font = Standard) +#define NewCommanderUnnamed1311Label 1311 //(Left Origin = 8, Top Origin = 40, Usable = 1, Font = Standard) +#define NewCommanderUnnamed1313Label 1313 //(Left Origin = 8, Top Origin = 103, Usable = 1, Font = Standard) +#define NewCommanderUnnamed1317Label 1317 //(Left Origin = 8, Top Origin = 118, Usable = 1, Font = Standard) + +// Resource: tFRM 1500 +#define GalacticChartForm 1500 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define GalacticChartFindButton 1501 //(Left Origin = 123, Top Origin = 135, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define GalacticChartSuperWarpButton 1502 //(Left Origin = 108, Top Origin = 135, Width = 11, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define GalacticChartBButton 1550 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define GalacticChartSButton 1551 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define GalacticChartYButton 1552 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define GalacticChartWButton 1553 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define GalacticChartTestingGadget2Gadget 1503 //(Left Origin = 0, Top Origin = 15, Width = 160, Height = 118, Usable = 1) + +// Resource: tFRM 1600 +#define WarpForm 1600 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define WarpBButton 1650 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define WarpSButton 1651 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define WarpYButton 1652 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define WarpWButton 1653 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define WarpTestingGadgetGadget 1601 //(Left Origin = 0, Top Origin = 15, Width = 160, Height = 145, Usable = 1) + +// Resource: tFRM 1700 +#define ExecuteWarpForm 1700 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 1717) +#define ExecuteWarpWarpButton 1715 //(Left Origin = 117, Top Origin = 130, Width = 42, Height = 29, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Large) +#define ExecuteWarpChartButton 1717 //(Left Origin = 1, Top Origin = 147, Width = 90, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ExecuteWarpPricesButton 1718 //(Left Origin = 1, Top Origin = 130, Width = 90, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ExecuteWarpSpecificationButton 1721 //(Left Origin = 117, Top Origin = 109, Width = 42, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ExecuteWarpScrollBackButton 1722 //(Left Origin = 134, Top Origin = 18, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 0, Non-bold Frame = 1, Font = Symbol) +#define ExecuteWarpScrollFwdButton 1723 //(Left Origin = 147, Top Origin = 18, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 0, Non-bold Frame = 1, Font = Symbol) +#define ExecuteWarpBButton 1750 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ExecuteWarpSButton 1751 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ExecuteWarpYButton 1752 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ExecuteWarpWButton 1753 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ExecuteWarpSystemNameLabel 1701 //(Left Origin = 76, Top Origin = 18, Usable = 1, Font = Standard) +#define ExecuteWarpUnnamed1702Label 1702 //(Left Origin = 0, Top Origin = 18, Usable = 1, Font = Bold) +#define ExecuteWarpUnnamed1703Label 1703 //(Left Origin = 0, Top Origin = 44, Usable = 1, Font = Bold) +#define ExecuteWarpTechLevelLabel 1704 //(Left Origin = 77, Top Origin = 44, Usable = 1, Font = Standard) +#define ExecuteWarpUnnamed1705Label 1705 //(Left Origin = 0, Top Origin = 57, Usable = 1, Font = Bold) +#define ExecuteWarpGovernmentLabel 1706 //(Left Origin = 76, Top Origin = 57, Usable = 1, Font = Standard) +#define ExecuteWarpUnnamed1707Label 1707 //(Left Origin = 0, Top Origin = 83, Usable = 1, Font = Bold) +#define ExecuteWarpPoliceLabel 1708 //(Left Origin = 76, Top Origin = 83, Usable = 1, Font = Standard) +#define ExecuteWarpUnnamed1709Label 1709 //(Left Origin = 0, Top Origin = 31, Usable = 1, Font = Bold) +#define ExecuteWarpSizeLabel 1710 //(Left Origin = 76, Top Origin = 31, Usable = 1, Font = Standard) +#define ExecuteWarpUnnamed1711Label 1711 //(Left Origin = 0, Top Origin = 70, Usable = 1, Font = Bold) +#define ExecuteWarpRangeLabel 1712 //(Left Origin = 76, Top Origin = 70, Usable = 1, Font = Standard) +#define ExecuteWarpUnnamed1713Label 1713 //(Left Origin = 0, Top Origin = 96, Usable = 1, Font = Bold) +#define ExecuteWarpOutOfRangeLabel 1714 //(Left Origin = 0, Top Origin = 122, Usable = 0, Font = Standard) +#define ExecuteWarpPiratesLabel 1716 //(Left Origin = 76, Top Origin = 96, Usable = 1, Font = Standard) +#define ExecuteWarpUnnamed1719Label 1719 //(Left Origin = 0, Top Origin = 109, Usable = 1, Font = Bold) +#define ExecuteWarpCurrentCostsLabel 1720 //(Left Origin = 76, Top Origin = 109, Usable = 1, Font = Standard) + +// Resource: tFRM 1800 +#define BuyCargoForm 1800 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define BuyCargoQty0Button 1801 //(Left Origin = 1, Top Origin = 17, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoQty1Button 1802 //(Left Origin = 1, Top Origin = 30, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoQty2Button 1803 //(Left Origin = 1, Top Origin = 43, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoQty3Button 1804 //(Left Origin = 1, Top Origin = 56, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoQty4Button 1805 //(Left Origin = 1, Top Origin = 69, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoQty5Button 1806 //(Left Origin = 1, Top Origin = 82, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoQty6Button 1807 //(Left Origin = 1, Top Origin = 95, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoQty7Button 1808 //(Left Origin = 1, Top Origin = 108, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoQty8Button 1809 //(Left Origin = 1, Top Origin = 121, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoQty9Button 1810 //(Left Origin = 1, Top Origin = 134, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoAll0Button 1811 //(Left Origin = 81, Top Origin = 17, Width = 24, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoAll1Button 1812 //(Left Origin = 81, Top Origin = 30, Width = 24, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoAll2Button 1813 //(Left Origin = 81, Top Origin = 43, Width = 24, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoAll3Button 1814 //(Left Origin = 81, Top Origin = 56, Width = 24, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoAll4Button 1815 //(Left Origin = 81, Top Origin = 69, Width = 24, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoAll5Button 1816 //(Left Origin = 81, Top Origin = 82, Width = 24, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoAll6Button 1817 //(Left Origin = 81, Top Origin = 95, Width = 24, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoAll7Button 1818 //(Left Origin = 81, Top Origin = 108, Width = 24, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoAll8Button 1819 //(Left Origin = 81, Top Origin = 121, Width = 24, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoAll9Button 1820 //(Left Origin = 81, Top Origin = 134, Width = 24, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoBButton 1850 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoSButton 1851 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoYButton 1852 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyCargoWButton 1853 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 1900 +#define SellCargoForm 1900 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define SellCargoQty0Button 1901 //(Left Origin = 1, Top Origin = 17, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoQty1Button 1902 //(Left Origin = 1, Top Origin = 30, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoQty2Button 1903 //(Left Origin = 1, Top Origin = 43, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoQty3Button 1904 //(Left Origin = 1, Top Origin = 56, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoQty4Button 1905 //(Left Origin = 1, Top Origin = 69, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoQty5Button 1906 //(Left Origin = 1, Top Origin = 82, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoQty6Button 1907 //(Left Origin = 1, Top Origin = 95, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoQty7Button 1908 //(Left Origin = 1, Top Origin = 108, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoQty8Button 1909 //(Left Origin = 1, Top Origin = 121, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoQty9Button 1910 //(Left Origin = 1, Top Origin = 134, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoAll0Button 1911 //(Left Origin = 81, Top Origin = 17, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoAll1Button 1912 //(Left Origin = 81, Top Origin = 30, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoAll2Button 1913 //(Left Origin = 81, Top Origin = 43, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoAll3Button 1914 //(Left Origin = 81, Top Origin = 56, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoAll4Button 1915 //(Left Origin = 81, Top Origin = 69, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoAll5Button 1916 //(Left Origin = 81, Top Origin = 82, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoAll6Button 1917 //(Left Origin = 81, Top Origin = 95, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoAll7Button 1918 //(Left Origin = 81, Top Origin = 108, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoAll8Button 1919 //(Left Origin = 81, Top Origin = 121, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoAll9Button 1920 //(Left Origin = 81, Top Origin = 134, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoDump0Button 1921 //(Left Origin = 81, Top Origin = 17, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoDump1Button 1922 //(Left Origin = 81, Top Origin = 30, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoDump2Button 1923 //(Left Origin = 81, Top Origin = 43, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoDump3Button 1924 //(Left Origin = 81, Top Origin = 56, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoDump4Button 1925 //(Left Origin = 81, Top Origin = 69, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoDump5Button 1926 //(Left Origin = 81, Top Origin = 82, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoDump6Button 1927 //(Left Origin = 81, Top Origin = 95, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoDump7Button 1928 //(Left Origin = 81, Top Origin = 108, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoDump8Button 1929 //(Left Origin = 81, Top Origin = 121, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoDump9Button 1930 //(Left Origin = 81, Top Origin = 134, Width = 29, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoBButton 1950 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoSButton 1951 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoYButton 1952 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellCargoWButton 1953 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 2000 +#define AmountToBuyForm 2000 //(Left Origin = 2, Top Origin = 94, Width = 156, Height = 64, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 2300, Menu Bar ID = 0, Default Button ID = 2005) +#define AmountToBuyOKButton 2003 //(Left Origin = 6, Top Origin = 48, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AmountToBuyAllButton 2004 //(Left Origin = 48, Top Origin = 48, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AmountToBuyNoneButton 2005 //(Left Origin = 90, Top Origin = 48, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AmountToBuyToBuyField 2006 //(Left Origin = 137, Top Origin = 30, Width = 15, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define AmountToBuyMaxToBuyLabel 2001 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define AmountToBuyUnnamed2002Label 2002 //(Left Origin = 6, Top Origin = 31, Usable = 1, Font = Standard) + +// Resource: tFRM 2100 +#define AmountToSellForm 2100 //(Left Origin = 2, Top Origin = 62, Width = 156, Height = 96, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 2500, Menu Bar ID = 0, Default Button ID = 2105) +#define AmountToSellOKButton 2103 //(Left Origin = 6, Top Origin = 80, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AmountToSellAllButton 2104 //(Left Origin = 48, Top Origin = 80, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AmountToSellNoneButton 2105 //(Left Origin = 90, Top Origin = 80, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AmountToSellToSellField 2106 //(Left Origin = 135, Top Origin = 60, Width = 15, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define AmountToSellMaxToSellLabel 2101 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define AmountToSellHowManyLabel 2102 //(Left Origin = 6, Top Origin = 60, Usable = 1, Font = Standard) +#define AmountToSellAveragePriceLabel 2107 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) +#define AmountToSellAverageProfitLabel 2108 //(Left Origin = 6, Top Origin = 46, Usable = 1, Font = Standard) + +// Resource: tFRM 2200 +#define ShipYardForm 2200 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define ShipYardEscapePodButton 2201 //(Left Origin = 1, Top Origin = 146, Width = 76, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShipYardShipInformationButton 2202 //(Left Origin = 1, Top Origin = 116, Width = 76, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShipYardBuyFuelButton 2203 //(Left Origin = 1, Top Origin = 44, Width = 48, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShipYardFullTankButton 2204 //(Left Origin = 56, Top Origin = 44, Width = 64, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShipYardRepairButton 2207 //(Left Origin = 1, Top Origin = 86, Width = 48, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShipYardFullRepairsButton 2208 //(Left Origin = 56, Top Origin = 86, Width = 64, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShipYardBuyNewShipButton 2210 //(Left Origin = 1, Top Origin = 116, Width = 76, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShipYardBButton 2250 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShipYardSButton 2251 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShipYardYButton 2252 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShipYardWButton 2253 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 2300 +#define BuyFuelForm 2300 //(Left Origin = 2, Top Origin = 90, Width = 156, Height = 68, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 2700, Menu Bar ID = 0, Default Button ID = 2306) +#define BuyFuelOKButton 2304 //(Left Origin = 6, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyFuelAllButton 2305 //(Left Origin = 48, Top Origin = 52, Width = 52, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyFuelNoneButton 2306 //(Left Origin = 106, Top Origin = 52, Width = 40, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyFuelForFuelField 2303 //(Left Origin = 90, Top Origin = 32, Width = 15, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define BuyFuelUnnamed2301Label 2301 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define BuyFuelUnnamed2302Label 2302 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) + +// Resource: tFRM 2400 +#define BuyRepairsForm 2400 //(Left Origin = 2, Top Origin = 90, Width = 156, Height = 68, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 2800, Menu Bar ID = 0, Default Button ID = 2406) +#define BuyRepairsOKButton 2404 //(Left Origin = 6, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyRepairsAllButton 2405 //(Left Origin = 48, Top Origin = 52, Width = 52, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyRepairsNoneButton 2406 //(Left Origin = 106, Top Origin = 52, Width = 40, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyRepairsForRepairsField 2403 //(Left Origin = 100, Top Origin = 32, Width = 20, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 4, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define BuyRepairsUnnamed2401Label 2401 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define BuyRepairsUnnamed2402Label 2402 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) + +// Resource: tFRM 2500 +#define BuyShipForm 2500 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define BuyShipInfo0Button 2501 //(Left Origin = 86, Top Origin = 17, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipInfo1Button 2502 //(Left Origin = 86, Top Origin = 30, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipInfo2Button 2503 //(Left Origin = 86, Top Origin = 43, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipInfo3Button 2504 //(Left Origin = 86, Top Origin = 56, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipInfo4Button 2505 //(Left Origin = 86, Top Origin = 69, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipInfo5Button 2506 //(Left Origin = 86, Top Origin = 82, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipInfo6Button 2507 //(Left Origin = 86, Top Origin = 95, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipInfo7Button 2508 //(Left Origin = 86, Top Origin = 108, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipInfo8Button 2509 //(Left Origin = 86, Top Origin = 121, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipInfo9Button 2510 //(Left Origin = 86, Top Origin = 134, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBuy0Button 2511 //(Left Origin = 1, Top Origin = 17, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBuy1Button 2512 //(Left Origin = 1, Top Origin = 30, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBuy2Button 2513 //(Left Origin = 1, Top Origin = 43, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBuy3Button 2514 //(Left Origin = 1, Top Origin = 56, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBuy4Button 2515 //(Left Origin = 1, Top Origin = 69, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBuy5Button 2516 //(Left Origin = 1, Top Origin = 82, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBuy6Button 2517 //(Left Origin = 1, Top Origin = 95, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBuy7Button 2518 //(Left Origin = 1, Top Origin = 108, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBuy8Button 2519 //(Left Origin = 1, Top Origin = 121, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBuy9Button 2520 //(Left Origin = 1, Top Origin = 134, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipBButton 2550 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipSButton 2551 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipYButton 2552 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyShipWButton 2553 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 2600 +#define TradeInShipForm 2600 //(Left Origin = 2, Top Origin = 90, Width = 156, Height = 68, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 3100, Menu Bar ID = 0, Default Button ID = 2602) +#define TradeInShipYesButton 2601 //(Left Origin = 6, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define TradeInShipNoButton 2602 //(Left Origin = 48, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define TradeInShipUnnamed2603Label 2603 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define TradeInShipTradeInShipLabel 2604 //(Left Origin = 5, Top Origin = 32, Usable = 1, Font = Standard) + +// Resource: tFRM 2700 +#define ShiptypeInfoForm 2700 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 3300, Menu Bar ID = 1000, Default Button ID = 2717) +#define ShiptypeInfoShipForSaleButton 2717 //(Left Origin = 6, Top Origin = 140, Width = 86, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShiptypeInfoShipNameLabel 2701 //(Left Origin = 86, Top Origin = 18, Usable = 1, Font = Standard) +#define ShiptypeInfoUnnamed2702Label 2702 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Bold) +#define ShiptypeInfoUnnamed2703Label 2703 //(Left Origin = 6, Top Origin = 82, Usable = 1, Font = Bold) +#define ShiptypeInfoWeaponSlotsLabel 2704 //(Left Origin = 86, Top Origin = 82, Usable = 1, Font = Standard) +#define ShiptypeInfoUnnamed2705Label 2705 //(Left Origin = 6, Top Origin = 95, Usable = 1, Font = Bold) +#define ShiptypeInfoShieldSlotsLabel 2706 //(Left Origin = 86, Top Origin = 95, Usable = 1, Font = Standard) +#define ShiptypeInfoUnnamed2707Label 2707 //(Left Origin = 6, Top Origin = 108, Usable = 1, Font = Bold) +#define ShiptypeInfoGadgetSlotsLabel 2708 //(Left Origin = 86, Top Origin = 108, Usable = 1, Font = Standard) +#define ShiptypeInfoUnnamed2709Label 2709 //(Left Origin = 6, Top Origin = 43, Usable = 1, Font = Bold) +#define ShiptypeInfoCargoBaysLabel 2710 //(Left Origin = 86, Top Origin = 43, Usable = 1, Font = Standard) +#define ShiptypeInfoUnnamed2711Label 2711 //(Left Origin = 6, Top Origin = 121, Usable = 1, Font = Bold) +#define ShiptypeInfoCrewQuartersLabel 2712 //(Left Origin = 86, Top Origin = 121, Usable = 1, Font = Standard) +#define ShiptypeInfoUnnamed2713Label 2713 //(Left Origin = 6, Top Origin = 56, Usable = 1, Font = Bold) +#define ShiptypeInfoMaximumRangeLabel 2714 //(Left Origin = 86, Top Origin = 56, Usable = 1, Font = Standard) +#define ShiptypeInfoUnnamed2715Label 2715 //(Left Origin = 6, Top Origin = 69, Usable = 1, Font = Bold) +#define ShiptypeInfoHullStrengthLabel 2716 //(Left Origin = 86, Top Origin = 69, Usable = 1, Font = Standard) +#define ShiptypeInfoUnnamed2718Label 2718 //(Left Origin = 6, Top Origin = 30, Usable = 1, Font = Bold) +#define ShiptypeInfoSizeLabel 2719 //(Left Origin = 86, Top Origin = 30, Usable = 1, Font = Standard) + +// Resource: tFRM 2800 +#define BuyEquipmentForm 2800 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define BuyEquipmentBuy0Button 2801 //(Left Origin = 1, Top Origin = 17, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentBuy1Button 2802 //(Left Origin = 1, Top Origin = 30, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentBuy2Button 2803 //(Left Origin = 1, Top Origin = 43, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentBuy3Button 2804 //(Left Origin = 1, Top Origin = 56, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentBuy4Button 2805 //(Left Origin = 1, Top Origin = 69, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentBuy5Button 2806 //(Left Origin = 1, Top Origin = 82, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentBuy6Button 2807 //(Left Origin = 1, Top Origin = 95, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentBuy7Button 2808 //(Left Origin = 1, Top Origin = 108, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentBuy8Button 2809 //(Left Origin = 1, Top Origin = 121, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentBuy9Button 2810 //(Left Origin = 1, Top Origin = 134, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentBButton 2850 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentSButton 2851 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentYButton 2852 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyEquipmentWButton 2853 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 2900 +#define SellEquipmentForm 2900 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define SellEquipmentSell0Button 2901 //(Left Origin = 1, Top Origin = 17, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentSell1Button 2902 //(Left Origin = 1, Top Origin = 30, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentSell2Button 2903 //(Left Origin = 1, Top Origin = 43, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentSell3Button 2904 //(Left Origin = 1, Top Origin = 62, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentSell4Button 2905 //(Left Origin = 1, Top Origin = 75, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentSell5Button 2906 //(Left Origin = 1, Top Origin = 88, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentSell6Button 2907 //(Left Origin = 1, Top Origin = 107, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentSell7Button 2908 //(Left Origin = 1, Top Origin = 120, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentSell8Button 2909 //(Left Origin = 1, Top Origin = 133, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentBButton 2950 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentSButton 2951 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentYButton 2952 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SellEquipmentWButton 2953 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 3000 +#define PersonnelRosterForm 3000 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define PersonnelRosterFire0Button 3001 //(Left Origin = 1, Top Origin = 17, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PersonnelRosterFire1Button 3002 //(Left Origin = 1, Top Origin = 62, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PersonnelRosterHire0Button 3003 //(Left Origin = 1, Top Origin = 107, Width = 20, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PersonnelRosterBButton 3050 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PersonnelRosterSButton 3051 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PersonnelRosterYButton 3052 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PersonnelRosterWButton 3053 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 3100 +#define SpecialEventForm 3100 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 4400, Menu Bar ID = 1200, Default Button ID = 3102) +#define SpecialEventYesButton 3101 //(Left Origin = 6, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SpecialEventNoButton 3102 //(Left Origin = 48, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SpecialEventOKButton 3103 //(Left Origin = 6, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 3200 +#define CommanderStatusForm 3200 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define CommanderStatusCheatButton 3223 //(Left Origin = 123, Top Origin = 18, Width = 36, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CommanderStatusShipButton 3228 //(Left Origin = 39, Top Origin = 147, Width = 34, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CommanderStatusQuestsButton 3229 //(Left Origin = 1, Top Origin = 147, Width = 34, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CommanderStatusSpecialButton 3230 //(Left Origin = 77, Top Origin = 147, Width = 60, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CommanderStatusBButton 3250 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CommanderStatusSButton 3251 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CommanderStatusYButton 3252 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CommanderStatusWButton 3253 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CommanderStatusNameLabel 3201 //(Left Origin = 48, Top Origin = 20, Usable = 1, Font = Standard) +#define CommanderStatusUnnamed3202Label 3202 //(Left Origin = 0, Top Origin = 20, Usable = 1, Font = Bold) +#define CommanderStatusUnnamed3203Label 3203 //(Left Origin = 0, Top Origin = 48, Usable = 1, Font = Bold) +#define CommanderStatusFighterLabel 3204 //(Left Origin = 48, Top Origin = 48, Usable = 1, Font = Standard) +#define CommanderStatusUnnamed3205Label 3205 //(Left Origin = 0, Top Origin = 62, Usable = 1, Font = Bold) +#define CommanderStatusTraderLabel 3206 //(Left Origin = 48, Top Origin = 62, Usable = 1, Font = Standard) +#define CommanderStatusUnnamed3207Label 3207 //(Left Origin = 78, Top Origin = 34, Usable = 1, Font = Bold) +#define CommanderStatusUnnamed3208Label 3208 //(Left Origin = 0, Top Origin = 118, Usable = 1, Font = Bold) +#define CommanderStatusUnnamed3209Label 3209 //(Left Origin = 0, Top Origin = 76, Usable = 1, Font = Bold) +#define CommanderStatusEngineerLabel 3210 //(Left Origin = 48, Top Origin = 76, Usable = 1, Font = Standard) +#define CommanderStatusUnnamed3211Label 3211 //(Left Origin = 0, Top Origin = 34, Usable = 1, Font = Bold) +#define CommanderStatusPilotLabel 3212 //(Left Origin = 48, Top Origin = 34, Usable = 1, Font = Standard) +#define CommanderStatusUnnamed3213Label 3213 //(Left Origin = 0, Top Origin = 104, Usable = 1, Font = Bold) +#define CommanderStatusReputationLabel 3214 //(Left Origin = 78, Top Origin = 104, Usable = 1, Font = Standard) +#define CommanderStatusUnnamed3215Label 3215 //(Left Origin = 0, Top Origin = 132, Usable = 1, Font = Bold) +#define CommanderStatusPoliceRecordLabel 3216 //(Left Origin = 78, Top Origin = 118, Usable = 1, Font = Standard) +#define CommanderStatusKillsLabel 3217 //(Left Origin = 112, Top Origin = 34, Usable = 1, Font = Standard) +#define CommanderStatusUnnamed3218Label 3218 //(Left Origin = 0, Top Origin = 90, Usable = 1, Font = Bold) +#define CommanderStatusLevelLabel 3219 //(Left Origin = 78, Top Origin = 132, Usable = 1, Font = Standard) +#define CommanderStatusUnnamed3220Label 3220 //(Left Origin = 78, Top Origin = 48, Usable = 1, Font = Bold) +#define CommanderStatusDaysLabel 3221 //(Left Origin = 112, Top Origin = 48, Usable = 1, Font = Standard) +#define CommanderStatusNetWorthLabel 3222 //(Left Origin = 78, Top Origin = 90, Usable = 1, Font = Standard) +#define CommanderStatusUnnamed3224Label 3224 //(Left Origin = 78, Top Origin = 62, Usable = 1, Font = Bold) +#define CommanderStatusCreditsLabel 3225 //(Left Origin = 112, Top Origin = 62, Usable = 1, Font = Standard) +#define CommanderStatusUnnamed3226Label 3226 //(Left Origin = 78, Top Origin = 76, Usable = 1, Font = Bold) +#define CommanderStatusDebtLabel 3227 //(Left Origin = 112, Top Origin = 76, Usable = 1, Font = Standard) + +// Resource: tFRM 3300 +#define OptionsForm 3300 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 5300, Menu Bar ID = 0, Default Button ID = 3303) +#define OptionsDoneButton 3303 //(Left Origin = 6, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define OptionsOptions2Button 3315 //(Left Origin = 48, Top Origin = 140, Width = 70, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define OptionsAutoFuelCheckbox 3301 //(Left Origin = 6, Top Origin = 50, Width = 144, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define OptionsAutoRepairCheckbox 3302 //(Left Origin = 6, Top Origin = 62, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define OptionsAlwaysIgnorePoliceCheckbox 3304 //(Left Origin = 6, Top Origin = 26, Width = 43, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define OptionsReserveMoneyCheckbox 3305 //(Left Origin = 6, Top Origin = 74, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define OptionsAlwaysInfoCheckbox 3308 //(Left Origin = 6, Top Origin = 86, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define OptionsAlwaysIgnorePiratesCheckbox 3310 //(Left Origin = 52, Top Origin = 26, Width = 46, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define OptionsAlwaysIgnoreTradersCheckbox 3311 //(Left Origin = 102, Top Origin = 26, Width = 50, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define OptionsTradeInOrbitCheckbox 3312 //(Left Origin = 6, Top Origin = 37, Width = 147, Height = 13, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define OptionsContinuousCheckbox 3313 //(Left Origin = 6, Top Origin = 98, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define OptionsAttackFleeingCheckbox 3314 //(Left Origin = 6, Top Origin = 110, Width = 150, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define OptionsLeaveEmptyField 3307 //(Left Origin = 122, Top Origin = 122, Width = 10, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 2, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define OptionsUnnamed3306Label 3306 //(Left Origin = 6, Top Origin = 122, Usable = 1, Font = Standard) +#define OptionsUnnamed3309Label 3309 //(Left Origin = 6, Top Origin = 15, Usable = 1, Font = Standard) + +// Resource: tFRM 3400 +#define AveragePricesForm 3400 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 3403) +#define AveragePricesAbsolutePricesButton 3401 //(Left Origin = 1, Top Origin = 113, Width = 90, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AveragePricesChartButton 3403 //(Left Origin = 1, Top Origin = 147, Width = 90, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AveragePricesSystemInfoButton 3404 //(Left Origin = 1, Top Origin = 130, Width = 90, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AveragePricesWarpButton 3406 //(Left Origin = 117, Top Origin = 130, Width = 42, Height = 29, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Large) +#define AveragePricesPriceDifferencesButton 3407 //(Left Origin = 1, Top Origin = 113, Width = 90, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AveragePricesScrollBackButton 3408 //(Left Origin = 134, Top Origin = 18, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 0, Non-bold Frame = 1, Font = Symbol) +#define AveragePricesScrollFwdButton 3409 //(Left Origin = 147, Top Origin = 18, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 0, Non-bold Frame = 1, Font = Symbol) +#define AveragePricesBButton 3450 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AveragePricesSButton 3451 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AveragePricesYButton 3452 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AveragePricesWButton 3453 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AveragePricesSystemNameLabel 3402 //(Left Origin = 0, Top Origin = 18, Usable = 1, Font = Standard) +#define AveragePricesResourcesLabel 3405 //(Left Origin = 0, Top Origin = 32, Usable = 1, Font = Standard) + +// Resource: tFRM 3500 +#define BankForm 3500 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define BankBuyInsuranceButton 3501 //(Left Origin = 1, Top Origin = 146, Width = 72, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BankPayBackButton 3505 //(Left Origin = 55, Top Origin = 64, Width = 48, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BankGetLoanButton 3506 //(Left Origin = 1, Top Origin = 64, Width = 48, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BankStopInsuranceButton 3511 //(Left Origin = 1, Top Origin = 146, Width = 72, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BankBButton 3550 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BankSButton 3551 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BankYButton 3552 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BankWButton 3553 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BankDebtLabel 3502 //(Left Origin = 0, Top Origin = 32, Usable = 1, Font = Bold) +#define BankUnnamed3503Label 3503 //(Left Origin = 0, Top Origin = 46, Usable = 1, Font = Bold) +#define BankUnnamed3504Label 3504 //(Left Origin = 0, Top Origin = 114, Usable = 1, Font = Bold) +#define BankUnnamed3507Label 3507 //(Left Origin = 0, Top Origin = 128, Usable = 1, Font = Bold) +#define BankUnnamed3508Label 3508 //(Left Origin = 0, Top Origin = 86, Usable = 1, Font = Bold) +#define BankUnnamed3509Label 3509 //(Left Origin = 0, Top Origin = 18, Usable = 1, Font = Bold) +#define BankUnnamed3510Label 3510 //(Left Origin = 0, Top Origin = 100, Usable = 1, Font = Bold) + +// Resource: tFRM 3600 +#define GetLoanForm 3600 //(Left Origin = 2, Top Origin = 90, Width = 156, Height = 68, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 5700, Menu Bar ID = 0, Default Button ID = 3606) +#define GetLoanOKButton 3604 //(Left Origin = 6, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define GetLoanEverythingButton 3605 //(Left Origin = 48, Top Origin = 52, Width = 52, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define GetLoanNothingButton 3606 //(Left Origin = 106, Top Origin = 52, Width = 40, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define GetLoanGetLoanField 3603 //(Left Origin = 110, Top Origin = 32, Width = 25, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 5, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define GetLoanMaxLoanLabel 3601 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define GetLoanUnnamed3602Label 3602 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) + +// Resource: tFRM 3700 +#define PayBackForm 3700 //(Left Origin = 2, Top Origin = 90, Width = 156, Height = 68, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 5800, Menu Bar ID = 0, Default Button ID = 3706) +#define PayBackOKButton 3704 //(Left Origin = 6, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PayBackEverythingButton 3705 //(Left Origin = 48, Top Origin = 52, Width = 52, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PayBackNothingButton 3706 //(Left Origin = 106, Top Origin = 52, Width = 40, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PayBackPayBackField 3703 //(Left Origin = 126, Top Origin = 32, Width = 25, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 5, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define PayBackMaxDebtLabel 3701 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define PayBackUnnamed3702Label 3702 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) + +// Resource: tFRM 3800 +#define EncounterForm 3800 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 6100, Menu Bar ID = 1100, Default Button ID = 0) +#define EncounterAttackButton 3801 //(Left Origin = 4, Top Origin = 140, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterFleeButton 3802 //(Left Origin = 40, Top Origin = 140, Width = 30, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterSurrenderButton 3803 //(Left Origin = 74, Top Origin = 140, Width = 47, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterSubmitButton 3804 //(Left Origin = 74, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterBribeButton 3805 //(Left Origin = 114, Top Origin = 140, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterIgnoreButton 3808 //(Left Origin = 40, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterPlunderButton 3809 //(Left Origin = 40, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterTribble0Button 3810 //(Left Origin = 31, Top Origin = 20, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble1Button 3811 //(Left Origin = 10, Top Origin = 37, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble2Button 3812 //(Left Origin = 62, Top Origin = 24, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble3Button 3813 //(Left Origin = 35, Top Origin = 52, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble4Button 3814 //(Left Origin = 59, Top Origin = 47, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble5Button 3815 //(Left Origin = 11, Top Origin = 68, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble6Button 3816 //(Left Origin = 58, Top Origin = 71, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble7Button 3817 //(Left Origin = 82, Top Origin = 38, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble8Button 3818 //(Left Origin = 109, Top Origin = 22, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble9Button 3819 //(Left Origin = 136, Top Origin = 19, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble10Button 3820 //(Left Origin = 128, Top Origin = 40, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble11Button 3821 //(Left Origin = 101, Top Origin = 54, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble12Button 3822 //(Left Origin = 71, Top Origin = 96, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble13Button 3823 //(Left Origin = 84, Top Origin = 69, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble14Button 3824 //(Left Origin = 138, Top Origin = 67, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble15Button 3825 //(Left Origin = 31, Top Origin = 72, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble16Button 3826 //(Left Origin = 7, Top Origin = 98, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble17Button 3827 //(Left Origin = 46, Top Origin = 96, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble18Button 3828 //(Left Origin = 17, Top Origin = 117, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble19Button 3829 //(Left Origin = 122, Top Origin = 82, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble20Button 3830 //(Left Origin = 96, Top Origin = 86, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble21Button 3831 //(Left Origin = 137, Top Origin = 107, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble22Button 3832 //(Left Origin = 119, Top Origin = 119, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble23Button 3833 //(Left Origin = 87, Top Origin = 115, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble24Button 3834 //(Left Origin = 58, Top Origin = 121, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble25Button 3835 //(Left Origin = 26, Top Origin = 92, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble26Button 3836 //(Left Origin = 43, Top Origin = 34, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble27Button 3837 //(Left Origin = 110, Top Origin = 103, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble28Button 3838 //(Left Origin = 48, Top Origin = 8, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble29Button 3839 //(Left Origin = 8, Top Origin = 9, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTribble30Button 3840 //(Left Origin = 87, Top Origin = 8, Width = 12, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Bold) +#define EncounterTradeButton 3841 //(Left Origin = 80, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterInterruptButton 3843 //(Left Origin = 125, Top Origin = 140, Width = 17, Height = 12, Usable = 1, Anchor Left = 0, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterYieldButton 3845 //(Left Origin = 74, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterBoardButton 3846 //(Left Origin = 4, Top Origin = 140, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterDrinkButton 3847 //(Left Origin = 4, Top Origin = 140, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterMeetButton 3848 //(Left Origin = 80, Top Origin = 140, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define EncounterAttackBitMap 11000 //(Left Origin = 145, Top Origin = 142, Bitmap Resource ID = 11000, Usable = 1) +#define EncounterAttack2BitMap 11100 //(Left Origin = 145, Top Origin = 142, Bitmap Resource ID = 11100, Usable = 1) +#define EncounterYouLabel 3806 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Bold) +#define EncounterOpponentLabel 3807 //(Left Origin = 84, Top Origin = 17, Usable = 1, Font = Bold) + +// Resource: tFRM 3900 +#define IllegalGoodsForm 3900 //(Left Origin = 2, Top Origin = 64, Width = 156, Height = 94, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 6400, Menu Bar ID = 0, Default Button ID = 3905) +#define IllegalGoodsUnnamed3905Button 3905 //(Left Origin = 6, Top Origin = 78, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define IllegalGoodsUnnamed3901Label 3901 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define IllegalGoodsUnnamed3902Label 3902 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) +#define IllegalGoodsUnnamed3903Label 3903 //(Left Origin = 6, Top Origin = 46, Usable = 1, Font = Standard) +#define IllegalGoodsFineLabel 3904 //(Left Origin = 6, Top Origin = 60, Usable = 1, Font = Standard) + +// Resource: tFRM 4000 +#define BribeForm 4000 //(Left Origin = 2, Top Origin = 76, Width = 156, Height = 82, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 6600, Menu Bar ID = 0, Default Button ID = 4005) +#define BribeOfferBribeButton 4004 //(Left Origin = 6, Top Origin = 66, Width = 54, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BribeForgetItButton 4005 //(Left Origin = 66, Top Origin = 66, Width = 44, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BribeUnnamed4001Label 4001 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define BribeUnnamed4002Label 4002 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) +#define BribeBribeLabel 4003 //(Left Origin = 6, Top Origin = 46, Usable = 1, Font = Standard) + +// Resource: tFRM 4100 +#define BountyForm 4100 //(Left Origin = 2, Top Origin = 90, Width = 156, Height = 68, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 7700, Menu Bar ID = 0, Default Button ID = 4103) +#define BountyOKButton 4103 //(Left Origin = 6, Top Origin = 51, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BountyUnnamed4101Label 4101 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define BountyBountyLabel 4102 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) + +// Resource: tFRM 4200 +#define PlunderForm 4200 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 7800, Menu Bar ID = 1100, Default Button ID = 4222) +#define PlunderQty0Button 4201 //(Left Origin = 6, Top Origin = 18, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderQty1Button 4202 //(Left Origin = 6, Top Origin = 31, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderQty2Button 4203 //(Left Origin = 6, Top Origin = 44, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderQty3Button 4204 //(Left Origin = 6, Top Origin = 57, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderQty4Button 4205 //(Left Origin = 6, Top Origin = 70, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderQty5Button 4206 //(Left Origin = 6, Top Origin = 83, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderQty6Button 4207 //(Left Origin = 6, Top Origin = 96, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderQty7Button 4208 //(Left Origin = 6, Top Origin = 109, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderQty8Button 4209 //(Left Origin = 6, Top Origin = 122, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderQty9Button 4210 //(Left Origin = 6, Top Origin = 135, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderAll0Button 4211 //(Left Origin = 83, Top Origin = 18, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderAll1Button 4212 //(Left Origin = 83, Top Origin = 31, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderAll2Button 4213 //(Left Origin = 83, Top Origin = 44, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderAll3Button 4214 //(Left Origin = 83, Top Origin = 57, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderAll4Button 4215 //(Left Origin = 83, Top Origin = 70, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderAll5Button 4216 //(Left Origin = 83, Top Origin = 83, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderAll6Button 4217 //(Left Origin = 83, Top Origin = 96, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderAll7Button 4218 //(Left Origin = 83, Top Origin = 109, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderAll8Button 4219 //(Left Origin = 83, Top Origin = 122, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderAll9Button 4220 //(Left Origin = 83, Top Origin = 135, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderDoneButton 4222 //(Left Origin = 116, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderDumpButton 4223 //(Left Origin = 116, Top Origin = 124, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PlunderUnnamed4221Label 4221 //(Left Origin = 118, Top Origin = 18, Usable = 1, Font = Standard) + +// Resource: tFRM 4300 +#define AmountToPlunderForm 4300 //(Left Origin = 2, Top Origin = 90, Width = 156, Height = 68, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 8300, Menu Bar ID = 0, Default Button ID = 4305) +#define AmountToPlunderOKButton 4303 //(Left Origin = 6, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AmountToPlunderAllButton 4304 //(Left Origin = 48, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AmountToPlunderNoneButton 4305 //(Left Origin = 90, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define AmountToPlunderToPlunderField 4306 //(Left Origin = 137, Top Origin = 32, Width = 15, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define AmountToPlunderMaxToPlunderLabel 4301 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define AmountToPlunderUnnamed4302Label 4302 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) + +// Resource: tFRM 4400 +#define FindSystemForm 4400 //(Left Origin = 2, Top Origin = 77, Width = 157, Height = 81, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 8500, Menu Bar ID = 0, Default Button ID = 4404) +#define FindSystemOKButton 4403 //(Left Origin = 6, Top Origin = 65, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define FindSystemCancelButton 4404 //(Left Origin = 47, Top Origin = 65, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define FindSystemTrackCheckbox 4405 //(Left Origin = 4, Top Origin = 45, Width = 96, Height = 14, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define FindSystemSystemField 4406 //(Left Origin = 6, Top Origin = 29, Width = 100, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 20, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0) +#define FindSystemUnnamed4402GraffitiShift 4402 //(Left Origin = 143, Top Origin = 68) +#define FindSystemMaxToPlunderLabel 4401 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) + +// Resource: tFRM 4500 +#define HighScoresForm 4500 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 9000, Menu Bar ID = 0, Default Button ID = 4501) +#define HighScoresOKButton 4501 //(Left Origin = 60, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define HighScoresName0Label 4502 //(Left Origin = 16, Top Origin = 18, Usable = 1, Font = Standard) +#define HighScoresName1Label 4503 //(Left Origin = 16, Top Origin = 58, Usable = 1, Font = Standard) +#define HighScoresName2Label 4504 //(Left Origin = 16, Top Origin = 98, Usable = 1, Font = Standard) +#define HighScoresDays0Label 4506 //(Left Origin = 16, Top Origin = 31, Usable = 1, Font = Standard) +#define HighScoresDays1Label 4507 //(Left Origin = 16, Top Origin = 71, Usable = 1, Font = Standard) +#define HighScoresDays2Label 4508 //(Left Origin = 16, Top Origin = 111, Usable = 1, Font = Standard) +#define HighScoresUnnamed4510Label 4510 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define HighScoresUnnamed4511Label 4511 //(Left Origin = 6, Top Origin = 58, Usable = 1, Font = Standard) +#define HighScoresUnnamed4512Label 4512 //(Left Origin = 6, Top Origin = 98, Usable = 1, Font = Standard) +#define HighScoresScore0Label 4514 //(Left Origin = 120, Top Origin = 18, Usable = 1, Font = Standard) +#define HighScoresScore1Label 4515 //(Left Origin = 120, Top Origin = 58, Usable = 1, Font = Standard) +#define HighScoresScore2Label 4516 //(Left Origin = 120, Top Origin = 98, Usable = 1, Font = Standard) +#define HighScoresModeWorth0Label 4518 //(Left Origin = 16, Top Origin = 44, Usable = 1, Font = Standard) +#define HighScoresModeWorth1Label 4519 //(Left Origin = 16, Top Origin = 84, Usable = 1, Font = Standard) +#define HighScoresModeWorth2Label 4520 //(Left Origin = 16, Top Origin = 124, Usable = 1, Font = Standard) + +// Resource: tFRM 4600 +#define CheatForm 4600 //(Left Origin = 2, Top Origin = 21, Width = 156, Height = 137, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) +#define CheatUnnamed4601Button 4601 //(Left Origin = 117, Top Origin = 122, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CheatNegativeCheckbox 4608 //(Left Origin = 4, Top Origin = 71, Width = 87, Height = 13, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define CheatLightningShieldCheckbox 4609 //(Left Origin = 4, Top Origin = 87, Width = 82, Height = 13, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define CheatFuelCompactorCheckbox 4610 //(Left Origin = 4, Top Origin = 103, Width = 78, Height = 13, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define CheatMorganLaserCheckbox 4611 //(Left Origin = 4, Top Origin = 119, Width = 79, Height = 13, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define CheatSingularityCheckbox 4612 //(Left Origin = 93, Top Origin = 87, Width = 62, Height = 16, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define CheatMoonCheckbox 4617 //(Left Origin = 93, Top Origin = 71, Width = 40, Height = 14, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define CheatCreditsField 4603 //(Left Origin = 93, Top Origin = 16, Width = 40, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 8, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define CheatPoliceRecordField 4605 //(Left Origin = 93, Top Origin = 57, Width = 40, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 4, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define CheatReputationField 4607 //(Left Origin = 93, Top Origin = 43, Width = 40, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 4, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define CheatDebtField 4619 //(Left Origin = 93, Top Origin = 30, Width = 40, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 8, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define CheatUnnamed4602Label 4602 //(Left Origin = 6, Top Origin = 17, Usable = 1, Font = Bold) +#define CheatUnnamed4604Label 4604 //(Left Origin = 5, Top Origin = 56, Usable = 1, Font = Bold) +#define CheatUnnamed4606Label 4606 //(Left Origin = 5, Top Origin = 43, Usable = 1, Font = Bold) +#define CheatUnnamed4618Label 4618 //(Left Origin = 6, Top Origin = 30, Usable = 1, Font = Bold) + +// Resource: tFRM 4700 +#define PickCannisterForm 4700 //(Left Origin = 2, Top Origin = 78, Width = 156, Height = 80, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 11200, Menu Bar ID = 0, Default Button ID = 4705) +#define PickCannisterPickItUpButton 4704 //(Left Origin = 6, Top Origin = 64, Width = 56, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PickCannisterLetItGoButton 4705 //(Left Origin = 68, Top Origin = 64, Width = 48, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define PickCannisterUnnamed4701Label 4701 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define PickCannisterCannisterLabel 4702 //(Left Origin = 5, Top Origin = 32, Usable = 1, Font = Standard) +#define PickCannisterUnnamed4703Label 4703 //(Left Origin = 6, Top Origin = 46, Usable = 1, Font = Standard) + +// Resource: tFRM 4800 +#define CurrentShipForm 4800 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define CurrentShipStatusButton 4801 //(Left Origin = 1, Top Origin = 147, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CurrentShipSpecialButton 4802 //(Left Origin = 81, Top Origin = 147, Width = 60, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CurrentShipQuestsButton 4803 //(Left Origin = 41, Top Origin = 147, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CurrentShipBButton 4850 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CurrentShipSButton 4851 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CurrentShipYButton 4852 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define CurrentShipWButton 4853 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 4900 +#define BuyItemForm 4900 //(Left Origin = 2, Top Origin = 90, Width = 156, Height = 68, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 11700, Menu Bar ID = 0, Default Button ID = 4904) +#define BuyItemYesButton 4903 //(Left Origin = 6, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyItemNoButton 4904 //(Left Origin = 48, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define BuyItemUnnamed4901Label 4901 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define BuyItemPriceLabel 4902 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) + +// Resource: tFRM 5000 +#define QuestsForm 5000 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define QuestsSpecialButton 5001 //(Left Origin = 81, Top Origin = 147, Width = 60, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define QuestsShipButton 5002 //(Left Origin = 41, Top Origin = 147, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define QuestsStatusButton 5003 //(Left Origin = 1, Top Origin = 147, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define QuestsBButton 5050 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define QuestsSButton 5051 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define QuestsYButton 5052 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define QuestsWButton 5053 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 5100 +#define SpecificationForm 5100 //(Left Origin = 2, Top Origin = 42, Width = 156, Height = 116, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 12100, Menu Bar ID = 0, Default Button ID = 5106) +#define SpecificationUnnamed5106Button 5106 //(Left Origin = 60, Top Origin = 100, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SpecificationUnnamed5101Label 5101 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Bold) +#define SpecificationUnnamed5102Label 5102 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Bold) +#define SpecificationUnnamed5103Label 5103 //(Left Origin = 6, Top Origin = 46, Usable = 1, Font = Bold) +#define SpecificationUnnamed5104Label 5104 //(Left Origin = 6, Top Origin = 60, Usable = 1, Font = Bold) +#define SpecificationUnnamed5105Label 5105 //(Left Origin = 6, Top Origin = 78, Usable = 1, Font = Bold) +#define SpecificationMercenariesLabel 5107 //(Left Origin = 90, Top Origin = 18, Usable = 1, Font = Standard) +#define SpecificationInsuranceLabel 5108 //(Left Origin = 90, Top Origin = 32, Usable = 1, Font = Standard) +#define SpecificationInterestLabel 5109 //(Left Origin = 90, Top Origin = 46, Usable = 1, Font = Standard) +#define SpecificationWormholeTaxLabel 5110 //(Left Origin = 90, Top Origin = 60, Usable = 1, Font = Standard) +#define SpecificationTotalLabel 5111 //(Left Origin = 90, Top Origin = 78, Usable = 1, Font = Standard) + +// Resource: tFRM 5200 +#define UtopiaForm 5200 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1200, Default Button ID = 0) +#define UtopiaUtopiaScreenBitmapBitMap 1800 //(Left Origin = 0, Top Origin = 0, Bitmap Resource ID = 1800, Usable = 1) + +// Resource: tFRM 5300 +#define ConvictionForm 5300 //(Left Origin = 2, Top Origin = 90, Width = 156, Height = 68, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 13500, Menu Bar ID = 0, Default Button ID = 0) +#define ConvictionOKButton 5303 //(Left Origin = 6, Top Origin = 52, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ConvictionImprisonmentLabel 5301 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define ConvictionFineLabel 5302 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) + +// Resource: tFRM 5400 +#define RetireForm 5400 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1200, Default Button ID = 0) +#define RetireRetireScreenBitmapBitMap 1100 //(Left Origin = 0, Top Origin = 0, Bitmap Resource ID = 1100, Usable = 1) + +// Resource: tFRM 5500 +#define DestroyedForm 5500 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 1, Help ID = 0, Menu Bar ID = 1200, Default Button ID = 0) +#define DestroyedDestoryedScreenBitmapBitMap 12000 //(Left Origin = 0, Top Origin = 0, Bitmap Resource ID = 12000, Usable = 1) + +// Resource: tFRM 5600 +#define QuestListForm 5600 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 14700, Menu Bar ID = 0, Default Button ID = 0) +#define QuestListUnnamed5613Button 5613 //(Left Origin = 129, Top Origin = 139, Width = 23, Height = 13, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define QuestListUnnamed5601Label 5601 //(Left Origin = 6, Top Origin = 16, Usable = 1, Font = Bold) +#define QuestListDragonflyLabel 5602 //(Left Origin = 70, Top Origin = 16, Usable = 1, Font = Standard) +#define QuestListUnnamed5603Label 5603 //(Left Origin = 6, Top Origin = 28, Usable = 1, Font = Bold) +#define QuestListMonsterLabel 5604 //(Left Origin = 70, Top Origin = 28, Usable = 1, Font = Standard) +#define QuestListArtifactQuestLabel 5605 //(Left Origin = 6, Top Origin = 40, Usable = 1, Font = Bold) +#define QuestListArtifactLabel 5606 //(Left Origin = 70, Top Origin = 40, Usable = 1, Font = Standard) +#define QuestListUnnamed5607Label 5607 //(Left Origin = 6, Top Origin = 52, Usable = 1, Font = Bold) +#define QuestListDiseaseLabel 5608 //(Left Origin = 70, Top Origin = 52, Usable = 1, Font = Standard) +#define QuestListUnnamed5609Label 5609 //(Left Origin = 6, Top Origin = 64, Usable = 1, Font = Bold) +#define QuestListTribblesLabel 5610 //(Left Origin = 70, Top Origin = 64, Usable = 1, Font = Standard) +#define QuestListUnnamed5611Label 5611 //(Left Origin = 6, Top Origin = 76, Usable = 1, Font = Bold) +#define QuestListJarekLabel 5612 //(Left Origin = 70, Top Origin = 76, Usable = 1, Font = Standard) +#define QuestListUnnamed5614Label 5614 //(Left Origin = 6, Top Origin = 88, Usable = 1, Font = Bold) +#define QuestListInvasionLabel 5615 //(Left Origin = 70, Top Origin = 88, Usable = 1, Font = Standard) +#define QuestListUnnamed5616Label 5616 //(Left Origin = 6, Top Origin = 100, Usable = 1, Font = Bold) +#define QuestListExperimentLabel 5617 //(Left Origin = 70, Top Origin = 100, Usable = 1, Font = Standard) +#define QuestListUnnamed5618Label 5618 //(Left Origin = 6, Top Origin = 112, Usable = 1, Font = Bold) +#define QuestListWildLabel 5619 //(Left Origin = 70, Top Origin = 112, Usable = 1, Font = Standard) +#define QuestListUnnamed5620Label 5620 //(Left Origin = 6, Top Origin = 124, Usable = 1, Font = Bold) +#define QuestListReactorLabel 5621 //(Left Origin = 70, Top Origin = 124, Usable = 1, Font = Standard) +#define QuestListScarabQuestLabel 5622 //(Left Origin = 6, Top Origin = 136, Usable = 1, Font = Bold) +#define QuestListScarabLabel 5623 //(Left Origin = 70, Top Origin = 136, Usable = 1, Font = Standard) + +// Resource: tFRM 5700 +#define FinalScoreForm 5700 //(Left Origin = 2, Top Origin = 76, Width = 156, Height = 82, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 8900, Menu Bar ID = 0, Default Button ID = 5704) +#define FinalScoreOKButton 5704 //(Left Origin = 6, Top Origin = 66, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define FinalScoreScoreLabel 5701 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define FinalScoreCongratulationsLabel 5702 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) +#define FinalScoreHighScoreLabel 5703 //(Left Origin = 6, Top Origin = 46, Usable = 1, Font = Standard) + +// Resource: tFRM 5900 +#define NewspaperForm 5900 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 19300, Menu Bar ID = 0, Default Button ID = 5901) +#define NewspaperDoneButton 5901 //(Left Origin = 6, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 3350 +#define Options2Form 3350 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 17200, Menu Bar ID = 0, Default Button ID = 3353) +#define Options2ConeButton 3353 //(Left Origin = 6, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define Options2Options1Button 3354 //(Left Origin = 48, Top Origin = 140, Width = 70, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define Options2RectOnButton 3361 //(Left Origin = 6, Top Origin = 115, Width = 144, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define Options2RectOffButton 3362 //(Left Origin = 6, Top Origin = 115, Width = 144, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define Options2AutoNewsPayCheckbox 3351 //(Left Origin = 6, Top Origin = 16, Width = 144, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define Options2UseHWButtonsCheckbox 3352 //(Left Origin = 6, Top Origin = 28, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define Options2ShowRangeCheckbox 3355 //(Left Origin = 6, Top Origin = 40, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define Options2TrackAutoOffCheckbox 3356 //(Left Origin = 6, Top Origin = 52, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define Options2TextualEncountersCheckbox 3357 //(Left Origin = 6, Top Origin = 64, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define Options2RemindLoansCheckbox 3358 //(Left Origin = 6, Top Origin = 76, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define Options2SharePreferencesCheckbox 3359 //(Left Origin = 6, Top Origin = 100, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define Options2IdentifyStartupCheckbox 3360 //(Left Origin = 6, Top Origin = 88, Width = 143, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) + +// Resource: tFRM 6100 +#define SpecialCargoForm 6100 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define SpecialCargoQuestsButton 6101 //(Left Origin = 81, Top Origin = 147, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SpecialCargoShipButton 6102 //(Left Origin = 41, Top Origin = 147, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SpecialCargoStatusButton 6103 //(Left Origin = 1, Top Origin = 147, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SpecialCargoBButton 6150 //(Left Origin = 108, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SpecialCargoSButton 6151 //(Left Origin = 121, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SpecialCargoYButton 6152 //(Left Origin = 134, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define SpecialCargoWButton 6153 //(Left Origin = 147, Top Origin = 1, Width = 12, Height = 11, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 6200 +#define DumpCargoForm 6200 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 17300, Menu Bar ID = 1100, Default Button ID = 6221) +#define DumpCargoQty0Button 6201 //(Left Origin = 6, Top Origin = 18, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoQty1Button 6202 //(Left Origin = 6, Top Origin = 31, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoQty2Button 6203 //(Left Origin = 6, Top Origin = 44, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoQty3Button 6204 //(Left Origin = 6, Top Origin = 57, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoQty4Button 6205 //(Left Origin = 6, Top Origin = 70, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoQty5Button 6206 //(Left Origin = 6, Top Origin = 83, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoQty6Button 6207 //(Left Origin = 6, Top Origin = 96, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoQty7Button 6208 //(Left Origin = 6, Top Origin = 109, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoQty8Button 6209 //(Left Origin = 6, Top Origin = 122, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoQty9Button 6210 //(Left Origin = 6, Top Origin = 135, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoAll0Button 6211 //(Left Origin = 83, Top Origin = 18, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoAll1Button 6212 //(Left Origin = 83, Top Origin = 31, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoAll2Button 6213 //(Left Origin = 83, Top Origin = 44, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoAll3Button 6214 //(Left Origin = 83, Top Origin = 57, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoAll4Button 6215 //(Left Origin = 83, Top Origin = 70, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoAll5Button 6216 //(Left Origin = 83, Top Origin = 83, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoAll6Button 6217 //(Left Origin = 83, Top Origin = 96, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoAll7Button 6218 //(Left Origin = 83, Top Origin = 109, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoAll8Button 6219 //(Left Origin = 83, Top Origin = 122, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoAll9Button 6220 //(Left Origin = 83, Top Origin = 135, Width = 20, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoDoneButton 6221 //(Left Origin = 116, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DumpCargoUnnamed6222Label 6222 //(Left Origin = 118, Top Origin = 18, Usable = 1, Font = Standard) + +// Resource: tFRM 6300 +#define RareCheatForm 6300 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 6310) +#define RareCheatDoneButton 6310 //(Left Origin = 6, Top Origin = 140, Width = 30, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define RareCheatAhabCheckbox 6301 //(Left Origin = 10, Top Origin = 26, Width = 76, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define RareCheatHuieCheckbox 6302 //(Left Origin = 10, Top Origin = 38, Width = 76, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define RareCheatConradCheckbox 6303 //(Left Origin = 10, Top Origin = 50, Width = 76, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define RareCheatGoodTonicCheckbox 6304 //(Left Origin = 10, Top Origin = 62, Width = 76, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define RareCheatBadTonicCheckbox 6305 //(Left Origin = 10, Top Origin = 74, Width = 76, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define RareCheatMarieCheckbox 6306 //(Left Origin = 10, Top Origin = 86, Width = 76, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) +#define RareCheatChancesField 6312 //(Left Origin = 90, Top Origin = 114, Width = 50, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 4, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define RareCheatTradeField 6313 //(Left Origin = 90, Top Origin = 126, Width = 50, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 4, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define RareCheatUnnamed6307Label 6307 //(Left Origin = 31, Top Origin = 126, Usable = 1, Font = Standard) +#define RareCheatUnnamed6308Label 6308 //(Left Origin = 6, Top Origin = 14, Usable = 1, Font = Standard) +#define RareCheatUnnamed6309Label 6309 //(Left Origin = 5, Top Origin = 102, Usable = 1, Font = Standard) +#define RareCheatUnnamed6311Label 6311 //(Left Origin = 15, Top Origin = 114, Usable = 1, Font = Standard) + +// Resource: tFRM 5800 +#define TradeInOrbitForm 5800 //(Left Origin = 1, Top Origin = 48, Width = 157, Height = 110, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 19900, Menu Bar ID = 0, Default Button ID = 5803) +#define TradeInOrbitOKButton 5803 //(Left Origin = 6, Top Origin = 93, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define TradeInOrbitAllButton 5804 //(Left Origin = 48, Top Origin = 93, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define TradeInOrbitNoneButton 5805 //(Left Origin = 90, Top Origin = 93, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define TradeInOrbitQuantityField 5806 //(Left Origin = 135, Top Origin = 75, Width = 15, Height = 16, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) +#define TradeInOrbitDealLabel 5801 //(Left Origin = 6, Top Origin = 18, Usable = 1, Font = Standard) +#define TradeInOrbitAveragePriceLabel 5802 //(Left Origin = 6, Top Origin = 60, Usable = 1, Font = Standard) +#define TradeInOrbitNumberItemsLabel 5807 //(Left Origin = 6, Top Origin = 32, Usable = 1, Font = Standard) +#define TradeInOrbitQuantityAvailableLabel 5808 //(Left Origin = 6, Top Origin = 46, Usable = 1, Font = Standard) +#define TradeInOrbitHowManyLabel 5809 //(Left Origin = 6, Top Origin = 75, Usable = 1, Font = Standard) + +// Resource: tFRM 3375 +#define ShortcutsForm 3375 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 20400, Menu Bar ID = 0, Default Button ID = 3378) +#define ShortcutsOKButton 3378 //(Left Origin = 6, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define ShortcutsUnnamed3379Label 3379 //(Left Origin = 5, Top Origin = 14, Usable = 1, Font = Bold) +#define ShortcutsUnnamed3384Label 3384 //(Left Origin = 5, Top Origin = 30, Usable = 1, Font = Bold) +#define ShortcutsUnnamed3385Label 3385 //(Left Origin = 5, Top Origin = 55, Usable = 1, Font = Bold) +#define ShortcutsUnnamed3386Label 3386 //(Left Origin = 5, Top Origin = 105, Usable = 1, Font = Bold) +#define ShortcutsUnnamed3387Label 3387 //(Left Origin = 5, Top Origin = 80, Usable = 1, Font = Bold) +#define ShortcutsShortcuts1List 3377 //(Left Origin = 58, Top Origin = 17, Width = 98, Usable = 0, Font = Standard, Visible Items = 11) +#define ShortcutsShortcuts2List 3381 //(Left Origin = 58, Top Origin = 22, Width = 98, Usable = 0, Font = Standard, Visible Items = 11) +#define ShortcutsShortcuts3List 3382 //(Left Origin = 58, Top Origin = 27, Width = 98, Usable = 0, Font = Standard, Visible Items = 11) +#define ShortcutsShortcuts4List 3383 //(Left Origin = 58, Top Origin = 31, Width = 98, Usable = 0, Font = Standard, Visible Items = 11) +#define ShortcutsShortcut1PopTrigger 3376 //(Left Origin = 5, Top Origin = 42, Width = 124, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3377) +#define ShortcutsShortcut2PopTrigger 3380 //(Left Origin = 5, Top Origin = 67, Width = 124, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3381) +#define ShortcutsShortcut3PopTrigger 3388 //(Left Origin = 5, Top Origin = 92, Width = 124, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3382) +#define ShortcutsShortcut4PopTrigger 3389 //(Left Origin = 5, Top Origin = 117, Width = 124, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3383) + + +// Resource: Talt 1000 +#define RomIncompatibleAlert 1000 +#define RomIncompatibleOK 0 + +// Resource: Talt 1100 +#define NewGameAlert 1100 +#define NewGameYes 0 +#define NewGameNo 1 + +// Resource: Talt 1200 +#define MoreSkillPointsAlert 1200 +#define MoreSkillPointsOK 0 + +// Resource: Talt 1300 +#define NothingAvailableAlert 1300 +#define NothingAvailableOK 0 + +// Resource: Talt 1400 +#define CantAffordAlert 1400 +#define CantAffordOK 0 + +// Resource: Talt 1500 +#define NoEmptyBaysAlert 1500 +#define NoEmptyBaysOK 0 + +// Resource: Talt 1600 +#define NothingForSaleAlert 1600 +#define NothingForSaleOK 0 + +// Resource: Talt 1700 +#define NotInterestedAlert 1700 +#define NotInterestedOK 0 + +// Resource: Talt 1800 +#define TooManyCrewmembersAlert 1800 +#define TooManyCrewmembersOK 0 + +// Resource: Talt 1900 +#define CantBuyShipAlert 1900 +#define CantBuyShipOK 0 + +// Resource: Talt 2000 +#define ShipNotAvailableAlert 2000 +#define ShipNotAvailableOK 0 + +// Resource: Talt 2100 +#define CantBuyItemAlert 2100 +#define CantBuyItemOK 0 + +// Resource: Talt 2200 +#define NotEnoughSlotsAlert 2200 +#define NotEnoughSlotsOK 0 + +// Resource: Talt 2300 +#define NoMoreOfItemAlert 2300 +#define NoMoreOfItemOK 0 + +// Resource: Talt 2400 +#define ItemNotSoldAlert 2400 +#define ItemNotSoldOK 0 + +// Resource: Talt 2500 +#define CargoBaysFullAlert 2500 +#define CargoBaysFullOK 0 + +// Resource: Talt 2600 +#define NoFreeQuartersAlert 2600 +#define NoFreeQuartersOK 0 + +// Resource: Talt 2700 +#define NotEnoughForEventAlert 2700 +#define NotEnoughForEventOK 0 + +// Resource: Talt 2800 +#define MustPayMercenariesAlert 2800 +#define MustPayMercenariesOK 0 + +// Resource: Talt 2900 +#define TribblesAteFoodAlert 2900 +#define TribblesAteFoodOK 0 + +// Resource: Talt 3000 +#define YouHaveATribbleAlert 3000 +#define YouHaveATribbleOK 0 + +// Resource: Talt 3100 +#define BeamOverTribblesAlert 3100 +#define BeamOverTribblesOK 0 + +// Resource: Talt 3200 +#define SkillIncreaseAlert 3200 +#define SkillIncreaseOK 0 + +// Resource: Talt 3300 +#define CleanRecordAlert 3300 +#define CleanRecordOK 0 + +// Resource: Talt 3400 +#define YoureInDebtAlert 3400 +#define YoureInDebtOK 0 + +// Resource: Talt 3500 +#define DebtTooHighAlert 3500 +#define DebtTooHighOK 0 + +// Resource: Talt 3600 +#define NoDebtAlert 3600 +#define NoDebtOK 0 + +// Resource: Talt 3700 +#define UneventfulTripAlert 3700 +#define UneventfulTripOK 0 + +// Resource: Talt 3800 +#define ArrivalAlert 3800 +#define ArrivalOK 0 + +// Resource: Talt 3900 +#define NoIllegalGoodsAlert 3900 +#define NoIllegalGoodsOK 0 + +// Resource: Talt 4000 +#define CantBeBribedAlert 4000 +#define CantBeBribedOK 0 + +// Resource: Talt 4100 +#define NoMoneyForBribeAlert 4100 +#define NoMoneyForBribeOK 0 + +// Resource: Talt 4200 +#define PiratesPlunderAlert 4200 +#define PiratesPlunderOK 0 + +// Resource: Talt 4300 +#define PiratesFindNoCargoAlert 4300 +#define PiratesFindNoCargoOK 0 + +// Resource: Talt 4400 +#define BothDestroyedAlert 4400 +#define BothDestroyedOK 0 + +// Resource: Talt 4500 +#define OpponentDestroyedAlert 4500 +#define OpponentDestroyedOK 0 + +// Resource: Talt 4600 +#define ShipDestroyedAlert 4600 +#define ShipDestroyedOK 0 + +// Resource: Talt 4700 +#define YouEscapedAlert 4700 +#define YouEscapedOK 0 + +// Resource: Talt 4800 +#define OpponentEscapedAlert 4800 +#define OpponentEscapedOK 0 + +// Resource: Talt 4900 +#define RetireAlert 4900 +#define RetireYes 0 +#define RetireNo 1 + +// Resource: Talt 5000 +#define NotEnoughBaysAlert 5000 +#define NotEnoughBaysOK 0 + +// Resource: Talt 5100 +#define AntidoteAlert 5100 +#define AntidoteOK 0 + +// Resource: Talt 5200 +#define LightningShieldAlert 5200 +#define LightningShieldOK 0 + +// Resource: Talt 5300 +#define SealedCannistersAlert 5300 +#define SealedCannistersOK 0 + +// Resource: Talt 5400 +#define VictimHasntGotAnyAlert 5400 +#define VictimHasntGotAnyOK 0 + +// Resource: Talt 5500 +#define YouEscapedWithDamageAlert 5500 +#define YouEscapedWithDamageOK 0 + +// Resource: Talt 5600 +#define NoFullTanksAlert 5600 +#define NoFullTanksOK 0 + +// Resource: Talt 5700 +#define NoFullRepairsAlert 5700 +#define NoFullRepairsOK 0 + +// Resource: Talt 5800 +#define NoFullTanksOrRepairsAlert 5800 +#define NoFullTanksOrRepairsOK 0 + +// Resource: Talt 6000 +#define ClearTableAlert 6000 +#define ClearTableYes 0 +#define ClearTableNo 1 + +// Resource: Talt 6100 +#define EggAlert 6100 +#define EggOK 0 + +// Resource: Talt 6200 +#define NoWeaponsAlert 6200 +#define NoWeaponsOK 0 + +// Resource: Talt 6300 +#define BuyEscapePodAlert 6300 +#define BuyEscapePodYes 0 +#define BuyEscapePodNo 1 + +// Resource: Talt 6400 +#define EscapePodActivatedAlert 6400 +#define EscapePodActivatedOK 0 + +// Resource: Talt 6500 +#define FleaBuiltAlert 6500 +#define FleaBuiltOK 0 + +// Resource: Talt 6600 +#define InsurancePaysAlert 6600 +#define InsurancePaysOK 0 + +// Resource: Talt 6700 +#define TribbleSurvivedAlert 6700 +#define TribbleSurvivedOK 0 + +// Resource: Talt 6800 +#define AntidoteDestroyedAlert 6800 +#define AntidoteDestroyedOK 0 + +// Resource: Talt 6900 +#define NoEscapePodAlert 6900 +#define NoEscapePodOK 0 + +// Resource: Talt 7000 +#define StopInsuranceAlert 7000 +#define StopInsuranceYes 0 +#define StopInsuranceNo 1 + +// Resource: Talt 7100 +#define CantPayInsuranceAlert 7100 +#define CantPayInsuranceOK 0 + +// Resource: Talt 7200 +#define OutdatedSoftwareAlert 7200 +#define OutdatedSoftwareOK 0 + +// Resource: Talt 7300 +#define NoRoomToScoopAlert 7300 +#define NoRoomToScoopMakeRoom 0 +#define NoRoomToScoopLetitgo 1 + +// Resource: Talt 7400 +#define SellItemAlert 7400 +#define SellItemYes 0 +#define SellItemNo 1 + +// Resource: Talt 7500 +#define SureToFleeOrBribeAlert 7500 +#define SureToFleeOrBribeYesIstillwantto 0 +#define SureToFleeOrBribeOKIwont 1 + +// Resource: Talt 7600 +#define SureToSubmitAlert 7600 +#define SureToSubmitYesIletthem 0 +#define SureToSubmitNo 1 + +// Resource: Talt 7700 +#define WormholeOutOfRangeAlert 7700 +#define WormholeOutOfRangeOK 0 + +// Resource: Talt 7800 +#define CantPayWormholeAlert 7800 +#define CantPayWormholeOK 0 + +// Resource: Talt 7900 +#define SqueekAlert 7900 +#define SqueekOK 0 + +// Resource: Talt 8000 +#define TribblesAteNarcoticsAlert 8000 +#define TribblesAteNarcoticsOK 0 + +// Resource: Talt 8100 +#define BoughtMoonAlert 8100 +#define BoughtMoonOK 0 + +// Resource: Talt 8200 +#define ArtifactStolenAlert 8200 +#define ArtifactStolenOK 0 + +// Resource: Talt 8300 +#define ArtifactNotSavedAlert 8300 +#define ArtifactNotSavedOK 0 + +// Resource: Talt 8400 +#define ShipNotWorthMuchAlert 8400 +#define ShipNotWorthMuchOK 0 + +// Resource: Talt 8500 +#define AttackByAccidentAlert 8500 +#define AttackByAccidentYes 0 +#define AttackByAccidentNo 1 + +// Resource: Talt 8600 +#define AttackTraderAlert 8600 +#define AttackTraderYes 0 +#define AttackTraderNo 1 + +// Resource: Talt 8700 +#define NoSurrenderAlert 8700 +#define NoSurrenderOK 0 + +// Resource: Talt 8800 +#define WantToSurrenderAlert 8800 +#define WantToSurrenderYes 0 +#define WantToSurrenderNo 1 + +// Resource: Talt 8900 +#define ArrestedAlert 8900 +#define ArrestedOK 0 + +// Resource: Talt 9000 +#define AntidoteRemovedAlert 9000 +#define AntidoteRemovedOK 0 + +// Resource: Talt 9100 +#define TribblesSoldAlert 9100 +#define TribblesSoldOK 0 + +// Resource: Talt 9200 +#define FleaReceivedAlert 9200 +#define FleaReceivedOK 0 + +// Resource: Talt 9300 +#define ShipSoldAlert 9300 +#define ShipSoldOK 0 + +// Resource: Talt 9400 +#define InsuranceLostAlert 9400 +#define InsuranceLostOK 0 + +// Resource: Talt 9500 +#define MercenariesLeaveAlert 9500 +#define MercenariesLeaveOK 0 + +// Resource: Talt 9600 +#define ImpoundAlert 9600 +#define ImpoundOK 0 + +// Resource: Talt 9700 +#define WantToSurrenderToAliensAlert 9700 +#define WantToSurrenderToAliensYes 0 +#define WantToSurrenderToAliensNo 1 + +// Resource: Talt 9800 +#define NoQuartersAvailableAlert 9800 +#define NoQuartersAvailableOK 0 + +// Resource: Talt 9900 +#define PassengerNeedsQuartersAlert 9900 +#define PassengerNeedsQuartersOK 0 + +// Resource: Talt 10000 +#define JarekTakenHomeAlert 10000 +#define JarekTakenHomeOK 0 + +// Resource: Talt 10100 +#define PassengerTakenOnBoardAlert 10100 +#define PassengerTakenOnBoardOK 0 + +// Resource: Talt 10200 +#define FuelCompactorAlert 10200 +#define FuelCompactorOK 0 + +// Resource: Talt 10300 +#define DebtWarningAlert 10300 +#define DebtWarningOK 0 + +// Resource: Talt 10400 +#define DebtTooLargeForBuyAlert 10400 +#define DebtTooLargeForBuyOK 0 + +// Resource: Talt 10500 +#define DebtTooLargeForTravelAlert 10500 +#define DebtTooLargeForTravelOK 0 + +// Resource: Talt 10600 +#define TransferFuelCompactorAlert 10600 +#define TransferFuelCompactorDoit 0 +#define TransferFuelCompactorNothanks 1 + +// Resource: Talt 10700 +#define TransferLightningShieldAlert 10700 +#define TransferLightningShieldDoit 0 +#define TransferLightningShieldNothanks 1 + +// Resource: Talt 5900 +#define CantBuyShipWithEquipmentAlert 5900 +#define CantBuyShipWithEquipmentOK 0 + +// Resource: Talt 10800 +#define FireMercenaryAlert 10800 +#define FireMercenaryYes 0 +#define FireMercenaryNo 1 + +// Resource: Talt 10900 +#define FlyInFabricRipAlert 10900 +#define FlyInFabricRipOK 0 + +// Resource: Talt 11400 +#define EngageMarieAlert 11400 +#define EngageMarieYesTakeCargo 0 +#define EngageMarieNo 1 + +// Resource: Talt 11500 +#define EngageCaptainAhabAlert 11500 +#define EngageCaptainAhabYesTradeShield 0 +#define EngageCaptainAhabNo 1 + +// Resource: Talt 11600 +#define TrainingCompletedAlert 11600 +#define TrainingCompletedOK 0 + +// Resource: Talt 11700 +#define EngageCaptainConradAlert 11700 +#define EngageCaptainConradYesTradeLaser 0 +#define EngageCaptainConradNo 1 + +// Resource: Talt 11800 +#define EngageCaptainHuieAlert 11800 +#define EngageCaptainHuieYesTradeLaser 0 +#define EngageCaptainHuieNo 1 + +// Resource: Talt 11900 +#define EngageBottleAlert 11900 +#define EngageBottleYesDrinkIt 0 +#define EngageBottleNo 1 + +// Resource: Talt 12200 +#define GoodDrinkAlert 12200 +#define GoodDrinkOK 0 + +// Resource: Talt 12300 +#define StrangeDrinkAlert 12300 +#define StrangeDrinkOK 0 + +// Resource: Talt 12500 +#define BuyNewspaperAlert 12500 +#define BuyNewspaperBuyNewspaper 0 +#define BuyNewspaperCancel 1 + +// Resource: Talt 12600 +#define CantAffordPaperAlert 12600 +#define CantAffordPaperOK 0 + +// Resource: Talt 12800 +#define NothingToDumpAlert 12800 +#define NothingToDumpOK 0 + +// Resource: Talt 12700 +#define DebugAlert 12700 +#define DebugOK 0 + +// Resource: Talt 12900 +#define WildArrestedAlert 12900 +#define WildArrestedOK 0 + +// Resource: Talt 13200 +#define WildGoesWithPiratesAlert 13200 +#define WildGoesWithPiratesOK 0 + +// Resource: Talt 13300 +#define WildStaysAboardAlert 13300 +#define WildStaysAboardOK 0 + +// Resource: Talt 13400 +#define WildWontGoAlert 13400 +#define WildWontGoCancel 0 +#define WildWontGoSayGoodbyetoWild 1 + +// Resource: Talt 13500 +#define WildLeavesShipAlert 13500 +#define WildLeavesShipOK 0 + +// Resource: Talt 13600 +#define ReactorConsumeAlert 13600 +#define ReactorConsumeOK 0 + +// Resource: Talt 13700 +#define ReactorMeltdownAlert 13700 +#define ReactorMeltdownOK 0 + +// Resource: Talt 13800 +#define ReactorAlert 13800 +#define ReactorOK 0 + +// Resource: Talt 13000 +#define MorganLaserAlert 13000 +#define MorganLaserOK 0 + +// Resource: Talt 13900 +#define ReactorNoiseAlert 13900 +#define ReactorNoiseOK 0 + +// Resource: Talt 14000 +#define ReactorSmokeAlert 14000 +#define ReactorSmokeOK 0 + +// Resource: Talt 14200 +#define PiratesDontStealReactorAlert 14200 +#define PiratesDontStealReactorOK 0 + +// Resource: Talt 14300 +#define PoliceConfiscateReactorAlert 14300 +#define PoliceConfiscateReactorOK 0 + +// Resource: Talt 14500 +#define CantTransferSlotAlert 14500 +#define CantTransferSlotOK 0 + +// Resource: Talt 13100 +#define TransferMorganLaserAlert 13100 +#define TransferMorganLaserDoit 0 +#define TransferMorganLaserNothanks 1 + +// Resource: Talt 14600 +#define TradeShipAlert 14600 +#define TradeShipYes 0 +#define TradeShipNo 1 + +// Resource: Talt 14700 +#define CantTransferAlert 14700 +#define CantTransferOK 0 + +// Resource: Talt 14800 +#define TribblesOnBoardAlert 14800 +#define TribblesOnBoardOK 0 + +// Resource: Talt 14900 +#define CantSellShipWithReactorAlert 14900 +#define CantSellShipWithReactorOK 0 + +// Resource: Talt 15000 +#define TribblesIrradiatedAlert 15000 +#define TribblesIrradiatedOK 0 + +// Resource: Talt 15100 +#define TribblesAllIrradiatedAlert 15100 +#define TribblesAllIrradiatedOK 0 + +// Resource: Talt 14100 +#define ReactorDestroyedAlert 14100 +#define ReactorDestroyedOK 0 + +// Resource: Talt 15200 +#define WildAfraidOfReactorAlert 15200 +#define WildAfraidOfReactorOK 0 + +// Resource: Talt 14400 +#define WildWontGetAboardAlert 14400 +#define WildWontGetAboardOK 0 + +// Resource: Talt 15300 +#define WildWontStayOnboardAlert 15300 +#define WildWontStayOnboardCancel 0 +#define WildWontStayOnboardSayGoodbyetoWild 1 + +// Resource: Talt 15400 +#define TrackSystemAlert 15400 +#define TrackSystemYes 0 +#define TrackSystemNo 1 + +// Resource: Talt 15500 +#define DumpAllAlert 15500 +#define DumpAllYes 0 +#define DumpAllNo 1 + +// Resource: Talt 11000 +#define SureToFleePostMarieAlert 11000 +#define SureToFleePostMarieYesIstillwantto 0 +#define SureToFleePostMarieOKIwont 1 + +// Resource: Talt 15600 +#define YieldNarcoticsAlert 15600 +#define YieldNarcoticsOK 0 + +// Resource: Talt 15700 +#define HullUpgradeAlert 15700 +#define HullUpgradeOK 0 + +// Resource: Talt 11100 +#define OrbitTradeCompletedAlert 11100 +#define OrbitTradeCompletedOK 0 + +// Resource: Talt 11200 +#define MarieCantBeBribedAlert 11200 +#define MarieCantBeBribedOK 0 + +// Resource: Talt 11300 +#define SureToAttackFamousAlert 11300 +#define SureToAttackFamousReallyAttack 0 +#define SureToAttackFamousOKIWont 1 + +// Resource: Talt 12000 +#define ExperimentPerformedAlert 12000 +#define ExperimentPerformedOK 0 + +// Resource: Talt 12100 +#define ErrGraphicsSupportAlert 12100 +#define ErrGraphicsSupportOK 0 + +// Resource: Talt 12400 +#define LoanAmountAlert 12400 +#define LoanAmountOK 0 + +// Resource: Talt 15800 +#define NoSystemSelectedAlert 15800 +#define NoSystemSelectedOK 0 + +// Resource: Talt 15900 +#define UseSingularityAlert 15900 +#define UseSingularityUseSingularity 0 +#define UseSingularityDontuseit 1 + +// Resource: Talt 16000 +#define NoDumpNoScoopAlert 16000 +#define NoDumpNoScoopOK 0 + +// Resource: Talt 16100 +#define GeneralMessageAlert 16100 +#define GeneralMessageOK 0 + +// Resource: Talt 16200 +#define CannotSaveAlert 16200 +#define CannotSaveOK 0 + +// Resource: Talt 16300 +#define CannotLoadAlert 16300 +#define CannotLoadOK 0 + +// Resource: Talt 16400 +#define ReallyLoadAlert 16400 +#define ReallyLoadYes 0 +#define ReallyLoadNo 1 + +// Resource: Talt 16500 +#define DisableScoringAlert 16500 +#define DisableScoringYes 0 +#define DisableScoringNo 1 + +// Resource: Talt 16600 +#define GameSavedAlert 16600 +#define GameSavedOK 0 + +// Resource: Talt 16700 +#define SpaceLitteringAlert 16700 +#define SpaceLitteringYes 0 +#define SpaceLitteringNo 1 + +// Resource: Talt 16800 +#define SwitchGameAlert 16800 +#define SwitchGameYes 0 +#define SwitchGameNo 1 + +// Resource: Talt 16900 +#define CannotSwitchAlert 16900 +#define CannotSwitchOK 0 + +// Resource: Talt 17000 +#define SwitchedAlert 17000 +#define SwitchedOK 0 + +// Resource: Talt 17100 +#define SwitchToNewAlert 17100 +#define SwitchToNewOK 0 + +// Resource: Talt 17200 +#define IdentifyStartupAlert 17200 +#define IdentifyStartupOK 0 + +// Resource: Talt 17300 +#define RectangularButtonsOnAlert 17300 +#define RectangularButtonsOnYes 0 +#define RectangularButtonsOnNo 1 + +// Resource: Talt 17400 +#define AttemptRectangularAlert 17400 +#define AttemptRectangularOK 0 + +// Resource: Talt 17500 +#define NoJumpToCurSystemAlert 17500 +#define NoJumpToCurSystemOK 0 + +// Resource: Talt 17600 +#define ErrGraphicsSupport40Alert 17600 +#define ErrGraphicsSupport40OK 0 + + +// Resource: MBAR 1000 +#define MenuMainMenuBar 1000 + +// Resource: MBAR 1100 +#define MenuEncounterMenuBar 1100 + +// Resource: MBAR 1200 +#define MenuHelpOnlyMenuBar 1200 + + +// Resource: MENU 1000 +#define MenuGameMenu 1000 +#define MenuGameNewGame 1000 +#define MenuGameSwitchGame 1001 +#define MenuGameRetire 1002 +#define MenuGameOptions 1004 // Command Key: O +#define MenuGameShortcuts 1005 +#define MenuGameHighScores 1007 +#define MenuGameClearHighScores 1008 +#define MenuGameSnapshot 1010 + +// Resource: MENU 1100 +#define MenuCommandMenu 1100 +#define MenuCommandBuyCargo 1100 // Command Key: B +#define MenuCommandSellCargo 1101 // Command Key: S +#define MenuCommandShipYard 1102 // Command Key: Y +#define MenuCommandBuyEquipment 1103 // Command Key: E +#define MenuCommandSellEquipment 1104 // Command Key: Q +#define MenuCommandPersonnelRoster 1105 // Command Key: P +#define MenuCommandBank 1106 // Command Key: K +#define MenuCommandSystemInformation 1107 // Command Key: I +#define MenuCommandCommanderStatus 1108 // Command Key: C +#define MenuCommandGalacticChart 1109 // Command Key: G +#define MenuCommandShortRangeChart 1110 // Command Key: W + +// Resource: MENU 1200 +#define MenuHelpMenu 1200 +#define MenuHelpHelpCurrentScreen 1200 // Command Key: H +#define MenuHelpHelpOnMenu 1201 +#define MenuHelpHowToPlay 1203 +#define MenuHelpTrading 1204 +#define MenuHelpTraveling 1205 +#define MenuHelpShipEquipment 1206 +#define MenuHelpSkills 1207 +#define MenuHelpFirstSteps 1208 +#define MenuHelpAcknowledgements 1209 +#define MenuHelpAbout 1211 + + +// Resource: tSTR 1300 +#define MainString 1300 // "While you are docked at a system, you can use the menu to access functions to buy and sell cargo, equip" + +// Resource: tSTR 1400 +#define NewCommanderString 1400 // "In the New Commander screen you can set your name, and set skill values. There are four skil" + +// Resource: tSTR 1000 +#define WarpString 1000 // "Tap the system you wish to warp to. The game will show you what is known about that system, or the average price list for that system (depending on your preferences and what you viewed last). You can warp from that screen. On " + +// Resource: tSTR 1100 +#define ExecuteWarpString 1100 // "This screen shows information on the system you have selected. If the system is reachable by a wormhole, it says so next to "Distance". To warp through a wormhole you" + +// Resource: tSTR 1200 +#define GalacticChartString 1200 // "Tapping a system on the gal" + +// Resource: tSTR 1500 +#define SystemInformationString 1500 // "This screen shows information on the system where you are currently docked. You can click on the News button to buy a newspaper, which will have headlines about local an" + +// Resource: tSTR 1600 +#define ConfirmNewString 1600 // "Starting a new game will erase all data on your current game." + +// Resource: tSTR 1700 +#define MoreSkillPointsString 1700 // "You have 20 skill points to divide over the four commander skills. You should award them all." + +// Resource: tSTR 1800 +#define BuyCargoString 1800 // "Use this screen to buy cargo. The leftmost column shows quantities" + +// Resource: tSTR 1900 +#define SellCargoString 1900 // "Use this screen to sell cargo. The leftmost column shows quantities you have stored in your cargo holds. The second column shows the name of the goods. If the name of the goods is in bold, it means you can sell these goods with a profit. The f" + +// Resource: tSTR 2000 +#define NothingAvailableString 2000 // "On the Buy Cargo screen, the button to the left of the goods displays the amount available. If the amount is zero, none of these goods are available." + +// Resource: tSTR 2100 +#define CantAffordString 2100 // "At the bottom of the Buy Cargo scr" + +// Resource: tSTR 2200 +#define NoEmptyBaysString 2200 // "On the screen where you can get the cargo, you see the number of cargo bays that are full, a" + +// Resource: tSTR 2300 +#define AmountToBuyString 2300 // "Specify the amount to buy and tap th" + +// Resource: tSTR 2400 +#define NothingForSaleString 2400 // "On the Sell Cargo screen, the leftmost button shows the number of cargo bays you have which contain these goods. If that amount is zero, you can't sell anything." + +// Resource: tSTR 2500 +#define AmountToSellString 2500 // "If you are selling items," + +// Resource: tSTR 2600 +#define ShipYardString 2600 // "At the Ship Yard, you can buy fuel, get your hull repaired, buy an escape pod, or even buy a new ship. When you buy a new ship, the total worth of your current ship (including equipment and cargo) is subtracted from the" + +// Resource: tSTR 2700 +#define BuyFuelString 2700 // "Enter the amount of credits you wish to spend on fuel and tap OK. If you tap Maximum, as much as needed for a full tank will be spent, up to your total amount of cash. If you tap Nothing, you won't buy fuel." + +// Resource: tSTR 2800 +#define BuyRepairsString 2800 // "Enter the amount of credits you wish to spend on repairs and tap OK. If you tap Maximum, as much as needed for full repairs will be spent, up to your total amount of cash. If you tap Nothing, you won't buy any repairs." + +// Resource: tSTR 2900 +#define NotInterestedString 2900 // "Notice that on the Sell Cargo screen, it says "no trade" next to these goods. This means that people aren't interested in buying them, either because of their political system, or because their tech level isn't high enough to make use of them." + +// Resource: tSTR 3000 +#define BuyShipString 3000 // "Information on a ship type you can get buy tapping the Info button to the right of it. Buy a new ship by tapping the corresponding Buy button. The price quoted for the ship takes into account the discount you get for trading in your current ship, inc" + +// Resource: tSTR 3100 +#define TradeShipString 3100 // "If you say Yes, you lose your current ship, including equipment and cargo, and get a brand new ship of the indicated type, without equipment and cargo." + +// Resource: tSTR 3200 +#define TooManyCrewmembersString 3200 // "The information on a ship will show how many crew quarters it has. If there are enough to hold your current crew, they will simply be transferred to the new ship. Otherwise you have to fire as many of them as needed, before you can buy a new ship." + +// Resource: tSTR 3300 +#define ShiptypeInfoString 3300 // "The Ship Information screen shows the specs of the selected ship type. You can return to the Buy Ship screen by tapping the button at the bottom of the screen. " + +// Resource: tSTR 3400 +#define CantBuyShipString 3400 // "The ship's price " + +// Resource: tSTR 3500 +#define BuyEquipmentString 3500 // "Tap the Buy button to the left of a piece of equipment to buy it for the price to the right of it. Note that each ship typ" + +// Resource: tSTR 3600 +#define SellEquipmentString 3600 // "To sell a piece of equipment for the price indicated to the right of it, tap the Sell button to the left of it." + +// Resource: tSTR 3700 +#define CantBuyItemString 3700 // "If you can't pay the price mentioned to the right of an item, you can't get it. If you have "Reserve Money" checked in the Options menu, the game will reserve at least enough money to pay for insurance and mercenaries." + +// Resource: tSTR 3800 +#define NotEnoughSlotsString 3800 // "F" + +// Resource: tSTR 3900 +#define NoMoreOfItemString 3900 // "Except for extra cargo bays, of the available gadgets you only need to buy one: a second one isn't of any use." + +// Resource: tSTR 4000 +#define ItemNotSoldString 4000 // "Each item is only available in a system which has the technological development needed to produce it." + +// Resource: tSTR 4100 +#define CargoBaysFullString 4100 // "First you need to sell some trade goods. When you have at least 5 empty bays, you can sell the extra cargo bays." + +// Resource: tSTR 4200 +#define PersonnelRosterString 4200 // "On the Personnel Roster screen, there are three areas. The upper two are reserved for mercenaries in your service. If you have hired someone, he or she is visible in one of these areas. To fire someone in your service, just tap the" + +// Resource: tSTR 4300 +#define NoFreeQuartersString 4300 // "If you hire someone, you must give him or her quarters on your ship. Depending on the type of ship, you can hire zero, one or two mercenaries." + +// Resource: tSTR 4400 +#define SpecialEventString 4400 // "In a special meeting, you can do something unique to this system. Usually this is a special offer or an assignment. If it is an offer you have to agree to, there are a Yes and a No button visible. Tap Ye" + +// Resource: tSTR 4500 +#define NotEnoughForEventString 4500 // "If you don't have" + +// Resource: tSTR 4600 +#define MustPayMercenariesString 4600 // "You must pay your mercenaries daily, that is, before you warp to another system. If you don't have the cash, you must either sell something so you have enough cash, or fire the mercenaries you can't pay. Until then, warping is out of the question." + +// Resource: tSTR 4700 +#define TribblesAteFoodString 4700 // "Alas, tribbles are hungry and fast-multiplying animals. You shouldn't expect to be able to hold them out of your cargo bays. You should find a way to get rid of them." + +// Resource: tSTR 4800 +#define YouHaveATribbleString 4800 // "The merchant prince sold you a cute, furry tribble. You can see your new acquisition on the Commander Status screen." + +// Resource: tSTR 4900 +#define BeamOverTribblesString 4900 // "No more tribbles!" + +// Resource: tSTR 5000 +#define SkillIncreaseString 5000 // "On the Commander Status screen you can see your new skill values." + +// Resource: tSTR 5100 +#define CleanRecordString 5100 // "With a clean police record, the police will usually let you slip by without searching your ship. Also, if you were a criminal before, you can now sell you goods again for full prices." + +// Resource: tSTR 5200 +#define CommanderStatusString 5200 // "On the Commander Status screen you ca" + +// Resource: tSTR 5300 +#define OptionsString 5300 // ""Always ignore when it is safe" will fly past encounters where y" + +// Resource: tSTR 5400 +#define AveragePricesString 5400 // "This screen shows the average prices you get for goods in the " + +// Resource: tSTR 5500 +#define BankString 5500 // "At the bank you can get a loan, if you are really in need o" + +// Resource: tSTR 5600 +#define YoureInDebtString 5600 // "Before you can buy a new ship or new equipment, you must settle your debts at the bank." + +// Resource: tSTR 5700 +#define GetLoanString 5700 // "As long as your debt is below the amount the bank is willing to lend you, you can get a loan up to that amount. There is a 10% interest to be paid each day, until you ha" + +// Resource: tSTR 5800 +#define PayBackString 5800 // "Pay back your loan by specifying an amount and tapping OK. You will never pay back more than your actual debt." + +// Resource: tSTR 5900 +#define DebtTooHighString 5900 // "You can't get a loan if your debt exceeds what the bank is willing to lend you." + +// Resource: tSTR 6000 +#define NoDebtString 6000 // "You don't need to pay back anything if you have no debts. Be happy." + +// Resource: tSTR 6100 +#define EncounterString 6100 // "When you encounter another ship, your and your opponent's stats are shown at the top of the encounter screen. When in pure text mode (you can set this in the Options menu), yo" + +// Resource: tSTR 6200 +#define UneventfulTripString 6200 // "Be glad you didn't encounter any pirates." + +// Resource: tSTR 6300 +#define ArrivalString 6300 // "Another trip you have survived." + +// Resource: tSTR 6400 +#define IllegalGoodsString 6400 // "Firearms and narcotics are illegal goods, and you lose these. You are fined a percentage of your total worth. This is subtracted from your credits. If you don't have enough credits, it increases your debt." + +// Resource: tSTR 6500 +#define NoIllegalGoodsString 6500 // "Firearms and narcotics are illegal goods. Since you don't carry these, the police have no problems with you." + +// Resource: tSTR 6600 +#define BribeString 6600 // "If the police officers can be bribed, it depends on the type of government of the target system how much" + +// Resource: tSTR 6700 +#define CantBeBribedString 6700 // "Certain governments have such an incorruptible police force that you can't bribe them." + +// Resource: tSTR 6800 +#define NoMoneyForBribeString 6800 // "You can only use your cash to pay a bribe; you can't trade your goods and you can't get a loan to pay the police off." + +// Resource: tSTR 6900 +#define PiratesPlunderString 6900 // "The pirates steal from you what they can carry, but at least you get out of it alive." + +// Resource: tSTR 7000 +#define PiratesFindNoCargoString 7000 // "If you have nothing in your cargo holds, th" + +// Resource: tSTR 7100 +#define BothDestroyedString 7100 // "The game is over, alas." + +// Resource: tSTR 7200 +#define OpponentDestroyedString 7200 // "You won the fight." + +// Resource: tSTR 7300 +#define ShipDestroyedString 7300 // "The game is over, alas." + +// Resource: tSTR 7400 +#define YouEscapedString 7400 // "You continue your flight towards the target system." + +// Resource: tSTR 7500 +#define OpponentEscapedString 7500 // "Your opponent has flown. You can't destroy him any longer, or try to plunder him." + +// Resource: tSTR 7600 +#define RetireString 7600 // "If you retire, the game ends. You sell your ship and everything on it, and remain in the current system for the rest of your days. If applicable, your total worth will be entered in the high score table." + +// Resource: tSTR 7700 +#define BountyString 7700 // "Destroying a pirate ship awards you bounty money. The height of the sum depends on the type of ship destroyed. The reward is automatically added to your cash." + +// Resource: tSTR 7800 +#define PlunderString 7800 // "You are allowed to plunder your opponent's cargo to your heart's content. Just steal whatever is to your liking. This works exactly as the Buy Cargo option when you are docked, except that you " + +// Resource: tSTR 7900 +#define NotEnoughBaysString 7900 // "You should sell enough goods so that you have enough empty cargo bays available." + +// Resource: tSTR 8000 +#define AntidoteString 8000 // "You can't use these ten cargo bays until you have visited the Japori system and delivered them there. Note that you can't even get rid of them by selling your ship." + +// Resource: tSTR 8100 +#define LightningShieldString 8100 // "The lightning shield is a shield with a lot more power than the u" + +// Resource: tSTR 8200 +#define SealedCannistersString 8200 // "On the Sell Cargo screen you can see what you bought." + +// Resource: tSTR 8300 +#define AmountToPlunderString 8300 // "You can steal the amount you like, as long as it fits in your cargo bays. Tap Maximum to get as much as possible. Tap Nothing to return to the Plunder screen." + +// Resource: tSTR 8400 +#define VictimDoesntHaveAnyString 8400 // "You can only steal what your victim actually has." + +// Resource: tSTR 8500 +#define FindSystemString 8500 // "Type in the name of the system you are looking for and click OK. The search is case insensitive. Selecting "Track this System" will cause a arrow to be shown in the Short Range chart, pointing in the direction of the system you are looking for." + +// Resource: tSTR 8600 +#define NoFullTanksString 8600 // "You have checked the automatic buying of full fuel tanks in the Options menu, but you don't have enough money to buy those tanks. Don't forget to buy them as soon as you have made some money." + +// Resource: tSTR 8700 +#define NoFullRepairsString 8700 // "You have automatic full hull repairs checked in the Options menu, but you don't have the money for that. If you still want the repairs, don't forget to make them before you leave the system." + +// Resource: tSTR 8800 +#define NoFullTanksOrRepairsString 8800 // "In the Options menu you have indicated that you wish to buy full tanks and full hull repairs automatically when you arrive in a new system, but you don't have the money for that. At least make sure that you buy full tanks after you have made some money." + +// Resource: tSTR 8900 +#define HighScoreString 8900 // "Your score, calculated from the way you ended the game, your total worth, and the number of days you played, is entered automatically in the high score table when you qualify. You do NOT qualify if you laded a savegame while playing the game." + +// Resource: tSTR 9000 +#define HighScoreTableString 9000 // "This screen shows the high scores. The scoring percentage is calculated as follows: if you retired through the menu, your score is your total worth / 25000, minus 5%. If you got killed, your scor" + +// Resource: tSTR 9100 +#define ClearTableString 9100 // "If you clear the high score table, your next score is certain to get entered. It's a bit of a cowardly option, though." + +// Resource: tSTR 9200 +#define HowToPlayString 9200 // "Space Trader is a strategy game in which the ultimate goal is to make enough cash to buy your own mo" + +// Resource: tSTR 9300 +#define TradingString 9300 // "Trading is the safest way to make money. You trade by buying goods at one solar system, and sell them at another solar system. Of course, you should try to make a profit. There are several ways to ensure you can indee" + +// Resource: tSTR 9400 +#define TravellingString 9400 // "To travel to another system, go to the Short Range Chart. The system where you currently are is in the centre of the screen. The wide circle shows how far you can travel on your current fuel tanks. If t" + +// Resource: tSTR 9500 +#define ShipEquipmentString 9500 // "There are several types of ships available to you. You start out in a Gnat, which is the cheapest ship but one (the cheapest is the Flea, which is mainly used if you need to jump over a large distance, since it " + +// Resource: tSTR 9600 +#define SkillsString 9600 // "As a trader, you have need of several skills. You can set your skills on the New Commander screen at the start of the game. The Pilot skill determines how well you fly your ship. Good pilots have an easier time escaping from a fight and dod" + +// Resource: tSTR 9800 +#define AcknowledgementsString 9800 // "This first version of "Space Trader" has been designed and programmed by me, Pieter Spronck, between July and September 2000. The game has been enhanced several times since then. It has been released as freeware un" + +// Resource: tSTR 9900 +#define FirstStepsString 9900 // "Here I will describe the steps you will undertake the first days as a trader: You start by docking on some system. The specifics of that system are shown on the System Information screen. Take special " + +// Resource: tSTR 10000 +#define EggString 10000 // "Look up your ship's equipment." + +// Resource: tSTR 10100 +#define NoWeaponsString 10100 // "You either are flying a ship without any weapon slots, so your only option is to flee from fights, or you haven't bought any weapons yet. Sorry, no weapons, no attacking." + +// Resource: tSTR 10200 +#define BuyEscapePodString 10200 // "When your ship has an escape pod, when it is destroyed, you are automatically ejected from it and you will be picked up by the Space Corps after a few days and dropped on a nearby system. You w" + +// Resource: tSTR 10300 +#define EscapePodActivatedString 10300 // "You have lost your ship and cargo, but your and your crew's lives are saved. The Space Corps transports you to the space port of the system where you are currently located. Your crew is returned to their home systems." + +// Resource: tSTR 10400 +#define FleaBuiltString 10400 // "Your ship has been destroyed, but luckily, you are clever enough to convert your pod into a Flea type of ship, so you can continue your journey, or trade it in for a better ship." + +// Resource: tSTR 10500 +#define InsurancePaysString 10500 // "The bank pays you the amount your ship was worth, including equipment but excluding the cargo. Note that this is the same amount as you would have got when you would have traded the ship in." + +// Resource: tSTR 10600 +#define TribbleSurvivedString 10600 // "Don't be too sad. They were incredibly annoying, weren't they?" + +// Resource: tSTR 10700 +#define AntidoteDestroyedString 10700 // "The antidote for the Japori system was destroyed with your ship. But they probably have some new antidote in the system where you originally got it." + +// Resource: tSTR 10800 +#define NoEscapePodString 10800 // "Insurance pays out when you must escape from your ship with an escape pod. Since you don't have a pod, you can't get insurance." + +// Resource: tSTR 10900 +#define StopInsuranceString 10900 // "If you stop your insurance, your no-claim will return to 0%, even if you buy new insurance immediately." + +// Resource: tSTR 11000 +#define CantPayInsuranceString 11000 // "You can't leave if you haven't paid your insurance. If you have no way to pay, you should stop your insurance at the bank." + +// Resource: tSTR 11100 +#define OutdatedSoftwareString 11100 // "This version of the software is a beta version, and can't be used after a certain date. To get a the latest version, go to http://go.to/spacetrader." + +// Resource: tSTR 11200 +#define PickCannisterString 11200 // "Your scoops can pick up space debris. If you want the contents of this canister, and you have room in your cargo holds, you can pick it up. If you don't have room, you can dump cargo to make room." + +// Resource: tSTR 11300 +#define CurrentShipString 11300 // "This screen shows your current ship, including equipment. " + +// Resource: tSTR 11400 +#define SellItemString 11400 // "Selling an item will return to you about 75% of what you first paid for it. If you sell a ship as a whole, all items on it will automatically be sold." + +// Resource: tSTR 11500 +#define SureToFleeOrBribeString 11500 // "Only when you are carrying illegal goods, the police will do something you don't like, so if you aren't carrying anything illegal, you usually should just submit, and not try to attack, flee or bribe." + +// Resource: tSTR 11600 +#define SureToSubmitString 11600 // "If you are carrying illegal goods and " + +// Resource: tSTR 11700 +#define BuyItemString 11700 // "Tap Yes if you want to buy the item in the title for the price mentioned." + +// Resource: tSTR 11800 +#define QuestsString 11800 // "This screen lists the quests you are currently on." + +// Resource: tSTR 11900 +#define WormholeOutOfRangeString 11900 // "The system that owns a wormhole is shown to the left of it. You must first fly to that system, and tap the wormhole from there." + +// Resource: tSTR 12000 +#define CantPayWormholeString 12000 // "Wormhole tax must be paid when you want to warp through a wormhole. It depends on the type of your ship." + +// Resource: tSTR 12100 +#define SpecificationString 12100 // "These are the specifications of the costs you have to pay if you are going to warp to the selected target system." + +// Resource: tSTR 12200 +#define SqueekString 12200 // "This is a cute, furry tribble." + +// Resource: tSTR 12300 +#define TribblesAteNarcoticsString 12300 // "Tribbles ate your narcotics, and it killed most of them. At least the furs remained." + +// Resource: tSTR 12400 +#define MoonBoughtString 12400 // "What are you waiting for?" + +// Resource: tSTR 12500 +#define ArtifactStolenString 12500 // "The aliens have taken the artifact from you. Well, it's rightfully theirs, so you probably shouldn't complain. You won't receive any reward from professor Berger, though." + +// Resource: tSTR 12600 +#define ArtifactNotSavedString 12600 // "You couldn't take the artifact with you in the escape pod, so now it's lost in the wreckage. The aliens will probably pick it up there." + +// Resource: tSTR 12700 +#define ShipNotWorthMuchString 12700 // "Normally you would receive about 75% of the worth of a new ship as trade-in value, but a tribble infested ship will give you only 25%. It is a way to get rid of your tribbles, though." + +// Resource: tSTR 12800 +#define AttackByAccidentString 12800 // "If you attack the police, they know you are a die-hard criminal and will immediately label you as such." + +// Resource: tSTR 12900 +#define AttackTraderString 12900 // "While attacking a trader is not considered to be as bad as attacking the police (since no police is present, they cannot judge the exact circumstances of the attack), it will make the police suspicious of you." + +// Resource: tSTR 13000 +#define NoSurrenderString 13000 // "If you are too big a criminal, surrender is NOT an option anymore." + +// Resource: tSTR 13100 +#define ArrestedString 13100 // "At least you survived." + +// Resource: tSTR 13200 +#define AntidoteRemovedString 13200 // "At least those poor people at Japori are assisted. You couldn't help them, what with being in prison 'n all." + +// Resource: tSTR 13300 +#define TribblesSoldString 13300 // "At least you got rid of them." + +// Resource: tSTR 13400 +#define FleaReceivedString 13400 // "It's standard practice for the police to leave a condemned criminal with at least the means to leave the solar system." + +// Resource: tSTR 13500 +#define ConvictionString 13500 // "Your fine and number of days in prison are based on the kind of criminal you were found to be." + +// Resource: tSTR 13600 +#define ShipSoldString 13600 // "The Space Corps needs cash to make you pay for the damages you did. Your ship is the only valuable possession you have." + +// Resource: tSTR 13700 +#define InsuranceLostString 13700 // "Too bad. Your no-claim is reset too." + +// Resource: tSTR 13800 +#define MercenariesLeaveString 13800 // "You can't pay your mercenaries while you are imprisoned, and so they have sought new employment." + +// Resource: tSTR 13900 +#define WantToSurrenderString 13900 // "Your fine and time in prison will depend on how big a criminal you are. Your fine will b" + +// Resource: tSTR 14000 +#define ImpoundString 14000 // "What would you expect?" + +// Resource: tSTR 14100 +#define WantToSurrenderToAliensString 14100 // "The aliens are only after the artifact. They will let you live, and even let you keep your cargo, but you won't be able to finish your quest." + +// Resource: tSTR 14200 +#define RetireDestroyedUtopiaString 14200 // "Tap anywhere on the screen to continue..." + +// Resource: tSTR 14300 +#define NoQuartersForJarekString 14300 // "To be able to take a passenger on board, you must have at least one empty set of crew quarters. That means you can't take a passenger on a ship with only one set of quarters, and if you have spare quarters, there can't be a mercenary living in them." + +// Resource: tSTR 14400 +#define JarekNeedsQuartersString 14400 // "There is room for a passenger on your current ship, but not on the ship you intend to buy." + +// Resource: tSTR 14500 +#define JarekTakenHomeString 14500 // "You can't deliver Jarek home yourself now." + +// Resource: tSTR 14600 +#define JarekTakenOnBoardString 14600 // "Your passenger uses one of your crew quarters, until you have delivered him to his destination." + +// Resource: tSTR 14700 +#define QuestListString 14700 // "This form lists where all the quests start." + +// Resource: tSTR 14800 +#define FuelCompactorString 14800 // "A fuel compactor allows you to fill up your tanks so you can travel 18 parsecs. You can't buy this anywhere, though you may sell it if you like. If you upgrade ships, you can pay to have the fuel compactor installed in your new ship." + +// Resource: tSTR 14900 +#define DebtWarningString 14900 // "You get this warning because your debt has exceeded 75000 credits. If you don't pay back quickly, you may find yourself stuck in a system with no way to leave. You have been warned." + +// Resource: tSTR 15000 +#define DebtTooLargeForBuyString 15000 // "Your debt has exceeded 100000 credits. You're in big trouble! You cannot buy any cargo. You should have heeded the warnings!" + +// Resource: tSTR 15100 +#define DebtTooLargeForTravelString 15100 // "Your ship has been chained to the station's dock. Your debt has increased to a point where you are no longer a trusted trader. You may not leave until you can reduce it to an acceptable level. You have been warned and should have listened.." + +// Resource: tSTR 15200 +#define TransferFuelCompactorString 15200 // "For the sum of 20000 credits, you get to keep your unique fuel compa" + +// Resource: tSTR 15300 +#define TransferLightningShieldString 15300 // "For the sum of 30000 credits, you get to keep your unique ligh" + +// Resource: tSTR 15400 +#define FireMercenaryString 15400 // "If you fire a mercenary, he or she returns to his or her home system." + +// Resource: tSTR 15600 +#define LootMarieCelesteString 15600 // "The Marie Cel" + +// Resource: tSTR 15900 +#define TradeCaptainAhabString 15900 // "Captain Ahab is in need of a spare shield for an upcoming mission. Since he's in a rush, he'd rather not stop to get one on-planet. The deal he's offering is a trade, rather than cash, for the shield. He'll trade y" + +// Resource: tSTR 16000 +#define TrainingString 16000 // "Under the watchful eye of the Captain, you demonstrate your abilities. The Captain provides some helpful pointers and tips, and teaches you a few new techniques. The few hours pass quickly, but you feel you've gained a lot from the experience." + +// Resource: tSTR 16100 +#define TradeCaptainConradString 16100 // "Captain " + +// Resource: tSTR 16200 +#define TradeCaptainHuieString 16200 // "Captain Huie is in need of a military laser for an upcoming mission, but would rather hold onto her cash to buy her cargo. The deal she's offering is a trade" + +// Resource: tSTR 16300 +#define DrinkOldTonicString 16300 // "Floating in orbit, you " + +// Resource: tSTR 16600 +#define DrankGoodSkillTonicString 16600 // "Captain Marmoset's Amazing Skill Tonic goes down very smoothly. You feel a slight tingling in your fingertips. " + +// Resource: tSTR 16700 +#define DrankOldSkillTonicString 16700 // "Captain Marmoset's Amazing Skill Tonic tasted very strange, like slightly salty red wine. You feel a bit dizzy, and your teeth itch for a while. " + +// Resource: tSTR 16900 +#define BuyPaperString 16900 // "The local newspaper is a great way to find out what's going on in the area. You may find out about shortages, wars, or other situations at nearby systems. Then again, some will tell you that "no news is good news."" + +// Resource: tSTR 17000 +#define CantBuyNewspaperString 17000 // "If you can't pay the price of a newspaper, you can't get it. If you have "Reserve Money" checked in the Options menu, the game will reserve at least enough money to pay for insurance and mercenaries." + +// Resource: tSTR 17100 +#define DumpItemString 17100 // "On the Dump Cargo screen, the leftmost button shows the number of cargo bays you have which contain these goods. If that amount is zero, you can't dump any." + +// Resource: tSTR 17200 +#define Options2String 17200 // ""Always pay for newspaper" will allow you to automatically pay when you click on the "News" button when viewing system information. If you leave this unchec" + +// Resource: tSTR 17300 +#define DumpCargoString 17300 // "Use this screen to jettison unwanted cargo. The leftmost column shows quantities you have stored in your cargo holds. T" + +// Resource: tSTR 17400 +#define WildArrestedString 17400 // "Jonathan Wild is arrested, and taken off to prison." + +// Resource: tSTR 17600 +#define WildSwitchesShipsString 17600 // "Jonathan Wild figures that it's probably safer to get a ride home with his old associate than stay on your ship. After all, if you surrender to pirates, what's to stop you from surrendering to the police?" + +// Resource: tSTR 17700 +#define WildStaysAboardString 17700 // "Jonathan Wild would h" + +// Resource: tSTR 17900 +#define WildLeavesString 17900 // "Since Jonathan Wild is not willing to travel under these conditions, and you're not willing to change the situation, he leaves you and goes into hiding on this system." + +// Resource: tSTR 17800 +#define WildWontGoString 17800 // "Jonathan Wild is being hunted by the police. They're serious about capturing him, and he doesn't wish to be captured. He'd rather take his chances hiding out on this system than facing swarms of police without any weapons." + +// Resource: tSTR 18000 +#define ReactorUsingFuelString 18000 // "The Reactor was unstable to begin with. Now, it seems that it's rapidly consuming fuel. It is not clear what will happen if it runs out -- but you have no reason to suspect it will be anything good." + +// Resource: tSTR 18100 +#define ReactorSelfDestructString 18100 // "The Reactor has undergone unplanned energetic self-disassembly." + +// Resource: tSTR 18200 +#define ReactorOnBoardString 18200 // "You can't use the five cargo bays containing the reactor until" + +// Resource: tSTR 18300 +#define MorganLaserInstallString 18300 // "Henry Morgan's Special Laser is a more powerful version of the Military laser. It uses advanced thermal coherence, which " + +// Resource: tSTR 18400 +#define ReactorTakenString 18400 // "The bad news is that you've lost the Ion Reactor. The good news is that you no longer have to worry about managing its depleting fuel store." + +// Resource: tSTR 18500 +#define ReactorNotTakenString 18500 // "The good news is that you still have the Ion Reactor. The bad news is that you still have to worry about managing its depleting fuel store." + +// Resource: tSTR 18600 +#define CantTransferString 18600 // "When trading ships, you will only be able to transfer an item from your old ship to the new ship if there is capacity for that item on the new ship," + +// Resource: tSTR 18700 +#define TransferMorgansLaserString 18700 // "For the sum of 33333 credits, you get to keep the laser given to you by" + +// Resource: tSTR 18800 +#define CantTransferAllString 18800 // "The ship's price takes into account the trade-in value of your current ship. You have to pay the remaining price, and the price of transferring your unique equipment, with y" + +// Resource: tSTR 18900 +#define TribbleNoticeString 18900 // "You might want to do something about those Tribbles..." + +// Resource: tSTR 19000 +#define CantSellShipWithReactorString 19000 // "You can't sell your ship as long as you have an Ion Reactor on board. Deliver the Reactor to Nix, and then you'll be able to get a new ship." + +// Resource: tSTR 19100 +#define IrradiatedTribblesString 19100 // "Radiation poisoning seems particularly effective in killing Tribbles. Unfortunately, their fur falls out when they're irradiated, so you can't salvage anything to sell." + +// Resource: tSTR 19200 +#define WildWontGoWithReactorString 19200 // "The Ion Reactor is known to be unstable, and Jonathan Wild is trying to get to safety. He's not willing to get on the ship while the Reactor's on board." + +// Resource: tSTR 19300 +#define NewspaperHelpString 19300 // "The local newspaper gives you information about what's happening on this and nearby systems. On higher-tech systems, you'll probably get better news about neighboring systems than you would on a low-tech system." + +// Resource: tSTR 19400 +#define TrackSystemString 19400 // "Tracking a system will modify the Sh" + +// Resource: tSTR 19500 +#define DumpAllString 19500 // "You" + +// Resource: tSTR 19600 +#define FleePostMarieString 19600 // "Even if you get away, the Customs Police know that you've engaged in criminal activity, and your police record will reflect this fact." + +// Resource: tSTR 19700 +#define CustomsPoliceConfiscatedString 19700 // "The Customs Police took all the illegal goods from your ship, and sent you on your way. " + +// Resource: tSTR 30000 +#define QuestDragonflyDestroyedString 30000 // "Hello, " + +// Resource: tSTR 30100 +#define QuestLightningShipString 30100 // "A ship with shields that seemed to be like lightning recently fought many other ships in our system. I have never seen anything like it before. After it left, I heard it went to the Regulas system." + +// Resource: tSTR 30200 +#define QuestMonsterKilledString 30200 // "We thank you for destroying the space monster that circled our system for so long. Please accept 15000 credits as reward for your heroic deed." + +// Resource: tSTR 30300 +#define QuestRetirementString 30300 // "Welcome to the Utopia system. Your own moon is available for you to retire to it, if you feel inclined to do that. Are you ready to retire and lead a happy, peaceful, and wealthy life?" + +// Resource: tSTR 30400 +#define QuestSkillIncreaseString 30400 // "An alien with a fast-learning machine offers to increase one of your skills for the reasonable sum of 3000 credits. You won't be able to pick that skill, though. Do you accept his offer?" + +// Resource: tSTR 30500 +#define QuestEraseRecordString 30500 // "A hacker conveys to you that he has cracked the passwords to the galaxy-wide police computer network, and that he can erase your police record for the sum of 5000 credits. Do you want him to do that?" + +// Resource: tSTR 30600 +#define QuestSpaceMonsterString 30600 // "A space monster has invaded the Acamar system and is disturbing the trade routes. You'll be rewarded handsomely if you manage to destroy it." + +// Resource: tSTR 30700 +#define QuestCargoForSaleString 30700 // "A trader in second-hand goods offers you 3 sealed cargo canisters for the sum of 1000 credits. It could be a good deal: they could contain robots. Then again, it might just be water. Do you want the canisters?" + +// Resource: tSTR 30800 +#define QuestJaporiDiseaseString 30800 // "A strange disease has invaded the Japori system. We would like you to deliver these ten canisters of special antidote to Japori. Note that, if you accept, ten of your cargo bays will remain in use on your way to Japori. Do you accept this mission?" + +// Resource: tSTR 30900 +#define QuestArtifactDeliveryString 30900 // "This is professor Berger. I thank you for delivering the alien artifact to me. I hope the aliens weren't too much of a nuisance. I have transferred 20000 credits to your account, which I assume compensates for your troubles." + +// Resource: tSTR 31000 +#define QuestAmbassadorJarekString 31000 // "A recent change in the political climate of this solar system has forced ambassador Jarek to flee back to his home system, Devidia. Would you be willing to give him a lift?" + +// Resource: tSTR 31100 +#define QuestGemulonInvadedString 31100 // "Alas, Gemulon has been invaded by aliens, which has thrown us back to pre-agricultural times. If only we had known the exact coordinates where they first arrived at our system, we might have prevented this tragedy from happening." + +// Resource: tSTR 31200 +#define QuestDangerousExperimentString 31200 // "While reviewing the plans for Dr. Fehler's new space-warping drive, Dr. Lowenstam discovered a critical error. If you don't go to Daled and stop the experiment within ten days, the time-space continuum itself could be damaged!" + +// Resource: tSTR 31300 +#define QuestMorgansReactorString 31300 // "Galactic criminal Henry Morgan wants this illegal ion reac" + +// Resource: tSTR 31400 +#define QuestScarabStolenString 31400 // "Captain Renwick developed a new organic hull material for h" + +// Resource: tSTR 30050 +#define QuestWeirdShipString 30050 // "A small ship of a weird design docked here recently for repairs. The engineer who worked on it said that it had a weak hull, but incredibly strong shields. I heard it took off in the direction of the Melina system." + +// Resource: tSTR 30150 +#define QuestStrangeShipString 30150 // "A small ship with shields like I have never seen before was here a few days ago. It destroyed at least ten police ships! Last thing I heard was that it went to the Zalkon system." + +// Resource: tSTR 30250 +#define QuestMedicineDeliveredString 30250 // "Thank you for delivering the medicine to us. We don't have any money to reward you, but we do have an alien fast-learning machine with which we will increase your skills." + +// Resource: tSTR 30350 +#define QuestMoonForSaleString 30350 // "There is a small but habitable moon for sale in the Utopia system, for the very reasonable sum of half a million credits. If you accept it, you can retire to it and live a peaceful, happy, and wealthy life. Do you wish to buy it?" + +// Resource: tSTR 30450 +#define QuestMerchantPrinceString 30450 // "A merchant prince offers you a very special and wondrous item for the sum of 1000 credits. Do you accept?" + +// Resource: tSTR 30550 +#define QuestTribbleBuyerString 30550 // "An eccentric alien billionaire wants to buy your collection of tribbles and offers half a credit for each of them. Do you accept his offer?" + +// Resource: tSTR 30650 +#define QuestDragonflyString 30650 // "This is colonel Jackson of the Space Corp" + +// Resource: tSTR 30750 +#define QuestLightningShieldString 30750 // "Colonel Jackson here. Do you want us to install a lightning shield on your current ship?" + +// Resource: tSTR 30850 +#define QuestLotteryWinnerString 30850 // "You are lucky! While docking on the space port, you receive a message that you won 1000 credits in a lottery. The prize had been added to your account." + +// Resource: tSTR 30950 +#define QuestAlienArtifactString 30950 // "This alien artifact should be delivered to" + +// Resource: tSTR 31050 +#define QuestAlienInvasionString 31050 // "We received word that alie" + +// Resource: tSTR 31150 +#define QuestFuelCompactorString 31150 // "Do you wish us to install the fuel compactor on your current ship? (You need a free gadget slot)" + +// Resource: tSTR 31250 +#define QuestJonathanWildString 31250 // "Law Enforcement is closing in on notorious criminal kingpin Jonathan Wild. He would reward you handsomely for smuggling him home to Kravat. You'd have to avoid capture by the Police on the way. Are you willing to give him a berth?" + +// Resource: tSTR 31350 +#define QuestInstallMorgansLaserString 31350 // "Morgan's technicians are standing by with something that looks a lot like a military laser -- if you ignore the additional cooling vents and anodized ducts. Do you want them to install Morgan's special laser?" + +// Resource: tSTR 31500 +#define QuestScarabDestroyedString 31500 // "Space Corps is " + +// Resource: tSTR 31450 +#define QuestUpgradeHullString 31450 // "The organic hull used in the Scarab is still not ready for day-to-day use. But Captain Renwick can certainly upgrade your hull with some of his retrofit technology. It's light stuff, and won't reduce your ship's range. Should he upgrade your ship?" + +// Resource: tSTR 31600 +#define QuestJarekGetsOutString 31600 // "Ambassador Jarek is very grateful to you for delivering him back to Devidia. As a reward, he gives you an experimental handheld haggling computer, which allows you to gain larger discounts when purchasing goods and equipment." + +// Resource: tSTR 31550 +#define QuestReactorDeliveredString 31550 // "Henry Mo" + +// Resource: tSTR 31700 +#define QuestDisasterAvertedString 31700 // "Upon your warning, Dr. Fehler calls off " + +// Resource: tSTR 31650 +#define QuestGemulonRescuedString 31650 // "This in" + +// Resource: tSTR 31800 +#define QuestWildGetsOutString 31800 // "Jonathan Wild is most" + +// Resource: tSTR 31750 +#define QuestExperimentFailedString 31750 // "Dr. Fehler can't understand why the experiment failed. But the failure has had a dramatic and disastrous effect on the fabric of space-time itself. It seems that Dr. Fehler won't be getting tenure any time soon... and you may have trouble when you warp!" + +// Resource: tSTR 19800 +#define HullReinforcedString 19800 // "Technicians spent the day replacing welds and bolts, and adding materials to your ship. When they're done, they tell you your ship should be significantly sturdier." + +// Resource: tSTR 19900 +#define TradeInOrbitString 19900 // "If you are selling items, specify the amount to sell an" + +// Resource: tSTR 9700 +#define MarieCantBribeString 9700 // "Certain governments have such an incorruptible police force that you can't bribe them. Other times, the police are corruptible, but their supervisors know what's going on, so they won't risk it." + +// Resource: tSTR 20000 +#define AttackGreatCaptainString 20000 // "You grew up on stories of the adventures of the Great Captains. You heard how they explored the galaxy, invented technologies ... and destroyed man, many pirates and villains in combat. Are you sure you want to attack one of these greats?" + +// Resource: tSTR 15500 +#define ErrGraphicsSupportString 15500 // "There are four versions of Space Trader: 1) SpaceTr" + +// Resource: tSTR 15700 +#define CreditsString 15700 // "Space Trader Copyright © 2000-2002 by Pieter Spron" + +// Resource: tSTR 20100 +#define LoanReminderString 20100 // "The Bank Officer will contact you every five days to remind you of your debt. You can turn off these warnings on the second page of Game Options." + +// Resource: tSTR 20200 +#define SingularityString 20200 // "To use the Portable Singularity in the Galactic Chart, select your destination system by tracking it, then Jump by clicking the "J" button. Voila! You will travel through the Singularity and arrive instananeously at your destination." + +// Resource: tSTR 15800 +#define NoDumpNoScoopString 15800 // "If you wanted to pick up the floating canister, you had to dump something from your cargo holds." + +// Resource: tSTR 16400 +#define CannotSaveString 16400 // "There was an error trying to create the savegame file. This may be due to a lack of system resources." + +// Resource: tSTR 16500 +#define CannotLoadString 16500 // "No savegame file was found to load. You must first create a savegame file with the menu choice "Save game"." + +// Resource: tSTR 16800 +#define ReallyLoadString 16800 // "Loading a savegame will remove your current game from memory and restore an earlier situation." + +// Resource: tSTR 17500 +#define DisableScoringString 17500 // "Only a game played without loading previously saved games will be taken into account for the high score table. So you can load a game, but you won't score anymore, until you start a new game." + +// Resource: tSTR 20300 +#define GameSavedString 20300 // "Snapshots are meant" + +// Resource: tSTR 20400 +#define ShortcutPrefsString 20400 // "On this page you can set your preferences for the rectangularshortcut buttons used when you're in the dock. Use the pulldowns to assign the function to each navigation button. Shortcut 1 is the leftmost shortcut, while Shortcut 4 is the rightmost." + +// Resource: tSTR 20500 +#define SpaceLitteringString 20500 // "Space litterers will at least be considered dubious. If you are already a dubious character, space littering will only add to your list of offences. However, the police must of course be able to track the litter to you, which they often are not." + +// Resource: tSTR 20600 +#define SwitchGameString 20600 // "You can play two parallel games of Space Trader on your Palm. You switch between them by using the "Switch Game" option. This allows you to try two different styles" + +// Resource: tSTR 20700 +#define CannotSwitchString 20700 // "Switching to a parallel game failed. This is usually due to a lack of space on your Palm." + +// Resource: tSTR 20800 +#define SwitchedString 20800 // "A parallel game has been loaded. You can switch back to the previous game by using the option "Switch Game" again." + +// Resource: tSTR 20900 +#define SwitchToNewString 20900 // "You can play two parallel games on a Palm. You can switch between them with the "Switch Game" function. You best give the commander in each of the games a different name, which makes it easier to recognize them." + +// Resource: tSTR 21000 +#define HelpOnMenuString 21000 // "The menu consists of" + +// Resource: tSTR 21100 +#define IdentifyStartupString 21100 // "This information box shows the name of the commander playing the current game. This is useful if two switched games are played in parallel. You can turn this notification off in the Options." + +// Resource: tSTR 21200 +#define RectangularButtonsOnString 21200 // "Space Trader by default uses rectangular buttons for shortcuts and on several screens. Before the release of Palm OS 5.0 it was possible to change the frame of a button from rounded into rectangular by directly acce" + +// Resource: tSTR 21300 +#define AttemptRectangularString 21300 // "After you leave the Options, if the current game screen shown contains buttons that normally are rectangular, the change will be visible when you leave the screen and come back to it later." + +// Resource: tSTR 21400 +#define NoJumpToCurSystemString 21400 // "Track another system than the one where you are currently are located, then tap the Singularity button to jump." + + +// Resource: tSTL 4300 +#define TheocracyHeadlinesStringList 4300 + +// Resource: tSTL 4200 +#define TechnocracyHeadlinesStringList 4200 + +// Resource: tSTL 4100 +#define SatoriHeadlinesStringList 4100 + +// Resource: tSTL 4000 +#define SocialistHeadlinesStringList 4000 + +// Resource: tSTL 3900 +#define PacifistHeadlinesStringList 3900 + +// Resource: tSTL 3800 +#define MonarchyHeadlinesStringList 3800 + +// Resource: tSTL 3700 +#define MilitaryHeadlinesStringList 3700 + +// Resource: tSTL 3600 +#define FeudalHeadlinesStringList 3600 + +// Resource: tSTL 3500 +#define FascistHeadlinesStringList 3500 + +// Resource: tSTL 3400 +#define DictatorshipHeadlinesStringList 3400 + +// Resource: tSTL 3300 +#define DemocracyHeadlinesStringList 3300 + +// Resource: tSTL 3200 +#define CyberneticHeadlinesStringList 3200 + +// Resource: tSTL 3100 +#define CorporateHeadlinesStringList 3100 + +// Resource: tSTL 3000 +#define ConfederacyHeadlinesStringList 3000 + +// Resource: tSTL 2900 +#define CommunistHeadlinesStringList 2900 + +// Resource: tSTL 2800 +#define CapitalistHeadlinesStringList 2800 + +// Resource: tSTL 2700 +#define AnarchyHeadlinesStringList 2700 + +// Resource: tSTL 2600 +#define TheocracyMastheadsStringList 2600 + +// Resource: tSTL 2500 +#define TechnocracyMastheadsStringList 2500 + +// Resource: tSTL 2400 +#define SatoriMastheadsStringList 2400 + +// Resource: tSTL 2300 +#define SocialistMastheadsStringList 2300 + +// Resource: tSTL 2200 +#define PacifistMastheadsStringList 2200 + +// Resource: tSTL 2100 +#define MonarchyMastheadsStringList 2100 + +// Resource: tSTL 2000 +#define MilitaryMastheadsStringList 2000 + +// Resource: tSTL 1900 +#define FeudalMastheadsStringList 1900 + +// Resource: tSTL 1800 +#define FascistMastheadsStringList 1800 + +// Resource: tSTL 1700 +#define DictatorshipMastheadsStringList 1700 + +// Resource: tSTL 1600 +#define DemocracyMastheadsStringList 1600 + +// Resource: tSTL 1500 +#define CyberneticMastheadsStringList 1500 + +// Resource: tSTL 1400 +#define CorporateMastheadsStringList 1400 + +// Resource: tSTL 1300 +#define ConfederacyMastheadsStringList 1300 + +// Resource: tSTL 1200 +#define CommunistMastheadsStringList 1200 + +// Resource: tSTL 1100 +#define CapitalistMastheadsStringList 1100 + +// Resource: tSTL 1000 +#define AnarchyMastheadsStringList 1000 + +// Resource: tSTL 5000 +#define ShortcutTextStringList 5000 + + +// Resource: PICT 2200 +#define AppIconBWBitmap 2200 + +// Resource: PICT 2500 +#define AppIconColorBitmap 2500 + +// Resource: PICT 2600 +#define SmallAppIconBWBitmap 2600 + +// Resource: PICT 2700 +#define SmallAppIconColorBitmap 2700 + +// Resource: PICT 2400 +#define AppIconGrayBitmap 2400 + +// Resource: PICT 2650 +#define SmallAppIconGrayBitmap 2650 + + +// Resource: taif 1000 +#define IconSpaceMerchantAppIconFamily 1000 + +// Resource: taif 1001 +#define IconSpaceMerchantSmallAppIconFamily 1001 + diff --git a/Rsc/Resource.frk/Merchant.rsrc b/Rsc/Resource.frk/Merchant.rsrc new file mode 100644 index 0000000..07f9bc6 Binary files /dev/null and b/Rsc/Resource.frk/Merchant.rsrc differ diff --git a/Rsc/Resource.frk/MerchantBW.rsrc b/Rsc/Resource.frk/MerchantBW.rsrc new file mode 100644 index 0000000..5bb7014 Binary files /dev/null and b/Rsc/Resource.frk/MerchantBW.rsrc differ diff --git a/Rsc/Resource.frk/MerchantColor.rsrc b/Rsc/Resource.frk/MerchantColor.rsrc new file mode 100644 index 0000000..ba664b3 Binary files /dev/null and b/Rsc/Resource.frk/MerchantColor.rsrc differ diff --git a/Rsc/Resource.frk/MerchantGray.rsrc b/Rsc/Resource.frk/MerchantGray.rsrc new file mode 100644 index 0000000..097e869 Binary files /dev/null and b/Rsc/Resource.frk/MerchantGray.rsrc differ diff --git a/Space Trader.mcp b/Space Trader.mcp new file mode 100644 index 0000000..941190b Binary files /dev/null and b/Space Trader.mcp differ diff --git a/Src/AppHandleEvent.c b/Src/AppHandleEvent.c new file mode 100644 index 0000000..f9afe90 --- /dev/null +++ b/Src/AppHandleEvent.c @@ -0,0 +1,763 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * AppHandleEvent.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +#include "external.h" + +// ************************************************************************* +// The standard menu handling of all "Docked" forms. +// ************************************************************************* +static Boolean DockedFormDoCommand(Word command) +{ + Boolean handled = true; + FormPtr frm; + Handle AmountH; + int NewForm = -1; + UInt16 buttonPressed = 0; + Boolean inOpts; + Boolean SkipOptions1; + char label1[21], label2[21], label3[21], label4[21]; + + switch (command) + { + case MenuGameNewGame: + if (FrmAlert( NewGameAlert) == NewGameYes) + StartNewGame(); + break; + + case MenuGameSnapshot: + if (SaveGame( 1 )) + FrmAlert( GameSavedAlert ); + break; + + case MenuGameSwitchGame: + if (FrmAlert( SwitchGameAlert ) != SwitchGameYes) + break; + if (SaveGame( 2 )) + { + if (NameCommander[0] == '\0') + { + FrmAlert( SwitchToNewAlert ); + IdentifyStartup = true; + StartNewGame(); + } + else + { + FrmCustomAlert( SwitchedAlert, NameCommander, "", "" ); + FrmGotoForm( CurForm ); + } + } + break; + + case MenuGameHighScores: + ViewHighScores(); + break; + + case MenuGameClearHighScores: + ClearHighScores(); + break; + + case MenuHelpAbout: + AutoAttack = false; + AutoFlee = false; + MenuEraseStatus( 0 ); + frm = FrmInitForm( AboutForm ); + FrmDoDialog( frm ); + FrmDeleteForm( frm ); + break; + + case MenuCommandGalacticChart: + NewForm = GalacticChartForm; + break; + + case MenuCommandSystemInformation: + NewForm = SystemInformationForm; + break; + + case MenuCommandShortRangeChart: + NewForm = WarpForm; + break; + + case MenuCommandBuyCargo: + NewForm = BuyCargoForm; + break; + + case MenuCommandSellCargo: + NewForm = SellCargoForm; + break; + + case MenuCommandShipYard: + NewForm = ShipYardForm; + break; + + case MenuCommandBuyEquipment: + NewForm = BuyEquipmentForm; + break; + + case MenuCommandSellEquipment: + NewForm = SellEquipmentForm; + break; + + case MenuCommandPersonnelRoster: + NewForm = PersonnelRosterForm; + break; + + case MenuCommandCommanderStatus: + NewForm = CommanderStatusForm; + break; + + case MenuCommandBank: + NewForm = BankForm; + break; + + case MenuGameRetire: + if (FrmAlert( RetireAlert) == RetireYes) + NewForm = RetireForm; + break; + + case MenuGameShortcuts: + AutoAttack = false; + AutoFlee = false; + MenuEraseStatus( 0 ); + frm = FrmInitForm( ShortcutsForm ); + SetTriggerList(frm, ShortcutsShortcuts1List, Shortcut1); + SetTriggerList(frm, ShortcutsShortcuts2List, Shortcut2); + SetTriggerList(frm, ShortcutsShortcuts3List, Shortcut3); + SetTriggerList(frm, ShortcutsShortcuts4List, Shortcut4); + + SysStringByIndex(ShortcutTextStringList,Shortcut1, label1, 21); + SetControlLabel(frm, ShortcutsShortcut1PopTrigger, label1); + + SysStringByIndex(ShortcutTextStringList,Shortcut2, label2, 21); + SetControlLabel(frm, ShortcutsShortcut2PopTrigger, label2); + + SysStringByIndex(ShortcutTextStringList,Shortcut3, label3, 21); + SetControlLabel(frm, ShortcutsShortcut3PopTrigger, label3); + + SysStringByIndex(ShortcutTextStringList,Shortcut4, label4, 21); + SetControlLabel(frm, ShortcutsShortcut4PopTrigger, label4); + + buttonPressed = FrmDoDialog( frm ); + Shortcut1 = GetTriggerList(frm, ShortcutsShortcuts1List); + Shortcut2 = GetTriggerList(frm, ShortcutsShortcuts2List); + Shortcut3 = GetTriggerList(frm, ShortcutsShortcuts3List); + Shortcut4 = GetTriggerList(frm, ShortcutsShortcuts4List); + FrmDeleteForm( frm ); + if (CurForm == SystemInformationForm || CurForm == WarpForm || CurForm == GalacticChartForm || + CurForm == ExecuteWarpForm || CurForm == BuyCargoForm || CurForm == SellCargoForm || + CurForm == ShipYardForm || CurForm == BuyShipForm || CurForm == BuyEquipmentForm || + CurForm == SellEquipmentForm | CurForm == PersonnelRosterForm || + CurForm == CommanderStatusForm || CurForm == BankForm || CurForm == CurrentShipForm || + CurForm == QuestsForm || CurForm == SpecialCargoForm) + { + FrmGotoForm(CurForm); + } + + break; + + case MenuGameOptions: + AutoAttack = false; + AutoFlee = false; + SkipOptions1 = false; + + MenuEraseStatus( 0 ); + inOpts = true; + while (inOpts) + { + if (!SkipOptions1) + { + frm = FrmInitForm( OptionsForm ); + + SetCheckBox( frm, OptionsAutoFuelCheckbox, AutoFuel ); + SetCheckBox( frm, OptionsAutoRepairCheckbox, AutoRepair ); + SetCheckBox( frm, OptionsAlwaysIgnoreTradersCheckbox, AlwaysIgnoreTraders ); + SetCheckBox( frm, OptionsAlwaysIgnorePoliceCheckbox, AlwaysIgnorePolice ); + SetCheckBox( frm, OptionsAlwaysIgnorePiratesCheckbox, AlwaysIgnorePirates ); + SetCheckBox( frm, OptionsTradeInOrbitCheckbox, AlwaysIgnoreTradeInOrbit ); + SetCheckBox( frm, OptionsReserveMoneyCheckbox, ReserveMoney ); + SetCheckBox( frm, OptionsAlwaysInfoCheckbox, AlwaysInfo ); + SetCheckBox( frm, OptionsContinuousCheckbox, Continuous ); + SetCheckBox( frm, OptionsAttackFleeingCheckbox, AttackFleeing ); + + StrIToA( SBuf, min( 99, LeaveEmpty ) ); + AmountH = (Handle) SetField( frm, OptionsLeaveEmptyField, SBuf, 4, true ); + + buttonPressed = FrmDoDialog( frm ); + + GetField( frm, OptionsLeaveEmptyField, SBuf, AmountH ); + if (SBuf[0] == '\0') + LeaveEmpty = 0; + else + LeaveEmpty = StrAToI( SBuf ); + + AutoFuel = GetCheckBox( frm, OptionsAutoFuelCheckbox ); + AutoRepair = GetCheckBox( frm, OptionsAutoRepairCheckbox ); + AlwaysIgnoreTraders = GetCheckBox( frm, OptionsAlwaysIgnoreTradersCheckbox ); + AlwaysIgnorePolice = GetCheckBox( frm, OptionsAlwaysIgnorePoliceCheckbox ); + AlwaysIgnorePirates = GetCheckBox( frm, OptionsAlwaysIgnorePiratesCheckbox ); + AlwaysIgnoreTradeInOrbit = GetCheckBox( frm, OptionsTradeInOrbitCheckbox ); + ReserveMoney = GetCheckBox( frm, OptionsReserveMoneyCheckbox ); + AlwaysInfo = GetCheckBox( frm, OptionsAlwaysInfoCheckbox ); + Continuous = GetCheckBox( frm, OptionsContinuousCheckbox ); + AttackFleeing = GetCheckBox( frm, OptionsAttackFleeingCheckbox ); + + FrmDeleteForm( frm ); + + if (buttonPressed != OptionsOptions2Button) + { + inOpts = false; + } + + SkipOptions1 = true; + } + else + { + SkipOptions1 = false; + + frm = FrmInitForm( Options2Form ); + +#ifdef SELECTRECT + if (BELOW50) + { + FrmHideObject( frm, FrmGetObjectIndex( frm, Options2RectOnButton ) ); + FrmHideObject( frm, FrmGetObjectIndex( frm, Options2RectOffButton ) ); + } + else if (RectangularButtonsOn) + { + FrmHideObject( frm, FrmGetObjectIndex( frm, Options2RectOnButton ) ); + FrmShowObject( frm, FrmGetObjectIndex( frm, Options2RectOffButton ) ); + } + else + { + FrmHideObject( frm, FrmGetObjectIndex( frm, Options2RectOffButton ) ); + FrmShowObject( frm, FrmGetObjectIndex( frm, Options2RectOnButton ) ); + } +#endif + + SetCheckBox( frm, Options2AutoNewsPayCheckbox, NewsAutoPay ); + SetCheckBox( frm, Options2UseHWButtonsCheckbox, UseHWButtons ); + SetCheckBox( frm, Options2ShowRangeCheckbox, ShowTrackedRange ); + SetCheckBox( frm, Options2TrackAutoOffCheckbox, TrackAutoOff ); + SetCheckBox( frm, Options2TextualEncountersCheckbox, TextualEncounters ); + SetCheckBox( frm, Options2RemindLoansCheckbox, RemindLoans ); + SetCheckBox( frm, Options2SharePreferencesCheckbox, SharePreferences ); + SetCheckBox( frm, Options2IdentifyStartupCheckbox, IdentifyStartup ); + + buttonPressed = FrmDoDialog( frm ); + + NewsAutoPay = GetCheckBox( frm, Options2AutoNewsPayCheckbox ); + UseHWButtons = GetCheckBox( frm, Options2UseHWButtonsCheckbox ); + ShowTrackedRange = GetCheckBox( frm, Options2ShowRangeCheckbox ); + TrackAutoOff = GetCheckBox( frm, Options2TrackAutoOffCheckbox ); + TextualEncounters = GetCheckBox( frm, Options2TextualEncountersCheckbox ); + RemindLoans = GetCheckBox( frm, Options2RemindLoansCheckbox ); + SharePreferences = GetCheckBox( frm, Options2SharePreferencesCheckbox ); + IdentifyStartup = GetCheckBox( frm, Options2IdentifyStartupCheckbox ); + + FrmDeleteForm( frm ); + +#ifdef SELECTRECT + if (buttonPressed == Options2RectOnButton || buttonPressed == Options2RectOffButton) + { + if (buttonPressed == Options2RectOnButton) + { + if (FrmAlert( RectangularButtonsOnAlert ) == RectangularButtonsOnYes) + { + RectangularButtonsOn = true; + FrmAlert( AttemptRectangularAlert ); + } + } + else + RectangularButtonsOn = false; + SkipOptions1 = true; + } + else +#endif + if (buttonPressed != Options2Options1Button) + { + inOpts = false; + } + } + } + break; + + case MenuHelpHowToPlay: + FrmHelp( HowToPlayString ); + break; + + case MenuHelpTrading: + FrmHelp( TradingString ); + break; + + case MenuHelpTraveling: + FrmHelp( TravellingString ); + break; + + case MenuHelpShipEquipment: + FrmHelp( ShipEquipmentString ); + break; + + case MenuHelpSkills: + FrmHelp( SkillsString ); + break; + + case MenuHelpAcknowledgements: + FrmHelp( AcknowledgementsString ); + break; + + case MenuHelpFirstSteps: + FrmHelp( FirstStepsString ); + break; + + case MenuHelpHelpOnMenu: + FrmHelp( HelpOnMenuString ); + break; + + case MenuHelpHelpCurrentScreen: + AutoAttack = false; + AutoFlee = false; + + switch (FrmGetActiveFormID()) + { + case BuyCargoForm: + FrmHelp( BuyCargoString ); + break; + + case SellCargoForm: + FrmHelp( SellCargoString ); + break; + + case ShipYardForm: + FrmHelp( ShipYardString ); + break; + + case BuyShipForm: + FrmHelp( BuyShipString ); + break; + + case ShiptypeInfoForm: + FrmHelp( ShiptypeInfoString ); + break; + + case BuyEquipmentForm: + FrmHelp( BuyEquipmentString ); + break; + + case SellEquipmentForm: + FrmHelp( SellEquipmentString ); + break; + + case PersonnelRosterForm: + FrmHelp( PersonnelRosterString ); + break; + + case SystemInformationForm: + FrmHelp( SystemInformationString ); + break; + + case GalacticChartForm: + FrmHelp( GalacticChartString ); + break; + + case WarpForm: + FrmHelp( WarpString ); + break; + + case ExecuteWarpForm: + FrmHelp( ExecuteWarpString ); + break; + + case CommanderStatusForm: + FrmHelp( CommanderStatusString ); + break; + + case AveragePricesForm: + FrmHelp( AveragePricesString ); + break; + + case BankForm: + FrmHelp( BankString ); + break; + + case CurrentShipForm: + FrmHelp( CurrentShipString ); + break; + + case QuestsForm: + FrmHelp( QuestsString ); + break; + + case PlunderForm: + FrmHelp( PlunderString ); + break; + + case EncounterForm: + FrmHelp( EncounterString ); + break; + + case MainForm: + FrmHelp( HowToPlayString ); + break; + + case NewCommanderForm: + FrmHelp( NewCommanderString ); + break; + + case RetireForm: + case UtopiaForm: + case DestroyedForm: + FrmHelp( RetireDestroyedUtopiaString ); + break; + + default: + FrmHelp( MainString ); + break; + } + break; + + default: + handled = false; + break; + } + + if (NewForm >= 0) + { + CurForm = NewForm; + FrmGotoForm( CurForm ); + } + + return handled; +} + + +// ************************************************************************* +// This routine loads form resources and set the event handler for the form loaded. +// ************************************************************************* +Boolean AppHandleEvent( EventPtr eventP) +{ + Word formId; + FormPtr frmP; + int i, Dock; + FormEventHandlerType* Set; + + Set = 0L; + Dock = -1; + + if (eventP->eType == frmLoadEvent) + { + // Load the form resource. + formId = eventP->data.frmLoad.formID; + frmP = FrmInitForm(formId); + FrmSetActiveForm(frmP); + + // Set the event handler for the form. The handler of the currently + // active form is called by FrmHandleEvent each time is receives an + // event. + switch (formId) + { + case MainForm: + Set = MainFormHandleEvent; + break; + + case NewCommanderForm: + Set = NewCommanderFormHandleEvent; + break; + + case SpecialCargoForm: + Set = SpecialCargoFormHandleEvent; + break; + + case SystemInformationForm: + Set = SystemInformationFormHandleEvent; + break; + + case GalacticChartForm: + Set = GalacticChartFormHandleEvent; + break; + + case WarpForm: + Set = WarpFormHandleEvent; + break; + + case ExecuteWarpForm: + Set = ExecuteWarpFormHandleEvent; + break; + + case AveragePricesForm: + Set = AveragePricesFormHandleEvent; + break; + + case BuyCargoForm: + Set = BuyCargoFormHandleEvent; + break; + + case SellCargoForm: + Set = SellCargoFormHandleEvent; + break; + + case DumpCargoForm: + Set = DiscardCargoFormHandleEvent; + break; + + case ShipYardForm: + Set = ShipYardFormHandleEvent; + break; + + case BuyShipForm: + Set = BuyShipFormHandleEvent; + break; + + case ShiptypeInfoForm: + Set = ShiptypeInfoFormHandleEvent; + break; + + case BuyEquipmentForm: + Set = BuyEquipmentFormHandleEvent; + break; + + case SellEquipmentForm: + Set = SellEquipmentFormHandleEvent; + break; + + case PersonnelRosterForm: + Set = PersonnelRosterFormHandleEvent; + break; + + case SpecialEventForm: + Set = SpecialEventFormHandleEvent; + break; + + case CommanderStatusForm: + Set = CommanderStatusFormHandleEvent; + break; + + case BankForm: + Set = BankFormHandleEvent; + break; + + case EncounterForm: + Set = EncounterFormHandleEvent; + break; + + case PlunderForm: + Set = PlunderFormHandleEvent; + break; + + case CurrentShipForm: + Set = CurrentShipFormHandleEvent; + break; + + case QuestsForm: + Set = QuestsFormHandleEvent; + break; + + case RetireForm: + Set = RetireFormHandleEvent; + break; + + case UtopiaForm: + Set = UtopiaFormHandleEvent; + break; + + case DestroyedForm: + Set = DestroyedFormHandleEvent; + break; + + case NewspaperForm: + Set = NewspaperFormHandleEvent; + break; + + default: + break; + + } + + if (Set != 0L) + FrmSetEventHandler( frmP, Set ); + + return true; + } + else if (eventP->eType == menuEvent) + { + return DockedFormDoCommand( eventP->data.menu.itemID ); + } + else if (eventP->eType == ctlSelectEvent) + { + if (eventP->data.ctlSelect.controlID >= CurForm+49 && + eventP->data.ctlSelect.controlID <= CurForm+53) + { + i = eventP->data.ctlSelect.controlID - CurForm - 49; + + switch (i) + { + case 0: + return true; + + case 1: + Dock = ShortcutTarget[Shortcut1]; + break; + + case 2: + Dock = ShortcutTarget[Shortcut2]; + break; + + case 3: + Dock = ShortcutTarget[Shortcut3]; + break; + + case 4: + Dock = ShortcutTarget[Shortcut4]; + break; + } + + if (Dock >= 0) + return DockedFormDoCommand( Dock ); + + return false; + } + } + else if (eventP->eType == keyDownEvent && + !((eventP->data.keyDown.chr == chrPageUp) || + (eventP->data.keyDown.chr == chrPageDown))) + { + + // trap accidental hw button presses + if ( (eventP->data.keyDown.chr == hard1Chr || + eventP->data.keyDown.chr == hard2Chr || + eventP->data.keyDown.chr == hard3Chr || + eventP->data.keyDown.chr == hard4Chr) && + CurForm != EncounterForm && CurForm != SystemInformationForm && + CurForm != WarpForm && CurForm != GalacticChartForm && CurForm != ExecuteWarpForm && + CurForm != BuyCargoForm && CurForm != SellCargoForm && CurForm != ShipYardForm && + CurForm != BuyShipForm && CurForm != BuyEquipmentForm && CurForm != SellEquipmentForm && + CurForm != PersonnelRosterForm && CurForm != CommanderStatusForm && + CurForm != BankForm && CurForm != CurrentShipForm && CurForm != QuestsForm && + CurForm != SpecialCargoForm) + return true; + + + if (CurForm != EncounterForm && CurForm != MainForm && CurForm != NewCommanderForm && + CurForm != PlunderForm && CurForm != DestroyedForm && CurForm != RetireForm && + CurForm != UtopiaForm && CurForm != SpecialEventForm) + { + + switch (TOLOWER( eventP->data.keyDown.chr )) + { + + // Address HW Button maps to Buy Cargo + case hard1Chr: + Dock = ShortcutTarget[Shortcut1]; + break; + + // Phone HW Button maps to Sell Cargo + case hard2Chr: + Dock = ShortcutTarget[Shortcut2]; + break; + + // To-do HW Button maps to Ship Yard + case hard3Chr: + Dock = ShortcutTarget[Shortcut3]; + break; + + // Memo HW Button maps to Short Range Chart + case hard4Chr: + Dock = ShortcutTarget[Shortcut4]; + break; + + case 'b': + Dock = MenuCommandBuyCargo; + break; + + case 's': + Dock = MenuCommandSellCargo; + break; + + case 'y': + Dock = MenuCommandShipYard; + break; + + case 'e': + Dock = MenuCommandBuyEquipment; + break; + + case 'q': + Dock = MenuCommandSellEquipment; + break; + + case 'p': + Dock = MenuCommandPersonnelRoster; + break; + + case 'k': + Dock = MenuCommandBank; + break; + + case 'i': + Dock = MenuCommandSystemInformation; + break; + + case 'c': + Dock = MenuCommandCommanderStatus; + break; + + case 'g': + Dock = MenuCommandGalacticChart; + break; + + case 'w': + Dock = MenuCommandShortRangeChart; + break; + } + } + + if (CurForm != NewCommanderForm) + { + switch (TOLOWER( eventP->data.keyDown.chr )) + { + case 'h': + Dock = MenuHelpHelpCurrentScreen; + break; + + case 'o': + Dock = MenuGameOptions; + break; + + } + } + + if (Dock >= 0) + return DockedFormDoCommand( Dock ); + } + + return false; +} diff --git a/Src/BW.h b/Src/BW.h new file mode 100644 index 0000000..4ea0cb1 --- /dev/null +++ b/Src/BW.h @@ -0,0 +1 @@ +#define BPP1 1 \ No newline at end of file diff --git a/Src/Bank.c b/Src/Bank.c new file mode 100644 index 0000000..66b33d7 --- /dev/null +++ b/Src/Bank.c @@ -0,0 +1,251 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Bank.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +#include "external.h" + +// ************************************************************************* +// Maximum loan +// ************************************************************************* +static long MaxLoan( void ) +{ + return (PoliceRecordScore >= CLEANSCORE ? + min( 25000L, max( 1000L, ((CurrentWorth() / 10L) / 500L) * 500L ) ) : 500L); +} + + +// ************************************************************************* +// Lending money +// ************************************************************************* +static void GetLoan( long Loan ) +{ + long Amount; + + Amount = min( MaxLoan() - Debt, Loan ); + Credits += Amount; + Debt += Amount; +} + + +// ************************************************************************* +// Paying back +// ************************************************************************* +static void PayBack( long Cash ) +{ + long Amount; + + Amount = min( Debt, Cash ); + Amount = min( Amount, Credits ); + Credits -= Amount; + Debt -= Amount; +} + +// ************************************************************************* +// Show the Bank screen +// ************************************************************************* +static void ShowBank( void ) + { + FormPtr frmP; + + frmP = FrmGetActiveForm(); + + RectangularShortcuts( frmP, BankBButton ); + + if (Debt <= 0) + FrmHideObject( frmP, FrmGetObjectIndex( frmP, BankPayBackButton ) ); + else + FrmShowObject( frmP, FrmGetObjectIndex( frmP, BankPayBackButton ) ); + + if (Insurance) + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, BankBuyInsuranceButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, BankStopInsuranceButton ) ); + } + else + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, BankBuyInsuranceButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, BankStopInsuranceButton ) ); + } + + FrmDrawForm( frmP ); + + EraseRectangle( 80, 32, 80, 26 ); + + StrIToA( SBuf, Debt ); + StrCat( SBuf, " cr." ); + DrawChars( SBuf, 80, 32 ); + + StrIToA( SBuf, MaxLoan() ); + StrCat( SBuf, " cr." ); + DrawChars( SBuf, 80, 46 ); + + EraseRectangle( 80, 100, 80, 40 ); + + StrIToA( SBuf, CurrentShipPriceWithoutCargo( true ) ); + StrCat( SBuf, " cr. " ); + DrawChars( SBuf, 80, 100 ); + + StrIToA( SBuf, min( NoClaim, 90 ) ); + StrCat( SBuf, "%" ); + if (NoClaim == 90) + StrCat( SBuf, " (maximum)" ); + DrawChars( SBuf, 80, 114 ); + + StrIToA( SBuf, InsuranceMoney() ); + StrCat( SBuf, " cr. daily" ); + DrawChars( SBuf, 80, 128 ); + + DisplayTradeCredits(); + } + +// ************************************************************************* +// Handling of events on the Bank screen +// ************************************************************************* +Boolean BankFormHandleEvent(EventPtr eventP) +{ + Boolean handled = false; + FormPtr frmP; + int d; + long Amount; + Handle AmountH; + + switch (eventP->eType) + { + case frmOpenEvent: + case frmUpdateEvent: + ShowBank(); + handled = true; + break; + + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID == BankGetLoanButton) + { + if (Debt >= MaxLoan()) + { + FrmAlert( DebtTooHighAlert ); + handled = true; + break; + } + + frmP = FrmInitForm( GetLoanForm ); + + AmountH = (Handle) SetField( frmP, GetLoanGetLoanField, "", 6, true ); + + StrCopy( SBuf, "You can borrow up to " ); + StrIToA( SBuf2, (MaxLoan() - Debt) ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " credits." ); + setLabelText( frmP, GetLoanMaxLoanLabel, SBuf ); + + d = FrmDoDialog( frmP ); + + GetField( frmP, GetLoanGetLoanField, SBuf, AmountH ); + if (SBuf[0] == '\0') + Amount = 0; + else + Amount = StrAToI( SBuf ); + + FrmDeleteForm( frmP ); + + if (d == GetLoanEverythingButton) + GetLoan( MaxLoan() ); + else if (d != GetLoanNothingButton) + GetLoan( Amount ); + } + else if (eventP->data.ctlSelect.controlID == BankPayBackButton) + { + if (Debt <= 0) + { + FrmAlert( NoDebtAlert ); + handled = true; + break; + } + + frmP = FrmInitForm( PayBackForm ); + + AmountH = (Handle) SetField( frmP, PayBackPayBackField, "", 6, true ); + + StrCopy( SBuf, "You have a debt of " ); + StrIToA( SBuf2, Debt ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " credits." ); + setLabelText( frmP, PayBackMaxDebtLabel, SBuf ); + + d = FrmDoDialog( frmP ); + + GetField( frmP, PayBackPayBackField, SBuf, AmountH ); + if (SBuf[0] == '\0') + Amount = 0; + else + Amount = StrAToI( SBuf ); + + FrmDeleteForm( frmP ); + + if (d == PayBackEverythingButton) + PayBack( 99999 ); + else if (d != PayBackNothingButton) + PayBack( Amount ); + } + else if (eventP->data.ctlSelect.controlID == BankBuyInsuranceButton) + { + if (!EscapePod) + { + FrmAlert( NoEscapePodAlert ); + handled = true; + break; + } + + Insurance = true; + } + else if (eventP->data.ctlSelect.controlID == BankStopInsuranceButton) + { + if (FrmAlert( StopInsuranceAlert ) == StopInsuranceNo) + { + handled = true; + break; + } + + Insurance = false; + NoClaim = 0; + } + ShowBank(); + handled = true; + break; + + default: + break; + } + + return handled; +} + diff --git a/Src/BuyEquipEvent.c b/Src/BuyEquipEvent.c new file mode 100644 index 0000000..020c20d --- /dev/null +++ b/Src/BuyEquipEvent.c @@ -0,0 +1,165 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * BuyEquipEvent.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +#include "external.h" + +// ************************************************************************* +// Draw an item on the screen +// ************************************************************************* +static void DrawItem( char* Name, int y, long Price ) +{ + int j; + + FntSetFont( stdFont ); + DrawChars( Name, 30, y ); + + EraseRectangle( 110, y, 56, 9 ); + StrIToA( SBuf, Price ); + StrCat( SBuf, " cr." ); + + j = MAXDIGITS - StrLen( SBuf ); + if (Price > 0) + DrawChars( SBuf, 124+j*5, y ); + else + DrawChars( "not sold", 122, y ); +} + +static void DrawBuyEquipmentForm() +{ + FormPtr frmP = FrmGetActiveForm(); + int i; + RectangularShortcuts( frmP, BuyEquipmentBButton ); + + for (i=0; ieType) + { + case frmOpenEvent: + case frmUpdateEvent: + DrawBuyEquipmentForm(); + handled = true; + break; + + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID >= BuyEquipmentBuy0Button && + eventP->data.ctlSelect.controlID < BuyEquipmentBuy0Button+MAXWEAPONTYPE) + { + BuyItem( Shiptype[Ship.Type].WeaponSlots, + Ship.Weapon, + BASEWEAPONPRICE( eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button ), + Weapontype[eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button].Name, + eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button ); + } + + if (eventP->data.ctlSelect.controlID >= BuyEquipmentBuy0Button+MAXWEAPONTYPE && + eventP->data.ctlSelect.controlID < BuyEquipmentBuy0Button+MAXWEAPONTYPE+MAXSHIELDTYPE) + { + BuyItem( Shiptype[Ship.Type].ShieldSlots, + Ship.Shield, + BASESHIELDPRICE( eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button - MAXWEAPONTYPE ), + Shieldtype[eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button - MAXWEAPONTYPE].Name, + eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button - MAXWEAPONTYPE ); + } + + if (eventP->data.ctlSelect.controlID >= BuyEquipmentBuy0Button+MAXWEAPONTYPE+MAXSHIELDTYPE && + eventP->data.ctlSelect.controlID < BuyEquipmentBuy0Button+MAXWEAPONTYPE+MAXSHIELDTYPE+MAXGADGETTYPE ) + { + if (HasGadget( &Ship, eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button - MAXWEAPONTYPE - MAXSHIELDTYPE ) && + EXTRABAYS != eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button - MAXWEAPONTYPE - MAXSHIELDTYPE) + FrmAlert( NoMoreOfItemAlert ); + else + { + BuyItem( Shiptype[Ship.Type].GadgetSlots, + Ship.Gadget, + BASEGADGETPRICE( eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button - MAXWEAPONTYPE - MAXSHIELDTYPE ), + Gadgettype[eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button - MAXWEAPONTYPE - MAXSHIELDTYPE].Name, + eventP->data.ctlSelect.controlID - BuyEquipmentBuy0Button - MAXWEAPONTYPE - MAXSHIELDTYPE ); + } + } + + handled = true; + break; + + default: + break; + } + + return handled; +} diff --git a/Src/BuyShipEvent.c b/Src/BuyShipEvent.c new file mode 100644 index 0000000..1e6eeb6 --- /dev/null +++ b/Src/BuyShipEvent.c @@ -0,0 +1,384 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * BuyShipEvent.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +#include "external.h" + +// ************************************************************************* +// Create a new ship. +// ************************************************************************* +static void CreateShip( int Index ) +{ + int i; + + Ship.Type = Index; + + for (i=0; i 0 && !TribbleMessage) + { + FrmAlert( ShipNotWorthMuchAlert ); + TribbleMessage = true; + } +} + +// ************************************************************************* +// Handling of the events of the Buy Ship form. +// ************************************************************************* +Boolean BuyShipFormHandleEvent( EventPtr eventP ) +{ + Boolean handled = false; + Boolean addLightning, addCompactor, addMorganLaser; + Boolean hasLightning, hasCompactor, hasMorganLaser; + long extra; + int d, i, j; + + switch (eventP->eType) + { + case frmOpenEvent: + case frmUpdateEvent: + DrawBuyShipForm(); + handled = true; + break; + + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID >= BuyShipInfo0Button && + eventP->data.ctlSelect.controlID <= BuyShipInfo9Button) + { + SelectedShipType = eventP->data.ctlSelect.controlID - BuyShipInfo0Button; + CurForm = ShiptypeInfoForm; + FrmGotoForm( CurForm ); + } + else if (eventP->data.ctlSelect.controlID >= BuyShipBuy0Button && + eventP->data.ctlSelect.controlID <= BuyShipBuy9Button) + { + j = 0; + for (i=0; i= 0) + ++j; + if (ShipPrice[eventP->data.ctlSelect.controlID - BuyShipBuy0Button] == 0) + FrmAlert( ShipNotAvailableAlert ); + else if ((ShipPrice[eventP->data.ctlSelect.controlID - BuyShipBuy0Button] > 0) && + (Debt > 0)) + FrmAlert( YoureInDebtAlert ); + else if (ShipPrice[eventP->data.ctlSelect.controlID - BuyShipBuy0Button] > ToSpend()) + FrmAlert( CantBuyShipAlert ); + else if ((JarekStatus == 1) && (Shiptype[eventP->data.ctlSelect.controlID - + BuyShipBuy0Button].CrewQuarters < 2)) + FrmCustomAlert( PassengerNeedsQuartersAlert, "Ambassador Jarek", NULL, NULL ); + else if ((WildStatus == 1) && (Shiptype[eventP->data.ctlSelect.controlID - + BuyShipBuy0Button].CrewQuarters < 2)) + FrmCustomAlert( PassengerNeedsQuartersAlert, "Jonathan Wild", NULL, NULL ); + else if (ReactorStatus > 0 && ReactorStatus < 21) + FrmAlert ( CantSellShipWithReactorAlert ); + else + { + + extra = 0; + hasLightning = false; + hasCompactor = false; + hasMorganLaser = false; + addLightning = false; + addCompactor = false; + addMorganLaser = false; + + if (HasShield( &Ship, LIGHTNINGSHIELD )) + { + + if (Shiptype[eventP->data.ctlSelect.controlID - BuyShipBuy0Button].ShieldSlots == 0) + { + // can't transfer the Lightning Shields. How often would this happen? + FrmCustomAlert(CantTransferSlotAlert, Shiptype[eventP->data.ctlSelect.controlID - + BuyShipBuy0Button].Name, "Lightning Shield", "Shield"); + } + hasLightning = true; + extra += 30000; + } + + if (HasGadget( &Ship, FUELCOMPACTOR )) + { + if (Shiptype[eventP->data.ctlSelect.controlID - BuyShipBuy0Button].GadgetSlots == 0) + { + // can't transfer the Fuel Compactor + FrmCustomAlert(CantTransferSlotAlert, Shiptype[eventP->data.ctlSelect.controlID - + BuyShipBuy0Button].Name, "Fuel Compactor", "Gadget"); + } + hasCompactor = true; + extra += 20000; + } + + if (HasWeapon( &Ship, MORGANLASERWEAPON, true )) + { + if (Shiptype[eventP->data.ctlSelect.controlID - BuyShipBuy0Button].WeaponSlots == 0) + { + // can't transfer the Laser + FrmCustomAlert(CantTransferSlotAlert, Shiptype[eventP->data.ctlSelect.controlID - + BuyShipBuy0Button].Name, "Morgan's Laser", "Weapon"); + } + extra += 33333; + hasMorganLaser = true; + } + + if (ShipPrice[eventP->data.ctlSelect.controlID - BuyShipBuy0Button] + extra > ToSpend()) + FrmCustomAlert( CantBuyShipWithEquipmentAlert, SBuf, NULL, NULL ); + + extra = 0; + + if (hasLightning && Shiptype[eventP->data.ctlSelect.controlID - BuyShipBuy0Button].ShieldSlots > 0) + { + if (ShipPrice[eventP->data.ctlSelect.controlID - BuyShipBuy0Button] + extra <= ToSpend()) + { + d = FrmAlert( TransferLightningShieldAlert ); + if (d == 0) + { + addLightning = true; + extra += 30000; + } + } + else + { + FrmCustomAlert ( CantTransferAlert, "Lightning Shield", NULL, NULL ); + } + } + + if (hasCompactor && Shiptype[eventP->data.ctlSelect.controlID - BuyShipBuy0Button].GadgetSlots > 0) + { + if (ShipPrice[eventP->data.ctlSelect.controlID - BuyShipBuy0Button] + extra <= ToSpend()) + { + d = FrmAlert( TransferFuelCompactorAlert ); + if (d == 0) + { + addCompactor = true; + extra += 20000; + } + } + else + { + FrmCustomAlert( CantTransferAlert, "Fuel Compactor", NULL, NULL); + } + } + + if (hasMorganLaser && Shiptype[eventP->data.ctlSelect.controlID - BuyShipBuy0Button].WeaponSlots > 0) + { + if (ShipPrice[eventP->data.ctlSelect.controlID - BuyShipBuy0Button] + extra <= ToSpend()) + { + d = FrmAlert( TransferMorganLaserAlert ); + if (d == 0) + { + addMorganLaser = true; + extra += 33333; + } + } + else + { + FrmCustomAlert( CantTransferAlert, "Morgan's Laser", NULL, NULL); + } + } + + + /* + if (ShipPrice[eventP->data.ctlSelect.controlID - BuyShipBuy0Button] + extra > ToSpend()) + FrmCustomAlert( CantBuyShipWithEquipmentAlert, SBuf, NULL, NULL ); + + */ + if (j > Shiptype[eventP->data.ctlSelect.controlID - + BuyShipBuy0Button].CrewQuarters) + FrmAlert( TooManyCrewmembersAlert ); + else + { + /* + frmP = FrmInitForm( TradeInShipForm ); + StrCopy( SBuf, Shiptype[Ship.Type].Name ); + StrCat( SBuf, " for a new " ); + StrCat( SBuf, Shiptype[eventP->data.ctlSelect.controlID - + BuyShipBuy0Button].Name ); + StrCat( SBuf, "?" ); + setLabelText( frmP, TradeInShipTradeInShipLabel, SBuf ); + + d = FrmDoDialog( frmP ); + + FrmDeleteForm( frmP ); + */ + if (addCompactor || addLightning || addMorganLaser) + { + StrCopy(SBuf, ", and transfer your unique equipment to the new ship?"); + } + else + { + StrCopy(SBuf, "?"); + } + + d = FrmCustomAlert( TradeShipAlert, Shiptype[Ship.Type].Name, + Shiptype[eventP->data.ctlSelect.controlID - BuyShipBuy0Button].Name, + SBuf); + + + if (d == TradeShipYes) + { + BuyShip( eventP->data.ctlSelect.controlID - BuyShipBuy0Button ); + Credits -= extra; + if (addCompactor) + Ship.Gadget[0] = FUELCOMPACTOR; + if (addLightning) + Ship.Shield[0] = LIGHTNINGSHIELD; + if (addMorganLaser) + Ship.Weapon[0] = MORGANLASERWEAPON; + Ship.Tribbles = 0; + CurForm = BuyShipForm; + FrmGotoForm( CurForm ); + } + } + } + } + handled = true; + break; + + default: + break; + } + + return handled; +} + diff --git a/Src/Cargo.c b/Src/Cargo.c new file mode 100644 index 0000000..689f7b1 --- /dev/null +++ b/Src/Cargo.c @@ -0,0 +1,1286 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Cargo.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// Cargo.c - Functions in this module include: +// +// int GetAmountToBuy( int Index ) +// +// void DisplayTradeQuantity( int Line, int Qty, int FirstQtyButton ) +// Boolean PlunderFormHandleEvent( EventPtr eventP ) +// Boolean BuyCargoFormHandleEvent(EventPtr eventP) +// Boolean SellCargoFormHandleEvent( EventPtr eventP ) +// void PlunderCargo( int Index, int Amount ) +// int GetAmountToPlunder( int Index ) +// void BuyCargo( int Index, int Amount, Boolean DisplayInfo ) +// void SellCargo( int Index, int Amount, Byte Operation ) +// int GetAmountToSell( int Index ) +// void DisplayTradeItemName( int i, Byte Operation ) +// int TotalCargoBays( void ) +// int FilledCargoBays( void ) +// void DisplayPlunderCargoBays( void ) +// void BuyItem( char Slots, int* Item, long Price, char* Name, int ItemIndex ) +// long BasePrice( char ItemTechLevel, long Price ) +// long BaseSellPrice( int Index, long Price ) +// void DrawSellEquipment( void ) +// void SBufBays( void ) +// void DisplayTradeCargoBays( void ) +// void DisplayTradeCredits( void ) +// +// Static Local Functions +// ---------------------- +// int GetAmountToSell( int Index ) +// +// ------------------------------------------------------------------------- +// Modifications: +// mm/dd/yy - description - author +// ------------------------------------------------------------------------- +// 06/30/01 - Debt is checked in BuyCargo - SRA +// ************************************************************************* + +#include "external.h" + +static char QtyBuf[MAXTRADEITEM][4]; // This variable cannot be moved without + // Doing dynamic memory allocation to a + // "char*** QtyBuf" through a loop that + // allocates memory for each row. SRA 04/18/01 + +// ************************************************************************* +// Let the commander indicate how many he wants to sell or dump +// Operation is SELLCARGO or DUMPCARGO +// ************************************************************************* +static int GetAmountToSell( int Index, Byte Operation ) +{ + FormPtr frm; + int d, Amount; + Handle AmountH; + + frm = FrmInitForm( AmountToSellForm ); + + AmountH = (Handle) SetField( frm, AmountToSellToSellField, "", 4, true ); + + if (Operation == SELLCARGO) + { + StrCopy( SBuf, "Sell " ); + } + else + { + StrCopy( SBuf, "Discard " ); + } + StrCat( SBuf, Tradeitem[Index].Name ); + setFormTitle( AmountToSellForm, SBuf ); + + if (Operation == SELLCARGO) + { + StrCopy( SBuf, "You can sell up to " ); + StrIToA( SBuf2, Ship.Cargo[Index] ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " at " ); + StrIToA( SBuf2, SellPrice[Index] ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " cr. each." ); + } + else if (Operation == DUMPCARGO) + { + StrCopy( SBuf, "You can dump up to " ); + StrIToA( SBuf2, min(Ship.Cargo[Index], ToSpend()/ (5 * (Difficulty + 1))) ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, "." ); + } + else + { + StrCopy( SBuf, "You can jettison up to " ); + StrIToA( SBuf2, Ship.Cargo[Index]); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, "." ); + } + setLabelText( frm, AmountToSellMaxToSellLabel, SBuf ); + + StrCopy( SBuf, "You paid about " ); + StrIToA( SBuf2, BuyingPrice[Index] / Ship.Cargo[Index] ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " cr. per unit." ); + setLabelText( frm, AmountToSellAveragePriceLabel, SBuf ); + + if (Operation == SELLCARGO) + { + if (BuyingPrice[Index] / Ship.Cargo[Index] > SellPrice[Index]) + { + StrCopy( SBuf, "Your loss per unit is " ); + StrIToA( SBuf2, (BuyingPrice[Index] / Ship.Cargo[Index]) - SellPrice[Index] ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " cr." ); + setLabelText( frm, AmountToSellAverageProfitLabel, SBuf ); + } + else if (BuyingPrice[Index] / Ship.Cargo[Index] < SellPrice[Index]) + { + StrCopy( SBuf, "Your profit per unit is " ); + StrIToA( SBuf2, SellPrice[Index] - (BuyingPrice[Index] / Ship.Cargo[Index]) ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " cr." ); + setLabelText( frm, AmountToSellAverageProfitLabel, SBuf ); + } + else + { + StrCopy( SBuf, "You won't make a profit." ); + setLabelText( frm, AmountToSellAverageProfitLabel, SBuf ); + } + setLabelText( frm, AmountToSellHowManyLabel, "How many do you want to sell?" ); + } + else if (Operation == DUMPCARGO) + { + StrCopy (SBuf, "It costs "); + StrIToA ( SBuf2, (5 * (Difficulty + 1))); + StrCat (SBuf, SBuf2); + StrCat (SBuf, " cr. per unit for disposal."); + setLabelText( frm, AmountToSellAverageProfitLabel, SBuf ); + setLabelText( frm, AmountToSellHowManyLabel, "How many will you dump?" ); + } + else + { + setLabelText( frm, AmountToSellAverageProfitLabel, "It costs nothing to jettison cargo." ); + setLabelText( frm, AmountToSellHowManyLabel, "How many will you dump?" ); + } + + + d = FrmDoDialog( frm ); + + GetField( frm, AmountToSellToSellField, SBuf, AmountH ); + if (SBuf[0] == '\0') + Amount = 0; + else + Amount = StrAToI( SBuf ); + + FrmDeleteForm( frm ); + + if (d == AmountToSellAllButton) + return( 999 ); + else if (d == AmountToSellNoneButton) + return( 0 ); + + return( Amount ); +} + +// ************************************************************************* +// Determines if a given ship is carrying items that can be bought or sold +// in a specified system. +// ************************************************************************* +Boolean HasTradeableItems (SHIP *sh, Byte theSystem, Byte Operation) +{ + int i; + Boolean ret = false, thisRet; + for (i = 0; i< MAXTRADEITEM; i++) + { + // trade only if trader is selling and the item has a buy price on the + // local system, or trader is buying, and there is a sell price on the + // local system. + thisRet = false; + if (sh->Cargo[i] > 0 && Operation == TRADERSELL && BuyPrice[i] > 0) + thisRet = true; + else if (sh->Cargo[i] > 0 && Operation == TRADERBUY && SellPrice[i] > 0) + thisRet = true; + + // Criminals can only buy or sell illegal goods, Noncriminals cannot buy + // or sell such items. + if (PoliceRecordScore < DUBIOUSSCORE && i != FIREARMS && i != NARCOTICS) + thisRet = false; + else if (PoliceRecordScore >= DUBIOUSSCORE && (i == FIREARMS || i == NARCOTICS)) + thisRet = false; + + if (thisRet) + ret = true; + + + } + + return ret; +} + +// ************************************************************************* +// Returns the index of a trade good that is on a given ship that can be +// sold in a given system. +// ************************************************************************* +int GetRandomTradeableItem (SHIP *sh, Byte Operation) +{ + Boolean looping = true; + int i=0, j; + + while (looping && i < 10) + { + j = GetRandom(MAXTRADEITEM); + // It's not as ugly as it may look! If the ship has a particulat item, the following + // conditions must be met for it to be tradeable: + // if the trader is buying, there must be a valid sale price for that good on the local system + // if the trader is selling, there must be a valid buy price for that good on the local system + // if the player is criminal, the good must be illegal + // if the player is not criminal, the good must be legal + if ( (sh->Cargo[j] > 0 && Operation == TRADERSELL && BuyPrice[j] > 0) && + ((PoliceRecordScore < DUBIOUSSCORE && (j == FIREARMS || j == NARCOTICS)) || + (PoliceRecordScore >= DUBIOUSSCORE && j != FIREARMS && j != NARCOTICS)) ) + looping = false; + else if ( (sh->Cargo[j] > 0 && Operation == TRADERBUY && SellPrice[j] > 0) && + ((PoliceRecordScore < DUBIOUSSCORE && (j == FIREARMS || j == NARCOTICS)) || + (PoliceRecordScore >= DUBIOUSSCORE && j != FIREARMS && j != NARCOTICS)) ) + looping = false; + // alles klar? + else + { + j = -1; + i++; + } + } + // if we didn't succeed in picking randomly, we'll pick sequentially. We can do this, because + // this routine is only called if there are tradeable goods. + if (j == -1) + { + j = 0; + looping = true; + while (looping) + { + // see lengthy comment above. + if ( (((sh->Cargo[j] > 0) && (Operation == TRADERSELL) && (BuyPrice[j] > 0)) || + ((sh->Cargo[j] > 0) && (Operation == TRADERBUY) && (SellPrice[j] > 0))) && + ((PoliceRecordScore < DUBIOUSSCORE && (j == FIREARMS || j == NARCOTICS)) || + (PoliceRecordScore >= DUBIOUSSCORE && j != FIREARMS && j != NARCOTICS)) ) + + { + looping = false; + } + else + { + j++; + if (j == MAXTRADEITEM) + { + // this should never happen! + looping = false; + } + } + } + } + return j; +} + + + +// ************************************************************************* +// Let the commander indicate how many he wants to buy +// ************************************************************************* +int GetAmountToBuy( int Index ) // used in Traveler.c also +{ + FormPtr frm; + long count; + int d, Amount; + Handle AmountH; + + if (BuyPrice[Index] <= 0 || CURSYSTEM.Qty[Index] <= 0) + { + FrmAlert( ItemNotSoldAlert ); + return( 0 ); + } + + frm = FrmInitForm( AmountToBuyForm ); + + AmountH = (Handle) SetField( frm, AmountToBuyToBuyField, "", 4, true ); + + StrCopy( SBuf, "Buy " ); + StrCat( SBuf, Tradeitem[Index].Name ); + + setFormTitle( AmountToBuyForm, SBuf ); + + StrCopy( SBuf, "At " ); + StrIToA( SBuf2, BuyPrice[Index] ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " cr. each, you can afford " ); + count = min( ToSpend() / BuyPrice[Index], CURSYSTEM.Qty[Index] ); + if (count <= 0) + StrCat( SBuf, "none" ); + else if (count < 1000) + { + StrIToA( SBuf2, count ); + StrCat( SBuf, SBuf2 ); + } + else + StrCat( SBuf, "a lot" ); + StrCat( SBuf, "." ); + setLabelText( frm, AmountToBuyMaxToBuyLabel, SBuf ); + + d = FrmDoDialog( frm ); + + GetField( frm, AmountToBuyToBuyField, SBuf, AmountH ); + + if (SBuf[0] == '\0') + Amount = 0; + else + Amount = StrAToI( SBuf ); + + FrmDeleteForm( frm ); + + if (d == AmountToBuyAllButton) + return( 999 ); + else if (d == AmountToBuyNoneButton) + return( 0 ); + + return( Amount ); +} + + +// ************************************************************************* +// Display quantity on trade screen button +// Cannot be moved without moving all functions that use QtyBuf to same file +// ************************************************************************* +void DisplayTradeQuantity( int Line, int Qty, int FirstQtyButton ) +{ + int objindex; + ControlPtr cp; + FormPtr frmP; + + frmP = FrmGetActiveForm(); + objindex = FrmGetObjectIndex( frmP, FirstQtyButton + Line ); + cp = (ControlPtr)FrmGetObjectPtr( frmP, objindex ); + StrIToA(QtyBuf[Line], Qty ); + CtlSetLabel( cp, QtyBuf[Line] ); +} + +static void DrawPlunderForm() +{ + FormPtr frmP = FrmGetActiveForm(); + ControlPtr cp; + int i; + + for (i=0; ieType) + { + case frmOpenEvent: + narcs = Ship.Cargo[NARCOTICS]; + DrawPlunderForm(); + handled = true; + break; + + case frmUpdateEvent: + DrawPlunderForm(); + handled = true; + break; + + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID >= PlunderAll0Button && + eventP->data.ctlSelect.controlID <= PlunderAll9Button) + PlunderCargo( eventP->data.ctlSelect.controlID - PlunderAll0Button, 999 ); + else if (eventP->data.ctlSelect.controlID >= PlunderQty0Button && + eventP->data.ctlSelect.controlID <= PlunderQty9Button) + { + if (Opponent.Cargo[eventP->data.ctlSelect.controlID - PlunderQty0Button] <= 0) + FrmAlert( VictimHasntGotAnyAlert ); + else + { + Amount = GetAmountToPlunder( eventP->data.ctlSelect.controlID - + PlunderQty0Button ); + if (Amount > 0) + PlunderCargo( eventP->data.ctlSelect.controlID - PlunderQty0Button, Amount ); + } + } + else if (eventP->data.ctlSelect.controlID == PlunderDumpButton) + { + frmP = FrmInitForm( DumpCargoForm ); + FrmSetEventHandler( frmP, DiscardCargoFormHandleEvent ); + FrmDoDialog( frmP ); + FrmDeleteForm( frmP ); + DrawPlunderForm(); + } + else + { + if (EncounterType == MARIECELESTEENCOUNTER && Ship.Cargo[NARCOTICS] > narcs) + JustLootedMarie = true; + Travel(); + } + handled = true; + break; + + default: + break; + } + + return handled; +} + + +static void DrawBuyCargoForm() +{ + FormPtr frmP = FrmGetActiveForm(); + int i, j; + ControlPtr cp; + RectangularShortcuts( frmP, BuyCargoBButton ); + + for (i=0; i 0) + DrawChars( SBuf, 139+j*5, 17+i*13 ); + else + DrawChars( "not sold", 122, 17+i*13 ); + DisplayTradeQuantity( i, CURSYSTEM.Qty[i], BuyCargoQty0Button ); + } + DisplayTradeCargoBays(); + DisplayTradeCredits(); + +} + +// ************************************************************************* +// Handling the events of the Buy Cargo form. +// Cannot be moved without moving all functions that use QtyBuf to same file +// ************************************************************************* +Boolean BuyCargoFormHandleEvent(EventPtr eventP) +{ + Boolean handled = false; + int Amount; + + switch (eventP->eType) + { + case frmOpenEvent: + case frmUpdateEvent: + DrawBuyCargoForm(); + handled = true; + break; + + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID >= BuyCargoAll0Button && + eventP->data.ctlSelect.controlID <= BuyCargoAll9Button) + BuyCargo( eventP->data.ctlSelect.controlID - BuyCargoAll0Button, 999, true ); + else + { + Amount = GetAmountToBuy( eventP->data.ctlSelect.controlID - + BuyCargoQty0Button ); + if (Amount > 0) + BuyCargo( eventP->data.ctlSelect.controlID - BuyCargoQty0Button, Amount, true ); + } + handled = true; + break; + + default: + break; + } + + return handled; +} + +static void DrawSellCargoForm() +{ + FormPtr frmP = FrmGetActiveForm(); + int i, j; + ControlPtr cp; + RectangularShortcuts( frmP, SellCargoBButton ); + FrmSetMenu(frmP, MenuMainMenuBar); + + + for (i=0; i 0) + DrawChars( SBuf, 139+j*5, 17+i*13 ); + else + DrawChars( "no trade", 119, 17+i*13 ); + + if (SellPrice[i] > 0) + DisplayTradeQuantity( i, Ship.Cargo[i], SellCargoQty0Button ); + else + { + StrIToA( SBuf, Ship.Cargo[i] ); + DrawChars( SBuf, 11-((StrLen( SBuf )*5)>>1), 17+i*13 ); + } + } + + DisplayTradeCargoBays(); + DisplayTradeCredits(); +} + +// ************************************************************************* +// Handling the events of the Sell Cargo form. +// Cannot be moved without moving all functions that use QtyBuf to same file +// ************************************************************************* +Boolean SellCargoFormHandleEvent( EventPtr eventP ) +{ + Boolean handled = false; + int Amount; + + switch (eventP->eType) + { + case frmOpenEvent: + case frmUpdateEvent: + DrawSellCargoForm(); + handled = true; + break; + + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID >= SellCargoAll0Button && + eventP->data.ctlSelect.controlID <= SellCargoAll9Button) + { + SellCargo( eventP->data.ctlSelect.controlID - SellCargoAll0Button, 999, SELLCARGO ); + DisplayTradeItemName( eventP->data.ctlSelect.controlID - SellCargoAll0Button, SELLCARGO ); + } + else if (eventP->data.ctlSelect.controlID >= SellCargoDump0Button && + eventP->data.ctlSelect.controlID <= SellCargoDump9Button) + { + if (Ship.Cargo[eventP->data.ctlSelect.controlID - SellCargoDump0Button] <= 0) + { + FrmAlert( NothingToDumpAlert ); + return true; + } + Amount = GetAmountToSell( eventP->data.ctlSelect.controlID - + SellCargoDump0Button, DUMPCARGO ); + if (Amount > 0) + SellCargo( eventP->data.ctlSelect.controlID - SellCargoDump0Button, Amount, DUMPCARGO ); + DisplayTradeItemName( eventP->data.ctlSelect.controlID - SellCargoDump0Button, DUMPCARGO ); + } + else + { + if (Ship.Cargo[eventP->data.ctlSelect.controlID - SellCargoQty0Button] <= 0) + { + FrmAlert( NothingForSaleAlert ); + return true; + } + if (SellPrice[eventP->data.ctlSelect.controlID - SellCargoQty0Button] <= 0) + { + FrmAlert( NotInterestedAlert ); + return true; + } + Amount = GetAmountToSell( eventP->data.ctlSelect.controlID - + SellCargoQty0Button, SELLCARGO ); + if (Amount > 0) + SellCargo( eventP->data.ctlSelect.controlID - SellCargoQty0Button, Amount, SELLCARGO ); + DisplayTradeItemName( eventP->data.ctlSelect.controlID - SellCargoQty0Button, SELLCARGO ); + } + handled = true; + break; + + default: + break; + } + + return handled; +} + + +// ************************************************************************* +// Show contents of Dump cargo form. +// ************************************************************************* +void ShowDumpCargo( void ) +{ + FormPtr frmP = FrmGetActiveForm(); + int i; + ControlPtr cp; + + for (i=0; ieType) + { + case winEnterEvent: + if (DontUpdate) + DontUpdate = false; + else + { + ShowDumpCargo(); + handled = true; + } + break; + + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID >= DumpCargoAll0Button && + eventP->data.ctlSelect.controlID <= DumpCargoAll9Button) + { + if (Ship.Cargo[eventP->data.ctlSelect.controlID - DumpCargoAll0Button] <= 0) + { + FrmAlert( NothingToDumpAlert ); + DontUpdate = true; + return true; + } + StrIToA(SBuf, BuyingPrice[eventP->data.ctlSelect.controlID - DumpCargoAll0Button]); + if (FrmCustomAlert(DumpAllAlert,SBuf,NULL,NULL) == DumpAllYes) + { + SellCargo( eventP->data.ctlSelect.controlID - DumpCargoAll0Button, 999, JETTISONCARGO ); + DisplayTradeItemName( eventP->data.ctlSelect.controlID - DumpCargoAll0Button, JETTISONCARGO ); + DontUpdate = true; + } + handled = true; + } + else if (eventP->data.ctlSelect.controlID >= DumpCargoDoneButton) + { + // Nothing + } + else + { + if (Ship.Cargo[eventP->data.ctlSelect.controlID - DumpCargoQty0Button] <= 0) + { + FrmAlert( NothingToDumpAlert ); + DontUpdate = true; + return true; + } + Amount = GetAmountToSell( eventP->data.ctlSelect.controlID - + DumpCargoQty0Button, JETTISONCARGO ); + if (Amount > 0) + SellCargo( eventP->data.ctlSelect.controlID - DumpCargoQty0Button, Amount, JETTISONCARGO ); + DisplayTradeItemName( eventP->data.ctlSelect.controlID - DumpCargoQty0Button, JETTISONCARGO ); + DontUpdate = true; + handled = true; + } + break; + + default: + break; + } + return handled; +} + + +// ************************************************************************* +// Plunder amount of cargo +// ************************************************************************* +void PlunderCargo( int Index, int Amount ) +{ + int ToPlunder; + + if (Opponent.Cargo[Index] <= 0) + { + FrmAlert( VictimHasntGotAnyAlert ); + return; + } + + if (TotalCargoBays() - FilledCargoBays() <= 0) + { + FrmAlert( NoEmptyBaysAlert ); + return; + } + + ToPlunder = min( Amount, Opponent.Cargo[Index] ); + ToPlunder = min( ToPlunder, TotalCargoBays() - FilledCargoBays() ); + + Ship.Cargo[Index] += ToPlunder; + Opponent.Cargo[Index] -= ToPlunder; + + DisplayTradeQuantity( Index, Opponent.Cargo[Index], PlunderQty0Button ); + DisplayPlunderCargoBays(); +} + + +// ************************************************************************* +// Let the commander indicate how many he wants to plunder +// ************************************************************************* +int GetAmountToPlunder( int Index ) +{ + FormPtr frm; + int d, Amount; + Handle AmountH; + + frm = FrmInitForm( AmountToPlunderForm ); + + AmountH = (Handle) SetField( frm, AmountToPlunderToPlunderField, "", 4, true ); + + StrCopy( SBuf, "Steal " ); + StrCat( SBuf, Tradeitem[Index].Name ); + setFormTitle( AmountToPlunderForm, SBuf ); + + StrCopy( SBuf, "Your victim has " ); + StrIToA( SBuf2, Opponent.Cargo[Index] ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " of these goods." ); + setLabelText( frm, AmountToPlunderMaxToPlunderLabel, SBuf ); + + d = FrmDoDialog( frm ); + + GetField( frm, AmountToPlunderToPlunderField, SBuf, AmountH ); + if (SBuf[0] == '\0') + Amount = 0; + else + Amount = StrAToI( SBuf ); + + FrmDeleteForm( frm ); + + if (d == AmountToPlunderAllButton) + return( 999 ); + else if (d == AmountToPlunderNoneButton) + return( 0 ); + + return( Amount ); +} + + +// ************************************************************************* +// Buy amount of cargo +// ************************************************************************* +void BuyCargo( int Index, int Amount, Boolean DisplayInfo ) +{ + int ToBuy; + + if (Debt > DEBTTOOLARGE) + { + FrmAlert( DebtTooLargeForBuyAlert ); + return; + } + + if (CURSYSTEM.Qty[Index] <= 0 || BuyPrice[Index] <= 0) + { + FrmAlert( NothingAvailableAlert ); + return; + } + + if (TotalCargoBays() - FilledCargoBays() - LeaveEmpty <= 0) + { + FrmAlert( NoEmptyBaysAlert ); + return; + } + + if (ToSpend() < BuyPrice[Index] ) + { + FrmAlert( CantAffordAlert ); + return; + } + + ToBuy = min( Amount, CURSYSTEM.Qty[Index] ); + ToBuy = min( ToBuy, TotalCargoBays() - FilledCargoBays() - LeaveEmpty ); + ToBuy = min( ToBuy, ToSpend() / BuyPrice[Index] ); + + Ship.Cargo[Index] += ToBuy; + Credits -= ToBuy * BuyPrice[Index]; + BuyingPrice[Index] += ToBuy * BuyPrice[Index]; + CURSYSTEM.Qty[Index] -= ToBuy; + + if (DisplayInfo) + { + DisplayTradeQuantity( Index, CURSYSTEM.Qty[Index], BuyCargoQty0Button ); + DisplayTradeCargoBays(); + DisplayTradeCredits(); + } +} + + +// ************************************************************************* +// Sell or Jettison amount of cargo +// Operation is SELLCARGO, DUMPCARGO, or JETTISONCARGO +// ************************************************************************* +void SellCargo( int Index, int Amount, Byte Operation ) +{ + int ToSell; + + if (Ship.Cargo[Index] <= 0) + { + if (Operation == SELLCARGO) + FrmAlert( NothingForSaleAlert ); + else + FrmAlert( NothingToDumpAlert ); + return; + } + + if (SellPrice[Index] <= 0 && Operation == SELLCARGO) + { + FrmAlert( NotInterestedAlert ); + return; + } + + if (Operation == JETTISONCARGO) + { + if (PoliceRecordScore > DUBIOUSSCORE && !LitterWarning) + { + LitterWarning = true; + if (FrmAlert( SpaceLitteringAlert ) == SpaceLitteringNo) + return; + } + } + + ToSell = min( Amount, Ship.Cargo[Index] ); + + if (Operation == DUMPCARGO) + { + ToSell = min(ToSell, ToSpend() / 5 * (Difficulty + 1)); + } + + BuyingPrice[Index] = (BuyingPrice[Index] * (Ship.Cargo[Index] - ToSell)) / Ship.Cargo[Index]; + Ship.Cargo[Index] -= ToSell; + if (Operation == SELLCARGO) + Credits += ToSell * SellPrice[Index]; + if (Operation == DUMPCARGO) + Credits -= ToSell * 5 * (Difficulty + 1); + if (Operation == JETTISONCARGO) + { + if (GetRandom( 10 ) < Difficulty + 1) + { + if (PoliceRecordScore > DUBIOUSSCORE) + PoliceRecordScore = DUBIOUSSCORE; + else + --PoliceRecordScore; + addNewsEvent(CAUGHTLITTERING); + } + } + + if (Operation == SELLCARGO || Operation == DUMPCARGO) + { + // DisplayTradeQuantity( Index, Ship.Cargo[Index], SellCargoQty0Button ); + + if (SellPrice[Index] > 0) + DisplayTradeQuantity( Index, Ship.Cargo[Index], SellCargoQty0Button ); + else + { + StrIToA( SBuf, Ship.Cargo[Index] ); + DrawChars( SBuf, 11-((StrLen( SBuf )*5)>>1), 17+Index*13 ); + } + DisplayTradeCargoBays(); + DisplayTradeCredits(); + } + else + { + DisplayTradeQuantity( Index, Ship.Cargo[Index], DumpCargoQty0Button ); + DisplayPlunderCargoBays(); + } +} + + +// ************************************************************************* +// Display the name of a trade item on the sell cargo screen +// Operation is either SELLCARGO, DUMPCARGO, or JETTISONCARGO +// ************************************************************************* +void DisplayTradeItemName( int i, Byte Operation ) +{ + if (Ship.Cargo[i] > 0 && SellPrice[i] > BuyingPrice[i] / Ship.Cargo[i] && + Operation == SELLCARGO) + FntSetFont( boldFont ); + else + FntSetFont( stdFont ); + if (Operation == SELLCARGO) + { + EraseRectangle( 30, 17+i*13, 50, 12 ); + DrawChars( Tradeitem[i].Name, 30, 17+i*13 ); + } + else if (Operation == JETTISONCARGO) + { + DrawChars( Tradeitem[i].Name, 35, 18+i * 13); + } + else + { + //EraseRectangle( 30, 18+i*13, 56, 12 ); + DrawChars( Tradeitem[i].Name, 30, 18+i*13 ); + } + FntSetFont( stdFont ); +} + + +// ************************************************************************* +// Calculate total cargo bays +// ************************************************************************* +int TotalCargoBays( void ) +{ + int Bays; + int i; + + Bays = Shiptype[Ship.Type].CargoBays; + for (i=0; i 0 && ReactorStatus < 21) + Bays -= (5 + 10 - (ReactorStatus - 1)/2); + + return Bays; +} + + +// ************************************************************************* +// Calculate total filled cargo bays +// ************************************************************************* +int FilledCargoBays( void ) +{ + int sum, i; + + sum = 0; + for (i=0; i 0) + FrmAlert( YoureInDebtAlert ); + else if (Price > ToSpend()) + FrmAlert( CantBuyItemAlert ); + else if (FirstEmptySlot < 0) + FrmAlert( NotEnoughSlotsAlert ); + else + { + frmP = FrmInitForm( BuyItemForm ); + + StrCopy( SBuf, "Buy " ); + StrCat( SBuf, Name ); + setFormTitle( BuyItemForm, SBuf ); + + StrIToA( SBuf, Price ); + StrCat( SBuf, " credits?" ); + setLabelText( frmP, BuyItemPriceLabel, SBuf ); + + if (FrmDoDialog( frmP ) == BuyItemYesButton) + { + Item[FirstEmptySlot] = ItemIndex; + Credits -= Price; + } + + FrmDeleteForm( frmP ); + + DisplayTradeCredits(); + } +} + + +// ************************************************************************* +// Determine base price of item +// ************************************************************************* +long BasePrice( char ItemTechLevel, long Price ) +{ + return ((ItemTechLevel > CURSYSTEM.TechLevel) ? 0 : + ((Price * (100 - TraderSkill( &Ship ))) / 100)); +} + +// ************************************************************************* +// Determine selling price +// ************************************************************************* +long BaseSellPrice( int Index, long Price ) +{ + return (Index >= 0 ? ((Price * 3) / 4) : 0); +} + +// ************************************************************************* +// Drawing the Sell Equipment screen. +// ************************************************************************* +void DrawSellEquipment( void ) +{ + FormPtr frmP; + RectangleType a; + int i, j; + + frmP = FrmGetActiveForm(); + + RectangularShortcuts( frmP, SellEquipmentBButton ); + + for (i=0; i= PoliceRecord[i].MinScore) + ++i; + --i; + if (i < 0) + ++i; + setLabelText( frmP, CommanderStatusPoliceRecordLabel, PoliceRecord[i].Name ); + + i = 0; + while (i < MAXREPUTATION && ReputationScore >= Reputation[i].MinScore) + ++i; + --i; + if (i < 0) + i = 0; + setLabelText( frmP, CommanderStatusReputationLabel, Reputation[i].Name ); + + setLabelText( frmP, CommanderStatusLevelLabel, DifficultyLevel[Difficulty] ); + + StrIToA( SBuf, Days ); + StrCat( SBuf, " days" ); + setLabelText( frmP, CommanderStatusDaysLabel, SBuf ); + + StrIToA( SBuf, Credits ); + StrCat( SBuf, " cr." ); + setLabelText( frmP, CommanderStatusCreditsLabel, SBuf ); + + StrIToA( SBuf, Debt ); + StrCat( SBuf, " cr." ); + setLabelText( frmP, CommanderStatusDebtLabel, SBuf ); + + StrIToA (SBuf, CurrentWorth()); + StrCat (SBuf, " cr." ); + setLabelText(frmP, CommanderStatusNetWorthLabel, SBuf); + + #ifdef _STRA_CHEAT_ + if (CheatCounter == 3) + FrmShowObject( frmP, FrmGetObjectIndex( frmP, CommanderStatusCheatButton )); + else + FrmHideObject( frmP, FrmGetObjectIndex( frmP, CommanderStatusCheatButton )); + #endif + + FrmDrawForm( frmP ); + } + +// ************************************************************************* +// Handling of events on the Commander Status screen +// ************************************************************************* +Boolean CommanderStatusFormHandleEvent(EventPtr eventP) +{ + Boolean handled = false; + static FormPtr frm; + static int i; + static Handle AmountH[4]; + + switch (eventP->eType) + { + // Show information on current system + case frmOpenEvent: + ShowCommanderStatus(); + CheatCounter = 0; + handled = true; + break; + + case frmUpdateEvent: + ShowCommanderStatus(); + handled = true; + break; + + + case ctlSelectEvent: + + #ifdef _STRA_CHEAT_ // cheat enable defined ? + + if (eventP->data.ctlSelect.controlID == CommanderStatusCheatButton) + { + frm = FrmInitForm( CheatForm ); + + StrIToA( SBuf, Credits ); + AmountH[0] = SetField( frm, CheatCreditsField, SBuf, 9, true ); + + StrIToA( SBuf, Debt ); + AmountH[1] = SetField( frm, CheatDebtField, SBuf, 9, true ); + + StrIToA( SBuf, ReputationScore ); + AmountH[2] = SetField( frm, CheatReputationField, SBuf, 5, false ); + + StrIToA( SBuf, ABS( PoliceRecordScore ) ); + AmountH[3] = SetField( frm, CheatPoliceRecordField, SBuf, 5, false ); + + SetCheckBox( frm, CheatNegativeCheckbox, (PoliceRecordScore < 0) ); + SetCheckBox( frm, CheatMoonCheckbox, MoonBought ); + SetCheckBox( frm, CheatLightningShieldCheckbox, HasShield( &Ship, LIGHTNINGSHIELD ) ); + SetCheckBox( frm, CheatFuelCompactorCheckbox, HasGadget( &Ship, FUELCOMPACTOR ) ); + SetCheckBox( frm, CheatMorganLaserCheckbox, HasWeapon( &Ship, MORGANLASERWEAPON, true ) ); + SetCheckBox( frm, CheatSingularityCheckbox, CanSuperWarp ); + + FrmDoDialog( frm ); + + GetField( frm, CheatCreditsField, SBuf, AmountH[0] ); + if (SBuf[0] != '\0') + Credits = StrAToI( SBuf ); + + GetField(frm, CheatDebtField, SBuf, AmountH[1]); + if (SBuf[0] != '\0') + Debt = StrAToI(SBuf); + + GetField( frm, CheatReputationField, SBuf, AmountH[2] ); + if (SBuf[0] != '\0') + ReputationScore = StrAToI( SBuf ); + + GetField( frm, CheatPoliceRecordField, SBuf, AmountH[3] ); + if (SBuf[0] != '\0') + PoliceRecordScore = StrAToI( SBuf ); + + if (GetCheckBox( frm, CheatNegativeCheckbox )) + PoliceRecordScore = -PoliceRecordScore; + + MoonBought = GetCheckBox( frm, CheatMoonCheckbox ); + + if (GetCheckBox( frm, CheatLightningShieldCheckbox ) && !HasShield( &Ship, LIGHTNINGSHIELD ) && + Shiptype[Ship.Type].ShieldSlots > 0) + Ship.Shield[0] = LIGHTNINGSHIELD; + else if (!GetCheckBox( frm, CheatLightningShieldCheckbox ) && HasShield( &Ship, LIGHTNINGSHIELD )) + { + for (i=0; i 0) + Ship.Gadget[0] = FUELCOMPACTOR; + else if (!GetCheckBox( frm, CheatFuelCompactorCheckbox ) && HasGadget( &Ship, FUELCOMPACTOR )) + { + for (i=0; i 0) + Ship.Weapon[0] = MORGANLASERWEAPON; + else if (!GetCheckBox( frm, CheatMorganLaserCheckbox ) && HasWeapon( &Ship, MORGANLASERWEAPON, true )) + { + for (i=0; idata.ctlSelect.controlID == CommanderStatusQuestsButton) + { + CurForm = QuestsForm; + } + else if (eventP->data.ctlSelect.controlID == CommanderStatusSpecialButton) + { + CurForm = SpecialCargoForm; + } + else + { + CurForm = CurrentShipForm; + } + FrmGotoForm( CurForm ); + handled = true; + break; + + default: + break; + } + + return handled; +} + diff --git a/Src/Color.h b/Src/Color.h new file mode 100644 index 0000000..438a2dd --- /dev/null +++ b/Src/Color.h @@ -0,0 +1 @@ +#define BPP8 1 \ No newline at end of file diff --git a/Src/DataTypes.h b/Src/DataTypes.h new file mode 100644 index 0000000..adeb7c1 --- /dev/null +++ b/Src/DataTypes.h @@ -0,0 +1,267 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Datatypes.h + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// Data Types Defined for Space Trader + +#ifndef __SPACETRADER_INC__ + #include "spacetrader.h" // we need our maximums defined before here +#endif + +typedef struct { + Byte Type; + int Cargo[MAXTRADEITEM]; + int Weapon[MAXWEAPON]; + int Shield[MAXSHIELD]; + long ShieldStrength[MAXSHIELD]; + int Gadget[MAXGADGET]; + int Crew[MAXCREW]; + Byte Fuel; + long Hull; + long Tribbles; + long ForFutureUse[4]; +} SHIP; + + +typedef struct { + char* Name; + long Price; + Byte TechLevel; + Byte Chance; // Chance that this is fitted in a slot +} GADGET; + + +typedef struct { + char* Name; + long Power; + long Price; + Byte TechLevel; + Byte Chance; // Chance that this is fitted in a slot +} WEAPON; + + +typedef struct { + char* Name; + long Power; + long Price; + Byte TechLevel; + Byte Chance; // Chance that this is fitted in a slot +} SHIELD; + + +typedef struct { + Byte NameIndex; + Byte Pilot; + Byte Fighter; + Byte Trader; + Byte Engineer; + Byte CurSystem; +} CREWMEMBER; + + +typedef struct { + char* Name; + Byte CargoBays; // Number of cargo bays + Byte WeaponSlots; // Number of lasers possible + Byte ShieldSlots; // Number of shields possible + Byte GadgetSlots; // Number of gadgets possible (e.g. docking computers) + Byte CrewQuarters; // Number of crewmembers possible + Byte FuelTanks; // Each tank contains enough fuel to travel 10 parsecs + Byte MinTechLevel; // Minimum tech level needed to build ship + Byte CostOfFuel; // Cost to fill one tank with fuel + long Price; // Base ship cost + int Bounty; // Base bounty + int Occurrence; // Percentage of the ships you meet + long HullStrength; // Hull strength + int Police; // Encountered as police with at least this strength + int Pirates; // idem Pirates + int Traders; // idem Traders + Byte RepairCosts; // Repair costs for 1 point of hull strength. + Byte Size; // Determines how easy it is to hit this ship +} SHIPTYPE; + + +typedef struct { + Byte NameIndex; + Byte TechLevel; // Tech level + Byte Politics; // Political system + Byte Status; // Status + Byte X; // X-coordinate (galaxy width = 150) + Byte Y; // Y-coordinate (galaxy height = 100) + Byte SpecialResources; // Special resources + Byte Size; // System size + int Qty[MAXTRADEITEM]; // Quantities of tradeitems. These change very slowly over time. + Byte CountDown; // Countdown for reset of tradeitems. + Boolean Visited; // Visited Yes or No + int Special; // Special event +} SOLARSYSTEM; + + +typedef struct { + char* Name; + Byte TechProduction; // Tech level needed for production + Byte TechUsage; // Tech level needed to use + Byte TechTopProduction; // Tech level which produces this item the most + int PriceLowTech; // Medium price at lowest tech level + int PriceInc; // Price increase per tech level + int Variance; // Max percentage above or below calculated price + int DoublePriceStatus; // Price increases considerably when this event occurs + int CheapResource; // When this resource is available, this trade item is cheap + int ExpensiveResource; // When this resource is available, this trade item is expensive + int MinTradePrice; // Minimum price to buy/sell in orbit + int MaxTradePrice; // Minimum price to buy/sell in orbit + int RoundOff; // Roundoff price for trade in orbit +} TRADEITEM; + +typedef struct { + char* Name; + Byte ReactionIllegal; // Reaction level of illegal goods 0 = total acceptance (determines how police reacts if they find you carry them) + Byte StrengthPolice; // Strength level of police force 0 = no police (determines occurrence rate) + Byte StrengthPirates; // Strength level of pirates 0 = no pirates + Byte StrengthTraders; // Strength levcel of traders 0 = no traders + Byte MinTechLevel; // Mininum tech level needed + Byte MaxTechLevel; // Maximum tech level where this is found + Byte BribeLevel; // Indicates how easily someone can be bribed 0 = unbribeable/high bribe costs + Boolean DrugsOK; // Drugs can be traded (if not, people aren't interested or the governemnt is too strict) + Boolean FirearmsOK; // Firearms can be traded (if not, people aren't interested or the governemnt is too strict) + int Wanted; // Tradeitem requested in particular in this type of government +} POLITICS; + +typedef struct { + char* Title; + int QuestStringID; + long Price; + Byte Occurrence; + Boolean JustAMessage; +} SPECIALEVENT; + +typedef struct { + char* Name; + int MinScore; +} POLICERECORD; + + +typedef struct { + char* Name; + int MinScore; +} REPUTATION; + + +typedef struct +{ + long Credits; + long Debt; + int Days; + int WarpSystem; + int SelectedShipType; + long BuyPrice[MAXTRADEITEM]; + long SellPrice[MAXTRADEITEM]; + long ShipPrice[MAXSHIPTYPE]; + int GalacticChartSystem; + long PoliceKills; + long TraderKills; + long PirateKills; + long PoliceRecordScore; + long ReputationScore; + Boolean AutoFuel; + Boolean AutoRepair; + Boolean Clicks; + int EncounterType; + Boolean Raided; + Byte MonsterStatus; + Byte DragonflyStatus; + Byte JaporiDiseaseStatus; + Boolean MoonBought; + long MonsterHull; + char NameCommander[NAMELEN+1]; + int CurForm; + SHIP Ship; + SHIP Opponent; + CREWMEMBER Mercenary[MAXCREWMEMBER+1]; + SOLARSYSTEM SolarSystem[MAXSOLARSYSTEM]; + Boolean EscapePod; + Boolean Insurance; + int NoClaim; + Boolean Inspected; + Boolean AlwaysIgnoreTraders; + Byte Wormhole[MAXWORMHOLE]; + Byte Difficulty; + Byte VersionMajor; + Byte VersionMinor; + long BuyingPrice[MAXTRADEITEM]; + Boolean ArtifactOnBoard; + Boolean ReserveMoney; + Boolean PriceDifferences; + Boolean APLscreen; + int LeaveEmpty; + Boolean TribbleMessage; + Boolean AlwaysInfo; + Boolean AlwaysIgnorePolice; + Boolean AlwaysIgnorePirates; + Boolean TextualEncounters; + Byte JarekStatus; + Byte InvasionStatus; + Boolean Continuous; + Boolean AttackFleeing; + Byte ExperimentAndWildStatus; + Byte FabricRipProbability; + Byte VeryRareEncounter; + Byte BooleanCollection; + Byte ReactorStatus; + int TrackedSystem; + Byte ScarabStatus; + Boolean AlwaysIgnoreTradeInOrbit; + Boolean AlreadyPaidForNewspaper; + Boolean GameLoaded; + int Shortcut1; + int Shortcut2; + int Shortcut3; + int Shortcut4; + Boolean LitterWarning; + Boolean SharePreferences; + Boolean IdentifyStartup; + Boolean RectangularButtonsOn; + Byte ForFutureUse[MAXFORFUTUREUSE]; // Make sure this is properly adapted or savegames won't work after an upgrade! +} SAVEGAMETYPE; + + +typedef struct HighScoreType { + char Name[NAMELEN+1]; + Byte Status; // 0 = killed, 1 = Retired, 2 = Bought moon + int Days; + long Worth; + Byte Difficulty; + Byte ForFutureUse; +} HIGHSCORE; + +#define __DATATYPES_INC__ \ No newline at end of file diff --git a/Src/Draw.c b/Src/Draw.c new file mode 100644 index 0000000..7472deb --- /dev/null +++ b/Src/Draw.c @@ -0,0 +1,378 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Draw.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// ControlPtr RectangularButton( FormPtr frmP, int Nr ) +// void SBufMultiples( long Count, char* Txt ) +// void setFormTitle( int formID, CharPtr s ) +// void setCurrentWinTitle( CharPtr s ) +// void setLabelText( FormPtr frm, int labelid, CharPtr s ) +// void RectangularShortcuts( FormPtr frm, int First ) +// void EraseRectangle( int x, int y, int ex, int ey ) +// void DrawChars( char* Text, int x, int y ) +// int ScrollButton( EventPtr eventP ) +// +// Modifications: +// mm/dd/yy - description - author +// ************************************************************************* + +// Needed to change the frames of buttons to rectangles. There is currently no function +// that allows to do it. When an OS is published that fails on this access (probably OS 5.0), +// the RectangularButton function must be adapted. +#ifndef ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS +#define ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS 1 +#endif + +#include "external.h" + +// ************************************************************************* +// Make button rectangular +// ************************************************************************* +ControlPtr RectangularButton( FormPtr frmP, int Nr ) +{ + int objindex; + ControlPtr cp; + + objindex = FrmGetObjectIndex( frmP, Nr ); + cp = (ControlPtr)FrmGetObjectPtr( frmP, objindex ); + if (BELOW50 || RectangularButtonsOn) + cp->attr.frame = rectangleButtonFrame; + + return cp; +} + + +// ************************************************************************* +// String number and qualifier together +// ************************************************************************* +void SBufMultiples( long Count, char* Txt ) +{ + StrIToA( SBuf2, Count ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " " ); + StrCat( SBuf, Txt ); + if (Count != 1) + StrCat( SBuf, "s" ); +} + +// ************************************************************************* +// String number and qualifier together, but no digit for singulars +// ************************************************************************* +void SBufShortMultiples( long Count, char* Txt ) +{ + if (Count != 1) + { + StrIToA( SBuf2, Count ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " " ); + StrCat( SBuf, Txt ); + if (Count != 1) + StrCat( SBuf, "s" ); + } + else + { + StrCat( SBuf, Txt ); + } +} + + +// ************************************************************************* +// Setting the title of a form. +// CW 8 required a rewrite, as FrmGetTitle now returns a const Char * +// ************************************************************************* +void setFormTitle( int formID, CharPtr s ) +{ + FormPtr frm; +// CharPtr wintitle; + + frm = FrmGetFormPtr( formID ); +// wintitle = FrmGetTitle( frm ); +// StrCopy( wintitle, s ); +// FrmSetTitle( frm, wintitle ); + + FrmCopyTitle( frm, s ); + +} + + +// ************************************************************************* +// Setting the title of the current form. +// ************************************************************************* +void setCurrentWinTitle( CharPtr s ) +{ + FormPtr frm = FrmGetActiveForm(); + FrmSetTitle( frm, s ); +} + + +// ************************************************************************* +// Setting the text of a label. +// CW 8 required a rewrite, as CtlGetLabel now returns a const Char * +// ************************************************************************* +void setLabelText( FormPtr frm, int labelid, CharPtr s ) +{ + int objindex; +// ControlPtr cp; +// CharPtr c; + + objindex = FrmGetObjectIndex( frm, labelid ); +// cp = (ControlPtr)FrmGetObjectPtr( frm, objindex ); +// c = CtlGetLabel( cp ); +// StrCopy( c, s ); + + FrmHideObject(frm, objindex); + FrmCopyLabel(frm, labelid, s); + FrmShowObject(frm, objindex); +} + + +// ************************************************************************* +// Make shortcut buttons rectangular +// ************************************************************************* +void RectangularShortcuts( FormPtr frm, int First ) +{ + + SetControlLabel(frm, First+0, Shortcuts[Shortcut1]); + RectangularButton( frm, First+0 ); + SetControlLabel(frm, First+1, Shortcuts[Shortcut2]); + RectangularButton( frm, First+1 ); + SetControlLabel(frm, First+2, Shortcuts[Shortcut3]); + RectangularButton( frm, First+2 ); + SetControlLabel(frm, First+3, Shortcuts[Shortcut4]); + RectangularButton( frm, First+3 ); + +} + + +// ************************************************************************* +// Erases a rectangle +// ************************************************************************* +void EraseRectangle( int x, int y, int ex, int ey ) +{ + RectangleType a; + + a.topLeft.x = x; + a.topLeft.y = y; + a.extent.x = ex; + a.extent.y = ey; + WinEraseRectangle( &a, 0 ); +} + + +// ************************************************************************* +// Draws a text on the screen +// ************************************************************************* +void DrawChars( char* Text, int x, int y ) +{ + WinDrawChars( Text, StrLen( Text ), x, y ); +} + +// ****** +// Debug Alerts +// ****** +// only compile this in if desired. The resource does get included regardless, +// but that's only at a cost of a handful of bytes. +#ifdef _INCLUDE_DEBUG_DIALOGS_ + +void DebugIntAlert(int a, int b, int c) +{ +char as[51],bs[51],cs[51]; +StrIToA(as, a); +StrIToA(bs, b); +StrIToA(cs, c); +FrmCustomAlert(DebugAlert, as, bs, cs); +} + +void DebugLongAlert(long a, long b, long c) +{ +char as[51],bs[51],cs[51]; +StrPrintF(as, "%ld", a); +StrPrintF(bs, "%ld", b); +StrPrintF(cs, "%ld", c); +FrmCustomAlert(DebugAlert, as, bs, cs); +} + +void DebugCharAlert(char *a, char *b, char *c) +{ +FrmCustomAlert(DebugAlert, a,b,c); +} + +#endif // end of debug code + +// ************************************************************************* +// Draws a text centered on the screen +// ************************************************************************* +void DrawCharsCentered( char* Text, int y, Boolean useBold ) +{ + FontID originalFont; + Int16 width=160, length=StrLen(Text); + Boolean fits; + if (useBold) + { + originalFont = FntSetFont(boldFont); + } + else + { + originalFont = FntSetFont(stdFont); + } + FntCharsInWidth(Text, &width, &length, &fits); + // should probably find the width of the screen for the hi-rez crowd. + WinDrawChars( Text, StrLen( Text ), (int)(80 - width/2), y ); + FntSetFont(originalFont); +} + + +// ***************************************************************** +// Utility function for displaying headlines and incrementing the +// line counter. If we're too far down the page, we simply don't +// display the headline (we'll return a false if that's the case) +// ***************************************************************** +Boolean DisplayHeadline(char *text, int *y_coord) +{ + int offset=0; + Int16 width=158 - (NEWSINDENT1 * 2), length=StrLen(text); + Boolean fits; + char theText[72]; + + FntCharsInWidth(text, &width, &length, &fits); + + // check to see if we've got room to put it on one line + if (fits) + { + // do we have room on the page? + if (*y_coord > 128) + return false; + DrawChars(text, NEWSINDENT1, *y_coord); + } + else + { + // do we have room for two lines on the page? + if (*y_coord > 107) + return false; + + // is our text too long? + if (StrLen(text) > 71) + { + return false; + } + StrCopy(theText, text); + offset = length; + while (offset > 0 && theText[offset] != ' ') + offset--; + + theText[offset]='\0'; + DrawChars(theText, NEWSINDENT1, *y_coord); + *y_coord += 11; + DrawChars(theText + offset + 1, NEWSINDENT2, *y_coord); + } + + *y_coord += 15; + return true; +} + +// ***************************************************************** +// Utility function for displaying a page of text. +// ***************************************************************** +void DisplayPage(char *text, int start_y) +{ + int offset=0; + int internalOffset = 0; + int vert = start_y; + Int16 width=148, length, origLength=StrLen(text); + Boolean fits, looping; + char theText[46]; + + looping = true; + while (looping) + { + + StrNCopy(theText, text + offset, min(45, origLength-offset)); + + theText[min (45, origLength - offset) ] = '\0'; + length=StrLen(theText); + + FntCharsInWidth(theText, &width, &length, &fits); + + if (fits) + { + offset += 45; + } + else + { + internalOffset = length; + while (internalOffset > 0 && + theText[internalOffset] != ' ' && theText[internalOffset] != '-') + internalOffset--; + + if (theText[internalOffset] == '-' && internalOffset < length) + { + theText[internalOffset+1]='\0'; + } + else + { + theText[internalOffset]='\0'; + } + offset += internalOffset + 1; + } + DrawChars(theText, 8, vert); + vert += 12; + if (offset >= origLength) + { + looping = false; + theText[45]='\0'; + } + } +} + + +// ************************************************************************* +// Return scrollbutton that is pushed +// ************************************************************************* +int ScrollButton( EventPtr eventP ) +{ + ULong Ticks; + + if ((eventP->data.keyDown.chr == chrPageUp) || + (eventP->data.keyDown.chr == chrPageDown)) + { + Ticks = TimGetTicks(); + if (Ticks < GalacticChartUpdateTicks + (SysTicksPerSecond() >> 1)) + return 0; + GalacticChartUpdateTicks = Ticks; + return eventP->data.keyDown.chr; + } + + return 0; +} + diff --git a/Src/Encounter.c b/Src/Encounter.c new file mode 100644 index 0000000..a2588c5 --- /dev/null +++ b/Src/Encounter.c @@ -0,0 +1,2320 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Encounter.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// Encounter.c - Functions in this module: +// -------------------------------------------------------------------- +// +// Boolean EncounterFormHandleEvent ( EventPtr eventP ) +// +// -------------------------------------------------------------------- +// Static Local Functions +// -------------------------------------------------------------------- +// Boolean ExecuteAttack( SHIP* Attacker, SHIP* Defender, Boolean Flees, Boolean CommanderUnderAttack ) +// int ExecuteAction( Boolean CommanderFlees ) +// long TotalWeapons( SHIP* Sh ) +// long TotalShields( SHIP* Sh ) +// long TotalShieldStrength( SHIP* Sh ) +// void ShowShip( SHIP* Sh, int offset, Boolean commandersShip ) +// void EncounterDisplayShips( void ) +// void EscapeWithPod( void ) +// void Arrested( void ) +// void Scoop( void ) +// void EncounterDisplayNextAction( Boolean FirstDisplay ) +// void EncounterButtons( void ) +// +// ------------------------------------------------------------------------- +// Modifications: +// mm/dd/yy - description - author +// 06/30/01 - Police Encounter text changed - SRA +// ------------------------------------------------------------------------- +// +// ************************************************************************* + +#include "external.h" + +static Boolean playerShipNeedsUpdate, opponentShipNeedsUpdate; + +#ifdef HWATTACK +int hwbutton[4]; +#endif + +#define BELOW35 (romVersion < sysMakeROMVersion( 3, 5, 0, sysROMStageRelease, 0 )) + +// ************************************************************************* +// Calculate Bounty +// ************************************************************************* +static long GetBounty( SHIP* Sh ) +{ + long Bounty = EnemyShipPrice( Sh ); + + Bounty /= 200; + Bounty /= 25; + Bounty *= 25; + if (Bounty <= 0) + Bounty = 25; + if (Bounty > 2500) + Bounty = 2500; + + return Bounty; +} + +// ************************************************************************* +// Buttons on the encounter screen +// ************************************************************************* +static void EncounterButtons( void ) +{ + FormPtr frmP; + + frmP = FrmGetActiveForm(); + + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterSurrenderButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterIgnoreButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterFleeButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterSubmitButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterBribeButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterPlunderButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterInterruptButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterDrinkButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterBoardButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterMeetButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterYieldButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterTradeButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackBitMap ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterAttack2BitMap ) ); + + if (AutoAttack || AutoFlee) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterInterruptButton ) ); + AttackIconStatus = !AttackIconStatus; + if (AttackIconStatus) + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackBitMap ) ); + else + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttack2BitMap ) ); + } + + if (EncounterType == POLICEINSPECTION) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterFleeButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterSubmitButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterBribeButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterAttackButton; + hwbutton[1] = EncounterFleeButton; + hwbutton[2] = EncounterSubmitButton; + hwbutton[3] = EncounterBribeButton; +#endif + } + else if (EncounterType == POSTMARIEPOLICEENCOUNTER) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterFleeButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterYieldButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterBribeButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterAttackButton; + hwbutton[1] = EncounterFleeButton; + hwbutton[2] = EncounterYieldButton; + hwbutton[3] = EncounterBribeButton; +#endif + } + else if (EncounterType == POLICEFLEE || EncounterType == TRADERFLEE || + EncounterType == PIRATEFLEE) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterIgnoreButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterAttackButton; + hwbutton[1] = EncounterIgnoreButton; + hwbutton[2] = 0; + hwbutton[3] = 0; +#endif + } + else if (EncounterType == PIRATEATTACK || EncounterType == POLICEATTACK || + EncounterType == SCARABATTACK) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterFleeButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterSurrenderButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterAttackButton; + hwbutton[1] = EncounterFleeButton; + hwbutton[2] = EncounterSurrenderButton; + hwbutton[3] = 0; +#endif + } + else if (EncounterType == FAMOUSCAPATTACK) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterFleeButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterAttackButton; + hwbutton[1] = EncounterFleeButton; + hwbutton[2] = 0; + hwbutton[3] = 0; +#endif + } + else if (EncounterType == TRADERATTACK || + EncounterType == SPACEMONSTERATTACK || EncounterType == DRAGONFLYATTACK) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterFleeButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterAttackButton; + hwbutton[1] = EncounterFleeButton; + hwbutton[2] = 0; + hwbutton[3] = 0; +#endif + } + else if (EncounterType == TRADERIGNORE || EncounterType == POLICEIGNORE || + EncounterType == PIRATEIGNORE || + EncounterType == SPACEMONSTERIGNORE || EncounterType == DRAGONFLYIGNORE || + EncounterType == SCARABIGNORE) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterIgnoreButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterAttackButton; + hwbutton[1] = EncounterIgnoreButton; + hwbutton[2] = 0; + hwbutton[3] = 0; +#endif + } + else if (EncounterType == TRADERSURRENDER || EncounterType == PIRATESURRENDER) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterPlunderButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterAttackButton; + hwbutton[1] = EncounterPlunderButton; + hwbutton[2] = 0; + hwbutton[3] = 0; +#endif + } + else if (EncounterType == MARIECELESTEENCOUNTER) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterBoardButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterIgnoreButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterBoardButton; + hwbutton[1] = EncounterIgnoreButton; + hwbutton[2] = 0; + hwbutton[3] = 0; +#endif + } + else if (ENCOUNTERFAMOUS(EncounterType)) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterIgnoreButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterMeetButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterAttackButton; + hwbutton[1] = EncounterIgnoreButton; + hwbutton[2] = EncounterMeetButton; + hwbutton[3] = 0; +#endif + } + else if (EncounterType == BOTTLEOLDENCOUNTER || + EncounterType == BOTTLEGOODENCOUNTER) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterDrinkButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterIgnoreButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterDrinkButton; + hwbutton[1] = EncounterIgnoreButton; + hwbutton[2] = 0; + hwbutton[3] = 0; +#endif + } + else if (EncounterType == TRADERSELL || EncounterType == TRADERBUY) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterAttackButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterIgnoreButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, EncounterTradeButton ) ); +#ifdef HWATTACK + hwbutton[0] = EncounterAttackButton; + hwbutton[1] = EncounterIgnoreButton; + hwbutton[2] = EncounterTradeButton; + hwbutton[3] = 0; +#endif + } + + if (!TextualEncounters) + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterYouLabel ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, EncounterOpponentLabel ) ); + } +} + + +// ************************************************************************* +// Display on the encounter screen what the next action will be +// ************************************************************************* +static void EncounterDisplayNextAction( Boolean FirstDisplay ) +{ + if (EncounterType == POLICEINSPECTION) + { + DrawChars( "The police summon you to submit", 6, 106 ); + DrawChars( "to an inspection.", 6, 119 ); + } + else if (EncounterType == POSTMARIEPOLICEENCOUNTER) + { + DrawChars( "\"We know you removed illegal", 6, 93 ); + DrawChars( "goods from the Marie Celeste.", 6,106 ); + DrawChars( "You must give them up at once!\"", 6, 119 ); + } + else if (FirstDisplay && EncounterType == POLICEATTACK && + PoliceRecordScore > CRIMINALSCORE) + { + DrawChars( "The police hail they want", 6, 106 ); + DrawChars( "you to surrender.", 6, 119 ); + } + else if (EncounterType == POLICEFLEE || EncounterType == TRADERFLEE || + EncounterType == PIRATEFLEE) + DrawChars( "Your opponent is fleeing.", 6, 106 ); + else if (EncounterType == PIRATEATTACK || EncounterType == POLICEATTACK || + EncounterType == TRADERATTACK || EncounterType == SPACEMONSTERATTACK || + EncounterType == DRAGONFLYATTACK || EncounterType == SCARABATTACK || + EncounterType == FAMOUSCAPATTACK) + DrawChars( "Your opponent attacks.", 6, 106 ); + else if (EncounterType == TRADERIGNORE || EncounterType == POLICEIGNORE || + EncounterType == SPACEMONSTERIGNORE || EncounterType == DRAGONFLYIGNORE || + EncounterType == PIRATEIGNORE || EncounterType == SCARABIGNORE) + { + if (Cloaked( &Ship, &Opponent )) + DrawChars( "It doesn't notice you.", 6, 106 ); + else + DrawChars( "It ignores you.", 6, 106 ); + } + else if (EncounterType == TRADERSELL || EncounterType == TRADERBUY) + { + DrawChars( "You are hailed with an offer", 6, 106 ); + DrawChars( "to trade goods.", 6, 119 ); + } + else if (EncounterType == TRADERSURRENDER || EncounterType == PIRATESURRENDER) + { + DrawChars( "Your opponent hails that he", 6, 106 ); + DrawChars( "surrenders to you.", 6, 119 ); + } + else if (EncounterType == MARIECELESTEENCOUNTER) + { + DrawChars( "The Marie Celeste appears to", 6, 106 ); + DrawChars( "be completely abandoned.", 6, 119 ); + } + else if (ENCOUNTERFAMOUS(EncounterType) && EncounterType != FAMOUSCAPATTACK) + { + DrawChars( "The Captain requests a brief", 6, 106 ); + DrawChars( "meeting with you.", 6, 119 ); + } + else if (EncounterType == BOTTLEOLDENCOUNTER || + EncounterType == BOTTLEGOODENCOUNTER) + { + DrawChars( "It appears to be a rare bottle", 6, 106); + DrawChars( "of Captain Marmoset's Skill Tonic!", 6, 119); + } + +} + + +// ************************************************************************* +// You can pick up cannisters left by a destroyed ship +// ************************************************************************* +static void Scoop( void ) +{ + int d, ret; + FormPtr frm; + + // Chance 50% to pick something up on Normal level, 33% on Hard level, 25% on + // Impossible level, and 100% on Easy or Beginner + if (Difficulty >= NORMAL) + if (GetRandom( Difficulty ) != 1) + return; + + // More chance to pick up a cheap good + d = GetRandom( MAXTRADEITEM ); + if (d >= 5) + d = GetRandom( MAXTRADEITEM ); + + frm = FrmInitForm( PickCannisterForm ); + + StrCopy( SBuf, "ship, labeled " ); + StrCat( SBuf, Tradeitem[d].Name ); + StrCat( SBuf, ", drifts" ); + setLabelText( frm, PickCannisterCannisterLabel, SBuf ); + + ret = FrmDoDialog( frm ); + FrmDeleteForm( frm ); + + if (ret == PickCannisterPickItUpButton) + { + if (FilledCargoBays() >= TotalCargoBays()) + { + if (FrmAlert( NoRoomToScoopAlert ) == NoRoomToScoopLetitgo) + return; + + frm = FrmInitForm( DumpCargoForm ); + FrmSetEventHandler( frm, DiscardCargoFormHandleEvent ); + FrmDoDialog( frm ); + FrmDeleteForm( frm ); + } + + if (FilledCargoBays() < TotalCargoBays()) + ++Ship.Cargo[d]; + else + FrmAlert( NoDumpNoScoopAlert ); + } + +} + +// ************************************************************************* +// Calculate total possible shield strength +// ************************************************************************* +static long TotalShields( SHIP* Sh ) +{ + int i; + long j; + + j = 0; + for (i=0; iShield[i] < 0) + break; + j += Shieldtype[Sh->Shield[i]].Power; + } + + return j; +} + + +// ************************************************************************* +// Calculate total shield strength +// ************************************************************************* +static long TotalShieldStrength( SHIP* Sh ) +{ + int i; + long k; + + k = 0; + for (i=0; iShield[i] < 0) + break; + k += Sh->ShieldStrength[i]; + } + + return k; +} + + +// ************************************************************************* +// Show the ship stats on the encounter screen +// ************************************************************************* +void ShowShip( SHIP* Sh, int offset, Boolean commandersShip ) +{ + int x, y, x2, y2, startdamage, startshield, icon; + RectangleType bounds; + + FntSetFont( stdFont ); + + if (TextualEncounters) + { + EraseRectangle( offset, 32, 70, 38 ); + + DrawChars( Shiptype[Sh->Type].Name, offset, 32 ); + + if (ENCOUNTERMONSTER( EncounterType ) && offset > 10) + StrCopy( SBuf, "Hide at " ); + else + StrCopy( SBuf, "Hull at " ); + + if (commandersShip) + StrIToA( SBuf2, ((Sh->Hull * 100) / GetHullStrength()) ); + else + StrIToA( SBuf2, ((Sh->Hull * 100) / Shiptype[Sh->Type].HullStrength) ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, "%" ); + DrawChars( SBuf, offset, 45 ); + + if (Sh->Shield[0] < 0) + StrCopy( SBuf, "No shields" ); + else + { + StrCopy( SBuf, "Shields at " ); + if (TotalShields( Sh ) > 0) + StrIToA( SBuf2, ((TotalShieldStrength( Sh ) * 100) / TotalShields( Sh )) ); + else + StrCopy( SBuf2, "0" ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, "%" ); + } + DrawChars( SBuf, offset, 58 ); + } + else + { + EraseRectangle( offset, 18, 70, 52 ); + + x = offset + ((64 - (GetBitmapWidth( ShipBmpPtr[Sh->Type] ))>>1)); + y = 18 + ((52 - (GetBitmapHeight( ShipBmpPtr[Sh->Type] ))>>1)); + + x2 = offset + ((64 - (GetBitmapWidth( ShieldedShipBmpPtr[Sh->Type] ))>>1)); + y2 = 18 + ((52 - (GetBitmapHeight( ShieldedShipBmpPtr[Sh->Type] ))>>1)); + + if (commandersShip) + { + startdamage = x + GetBitmapWidth( ShipBmpPtr[Sh->Type] ) - + ((Sh->Hull * GetBitmapWidth( ShipBmpPtr[Sh->Type] )) / GetHullStrength()); + } + else + { + startdamage = x + GetBitmapWidth( ShipBmpPtr[Sh->Type] ) - + ((Sh->Hull * GetBitmapWidth( ShipBmpPtr[Sh->Type] )) / Shiptype[Sh->Type].HullStrength); + } + startshield = x2 + GetBitmapWidth( ShieldedShipBmpPtr[Sh->Type] ) - + (Sh->Shield[0] < 0 ? 0 : + (TotalShieldStrength( Sh ) * GetBitmapWidth( ShieldedShipBmpPtr[Sh->Type] )) / TotalShields( Sh ) ); + + bounds.topLeft.x = x2; + bounds.topLeft.y = 18; + bounds.extent.x = min( startdamage, startshield ) - x2; + bounds.extent.y = 52; + WinSetClip( &bounds ); + WinDrawBitmap( DamagedShipBmpPtr[Sh->Type], x, y ); + WinResetClip(); + + bounds.topLeft.x = min( startdamage, startshield ); + bounds.extent.x = max( startdamage, startshield ) - x2; + WinSetClip( &bounds ); + if (startdamage < startshield) + WinDrawBitmap( ShipBmpPtr[Sh->Type], x, y ); + else + WinDrawBitmap( DamagedShieldedShipBmpPtr[Sh->Type], x2, y2 ); + WinResetClip(); + + bounds.topLeft.x = max( startdamage, startshield ); + bounds.extent.x = GetBitmapWidth( ShieldedShipBmpPtr[Sh->Type] ); + WinSetClip( &bounds ); + WinDrawBitmap( ShieldedShipBmpPtr[Sh->Type], x2, y2 ); + WinResetClip(); + + if (offset > 10) + { + icon = -1; + if (ENCOUNTERPIRATE( EncounterType )) + { + if (Sh->Type == MANTISTYPE) + icon = 3; + else + icon = 0; + } + else if (ENCOUNTERPOLICE( EncounterType )) + icon = 1; + else if (ENCOUNTERTRADER( EncounterType )) + icon = 2; + else if (EncounterType == CAPTAINHUIEENCOUNTER || + EncounterType == MARIECELESTEENCOUNTER || + EncounterType == CAPTAINAHABENCOUNTER || + EncounterType == CAPTAINCONRADENCOUNTER) + icon = 4; + if (icon >= 0) + WinDrawBitmap( IconBmpPtr[icon], 143, 13 ); + } + } +} + + +// ************************************************************************* +// Display on the encounter screen the ships (and also wipe it) +// ************************************************************************* +static void EncounterDisplayShips( void ) +{ + + if (opponentShipNeedsUpdate) + { + opponentShipNeedsUpdate = false; + ShowShip( &Opponent, (TextualEncounters ? 84 : 80), false ); + } + if (playerShipNeedsUpdate) + { + playerShipNeedsUpdate = false; + ShowShip( &Ship, 6, true ); + } + + EraseRectangle( 5, 75, 151, 64 ); + + + +} + + +// ************************************************************************* +// Your escape pod ejects you +// ************************************************************************* +void EscapeWithPod( void ) +{ + FrmAlert( EscapePodActivatedAlert ); + + if (ScarabStatus == 3) + ScarabStatus = 0; + + Arrival(); + + if (ReactorStatus > 0 && ReactorStatus < 21) + { + FrmAlert( ReactorDestroyedAlert ); + ReactorStatus = 0; + } + + if (JaporiDiseaseStatus == 1) + { + FrmAlert( AntidoteDestroyedAlert ); + JaporiDiseaseStatus = 0; + } + + if (ArtifactOnBoard) + { + FrmAlert( ArtifactNotSavedAlert ); + ArtifactOnBoard = false; + } + + if (JarekStatus == 1) + { + FrmAlert( JarekTakenHomeAlert ); + JarekStatus = 0; + } + + if (WildStatus == 1) + { + FrmAlert( WildArrestedAlert ); + PoliceRecordScore += CAUGHTWITHWILDSCORE; + addNewsEvent(WILDARRESTED); + WildStatus = 0; + } + + if (Ship.Tribbles > 0) + { + FrmAlert( TribbleSurvivedAlert ); + Ship.Tribbles = 0; + } + + if (Insurance) + { + FrmAlert( InsurancePaysAlert ); + Credits += CurrentShipPriceWithoutCargo( true ); + } + + FrmAlert( FleaBuiltAlert ); + + if (Credits > 500) + Credits -= 500; + else + { + Debt += (500 - Credits); + Credits = 0; + } + + IncDays( 3 ); + + CreateFlea(); + + CurForm = SystemInformationForm; + FrmGotoForm( CurForm ); +} + + +// ************************************************************************* +// You get arrested +// ************************************************************************* +static void Arrested( void ) +{ + FormPtr frm; + long Fine, Imprisonment; + int i; + + Fine = ((1 + (((CurrentWorth() * min( 80, -PoliceRecordScore )) / 100) / 500)) * 500); + if (WildStatus == 1) + { + Fine *= 1.05; + } + Imprisonment = max( 30, -PoliceRecordScore ); + + FrmAlert( ArrestedAlert ); + + frm = FrmInitForm( ConvictionForm ); + + StrCopy( SBuf, "You are convicted to " ); + StrIToA( SBuf2, Imprisonment ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " days in" ); + setLabelText( frm, ConvictionImprisonmentLabel, SBuf ); + + StrCopy( SBuf, "prison and a fine of " ); + StrIToA( SBuf2, Fine ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " credits." ); + setLabelText( frm, ConvictionFineLabel, SBuf ); + + FrmDoDialog( frm ); + FrmDeleteForm( frm ); + + if (Ship.Cargo[NARCOTICS] > 0 || Ship.Cargo[FIREARMS] > 0) + { + FrmAlert( ImpoundAlert ); + Ship.Cargo[NARCOTICS] = 0; + Ship.Cargo[FIREARMS] = 0; + } + + if (Insurance) + { + FrmAlert( InsuranceLostAlert ); + Insurance = false; + NoClaim = 0; + } + + if (Ship.Crew[1] >= 0) + { + FrmAlert( MercenariesLeaveAlert ); + for (i=1; i 0 && ReactorStatus < 21) + { + FrmAlert( PoliceConfiscateReactorAlert ); + ReactorStatus = 0; + } + + Arrival(); + + IncDays( Imprisonment ); + + if (Credits >= Fine) + Credits -= Fine; + else + { + Credits += CurrentShipPrice( true ); + + if (Credits >= Fine) + Credits -= Fine; + else + Credits = 0; + + FrmAlert( ShipSoldAlert ); + + if (Ship.Tribbles > 0) + { + FrmAlert( TribblesSoldAlert ); + Ship.Tribbles = 0; + } + + FrmAlert( FleaReceivedAlert ); + + CreateFlea(); + } + + PoliceRecordScore = DUBIOUSSCORE; + + if (Debt > 0) + { + if (Credits >= Debt) + { + Credits -= Debt; + Debt = 0; + } + else + { + Debt -= Credits; + Credits = 0; + } + } + + for (i=0; iType].Size ) < + (Flees ? 2 : 1) * GetRandom( 5 + (PilotSkill( Defender ) >> 1) )) + // Misses + return false; + + if (TotalWeapons( Attacker, -1, -1) <= 0) + Damage = 0L; + else if (Defender->Type == SCARABTYPE) + { + if (TotalWeapons( Attacker, PULSELASERWEAPON, PULSELASERWEAPON ) <= 0 && + TotalWeapons( Attacker, MORGANLASERWEAPON, MORGANLASERWEAPON ) <= 0) + Damage = 0L; + else + Damage = GetRandom( ((TotalWeapons( Attacker, PULSELASERWEAPON, PULSELASERWEAPON ) + + TotalWeapons( Attacker, MORGANLASERWEAPON, MORGANLASERWEAPON )) * (100 + 2*EngineerSkill( Attacker )) / 100) ); + } + else + Damage = GetRandom( (TotalWeapons( Attacker, -1, -1 ) * (100 + 2*EngineerSkill( Attacker )) / 100) ); + + if (Damage <= 0L) + return false; + + // Reactor on board -- damage is boosted! + if (CommanderUnderAttack && ReactorStatus > 0 && ReactorStatus < 21) + { + if (Difficulty < NORMAL) + Damage *= 1 + (Difficulty + 1)*0.25; + else + Damage *= 1 + (Difficulty + 1)*0.33; + } + + // First, shields are depleted + for (i=0; iShield[i] < 0) + break; + if (Damage <= Defender->ShieldStrength[i]) + { + Defender->ShieldStrength[i] -= Damage; + Damage = 0; + break; + } + Damage -= Defender->ShieldStrength[i]; + Defender->ShieldStrength[i] = 0; + } + + prevDamage = Damage; + + // If there still is damage after the shields have been depleted, + // this is subtracted from the hull, modified by the engineering skill + // of the defender. + if (Damage > 0) + { + Damage -= GetRandom( EngineerSkill( Defender ) ); + if (Damage <= 0) + Damage = 1; + // At least 2 shots on Normal level are needed to destroy the hull + // (3 on Easy, 4 on Beginner, 1 on Hard or Impossible). For opponents, + // it is always 2. + if (CommanderUnderAttack && ScarabStatus == 3) + Damage = min( Damage, (GetHullStrength()/ + (CommanderUnderAttack ? max( 1, (IMPOSSIBLE-Difficulty) ) : 2)) ); + else + Damage = min( Damage, (Shiptype[Defender->Type].HullStrength/ + (CommanderUnderAttack ? max( 1, (IMPOSSIBLE-Difficulty) ) : 2)) ); + Defender->Hull -= Damage; + if (Defender->Hull < 0) + Defender->Hull = 0; + } + + if (Damage != prevDamage) + { + if (CommanderUnderAttack) + { + playerShipNeedsUpdate = true; + } + else + { + opponentShipNeedsUpdate = true; + } + } + + return true; +} + + +// ************************************************************************* +// A fight round +// Return value indicates whether fight continues into another round +// ************************************************************************* +static int ExecuteAction( Boolean CommanderFlees ) +{ + FormPtr frmP; + Boolean CommanderGotHit, OpponentGotHit; + long OpponentHull, ShipHull; + int y, i, objindex; + int PrevEncounterType; + ControlPtr cp; + + CommanderGotHit = false; + OpponentHull = Opponent.Hull; + ShipHull = Ship.Hull; + + // Fire shots + if (EncounterType == PIRATEATTACK || EncounterType == POLICEATTACK || + EncounterType == TRADERATTACK || EncounterType == SPACEMONSTERATTACK || + EncounterType == DRAGONFLYATTACK || EncounterType == POSTMARIEPOLICEENCOUNTER || + EncounterType == SCARABATTACK || EncounterType == FAMOUSCAPATTACK) + { + CommanderGotHit = ExecuteAttack( &Opponent, &Ship, CommanderFlees, true ); + } + + OpponentGotHit = false; + + if (!CommanderFlees) + { + if (EncounterType == POLICEFLEE || EncounterType == TRADERFLEE || + EncounterType == PIRATEFLEE) + { + OpponentGotHit = ExecuteAttack( &Ship, &Opponent, true, false ); + } + else + { + OpponentGotHit = ExecuteAttack( &Ship, &Opponent, false, false ); + } + } + + if (CommanderGotHit) + { + playerShipNeedsUpdate = true; + } + if (OpponentGotHit) + { + opponentShipNeedsUpdate = true; + } + + // Determine whether someone gets destroyed + if (Ship.Hull <= 0 && Opponent.Hull <= 0) + { + AutoAttack = false; + AutoFlee = false; + + if (EscapePod) + { + EscapeWithPod(); + return( true ); + } + else + { + FrmAlert( BothDestroyedAlert ); + CurForm = DestroyedForm; + FrmGotoForm( CurForm ); + } + return false; + } + else if (Opponent.Hull <= 0) + { + AutoAttack = false; + AutoFlee = false; + + if (ENCOUNTERPIRATE( EncounterType ) && Opponent.Type != MANTISTYPE && PoliceRecordScore >= DUBIOUSSCORE) + { + + frmP = FrmInitForm( BountyForm ); + StrCopy( SBuf, "You earned a bounty of " ); +// StrIToA( SBuf2, Shiptype[Opponent.Type].Bounty ); + StrIToA( SBuf2, GetBounty( &Opponent ) ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " cr." ); + setLabelText( frmP, BountyBountyLabel, SBuf ); + FrmDoDialog( frmP ); + FrmDeleteForm( frmP ); + } + else + { + FrmAlert( OpponentDestroyedAlert ); + } + if (ENCOUNTERPOLICE( EncounterType )) + { + ++PoliceKills; + PoliceRecordScore += KILLPOLICESCORE; + } + else if (ENCOUNTERFAMOUS( EncounterType)) + { + if (ReputationScore < DANGEROUSREP) + { + ReputationScore = DANGEROUSREP; + } + else + { + ReputationScore += 100; + } + // bump news flag from attacked to ship destroyed + replaceNewsEvent(latestNewsEvent(), latestNewsEvent() + 10); + + } + else if (ENCOUNTERPIRATE( EncounterType )) + { + if (Opponent.Type != MANTISTYPE) + { +// Credits += Shiptype[Opponent.Type].Bounty; + Credits += GetBounty( &Opponent ); + PoliceRecordScore += KILLPIRATESCORE; + Scoop(); + } + ++PirateKills; + } + else if (ENCOUNTERTRADER( EncounterType )) + { + ++TraderKills; + PoliceRecordScore += KILLTRADERSCORE; + Scoop(); + } + else if (ENCOUNTERMONSTER( EncounterType )) + { + ++PirateKills; + PoliceRecordScore += KILLPIRATESCORE; + MonsterStatus = 2; + } + else if (ENCOUNTERDRAGONFLY( EncounterType )) + { + ++PirateKills; + PoliceRecordScore += KILLPIRATESCORE; + DragonflyStatus = 5; + } + else if (ENCOUNTERSCARAB( EncounterType )) + { + ++PirateKills; + PoliceRecordScore += KILLPIRATESCORE; + ScarabStatus = 2; + } + ReputationScore += 1 + (Opponent.Type>>1); + return false; + } + else if (Ship.Hull <= 0) + { + AutoAttack = false; + AutoFlee = false; + + if (EscapePod) + { + EscapeWithPod(); + return( true ); + } + else + { + FrmAlert( ShipDestroyedAlert ); + CurForm = DestroyedForm; + FrmGotoForm( CurForm ); + } + return false; + } + + // Determine whether someone gets away. + if (CommanderFlees) + { + if (Difficulty == BEGINNER) + { + AutoAttack = false; + AutoFlee = false; + + FrmAlert( YouEscapedAlert ); + if (ENCOUNTERMONSTER( EncounterType )) + MonsterHull = Opponent.Hull; + + return false; + } + else if ((GetRandom( 7 ) + (PilotSkill( &Ship ) / 3)) * 2 >= + GetRandom( PilotSkill( &Opponent ) ) * (2 + Difficulty)) + { + AutoAttack = false; + AutoFlee = false; + if (CommanderGotHit) + { + ShowShip( &Ship, 6, true ); + frmP = FrmGetActiveForm(); + for (i=0; i> 1) + if (Ship.Hull < ShipHull >> 1) + { + if (GetRandom( 10 ) > 5) + EncounterType = POLICEFLEE; + } + else + EncounterType = POLICEFLEE; + } + else if (EncounterType == POSTMARIEPOLICEENCOUNTER) + { + EncounterType = POLICEATTACK; + } + else if (ENCOUNTERPIRATE( EncounterType )) + { + if (Opponent.Hull < (OpponentHull * 2) / 3) + { + if (Ship.Hull < (ShipHull * 2) / 3) + { + if (GetRandom( 10 ) > 3) + EncounterType = PIRATEFLEE; + } + else + { + EncounterType = PIRATEFLEE; + if (GetRandom( 10 ) > 8 && Opponent.Type < MAXSHIPTYPE) + EncounterType = PIRATESURRENDER; + } + } + } + else if (ENCOUNTERTRADER( EncounterType )) + { + if (Opponent.Hull < (OpponentHull * 2) / 3) + { + if (GetRandom( 10 ) > 3) + EncounterType = TRADERSURRENDER; + else + EncounterType = TRADERFLEE; + } + else if (Opponent.Hull < (OpponentHull * 9) / 10) + { + if (Ship.Hull < (ShipHull * 2) / 3) + { + // If you get damaged a lot, the trader tends to keep shooting + if (GetRandom( 10 ) > 7) + EncounterType = TRADERFLEE; + } + else if (Ship.Hull < (ShipHull * 9) / 10) + { + if (GetRandom( 10 ) > 3) + EncounterType = TRADERFLEE; + } + else + EncounterType = TRADERFLEE; + } + } + } + + if (PrevEncounterType != EncounterType) + { + if (!(AutoAttack && + (EncounterType == TRADERFLEE || EncounterType == PIRATEFLEE || EncounterType == POLICEFLEE))) + AutoAttack = false; + AutoFlee = false; + } + + // Show new status + frmP = FrmGetActiveForm(); + + EncounterButtons(); + // FrmDrawForm( frmP ); + EncounterDisplayShips(); + + if (ENCOUNTERPOLICE( PrevEncounterType )) + StrCopy( SBuf2, "police ship" ); + else if (ENCOUNTERPIRATE( PrevEncounterType )) + { + if (Opponent.Type == MANTISTYPE) + StrCopy( SBuf2, "alien ship" ); + else + StrCopy( SBuf2, "pirate ship" ); + } + else if (ENCOUNTERTRADER( PrevEncounterType )) + StrCopy( SBuf2, "trader ship" ); + else if (ENCOUNTERMONSTER( PrevEncounterType )) + StrCopy( SBuf2, "monster" ); + else if (ENCOUNTERDRAGONFLY( PrevEncounterType )) + StrCopy( SBuf2, "Dragonfly" ); + else if (ENCOUNTERSCARAB( PrevEncounterType )) + StrCopy( SBuf2, "Scarab" ); + else if (ENCOUNTERFAMOUS( PrevEncounterType)) + StrCopy( SBuf2, "Captain"); + + y = 75; + + if (CommanderGotHit) + { + StrCopy( SBuf, "The " ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " hits you." ); + DrawChars( SBuf, 6, y ); + y += 13; + } + + if (!(PrevEncounterType == POLICEFLEE || PrevEncounterType == TRADERFLEE || + PrevEncounterType == PIRATEFLEE) && !CommanderGotHit) + { + StrCopy( SBuf, "The " ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " missed you." ); + DrawChars( SBuf, 6, y ); + y += 13; + } + + if (OpponentGotHit) + { + StrCopy( SBuf, "You hit the " ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, "." ); + DrawChars( SBuf, 6, y ); + y += 13; + } + + if (!CommanderFlees && !OpponentGotHit) + { + StrCopy( SBuf, "You missed the " ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, "." ); + DrawChars( SBuf, 6, y ); + y += 13; + } + + if (PrevEncounterType == POLICEFLEE || PrevEncounterType == TRADERFLEE || + PrevEncounterType == PIRATEFLEE) + { + StrCopy( SBuf, "The " ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " didn't get away." ); + DrawChars( SBuf, 6, y ); + y += 13; + } + + if (CommanderFlees) + { + StrCopy( SBuf, "The " ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " is still following you." ); + DrawChars( SBuf, 6, y ); + y += 13; + } + + EncounterDisplayNextAction( false ); + + for (i=0; iWeapon[i] < 0) + break; + + if ((minWeapon != -1 && Sh->Weapon[i] < minWeapon) || + (maxWeapon != -1 && Sh->Weapon[i] > maxWeapon)) + continue; + + j += Weapontype[Sh->Weapon[i]].Power; + } + + return j; +} + + +static void DrawEncounterForm() +{ + FormPtr frmP; + int d, i; + int objindex; + ControlPtr cp; + + frmP = FrmGetActiveForm(); + + EncounterButtons(); + FrmDrawForm( frmP ); + + // This is an ugly hack. It seems to fix a PalmOS 3.0 bug. + if (BELOW35) + EncounterButtons(); + + playerShipNeedsUpdate=true; + opponentShipNeedsUpdate=true; + + EncounterDisplayShips(); + EncounterDisplayNextAction( true ); + + if (EncounterType == POSTMARIEPOLICEENCOUNTER) + { + DrawChars( "You encounter the Customs Police.", 6, 75 ); + } + else + { + StrCopy( SBuf, "At " ); + SBufMultiples( Clicks, "click" ); + StrCat( SBuf, " from " ); + StrCat( SBuf, SolarSystemName[SolarSystem[WarpSystem].NameIndex] ); + StrCat( SBuf, ", you" ); + DrawChars( SBuf, 6, 75 ); + + StrCopy( SBuf, "encounter " ); + + if (ENCOUNTERPOLICE( EncounterType )) + StrCat( SBuf, "a police " ); + else if (ENCOUNTERPIRATE( EncounterType )) + { + if (Opponent.Type == MANTISTYPE) + StrCat( SBuf, "an alien " ); + else + StrCat( SBuf, "a pirate " ); + } + else if (ENCOUNTERTRADER( EncounterType )) + StrCat( SBuf, "a trader " ); + else if (ENCOUNTERMONSTER( EncounterType )) + StrCat( SBuf, " " ); + else if (EncounterType == MARIECELESTEENCOUNTER) + StrCat(SBuf,"a drifting ship"); + else if (EncounterType == CAPTAINAHABENCOUNTER) + StrCat(SBuf, "the famous Captain Ahab"); + else if (EncounterType == CAPTAINCONRADENCOUNTER) + StrCat(SBuf, "Captain Conrad"); + else if (EncounterType == CAPTAINHUIEENCOUNTER) + StrCat(SBuf, "Captain Huie"); + else if (EncounterType == BOTTLEOLDENCOUNTER || EncounterType == BOTTLEGOODENCOUNTER) + StrCat(SBuf, "a floating bottle."); + else + StrCat( SBuf, "a stolen " ); + if (EncounterType != MARIECELESTEENCOUNTER && EncounterType != CAPTAINAHABENCOUNTER && + EncounterType != CAPTAINCONRADENCOUNTER && EncounterType != CAPTAINHUIEENCOUNTER && + EncounterType != BOTTLEOLDENCOUNTER && EncounterType != BOTTLEGOODENCOUNTER) + { + StrCopy( SBuf2, Shiptype[Opponent.Type].Name ); + SBuf2[0] = TOLOWER( SBuf2[0] ); + StrCat( SBuf, SBuf2 ); + } + StrCat( SBuf, "." ); + + DrawChars( SBuf, 6, 88 ); + } + + d = sqrt( Ship.Tribbles/250 ); + for (i=0; ieType) + { + case frmOpenEvent: + case frmUpdateEvent: + DrawEncounterForm(); + handled = true; + break; + +#ifdef HWATTACK + case keyDownEvent: + if (! UseHWButtons) + return false; + MemSet(&event, sizeof(event), 0); + event.eType = ctlSelectEvent; + if (eventP->data.keyDown.chr == hard1Chr) + event.data.ctlSelect.controlID = hwbutton[0]; + else if (eventP->data.keyDown.chr == hard2Chr) + event.data.ctlSelect.controlID = hwbutton[1]; + else if (eventP->data.keyDown.chr == hard3Chr) + event.data.ctlSelect.controlID = hwbutton[2]; + else if (eventP->data.keyDown.chr == hard4Chr) + event.data.ctlSelect.controlID = hwbutton[3]; + if (event.data.ctlSelect.controlID > 0) + EvtAddEventToQueue(&event); + else + return true; + handled = true; + break; +#endif + + case nilEvent: + if (!Continuous) + return true; + if (!(AutoAttack || AutoFlee)) + return true; + // Don't put anything in between the nilEvent and the ctlSelectEvent; these two + // run into each other! + case ctlSelectEvent: + + if (eventP->data.ctlSelect.controlID >= EncounterTribble0Button && + eventP->data.ctlSelect.controlID < EncounterTribble0Button + TRIBBLESONSCREEN) + { + if (AutoAttack || AutoFlee) + RedrawButtons = true; + AutoAttack = false; + AutoFlee = false; + if (RedrawButtons) + EncounterButtons(); + + FrmAlert( SqueekAlert ); + handled = true; + break; + } + + if (((eventP->eType == nilEvent) && AutoAttack) || + (eventP->data.ctlSelect.controlID == EncounterAttackButton)) // Attack + { + if (AutoAttack || AutoFlee) + RedrawButtons = true; + AutoAttack = false; + AutoFlee = false; + if (RedrawButtons) + EncounterButtons(); + + if (TotalWeapons( &Ship, -1, -1 ) <= 0) + { + FrmAlert( NoWeaponsAlert ); + return true; + } + + if (EncounterType == POLICEINSPECTION && Ship.Cargo[FIREARMS] <= 0 && + Ship.Cargo[NARCOTICS] <= 0) + { + if (FrmAlert( SureToFleeOrBribeAlert ) == SureToFleeOrBribeOKIwont) + return true; + } + + if (ENCOUNTERPOLICE( EncounterType ) || EncounterType == POSTMARIEPOLICEENCOUNTER) + { + if (PoliceRecordScore > CRIMINALSCORE && + FrmAlert( AttackByAccidentAlert ) == AttackByAccidentNo) + return true; + if (PoliceRecordScore > CRIMINALSCORE) + PoliceRecordScore = CRIMINALSCORE; + + PoliceRecordScore += ATTACKPOLICESCORE; + + if (EncounterType == POLICEIGNORE || EncounterType == POLICEINSPECTION || + EncounterType == POSTMARIEPOLICEENCOUNTER) + { + EncounterType = POLICEATTACK; + } + } + else if (ENCOUNTERPIRATE( EncounterType )) + { + if (EncounterType == PIRATEIGNORE) + EncounterType = PIRATEATTACK; + } + else if (ENCOUNTERTRADER( EncounterType )) + { + if (EncounterType == TRADERIGNORE || EncounterType == TRADERBUY || + EncounterType == TRADERSELL) + { + if (PoliceRecordScore >= CLEANSCORE) + { + if (FrmAlert( AttackTraderAlert ) == AttackTraderNo) + return true; + PoliceRecordScore = DUBIOUSSCORE; + } + else + PoliceRecordScore += ATTACKTRADERSCORE; + } + if (EncounterType != TRADERFLEE) + { + if (TotalWeapons( &Opponent, -1, -1 ) <= 0) + EncounterType = TRADERFLEE; + else if (GetRandom( ELITESCORE ) <= (ReputationScore * 10) / (1 + Opponent.Type)) + EncounterType = TRADERFLEE; + else + EncounterType = TRADERATTACK; + } + } + else if (ENCOUNTERMONSTER( EncounterType )) + { + if (EncounterType == SPACEMONSTERIGNORE) + EncounterType = SPACEMONSTERATTACK; + } + else if (ENCOUNTERDRAGONFLY( EncounterType )) + { + if (EncounterType == DRAGONFLYIGNORE) + EncounterType = DRAGONFLYATTACK; + } + else if (ENCOUNTERSCARAB( EncounterType )) + { + if (EncounterType == SCARABIGNORE) + EncounterType = SCARABATTACK; + } + else if (ENCOUNTERFAMOUS( EncounterType )) + { + if (EncounterType != FAMOUSCAPATTACK && + FrmAlert( SureToAttackFamousAlert ) == SureToAttackFamousOKIWont) + return true; + if (PoliceRecordScore > VILLAINSCORE) + PoliceRecordScore = VILLAINSCORE; + PoliceRecordScore += ATTACKTRADERSCORE; + if (EncounterType == CAPTAINHUIEENCOUNTER) + addNewsEvent(CAPTAINHUIEATTACKED); + else if (EncounterType == CAPTAINAHABENCOUNTER) + addNewsEvent(CAPTAINAHABATTACKED); + else if (EncounterType == CAPTAINCONRADENCOUNTER) + addNewsEvent(CAPTAINCONRADATTACKED); + + EncounterType = FAMOUSCAPATTACK; + + } + if (Continuous) + AutoAttack = true; + if (ExecuteAction( false )) + return true; + if (Ship.Hull <= 0) + return true; + } + else if (((eventP->eType == nilEvent) && AutoFlee) || + (eventP->data.ctlSelect.controlID == EncounterFleeButton)) // Flee + { + if (AutoAttack || AutoFlee) + RedrawButtons = true; + AutoAttack = false; + AutoFlee = false; + if (RedrawButtons) + EncounterButtons(); + + if (EncounterType == POLICEINSPECTION && Ship.Cargo[FIREARMS] <= 0 && + Ship.Cargo[NARCOTICS] <= 0 && WildStatus != 1 && (ReactorStatus == 0 || ReactorStatus == 21)) + { + if (FrmAlert( SureToFleeOrBribeAlert ) == SureToFleeOrBribeOKIwont) + return true; + } + + if (EncounterType == POLICEINSPECTION) + { + EncounterType = POLICEATTACK; + if (PoliceRecordScore > DUBIOUSSCORE) + PoliceRecordScore = DUBIOUSSCORE - (Difficulty < NORMAL ? 0 : 1); + else + PoliceRecordScore += FLEEFROMINSPECTION; + } + else if (EncounterType == POSTMARIEPOLICEENCOUNTER) + { + if (FrmAlert( SureToFleePostMarieAlert ) != SureToFleePostMarieOKIwont) + { + EncounterType = POLICEATTACK; + if (PoliceRecordScore >= CRIMINALSCORE) + PoliceRecordScore = CRIMINALSCORE; + else + PoliceRecordScore += ATTACKPOLICESCORE; + } + else + { + return true; + } + } + + if (Continuous) + AutoFlee = true; + if (ExecuteAction( true )) + return true; + if (Ship.Hull <= 0) + return true; + } + else if (eventP->data.ctlSelect.controlID == EncounterIgnoreButton) // Ignore + { + // Only occurs when opponent either ignores you or flees, so just continue + if (AutoAttack || AutoFlee) + RedrawButtons = true; + AutoAttack = false; + AutoFlee = false; + if (RedrawButtons) + EncounterButtons(); + } + else if (eventP->data.ctlSelect.controlID == EncounterTradeButton) // Trade in Orbit + { + if (EncounterType == TRADERBUY) + { + i = GetRandomTradeableItem (&Ship, TRADERBUY); + + if (i == NARCOTICS || i == FIREARMS) + { + if (GetRandom(100) <= 45) + SellPrice[i] *= 0.8; + else + SellPrice[i] *= 1.1; + } + else + { + if (GetRandom(100) <= 10) + SellPrice[i] *= 0.9; + else + SellPrice[i] *= 1.1; + } + + SellPrice[i] /= Tradeitem[i].RoundOff; + ++SellPrice[i]; + SellPrice[i] *= Tradeitem[i].RoundOff; + if (SellPrice[i] < Tradeitem[i].MinTradePrice) + SellPrice[i] = Tradeitem[i].MinTradePrice; + if (SellPrice[i] > Tradeitem[i].MaxTradePrice) + SellPrice[i] = Tradeitem[i].MaxTradePrice; + + frm = FrmInitForm( TradeInOrbitForm ); + + StrCopy( SBuf, "The trader wants to buy "); + StrCat ( SBuf, Tradeitem[i].Name); + StrCat ( SBuf, ","); + setLabelText( frm, TradeInOrbitDealLabel, SBuf ); + + + StrCopy( SBuf, "and offers "); + StrIToA( SBuf2, SellPrice[i]); + StrCat ( SBuf, SBuf2); + StrCat ( SBuf, " cr. each."); + setLabelText( frm, TradeInOrbitNumberItemsLabel, SBuf); + + StrCopy ( SBuf, "You have "); + StrIToA ( SBuf2, Ship.Cargo[i]); + StrCat ( SBuf, SBuf2); + if (Ship.Cargo[i] > 1) + StrCat ( SBuf, " units"); + else + StrCat (SBuf, " unit"); + StrCat( SBuf, " available."); + setLabelText( frm, TradeInOrbitQuantityAvailableLabel, SBuf ); + + StrCopy( SBuf, "You paid about " ); + StrIToA( SBuf2, BuyingPrice[i] / Ship.Cargo[i] ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " cr. per unit." ); + setLabelText( frm, TradeInOrbitAveragePriceLabel, SBuf ); + setLabelText( frm, TradeInOrbitHowManyLabel, "How many do you wish to sell?"); + + QuantityH = (Handle) SetField( frm, TradeInOrbitQuantityField, "", 5, true ); + d = FrmDoDialog(frm); + j = 0; + if (d == TradeInOrbitOKButton) + { + GetField( frm, TradeInOrbitQuantityField, SBuf, QuantityH ); + if (SBuf[0] != '\0') + { + j = max(0, min(Ship.Cargo[i], StrAToI(SBuf))); + } + } + else if (d == TradeInOrbitAllButton) + { + j = Ship.Cargo[i]; + } + j = min( j, Shiptype[Opponent.Type].CargoBays ); + if (j > 0) + { + BuyingPrice[i] = BuyingPrice[i]*(Ship.Cargo[i]-j)/Ship.Cargo[i]; + Ship.Cargo[i] -= j; + Opponent.Cargo[i] = j; + Credits += j * SellPrice[i]; + FrmCustomAlert(OrbitTradeCompletedAlert,"Thanks for selling us the", Tradeitem[i].Name, " "); + } + + FrmDeleteForm( frm ); + } + else if (EncounterType == TRADERSELL) + { + i = GetRandomTradeableItem (&Opponent, TRADERSELL); + + if (i == NARCOTICS || i == FIREARMS) + { + if (GetRandom(100) <= 45) + BuyPrice[i] *= 1.1; + else + BuyPrice[i] *= 0.8; + } + else + { + if (GetRandom(100) <= 10) + BuyPrice[i] *= 1.1; + else + BuyPrice[i] *= 0.9; + } + + BuyPrice[i] /= Tradeitem[i].RoundOff; + BuyPrice[i] *= Tradeitem[i].RoundOff; + if (BuyPrice[i] < Tradeitem[i].MinTradePrice) + BuyPrice[i] = Tradeitem[i].MinTradePrice; + if (BuyPrice[i] > Tradeitem[i].MaxTradePrice) + BuyPrice[i] = Tradeitem[i].MaxTradePrice; + + frm = FrmInitForm( TradeInOrbitForm ); + + StrCopy( SBuf, "The trader wants to sell "); + StrCat ( SBuf, Tradeitem[i].Name); + setLabelText( frm, TradeInOrbitDealLabel, SBuf ); + + StrCopy( SBuf, "for the price of "); + StrIToA( SBuf2, BuyPrice[i]); + StrCat ( SBuf, SBuf2); + StrCat ( SBuf, " cr. each."); + setLabelText( frm, TradeInOrbitNumberItemsLabel, SBuf); + + StrCopy ( SBuf, "The trader has "); + StrIToA ( SBuf2, Opponent.Cargo[i]); + StrCat ( SBuf, SBuf2); + if (Opponent.Cargo[i] > 1) + StrCat ( SBuf, " units"); + else + StrCat (SBuf, " unit"); + StrCat ( SBuf, " for sale."); + setLabelText( frm, TradeInOrbitQuantityAvailableLabel, SBuf ); + + StrCopy( SBuf, "You can afford " ); + StrIToA( SBuf2, Credits / BuyPrice[i] ); + StrCat( SBuf, SBuf2 ); + if (Credits/BuyPrice[i] > 1) + StrCat( SBuf, " units." ); + else + StrCat( SBuf, " unit."); + setLabelText( frm, TradeInOrbitAveragePriceLabel, SBuf ); + setLabelText( frm, TradeInOrbitHowManyLabel, "How many do you wish to buy?"); + + QuantityH = (Handle) SetField( frm, TradeInOrbitQuantityField, "", 5, true ); + d = FrmDoDialog(frm); + j = 0; + if (d == TradeInOrbitOKButton) + { + GetField( frm, TradeInOrbitQuantityField, SBuf, QuantityH ); + if (SBuf[0] != '\0') + { + j = max(0, min(Opponent.Cargo[i], StrAToI(SBuf)));; + } + } + else if (d == TradeInOrbitAllButton) + { + j = min(Opponent.Cargo[i], (TotalCargoBays()-FilledCargoBays())); + } + + j = min ( j, (Credits / BuyPrice[i])); + + if (j > 0) + { + Ship.Cargo[i] += j; + Opponent.Cargo[i] -= j; + BuyingPrice[i] += (j * BuyPrice[i]); + Credits -= (j * BuyPrice[i]); + FrmCustomAlert(OrbitTradeCompletedAlert,"Thanks for buying the", Tradeitem[i].Name, " "); + } + + FrmDeleteForm( frm ); + } + } + else if (eventP->data.ctlSelect.controlID == EncounterYieldButton) // Yield Narcotics from Marie Celeste + { + + if (WildStatus == 1) + { + if (FrmCustomAlert( WantToSurrenderAlert, "You have Jonathan Wild on board! ", "Wild will be arrested, too. ", NULL ) == WantToSurrenderNo) + return true; + } + else if (ReactorStatus > 0 && ReactorStatus < 21) + { + if (FrmCustomAlert( WantToSurrenderAlert, "You have an illegal Reactor on board! ", "They will destroy the reactor. ", NULL) == WantToSurrenderNo) + return true; + } + + if (WildStatus == 1 || (ReactorStatus > 0 && ReactorStatus < 21)) + { + Arrested(); + } + else + { + // Police Record becomes dubious, if it wasn't already. + if (PoliceRecordScore > DUBIOUSSCORE) + PoliceRecordScore = DUBIOUSSCORE; + Ship.Cargo[NARCOTICS]=0; + Ship.Cargo[FIREARMS]=0; + + FrmAlert(YieldNarcoticsAlert); + } + } + else if (eventP->data.ctlSelect.controlID == EncounterSurrenderButton) // Surrender + { + if (AutoAttack || AutoFlee) + RedrawButtons = true; + AutoAttack = false; + AutoFlee = false; + if (RedrawButtons) + EncounterButtons(); + + if (Opponent.Type == MANTISTYPE) + { + if (ArtifactOnBoard) + { + if (FrmAlert( WantToSurrenderToAliensAlert ) == WantToSurrenderToAliensNo) + return true; + else + { + FrmAlert( ArtifactStolenAlert ); + ArtifactOnBoard = 0; + } + } + else + { + FrmAlert( NoSurrenderAlert ); + return true; + } + } + else if (ENCOUNTERPOLICE( EncounterType )) + { + if (PoliceRecordScore <= PSYCHOPATHSCORE) + { + FrmAlert( NoSurrenderAlert ); + return true; + } + else + { + if (WildStatus == 1) + { + if (FrmCustomAlert( WantToSurrenderAlert, "You have Jonathan Wild on board! ", "Wild will be arrested, too. ", NULL ) == WantToSurrenderNo) + return true; + } + else if (ReactorStatus > 0 && ReactorStatus < 21) + { + if (FrmCustomAlert( WantToSurrenderAlert, "You have an illegal Reactor on board! ", "They will destroy the reactor. ", NULL) == WantToSurrenderNo) + return true; + } + else + { + if (FrmCustomAlert( WantToSurrenderAlert, NULL, NULL, NULL ) == WantToSurrenderNo) + return true; + } + + Arrested(); + return true; + } + } + else + { + Raided = true; + + TotalCargo = 0; + for (i=0; i= Blackmail) + Credits -= Blackmail; + else + { + Debt += (Blackmail - Credits); + Credits = 0; + } + } + else + { + + FrmAlert( PiratesPlunderAlert ); + + Bays = Shiptype[Opponent.Type].CargoBays; + for (i=0; i= TotalCargo) + { + for (i=0; i 0) + { + i = GetRandom( MAXTRADEITEM ); + if (Ship.Cargo[i] > 0) + { + BuyingPrice[i] = (BuyingPrice[i] * (Ship.Cargo[i] - 1)) / Ship.Cargo[i]; + --Ship.Cargo[i]; + --Bays; + } + } + } + } + if ((WildStatus == 1) && (Shiptype[Opponent.Type].CrewQuarters > 1)) + { + // Wild hops onto Pirate Ship + WildStatus = 0; + FrmAlert( WildGoesWithPiratesAlert ); + } + else if (WildStatus == 1) + { + // no room on pirate ship + FrmAlert( WildStaysAboardAlert ); + } + if (ReactorStatus > 0 && ReactorStatus < 21) + { + // pirates puzzled by reactor + FrmAlert( PiratesDontStealReactorAlert ); + } + } + } + else if (eventP->data.ctlSelect.controlID == EncounterBribeButton) // Bribe + { + if (AutoAttack || AutoFlee) + RedrawButtons = true; + AutoAttack = false; + AutoFlee = false; + if (RedrawButtons) + EncounterButtons(); + + if (Politics[SolarSystem[WarpSystem].Politics].BribeLevel <= 0) + { + FrmAlert( CantBeBribedAlert ); + return true; + } + if (EncounterType == POSTMARIEPOLICEENCOUNTER) + { + FrmAlert( MarieCantBeBribedAlert ); + return true; + } + + if (EncounterType == POLICEINSPECTION && Ship.Cargo[FIREARMS] <= 0 && + Ship.Cargo[NARCOTICS] <= 0 && WildStatus != 1) + { + if (FrmAlert( SureToFleeOrBribeAlert ) == SureToFleeOrBribeOKIwont) + return true; + } + + // Bribe depends on how easy it is to bribe the police and commander's current worth + Bribe = CurrentWorth() / + ((10L + 5L * (IMPOSSIBLE - Difficulty)) * Politics[SolarSystem[WarpSystem].Politics].BribeLevel); + if (Bribe % 100 != 0) + Bribe += (100 - (Bribe % 100)); + if (WildStatus == 1 || (ReactorStatus > 0 && ReactorStatus < 21)) + { + if (Difficulty <= NORMAL) + Bribe *= 2; + else + Bribe *= 3; + } + Bribe = max( 100, min( Bribe, 10000 ) ); + + frmP = FrmInitForm( BribeForm ); + + StrCopy( SBuf, "of " ); + StrIToA( SBuf2, Bribe ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " credits." ); + setLabelText( frmP, BribeBribeLabel, SBuf ); + + d = FrmDoDialog( frmP ); + + FrmDeleteForm( frmP ); + + if (d == BribeOfferBribeButton) + { + if (Credits < Bribe) + { + FrmAlert( NoMoneyForBribeAlert ); + return true; + } + + Credits -= Bribe; + } + else + return true; + } + else if (eventP->data.ctlSelect.controlID == EncounterSubmitButton) // Submit + { + if (AutoAttack || AutoFlee) + RedrawButtons = true; + AutoAttack = false; + AutoFlee = false; + if (RedrawButtons) + EncounterButtons(); + + if (EncounterType == POLICEINSPECTION && (Ship.Cargo[FIREARMS] > 0 || + Ship.Cargo[NARCOTICS] > 0 || WildStatus == 1 || + (ReactorStatus > 1 && ReactorStatus < 21))) + { + if (WildStatus == 1) + { + if (Ship.Cargo[FIREARMS] > 0 || Ship.Cargo[NARCOTICS] > 0) + { + StrCopy( SBuf, "Jonathan Wild and illegal goods"); + } + else + { + StrCopy( SBuf, "Jonathan Wild"); + } + StrCopy(SBuf2, "You will be arrested!"); + } + else if (ReactorStatus > 0 && ReactorStatus < 21) + { + if (Ship.Cargo[FIREARMS] > 0 || Ship.Cargo[NARCOTICS] > 0) + { + StrCopy( SBuf, "an illegal Ion Reactor and other illegal goods"); + } + else + { + StrCopy( SBuf, "an illegal Ion Reactor"); + } + StrCopy(SBuf2, "You will be arrested!"); + } + else + { + StrCopy( SBuf, "illegal goods"); + StrCopy( SBuf2, " "); + } + if (FrmCustomAlert( SureToSubmitAlert, SBuf, SBuf2, NULL ) == SureToSubmitNo) + return true; + + } + + if ((Ship.Cargo[FIREARMS] > 0) || (Ship.Cargo[NARCOTICS] > 0)) + { + // If you carry illegal goods, they are impounded and you are fined + Ship.Cargo[FIREARMS] = 0; + BuyingPrice[FIREARMS] = 0; + Ship.Cargo[NARCOTICS] = 0; + BuyingPrice[NARCOTICS] = 0; + Fine = CurrentWorth() / ((IMPOSSIBLE+2-Difficulty) * 10L); + if (Fine % 50 != 0) + Fine += (50 - (Fine % 50)); + Fine = max( 100, min( Fine, 10000 ) ); + if (Credits >= Fine) + Credits -= Fine; + else + { + Debt += (Fine - Credits); + Credits = 0; + } + + frmP = FrmInitForm( IllegalGoodsForm ); + + StrIToA( SBuf, Fine ); + StrCat( SBuf, " credits." ); + setLabelText( frmP, IllegalGoodsFineLabel, SBuf ); + + FrmDoDialog( frmP ); + + FrmDeleteForm( frmP ); + + PoliceRecordScore += TRAFFICKING; + } + else if (WildStatus != 1) + { + // If you aren't carrying illegal goods, the police will increase your lawfulness record + FrmAlert( NoIllegalGoodsAlert ); + PoliceRecordScore -= TRAFFICKING; + } + if (WildStatus == 1) + { + // Jonathan Wild Captured, and your status damaged. + Arrested(); + return true; + } + if (ReactorStatus > 0 && ReactorStatus < 21) + { + // Police confiscate the Reactor. + // Of course, this can only happen if somehow your + // Police Score gets repaired while you have the + // reactor on board -- otherwise you'll be arrested + // before we get to this point. (no longer true - 25 August 2002) + FrmAlert( PoliceConfiscateReactorAlert ); + ReactorStatus = 0; + + } + } + else if (eventP->data.ctlSelect.controlID == EncounterPlunderButton) // Plunder + { + if (AutoAttack || AutoFlee) + RedrawButtons = true; + AutoAttack = false; + AutoFlee = false; + if (RedrawButtons) + EncounterButtons(); + + if (ENCOUNTERTRADER( EncounterType )) + PoliceRecordScore += PLUNDERTRADERSCORE; + else + PoliceRecordScore += PLUNDERPIRATESCORE; + CurForm = PlunderForm; + FrmGotoForm( CurForm ); + return true; + } + else if (eventP->data.ctlSelect.controlID == EncounterInterruptButton) // Interrupt automatic attack/flight + { + if (AutoAttack || AutoFlee) + RedrawButtons = true; + AutoAttack = false; + AutoFlee = false; + if (RedrawButtons) + EncounterButtons(); + + return true; + } + else if (eventP->data.ctlSelect.controlID == EncounterMeetButton) // Meet with Famous Captain + { + if (EncounterType == CAPTAINAHABENCOUNTER) + { + // Trade a reflective shield for skill points in piloting? + if (FrmAlert( EngageCaptainAhabAlert) == EngageCaptainAhabYesTradeShield) + { + // remove the last reflective shield + i=MAXSHIELD - 1; + while (i >= 0) + { + if (Ship.Shield[i] == REFLECTIVESHIELD) + { + for (m=i+1; m MAXSKILL) + { + COMMANDER.Pilot = MAXSKILL; + } + FrmAlert( TrainingCompletedAlert ); + } + } + else if (EncounterType == CAPTAINCONRADENCOUNTER) + { + // Trade a military laser for skill points in engineering? + if (FrmAlert( EngageCaptainConradAlert) == EngageCaptainConradYesTradeLaser) + { + // remove the last military laser + i=MAXWEAPON - 1; + while (i>=0) + { + if (Ship.Weapon[i] == MILITARYLASERWEAPON) + { + for (m=i+1; m MAXSKILL) + { + COMMANDER.Engineer = MAXSKILL; + } + FrmAlert( TrainingCompletedAlert ); + } + } + else if (EncounterType == CAPTAINHUIEENCOUNTER) + { + // Trade a military laser for skill points in trading? + if (FrmAlert( EngageCaptainHuieAlert) == EngageCaptainHuieYesTradeLaser) + { + // remove the last military laser + i=MAXWEAPON - 1; + while (i>=0) + { + if (Ship.Weapon[i] == MILITARYLASERWEAPON) + { + for (m=i+1; m MAXSKILL) + { + COMMANDER.Trader = MAXSKILL; + } + RecalculateBuyPrices(COMMANDER.CurSystem); + FrmAlert( TrainingCompletedAlert ); + } + } + } + else if (eventP->data.ctlSelect.controlID == EncounterBoardButton) // Board Marie Celeste + { + if (EncounterType == MARIECELESTEENCOUNTER) + { + // take the cargo of the Marie Celeste? + if (FrmAlert( EngageMarieAlert ) == EngageMarieYesTakeCargo) + { + CurForm = PlunderForm; + FrmGotoForm( CurForm ); + return true; + } + } + } + else if (eventP->data.ctlSelect.controlID == EncounterDrinkButton) // Drink Tonic? + { + if (EncounterType == BOTTLEGOODENCOUNTER) + { + // Quaff the good bottle of Skill Tonic? + if (FrmAlert( EngageBottleAlert ) == EngageBottleYesDrinkIt) + { + // two points if you're on beginner-normal, one otherwise + IncreaseRandomSkill(); + if (Difficulty < HARD) + IncreaseRandomSkill(); + FrmAlert( GoodDrinkAlert ); + } + } + else if (EncounterType == BOTTLEOLDENCOUNTER) + { + // Quaff the out of date bottle of Skill Tonic? + if (FrmAlert( EngageBottleAlert ) == EngageBottleYesDrinkIt) + { + TonicTweakRandomSkill(); + FrmAlert( StrangeDrinkAlert ); + } + } + + } + Travel(); + handled = true; + break; + + default: + break; + } + + return handled; +} + + diff --git a/Src/Field.c b/Src/Field.c new file mode 100644 index 0000000..0a55b1c --- /dev/null +++ b/Src/Field.c @@ -0,0 +1,154 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Field.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// Field.c - Functions Include: +// Handle SetField( FormPtr frm, int Nr, char* Value, int Size, Boolean Focus ) +// void GetField( FormPtr frm, int Nr, char* Value, Handle AmountH ) +// void SetCheckBox( FormPtr frm, int Nr, Boolean Value ) +// Boolean GetCheckBox( FormPtr frm, int Nr ) +// +// Modifications: +// mm/dd/yy - description - author +// ************************************************************************* + +#include "external.h" + +// ************************************************************************* +// Set Field +// ************************************************************************* +Handle SetField( FormPtr frm, int Nr, char* Value, int Size, Boolean Focus ) +{ + Word objIndex; + CharPtr AmountP; + Handle AmountH; + + objIndex = FrmGetObjectIndex( frm, Nr ); + AmountH = MemHandleNew( Size ); + AmountP = MemHandleLock( AmountH ); + StrCopy( AmountP, Value ); + MemPtrUnlock( AmountP ); + FldSetTextHandle( FrmGetObjectPtr( frm, objIndex ), AmountH ); + if (Focus) + FrmSetFocus( frm, objIndex ); + + return AmountH; +} + + +// ************************************************************************* +// Get Field +// ************************************************************************* +void GetField( FormPtr frm, int Nr, char* Value, Handle AmountH ) +{ + Word objIndex; + CharPtr AmountP; + + objIndex = FrmGetObjectIndex( frm, Nr ); + FldSetTextHandle( FrmGetObjectPtr( frm, objIndex ), 0 ); + AmountP = MemHandleLock( AmountH ); + StrCopy( Value, AmountP ); + MemPtrUnlock( AmountP ); + MemHandleFree( AmountH ); +} + +// ************************************************************************* +// Set Trigger List value +// ************************************************************************* +void SetTriggerList( FormPtr frm, int Nr, int Index ) +{ + Word objIndex; + ControlPtr cp; + + objIndex = FrmGetObjectIndex( frm, Nr ); + cp = (ControlPtr)FrmGetObjectPtr( frm, objIndex ); + LstSetSelection( cp, Index ); +} + +// ************************************************************************* +// Set Control Label +// ************************************************************************* +void SetControlLabel( FormPtr frm, int Nr, Char * Label ) +{ + Word objIndex; + ControlPtr cp; + + objIndex = FrmGetObjectIndex( frm, Nr ); + cp = (ControlPtr)FrmGetObjectPtr( frm, objIndex ); + CtlSetLabel( cp, Label ); +} + +// ************************************************************************* +// Get Trigger List value +// ************************************************************************* +int GetTriggerList( FormPtr frm, int Nr) +{ + Word objIndex; + ControlPtr cp; + + objIndex = FrmGetObjectIndex( frm, Nr ); + cp = (ControlPtr)FrmGetObjectPtr( frm, objIndex ); + return LstGetSelection( cp ); +} + + +// ************************************************************************* +// Set Checkbox value +// ************************************************************************* +void SetCheckBox( FormPtr frm, int Nr, Boolean Value ) +{ + Word objIndex; + ControlPtr cp; + + objIndex = FrmGetObjectIndex( frm, Nr ); + cp = (ControlPtr)FrmGetObjectPtr( frm, objIndex ); + CtlSetValue( cp, (Value ? 1 : 0) ); +} + + +// ************************************************************************* +// Get Checkbox value +// ************************************************************************* +Boolean GetCheckBox( FormPtr frm, int Nr ) +{ + Word objIndex; + ControlPtr cp; + + objIndex = FrmGetObjectIndex( frm, Nr ); + cp = (ControlPtr)FrmGetObjectPtr( frm, objIndex ); + if (CtlGetValue( cp ) == 0) + return false; + else + return true; +} diff --git a/Src/Fuel.c b/Src/Fuel.c new file mode 100644 index 0000000..e62945b --- /dev/null +++ b/Src/Fuel.c @@ -0,0 +1,83 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Fuel.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// Fuel.c - Functions include: +// char GetFuelTanks( void ) +// char GetFuel( void ) +// void BuyFuel( int Amount ) +// +// Modifications: +// mm/dd/yy - description - author +// ************************************************************************* + +#include "external.h" + +// ************************************************************************* +// Determine size of fueltanks +// ************************************************************************* +char GetFuelTanks( void ) +{ + return (HasGadget( &Ship, FUELCOMPACTOR ) ? 18 : Shiptype[Ship.Type].FuelTanks); +} + + +// ************************************************************************* +// Determine fuel in tank +// ************************************************************************* +char GetFuel( void ) +{ + return min( Ship.Fuel, GetFuelTanks() ); +} + + +// ************************************************************************* +// Buy Fuel for Amount credits +// ************************************************************************* +void BuyFuel( int Amount ) +{ + int MaxFuel; + int Parsecs; + + MaxFuel = (GetFuelTanks() - GetFuel()) * Shiptype[Ship.Type].CostOfFuel; + if (Amount > MaxFuel) + Amount = MaxFuel; + if (Amount > Credits) + Amount = Credits; + + Parsecs = Amount / Shiptype[Ship.Type].CostOfFuel; + + Ship.Fuel += Parsecs; + Credits -= Parsecs * Shiptype[Ship.Type].CostOfFuel; +} diff --git a/Src/Global.c b/Src/Global.c new file mode 100644 index 0000000..9308745 --- /dev/null +++ b/Src/Global.c @@ -0,0 +1,683 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Global.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// Global Variable Storage +// Define any Global Variable Here and Reference it in external.h +// Include the external.h file in any new source file to have +// access to the global variable +// + +#define PILOT_PRECOMPILED_HEADERS_OFF 1 + +#include +#include +#include "spacetrader.h" +#include "MerchantRsc.h" + +const POLICERECORD PoliceRecord[MAXPOLICERECORD] = +{ + { "Psycho", -100 }, + { "Villain", PSYCHOPATHSCORE }, + { "Criminal", VILLAINSCORE }, + { "Crook", CRIMINALSCORE }, + { "Dubious", DUBIOUSSCORE }, + { "Clean", CLEANSCORE }, + { "Lawful", LAWFULSCORE }, + { "Trusted", TRUSTEDSCORE }, + { "Liked", HELPERSCORE }, + { "Hero", HEROSCORE } +}; + + +const REPUTATION Reputation[MAXREPUTATION] = +{ + { "Harmless", HARMLESSREP }, + { "Mostly harmless", MOSTLYHARMLESSREP }, + { "Poor", POORREP }, + { "Average", AVERAGESCORE }, + { "Above average", ABOVEAVERAGESCORE }, + { "Competent", COMPETENTREP }, + { "Dangerous", DANGEROUSREP }, + { "Deadly", DEADLYREP }, + { "Elite", ELITESCORE } +}; + + +const char* DifficultyLevel[MAXDIFFICULTY] = +{ + "Beginner", + "Easy", + "Normal", + "Hard", + "Impossible" +}; + + +const char* SpecialResources[MAXRESOURCES] = +{ + "Nothing special", + "Mineral rich", + "Mineral poor", + "Desert", + "Sweetwater oceans", + "Rich soil", + "Poor soil", + "Rich fauna", + "Lifeless", + "Weird mushrooms", + "Special herbs", + "Artistic populace", + "Warlike populace" +}; + + +const char* Status[MAXSTATUS] = +{ + "under no particular pressure", // Uneventful + "at war", // Ore and Weapons in demand + "ravaged by a plague", // Medicine in demand + "suffering from a drought", // Water in demand + "suffering from extreme boredom", // Games and Narcotics in demand + "suffering from a cold spell", // Furs in demand + "suffering from a crop failure", // Food in demand + "lacking enough workers" // Machinery and Robots in demand +}; + + +const char* Activity[MAXACTIVITY] = +{ + "Absent", + "Minimal", + "Few", + "Some", + "Moderate", + "Many", + "Abundant", + "Swarms" +}; + + +const TRADEITEM Tradeitem[MAXTRADEITEM] = +{ + { "Water", 0, 0, 2, 30, +3, 4, DROUGHT, LOTSOFWATER, DESERT, 30, 50, 1 }, + { "Furs", 0, 0, 0, 250, +10, 10, COLD, RICHFAUNA, LIFELESS, 230, 280, 5 }, + { "Food", 1, 0, 1, 100, +5, 5, CROPFAILURE, RICHSOIL, POORSOIL, 90, 160, 5 }, + { "Ore", 2, 2, 3, 350, +20, 10, WAR, MINERALRICH, MINERALPOOR, 350, 420, 10 }, + { "Games", 3, 1, 6, 250, -10, 5, BOREDOM, ARTISTIC, -1, 160, 270, 5 }, + { "Firearms", 3, 1, 5, 1250, -75, 100, WAR, WARLIKE, -1, 600, 1100, 25 }, + { "Medicine", 4, 1, 6, 650, -20, 10, PLAGUE, LOTSOFHERBS, -1, 400, 700, 25 }, + { "Machines", 4, 3, 5, 900, -30, 5, LACKOFWORKERS, -1, -1, 600, 800, 25 }, + { "Narcotics", 5, 0, 5, 3500, -125, 150, BOREDOM, WEIRDMUSHROOMS, -1, 2000, 3000, 50 }, + { "Robots", 6, 4, 7, 5000, -150, 100, LACKOFWORKERS, -1, -1, 3500, 5000, 100 } +}; + + +char NameCommander[NAMELEN+1] = "Jameson"; + +char* MercenaryName[MAXCREWMEMBER] = +{ + NameCommander, + "Alyssa", + "Armatur", + "Bentos", + "C2U2", + "Chi'Ti", + "Crystal", + "Dane", + "Deirdre", + "Doc", + "Draco", + "Iranda", + "Jeremiah", + "Jujubal", + "Krydon", + "Luis", + "Mercedez", + "Milete", + "Muri-L", + "Mystyc", + "Nandi", + "Orestes", + "Pancho", + "PS37", + "Quarck", + "Sosumi", + "Uma", + "Wesley", + "Wonton", + "Yorvick", + "Zeethibal" // anagram for Elizabeth +}; + +CREWMEMBER Mercenary[MAXCREWMEMBER + 1]; + + +const SHIPTYPE Shiptype[MAXSHIPTYPE+EXTRASHIPS] = +{ + { "Flea", 10, 0, 0, 0, 1, MAXRANGE, 4, 1, 2000, 5, 2, 25, -1, -1, 0, 1, 0 }, + { "Gnat", 15, 1, 0, 1, 1, 14, 5, 2, 10000, 50, 28, 100, 0, 0, 0, 1, 1 }, + { "Firefly", 20, 1, 1, 1, 1, 17, 5, 3, 25000, 75, 20, 100, 0, 0, 0, 1, 1 }, + { "Mosquito", 15, 2, 1, 1, 1, 13, 5, 5, 30000, 100, 20, 100, 0, 1, 0, 1, 1 }, + { "Bumblebee", 25, 1, 2, 2, 2, 15, 5, 7, 60000, 125, 15, 100, 1, 1, 0, 1, 2 }, + { "Beetle", 50, 0, 1, 1, 3, 14, 5, 10, 80000, 50, 3, 50, -1, -1, 0, 1, 2 }, + { "Hornet", 20, 3, 2, 1, 2, 16, 6, 15, 100000, 200, 6, 150, 2, 3, 1, 2, 3 }, + { "Grasshopper", 30, 2, 2, 3, 3, 15, 6, 15, 150000, 300, 2, 150, 3, 4, 2, 3, 3 }, + { "Termite", 60, 1, 3, 2, 3, 13, 7, 20, 225000, 300, 2, 200, 4, 5, 3, 4, 4 }, + { "Wasp", 35, 3, 2, 2, 3, 14, 7, 20, 300000, 500, 2, 200, 5, 6, 4, 5, 4 }, + // The ships below can't be bought + { "Space monster", 0, 3, 0, 0, 1, 1, 8, 1, 500000, 0, 0, 500, 8, 8, 8, 1, 4 }, + { "Dragonfly", 0, 2, 3, 2, 1, 1, 8, 1, 500000, 0, 0, 10, 8, 8, 8, 1, 1 }, + { "Mantis", 0, 3, 1, 3, 3, 1, 8, 1, 500000, 0, 0, 300, 8, 8, 8, 1, 2 }, + { "Scarab", 20, 2, 0, 0, 2, 1, 8, 1, 500000, 0, 0, 400, 8, 8, 8, 1, 3 }, + { "Bottle", 0, 0, 0, 0, 0, 1, 8, 1, 100, 0, 0, 10, 8, 8, 8, 1, 1 } +}; + + +const WEAPON Weapontype[MAXWEAPONTYPE+EXTRAWEAPONS] = +{ + { "Pulse laser", PULSELASERPOWER, 2000, 5, 50 }, + { "Beam laser", BEAMLASERPOWER, 12500, 6, 35 }, + { "Military laser", MILITARYLASERPOWER, 35000, 7, 15 }, + // The weapons below cannot be bought + { "Morgan's laser", MORGANLASERPOWER, 50000, 8, 0 } +}; + + +const SHIELD Shieldtype[MAXSHIELDTYPE+EXTRASHIELDS] = +{ + { "Energy shield", ESHIELDPOWER, 5000, 5, 70 }, + { "Reflective shield", RSHIELDPOWER, 20000, 6, 30 }, + // The shields below can't be bought + { "Lightning shield", LSHIELDPOWER, 45000, 8, 0 } +}; + + +const GADGET Gadgettype[MAXGADGETTYPE+EXTRAGADGETS] = +{ + { "5 extra cargo bays", 2500, 4, 35 }, // 5 extra holds + { "Auto-repair system", 7500, 5, 20 }, // Increases engineer's effectivity + { "Navigating system", 15000, 6, 20 }, // Increases pilot's effectivity + { "Targeting system", 25000, 6, 20 }, // Increases fighter's effectivity + { "Cloaking device", 100000, 7, 5 }, // If you have a good engineer, nor pirates nor police will notice you + // The gadgets below can't be bought + { "Fuel compactor", 30000, 8, 0 } +}; + + +// Note that these initializations are overruled by the StartNewGame function +SHIP Ship = +{ + 1, // Gnat + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // No cargo + { 0, -1, -1 }, // One pulse laser + { -1, -1, -1 },{ 0,0,0 }, // No shields + { -1, -1, -1 }, // No gadgets + { 0, -1, -1 }, // Commander on board + 14, // Full tank + 100, // Full hull strength + 0, // No tribbles on board + { 0, 0, 0, 0 } // For future use +}; + +SHIP Opponent = + { + 1, // Gnat + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // No cargo + { 0, -1, -1 }, // One pulse laser + { -1, -1, -1 }, { 0, 0, 0 }, // No shields + { -1, -1, -1 }, // No gadgets + { 1, -1, -1 }, // Alyssa on board + 14, // Full tank + 100, // Full hull strength + 0, // No tribbles on board + { 0, 0, 0, 0 } // For future use + }; + + +SHIP SpaceMonster = +{ + MAXSHIPTYPE, // Space monster + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // No cargo + { 2, 2, 2 }, // Three military lasers + { -1, -1, -1 }, { 0, 0, 0 }, // No shields + { -1, -1, -1 }, // No gadgets + { MAXCREWMEMBER, -1, -1 }, // super stats + 1, // Full tank + 500, // Full hull strength + 0, // No tribbles on board + { 0, 0, 0, 0 } // For future use +}; + +SHIP Scarab = +{ + MAXSHIPTYPE+3, // Scarab + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // No cargo + { 2, 2, -1 }, // Two military lasers + { -1, -1, -1 }, { 0, 0, 0 }, // No shields + { -1, -1, -1 }, // No gadgets + { MAXCREWMEMBER, -1, -1 }, // super stats + 1, // Full tank + 400, // Full hull strength + 0, // No tribbles on board + { 0, 0, 0, 0 } // For future use +}; + +SHIP Dragonfly = +{ + MAXSHIPTYPE+1, // Dragonfly + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // No cargo + { 2, 0, -1 }, // One military laser and one pulse laser + { LIGHTNINGSHIELD, LIGHTNINGSHIELD, LIGHTNINGSHIELD }, // Three lightning shields + { LSHIELDPOWER, LSHIELDPOWER, LSHIELDPOWER }, + { AUTOREPAIRSYSTEM, TARGETINGSYSTEM, -1 }, // Gadgets + { MAXCREWMEMBER, -1, -1 }, // super stats + 1, // Full tank + 10, // Full hull strength (though this isn't much) + 0, // No tribbles on board + { 0, 0, 0, 0 } // For future use +}; + + +const char* SystemSize[MAXSIZE] = +{ + "Tiny", + "Small", + "Medium", + "Large", + "Huge" +}; + + +const char* TechLevel[MAXTECHLEVEL] = +{ + "Pre-agricultural", + "Agricultural", + "Medieval", + "Renaissance", + "Early Industrial", + "Industrial", + "Post-industrial", + "Hi-tech" +}; + + +const POLITICS Politics[MAXPOLITICS] = +{ + { "Anarchy", 0, 0, 7, 1, 0, 5, 7, true, true, FOOD }, + { "Capitalist State", 2, 3, 2, 7, 4, 7, 1, true, true, ORE }, + { "Communist State", 6, 6, 4, 4, 1, 5, 5, true, true, -1 }, + { "Confederacy", 5, 4, 3, 5, 1, 6, 3, true, true, GAMES }, + { "Corporate State", 2, 6, 2, 7, 4, 7, 2, true, true, ROBOTS }, + { "Cybernetic State", 0, 7, 7, 5, 6, 7, 0, false, false, ORE }, + { "Democracy", 4, 3, 2, 5, 3, 7, 2, true, true, GAMES }, + { "Dictatorship", 3, 4, 5, 3, 0, 7, 2, true, true, -1 }, + { "Fascist State", 7, 7, 7, 1, 4, 7, 0, false, true, MACHINERY }, + { "Feudal State", 1, 1, 6, 2, 0, 3, 6, true, true, FIREARMS }, + { "Military State", 7, 7, 0, 6, 2, 7, 0, false, true, ROBOTS }, + { "Monarchy", 3, 4, 3, 4, 0, 5, 4, true, true, MEDICINE }, + { "Pacifist State", 7, 2, 1, 5, 0, 3, 1, true, false, -1 }, + { "Socialist State", 4, 2, 5, 3, 0, 5, 6, true, true, -1 }, + { "State of Satori", 0, 1, 1, 1, 0, 1, 0, false, false, -1 }, + { "Technocracy", 1, 6, 3, 6, 4, 7, 2, true, true, WATER }, + { "Theocracy", 5, 6, 1, 4, 0, 4, 0, true, true, NARCOTICS } +}; + +// Many of these names are from Star Trek: The Next Generation, or are small changes +// to names of this series. A few have different origins. +const char* SolarSystemName[MAXSOLARSYSTEM] = +{ + "Acamar", + "Adahn", // The alternate personality for The Nameless One in "Planescape: Torment" + "Aldea", + "Andevian", + "Antedi", + "Balosnee", + "Baratas", + "Brax", // One of the heroes in Master of Magic + "Bretel", // This is a Dutch device for keeping your pants up. + "Calondia", + "Campor", + "Capelle", // The city I lived in while programming this game + "Carzon", + "Castor", // A Greek demi-god + "Cestus", + "Cheron", + "Courteney", // After Courteney Cox... + "Daled", + "Damast", + "Davlos", + "Deneb", + "Deneva", + "Devidia", + "Draylon", + "Drema", + "Endor", + "Esmee", // One of the witches in Pratchett's Discworld + "Exo", + "Ferris", // Iron + "Festen", // A great Scandinavian movie + "Fourmi", // An ant, in French + "Frolix", // A solar system in one of Philip K. Dick's novels + "Gemulon", + "Guinifer", // One way of writing the name of king Arthur's wife + "Hades", // The underworld + "Hamlet", // From Shakespeare + "Helena", // Of Troy + "Hulst", // A Dutch plant + "Iodine", // An element + "Iralius", + "Janus", // A seldom encountered Dutch boy's name + "Japori", + "Jarada", + "Jason", // A Greek hero + "Kaylon", + "Khefka", + "Kira", // My dog's name + "Klaatu", // From a classic SF movie + "Klaestron", + "Korma", // An Indian sauce + "Kravat", // Interesting spelling of the French word for "tie" + "Krios", + "Laertes", // A king in a Greek tragedy + "Largo", + "Lave", // The starting system in Elite + "Ligon", + "Lowry", // The name of the "hero" in Terry Gilliam's "Brazil" + "Magrat", // The second of the witches in Pratchett's Discworld + "Malcoria", + "Melina", + "Mentar", // The Psilon home system in Master of Orion + "Merik", + "Mintaka", + "Montor", // A city in Ultima III and Ultima VII part 2 + "Mordan", + "Myrthe", // The name of my daughter + "Nelvana", + "Nix", // An interesting spelling of a word meaning "nothing" in Dutch + "Nyle", // An interesting spelling of the great river + "Odet", + "Og", // The last of the witches in Pratchett's Discworld + "Omega", // The end of it all + "Omphalos", // Greek for navel + "Orias", + "Othello", // From Shakespeare + "Parade", // This word means the same in Dutch and in English + "Penthara", + "Picard", // The enigmatic captain from ST:TNG + "Pollux", // Brother of Castor + "Quator", + "Rakhar", + "Ran", // A film by Akira Kurosawa + "Regulas", + "Relva", + "Rhymus", + "Rochani", + "Rubicum", // The river Ceasar crossed to get into Rome + "Rutia", + "Sarpeidon", + "Sefalla", + "Seltrice", + "Sigma", + "Sol", // That's our own solar system + "Somari", + "Stakoron", + "Styris", + "Talani", + "Tamus", + "Tantalos", // A king from a Greek tragedy + "Tanuga", + "Tarchannen", + "Terosa", + "Thera", // A seldom encountered Dutch girl's name + "Titan", // The largest moon of Jupiter + "Torin", // A hero from Master of Magic + "Triacus", + "Turkana", + "Tyrus", + "Umberlee", // A god from AD&D, which has a prominent role in Baldur's Gate + "Utopia", // The ultimate goal + "Vadera", + "Vagra", + "Vandor", + "Ventax", + "Xenon", + "Xerxes", // A Greek hero + "Yew", // A city which is in almost all of the Ultima games + "Yojimbo", // A film by Akira Kurosawa + "Zalkon", + "Zuul" // From the first Ghostbusters movie +}; + + +SOLARSYSTEM SolarSystem[MAXSOLARSYSTEM]; + + +Byte Wormhole[MAXWORMHOLE]; // Systems which have a wormhole + +// Quest descriptions have been moved into the Resources. +// This makes them marginally easier to edit, as well as moves them out +// of the heap during runtime. SjG +const SPECIALEVENT SpecialEvent[MAXSPECIALEVENT] = +{ + { "Dragonfly Destroyed", QuestDragonflyDestroyedString, 0, 0, true }, + { "Weird Ship", QuestWeirdShipString, 0, 0, true }, + { "Lightning Ship", QuestLightningShipString, 0, 0, true }, + { "Strange Ship", QuestStrangeShipString, 0, 0, true }, + { "Monster Killed", QuestMonsterKilledString, -15000, 0, true }, + { "Medicine Delivery", QuestMedicineDeliveredString, 0, 0, true }, + { "Retirement", QuestRetirementString, 0, 0, false }, + { "Moon For Sale", QuestMoonForSaleString, COSTMOON, 4, false }, + { "Skill Increase", QuestSkillIncreaseString, 3000, 3, false }, + { "Merchant Prince", QuestMerchantPrinceString, 1000, 1, false }, + { "Erase Record", QuestEraseRecordString, 5000, 3, false }, + { "Tribble Buyer", QuestTribbleBuyerString, 0, 3, false }, + { "Space Monster", QuestSpaceMonsterString, 0, 1, true }, + { "Dragonfly", QuestDragonflyString, 0, 1, true }, + { "Cargo For Sale", QuestCargoForSaleString, 1000, 3, false }, + { "Lightning Shield", QuestLightningShieldString, 0, 0, false }, + { "Japori Disease", QuestJaporiDiseaseString, 0, 1, false }, + { "Lottery Winner", QuestLotteryWinnerString, -1000, 0, true }, + { "Artifact Delivery", QuestArtifactDeliveryString, -20000, 0, true }, + { "Alien Artifact", QuestAlienArtifactString, 0, 1, false }, + { "Ambassador Jarek", QuestAmbassadorJarekString, 0, 1, false }, + { "Alien Invasion", QuestAlienInvasionString, 0, 0, true }, + { "Gemulon Invaded", QuestGemulonInvadedString, 0, 0, true }, + { "Fuel Compactor", QuestFuelCompactorString, 0, 0, false }, + { "Dangerous Experiment", QuestDangerousExperimentString, 0, 0, true }, + { "Jonathan Wild", QuestJonathanWildString, 0, 1, false }, + { "Morgan's Reactor", QuestMorgansReactorString, 0, 0, false }, + { "Install Morgan's Laser", QuestInstallMorgansLaserString, 0, 0, false }, + { "Scarab Stolen", QuestScarabStolenString, 0, 1, true}, + { "Upgrade Hull", QuestUpgradeHullString, 0, 0, false}, + { "Scarab Destroyed", QuestScarabDestroyedString, 0, 0, true}, + { "Reactor Delivered", QuestReactorDeliveredString, 0, 0, true }, + { "Jarek Gets Out", QuestJarekGetsOutString, 0, 0, true }, + { "Gemulon Rescued", QuestGemulonRescuedString, 0, 0, true }, + { "Disaster Averted", QuestDisasterAvertedString, 0, 0, true }, + { "Experiment Failed", QuestExperimentFailedString, 0, 0, true }, + { "Wild Gets Out", QuestWildGetsOutString, 0, 0, true } + +}; + +const char *Shortcuts[11] = { + "B","S","Y","E","Q","P","K","I","C","G","W" +}; + +int ShortcutTarget[11] = { + MenuCommandBuyCargo, + MenuCommandSellCargo, + MenuCommandShipYard, + MenuCommandBuyEquipment, + MenuCommandSellEquipment, + MenuCommandPersonnelRoster, + MenuCommandBank, + MenuCommandSystemInformation, + MenuCommandCommanderStatus, + MenuCommandGalacticChart, + MenuCommandShortRangeChart +}; + +// increased from 51 to 128 to handle the needs of the Newspaper, and various +// quest messages stored in String Resources +char SBuf[128]; +char SBuf2[51]; + +//int NewsEvents[MAXSPECIALNEWSEVENTS]; + + +Handle SystemBmp; +Handle CurrentSystemBmp; +Handle ShortRangeSystemBmp; +Handle WormholeBmp; +Handle SmallWormholeBmp; +Handle VisitedSystemBmp; +Handle CurrentVisitedSystemBmp; +Handle VisitedShortRangeSystemBmp; +Handle ShipBmp[MAXSHIPTYPE+EXTRASHIPS]; +Handle DamagedShipBmp[MAXSHIPTYPE+EXTRASHIPS]; +Handle ShieldedShipBmp[MAXSHIPTYPE+EXTRASHIPS]; +Handle DamagedShieldedShipBmp[MAXSHIPTYPE+EXTRASHIPS]; +Handle IconBmp[5]; +BitmapPtr SystemBmpPtr; +BitmapPtr CurrentSystemBmpPtr; +BitmapPtr ShortRangeSystemBmpPtr; +BitmapPtr WormholeBmpPtr; +BitmapPtr SmallWormholeBmpPtr; +BitmapPtr VisitedSystemBmpPtr; +BitmapPtr CurrentVisitedSystemBmpPtr; +BitmapPtr VisitedShortRangeSystemBmpPtr; +BitmapPtr ShipBmpPtr[MAXSHIPTYPE+EXTRASHIPS]; +BitmapPtr DamagedShipBmpPtr[MAXSHIPTYPE+EXTRASHIPS]; +BitmapPtr ShieldedShipBmpPtr[MAXSHIPTYPE+EXTRASHIPS]; +BitmapPtr DamagedShieldedShipBmpPtr[MAXSHIPTYPE+EXTRASHIPS]; +BitmapPtr IconBmpPtr[5]; + +unsigned long GalacticChartUpdateTicks = 0; +Handle NameH; +//DmOpenRef pmDB; + +// The following globals are saved between sessions +// Note that these initializations are overruled by the StartNewGame function +long Credits = 1000; // Current credits owned +long Debt = 0; // Current Debt +long BuyPrice[MAXTRADEITEM]; // Price list current system +long BuyingPrice[MAXTRADEITEM]; // Total price paid for trade goods +long SellPrice[MAXTRADEITEM]; // Price list current system +long ShipPrice[MAXSHIPTYPE]; // Price list current system (recalculate when buy ship screen is entered) +long PoliceKills = 0; // Number of police ships killed +long TraderKills = 0; // Number of trader ships killed +long PirateKills = 0; // Number of pirate ships killed +long PoliceRecordScore = 0; // 0 = Clean record +long ReputationScore = 0; // 0 = Harmless +long MonsterHull = 500; // Hull strength of monster + +int Days = 0; // Number of days playing +int WarpSystem = 0; // Target system for warp +int SelectedShipType = 0; // Selected Ship type for Shiptype Info screen +int CheatCounter = 0; +int GalacticChartSystem = 0; // Current system on Galactic chart +int EncounterType = 0; // Type of current encounter +int CurForm = 0; // Form to return to +int NoClaim = 0; // Days of No-Claim +int LeaveEmpty = 0; // Number of cargo bays to leave empty when buying goods +int NewsSpecialEventCount = 0; // Simplifies tracking what Quests have just been initiated or completed for the News System. This is not important enough to get saved. +int TrackedSystem = -1; // The short-range chart will display an arrow towards this system if the value is not -1 + +int Shortcut1 = 0; // default shortcut 1 = Buy Cargo +int Shortcut2 = 1; // default shortcut 2 = Sell Cargo +int Shortcut3 = 2; // default shortcut 3 = Shipyard +int Shortcut4 = 10; // default shortcut 4 = Short Range Warp + + +// the next two values are NOT saved between sessions -- they can only be changed via cheats. +int ChanceOfVeryRareEncounter = CHANCEOFVERYRAREENCOUNTER; +int ChanceOfTradeInOrbit = CHANCEOFTRADEINORBIT; + +Byte MonsterStatus = 0; // 0 = Space monster isn't available, 1 = Space monster is in Acamar system, 2 = Space monster is destroyed +Byte DragonflyStatus = 0; // 0 = Dragonfly not available, 1 = Go to Baratas, 2 = Go to Melina, 3 = Go to Regulas, 4 = Go to Zalkon, 5 = Dragonfly destroyed +Byte JaporiDiseaseStatus = 0; // 0 = No disease, 1 = Go to Japori (always at least 10 medicine cannisters), 2 = Assignment finished or canceled +Byte Difficulty = NORMAL; // Difficulty level +Byte JarekStatus = 0; // Ambassador Jarek 0=not delivered; 1=on board; 2=delivered +Byte InvasionStatus = 0; // Status Alien invasion of Gemulon; 0=not given yet; 1-7=days from start; 8=too late +Byte ExperimentStatus = 0; // Experiment; 0=not given yet,1-11 days from start; 12=performed, 13=cancelled +Byte FabricRipProbability = 0; // if Experiment = 8, this is the probability of being warped to a random planet. +Byte VeryRareEncounter = 0; // bit map for which Very Rare Encounter(s) have taken place (see traveler.c, around line 1850) +Byte WildStatus = 0; // Jonathan Wild: 0=not delivered; 1=on board; 2=delivered +Byte ReactorStatus = 0; // Unstable Reactor Status: 0=not encountered; 1-20=days of mission (bays of fuel left = 10 - (ReactorStatus/2); 21=delivered +Byte ScarabStatus = 0; // Scarab: 0=not given yet, 1=not destroyed, 2=destroyed, upgrade not performed, 3=destroyed, hull upgrade performed + +Boolean AutoFuel = false; // Automatically get a full tank when arriving in a new system +Boolean AutoRepair = false; // Automatically get a full hull repair when arriving in a new system +Boolean Clicks = 0; // Distance from target system, 0 = arrived +Boolean Raided = false; // True when the commander has been raided during the trip +Boolean Inspected = false; // True when the commander has been inspected during the trip +Boolean MoonBought = false; // Indicates whether a moon is available at Utopia +Boolean EscapePod = false; // Escape Pod in ship +Boolean Insurance = false; // Insurance bought +Boolean AlwaysIgnoreTraders = false; // Automatically ignores traders when it is safe to do so +Boolean AlwaysIgnorePolice = true; // Automatically ignores police when it is safe to do so +Boolean AlwaysIgnorePirates = false; // Automatically ignores pirates when it is safe to do so +Boolean AlwaysIgnoreTradeInOrbit = false; // Automatically ignores Trade in Orbit when it is safe to do so +Boolean ArtifactOnBoard = false; // Alien artifact on board +Boolean ReserveMoney = false; // Keep enough money for insurance and mercenaries +Boolean PriceDifferences = false; // Show price differences instead of absolute prices +Boolean APLscreen = false; // Is true is the APL screen was last shown after the SRC +Boolean TribbleMessage = false; // Is true if the Ship Yard on the current system informed you about the tribbles +Boolean AlwaysInfo = false; // Will always go from SRC to Info +Boolean TextualEncounters = false; // Show encounters as text. +Boolean AutoAttack = false; // Auto-attack mode +Boolean AutoFlee = false; // Auto-flee mode +Boolean Continuous = false; // Continuous attack/flee mode +Boolean AttackIconStatus = false; // Show Attack Star or not +Boolean AttackFleeing = false; // Continue attack on fleeing ship +Boolean PossibleToGoThroughRip = false; // if Dr Fehler's experiment happened, we can only go through one space-time rip per warp. +Boolean UseHWButtons = false; // by default, don't use Hardware W buttons +Boolean NewsAutoPay = false; // by default, ask each time someone buys a newspaper +Boolean ShowTrackedRange = true; // display range when tracking a system on Short Range Chart +Boolean JustLootedMarie = 0; // flag to indicate whether player looted Marie Celeste +Boolean ArrivedViaWormhole = false; // flag to indicate whether player arrived on current planet via wormhole +Boolean AlreadyPaidForNewspaper = false; // once you buy a paper on a system, you don't have to pay again. +Boolean TrackAutoOff = true; // Automatically stop tracking a system when you get to it? +Boolean RemindLoans = true; // remind you every five days about outstanding loan balances +Boolean CanSuperWarp = false; // Do you have the Portable Singularity on board? +Boolean GameLoaded = false; // Indicates whether a game is loaded +Boolean LitterWarning = false; // Warning against littering has been issued. +Boolean SharePreferences = true; // Share preferences between switched games. +Boolean IdentifyStartup = false; // Identify commander at game start +Boolean RectangularButtonsOn = false; // Indicates on OS 5.0 and higher whether rectangular buttons should be used. + +HIGHSCORE Hscores[MAXHIGHSCORE]; + +DWord romVersion; + diff --git a/Src/Gray.h b/Src/Gray.h new file mode 100644 index 0000000..f3f0bc9 --- /dev/null +++ b/Src/Gray.h @@ -0,0 +1 @@ +#define BPP4 1 \ No newline at end of file diff --git a/Src/Math.c b/Src/Math.c new file mode 100644 index 0000000..9683be1 --- /dev/null +++ b/Src/Math.c @@ -0,0 +1,112 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Math.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// Math.c +// ************************************************************************* + +#include "external.h" + +// ************************************************************************* +// Temporary implementation of square root +// ************************************************************************* +int sqrt( int a ) +{ + int i; + + i = 0; + while (SQR( i ) < a) + ++i; + if (i > 0) + if ((SQR( i ) - a) > (a - SQR( i-1 ))) + --i; + return( i ); +} + +// ************************************************************************* +// Square of the distance between two solar systems +// ************************************************************************* +long SqrDistance( SOLARSYSTEM a, SOLARSYSTEM b ) +{ + return (SQR( a.X - b.X ) + SQR( a.Y - b.Y )); +} + + +// ************************************************************************* +// Distance between two solar systems +// ************************************************************************* +long RealDistance( SOLARSYSTEM a, SOLARSYSTEM b ) +{ + return (sqrt( SqrDistance( a, b ) )); +} + + +// ************************************************************************* +// Pieter's new random functions, tweaked a bit by SjG +// ************************************************************************* + +#define DEFSEEDX 521288629 +#define DEFSEEDY 362436069 + +static UInt16 SeedX = DEFSEEDX; +static UInt16 SeedY = DEFSEEDY; + +int GetRandom2(int maxVal) +{ + return (int)(Rand() % maxVal); +} + +UInt16 Rand() +{ + static UInt16 a = 18000; + static UInt16 b = 30903; + + SeedX = a*(SeedX&MAX_WORD) + (SeedX>>16); + SeedY = b*(SeedY&MAX_WORD) + (SeedY>>16); + + return ((SeedX<<16) + (SeedY&MAX_WORD)); +} + +void RandSeed( UInt16 seed1, UInt16 seed2 ) +{ + if (seed1) + SeedX = seed1; /* use default seeds if parameter is 0 */ + else + SeedX = DEFSEEDX; + + if (seed2) + SeedY = seed2; + else + SeedY = DEFSEEDY; +} diff --git a/Src/Merchant.c b/Src/Merchant.c new file mode 100644 index 0000000..f2736b4 --- /dev/null +++ b/Src/Merchant.c @@ -0,0 +1,989 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Merchant.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// Needed to determine the height and width of a bitmap below OS version 4.0. +// The direct access is only used below 4.0, otherwise the BmpGetDimensions function is used. +#ifndef ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS +#define ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS 1 +#endif + +#include "external.h" +//#include + +#define ourMinVersion sysMakeROMVersion(2,0,0,sysROMStageRelease,0) +void UnpackBooleans(Byte _val, Boolean *_a, Boolean *_b, Boolean *_c, Boolean *_d, + Boolean *_e, Boolean *_f, Boolean *_g, Boolean *_h); +Byte PackBooleans(Boolean _a, Boolean _b, Boolean _c, Boolean _d, + Boolean _e, Boolean _f, Boolean _g, Boolean _h); +Byte PackBytes(Byte _a, Byte _b); +void UnpackBytes(Byte _val, Byte *_a, Byte *_b); + +#define BELOW35 (romVersion < sysMakeROMVersion( 3, 5, 0, sysROMStageRelease, 0 )) +#define BELOW40 (romVersion < sysMakeROMVersion( 4, 0, 0, sysROMStageRelease, 0 )) + +static char* SAVEGAMENAME = "SpaceTraderSave"; +static char* SWITCHGAMENAME = "SpaceTraderSwitch"; + +// ************************************************************************* +// Get width of bitmap +// ************************************************************************* +int GetBitmapWidth( BitmapPtr BmpPtr ) +{ + Coord W; + + if (BELOW40) + return BmpPtr->width; + else + { + BmpGetDimensions( BmpPtr, &W, 0, 0 ); + return W; + } +} + +// ************************************************************************* +// Get heigth of bitmap +// ************************************************************************* +int GetBitmapHeight( BitmapPtr BmpPtr ) +{ + Coord H; + + if (BELOW40) + return BmpPtr->height; + else + { + BmpGetDimensions( BmpPtr, 0, &H, 0 ); + return H; + } +} +// ************************************************************************* +// Determines if the OS supports this resolution +// ************************************************************************* +static Err GraphicsSupport( void ) +{ +#ifdef BPP1 + + return 0; + +#else + UInt32 depth, reqmode, reqmodedec; + +#ifdef BPP8 + Boolean color; +#endif + +#ifdef BPP16 + Boolean color; +#endif + + DWord romVersion; + + // See if we're on in minimum required version of the ROM or later. + FtrGet( sysFtrCreator, sysFtrNumROMVersion, &romVersion ); + + if (BELOW35) + { + FrmAlert( ErrGraphicsSupportAlert ); + return 1; + } + +#ifdef BPP16 + if (BELOW40) + { + FrmAlert( ErrGraphicsSupport40Alert ); + return 1; + } +#endif + +#ifdef BPP16 + reqmode = 0x8000; + reqmodedec = 16; +#else +#ifdef BPP8 + reqmode = 0x0080; + reqmodedec = 8; +#else // BPP4 + reqmode = 0x0008; + reqmodedec = 4; +#endif +#endif + +#ifndef BPP4 + WinScreenMode( winScreenModeGetSupportsColor, NULL, NULL, NULL, &color ); + if (!color) + { + FrmAlert( ErrGraphicsSupportAlert ); + return 1; + } +#endif + + WinScreenMode( winScreenModeGetSupportedDepths, NULL, NULL, &depth, NULL ); + + if (((reqmode & depth) == 0) || (WinScreenMode( winScreenModeSet, NULL, NULL, &reqmodedec, NULL ))) + { + FrmAlert( ErrGraphicsSupportAlert ); + return 1; + } + + return( 0 ); + +#endif +} + +/*********************************************************************** + * Resets the screen depth to default values. + ***********************************************************************/ +static void EndGraphicsSupport( void ) +{ +#ifndef BPP1 + + WinScreenMode( winScreenModeSetToDefaults, NULL, NULL, NULL, NULL ); + +#endif + + return; +} + +// ************************************************************************* +// Determines if the ROM version is compatible +// ************************************************************************* +Err RomVersionCompatible(DWord requiredVersion, Word launchFlags) +{ + DWord romVersion; + + // See if we're on in minimum required version of the ROM or later. + FtrGet( sysFtrCreator, sysFtrNumROMVersion, &romVersion ); + if (romVersion < requiredVersion) + { + if ((launchFlags & (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) == + (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) + { + FrmAlert (RomIncompatibleAlert); + + // Pilot 1.0 will continuously relaunch this app unless we switch to + // another safe one. + if (romVersion < sysMakeROMVersion( 2,0,0,sysROMStageRelease,0 )) + AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL); + } + + return (sysErrRomIncompatible); + + } + + return (0); +} + + +// ************************************************************************* +// Determines if the software is outdated +// ************************************************************************* +Err OutdatedSoftware( void ) +{ +#ifdef BETATEST + ULong Secs; + DateTimeType Dt; + DateTimePtr DtP; + + Dt.year = 2002; + Dt.month = 12; + Dt.day = 31; + Dt.hour = 0; + Dt.minute = 0; + Dt.second = 0; + + DtP = &Dt; + Secs = TimDateTimeToSeconds( DtP ); + if (Secs < TimGetSeconds()) + { + FrmAlert( OutdatedSoftwareAlert ); + return( 1 ); + } +#endif + return( 0 ); +} + +// Fills global variables +static void FillGlobals( SAVEGAMETYPE* sg, int State ) +{ + int i; + Boolean OldVersion = false; + Boolean Trash; + + if (sg->VersionMinor < 4) + OldVersion = true; + + Credits = sg->Credits; + Debt = sg->Debt; + Days = sg->Days; + WarpSystem = sg->WarpSystem; + SelectedShipType = sg->SelectedShipType; + for (i=0; iBuyPrice[i]; + SellPrice[i] = sg->SellPrice[i]; + } + for (i=0; iShipPrice[i]; + GalacticChartSystem = sg->GalacticChartSystem; + PoliceKills = sg->PoliceKills; + TraderKills = sg->TraderKills; + PirateKills = sg->PirateKills; + PoliceRecordScore = sg->PoliceRecordScore; + ReputationScore = sg->ReputationScore; + Clicks = sg->Clicks; + EncounterType = sg->EncounterType; + Raided = sg->Raided; + MonsterStatus = sg->MonsterStatus; + DragonflyStatus = sg->DragonflyStatus; + JaporiDiseaseStatus = sg->JaporiDiseaseStatus; + MoonBought = sg->MoonBought; + MonsterHull = sg->MonsterHull; + StrCopy( NameCommander, sg->NameCommander ); + CurForm = sg->CurForm; + MemMove( &Ship, &(sg->Ship), sizeof( Ship ) ); + MemMove( &Opponent, &(sg->Opponent), sizeof( Opponent) ); + for (i=0; iMercenary[i]), sizeof( Mercenary[i] ) ); + for (i=0; iSolarSystem[i]), sizeof( SolarSystem[i] ) ); + EscapePod = sg->EscapePod; + Insurance = sg->Insurance; + NoClaim = sg->NoClaim; + Inspected = sg->Inspected; + LitterWarning = sg->LitterWarning; + Difficulty = sg->Difficulty; + for (i=0; iWormhole[i]; + for (i=0; iBuyingPrice[i]; + ArtifactOnBoard = sg->ArtifactOnBoard; + JarekStatus = sg->JarekStatus; + InvasionStatus = sg->InvasionStatus; + + if (OldVersion) + { + ExperimentStatus = 0; + FabricRipProbability = 0; + VeryRareEncounter = 0; + WildStatus = 0; + ReactorStatus = 0; + TrackedSystem = -1; + JustLootedMarie = false; + AlreadyPaidForNewspaper = false; + GameLoaded = false; + // if Nix already has a special, we have to get rid of the + // spurious GETREACTOR quest. + if (SolarSystem[NIXSYSTEM].Special == -1) + SolarSystem[NIXSYSTEM].Special = REACTORDELIVERED; + else + { + for (i=0;iExperimentAndWildStatus, &ExperimentStatus,&WildStatus); + FabricRipProbability = sg->FabricRipProbability; + VeryRareEncounter = sg->VeryRareEncounter; + SharePreferences = sg->SharePreferences; + + if (State != 2 || !SharePreferences) + UnpackBooleans(sg->BooleanCollection, &UseHWButtons, &NewsAutoPay, + &ShowTrackedRange, &JustLootedMarie, &ArrivedViaWormhole, &TrackAutoOff, + &RemindLoans, &CanSuperWarp); + else + UnpackBooleans(sg->BooleanCollection, &Trash, &Trash, + &Trash, &JustLootedMarie, &ArrivedViaWormhole, &Trash, + &Trash, &CanSuperWarp); + + ReactorStatus = sg-> ReactorStatus; + TrackedSystem = sg->TrackedSystem; + ScarabStatus = sg->ScarabStatus; + AlreadyPaidForNewspaper = sg->AlreadyPaidForNewspaper; + GameLoaded = sg->GameLoaded; + + if (State != 2 || !SharePreferences) + { + AlwaysIgnoreTradeInOrbit = sg->AlwaysIgnoreTradeInOrbit; + Shortcut1 = sg->Shortcut1; + Shortcut2 = sg->Shortcut2; + Shortcut3 = sg->Shortcut3; + Shortcut4 = sg->Shortcut4; + IdentifyStartup = sg->IdentifyStartup; + RectangularButtonsOn = sg->RectangularButtonsOn; + } + } + + if (State != 2 || !SharePreferences) + { + ReserveMoney = sg->ReserveMoney; + PriceDifferences = sg->PriceDifferences; + APLscreen = sg->APLscreen; + TribbleMessage = sg->TribbleMessage; + AlwaysInfo = sg->AlwaysInfo; + LeaveEmpty = sg->LeaveEmpty; + TextualEncounters = sg->TextualEncounters; + Continuous = sg->Continuous; + AttackFleeing = sg->AttackFleeing; + AutoFuel = sg->AutoFuel; + AutoRepair = sg->AutoRepair; + AlwaysIgnoreTraders = sg->AlwaysIgnoreTraders; + AlwaysIgnorePolice = sg->AlwaysIgnorePolice; + AlwaysIgnorePirates = sg->AlwaysIgnorePirates; + } + + SolarSystem[UTOPIASYSTEM].Special = MOONBOUGHT; +} + +// Load game and returns true if OK +Boolean LoadGame( int State ) +{ + Word prefsSize; + SWord prefsVersion = noPreferenceFound; + SAVEGAMETYPE* sg; + Handle sgH; + Boolean DontLoad = false; + UInt index = 0; + VoidHand RecHandle; + VoidPtr RecPointer; + LocalID DbId; + DmOpenRef pmDB; + + sgH = MemHandleNew( sizeof( SAVEGAMETYPE ) ); + sg = MemHandleLock( sgH ); + + if (State == 0) + { + prefsSize = sizeof( SAVEGAMETYPE ); + prefsVersion = PrefGetAppPreferences ( appFileCreator, appPrefID, sg, &prefsSize, true ); + + if (prefsVersion > 1) + prefsVersion = noPreferenceFound; + + if (prefsVersion == noPreferenceFound) + { + CurForm = MainForm; + DontLoad = true; + } + } + else + { + DbId = DmFindDatabase( 0, (State == 1 ? SAVEGAMENAME : SWITCHGAMENAME ) ); + if (DbId == 0) + { + if (State == 1) + FrmAlert( CannotLoadAlert ); + MemPtrUnlock( sg ); + MemHandleFree( sgH ); + return false; + } + pmDB = DmOpenDatabase( 0, DbId, dmModeReadWrite ); + RecHandle = DmGetRecord( pmDB, 0 ); + if (RecHandle == NULL) + { + if (State == 1) + FrmAlert( CannotLoadAlert ); + DmReleaseRecord( pmDB, 0, true ); + DmCloseDatabase( pmDB ); + MemPtrUnlock( sg ); + MemHandleFree( sgH ); + return false; + } + RecPointer = MemHandleLock( RecHandle ); + MemMove( sg, RecPointer, sizeof( SAVEGAMETYPE ) ); + MemHandleUnlock( RecHandle ); + DmReleaseRecord( pmDB, 0, true ); + DmCloseDatabase( pmDB ); + } + + if (!DontLoad) + FillGlobals( sg, State ); + + MemPtrUnlock( sg ); + MemHandleFree( sgH ); + + return true; +} + + +// ************************************************************************* +// Get the current application's preferences. +// ************************************************************************* +static Err AppStart(void) +{ + FtrGet( sysFtrCreator, sysFtrNumROMVersion, &romVersion ); + + LoadGame( 0 ); + + ChanceOfVeryRareEncounter = CHANCEOFVERYRAREENCOUNTER; + ChanceOfTradeInOrbit = CHANCEOFTRADEINORBIT; + + return 0; +} + + +// ************************************************************************* +// Pack two limited range bytes into a two nibbles (a single byte) for storage. +// Use this with caution -- it doesn't check that the values are really +// within the range of 0-15 +// ************************************************************************* +Byte PackBytes(Byte a, Byte b) +{ + return (Byte)(a<<4 | (b & (Byte)0x0F)); +} + +// ************************************************************************* +// Unpack two limited range bytes from a single byte from storage. +// High order 4 bits become Byte a, low order 4 bits become Byte b +// ************************************************************************* +void UnpackBytes(Byte val, Byte *a, Byte *b) +{ + *a = val >> 4; + *b = val & (Byte) 15; // 0x0F +} + + +// ************************************************************************* +// Pack eight booleans into a single byte for storage. +// ************************************************************************* +Byte PackBooleans(Boolean a, Boolean b, Boolean c, Boolean d, + Boolean e, Boolean f, Boolean g, Boolean h) +{ + Byte retByte = 0; + if (a) retByte |= (Byte)128; // 0x80 + if (b) retByte |= (Byte) 64; // 0x40 + if (c) retByte |= (Byte) 32; // 0x20 + if (d) retByte |= (Byte) 16; // etc. + if (e) retByte |= (Byte) 8; + if (f) retByte |= (Byte) 4; + if (g) retByte |= (Byte) 2; + if (h) retByte |= (Byte) 1; + return retByte; +} + +// ************************************************************************* +// unpack eight booleans from a single byte out of storage. +// ************************************************************************* +void UnpackBooleans(Byte val, Boolean *a, Boolean *b, Boolean *c, Boolean *d, + Boolean *e, Boolean *f, Boolean *g, Boolean *h) +{ + + if ( val & (Byte)128 ) + *a = true; + else + *a = false; + if (val & (Byte) 64 ) + *b = true; + else + *b = false; + if (val & (Byte) 32 ) + *c = true; + else + *c = false; + if (val & (Byte) 16 ) + *d = true; + else + *d = false; + if (val & (Byte) 8 ) + *e = true; + else + *e = false; + if (val & (Byte) 4 ) + *f = true; + else + *f = false; + if (val & (Byte) 2 ) + *g = true; + else + *g = false; + if (val & (Byte) 1 ) + *h = true; + else + *h = false; + +} + +// Save the game, either in the Statesave or in a file +Boolean SaveGame( int State ) +{ + int i; + SAVEGAMETYPE* sg; + Handle sgH; + Err err; + VoidHand RecHandle; + LocalID DbId; + UInt index = 0; + VoidPtr p; + DmOpenRef pmDB; + Word theAttrs; + + sgH = MemHandleNew( sizeof( SAVEGAMETYPE ) ); + sg = MemHandleLock( sgH ); + + sg->Credits = Credits; + sg->Debt = Debt; + sg->Days = Days; + sg->WarpSystem = WarpSystem; + sg->SelectedShipType = SelectedShipType; + for (i=0; iBuyPrice[i] = BuyPrice[i]; + sg->SellPrice[i] = SellPrice[i]; + } + for (i=0; iShipPrice[i] = ShipPrice[i]; + sg->GalacticChartSystem = GalacticChartSystem; + sg->PoliceKills = PoliceKills; + sg->TraderKills = TraderKills; + sg->PirateKills = PirateKills; + sg->PoliceRecordScore = PoliceRecordScore; + sg->ReputationScore = ReputationScore; + sg->AutoFuel = AutoFuel; + sg->AutoRepair = AutoRepair; + sg->Clicks = Clicks; + sg->EncounterType = EncounterType; + sg->Raided = Raided; + sg->MonsterStatus = MonsterStatus; + sg->DragonflyStatus = DragonflyStatus; + sg->JaporiDiseaseStatus = JaporiDiseaseStatus; + sg->MoonBought = MoonBought; + sg->MonsterHull = MonsterHull; + StrCopy( sg->NameCommander, NameCommander ); + sg->CurForm = CurForm; + MemMove( &(sg->Ship), &Ship, sizeof( sg->Ship ) ); + MemMove( &(sg->Opponent), &Opponent, sizeof( sg->Opponent ) ); + for (i=0; iMercenary[i]), &Mercenary[i], sizeof( sg->Mercenary[i] ) ); + for (i=0; iSolarSystem[i]), &SolarSystem[i], sizeof( sg->SolarSystem[i] ) ); + for (i=0; iForFutureUse[i] = 0; + sg->EscapePod = EscapePod; + sg->Insurance = Insurance; + sg->NoClaim = NoClaim; + sg->Inspected = Inspected; + sg->LitterWarning = LitterWarning; + sg->AlwaysIgnoreTraders = AlwaysIgnoreTraders; + sg->AlwaysIgnorePolice = AlwaysIgnorePolice; + sg->AlwaysIgnorePirates = AlwaysIgnorePirates; + sg->Difficulty = Difficulty; + sg->VersionMajor = 1; + // changed from 3 to 4. SjG + sg->VersionMinor = 4; + for (i=0; iWormhole[i] = Wormhole[i]; + for (i=0; iBuyingPrice[i] = BuyingPrice[i]; + sg->ArtifactOnBoard = ArtifactOnBoard; + sg->ReserveMoney = ReserveMoney; + sg->PriceDifferences = PriceDifferences; + sg->APLscreen = APLscreen; + sg->TribbleMessage = TribbleMessage; + sg->AlwaysInfo = AlwaysInfo; + sg->LeaveEmpty = LeaveEmpty; + sg->TextualEncounters = TextualEncounters; + sg->JarekStatus = JarekStatus; + sg->InvasionStatus = InvasionStatus; + sg->Continuous = Continuous; + sg->AttackFleeing = AttackFleeing; + sg->ExperimentAndWildStatus = PackBytes(ExperimentStatus, WildStatus); + sg->FabricRipProbability = FabricRipProbability; + sg->VeryRareEncounter = VeryRareEncounter; + sg->BooleanCollection = PackBooleans(UseHWButtons, NewsAutoPay, + ShowTrackedRange, JustLootedMarie, ArrivedViaWormhole, TrackAutoOff, + RemindLoans, CanSuperWarp); + sg->ReactorStatus = ReactorStatus; + sg->TrackedSystem = TrackedSystem; + sg->ScarabStatus = ScarabStatus; + sg->AlwaysIgnoreTradeInOrbit = AlwaysIgnoreTradeInOrbit; + sg->AlreadyPaidForNewspaper = AlreadyPaidForNewspaper; + sg->GameLoaded = GameLoaded; + sg->SharePreferences = SharePreferences; + sg->IdentifyStartup = IdentifyStartup; + sg->Shortcut1 = Shortcut1; + sg->Shortcut2 = Shortcut2; + sg->Shortcut3 = Shortcut3; + sg->Shortcut4 = Shortcut4; + sg->RectangularButtonsOn = RectangularButtonsOn; + + if (State == 0) + PrefSetAppPreferences( appFileCreator, appPrefID, appPrefVersionNum, + sg, sizeof( SAVEGAMETYPE ), true ); + else + { + if (State == 2) + { + if (!LoadGame( 2 )) + NameCommander[0] = '\0'; + } + + DbId = DmFindDatabase( 0, (State == 1 ? SAVEGAMENAME : SWITCHGAMENAME ) ); + if (DbId == 0) + { + err = DmCreateDatabase( 0, (State == 1 ? SAVEGAMENAME : SWITCHGAMENAME ), appFileCreator, 'Data', false ); + if (err != errNone) + { + FrmAlert( (State == 1 ? CannotSaveAlert : CannotSwitchAlert ) ); + if (State == 2) + FillGlobals( sg, State ); + MemPtrUnlock( sg ); + MemHandleFree( sgH ); + return false; + } + DbId = DmFindDatabase( 0, (State == 1 ? SAVEGAMENAME : SWITCHGAMENAME ) ); + if (DbId == 0) + { + FrmAlert( (State == 1 ? CannotSaveAlert : CannotSwitchAlert ) ); + if (State == 2) + FillGlobals( sg, State ); // Restore previous setting + MemPtrUnlock( sg ); + MemHandleFree( sgH ); + return false; + } + + pmDB = DmOpenDatabase( 0, DbId, dmModeReadWrite ); + RecHandle = DmNewRecord( pmDB, &index, sizeof( SAVEGAMETYPE ) ); + DmWrite( MemHandleLock( RecHandle ), 0, sg, sizeof( SAVEGAMETYPE ) ); + MemHandleUnlock( RecHandle ); + } + else + { + pmDB = DmOpenDatabase( 0, DbId, dmModeReadWrite ); + p = MemHandleLock( DmGetRecord( pmDB, 0 ) ); + DmWrite( p, 0, sg, sizeof( SAVEGAMETYPE ) ); + MemPtrUnlock( p ); + } + + DmReleaseRecord( pmDB, 0, true ); + + // Get the attributes for our database + DmDatabaseInfo( 0, DbId, NULL, &theAttrs, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + // Set the backup flag + theAttrs |= dmHdrAttrBackup; + + // Set the attributes + DmSetDatabaseInfo( 0, DbId, NULL, &theAttrs, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + DmCloseDatabase( pmDB ); + } + + MemPtrUnlock( sg ); + MemHandleFree( sgH ); + + return true; +} + +// ************************************************************************* +// Save the current state of the application. +// ************************************************************************* +static void AppStop(void) +{ + SaveGame( 0 ); + FrmCloseAllForms(); +} + +// ************************************************************************* +// This routine is the event loop for the application. +// ************************************************************************* +static void AppEventLoop(void) +{ + Word error; + EventType event; + UInt32 LastTicks; + + do + { + if (Continuous && (AutoAttack || AutoFlee) && (CurForm == EncounterForm)) + { + LastTicks = TimGetTicks(); + + EvtGetEvent( &event, SysTicksPerSecond()); + + if (event.eType == nilEvent && + (3 * (TimGetTicks() - LastTicks) > 2 * SysTicksPerSecond())) + { + EncounterFormHandleEvent( &event ); + continue; + } + } + else + EvtGetEvent(&event, evtWaitForever); + + if ( (UseHWButtons && event.eType == keyDownEvent && (event.data.keyDown.chr == vchrHard1 || + event.data.keyDown.chr == vchrHard2 || event.data.keyDown.chr == vchrHard3 || + event.data.keyDown.chr == vchrHard4) ) || + !SysHandleEvent(&event)) + if (!MenuHandleEvent(0, &event, &error)) + if (!AppHandleEvent(&event)) + FrmDispatchEvent(&event); + + if (CurForm != EncounterForm) + { + AutoAttack = false; + AutoFlee = false; + } + + } while (event.eType != appStopEvent); +} + +// ************************************************************************* +// This routine is the event handler for the Start screen. +// ************************************************************************* +Boolean MainFormHandleEvent(EventPtr eventP) +{ + Boolean handled = false; + FormPtr frmP = FrmGetActiveForm(); + + switch (eventP->eType) + { + case frmOpenEvent: + FrmDrawForm ( frmP); + handled = true; + break; + + case frmUpdateEvent: + FrmDrawForm ( frmP ); + handled = true; + break; + + // Start new game + case penDownEvent: + case keyDownEvent: + StartNewGame(); + handled = true; + break; + + default: + break; + } + + return handled; +} + + +// ************************************************************************* +// Handling of the events of several forms. +// ************************************************************************* +Boolean DefaultFormHandleEvent(EventPtr eventP) +{ + Boolean handled = false; + FormPtr frmP = FrmGetActiveForm(); + + switch (eventP->eType) + { + case frmOpenEvent: + FrmDrawForm ( frmP); + handled = true; + break; + case frmUpdateEvent: + FrmDrawForm ( frmP ); + handled = true; + break; + } + + return handled; +} + + +// ************************************************************************* +// This is the main application. +// ************************************************************************* +long MerchantPilotMain( Word cmd, Ptr cmdPBP, Word launchFlags ) +{ + Err error; + int i; + + switch (cmd) + { + case sysAppLaunchCmdNormalLaunch: + error = RomVersionCompatible (ourMinVersion, launchFlags); + if (error) + return error; + + error = OutdatedSoftware(); + if (error) + return error; + + error = GraphicsSupport(); + if (error) + return error; + + SystemBmp = DmGetResource( bitmapRsc, SystemBitmapFamily ); + SystemBmpPtr = MemHandleLock( SystemBmp ); + CurrentSystemBmp = DmGetResource( bitmapRsc, CurrentSystemBitmapFamily ); + CurrentSystemBmpPtr = MemHandleLock( CurrentSystemBmp ); + ShortRangeSystemBmp = DmGetResource( bitmapRsc, ShortRangeSystemBitmapFamily ); + ShortRangeSystemBmpPtr = MemHandleLock( ShortRangeSystemBmp ); + WormholeBmp = DmGetResource( bitmapRsc, WormholeBitmapFamily ); + WormholeBmpPtr = MemHandleLock( WormholeBmp ); + SmallWormholeBmp = DmGetResource( bitmapRsc, SmallWormholeBitmapFamily ); + SmallWormholeBmpPtr = MemHandleLock( SmallWormholeBmp ); + VisitedSystemBmp = DmGetResource( bitmapRsc, VisitedSystemBitmapFamily ); + VisitedSystemBmpPtr = MemHandleLock( VisitedSystemBmp ); + CurrentVisitedSystemBmp = DmGetResource( bitmapRsc, CurrentVisitedSystemBitmapFamily ); + CurrentVisitedSystemBmpPtr = MemHandleLock( CurrentVisitedSystemBmp ); + VisitedShortRangeSystemBmp = DmGetResource( bitmapRsc, VisitedShortRangeSystemBitmapFamily ); + VisitedShortRangeSystemBmpPtr = MemHandleLock( VisitedShortRangeSystemBmp ); + + // Load bitmaps for the ships (4 Bitmap Family Groups Per Ship) FleaBitmapFamily is the Base + for (i=0; i=0; i--) + { + MemHandleUnlock( IconBmp[i] ); + DmReleaseResource( IconBmp[i] ); + } + + for (i=MAXSHIPTYPE+EXTRASHIPS-1; i>=0; i--) + { + if (Shiptype[i].ShieldSlots > 0) + { + MemHandleUnlock( DamagedShieldedShipBmp[i] ); + DmReleaseResource( DamagedShieldedShipBmp[i] ); + MemHandleUnlock( ShieldedShipBmp[i] ); + DmReleaseResource( ShieldedShipBmp[i] ); + } + MemHandleUnlock( DamagedShipBmp[i] ); + DmReleaseResource( DamagedShipBmp[i] ); + MemHandleUnlock( ShipBmp[i] ); + DmReleaseResource( ShipBmp[i] ); + } + + MemHandleUnlock( VisitedShortRangeSystemBmp ); + DmReleaseResource( VisitedShortRangeSystemBmp ); + MemHandleUnlock( CurrentVisitedSystemBmp ); + DmReleaseResource( CurrentVisitedSystemBmp ); + MemHandleUnlock( VisitedSystemBmp ); + DmReleaseResource( VisitedSystemBmp ); + MemHandleUnlock( SmallWormholeBmp ); + DmReleaseResource( SmallWormholeBmp ); + MemHandleUnlock( WormholeBmp ); + DmReleaseResource( WormholeBmp ); + MemHandleUnlock( ShortRangeSystemBmp ); + DmReleaseResource( ShortRangeSystemBmp ); + MemHandleUnlock( CurrentSystemBmp ); + DmReleaseResource( CurrentSystemBmp ); + MemHandleUnlock( SystemBmp ); + DmReleaseResource( SystemBmp ); + break; + + default: + break; + } + + EndGraphicsSupport(); + return 0; +} + +// ************************************************************************* +// This is the main entry point for the application. +// ************************************************************************* +DWord PilotMain( Word cmd, Ptr cmdPBP, Word launchFlags) +{ + return MerchantPilotMain(cmd, cmdPBP, launchFlags); +} diff --git a/Src/Money.c b/Src/Money.c new file mode 100644 index 0000000..2decc85 --- /dev/null +++ b/Src/Money.c @@ -0,0 +1,71 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Money.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +#include "external.h" +// ************************************************************************* +// Functions Include: +// +// long CurrentWorth( void ) +// void PayInterest( void ) +// + +// ************************************************************************* +// Current worth of commander +// ************************************************************************* +long CurrentWorth( void ) +{ + return (CurrentShipPrice( false ) + Credits - Debt + (MoonBought ? COSTMOON : 0)); +} + + +// ************************************************************************* +// Pay interest on debt +// ************************************************************************* +void PayInterest( void ) +{ + long IncDebt; + + if (Debt > 0) + { + IncDebt = max( 1, Debt / 10 ); + if (Credits > IncDebt) + Credits -= IncDebt; + else + { + Debt += (IncDebt - Credits); + Credits = 0; + } + } +} + diff --git a/Src/OtherEvent.c b/Src/OtherEvent.c new file mode 100644 index 0000000..17ad255 --- /dev/null +++ b/Src/OtherEvent.c @@ -0,0 +1,164 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * OtherEvent.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// +// Special Cargo Screen Event Handler +// +// ************************************************************************* +#include "external.h" + +static Boolean MessageHasBeenShown = false; + +static void DrawSpecialCargoForm() +{ + FormPtr frmP; + int Line; + + frmP = FrmGetActiveForm(); + + RectangularShortcuts( frmP, SpecialCargoBButton ); + + FrmDrawForm( frmP ); + + Line = 18; + + FntSetFont ( stdFont ); + if (Ship.Tribbles > 0) + { + if (Ship.Tribbles >= MAXTRIBBLES) + StrCopy( SBuf, "An infestation of tribbles." ); + else + { + StrCopy( SBuf, "" ); + SBufMultiples( Ship.Tribbles, "cute, furry tribble" ); + StrCat( SBuf, "." ); + } + DrawChars (SBuf, 0, Line); + Line += 14; + } + + if (JaporiDiseaseStatus == 1) + { + DrawChars( "10 bays of antidote.", 0, Line); + Line += 14; + } + if (ArtifactOnBoard) + { + DrawChars( "An alien artifact.", 0, Line); + Line += 14; + } + if (JarekStatus == 2) + { + DrawChars( "A haggling computer.", 0, Line); + Line += 14; + } + if (ReactorStatus > 0 && ReactorStatus < 21) + { + DrawChars( "An unstable reactor taking up 5 bays.", 0, Line); + Line += 14; + StrCopy( SBuf, "" ); + SBufMultiples( 10 - ((ReactorStatus - 1) / 2), "bay" ); + StrCat( SBuf, " of enriched fuel." ); + DrawChars (SBuf, 0, Line); + Line += 14; + + } + if (CanSuperWarp) + { + DrawChars( "A Portable Singularity.", 0, Line); + Line += 14; + } + + + if (Line == 18) + { + DrawChars ("No special items.", 0, Line); + } + +} + + +Boolean SpecialCargoFormHandleEvent( EventPtr eventP ) +{ + Boolean handled = false; + + switch (eventP->eType) + { + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID ==SpecialCargoStatusButton) + { + CurForm = CommanderStatusForm; + } + else if (eventP->data.ctlSelect.controlID == SpecialCargoShipButton) + { + CurForm = CurrentShipForm; + } + else if (eventP->data.ctlSelect.controlID == SpecialCargoQuestsButton) + { + CurForm = QuestsForm; + } + FrmGotoForm( CurForm ); + handled = true; + break; + + case frmOpenEvent: + case frmUpdateEvent: + DrawSpecialCargoForm(); + handled = true; + break; + + default: + break; + } + + return handled; +} + + +/*********************************************************************** + * Show message shows a general message, usually for debugging. + ***********************************************************************/ +void ShowMessage( char *str1, char* str2, char* str3, Boolean ShowAlways ) +{ + if (MessageHasBeenShown && !ShowAlways) + return; + + FrmCustomAlert( GeneralMessageAlert, str1, str2, str3 ); + + MessageHasBeenShown = true; + + return; +} + diff --git a/Src/Prototype.h b/Src/Prototype.h new file mode 100644 index 0000000..b976e2e --- /dev/null +++ b/Src/Prototype.h @@ -0,0 +1,278 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Prototype.h + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// Prototype.h +// All Function prototypes are defined here and can be referenced +// from any source file. Functions are referenced from multiple +// sources. + +// Shipyard.c +extern void BuyRepairs( int _Amount ); +extern Boolean ShipYardFormHandleEvent( EventPtr eventP ); +extern long GetHullStrength( void ); + +// Math.c +extern int sqrt( int _a ); +extern long SqrDistance( SOLARSYSTEM _a, SOLARSYSTEM _b ); +extern long RealDistance( SOLARSYSTEM _a, SOLARSYSTEM _b ); +extern UInt16 Rand(); +extern void RandSeed( UInt16 _seed1, UInt16 _seed2 ); +extern int GetRandom2(int _maxVal); + +// Money.c +extern long CurrentWorth(); +extern void PayInterest(); + +// Field.c +extern Handle SetField( FormPtr _frm, int _Nr, char* _Value, int _Size, Boolean _Focus ); +extern void GetField( FormPtr _frm, int _Nr, char* _Value, Handle _AmountH ); +extern void SetCheckBox( FormPtr _frm, int _Nr, Boolean _Value ); +extern Boolean GetCheckBox( FormPtr _frm, int _Nr ); +extern void SetTriggerList( FormPtr _frm, int _Nr, int _Index ); +extern int GetTriggerList( FormPtr _frm, int _Nr); +extern void SetControlLabel( FormPtr _frm, int _Nr, Char * _Label ); + + +// Fuel.c +extern char GetFuelTanks(); +extern char GetFuel(); +extern void BuyFuel( int _Amount ); + +// Skill.c +extern char TraderSkill( SHIP* _Sh ); +extern void RecalculateBuyPrices(Byte SystemID); +extern void IncreaseRandomSkill(); +extern void TonicTweakRandomSkill(); +extern char FighterSkill( SHIP* _Sh ); +extern char PilotSkill( SHIP* _Sh ); +extern char EngineerSkill( SHIP* _Sh ); +extern char AdaptDifficulty( char _Level ); +extern void RecalculateSellPrices(); +extern char RandomSkill(); +extern Boolean HasGadget( SHIP* _Sh, char _Gg ); +extern Boolean HasShield( SHIP* _Sh, char _Gg ); +extern Boolean HasWeapon( SHIP* _Sh, char _Gg, Boolean _exactMatch ); +extern Byte NthLowestSkill( SHIP* _Sh, Byte _n ); +extern int DifficultyRange(int _low, int _high); + +// Draw.c +extern void DrawShortRange( int _Index ); +extern void DrawCircle( int _Xs, int _Ys, int _R ); +extern void DrawGalaxy( int _Index ); +extern ControlPtr RectangularButton( FormPtr _frmP, int _Nr ); +extern void SBufMultiples( long _Count, char* _Txt ); +extern void SBufShortMultiples( long _Count, char* _Txt ); +extern void setFormTitle( int _formID, CharPtr _s ); +extern void setCurrentWinTitle( CharPtr _s ); +extern void setLabelText( FormPtr _frm, int _labelid, CharPtr _s ); +extern void RectangularShortcuts( FormPtr _frm, int _First ); +extern void EraseRectangle( int _x, int _y, int _ex, int _ey ); +extern void DrawChars( char* _Text, int _x, int _y ); +extern void DrawCharsCentered( char* _Text, int _y, Boolean _useBold ); +extern int ScrollButton( EventPtr _eventP ); +extern Boolean DisplayHeadline(char* _text, int* _y_coord); +extern void DisplayPage(char* _text, int _start_y); + +// Cargo.c +// Note the following four functions must stay together +// These functions use QtyBuf which cannot be referenced externally +// in it's current form. +// ------------------------------------------------------------------ +extern void DisplayTradeQuantity( int Line, int Qty, int FirstQtyButton ); +extern Boolean PlunderFormHandleEvent( EventPtr eventP ); +extern Boolean BuyCargoFormHandleEvent(EventPtr eventP); +extern Boolean SellCargoFormHandleEvent( EventPtr eventP ); +// ------------------------------------------------------------------ +extern int GetAmountToBuy( int Index ); // used in Traveler.c also + +extern void PlunderCargo( int _Index, int _Amount ); +extern int GetAmountToPlunder( int _Index ); +extern void BuyCargo( int _Index, int _Amount, Boolean _DisplayInfo ); +extern void SellCargo( int _Index, int _Amount, Byte Operation ); +extern void DisplayTradeItemName( int _i, Byte Operation ); +extern int TotalCargoBays(); +extern int FilledCargoBays(); +extern void DisplayPlunderCargoBays(); +extern void BuyItem( char _Slots, int* _Item, long _Price, char* _Name, int _ItemIndex ); +extern long BasePrice( char _ItemTechLevel, long _Price ); +extern long BaseSellPrice( int _Index, long _Price ); +extern void DrawSellEquipment(); +extern void SBufBays( void ); +extern void DisplayTradeCargoBays(); +extern void DisplayTradeCredits(); +extern void DisplayDumpCredits(); +extern Boolean HasTradeableItems (SHIP *_sh, Byte _theSystem, Byte _Operation); +extern int GetRandomTradeableItem (SHIP *_sh, Byte _Operation); + + +// Encounter.c +extern Boolean EncounterFormHandleEvent( EventPtr _eventP ); +extern long TotalWeapons( SHIP* _Sh, int _minWeapon, int _maxWeapon ); // used in Traveler also +extern void ShowShip( SHIP* _Sh, int _offset, Boolean _commandersShip ); +extern void EscapeWithPod(); // used in IncDays for Reactor meltdown + +// Traveler.c +extern Boolean AveragePricesFormHandleEvent( EventPtr _eventP ); +extern Boolean RetireDestroyedUtopiaFormHandleEvent( EventPtr _eventP, char _EndStatus ); +extern Boolean UtopiaFormHandleEvent( EventPtr _eventP ); +extern Boolean RetireFormHandleEvent( EventPtr _eventP ); +extern Boolean ExecuteWarpFormHandleEvent(EventPtr _eventP); +extern Boolean AnyEmptySlots( SHIP* _ship ); +extern void DoWarp(Boolean _viaSingularity ); //referenced in WarpForm for the Singularity. +extern void Travel(); +extern Boolean StartNewGame(); +extern Boolean WormholeExists( int _a, int _b ); +extern void Arrival(); +extern Boolean Cloaked( SHIP* _Sh, SHIP* _Opp ); +extern int GetFirstEmptySlot( char _Slots, int* _Item ); +extern void IncDays( int _Amount ); +extern void ViewHighScores( void ); +extern long GetScore( char EndStatus, int Days, long Worth, char Level ); // Traveler.c +extern long InsuranceMoney(); +extern long ToSpend(); + +// ShipPrice.c +extern long EnemyShipPrice( SHIP* Sh ); +extern long CurrentShipPriceWithoutCargo( Boolean _ForInsurance ); +extern long CurrentShipPrice( Boolean _ForInsurance ); + +// BuyShipEvent.c +extern void CreateFlea(); +extern Boolean BuyShipFormHandleEvent( EventPtr _eventP ); + +// SystemInfoEvent.c +extern void DrawPersonnelRoster(); +extern Boolean SystemInformationFormHandleEvent( EventPtr _eventP ); +extern Boolean NewspaperFormHandleEvent( EventPtr _eventP ); +extern void addNewsEvent(int _eventFlag); +extern void resetNewsEvents(); +extern Boolean isNewsEvent(int _eventFlag); +extern void replaceNewsEvent(int _originalEventFlag, int _replacementEventFlag); +extern int latestNewsEvent(); + +// Merchant +Boolean Savegame( int State ); +Boolean LoadGame( int State ); +GetBitmapWidth( BitmapPtr BmpPtr ); +int GetBitmapHeight( BitmapPtr BmpPtr ); + +// Form Event Handlers +extern void ShowMessage( char *str1, char* str2, char* str3, Boolean ShowAlways ); +extern void ShowDumpCargo( void ); +extern int OpenQuests( void ); +extern Boolean MainFormHandleEvent( EventPtr _eventP ); +extern Boolean NewCommanderFormHandleEvent( EventPtr _eventP); +extern Boolean QuestsFormHandleEvent( EventPtr _eventP ); +extern Boolean GalacticChartFormHandleEvent( EventPtr _eventP ); +extern Boolean WarpFormHandleEvent( EventPtr _eventP ); +extern Boolean ExecuteWarpFormHandleEvent( EventPtr _eventP ); +extern Boolean BuyEquipmentFormHandleEvent( EventPtr eventP ); +extern Boolean SellEquipmentFormHandleEvent( EventPtr _eventP ); +extern Boolean ShiptypeInfoFormHandleEvent( EventPtr _eventP ); +extern Boolean PersonnelRosterFormHandleEvent( EventPtr _eventP ); +extern Boolean SpecialEventFormHandleEvent( EventPtr _eventP ); +extern Boolean CommanderStatusFormHandleEvent( EventPtr _eventP ); +extern Boolean BankFormHandleEvent( EventPtr _eventP ); +extern Boolean CurrentShipFormHandleEvent( EventPtr _eventP ); +extern Boolean RetireFormHandleEvent( EventPtr _eventP ); +extern Boolean UtopiaFormHandleEvent( EventPtr _eventP ); +extern Boolean DestroyedFormHandleEvent( EventPtr _eventP ); +extern Boolean AppHandleEvent( EventPtr _eventP); +extern Boolean SpecialEventFormHandleEvent( EventPtr _eventP ); +extern Boolean SpecialCargoFormHandleEvent( EventPtr _eventP ); +extern Boolean DiscardCargoFormHandleEvent( EventPtr _eventP ); + +// ---------------------------------------------------------- +// Static Functions and their locations +// Function Name Module +// ---------------------------------------------------------- +// Err AppStart(); // merchant.c +// void AppStop(); // merchant.c +// Boolean DockedFormDoCommand(Word _command); // AppHandleEvent.c + +// void ShowBank( void ) // Bank.c +// long MaxLoan( void ) // Bank.c +// void GetLoan( long _Loan ); // Bank.c +// void PayBack( long _Cash ); // Bank.c + +// char AvailableQuarters( void ) // SystemInfoEvent.c +// int GetForHire(); // SystemInfoEvent.c +// void DrawMercenary( int Index, int y ) // SystemInfoEvent.c +// static int GetForHire( void ) // SystemInfoEvent.c + +// long TotalShields( SHIP* _Sh ); // Encounter.c +// long TotalShieldStrength( SHIP* _Sh ); // Encounter.c +// void ShowShip(SHIP* _Sh, int _offset); // Encounter.c +// Boolean ExecuteAttack( SHIP* _Attacker, SHIP* _Defender, Boolean _Flees, Boolean _CommanderUnderAttack ); // Encounter.c +// int ExecuteAction( Boolean _CommanderFlees ); // Encounter.c +// void Arrested(); // Encounter.c +// void EscapeWithPod(); // Encounter.c +// void Scoop(); // Encounter.c +// void EncounterButtons( void ) // Encounter.c + +// void DetermineShipPrices(); // BuyShipEvent.c +// void BuyShip( int _Index ); // BuyShipEvent.c +// void CreateShip ( int _Index ); // BuyShipEvent.c +// void NewCommanderDrawSkills(); // NewCmdrEvent.c + +// void ShowCommanderStatus(); // CmdrStatusEvent.c +// void DisplaySkill( int Skill, int AdaptedSkill, FormPtr frmP, long Label ) // CmdrStatusEvent.c + +// void ShowAveragePrices(); // Traveler.c +// void ShuffleStatus(); // Traveler.c +// void DeterminePrices(Byte SystemID); // Traveler.c +// void GenerateOpponent( char _Opp ); // Traveler.c +// void ChangeQuantities(); // Traveler.c +// void InitializeTradeitems( const int _Index ); // Traveler.c +// void ShowExecuteWarp( void ); // Traveler.c +// void InitHighScores (void); // Traveler.c +// Err CreateEmptyHighscoreTable( void ); // Traveler.c +// Err OpenDatabase( void ); // Traveler.c +// void ClearHighScores( void ); // Traveler.c +// long WormholeTax( int a, int b ) // Traveler.c +// int MercenaryMoney(); // Traveler.c +// extern long StandardPrice( char _Good, char _Size, char _Tech, char _Government, int _Resources ); // Traveler.c +// int NextSystemWithinRange(int Current, Boolean Back); // Traveler.c + +// void DrawShortRange( int Index ) // WarpFormEvent.c +// void DrawCircle( int Xs, int Ys, int R ) // WarpFormEvent.c +// void DrawGalaxy( int Index ) // WarpFormEvent.c + +// int GetAmountToSell( int Index ) // Trader.c + +// int GetAmountForFuel( void ) // Shipyard.c +// int GetAmountForRepairs( void ) // Shipyard.c +// void ShowShipYard(); // Shipyard.c + +// void DrawItem( char* Name, int y, long Price ) // BuyEquipEvent.c \ No newline at end of file diff --git a/Src/QuestEvent.c b/Src/QuestEvent.c new file mode 100644 index 0000000..b22eab4 --- /dev/null +++ b/Src/QuestEvent.c @@ -0,0 +1,280 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * QuestEvent.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// +// Quests Screen Event Handler +// +// ************************************************************************* +#include "external.h" + +// Returns number of open quests. +int OpenQuests( void ) +{ + int r = 0; + + if (MonsterStatus == 1) + ++r; + + if (DragonflyStatus >= 1 && DragonflyStatus <= 4) + ++r; + else if (SolarSystem[ZALKONSYSTEM].Special == INSTALLLIGHTNINGSHIELD) + ++r; + + if (JaporiDiseaseStatus == 1) + ++r; + + if (ArtifactOnBoard) + ++r; + + if (WildStatus == 1) + ++r; + + if (JarekStatus == 1) + ++r; + + if (InvasionStatus >= 1 && InvasionStatus < 7) + ++r; + else if (SolarSystem[GEMULONSYSTEM].Special == GETFUELCOMPACTOR) + ++r; + + if (ExperimentStatus >= 1 && ExperimentStatus < 11) + ++r; + + if (ReactorStatus >= 1 && ReactorStatus < 21) + ++r; + + if (SolarSystem[NIXSYSTEM].Special == GETSPECIALLASER) + ++r; + + if (ScarabStatus == 1) + ++r; + + if (Ship.Tribbles > 0) + ++r; + + if (MoonBought) + ++r; + + return r; +} + +static void DrawQuestsForm() +{ + FormPtr frmP; + int Line; + frmP = FrmGetActiveForm(); + + RectangularShortcuts( frmP, QuestsBButton ); + + FrmDrawForm( frmP ); + + FntSetFont( stdFont ); + + Line = 18; + + if (MonsterStatus == 1) + { + DrawChars( "Kill the space monster at Acamar.", 0, Line ); + Line += 16; + } + + if (DragonflyStatus >= 1 && DragonflyStatus <= 4) + { + StrCopy( SBuf, "Follow the Dragonfly to " ); + if (DragonflyStatus == 1) + StrCat( SBuf, "Baratas." ); + else if (DragonflyStatus == 2) + StrCat( SBuf, "Melina." ); + else if (DragonflyStatus == 3) + StrCat( SBuf, "Regulas." ); + else if (DragonflyStatus == 4) + StrCat( SBuf, "Zalkon." ); + DrawChars( SBuf, 0, Line ); + Line += 16; + } + else if (SolarSystem[ZALKONSYSTEM].Special == INSTALLLIGHTNINGSHIELD) + { + DrawChars( "Get your lightning shield at Zalkon.", 0, Line ); + Line += 16; + } + + if (JaporiDiseaseStatus == 1) + { + DrawChars( "Deliver antidote to Japori.", 0, Line ); + Line += 16; + } + + if (ArtifactOnBoard) + { + DrawChars( "Deliver the alien artifact to professor", 0, Line ); + Line += 12; + DrawChars( "Berger at some hi-tech system.", 0, Line ); + Line += 16; + } + if (WildStatus == 1) + { + DrawChars( "Smuggle Jonathan Wild to Kravat.", 0, Line ); + Line += 16; + } + + if (JarekStatus == 1) + { + DrawChars( "Bring ambassador Jarek to Devidia.", 0, Line ); + Line += 16; + } + + // I changed this, and the reused the code in the Experiment quest. + // I think it makes more sense to display the time remaining in + // this fashion. SjG 10 July 2002 + if (InvasionStatus >= 1 && InvasionStatus < 7) + { + DrawChars( "Inform Gemulon about alien invasion", 0, Line ); + Line += 12; + if (InvasionStatus == 6) + StrCopy( SBuf, "by tomorrow" ); + else + { + StrCopy( SBuf, "within " ); + SBufMultiples( 7 - InvasionStatus, "day" ); + } + StrCat( SBuf, "." ); + DrawChars( SBuf, 0, Line ); + Line += 16; + } + else if (SolarSystem[GEMULONSYSTEM].Special == GETFUELCOMPACTOR) + { + DrawChars( "Get your fuel compactor at Gemulon.", 0, Line ); + Line += 16; + } + + if (ExperimentStatus >= 1 && ExperimentStatus < 11) + { + DrawChars( "Stop Dr. Fehler's experiment at Daled", 0, Line ); + Line += 12; + if (ExperimentStatus == 10) + StrCopy( SBuf, "by tomorrow" ); + else + { + StrCopy( SBuf, "within " ); + SBufMultiples( 11 - ExperimentStatus, "day" ); + } + StrCat( SBuf, "." ); + DrawChars( SBuf, 0, Line ); + Line += 16; + } + + if (ReactorStatus >= 1 && ReactorStatus < 21) + { + DrawChars( "Deliver the unstable reactor to Nix", 0, Line ); + Line += 12; + if (ReactorStatus < 2) + { + DrawChars( "for Henry Morgan.", 0, Line ); + } + else + { + DrawChars( "before it consumes all its fuel.", 0, Line ); + } + Line += 16; + } + + if (SolarSystem[NIXSYSTEM].Special == GETSPECIALLASER) + { + DrawChars( "Get your special laser at Nix.", 0, Line ); + Line += 16; + } + + if (ScarabStatus == 1) + { + DrawChars( "Find and destroy the Scarab (which", 0, Line ); + Line += 12; + DrawChars( "is hiding at the exit to a wormhole).", 0, Line ); + Line += 16; + } + + if (Ship.Tribbles > 0) + { + DrawChars( "Get rid of those pesky tribbles.", 0, Line ); + Line += 16; + } + + if (MoonBought) + { + DrawChars( "Claim your moon at Utopia.", 0, Line ); + Line += 16; + } + + if (Line <= 18) + DrawChars( "There are no open quests.", 0, Line ); +} + +Boolean QuestsFormHandleEvent( EventPtr eventP ) +{ + Boolean handled = false; + + switch (eventP->eType) + { + case frmOpenEvent: + case frmUpdateEvent: + DrawQuestsForm(); + handled = true; + break; + + + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID == QuestsStatusButton) + { + CurForm = CommanderStatusForm; + } + else if (eventP->data.ctlSelect.controlID == QuestsShipButton) + { + CurForm = CurrentShipForm; + } + else if (eventP->data.ctlSelect.controlID == QuestsSpecialButton) + { + CurForm = SpecialCargoForm; + } + + FrmGotoForm( CurForm ); + handled = true; + break; + + default: + break; + } + + return handled; +} + diff --git a/Src/SellEquipEvent.c b/Src/SellEquipEvent.c new file mode 100644 index 0000000..8b2a85f --- /dev/null +++ b/Src/SellEquipEvent.c @@ -0,0 +1,124 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * SellEquipEvent.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// Handling of the events of the Sell Equipment form. +// ************************************************************************* +#include "external.h" + +Boolean SellEquipmentFormHandleEvent( EventPtr eventP ) +{ + Boolean handled = false; + Boolean Sale; + FormPtr frmP; + int i; + + switch (eventP->eType) + { + case frmOpenEvent: + DrawSellEquipment(); + handled = true; + break; + + case frmUpdateEvent: + DrawSellEquipment(); + handled = true; + break; + + case ctlSelectEvent: + if (FrmAlert( SellItemAlert ) != SellItemYes) + { + handled = true; + break; + } + + frmP = FrmGetActiveForm(); + + Sale = true; + + if (eventP->data.ctlSelect.controlID >= SellEquipmentSell0Button && + eventP->data.ctlSelect.controlID < SellEquipmentSell0Button+MAXWEAPON) + { + Credits += WEAPONSELLPRICE( eventP->data.ctlSelect.controlID - SellEquipmentSell0Button ); + for (i=eventP->data.ctlSelect.controlID - SellEquipmentSell0Button + 1; idata.ctlSelect.controlID >= SellEquipmentSell0Button+MAXWEAPON && + eventP->data.ctlSelect.controlID < SellEquipmentSell0Button+MAXWEAPON+MAXSHIELD) + { + Credits += SHIELDSELLPRICE( eventP->data.ctlSelect.controlID - SellEquipmentSell0Button - MAXWEAPON ); + for (i=eventP->data.ctlSelect.controlID - SellEquipmentSell0Button - MAXWEAPON + 1; idata.ctlSelect.controlID >= SellEquipmentSell0Button+MAXWEAPON+MAXSHIELD && + eventP->data.ctlSelect.controlID < SellEquipmentSell0Button+MAXWEAPON+MAXSHIELD+MAXGADGET) + { + if (Ship.Gadget[eventP->data.ctlSelect.controlID - SellEquipmentSell0Button - MAXWEAPON - MAXSHIELD] == EXTRABAYS) + { + if (FilledCargoBays() > TotalCargoBays() - 5) + { + FrmAlert( CargoBaysFullAlert ); + Sale = false; + } + } + + if (Sale) + { + Credits += GADGETSELLPRICE( eventP->data.ctlSelect.controlID - SellEquipmentSell0Button - MAXWEAPON - MAXSHIELD ); + for (i=eventP->data.ctlSelect.controlID - SellEquipmentSell0Button - MAXWEAPON - MAXSHIELD + 1; i 0) + { + SBuf[0] = '\0'; + SBufMultiples( j, Weapontype[i].Name ); + StrToLower( SBuf2, SBuf ); + DrawChars( SBuf2, 60, Line ); + Line += 14; + } + } + + for (i=0; i 0) + { + SBuf[0] = '\0'; + SBufMultiples( j, Shieldtype[i].Name ); + StrToLower( SBuf2, SBuf ); + DrawChars( SBuf2, 60, Line ); + Line += 14; + } + } + for (i=0; i 0) + { + if (i == EXTRABAYS) + { + j = j*5; + StrIToA( SBuf, j ); + StrCat( SBuf, " extra cargo bays" ); + } + else + { + StrCopy(SBuf, Gadgettype[i].Name ); + } + StrToLower( SBuf2, SBuf ); + DrawChars( SBuf2, 60, Line ); + Line += 14; + } + } + + if (EscapePod) + { + DrawChars( "an escape pod", 60, Line ); + Line += 14; + } + + if (AnyEmptySlots(&Ship)) + { + FntSetFont( boldFont ); + DrawChars( "Unfilled: ", 0, Line ); + + FntSetFont( stdFont ); + + FirstEmptySlot = GetFirstEmptySlot( Shiptype[Ship.Type].WeaponSlots, Ship.Weapon ); + if (FirstEmptySlot >= 0) + { + SBuf[0] = '\0'; + SBufMultiples( Shiptype[Ship.Type].WeaponSlots - FirstEmptySlot, "weapon slot" ); + DrawChars( SBuf, 60, Line ); + Line += 14; + } + + FirstEmptySlot = GetFirstEmptySlot( Shiptype[Ship.Type].ShieldSlots, Ship.Shield ); + if (FirstEmptySlot >= 0) + { + SBuf[0] = '\0'; + SBufMultiples( Shiptype[Ship.Type].ShieldSlots - FirstEmptySlot, "shield slot" ); + DrawChars( SBuf, 60, Line ); + Line += 14; + } + + FirstEmptySlot = GetFirstEmptySlot( Shiptype[Ship.Type].GadgetSlots, Ship.Gadget ); + if (FirstEmptySlot >= 0) + { + SBuf[0] = '\0'; + SBufMultiples( Shiptype[Ship.Type].GadgetSlots - FirstEmptySlot, "gadget slot" ); + DrawChars( SBuf, 60, Line ); + Line += 14; + } + } + +} + + +// ************************************************************************* +// Event handler for the Current Ship screen +// ******************************************************************** +Boolean CurrentShipFormHandleEvent( EventPtr eventP ) +{ + Boolean handled = false; + + switch (eventP->eType) + { + + case frmOpenEvent: + case frmUpdateEvent: + DrawCurrentShipForm(); + handled = true; + break; + + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID == CurrentShipStatusButton) + { + CurForm = CommanderStatusForm; + } + else if (eventP->data.ctlSelect.controlID == CurrentShipQuestsButton) + { + CurForm = QuestsForm; + } + else if (eventP->data.ctlSelect.controlID == CurrentShipSpecialButton) + { + CurForm = SpecialCargoForm; + } + + FrmGotoForm( CurForm ); + handled = true; + break; + + default: + break; + } + + return handled; +} \ No newline at end of file diff --git a/Src/ShipPrice.c b/Src/ShipPrice.c new file mode 100644 index 0000000..3bb0f27 --- /dev/null +++ b/Src/ShipPrice.c @@ -0,0 +1,112 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Shipprice.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// ShipPrice.c - Functions include: +// long CurrentShipPriceWithoutCargo( Boolean ForInsurance ) +// long CurrentShipPrice( Boolean ForInsurance ) +// +// Modifications: +// mm/dd/yy - description - author +// ************************************************************************* + +#include "external.h" + +// ************************************************************************* +// Determine value of ship +// ************************************************************************* +long EnemyShipPrice( SHIP* Sh ) +{ + int i; + long CurPrice; + + CurPrice = Shiptype[Sh->Type].Price; + for (i=0; iWeapon[i] >= 0) + CurPrice += Weapontype[Sh->Weapon[i]].Price; + for (i=0; iShield[i] >= 0) + CurPrice += Shieldtype[Sh->Shield[i]].Price; + // Gadgets aren't counted in the price, because they are already taken into account in + // the skill adjustment of the price. + + CurPrice = CurPrice * (2 * PilotSkill( Sh ) + EngineerSkill( Sh ) + 3 * FighterSkill( Sh )) / 60; + + return CurPrice; +} + +// ************************************************************************* +// Determine value of current ship, including equipment. +// ************************************************************************* +long CurrentShipPriceWithoutCargo( Boolean ForInsurance ) +{ + int i; + long CurPrice; + + CurPrice = + // Trade-in value is three-fourths the original price + ((Shiptype[Ship.Type].Price * (Ship.Tribbles > 0 && !ForInsurance? 1 : 3)) / 4) + // subtract repair costs + - (GetHullStrength() - Ship.Hull) * Shiptype[Ship.Type].RepairCosts + // subtract costs to fill tank with fuel + - (Shiptype[Ship.Type].FuelTanks - GetFuel()) * Shiptype[Ship.Type].CostOfFuel; + // Add 2/3 of the price of each item of equipment + for (i=0; i= 0) + CurPrice += WEAPONSELLPRICE( i ); + for (i=0; i= 0) + CurPrice += SHIELDSELLPRICE( i ); + for (i=0; i= 0) + CurPrice += GADGETSELLPRICE( i ); + + return CurPrice; +} + + +// ************************************************************************* +// Determine value of current ship, including goods and equipment. +// ************************************************************************* +long CurrentShipPrice( Boolean ForInsurance ) +{ + int i; + long CurPrice; + + CurPrice = CurrentShipPriceWithoutCargo( ForInsurance ); + for (i=0; i>1), + 83+((48-GetBitmapHeight( ShipBmpPtr[SelectedShipType] ))>>1) ); +} + +Boolean ShiptypeInfoFormHandleEvent( EventPtr eventP ) +{ + Boolean handled = false; + + switch (eventP->eType) + { + case frmOpenEvent: + case frmUpdateEvent: + DrawShiptypeInfoForm(); + handled = true; + break; + + case ctlSelectEvent: + CurForm = BuyShipForm; + FrmGotoForm( CurForm ); + handled = true; + break; + + default: + break; + } + + return handled; +} diff --git a/Src/Shipyard.c b/Src/Shipyard.c new file mode 100644 index 0000000..18256ff --- /dev/null +++ b/Src/Shipyard.c @@ -0,0 +1,330 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Shipyard.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// Shipyard.c - Shipyard Module. +// +// Boolean ShipYardFormHandleEvent( EventPtr eventP ) +// void BuyRepairs( int Amount ) +// +// Static Local Functions +// ------------------------------- +// int GetAmountForRepairs( void ) +// int GetAmountForFuel( void ) +// void ShowShipYard( void ) +// +// ************************************************************************* + +#include "external.h" + +// ************************************************************************* +// Let the commander indicate how much he wants to spend on repairs +// ************************************************************************* +static int GetAmountForRepairs( void ) +{ + FormPtr frm; + int d, Amount; + Handle AmountH; + + frm = FrmInitForm( BuyRepairsForm ); + + AmountH = (Handle) SetField( frm, BuyRepairsForRepairsField, "", 5, true ); + + d = FrmDoDialog( frm ); + + GetField( frm, BuyRepairsForRepairsField, SBuf, AmountH ); + if (SBuf[0] == '\0') + Amount = 0; + else + Amount = StrAToI( SBuf ); + + FrmDeleteForm( frm ); + + if (d == BuyFuelAllButton) + return( 9999 ); + else if (d == BuyFuelNoneButton) + return( 0 ); + + return( Amount ); +} + +// ************************************************************************* +// Let the commander indicate how much he wants to spend on fuel +// ************************************************************************* +static int GetAmountForFuel( void ) +{ + FormPtr frm; + int d, Amount; + Handle AmountH; + + frm = FrmInitForm( BuyFuelForm ); + + AmountH = (Handle) SetField( frm, BuyFuelForFuelField, "", 4, true ); + + d = FrmDoDialog( frm ); + + GetField( frm, BuyFuelForFuelField, SBuf, AmountH ); + if (SBuf[0] == '\0') + Amount = 0; + else + Amount = StrAToI( SBuf ); + + FrmDeleteForm( frm ); + + if (d == BuyFuelAllButton) + return( 999 ); + else if (d == BuyFuelNoneButton) + return( 0 ); + + return( Amount ); +} + + +// ************************************************************************* +// Determine ship's hull strength +// ************************************************************************* +long GetHullStrength(void) +{ + if (ScarabStatus == 3) + return Shiptype[Ship.Type].HullStrength + UPGRADEDHULL; + else + return Shiptype[Ship.Type].HullStrength; +} + +// ************************************************************************* +// Display the Ship Yard form. +// Modified by SRA 04/19/01 - DisplayTradeCredits if Enabled +// ************************************************************************* +static void ShowShipYard( void ) +{ + FormPtr frmP; + + frmP = FrmGetActiveForm(); + + RectangularShortcuts( frmP, ShipYardBButton ); + + if (GetFuel() < GetFuelTanks()) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ShipYardBuyFuelButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ShipYardFullTankButton ) ); + } + else + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ShipYardBuyFuelButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ShipYardFullTankButton ) ); + } + + if (Ship.Hull < GetHullStrength()) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ShipYardRepairButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ShipYardFullRepairsButton ) ); + } + else + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ShipYardRepairButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ShipYardFullRepairsButton ) ); + } + + if (CURSYSTEM.TechLevel >= Shiptype[0].MinTechLevel) + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ShipYardShipInformationButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ShipYardBuyNewShipButton ) ); + } + else + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ShipYardBuyNewShipButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ShipYardShipInformationButton ) ); + } + if (EscapePod || ToSpend() < 2000 || CURSYSTEM.TechLevel < Shiptype[0].MinTechLevel) + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ShipYardEscapePodButton ) ); + else + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ShipYardEscapePodButton ) ); + + FrmDrawForm( frmP ); + + FntSetFont( stdFont ); + + EraseRectangle( 0, 18, 160, 25 ); + + StrCopy( SBuf, "You have fuel to fly " ); + SBufMultiples( GetFuel(), "parsec" ); + StrCat( SBuf, "." ); + DrawChars( SBuf, 0, 18 ); + + if (GetFuel() < GetFuelTanks()) + { + StrCopy( SBuf, "A full tank costs " ); + StrIToA( SBuf2, (GetFuelTanks() - GetFuel()) * Shiptype[Ship.Type].CostOfFuel ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " cr." ); + DrawChars( SBuf, 0, 30 ); + } + else + DrawChars( "Your tank cannot hold more fuel.", 0, 30 ); + + EraseRectangle( 0, 60, 160, 25 ); + + StrCopy( SBuf, "Your hull strength is at " ); + StrIToA( SBuf2, (Ship.Hull * 100) / GetHullStrength() ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, "%." ); + DrawChars( SBuf, 0, 60 ); + + if (Ship.Hull < GetHullStrength()) + { + StrCopy( SBuf, "Full repair will cost " ); + StrIToA( SBuf2, (GetHullStrength() - Ship.Hull) * + Shiptype[Ship.Type].RepairCosts ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " cr." ); + DrawChars( SBuf, 0, 72 ); + } + else + DrawChars( "No repairs are needed.", 0, 72 ); + + EraseRectangle( 0, 102, 160, 12 ); + + if (CURSYSTEM.TechLevel >= Shiptype[0].MinTechLevel) + DrawChars( "There are new ships for sale.", 0, 102 ); + else + DrawChars( "No new ships are for sale.", 0, 102 ); + + #ifdef _STRA_SHIPYARDCREDITS_ + DisplayTradeCredits(); // SRA 04/19/01 + #endif + + EraseRectangle( 0, 132, 160, 12 ); + + if (EscapePod) + DrawChars( "You have an escape pod installed.", 0, 132 ); + else if (CURSYSTEM.TechLevel < Shiptype[0].MinTechLevel) + DrawChars( "No escape pods are for sale.", 0, 132 ); + else if (ToSpend() < 2000) + DrawChars( "You need 2000 cr. for an escape pod.", 0, 132 ); + else + DrawChars( "You can buy an escape pod for 2000 cr.", 0, 132 ); + + +} +// ************************************************************************* +// Repair Ship for Amount credits +// ************************************************************************* +void BuyRepairs( int Amount ) +{ + int MaxRepairs; + int Percentage; + + MaxRepairs = (GetHullStrength() - Ship.Hull) * + Shiptype[Ship.Type].RepairCosts; + if (Amount > MaxRepairs) + Amount = MaxRepairs; + if (Amount > Credits) + Amount = Credits; + + Percentage = Amount / Shiptype[Ship.Type].RepairCosts; + + Ship.Hull += Percentage; + Credits -= Percentage * Shiptype[Ship.Type].RepairCosts; +} + +// ************************************************************************* +// Ship Yard Form Event Handler. +// ************************************************************************* +Boolean ShipYardFormHandleEvent( EventPtr eventP ) +{ + Boolean handled = false; + int Amount; + + switch (eventP->eType) + { + case frmOpenEvent: + ShowShipYard(); + handled = true; + break; + + case ctlSelectEvent: + switch (eventP->data.ctlSelect.controlID) + { + case ShipYardBuyFuelButton: + Amount = GetAmountForFuel(); + if (Amount > 0) + BuyFuel( Amount ); + ShowShipYard(); + break; + + case ShipYardFullTankButton: + BuyFuel( 999 ); + ShowShipYard(); + break; + + case ShipYardRepairButton: + Amount = GetAmountForRepairs(); + if (Amount > 0) + BuyRepairs( Amount ); + ShowShipYard(); + break; + + case ShipYardFullRepairsButton: + BuyRepairs( 9999 ); + ShowShipYard(); + break; + + case ShipYardBuyNewShipButton: + CurForm = BuyShipForm; + FrmGotoForm( CurForm ); + break; + + case ShipYardShipInformationButton: + CurForm = BuyShipForm; + FrmGotoForm( CurForm ); + break; + + case ShipYardEscapePodButton: + if (FrmAlert( BuyEscapePodAlert ) == BuyEscapePodYes) + { + Credits -= 2000; + EscapePod = true; + ShowShipYard(); + } + break; + } + handled = true; + break; + + default: + break; + } + + return handled; +} \ No newline at end of file diff --git a/Src/Skill.c b/Src/Skill.c new file mode 100644 index 0000000..8b7752d --- /dev/null +++ b/Src/Skill.c @@ -0,0 +1,437 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Skill.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// Skill.c - Functions in this module: +// +// char TraderSkill( SHIP* _Sh ); +// void RecalculateBuyPrices(Byte SystemID); +// void IncreaseRandomSkill(); +// char FighterSkill( SHIP* _Sh ); +// char PilotSkill( SHIP* _Sh ); +// char EngineerSkill( SHIP* _Sh ); +// char AdaptDifficulty( char _Level ); +// void RecalculateSellPrices(); +// char RandomSkill( void ) +// Boolean HasGadget( SHIP* Sh, char Gg ) +// Byte NthLowestSkill( SHIP* Sh, Byte n ) +// +// Modifications: +// mm/dd/yy - description - author +// ************************************************************************* + +#include "external.h" + + +// ************************************************************************* +// NthLowest Skill. Returns skill with the nth lowest score +// (i.e., 2 is the second worst skill). If there is a tie, it will return +// in the order of Pilot, Fighter, Trader, Engineer. +// ************************************************************************* +Byte NthLowestSkill( SHIP* Sh, Byte n ) +{ + Byte i = 0, lower = 1, retVal; + Boolean looping = true; + while (looping) + { + retVal = 0; + if (Mercenary[Sh->Crew[0]].Pilot == i) + { + if (lower == n) + { + looping = false; + retVal = PILOTSKILL; + } + + lower++; + } + if (Mercenary[Sh->Crew[0]].Fighter == i) + { + if (lower == n) + { + looping = false; + retVal = FIGHTERSKILL; + } + + lower++; + } + if (Mercenary[Sh->Crew[0]].Trader == i) + { + if (lower == n) + { + looping = false; + retVal = TRADERSKILL; + } + + lower++; + } + if (Mercenary[Sh->Crew[0]].Engineer == i) + { + if (lower == n) + { + looping = false; + retVal = ENGINEERSKILL; + } + + lower++; + } + i++; + } + return retVal; +} + +// ************************************************************************* +// Trader skill +// ************************************************************************* +char TraderSkill( SHIP* Sh ) +{ + int i; + char MaxSkill; + + MaxSkill = Mercenary[Sh->Crew[0]].Trader; + + for (i=1; iCrew[i] < 0) + break; + if (Mercenary[Sh->Crew[i]].Trader > MaxSkill) + MaxSkill = Mercenary[Sh->Crew[i]].Trader; + } + + if (JarekStatus >= 2) + ++MaxSkill; + + return AdaptDifficulty( MaxSkill ); +} + +// ************************************************************************* +// After changing the trader skill, buying prices must be recalculated. +// Revised to be callable on an arbitrary Solar System +// ************************************************************************* +void RecalculateBuyPrices( Byte SystemID ) +{ + int i; + + for (i=0; i= MAXSKILL && COMMANDER.Trader >= MAXSKILL && + COMMANDER.Fighter >= MAXSKILL && COMMANDER.Engineer >= MAXSKILL) + return; + + oldtraderskill = TraderSkill( &Ship ); + + Redo = true; + while (Redo) + { + d = (GetRandom( MAXSKILLTYPE )); + if ((d == 0 && COMMANDER.Pilot < MAXSKILL) || + (d == 1 && COMMANDER.Fighter < MAXSKILL) || + (d == 2 && COMMANDER.Trader < MAXSKILL) || + (d == 3 && COMMANDER.Engineer < MAXSKILL)) + Redo = false; + } + if (d == 0) + COMMANDER.Pilot += 1; + else if (d == 1) + COMMANDER.Fighter += 1; + else if (d == 2) + { + COMMANDER.Trader += 1; + if (oldtraderskill != TraderSkill( &Ship )) + RecalculateBuyPrices(COMMANDER.CurSystem); + } + else + COMMANDER.Engineer += 1; +} + +// ************************************************************************* +// Decrease one of the skills of the commander +// ************************************************************************* +void DecreaseRandomSkill( int amount ) +{ + Boolean Redo; + int d, oldtraderskill; + + if (COMMANDER.Pilot >= MAXSKILL && COMMANDER.Trader >= MAXSKILL && + COMMANDER.Fighter >= MAXSKILL && COMMANDER.Engineer >= MAXSKILL) + return; + + oldtraderskill = TraderSkill( &Ship ); + + Redo = true; + while (Redo) + { + d = (GetRandom( MAXSKILLTYPE )); + if ((d == 0 && COMMANDER.Pilot > amount) || + (d == 1 && COMMANDER.Fighter > amount) || + (d == 2 && COMMANDER.Trader > amount) || + (d == 3 && COMMANDER.Engineer > amount)) + Redo = false; + } + if (d == 0) + COMMANDER.Pilot -= amount; + else if (d == 1) + COMMANDER.Fighter -= amount; + else if (d == 2) + { + COMMANDER.Trader -= amount; + if (oldtraderskill != TraderSkill( &Ship )) + RecalculateBuyPrices(COMMANDER.CurSystem); + } + else + COMMANDER.Engineer -= amount; +} + + + +// ************************************************************************* +// Randomly tweak one of the skills of the commander +// ************************************************************************* +void TonicTweakRandomSkill( void ) +{ + int oldPilot, oldFighter, oldTrader, oldEngineer; + oldPilot = COMMANDER.Pilot; + oldFighter = COMMANDER.Fighter; + oldTrader = COMMANDER.Trader; + oldEngineer = COMMANDER.Engineer; + + if (Difficulty < HARD) + { + // add one to a random skill, subtract one from a random skill + while ( oldPilot == COMMANDER.Pilot && + oldFighter == COMMANDER.Fighter && + oldTrader == COMMANDER.Trader && + oldEngineer == COMMANDER.Engineer) + { + IncreaseRandomSkill(); + DecreaseRandomSkill(1); + } + } + else + { + // add one to two random skills, subtract three from one random skill + IncreaseRandomSkill(); + IncreaseRandomSkill(); + DecreaseRandomSkill(3); + } +} + + +// ************************************************************************* +// Fighter skill +// ************************************************************************* +char FighterSkill( SHIP* Sh ) +{ + int i; + char MaxSkill; + + MaxSkill = Mercenary[Sh->Crew[0]].Fighter; + + for (i=1; iCrew[i] < 0) + break; + if (Mercenary[Sh->Crew[i]].Fighter > MaxSkill) + MaxSkill = Mercenary[Sh->Crew[i]].Fighter; + } + + if (HasGadget( Sh, TARGETINGSYSTEM )) + MaxSkill += SKILLBONUS; + + return AdaptDifficulty( MaxSkill ); +} + +// ************************************************************************* +// Pilot skill +// ************************************************************************* +char PilotSkill( SHIP* Sh ) +{ + int i; + char MaxSkill; + + MaxSkill = Mercenary[Sh->Crew[0]].Pilot; + + for (i=1; iCrew[i] < 0) + break; + if (Mercenary[Sh->Crew[i]].Pilot > MaxSkill) + MaxSkill = Mercenary[Sh->Crew[i]].Pilot; + } + + if (HasGadget( Sh, NAVIGATINGSYSTEM )) + MaxSkill += SKILLBONUS; + if (HasGadget( Sh, CLOAKINGDEVICE )) + MaxSkill += CLOAKBONUS; + + return AdaptDifficulty( MaxSkill ); +} + +// ************************************************************************* +// Engineer skill +// ************************************************************************* +char EngineerSkill( SHIP* Sh ) +{ + int i; + char MaxSkill; + + MaxSkill = Mercenary[Sh->Crew[0]].Engineer; + + for (i=1; iCrew[i] < 0) + break; + if (Mercenary[Sh->Crew[i]].Engineer > MaxSkill) + MaxSkill = Mercenary[Sh->Crew[i]].Engineer; + } + + if (HasGadget( Sh, AUTOREPAIRSYSTEM )) + MaxSkill += SKILLBONUS; + + return AdaptDifficulty( MaxSkill ); +} + +// ************************************************************************* +// Adapt a skill to the difficulty level +// ************************************************************************* +char AdaptDifficulty( char Level ) +{ + if (Difficulty == BEGINNER || Difficulty == EASY) + return (Level+1); + else if (Difficulty == IMPOSSIBLE) + return max( 1, Level-1 ); + else + return Level; +} + +// ************************************************************************* +// After erasure of police record, selling prices must be recalculated +// ************************************************************************* +void RecalculateSellPrices( void ) +{ + int i; + + for (i=0; iGadget[i] < 0) + continue; + if (Sh->Gadget[i] == Gg) + return true; + } + + return false; +} + +// ************************************************************************* +// Determines whether a certain shield type is on board +// ************************************************************************* +Boolean HasShield( SHIP* Sh, char Gg ) +{ + int i; + + for (i=0; iShield[i] < 0) + continue; + if (Sh->Shield[i] == Gg) + return true; + } + + return false; +} + +// ************************************************************************* +// Determines whether a certain weapon type is on board. If exactCompare is +// false, then better weapons will also return TRUE +// ************************************************************************* +Boolean HasWeapon( SHIP* Sh, char Gg, Boolean exactCompare ) +{ + int i; + + for (i=0; iWeapon[i] < 0) + continue; + if ((Sh->Weapon[i] == Gg) || (Sh->Weapon[i] > Gg && !exactCompare)) + return true; + } + + return false; +} diff --git a/Src/SpecialEvent.c b/Src/SpecialEvent.c new file mode 100644 index 0000000..457e95b --- /dev/null +++ b/Src/SpecialEvent.c @@ -0,0 +1,406 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.2 + * + * SpecialEvent.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// ************************************************************************* +// Handling of events on the Special Event screen +// ************************************************************************* +#include "external.h" + +static void DrawSpecialEventForm() +{ + FormPtr frmP; + char theText[320]; + + frmP = FrmGetActiveForm(); + setCurrentWinTitle( SpecialEvent[CURSYSTEM.Special].Title ); + if (SpecialEvent[CURSYSTEM.Special].JustAMessage) + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, SpecialEventYesButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, SpecialEventNoButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, SpecialEventOKButton ) ); + } + else + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, SpecialEventYesButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, SpecialEventNoButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, SpecialEventOKButton ) ); + } + FrmDrawForm ( frmP ); + + SysCopyStringResource(theText, SpecialEvent[CURSYSTEM.Special].QuestStringID); + DisplayPage(theText, 18); +} + +Boolean SpecialEventFormHandleEvent( EventPtr eventP ) +{ + Boolean handled = false; + int i, FirstEmptySlot; + + switch (eventP->eType) + { + case frmOpenEvent: + case frmUpdateEvent: + DrawSpecialEventForm(); + handled = true; + break; + + // Special event + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID != SpecialEventNoButton) + { + if (ToSpend() < SpecialEvent[CURSYSTEM.Special].Price) + { + FrmAlert( NotEnoughForEventAlert ); + handled = true; + break; + } + + Credits -= SpecialEvent[CURSYSTEM.Special].Price; + + switch (CURSYSTEM.Special) + { + + case GETREACTOR: + if (FilledCargoBays() > TotalCargoBays() - 15) + { + FrmAlert( NotEnoughBaysAlert ); + handled = true; + break; + } + else if (WildStatus == 1) + { + if (FrmCustomAlert(WildWontStayOnboardAlert, SolarSystemName[CURSYSTEM.NameIndex], + NULL, NULL) == WildWontStayOnboardSayGoodbyetoWild) + { + WildStatus = 0; + FrmCustomAlert( WildLeavesShipAlert,SolarSystemName[CURSYSTEM.NameIndex], + NULL, NULL); + } + else + { + handled = true; + break; + } + + } + FrmAlert( ReactorAlert ); + ReactorStatus = 1; + break; + + case REACTORDELIVERED: + CURSYSTEM.Special = GETSPECIALLASER; + ReactorStatus = 21; + handled = true; + break; + + case MONSTERKILLED: + break; + + case SCARAB: + ScarabStatus = 1; + break; + + case SCARABDESTROYED: + ScarabStatus = 2; + CURSYSTEM.Special = GETHULLUPGRADED; + handled = true; + break; + + case GETHULLUPGRADED: + FrmAlert( HullUpgradeAlert ); + Ship.Hull += UPGRADEDHULL; + ScarabStatus = 3; + handled = true; + break; + + case EXPERIMENT: + ExperimentStatus = 1; + break; + + case EXPERIMENTSTOPPED: + ExperimentStatus = 13; + CanSuperWarp = true; + break; + + case EXPERIMENTNOTSTOPPED: + break; + + case ARTIFACTDELIVERY: + ArtifactOnBoard = false; + break; + + case ALIENARTIFACT: + ArtifactOnBoard = true; + break; + + case FLYBARATAS: + case FLYMELINA: + case FLYREGULAS: + ++DragonflyStatus; + break; + + case DRAGONFLYDESTROYED: + CURSYSTEM.Special = INSTALLLIGHTNINGSHIELD; + handled = true; + break; + + case GEMULONRESCUED: + CURSYSTEM.Special = GETFUELCOMPACTOR; + InvasionStatus = 0; + handled = true; + break; + + case MEDICINEDELIVERY: + JaporiDiseaseStatus = 2; + IncreaseRandomSkill(); + IncreaseRandomSkill(); + break; + + case MOONFORSALE: + FrmAlert( BoughtMoonAlert ); + MoonBought = true; + break; + + case MOONBOUGHT: + EraseRectangle( 0, 0, 160, 160 ); + CurForm = UtopiaForm; + FrmGotoForm( UtopiaForm ); + return true; + break; + + case SKILLINCREASE: + FrmAlert( SkillIncreaseAlert ); + IncreaseRandomSkill(); + break; + + case TRIBBLE: + FrmAlert( YouHaveATribbleAlert ); + Ship.Tribbles = 1; + break; + + case BUYTRIBBLE: + FrmAlert( BeamOverTribblesAlert ); + Credits += (Ship.Tribbles >> 1); + Ship.Tribbles = 0; + break; + + case ERASERECORD: + FrmAlert( CleanRecordAlert ); + PoliceRecordScore = CLEANSCORE; + RecalculateSellPrices(); + break; + + case SPACEMONSTER: + MonsterStatus = 1; + for (i=0; i= 0) + { + FrmCustomAlert( NoQuartersAvailableAlert, "Ambassador Jarek", NULL, NULL ); + handled = true; + break; + } + FrmCustomAlert( PassengerTakenOnBoardAlert, "Ambassador Jarek", NULL, NULL ); + JarekStatus = 1; + break; + + case TRANSPORTWILD: + + if (Ship.Crew[Shiptype[Ship.Type].CrewQuarters-1] >= 0) + { + FrmCustomAlert( NoQuartersAvailableAlert, "Jonathan Wild", NULL, NULL ); + handled = true; + break; + } + if (!HasWeapon(&Ship, BEAMLASERWEAPON, false)) + { + FrmAlert (WildWontGetAboardAlert); + handled = true; + break; + } + if (ReactorStatus > 0 && ReactorStatus < 21) + { + FrmAlert( WildAfraidOfReactorAlert ); + handled = true; + break; + } + FrmCustomAlert( PassengerTakenOnBoardAlert, "Jonathan Wild", NULL, NULL ); + WildStatus = 1; + break; + + + case ALIENINVASION: + InvasionStatus = 1; + break; + + case JAREKGETSOUT: + JarekStatus = 2; + RecalculateBuyPrices(COMMANDER.CurSystem); + break; + + case WILDGETSOUT: + WildStatus = 2; + Mercenary[MAXCREWMEMBER-1].CurSystem = KRAVATSYSTEM; + // Zeethibal has a 10 in player's lowest score, an 8 + // in the next lowest score, and 5 elsewhere. + Mercenary[MAXCREWMEMBER-1].Pilot = 5; + Mercenary[MAXCREWMEMBER-1].Fighter = 5; + Mercenary[MAXCREWMEMBER-1].Trader = 5; + Mercenary[MAXCREWMEMBER-1].Engineer = 5; + switch (NthLowestSkill(&Ship, 1)) + { + case PILOTSKILL: + Mercenary[MAXCREWMEMBER-1].Pilot = 10; + break; + case FIGHTERSKILL: + Mercenary[MAXCREWMEMBER-1].Fighter = 10; + break; + case TRADERSKILL: + Mercenary[MAXCREWMEMBER-1].Trader = 10; + break; + case ENGINEERSKILL: + Mercenary[MAXCREWMEMBER-1].Engineer = 10; + break; + } + switch (NthLowestSkill(&Ship, 2)) + { + case PILOTSKILL: + Mercenary[MAXCREWMEMBER-1].Pilot = 8; + break; + case FIGHTERSKILL: + Mercenary[MAXCREWMEMBER-1].Fighter = 8; + break; + case TRADERSKILL: + Mercenary[MAXCREWMEMBER-1].Trader = 8; + break; + case ENGINEERSKILL: + Mercenary[MAXCREWMEMBER-1].Engineer = 8; + break; + } + + if (PoliceRecordScore < CLEANSCORE) + PoliceRecordScore = CLEANSCORE; + break; + + + case CARGOFORSALE: + FrmAlert( SealedCannistersAlert ); + i = GetRandom( MAXTRADEITEM ); + Ship.Cargo[i] += 3; + BuyingPrice[i] += SpecialEvent[CURSYSTEM.Special].Price; + break; + + case INSTALLLIGHTNINGSHIELD: + FirstEmptySlot = GetFirstEmptySlot( Shiptype[Ship.Type].ShieldSlots, Ship.Shield ); + if (FirstEmptySlot < 0) + { + FrmAlert( NotEnoughSlotsAlert ); + handled = true; + } + else + { + FrmAlert( LightningShieldAlert ); + Ship.Shield[FirstEmptySlot] = LIGHTNINGSHIELD; + Ship.ShieldStrength[FirstEmptySlot] = Shieldtype[LIGHTNINGSHIELD].Power; + } + break; + + case GETSPECIALLASER: + FirstEmptySlot = GetFirstEmptySlot( Shiptype[Ship.Type].WeaponSlots, Ship.Weapon ); + if (FirstEmptySlot < 0) + { + FrmAlert( NotEnoughSlotsAlert ); + handled = true; + } + else + { + FrmAlert(MorganLaserAlert ); + Ship.Weapon[FirstEmptySlot] = MORGANLASERWEAPON; + } + break; + + case GETFUELCOMPACTOR: + FirstEmptySlot = GetFirstEmptySlot( Shiptype[Ship.Type].GadgetSlots, Ship.Gadget ); + if (FirstEmptySlot < 0) + { + FrmAlert( NotEnoughSlotsAlert ); + handled = true; + } + else + { + FrmAlert( FuelCompactorAlert ); + Ship.Gadget[FirstEmptySlot] = FUELCOMPACTOR; + Ship.Fuel = GetFuelTanks(); + } + break; + + case JAPORIDISEASE: + if (FilledCargoBays() > TotalCargoBays() - 10) + { + FrmAlert( NotEnoughBaysAlert ); + handled = true; + } + else + { + FrmAlert( AntidoteAlert ); + JaporiDiseaseStatus = 1; + } + break; + } + + if (!handled) + CURSYSTEM.Special = -1; + } + CurForm = SystemInformationForm; + FrmGotoForm( CurForm ); + handled = true; + break; + + default: + break; + } + + return handled; +} diff --git a/Src/SystemInfoEvent.c b/Src/SystemInfoEvent.c new file mode 100644 index 0000000..cad0d60 --- /dev/null +++ b/Src/SystemInfoEvent.c @@ -0,0 +1,917 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * SystemInfoEvent.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +#include "external.h" + +static int NewsEvents[MAXSPECIALNEWSEVENTS]; + +// ************************************************************************* +// Draw one mercenary +// ************************************************************************* +static void DrawMercenary( int Index, int y ) +{ + int j, d; + + DrawChars( MercenaryName[Mercenary[Index].NameIndex], 30, y ); + + StrIToA( SBuf, MERCENARYHIREPRICE( Index ) ); + StrCat( SBuf, " cr." ); + j = MAXDIGITS - StrLen( SBuf ); + d = 101+j*5; + StrCat( SBuf, " daily" ); + DrawChars( SBuf, d, y ); + + StrCopy( SBuf, "Pilot: " ); + StrIToA( SBuf2, Mercenary[Index].Pilot ); + StrCat( SBuf, SBuf2 ); + DrawChars( SBuf, 30, y + 13 ); + + StrCopy( SBuf, "Trader: " ); + StrIToA( SBuf2, Mercenary[Index].Trader ); + StrCat( SBuf, SBuf2 ); + DrawChars( SBuf, 30, y + 26 ); + + StrCopy( SBuf, "Fighter: " ); + StrIToA( SBuf2, Mercenary[Index].Fighter ); + StrCat( SBuf, SBuf2 ); + DrawChars( SBuf, 80, y + 13 ); + + StrCopy( SBuf, "Engineer: " ); + StrIToA( SBuf2, Mercenary[Index].Engineer ); + StrCat( SBuf, SBuf2 ); + DrawChars( SBuf, 80, y + 26 ); +} + +// ************************************************************************* +// Return available crew quarters +// ************************************************************************* +static char AvailableQuarters( void ) +{ + return Shiptype[Ship.Type].CrewQuarters - (JarekStatus == 1 ? 1 : 0) - + (WildStatus == 1 ? 1 : 0); +} + + + +// ************************************************************************* +// Determine which mercenary is for hire in the current system +// ************************************************************************* +static int GetForHire( void ) +{ + int ForHire = -1; + int i; + + for (i=1; i= DUBIOUSSCORE) || + (CURSYSTEM.Special == CARGOFORSALE && (FilledCargoBays() > TotalCargoBays() - 3)) || + ((CURSYSTEM.Special == DRAGONFLY || CURSYSTEM.Special == JAPORIDISEASE || + CURSYSTEM.Special == ALIENARTIFACT || CURSYSTEM.Special == AMBASSADORJAREK || + CURSYSTEM.Special == EXPERIMENT) && (PoliceRecordScore < DUBIOUSSCORE)) || + (CURSYSTEM.Special == TRANSPORTWILD && (PoliceRecordScore >= DUBIOUSSCORE)) || + (CURSYSTEM.Special == GETREACTOR && (PoliceRecordScore >= DUBIOUSSCORE || ReputationScore < AVERAGESCORE || ReactorStatus != 0)) || + (CURSYSTEM.Special == REACTORDELIVERED && !(ReactorStatus > 0 && ReactorStatus < 21)) || + (CURSYSTEM.Special == MONSTERKILLED && MonsterStatus < 2) || + (CURSYSTEM.Special == EXPERIMENTSTOPPED && !(ExperimentStatus >= 1 && ExperimentStatus < 12)) || + (CURSYSTEM.Special == FLYBARATAS && DragonflyStatus < 1) || + (CURSYSTEM.Special == FLYMELINA && DragonflyStatus < 2) || + (CURSYSTEM.Special == FLYREGULAS && DragonflyStatus < 3) || + (CURSYSTEM.Special == DRAGONFLYDESTROYED && DragonflyStatus < 5) || + (CURSYSTEM.Special == SCARAB && (ReputationScore < AVERAGESCORE || ScarabStatus != 0)) || + (CURSYSTEM.Special == SCARABDESTROYED && ScarabStatus != 2) || + (CURSYSTEM.Special == GETHULLUPGRADED && ScarabStatus != 2) || + (CURSYSTEM.Special == MEDICINEDELIVERY && JaporiDiseaseStatus != 1) || + (CURSYSTEM.Special == JAPORIDISEASE && (JaporiDiseaseStatus != 0)) || + (CURSYSTEM.Special == ARTIFACTDELIVERY && !ArtifactOnBoard) || + (CURSYSTEM.Special == JAREKGETSOUT && JarekStatus != 1) || + (CURSYSTEM.Special == WILDGETSOUT && WildStatus != 1) || + (CURSYSTEM.Special == GEMULONRESCUED && !(InvasionStatus >= 1 && InvasionStatus <= 7)) || + (CURSYSTEM.Special == MOONFORSALE && (MoonBought || CurrentWorth() < (COSTMOON * 4) / 5)) || + (CURSYSTEM.Special == MOONBOUGHT && MoonBought != true)) + FrmHideObject( frmP, FrmGetObjectIndex( frmP, SystemInformationSpecialButton ) ); + else if (OpenQ > 3 && + (CURSYSTEM.Special == TRIBBLE || + CURSYSTEM.Special == SPACEMONSTER || + CURSYSTEM.Special == DRAGONFLY || + CURSYSTEM.Special == JAPORIDISEASE || + CURSYSTEM.Special == ALIENARTIFACT || + CURSYSTEM.Special == AMBASSADORJAREK || + CURSYSTEM.Special == ALIENINVASION || + CURSYSTEM.Special == EXPERIMENT || + CURSYSTEM.Special == TRANSPORTWILD || + CURSYSTEM.Special == GETREACTOR || + CURSYSTEM.Special == SCARAB)) + FrmHideObject( frmP, FrmGetObjectIndex( frmP, SystemInformationSpecialButton ) ); + else + FrmShowObject( frmP, FrmGetObjectIndex( frmP, SystemInformationSpecialButton ) ); + if (GetForHire() < 0) + FrmHideObject( frmP, FrmGetObjectIndex( frmP, SystemInformationMercenaryForHireButton ) ); + else + FrmShowObject( frmP, FrmGetObjectIndex( frmP, SystemInformationMercenaryForHireButton ) ); + RectangularShortcuts( frmP, SystemInformationBButton ); + FrmDrawForm( frmP ); +} + +// ************************************************************************* +// Handling of events on the System Information screen +// ************************************************************************* +Boolean SystemInformationFormHandleEvent(EventPtr eventP) +{ + Boolean handled = false; + int OpenQ = OpenQuests(); + + switch (eventP->eType) + { + // Show information on current system + case frmOpenEvent: + // also, we decide if we want to set the News Flags here... + if (CURSYSTEM.Special > -1) + { + if (CURSYSTEM.Special == MONSTERKILLED && MonsterStatus == 2) + addNewsEvent(MONSTERKILLED); + else if (CURSYSTEM.Special == DRAGONFLY) + addNewsEvent(DRAGONFLY); + else if (CURSYSTEM.Special == SCARAB) + addNewsEvent(SCARAB); + else if (CURSYSTEM.Special == SCARABDESTROYED && ScarabStatus == 2) + addNewsEvent(SCARABDESTROYED); + else if (CURSYSTEM.Special == FLYBARATAS && DragonflyStatus == 1) + addNewsEvent(FLYBARATAS); + else if (CURSYSTEM.Special == FLYMELINA && DragonflyStatus == 2) + addNewsEvent(FLYMELINA); + else if (CURSYSTEM.Special == FLYREGULAS && DragonflyStatus == 3) + addNewsEvent(FLYREGULAS); + else if (CURSYSTEM.Special == DRAGONFLYDESTROYED && DragonflyStatus == 5) + addNewsEvent(DRAGONFLYDESTROYED); + else if (CURSYSTEM.Special == MEDICINEDELIVERY && JaporiDiseaseStatus == 1) + addNewsEvent(MEDICINEDELIVERY); + else if (CURSYSTEM.Special == ARTIFACTDELIVERY && ArtifactOnBoard) + addNewsEvent(ARTIFACTDELIVERY); + else if (CURSYSTEM.Special == JAPORIDISEASE && JaporiDiseaseStatus == 0) + addNewsEvent(JAPORIDISEASE); + else if (CURSYSTEM.Special == JAREKGETSOUT && JarekStatus == 1) + addNewsEvent(JAREKGETSOUT); + else if (CURSYSTEM.Special == WILDGETSOUT && WildStatus == 1) + addNewsEvent(WILDGETSOUT); + else if (CURSYSTEM.Special == GEMULONRESCUED && InvasionStatus > 0 && InvasionStatus < 8) + addNewsEvent(GEMULONRESCUED); + else if (CURSYSTEM.Special == ALIENINVASION) + addNewsEvent(ALIENINVASION); + else if (CURSYSTEM.Special == EXPERIMENTSTOPPED && ExperimentStatus > 0 && ExperimentStatus < 12) + addNewsEvent(EXPERIMENTSTOPPED); + else if (CURSYSTEM.Special == EXPERIMENTNOTSTOPPED) + addNewsEvent(EXPERIMENTNOTSTOPPED); + + } + DrawSystemInformationForm(); + CURSYSTEM.Visited = true; + handled = true; + break; + + case frmUpdateEvent: + DrawSystemInformationForm(); + handled = true; + break; + + // Special event + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID == SystemInformationSpecialButton) + { + CurForm = SpecialEventForm; + } + else if (eventP->data.ctlSelect.controlID == SystemInformationMercenaryForHireButton) + { + CurForm = PersonnelRosterForm; + } + else if (eventP->data.ctlSelect.controlID == SystemInformationNewsButton) + { + StrIToA( SBuf, Difficulty + 1 ); + if (!AlreadyPaidForNewspaper && ToSpend() < (long)(Difficulty + 1.0) ) + { + FrmCustomAlert(CantAffordPaperAlert, SBuf, NULL, NULL); + return true; + } + else + { + if (!NewsAutoPay && !AlreadyPaidForNewspaper) + if (FrmCustomAlert( BuyNewspaperAlert, SBuf, NULL, NULL ) == BuyNewspaperCancel) + return true; + if (!AlreadyPaidForNewspaper) + { + Credits -= (Difficulty + 1); + AlreadyPaidForNewspaper = true; + } + CurForm = NewspaperForm; + } + } + + FrmGotoForm( CurForm ); + handled = true; + break; + + default: + break; + } + + return handled; +} + + +static void DrawNewspaperForm() +{ + FormPtr frmP; + int line = 18, i, j; + Boolean shown[MAXSTORIES]; + Boolean realNews = false; + frmP = FrmGetActiveForm(); + FrmDrawForm( frmP ); + + i = WarpSystem % MAXMASTHEADS; + SysStringByIndex(AnarchyMastheadsStringList + CURSYSTEM.Politics * 100,i,SBuf2,50); + if (StrNCompare(SBuf2,"*",1) == 0) + { + StrCopy(SBuf,"The "); + StrCat(SBuf, SolarSystemName[CURSYSTEM.NameIndex]); + StrCat(SBuf, SBuf2 + 1); + //DrawCharsCentered(SBuf, line, true); + setCurrentWinTitle(SBuf); + + } + else if (StrNCompare(SBuf2,"+",1) == 0) + { + StrCopy(SBuf, SolarSystemName[CURSYSTEM.NameIndex]); + StrCat(SBuf, SBuf2 + 1); + //DrawCharsCentered(SBuf, line, true); + setCurrentWinTitle(SBuf); + + } + else + { + //DrawCharsCentered(SBuf2, line, true); + setCurrentWinTitle(SBuf2); + } + + + RandSeed( WarpSystem, Days ); + + // Special Events get to go first, crowding out other news + if (isNewsEvent(CAPTAINHUIEATTACKED)) + { + DisplayHeadline("Famed Captain Huie Attacked by Brigand!", &line); + } + if (isNewsEvent(EXPERIMENTPERFORMED)) + { + DisplayHeadline("Travelers Report Timespace Damage, Warp Problems!", &line); + } + if (isNewsEvent(CAPTAINHUIEDESTROYED)) + { + DisplayHeadline("Citizens Mourn Destruction of Captain Huie's Ship!", &line); + } + if (isNewsEvent(CAPTAINAHABATTACKED)) + { + DisplayHeadline("Thug Assaults Captain Ahab!", &line); + } + if (isNewsEvent(CAPTAINAHABDESTROYED)) + { + DisplayHeadline("Destruction of Captain Ahab's Ship Causes Anger!", &line); + } + if (isNewsEvent(CAPTAINCONRADATTACKED)) + { + DisplayHeadline("Captain Conrad Comes Under Attack By Criminal!", &line); + } + if (isNewsEvent(CAPTAINCONRADDESTROYED)) + { + DisplayHeadline("Captain Conrad's Ship Destroyed by Villain!", &line); + } + if (isNewsEvent(MONSTERKILLED)) + { + DisplayHeadline("Hero Slays Space Monster! Parade, Honors Planned for Today.", &line); + } + if (isNewsEvent(WILDARRESTED)) + { + DisplayHeadline("Notorious Criminal Jonathan Wild Arrested!", &line); + } + if (CURSYSTEM.Special == MONSTERKILLED && MonsterStatus == 1) + { + DisplayHeadline("Space Monster Threatens Homeworld!", &line); + } + if (CURSYSTEM.Special == SCARABDESTROYED && ScarabStatus == 1) + { + DisplayHeadline("Wormhole Travelers Harassed by Unusual Ship!", &line); + } + if (isNewsEvent(EXPERIMENTSTOPPED)) + { + DisplayHeadline("Scientists Cancel High-profile Test! Committee to Investigate Design.", &line); + } + if (isNewsEvent(EXPERIMENTNOTSTOPPED)) + { + DisplayHeadline("Huge Explosion Reported at Research Facility.", &line); + } + if (isNewsEvent(DRAGONFLY)) + { + DisplayHeadline("Experimental Craft Stolen! Critics Demand Security Review.", &line); + } + if (isNewsEvent(SCARAB)) + { + DisplayHeadline("Security Scandal: Test Craft Confirmed Stolen.", &line); + } + if (isNewsEvent(FLYBARATAS)) + { + DisplayHeadline("Investigators Report Strange Craft.", &line); + } + if (isNewsEvent(FLYMELINA)) + { + DisplayHeadline("Rumors Continue: Melina Orbitted by Odd Starcraft.", &line); + } + if (isNewsEvent(FLYREGULAS)) + { + DisplayHeadline("Strange Ship Observed in Regulas Orbit.", &line); + } + if (CURSYSTEM.Special == DRAGONFLYDESTROYED && DragonflyStatus == 4 && + !isNewsEvent(DRAGONFLYDESTROYED)) + { + DisplayHeadline("Unidentified Ship: A Threat to Zalkon?", &line); + } + if (isNewsEvent(DRAGONFLYDESTROYED)) + { + DisplayHeadline("Spectacular Display as Stolen Ship Destroyed in Fierce Space Battle.", &line); + } + if (isNewsEvent(SCARABDESTROYED)) + { + DisplayHeadline("Wormhole Traffic Delayed as Stolen Craft Destroyed.", &line); + } + if (isNewsEvent(MEDICINEDELIVERY)) + { + DisplayHeadline("Disease Antidotes Arrive! Health Officials Optimistic.", &line); + } + if (isNewsEvent(JAPORIDISEASE)) + { + DisplayHeadline("Editorial: We Must Help Japori!",&line); + } + if (isNewsEvent(ARTIFACTDELIVERY)) + { + DisplayHeadline("Scientist Adds Alien Artifact to Museum Collection.", &line); + } + if (isNewsEvent(JAREKGETSOUT)) + { + DisplayHeadline("Ambassador Jarek Returns from Crisis.", &line); + } + if (isNewsEvent(WILDGETSOUT)) + { + DisplayHeadline("Rumors Suggest Known Criminal J. Wild May Come to Kravat!", &line); + } + if (isNewsEvent(GEMULONRESCUED)) + { + DisplayHeadline("Invasion Imminent! Plans in Place to Repel Hostile Invaders.", &line); + } + if (CURSYSTEM.Special == GEMULONRESCUED && !isNewsEvent(GEMULONRESCUED)) + { + DisplayHeadline("Alien Invasion Devastates Planet!", &line); + } + if (isNewsEvent(ALIENINVASION)) + { + DisplayHeadline("Editorial: Who Will Warn Gemulon?", &line); + } + if (isNewsEvent(ARRIVALVIASINGULARITY)) + { + DisplayHeadline("Travelers Claim Sighting of Ship Materializing in Orbit!", &line); + } + + + // local system status information + if (CURSYSTEM.Status > 0) + { + switch (CURSYSTEM.Status) + { + case WAR: + DisplayHeadline("War News: Offensives Continue!", &line); + break; + case PLAGUE: + DisplayHeadline("Plague Spreads! Outlook Grim.", &line); + break; + case DROUGHT: + DisplayHeadline("No Rain in Sight!",&line); + break; + case BOREDOM: + DisplayHeadline("Editors: Won't Someone Entertain Us?",&line); + break; + case COLD: + DisplayHeadline("Cold Snap Continues!", &line); + break; + case CROPFAILURE: + DisplayHeadline("Serious Crop Failure! Must We Ration?", &line); + break; + case LACKOFWORKERS: + DisplayHeadline("Jobless Rate at All-Time Low!", &line); + break; + } + } + + // character-specific news. + if (PoliceRecordScore <= VILLAINSCORE) + { + j = GetRandom2(4); + switch (j) + { + case 0: + StrCopy( SBuf, "Police Warning: "); + StrCat( SBuf, NameCommander); + StrCat( SBuf, " Will Dock At "); + StrCat( SBuf, SolarSystemName[CURSYSTEM.NameIndex]); + StrCat( SBuf, "!"); + break; + case 1: + StrCopy(SBuf,"Notorious Criminal "); + StrCat(SBuf, NameCommander); + StrCat(SBuf, " Sighted in "); + StrCat( SBuf, SolarSystemName[CURSYSTEM.NameIndex]); + StrCat( SBuf, "!"); + break; + case 2: + StrCopy(SBuf,"Locals Rally to Deny Spaceport Access to "); + StrCat(SBuf, NameCommander); + StrCat(SBuf, "!"); + break; + case 3: + StrCopy(SBuf,"Terror Strikes Locals on Arrival of "); + StrCat(SBuf, NameCommander); + StrCat(SBuf, "!"); + break; + } + DisplayHeadline(SBuf, &line); + } + + if (PoliceRecordScore == HEROSCORE) + { + j = GetRandom2(3); + switch (j) + { + case 0: + StrCopy(SBuf,"Locals Welcome Visiting Hero "); + StrCat(SBuf, NameCommander); + StrCat(SBuf, "!"); + break; + case 1: + StrCopy(SBuf,"Famed Hero "); + StrCat(SBuf, NameCommander); + StrCat(SBuf, " to Visit System!"); + break; + case 2: + StrCopy(SBuf,"Large Turnout At Spaceport to Welcome "); + StrCat(SBuf, NameCommander); + StrCat(SBuf, "!"); + break; + } + DisplayHeadline(SBuf, &line); + } + + // caught littering? + if (isNewsEvent(CAUGHTLITTERING)) + { + StrCopy( SBuf, "Police Trace Orbiting Space Litter to "); + StrCat( SBuf, NameCommander ); + StrCat( SBuf, "."); + DisplayHeadline(SBuf, &line); + } + + + // and now, finally, useful news (if any) + // base probability of a story showing up is (50 / MAXTECHLEVEL) * Current Tech Level + // This is then modified by adding 10% for every level of play less than Impossible + for (i=0; i < MAXSOLARSYSTEM; i++) + { + if (i != COMMANDER.CurSystem && + ((RealDistance(CURSYSTEM, SolarSystem[i]) <= Shiptype[Ship.Type].FuelTanks) + || + (WormholeExists( COMMANDER.CurSystem, i ))) + && + SolarSystem[i].Status > 0) + + { + // Special stories that always get shown: moon, millionaire + if (SolarSystem[i].Special == MOONFORSALE) + { + StrCopy(SBuf, "Seller in "); + StrCat(SBuf,SolarSystemName[i]); + StrCat(SBuf, " System has Utopian Moon available."); + DisplayHeadline(SBuf, &line); + } + if (SolarSystem[i].Special == BUYTRIBBLE) + { + StrCopy(SBuf, "Collector in "); + StrCat(SBuf,SolarSystemName[i]); + StrCat(SBuf, " System seeks to purchase Tribbles."); + DisplayHeadline(SBuf, &line); + } + + // And not-always-shown stories + if (GetRandom2(100) <= STORYPROBABILITY * CURSYSTEM.TechLevel + 10 * (5 - Difficulty)) + { + j = GetRandom2(6); + switch (j) + { + case 0: + StrCopy(SBuf, "Reports of"); + break; + case 1: + StrCopy(SBuf, "News of"); + break; + case 2: + StrCopy(SBuf, "New Rumors of"); + break; + case 3: + StrCopy(SBuf, "Sources say"); + break; + case 4: + StrCopy(SBuf, "Notice:"); + break; + case 5: + StrCopy(SBuf, "Evidence Suggests"); + break; + } + StrCat(SBuf, " "); + switch (SolarSystem[i].Status) + { + case WAR: + StrCat(SBuf,"Strife and War"); + break; + case PLAGUE: + StrCat(SBuf, "Plague Outbreaks"); + break; + case DROUGHT: + StrCat(SBuf, "Severe Drought"); + break; + case BOREDOM: + StrCat(SBuf, "Terrible Boredom"); + break; + case COLD: + StrCat(SBuf, "Cold Weather"); + break; + case CROPFAILURE: + StrCat(SBuf, "Crop Failures"); + break; + case LACKOFWORKERS: + StrCat(SBuf, "Labor Shortages"); + break; + } + StrCat(SBuf, " in the "); + StrCat(SBuf,SolarSystemName[i]); + StrCat(SBuf, " System."); + DisplayHeadline(SBuf, &line); + realNews = true; + } + } + } + + // if there's no useful news, we throw up at least one + // headline from our canned news list. + if (! realNews) + { + for (i=0; i< MAXSTORIES; i++) + { + shown[i]= false; + } + for (i=0; i <=GetRandom2(MAXSTORIES); i++) + { + j = GetRandom2(MAXSTORIES); + if (!shown[j] && line <= 150) + { + SysStringByIndex(AnarchyHeadlinesStringList + CURSYSTEM.Politics * 100,j,SBuf,63); + DisplayHeadline(SBuf, &line); + shown[j] = true; + } + } + } + + +} + +// Show the newspaper screen +Boolean NewspaperFormHandleEvent(EventPtr eventP) +{ + Boolean handled = false; + + switch (eventP->eType) + { + // Show information on current system + case frmOpenEvent: + case frmUpdateEvent: + DrawNewspaperForm(); + handled = true; + break; + + // Special event + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID == NewspaperDoneButton) + { + CurForm = SystemInformationForm; + } + FrmGotoForm( CurForm ); + handled = true; + break; + + default: + break; + } + + return handled; +} + + +// ***************************************************************** +// Handling of the events of the Personnel Roster form +// ***************************************************************** +Boolean PersonnelRosterFormHandleEvent( EventPtr eventP ) +{ + Boolean handled = false; + Boolean Sale; + int FirstFree, ForHire, oldtraderskill; + + switch (eventP->eType) + { + case frmOpenEvent: + DrawPersonnelRoster(); + handled = true; + break; + + case frmUpdateEvent: + DrawPersonnelRoster(); + handled = true; + break; + + + case ctlSelectEvent: + Sale = true; + oldtraderskill = TraderSkill( &Ship ); + if (eventP->data.ctlSelect.controlID == PersonnelRosterFire0Button) + { + if (FrmAlert( FireMercenaryAlert ) == 0) + { + Ship.Crew[1] = Ship.Crew[2]; + Ship.Crew[2] = -1; + } + } + else if (eventP->data.ctlSelect.controlID == PersonnelRosterFire1Button) + { + if (FrmAlert( FireMercenaryAlert ) == 0) + { + Ship.Crew[2] = -1; + } + } + else if (eventP->data.ctlSelect.controlID == PersonnelRosterHire0Button) + { + /* + ForHire = -1; + for (i=1; i 0) + { + if (Tradeitem[Good].CheapResource >= 0) + if (Resources == Tradeitem[Good].CheapResource) + Price = (Price * 3) / 4; + if (Tradeitem[Good].ExpensiveResource >= 0) + if (Resources == Tradeitem[Good].ExpensiveResource) + Price = (Price * 4) / 3; + } + + // If a system can't use something, its selling price is zero. + if (Tech < Tradeitem[Good].TechUsage) + return 0L; + + if (Price < 0) + return 0L; + + return Price; +} + +// ************************************************************************* +// What you owe the mercenaries daily +// ************************************************************************* +static int MercenaryMoney( void ) +{ + int i, ToPay; + + ToPay = 0; + for (i=1; i= 0) + ToPay += MERCENARYHIREPRICE( Ship.Crew[i] ); + + return ToPay; +} + +// ************************************************************************* +// Calculate wormhole tax to be paid between systems a and b +// ************************************************************************* +static long WormholeTax( int a, int b ) +{ + if (WormholeExists( a, b )) + return( Shiptype[Ship.Type].CostOfFuel * 25L ); + + return 0L; +} + +// ************************************************************************* +// Calculate the score +// ************************************************************************* +long GetScore( char EndStatus, int Days, long Worth, char Level ) +{ + long d; + + Worth = (Worth < 1000000 ? Worth : 1000000 + ((Worth - 1000000) / 10) ); + + if (EndStatus == KILLED) + return (Level+1L)*(long)((Worth * 90) / 50000); + else if (EndStatus == RETIRED) + return (Level+1L)*(long)((Worth * 95) / 50000); + else + { + d = ((Level+1L)*100) - Days; + if (d < 0) + d = 0; + return (Level+1L)*(long)((Worth + (d * 1000)) / 500); + } +} + +// ************************************************************************* +// Initializing the high score table +// ************************************************************************* +static void InitHighScores (void) +{ + int i; + + for (i=0; i b) || (a == b && CurrentWorth() > Hscores[i].Worth) || + (a == b && CurrentWorth() == Hscores[i].Worth && Days > Hscores[i].Days) || + Hscores[i].Name[0] == '\0') + { + for (j=MAXHIGHSCORE-1; j>i; --j) + { + StrCopy( Hscores[j].Name, Hscores[j-1].Name ); + Hscores[j].Status = Hscores[j-1].Status; + Hscores[j].Days = Hscores[j-1].Days; + Hscores[j].Worth = Hscores[j-1].Worth; + Hscores[j].Difficulty = Hscores[j-1].Difficulty; + } + + StrCopy( Hscores[i].Name, NameCommander ); + Hscores[i].Status = EndStatus; + Hscores[i].Days = Days; + Hscores[i].Worth = CurrentWorth(); + Hscores[i].Difficulty = Difficulty; + + Scored = true; + + if (!GameLoaded) + SaveStatus( pmDB ); + break; + } + + ++i; + } + + DmCloseDatabase( pmDB ); + + frmP = FrmInitForm( FinalScoreForm ); + + StrCopy( SBuf, "You achieved a score of " ); + StrIToA( SBuf2, (a / 50L) ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, "." ); + StrIToA( SBuf2, ((a%50L) / 5) ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, "%." ); + setLabelText( frmP, FinalScoreScoreLabel, SBuf ); + + if (Scored && GameLoaded) + { + setLabelText( frmP, FinalScoreCongratulationsLabel, "Without loading a savegame, you" ); + setLabelText( frmP, FinalScoreHighScoreLabel, "would have made the high-score list." ); + } + else if (Scored) + { + setLabelText( frmP, FinalScoreCongratulationsLabel, "Congratulations!" ); + setLabelText( frmP, FinalScoreHighScoreLabel, "You have made the high-score list!" ); + } + else + { + setLabelText( frmP, FinalScoreCongratulationsLabel, "Alas! This is not enough to enter" ); + setLabelText( frmP, FinalScoreHighScoreLabel, "the high-score list." ); + } + + FrmDoDialog( frmP ); + + FrmDeleteForm( frmP ); + + CurForm = MainForm; + if (Scored && !GameLoaded) + ViewHighScores(); + FrmGotoForm( CurForm ); +} + +// ************************************************************************* +// Initialize qunatities of trade items of system Index +// ************************************************************************* +static void InitializeTradeitems( const int Index ) +{ + int i; + + for (i=0; i= 0) + if (SolarSystem[Index]. SpecialResources == + Tradeitem[i].CheapResource) + SolarSystem[Index].Qty[i] = (SolarSystem[Index].Qty[i] * 4) / 3; + + if (Tradeitem[i].ExpensiveResource >= 0) + if (SolarSystem[Index].SpecialResources == + Tradeitem[i].ExpensiveResource) + SolarSystem[Index].Qty[i] = (SolarSystem[Index].Qty[i] * 3) >> 2; + + if (Tradeitem[i].DoublePriceStatus >= 0) + if (SolarSystem[Index].Status == Tradeitem[i].DoublePriceStatus) + SolarSystem[Index].Qty[i] = SolarSystem[Index].Qty[i] / 5; + + SolarSystem[Index].Qty[i] = SolarSystem[Index].Qty[i] - GetRandom( 10 ) + + GetRandom( 10 ); + + if (SolarSystem[Index].Qty[i] < 0) + SolarSystem[Index].Qty[i] = 0; + } +} + +// ************************************************************************* +// Determine prices in specified system (changed from Current System) SjG +// ************************************************************************* +static void DeterminePrices( Byte SystemID ) +{ + int i; + + for (i=0; i= 0) + if (SolarSystem[SystemID].Status == Tradeitem[i].DoublePriceStatus) + BuyPrice[i] = (BuyPrice[i] * 3) >> 1; + + // Randomize price a bit + BuyPrice[i] = BuyPrice[i] + GetRandom( Tradeitem[i].Variance ) - + GetRandom( Tradeitem[i].Variance ); + + // Should never happen + if (BuyPrice[i] <= 0) + { + BuyPrice[i] = 0; + SellPrice[i] = 0; + continue; + } + + SellPrice[i] = BuyPrice[i]; + if (PoliceRecordScore < DUBIOUSSCORE) + { + // Criminals have to pay off an intermediary + SellPrice[i] = (SellPrice[i] * 90) / 100; + } + } + + RecalculateBuyPrices(SystemID); +} + + +// ************************************************************************* +// Execute a warp command +// ************************************************************************* +void DoWarp( Boolean viaSingularity ) +{ + int i, Distance; + + // if Wild is aboard, make sure ship is armed! + if (WildStatus == 1) + { + if (! HasWeapon(&Ship, BEAMLASERWEAPON, false)) + { + if (FrmCustomAlert( WildWontGoAlert, SolarSystemName[CURSYSTEM.NameIndex], NULL, NULL) != WildWontGoSayGoodbyetoWild) + { + return; + } + else + { + FrmCustomAlert( WildLeavesShipAlert, SolarSystemName[CURSYSTEM.NameIndex], NULL, NULL ); + WildStatus = 0; + } + } + } + + // Check for Large Debt + if (Debt > DEBTTOOLARGE) + { + FrmAlert( DebtTooLargeForTravelAlert ); + return; + } + + // Check for enough money to pay Mercenaries + if (MercenaryMoney() > Credits) + { + FrmAlert( MustPayMercenariesAlert ); + return; + } + + // Check for enough money to pay Insurance + if (Insurance) + { + if (InsuranceMoney() + MercenaryMoney() > Credits) + { + FrmAlert( CantPayInsuranceAlert ); + return; + } + } + + // Check for enough money to pay Wormhole Tax + if (InsuranceMoney() + MercenaryMoney() + + WormholeTax( COMMANDER.CurSystem, WarpSystem ) > Credits) + { + FrmAlert( CantPayWormholeAlert ); + return; + } + + if (! viaSingularity) + { + Credits -= WormholeTax( COMMANDER.CurSystem, WarpSystem ); + Credits -= MercenaryMoney(); + Credits -= InsuranceMoney(); + } + + for (i=0; i Shiptype[SpaceMonster.Type].HullStrength) + MonsterHull = Shiptype[SpaceMonster.Type].HullStrength; + if (Days%3 == 0) + { + if (PoliceRecordScore > CLEANSCORE) + --PoliceRecordScore; + } + if (PoliceRecordScore < DUBIOUSSCORE) + if (Difficulty <= NORMAL) + ++PoliceRecordScore; + else if (Days%Difficulty == 0) + ++PoliceRecordScore; + + PossibleToGoThroughRip=true; + + DeterminePrices(WarpSystem); + Travel(); +} + + +// ************************************************************************* +// Show the target system form +// ************************************************************************* +static void ShowExecuteWarp( void ) +{ + FormPtr frmP; + int Distance; + + frmP = FrmGetActiveForm(); + + + RectangularShortcuts( frmP, ExecuteWarpBButton ); + + FrmDrawForm(frmP); + + EraseRectangle( 76, 18, 52, 12 ); + EraseRectangle( 76, 31, 80, 76 ); + EraseRectangle( 76, 109, 39, 12 ); + + setLabelText( frmP, ExecuteWarpSystemNameLabel, SolarSystemName[SolarSystem[WarpSystem].NameIndex] ); + setLabelText( frmP, ExecuteWarpTechLevelLabel, TechLevel[SolarSystem[WarpSystem].TechLevel] ); + setLabelText( frmP, ExecuteWarpGovernmentLabel, Politics[SolarSystem[WarpSystem].Politics].Name ); + setLabelText( frmP, ExecuteWarpSizeLabel, SystemSize[SolarSystem[WarpSystem].Size] ); + + if (WormholeExists( COMMANDER.CurSystem, WarpSystem )) + { + StrCopy( SBuf, "Wormhole" ); + } + else + { + Distance = RealDistance( CURSYSTEM, SolarSystem[WarpSystem] ); + StrIToA( SBuf, Distance ); + StrCat( SBuf, " parsecs" ); + } + + setLabelText( frmP, ExecuteWarpRangeLabel, SBuf ); + setLabelText( frmP, ExecuteWarpPoliceLabel, Activity[Politics[SolarSystem[WarpSystem].Politics].StrengthPolice] ); + setLabelText( frmP, ExecuteWarpPiratesLabel, Activity[Politics[SolarSystem[WarpSystem].Politics].StrengthPirates] ); + StrIToA( SBuf, InsuranceMoney() + MercenaryMoney() + (Debt > 0 ? + max( Debt / 10, 1 ) : 0 ) + WormholeTax( COMMANDER.CurSystem, WarpSystem ) ); + StrCat( SBuf, " cr." ); + setLabelText( frmP, ExecuteWarpCurrentCostsLabel, SBuf ); + + if (WormholeExists( COMMANDER.CurSystem, WarpSystem )) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpWarpButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpPricesButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpOutOfRangeLabel ) ); + } + else if (Distance > GetFuel()) + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpWarpButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpPricesButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpOutOfRangeLabel ) ); + } + else if (Distance <= 0) + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpWarpButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpPricesButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpOutOfRangeLabel ) ); + } + else + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpWarpButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpPricesButton ) ); + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpOutOfRangeLabel ) ); + } + + if (WormholeExists( COMMANDER.CurSystem, WarpSystem ) || Insurance || + Debt > 0 || Ship.Crew[1] >= 0) + FrmShowObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpSpecificationButton ) ); + else + FrmHideObject( frmP, FrmGetObjectIndex( frmP, ExecuteWarpSpecificationButton ) ); + + FrmDrawForm ( frmP); +} + +// ************************************************************************* +// Draws the list of skill points on the New Commander screen +// ************************************************************************* +static void NewCommanderDrawSkills( void ) + { + int Remaining; + + EraseRectangle( 78, 40, 44, 12 ); + EraseRectangle( 78, 58, 14, 70 ); + + FntSetFont( stdFont ); + + DrawChars( DifficultyLevel[Difficulty], 78, 40 ); + + StrIToA( SBuf, COMMANDER.Pilot ); + StrCat( SBuf, " " ); + DrawChars( SBuf, 78, 73 ); + + StrIToA( SBuf, COMMANDER.Fighter ); + StrCat( SBuf, " " ); + DrawChars( SBuf, 78, 88 ); + + StrIToA( SBuf, COMMANDER.Trader ); + StrCat( SBuf, " " ); + DrawChars( SBuf, 78, 103 ); + + StrIToA( SBuf, COMMANDER.Engineer ); + StrCat( SBuf, " " ); + DrawChars( SBuf, 78, 118 ); + + Remaining = 2*MAXSKILL - COMMANDER.Pilot - COMMANDER.Fighter - + COMMANDER.Trader - COMMANDER.Engineer; + StrIToA( SBuf, Remaining ); + StrCat( SBuf, " " ); + DrawChars( SBuf, 78, 58 ); + } + +// ************************************************************************* +// Status of solar systems may change over time. Used on Arrival to a System +// ************************************************************************* +static void ShuffleStatus( void ) +{ + int i; + + for (i=0; i 0) + { + if (GetRandom( 100 ) < 15) + SolarSystem[i].Status = UNEVENTFUL; + } + else if (GetRandom( 100 ) < 15) + SolarSystem[i].Status = 1 + GetRandom( MAXSTATUS - 1 ); + } +} + +// ************************************************************************* +// Determine next system withing range +// ************************************************************************* +static int NextSystemWithinRange( int Current, Boolean Back ) +{ + int i = Current; + + (Back ? --i : ++i); + + while (true) + { + if (i < 0) + i = MAXSOLARSYSTEM - 1; + else if (i >= MAXSOLARSYSTEM) + i = 0; + if (i == Current) + break; + + if (WormholeExists( COMMANDER.CurSystem, i )) + return i; + else if (RealDistance( CURSYSTEM, SolarSystem[i] ) <= GetFuel() && + RealDistance( CURSYSTEM, SolarSystem[i] ) > 0) + return i; + + (Back ? --i : ++i); + } + + return -1; +} + +// ************************************************************************* +// Show the average prices list +// ************************************************************************* +static void ShowAveragePrices( void ) +{ + FormPtr frmP; + int i, j, pos; + long Price; + + frmP = FrmGetActiveForm(); + + RectangularShortcuts( frmP, AveragePricesBButton ); + + FrmDrawForm( frmP ); + + EraseRectangle( 0, 18, 128, 26 ); + + if (SolarSystem[WarpSystem].Visited) + StrCopy( SBuf, SpecialResources[SolarSystem[WarpSystem].SpecialResources] ); + else + StrCopy( SBuf, "Special resources unknown" ); + setLabelText( frmP, AveragePricesResourcesLabel, SBuf ); + setLabelText( frmP, AveragePricesSystemNameLabel, SolarSystemName[SolarSystem[WarpSystem].NameIndex] ); + + if (PriceDifferences) + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, AveragePricesPriceDifferencesButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, AveragePricesAbsolutePricesButton ) ); + } + else + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, AveragePricesAbsolutePricesButton ) ); + FrmShowObject( frmP, FrmGetObjectIndex( frmP, AveragePricesPriceDifferencesButton ) ); + } + + FrmDrawForm ( frmP); + + SBufBays(); + FntSetFont( stdFont ); + i = 5 * StrLen( SBuf ); + StrCopy( SBuf2, "Bays: " ); + StrCat( SBuf2, SBuf ); + DrawChars( SBuf2, 160 - 23 - i, 113 ); + + EraseRectangle( 0, 46, 160, 65 ); + + for (i=0; i BuyPrice[i] && BuyPrice[i] > 0 && CURSYSTEM.Qty[i] > 0) + FntSetFont( boldFont ); + else + FntSetFont( stdFont ); + + DrawChars( Tradeitem[i].Name, (i/5)*72, 46+(i%5)*13 ); + FntSetFont( stdFont ); + SBuf[0] = '\0'; + if (PriceDifferences && Price > BuyPrice[i]) + StrCat( SBuf, "+" ); + StrIToA( SBuf2, (PriceDifferences ? Price - BuyPrice[i] : Price) ); + StrCat( SBuf, SBuf2 ); + StrCat( SBuf, " cr." ); + if (Price <= 0 || (PriceDifferences && BuyPrice[i] <= 0)) + DrawChars( "---", (i/5)*95+50, 46+(i%5)*13 ); + else + { + j = MAXPRICEDIGITS - StrLen( SBuf ); + pos = (i/5)*95+49+j*5; + if (PriceDifferences) + if (Price > BuyPrice[i]) + --pos; + else if (Price < BuyPrice[i]) + ++pos; + DrawChars( SBuf, pos, 46+(i%5)*13 ); + } + } +} + + +// ************************************************************************* +// Generate an opposing ship +// ************************************************************************* +static void GenerateOpponent( char Opp ) +{ + Boolean Redo; + int i, j, sum, Tries; + long d, e, f, k, m; + int Bays; + + Tries = 1; + + if (Opp == FAMOUSCAPTAIN) + { + // we just fudge for the Famous Captains' Ships... + Opponent.Type = MAXSHIPTYPE - 1; + for (i=0;i= NORMAL ? Difficulty - NORMAL : 0); + + while (j < Tries) + { + Redo = true; + + while (Redo) + { + d = GetRandom( 100 ); + i = 0; + sum = Shiptype[0].Occurrence; + + while (sum < d) + { + if (i >= MAXSHIPTYPE-1) + break; + ++i; + sum += Shiptype[i].Occurrence; + } + + if (Opp == POLICE && (Shiptype[i].Police < 0 || + Politics[SolarSystem[WarpSystem].Politics].StrengthPolice + k < Shiptype[i].Police)) + continue; + + if (Opp == PIRATE && (Shiptype[i].Pirates < 0 || + Politics[SolarSystem[WarpSystem].Politics].StrengthPirates + k < Shiptype[i].Pirates)) + continue; + + if (Opp == TRADER && (Shiptype[i].Traders < 0 || + Politics[SolarSystem[WarpSystem].Politics].StrengthTraders + k < Shiptype[i].Traders)) + continue; + + Redo = false; + } + + if (i > Opponent.Type) + Opponent.Type = i; + ++j; + } + + if (Opp == MANTIS) + Opponent.Type = MANTISTYPE; + else + Tries = max( 1, (CurrentWorth() / 150000L) + Difficulty - NORMAL ); + + // Determine the gadgets + if (Shiptype[Opponent.Type].GadgetSlots <= 0) + d = 0; + else if (Difficulty <= HARD) + { + d = GetRandom( Shiptype[Opponent.Type].GadgetSlots + 1 ); + if (d < Shiptype[Opponent.Type].GadgetSlots) + if (Tries > 4) + ++d; + else if (Tries > 2) + d += GetRandom( 2 ); + } + else + d = Shiptype[Opponent.Type].GadgetSlots; + for (i=0; i= MAXGADGETTYPE - 1) + break; + ++j; + sum += Gadgettype[j].Chance; + } + if (!HasGadget( &Opponent, j )) + if (j > f) + f = j; + ++e; + } + Opponent.Gadget[i] = f; + } + for (i=d; i 5) + { + if (Difficulty >= NORMAL) + { + m = 3 + GetRandom( Bays - 5 ); + sum = min( m, 15 ); + } + else + sum = Bays; + if (Opp == POLICE) + sum = 0; + if (Opp == PIRATE) + { + if (Difficulty < NORMAL) + sum = (sum * 4) / 5; + else + sum = sum / Difficulty; + } + if (sum < 1) + sum = 1; + + i = 0; + while (i < sum) + { + j = GetRandom( MAXTRADEITEM ); + k = 1 + GetRandom( 10 - j ); + if (i + k > sum) + k = sum - i; + Opponent.Cargo[j] += k; + i += k; + } + } + + // Fill the fuel tanks + Opponent.Fuel = Shiptype[Opponent.Type].FuelTanks; + + // No tribbles on board + Opponent.Tribbles = 0; + + // Fill the weapon slots (if possible, at least one weapon) + if (Shiptype[Opponent.Type].WeaponSlots <= 0) + d = 0; + else if (Shiptype[Opponent.Type].WeaponSlots <= 1) + d = 1; + else if (Difficulty <= HARD) + { + d = 1 + GetRandom( Shiptype[Opponent.Type].WeaponSlots ); + if (d < Shiptype[Opponent.Type].WeaponSlots) + if (Tries > 4 && Difficulty >= HARD) + ++d; + else if (Tries > 3 || Difficulty >= HARD) + d += GetRandom( 2 ); + } + else + d = Shiptype[Opponent.Type].WeaponSlots; + for (i=0; i= MAXWEAPONTYPE - 1) + break; + ++j; + sum += Weapontype[j].Chance; + } + if (j > f) + f = j; + ++e; + } + Opponent.Weapon[i] = f; + } + for (i=d; i 3) + ++d; + else if (Tries > 1) + d += GetRandom( 2 ); + } + else + d = Shiptype[Opponent.Type].ShieldSlots; + for (i=0; i= MAXSHIELDTYPE - 1) + break; + ++j; + sum += Shieldtype[j].Chance; + } + if (j > f) + f = j; + ++e; + } + Opponent.Shield[i] = f; + + j = 0; + k = 0; + while (j < 5) + { + e = 1 + GetRandom( Shieldtype[Opponent.Shield[i]].Power ); + if (e > k) + k = e; + ++j; + } + Opponent.ShieldStrength[i] = k; + } + for (i=d; i= 0 && GetRandom( 10 ) <= 7) + Opponent.Hull = Shiptype[Opponent.Type].HullStrength; + else + { + while (i < 5) + { + d = 1 + GetRandom( Shiptype[Opponent.Type].HullStrength ); + if (d > k) + k = d; + ++i; + } + Opponent.Hull = k; + } + + if (Opp == MANTIS || Opp == FAMOUSCAPTAIN) + Opponent.Hull = Shiptype[Opponent.Type].HullStrength; + + + // Set the crew. These may be duplicates, or even equal to someone aboard + // the commander's ship, but who cares, it's just for the skills anyway. + Opponent.Crew[0] = MAXCREWMEMBER; + Mercenary[Opponent.Crew[0]].Pilot = 1 + GetRandom( MAXSKILL ); + Mercenary[Opponent.Crew[0]].Fighter = 1 + GetRandom( MAXSKILL ); + Mercenary[Opponent.Crew[0]].Trader = 1 + GetRandom( MAXSKILL ); + Mercenary[Opponent.Crew[0]].Engineer = 1 + GetRandom( MAXSKILL ); + if (WarpSystem == KRAVATSYSTEM && WildStatus == 1 && (GetRandom(10)= HARD && d < Shiptype[Opponent.Type].CrewQuarters) + ++d; + } + else + d = Shiptype[Opponent.Type].CrewQuarters; + for (i=1; i 0) + { + --SolarSystem[i].CountDown; + if (SolarSystem[i].CountDown > STARTCOUNTDOWN) + SolarSystem[i].CountDown = STARTCOUNTDOWN; + else if (SolarSystem[i].CountDown <= 0) + InitializeTradeitems( i ); + else + { + for (j=0; j= BEGINNER && Hscores[i].Difficulty <= IMPOSSIBLE) + { + StrCat( SBuf, DifficultyLevel[Hscores[i].Difficulty] ); + StrCat( SBuf, " level" ); + } + StrToLower( SBuf2, SBuf ); + setLabelText( frm, HighScoresModeWorth0Label + i, SBuf2 ); + } + + FrmDoDialog( frm ); + + FrmDeleteForm( frm ); +} + +// ************************************************************************* +// Clear high scores +// ************************************************************************* +void ClearHighScores( void ) +{ + int d; + DmOpenRef pmDB; + + d = FrmAlert( ClearTableAlert ); + if (d == ClearTableYes) + { + pmDB = OpenDatabase(); + InitHighScores(); + SaveStatus( pmDB ); + DmCloseDatabase( pmDB ); + } +} + +// ************************************************************************* +// Start a new game +// ************************************************************************* +Boolean StartNewGame( void ) +{ + int i, j, k, d, x, y; + Boolean Redo, CloseFound, FreeWormhole; + + if (NameCommander[0] == '\0') + StrCopy( NameCommander, "Shelby" ); + + EraseRectangle( 0, 0, 160, 160 ); + + FntSetFont( stdFont ); + DrawChars( "Creating Galaxy...", 44, 76 ); + + // Initialize Galaxy + i = 0; + while (i < MAXSOLARSYSTEM) + { + if (i < MAXWORMHOLE) + { + // Place the first system somewhere in the centre + SolarSystem[i].X = (char)(((CLOSEDISTANCE>>1) - + GetRandom( CLOSEDISTANCE )) + ((GALAXYWIDTH * (1 + 2*(i%3)))/6)); + SolarSystem[i].Y = (char)(((CLOSEDISTANCE>>1) - + GetRandom( CLOSEDISTANCE )) + ((GALAXYHEIGHT * (i < 3 ? 1 : 3))/4)); + Wormhole[i] = (char)i; + } + else + { + SolarSystem[i].X = (char)(1 + GetRandom( GALAXYWIDTH - 2 )); + SolarSystem[i].Y = (char)(1 + GetRandom( GALAXYHEIGHT - 2 )); + } + + CloseFound = false; + Redo = false; + if (i >= MAXWORMHOLE) + { + for (j=0; j= MAXWORMHOLE) && !CloseFound) + continue; + + SolarSystem[i].TechLevel = (char)(GetRandom( MAXTECHLEVEL )); + SolarSystem[i].Politics = (char)(GetRandom( MAXPOLITICS )); + if (Politics[SolarSystem[i].Politics].MinTechLevel > SolarSystem[i].TechLevel) + continue; + if (Politics[SolarSystem[i].Politics].MaxTechLevel < SolarSystem[i].TechLevel) + continue; + + if (GetRandom( 5 ) >= 3) + SolarSystem[i].SpecialResources = (char)(1 + GetRandom( MAXRESOURCES - 1 )); + else + SolarSystem[i].SpecialResources = 0; + + SolarSystem[i].Size = (char)(GetRandom( MAXSIZE )); + + if (GetRandom( 100 ) < 15) + SolarSystem[i].Status = 1 + GetRandom( MAXSTATUS - 1 ); + else + SolarSystem[i].Status = UNEVENTFUL; + + SolarSystem[i].NameIndex = i; + SolarSystem[i].Special = -1; + SolarSystem[i].CountDown = 0; + SolarSystem[i].Visited = false; + + InitializeTradeitems( i ); + + ++i; + } + + // Randomize the system locations a bit more, otherwise the systems with the first + // names in the alphabet are all in the centre + for (i=0; i= 70 && j < d && SolarSystem[i].Special < 0 && + d != GEMULONSYSTEM && d!= DALEDSYSTEM) + { + k = i; + d = j; + } + } + if (k >= 0) + { + SolarSystem[k].Special = GETREACTOR; + SolarSystem[NIXSYSTEM].Special = REACTORDELIVERED; + } + + + i = 0; + while (i < MAXSOLARSYSTEM) + { + d = 1 + (GetRandom( MAXSOLARSYSTEM - 1 )); + if (SolarSystem[d].Special < 0 && SolarSystem[d].TechLevel >= MAXTECHLEVEL-1 && + d != GEMULONSYSTEM && d != DALEDSYSTEM) + { + SolarSystem[d].Special = ARTIFACTDELIVERY; + break; + } + ++i; + } + if (i >= MAXSOLARSYSTEM) + SpecialEvent[ALIENARTIFACT].Occurrence = 0; + + + d = 999; + k = -1; + for (i=0; i= 70 && j < d && SolarSystem[i].Special < 0 && + k != DALEDSYSTEM && k!= GEMULONSYSTEM) + { + k = i; + d = j; + } + } + if (k >= 0) + { + SolarSystem[k].Special = ALIENINVASION; + SolarSystem[GEMULONSYSTEM].Special = GEMULONRESCUED; + } + + d = 999; + k = -1; + for (i=0; i= 70 && j < d && SolarSystem[i].Special < 0) + { + k = i; + d = j; + } + } + if (k >= 0) + { + SolarSystem[k].Special = EXPERIMENT; + SolarSystem[DALEDSYSTEM].Special = EXPERIMENTSTOPPED; + } + + + for (i=MOONFORSALE; i= 0) + continue; + + // Seek at least an agricultural planet as startplanet (but not too hi-tech) + if ((i < 100) && ((CURSYSTEM.TechLevel <= 0) || + (CURSYSTEM.TechLevel >= 6))) + continue; + + // Make sure at least three other systems can be reached + d = 0; + for (j=0; j= 3) + break; + } + } + if (d < 3) + continue; + + break; + } + + Credits = 1000; + Debt = 0; + Days = 0; + WarpSystem = COMMANDER.CurSystem; + PoliceKills = 0; + TraderKills = 0; + PirateKills = 0; + PoliceRecordScore = 0; + ReputationScore = 0; + MonsterStatus = 0; + DragonflyStatus = 0; + ScarabStatus = 0; + JaporiDiseaseStatus = 0; + MoonBought = false; + MonsterHull = Shiptype[SpaceMonster.Type].HullStrength; + EscapePod = false; + Insurance = false; + RemindLoans = true; + NoClaim = 0; + ArtifactOnBoard = false; + for (i=0; i 0 && InvasionStatus < 8) + { + InvasionStatus += Amount; + if (InvasionStatus >= 8) + { + SolarSystem[GEMULONSYSTEM].Special = GEMULONINVADED; + SolarSystem[GEMULONSYSTEM].TechLevel = 0; + SolarSystem[GEMULONSYSTEM].Politics = ANARCHY; + } + } + + if (ReactorStatus > 0 && ReactorStatus < 21) + { + ReactorStatus += Amount; + if (ReactorStatus > 20) + ReactorStatus = 20; + + } + + if (ExperimentStatus > 0 && ExperimentStatus < 12) + { + ExperimentStatus += Amount; + if (ExperimentStatus > 11) + { + FabricRipProbability = FABRICRIPINITIALPROBABILITY; + SolarSystem[DALEDSYSTEM].Special = EXPERIMENTNOTSTOPPED; + // in case Amount > 1 + ExperimentStatus = 12; + FrmAlert(ExperimentPerformedAlert); + addNewsEvent(EXPERIMENTPERFORMED); + } + } + else if (ExperimentStatus == 12 && FabricRipProbability > 0) + { + FabricRipProbability -= Amount; + } +} + +// ************************************************************************* +// Travelling to the target system +// ************************************************************************* +void Travel( void ) +{ + int EncounterTest, StartClicks, i, j, Repairs, FirstEmptySlot, rareEncounter; + Boolean Pirate, Trader, Police, Mantis, TryAutoRepair, FoodOnBoard, EasterEgg; + Boolean HaveMilitaryLaser, HaveReflectiveShield; + long previousTribbles; + + Pirate = false; + Trader = false; + Police = false; + Mantis = false; + HaveMilitaryLaser = HasWeapon(&Ship, MILITARYLASERWEAPON, true); + HaveReflectiveShield = HasShield(&Ship, REFLECTIVESHIELD); + + // if timespace is ripped, we may switch the warp system here. + if (PossibleToGoThroughRip && + ExperimentStatus == 12 && FabricRipProbability > 0 && + (GetRandom(100) < FabricRipProbability || FabricRipProbability == 25)) + { + FrmAlert(FlyInFabricRipAlert); + WarpSystem = GetRandom(MAXSOLARSYSTEM); + } + + PossibleToGoThroughRip=false; + + StartClicks = Clicks; + --Clicks; + + while (Clicks > 0) + { + // Engineer may do some repairs + Repairs = GetRandom( EngineerSkill( &Ship ) ) >> 1; + Ship.Hull += Repairs; + if (Ship.Hull > GetHullStrength()) + { + Repairs = Ship.Hull - GetHullStrength(); + Ship.Hull = GetHullStrength(); + } + else + Repairs = 0; + + // Shields are easier to repair + Repairs = 2 * Repairs; + for (i=0; i Shieldtype[Ship.Shield[i]].Power) + { + Repairs = Ship.ShieldStrength[i] - Shieldtype[Ship.Shield[i]].Power; + Ship.ShieldStrength[i] = Shieldtype[Ship.Shield[i]].Power; + } + else + Repairs = 0; + } + + // Encounter with space monster + if ((Clicks == 1) && (WarpSystem == ACAMARSYSTEM) && (MonsterStatus == 1)) + { + MemMove( &Opponent, &SpaceMonster, sizeof( Opponent ) ); + Opponent.Hull = MonsterHull; + Mercenary[Opponent.Crew[0]].Pilot = 8 + Difficulty; + Mercenary[Opponent.Crew[0]].Fighter = 8 + Difficulty; + Mercenary[Opponent.Crew[0]].Trader = 1; + Mercenary[Opponent.Crew[0]].Engineer = 1 + Difficulty; + if (Cloaked( &Ship, &Opponent )) + EncounterType = SPACEMONSTERIGNORE; + else + EncounterType = SPACEMONSTERATTACK; + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + + // Encounter with the stolen Scarab + if (Clicks == 20 && SolarSystem[WarpSystem].Special == SCARABDESTROYED && + ScarabStatus == 1 && ArrivedViaWormhole) + { + MemMove( &Opponent, &Scarab, sizeof( Opponent ) ); + Mercenary[Opponent.Crew[0]].Pilot = 5 + Difficulty; + Mercenary[Opponent.Crew[0]].Fighter = 6 + Difficulty; + Mercenary[Opponent.Crew[0]].Trader = 1; + Mercenary[Opponent.Crew[0]].Engineer = 6 + Difficulty; + if (Cloaked( &Ship, &Opponent )) + EncounterType = SCARABIGNORE; + else + EncounterType = SCARABATTACK; + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + // Encounter with stolen Dragonfly + if ((Clicks == 1) && (WarpSystem == ZALKONSYSTEM) && (DragonflyStatus == 4)) + { + MemMove( &Opponent, &Dragonfly, sizeof( Opponent ) ); + Mercenary[Opponent.Crew[0]].Pilot = 4 + Difficulty; + Mercenary[Opponent.Crew[0]].Fighter = 6 + Difficulty; + Mercenary[Opponent.Crew[0]].Trader = 1; + Mercenary[Opponent.Crew[0]].Engineer = 6 + Difficulty; + if (Cloaked( &Ship, &Opponent )) + EncounterType = DRAGONFLYIGNORE; + else + EncounterType = DRAGONFLYATTACK; + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + + if (WarpSystem == GEMULONSYSTEM && InvasionStatus > 7) + { + if (GetRandom( 10 ) > 4) + Mantis = true; + } + else + { + // Check if it is time for an encounter + EncounterTest = GetRandom( 44 - (2 * Difficulty) ); + + // encounters are half as likely if you're in a flea. + if (Ship.Type == 0) + EncounterTest *= 2; + + if (EncounterTest < Politics[SolarSystem[WarpSystem].Politics].StrengthPirates && + !Raided) // When you are already raided, other pirates have little to gain + Pirate = true; + else if (EncounterTest < + Politics[SolarSystem[WarpSystem].Politics].StrengthPirates + + STRENGTHPOLICE( WarpSystem )) + // StrengthPolice adapts itself to your criminal record: you'll + // encounter more police if you are a hardened criminal. + Police = true; + else if (EncounterTest < + Politics[SolarSystem[WarpSystem].Politics].StrengthPirates + + STRENGTHPOLICE( WarpSystem ) + + Politics[SolarSystem[WarpSystem].Politics].StrengthTraders) + Trader = true; + else if (WildStatus == 1 && WarpSystem == KRAVATSYSTEM) + { + // if you're coming in to Kravat & you have Wild onboard, there'll be swarms o' cops. + rareEncounter = GetRandom(100); + if (Difficulty <= EASY && rareEncounter < 25) + { + Police = true; + } + else if (Difficulty == NORMAL && rareEncounter < 33) + { + Police = true; + } + else if (Difficulty > NORMAL && rareEncounter < 50) + { + Police = true; + } + } + if (!(Trader || Police || Pirate)) + if (ArtifactOnBoard && GetRandom( 20 ) <= 3) + Mantis = true; + } + + // Encounter with police + if (Police) + { + GenerateOpponent( POLICE ); + EncounterType = POLICEIGNORE; + // If you are cloaked, they don't see you + if (Cloaked( &Ship, &Opponent )) + EncounterType = POLICEIGNORE; + else if (PoliceRecordScore < DUBIOUSSCORE) + { + // If you're a criminal, the police will tend to attack + if (TotalWeapons( &Opponent, -1, -1) <= 0) + { + if (Cloaked( &Opponent, &Ship )) + EncounterType = POLICEIGNORE; + else + EncounterType = POLICEFLEE; + } + if (ReputationScore < AVERAGESCORE) + EncounterType = POLICEATTACK; + else if (GetRandom( ELITESCORE ) > (ReputationScore / (1 + Opponent.Type))) + EncounterType = POLICEATTACK; + else if (Cloaked( &Opponent, &Ship )) + EncounterType = POLICEIGNORE; + else + EncounterType = POLICEFLEE; + } + else if (PoliceRecordScore >= DUBIOUSSCORE && + PoliceRecordScore < CLEANSCORE && !Inspected) + { + // If you're reputation is dubious, the police will inspect you + EncounterType = POLICEINSPECTION; + Inspected = true; + } + else if (PoliceRecordScore < LAWFULSCORE) + { + // If your record is clean, the police will inspect you with a chance of 10% on Normal + if (GetRandom( 12 - Difficulty ) < 1 && !Inspected) + { + EncounterType = POLICEINSPECTION; + Inspected = true; + } + } + else + { + // If your record indicates you are a lawful trader, the chance on inspection drops to 2.5% + if (GetRandom( 40 ) == 1 && !Inspected) + { + EncounterType = POLICEINSPECTION; + Inspected = true; + } + } + + // if you're suddenly stuck in a lousy ship, Police won't flee even if you + // have a fearsome reputation. + if (EncounterType == POLICEFLEE && Opponent.Type > Ship.Type) + { + if (PoliceRecordScore < DUBIOUSSCORE) + { + EncounterType = POLICEATTACK; + } + else + { + EncounterType = POLICEINSPECTION; + } + } + + // If they ignore you and you can't see them, the encounter doesn't take place + if (EncounterType == POLICEIGNORE && Cloaked( &Opponent, &Ship )) + { + --Clicks; + continue; + } + + + // If you automatically don't want to confront someone who ignores you, the + // encounter may not take place + if (AlwaysIgnorePolice && (EncounterType == POLICEIGNORE || + EncounterType == POLICEFLEE)) + { + --Clicks; + continue; + } + + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + // Encounter with pirate + else if (Pirate || Mantis) + { + if (Mantis) + GenerateOpponent( MANTIS ); + else + GenerateOpponent( PIRATE ); + + // If you have a cloak, they don't see you + if (Cloaked( &Ship, &Opponent )) + EncounterType = PIRATEIGNORE; + + // Pirates will mostly attack, but they are cowardly: if your rep is too high, they tend to flee + else if (Opponent.Type >= 7 || + GetRandom( ELITESCORE ) > (ReputationScore * 4) / (1 + Opponent.Type)) + EncounterType = PIRATEATTACK; + else + EncounterType = PIRATEFLEE; + + if (Mantis) + EncounterType = PIRATEATTACK; + + // if Pirates are in a better ship, they won't flee, even if you have a very scary + // reputation. + if (EncounterType == PIRATEFLEE && Opponent.Type > Ship.Type) + { + EncounterType = PIRATEATTACK; + } + + + // If they ignore you or flee and you can't see them, the encounter doesn't take place + if ((EncounterType == PIRATEIGNORE || EncounterType == PIRATEFLEE) && + Cloaked( &Opponent, &Ship )) + { + --Clicks; + continue; + } + if (AlwaysIgnorePirates && (EncounterType == PIRATEIGNORE || + EncounterType == PIRATEFLEE)) + { + --Clicks; + continue; + } + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + // Encounter with trader + else if (Trader) + { + GenerateOpponent( TRADER ); + EncounterType = TRADERIGNORE; + // If you are cloaked, they don't see you + if (Cloaked( &Ship, &Opponent )) + EncounterType = TRADERIGNORE; + // If you're a criminal, traders tend to flee if you've got at least some reputation + else if (PoliceRecordScore <= CRIMINALSCORE) + { + if (GetRandom( ELITESCORE ) <= (ReputationScore * 10) / (1 + Opponent.Type)) + { + if (Cloaked( &Opponent, &Ship )) + EncounterType = TRADERIGNORE; + else + EncounterType = TRADERFLEE; + } + } + + // Will there be trade in orbit? + if (EncounterType == TRADERIGNORE && (GetRandom(1000) < ChanceOfTradeInOrbit)) + { + if (FilledCargoBays() < TotalCargoBays() && + HasTradeableItems(&Opponent, WarpSystem, TRADERSELL)) + EncounterType = TRADERSELL; + + // we fudge on whether the trader has capacity to carry the stuff he's buying. + if (HasTradeableItems(&Ship, WarpSystem, TRADERBUY) && EncounterType != TRADERSELL) + EncounterType = TRADERBUY; + } + + // If they ignore you and you can't see them, the encounter doesn't take place + if ((EncounterType == TRADERIGNORE || EncounterType == TRADERFLEE || + EncounterType == TRADERSELL || EncounterType == TRADERBUY) && + Cloaked( &Opponent, &Ship )) + { + --Clicks; + continue; + } + // pay attention to user's prefs with regard to ignoring traders + if (AlwaysIgnoreTraders && (EncounterType == TRADERIGNORE || + EncounterType == TRADERFLEE)) + { + --Clicks; + continue; + } + // pay attention to user's prefs with regard to ignoring trade in orbit + if (AlwaysIgnoreTradeInOrbit && (EncounterType == TRADERBUY || + EncounterType == TRADERSELL)) + { + --Clicks; + continue; + } + + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + // Very Rare Random Events: + // 1. Encounter the abandoned Marie Celeste, which you may loot. + // 2. Captain Ahab will trade your Reflective Shield for skill points in Piloting. + // 3. Captain Conrad will trade your Military Laser for skill points in Engineering. + // 4. Captain Huie will trade your Military Laser for points in Trading. + // 5. Encounter an out-of-date bottle of Captain Marmoset's Skill Tonic. This + // will affect skills depending on game difficulty level. + // 6. Encounter a good bottle of Captain Marmoset's Skill Tonic, which will invoke + // IncreaseRandomSkill one or two times, depending on game difficulty. + else if ((Days > 10) && (GetRandom(1000) < ChanceOfVeryRareEncounter )) + { + rareEncounter = GetRandom(MAXVERYRAREENCOUNTER); + + switch (rareEncounter) + { + case MARIECELESTE: + if (!(VeryRareEncounter & (Byte)ALREADYMARIE)) + { + VeryRareEncounter += ALREADYMARIE; + EncounterType = MARIECELESTEENCOUNTER; + GenerateOpponent( TRADER ); + for (i=0;i CRIMINALSCORE && + !(VeryRareEncounter & (Byte)ALREADYAHAB)) + { + VeryRareEncounter += ALREADYAHAB; + EncounterType = CAPTAINAHABENCOUNTER; + GenerateOpponent( FAMOUSCAPTAIN ); + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + break; + + case CAPTAINCONRAD: + if (HaveMilitaryLaser && COMMANDER.Engineer < 10 && + PoliceRecordScore > CRIMINALSCORE && + !(VeryRareEncounter & (Byte)ALREADYCONRAD)) + { + VeryRareEncounter += ALREADYCONRAD; + EncounterType = CAPTAINCONRADENCOUNTER; + GenerateOpponent( FAMOUSCAPTAIN ); + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + break; + + case CAPTAINHUIE: + if (HaveMilitaryLaser && COMMANDER.Trader < 10 && + PoliceRecordScore > CRIMINALSCORE && + !(VeryRareEncounter & (Byte)ALREADYHUIE)) + { + VeryRareEncounter = VeryRareEncounter | ALREADYHUIE; + EncounterType = CAPTAINHUIEENCOUNTER; + GenerateOpponent( FAMOUSCAPTAIN ); + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + break; + case BOTTLEOLD: + if (!(VeryRareEncounter & (Byte)ALREADYBOTTLEOLD)) + { + VeryRareEncounter = VeryRareEncounter | ALREADYBOTTLEOLD; + EncounterType = BOTTLEOLDENCOUNTER; + GenerateOpponent( TRADER ); + Opponent.Type = BOTTLETYPE; + Opponent.Hull = 10; + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + break; + case BOTTLEGOOD: + if (!(VeryRareEncounter & (Byte)ALREADYBOTTLEGOOD)) + { + VeryRareEncounter = VeryRareEncounter | ALREADYBOTTLEGOOD; + EncounterType = BOTTLEGOODENCOUNTER; + GenerateOpponent( TRADER ); + Opponent.Type = BOTTLETYPE; + Opponent.Hull = 10; + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + break; + } + } + + --Clicks; + } + + // ah, just when you thought you were gonna get away with it... + if (JustLootedMarie) + { + GenerateOpponent( POLICE ); + EncounterType = POSTMARIEPOLICEENCOUNTER; + JustLootedMarie = false; + Clicks++; + CurForm = EncounterForm; + FrmGotoForm( CurForm ); + return; + } + + // Arrival in the target system + FrmAlert( (StartClicks > 20 ? UneventfulTripAlert : ArrivalAlert ) ); + + // Check for Large Debt - 06/30/01 SRA + if (Debt >= 75000 ) FrmAlert (DebtWarningAlert); + + // Debt Reminder + if (Debt > 0 && RemindLoans && Days % 5 == 0) + { + StrIToA(SBuf2, Debt); + FrmCustomAlert( LoanAmountAlert, SBuf2, " ", " "); + } + + Arrival(); + + // Reactor warnings: + // now they know the quest has a time constraint! + if (ReactorStatus == 2) FrmAlert( ReactorConsumeAlert); + // better deliver it soon! + else if (ReactorStatus == 16) FrmAlert( ReactorNoiseAlert); + // last warning! + else if (ReactorStatus == 18) FrmAlert( ReactorSmokeAlert); + + if (ReactorStatus == 20) + { + FrmAlert( ReactorMeltdownAlert ); + ReactorStatus = 0; + if (EscapePod) + { + EscapeWithPod(); + return; + } + else + { + FrmAlert( ShipDestroyedAlert ); + CurForm = DestroyedForm; + FrmGotoForm( CurForm ); + return; + } + + } + + if (TrackAutoOff && TrackedSystem == COMMANDER.CurSystem) + { + TrackedSystem = -1; + } + + FoodOnBoard = false; + previousTribbles = Ship.Tribbles; + + if (Ship.Tribbles > 0 && ReactorStatus > 0 && ReactorStatus < 21) + { + Ship.Tribbles /= 2; + if (Ship.Tribbles < 10) + { + Ship.Tribbles = 0; + FrmAlert ( TribblesAllIrradiatedAlert ); + } + else + { + FrmAlert ( TribblesIrradiatedAlert ); + } + } + else if (Ship.Tribbles > 0 && Ship.Cargo[NARCOTICS] > 0) + { + Ship.Tribbles = 1 + GetRandom( 3 ); + j = 1 + GetRandom( 3 ); + i = min( j, Ship.Cargo[NARCOTICS] ); + BuyingPrice[NARCOTICS] = (BuyingPrice[NARCOTICS] * + (Ship.Cargo[NARCOTICS] - i)) / Ship.Cargo[NARCOTICS]; + Ship.Cargo[NARCOTICS] -= i; + Ship.Cargo[FURS] += i; + FrmAlert( TribblesAteNarcoticsAlert ); + } + else if (Ship.Tribbles > 0 && Ship.Cargo[FOOD] > 0) + { + Ship.Tribbles += 100 + GetRandom( Ship.Cargo[FOOD] * 100 ); + i = GetRandom( Ship.Cargo[FOOD] ); + BuyingPrice[FOOD] = (BuyingPrice[FOOD] * i) / Ship.Cargo[FOOD]; + Ship.Cargo[FOOD] = i; + FrmAlert( TribblesAteFoodAlert ); + FoodOnBoard = true; + } + + if (Ship.Tribbles > 0 && Ship.Tribbles < MAXTRIBBLES) + Ship.Tribbles += 1 + GetRandom( max( 1, (Ship.Tribbles >> (FoodOnBoard ? 0 : 1)) ) ); + + if (Ship.Tribbles > MAXTRIBBLES) + Ship.Tribbles = MAXTRIBBLES; + + if ((previousTribbles < 100 && Ship.Tribbles >= 100) || + (previousTribbles < 1000 && Ship.Tribbles >= 1000) || + (previousTribbles < 10000 && Ship.Tribbles >= 10000) || + (previousTribbles < 50000 && Ship.Tribbles >= 50000)) + { + if (Ship.Tribbles >= MAXTRIBBLES) + StrCopy( SBuf, "a dangerous number of" ); + else + StrPrintF(SBuf, "%ld", Ship.Tribbles); + FrmCustomAlert( TribblesOnBoardAlert, SBuf, NULL, NULL); + } + + TribbleMessage = false; + + Ship.Hull += GetRandom( EngineerSkill( &Ship ) ); + if (Ship.Hull > GetHullStrength()) + Ship.Hull = GetHullStrength(); + + TryAutoRepair = true; + if (AutoFuel) + { + BuyFuel( 999 ); + if (GetFuel() < GetFuelTanks()) + { + if (AutoRepair && Ship.Hull < GetHullStrength()) + { + FrmAlert( NoFullTanksOrRepairsAlert ); + TryAutoRepair = false; + } + else + FrmAlert( NoFullTanksAlert ); + } + } + + if (AutoRepair && TryAutoRepair) + { + BuyRepairs( 9999 ); + if (Ship.Hull < GetHullStrength()) + FrmAlert( NoFullRepairsAlert ); + } + + /* This Easter Egg gives the commander a Lighting Shield */ + if (COMMANDER.CurSystem == OGSYSTEM) + { + i = 0; + EasterEgg = false; + while (i < MAXTRADEITEM) + { + if (Ship.Cargo[i] != 1) + break; + ++i; + } + if (i >= MAXTRADEITEM) + { + FrmAlert( EggAlert ); + + FirstEmptySlot = GetFirstEmptySlot( Shiptype[Ship.Type].ShieldSlots, Ship.Shield ); + + if (FirstEmptySlot >= 0) + { + Ship.Shield[FirstEmptySlot] = LIGHTNINGSHIELD; + Ship.ShieldStrength[FirstEmptySlot] = Shieldtype[LIGHTNINGSHIELD].Power; + EasterEgg = true; + } + + + if (EasterEgg) + { + for (i=0; ieType) + { + case frmOpenEvent: + FrmDrawForm ( frmP ); + handled = true; + break; + + case penDownEvent: + case keyDownEvent: + EraseRectangle( 0, 0, 160, 160 ); + EndOfGame( EndStatus ); + handled = true; + break; + + default: + break; + } + + return handled; +} + + +// ************************************************************************* +// This routine is the event handler for the Utopia screen. +// ************************************************************************* +Boolean UtopiaFormHandleEvent( EventPtr eventP ) +{ + return RetireDestroyedUtopiaFormHandleEvent( eventP, MOON ); +} + + +// ************************************************************************* +// This routine is the event handler for the Destroyed screen. +// ************************************************************************* +Boolean DestroyedFormHandleEvent( EventPtr eventP ) +{ + return RetireDestroyedUtopiaFormHandleEvent( eventP, KILLED ); +} + + +// ************************************************************************* +// This routine is the event handler for the Retire screen. +// ************************************************************************* +Boolean RetireFormHandleEvent( EventPtr eventP ) +{ + return RetireDestroyedUtopiaFormHandleEvent( eventP, RETIRED ); +} + + +// ************************************************************************* +// Determine if ship is cloaked +// ************************************************************************* +Boolean Cloaked( SHIP* Sh, SHIP* Opp ) +{ + return (HasGadget( Sh, CLOAKINGDEVICE ) && (EngineerSkill( Sh ) > EngineerSkill( Opp ))); +} + + +// ************************************************************************* +// Determine first empty slot, return -1 if none +// ************************************************************************* +int GetFirstEmptySlot( char Slots, int* Item ) +{ + int FirstEmptySlot, j; + + FirstEmptySlot = -1; + for (j=0; jType].WeaponSlots; ++j) + { + if (ship->Weapon[j] < 0) + { + return true; + } + } + for (j=0; jType].ShieldSlots; ++j) + { + if (ship->Shield[j] < 0) + { + return true; + } + } + for (j=0; jType].GadgetSlots; ++j) + { + if (ship->Gadget[j] < 0) + { + return true; + } + } + + return false; +} + +// ************************************************************************* +// Handling of the New Commander +// ************************************************************************* +Boolean NewCommanderFormHandleEvent(EventPtr eventP) +{ + int CommanderNameLen; + Boolean handled = false; + FormPtr frmP = FrmGetActiveForm(); + + switch (eventP->eType) + { + case ctlSelectEvent: + // Closing the New Commander screen + if (eventP->data.ctlSelect.controlID == NewCommanderOKButton) + { + if (2*MAXSKILL - COMMANDER.Pilot - COMMANDER.Fighter - + COMMANDER.Trader - COMMANDER.Engineer > 0) + { + FrmAlert( MoreSkillPointsAlert); + handled = true; + break; + } + + GetField( frmP, NewCommanderEditNameField, NameCommander, NameH ); + + DeterminePrices(COMMANDER.CurSystem); + + if (Difficulty < NORMAL) + if (CURSYSTEM.Special < 0) + CURSYSTEM.Special = LOTTERYWINNER; + + CurForm = SystemInformationForm; + FrmGotoForm( CurForm ); + handled = true; + break; + } + // Tapping of one of the skill increase or decrease buttons + switch (eventP->data.ctlSelect.controlID) + { + case NewCommanderDecDifficultyButton: + if (Difficulty > 0) + --Difficulty; + break; + + case NewCommanderIncDifficultyButton: + if (Difficulty < MAXDIFFICULTY - 1) + ++Difficulty; + break; + + case NewCommanderDecPilotButton: + if (COMMANDER.Pilot > 1) + --COMMANDER.Pilot; + break; + + case NewCommanderIncPilotButton: + if (COMMANDER.Pilot < MAXSKILL) + if (2*MAXSKILL - COMMANDER.Pilot - COMMANDER.Fighter - + COMMANDER.Trader - COMMANDER.Engineer > 0) + ++COMMANDER.Pilot; + break; + + case NewCommanderDecFighterButton: + if (COMMANDER.Fighter > 1) + --COMMANDER.Fighter; + break; + + case NewCommanderIncFighterButton: + if (COMMANDER.Fighter < MAXSKILL) + if (2*MAXSKILL - COMMANDER.Pilot - COMMANDER.Fighter - + COMMANDER.Trader - COMMANDER.Engineer > 0) + ++COMMANDER.Fighter; + break; + + case NewCommanderDecTraderButton: + if (COMMANDER.Trader > 1) + --COMMANDER.Trader; + break; + + case NewCommanderIncTraderButton: + if (COMMANDER.Trader < MAXSKILL) + if (2*MAXSKILL - COMMANDER.Pilot - COMMANDER.Fighter - + COMMANDER.Trader - COMMANDER.Engineer > 0) + ++COMMANDER.Trader; + break; + + case NewCommanderDecEngineerButton: + if (COMMANDER.Engineer > 1) + --COMMANDER.Engineer; + break; + + case NewCommanderIncEngineerButton: + if (COMMANDER.Engineer < MAXSKILL) + if (2*MAXSKILL - COMMANDER.Pilot - COMMANDER.Fighter - + COMMANDER.Trader - COMMANDER.Engineer > 0) + ++COMMANDER.Engineer; + break; + } + NewCommanderDrawSkills(); + handled = true; + break; + + case frmOpenEvent: + // Set Commander name and skills + CommanderNameLen = NAMELEN+1; + NameH = SetField( frmP, NewCommanderEditNameField, NameCommander, CommanderNameLen, true ); + GrfSetState( false, false, false ); + FrmDrawForm ( frmP); + NewCommanderDrawSkills(); + handled = true; + break; + + case frmUpdateEvent: + FrmDrawForm ( frmP ); + NewCommanderDrawSkills(); + handled = true; + break; + + default: + break; + } + + return handled; +} + +// ************************************************************************* +// Handling of the Average Prices form +// ************************************************************************* +Boolean AveragePricesFormHandleEvent(EventPtr eventP) +{ + int i, d, Amount; + Boolean handled = false; + + switch (eventP->eType) + { + case penDownEvent: + for (i=0; iscreenX >= (i/5)*72) && + (eventP->screenX < (i<5 ? 72 : 160)) && + (eventP->screenY >= 46+(i%5)*13) && + (eventP->screenY < 46+(1+(i%5))*13)) + { + Amount = GetAmountToBuy( i ); + if (Amount > 0) + { + BuyCargo( i, Amount, false ); + ShowAveragePrices(); + } + handled = true; + } + } + break; + + case keyDownEvent: + d = ScrollButton( eventP ); + if (d == chrPageUp || d == chrPageDown) + { + i = NextSystemWithinRange( WarpSystem, (d == chrPageDown) ); + if (i >= 0) + { + WarpSystem = i; + ShowAveragePrices(); + } + handled = true; + } + break; + + case ctlSelectEvent: + switch (eventP->data.ctlSelect.controlID) + { + case AveragePricesScrollBackButton: + case AveragePricesScrollFwdButton: + { + i = NextSystemWithinRange( WarpSystem, + (eventP->data.ctlSelect.controlID == AveragePricesScrollBackButton) ); + if (i >= 0) + { + WarpSystem = i; + ShowAveragePrices(); + } + break; + } + + case AveragePricesWarpButton: + { + DoWarp(false); + break; + } + + case AveragePricesSystemInfoButton: + { + CurForm = ExecuteWarpForm; + FrmGotoForm( CurForm ); + break; + } + + case AveragePricesPriceDifferencesButton: + case AveragePricesAbsolutePricesButton: + { + PriceDifferences = !PriceDifferences; + ShowAveragePrices(); + break; + } + + default: + { + CurForm = WarpForm; + FrmGotoForm( CurForm ); + break; + } + } + handled = true; + break; + + case frmOpenEvent: + ShowAveragePrices(); + APLscreen = true; + handled = true; + break; + + case frmUpdateEvent: + ShowAveragePrices(); + handled = true; + break; + + default: + break; + } + + return handled; +} + + +// ************************************************************************* +// Handling of the Execute Warp form +// ************************************************************************* +Boolean ExecuteWarpFormHandleEvent(EventPtr eventP) +{ + Boolean handled = false; + FormPtr frmP; + int i, d; + long IncDebt, Total; + + switch (eventP->eType) + { + case keyDownEvent: + d = ScrollButton( eventP ); + if (d == chrPageUp || d == chrPageDown) + { + i = NextSystemWithinRange( WarpSystem, (d == chrPageDown) ); + if (i >= 0) + { + WarpSystem = i; + ShowExecuteWarp(); + } + handled = true; + } + break; + + case ctlSelectEvent: + switch (eventP->data.ctlSelect.controlID) + { + case ExecuteWarpScrollBackButton: + case ExecuteWarpScrollFwdButton: + { + i = NextSystemWithinRange( WarpSystem, + (eventP->data.ctlSelect.controlID == ExecuteWarpScrollBackButton) ); + if (i >= 0) + { + WarpSystem = i; + ShowExecuteWarp(); + } + break; + } + + // Warp to another system. This can only be selected if the warp is indeed possible + case ExecuteWarpWarpButton: + { + DoWarp(false); + break; + } + + case ExecuteWarpPricesButton: + { + CurForm = AveragePricesForm; + FrmGotoForm( CurForm ); + break; + } + + case ExecuteWarpSpecificationButton: + { + frmP = FrmInitForm( SpecificationForm ); + + Total = 0L; + + StrIToA( SBuf, MercenaryMoney() ); + StrCat( SBuf, " cr." ); + setLabelText( frmP, SpecificationMercenariesLabel, SBuf ); + Total += MercenaryMoney(); + StrIToA( SBuf, InsuranceMoney() ); + Total += InsuranceMoney(); + StrCat( SBuf, " cr." ); + setLabelText( frmP, SpecificationInsuranceLabel, SBuf ); + + StrIToA( SBuf, WormholeTax( COMMANDER.CurSystem, WarpSystem ) ); + StrCat( SBuf, " cr." ); + setLabelText( frmP, SpecificationWormholeTaxLabel, SBuf ); + Total += WormholeTax( COMMANDER.CurSystem, WarpSystem ); + + if (Debt > 0) + { + IncDebt = max( 1, Debt / 10 ); + StrIToA( SBuf, IncDebt ); + Total += IncDebt; + } + else + StrCopy( SBuf, "0" ); + StrCat( SBuf, " cr." ); + setLabelText( frmP, SpecificationInterestLabel, SBuf ); + + StrIToA( SBuf, Total ); + StrCat( SBuf, " cr." ); + setLabelText( frmP, SpecificationTotalLabel, SBuf ); + + FrmDoDialog( frmP ); + + FrmDeleteForm( frmP ); + break; + } + + default: + { + CurForm = WarpForm; + FrmGotoForm( CurForm ); + break; + } + } + handled = true; + break; + + // Give information on the system selected on the short range chart + case frmOpenEvent: + ShowExecuteWarp(); + APLscreen = false; + handled = true; + break; + + case frmUpdateEvent: + ShowExecuteWarp(); + handled = true; + break; + + default: + break; + } + + return handled; +} + diff --git a/Src/WarpFormEvent.c b/Src/WarpFormEvent.c new file mode 100644 index 0000000..555f729 --- /dev/null +++ b/Src/WarpFormEvent.c @@ -0,0 +1,762 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * WarpFormEvent.c + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +#include "external.h" + +// ************************************************************************* +// To draw a circle with centre Xs, Ys and radius R. +// ************************************************************************* +static void DrawCircle( int Xs, int Ys, int R ) +{ + int Xp, Yp, i, Xt, Yt; + + Xp = Xs; + Yp = Ys - R; + for (i=0; i<=R; ++i) + { + Xt = Xs + i; + Yt = Ys - sqrt( SQR( R ) - SQR( i ) ); + WinDrawLine( Xp, Yp, Xt, Yt ); + Xp = Xt; + Yp = Yt; + } + Xp = Xs; + Yp = Ys + R; + for (i=0; i<=R; ++i) + { + Xt = Xs + i; + Yt = Ys + sqrt( SQR( R ) - SQR( i ) ); + WinDrawLine( Xp, Yp, Xt, Yt ); + Xp = Xt; + Yp = Yt; + } + Xp = Xs; + Yp = Ys + R; + for (i=0; i<=R; ++i) + { + Xt = Xs - i; + Yt = Ys + sqrt( SQR( R ) - SQR( i ) ); + WinDrawLine( Xp, Yp, Xt, Yt ); + Xp = Xt; + Yp = Yt; + } + Xp = Xs; + Yp = Ys - R; + for (i=0; i<=R; ++i) + { + Xt = Xs - i; + Yt = Ys - sqrt( SQR( R ) - SQR( i ) ); + WinDrawLine( Xp, Yp, Xt, Yt ); + Xp = Xt; + Yp = Yt; + } +} + +// ************************************************************************* +// Draw the short range chart +// ************************************************************************* +static void DrawShortRange( int Index ) +{ + FormPtr frmP; + RectangleType bounds; + int i, j, Xs, Ys, Xp, Yp, delta; + int dX, dY, dX3, dY3, distToTracked; + + frmP = FrmGetActiveForm(); + + RectangularShortcuts( frmP, WarpBButton ); + + FrmDrawForm ( frmP); + + // Rectangle for chart + bounds.topLeft.x = 0; + bounds.topLeft.y = BOUNDSY - EXTRAERASE; + bounds.extent.x = 160; + bounds.extent.y = 160 - BOUNDSY + EXTRAERASE; + WinEraseRectangle( &bounds, 0 ); + + WinSetClip( &bounds ); + + // Centre of chart + Xs = (int)((SHORTRANGEWIDTH >> 1) + SHORTRANGEBOUNDSX); + Ys = (int)((SHORTRANGEHEIGHT >> 1) + BOUNDSY); + delta = (SHORTRANGEWIDTH / (MAXRANGE << 1)); + + FntSetFont( stdFont ); + + // Draw the maximum range circle + if (GetFuel() > 0) + DrawCircle( Xs, Ys, GetFuel()*delta ); + + // show the tracked system (if any) + if (TrackedSystem >= 0) + { + distToTracked = RealDistance(SolarSystem[COMMANDER.CurSystem], SolarSystem[TrackedSystem]); + if (distToTracked > 0) + { + + dX = (int)(25.0 * ((float)SolarSystem[COMMANDER.CurSystem].X - (float)SolarSystem[TrackedSystem].X) / + (float)distToTracked); + dY = (int)(25.0 * ((float)SolarSystem[COMMANDER.CurSystem].Y - (float)SolarSystem[TrackedSystem].Y) / + (float)distToTracked); + + // draw directional arrow from planet -- I'd do this in color if it were easier. + + dY3 = -(int)(4.0 * ((float)SolarSystem[COMMANDER.CurSystem].X - (float)SolarSystem[TrackedSystem].X) / + (float)distToTracked); + dX3 = (int)(4.0 * ((float)SolarSystem[COMMANDER.CurSystem].Y - (float)SolarSystem[TrackedSystem].Y) / + (float)distToTracked); + + WinDrawLine( Xs - dX, Ys - dY, Xs - dX3, Ys - dY3 ); + WinDrawLine( Xs - dX, Ys - dY, Xs + dX3, Ys + dY3 ); + } + } + + + // Two loops: first draw the names and then the systems. The names may + // overlap and the systems may be drawn on the names, but at least every + // system is visible. + for (j=0; j<2; ++j) + { + for (i=0; i> 1) + + (SolarSystem[i].X - SolarSystem[Index].X) * + (SHORTRANGEWIDTH / (MAXRANGE << 1)) + + SHORTRANGEBOUNDSX - EXTRAERASE); + Yp = (int)((SHORTRANGEHEIGHT >> 1) + + (SolarSystem[i].Y - SolarSystem[Index].Y) * + (SHORTRANGEHEIGHT / (MAXRANGE << 1)) + + BOUNDSY - EXTRAERASE); + if (j == 1) + { + if (i == WarpSystem) + { + WinDrawLine( Xp-2, Yp+3, Xp+8, Yp+3 ); + WinDrawLine( Xp+3, Yp-2, Xp+3, Yp+8 ); + } + WinDrawBitmap( (SolarSystem[i].Visited ? VisitedShortRangeSystemBmpPtr : + ShortRangeSystemBmpPtr), Xp, Yp ); + if (WormholeExists( i, -1 )) + { + delta = WORMHOLEDISTANCE * (SHORTRANGEWIDTH / (MAXRANGE << 1)); + if (WormholeExists( i, WarpSystem )) + { + WinDrawLine( Xp-2+delta, Yp+3, Xp+8+delta, Yp+3 ); + WinDrawLine( Xp+3+delta, Yp-2, Xp+3+delta, Yp+8 ); + } + WinDrawBitmap( WormholeBmpPtr, Xp + delta, Yp ); + } + } + else + { + DrawChars( SolarSystemName[SolarSystem[i].NameIndex], + Xp - StrLen( SolarSystemName[SolarSystem[i].NameIndex] ) * 2, + Yp - 12 ); + } + } + } + } + + // if they're tracking, and they want range info: + if (TrackedSystem >= 0 && ShowTrackedRange) + { + StrPrintF(SBuf, "%d", distToTracked); + StrCat(SBuf, " parsecs to "); + StrCat(SBuf, SolarSystemName[SolarSystem[TrackedSystem].NameIndex]); + DrawChars( SBuf, 0, 149); + } + + WinResetClip(); +} + +// ************************************************************************* +// Draw the galactic chart, with system Index selected. +// ************************************************************************* +static void DrawGalaxy( int Index ) +{ + FormPtr frmP; + RectangleType bounds; + int i; + + frmP = FrmGetActiveForm(); + + RectangularShortcuts( frmP, GalacticChartBButton ); + + FrmDrawForm ( frmP); + + EraseRectangle( 0, 136, 120, 12 ); + + EraseRectangle( 0, 148, 160, 12 ); + + bounds.topLeft.x = 0; + bounds.topLeft.y = BOUNDSY; + bounds.extent.x = 160; + bounds.extent.y = GALAXYHEIGHT+2*EXTRAERASE-2; + WinEraseRectangle( &bounds, 0 ); + + WinSetClip( &bounds ); + + if (GetFuel() > 0) + DrawCircle( CURSYSTEM.X+BOUNDSX, CURSYSTEM.Y+BOUNDSY, GetFuel() ); + + for (i=0; i= 0) + { + DrawChars( SolarSystemName[SolarSystem[Index].NameIndex], 0, 136 ); + StrCopy( SBuf, SystemSize[SolarSystem[Index].Size] ); + StrCat( SBuf, " " ); + StrCat( SBuf, TechLevel[SolarSystem[Index].TechLevel] ); + StrCat( SBuf, " " ); + StrCat( SBuf, Politics[SolarSystem[Index].Politics].Name ); + DrawChars( SBuf, 0, 148 ); + + StrIToA( SBuf, RealDistance( CURSYSTEM, SolarSystem[Index] ) ); + StrCat( SBuf, " parsecs" ); + DrawChars( SBuf, 58, 136 ); + + GalacticChartSystem = Index; + } + else + { + i = -Index - 1; + StrCopy( SBuf, "Wormhole to "); + StrCat( SBuf, SolarSystemName[i < MAXWORMHOLE-1 ? Wormhole[i+1] : Wormhole[0]]); + DrawChars( SBuf, 0,136); + StrCopy ( SBuf, "(from "); + StrCat( SBuf, SolarSystemName[Wormhole[i]]); + StrCat( SBuf, " System)"); + DrawChars( SBuf, 0, 148); + } + + if (CanSuperWarp) + { + FrmShowObject( frmP, FrmGetObjectIndex( frmP, GalacticChartSuperWarpButton ) ); + } + else + { + FrmHideObject( frmP, FrmGetObjectIndex( frmP, GalacticChartSuperWarpButton ) ); + } + +} + +// ************************************************************************* +// Events of the short range chart +// ************************************************************************* +Boolean WarpFormHandleEvent(EventPtr eventP) +{ + Boolean handled = false; + int Xp, Yp, i, Index; + + switch (eventP->eType) + { + // Tap one of the systems on the short range chart + case penDownEvent: + if ((eventP->screenX >= SHORTRANGEBOUNDSX-EXTRAERASE) && + (eventP->screenX <= SHORTRANGEBOUNDSX+SHORTRANGEWIDTH+EXTRAERASE) && + (eventP->screenY >= BOUNDSY-EXTRAERASE) && + (eventP->screenY <= BOUNDSY+SHORTRANGEHEIGHT+EXTRAERASE)) + { + i = 0; + Index = COMMANDER.CurSystem; + while (i < MAXSOLARSYSTEM) + { + Xp = (int)((SHORTRANGEWIDTH >> 1) + + (SolarSystem[i].X - SolarSystem[Index].X) * + (SHORTRANGEWIDTH / (MAXRANGE << 1)) + + SHORTRANGEBOUNDSX); + Yp = (int)((SHORTRANGEHEIGHT >> 1) + + (SolarSystem[i].Y - SolarSystem[Index].Y) * + (SHORTRANGEHEIGHT / (MAXRANGE << 1)) + + BOUNDSY); + if ((ABS( Xp - (eventP->screenX) ) <= MINDISTANCE) && + (ABS( Yp - (eventP->screenY) ) <= MINDISTANCE)) + break; + ++i; + } + if (i < MAXSOLARSYSTEM) + { + WarpSystem = i; + if (!AlwaysInfo && APLscreen && RealDistance( CURSYSTEM, SolarSystem[WarpSystem] ) <= GetFuel() && + RealDistance( CURSYSTEM, SolarSystem[WarpSystem] ) > 0) + CurForm = AveragePricesForm; + else + CurForm = ExecuteWarpForm; + FrmGotoForm( CurForm ); + handled = true; + break; + } + + i = 0; + while (i < MAXWORMHOLE) + { + Xp = (int)((SHORTRANGEWIDTH >> 1) + + (SolarSystem[Wormhole[i]].X + WORMHOLEDISTANCE - SolarSystem[Index].X) * + (SHORTRANGEWIDTH / (MAXRANGE << 1)) + + SHORTRANGEBOUNDSX); + Yp = (int)((SHORTRANGEHEIGHT >> 1) + + (SolarSystem[Wormhole[i]].Y - SolarSystem[Index].Y) * + (SHORTRANGEHEIGHT / (MAXRANGE << 1)) + + BOUNDSY); + if ((ABS( Xp - (eventP->screenX) ) <= MINDISTANCE) && + (ABS( Yp - (eventP->screenY) ) <= MINDISTANCE)) + break; + ++i; + } + if (i < MAXWORMHOLE) + { + if (COMMANDER.CurSystem != Wormhole[i]) + FrmCustomAlert( WormholeOutOfRangeAlert, SolarSystemName[i < MAXWORMHOLE-1 ? Wormhole[i+1] : Wormhole[0]], SolarSystemName[Wormhole[i]], "" ); + else + { + WarpSystem = (i < MAXWORMHOLE-1 ? Wormhole[i+1] : Wormhole[0] ); + if (!AlwaysInfo && APLscreen) + CurForm = AveragePricesForm; + else + CurForm = ExecuteWarpForm; + FrmGotoForm( CurForm ); + } + handled = true; + break; + } + } + break; + + case frmOpenEvent: + DrawShortRange( COMMANDER.CurSystem ); + handled = true; + break; + + case frmUpdateEvent: + DrawShortRange( COMMANDER.CurSystem ); + handled = true; + break; + + default: + break; + } + + return handled; +} + +// ************************************************************************* +// Handling of events on Galactic Chart +// ************************************************************************* +Boolean GalacticChartFormHandleEvent(EventPtr eventP) +{ + Boolean handled = false; + Boolean track = false; + int i=0, d, delta; + static int last = -1; + Handle SystemH; + Handle SystemH2; + FormPtr frm; + char FindSystem[NAMELEN+1]; + Boolean DontLoad; + + switch (eventP->eType) + { + case keyDownEvent: + d = ScrollButton( eventP ); + if (d == chrPageUp || d == chrPageDown) + { + if (d == chrPageDown) + { + i = GalacticChartSystem + 1; + if (i >= MAXSOLARSYSTEM) + i = 0; + } + else + { + i = GalacticChartSystem - 1; + if (i < 0) + i = MAXSOLARSYSTEM-1; + } + DrawGalaxy( i ); + handled = true; + } + break; + + // tap one of the systems + case penDownEvent: + if ((eventP->screenX >= BOUNDSX-EXTRAERASE) && + (eventP->screenX <= BOUNDSX+GALAXYWIDTH+EXTRAERASE) && + (eventP->screenY >= BOUNDSY-EXTRAERASE) && + (eventP->screenY <= BOUNDSY+GALAXYHEIGHT+EXTRAERASE)) + { + + i = 0; + delta = WORMHOLEDISTANCE * (SHORTRANGEWIDTH / (MAXRANGE << 1))>>1; + + while (i < MAXWORMHOLE) + { + if ((ABS( SolarSystem[Wormhole[i]].X + delta - (eventP->screenX - BOUNDSX) ) <= 1) && + (ABS( SolarSystem[Wormhole[i]].Y - (eventP->screenY - BOUNDSY) ) <= 1)) + break; + ++i; + } + + if (i < MAXWORMHOLE) + { + DrawGalaxy(-i-1); + last = -1; + handled = true; + break; + } + + i = 0; + while (i < MAXSOLARSYSTEM) + { + if ((ABS( SolarSystem[i].X - (eventP->screenX - BOUNDSX) ) <= MINDISTANCE>>1) && + (ABS( SolarSystem[i].Y - (eventP->screenY - BOUNDSY) ) <= MINDISTANCE>>1)) + break; + ++i; + } + if (i < MAXSOLARSYSTEM) + { + if (i == TrackedSystem) + { + StrCopy( SBuf, "Do you wish to stop tracking "); + StrCat( SBuf, SolarSystemName[i]); + if (FrmCustomAlert(TrackSystemAlert,SBuf, NULL, NULL) == TrackSystemYes) + { + TrackedSystem = -1; + } + } + else if (i == last) + { + if (TrackedSystem == -1) + { + StrCopy( SBuf, "Do you wish to track "); + StrCat( SBuf, SolarSystemName[i] ); + } + else + { + StrCopy( SBuf, "Do you wish to stop tracking "); + StrCat( SBuf, SolarSystemName[TrackedSystem] ); + StrCat( SBuf, ", and track "); + StrCat( SBuf, SolarSystemName[i] ); + StrCat( SBuf, " instead"); + } + if (FrmCustomAlert(TrackSystemAlert,SBuf, NULL, NULL) == TrackSystemYes) + { + TrackedSystem = i; + } + } + last = i; + DrawGalaxy( i ); + handled = true; + break; + } + + } + break; + + // Find System + case ctlSelectEvent: + if (eventP->data.ctlSelect.controlID == GalacticChartSuperWarpButton) + { + if (TrackedSystem < 0) + { + FrmAlert(NoSystemSelectedAlert); + return true; + } + else if (TrackedSystem == COMMANDER.CurSystem) + { + FrmAlert( NoJumpToCurSystemAlert ); + return true; + } + else if (FrmCustomAlert(UseSingularityAlert, SolarSystemName[TrackedSystem], " ", " ") == UseSingularityUseSingularity) + { + WarpSystem = TrackedSystem; + CanSuperWarp = false; + DoWarp(true); + } + } + else if (eventP->data.ctlSelect.controlID == GalacticChartFindButton) + { + frm = FrmInitForm( FindSystemForm ); + + SystemH = (Handle) SetField( frm, FindSystemSystemField, "", NAMELEN+1, true ); + + d = FrmDoDialog( frm ); + + GetField( frm, FindSystemSystemField, SBuf, SystemH ); + if (SBuf[0] == '\0') + d = FindSystemCancelButton; + else + StrCopy( FindSystem, SBuf ); + + track = GetCheckBox( frm, FindSystemTrackCheckbox ); + + FrmDeleteForm( frm ); + + if (d != FindSystemOKButton) + { + handled = true; + break; + } + if (StrCompare( FindSystem, "Moolah" ) == 0) + { + Credits += 100000; + } + else if (StrCompare( FindSystem, "Very rare" ) == 0) + { + frm = FrmInitForm( RareCheatForm ); + + SetCheckBox( frm, RareCheatMarieCheckbox, VeryRareEncounter & (Byte)ALREADYMARIE ); + SetCheckBox( frm, RareCheatHuieCheckbox, VeryRareEncounter & (Byte)ALREADYHUIE ); + SetCheckBox( frm, RareCheatAhabCheckbox, VeryRareEncounter & (Byte)ALREADYAHAB ); + SetCheckBox( frm, RareCheatConradCheckbox, VeryRareEncounter & (Byte)ALREADYCONRAD ); + SetCheckBox( frm, RareCheatGoodTonicCheckbox, VeryRareEncounter & (Byte)ALREADYBOTTLEGOOD ); + SetCheckBox( frm, RareCheatBadTonicCheckbox, VeryRareEncounter & (Byte)ALREADYBOTTLEOLD ); + StrIToA( SBuf, ChanceOfVeryRareEncounter ); + SystemH = (Handle) SetField( frm, RareCheatChancesField, SBuf, 5, true ); + StrIToA( SBuf, ChanceOfTradeInOrbit ); + SystemH2 = (Handle) SetField( frm, RareCheatTradeField, SBuf, 5, true ); + + d = FrmDoDialog( frm ); + GetField( frm, RareCheatChancesField, SBuf, SystemH ); + if (SBuf[0] != '\0') + { + ChanceOfVeryRareEncounter = StrAToI(SBuf); + } + GetField( frm, RareCheatTradeField, SBuf, SystemH2 ); + if (SBuf[0] != '\0') + { + ChanceOfTradeInOrbit = StrAToI(SBuf); + } + + VeryRareEncounter = 0; + if (GetCheckBox( frm, RareCheatMarieCheckbox)) + VeryRareEncounter |= (Byte)ALREADYMARIE; + if (GetCheckBox( frm, RareCheatHuieCheckbox)) + VeryRareEncounter |= (Byte)ALREADYHUIE; + if (GetCheckBox( frm, RareCheatAhabCheckbox)) + VeryRareEncounter |= (Byte)ALREADYAHAB; + if (GetCheckBox( frm, RareCheatConradCheckbox)) + VeryRareEncounter |= (Byte)ALREADYCONRAD; + if (GetCheckBox( frm, RareCheatGoodTonicCheckbox)) + VeryRareEncounter |= (Byte)ALREADYBOTTLEGOOD; + if (GetCheckBox( frm, RareCheatBadTonicCheckbox)) + VeryRareEncounter |= (Byte)ALREADYBOTTLEOLD; + + FrmDeleteForm( frm ); + } + else if (StrCompare( FindSystem, "Cheetah" ) == 0) + { + CheatCounter = 3; + } + else if (StrNCompare(FindSystem,"Go ",3) == 0 && StrLen(FindSystem) > 3 ) + { + StrCopy(FindSystem, FindSystem+3); + i = 0; + while (i < MAXSOLARSYSTEM) + { + if (StrCaselessCompare( SolarSystemName[i], FindSystem ) >= 0) + break; + ++i; + } + if (i < MAXSOLARSYSTEM) + { + COMMANDER.CurSystem = i; + DrawGalaxy( i ); + } + } + else if (StrCompare( FindSystem, "Quests" ) == 0) + { + frm = FrmInitForm( QuestListForm ); + for (i=0; i 0 && ScarabStatus < 2) + setLabelText( frm, QuestListScarabLabel, SolarSystemName[SolarSystem[i].NameIndex] ); + } + + FrmDoDialog( frm ); + FrmDeleteForm( frm ); + } +#ifdef BETATEST + else if (StrCompare( FindSystem, "Load" ) == 0) +#else + else if (StrCompare( FindSystem, "Timewarp" ) == 0) +#endif + { + DontLoad = false; + if (!GameLoaded) + { + if (FrmAlert( DisableScoringAlert ) != DisableScoringYes) + DontLoad = true; + } + else if (FrmAlert( ReallyLoadAlert ) != ReallyLoadYes) + DontLoad = true; + if (!DontLoad) + { + if (LoadGame( 1 )) + { + GameLoaded = true; + FrmGotoForm( CurForm ); + } + } + } + else + { + i = 0; + while (i < MAXSOLARSYSTEM) + { + if (StrCaselessCompare( SolarSystemName[i], FindSystem ) >= 0) + break; + ++i; + } + if (i >= MAXSOLARSYSTEM) + { + i = COMMANDER.CurSystem; + } + else if (track) + { + TrackedSystem = i; + } + DrawGalaxy( i ); + } + } + handled = true; + break; + + case frmOpenEvent: + DrawGalaxy( COMMANDER.CurSystem ); + handled = true; + break; + + case frmUpdateEvent: + DrawGalaxy( COMMANDER.CurSystem ); + handled = true; + break; + + default: + break; + } + + return handled; +} diff --git a/Src/external.h b/Src/external.h new file mode 100644 index 0000000..f541fed --- /dev/null +++ b/Src/external.h @@ -0,0 +1,205 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * External.h + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ + +// External Definitions +// This file is included into all sources +// Defines Global Variables for external reference +// +// Global Variables defined in Global.c +// Any new Global Variable should be referenced here and can then +// be used in any source file +#define PILOT_PRECOMPILED_HEADERS_OFF 1 + +#include +#include +#include +#include +#include +#include +#include +#include "MerchantRsc.h" +#include "MerchantGraphics.h" +#include "spacetrader.h" // Includes data definitions and Prototypes + +// Global Variables +extern long Credits; +extern long Debt; +extern long PoliceRecordScore; +extern long ReputationScore; +extern long PoliceKills; +extern long TraderKills; +extern long PirateKills; +extern long SellPrice[]; +extern long BuyPrice[]; +extern long BuyingPrice[]; +extern long ShipPrice[]; +extern long MonsterHull; +extern unsigned long GalacticChartUpdateTicks; + +extern int CheatCounter; +extern int Days; +extern int CurForm; +extern int EncounterType; +extern int WarpSystem; +extern int NoClaim; +extern int SelectedShipType; +extern int LeaveEmpty; +extern int GalacticChartSystem; +extern int NewsSpecialEventCount; +extern int TrackedSystem; +extern int ChanceOfVeryRareEncounter; +extern int ChanceOfTradeInOrbit; +extern int Shortcut1; +extern int Shortcut2; +extern int Shortcut3; +extern int Shortcut4; +extern int ShortcutTarget[]; + +extern char MonsterStatus; +extern char DragonflyStatus; +extern char JaporiDiseaseStatus; +extern char JarekStatus; +extern char WildStatus; +extern char InvasionStatus; +extern char ExperimentStatus; +extern char FabricRipProbability; +extern char VeryRareEncounter; +extern char Difficulty; +extern char ReactorStatus; +extern char ScarabStatus; +extern char SBuf[]; +extern char SBuf2[]; +extern char NameCommander[]; +extern char Wormhole[]; +extern char* Shortcuts[]; +extern char* SolarSystemName[]; +extern char* SystemSize[]; +extern char* TechLevel[]; +extern char* Activity[]; +extern char* DifficultyLevel[]; +extern char* SpecialResources[]; +extern char* Status[]; +extern char* MercenaryName[]; + +extern Boolean MoonBought; +extern Boolean Clicks; +extern Boolean Raided; +extern Boolean Inspected; +extern Boolean AlwaysIgnoreTraders; +extern Boolean AlwaysIgnorePolice; +extern Boolean AlwaysIgnorePirates; +extern Boolean AlwaysIgnoreTradeInOrbit; +extern Boolean TribbleMessage; +extern Boolean AutoFuel; +extern Boolean AutoRepair; +extern Boolean Insurance; +extern Boolean EscapePod; +extern Boolean PriceDifferences; +extern Boolean ArtifactOnBoard; +extern Boolean APLscreen; +extern Boolean ReserveMoney; +extern Boolean AlwaysInfo; +extern Boolean TextualEncounters; +extern Boolean AutoAttack; +extern Boolean AutoFlee; +extern Boolean Continuous; +extern Boolean AttackIconStatus; +extern Boolean AttackFleeing; +extern Boolean PossibleToGoThroughRip; +extern Boolean UseHWButtons; +extern Boolean NewsAutoPay; +extern Boolean ShowTrackedRange; +extern Boolean JustLootedMarie; +extern Boolean ArrivedViaWormhole; +extern Boolean AlreadyPaidForNewspaper; +extern Boolean TrackAutoOff; +extern Boolean RemindLoans; +extern Boolean CanSuperWarp; +extern Boolean GameLoaded; +extern Boolean LitterWarning; +extern Boolean SharePreferences; +extern Boolean IdentifyStartup; +extern Boolean RectangularButtonsOn; + +extern SHIP Ship; +extern SHIP Opponent; +extern SHIP Dragonfly; +extern SHIP SpaceMonster; +extern SHIP Scarab; + +extern SOLARSYSTEM SolarSystem[]; +extern SHIPTYPE Shiptype[]; +extern SHIELD Shieldtype[]; +extern WEAPON Weapontype[]; +extern GADGET Gadgettype[]; +extern CREWMEMBER Mercenary[]; +extern POLITICS Politics[]; +extern POLICERECORD PoliceRecord[]; +extern TRADEITEM Tradeitem[]; +extern SPECIALEVENT SpecialEvent[]; +extern HIGHSCORE Hscores[]; +extern REPUTATION Reputation[]; + +extern Handle SystemBmp; +extern Handle CurrentSystemBmp; +extern Handle ShortRangeSystemBmp; +extern Handle WormholeBmp; +extern Handle SmallWormholeBmp; +extern Handle VisitedSystemBmp; +extern Handle CurrentVisitedSystemBmp; +extern Handle VisitedShortRangeSystemBmp; +extern Handle ShipBmp[]; +extern Handle DamagedShipBmp[]; +extern Handle ShieldedShipBmp[]; +extern Handle DamagedShieldedShipBmp[]; +extern Handle IconBmp[]; + +extern BitmapPtr ShipBmpPtr[]; +extern BitmapPtr SystemBmpPtr; +extern BitmapPtr CurrentSystemBmpPtr; +extern BitmapPtr ShortRangeSystemBmpPtr; +extern BitmapPtr WormholeBmpPtr; +extern BitmapPtr SmallWormholeBmpPtr; +extern BitmapPtr VisitedSystemBmpPtr; +extern BitmapPtr CurrentVisitedSystemBmpPtr; +extern BitmapPtr VisitedShortRangeSystemBmpPtr; +extern BitmapPtr DamagedShipBmpPtr[]; +extern BitmapPtr ShieldedShipBmpPtr[]; +extern BitmapPtr DamagedShieldedShipBmpPtr[]; +extern BitmapPtr IconBmpPtr[]; + +extern Handle NameH; +//extern DmOpenRef pmDB; + +extern DWord romVersion; diff --git a/Src/spacetrader.h b/Src/spacetrader.h new file mode 100644 index 0000000..bdeae6a --- /dev/null +++ b/Src/spacetrader.h @@ -0,0 +1,475 @@ +/*********************************************************************** + * + * SPACE TRADER 1.2.0 + * + * Spacetrader.h + * + * Copyright (C) 2000-2002 Pieter Spronck, All Rights Reserved + * + * Additional coding by Sam Anderson (rulez2@home.com) + * Additional coding by Samuel Goldstein (palm@fogbound.net) + * + * Some code of Matt Lee's Dope Wars program has been used. + * + * 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. + * + * You can contact the author at space_trader@hotmail.com + * + * For those who are familiar with the classic game Elite: many of the + * ideas in Space Trader are heavily inspired by Elite. + * + **********************************************************************/ +// +// Space Trader Main Include +// +#define appFileCreator 'STra' +#define appVersionNum 0x01 +#define appPrefID 0x00 +#define appPrefVersionNum 0x01 + +// Special Enables // Comment these out to disable code +#define _STRA_CHEAT_ // Cheat Enable +#define _STRA_SHIPYARDCREDITS_ // Display Trade Credits in Ship Yard +#define _INCLUDE_DEBUG_DIALOGS_ // Include code for displaying Debug Alerts + +// Add Ships, Weapons, Shields, and Gadgets that don't show up normally +#define EXTRAWEAPONS 1 // Number of weapons over standard +#define EXTRAGADGETS 1 // Number of Gadgets over standard +#define EXTRASHIELDS 1 // Number of Shields over standard +#define EXTRASHIPS 5 // Number of Ships over standard + +// Tradeable items +#define MAXTRADEITEM 10 // Number of items traded +#define MAXDIGITS 8 // Maximum amount of cash 99,999,999 +#define MAXPRICEDIGITS 5 // Maximum price 99,999. +#define MAXQTYDIGITS 3 // Maximum quantity 999 + +// Activity level of police, traders or pirates +#define MAXACTIVITY 8 +#define MAXSTATUS 8 + +// System status: normally this is uneventful, but sometimes a system has a +// special event occurring. This influences some prices. +#define UNEVENTFUL 0 +#define WAR 1 +#define PLAGUE 2 +#define DROUGHT 3 +#define BOREDOM 4 +#define COLD 5 +#define CROPFAILURE 6 +#define LACKOFWORKERS 7 + +// Difficulty levels +#define MAXDIFFICULTY 5 +#define BEGINNER 0 +#define EASY 1 +#define NORMAL 2 +#define HARD 3 +#define IMPOSSIBLE 4 + +// Crewmembers. The commander is always the crewmember with index 0. +// Zeethibal is always the last +#define MAXCREWMEMBER 31 + +// Extra Crewmembers who won't be found randomly +#define MAXSKILL 10 +#define NAMELEN 20 + +// Skills +#define PILOTSKILL 1 +#define FIGHTERSKILL 2 +#define TRADERSKILL 3 +#define ENGINEERSKILL 4 + +// Tradeitems +#define WATER 0 +#define FURS 1 +#define FOOD 2 +#define ORE 3 +#define GAMES 4 +#define FIREARMS 5 +#define MEDICINE 6 +#define MACHINERY 7 +#define NARCOTICS 8 +#define ROBOTS 9 + +// Ship types +#define MAXSHIPTYPE 10 +#define MAXRANGE 20 +#define MANTISTYPE MAXSHIPTYPE+2 +#define SCARABTYPE MAXSHIPTYPE+3 +#define BOTTLETYPE MAXSHIPTYPE+4 + +// Weapons +#define MAXWEAPONTYPE 3 +#define PULSELASERWEAPON 0 +#define PULSELASERPOWER 15 +#define BEAMLASERWEAPON 1 +#define BEAMLASERPOWER 25 +#define MILITARYLASERWEAPON 2 +#define MILITARYLASERPOWER 35 +#define MORGANLASERWEAPON 3 +#define MORGANLASERPOWER 85 // fixme! + +// Shields +#define MAXSHIELDTYPE 2 +#define ENERGYSHIELD 0 +#define ESHIELDPOWER 100 +#define REFLECTIVESHIELD 1 +#define RSHIELDPOWER 200 +#define LIGHTNINGSHIELD 2 +#define LSHIELDPOWER 350 + +// Hull Upgrade +#define UPGRADEDHULL 50 + +// Gadgets +#define MAXGADGETTYPE 5 +#define EXTRABAYS 0 +#define AUTOREPAIRSYSTEM 1 +#define NAVIGATINGSYSTEM 2 +#define TARGETINGSYSTEM 3 +#define CLOAKINGDEVICE 4 +#define FUELCOMPACTOR 5 // MAXGADGETTYPE + 1 + +// Skills +#define MAXSKILLTYPE 4 +#define SKILLBONUS 3 +#define CLOAKBONUS 2 + +// Police Action +#define POLICE 0 +#define POLICEINSPECTION 0 // Police asks to submit for inspection +#define POLICEIGNORE 1 // Police just ignores you +#define POLICEATTACK 2 // Police attacks you (sometimes on sight) +#define POLICEFLEE 3 // Police is fleeing +#define MAXPOLICE 9 + +// Pirate Actions +#define PIRATE 10 +#define PIRATEATTACK 10 // Pirate attacks +#define PIRATEFLEE 11 // Pirate flees +#define PIRATEIGNORE 12 // Pirate ignores you (because of cloak) +#define PIRATESURRENDER 13 // Pirate surrenders +#define MAXPIRATE 19 + +// Trader Actions +#define TRADER 20 +#define TRADERIGNORE 20 // Trader passes +#define TRADERFLEE 21 // Trader flees +#define TRADERATTACK 22 // Trader is attacking (after being provoked) +#define TRADERSURRENDER 23 // Trader surrenders +#define TRADERSELL 24 // Trader will sell products in orbit +#define TRADERBUY 25 // Trader will buy products in orbit +#define TRADERNOTRADE 26 // Player has declined to transact with Trader +#define MAXTRADER 29 + +// Space Monster Actions +#define SPACEMONSTERATTACK 30 +#define SPACEMONSTERIGNORE 31 +#define MAXSPACEMONSTER 39 + +// Dragonfly Actions +#define DRAGONFLYATTACK 40 +#define DRAGONFLYIGNORE 41 +#define MAXDRAGONFLY 49 + +#define MANTIS 50 + +// Scarab Actions +#define SCARABATTACK 60 +#define SCARABIGNORE 61 +#define MAXSCARAB 69 + +// Famous Captain +#define FAMOUSCAPTAIN 70 +#define FAMOUSCAPATTACK 71 +#define CAPTAINAHABENCOUNTER 72 +#define CAPTAINCONRADENCOUNTER 73 +#define CAPTAINHUIEENCOUNTER 74 +#define MAXFAMOUSCAPTAIN 79 + +// Other Special Encounters +#define MARIECELESTEENCOUNTER 80 +#define BOTTLEOLDENCOUNTER 81 +#define BOTTLEGOODENCOUNTER 82 +#define POSTMARIEPOLICEENCOUNTER 83 + + +// The commander's ship +#define MAXWEAPON 3 +#define MAXSHIELD 3 +#define MAXGADGET 3 +#define MAXCREW 3 +#define MAXTRIBBLES 100000 + +// Solar systems +#define MAXSOLARSYSTEM 120 +#define ACAMARSYSTEM 0 +#define BARATASSYSTEM 6 +#define DALEDSYSTEM 17 +#define DEVIDIASYSTEM 22 +#define GEMULONSYSTEM 32 +#define JAPORISYSTEM 41 +#define KRAVATSYSTEM 50 +#define MELINASYSTEM 59 +#define NIXSYSTEM 67 +#define OGSYSTEM 70 +#define REGULASSYSTEM 82 +#define SOLSYSTEM 92 +#define UTOPIASYSTEM 109 +#define ZALKONSYSTEM 118 + +// Special events +#define COSTMOON 500000L +#define MAXSPECIALEVENT 37 +#define ENDFIXED 7 +#define MAXTEXT 9 +#define DRAGONFLYDESTROYED 0 +#define FLYBARATAS 1 +#define FLYMELINA 2 +#define FLYREGULAS 3 +#define MONSTERKILLED 4 +#define MEDICINEDELIVERY 5 +#define MOONBOUGHT 6 +// ----- fixed locations precede +#define MOONFORSALE 7 +#define SKILLINCREASE 8 +#define TRIBBLE 9 +#define ERASERECORD 10 +#define BUYTRIBBLE 11 +#define SPACEMONSTER 12 +#define DRAGONFLY 13 +#define CARGOFORSALE 14 +#define INSTALLLIGHTNINGSHIELD 15 +#define JAPORIDISEASE 16 +#define LOTTERYWINNER 17 +#define ARTIFACTDELIVERY 18 +#define ALIENARTIFACT 19 +#define AMBASSADORJAREK 20 +#define ALIENINVASION 21 +#define GEMULONINVADED 22 +#define GETFUELCOMPACTOR 23 +#define EXPERIMENT 24 +#define TRANSPORTWILD 25 +#define GETREACTOR 26 +#define GETSPECIALLASER 27 +#define SCARAB 28 +#define GETHULLUPGRADED 29 +// ------ fixed locations follow +#define SCARABDESTROYED 30 +#define REACTORDELIVERED 31 +#define JAREKGETSOUT 32 +#define GEMULONRESCUED 33 +#define EXPERIMENTSTOPPED 34 +#define EXPERIMENTNOTSTOPPED 35 +#define WILDGETSOUT 36 + +// Max Number of Tribble Buttons +#define TRIBBLESONSCREEN 31 + +// Other special events (Encounters) +// First is probability in 1000 that one could happen at all: +#define CHANCEOFVERYRAREENCOUNTER 5 +#define MAXVERYRAREENCOUNTER 6 +#define MARIECELESTE 0 +#define CAPTAINAHAB 1 +#define CAPTAINCONRAD 2 +#define CAPTAINHUIE 3 +#define BOTTLEOLD 4 +#define BOTTLEGOOD 5 +// Already done this encounter? +#define ALREADYMARIE 1 +#define ALREADYAHAB 2 +#define ALREADYCONRAD 4 +#define ALREADYHUIE 8 +#define ALREADYBOTTLEOLD 16 +#define ALREADYBOTTLEGOOD 32 + +// Propability in 1000 that a trader will make offer while in orbit +#define CHANCEOFTRADEINORBIT 100 + +// Political systems (governments) +#define MAXPOLITICS 17 +#define MAXSTRENGTH 8 +#define ANARCHY 0 + +// Tech levels. +#define MAXTECHLEVEL 8 + + +// Cargo Dumping Codes. These identify the operation so we can reuse +// some of the Sell Cargo code. +// SELL is obvious, Dump is when in dock, Jettison is when in space. +#define SELLCARGO 1 +#define DUMPCARGO 2 +#define JETTISONCARGO 3 + +// System sizes (influences the number of goods available) +#define MAXSIZE 5 + +// Newspaper Defines +// Newspaper Mastheads and Headlines have been moved into String Resources, where +// they belong. Mastheads starting with codes will have the codes replaced as follows: +// + -> System Name +// * -> The System Name +#define MAXMASTHEADS 3 // number of newspaper names per Political situation +#define MAXSTORIES 4 // number of canned stories per Political situation +#define NEWSINDENT1 5 // pixels to indent 1st line of news story +#define NEWSINDENT2 5 // pixels to indent 2nd line of news story + +#define STORYPROBABILITY 50/MAXTECHLEVEL // probability of a story being shown +#define MAXSPECIALNEWSEVENTS 5 // maximum number of special news events to keep for a system + +// News Events that don't exactly match special events +#define WILDARRESTED 90 +#define CAUGHTLITTERING 91 +#define EXPERIMENTPERFORMED 92 +#define ARRIVALVIASINGULARITY 93 +#define CAPTAINHUIEATTACKED 100 +#define CAPTAINCONRADATTACKED 101 +#define CAPTAINAHABATTACKED 102 +#define CAPTAINHUIEDESTROYED 110 +#define CAPTAINCONRADDESTROYED 111 +#define CAPTAINAHABDESTROYED 112 + + +// Police record +#define MAXPOLICERECORD 10 +#define ATTACKPOLICESCORE -3 +#define KILLPOLICESCORE -6 +#define CAUGHTWITHWILDSCORE -4 +#define ATTACKTRADERSCORE -2 +#define PLUNDERTRADERSCORE -2 +#define KILLTRADERSCORE -4 +#define ATTACKPIRATESCORE 0 +#define KILLPIRATESCORE 1 +#define PLUNDERPIRATESCORE -1 +#define TRAFFICKING -1 +#define FLEEFROMINSPECTION -2 +#define TAKEMARIENARCOTICS -4 + +// Police Record Score +#define PSYCHOPATHSCORE -70 +#define VILLAINSCORE -30 +#define CRIMINALSCORE -10 +#define DUBIOUSSCORE -5 +#define CLEANSCORE 0 +#define LAWFULSCORE 5 +#define TRUSTEDSCORE 10 +#define HELPERSCORE 25 +#define HEROSCORE 75 + +// Reputation (depends on number of kills) +#define MAXREPUTATION 9 + +#define HARMLESSREP 0 +#define MOSTLYHARMLESSREP 10 +#define POORREP 20 +#define AVERAGESCORE 40 +#define ABOVEAVERAGESCORE 80 +#define COMPETENTREP 150 +#define DANGEROUSREP 300 +#define DEADLYREP 600 +#define ELITESCORE 1500 + + +// Debt Control +#define DEBTWARNING 75000 +#define DEBTTOOLARGE 100000 + +// Resources. Some systems have special resources, which influences some prices. +#define MAXRESOURCES 13 + +#define NOSPECIALRESOURCES 0 +#define MINERALRICH 1 +#define MINERALPOOR 2 +#define DESERT 3 +#define LOTSOFWATER 4 +#define RICHSOIL 5 +#define POORSOIL 6 +#define RICHFAUNA 7 +#define LIFELESS 8 +#define WEIRDMUSHROOMS 9 +#define LOTSOFHERBS 10 +#define ARTISTIC 11 +#define WARLIKE 12 + +// Wormholes +#define MAXWORMHOLE 6 + +#define GALAXYWIDTH 150 +#define GALAXYHEIGHT 110 +#define SHORTRANGEWIDTH 140 +#define SHORTRANGEHEIGHT 140 +#define SHORTRANGEBOUNDSX 10 +#define BOUNDSX 5 +#define BOUNDSY 20 +#define MINDISTANCE 6 +#define CLOSEDISTANCE 13 +#define WORMHOLEDISTANCE 3 +#define EXTRAERASE 3 +// (There are new functions for crunching down booleans and +// nibbles, which gain us a little room...) +#define MAXFORFUTUREUSE 96 + +// this is in percentage, and will decrease by one every day. +#define FABRICRIPINITIALPROBABILITY 25 + +#define MAXHIGHSCORE 3 +#define KILLED 0 +#define RETIRED 1 +#define MOON 2 + +// size of a UInt16 +#define MAX_WORD 65535 + +// these have been added to avoid tracking down the math library. +#define min( a, b ) ( (a) <= (b) ? (a) : (b) ) +#define max( a, b ) ( (a) >= (b) ? (a) : (b) ) + + +#define GetRandom( a ) (SysRandom( 0 )%(a)) +#define TOLOWER( a ) ((a) >= 'A' && (a) <= 'Z' ? (a) - 'A' + 'a' : (a)) +#define ABS( a ) ((a) < 0 ? (-(a)) : (a)) +#define SQR( a ) ((a) * (a)) +#define COMMANDER Mercenary[0] +#define CURSYSTEM SolarSystem[COMMANDER.CurSystem] +#define BASEWEAPONPRICE( a ) (BasePrice( Weapontype[a].TechLevel, Weapontype[a].Price )) +#define BASESHIELDPRICE( a ) (BasePrice( Shieldtype[a].TechLevel, Shieldtype[a].Price )) +#define BASEGADGETPRICE( a ) (BasePrice( Gadgettype[a].TechLevel, Gadgettype[a].Price )) +#define BASESHIPPRICE( a ) (((Shiptype[a].Price * (100 - TraderSkill( &Ship ))) / 100) /* * (Difficulty < 3 ? 1 : (Difficulty + 3)) / (Difficulty < 3 ? 1 : 5)*/) +#define WEAPONSELLPRICE( a ) (BaseSellPrice( Ship.Weapon[a], Weapontype[Ship.Weapon[a]].Price )) +#define SHIELDSELLPRICE( a ) (BaseSellPrice( Ship.Shield[a], Shieldtype[Ship.Shield[a]].Price )) +#define GADGETSELLPRICE( a ) (BaseSellPrice( Ship.Gadget[a], Gadgettype[Ship.Gadget[a]].Price )) +#define MERCENARYHIREPRICE( a ) (a < 0 || (a >= MAXCREWMEMBER && WildStatus == 2) ? 0 : ((Mercenary[a].Pilot + Mercenary[a].Fighter + Mercenary[a].Trader + Mercenary[a].Engineer) * 3)) +#define ENCOUNTERPOLICE( a ) ((a) >= POLICE && (a) <= MAXPOLICE) +#define ENCOUNTERPIRATE( a ) ((a) >= PIRATE && (a) <= MAXPIRATE) +#define ENCOUNTERTRADER( a ) ((a) >= TRADER && (a) <= MAXTRADER) +#define ENCOUNTERMONSTER( a ) ((a) >= SPACEMONSTERATTACK && (a) <= MAXSPACEMONSTER) +#define ENCOUNTERDRAGONFLY( a ) ((a) >= DRAGONFLYATTACK && (a) <= MAXDRAGONFLY) +#define ENCOUNTERSCARAB( a ) ((a) >= SCARABATTACK && (a) <= MAXSCARAB) +#define ENCOUNTERFAMOUS( a ) ((a) >= FAMOUSCAPTAIN && (a) <= MAXFAMOUSCAPTAIN) +#define STRENGTHPOLICE( a ) (PoliceRecordScore < PSYCHOPATHSCORE ? 3 * Politics[SolarSystem[a].Politics].StrengthPolice : (PoliceRecordScore < VILLAINSCORE ? 2 * Politics[SolarSystem[a].Politics].StrengthPolice : Politics[SolarSystem[a].Politics].StrengthPolice)) +#define STARTCOUNTDOWN (3 + Difficulty) + +#define BELOW50 (romVersion < sysMakeROMVersion( 5, 0, 0, sysROMStageRelease, 0 )) + +#define __SPACETRADER_INC__ + +// Always include DataTypes after all maximum definitions have occured. + +#include "DataTypes.h" // Structure Definitions +#include "Prototype.h" // Function Prototypes